summaryrefslogtreecommitdiffstats
path: root/drivers/media/usb
diff options
context:
space:
mode:
authorFrank Schäfer <fschaefer.oss@googlemail.com>2012-09-09 15:02:21 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-09-13 17:53:57 -0300
commitb1a19c0165573b169eceb690df7a72bf1ffa47dc (patch)
tree7a6ee71e05bb0b8b9034b0e2719ee4d08a28792a /drivers/media/usb
parentdb43b9ca2f101d0945d043fa7d5ecd8f2da17fef (diff)
downloadlinux-b1a19c0165573b169eceb690df7a72bf1ffa47dc.tar.bz2
[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/usb')
-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 eb3c90e4a658..8c2961326a65 100644
--- a/drivers/media/usb/gspca/pac7302.c
+++ b/drivers/media/usb/gspca/pac7302.c
@@ -26,6 +26,11 @@
/*
* Some documentation about various registers as determined by trial and error.
*
+ * Register page 0:
+ *
+ * Address Description
+ * 0xb6 Sharpness control (bits 0-4)
+ *
* Register page 1:
*
* Address Description
@@ -66,6 +71,7 @@
* -----+------------+---------------------------------------------------
* 0 | 0x0f..0x20 | setcolors()
* 0 | 0xa2..0xab | setbrightcont()
+ * 0 | 0xb6 | setsharpness()
* 0 | 0xc5 | setredbalance()
* 0 | 0xc6 | setwhitebalance()
* 0 | 0xc7 | setbluebalance()
@@ -109,6 +115,7 @@ struct sd {
struct v4l2_ctrl *hflip;
struct v4l2_ctrl *vflip;
};
+ struct v4l2_ctrl *sharpness;
u8 flags;
#define FL_HFLIP 0x01 /* mirrored by default */
#define FL_VFLIP 0x02 /* vertical flipped by default */
@@ -531,6 +538,16 @@ static void sethvflip(struct gspca_dev *gspca_dev)
reg_w(gspca_dev, 0x11, 0x01);
}
+static void setsharpness(struct gspca_dev *gspca_dev)
+{
+ struct sd *sd = (struct sd *) gspca_dev;
+
+ reg_w(gspca_dev, 0xff, 0x00); /* page 0 */
+ reg_w(gspca_dev, 0xb6, sd->sharpness->val);
+
+ reg_w(gspca_dev, 0xdc, 0x01);
+}
+
/* this function is called at probe and resume time for pac7302 */
static int sd_init(struct gspca_dev *gspca_dev)
{
@@ -584,6 +601,9 @@ static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_HFLIP:
sethvflip(gspca_dev);
break;
+ case V4L2_CID_SHARPNESS:
+ setsharpness(gspca_dev);
+ break;
default:
return -EINVAL;
}
@@ -601,7 +621,7 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler;
gspca_dev->vdev.ctrl_handler = hdl;
- v4l2_ctrl_handler_init(hdl, 11);
+ v4l2_ctrl_handler_init(hdl, 12);
sd->brightness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
V4L2_CID_BRIGHTNESS, 0, 32, 1, 16);
@@ -632,6 +652,9 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
sd->vflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
V4L2_CID_VFLIP, 0, 1, 1, 0);
+ sd->sharpness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
+ V4L2_CID_SHARPNESS, 0, 15, 1, 8);
+
if (hdl->error) {
pr_err("Could not initialize controls\n");
return hdl->error;