aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorFrank Schäfer <fschaefer.oss@googlemail.com>2012-09-09 14:02:21 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-09-13 16:53:57 -0400
commitb1a19c0165573b169eceb690df7a72bf1ffa47dc (patch)
tree7a6ee71e05bb0b8b9034b0e2719ee4d08a28792a /drivers/media
parentdb43b9ca2f101d0945d043fa7d5ecd8f2da17fef (diff)
[media] gspca_pac7302: add sharpness control
The Windows driver uses page 0 register 0xb6 for sharpness adjustment. Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/usb/gspca/pac7302.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/drivers/media/usb/gspca/pac7302.c b/drivers/media/usb/gspca/pac7302.c
index eb3c90e4a65..8c2961326a6 100644
--- a/drivers/media/usb/gspca/pac7302.c
+++ b/drivers/media/usb/gspca/pac7302.c
@@ -26,6 +26,11 @@
26/* 26/*
27 * Some documentation about various registers as determined by trial and error. 27 * Some documentation about various registers as determined by trial and error.
28 * 28 *
29 * Register page 0:
30 *
31 * Address Description
32 * 0xb6 Sharpness control (bits 0-4)
33 *
29 * Register page 1: 34 * Register page 1:
30 * 35 *
31 * Address Description 36 * Address Description
@@ -66,6 +71,7 @@
66 * -----+------------+--------------------------------------------------- 71 * -----+------------+---------------------------------------------------
67 * 0 | 0x0f..0x20 | setcolors() 72 * 0 | 0x0f..0x20 | setcolors()
68 * 0 | 0xa2..0xab | setbrightcont() 73 * 0 | 0xa2..0xab | setbrightcont()
74 * 0 | 0xb6 | setsharpness()
69 * 0 | 0xc5 | setredbalance() 75 * 0 | 0xc5 | setredbalance()
70 * 0 | 0xc6 | setwhitebalance() 76 * 0 | 0xc6 | setwhitebalance()
71 * 0 | 0xc7 | setbluebalance() 77 * 0 | 0xc7 | setbluebalance()
@@ -109,6 +115,7 @@ struct sd {
109 struct v4l2_ctrl *hflip; 115 struct v4l2_ctrl *hflip;
110 struct v4l2_ctrl *vflip; 116 struct v4l2_ctrl *vflip;
111 }; 117 };
118 struct v4l2_ctrl *sharpness;
112 u8 flags; 119 u8 flags;
113#define FL_HFLIP 0x01 /* mirrored by default */ 120#define FL_HFLIP 0x01 /* mirrored by default */
114#define FL_VFLIP 0x02 /* vertical flipped by default */ 121#define FL_VFLIP 0x02 /* vertical flipped by default */
@@ -531,6 +538,16 @@ static void sethvflip(struct gspca_dev *gspca_dev)
531 reg_w(gspca_dev, 0x11, 0x01); 538 reg_w(gspca_dev, 0x11, 0x01);
532} 539}
533 540
541static void setsharpness(struct gspca_dev *gspca_dev)
542{
543 struct sd *sd = (struct sd *) gspca_dev;
544
545 reg_w(gspca_dev, 0xff, 0x00); /* page 0 */
546 reg_w(gspca_dev, 0xb6, sd->sharpness->val);
547
548 reg_w(gspca_dev, 0xdc, 0x01);
549}
550
534/* this function is called at probe and resume time for pac7302 */ 551/* this function is called at probe and resume time for pac7302 */
535static int sd_init(struct gspca_dev *gspca_dev) 552static int sd_init(struct gspca_dev *gspca_dev)
536{ 553{
@@ -584,6 +601,9 @@ static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
584 case V4L2_CID_HFLIP: 601 case V4L2_CID_HFLIP:
585 sethvflip(gspca_dev); 602 sethvflip(gspca_dev);
586 break; 603 break;
604 case V4L2_CID_SHARPNESS:
605 setsharpness(gspca_dev);
606 break;
587 default: 607 default:
588 return -EINVAL; 608 return -EINVAL;
589 } 609 }
@@ -601,7 +621,7 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
601 struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; 621 struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler;
602 622
603 gspca_dev->vdev.ctrl_handler = hdl; 623 gspca_dev->vdev.ctrl_handler = hdl;
604 v4l2_ctrl_handler_init(hdl, 11); 624 v4l2_ctrl_handler_init(hdl, 12);
605 625
606 sd->brightness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, 626 sd->brightness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
607 V4L2_CID_BRIGHTNESS, 0, 32, 1, 16); 627 V4L2_CID_BRIGHTNESS, 0, 32, 1, 16);
@@ -632,6 +652,9 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
632 sd->vflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, 652 sd->vflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
633 V4L2_CID_VFLIP, 0, 1, 1, 0); 653 V4L2_CID_VFLIP, 0, 1, 1, 0);
634 654
655 sd->sharpness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
656 V4L2_CID_SHARPNESS, 0, 15, 1, 8);
657
635 if (hdl->error) { 658 if (hdl->error) {
636 pr_err("Could not initialize controls\n"); 659 pr_err("Could not initialize controls\n");
637 return hdl->error; 660 return hdl->error;