summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/gspca
diff options
context:
space:
mode:
authorErik Andrén <erik.andren@gmail.com>2009-06-17 08:14:12 +0200
committerErik Andrén <erik.andren@gmail.com>2009-06-17 08:14:12 +0200
commitfd9d2330d3da07a09a378f54f87283bb8d36a9b7 (patch)
treeea4421ed30954a09085f53929a1add2e992c184d /linux/drivers/media/video/gspca
parentd762428c9dbb0c0ec232dea1d8a9d3cb34c4cfa1 (diff)
downloadmediapointer-dvb-s2-fd9d2330d3da07a09a378f54f87283bb8d36a9b7.tar.gz
mediapointer-dvb-s2-fd9d2330d3da07a09a378f54f87283bb8d36a9b7.tar.bz2
gspca - m5602-ov7660: Add red gain control
From: Erik Andrén <erik.andren@gmail.com> Hook up the red gain controller Priority: normal Signed-off-by: Erik Andrén <erik.andren@gmail.com>
Diffstat (limited to 'linux/drivers/media/video/gspca')
-rw-r--r--linux/drivers/media/video/gspca/m5602/m5602_ov7660.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c
index 8125c5b6c..9d0cf2ccd 100644
--- a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c
+++ b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c
@@ -22,6 +22,8 @@ static int ov7660_get_gain(struct gspca_dev *gspca_dev, __s32 *val);
static int ov7660_set_gain(struct gspca_dev *gspca_dev, __s32 val);
static int ov7660_get_blue_gain(struct gspca_dev *gspca_dev, __s32 *val);
static int ov7660_set_blue_gain(struct gspca_dev *gspca_dev, __s32 val);
+static int ov7660_get_red_gain(struct gspca_dev *gspca_dev, __s32 *val);
+static int ov7660_set_red_gain(struct gspca_dev *gspca_dev, __s32 val);
const static struct ctrl ov7660_ctrls[] = {
#define GAIN_IDX 1
@@ -54,7 +56,21 @@ const static struct ctrl ov7660_ctrls[] = {
.set = ov7660_set_blue_gain,
.get = ov7660_get_blue_gain
},
-
+#define RED_BALANCE_IDX 3
+ {
+ {
+ .id = V4L2_CID_RED_BALANCE,
+ .type = V4L2_CTRL_TYPE_INTEGER,
+ .name = "red balance",
+ .minimum = 0x00,
+ .maximum = 0x7f,
+ .step = 0x1,
+ .default_value = OV7660_DEFAULT_RED_GAIN,
+ .flags = V4L2_CTRL_FLAG_SLIDER
+ },
+ .set = ov7660_set_red_gain,
+ .get = ov7660_get_red_gain
+ },
};
static struct v4l2_pix_format ov7660_modes[] = {
@@ -237,6 +253,31 @@ static int ov7660_set_blue_gain(struct gspca_dev *gspca_dev, __s32 val)
return err;
}
+static int ov7660_get_red_gain(struct gspca_dev *gspca_dev, __s32 *val)
+{
+ struct sd *sd = (struct sd *) gspca_dev;
+ s32 *sensor_settings = sd->sensor_priv;
+
+ *val = sensor_settings[RED_BALANCE_IDX];
+ PDEBUG(D_V4L2, "Read red balance %d", *val);
+ return 0;
+}
+
+static int ov7660_set_red_gain(struct gspca_dev *gspca_dev, __s32 val)
+{
+ int err;
+ u8 i2c_data;
+ struct sd *sd = (struct sd *) gspca_dev;
+ s32 *sensor_settings = sd->sensor_priv;
+
+ PDEBUG(D_V4L2, "Setting red balance to %d", val);
+
+ sensor_settings[RED_BALANCE_IDX] = val;
+
+ err = m5602_write_sensor(sd, OV7660_RED_GAIN, &i2c_data, 1);
+ return err;
+}
+
static void ov7660_dump_registers(struct sd *sd)
{
int address;