[media] uvcvideo: Set bandwidth to at least 1024 with the FIX_BANDWIDTH quirk
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Sun, 3 Oct 2010 20:40:29 +0000 (17:40 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 21 Oct 2010 03:18:19 +0000 (01:18 -0200)
The bandwidth estimate computed with the FIX_BANDIWDTH quirk is too low
for many cameras. Don't use maximum packet sizes lower than 1024 bytes
to try and work around the problem. According to measurements done on
two different camera models, the value is high enough to get most
resolutions working while not preventing two simultaneous VGA streams at
15 fps.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/uvc/uvc_video.c

index ee5e2338b4177c0eeda832290b8111ab3075247e..5a2022c0152829e232b1201e534dd82508523c7d 100644 (file)
@@ -138,6 +138,15 @@ static void uvc_fixup_video_ctrl(struct uvc_streaming *stream,
                        bandwidth /= 8;
                bandwidth += 12;
 
+               /* The bandwidth estimate is too low for many cameras. Don't use
+                * maximum packet sizes lower than 1024 bytes to try and work
+                * around the problem. According to measurements done on two
+                * different camera models, the value is high enough to get most
+                * resolutions working while not preventing two simultaneous
+                * VGA streams at 15 fps.
+                */
+               bandwidth = max_t(u32, bandwidth, 1024);
+
                ctrl->dwMaxPayloadTransferSize = bandwidth;
        }
 }