]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
[media] em28xx: increase maxwidth for em2800
authorSascha Sommer <saschasommer@freenet.de>
Sun, 8 Jan 2012 19:54:28 +0000 (16:54 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 11 Jan 2012 00:54:03 +0000 (22:54 -0200)
The MaxPacketSize for em2800 based devices is too small to capture at full resolution.
Therefore scale down when the maximum frame size is selected.
The previous workaround that simply reduced the X resolution cannot be used
because it crops a part of the input as
the em2800 can only scale down with a factor of 0.5.

reverts commits 1ca31892e and fb3de0398ab.

[mchehab@redhat.com: Fix CodingStyle]
Signed-off-by: Sascha Sommer <saschasommer@freenet.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/em28xx/em28xx-video.c
drivers/media/video/em28xx/em28xx.h

index 9b4557a2f6d02858cb0c6a29a4295fac966cd317..613300b51a9e82012f17c664ad7ae2d90ca70a03 100644 (file)
@@ -1070,6 +1070,10 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
                /* the em2800 can only scale down to 50% */
                height = height > (3 * maxh / 4) ? maxh : maxh / 2;
                width = width > (3 * maxw / 4) ? maxw : maxw / 2;
+                /* MaxPacketSize for em2800 is too small to capture at full resolution
+                 * use half of maxw as the scaler can only scale to 50% */
+               if (width == maxw && height == maxh)
+                       width /= 2;
        } else {
                /* width must even because of the YUYV format
                   height must be even because of interlacing */
@@ -2503,6 +2507,7 @@ int em28xx_register_analog_devices(struct em28xx *dev)
 {
       u8 val;
        int ret;
+       unsigned int maxw;
 
        printk(KERN_INFO "%s: v4l2 driver version %s\n",
                dev->name, EM28XX_VERSION);
@@ -2515,8 +2520,15 @@ int em28xx_register_analog_devices(struct em28xx *dev)
 
        /* Analog specific initialization */
        dev->format = &format[0];
+
+       maxw = norm_maxw(dev);
+        /* MaxPacketSize for em2800 is too small to capture at full resolution
+         * use half of maxw as the scaler can only scale to 50% */
+        if (dev->board.is_em2800)
+            maxw /= 2;
+
        em28xx_set_video_format(dev, format[0].fourcc,
-                               norm_maxw(dev), norm_maxh(dev));
+                               maxw, norm_maxh(dev));
 
        video_mux(dev, dev->ctl_input);
 
index 7c3ebe2fcce5b66cf9187fa51d42fc81c4cb9daa..22e252bcc41e2fffc0ad5ef9bcd08fca24b82175 100644 (file)
@@ -831,7 +831,7 @@ static inline unsigned int norm_maxw(struct em28xx *dev)
        if (dev->board.is_webcam)
                return dev->sensor_xres;
 
-       if (dev->board.max_range_640_480 || dev->board.is_em2800)
+       if (dev->board.max_range_640_480)
                return 640;
 
        return 720;