diff options
author | Hans de Goede <hdegoede@redhat.com> | 2012-04-27 11:56:59 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-05-07 15:15:21 -0400 |
commit | 282ddfbcab456eb09429b3ca3c1cc5dde5a65358 (patch) | |
tree | c5ea87d2b0dae23c151f3df02b7c60b44f017225 /drivers | |
parent | 4b8ceb6c1539d776de8aec587902d8e0e2705390 (diff) |
[media] gspca_pac7311: Properly set the compression balance
Before this patch sometimes the camera would run out of bandwidth when
running at 640x480@30.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/gspca/pac7311.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/drivers/media/video/gspca/pac7311.c b/drivers/media/video/gspca/pac7311.c index 54b4ab68f0b5..5ccf0b41ffc5 100644 --- a/drivers/media/video/gspca/pac7311.c +++ b/drivers/media/video/gspca/pac7311.c | |||
@@ -29,7 +29,18 @@ | |||
29 | * 0x1b Auto white balance related, bit 0 is AWB enable (inverted) | 29 | * 0x1b Auto white balance related, bit 0 is AWB enable (inverted) |
30 | * bits 345 seem to toggle per color gains on/off (inverted) | 30 | * bits 345 seem to toggle per color gains on/off (inverted) |
31 | * 0x78 Global control, bit 6 controls the LED (inverted) | 31 | * 0x78 Global control, bit 6 controls the LED (inverted) |
32 | * 0x80 JPEG compression ratio ? Best not touched | 32 | * 0x80 Compression balance, interesting settings: |
33 | * 0x01 Use this to allow the camera to switch to higher compr. | ||
34 | * on the fly. Needed to stay within bandwidth @ 640x480@30 | ||
35 | * 0x1c From usb captures under Windows for 640x480 | ||
36 | * 0x2a Values >= this switch the camera to a lower compression, | ||
37 | * using the same table for both luminance and chrominance. | ||
38 | * This gives a sharper picture. Usable only at 640x480@ < | ||
39 | * 15 fps or 320x240 / 160x120. Note currently the driver | ||
40 | * does not use this as the quality gain is small and the | ||
41 | * generated JPG-s are only understood by v4l-utils >= 0.8.9 | ||
42 | * 0x3f From usb captures under Windows for 320x240 | ||
43 | * 0x69 From usb captures under Windows for 160x120 | ||
33 | * | 44 | * |
34 | * Register page 4: | 45 | * Register page 4: |
35 | * | 46 | * |
@@ -408,12 +419,21 @@ static void setexposure(struct gspca_dev *gspca_dev) | |||
408 | * 640x480 mode and page 4 reg 2 <= 3 then it must be 9 | 419 | * 640x480 mode and page 4 reg 2 <= 3 then it must be 9 |
409 | */ | 420 | */ |
410 | reg_w(gspca_dev, 0xff, 0x01); | 421 | reg_w(gspca_dev, 0xff, 0x01); |
411 | if (gspca_dev->cam.cam_mode[(int)gspca_dev->curr_mode].priv && | 422 | if (gspca_dev->width != 640 && sd->ctrls[EXPOSURE].val <= 3) |
412 | sd->ctrls[EXPOSURE].val <= 3) { | ||
413 | reg_w(gspca_dev, 0x08, 0x09); | 423 | reg_w(gspca_dev, 0x08, 0x09); |
414 | } else { | 424 | else |
415 | reg_w(gspca_dev, 0x08, 0x08); | 425 | reg_w(gspca_dev, 0x08, 0x08); |
416 | } | 426 | |
427 | /* | ||
428 | * Page1 register 80 sets the compression balance, normally we | ||
429 | * want / use 0x1c, but for 640x480@30fps we must allow the | ||
430 | * camera to use higher compression or we may run out of | ||
431 | * bandwidth. | ||
432 | */ | ||
433 | if (gspca_dev->width == 640 && sd->ctrls[EXPOSURE].val == 2) | ||
434 | reg_w(gspca_dev, 0x80, 0x01); | ||
435 | else | ||
436 | reg_w(gspca_dev, 0x80, 0x1c); | ||
417 | 437 | ||
418 | /* load registers to sensor (Bit 0, auto clear) */ | 438 | /* load registers to sensor (Bit 0, auto clear) */ |
419 | reg_w(gspca_dev, 0x11, 0x01); | 439 | reg_w(gspca_dev, 0x11, 0x01); |