aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2012-01-01 14:03:37 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-01-06 06:08:55 -0500
commitd80dd5d036147e00a27e3c649aec64bf9e572e9b (patch)
tree46c68026a045d8be9978666991772a23241cb826 /drivers/media
parenteb3fb7c9633f79077c7c650efe0edec1840926da (diff)
[media] gscpa - sn9c20x: Add sd_isoc_init ensuring enough bw when i420 fmt
When using the SN9C20X_I420 fmt the sn9c20x needs more bandwidth than our regular bandwidth calculations reserve. This patch adds a sd_isoc_init function, which forces the use of a specific altsetting when using the SN9C20X_I420 fmt. This fixes the bottom 10-30% of the image getting corrupted when using the SN9C20X_I420 fmt (which is the default fmt). Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean-François Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/gspca/sn9c20x.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c
index 7350718c613a..b5fca9166745 100644
--- a/drivers/media/video/gspca/sn9c20x.c
+++ b/drivers/media/video/gspca/sn9c20x.c
@@ -2234,6 +2234,42 @@ static void configure_sensor_output(struct gspca_dev *gspca_dev, int mode)
2234 } 2234 }
2235} 2235}
2236 2236
2237static int sd_isoc_init(struct gspca_dev *gspca_dev)
2238{
2239 struct usb_interface *intf;
2240 u32 flags = gspca_dev->cam.cam_mode[(int)gspca_dev->curr_mode].priv;
2241
2242 /*
2243 * When using the SN9C20X_I420 fmt the sn9c20x needs more bandwidth
2244 * than our regular bandwidth calculations reserve, so we force the
2245 * use of a specific altsetting when using the SN9C20X_I420 fmt.
2246 */
2247 if (!(flags & (MODE_RAW | MODE_JPEG))) {
2248 intf = usb_ifnum_to_if(gspca_dev->dev, gspca_dev->iface);
2249
2250 if (intf->num_altsetting != 9) {
2251 pr_warn("sn9c20x camera with unknown number of alt "
2252 "settings (%d), please report!\n",
2253 intf->num_altsetting);
2254 gspca_dev->alt = intf->num_altsetting;
2255 return 0;
2256 }
2257
2258 switch (gspca_dev->width) {
2259 case 160: /* 160x120 */
2260 gspca_dev->alt = 2;
2261 break;
2262 case 320: /* 320x240 */
2263 gspca_dev->alt = 6;
2264 break;
2265 default: /* >= 640x480 */
2266 gspca_dev->alt = 9;
2267 }
2268 }
2269
2270 return 0;
2271}
2272
2237#define HW_WIN(mode, hstart, vstart) \ 2273#define HW_WIN(mode, hstart, vstart) \
2238((const u8 []){hstart, 0, vstart, 0, \ 2274((const u8 []){hstart, 0, vstart, 0, \
2239(mode & MODE_SXGA ? 1280 >> 4 : 640 >> 4), \ 2275(mode & MODE_SXGA ? 1280 >> 4 : 640 >> 4), \
@@ -2474,6 +2510,7 @@ static const struct sd_desc sd_desc = {
2474 .nctrls = ARRAY_SIZE(sd_ctrls), 2510 .nctrls = ARRAY_SIZE(sd_ctrls),
2475 .config = sd_config, 2511 .config = sd_config,
2476 .init = sd_init, 2512 .init = sd_init,
2513 .isoc_init = sd_isoc_init,
2477 .start = sd_start, 2514 .start = sd_start,
2478 .stopN = sd_stopN, 2515 .stopN = sd_stopN,
2479 .pkt_scan = sd_pkt_scan, 2516 .pkt_scan = sd_pkt_scan,