aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/gspca/sonixj.c65
1 files changed, 51 insertions, 14 deletions
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index da64947fc08f..f5dab675c96c 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -40,6 +40,7 @@ enum e_ctrl {
40 RED, 40 RED,
41 GAMMA, 41 GAMMA,
42 AUTOGAIN, 42 AUTOGAIN,
43 HFLIP,
43 VFLIP, 44 VFLIP,
44 SHARPNESS, 45 SHARPNESS,
45 INFRARED, 46 INFRARED,
@@ -102,7 +103,7 @@ static void setcolors(struct gspca_dev *gspca_dev);
102static void setredblue(struct gspca_dev *gspca_dev); 103static void setredblue(struct gspca_dev *gspca_dev);
103static void setgamma(struct gspca_dev *gspca_dev); 104static void setgamma(struct gspca_dev *gspca_dev);
104static void setautogain(struct gspca_dev *gspca_dev); 105static void setautogain(struct gspca_dev *gspca_dev);
105static void setvflip(struct gspca_dev *gspca_dev); 106static void sethvflip(struct gspca_dev *gspca_dev);
106static void setsharpness(struct gspca_dev *gspca_dev); 107static void setsharpness(struct gspca_dev *gspca_dev);
107static void setinfrared(struct gspca_dev *gspca_dev); 108static void setinfrared(struct gspca_dev *gspca_dev);
108static void setfreq(struct gspca_dev *gspca_dev); 109static void setfreq(struct gspca_dev *gspca_dev);
@@ -195,7 +196,18 @@ static const struct ctrl sd_ctrls[NCTRLS] = {
195 }, 196 },
196 .set_control = setautogain 197 .set_control = setautogain
197 }, 198 },
198/* ov7630/ov7648 only */ 199[HFLIP] = {
200 {
201 .id = V4L2_CID_HFLIP,
202 .type = V4L2_CTRL_TYPE_BOOLEAN,
203 .name = "Mirror",
204 .minimum = 0,
205 .maximum = 1,
206 .step = 1,
207 .default_value = 0,
208 },
209 .set_control = sethvflip
210 },
199[VFLIP] = { 211[VFLIP] = {
200 { 212 {
201 .id = V4L2_CID_VFLIP, 213 .id = V4L2_CID_VFLIP,
@@ -206,7 +218,7 @@ static const struct ctrl sd_ctrls[NCTRLS] = {
206 .step = 1, 218 .step = 1,
207 .default_value = 0, 219 .default_value = 0,
208 }, 220 },
209 .set_control = setvflip 221 .set_control = sethvflip
210 }, 222 },
211[SHARPNESS] = { 223[SHARPNESS] = {
212 { 224 {
@@ -252,59 +264,72 @@ static const struct ctrl sd_ctrls[NCTRLS] = {
252static const __u32 ctrl_dis[] = { 264static const __u32 ctrl_dis[] = {
253[SENSOR_ADCM1700] = (1 << AUTOGAIN) | 265[SENSOR_ADCM1700] = (1 << AUTOGAIN) |
254 (1 << INFRARED) | 266 (1 << INFRARED) |
267 (1 << HFLIP) |
255 (1 << VFLIP) | 268 (1 << VFLIP) |
256 (1 << FREQ), 269 (1 << FREQ),
257 270
258[SENSOR_GC0307] = (1 << INFRARED) | 271[SENSOR_GC0307] = (1 << INFRARED) |
272 (1 << HFLIP) |
259 (1 << VFLIP) | 273 (1 << VFLIP) |
260 (1 << FREQ), 274 (1 << FREQ),
261 275
262[SENSOR_HV7131R] = (1 << INFRARED) | 276[SENSOR_HV7131R] = (1 << INFRARED) |
277 (1 << HFLIP) |
263 (1 << FREQ), 278 (1 << FREQ),
264 279
265[SENSOR_MI0360] = (1 << INFRARED) | 280[SENSOR_MI0360] = (1 << INFRARED) |
281 (1 << HFLIP) |
266 (1 << VFLIP) | 282 (1 << VFLIP) |
267 (1 << FREQ), 283 (1 << FREQ),
268 284
269[SENSOR_MI0360B] = (1 << INFRARED) | 285[SENSOR_MI0360B] = (1 << INFRARED) |
286 (1 << HFLIP) |
270 (1 << VFLIP) | 287 (1 << VFLIP) |
271 (1 << FREQ), 288 (1 << FREQ),
272 289
273[SENSOR_MO4000] = (1 << INFRARED) | 290[SENSOR_MO4000] = (1 << INFRARED) |
291 (1 << HFLIP) |
274 (1 << VFLIP) | 292 (1 << VFLIP) |
275 (1 << FREQ), 293 (1 << FREQ),
276 294
277[SENSOR_MT9V111] = (1 << VFLIP) | 295[SENSOR_MT9V111] = (1 << HFLIP) |
296 (1 << VFLIP) |
278 (1 << FREQ), 297 (1 << FREQ),
279 298
280[SENSOR_OM6802] = (1 << INFRARED) | 299[SENSOR_OM6802] = (1 << INFRARED) |
300 (1 << HFLIP) |
281 (1 << VFLIP) | 301 (1 << VFLIP) |
282 (1 << FREQ), 302 (1 << FREQ),
283 303
284[SENSOR_OV7630] = (1 << INFRARED), 304[SENSOR_OV7630] = (1 << INFRARED) |
305 (1 << HFLIP),
285 306
286[SENSOR_OV7648] = (1 << INFRARED), 307[SENSOR_OV7648] = (1 << INFRARED) |
308 (1 << HFLIP),
287 309
288[SENSOR_OV7660] = (1 << AUTOGAIN) | 310[SENSOR_OV7660] = (1 << AUTOGAIN) |
289 (1 << INFRARED) | 311 (1 << INFRARED) |
312 (1 << HFLIP) |
290 (1 << VFLIP), 313 (1 << VFLIP),
291 314
292[SENSOR_PO1030] = (1 << AUTOGAIN) | 315[SENSOR_PO1030] = (1 << AUTOGAIN) |
293 (1 << INFRARED) | 316 (1 << INFRARED) |
317 (1 << HFLIP) |
294 (1 << VFLIP) | 318 (1 << VFLIP) |
295 (1 << FREQ), 319 (1 << FREQ),
296 320
297[SENSOR_PO2030N] = (1 << AUTOGAIN) | 321[SENSOR_PO2030N] = (1 << AUTOGAIN) |
298 (1 << INFRARED) | 322 (1 << INFRARED) |
299 (1 << VFLIP) |
300 (1 << FREQ), 323 (1 << FREQ),
301[SENSOR_SOI768] = (1 << AUTOGAIN) | 324[SENSOR_SOI768] = (1 << AUTOGAIN) |
302 (1 << INFRARED) | 325 (1 << INFRARED) |
326 (1 << HFLIP) |
303 (1 << VFLIP) | 327 (1 << VFLIP) |
304 (1 << FREQ), 328 (1 << FREQ),
305 329
306[SENSOR_SP80708] = (1 << AUTOGAIN) | 330[SENSOR_SP80708] = (1 << AUTOGAIN) |
307 (1 << INFRARED) | 331 (1 << INFRARED) |
332 (1 << HFLIP) |
308 (1 << VFLIP) | 333 (1 << VFLIP) |
309 (1 << FREQ), 334 (1 << FREQ),
310}; 335};
@@ -2237,14 +2262,11 @@ static void setautogain(struct gspca_dev *gspca_dev)
2237 sd->ag_cnt = -1; 2262 sd->ag_cnt = -1;
2238} 2263}
2239 2264
2240/* hv7131r/ov7630/ov7648 only */ 2265static void sethvflip(struct gspca_dev *gspca_dev)
2241static void setvflip(struct gspca_dev *gspca_dev)
2242{ 2266{
2243 struct sd *sd = (struct sd *) gspca_dev; 2267 struct sd *sd = (struct sd *) gspca_dev;
2244 u8 comn; 2268 u8 comn;
2245 2269
2246 if (gspca_dev->ctrl_dis & (1 << VFLIP))
2247 return;
2248 switch (sd->sensor) { 2270 switch (sd->sensor) {
2249 case SENSOR_HV7131R: 2271 case SENSOR_HV7131R:
2250 comn = 0x18; /* clkdiv = 1, ablcen = 1 */ 2272 comn = 0x18; /* clkdiv = 1, ablcen = 1 */
@@ -2258,13 +2280,28 @@ static void setvflip(struct gspca_dev *gspca_dev)
2258 comn |= 0x80; 2280 comn |= 0x80;
2259 i2c_w1(gspca_dev, 0x75, comn); 2281 i2c_w1(gspca_dev, 0x75, comn);
2260 break; 2282 break;
2261 default: 2283 case SENSOR_OV7648:
2262/* case SENSOR_OV7648: */
2263 comn = 0x06; 2284 comn = 0x06;
2264 if (sd->ctrls[VFLIP].val) 2285 if (sd->ctrls[VFLIP].val)
2265 comn |= 0x80; 2286 comn |= 0x80;
2266 i2c_w1(gspca_dev, 0x75, comn); 2287 i2c_w1(gspca_dev, 0x75, comn);
2267 break; 2288 break;
2289 case SENSOR_PO2030N:
2290 /* Reg. 0x1E: Timing Generator Control Register 2 (Tgcontrol2)
2291 * (reset value: 0x0A)
2292 * bit7: HM: Horizontal Mirror: 0: disable, 1: enable
2293 * bit6: VM: Vertical Mirror: 0: disable, 1: enable
2294 * bit5: ST: Shutter Selection: 0: electrical, 1: mechanical
2295 * bit4: FT: Single Frame Transfer: 0: disable, 1: enable
2296 * bit3-0: X
2297 */
2298 comn = 0x0a;
2299 if (sd->ctrls[HFLIP].val)
2300 comn |= 0x80;
2301 if (sd->ctrls[VFLIP].val)
2302 comn |= 0x40;
2303 i2c_w1(&sd->gspca_dev, 0x1e, comn);
2304 break;
2268 } 2305 }
2269} 2306}
2270 2307
@@ -2650,7 +2687,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
2650 reg_w1(gspca_dev, 0x17, reg17); 2687 reg_w1(gspca_dev, 0x17, reg17);
2651 reg_w1(gspca_dev, 0x01, reg1); 2688 reg_w1(gspca_dev, 0x01, reg1);
2652 2689
2653 setvflip(gspca_dev); 2690 sethvflip(gspca_dev);
2654 setbrightness(gspca_dev); 2691 setbrightness(gspca_dev);
2655 setcontrast(gspca_dev); 2692 setcontrast(gspca_dev);
2656 setcolors(gspca_dev); 2693 setcolors(gspca_dev);