diff options
Diffstat (limited to 'drivers/media/video/gspca/ov534.c')
-rw-r--r-- | drivers/media/video/gspca/ov534.c | 980 |
1 files changed, 593 insertions, 387 deletions
diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c index 04da22802736..0c6369b7fe18 100644 --- a/drivers/media/video/gspca/ov534.c +++ b/drivers/media/video/gspca/ov534.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * ov534-ov772x gspca driver | 2 | * ov534-ov7xxx gspca driver |
3 | * | 3 | * |
4 | * Copyright (C) 2008 Antonio Ospite <ospite@studenti.unina.it> | 4 | * Copyright (C) 2008 Antonio Ospite <ospite@studenti.unina.it> |
5 | * Copyright (C) 2008 Jim Paris <jim@jtan.com> | 5 | * Copyright (C) 2008 Jim Paris <jim@jtan.com> |
@@ -49,54 +49,59 @@ MODULE_AUTHOR("Antonio Ospite <ospite@studenti.unina.it>"); | |||
49 | MODULE_DESCRIPTION("GSPCA/OV534 USB Camera Driver"); | 49 | MODULE_DESCRIPTION("GSPCA/OV534 USB Camera Driver"); |
50 | MODULE_LICENSE("GPL"); | 50 | MODULE_LICENSE("GPL"); |
51 | 51 | ||
52 | /* controls */ | ||
53 | enum e_ctrl { | ||
54 | BRIGHTNESS, | ||
55 | CONTRAST, | ||
56 | GAIN, | ||
57 | EXPOSURE, | ||
58 | AGC, | ||
59 | AWB, | ||
60 | AEC, | ||
61 | SHARPNESS, | ||
62 | HFLIP, | ||
63 | VFLIP, | ||
64 | COLORS, | ||
65 | LIGHTFREQ, | ||
66 | NCTRLS /* number of controls */ | ||
67 | }; | ||
68 | |||
52 | /* specific webcam descriptor */ | 69 | /* specific webcam descriptor */ |
53 | struct sd { | 70 | struct sd { |
54 | struct gspca_dev gspca_dev; /* !! must be the first item */ | 71 | struct gspca_dev gspca_dev; /* !! must be the first item */ |
72 | |||
73 | struct gspca_ctrl ctrls[NCTRLS]; | ||
74 | |||
55 | __u32 last_pts; | 75 | __u32 last_pts; |
56 | u16 last_fid; | 76 | u16 last_fid; |
57 | u8 frame_rate; | 77 | u8 frame_rate; |
58 | 78 | ||
59 | u8 brightness; | 79 | u8 sensor; |
60 | u8 contrast; | 80 | }; |
61 | u8 gain; | 81 | enum sensors { |
62 | u8 exposure; | 82 | SENSOR_OV767x, |
63 | u8 agc; | 83 | SENSOR_OV772x, |
64 | u8 awb; | 84 | NSENSORS |
65 | u8 aec; | ||
66 | s8 sharpness; | ||
67 | u8 hflip; | ||
68 | u8 vflip; | ||
69 | u8 freqfltr; | ||
70 | }; | 85 | }; |
71 | 86 | ||
72 | /* V4L2 controls supported by the driver */ | 87 | /* V4L2 controls supported by the driver */ |
73 | static int sd_setgain(struct gspca_dev *gspca_dev, __s32 val); | 88 | static void setbrightness(struct gspca_dev *gspca_dev); |
74 | static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val); | 89 | static void setcontrast(struct gspca_dev *gspca_dev); |
75 | static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val); | 90 | static void setgain(struct gspca_dev *gspca_dev); |
76 | static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val); | 91 | static void setexposure(struct gspca_dev *gspca_dev); |
77 | static int sd_setagc(struct gspca_dev *gspca_dev, __s32 val); | 92 | static int sd_setagc(struct gspca_dev *gspca_dev, __s32 val); |
78 | static int sd_getagc(struct gspca_dev *gspca_dev, __s32 *val); | 93 | static void setawb(struct gspca_dev *gspca_dev); |
79 | static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val); | 94 | static void setaec(struct gspca_dev *gspca_dev); |
80 | static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val); | 95 | static void setsharpness(struct gspca_dev *gspca_dev); |
81 | static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val); | 96 | static void sethvflip(struct gspca_dev *gspca_dev); |
82 | static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val); | 97 | static void setcolors(struct gspca_dev *gspca_dev); |
83 | static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val); | 98 | static void setlightfreq(struct gspca_dev *gspca_dev); |
84 | static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val); | 99 | |
85 | static int sd_setawb(struct gspca_dev *gspca_dev, __s32 val); | 100 | static int sd_start(struct gspca_dev *gspca_dev); |
86 | static int sd_getawb(struct gspca_dev *gspca_dev, __s32 *val); | 101 | static void sd_stopN(struct gspca_dev *gspca_dev); |
87 | static int sd_setaec(struct gspca_dev *gspca_dev, __s32 val); | ||
88 | static int sd_getaec(struct gspca_dev *gspca_dev, __s32 *val); | ||
89 | static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val); | ||
90 | static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val); | ||
91 | static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val); | ||
92 | static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val); | ||
93 | static int sd_setfreqfltr(struct gspca_dev *gspca_dev, __s32 val); | ||
94 | static int sd_getfreqfltr(struct gspca_dev *gspca_dev, __s32 *val); | ||
95 | static int sd_querymenu(struct gspca_dev *gspca_dev, | ||
96 | struct v4l2_querymenu *menu); | ||
97 | 102 | ||
98 | static const struct ctrl sd_ctrls[] = { | 103 | static const struct ctrl sd_ctrls[] = { |
99 | { /* 0 */ | 104 | [BRIGHTNESS] = { |
100 | { | 105 | { |
101 | .id = V4L2_CID_BRIGHTNESS, | 106 | .id = V4L2_CID_BRIGHTNESS, |
102 | .type = V4L2_CTRL_TYPE_INTEGER, | 107 | .type = V4L2_CTRL_TYPE_INTEGER, |
@@ -104,13 +109,11 @@ static const struct ctrl sd_ctrls[] = { | |||
104 | .minimum = 0, | 109 | .minimum = 0, |
105 | .maximum = 255, | 110 | .maximum = 255, |
106 | .step = 1, | 111 | .step = 1, |
107 | #define BRIGHTNESS_DEF 0 | 112 | .default_value = 0, |
108 | .default_value = BRIGHTNESS_DEF, | ||
109 | }, | 113 | }, |
110 | .set = sd_setbrightness, | 114 | .set_control = setbrightness |
111 | .get = sd_getbrightness, | ||
112 | }, | 115 | }, |
113 | { /* 1 */ | 116 | [CONTRAST] = { |
114 | { | 117 | { |
115 | .id = V4L2_CID_CONTRAST, | 118 | .id = V4L2_CID_CONTRAST, |
116 | .type = V4L2_CTRL_TYPE_INTEGER, | 119 | .type = V4L2_CTRL_TYPE_INTEGER, |
@@ -118,13 +121,11 @@ static const struct ctrl sd_ctrls[] = { | |||
118 | .minimum = 0, | 121 | .minimum = 0, |
119 | .maximum = 255, | 122 | .maximum = 255, |
120 | .step = 1, | 123 | .step = 1, |
121 | #define CONTRAST_DEF 32 | 124 | .default_value = 32, |
122 | .default_value = CONTRAST_DEF, | ||
123 | }, | 125 | }, |
124 | .set = sd_setcontrast, | 126 | .set_control = setcontrast |
125 | .get = sd_getcontrast, | ||
126 | }, | 127 | }, |
127 | { /* 2 */ | 128 | [GAIN] = { |
128 | { | 129 | { |
129 | .id = V4L2_CID_GAIN, | 130 | .id = V4L2_CID_GAIN, |
130 | .type = V4L2_CTRL_TYPE_INTEGER, | 131 | .type = V4L2_CTRL_TYPE_INTEGER, |
@@ -132,13 +133,11 @@ static const struct ctrl sd_ctrls[] = { | |||
132 | .minimum = 0, | 133 | .minimum = 0, |
133 | .maximum = 63, | 134 | .maximum = 63, |
134 | .step = 1, | 135 | .step = 1, |
135 | #define GAIN_DEF 20 | 136 | .default_value = 20, |
136 | .default_value = GAIN_DEF, | ||
137 | }, | 137 | }, |
138 | .set = sd_setgain, | 138 | .set_control = setgain |
139 | .get = sd_getgain, | ||
140 | }, | 139 | }, |
141 | { /* 3 */ | 140 | [EXPOSURE] = { |
142 | { | 141 | { |
143 | .id = V4L2_CID_EXPOSURE, | 142 | .id = V4L2_CID_EXPOSURE, |
144 | .type = V4L2_CTRL_TYPE_INTEGER, | 143 | .type = V4L2_CTRL_TYPE_INTEGER, |
@@ -146,13 +145,11 @@ static const struct ctrl sd_ctrls[] = { | |||
146 | .minimum = 0, | 145 | .minimum = 0, |
147 | .maximum = 255, | 146 | .maximum = 255, |
148 | .step = 1, | 147 | .step = 1, |
149 | #define EXPO_DEF 120 | 148 | .default_value = 120, |
150 | .default_value = EXPO_DEF, | ||
151 | }, | 149 | }, |
152 | .set = sd_setexposure, | 150 | .set_control = setexposure |
153 | .get = sd_getexposure, | ||
154 | }, | 151 | }, |
155 | { /* 4 */ | 152 | [AGC] = { |
156 | { | 153 | { |
157 | .id = V4L2_CID_AUTOGAIN, | 154 | .id = V4L2_CID_AUTOGAIN, |
158 | .type = V4L2_CTRL_TYPE_BOOLEAN, | 155 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
@@ -160,14 +157,11 @@ static const struct ctrl sd_ctrls[] = { | |||
160 | .minimum = 0, | 157 | .minimum = 0, |
161 | .maximum = 1, | 158 | .maximum = 1, |
162 | .step = 1, | 159 | .step = 1, |
163 | #define AGC_DEF 1 | 160 | .default_value = 1, |
164 | .default_value = AGC_DEF, | ||
165 | }, | 161 | }, |
166 | .set = sd_setagc, | 162 | .set = sd_setagc |
167 | .get = sd_getagc, | ||
168 | }, | 163 | }, |
169 | #define AWB_IDX 5 | 164 | [AWB] = { |
170 | { /* 5 */ | ||
171 | { | 165 | { |
172 | .id = V4L2_CID_AUTO_WHITE_BALANCE, | 166 | .id = V4L2_CID_AUTO_WHITE_BALANCE, |
173 | .type = V4L2_CTRL_TYPE_BOOLEAN, | 167 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
@@ -175,13 +169,11 @@ static const struct ctrl sd_ctrls[] = { | |||
175 | .minimum = 0, | 169 | .minimum = 0, |
176 | .maximum = 1, | 170 | .maximum = 1, |
177 | .step = 1, | 171 | .step = 1, |
178 | #define AWB_DEF 1 | 172 | .default_value = 1, |
179 | .default_value = AWB_DEF, | ||
180 | }, | 173 | }, |
181 | .set = sd_setawb, | 174 | .set_control = setawb |
182 | .get = sd_getawb, | ||
183 | }, | 175 | }, |
184 | { /* 6 */ | 176 | [AEC] = { |
185 | { | 177 | { |
186 | .id = V4L2_CID_EXPOSURE_AUTO, | 178 | .id = V4L2_CID_EXPOSURE_AUTO, |
187 | .type = V4L2_CTRL_TYPE_BOOLEAN, | 179 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
@@ -189,13 +181,11 @@ static const struct ctrl sd_ctrls[] = { | |||
189 | .minimum = 0, | 181 | .minimum = 0, |
190 | .maximum = 1, | 182 | .maximum = 1, |
191 | .step = 1, | 183 | .step = 1, |
192 | #define AEC_DEF 1 | 184 | .default_value = 1, |
193 | .default_value = AEC_DEF, | ||
194 | }, | 185 | }, |
195 | .set = sd_setaec, | 186 | .set_control = setaec |
196 | .get = sd_getaec, | ||
197 | }, | 187 | }, |
198 | { /* 7 */ | 188 | [SHARPNESS] = { |
199 | { | 189 | { |
200 | .id = V4L2_CID_SHARPNESS, | 190 | .id = V4L2_CID_SHARPNESS, |
201 | .type = V4L2_CTRL_TYPE_INTEGER, | 191 | .type = V4L2_CTRL_TYPE_INTEGER, |
@@ -203,13 +193,11 @@ static const struct ctrl sd_ctrls[] = { | |||
203 | .minimum = 0, | 193 | .minimum = 0, |
204 | .maximum = 63, | 194 | .maximum = 63, |
205 | .step = 1, | 195 | .step = 1, |
206 | #define SHARPNESS_DEF 0 | 196 | .default_value = 0, |
207 | .default_value = SHARPNESS_DEF, | ||
208 | }, | 197 | }, |
209 | .set = sd_setsharpness, | 198 | .set_control = setsharpness |
210 | .get = sd_getsharpness, | ||
211 | }, | 199 | }, |
212 | { /* 8 */ | 200 | [HFLIP] = { |
213 | { | 201 | { |
214 | .id = V4L2_CID_HFLIP, | 202 | .id = V4L2_CID_HFLIP, |
215 | .type = V4L2_CTRL_TYPE_BOOLEAN, | 203 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
@@ -217,13 +205,11 @@ static const struct ctrl sd_ctrls[] = { | |||
217 | .minimum = 0, | 205 | .minimum = 0, |
218 | .maximum = 1, | 206 | .maximum = 1, |
219 | .step = 1, | 207 | .step = 1, |
220 | #define HFLIP_DEF 0 | 208 | .default_value = 0, |
221 | .default_value = HFLIP_DEF, | ||
222 | }, | 209 | }, |
223 | .set = sd_sethflip, | 210 | .set_control = sethvflip |
224 | .get = sd_gethflip, | ||
225 | }, | 211 | }, |
226 | { /* 9 */ | 212 | [VFLIP] = { |
227 | { | 213 | { |
228 | .id = V4L2_CID_VFLIP, | 214 | .id = V4L2_CID_VFLIP, |
229 | .type = V4L2_CTRL_TYPE_BOOLEAN, | 215 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
@@ -231,13 +217,23 @@ static const struct ctrl sd_ctrls[] = { | |||
231 | .minimum = 0, | 217 | .minimum = 0, |
232 | .maximum = 1, | 218 | .maximum = 1, |
233 | .step = 1, | 219 | .step = 1, |
234 | #define VFLIP_DEF 0 | 220 | .default_value = 0, |
235 | .default_value = VFLIP_DEF, | ||
236 | }, | 221 | }, |
237 | .set = sd_setvflip, | 222 | .set_control = sethvflip |
238 | .get = sd_getvflip, | ||
239 | }, | 223 | }, |
240 | { /* 10 */ | 224 | [COLORS] = { |
225 | { | ||
226 | .id = V4L2_CID_SATURATION, | ||
227 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
228 | .name = "Saturation", | ||
229 | .minimum = 0, | ||
230 | .maximum = 6, | ||
231 | .step = 1, | ||
232 | .default_value = 3, | ||
233 | }, | ||
234 | .set_control = setcolors | ||
235 | }, | ||
236 | [LIGHTFREQ] = { | ||
241 | { | 237 | { |
242 | .id = V4L2_CID_POWER_LINE_FREQUENCY, | 238 | .id = V4L2_CID_POWER_LINE_FREQUENCY, |
243 | .type = V4L2_CTRL_TYPE_MENU, | 239 | .type = V4L2_CTRL_TYPE_MENU, |
@@ -245,11 +241,9 @@ static const struct ctrl sd_ctrls[] = { | |||
245 | .minimum = 0, | 241 | .minimum = 0, |
246 | .maximum = 1, | 242 | .maximum = 1, |
247 | .step = 1, | 243 | .step = 1, |
248 | #define FREQFLTR_DEF 0 | 244 | .default_value = 0, |
249 | .default_value = FREQFLTR_DEF, | ||
250 | }, | 245 | }, |
251 | .set = sd_setfreqfltr, | 246 | .set_control = setlightfreq |
252 | .get = sd_getfreqfltr, | ||
253 | }, | 247 | }, |
254 | }; | 248 | }; |
255 | 249 | ||
@@ -265,6 +259,16 @@ static const struct v4l2_pix_format ov772x_mode[] = { | |||
265 | .colorspace = V4L2_COLORSPACE_SRGB, | 259 | .colorspace = V4L2_COLORSPACE_SRGB, |
266 | .priv = 0}, | 260 | .priv = 0}, |
267 | }; | 261 | }; |
262 | static const struct v4l2_pix_format ov767x_mode[] = { | ||
263 | {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, | ||
264 | .bytesperline = 320, | ||
265 | .sizeimage = 320 * 240 * 3 / 8 + 590, | ||
266 | .colorspace = V4L2_COLORSPACE_JPEG}, | ||
267 | {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, | ||
268 | .bytesperline = 640, | ||
269 | .sizeimage = 640 * 480 * 3 / 8 + 590, | ||
270 | .colorspace = V4L2_COLORSPACE_JPEG}, | ||
271 | }; | ||
268 | 272 | ||
269 | static const u8 qvga_rates[] = {125, 100, 75, 60, 50, 40, 30}; | 273 | static const u8 qvga_rates[] = {125, 100, 75, 60, 50, 40, 30}; |
270 | static const u8 vga_rates[] = {60, 50, 40, 30, 15}; | 274 | static const u8 vga_rates[] = {60, 50, 40, 30, 15}; |
@@ -280,7 +284,288 @@ static const struct framerates ov772x_framerates[] = { | |||
280 | }, | 284 | }, |
281 | }; | 285 | }; |
282 | 286 | ||
283 | static const u8 bridge_init[][2] = { | 287 | struct reg_array { |
288 | const u8 (*val)[2]; | ||
289 | int len; | ||
290 | }; | ||
291 | |||
292 | static const u8 bridge_init_767x[][2] = { | ||
293 | /* comments from the ms-win file apollo7670.set */ | ||
294 | /* str1 */ | ||
295 | {0xf1, 0x42}, | ||
296 | {0x88, 0xf8}, | ||
297 | {0x89, 0xff}, | ||
298 | {0x76, 0x03}, | ||
299 | {0x92, 0x03}, | ||
300 | {0x95, 0x10}, | ||
301 | {0xe2, 0x00}, | ||
302 | {0xe7, 0x3e}, | ||
303 | {0x8d, 0x1c}, | ||
304 | {0x8e, 0x00}, | ||
305 | {0x8f, 0x00}, | ||
306 | {0x1f, 0x00}, | ||
307 | {0xc3, 0xf9}, | ||
308 | {0x89, 0xff}, | ||
309 | {0x88, 0xf8}, | ||
310 | {0x76, 0x03}, | ||
311 | {0x92, 0x01}, | ||
312 | {0x93, 0x18}, | ||
313 | {0x1c, 0x00}, | ||
314 | {0x1d, 0x48}, | ||
315 | {0x1d, 0x00}, | ||
316 | {0x1d, 0xff}, | ||
317 | {0x1d, 0x02}, | ||
318 | {0x1d, 0x58}, | ||
319 | {0x1d, 0x00}, | ||
320 | {0x1c, 0x0a}, | ||
321 | {0x1d, 0x0a}, | ||
322 | {0x1d, 0x0e}, | ||
323 | {0xc0, 0x50}, /* HSize 640 */ | ||
324 | {0xc1, 0x3c}, /* VSize 480 */ | ||
325 | {0x34, 0x05}, /* enable Audio Suspend mode */ | ||
326 | {0xc2, 0x0c}, /* Input YUV */ | ||
327 | {0xc3, 0xf9}, /* enable PRE */ | ||
328 | {0x34, 0x05}, /* enable Audio Suspend mode */ | ||
329 | {0xe7, 0x2e}, /* this solves failure of "SuspendResumeTest" */ | ||
330 | {0x31, 0xf9}, /* enable 1.8V Suspend */ | ||
331 | {0x35, 0x02}, /* turn on JPEG */ | ||
332 | {0xd9, 0x10}, | ||
333 | {0x25, 0x42}, /* GPIO[8]:Input */ | ||
334 | {0x94, 0x11}, /* If the default setting is loaded when | ||
335 | * system boots up, this flag is closed here */ | ||
336 | }; | ||
337 | static const u8 sensor_init_767x[][2] = { | ||
338 | {0x12, 0x80}, | ||
339 | {0x11, 0x03}, | ||
340 | {0x3a, 0x04}, | ||
341 | {0x12, 0x00}, | ||
342 | {0x17, 0x13}, | ||
343 | {0x18, 0x01}, | ||
344 | {0x32, 0xb6}, | ||
345 | {0x19, 0x02}, | ||
346 | {0x1a, 0x7a}, | ||
347 | {0x03, 0x0a}, | ||
348 | {0x0c, 0x00}, | ||
349 | {0x3e, 0x00}, | ||
350 | {0x70, 0x3a}, | ||
351 | {0x71, 0x35}, | ||
352 | {0x72, 0x11}, | ||
353 | {0x73, 0xf0}, | ||
354 | {0xa2, 0x02}, | ||
355 | {0x7a, 0x2a}, /* set Gamma=1.6 below */ | ||
356 | {0x7b, 0x12}, | ||
357 | {0x7c, 0x1d}, | ||
358 | {0x7d, 0x2d}, | ||
359 | {0x7e, 0x45}, | ||
360 | {0x7f, 0x50}, | ||
361 | {0x80, 0x59}, | ||
362 | {0x81, 0x62}, | ||
363 | {0x82, 0x6b}, | ||
364 | {0x83, 0x73}, | ||
365 | {0x84, 0x7b}, | ||
366 | {0x85, 0x8a}, | ||
367 | {0x86, 0x98}, | ||
368 | {0x87, 0xb2}, | ||
369 | {0x88, 0xca}, | ||
370 | {0x89, 0xe0}, | ||
371 | {0x13, 0xe0}, | ||
372 | {0x00, 0x00}, | ||
373 | {0x10, 0x00}, | ||
374 | {0x0d, 0x40}, | ||
375 | {0x14, 0x38}, /* gain max 16x */ | ||
376 | {0xa5, 0x05}, | ||
377 | {0xab, 0x07}, | ||
378 | {0x24, 0x95}, | ||
379 | {0x25, 0x33}, | ||
380 | {0x26, 0xe3}, | ||
381 | {0x9f, 0x78}, | ||
382 | {0xa0, 0x68}, | ||
383 | {0xa1, 0x03}, | ||
384 | {0xa6, 0xd8}, | ||
385 | {0xa7, 0xd8}, | ||
386 | {0xa8, 0xf0}, | ||
387 | {0xa9, 0x90}, | ||
388 | {0xaa, 0x94}, | ||
389 | {0x13, 0xe5}, | ||
390 | {0x0e, 0x61}, | ||
391 | {0x0f, 0x4b}, | ||
392 | {0x16, 0x02}, | ||
393 | {0x21, 0x02}, | ||
394 | {0x22, 0x91}, | ||
395 | {0x29, 0x07}, | ||
396 | {0x33, 0x0b}, | ||
397 | {0x35, 0x0b}, | ||
398 | {0x37, 0x1d}, | ||
399 | {0x38, 0x71}, | ||
400 | {0x39, 0x2a}, | ||
401 | {0x3c, 0x78}, | ||
402 | {0x4d, 0x40}, | ||
403 | {0x4e, 0x20}, | ||
404 | {0x69, 0x00}, | ||
405 | {0x6b, 0x4a}, | ||
406 | {0x74, 0x10}, | ||
407 | {0x8d, 0x4f}, | ||
408 | {0x8e, 0x00}, | ||
409 | {0x8f, 0x00}, | ||
410 | {0x90, 0x00}, | ||
411 | {0x91, 0x00}, | ||
412 | {0x96, 0x00}, | ||
413 | {0x9a, 0x80}, | ||
414 | {0xb0, 0x84}, | ||
415 | {0xb1, 0x0c}, | ||
416 | {0xb2, 0x0e}, | ||
417 | {0xb3, 0x82}, | ||
418 | {0xb8, 0x0a}, | ||
419 | {0x43, 0x0a}, | ||
420 | {0x44, 0xf0}, | ||
421 | {0x45, 0x34}, | ||
422 | {0x46, 0x58}, | ||
423 | {0x47, 0x28}, | ||
424 | {0x48, 0x3a}, | ||
425 | {0x59, 0x88}, | ||
426 | {0x5a, 0x88}, | ||
427 | {0x5b, 0x44}, | ||
428 | {0x5c, 0x67}, | ||
429 | {0x5d, 0x49}, | ||
430 | {0x5e, 0x0e}, | ||
431 | {0x6c, 0x0a}, | ||
432 | {0x6d, 0x55}, | ||
433 | {0x6e, 0x11}, | ||
434 | {0x6f, 0x9f}, | ||
435 | {0x6a, 0x40}, | ||
436 | {0x01, 0x40}, | ||
437 | {0x02, 0x40}, | ||
438 | {0x13, 0xe7}, | ||
439 | {0x4f, 0x80}, | ||
440 | {0x50, 0x80}, | ||
441 | {0x51, 0x00}, | ||
442 | {0x52, 0x22}, | ||
443 | {0x53, 0x5e}, | ||
444 | {0x54, 0x80}, | ||
445 | {0x58, 0x9e}, | ||
446 | {0x41, 0x08}, | ||
447 | {0x3f, 0x00}, | ||
448 | {0x75, 0x04}, | ||
449 | {0x76, 0xe1}, | ||
450 | {0x4c, 0x00}, | ||
451 | {0x77, 0x01}, | ||
452 | {0x3d, 0xc2}, | ||
453 | {0x4b, 0x09}, | ||
454 | {0xc9, 0x60}, | ||
455 | {0x41, 0x38}, /* jfm: auto sharpness + auto de-noise */ | ||
456 | {0x56, 0x40}, | ||
457 | {0x34, 0x11}, | ||
458 | {0x3b, 0xc2}, | ||
459 | {0xa4, 0x8a}, /* Night mode trigger point */ | ||
460 | {0x96, 0x00}, | ||
461 | {0x97, 0x30}, | ||
462 | {0x98, 0x20}, | ||
463 | {0x99, 0x20}, | ||
464 | {0x9a, 0x84}, | ||
465 | {0x9b, 0x29}, | ||
466 | {0x9c, 0x03}, | ||
467 | {0x9d, 0x4c}, | ||
468 | {0x9e, 0x3f}, | ||
469 | {0x78, 0x04}, | ||
470 | {0x79, 0x01}, | ||
471 | {0xc8, 0xf0}, | ||
472 | {0x79, 0x0f}, | ||
473 | {0xc8, 0x00}, | ||
474 | {0x79, 0x10}, | ||
475 | {0xc8, 0x7e}, | ||
476 | {0x79, 0x0a}, | ||
477 | {0xc8, 0x80}, | ||
478 | {0x79, 0x0b}, | ||
479 | {0xc8, 0x01}, | ||
480 | {0x79, 0x0c}, | ||
481 | {0xc8, 0x0f}, | ||
482 | {0x79, 0x0d}, | ||
483 | {0xc8, 0x20}, | ||
484 | {0x79, 0x09}, | ||
485 | {0xc8, 0x80}, | ||
486 | {0x79, 0x02}, | ||
487 | {0xc8, 0xc0}, | ||
488 | {0x79, 0x03}, | ||
489 | {0xc8, 0x20}, | ||
490 | {0x79, 0x26}, | ||
491 | }; | ||
492 | static const u8 bridge_start_vga_767x[][2] = { | ||
493 | /* str59 JPG */ | ||
494 | {0x94, 0xaa}, | ||
495 | {0xf1, 0x42}, | ||
496 | {0xe5, 0x04}, | ||
497 | {0xc0, 0x50}, | ||
498 | {0xc1, 0x3c}, | ||
499 | {0xc2, 0x0c}, | ||
500 | {0x35, 0x02}, /* turn on JPEG */ | ||
501 | {0xd9, 0x10}, | ||
502 | {0xda, 0x00}, /* for higher clock rate(30fps) */ | ||
503 | {0x34, 0x05}, /* enable Audio Suspend mode */ | ||
504 | {0xc3, 0xf9}, /* enable PRE */ | ||
505 | {0x8c, 0x00}, /* CIF VSize LSB[2:0] */ | ||
506 | {0x8d, 0x1c}, /* output YUV */ | ||
507 | /* {0x34, 0x05}, * enable Audio Suspend mode (?) */ | ||
508 | {0x50, 0x00}, /* H/V divider=0 */ | ||
509 | {0x51, 0xa0}, /* input H=640/4 */ | ||
510 | {0x52, 0x3c}, /* input V=480/4 */ | ||
511 | {0x53, 0x00}, /* offset X=0 */ | ||
512 | {0x54, 0x00}, /* offset Y=0 */ | ||
513 | {0x55, 0x00}, /* H/V size[8]=0 */ | ||
514 | {0x57, 0x00}, /* H-size[9]=0 */ | ||
515 | {0x5c, 0x00}, /* output size[9:8]=0 */ | ||
516 | {0x5a, 0xa0}, /* output H=640/4 */ | ||
517 | {0x5b, 0x78}, /* output V=480/4 */ | ||
518 | {0x1c, 0x0a}, | ||
519 | {0x1d, 0x0a}, | ||
520 | {0x94, 0x11}, | ||
521 | }; | ||
522 | static const u8 sensor_start_vga_767x[][2] = { | ||
523 | {0x11, 0x01}, | ||
524 | {0x1e, 0x04}, | ||
525 | {0x19, 0x02}, | ||
526 | {0x1a, 0x7a}, | ||
527 | }; | ||
528 | static const u8 bridge_start_qvga_767x[][2] = { | ||
529 | /* str86 JPG */ | ||
530 | {0x94, 0xaa}, | ||
531 | {0xf1, 0x42}, | ||
532 | {0xe5, 0x04}, | ||
533 | {0xc0, 0x80}, | ||
534 | {0xc1, 0x60}, | ||
535 | {0xc2, 0x0c}, | ||
536 | {0x35, 0x02}, /* turn on JPEG */ | ||
537 | {0xd9, 0x10}, | ||
538 | {0xc0, 0x50}, /* CIF HSize 640 */ | ||
539 | {0xc1, 0x3c}, /* CIF VSize 480 */ | ||
540 | {0x8c, 0x00}, /* CIF VSize LSB[2:0] */ | ||
541 | {0x8d, 0x1c}, /* output YUV */ | ||
542 | {0x34, 0x05}, /* enable Audio Suspend mode */ | ||
543 | {0xc2, 0x4c}, /* output YUV and Enable DCW */ | ||
544 | {0xc3, 0xf9}, /* enable PRE */ | ||
545 | {0x1c, 0x00}, /* indirect addressing */ | ||
546 | {0x1d, 0x48}, /* output YUV422 */ | ||
547 | {0x50, 0x89}, /* H/V divider=/2; plus DCW AVG */ | ||
548 | {0x51, 0xa0}, /* DCW input H=640/4 */ | ||
549 | {0x52, 0x78}, /* DCW input V=480/4 */ | ||
550 | {0x53, 0x00}, /* offset X=0 */ | ||
551 | {0x54, 0x00}, /* offset Y=0 */ | ||
552 | {0x55, 0x00}, /* H/V size[8]=0 */ | ||
553 | {0x57, 0x00}, /* H-size[9]=0 */ | ||
554 | {0x5c, 0x00}, /* DCW output size[9:8]=0 */ | ||
555 | {0x5a, 0x50}, /* DCW output H=320/4 */ | ||
556 | {0x5b, 0x3c}, /* DCW output V=240/4 */ | ||
557 | {0x1c, 0x0a}, | ||
558 | {0x1d, 0x0a}, | ||
559 | {0x94, 0x11}, | ||
560 | }; | ||
561 | static const u8 sensor_start_qvga_767x[][2] = { | ||
562 | {0x11, 0x01}, | ||
563 | {0x1e, 0x04}, | ||
564 | {0x19, 0x02}, | ||
565 | {0x1a, 0x7a}, | ||
566 | }; | ||
567 | |||
568 | static const u8 bridge_init_772x[][2] = { | ||
284 | { 0xc2, 0x0c }, | 569 | { 0xc2, 0x0c }, |
285 | { 0x88, 0xf8 }, | 570 | { 0x88, 0xf8 }, |
286 | { 0xc3, 0x69 }, | 571 | { 0xc3, 0x69 }, |
@@ -338,7 +623,7 @@ static const u8 bridge_init[][2] = { | |||
338 | { 0xc1, 0x3c }, | 623 | { 0xc1, 0x3c }, |
339 | { 0xc2, 0x0c }, | 624 | { 0xc2, 0x0c }, |
340 | }; | 625 | }; |
341 | static const u8 sensor_init[][2] = { | 626 | static const u8 sensor_init_772x[][2] = { |
342 | { 0x12, 0x80 }, | 627 | { 0x12, 0x80 }, |
343 | { 0x11, 0x01 }, | 628 | { 0x11, 0x01 }, |
344 | /*fixme: better have a delay?*/ | 629 | /*fixme: better have a delay?*/ |
@@ -431,7 +716,7 @@ static const u8 sensor_init[][2] = { | |||
431 | { 0x8e, 0x00 }, /* De-noise threshold */ | 716 | { 0x8e, 0x00 }, /* De-noise threshold */ |
432 | { 0x0c, 0xd0 } | 717 | { 0x0c, 0xd0 } |
433 | }; | 718 | }; |
434 | static const u8 bridge_start_vga[][2] = { | 719 | static const u8 bridge_start_vga_772x[][2] = { |
435 | {0x1c, 0x00}, | 720 | {0x1c, 0x00}, |
436 | {0x1d, 0x40}, | 721 | {0x1d, 0x40}, |
437 | {0x1d, 0x02}, | 722 | {0x1d, 0x02}, |
@@ -442,7 +727,7 @@ static const u8 bridge_start_vga[][2] = { | |||
442 | {0xc0, 0x50}, | 727 | {0xc0, 0x50}, |
443 | {0xc1, 0x3c}, | 728 | {0xc1, 0x3c}, |
444 | }; | 729 | }; |
445 | static const u8 sensor_start_vga[][2] = { | 730 | static const u8 sensor_start_vga_772x[][2] = { |
446 | {0x12, 0x00}, | 731 | {0x12, 0x00}, |
447 | {0x17, 0x26}, | 732 | {0x17, 0x26}, |
448 | {0x18, 0xa0}, | 733 | {0x18, 0xa0}, |
@@ -452,7 +737,7 @@ static const u8 sensor_start_vga[][2] = { | |||
452 | {0x2c, 0xf0}, | 737 | {0x2c, 0xf0}, |
453 | {0x65, 0x20}, | 738 | {0x65, 0x20}, |
454 | }; | 739 | }; |
455 | static const u8 bridge_start_qvga[][2] = { | 740 | static const u8 bridge_start_qvga_772x[][2] = { |
456 | {0x1c, 0x00}, | 741 | {0x1c, 0x00}, |
457 | {0x1d, 0x40}, | 742 | {0x1d, 0x40}, |
458 | {0x1d, 0x02}, | 743 | {0x1d, 0x02}, |
@@ -463,7 +748,7 @@ static const u8 bridge_start_qvga[][2] = { | |||
463 | {0xc0, 0x28}, | 748 | {0xc0, 0x28}, |
464 | {0xc1, 0x1e}, | 749 | {0xc1, 0x1e}, |
465 | }; | 750 | }; |
466 | static const u8 sensor_start_qvga[][2] = { | 751 | static const u8 sensor_start_qvga_772x[][2] = { |
467 | {0x12, 0x40}, | 752 | {0x12, 0x40}, |
468 | {0x17, 0x3f}, | 753 | {0x17, 0x3f}, |
469 | {0x18, 0x50}, | 754 | {0x18, 0x50}, |
@@ -646,6 +931,8 @@ static void set_frame_rate(struct gspca_dev *gspca_dev) | |||
646 | {30, 0x04, 0x41, 0x04}, | 931 | {30, 0x04, 0x41, 0x04}, |
647 | }; | 932 | }; |
648 | 933 | ||
934 | if (sd->sensor != SENSOR_OV772x) | ||
935 | return; | ||
649 | if (gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv == 0) { | 936 | if (gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv == 0) { |
650 | r = rate_0; | 937 | r = rate_0; |
651 | i = ARRAY_SIZE(rate_0); | 938 | i = ARRAY_SIZE(rate_0); |
@@ -669,15 +956,28 @@ static void set_frame_rate(struct gspca_dev *gspca_dev) | |||
669 | static void setbrightness(struct gspca_dev *gspca_dev) | 956 | static void setbrightness(struct gspca_dev *gspca_dev) |
670 | { | 957 | { |
671 | struct sd *sd = (struct sd *) gspca_dev; | 958 | struct sd *sd = (struct sd *) gspca_dev; |
959 | int val; | ||
672 | 960 | ||
673 | sccb_reg_write(gspca_dev, 0x9b, sd->brightness); | 961 | val = sd->ctrls[BRIGHTNESS].val; |
962 | if (sd->sensor == SENSOR_OV767x) { | ||
963 | if (val < 0) | ||
964 | val = 0x80 - val; | ||
965 | sccb_reg_write(gspca_dev, 0x55, val); /* bright */ | ||
966 | } else { | ||
967 | sccb_reg_write(gspca_dev, 0x9b, val); | ||
968 | } | ||
674 | } | 969 | } |
675 | 970 | ||
676 | static void setcontrast(struct gspca_dev *gspca_dev) | 971 | static void setcontrast(struct gspca_dev *gspca_dev) |
677 | { | 972 | { |
678 | struct sd *sd = (struct sd *) gspca_dev; | 973 | struct sd *sd = (struct sd *) gspca_dev; |
974 | u8 val; | ||
679 | 975 | ||
680 | sccb_reg_write(gspca_dev, 0x9c, sd->contrast); | 976 | val = sd->ctrls[CONTRAST].val; |
977 | if (sd->sensor == SENSOR_OV767x) | ||
978 | sccb_reg_write(gspca_dev, 0x56, val); /* contras */ | ||
979 | else | ||
980 | sccb_reg_write(gspca_dev, 0x9c, val); | ||
681 | } | 981 | } |
682 | 982 | ||
683 | static void setgain(struct gspca_dev *gspca_dev) | 983 | static void setgain(struct gspca_dev *gspca_dev) |
@@ -685,10 +985,10 @@ static void setgain(struct gspca_dev *gspca_dev) | |||
685 | struct sd *sd = (struct sd *) gspca_dev; | 985 | struct sd *sd = (struct sd *) gspca_dev; |
686 | u8 val; | 986 | u8 val; |
687 | 987 | ||
688 | if (sd->agc) | 988 | if (sd->ctrls[AGC].val) |
689 | return; | 989 | return; |
690 | 990 | ||
691 | val = sd->gain; | 991 | val = sd->ctrls[GAIN].val; |
692 | switch (val & 0x30) { | 992 | switch (val & 0x30) { |
693 | case 0x00: | 993 | case 0x00: |
694 | val &= 0x0f; | 994 | val &= 0x0f; |
@@ -715,25 +1015,32 @@ static void setexposure(struct gspca_dev *gspca_dev) | |||
715 | struct sd *sd = (struct sd *) gspca_dev; | 1015 | struct sd *sd = (struct sd *) gspca_dev; |
716 | u8 val; | 1016 | u8 val; |
717 | 1017 | ||
718 | if (sd->aec) | 1018 | if (sd->ctrls[AEC].val) |
719 | return; | 1019 | return; |
720 | 1020 | ||
721 | /* 'val' is one byte and represents half of the exposure value we are | 1021 | val = sd->ctrls[EXPOSURE].val; |
722 | * going to set into registers, a two bytes value: | 1022 | if (sd->sensor == SENSOR_OV767x) { |
723 | * | 1023 | |
724 | * MSB: ((u16) val << 1) >> 8 == val >> 7 | 1024 | /* set only aec[9:2] */ |
725 | * LSB: ((u16) val << 1) & 0xff == val << 1 | 1025 | sccb_reg_write(gspca_dev, 0x10, val); /* aech */ |
726 | */ | 1026 | } else { |
727 | val = sd->exposure; | 1027 | |
728 | sccb_reg_write(gspca_dev, 0x08, val >> 7); | 1028 | /* 'val' is one byte and represents half of the exposure value |
729 | sccb_reg_write(gspca_dev, 0x10, val << 1); | 1029 | * we are going to set into registers, a two bytes value: |
1030 | * | ||
1031 | * MSB: ((u16) val << 1) >> 8 == val >> 7 | ||
1032 | * LSB: ((u16) val << 1) & 0xff == val << 1 | ||
1033 | */ | ||
1034 | sccb_reg_write(gspca_dev, 0x08, val >> 7); | ||
1035 | sccb_reg_write(gspca_dev, 0x10, val << 1); | ||
1036 | } | ||
730 | } | 1037 | } |
731 | 1038 | ||
732 | static void setagc(struct gspca_dev *gspca_dev) | 1039 | static void setagc(struct gspca_dev *gspca_dev) |
733 | { | 1040 | { |
734 | struct sd *sd = (struct sd *) gspca_dev; | 1041 | struct sd *sd = (struct sd *) gspca_dev; |
735 | 1042 | ||
736 | if (sd->agc) { | 1043 | if (sd->ctrls[AGC].val) { |
737 | sccb_reg_write(gspca_dev, 0x13, | 1044 | sccb_reg_write(gspca_dev, 0x13, |
738 | sccb_reg_read(gspca_dev, 0x13) | 0x04); | 1045 | sccb_reg_read(gspca_dev, 0x13) | 0x04); |
739 | sccb_reg_write(gspca_dev, 0x64, | 1046 | sccb_reg_write(gspca_dev, 0x64, |
@@ -752,15 +1059,17 @@ static void setawb(struct gspca_dev *gspca_dev) | |||
752 | { | 1059 | { |
753 | struct sd *sd = (struct sd *) gspca_dev; | 1060 | struct sd *sd = (struct sd *) gspca_dev; |
754 | 1061 | ||
755 | if (sd->awb) { | 1062 | if (sd->ctrls[AWB].val) { |
756 | sccb_reg_write(gspca_dev, 0x13, | 1063 | sccb_reg_write(gspca_dev, 0x13, |
757 | sccb_reg_read(gspca_dev, 0x13) | 0x02); | 1064 | sccb_reg_read(gspca_dev, 0x13) | 0x02); |
758 | sccb_reg_write(gspca_dev, 0x63, | 1065 | if (sd->sensor == SENSOR_OV772x) |
1066 | sccb_reg_write(gspca_dev, 0x63, | ||
759 | sccb_reg_read(gspca_dev, 0x63) | 0xc0); | 1067 | sccb_reg_read(gspca_dev, 0x63) | 0xc0); |
760 | } else { | 1068 | } else { |
761 | sccb_reg_write(gspca_dev, 0x13, | 1069 | sccb_reg_write(gspca_dev, 0x13, |
762 | sccb_reg_read(gspca_dev, 0x13) & ~0x02); | 1070 | sccb_reg_read(gspca_dev, 0x13) & ~0x02); |
763 | sccb_reg_write(gspca_dev, 0x63, | 1071 | if (sd->sensor == SENSOR_OV772x) |
1072 | sccb_reg_write(gspca_dev, 0x63, | ||
764 | sccb_reg_read(gspca_dev, 0x63) & ~0xc0); | 1073 | sccb_reg_read(gspca_dev, 0x63) & ~0xc0); |
765 | } | 1074 | } |
766 | } | 1075 | } |
@@ -768,14 +1077,22 @@ static void setawb(struct gspca_dev *gspca_dev) | |||
768 | static void setaec(struct gspca_dev *gspca_dev) | 1077 | static void setaec(struct gspca_dev *gspca_dev) |
769 | { | 1078 | { |
770 | struct sd *sd = (struct sd *) gspca_dev; | 1079 | struct sd *sd = (struct sd *) gspca_dev; |
1080 | u8 data; | ||
771 | 1081 | ||
772 | if (sd->aec) | 1082 | data = sd->sensor == SENSOR_OV767x ? |
1083 | 0x05 : /* agc + aec */ | ||
1084 | 0x01; /* agc */ | ||
1085 | if (sd->ctrls[AEC].val) | ||
773 | sccb_reg_write(gspca_dev, 0x13, | 1086 | sccb_reg_write(gspca_dev, 0x13, |
774 | sccb_reg_read(gspca_dev, 0x13) | 0x01); | 1087 | sccb_reg_read(gspca_dev, 0x13) | data); |
775 | else { | 1088 | else { |
776 | sccb_reg_write(gspca_dev, 0x13, | 1089 | sccb_reg_write(gspca_dev, 0x13, |
777 | sccb_reg_read(gspca_dev, 0x13) & ~0x01); | 1090 | sccb_reg_read(gspca_dev, 0x13) & ~data); |
778 | setexposure(gspca_dev); | 1091 | if (sd->sensor == SENSOR_OV767x) |
1092 | sd->ctrls[EXPOSURE].val = | ||
1093 | sccb_reg_read(gspca_dev, 10); /* aech */ | ||
1094 | else | ||
1095 | setexposure(gspca_dev); | ||
779 | } | 1096 | } |
780 | } | 1097 | } |
781 | 1098 | ||
@@ -784,43 +1101,67 @@ static void setsharpness(struct gspca_dev *gspca_dev) | |||
784 | struct sd *sd = (struct sd *) gspca_dev; | 1101 | struct sd *sd = (struct sd *) gspca_dev; |
785 | u8 val; | 1102 | u8 val; |
786 | 1103 | ||
787 | val = sd->sharpness; | 1104 | val = sd->ctrls[SHARPNESS].val; |
788 | sccb_reg_write(gspca_dev, 0x91, val); /* Auto de-noise threshold */ | 1105 | sccb_reg_write(gspca_dev, 0x91, val); /* Auto de-noise threshold */ |
789 | sccb_reg_write(gspca_dev, 0x8e, val); /* De-noise threshold */ | 1106 | sccb_reg_write(gspca_dev, 0x8e, val); /* De-noise threshold */ |
790 | } | 1107 | } |
791 | 1108 | ||
792 | static void sethflip(struct gspca_dev *gspca_dev) | 1109 | static void sethvflip(struct gspca_dev *gspca_dev) |
793 | { | 1110 | { |
794 | struct sd *sd = (struct sd *) gspca_dev; | 1111 | struct sd *sd = (struct sd *) gspca_dev; |
1112 | u8 val; | ||
795 | 1113 | ||
796 | if (sd->hflip == 0) | 1114 | if (sd->sensor == SENSOR_OV767x) { |
797 | sccb_reg_write(gspca_dev, 0x0c, | 1115 | val = sccb_reg_read(gspca_dev, 0x1e); /* mvfp */ |
798 | sccb_reg_read(gspca_dev, 0x0c) | 0x40); | 1116 | val &= ~0x30; |
799 | else | 1117 | if (sd->ctrls[HFLIP].val) |
800 | sccb_reg_write(gspca_dev, 0x0c, | 1118 | val |= 0x20; |
801 | sccb_reg_read(gspca_dev, 0x0c) & ~0x40); | 1119 | if (sd->ctrls[VFLIP].val) |
1120 | val |= 0x10; | ||
1121 | sccb_reg_write(gspca_dev, 0x1e, val); | ||
1122 | } else { | ||
1123 | val = sccb_reg_read(gspca_dev, 0x0c); | ||
1124 | val &= ~0xc0; | ||
1125 | if (sd->ctrls[HFLIP].val == 0) | ||
1126 | val |= 0x40; | ||
1127 | if (sd->ctrls[VFLIP].val == 0) | ||
1128 | val |= 0x80; | ||
1129 | sccb_reg_write(gspca_dev, 0x0c, val); | ||
1130 | } | ||
802 | } | 1131 | } |
803 | 1132 | ||
804 | static void setvflip(struct gspca_dev *gspca_dev) | 1133 | static void setcolors(struct gspca_dev *gspca_dev) |
805 | { | 1134 | { |
806 | struct sd *sd = (struct sd *) gspca_dev; | 1135 | struct sd *sd = (struct sd *) gspca_dev; |
1136 | u8 val; | ||
1137 | int i; | ||
1138 | static u8 color_tb[][6] = { | ||
1139 | {0x42, 0x42, 0x00, 0x11, 0x30, 0x41}, | ||
1140 | {0x52, 0x52, 0x00, 0x16, 0x3c, 0x52}, | ||
1141 | {0x66, 0x66, 0x00, 0x1b, 0x4b, 0x66}, | ||
1142 | {0x80, 0x80, 0x00, 0x22, 0x5e, 0x80}, | ||
1143 | {0x9a, 0x9a, 0x00, 0x29, 0x71, 0x9a}, | ||
1144 | {0xb8, 0xb8, 0x00, 0x31, 0x87, 0xb8}, | ||
1145 | {0xdd, 0xdd, 0x00, 0x3b, 0xa2, 0xdd}, | ||
1146 | }; | ||
807 | 1147 | ||
808 | if (sd->vflip == 0) | 1148 | val = sd->ctrls[COLORS].val; |
809 | sccb_reg_write(gspca_dev, 0x0c, | 1149 | for (i = 0; i < ARRAY_SIZE(color_tb[0]); i++) |
810 | sccb_reg_read(gspca_dev, 0x0c) | 0x80); | 1150 | sccb_reg_write(gspca_dev, 0x4f + i, color_tb[val][i]); |
811 | else | ||
812 | sccb_reg_write(gspca_dev, 0x0c, | ||
813 | sccb_reg_read(gspca_dev, 0x0c) & ~0x80); | ||
814 | } | 1151 | } |
815 | 1152 | ||
816 | static void setfreqfltr(struct gspca_dev *gspca_dev) | 1153 | static void setlightfreq(struct gspca_dev *gspca_dev) |
817 | { | 1154 | { |
818 | struct sd *sd = (struct sd *) gspca_dev; | 1155 | struct sd *sd = (struct sd *) gspca_dev; |
1156 | u8 val; | ||
819 | 1157 | ||
820 | if (sd->freqfltr == 0) | 1158 | val = sd->ctrls[LIGHTFREQ].val ? 0x9e : 0x00; |
821 | sccb_reg_write(gspca_dev, 0x2b, 0x00); | 1159 | if (sd->sensor == SENSOR_OV767x) { |
822 | else | 1160 | sccb_reg_write(gspca_dev, 0x2a, 0x00); |
823 | sccb_reg_write(gspca_dev, 0x2b, 0x9e); | 1161 | if (val) |
1162 | val = 0x9d; /* insert dummy to 25fps for 50Hz */ | ||
1163 | } | ||
1164 | sccb_reg_write(gspca_dev, 0x2b, val); | ||
824 | } | 1165 | } |
825 | 1166 | ||
826 | 1167 | ||
@@ -833,39 +1174,33 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
833 | 1174 | ||
834 | cam = &gspca_dev->cam; | 1175 | cam = &gspca_dev->cam; |
835 | 1176 | ||
1177 | cam->ctrls = sd->ctrls; | ||
1178 | |||
1179 | /* the auto white balance control works only when auto gain is set */ | ||
1180 | if (sd_ctrls[AGC].qctrl.default_value == 0) | ||
1181 | gspca_dev->ctrl_inac |= (1 << AWB); | ||
1182 | |||
836 | cam->cam_mode = ov772x_mode; | 1183 | cam->cam_mode = ov772x_mode; |
837 | cam->nmodes = ARRAY_SIZE(ov772x_mode); | 1184 | cam->nmodes = ARRAY_SIZE(ov772x_mode); |
838 | cam->mode_framerates = ov772x_framerates; | ||
839 | |||
840 | cam->bulk = 1; | ||
841 | cam->bulk_size = 16384; | ||
842 | cam->bulk_nurbs = 2; | ||
843 | 1185 | ||
844 | sd->frame_rate = 30; | 1186 | sd->frame_rate = 30; |
845 | 1187 | ||
846 | sd->brightness = BRIGHTNESS_DEF; | ||
847 | sd->contrast = CONTRAST_DEF; | ||
848 | sd->gain = GAIN_DEF; | ||
849 | sd->exposure = EXPO_DEF; | ||
850 | #if AGC_DEF != 0 | ||
851 | sd->agc = AGC_DEF; | ||
852 | #else | ||
853 | gspca_dev->ctrl_inac |= (1 << AWB_IDX); | ||
854 | #endif | ||
855 | sd->awb = AWB_DEF; | ||
856 | sd->aec = AEC_DEF; | ||
857 | sd->sharpness = SHARPNESS_DEF; | ||
858 | sd->hflip = HFLIP_DEF; | ||
859 | sd->vflip = VFLIP_DEF; | ||
860 | sd->freqfltr = FREQFLTR_DEF; | ||
861 | |||
862 | return 0; | 1188 | return 0; |
863 | } | 1189 | } |
864 | 1190 | ||
865 | /* this function is called at probe and resume time */ | 1191 | /* this function is called at probe and resume time */ |
866 | static int sd_init(struct gspca_dev *gspca_dev) | 1192 | static int sd_init(struct gspca_dev *gspca_dev) |
867 | { | 1193 | { |
1194 | struct sd *sd = (struct sd *) gspca_dev; | ||
868 | u16 sensor_id; | 1195 | u16 sensor_id; |
1196 | static const struct reg_array bridge_init[NSENSORS] = { | ||
1197 | [SENSOR_OV767x] = {bridge_init_767x, ARRAY_SIZE(bridge_init_767x)}, | ||
1198 | [SENSOR_OV772x] = {bridge_init_772x, ARRAY_SIZE(bridge_init_772x)}, | ||
1199 | }; | ||
1200 | static const struct reg_array sensor_init[NSENSORS] = { | ||
1201 | [SENSOR_OV767x] = {sensor_init_767x, ARRAY_SIZE(sensor_init_767x)}, | ||
1202 | [SENSOR_OV772x] = {sensor_init_772x, ARRAY_SIZE(sensor_init_772x)}, | ||
1203 | }; | ||
869 | 1204 | ||
870 | /* reset bridge */ | 1205 | /* reset bridge */ |
871 | ov534_reg_write(gspca_dev, 0xe7, 0x3a); | 1206 | ov534_reg_write(gspca_dev, 0xe7, 0x3a); |
@@ -886,48 +1221,100 @@ static int sd_init(struct gspca_dev *gspca_dev) | |||
886 | sensor_id |= sccb_reg_read(gspca_dev, 0x0b); | 1221 | sensor_id |= sccb_reg_read(gspca_dev, 0x0b); |
887 | PDEBUG(D_PROBE, "Sensor ID: %04x", sensor_id); | 1222 | PDEBUG(D_PROBE, "Sensor ID: %04x", sensor_id); |
888 | 1223 | ||
1224 | if ((sensor_id & 0xfff0) == 0x7670) { | ||
1225 | sd->sensor = SENSOR_OV767x; | ||
1226 | gspca_dev->ctrl_dis = (1 << GAIN) | | ||
1227 | (1 << AGC) | | ||
1228 | (1 << SHARPNESS); /* auto */ | ||
1229 | sd->ctrls[BRIGHTNESS].min = -127; | ||
1230 | sd->ctrls[BRIGHTNESS].max = 127; | ||
1231 | sd->ctrls[BRIGHTNESS].def = 0; | ||
1232 | sd->ctrls[CONTRAST].max = 0x80; | ||
1233 | sd->ctrls[CONTRAST].def = 0x40; | ||
1234 | sd->ctrls[EXPOSURE].min = 0x08; | ||
1235 | sd->ctrls[EXPOSURE].max = 0x60; | ||
1236 | sd->ctrls[EXPOSURE].def = 0x13; | ||
1237 | sd->ctrls[SHARPNESS].max = 9; | ||
1238 | sd->ctrls[SHARPNESS].def = 4; | ||
1239 | sd->ctrls[HFLIP].def = 1; | ||
1240 | gspca_dev->cam.cam_mode = ov767x_mode; | ||
1241 | gspca_dev->cam.nmodes = ARRAY_SIZE(ov767x_mode); | ||
1242 | } else { | ||
1243 | sd->sensor = SENSOR_OV772x; | ||
1244 | gspca_dev->ctrl_dis = (1 << COLORS); | ||
1245 | gspca_dev->cam.bulk = 1; | ||
1246 | gspca_dev->cam.bulk_size = 16384; | ||
1247 | gspca_dev->cam.bulk_nurbs = 2; | ||
1248 | gspca_dev->cam.mode_framerates = ov772x_framerates; | ||
1249 | } | ||
1250 | |||
889 | /* initialize */ | 1251 | /* initialize */ |
890 | reg_w_array(gspca_dev, bridge_init, | 1252 | reg_w_array(gspca_dev, bridge_init[sd->sensor].val, |
891 | ARRAY_SIZE(bridge_init)); | 1253 | bridge_init[sd->sensor].len); |
892 | ov534_set_led(gspca_dev, 1); | 1254 | ov534_set_led(gspca_dev, 1); |
893 | sccb_w_array(gspca_dev, sensor_init, | 1255 | sccb_w_array(gspca_dev, sensor_init[sd->sensor].val, |
894 | ARRAY_SIZE(sensor_init)); | 1256 | sensor_init[sd->sensor].len); |
895 | ov534_reg_write(gspca_dev, 0xe0, 0x09); | 1257 | if (sd->sensor == SENSOR_OV767x) |
896 | ov534_set_led(gspca_dev, 0); | 1258 | sd_start(gspca_dev); |
897 | set_frame_rate(gspca_dev); | 1259 | sd_stopN(gspca_dev); |
1260 | /* set_frame_rate(gspca_dev); */ | ||
898 | 1261 | ||
899 | return gspca_dev->usb_err; | 1262 | return gspca_dev->usb_err; |
900 | } | 1263 | } |
901 | 1264 | ||
902 | static int sd_start(struct gspca_dev *gspca_dev) | 1265 | static int sd_start(struct gspca_dev *gspca_dev) |
903 | { | 1266 | { |
1267 | struct sd *sd = (struct sd *) gspca_dev; | ||
904 | int mode; | 1268 | int mode; |
1269 | static const struct reg_array bridge_start[NSENSORS][2] = { | ||
1270 | [SENSOR_OV767x] = {{bridge_start_qvga_767x, | ||
1271 | ARRAY_SIZE(bridge_start_qvga_767x)}, | ||
1272 | {bridge_start_vga_767x, | ||
1273 | ARRAY_SIZE(bridge_start_vga_767x)}}, | ||
1274 | [SENSOR_OV772x] = {{bridge_start_qvga_772x, | ||
1275 | ARRAY_SIZE(bridge_start_qvga_772x)}, | ||
1276 | {bridge_start_vga_772x, | ||
1277 | ARRAY_SIZE(bridge_start_vga_772x)}}, | ||
1278 | }; | ||
1279 | static const struct reg_array sensor_start[NSENSORS][2] = { | ||
1280 | [SENSOR_OV767x] = {{sensor_start_qvga_767x, | ||
1281 | ARRAY_SIZE(sensor_start_qvga_767x)}, | ||
1282 | {sensor_start_vga_767x, | ||
1283 | ARRAY_SIZE(sensor_start_vga_767x)}}, | ||
1284 | [SENSOR_OV772x] = {{sensor_start_qvga_772x, | ||
1285 | ARRAY_SIZE(sensor_start_qvga_772x)}, | ||
1286 | {sensor_start_vga_772x, | ||
1287 | ARRAY_SIZE(sensor_start_vga_772x)}}, | ||
1288 | }; | ||
1289 | |||
1290 | /* (from ms-win trace) */ | ||
1291 | if (sd->sensor == SENSOR_OV767x) | ||
1292 | sccb_reg_write(gspca_dev, 0x1e, 0x04); | ||
1293 | /* black sun enable ? */ | ||
1294 | |||
1295 | mode = gspca_dev->curr_mode; /* 0: 320x240, 1: 640x480 */ | ||
1296 | reg_w_array(gspca_dev, bridge_start[sd->sensor][mode].val, | ||
1297 | bridge_start[sd->sensor][mode].len); | ||
1298 | sccb_w_array(gspca_dev, sensor_start[sd->sensor][mode].val, | ||
1299 | sensor_start[sd->sensor][mode].len); | ||
905 | 1300 | ||
906 | mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv; | ||
907 | if (mode != 0) { /* 320x240 */ | ||
908 | reg_w_array(gspca_dev, bridge_start_qvga, | ||
909 | ARRAY_SIZE(bridge_start_qvga)); | ||
910 | sccb_w_array(gspca_dev, sensor_start_qvga, | ||
911 | ARRAY_SIZE(sensor_start_qvga)); | ||
912 | } else { /* 640x480 */ | ||
913 | reg_w_array(gspca_dev, bridge_start_vga, | ||
914 | ARRAY_SIZE(bridge_start_vga)); | ||
915 | sccb_w_array(gspca_dev, sensor_start_vga, | ||
916 | ARRAY_SIZE(sensor_start_vga)); | ||
917 | } | ||
918 | set_frame_rate(gspca_dev); | 1301 | set_frame_rate(gspca_dev); |
919 | 1302 | ||
920 | setagc(gspca_dev); | 1303 | if (!(gspca_dev->ctrl_dis & (1 << AGC))) |
1304 | setagc(gspca_dev); | ||
921 | setawb(gspca_dev); | 1305 | setawb(gspca_dev); |
922 | setaec(gspca_dev); | 1306 | setaec(gspca_dev); |
923 | setgain(gspca_dev); | 1307 | if (!(gspca_dev->ctrl_dis & (1 << GAIN))) |
1308 | setgain(gspca_dev); | ||
924 | setexposure(gspca_dev); | 1309 | setexposure(gspca_dev); |
925 | setbrightness(gspca_dev); | 1310 | setbrightness(gspca_dev); |
926 | setcontrast(gspca_dev); | 1311 | setcontrast(gspca_dev); |
927 | setsharpness(gspca_dev); | 1312 | if (!(gspca_dev->ctrl_dis & (1 << SHARPNESS))) |
928 | setvflip(gspca_dev); | 1313 | setsharpness(gspca_dev); |
929 | sethflip(gspca_dev); | 1314 | sethvflip(gspca_dev); |
930 | setfreqfltr(gspca_dev); | 1315 | if (!(gspca_dev->ctrl_dis & (1 << COLORS))) |
1316 | setcolors(gspca_dev); | ||
1317 | setlightfreq(gspca_dev); | ||
931 | 1318 | ||
932 | ov534_set_led(gspca_dev, 1); | 1319 | ov534_set_led(gspca_dev, 1); |
933 | ov534_reg_write(gspca_dev, 0xe0, 0x00); | 1320 | ov534_reg_write(gspca_dev, 0xe0, 0x00); |
@@ -957,9 +1344,11 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
957 | __u32 this_pts; | 1344 | __u32 this_pts; |
958 | u16 this_fid; | 1345 | u16 this_fid; |
959 | int remaining_len = len; | 1346 | int remaining_len = len; |
1347 | int payload_len; | ||
960 | 1348 | ||
1349 | payload_len = gspca_dev->cam.bulk ? 2048 : 2040; | ||
961 | do { | 1350 | do { |
962 | len = min(remaining_len, 2048); | 1351 | len = min(remaining_len, payload_len); |
963 | 1352 | ||
964 | /* Payloads are prefixed with a UVC-style header. We | 1353 | /* Payloads are prefixed with a UVC-style header. We |
965 | consider a frame to start when the FID toggles, or the PTS | 1354 | consider a frame to start when the FID toggles, or the PTS |
@@ -999,8 +1388,9 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
999 | /* If this packet is marked as EOF, end the frame */ | 1388 | /* If this packet is marked as EOF, end the frame */ |
1000 | } else if (data[1] & UVC_STREAM_EOF) { | 1389 | } else if (data[1] & UVC_STREAM_EOF) { |
1001 | sd->last_pts = 0; | 1390 | sd->last_pts = 0; |
1002 | if (gspca_dev->image_len + len - 12 != | 1391 | if (gspca_dev->pixfmt == V4L2_PIX_FMT_YUYV |
1003 | gspca_dev->width * gspca_dev->height * 2) { | 1392 | && gspca_dev->image_len + len - 12 != |
1393 | gspca_dev->width * gspca_dev->height * 2) { | ||
1004 | PDEBUG(D_PACK, "wrong sized frame"); | 1394 | PDEBUG(D_PACK, "wrong sized frame"); |
1005 | goto discard; | 1395 | goto discard; |
1006 | } | 1396 | } |
@@ -1026,212 +1416,27 @@ scan_next: | |||
1026 | } while (remaining_len > 0); | 1416 | } while (remaining_len > 0); |
1027 | } | 1417 | } |
1028 | 1418 | ||
1029 | /* controls */ | ||
1030 | static int sd_setgain(struct gspca_dev *gspca_dev, __s32 val) | ||
1031 | { | ||
1032 | struct sd *sd = (struct sd *) gspca_dev; | ||
1033 | |||
1034 | sd->gain = val; | ||
1035 | if (gspca_dev->streaming) | ||
1036 | setgain(gspca_dev); | ||
1037 | return 0; | ||
1038 | } | ||
1039 | |||
1040 | static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val) | ||
1041 | { | ||
1042 | struct sd *sd = (struct sd *) gspca_dev; | ||
1043 | |||
1044 | *val = sd->gain; | ||
1045 | return 0; | ||
1046 | } | ||
1047 | |||
1048 | static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val) | ||
1049 | { | ||
1050 | struct sd *sd = (struct sd *) gspca_dev; | ||
1051 | |||
1052 | sd->exposure = val; | ||
1053 | if (gspca_dev->streaming) | ||
1054 | setexposure(gspca_dev); | ||
1055 | return 0; | ||
1056 | } | ||
1057 | |||
1058 | static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val) | ||
1059 | { | ||
1060 | struct sd *sd = (struct sd *) gspca_dev; | ||
1061 | |||
1062 | *val = sd->exposure; | ||
1063 | return 0; | ||
1064 | } | ||
1065 | |||
1066 | static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) | ||
1067 | { | ||
1068 | struct sd *sd = (struct sd *) gspca_dev; | ||
1069 | |||
1070 | sd->brightness = val; | ||
1071 | if (gspca_dev->streaming) | ||
1072 | setbrightness(gspca_dev); | ||
1073 | return 0; | ||
1074 | } | ||
1075 | |||
1076 | static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val) | ||
1077 | { | ||
1078 | struct sd *sd = (struct sd *) gspca_dev; | ||
1079 | |||
1080 | *val = sd->brightness; | ||
1081 | return 0; | ||
1082 | } | ||
1083 | |||
1084 | static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val) | ||
1085 | { | ||
1086 | struct sd *sd = (struct sd *) gspca_dev; | ||
1087 | |||
1088 | sd->contrast = val; | ||
1089 | if (gspca_dev->streaming) | ||
1090 | setcontrast(gspca_dev); | ||
1091 | return 0; | ||
1092 | } | ||
1093 | |||
1094 | static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val) | ||
1095 | { | ||
1096 | struct sd *sd = (struct sd *) gspca_dev; | ||
1097 | |||
1098 | *val = sd->contrast; | ||
1099 | return 0; | ||
1100 | } | ||
1101 | |||
1102 | static int sd_setagc(struct gspca_dev *gspca_dev, __s32 val) | 1419 | static int sd_setagc(struct gspca_dev *gspca_dev, __s32 val) |
1103 | { | 1420 | { |
1104 | struct sd *sd = (struct sd *) gspca_dev; | 1421 | struct sd *sd = (struct sd *) gspca_dev; |
1105 | 1422 | ||
1106 | sd->agc = val; | 1423 | sd->ctrls[AGC].val = val; |
1107 | |||
1108 | if (gspca_dev->streaming) { | ||
1109 | 1424 | ||
1110 | /* the auto white balance control works only | 1425 | /* the auto white balance control works only |
1111 | * when auto gain is set */ | 1426 | * when auto gain is set */ |
1112 | if (val) | 1427 | if (val) { |
1113 | gspca_dev->ctrl_inac &= ~(1 << AWB_IDX); | 1428 | gspca_dev->ctrl_inac &= ~(1 << AWB); |
1114 | else | 1429 | } else { |
1115 | gspca_dev->ctrl_inac |= (1 << AWB_IDX); | 1430 | gspca_dev->ctrl_inac |= (1 << AWB); |
1116 | setagc(gspca_dev); | 1431 | if (sd->ctrls[AWB].val) { |
1432 | sd->ctrls[AWB].val = 0; | ||
1433 | if (gspca_dev->streaming) | ||
1434 | setawb(gspca_dev); | ||
1435 | } | ||
1117 | } | 1436 | } |
1118 | return 0; | ||
1119 | } | ||
1120 | |||
1121 | static int sd_getagc(struct gspca_dev *gspca_dev, __s32 *val) | ||
1122 | { | ||
1123 | struct sd *sd = (struct sd *) gspca_dev; | ||
1124 | |||
1125 | *val = sd->agc; | ||
1126 | return 0; | ||
1127 | } | ||
1128 | |||
1129 | static int sd_setawb(struct gspca_dev *gspca_dev, __s32 val) | ||
1130 | { | ||
1131 | struct sd *sd = (struct sd *) gspca_dev; | ||
1132 | |||
1133 | sd->awb = val; | ||
1134 | if (gspca_dev->streaming) | ||
1135 | setawb(gspca_dev); | ||
1136 | return 0; | ||
1137 | } | ||
1138 | |||
1139 | static int sd_getawb(struct gspca_dev *gspca_dev, __s32 *val) | ||
1140 | { | ||
1141 | struct sd *sd = (struct sd *) gspca_dev; | ||
1142 | |||
1143 | *val = sd->awb; | ||
1144 | return 0; | ||
1145 | } | ||
1146 | |||
1147 | static int sd_setaec(struct gspca_dev *gspca_dev, __s32 val) | ||
1148 | { | ||
1149 | struct sd *sd = (struct sd *) gspca_dev; | ||
1150 | |||
1151 | sd->aec = val; | ||
1152 | if (gspca_dev->streaming) | ||
1153 | setaec(gspca_dev); | ||
1154 | return 0; | ||
1155 | } | ||
1156 | |||
1157 | static int sd_getaec(struct gspca_dev *gspca_dev, __s32 *val) | ||
1158 | { | ||
1159 | struct sd *sd = (struct sd *) gspca_dev; | ||
1160 | |||
1161 | *val = sd->aec; | ||
1162 | return 0; | ||
1163 | } | ||
1164 | |||
1165 | static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val) | ||
1166 | { | ||
1167 | struct sd *sd = (struct sd *) gspca_dev; | ||
1168 | |||
1169 | sd->sharpness = val; | ||
1170 | if (gspca_dev->streaming) | ||
1171 | setsharpness(gspca_dev); | ||
1172 | return 0; | ||
1173 | } | ||
1174 | |||
1175 | static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val) | ||
1176 | { | ||
1177 | struct sd *sd = (struct sd *) gspca_dev; | ||
1178 | |||
1179 | *val = sd->sharpness; | ||
1180 | return 0; | ||
1181 | } | ||
1182 | |||
1183 | static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val) | ||
1184 | { | ||
1185 | struct sd *sd = (struct sd *) gspca_dev; | ||
1186 | |||
1187 | sd->hflip = val; | ||
1188 | if (gspca_dev->streaming) | ||
1189 | sethflip(gspca_dev); | ||
1190 | return 0; | ||
1191 | } | ||
1192 | |||
1193 | static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val) | ||
1194 | { | ||
1195 | struct sd *sd = (struct sd *) gspca_dev; | ||
1196 | |||
1197 | *val = sd->hflip; | ||
1198 | return 0; | ||
1199 | } | ||
1200 | |||
1201 | static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val) | ||
1202 | { | ||
1203 | struct sd *sd = (struct sd *) gspca_dev; | ||
1204 | |||
1205 | sd->vflip = val; | ||
1206 | if (gspca_dev->streaming) | ||
1207 | setvflip(gspca_dev); | ||
1208 | return 0; | ||
1209 | } | ||
1210 | |||
1211 | static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val) | ||
1212 | { | ||
1213 | struct sd *sd = (struct sd *) gspca_dev; | ||
1214 | |||
1215 | *val = sd->vflip; | ||
1216 | return 0; | ||
1217 | } | ||
1218 | |||
1219 | static int sd_setfreqfltr(struct gspca_dev *gspca_dev, __s32 val) | ||
1220 | { | ||
1221 | struct sd *sd = (struct sd *) gspca_dev; | ||
1222 | |||
1223 | sd->freqfltr = val; | ||
1224 | if (gspca_dev->streaming) | 1437 | if (gspca_dev->streaming) |
1225 | setfreqfltr(gspca_dev); | 1438 | setagc(gspca_dev); |
1226 | return 0; | 1439 | return gspca_dev->usb_err; |
1227 | } | ||
1228 | |||
1229 | static int sd_getfreqfltr(struct gspca_dev *gspca_dev, __s32 *val) | ||
1230 | { | ||
1231 | struct sd *sd = (struct sd *) gspca_dev; | ||
1232 | |||
1233 | *val = sd->freqfltr; | ||
1234 | return 0; | ||
1235 | } | 1440 | } |
1236 | 1441 | ||
1237 | static int sd_querymenu(struct gspca_dev *gspca_dev, | 1442 | static int sd_querymenu(struct gspca_dev *gspca_dev, |
@@ -1302,6 +1507,7 @@ static const struct sd_desc sd_desc = { | |||
1302 | /* -- module initialisation -- */ | 1507 | /* -- module initialisation -- */ |
1303 | static const struct usb_device_id device_table[] = { | 1508 | static const struct usb_device_id device_table[] = { |
1304 | {USB_DEVICE(0x1415, 0x2000)}, | 1509 | {USB_DEVICE(0x1415, 0x2000)}, |
1510 | {USB_DEVICE(0x06f8, 0x3002)}, | ||
1305 | {} | 1511 | {} |
1306 | }; | 1512 | }; |
1307 | 1513 | ||