diff options
Diffstat (limited to 'drivers/media/video/gspca/gl860/gl860-ov2640.c')
-rw-r--r-- | drivers/media/video/gspca/gl860/gl860-ov2640.c | 140 |
1 files changed, 62 insertions, 78 deletions
diff --git a/drivers/media/video/gspca/gl860/gl860-ov2640.c b/drivers/media/video/gspca/gl860/gl860-ov2640.c index 14b9c373f9f7..768cac5cd72b 100644 --- a/drivers/media/video/gspca/gl860/gl860-ov2640.c +++ b/drivers/media/video/gspca/gl860/gl860-ov2640.c | |||
@@ -1,6 +1,5 @@ | |||
1 | /* @file gl860-ov2640.c | 1 | /* Subdriver for the GL860 chip with the OV2640 sensor |
2 | * @author Olivier LORIN, from Malmostoso's logs | 2 | * Author Olivier LORIN, from Malmostoso's logs |
3 | * @date 2009-08-27 | ||
4 | * | 3 | * |
5 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 5 | * it under the terms of the GNU General Public License as published by |
@@ -21,8 +20,12 @@ | |||
21 | #include "gl860.h" | 20 | #include "gl860.h" |
22 | 21 | ||
23 | static u8 dat_init1[] = "\x00\x41\x07\x6a\x06\x61\x0d\x6a" "\x10\x10\xc1\x01"; | 22 | static u8 dat_init1[] = "\x00\x41\x07\x6a\x06\x61\x0d\x6a" "\x10\x10\xc1\x01"; |
24 | static u8 dat_init2[] = {0x61}; /* expected */ | 23 | |
25 | static u8 dat_init3[] = {0x51}; /* expected */ | 24 | static u8 c61[] = {0x61}; /* expected */ |
25 | static u8 c51[] = {0x51}; /* expected */ | ||
26 | static u8 c50[] = {0x50}; /* expected */ | ||
27 | static u8 c28[] = {0x28}; /* expected */ | ||
28 | static u8 ca8[] = {0xa8}; /* expected */ | ||
26 | 29 | ||
27 | static u8 dat_post[] = | 30 | static u8 dat_post[] = |
28 | "\x00\x41\x07\x6a\x06\xef\x0d\x6a" "\x10\x10\xc1\x01"; | 31 | "\x00\x41\x07\x6a\x06\xef\x0d\x6a" "\x10\x10\xc1\x01"; |
@@ -32,10 +35,6 @@ static u8 dat_800[] = "\xd0\x01\xd1\x10\xd2\x58\xd3\x02\xd4\x18\xd5\x21"; | |||
32 | static u8 dat_1280[] = "\xd0\x01\xd1\x18\xd2\xc0\xd3\x02\xd4\x28\xd5\x01"; | 35 | static u8 dat_1280[] = "\xd0\x01\xd1\x18\xd2\xc0\xd3\x02\xd4\x28\xd5\x01"; |
33 | static u8 dat_1600[] = "\xd0\x01\xd1\x20\xd2\xb0\xd3\x02\xd4\x30\xd5\x41"; | 36 | static u8 dat_1600[] = "\xd0\x01\xd1\x20\xd2\xb0\xd3\x02\xd4\x30\xd5\x41"; |
34 | 37 | ||
35 | static u8 c50[] = {0x50}; /* expected */ | ||
36 | static u8 c28[] = {0x28}; /* expected */ | ||
37 | static u8 ca8[] = {0xa8}; /* expected */ | ||
38 | |||
39 | static struct validx tbl_init_at_startup[] = { | 38 | static struct validx tbl_init_at_startup[] = { |
40 | {0x0000, 0x0000}, {0x0010, 0x0010}, {0x0008, 0x00c0}, {0x0001, 0x00c1}, | 39 | {0x0000, 0x0000}, {0x0010, 0x0010}, {0x0008, 0x00c0}, {0x0001, 0x00c1}, |
41 | {0x0001, 0x00c2}, {0x0020, 0x0006}, {0x006a, 0x000d}, | 40 | {0x0001, 0x00c2}, {0x0020, 0x0006}, {0x006a, 0x000d}, |
@@ -92,7 +91,7 @@ static struct validx tbl_common[] = { | |||
92 | {0x6000, 0x0010}, | 91 | {0x6000, 0x0010}, |
93 | }; | 92 | }; |
94 | 93 | ||
95 | static struct validx tbl_sensor_settings_common_a[] = { | 94 | static struct validx tbl_sensor_settings_common1[] = { |
96 | {0x0041, 0x0000}, {0x006a, 0x0007}, {0x00ef, 0x0006}, {0x006a, 0x000d}, | 95 | {0x0041, 0x0000}, {0x006a, 0x0007}, {0x00ef, 0x0006}, {0x006a, 0x000d}, |
97 | {0x0000, 0x00c0}, {0x0010, 0x0010}, {0x0001, 0x00c1}, {0x0041, 0x00c2}, | 96 | {0x0000, 0x00c0}, {0x0010, 0x0010}, {0x0001, 0x00c1}, {0x0041, 0x00c2}, |
98 | {0x0004, 0x00d8}, {0x0012, 0x0004}, {0x0000, 0x0058}, {0x0041, 0x0000}, | 97 | {0x0004, 0x00d8}, {0x0012, 0x0004}, {0x0000, 0x0058}, {0x0041, 0x0000}, |
@@ -104,40 +103,10 @@ static struct validx tbl_sensor_settings_common_a[] = { | |||
104 | {0x0040, 0x0000}, | 103 | {0x0040, 0x0000}, |
105 | }; | 104 | }; |
106 | 105 | ||
107 | static struct validx tbl_sensor_settings_common_b[] = { | 106 | static struct validx tbl_sensor_settings_common2[] = { |
108 | {0x6001, 0x00ff}, {0x6038, 0x000c}, | 107 | {0x6001, 0x00ff}, {0x6038, 0x000c}, |
109 | {10, 0xffff}, | 108 | {10, 0xffff}, |
110 | {0x6000, 0x0011}, | 109 | {0x6000, 0x0011}, |
111 | /* backlight=31/64 */ | ||
112 | {0x6001, 0x00ff}, {0x603e, 0x0024}, {0x6034, 0x0025}, | ||
113 | /* bright=0/256 */ | ||
114 | {0x6000, 0x00ff}, {0x6009, 0x007c}, {0x6000, 0x007d}, | ||
115 | /* wbal=64/128 */ | ||
116 | {0x6000, 0x00ff}, {0x6003, 0x007c}, {0x6040, 0x007d}, | ||
117 | /* cntr=0/256 */ | ||
118 | {0x6000, 0x00ff}, {0x6007, 0x007c}, {0x6000, 0x007d}, | ||
119 | /* sat=128/256 */ | ||
120 | {0x6000, 0x00ff}, {0x6001, 0x007c}, {0x6080, 0x007d}, | ||
121 | /* sharpness=0/32 */ | ||
122 | {0x6000, 0x00ff}, {0x6001, 0x0092}, {0x60c0, 0x0093}, | ||
123 | /* hue=0/256 */ | ||
124 | {0x6000, 0x00ff}, {0x6002, 0x007c}, {0x6000, 0x007d}, | ||
125 | /* gam=32/64 */ | ||
126 | {0x6000, 0x00ff}, {0x6008, 0x007c}, {0x6020, 0x007d}, | ||
127 | /* image right up */ | ||
128 | {0xffff, 0xffff}, | ||
129 | {15, 0xffff}, | ||
130 | {0x6001, 0x00ff}, {0x6000, 0x8004}, | ||
131 | {0xffff, 0xffff}, | ||
132 | {0x60a8, 0x0004}, | ||
133 | {15, 0xffff}, | ||
134 | {0x6001, 0x00ff}, {0x6000, 0x8004}, | ||
135 | {0xffff, 0xffff}, | ||
136 | {0x60f8, 0x0004}, | ||
137 | /* image right up */ | ||
138 | {0xffff, 0xffff}, | ||
139 | /* backlight=31/64 */ | ||
140 | {0x6001, 0x00ff}, {0x603e, 0x0024}, {0x6034, 0x0025}, | ||
141 | }; | 110 | }; |
142 | 111 | ||
143 | static struct validx tbl_640[] = { | 112 | static struct validx tbl_640[] = { |
@@ -166,7 +135,7 @@ static struct validx tbl_800[] = { | |||
166 | {0x60ff, 0x00dd}, {0x6020, 0x008c}, {0x6001, 0x00ff}, {0x6044, 0x0018}, | 135 | {0x60ff, 0x00dd}, {0x6020, 0x008c}, {0x6001, 0x00ff}, {0x6044, 0x0018}, |
167 | }; | 136 | }; |
168 | 137 | ||
169 | static struct validx tbl_big_a[] = { | 138 | static struct validx tbl_big1[] = { |
170 | {0x0002, 0x00c1}, {0x6000, 0x00ff}, {0x60f1, 0x00dd}, {0x6004, 0x00e0}, | 139 | {0x0002, 0x00c1}, {0x6000, 0x00ff}, {0x60f1, 0x00dd}, {0x6004, 0x00e0}, |
171 | {0x6001, 0x00ff}, {0x6000, 0x0012}, {0x6000, 0x0000}, {0x6000, 0x0045}, | 140 | {0x6001, 0x00ff}, {0x6000, 0x0012}, {0x6000, 0x0000}, {0x6000, 0x0045}, |
172 | {0x6000, 0x0010}, {0x6000, 0x0011}, {0x6011, 0x0017}, {0x6075, 0x0018}, | 141 | {0x6000, 0x0010}, {0x6000, 0x0011}, {0x6011, 0x0017}, {0x6075, 0x0018}, |
@@ -176,14 +145,14 @@ static struct validx tbl_big_a[] = { | |||
176 | {0x60c8, 0x00c0}, {0x6096, 0x00c1}, {0x6000, 0x008c}, | 145 | {0x60c8, 0x00c0}, {0x6096, 0x00c1}, {0x6000, 0x008c}, |
177 | }; | 146 | }; |
178 | 147 | ||
179 | static struct validx tbl_big_b[] = { | 148 | static struct validx tbl_big2[] = { |
180 | {0x603d, 0x0086}, {0x6000, 0x0050}, {0x6090, 0x0051}, {0x602c, 0x0052}, | 149 | {0x603d, 0x0086}, {0x6000, 0x0050}, {0x6090, 0x0051}, {0x602c, 0x0052}, |
181 | {0x6000, 0x0053}, {0x6000, 0x0054}, {0x6088, 0x0055}, {0x6000, 0x0057}, | 150 | {0x6000, 0x0053}, {0x6000, 0x0054}, {0x6088, 0x0055}, {0x6000, 0x0057}, |
182 | {0x6040, 0x005a}, {0x60f0, 0x005b}, {0x6001, 0x005c}, {0x6082, 0x00d3}, | 151 | {0x6040, 0x005a}, {0x60f0, 0x005b}, {0x6001, 0x005c}, {0x6082, 0x00d3}, |
183 | {0x6000, 0x008e}, | 152 | {0x6000, 0x008e}, |
184 | }; | 153 | }; |
185 | 154 | ||
186 | static struct validx tbl_big_c[] = { | 155 | static struct validx tbl_big3[] = { |
187 | {0x6004, 0x00da}, {0x6000, 0x00e0}, {0x6067, 0x00e1}, {0x60ff, 0x00dd}, | 156 | {0x6004, 0x00da}, {0x6000, 0x00e0}, {0x6067, 0x00e1}, {0x60ff, 0x00dd}, |
188 | {0x6001, 0x00ff}, {0x6000, 0x00ff}, {0x60f1, 0x00dd}, {0x6004, 0x00e0}, | 157 | {0x6001, 0x00ff}, {0x6000, 0x00ff}, {0x60f1, 0x00dd}, {0x6004, 0x00e0}, |
189 | {0x6001, 0x00ff}, {0x6000, 0x0011}, {0x6000, 0x00ff}, {0x6010, 0x00c7}, | 158 | {0x6001, 0x00ff}, {0x6000, 0x0011}, {0x6000, 0x00ff}, {0x6010, 0x00c7}, |
@@ -223,17 +192,19 @@ void ov2640_init_settings(struct gspca_dev *gspca_dev) | |||
223 | sd->vcur.hue = 0; | 192 | sd->vcur.hue = 0; |
224 | sd->vcur.saturation = 128; | 193 | sd->vcur.saturation = 128; |
225 | sd->vcur.whitebal = 64; | 194 | sd->vcur.whitebal = 64; |
195 | sd->vcur.mirror = 0; | ||
196 | sd->vcur.flip = 0; | ||
226 | 197 | ||
227 | sd->vmax.backlight = 64; | 198 | sd->vmax.backlight = 64; |
228 | sd->vmax.brightness = 255; | 199 | sd->vmax.brightness = 255; |
229 | sd->vmax.sharpness = 31; | 200 | sd->vmax.sharpness = 31; |
230 | sd->vmax.contrast = 255; | 201 | sd->vmax.contrast = 255; |
231 | sd->vmax.gamma = 64; | 202 | sd->vmax.gamma = 64; |
232 | sd->vmax.hue = 255 + 1; | 203 | sd->vmax.hue = 254 + 2; |
233 | sd->vmax.saturation = 255; | 204 | sd->vmax.saturation = 255; |
234 | sd->vmax.whitebal = 128; | 205 | sd->vmax.whitebal = 128; |
235 | sd->vmax.mirror = 0; | 206 | sd->vmax.mirror = 1; |
236 | sd->vmax.flip = 0; | 207 | sd->vmax.flip = 1; |
237 | sd->vmax.AC50Hz = 0; | 208 | sd->vmax.AC50Hz = 0; |
238 | 209 | ||
239 | sd->dev_camera_settings = ov2640_camera_settings; | 210 | sd->dev_camera_settings = ov2640_camera_settings; |
@@ -259,11 +230,11 @@ static int ov2640_init_at_startup(struct gspca_dev *gspca_dev) | |||
259 | 230 | ||
260 | common(gspca_dev); | 231 | common(gspca_dev); |
261 | 232 | ||
262 | ctrl_in(gspca_dev, 0xc0, 2, 0x0000, 0x0006, 1, dat_init2); | 233 | ctrl_in(gspca_dev, 0xc0, 2, 0x0000, 0x0006, 1, c61); |
263 | 234 | ||
264 | ctrl_out(gspca_dev, 0x40, 1, 0x00ef, 0x0006, 0, NULL); | 235 | ctrl_out(gspca_dev, 0x40, 1, 0x00ef, 0x0006, 0, NULL); |
265 | 236 | ||
266 | ctrl_in(gspca_dev, 0xc0, 2, 0x0000, 0x0000, 1, dat_init3); | 237 | ctrl_in(gspca_dev, 0xc0, 2, 0x0000, 0x0000, 1, c51); |
267 | 238 | ||
268 | ctrl_out(gspca_dev, 0x40, 1, 0x0051, 0x0000, 0, NULL); | 239 | ctrl_out(gspca_dev, 0x40, 1, 0x0051, 0x0000, 0, NULL); |
269 | /* ctrl_out(gspca_dev, 0x40, 11, 0x0000, 0x0000, 0, NULL); */ | 240 | /* ctrl_out(gspca_dev, 0x40, 11, 0x0000, 0x0000, 0, NULL); */ |
@@ -275,6 +246,8 @@ static int ov2640_init_pre_alt(struct gspca_dev *gspca_dev) | |||
275 | { | 246 | { |
276 | struct sd *sd = (struct sd *) gspca_dev; | 247 | struct sd *sd = (struct sd *) gspca_dev; |
277 | 248 | ||
249 | sd->mirrorMask = 0; | ||
250 | |||
278 | sd->vold.backlight = -1; | 251 | sd->vold.backlight = -1; |
279 | sd->vold.brightness = -1; | 252 | sd->vold.brightness = -1; |
280 | sd->vold.sharpness = -1; | 253 | sd->vold.sharpness = -1; |
@@ -283,6 +256,8 @@ static int ov2640_init_pre_alt(struct gspca_dev *gspca_dev) | |||
283 | sd->vold.gamma = -1; | 256 | sd->vold.gamma = -1; |
284 | sd->vold.hue = -1; | 257 | sd->vold.hue = -1; |
285 | sd->vold.whitebal = -1; | 258 | sd->vold.whitebal = -1; |
259 | sd->vold.mirror = -1; | ||
260 | sd->vold.flip = -1; | ||
286 | 261 | ||
287 | ov2640_init_post_alt(gspca_dev); | 262 | ov2640_init_post_alt(gspca_dev); |
288 | 263 | ||
@@ -292,16 +267,16 @@ static int ov2640_init_pre_alt(struct gspca_dev *gspca_dev) | |||
292 | static int ov2640_init_post_alt(struct gspca_dev *gspca_dev) | 267 | static int ov2640_init_post_alt(struct gspca_dev *gspca_dev) |
293 | { | 268 | { |
294 | s32 reso = gspca_dev->cam.cam_mode[(s32) gspca_dev->curr_mode].priv; | 269 | s32 reso = gspca_dev->cam.cam_mode[(s32) gspca_dev->curr_mode].priv; |
295 | s32 n; /* reserved for FETCH macros */ | 270 | s32 n; /* reserved for FETCH functions */ |
296 | 271 | ||
297 | ctrl_out(gspca_dev, 0x40, 5, 0x0001, 0x0000, 0, NULL); | 272 | ctrl_out(gspca_dev, 0x40, 5, 0x0001, 0x0000, 0, NULL); |
298 | 273 | ||
299 | n = fetch_validx(gspca_dev, tbl_sensor_settings_common_a, | 274 | n = fetch_validx(gspca_dev, tbl_sensor_settings_common1, |
300 | ARRAY_SIZE(tbl_sensor_settings_common_a)); | 275 | ARRAY_SIZE(tbl_sensor_settings_common1)); |
301 | ctrl_out(gspca_dev, 0x40, 3, 0x0000, 0x0200, 12, dat_post); | 276 | ctrl_out(gspca_dev, 0x40, 3, 0x0000, 0x0200, 12, dat_post); |
302 | common(gspca_dev); | 277 | common(gspca_dev); |
303 | keep_on_fetching_validx(gspca_dev, tbl_sensor_settings_common_a, | 278 | keep_on_fetching_validx(gspca_dev, tbl_sensor_settings_common1, |
304 | ARRAY_SIZE(tbl_sensor_settings_common_a), n); | 279 | ARRAY_SIZE(tbl_sensor_settings_common1), n); |
305 | 280 | ||
306 | switch (reso) { | 281 | switch (reso) { |
307 | case IMAGE_640: | 282 | case IMAGE_640: |
@@ -316,18 +291,18 @@ static int ov2640_init_post_alt(struct gspca_dev *gspca_dev) | |||
316 | 291 | ||
317 | case IMAGE_1600: | 292 | case IMAGE_1600: |
318 | case IMAGE_1280: | 293 | case IMAGE_1280: |
319 | n = fetch_validx(gspca_dev, tbl_big_a, ARRAY_SIZE(tbl_big_a)); | 294 | n = fetch_validx(gspca_dev, tbl_big1, ARRAY_SIZE(tbl_big1)); |
320 | 295 | ||
321 | if (reso == IMAGE_1280) { | 296 | if (reso == IMAGE_1280) { |
322 | n = fetch_validx(gspca_dev, tbl_big_b, | 297 | n = fetch_validx(gspca_dev, tbl_big2, |
323 | ARRAY_SIZE(tbl_big_b)); | 298 | ARRAY_SIZE(tbl_big2)); |
324 | } else { | 299 | } else { |
325 | ctrl_out(gspca_dev, 0x40, 1, 0x601d, 0x0086, 0, NULL); | 300 | ctrl_out(gspca_dev, 0x40, 1, 0x601d, 0x0086, 0, NULL); |
326 | ctrl_out(gspca_dev, 0x40, 1, 0x6001, 0x00d7, 0, NULL); | 301 | ctrl_out(gspca_dev, 0x40, 1, 0x6001, 0x00d7, 0, NULL); |
327 | ctrl_out(gspca_dev, 0x40, 1, 0x6082, 0x00d3, 0, NULL); | 302 | ctrl_out(gspca_dev, 0x40, 1, 0x6082, 0x00d3, 0, NULL); |
328 | } | 303 | } |
329 | 304 | ||
330 | n = fetch_validx(gspca_dev, tbl_big_c, ARRAY_SIZE(tbl_big_c)); | 305 | n = fetch_validx(gspca_dev, tbl_big3, ARRAY_SIZE(tbl_big3)); |
331 | 306 | ||
332 | if (reso == IMAGE_1280) { | 307 | if (reso == IMAGE_1280) { |
333 | ctrl_out(gspca_dev, 0x40, 1, 0x6001, 0x00ff, 0, NULL); | 308 | ctrl_out(gspca_dev, 0x40, 1, 0x6001, 0x00ff, 0, NULL); |
@@ -343,20 +318,8 @@ static int ov2640_init_post_alt(struct gspca_dev *gspca_dev) | |||
343 | break; | 318 | break; |
344 | } | 319 | } |
345 | 320 | ||
346 | n = fetch_validx(gspca_dev, tbl_sensor_settings_common_b, | 321 | n = fetch_validx(gspca_dev, tbl_sensor_settings_common2, |
347 | ARRAY_SIZE(tbl_sensor_settings_common_b)); | 322 | ARRAY_SIZE(tbl_sensor_settings_common2)); |
348 | ctrl_in(gspca_dev, 0xc0, 2, 0x0000, 0x0000, 1, c50); | ||
349 | keep_on_fetching_validx(gspca_dev, tbl_sensor_settings_common_b, | ||
350 | ARRAY_SIZE(tbl_sensor_settings_common_b), n); | ||
351 | ctrl_in(gspca_dev, 0xc0, 2, 0x6000, 0x8004, 1, c28); | ||
352 | keep_on_fetching_validx(gspca_dev, tbl_sensor_settings_common_b, | ||
353 | ARRAY_SIZE(tbl_sensor_settings_common_b), n); | ||
354 | ctrl_in(gspca_dev, 0xc0, 2, 0x6000, 0x8004, 1, ca8); | ||
355 | keep_on_fetching_validx(gspca_dev, tbl_sensor_settings_common_b, | ||
356 | ARRAY_SIZE(tbl_sensor_settings_common_b), n); | ||
357 | ctrl_in(gspca_dev, 0xc0, 2, 0x0000, 0x0000, 1, c50); | ||
358 | keep_on_fetching_validx(gspca_dev, tbl_sensor_settings_common_b, | ||
359 | ARRAY_SIZE(tbl_sensor_settings_common_b), n); | ||
360 | 323 | ||
361 | ov2640_camera_settings(gspca_dev); | 324 | ov2640_camera_settings(gspca_dev); |
362 | 325 | ||
@@ -393,18 +356,20 @@ static int ov2640_camera_settings(struct gspca_dev *gspca_dev) | |||
393 | s32 sat = sd->vcur.saturation; | 356 | s32 sat = sd->vcur.saturation; |
394 | s32 hue = sd->vcur.hue; | 357 | s32 hue = sd->vcur.hue; |
395 | s32 wbal = sd->vcur.whitebal; | 358 | s32 wbal = sd->vcur.whitebal; |
359 | s32 mirror = (((sd->vcur.mirror > 0) ^ sd->mirrorMask) == 0); | ||
360 | s32 flip = (((sd->vcur.flip > 0) ^ sd->mirrorMask) == 0); | ||
396 | 361 | ||
397 | if (backlight != sd->vold.backlight) { | 362 | if (backlight != sd->vold.backlight) { |
363 | /* No sd->vold.backlight=backlight; (to be done again later) */ | ||
398 | if (backlight < 0 || backlight > sd->vmax.backlight) | 364 | if (backlight < 0 || backlight > sd->vmax.backlight) |
399 | backlight = 0; | 365 | backlight = 0; |
400 | 366 | ||
401 | ctrl_out(gspca_dev, 0x40, 1, 0x6001 , 0x00ff, | 367 | ctrl_out(gspca_dev, 0x40, 1, 0x6001 , 0x00ff, |
402 | 0, NULL); | 368 | 0, NULL); |
403 | ctrl_out(gspca_dev, 0x40, 1, 0x601f + backlight , 0x0024, | 369 | ctrl_out(gspca_dev, 0x40, 1, 0x601e + backlight , 0x0024, |
404 | 0, NULL); | 370 | 0, NULL); |
405 | ctrl_out(gspca_dev, 0x40, 1, 0x601f + backlight - 10, 0x0025, | 371 | ctrl_out(gspca_dev, 0x40, 1, 0x601e + backlight - 10, 0x0025, |
406 | 0, NULL); | 372 | 0, NULL); |
407 | /* No sd->vold.backlight=backlight; (to be done again later) */ | ||
408 | } | 373 | } |
409 | 374 | ||
410 | if (bright != sd->vold.brightness) { | 375 | if (bright != sd->vold.brightness) { |
@@ -466,7 +431,7 @@ static int ov2640_camera_settings(struct gspca_dev *gspca_dev) | |||
466 | ctrl_out(gspca_dev, 0x40, 1, 0x6002 , 0x007c, 0, NULL); | 431 | ctrl_out(gspca_dev, 0x40, 1, 0x6002 , 0x007c, 0, NULL); |
467 | ctrl_out(gspca_dev, 0x40, 1, 0x6000 + hue * (hue < 255), 0x007d, | 432 | ctrl_out(gspca_dev, 0x40, 1, 0x6000 + hue * (hue < 255), 0x007d, |
468 | 0, NULL); | 433 | 0, NULL); |
469 | if (hue >= sd->vmax.hue) | 434 | if (hue >= 255) |
470 | sd->swapRB = 1; | 435 | sd->swapRB = 1; |
471 | else | 436 | else |
472 | sd->swapRB = 0; | 437 | sd->swapRB = 0; |
@@ -482,14 +447,33 @@ static int ov2640_camera_settings(struct gspca_dev *gspca_dev) | |||
482 | ctrl_out(gspca_dev, 0x40, 1, 0x6000 + gam, 0x007d, 0, NULL); | 447 | ctrl_out(gspca_dev, 0x40, 1, 0x6000 + gam, 0x007d, 0, NULL); |
483 | } | 448 | } |
484 | 449 | ||
450 | if (mirror != sd->vold.mirror || flip != sd->vold.flip) { | ||
451 | sd->vold.mirror = mirror; | ||
452 | sd->vold.flip = flip; | ||
453 | |||
454 | mirror = 0x80 * mirror; | ||
455 | ctrl_out(gspca_dev, 0x40, 1, 0x6001, 0x00ff, 0, NULL); | ||
456 | ctrl_out(gspca_dev, 0x40, 1, 0x6000, 0x8004, 0, NULL); | ||
457 | ctrl_in(gspca_dev, 0xc0, 2, 0x6000, 0x8004, 1, c28); | ||
458 | ctrl_out(gspca_dev, 0x40, 1, 0x6028 + mirror, 0x0004, 0, NULL); | ||
459 | |||
460 | flip = 0x50 * flip + mirror; | ||
461 | ctrl_out(gspca_dev, 0x40, 1, 0x6001, 0x00ff, 0, NULL); | ||
462 | ctrl_out(gspca_dev, 0x40, 1, 0x6000, 0x8004, 0, NULL); | ||
463 | ctrl_in(gspca_dev, 0xc0, 2, 0x6000, 0x8004, 1, ca8); | ||
464 | ctrl_out(gspca_dev, 0x40, 1, 0x6028 + flip, 0x0004, 0, NULL); | ||
465 | |||
466 | ctrl_in(gspca_dev, 0xc0, 2, 0x0000, 0x0000, 1, c50); | ||
467 | } | ||
468 | |||
485 | if (backlight != sd->vold.backlight) { | 469 | if (backlight != sd->vold.backlight) { |
486 | sd->vold.backlight = backlight; | 470 | sd->vold.backlight = backlight; |
487 | 471 | ||
488 | ctrl_out(gspca_dev, 0x40, 1, 0x6001 , 0x00ff, | 472 | ctrl_out(gspca_dev, 0x40, 1, 0x6001 , 0x00ff, |
489 | 0, NULL); | 473 | 0, NULL); |
490 | ctrl_out(gspca_dev, 0x40, 1, 0x601f + backlight , 0x0024, | 474 | ctrl_out(gspca_dev, 0x40, 1, 0x601e + backlight , 0x0024, |
491 | 0, NULL); | 475 | 0, NULL); |
492 | ctrl_out(gspca_dev, 0x40, 1, 0x601f + backlight - 10, 0x0025, | 476 | ctrl_out(gspca_dev, 0x40, 1, 0x601e + backlight - 10, 0x0025, |
493 | 0, NULL); | 477 | 0, NULL); |
494 | } | 478 | } |
495 | 479 | ||