diff options
Diffstat (limited to 'drivers/media/video/gspca/m5602')
-rw-r--r-- | drivers/media/video/gspca/m5602/m5602_po1030.c | 65 | ||||
-rw-r--r-- | drivers/media/video/gspca/m5602/m5602_po1030.h | 43 |
2 files changed, 101 insertions, 7 deletions
diff --git a/drivers/media/video/gspca/m5602/m5602_po1030.c b/drivers/media/video/gspca/m5602/m5602_po1030.c index f405294af996..d17ac52566e6 100644 --- a/drivers/media/video/gspca/m5602/m5602_po1030.c +++ b/drivers/media/video/gspca/m5602/m5602_po1030.c | |||
@@ -1,4 +1,3 @@ | |||
1 | |||
2 | /* | 1 | /* |
3 | * Driver for the po1030 sensor | 2 | * Driver for the po1030 sensor |
4 | * | 3 | * |
@@ -232,6 +231,70 @@ int po1030_get_gain(struct gspca_dev *gspca_dev, __s32 *val) | |||
232 | return (err < 0) ? err : 0; | 231 | return (err < 0) ? err : 0; |
233 | } | 232 | } |
234 | 233 | ||
234 | int po1030_get_hflip(struct gspca_dev *gspca_dev, __s32 *val) | ||
235 | { | ||
236 | struct sd *sd = (struct sd *) gspca_dev; | ||
237 | u8 i2c_data; | ||
238 | int err; | ||
239 | |||
240 | err = po1030_read_sensor(sd, PO1030_REG_CONTROL2, | ||
241 | &i2c_data, 1); | ||
242 | |||
243 | *val = (i2c_data >> 7) & 0x01 ; | ||
244 | |||
245 | PDEBUG(D_V4L2, "Read hflip %d", *val); | ||
246 | |||
247 | return (err < 0) ? err : 0; | ||
248 | } | ||
249 | |||
250 | int po1030_set_hflip(struct gspca_dev *gspca_dev, __s32 val) | ||
251 | { | ||
252 | struct sd *sd = (struct sd *) gspca_dev; | ||
253 | u8 i2c_data; | ||
254 | int err; | ||
255 | |||
256 | PDEBUG(D_V4L2, "Set hflip %d", val); | ||
257 | |||
258 | i2c_data = (val & 0x01) << 7; | ||
259 | |||
260 | err = po1030_write_sensor(sd, PO1030_REG_CONTROL2, | ||
261 | &i2c_data, 1); | ||
262 | |||
263 | return (err < 0) ? err : 0; | ||
264 | } | ||
265 | |||
266 | int po1030_get_vflip(struct gspca_dev *gspca_dev, __s32 *val) | ||
267 | { | ||
268 | struct sd *sd = (struct sd *) gspca_dev; | ||
269 | u8 i2c_data; | ||
270 | int err; | ||
271 | |||
272 | err = po1030_read_sensor(sd, PO1030_REG_GLOBALGAIN, | ||
273 | &i2c_data, 1); | ||
274 | |||
275 | *val = (i2c_data >> 6) & 0x01; | ||
276 | |||
277 | PDEBUG(D_V4L2, "Read vflip %d", *val); | ||
278 | |||
279 | return (err < 0) ? err : 0; | ||
280 | } | ||
281 | |||
282 | int po1030_set_vflip(struct gspca_dev *gspca_dev, __s32 val) | ||
283 | { | ||
284 | struct sd *sd = (struct sd *) gspca_dev; | ||
285 | u8 i2c_data; | ||
286 | int err; | ||
287 | |||
288 | PDEBUG(D_V4L2, "Set vflip %d", val); | ||
289 | |||
290 | i2c_data = (val & 0x01) << 6; | ||
291 | |||
292 | err = po1030_write_sensor(sd, PO1030_REG_CONTROL2, | ||
293 | &i2c_data, 1); | ||
294 | |||
295 | return (err < 0) ? err : 0; | ||
296 | } | ||
297 | |||
235 | int po1030_set_gain(struct gspca_dev *gspca_dev, __s32 val) | 298 | int po1030_set_gain(struct gspca_dev *gspca_dev, __s32 val) |
236 | { | 299 | { |
237 | struct sd *sd = (struct sd *) gspca_dev; | 300 | struct sd *sd = (struct sd *) gspca_dev; |
diff --git a/drivers/media/video/gspca/m5602/m5602_po1030.h b/drivers/media/video/gspca/m5602/m5602_po1030.h index f75dfa6f6594..a0b75ff61d79 100644 --- a/drivers/media/video/gspca/m5602/m5602_po1030.h +++ b/drivers/media/video/gspca/m5602/m5602_po1030.h | |||
@@ -108,10 +108,13 @@ | |||
108 | #define PO1030_REG_YCONTRAST 0x74 | 108 | #define PO1030_REG_YCONTRAST 0x74 |
109 | #define PO1030_REG_YSATURATION 0x75 | 109 | #define PO1030_REG_YSATURATION 0x75 |
110 | 110 | ||
111 | #define PO1030_HFLIP (1 << 7) | ||
112 | #define PO1030_VFLIP (1 << 6) | ||
113 | |||
111 | /*****************************************************************************/ | 114 | /*****************************************************************************/ |
112 | 115 | ||
113 | #define PO1030_GLOBAL_GAIN_DEFAULT 0x12 | 116 | #define PO1030_GLOBAL_GAIN_DEFAULT 0x12 |
114 | #define PO1030_EXPOSURE_DEFAULT 0xf0ff | 117 | #define PO1030_EXPOSURE_DEFAULT 0x0085 |
115 | #define PO1030_BLUE_GAIN_DEFAULT 0x40 | 118 | #define PO1030_BLUE_GAIN_DEFAULT 0x40 |
116 | #define PO1030_RED_GAIN_DEFAULT 0x40 | 119 | #define PO1030_RED_GAIN_DEFAULT 0x40 |
117 | 120 | ||
@@ -120,7 +123,6 @@ | |||
120 | /* Kernel module parameters */ | 123 | /* Kernel module parameters */ |
121 | extern int force_sensor; | 124 | extern int force_sensor; |
122 | extern int dump_sensor; | 125 | extern int dump_sensor; |
123 | extern unsigned int m5602_debug; | ||
124 | 126 | ||
125 | int po1030_probe(struct sd *sd); | 127 | int po1030_probe(struct sd *sd); |
126 | int po1030_init(struct sd *sd); | 128 | int po1030_init(struct sd *sd); |
@@ -141,6 +143,10 @@ int po1030_get_red_balance(struct gspca_dev *gspca_dev, __s32 *val); | |||
141 | int po1030_set_red_balance(struct gspca_dev *gspca_dev, __s32 val); | 143 | int po1030_set_red_balance(struct gspca_dev *gspca_dev, __s32 val); |
142 | int po1030_get_blue_balance(struct gspca_dev *gspca_dev, __s32 *val); | 144 | int po1030_get_blue_balance(struct gspca_dev *gspca_dev, __s32 *val); |
143 | int po1030_set_blue_balance(struct gspca_dev *gspca_dev, __s32 val); | 145 | int po1030_set_blue_balance(struct gspca_dev *gspca_dev, __s32 val); |
146 | int po1030_get_hflip(struct gspca_dev *gspca_dev, __s32 *val); | ||
147 | int po1030_set_hflip(struct gspca_dev *gspca_dev, __s32 val); | ||
148 | int po1030_get_vflip(struct gspca_dev *gspca_dev, __s32 *val); | ||
149 | int po1030_set_vflip(struct gspca_dev *gspca_dev, __s32 val); | ||
144 | 150 | ||
145 | static struct m5602_sensor po1030 = { | 151 | static struct m5602_sensor po1030 = { |
146 | .name = "PO1030", | 152 | .name = "PO1030", |
@@ -151,7 +157,7 @@ static struct m5602_sensor po1030 = { | |||
151 | .init = po1030_init, | 157 | .init = po1030_init, |
152 | .power_down = po1030_power_down, | 158 | .power_down = po1030_power_down, |
153 | 159 | ||
154 | .nctrls = 4, | 160 | .nctrls = 6, |
155 | .ctrls = { | 161 | .ctrls = { |
156 | { | 162 | { |
157 | { | 163 | { |
@@ -159,7 +165,7 @@ static struct m5602_sensor po1030 = { | |||
159 | .type = V4L2_CTRL_TYPE_INTEGER, | 165 | .type = V4L2_CTRL_TYPE_INTEGER, |
160 | .name = "gain", | 166 | .name = "gain", |
161 | .minimum = 0x00, | 167 | .minimum = 0x00, |
162 | .maximum = 0xff, | 168 | .maximum = 0x4f, |
163 | .step = 0x1, | 169 | .step = 0x1, |
164 | .default_value = PO1030_GLOBAL_GAIN_DEFAULT, | 170 | .default_value = PO1030_GLOBAL_GAIN_DEFAULT, |
165 | .flags = V4L2_CTRL_FLAG_SLIDER | 171 | .flags = V4L2_CTRL_FLAG_SLIDER |
@@ -172,7 +178,7 @@ static struct m5602_sensor po1030 = { | |||
172 | .type = V4L2_CTRL_TYPE_INTEGER, | 178 | .type = V4L2_CTRL_TYPE_INTEGER, |
173 | .name = "exposure", | 179 | .name = "exposure", |
174 | .minimum = 0x00, | 180 | .minimum = 0x00, |
175 | .maximum = 0xffff, | 181 | .maximum = 0x02ff, |
176 | .step = 0x1, | 182 | .step = 0x1, |
177 | .default_value = PO1030_EXPOSURE_DEFAULT, | 183 | .default_value = PO1030_EXPOSURE_DEFAULT, |
178 | .flags = V4L2_CTRL_FLAG_SLIDER | 184 | .flags = V4L2_CTRL_FLAG_SLIDER |
@@ -205,8 +211,33 @@ static struct m5602_sensor po1030 = { | |||
205 | }, | 211 | }, |
206 | .set = po1030_set_blue_balance, | 212 | .set = po1030_set_blue_balance, |
207 | .get = po1030_get_blue_balance | 213 | .get = po1030_get_blue_balance |
214 | }, { | ||
215 | { | ||
216 | .id = V4L2_CID_HFLIP, | ||
217 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
218 | .name = "horizontal flip", | ||
219 | .minimum = 0, | ||
220 | .maximum = 1, | ||
221 | .step = 1, | ||
222 | .default_value = 0, | ||
223 | }, | ||
224 | .set = po1030_set_hflip, | ||
225 | .get = po1030_get_hflip | ||
226 | }, { | ||
227 | { | ||
228 | .id = V4L2_CID_VFLIP, | ||
229 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
230 | .name = "vertical flip", | ||
231 | .minimum = 0, | ||
232 | .maximum = 1, | ||
233 | .step = 1, | ||
234 | .default_value = 0, | ||
235 | }, | ||
236 | .set = po1030_set_vflip, | ||
237 | .get = po1030_get_vflip | ||
208 | } | 238 | } |
209 | }, | 239 | }, |
240 | |||
210 | .nmodes = 1, | 241 | .nmodes = 1, |
211 | .modes = { | 242 | .modes = { |
212 | { | 243 | { |
@@ -380,7 +411,7 @@ static const unsigned char init_po1030[][4] = | |||
380 | 411 | ||
381 | /* Set the y window to 1 */ | 412 | /* Set the y window to 1 */ |
382 | {SENSOR, PO1030_REG_WINDOWY_H, 0x00}, | 413 | {SENSOR, PO1030_REG_WINDOWY_H, 0x00}, |
383 | {SENSOR, PO1030_REG_WINDOWX_L, 0x01}, | 414 | {SENSOR, PO1030_REG_WINDOWY_L, 0x01}, |
384 | 415 | ||
385 | {SENSOR, PO1030_REG_WINDOWWIDTH_H, 0x02}, | 416 | {SENSOR, PO1030_REG_WINDOWWIDTH_H, 0x02}, |
386 | {SENSOR, PO1030_REG_WINDOWWIDTH_L, 0x87}, | 417 | {SENSOR, PO1030_REG_WINDOWWIDTH_L, 0x87}, |