aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2012-05-10 11:13:16 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-05-14 08:45:27 -0400
commit6a6c70b8f26e1a59fa884e87b304ac50d4214602 (patch)
tree691fcb6a498f67a7d208586bb0ce0b21842720c0 /drivers/media/video/gspca
parent42f85d0a9612b559dc3110cc0d468050ac22cf77 (diff)
[media] gspca_pac7311: Remove vflip control
Enabling vflip leads to a much better image, with vflip disabled the image looks washed out as if there is a too high brightness setting. Since we don't know how to lower the brightness setting when not vflipping, simply always vflip and tell userspace to flip the image back, resulting in a much better (less washed out) image. Since the image is now no longer too bright, also modify the luminance level the auto-gain algorithm aims for. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca')
-rw-r--r--drivers/media/video/gspca/pac7311.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/media/video/gspca/pac7311.c b/drivers/media/video/gspca/pac7311.c
index 910d881d3694..2cb7d95f7be7 100644
--- a/drivers/media/video/gspca/pac7311.c
+++ b/drivers/media/video/gspca/pac7311.c
@@ -50,6 +50,8 @@
50 * 0x0f Master gain 1-245, low value = high gain 50 * 0x0f Master gain 1-245, low value = high gain
51 * 0x10 Another gain 0-15, limited influence (1-2x gain I guess) 51 * 0x10 Another gain 0-15, limited influence (1-2x gain I guess)
52 * 0x21 Bitfield: 0-1 unused, 2-3 vflip/hflip, 4-5 unknown, 6-7 unused 52 * 0x21 Bitfield: 0-1 unused, 2-3 vflip/hflip, 4-5 unknown, 6-7 unused
53 * Note setting vflip disabled leads to a much lower image quality,
54 * so we always vflip, and tell userspace to flip it back
53 * 0x27 Seems to toggle various gains on / off, Setting bit 7 seems to 55 * 0x27 Seems to toggle various gains on / off, Setting bit 7 seems to
54 * completely disable the analog amplification block. Set to 0x68 56 * completely disable the analog amplification block. Set to 0x68
55 * for max gain, 0x14 for minimal gain. 57 * for max gain, 0x14 for minimal gain.
@@ -75,10 +77,7 @@ struct sd {
75 struct gspca_dev gspca_dev; /* !! must be the first item */ 77 struct gspca_dev gspca_dev; /* !! must be the first item */
76 78
77 struct v4l2_ctrl *contrast; 79 struct v4l2_ctrl *contrast;
78 struct { /* flip cluster */ 80 struct v4l2_ctrl *hflip;
79 struct v4l2_ctrl *hflip;
80 struct v4l2_ctrl *vflip;
81 };
82 81
83 u8 sof_read; 82 u8 sof_read;
84 u8 autogain_ignore_frames; 83 u8 autogain_ignore_frames;
@@ -292,6 +291,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
292 291
293 cam->cam_mode = vga_mode; 292 cam->cam_mode = vga_mode;
294 cam->nmodes = ARRAY_SIZE(vga_mode); 293 cam->nmodes = ARRAY_SIZE(vga_mode);
294 cam->input_flags = V4L2_IN_ST_VFLIP;
295 295
296 return 0; 296 return 0;
297} 297}
@@ -399,7 +399,7 @@ static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
399 setgain(gspca_dev, gspca_dev->gain->val); 399 setgain(gspca_dev, gspca_dev->gain->val);
400 break; 400 break;
401 case V4L2_CID_HFLIP: 401 case V4L2_CID_HFLIP:
402 sethvflip(gspca_dev, sd->hflip->val, sd->vflip->val); 402 sethvflip(gspca_dev, sd->hflip->val, 1);
403 break; 403 break;
404 default: 404 default:
405 return -EINVAL; 405 return -EINVAL;
@@ -432,8 +432,6 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
432 PAC7311_GAIN_DEFAULT); 432 PAC7311_GAIN_DEFAULT);
433 sd->hflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, 433 sd->hflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
434 V4L2_CID_HFLIP, 0, 1, 1, 0); 434 V4L2_CID_HFLIP, 0, 1, 1, 0);
435 sd->vflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
436 V4L2_CID_VFLIP, 0, 1, 1, 0);
437 435
438 if (hdl->error) { 436 if (hdl->error) {
439 pr_err("Could not initialize controls\n"); 437 pr_err("Could not initialize controls\n");
@@ -441,7 +439,6 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
441 } 439 }
442 440
443 v4l2_ctrl_auto_cluster(3, &gspca_dev->autogain, 0, false); 441 v4l2_ctrl_auto_cluster(3, &gspca_dev->autogain, 0, false);
444 v4l2_ctrl_cluster(2, &sd->hflip);
445 return 0; 442 return 0;
446} 443}
447 444
@@ -457,8 +454,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
457 setcontrast(gspca_dev, v4l2_ctrl_g_ctrl(sd->contrast)); 454 setcontrast(gspca_dev, v4l2_ctrl_g_ctrl(sd->contrast));
458 setgain(gspca_dev, v4l2_ctrl_g_ctrl(gspca_dev->gain)); 455 setgain(gspca_dev, v4l2_ctrl_g_ctrl(gspca_dev->gain));
459 setexposure(gspca_dev, v4l2_ctrl_g_ctrl(gspca_dev->exposure)); 456 setexposure(gspca_dev, v4l2_ctrl_g_ctrl(gspca_dev->exposure));
460 sethvflip(gspca_dev, v4l2_ctrl_g_ctrl(sd->hflip), 457 sethvflip(gspca_dev, v4l2_ctrl_g_ctrl(sd->hflip), 1);
461 v4l2_ctrl_g_ctrl(sd->vflip));
462 458
463 /* set correct resolution */ 459 /* set correct resolution */
464 switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) { 460 switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) {
@@ -513,7 +509,7 @@ static void do_autogain(struct gspca_dev *gspca_dev)
513 if (avg_lum == -1) 509 if (avg_lum == -1)
514 return; 510 return;
515 511
516 desired_lum = 200; 512 desired_lum = 170;
517 deadzone = 20; 513 deadzone = 20;
518 514
519 if (sd->autogain_ignore_frames > 0) 515 if (sd->autogain_ignore_frames > 0)