aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/gspca/m5602/m5602_ov7660.c43
-rw-r--r--drivers/media/video/gspca/m5602/m5602_ov7660.h20
2 files changed, 51 insertions, 12 deletions
diff --git a/drivers/media/video/gspca/m5602/m5602_ov7660.c b/drivers/media/video/gspca/m5602/m5602_ov7660.c
index 7aafeb7cfa07..8125c5b6cfc0 100644
--- a/drivers/media/video/gspca/m5602/m5602_ov7660.c
+++ b/drivers/media/video/gspca/m5602/m5602_ov7660.c
@@ -20,6 +20,8 @@
20 20
21static int ov7660_get_gain(struct gspca_dev *gspca_dev, __s32 *val); 21static int ov7660_get_gain(struct gspca_dev *gspca_dev, __s32 *val);
22static int ov7660_set_gain(struct gspca_dev *gspca_dev, __s32 val); 22static int ov7660_set_gain(struct gspca_dev *gspca_dev, __s32 val);
23static int ov7660_get_blue_gain(struct gspca_dev *gspca_dev, __s32 *val);
24static int ov7660_set_blue_gain(struct gspca_dev *gspca_dev, __s32 val);
23 25
24const static struct ctrl ov7660_ctrls[] = { 26const static struct ctrl ov7660_ctrls[] = {
25#define GAIN_IDX 1 27#define GAIN_IDX 1
@@ -37,6 +39,22 @@ const static struct ctrl ov7660_ctrls[] = {
37 .set = ov7660_set_gain, 39 .set = ov7660_set_gain,
38 .get = ov7660_get_gain 40 .get = ov7660_get_gain
39 }, 41 },
42#define BLUE_BALANCE_IDX 2
43 {
44 {
45 .id = V4L2_CID_BLUE_BALANCE,
46 .type = V4L2_CTRL_TYPE_INTEGER,
47 .name = "blue balance",
48 .minimum = 0x00,
49 .maximum = 0x7f,
50 .step = 0x1,
51 .default_value = OV7660_DEFAULT_BLUE_GAIN,
52 .flags = V4L2_CTRL_FLAG_SLIDER
53 },
54 .set = ov7660_set_blue_gain,
55 .get = ov7660_get_blue_gain
56 },
57
40}; 58};
41 59
42static struct v4l2_pix_format ov7660_modes[] = { 60static struct v4l2_pix_format ov7660_modes[] = {
@@ -194,6 +212,31 @@ static int ov7660_set_gain(struct gspca_dev *gspca_dev, __s32 val)
194 return err; 212 return err;
195} 213}
196 214
215static int ov7660_get_blue_gain(struct gspca_dev *gspca_dev, __s32 *val)
216{
217 struct sd *sd = (struct sd *) gspca_dev;
218 s32 *sensor_settings = sd->sensor_priv;
219
220 *val = sensor_settings[BLUE_BALANCE_IDX];
221 PDEBUG(D_V4L2, "Read blue balance %d", *val);
222 return 0;
223}
224
225static int ov7660_set_blue_gain(struct gspca_dev *gspca_dev, __s32 val)
226{
227 int err;
228 u8 i2c_data;
229 struct sd *sd = (struct sd *) gspca_dev;
230 s32 *sensor_settings = sd->sensor_priv;
231
232 PDEBUG(D_V4L2, "Setting blue balance to %d", val);
233
234 sensor_settings[BLUE_BALANCE_IDX] = val;
235
236 err = m5602_write_sensor(sd, OV7660_BLUE_GAIN, &i2c_data, 1);
237 return err;
238}
239
197static void ov7660_dump_registers(struct sd *sd) 240static void ov7660_dump_registers(struct sd *sd)
198{ 241{
199 int address; 242 int address;
diff --git a/drivers/media/video/gspca/m5602/m5602_ov7660.h b/drivers/media/video/gspca/m5602/m5602_ov7660.h
index 3f2c169a93ea..d2589d654a19 100644
--- a/drivers/media/video/gspca/m5602/m5602_ov7660.h
+++ b/drivers/media/video/gspca/m5602/m5602_ov7660.h
@@ -66,23 +66,23 @@
66#define OV7660_RBIAS 0x2c 66#define OV7660_RBIAS 0x2c
67#define OV7660_HREF 0x32 67#define OV7660_HREF 0x32
68#define OV7660_ADC 0x37 68#define OV7660_ADC 0x37
69#define OV7660_OFON 0x39 69#define OV7660_OFON 0x39
70#define OV7660_TSLB 0x3a 70#define OV7660_TSLB 0x3a
71#define OV7660_COM12 0x3c 71#define OV7660_COM12 0x3c
72#define OV7660_COM13 0x3d 72#define OV7660_COM13 0x3d
73#define OV7660_LCC1 0x62 73#define OV7660_LCC1 0x62
74#define OV7660_LCC2 0x63 74#define OV7660_LCC2 0x63
75#define OV7660_LCC3 0x64 75#define OV7660_LCC3 0x64
76#define OV7660_LCC4 0x65 76#define OV7660_LCC4 0x65
77#define OV7660_LCC5 0x66 77#define OV7660_LCC5 0x66
78#define OV7660_HV 0x69 78#define OV7660_HV 0x69
79#define OV7660_RSVDA1 0xa1 79#define OV7660_RSVDA1 0xa1
80 80
81#define OV7660_DEFAULT_GAIN 0x0e 81#define OV7660_DEFAULT_GAIN 0x0e
82#define OV7660_DEFAULT_RED_GAIN 0x80 82#define OV7660_DEFAULT_RED_GAIN 0x80
83#define OV7660_DEFAULT_BLUE_GAIN 0x80 83#define OV7660_DEFAULT_BLUE_GAIN 0x80
84#define OV7660_DEFAULT_SATURATION 0x00 84#define OV7660_DEFAULT_SATURATION 0x00
85#define OV7660_DEFAULT_EXPOSURE 0x20 85#define OV7660_DEFAULT_EXPOSURE 0x20
86 86
87/* Kernel module parameters */ 87/* Kernel module parameters */
88extern int force_sensor; 88extern int force_sensor;
@@ -199,8 +199,6 @@ static const unsigned char init_ov7660[][4] =
199 199
200 {SENSOR, OV7660_COM7, 0x80}, 200 {SENSOR, OV7660_COM7, 0x80},
201 {SENSOR, OV7660_CLKRC, 0x80}, 201 {SENSOR, OV7660_CLKRC, 0x80},
202 {SENSOR, OV7660_BLUE_GAIN, 0x80},
203 {SENSOR, OV7660_RED_GAIN, 0x80},
204 {SENSOR, OV7660_COM9, 0x4c}, 202 {SENSOR, OV7660_COM9, 0x4c},
205 {SENSOR, OV7660_OFON, 0x43}, 203 {SENSOR, OV7660_OFON, 0x43},
206 {SENSOR, OV7660_COM12, 0x28}, 204 {SENSOR, OV7660_COM12, 0x28},
@@ -264,8 +262,6 @@ static const unsigned char init_ov7660[][4] =
264 {SENSOR, OV7660_OFON, 0x0c}, 262 {SENSOR, OV7660_OFON, 0x0c},
265 {SENSOR, OV7660_COM2, 0x11}, 263 {SENSOR, OV7660_COM2, 0x11},
266 {SENSOR, OV7660_COM7, 0x05}, 264 {SENSOR, OV7660_COM7, 0x05},
267 {SENSOR, OV7660_BLUE_GAIN, 0x80},
268 {SENSOR, OV7660_RED_GAIN, 0x80},
269 265
270 {BRIDGE, M5602_XB_GPIO_DIR, 0x01}, 266 {BRIDGE, M5602_XB_GPIO_DIR, 0x01},
271 {BRIDGE, M5602_XB_GPIO_DAT, 0x04}, 267 {BRIDGE, M5602_XB_GPIO_DAT, 0x04},