aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSascha Sommer <saschasommer@freenet.de>2012-01-08 14:54:28 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-01-10 19:54:03 -0500
commit1020d13d50d0a5bfcfc8a0a6826ed221cdf8a775 (patch)
treea62626446630bcd72bbf5e920b95080a84aa31b3 /drivers
parentca80cf60489508792e97a7703ed35756f4d62943 (diff)
[media] em28xx: increase maxwidth for em2800
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c14
-rw-r--r--drivers/media/video/em28xx/em28xx.h2
2 files changed, 14 insertions, 2 deletions
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 9b4557a2f6d0..613300b51a9e 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -1070,6 +1070,10 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
1070 /* the em2800 can only scale down to 50% */ 1070 /* the em2800 can only scale down to 50% */
1071 height = height > (3 * maxh / 4) ? maxh : maxh / 2; 1071 height = height > (3 * maxh / 4) ? maxh : maxh / 2;
1072 width = width > (3 * maxw / 4) ? maxw : maxw / 2; 1072 width = width > (3 * maxw / 4) ? maxw : maxw / 2;
1073 /* MaxPacketSize for em2800 is too small to capture at full resolution
1074 * use half of maxw as the scaler can only scale to 50% */
1075 if (width == maxw && height == maxh)
1076 width /= 2;
1073 } else { 1077 } else {
1074 /* width must even because of the YUYV format 1078 /* width must even because of the YUYV format
1075 height must be even because of interlacing */ 1079 height must be even because of interlacing */
@@ -2503,6 +2507,7 @@ int em28xx_register_analog_devices(struct em28xx *dev)
2503{ 2507{
2504 u8 val; 2508 u8 val;
2505 int ret; 2509 int ret;
2510 unsigned int maxw;
2506 2511
2507 printk(KERN_INFO "%s: v4l2 driver version %s\n", 2512 printk(KERN_INFO "%s: v4l2 driver version %s\n",
2508 dev->name, EM28XX_VERSION); 2513 dev->name, EM28XX_VERSION);
@@ -2515,8 +2520,15 @@ int em28xx_register_analog_devices(struct em28xx *dev)
2515 2520
2516 /* Analog specific initialization */ 2521 /* Analog specific initialization */
2517 dev->format = &format[0]; 2522 dev->format = &format[0];
2523
2524 maxw = norm_maxw(dev);
2525 /* MaxPacketSize for em2800 is too small to capture at full resolution
2526 * use half of maxw as the scaler can only scale to 50% */
2527 if (dev->board.is_em2800)
2528 maxw /= 2;
2529
2518 em28xx_set_video_format(dev, format[0].fourcc, 2530 em28xx_set_video_format(dev, format[0].fourcc,
2519 norm_maxw(dev), norm_maxh(dev)); 2531 maxw, norm_maxh(dev));
2520 2532
2521 video_mux(dev, dev->ctl_input); 2533 video_mux(dev, dev->ctl_input);
2522 2534
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h
index 7c3ebe2fcce5..22e252bcc41e 100644
--- a/drivers/media/video/em28xx/em28xx.h
+++ b/drivers/media/video/em28xx/em28xx.h
@@ -831,7 +831,7 @@ static inline unsigned int norm_maxw(struct em28xx *dev)
831 if (dev->board.is_webcam) 831 if (dev->board.is_webcam)
832 return dev->sensor_xres; 832 return dev->sensor_xres;
833 833
834 if (dev->board.max_range_640_480 || dev->board.is_em2800) 834 if (dev->board.max_range_640_480)
835 return 640; 835 return 640;
836 836
837 return 720; 837 return 720;