1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
19
20#define MODULE_NAME "sonixj"
21
22#include <linux/input.h>
23#include "gspca.h"
24#include "jpeg.h"
25
26MODULE_AUTHOR("Jean-François Moine <http://moinejf.free.fr>");
27MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver");
28MODULE_LICENSE("GPL");
29
30
31struct sd {
32 struct gspca_dev gspca_dev;
33
34 atomic_t avg_lum;
35 struct v4l2_ctrl *brightness;
36 struct v4l2_ctrl *contrast;
37 struct v4l2_ctrl *saturation;
38 struct {
39 struct v4l2_ctrl *red_bal;
40 struct v4l2_ctrl *blue_bal;
41 };
42 struct {
43 struct v4l2_ctrl *vflip;
44 struct v4l2_ctrl *hflip;
45 };
46 struct v4l2_ctrl *gamma;
47 struct v4l2_ctrl *illum;
48 struct v4l2_ctrl *sharpness;
49 struct v4l2_ctrl *freq;
50 u32 exposure;
51
52 struct work_struct work;
53
54 u32 pktsz;
55 u16 npkt;
56 s8 nchg;
57 s8 short_mark;
58
59 u8 quality;
60#define QUALITY_MIN 25
61#define QUALITY_MAX 90
62#define QUALITY_DEF 70
63
64 u8 reg01;
65 u8 reg17;
66 u8 reg18;
67 u8 flags;
68
69 s8 ag_cnt;
70#define AG_CNT_START 13
71
72 u8 bridge;
73#define BRIDGE_SN9C102P 0
74#define BRIDGE_SN9C105 1
75#define BRIDGE_SN9C110 2
76#define BRIDGE_SN9C120 3
77 u8 sensor;
78 u8 i2c_addr;
79
80 u8 jpeg_hdr[JPEG_HDR_SZ];
81};
82enum sensors {
83 SENSOR_ADCM1700,
84 SENSOR_GC0307,
85 SENSOR_HV7131R,
86 SENSOR_MI0360,
87 SENSOR_MI0360B,
88 SENSOR_MO4000,
89 SENSOR_MT9V111,
90 SENSOR_OM6802,
91 SENSOR_OV7630,
92 SENSOR_OV7648,
93 SENSOR_OV7660,
94 SENSOR_PO1030,
95 SENSOR_PO2030N,
96 SENSOR_SOI768,
97 SENSOR_SP80708,
98};
99
100static void qual_upd(struct work_struct *work);
101
102
103#define F_PDN_INV 0x01
104#define F_ILLUM 0x02
105
106
107
108#define S_PWR_DN 0x01
109#define S_PDN_INV 0x02
110#define V_TX_EN 0x04
111#define LED 0x08
112#define SCL_SEL_OD 0x20
113#define SYS_SEL_48M 0x40
114
115#define MCK_SIZE_MASK 0x1f
116#define SEN_CLK_EN 0x20
117#define DEF_EN 0x80
118
119static const struct v4l2_pix_format cif_mode[] = {
120 {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
121 .bytesperline = 352,
122 .sizeimage = 352 * 288 * 4 / 8 + 590,
123 .colorspace = V4L2_COLORSPACE_JPEG,
124 .priv = 0},
125};
126static const struct v4l2_pix_format vga_mode[] = {
127 {160, 120, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
128 .bytesperline = 160,
129 .sizeimage = 160 * 120 * 4 / 8 + 590,
130 .colorspace = V4L2_COLORSPACE_JPEG,
131 .priv = 2},
132 {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
133 .bytesperline = 320,
134 .sizeimage = 320 * 240 * 3 / 8 + 590,
135 .colorspace = V4L2_COLORSPACE_JPEG,
136 .priv = 1},
137 {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
138 .bytesperline = 640,
139
140 .sizeimage = 640 * 480 * 3 / 4 + 590,
141 .colorspace = V4L2_COLORSPACE_JPEG,
142 .priv = 0},
143};
144
145static const u8 sn_adcm1700[0x1c] = {
146
147 0x00, 0x43, 0x60, 0x00, 0x1a, 0x00, 0x00, 0x00,
148
149 0x80, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
150
151 0x03, 0x00, 0x05, 0x01, 0x05, 0x16, 0x12, 0x42,
152
153 0x06, 0x00, 0x00, 0x00
154};
155
156static const u8 sn_gc0307[0x1c] = {
157
158 0x00, 0x61, 0x62, 0x00, 0x1a, 0x00, 0x00, 0x00,
159
160 0x80, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
161
162 0x03, 0x00, 0x03, 0x01, 0x08, 0x28, 0x1e, 0x02,
163
164 0x06, 0x00, 0x00, 0x00
165};
166
167static const u8 sn_hv7131[0x1c] = {
168
169 0x00, 0x03, 0x60, 0x00, 0x1a, 0x20, 0x20, 0x20,
170
171 0x81, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
172
173 0x03, 0x00, 0x00, 0x01, 0x03, 0x28, 0x1e, 0x41,
174
175 0x0a, 0x00, 0x00, 0x00
176};
177
178static const u8 sn_mi0360[0x1c] = {
179
180 0x00, 0x63, 0x40, 0x00, 0x1a, 0x20, 0x20, 0x20,
181
182 0x81, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
183
184 0x03, 0x00, 0x00, 0x02, 0x0a, 0x28, 0x1e, 0x61,
185
186 0x06, 0x00, 0x00, 0x00
187};
188
189static const u8 sn_mi0360b[0x1c] = {
190
191 0x00, 0x61, 0x40, 0x00, 0x1a, 0x00, 0x00, 0x00,
192
193 0x81, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
194
195 0x03, 0x00, 0x00, 0x02, 0x0a, 0x28, 0x1e, 0x40,
196
197 0x06, 0x00, 0x00, 0x00
198};
199
200static const u8 sn_mo4000[0x1c] = {
201
202 0x00, 0x23, 0x60, 0x00, 0x1a, 0x00, 0x20, 0x18,
203
204 0x81, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
205
206 0x03, 0x00, 0x0b, 0x0f, 0x14, 0x28, 0x1e, 0x40,
207
208 0x08, 0x00, 0x00, 0x00
209};
210
211static const u8 sn_mt9v111[0x1c] = {
212
213 0x00, 0x61, 0x40, 0x00, 0x1a, 0x20, 0x20, 0x20,
214
215 0x81, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
216
217 0x03, 0x00, 0x00, 0x02, 0x1c, 0x28, 0x1e, 0x40,
218
219 0x06, 0x00, 0x00, 0x00
220};
221
222static const u8 sn_om6802[0x1c] = {
223
224 0x00, 0x23, 0x72, 0x00, 0x1a, 0x20, 0x20, 0x19,
225
226 0x80, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
227
228 0x03, 0x00, 0x51, 0x01, 0x00, 0x28, 0x1e, 0x40,
229
230 0x05, 0x00, 0x00, 0x00
231};
232
233static const u8 sn_ov7630[0x1c] = {
234
235 0x00, 0x21, 0x40, 0x00, 0x1a, 0x00, 0x00, 0x00,
236
237 0x81, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
238
239 0x03, 0x00, 0x04, 0x01, 0x0a, 0x28, 0x1e, 0xc2,
240
241 0x0b, 0x00, 0x00, 0x00
242};
243
244static const u8 sn_ov7648[0x1c] = {
245
246 0x00, 0x63, 0x40, 0x00, 0x1a, 0x20, 0x20, 0x20,
247
248 0x81, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
249
250 0x03, 0x00, 0x00, 0x01, 0x00, 0x28, 0x1e, 0x00,
251
252 0x0b, 0x00, 0x00, 0x00
253};
254
255static const u8 sn_ov7660[0x1c] = {
256
257 0x00, 0x61, 0x40, 0x00, 0x1a, 0x00, 0x00, 0x00,
258
259 0x81, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
260
261 0x03, 0x00, 0x01, 0x01, 0x08, 0x28, 0x1e, 0x20,
262
263 0x07, 0x00, 0x00, 0x00
264};
265
266static const u8 sn_po1030[0x1c] = {
267
268 0x00, 0x21, 0x62, 0x00, 0x1a, 0x20, 0x20, 0x20,
269
270 0x81, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
271
272 0x03, 0x00, 0x00, 0x06, 0x06, 0x28, 0x1e, 0x00,
273
274 0x07, 0x00, 0x00, 0x00
275};
276
277static const u8 sn_po2030n[0x1c] = {
278
279 0x00, 0x63, 0x40, 0x00, 0x1a, 0x00, 0x00, 0x00,
280
281 0x81, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
282
283 0x03, 0x00, 0x00, 0x01, 0x14, 0x28, 0x1e, 0x00,
284
285 0x07, 0x00, 0x00, 0x00
286};
287
288static const u8 sn_soi768[0x1c] = {
289
290 0x00, 0x21, 0x40, 0x00, 0x1a, 0x00, 0x00, 0x00,
291
292 0x81, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
293
294 0x03, 0x00, 0x00, 0x01, 0x08, 0x28, 0x1e, 0x00,
295
296 0x07, 0x00, 0x00, 0x00
297};
298
299static const u8 sn_sp80708[0x1c] = {
300
301 0x00, 0x63, 0x60, 0x00, 0x1a, 0x20, 0x20, 0x20,
302
303 0x81, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
304
305 0x03, 0x00, 0x00, 0x03, 0x04, 0x28, 0x1e, 0x00,
306
307 0x07, 0x00, 0x00, 0x00
308};
309
310
311static const u8 *sn_tb[] = {
312[SENSOR_ADCM1700] = sn_adcm1700,
313[SENSOR_GC0307] = sn_gc0307,
314[SENSOR_HV7131R] = sn_hv7131,
315[SENSOR_MI0360] = sn_mi0360,
316[SENSOR_MI0360B] = sn_mi0360b,
317[SENSOR_MO4000] = sn_mo4000,
318[SENSOR_MT9V111] = sn_mt9v111,
319[SENSOR_OM6802] = sn_om6802,
320[SENSOR_OV7630] = sn_ov7630,
321[SENSOR_OV7648] = sn_ov7648,
322[SENSOR_OV7660] = sn_ov7660,
323[SENSOR_PO1030] = sn_po1030,
324[SENSOR_PO2030N] = sn_po2030n,
325[SENSOR_SOI768] = sn_soi768,
326[SENSOR_SP80708] = sn_sp80708,
327};
328
329
330static const u8 gamma_def[17] = {
331 0x00, 0x2d, 0x46, 0x5a, 0x6c, 0x7c, 0x8b, 0x99,
332 0xa6, 0xb2, 0xbf, 0xca, 0xd5, 0xe0, 0xeb, 0xf5, 0xff
333};
334
335static const u8 gamma_spec_0[17] = {
336 0x0f, 0x39, 0x5a, 0x74, 0x86, 0x95, 0xa6, 0xb4,
337 0xbd, 0xc4, 0xcc, 0xd4, 0xd5, 0xde, 0xe4, 0xed, 0xf5
338};
339
340static const u8 gamma_spec_1[17] = {
341 0x08, 0x3a, 0x52, 0x65, 0x75, 0x83, 0x91, 0x9d,
342 0xa9, 0xb4, 0xbe, 0xc8, 0xd2, 0xdb, 0xe4, 0xed, 0xf5
343};
344
345static const u8 gamma_spec_2[17] = {
346 0x14, 0x37, 0x50, 0x6a, 0x7c, 0x8d, 0x9d, 0xab,
347 0xb5, 0xbf, 0xc2, 0xcb, 0xd1, 0xd6, 0xdb, 0xe1, 0xeb
348};
349
350static const u8 gamma_spec_3[17] = {
351 0x0a, 0x2d, 0x4e, 0x68, 0x7d, 0x8f, 0x9f, 0xab,
352 0xb7, 0xc2, 0xcc, 0xd3, 0xd8, 0xde, 0xe2, 0xe5, 0xe6
353};
354
355
356static const u8 reg84[] = {
357 0x14, 0x00, 0x27, 0x00, 0x07, 0x00,
358 0xe8, 0x0f, 0xda, 0x0f, 0x40, 0x00,
359 0x3e, 0x00, 0xcd, 0x0f, 0xf7, 0x0f,
360 0x00, 0x00, 0x00
361};
362
363#define DELAY 0xdd
364
365static const u8 adcm1700_sensor_init[][8] = {
366 {0xa0, 0x51, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x10},
367 {0xb0, 0x51, 0x04, 0x08, 0x00, 0x00, 0x00, 0x10},
368 {DELAY, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
369 {0xb0, 0x51, 0x04, 0x00, 0x00, 0x00, 0x00, 0x10},
370 {DELAY, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
371 {0xb0, 0x51, 0x0c, 0xe0, 0x2e, 0x00, 0x00, 0x10},
372 {0xb0, 0x51, 0x10, 0x02, 0x02, 0x00, 0x00, 0x10},
373 {0xb0, 0x51, 0x14, 0x0e, 0x0e, 0x00, 0x00, 0x10},
374 {0xb0, 0x51, 0x1c, 0x00, 0x80, 0x00, 0x00, 0x10},
375 {0xb0, 0x51, 0x20, 0x01, 0x00, 0x00, 0x00, 0x10},
376 {DELAY, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
377 {0xb0, 0x51, 0x04, 0x04, 0x00, 0x00, 0x00, 0x10},
378 {DELAY, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
379 {0xb0, 0x51, 0x04, 0x01, 0x00, 0x00, 0x00, 0x10},
380 {0xa0, 0x51, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x10},
381 {0xb0, 0x51, 0x14, 0x01, 0x00, 0x00, 0x00, 0x10},
382 {0xb0, 0x51, 0x32, 0x00, 0x00, 0x00, 0x00, 0x10},
383 {}
384};
385static const u8 adcm1700_sensor_param1[][8] = {
386 {0xb0, 0x51, 0x26, 0xf9, 0x01, 0x00, 0x00, 0x10},
387 {0xd0, 0x51, 0x1e, 0x8e, 0x8e, 0x8e, 0x8e, 0x10},
388
389 {0xa0, 0x51, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x10},
390 {0xb0, 0x51, 0x00, 0x02, 0x00, 0x00, 0x00, 0x10},
391 {0xa0, 0x51, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x10},
392 {0xb0, 0x51, 0x32, 0x00, 0x72, 0x00, 0x00, 0x10},
393 {0xd0, 0x51, 0x1e, 0xbe, 0xd7, 0xe8, 0xbe, 0x10},
394
395 {0xa0, 0x51, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x10},
396 {0xb0, 0x51, 0x00, 0x02, 0x00, 0x00, 0x00, 0x10},
397 {0xa0, 0x51, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x10},
398 {0xb0, 0x51, 0x32, 0x00, 0xa2, 0x00, 0x00, 0x10},
399 {}
400};
401static const u8 gc0307_sensor_init[][8] = {
402 {0xa0, 0x21, 0x43, 0x00, 0x00, 0x00, 0x00, 0x10},
403 {0xa0, 0x21, 0x44, 0xa2, 0x00, 0x00, 0x00, 0x10},
404 {0xa0, 0x21, 0x01, 0x6a, 0x00, 0x00, 0x00, 0x10},
405 {0xa0, 0x21, 0x02, 0x70, 0x00, 0x00, 0x00, 0x10},
406 {0xa0, 0x21, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10},
407 {0xa0, 0x21, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x10},
408 {0xa0, 0x21, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x10},
409 {0xa0, 0x21, 0x11, 0x05, 0x00, 0x00, 0x00, 0x10},
410 {0xa0, 0x21, 0x05, 0x00, 0x00, 0x00, 0x00, 0x10},
411 {0xa0, 0x21, 0x06, 0x00, 0x00, 0x00, 0x00, 0x10},
412 {0xa0, 0x21, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10},
413 {0xa0, 0x21, 0x08, 0x02, 0x00, 0x00, 0x00, 0x10},
414 {0xa0, 0x21, 0x09, 0x01, 0x00, 0x00, 0x00, 0x10},
415 {0xa0, 0x21, 0x0a, 0xe8, 0x00, 0x00, 0x00, 0x10},
416 {0xa0, 0x21, 0x0b, 0x02, 0x00, 0x00, 0x00, 0x10},
417 {0xa0, 0x21, 0x0c, 0x80, 0x00, 0x00, 0x00, 0x10},
418 {0xa0, 0x21, 0x0d, 0x22, 0x00, 0x00, 0x00, 0x10},
419 {0xa0, 0x21, 0x0e, 0x02, 0x00, 0x00, 0x00, 0x10},
420 {0xa0, 0x21, 0x0f, 0xb2, 0x00, 0x00, 0x00, 0x10},
421 {0xa0, 0x21, 0x12, 0x70, 0x00, 0x00, 0x00, 0x10},
422 {DELAY, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
423 {0xa0, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00, 0x10},
424 {0xa0, 0x21, 0x15, 0xb8, 0x00, 0x00, 0x00, 0x10},
425 {0xa0, 0x21, 0x16, 0x13, 0x00, 0x00, 0x00, 0x10},
426 {0xa0, 0x21, 0x17, 0x52, 0x00, 0x00, 0x00, 0x10},
427 {0xa0, 0x21, 0x18, 0x50, 0x00, 0x00, 0x00, 0x10},
428 {0xa0, 0x21, 0x1e, 0x0d, 0x00, 0x00, 0x00, 0x10},
429 {0xa0, 0x21, 0x1f, 0x32, 0x00, 0x00, 0x00, 0x10},
430 {0xa0, 0x21, 0x61, 0x90, 0x00, 0x00, 0x00, 0x10},
431 {0xa0, 0x21, 0x63, 0x70, 0x00, 0x00, 0x00, 0x10},
432 {0xa0, 0x21, 0x65, 0x98, 0x00, 0x00, 0x00, 0x10},
433 {0xa0, 0x21, 0x67, 0x90, 0x00, 0x00, 0x00, 0x10},
434 {0xa0, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10},
435 {0xa0, 0x21, 0x04, 0x96, 0x00, 0x00, 0x00, 0x10},
436 {0xa0, 0x21, 0x45, 0x27, 0x00, 0x00, 0x00, 0x10},
437 {0xa0, 0x21, 0x47, 0x2c, 0x00, 0x00, 0x00, 0x10},
438 {0xa0, 0x21, 0x43, 0x47, 0x00, 0x00, 0x00, 0x10},
439 {0xa0, 0x21, 0x44, 0xd8, 0x00, 0x00, 0x00, 0x10},
440 {}
441};
442static const u8 gc0307_sensor_param1[][8] = {
443 {0xa0, 0x21, 0x68, 0x13, 0x00, 0x00, 0x00, 0x10},
444 {0xd0, 0x21, 0x61, 0x80, 0x00, 0x80, 0x00, 0x10},
445 {0xc0, 0x21, 0x65, 0x80, 0x00, 0x80, 0x00, 0x10},
446 {0xc0, 0x21, 0x63, 0xa0, 0x00, 0xa6, 0x00, 0x10},
447
448 {0xa0, 0x21, 0x01, 0x6e, 0x00, 0x00, 0x00, 0x10},
449 {0xa0, 0x21, 0x02, 0x88, 0x00, 0x00, 0x00, 0x10},
450 {}
451};
452
453static const u8 hv7131r_sensor_init[][8] = {
454 {0xc1, 0x11, 0x01, 0x08, 0x01, 0x00, 0x00, 0x10},
455 {0xb1, 0x11, 0x34, 0x17, 0x7f, 0x00, 0x00, 0x10},
456 {0xd1, 0x11, 0x40, 0xff, 0x7f, 0x7f, 0x7f, 0x10},
457
458 {0xd1, 0x11, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10},
459 {0xd1, 0x11, 0x14, 0x01, 0xe2, 0x02, 0x82, 0x10},
460
461
462 {0xa1, 0x11, 0x01, 0x08, 0x00, 0x00, 0x00, 0x10},
463 {0xa1, 0x11, 0x01, 0x08, 0x00, 0x00, 0x00, 0x10},
464 {0xc1, 0x11, 0x25, 0x00, 0x61, 0xa8, 0x00, 0x10},
465 {0xa1, 0x11, 0x30, 0x22, 0x00, 0x00, 0x00, 0x10},
466 {0xc1, 0x11, 0x31, 0x20, 0x2e, 0x20, 0x00, 0x10},
467 {0xc1, 0x11, 0x25, 0x00, 0xc3, 0x50, 0x00, 0x10},
468 {0xa1, 0x11, 0x30, 0x07, 0x00, 0x00, 0x00, 0x10},
469 {0xc1, 0x11, 0x31, 0x10, 0x10, 0x10, 0x00, 0x10},
470
471 {0xa1, 0x11, 0x01, 0x08, 0x00, 0x00, 0x00, 0x10},
472 {0xa1, 0x11, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10},
473 {0xa1, 0x11, 0x21, 0xd0, 0x00, 0x00, 0x00, 0x10},
474 {0xa1, 0x11, 0x22, 0x00, 0x00, 0x00, 0x00, 0x10},
475 {0xa1, 0x11, 0x23, 0x09, 0x00, 0x00, 0x00, 0x10},
476
477 {0xa1, 0x11, 0x01, 0x08, 0x00, 0x00, 0x00, 0x10},
478 {0xa1, 0x11, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10},
479 {0xa1, 0x11, 0x21, 0xd0, 0x00, 0x00, 0x00, 0x10},
480 {0xa1, 0x11, 0x22, 0x00, 0x00, 0x00, 0x00, 0x10},
481 {0xa1, 0x11, 0x23, 0x10, 0x00, 0x00, 0x00, 0x10},
482 {0xa1, 0x11, 0x01, 0x18, 0x00, 0x00, 0x00, 0x10},
483
484 {}
485};
486static const u8 mi0360_sensor_init[][8] = {
487 {0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10},
488 {0xb1, 0x5d, 0x0d, 0x00, 0x01, 0x00, 0x00, 0x10},
489 {0xb1, 0x5d, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x10},
490 {0xd1, 0x5d, 0x01, 0x00, 0x08, 0x00, 0x16, 0x10},
491 {0xd1, 0x5d, 0x03, 0x01, 0xe2, 0x02, 0x82, 0x10},
492 {0xd1, 0x5d, 0x05, 0x00, 0x09, 0x00, 0x53, 0x10},
493 {0xb1, 0x5d, 0x0d, 0x00, 0x02, 0x00, 0x00, 0x10},
494 {0xd1, 0x5d, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x10},
495 {0xd1, 0x5d, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x10},
496 {0xd1, 0x5d, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x10},
497 {0xd1, 0x5d, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10},
498 {0xd1, 0x5d, 0x12, 0x00, 0x00, 0x00, 0x00, 0x10},
499 {0xd1, 0x5d, 0x14, 0x00, 0x00, 0x00, 0x00, 0x10},
500 {0xd1, 0x5d, 0x16, 0x00, 0x00, 0x00, 0x00, 0x10},
501 {0xd1, 0x5d, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10},
502 {0xd1, 0x5d, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x10},
503 {0xd1, 0x5d, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x10},
504 {0xb1, 0x5d, 0x32, 0x00, 0x00, 0x00, 0x00, 0x10},
505 {0xd1, 0x5d, 0x20, 0x91, 0x01, 0x00, 0x00, 0x10},
506 {0xd1, 0x5d, 0x22, 0x00, 0x00, 0x00, 0x00, 0x10},
507 {0xd1, 0x5d, 0x24, 0x00, 0x00, 0x00, 0x00, 0x10},
508 {0xd1, 0x5d, 0x26, 0x00, 0x00, 0x00, 0x24, 0x10},
509 {0xd1, 0x5d, 0x2f, 0xf7, 0xb0, 0x00, 0x04, 0x10},
510 {0xd1, 0x5d, 0x31, 0x00, 0x00, 0x00, 0x00, 0x10},
511 {0xd1, 0x5d, 0x33, 0x00, 0x00, 0x01, 0x00, 0x10},
512 {0xb1, 0x5d, 0x3d, 0x06, 0x8f, 0x00, 0x00, 0x10},
513 {0xd1, 0x5d, 0x40, 0x01, 0xe0, 0x00, 0xd1, 0x10},
514 {0xb1, 0x5d, 0x44, 0x00, 0x82, 0x00, 0x00, 0x10},
515 {0xd1, 0x5d, 0x58, 0x00, 0x78, 0x00, 0x43, 0x10},
516 {0xd1, 0x5d, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x10},
517 {0xd1, 0x5d, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x10},
518 {0xd1, 0x5d, 0x5e, 0x00, 0x00, 0xa3, 0x1d, 0x10},
519 {0xb1, 0x5d, 0x62, 0x04, 0x11, 0x00, 0x00, 0x10},
520
521 {0xb1, 0x5d, 0x20, 0x91, 0x01, 0x00, 0x00, 0x10},
522 {0xb1, 0x5d, 0x20, 0x11, 0x01, 0x00, 0x00, 0x10},
523 {0xb1, 0x5d, 0x09, 0x00, 0x64, 0x00, 0x00, 0x10},
524 {0xd1, 0x5d, 0x2b, 0x00, 0xa0, 0x00, 0xb0, 0x10},
525 {0xd1, 0x5d, 0x2d, 0x00, 0xa0, 0x00, 0xa0, 0x10},
526
527 {0xb1, 0x5d, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x10},
528 {0xb1, 0x5d, 0x06, 0x00, 0x30, 0x00, 0x00, 0x10},
529 {0xb1, 0x5d, 0x05, 0x00, 0x0a, 0x00, 0x00, 0x10},
530 {0xb1, 0x5d, 0x09, 0x02, 0x35, 0x00, 0x00, 0x10},
531
532 {0xd1, 0x5d, 0x2b, 0x00, 0xb9, 0x00, 0xe3, 0x10},
533 {0xd1, 0x5d, 0x2d, 0x00, 0x5f, 0x00, 0xb9, 0x10},
534
535
536 {0xb1, 0x5d, 0x07, 0x00, 0x03, 0x00, 0x00, 0x10},
537 {0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10},
538 {}
539};
540static const u8 mi0360b_sensor_init[][8] = {
541 {0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10},
542 {0xb1, 0x5d, 0x0d, 0x00, 0x01, 0x00, 0x00, 0x10},
543 {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
544 {0xb1, 0x5d, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x10},
545 {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
546 {0xd1, 0x5d, 0x01, 0x00, 0x08, 0x00, 0x16, 0x10},
547 {0xd1, 0x5d, 0x03, 0x01, 0xe2, 0x02, 0x82, 0x10},
548 {0xd1, 0x5d, 0x05, 0x00, 0x00, 0x00, 0x00, 0x10},
549 {0xb1, 0x5d, 0x0d, 0x00, 0x02, 0x00, 0x00, 0x10},
550 {0xd1, 0x5d, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x10},
551 {0xd1, 0x5d, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x10},
552 {0xd1, 0x5d, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x10},
553 {0xd1, 0x5d, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10},
554 {0xd1, 0x5d, 0x12, 0x00, 0x00, 0x00, 0x00, 0x10},
555 {0xd1, 0x5d, 0x14, 0x00, 0x00, 0x00, 0x00, 0x10},
556 {0xd1, 0x5d, 0x16, 0x00, 0x00, 0x00, 0x00, 0x10},
557 {0xd1, 0x5d, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10},
558 {0xd1, 0x5d, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x10},
559 {0xd1, 0x5d, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x10},
560 {0xb1, 0x5d, 0x32, 0x00, 0x00, 0x00, 0x00, 0x10},
561 {0xd1, 0x5d, 0x20, 0x11, 0x01, 0x00, 0x00, 0x10},
562 {0xd1, 0x5d, 0x22, 0x00, 0x00, 0x00, 0x00, 0x10},
563 {0xd1, 0x5d, 0x24, 0x00, 0x00, 0x00, 0x00, 0x10},
564 {0xd1, 0x5d, 0x26, 0x00, 0x00, 0x00, 0x24, 0x10},
565 {0xd1, 0x5d, 0x2f, 0xf7, 0xb0, 0x00, 0x04, 0x10},
566 {0xd1, 0x5d, 0x31, 0x00, 0x00, 0x00, 0x00, 0x10},
567 {0xd1, 0x5d, 0x33, 0x00, 0x00, 0x01, 0x00, 0x10},
568 {0xb1, 0x5d, 0x3d, 0x06, 0x8f, 0x00, 0x00, 0x10},
569 {0xd1, 0x5d, 0x40, 0x01, 0xe0, 0x00, 0xd1, 0x10},
570 {0xb1, 0x5d, 0x44, 0x00, 0x82, 0x00, 0x00, 0x10},
571 {0xd1, 0x5d, 0x58, 0x00, 0x78, 0x00, 0x43, 0x10},
572 {0xd1, 0x5d, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x10},
573 {0xd1, 0x5d, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x10},
574 {0xd1, 0x5d, 0x5e, 0x00, 0x00, 0xa3, 0x1d, 0x10},
575 {0xb1, 0x5d, 0x62, 0x04, 0x11, 0x00, 0x00, 0x10},
576
577 {0xb1, 0x5d, 0x20, 0x11, 0x01, 0x00, 0x00, 0x10},
578 {0xb1, 0x5d, 0x20, 0x11, 0x01, 0x00, 0x00, 0x10},
579 {0xb1, 0x5d, 0x09, 0x00, 0x64, 0x00, 0x00, 0x10},
580 {0xd1, 0x5d, 0x2b, 0x00, 0x33, 0x00, 0xa0, 0x10},
581 {0xd1, 0x5d, 0x2d, 0x00, 0xa0, 0x00, 0x33, 0x10},
582 {}
583};
584static const u8 mi0360b_sensor_param1[][8] = {
585 {0xb1, 0x5d, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x10},
586 {0xb1, 0x5d, 0x06, 0x00, 0x53, 0x00, 0x00, 0x10},
587 {0xb1, 0x5d, 0x05, 0x00, 0x09, 0x00, 0x00, 0x10},
588 {0xb1, 0x5d, 0x09, 0x02, 0x35, 0x00, 0x00, 0x10},
589
590 {0xd1, 0x5d, 0x2b, 0x00, 0xd1, 0x01, 0xc9, 0x10},
591 {0xd1, 0x5d, 0x2d, 0x00, 0xed, 0x00, 0xd1, 0x10},
592 {0xb1, 0x5d, 0x07, 0x00, 0x03, 0x00, 0x00, 0x10},
593 {0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10},
594 {}
595};
596static const u8 mo4000_sensor_init[][8] = {
597 {0xa1, 0x21, 0x01, 0x02, 0x00, 0x00, 0x00, 0x10},
598 {0xa1, 0x21, 0x02, 0x00, 0x00, 0x00, 0x00, 0x10},
599 {0xa1, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10},
600 {0xa1, 0x21, 0x04, 0x00, 0x00, 0x00, 0x00, 0x10},
601 {0xa1, 0x21, 0x05, 0x00, 0x00, 0x00, 0x00, 0x10},
602 {0xa1, 0x21, 0x05, 0x04, 0x00, 0x00, 0x00, 0x10},
603 {0xa1, 0x21, 0x06, 0x80, 0x00, 0x00, 0x00, 0x10},
604 {0xa1, 0x21, 0x06, 0x81, 0x00, 0x00, 0x00, 0x10},
605 {0xa1, 0x21, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x10},
606 {0xa1, 0x21, 0x11, 0x00, 0x00, 0x00, 0x00, 0x10},
607 {0xa1, 0x21, 0x11, 0x20, 0x00, 0x00, 0x00, 0x10},
608 {0xa1, 0x21, 0x11, 0x30, 0x00, 0x00, 0x00, 0x10},
609 {0xa1, 0x21, 0x11, 0x38, 0x00, 0x00, 0x00, 0x10},
610 {0xa1, 0x21, 0x11, 0x38, 0x00, 0x00, 0x00, 0x10},
611 {0xa1, 0x21, 0x12, 0x00, 0x00, 0x00, 0x00, 0x10},
612 {0xa1, 0x21, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10},
613 {0xa1, 0x21, 0x0f, 0x20, 0x00, 0x00, 0x00, 0x10},
614 {0xa1, 0x21, 0x10, 0x20, 0x00, 0x00, 0x00, 0x10},
615 {0xa1, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10},
616 {0xa1, 0x21, 0x11, 0x38, 0x00, 0x00, 0x00, 0x10},
617 {}
618};
619static const u8 mt9v111_sensor_init[][8] = {
620 {0xb1, 0x5c, 0x0d, 0x00, 0x01, 0x00, 0x00, 0x10},
621 {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
622 {0xb1, 0x5c, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x10},
623 {0xb1, 0x5c, 0x01, 0x00, 0x01, 0x00, 0x00, 0x10},
624 {0xb1, 0x5c, 0x08, 0x04, 0x80, 0x00, 0x00, 0x10},
625 {0xb1, 0x5c, 0x06, 0x00, 0x00, 0x00, 0x00, 0x10},
626 {0xb1, 0x5c, 0x01, 0x00, 0x04, 0x00, 0x00, 0x10},
627 {0xb1, 0x5c, 0x08, 0x00, 0x08, 0x00, 0x00, 0x10},
628 {0xb1, 0x5c, 0x02, 0x00, 0x16, 0x00, 0x00, 0x10},
629 {0xb1, 0x5c, 0x03, 0x01, 0xe7, 0x00, 0x00, 0x10},
630 {0xb1, 0x5c, 0x04, 0x02, 0x87, 0x00, 0x00, 0x10},
631 {0xb1, 0x5c, 0x07, 0x30, 0x02, 0x00, 0x00, 0x10},
632 {0xb1, 0x5c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x10},
633 {0xb1, 0x5c, 0x12, 0x00, 0xb0, 0x00, 0x00, 0x10},
634 {0xb1, 0x5c, 0x13, 0x00, 0x7c, 0x00, 0x00, 0x10},
635 {0xb1, 0x5c, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x10},
636 {0xb1, 0x5c, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10},
637 {0xb1, 0x5c, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10},
638 {}
639};
640static const u8 mt9v111_sensor_param1[][8] = {
641 {0xd1, 0x5c, 0x2b, 0x00, 0x33, 0x00, 0xad, 0x10},
642 {0xd1, 0x5c, 0x2d, 0x00, 0xad, 0x00, 0x33, 0x10},
643 {0xb1, 0x5c, 0x06, 0x00, 0x40, 0x00, 0x00, 0x10},
644 {0xb1, 0x5c, 0x05, 0x00, 0x09, 0x00, 0x00, 0x10},
645 {0xb1, 0x5c, 0x35, 0x01, 0xc0, 0x00, 0x00, 0x10},
646 {}
647};
648static const u8 om6802_init0[2][8] = {
649
650 {0xa0, 0x34, 0x29, 0x0e, 0x00, 0x00, 0x00, 0x10},
651 {0xa0, 0x34, 0x23, 0xb0, 0x00, 0x00, 0x00, 0x10},
652};
653static const u8 om6802_sensor_init[][8] = {
654 {0xa0, 0x34, 0xdf, 0x6d, 0x00, 0x00, 0x00, 0x10},
655
656 {0xa0, 0x34, 0xdd, 0x18, 0x00, 0x00, 0x00, 0x10},
657
658 {0xa0, 0x34, 0x5a, 0xc0, 0x00, 0x00, 0x00, 0x10},
659
660 {0xa0, 0x34, 0xf0, 0x04, 0x00, 0x00, 0x00, 0x10},
661
662
663
664
665
666
667
668
669
670
671
672
673
674 {0xa0, 0x34, 0xe9, 0x0f, 0x00, 0x00, 0x00, 0x10},
675
676 {0xa0, 0x34, 0xe4, 0xff, 0x00, 0x00, 0x00, 0x10},
677
678
679
680
681 {0xa0, 0x34, 0x5d, 0x80, 0x00, 0x00, 0x00, 0x10},
682 {}
683};
684static const u8 om6802_sensor_param1[][8] = {
685 {0xa0, 0x34, 0x71, 0x84, 0x00, 0x00, 0x00, 0x10},
686 {0xa0, 0x34, 0x72, 0x05, 0x00, 0x00, 0x00, 0x10},
687 {0xa0, 0x34, 0x68, 0x80, 0x00, 0x00, 0x00, 0x10},
688 {0xa0, 0x34, 0x69, 0x01, 0x00, 0x00, 0x00, 0x10},
689 {}
690};
691static const u8 ov7630_sensor_init[][8] = {
692 {0xa1, 0x21, 0x76, 0x01, 0x00, 0x00, 0x00, 0x10},
693 {0xa1, 0x21, 0x12, 0xc8, 0x00, 0x00, 0x00, 0x10},
694 {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
695 {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10},
696 {0xa1, 0x21, 0x12, 0xc8, 0x00, 0x00, 0x00, 0x10},
697 {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
698 {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10},
699
700 {0xd1, 0x21, 0x03, 0x80, 0x10, 0x20, 0x80, 0x10},
701 {0xb1, 0x21, 0x0c, 0x20, 0x20, 0x00, 0x00, 0x10},
702
703
704 {0xd1, 0x21, 0x11, 0x01, 0x48, 0xc3, 0x00, 0x10},
705 {0xb1, 0x21, 0x15, 0x80, 0x03, 0x00, 0x00, 0x10},
706 {0xd1, 0x21, 0x17, 0x1b, 0xbd, 0x05, 0xf6, 0x10},
707 {0xa1, 0x21, 0x1b, 0x04, 0x00, 0x00, 0x00, 0x10},
708 {0xd1, 0x21, 0x1f, 0x00, 0x80, 0x80, 0x80, 0x10},
709 {0xd1, 0x21, 0x23, 0xde, 0x10, 0x8a, 0xa0, 0x10},
710 {0xc1, 0x21, 0x27, 0xca, 0xa2, 0x74, 0x00, 0x10},
711 {0xd1, 0x21, 0x2a, 0x88, 0x00, 0x88, 0x01, 0x10},
712 {0xc1, 0x21, 0x2e, 0x80, 0x00, 0x18, 0x00, 0x10},
713 {0xa1, 0x21, 0x21, 0x08, 0x00, 0x00, 0x00, 0x10},
714 {0xa1, 0x21, 0x22, 0x00, 0x00, 0x00, 0x00, 0x10},
715 {0xa1, 0x21, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x10},
716 {0xb1, 0x21, 0x32, 0xc2, 0x08, 0x00, 0x00, 0x10},
717 {0xb1, 0x21, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x10},
718 {0xd1, 0x21, 0x60, 0x05, 0x40, 0x12, 0x57, 0x10},
719 {0xa1, 0x21, 0x64, 0x73, 0x00, 0x00, 0x00, 0x10},
720 {0xd1, 0x21, 0x65, 0x00, 0x55, 0x01, 0xac, 0x10},
721 {0xa1, 0x21, 0x69, 0x38, 0x00, 0x00, 0x00, 0x10},
722 {0xd1, 0x21, 0x6f, 0x1f, 0x01, 0x00, 0x10, 0x10},
723 {0xd1, 0x21, 0x73, 0x50, 0x20, 0x02, 0x01, 0x10},
724 {0xd1, 0x21, 0x77, 0xf3, 0x90, 0x98, 0x98, 0x10},
725 {0xc1, 0x21, 0x7b, 0x00, 0x4c, 0xf7, 0x00, 0x10},
726 {0xd1, 0x21, 0x17, 0x1b, 0xbd, 0x05, 0xf6, 0x10},
727 {0xa1, 0x21, 0x1b, 0x04, 0x00, 0x00, 0x00, 0x10},
728 {}
729};
730static const u8 ov7630_sensor_param1[][8] = {
731 {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10},
732 {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10},
733
734
735
736 {0xa1, 0x21, 0x10, 0x32, 0x00, 0x00, 0x00, 0x10},
737 {0xa1, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10},
738 {0xb1, 0x21, 0x01, 0x80, 0x80, 0x00, 0x00, 0x10},
739
740
741
742
743 {0xa1, 0x21, 0x10, 0x83, 0x00, 0x00, 0x00, 0x10},
744
745 {}
746};
747
748static const u8 ov7648_sensor_init[][8] = {
749 {0xa1, 0x21, 0x76, 0x00, 0x00, 0x00, 0x00, 0x10},
750 {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10},
751 {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
752 {0xa1, 0x21, 0x12, 0x00, 0x00, 0x00, 0x00, 0x10},
753 {0xd1, 0x21, 0x03, 0xa4, 0x30, 0x88, 0x00, 0x10},
754 {0xb1, 0x21, 0x11, 0x80, 0x08, 0x00, 0x00, 0x10},
755 {0xc1, 0x21, 0x13, 0xa0, 0x04, 0x84, 0x00, 0x10},
756 {0xd1, 0x21, 0x17, 0x1a, 0x02, 0xba, 0xf4, 0x10},
757 {0xa1, 0x21, 0x1b, 0x04, 0x00, 0x00, 0x00, 0x10},
758 {0xd1, 0x21, 0x1f, 0x41, 0xc0, 0x80, 0x80, 0x10},
759 {0xd1, 0x21, 0x23, 0xde, 0xa0, 0x80, 0x32, 0x10},
760 {0xd1, 0x21, 0x27, 0xfe, 0xa0, 0x00, 0x91, 0x10},
761 {0xd1, 0x21, 0x2b, 0x00, 0x88, 0x85, 0x80, 0x10},
762 {0xc1, 0x21, 0x2f, 0x9c, 0x00, 0xc4, 0x00, 0x10},
763 {0xd1, 0x21, 0x60, 0xa6, 0x60, 0x88, 0x12, 0x10},
764 {0xd1, 0x21, 0x64, 0x88, 0x00, 0x00, 0x94, 0x10},
765 {0xd1, 0x21, 0x68, 0x7a, 0x0c, 0x00, 0x00, 0x10},
766 {0xd1, 0x21, 0x6c, 0x11, 0x33, 0x22, 0x00, 0x10},
767 {0xd1, 0x21, 0x70, 0x11, 0x00, 0x10, 0x50, 0x10},
768 {0xd1, 0x21, 0x74, 0x20, 0x06, 0x00, 0xb5, 0x10},
769 {0xd1, 0x21, 0x78, 0x8a, 0x00, 0x00, 0x00, 0x10},
770 {0xb1, 0x21, 0x7c, 0x00, 0x43, 0x00, 0x00, 0x10},
771
772 {0xd1, 0x21, 0x21, 0x86, 0x00, 0xde, 0xa0, 0x10},
773
774
775
776 {}
777};
778static const u8 ov7648_sensor_param1[][8] = {
779
780
781
782 {0xa1, 0x21, 0x19, 0x02, 0x00, 0x00, 0x00, 0x10},
783 {0xa1, 0x21, 0x10, 0x32, 0x00, 0x00, 0x00, 0x10},
784
785
786
787
788 {0xa1, 0x21, 0x11, 0x81, 0x00, 0x00, 0x00, 0x10},
789
790
791
792
793
794
795 {}
796};
797
798static const u8 ov7660_sensor_init[][8] = {
799 {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10},
800 {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
801 {0xa1, 0x21, 0x12, 0x05, 0x00, 0x00, 0x00, 0x10},
802
803 {0xa1, 0x21, 0x13, 0xb8, 0x00, 0x00, 0x00, 0x10},
804 {0xd1, 0x21, 0x00, 0x01, 0x74, 0x92, 0x00, 0x10},
805
806 {0xd1, 0x21, 0x04, 0x00, 0x7d, 0x62, 0x00, 0x10},
807
808 {0xb1, 0x21, 0x08, 0x83, 0x01, 0x00, 0x00, 0x10},
809 {0xd1, 0x21, 0x0c, 0x00, 0x08, 0x04, 0x4f, 0x10},
810 {0xd1, 0x21, 0x10, 0x7f, 0x40, 0x05, 0xff, 0x10},
811
812 {0xc1, 0x21, 0x14, 0x2c, 0x00, 0x02, 0x00, 0x10},
813 {0xd1, 0x21, 0x17, 0x10, 0x60, 0x02, 0x7b, 0x10},
814
815 {0xa1, 0x21, 0x1b, 0x02, 0x00, 0x00, 0x00, 0x10},
816 {0xb1, 0x21, 0x1e, 0x01, 0x0e, 0x00, 0x00, 0x10},
817 {0xd1, 0x21, 0x20, 0x07, 0x07, 0x07, 0x07, 0x10},
818
819
820 {0xd1, 0x21, 0x24, 0x78, 0x68, 0xd4, 0x80, 0x10},
821
822 {0xd1, 0x21, 0x28, 0x80, 0x30, 0x00, 0x00, 0x10},
823
824 {0xd1, 0x21, 0x2c, 0x80, 0x00, 0x00, 0x62, 0x10},
825
826 {0xc1, 0x21, 0x30, 0x08, 0x30, 0xb4, 0x00, 0x10},
827
828 {0xd1, 0x21, 0x33, 0x00, 0x07, 0x84, 0x00, 0x10},
829 {0xd1, 0x21, 0x37, 0x0c, 0x02, 0x43, 0x00, 0x10},
830
831 {0xd1, 0x21, 0x3b, 0x02, 0x6c, 0x19, 0x0e, 0x10},
832
833 {0xd1, 0x21, 0x3f, 0x41, 0xc1, 0x22, 0x08, 0x10},
834
835 {0xd1, 0x21, 0x43, 0xf0, 0x10, 0x78, 0xa8, 0x10},
836 {0xd1, 0x21, 0x47, 0x60, 0x80, 0x00, 0x00, 0x10},
837 {0xd1, 0x21, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x10},
838 {0xd1, 0x21, 0x4f, 0x46, 0x36, 0x0f, 0x17, 0x10},
839 {0xd1, 0x21, 0x53, 0x7f, 0x96, 0x40, 0x40, 0x10},
840 {0xb1, 0x21, 0x57, 0x40, 0x0f, 0x00, 0x00, 0x10},
841 {0xd1, 0x21, 0x59, 0xba, 0x9a, 0x22, 0xb9, 0x10},
842 {0xd1, 0x21, 0x5d, 0x9b, 0x10, 0xf0, 0x05, 0x10},
843 {0xa1, 0x21, 0x61, 0x60, 0x00, 0x00, 0x00, 0x10},
844 {0xd1, 0x21, 0x62, 0x00, 0x00, 0x50, 0x30, 0x10},
845
846 {0xa1, 0x21, 0x66, 0x00, 0x00, 0x00, 0x00, 0x10},
847 {0xd1, 0x21, 0x67, 0x80, 0x7a, 0x90, 0x80, 0x10},
848 {0xa1, 0x21, 0x6b, 0x0a, 0x00, 0x00, 0x00, 0x10},
849
850 {0xd1, 0x21, 0x6c, 0x30, 0x48, 0x80, 0x74, 0x10},
851 {0xd1, 0x21, 0x70, 0x64, 0x60, 0x5c, 0x58, 0x10},
852 {0xd1, 0x21, 0x74, 0x54, 0x4c, 0x40, 0x38, 0x10},
853 {0xd1, 0x21, 0x78, 0x34, 0x30, 0x2f, 0x2b, 0x10},
854 {0xd1, 0x21, 0x7c, 0x03, 0x07, 0x17, 0x34, 0x10},
855 {0xd1, 0x21, 0x80, 0x41, 0x4d, 0x58, 0x63, 0x10},
856 {0xd1, 0x21, 0x84, 0x6e, 0x77, 0x87, 0x95, 0x10},
857 {0xc1, 0x21, 0x88, 0xaf, 0xc7, 0xdf, 0x00, 0x10},
858 {0xc1, 0x21, 0x8b, 0x99, 0x99, 0xcf, 0x00, 0x10},
859 {0xb1, 0x21, 0x92, 0x00, 0x00, 0x00, 0x00, 0x10},
860
861 {0xa1, 0x21, 0xa1, 0x00, 0x00, 0x00, 0x00, 0x10},
862 {}
863};
864static const u8 ov7660_sensor_param1[][8] = {
865 {0xa1, 0x21, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x10},
866
867 {0xa1, 0x21, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x10},
868 {0xa1, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10},
869
870 {0xa1, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10},
871 {0xa1, 0x21, 0x10, 0x20, 0x00, 0x00, 0x00, 0x10},
872 {0xa1, 0x21, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x10},
873 {0xa1, 0x21, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x10},
874 {0xa1, 0x21, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x10},
875
876
877
878 {0xa1, 0x21, 0x93, 0x00, 0x00, 0x00, 0x00, 0x10},
879 {0xa1, 0x21, 0x92, 0x25, 0x00, 0x00, 0x00, 0x10},
880 {0xa1, 0x21, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x10},
881 {0xa1, 0x21, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10},
882
883
884
885
886 {0xa1, 0x21, 0x93, 0x01, 0x00, 0x00, 0x00, 0x10},
887 {0xa1, 0x21, 0x92, 0xff, 0x00, 0x00, 0x00, 0x10},
888 {0xa1, 0x21, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x10},
889 {0xa1, 0x21, 0x2b, 0xc3, 0x00, 0x00, 0x00, 0x10},
890 {}
891};
892
893static const u8 po1030_sensor_init[][8] = {
894
895 {0xa1, 0x6e, 0x3f, 0x20, 0x00, 0x00, 0x00, 0x10},
896 {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
897 {0xa1, 0x6e, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x10},
898 {0xa1, 0x6e, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x10},
899 {0xd1, 0x6e, 0x04, 0x02, 0xb1, 0x02, 0x39, 0x10},
900 {0xd1, 0x6e, 0x08, 0x00, 0x01, 0x00, 0x00, 0x10},
901 {0xd1, 0x6e, 0x0c, 0x02, 0x7f, 0x01, 0xe0, 0x10},
902 {0xd1, 0x6e, 0x12, 0x03, 0x02, 0x00, 0x03, 0x10},
903 {0xd1, 0x6e, 0x16, 0x85, 0x40, 0x4a, 0x40, 0x10},
904 {0xc1, 0x6e, 0x1a, 0x00, 0x80, 0x00, 0x00, 0x10},
905 {0xd1, 0x6e, 0x1d, 0x08, 0x03, 0x00, 0x00, 0x10},
906 {0xd1, 0x6e, 0x23, 0x00, 0xb0, 0x00, 0x94, 0x10},
907 {0xd1, 0x6e, 0x27, 0x58, 0x00, 0x00, 0x00, 0x10},
908 {0xb1, 0x6e, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10},
909 {0xd1, 0x6e, 0x2d, 0x14, 0x35, 0x61, 0x84, 0x10},
910 {0xd1, 0x6e, 0x31, 0xa2, 0xbd, 0xd8, 0xff, 0x10},
911 {0xd1, 0x6e, 0x35, 0x06, 0x1e, 0x12, 0x02, 0x10},
912 {0xd1, 0x6e, 0x39, 0xaa, 0x53, 0x37, 0xd5, 0x10},
913 {0xa1, 0x6e, 0x3d, 0xf2, 0x00, 0x00, 0x00, 0x10},
914 {0xd1, 0x6e, 0x3e, 0x00, 0x00, 0x80, 0x03, 0x10},
915 {0xd1, 0x6e, 0x42, 0x03, 0x00, 0x00, 0x00, 0x10},
916 {0xc1, 0x6e, 0x46, 0x00, 0x80, 0x80, 0x00, 0x10},
917 {0xd1, 0x6e, 0x4b, 0x02, 0xef, 0x08, 0xcd, 0x10},
918 {0xd1, 0x6e, 0x4f, 0x00, 0xd0, 0x00, 0xa0, 0x10},
919 {0xd1, 0x6e, 0x53, 0x01, 0xaa, 0x01, 0x40, 0x10},
920 {0xd1, 0x6e, 0x5a, 0x50, 0x04, 0x30, 0x03, 0x10},
921 {0xa1, 0x6e, 0x5e, 0x00, 0x00, 0x00, 0x00, 0x10},
922 {0xd1, 0x6e, 0x5f, 0x10, 0x40, 0xff, 0x00, 0x10},
923
924 {0xd1, 0x6e, 0x63, 0x40, 0x40, 0x00, 0x00, 0x10},
925 {0xd1, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x00, 0x10},
926 {0xd1, 0x6e, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x10},
927 {0xd1, 0x6e, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x10},
928 {0xc1, 0x6e, 0x73, 0x10, 0x80, 0xeb, 0x00, 0x10},
929 {}
930};
931static const u8 po1030_sensor_param1[][8] = {
932
933 {0xa1, 0x6e, 0x1e, 0x03, 0x00, 0x00, 0x00, 0x10},
934 {0xa1, 0x6e, 0x1e, 0x03, 0x00, 0x00, 0x00, 0x10},
935
936 {0xc1, 0x6e, 0x1a, 0x02, 0xd4, 0xa4, 0x00, 0x10},
937 {0xa1, 0x6e, 0x15, 0x04, 0x00, 0x00, 0x00, 0x10},
938 {0xc1, 0x6e, 0x16, 0x40, 0x40, 0x40, 0x00, 0x10},
939
940 {0xa1, 0x6e, 0x1d, 0x08, 0x00, 0x00, 0x00, 0x10},
941 {0xa1, 0x6e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x10},
942 {0xa1, 0x6e, 0x07, 0xd5, 0x00, 0x00, 0x00, 0x10},
943
944 {}
945};
946
947static const u8 po2030n_sensor_init[][8] = {
948 {0xa1, 0x6e, 0x1e, 0x1a, 0x00, 0x00, 0x00, 0x10},
949 {0xa1, 0x6e, 0x1f, 0x99, 0x00, 0x00, 0x00, 0x10},
950 {DELAY, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
951 {0xa1, 0x6e, 0x1e, 0x0a, 0x00, 0x00, 0x00, 0x10},
952 {0xa1, 0x6e, 0x1f, 0x19, 0x00, 0x00, 0x00, 0x10},
953 {DELAY, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
954 {0xa1, 0x6e, 0x20, 0x44, 0x00, 0x00, 0x00, 0x10},
955 {0xa1, 0x6e, 0x04, 0x03, 0x00, 0x00, 0x00, 0x10},
956 {0xa1, 0x6e, 0x05, 0x70, 0x00, 0x00, 0x00, 0x10},
957 {0xa1, 0x6e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x10},
958 {0xa1, 0x6e, 0x07, 0x25, 0x00, 0x00, 0x00, 0x10},
959 {0xd1, 0x6e, 0x08, 0x00, 0xd0, 0x00, 0x08, 0x10},
960 {0xd1, 0x6e, 0x0c, 0x03, 0x50, 0x01, 0xe8, 0x10},
961 {0xd1, 0x6e, 0x1d, 0x20, 0x0a, 0x19, 0x44, 0x10},
962 {0xd1, 0x6e, 0x21, 0x00, 0x00, 0x00, 0x00, 0x10},
963 {0xd1, 0x6e, 0x25, 0x00, 0x00, 0x00, 0x00, 0x10},
964 {0xd1, 0x6e, 0x29, 0x00, 0x00, 0x00, 0x00, 0x10},
965 {0xd1, 0x6e, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x10},
966 {0xd1, 0x6e, 0x31, 0x00, 0x00, 0x00, 0x00, 0x10},
967 {0xd1, 0x6e, 0x35, 0x00, 0x00, 0x00, 0x00, 0x10},
968 {0xd1, 0x6e, 0x39, 0x00, 0x00, 0x00, 0x00, 0x10},
969 {0xd1, 0x6e, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x10},
970 {0xd1, 0x6e, 0x41, 0x00, 0x00, 0x00, 0x00, 0x10},
971 {0xd1, 0x6e, 0x45, 0x00, 0x00, 0x00, 0x00, 0x10},
972 {0xd1, 0x6e, 0x49, 0x00, 0x00, 0x00, 0x00, 0x10},
973 {0xd1, 0x6e, 0x4d, 0x00, 0x00, 0x00, 0xed, 0x10},
974 {0xd1, 0x6e, 0x51, 0x17, 0x4a, 0x2f, 0xc0, 0x10},
975 {0xd1, 0x6e, 0x55, 0x00, 0x00, 0x00, 0x00, 0x10},
976 {0xd1, 0x6e, 0x59, 0x00, 0x00, 0x00, 0x00, 0x10},
977 {0xd1, 0x6e, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x10},
978 {0xd1, 0x6e, 0x61, 0x00, 0x00, 0x00, 0x00, 0x10},
979 {0xd1, 0x6e, 0x65, 0x00, 0x00, 0x00, 0x00, 0x10},
980 {0xd1, 0x6e, 0x69, 0x00, 0x00, 0x00, 0x00, 0x10},
981 {0xd1, 0x6e, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x10},
982 {0xd1, 0x6e, 0x71, 0x00, 0x00, 0x00, 0x00, 0x10},
983 {0xd1, 0x6e, 0x75, 0x00, 0x00, 0x00, 0x00, 0x10},
984 {0xd1, 0x6e, 0x79, 0x00, 0x00, 0x00, 0x00, 0x10},
985 {0xd1, 0x6e, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x10},
986 {0xd1, 0x6e, 0x81, 0x00, 0x00, 0x00, 0x00, 0x10},
987 {0xd1, 0x6e, 0x85, 0x00, 0x00, 0x00, 0x08, 0x10},
988 {0xd1, 0x6e, 0x89, 0x01, 0xe8, 0x00, 0x01, 0x10},
989 {0xa1, 0x6e, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x10},
990 {0xd1, 0x6e, 0x21, 0x00, 0x00, 0x00, 0x00, 0x10},
991 {0xd1, 0x6e, 0x25, 0x00, 0x00, 0x00, 0x01, 0x10},
992 {0xd1, 0x6e, 0x29, 0xe6, 0x00, 0xbd, 0x03, 0x10},
993 {0xd1, 0x6e, 0x2d, 0x41, 0x38, 0x68, 0x40, 0x10},
994 {0xd1, 0x6e, 0x31, 0x2b, 0x00, 0x36, 0x00, 0x10},
995 {0xd1, 0x6e, 0x35, 0x30, 0x30, 0x08, 0x00, 0x10},
996 {0xd1, 0x6e, 0x39, 0x00, 0x00, 0x33, 0x06, 0x10},
997 {0xb1, 0x6e, 0x3d, 0x06, 0x02, 0x00, 0x00, 0x10},
998 {}
999};
1000static const u8 po2030n_sensor_param1[][8] = {
1001 {0xa1, 0x6e, 0x1a, 0x01, 0x00, 0x00, 0x00, 0x10},
1002 {DELAY, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
1003 {0xa1, 0x6e, 0x1b, 0xf4, 0x00, 0x00, 0x00, 0x10},
1004 {0xa1, 0x6e, 0x15, 0x04, 0x00, 0x00, 0x00, 0x10},
1005 {0xd1, 0x6e, 0x16, 0x40, 0x40, 0x40, 0x40, 0x10},
1006
1007 {0xa1, 0x6e, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x10},
1008 {0xa1, 0x6e, 0x04, 0x03, 0x00, 0x00, 0x00, 0x10},
1009 {0xa1, 0x6e, 0x05, 0x6f, 0x00, 0x00, 0x00, 0x10},
1010 {0xa1, 0x6e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x10},
1011 {0xa1, 0x6e, 0x07, 0x25, 0x00, 0x00, 0x00, 0x10},
1012 {}
1013};
1014
1015static const u8 soi768_sensor_init[][8] = {
1016 {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10},
1017 {DELAY, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
1018 {0xa1, 0x21, 0x12, 0x00, 0x00, 0x00, 0x00, 0x10},
1019 {0xa1, 0x21, 0x13, 0x80, 0x00, 0x00, 0x00, 0x10},
1020 {0xa1, 0x21, 0x0f, 0x03, 0x00, 0x00, 0x00, 0x10},
1021 {0xa1, 0x21, 0x19, 0x00, 0x00, 0x00, 0x00, 0x10},
1022 {}
1023};
1024static const u8 soi768_sensor_param1[][8] = {
1025 {0xa1, 0x21, 0x10, 0x10, 0x00, 0x00, 0x00, 0x10},
1026 {0xa1, 0x21, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x10},
1027 {0xa1, 0x21, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x10},
1028 {0xa1, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10},
1029 {0xb1, 0x21, 0x01, 0x7f, 0x7f, 0x00, 0x00, 0x10},
1030
1031
1032
1033 {0xa1, 0x21, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10},
1034
1035 {0xa1, 0x21, 0x02, 0x8d, 0x00, 0x00, 0x00, 0x10},
1036
1037 {0xa1, 0x21, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10},
1038
1039 {0xa1, 0x21, 0x10, 0x3f, 0x00, 0x00, 0x00, 0x10},
1040 {0xa1, 0x21, 0x04, 0x06, 0x00, 0x00, 0x00, 0x10},
1041 {0xb1, 0x21, 0x2d, 0x63, 0x03, 0x00, 0x00, 0x10},
1042
1043 {}
1044};
1045
1046static const u8 sp80708_sensor_init[][8] = {
1047 {0xa1, 0x18, 0x06, 0xf9, 0x00, 0x00, 0x00, 0x10},
1048 {0xa1, 0x18, 0x09, 0x1f, 0x00, 0x00, 0x00, 0x10},
1049 {0xa1, 0x18, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x10},
1050 {0xa1, 0x18, 0x0d, 0xc0, 0x00, 0x00, 0x00, 0x10},
1051 {0xa1, 0x18, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x10},
1052 {0xa1, 0x18, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x10},
1053 {0xa1, 0x18, 0x10, 0x40, 0x00, 0x00, 0x00, 0x10},
1054 {0xa1, 0x18, 0x11, 0x4e, 0x00, 0x00, 0x00, 0x10},
1055 {0xa1, 0x18, 0x12, 0x53, 0x00, 0x00, 0x00, 0x10},
1056 {0xa1, 0x18, 0x15, 0x80, 0x00, 0x00, 0x00, 0x10},
1057 {0xa1, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x10},
1058 {0xa1, 0x18, 0x19, 0x18, 0x00, 0x00, 0x00, 0x10},
1059 {0xa1, 0x18, 0x1a, 0x10, 0x00, 0x00, 0x00, 0x10},
1060 {0xa1, 0x18, 0x1b, 0x10, 0x00, 0x00, 0x00, 0x10},
1061 {0xa1, 0x18, 0x1c, 0x28, 0x00, 0x00, 0x00, 0x10},
1062 {0xa1, 0x18, 0x1d, 0x02, 0x00, 0x00, 0x00, 0x10},
1063 {0xa1, 0x18, 0x1e, 0x10, 0x00, 0x00, 0x00, 0x10},
1064 {0xa1, 0x18, 0x26, 0x04, 0x00, 0x00, 0x00, 0x10},
1065 {0xa1, 0x18, 0x27, 0x1e, 0x00, 0x00, 0x00, 0x10},
1066 {0xa1, 0x18, 0x28, 0x5a, 0x00, 0x00, 0x00, 0x10},
1067 {0xa1, 0x18, 0x29, 0x28, 0x00, 0x00, 0x00, 0x10},
1068 {0xa1, 0x18, 0x2a, 0x78, 0x00, 0x00, 0x00, 0x10},
1069 {0xa1, 0x18, 0x2b, 0x01, 0x00, 0x00, 0x00, 0x10},
1070 {0xa1, 0x18, 0x2c, 0xf7, 0x00, 0x00, 0x00, 0x10},
1071 {0xa1, 0x18, 0x2d, 0x2d, 0x00, 0x00, 0x00, 0x10},
1072 {0xa1, 0x18, 0x2e, 0xd5, 0x00, 0x00, 0x00, 0x10},
1073 {0xa1, 0x18, 0x39, 0x42, 0x00, 0x00, 0x00, 0x10},
1074 {0xa1, 0x18, 0x3a, 0x67, 0x00, 0x00, 0x00, 0x10},
1075 {0xa1, 0x18, 0x3b, 0x87, 0x00, 0x00, 0x00, 0x10},
1076 {0xa1, 0x18, 0x3c, 0xa3, 0x00, 0x00, 0x00, 0x10},
1077 {0xa1, 0x18, 0x3d, 0xb0, 0x00, 0x00, 0x00, 0x10},
1078 {0xa1, 0x18, 0x3e, 0xbc, 0x00, 0x00, 0x00, 0x10},
1079 {0xa1, 0x18, 0x3f, 0xc8, 0x00, 0x00, 0x00, 0x10},
1080 {0xa1, 0x18, 0x40, 0xd4, 0x00, 0x00, 0x00, 0x10},
1081 {0xa1, 0x18, 0x41, 0xdf, 0x00, 0x00, 0x00, 0x10},
1082 {0xa1, 0x18, 0x42, 0xea, 0x00, 0x00, 0x00, 0x10},
1083 {0xa1, 0x18, 0x43, 0xf5, 0x00, 0x00, 0x00, 0x10},
1084 {0xa1, 0x18, 0x45, 0x80, 0x00, 0x00, 0x00, 0x10},
1085 {0xa1, 0x18, 0x46, 0x60, 0x00, 0x00, 0x00, 0x10},
1086 {0xa1, 0x18, 0x47, 0x50, 0x00, 0x00, 0x00, 0x10},
1087 {0xa1, 0x18, 0x48, 0x30, 0x00, 0x00, 0x00, 0x10},
1088 {0xa1, 0x18, 0x49, 0x01, 0x00, 0x00, 0x00, 0x10},
1089 {0xa1, 0x18, 0x4d, 0xae, 0x00, 0x00, 0x00, 0x10},
1090 {0xa1, 0x18, 0x4e, 0x03, 0x00, 0x00, 0x00, 0x10},
1091 {0xa1, 0x18, 0x4f, 0x66, 0x00, 0x00, 0x00, 0x10},
1092 {0xa1, 0x18, 0x50, 0x1c, 0x00, 0x00, 0x00, 0x10},
1093 {0xa1, 0x18, 0x44, 0x10, 0x00, 0x00, 0x00, 0x10},
1094 {0xa1, 0x18, 0x4a, 0x30, 0x00, 0x00, 0x00, 0x10},
1095 {0xa1, 0x18, 0x51, 0x80, 0x00, 0x00, 0x00, 0x10},
1096 {0xa1, 0x18, 0x52, 0x80, 0x00, 0x00, 0x00, 0x10},
1097 {0xa1, 0x18, 0x53, 0x80, 0x00, 0x00, 0x00, 0x10},
1098 {0xa1, 0x18, 0x54, 0x80, 0x00, 0x00, 0x00, 0x10},
1099 {0xa1, 0x18, 0x55, 0x80, 0x00, 0x00, 0x00, 0x10},
1100 {0xa1, 0x18, 0x56, 0x80, 0x00, 0x00, 0x00, 0x10},
1101 {0xa1, 0x18, 0x57, 0xe0, 0x00, 0x00, 0x00, 0x10},
1102 {0xa1, 0x18, 0x58, 0xc0, 0x00, 0x00, 0x00, 0x10},
1103 {0xa1, 0x18, 0x59, 0xab, 0x00, 0x00, 0x00, 0x10},
1104 {0xa1, 0x18, 0x5a, 0xa0, 0x00, 0x00, 0x00, 0x10},
1105 {0xa1, 0x18, 0x5b, 0x99, 0x00, 0x00, 0x00, 0x10},
1106 {0xa1, 0x18, 0x5c, 0x90, 0x00, 0x00, 0x00, 0x10},
1107 {0xa1, 0x18, 0x5e, 0x24, 0x00, 0x00, 0x00, 0x10},
1108 {0xa1, 0x18, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x10},
1109 {0xa1, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x10},
1110 {0xa1, 0x18, 0x61, 0x73, 0x00, 0x00, 0x00, 0x10},
1111 {0xa1, 0x18, 0x63, 0x42, 0x00, 0x00, 0x00, 0x10},
1112 {0xa1, 0x18, 0x64, 0x42, 0x00, 0x00, 0x00, 0x10},
1113 {0xa1, 0x18, 0x65, 0x42, 0x00, 0x00, 0x00, 0x10},
1114 {0xa1, 0x18, 0x66, 0x24, 0x00, 0x00, 0x00, 0x10},
1115 {0xa1, 0x18, 0x67, 0x24, 0x00, 0x00, 0x00, 0x10},
1116 {0xa1, 0x18, 0x68, 0x08, 0x00, 0x00, 0x00, 0x10},
1117 {0xa1, 0x18, 0x2f, 0xc9, 0x00, 0x00, 0x00, 0x10},
1118 {}
1119};
1120static const u8 sp80708_sensor_param1[][8] = {
1121 {0xa1, 0x18, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x10},
1122 {0xa1, 0x18, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x10},
1123 {0xa1, 0x18, 0x03, 0x01, 0x00, 0x00, 0x00, 0x10},
1124 {0xa1, 0x18, 0x04, 0xa4, 0x00, 0x00, 0x00, 0x10},
1125 {0xa1, 0x18, 0x14, 0x3f, 0x00, 0x00, 0x00, 0x10},
1126 {0xa1, 0x18, 0x5d, 0x80, 0x00, 0x00, 0x00, 0x10},
1127 {0xb1, 0x18, 0x11, 0x40, 0x40, 0x00, 0x00, 0x10},
1128 {}
1129};
1130
1131static const u8 (*sensor_init[])[8] = {
1132[SENSOR_ADCM1700] = adcm1700_sensor_init,
1133[SENSOR_GC0307] = gc0307_sensor_init,
1134[SENSOR_HV7131R] = hv7131r_sensor_init,
1135[SENSOR_MI0360] = mi0360_sensor_init,
1136[SENSOR_MI0360B] = mi0360b_sensor_init,
1137[SENSOR_MO4000] = mo4000_sensor_init,
1138[SENSOR_MT9V111] = mt9v111_sensor_init,
1139[SENSOR_OM6802] = om6802_sensor_init,
1140[SENSOR_OV7630] = ov7630_sensor_init,
1141[SENSOR_OV7648] = ov7648_sensor_init,
1142[SENSOR_OV7660] = ov7660_sensor_init,
1143[SENSOR_PO1030] = po1030_sensor_init,
1144[SENSOR_PO2030N] = po2030n_sensor_init,
1145[SENSOR_SOI768] = soi768_sensor_init,
1146[SENSOR_SP80708] = sp80708_sensor_init,
1147};
1148
1149
1150static void reg_r(struct gspca_dev *gspca_dev,
1151 u16 value, int len)
1152{
1153 int ret;
1154
1155 if (gspca_dev->usb_err < 0)
1156 return;
1157 if (len > USB_BUF_SZ) {
1158 PERR("reg_r: buffer overflow\n");
1159 return;
1160 }
1161
1162 ret = usb_control_msg(gspca_dev->dev,
1163 usb_rcvctrlpipe(gspca_dev->dev, 0),
1164 0,
1165 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
1166 value, 0,
1167 gspca_dev->usb_buf, len,
1168 500);
1169 PDEBUG(D_USBI, "reg_r [%02x] -> %02x", value, gspca_dev->usb_buf[0]);
1170 if (ret < 0) {
1171 pr_err("reg_r err %d\n", ret);
1172 gspca_dev->usb_err = ret;
1173 }
1174}
1175
1176static void reg_w1(struct gspca_dev *gspca_dev,
1177 u16 value,
1178 u8 data)
1179{
1180 int ret;
1181
1182 if (gspca_dev->usb_err < 0)
1183 return;
1184 PDEBUG(D_USBO, "reg_w1 [%04x] = %02x", value, data);
1185 gspca_dev->usb_buf[0] = data;
1186 ret = usb_control_msg(gspca_dev->dev,
1187 usb_sndctrlpipe(gspca_dev->dev, 0),
1188 0x08,
1189 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
1190 value,
1191 0,
1192 gspca_dev->usb_buf, 1,
1193 500);
1194 if (ret < 0) {
1195 pr_err("reg_w1 err %d\n", ret);
1196 gspca_dev->usb_err = ret;
1197 }
1198}
1199static void reg_w(struct gspca_dev *gspca_dev,
1200 u16 value,
1201 const u8 *buffer,
1202 int len)
1203{
1204 int ret;
1205
1206 if (gspca_dev->usb_err < 0)
1207 return;
1208 PDEBUG(D_USBO, "reg_w [%04x] = %02x %02x ..",
1209 value, buffer[0], buffer[1]);
1210
1211 if (len > USB_BUF_SZ) {
1212 PERR("reg_w: buffer overflow\n");
1213 return;
1214 }
1215
1216 memcpy(gspca_dev->usb_buf, buffer, len);
1217 ret = usb_control_msg(gspca_dev->dev,
1218 usb_sndctrlpipe(gspca_dev->dev, 0),
1219 0x08,
1220 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
1221 value, 0,
1222 gspca_dev->usb_buf, len,
1223 500);
1224 if (ret < 0) {
1225 pr_err("reg_w err %d\n", ret);
1226 gspca_dev->usb_err = ret;
1227 }
1228}
1229
1230
1231static void i2c_w1(struct gspca_dev *gspca_dev, u8 reg, u8 val)
1232{
1233 struct sd *sd = (struct sd *) gspca_dev;
1234 int ret;
1235
1236 if (gspca_dev->usb_err < 0)
1237 return;
1238 PDEBUG(D_USBO, "i2c_w1 [%02x] = %02x", reg, val);
1239 switch (sd->sensor) {
1240 case SENSOR_ADCM1700:
1241 case SENSOR_OM6802:
1242 case SENSOR_GC0307:
1243 gspca_dev->usb_buf[0] = 0x80 | (2 << 4);
1244 break;
1245 default:
1246 gspca_dev->usb_buf[0] = 0x81 | (2 << 4);
1247 break;
1248 }
1249 gspca_dev->usb_buf[1] = sd->i2c_addr;
1250 gspca_dev->usb_buf[2] = reg;
1251 gspca_dev->usb_buf[3] = val;
1252 gspca_dev->usb_buf[4] = 0;
1253 gspca_dev->usb_buf[5] = 0;
1254 gspca_dev->usb_buf[6] = 0;
1255 gspca_dev->usb_buf[7] = 0x10;
1256 ret = usb_control_msg(gspca_dev->dev,
1257 usb_sndctrlpipe(gspca_dev->dev, 0),
1258 0x08,
1259 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
1260 0x08,
1261 0,
1262 gspca_dev->usb_buf, 8,
1263 500);
1264 msleep(2);
1265 if (ret < 0) {
1266 pr_err("i2c_w1 err %d\n", ret);
1267 gspca_dev->usb_err = ret;
1268 }
1269}
1270
1271
1272static void i2c_w8(struct gspca_dev *gspca_dev,
1273 const u8 *buffer)
1274{
1275 int ret;
1276
1277 if (gspca_dev->usb_err < 0)
1278 return;
1279 PDEBUG(D_USBO, "i2c_w8 [%02x] = %02x ..",
1280 buffer[2], buffer[3]);
1281 memcpy(gspca_dev->usb_buf, buffer, 8);
1282 ret = usb_control_msg(gspca_dev->dev,
1283 usb_sndctrlpipe(gspca_dev->dev, 0),
1284 0x08,
1285 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
1286 0x08, 0,
1287 gspca_dev->usb_buf, 8,
1288 500);
1289 msleep(2);
1290 if (ret < 0) {
1291 pr_err("i2c_w8 err %d\n", ret);
1292 gspca_dev->usb_err = ret;
1293 }
1294}
1295
1296
1297static void i2c_r(struct gspca_dev *gspca_dev, u8 reg, int len)
1298{
1299 struct sd *sd = (struct sd *) gspca_dev;
1300 u8 mode[8];
1301
1302 switch (sd->sensor) {
1303 case SENSOR_ADCM1700:
1304 case SENSOR_OM6802:
1305 case SENSOR_GC0307:
1306 mode[0] = 0x80 | 0x10;
1307 break;
1308 default:
1309 mode[0] = 0x81 | 0x10;
1310 break;
1311 }
1312 mode[1] = sd->i2c_addr;
1313 mode[2] = reg;
1314 mode[3] = 0;
1315 mode[4] = 0;
1316 mode[5] = 0;
1317 mode[6] = 0;
1318 mode[7] = 0x10;
1319 i2c_w8(gspca_dev, mode);
1320 msleep(2);
1321 mode[0] = (mode[0] & 0x81) | (len << 4) | 0x02;
1322 mode[2] = 0;
1323 i2c_w8(gspca_dev, mode);
1324 msleep(2);
1325 reg_r(gspca_dev, 0x0a, 5);
1326}
1327
1328static void i2c_w_seq(struct gspca_dev *gspca_dev,
1329 const u8 (*data)[8])
1330{
1331 while ((*data)[0] != 0) {
1332 if ((*data)[0] != DELAY)
1333 i2c_w8(gspca_dev, *data);
1334 else
1335 msleep((*data)[1]);
1336 data++;
1337 }
1338}
1339
1340
1341
1342static void hv7131r_probe(struct gspca_dev *gspca_dev)
1343{
1344 i2c_w1(gspca_dev, 0x02, 0);
1345 msleep(10);
1346 reg_w1(gspca_dev, 0x02, 0x66);
1347 msleep(10);
1348 i2c_r(gspca_dev, 0, 5);
1349 if (gspca_dev->usb_buf[0] == 0x02
1350 && gspca_dev->usb_buf[1] == 0x09
1351 && gspca_dev->usb_buf[2] == 0x01) {
1352 PDEBUG(D_PROBE, "Sensor HV7131R found");
1353 return;
1354 }
1355 pr_warn("Erroneous HV7131R ID 0x%02x 0x%02x 0x%02x\n",
1356 gspca_dev->usb_buf[0], gspca_dev->usb_buf[1],
1357 gspca_dev->usb_buf[2]);
1358}
1359
1360static void mi0360_probe(struct gspca_dev *gspca_dev)
1361{
1362 struct sd *sd = (struct sd *) gspca_dev;
1363 int i, j;
1364 u16 val = 0;
1365 static const u8 probe_tb[][4][8] = {
1366 {
1367 {0xb0, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10},
1368 {0x90, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10},
1369 {0xa2, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10},
1370 {0xb0, 0x5d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10}
1371 },
1372 {
1373 {0xb0, 0x5c, 0x01, 0x00, 0x04, 0x00, 0x00, 0x10},
1374 {0x90, 0x5c, 0x36, 0x00, 0x00, 0x00, 0x00, 0x10},
1375 {0xa2, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10},
1376 {}
1377 },
1378 };
1379
1380 for (i = 0; i < ARRAY_SIZE(probe_tb); i++) {
1381 reg_w1(gspca_dev, 0x17, 0x62);
1382 reg_w1(gspca_dev, 0x01, 0x08);
1383 for (j = 0; j < 3; j++)
1384 i2c_w8(gspca_dev, probe_tb[i][j]);
1385 msleep(2);
1386 reg_r(gspca_dev, 0x0a, 5);
1387 val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4];
1388 if (probe_tb[i][3][0] != 0)
1389 i2c_w8(gspca_dev, probe_tb[i][3]);
1390 reg_w1(gspca_dev, 0x01, 0x29);
1391 reg_w1(gspca_dev, 0x17, 0x42);
1392 if (val != 0xffff)
1393 break;
1394 }
1395 if (gspca_dev->usb_err < 0)
1396 return;
1397 switch (val) {
1398 case 0x8221:
1399 PDEBUG(D_PROBE, "Sensor mi0360b");
1400 sd->sensor = SENSOR_MI0360B;
1401 break;
1402 case 0x823a:
1403 PDEBUG(D_PROBE, "Sensor mt9v111");
1404 sd->sensor = SENSOR_MT9V111;
1405 break;
1406 case 0x8243:
1407 PDEBUG(D_PROBE, "Sensor mi0360");
1408 break;
1409 default:
1410 PDEBUG(D_PROBE, "Unknown sensor %04x - forced to mi0360", val);
1411 break;
1412 }
1413}
1414
1415static void ov7630_probe(struct gspca_dev *gspca_dev)
1416{
1417 struct sd *sd = (struct sd *) gspca_dev;
1418 u16 val;
1419
1420
1421 reg_w1(gspca_dev, 0x17, 0x62);
1422 reg_w1(gspca_dev, 0x01, 0x08);
1423 sd->i2c_addr = 0x21;
1424 i2c_r(gspca_dev, 0x0a, 2);
1425 val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4];
1426 reg_w1(gspca_dev, 0x01, 0x29);
1427 reg_w1(gspca_dev, 0x17, 0x42);
1428 if (gspca_dev->usb_err < 0)
1429 return;
1430 if (val == 0x7628) {
1431 sd->sensor = SENSOR_SOI768;
1432
1433 gspca_dev->cam.input_flags =
1434 V4L2_IN_ST_VFLIP | V4L2_IN_ST_HFLIP;
1435 PDEBUG(D_PROBE, "Sensor soi768");
1436 return;
1437 }
1438 PDEBUG(D_PROBE, "Sensor ov%04x", val);
1439}
1440
1441static void ov7648_probe(struct gspca_dev *gspca_dev)
1442{
1443 struct sd *sd = (struct sd *) gspca_dev;
1444 u16 val;
1445
1446
1447 reg_w1(gspca_dev, 0x17, 0x62);
1448 reg_w1(gspca_dev, 0x01, 0x08);
1449 sd->i2c_addr = 0x21;
1450 i2c_r(gspca_dev, 0x0a, 2);
1451 val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4];
1452 reg_w1(gspca_dev, 0x01, 0x29);
1453 reg_w1(gspca_dev, 0x17, 0x42);
1454 if ((val & 0xff00) == 0x7600) {
1455 PDEBUG(D_PROBE, "Sensor ov%04x", val);
1456 return;
1457 }
1458
1459
1460 reg_w1(gspca_dev, 0x17, 0x62);
1461 reg_w1(gspca_dev, 0x01, 0x08);
1462 sd->i2c_addr = 0x6e;
1463 i2c_r(gspca_dev, 0x00, 2);
1464 val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4];
1465 reg_w1(gspca_dev, 0x01, 0x29);
1466 reg_w1(gspca_dev, 0x17, 0x42);
1467 if (gspca_dev->usb_err < 0)
1468 return;
1469 if (val == 0x1030) {
1470 PDEBUG(D_PROBE, "Sensor po1030");
1471 sd->sensor = SENSOR_PO1030;
1472 return;
1473 }
1474 pr_err("Unknown sensor %04x\n", val);
1475}
1476
1477
1478static void po2030n_probe(struct gspca_dev *gspca_dev)
1479{
1480 struct sd *sd = (struct sd *) gspca_dev;
1481 u16 val;
1482
1483
1484 reg_w1(gspca_dev, 0x17, 0x62);
1485 reg_w1(gspca_dev, 0x01, 0x08);
1486 reg_w1(gspca_dev, 0x02, 0x22);
1487 sd->i2c_addr = 0x21;
1488 i2c_r(gspca_dev, 0x00, 1);
1489 val = gspca_dev->usb_buf[4];
1490 reg_w1(gspca_dev, 0x01, 0x29);
1491 reg_w1(gspca_dev, 0x17, 0x42);
1492 if (val == 0x99) {
1493 PDEBUG(D_PROBE, "Sensor gc0307");
1494 sd->sensor = SENSOR_GC0307;
1495 return;
1496 }
1497
1498
1499 reg_w1(gspca_dev, 0x17, 0x62);
1500 reg_w1(gspca_dev, 0x01, 0x0a);
1501 sd->i2c_addr = 0x6e;
1502 i2c_r(gspca_dev, 0x00, 2);
1503 val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4];
1504 reg_w1(gspca_dev, 0x01, 0x29);
1505 reg_w1(gspca_dev, 0x17, 0x42);
1506 if (gspca_dev->usb_err < 0)
1507 return;
1508 if (val == 0x2030) {
1509 PDEBUG(D_PROBE, "Sensor po2030n");
1510
1511 } else {
1512 pr_err("Unknown sensor ID %04x\n", val);
1513 }
1514}
1515
1516
1517static int sd_config(struct gspca_dev *gspca_dev,
1518 const struct usb_device_id *id)
1519{
1520 struct sd *sd = (struct sd *) gspca_dev;
1521 struct cam *cam;
1522
1523 sd->bridge = id->driver_info >> 16;
1524 sd->sensor = id->driver_info >> 8;
1525 sd->flags = id->driver_info;
1526
1527 cam = &gspca_dev->cam;
1528 if (sd->sensor == SENSOR_ADCM1700) {
1529 cam->cam_mode = cif_mode;
1530 cam->nmodes = ARRAY_SIZE(cif_mode);
1531 } else {
1532 cam->cam_mode = vga_mode;
1533 cam->nmodes = ARRAY_SIZE(vga_mode);
1534 }
1535 cam->npkt = 24;
1536
1537 sd->ag_cnt = -1;
1538 sd->quality = QUALITY_DEF;
1539
1540 INIT_WORK(&sd->work, qual_upd);
1541
1542 return 0;
1543}
1544
1545
1546static int sd_init(struct gspca_dev *gspca_dev)
1547{
1548 struct sd *sd = (struct sd *) gspca_dev;
1549 const u8 *sn9c1xx;
1550 u8 regGpio[] = { 0x29, 0x70 };
1551 u8 regF1;
1552
1553
1554 reg_w1(gspca_dev, 0xf1, 0x01);
1555 reg_r(gspca_dev, 0x00, 1);
1556 reg_w1(gspca_dev, 0xf1, 0x00);
1557 reg_r(gspca_dev, 0x00, 1);
1558 regF1 = gspca_dev->usb_buf[0];
1559 if (gspca_dev->usb_err < 0)
1560 return gspca_dev->usb_err;
1561 PDEBUG(D_PROBE, "Sonix chip id: %02x", regF1);
1562 if (gspca_dev->audio)
1563 regGpio[1] |= 0x04;
1564 switch (sd->bridge) {
1565 case BRIDGE_SN9C102P:
1566 case BRIDGE_SN9C105:
1567 if (regF1 != 0x11)
1568 return -ENODEV;
1569 break;
1570 default:
1571
1572
1573 if (regF1 != 0x12)
1574 return -ENODEV;
1575 }
1576
1577 switch (sd->sensor) {
1578 case SENSOR_MI0360:
1579 mi0360_probe(gspca_dev);
1580 break;
1581 case SENSOR_OV7630:
1582 ov7630_probe(gspca_dev);
1583 break;
1584 case SENSOR_OV7648:
1585 ov7648_probe(gspca_dev);
1586 break;
1587 case SENSOR_PO2030N:
1588 po2030n_probe(gspca_dev);
1589 break;
1590 }
1591
1592 switch (sd->bridge) {
1593 case BRIDGE_SN9C102P:
1594 reg_w1(gspca_dev, 0x02, regGpio[1]);
1595 break;
1596 default:
1597 reg_w(gspca_dev, 0x01, regGpio, 2);
1598 break;
1599 }
1600
1601
1602
1603 reg_w1(gspca_dev, 0xf1, 0x00);
1604
1605
1606 sn9c1xx = sn_tb[sd->sensor];
1607 sd->i2c_addr = sn9c1xx[9];
1608
1609 return gspca_dev->usb_err;
1610}
1611
1612static int sd_s_ctrl(struct v4l2_ctrl *ctrl);
1613
1614static const struct v4l2_ctrl_ops sd_ctrl_ops = {
1615 .s_ctrl = sd_s_ctrl,
1616};
1617
1618
1619static int sd_init_controls(struct gspca_dev *gspca_dev)
1620{
1621 struct sd *sd = (struct sd *) gspca_dev;
1622 struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler;
1623
1624 gspca_dev->vdev.ctrl_handler = hdl;
1625 v4l2_ctrl_handler_init(hdl, 14);
1626
1627 sd->brightness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1628 V4L2_CID_BRIGHTNESS, 0, 255, 1, 128);
1629#define CONTRAST_MAX 127
1630 sd->contrast = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1631 V4L2_CID_CONTRAST, 0, CONTRAST_MAX, 1, 20);
1632#define COLORS_DEF 25
1633 sd->saturation = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1634 V4L2_CID_SATURATION, 0, 40, 1, COLORS_DEF);
1635 sd->red_bal = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1636 V4L2_CID_RED_BALANCE, 24, 40, 1, 32);
1637 sd->blue_bal = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1638 V4L2_CID_BLUE_BALANCE, 24, 40, 1, 32);
1639#define GAMMA_DEF 20
1640 sd->gamma = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1641 V4L2_CID_GAMMA, 0, 40, 1, GAMMA_DEF);
1642
1643 if (sd->sensor == SENSOR_OM6802)
1644 sd->sharpness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1645 V4L2_CID_SHARPNESS, 0, 255, 1, 16);
1646 else
1647 sd->sharpness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1648 V4L2_CID_SHARPNESS, 0, 255, 1, 90);
1649
1650 if (sd->flags & F_ILLUM)
1651 sd->illum = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1652 V4L2_CID_ILLUMINATORS_1, 0, 1, 1, 0);
1653
1654 if (sd->sensor == SENSOR_PO2030N) {
1655 gspca_dev->exposure = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1656 V4L2_CID_EXPOSURE, 500, 1500, 1, 1024);
1657 gspca_dev->gain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1658 V4L2_CID_GAIN, 4, 49, 1, 15);
1659 sd->hflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1660 V4L2_CID_HFLIP, 0, 1, 1, 0);
1661 }
1662
1663 if (sd->sensor != SENSOR_ADCM1700 && sd->sensor != SENSOR_OV7660 &&
1664 sd->sensor != SENSOR_PO1030 && sd->sensor != SENSOR_SOI768 &&
1665 sd->sensor != SENSOR_SP80708)
1666 gspca_dev->autogain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1667 V4L2_CID_AUTOGAIN, 0, 1, 1, 1);
1668
1669 if (sd->sensor == SENSOR_HV7131R || sd->sensor == SENSOR_OV7630 ||
1670 sd->sensor == SENSOR_OV7648 || sd->sensor == SENSOR_PO2030N)
1671 sd->vflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1672 V4L2_CID_VFLIP, 0, 1, 1, 0);
1673
1674 if (sd->sensor == SENSOR_OV7630 || sd->sensor == SENSOR_OV7648 ||
1675 sd->sensor == SENSOR_OV7660)
1676 sd->freq = v4l2_ctrl_new_std_menu(hdl, &sd_ctrl_ops,
1677 V4L2_CID_POWER_LINE_FREQUENCY,
1678 V4L2_CID_POWER_LINE_FREQUENCY_60HZ, 0,
1679 V4L2_CID_POWER_LINE_FREQUENCY_50HZ);
1680
1681 if (hdl->error) {
1682 pr_err("Could not initialize controls\n");
1683 return hdl->error;
1684 }
1685
1686 v4l2_ctrl_cluster(2, &sd->red_bal);
1687 if (sd->sensor == SENSOR_PO2030N) {
1688 v4l2_ctrl_cluster(2, &sd->vflip);
1689 v4l2_ctrl_auto_cluster(3, &gspca_dev->autogain, 0, false);
1690 }
1691
1692 return 0;
1693}
1694
1695static u32 expo_adjust(struct gspca_dev *gspca_dev,
1696 u32 expo)
1697{
1698 struct sd *sd = (struct sd *) gspca_dev;
1699
1700 switch (sd->sensor) {
1701 case SENSOR_GC0307: {
1702 int a, b;
1703
1704
1705 a = 19 + expo * 25 / 256;
1706 i2c_w1(gspca_dev, 0x68, a);
1707 a -= 12;
1708 b = a * a * 4;
1709 i2c_w1(gspca_dev, 0x03, b >> 8);
1710 i2c_w1(gspca_dev, 0x04, b);
1711 break;
1712 }
1713 case SENSOR_HV7131R: {
1714 u8 Expodoit[] =
1715 { 0xc1, 0x11, 0x25, 0x00, 0x00, 0x00, 0x00, 0x16 };
1716
1717 Expodoit[3] = expo >> 16;
1718 Expodoit[4] = expo >> 8;
1719 Expodoit[5] = expo;
1720 i2c_w8(gspca_dev, Expodoit);
1721 break;
1722 }
1723 case SENSOR_MI0360:
1724 case SENSOR_MI0360B: {
1725 u8 expoMi[] =
1726 { 0xb1, 0x5d, 0x09, 0x00, 0x00, 0x00, 0x00, 0x16 };
1727 static const u8 doit[] =
1728 { 0xb1, 0x5d, 0x07, 0x00, 0x03, 0x00, 0x00, 0x10 };
1729 static const u8 sensorgo[] =
1730 { 0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10 };
1731
1732 if (expo > 0x0635)
1733 expo = 0x0635;
1734 else if (expo < 0x0001)
1735 expo = 0x0001;
1736 expoMi[3] = expo >> 8;
1737 expoMi[4] = expo;
1738 i2c_w8(gspca_dev, expoMi);
1739 i2c_w8(gspca_dev, doit);
1740 i2c_w8(gspca_dev, sensorgo);
1741 break;
1742 }
1743 case SENSOR_MO4000: {
1744 u8 expoMof[] =
1745 { 0xa1, 0x21, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x10 };
1746 u8 expoMo10[] =
1747 { 0xa1, 0x21, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10 };
1748 static const u8 gainMo[] =
1749 { 0xa1, 0x21, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1d };
1750
1751 if (expo > 0x1fff)
1752 expo = 0x1fff;
1753 else if (expo < 0x0001)
1754 expo = 0x0001;
1755 expoMof[3] = (expo & 0x03fc) >> 2;
1756 i2c_w8(gspca_dev, expoMof);
1757 expoMo10[3] = ((expo & 0x1c00) >> 10)
1758 | ((expo & 0x0003) << 4);
1759 i2c_w8(gspca_dev, expoMo10);
1760 i2c_w8(gspca_dev, gainMo);
1761 PDEBUG(D_FRAM, "set exposure %d",
1762 ((expoMo10[3] & 0x07) << 10)
1763 | (expoMof[3] << 2)
1764 | ((expoMo10[3] & 0x30) >> 4));
1765 break;
1766 }
1767 case SENSOR_MT9V111: {
1768 u8 expo_c1[] =
1769 { 0xb1, 0x5c, 0x09, 0x00, 0x00, 0x00, 0x00, 0x10 };
1770
1771 if (expo > 0x0390)
1772 expo = 0x0390;
1773 else if (expo < 0x0060)
1774 expo = 0x0060;
1775 expo_c1[3] = expo >> 8;
1776 expo_c1[4] = expo;
1777 i2c_w8(gspca_dev, expo_c1);
1778 break;
1779 }
1780 case SENSOR_OM6802: {
1781 u8 gainOm[] =
1782 { 0xa0, 0x34, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x10 };
1783
1784
1785 if (expo > 0x03ff)
1786 expo = 0x03ff;
1787 if (expo < 0x0001)
1788 expo = 0x0001;
1789 gainOm[3] = expo >> 2;
1790 i2c_w8(gspca_dev, gainOm);
1791 reg_w1(gspca_dev, 0x96, expo >> 5);
1792 PDEBUG(D_FRAM, "set exposure %d", gainOm[3]);
1793 break;
1794 }
1795 }
1796 return expo;
1797}
1798
1799static void setbrightness(struct gspca_dev *gspca_dev)
1800{
1801 struct sd *sd = (struct sd *) gspca_dev;
1802 unsigned int expo;
1803 int brightness = sd->brightness->val;
1804 u8 k2;
1805
1806 k2 = (brightness - 0x80) >> 2;
1807 switch (sd->sensor) {
1808 case SENSOR_ADCM1700:
1809 if (k2 > 0x1f)
1810 k2 = 0;
1811 break;
1812 case SENSOR_HV7131R:
1813 expo = brightness << 12;
1814 if (expo > 0x002dc6c0)
1815 expo = 0x002dc6c0;
1816 else if (expo < 0x02a0)
1817 expo = 0x02a0;
1818 sd->exposure = expo_adjust(gspca_dev, expo);
1819 break;
1820 case SENSOR_MI0360:
1821 case SENSOR_MO4000:
1822 expo = brightness << 4;
1823 sd->exposure = expo_adjust(gspca_dev, expo);
1824 break;
1825 case SENSOR_MI0360B:
1826 expo = brightness << 2;
1827 sd->exposure = expo_adjust(gspca_dev, expo);
1828 break;
1829 case SENSOR_GC0307:
1830 expo = brightness;
1831 sd->exposure = expo_adjust(gspca_dev, expo);
1832 return;
1833 case SENSOR_MT9V111:
1834 expo = brightness << 2;
1835 sd->exposure = expo_adjust(gspca_dev, expo);
1836 return;
1837 case SENSOR_OM6802:
1838 expo = brightness << 2;
1839 sd->exposure = expo_adjust(gspca_dev, expo);
1840 return;
1841 }
1842
1843 reg_w1(gspca_dev, 0x96, k2);
1844}
1845
1846static void setcontrast(struct gspca_dev *gspca_dev)
1847{
1848 struct sd *sd = (struct sd *) gspca_dev;
1849 u8 k2;
1850 u8 contrast[6];
1851
1852 k2 = sd->contrast->val * 37 / (CONTRAST_MAX + 1)
1853 + 37;
1854 contrast[0] = (k2 + 1) / 2;
1855 contrast[1] = 0;
1856 contrast[2] = k2;
1857 contrast[3] = 0;
1858 contrast[4] = k2 / 5;
1859 contrast[5] = 0;
1860 reg_w(gspca_dev, 0x84, contrast, sizeof contrast);
1861}
1862
1863static void setcolors(struct gspca_dev *gspca_dev)
1864{
1865 struct sd *sd = (struct sd *) gspca_dev;
1866 int i, v, colors;
1867 const s16 *uv;
1868 u8 reg8a[12];
1869 static const s16 uv_com[6] = {
1870 -24, -38, 64,
1871 62, -51, -9
1872 };
1873 static const s16 uv_mi0360b[6] = {
1874 -20, -38, 64,
1875 60, -51, -9
1876 };
1877
1878 colors = sd->saturation->val;
1879 if (sd->sensor == SENSOR_MI0360B)
1880 uv = uv_mi0360b;
1881 else
1882 uv = uv_com;
1883 for (i = 0; i < 6; i++) {
1884 v = uv[i] * colors / COLORS_DEF;
1885 reg8a[i * 2] = v;
1886 reg8a[i * 2 + 1] = (v >> 8) & 0x0f;
1887 }
1888 reg_w(gspca_dev, 0x8a, reg8a, sizeof reg8a);
1889}
1890
1891static void setredblue(struct gspca_dev *gspca_dev)
1892{
1893 struct sd *sd = (struct sd *) gspca_dev;
1894
1895 if (sd->sensor == SENSOR_PO2030N) {
1896 u8 rg1b[] =
1897 {0xc1, 0x6e, 0x16, 0x00, 0x40, 0x00, 0x00, 0x10};
1898
1899
1900 rg1b[3] = sd->red_bal->val * 2;
1901 rg1b[5] = sd->blue_bal->val * 2;
1902 i2c_w8(gspca_dev, rg1b);
1903 return;
1904 }
1905 reg_w1(gspca_dev, 0x05, sd->red_bal->val);
1906
1907 reg_w1(gspca_dev, 0x06, sd->blue_bal->val);
1908}
1909
1910static void setgamma(struct gspca_dev *gspca_dev)
1911{
1912 struct sd *sd = (struct sd *) gspca_dev;
1913 int i, val;
1914 u8 gamma[17];
1915 const u8 *gamma_base;
1916 static const u8 delta[17] = {
1917 0x00, 0x14, 0x1c, 0x1c, 0x1c, 0x1c, 0x1b, 0x1a,
1918 0x18, 0x13, 0x10, 0x0e, 0x08, 0x07, 0x04, 0x02, 0x00
1919 };
1920
1921 switch (sd->sensor) {
1922 case SENSOR_ADCM1700:
1923 gamma_base = gamma_spec_0;
1924 break;
1925 case SENSOR_HV7131R:
1926 case SENSOR_MI0360B:
1927 case SENSOR_MT9V111:
1928 gamma_base = gamma_spec_1;
1929 break;
1930 case SENSOR_GC0307:
1931 gamma_base = gamma_spec_2;
1932 break;
1933 case SENSOR_SP80708:
1934 gamma_base = gamma_spec_3;
1935 break;
1936 default:
1937 gamma_base = gamma_def;
1938 break;
1939 }
1940
1941 val = sd->gamma->val;
1942 for (i = 0; i < sizeof gamma; i++)
1943 gamma[i] = gamma_base[i]
1944 + delta[i] * (val - GAMMA_DEF) / 32;
1945 reg_w(gspca_dev, 0x20, gamma, sizeof gamma);
1946}
1947
1948static void setexposure(struct gspca_dev *gspca_dev)
1949{
1950 struct sd *sd = (struct sd *) gspca_dev;
1951
1952 if (sd->sensor == SENSOR_PO2030N) {
1953 u8 rexpo[] =
1954 {0xa1, 0x6e, 0x1a, 0x00, 0x40, 0x00, 0x00, 0x10};
1955
1956 rexpo[3] = gspca_dev->exposure->val >> 8;
1957 i2c_w8(gspca_dev, rexpo);
1958 msleep(6);
1959 rexpo[2] = 0x1b;
1960 rexpo[3] = gspca_dev->exposure->val;
1961 i2c_w8(gspca_dev, rexpo);
1962 }
1963}
1964
1965static void setautogain(struct gspca_dev *gspca_dev)
1966{
1967 struct sd *sd = (struct sd *) gspca_dev;
1968
1969 switch (sd->sensor) {
1970 case SENSOR_OV7630:
1971 case SENSOR_OV7648: {
1972 u8 comb;
1973
1974 if (sd->sensor == SENSOR_OV7630)
1975 comb = 0xc0;
1976 else
1977 comb = 0xa0;
1978 if (gspca_dev->autogain->val)
1979 comb |= 0x03;
1980 i2c_w1(&sd->gspca_dev, 0x13, comb);
1981 return;
1982 }
1983 }
1984 if (gspca_dev->autogain->val)
1985 sd->ag_cnt = AG_CNT_START;
1986 else
1987 sd->ag_cnt = -1;
1988}
1989
1990static void setgain(struct gspca_dev *gspca_dev)
1991{
1992 struct sd *sd = (struct sd *) gspca_dev;
1993
1994 if (sd->sensor == SENSOR_PO2030N) {
1995 u8 rgain[] =
1996 {0xa1, 0x6e, 0x15, 0x00, 0x40, 0x00, 0x00, 0x15};
1997
1998 rgain[3] = gspca_dev->gain->val;
1999 i2c_w8(gspca_dev, rgain);
2000 }
2001}
2002
2003static void sethvflip(struct gspca_dev *gspca_dev)
2004{
2005 struct sd *sd = (struct sd *) gspca_dev;
2006 u8 comn;
2007
2008 switch (sd->sensor) {
2009 case SENSOR_HV7131R:
2010 comn = 0x18;
2011 if (sd->vflip->val)
2012 comn |= 0x01;
2013 i2c_w1(gspca_dev, 0x01, comn);
2014 break;
2015 case SENSOR_OV7630:
2016 comn = 0x02;
2017 if (!sd->vflip->val)
2018 comn |= 0x80;
2019 i2c_w1(gspca_dev, 0x75, comn);
2020 break;
2021 case SENSOR_OV7648:
2022 comn = 0x06;
2023 if (sd->vflip->val)
2024 comn |= 0x80;
2025 i2c_w1(gspca_dev, 0x75, comn);
2026 break;
2027 case SENSOR_PO2030N:
2028
2029
2030
2031
2032
2033
2034
2035
2036 comn = 0x0a;
2037 if (sd->hflip->val)
2038 comn |= 0x80;
2039 if (sd->vflip->val)
2040 comn |= 0x40;
2041 i2c_w1(&sd->gspca_dev, 0x1e, comn);
2042 break;
2043 }
2044}
2045
2046static void setsharpness(struct gspca_dev *gspca_dev)
2047{
2048 struct sd *sd = (struct sd *) gspca_dev;
2049
2050 reg_w1(gspca_dev, 0x99, sd->sharpness->val);
2051}
2052
2053static void setillum(struct gspca_dev *gspca_dev)
2054{
2055 struct sd *sd = (struct sd *) gspca_dev;
2056
2057 switch (sd->sensor) {
2058 case SENSOR_ADCM1700:
2059 reg_w1(gspca_dev, 0x02,
2060 sd->illum->val ? 0x64 : 0x60);
2061 break;
2062 case SENSOR_MT9V111:
2063 reg_w1(gspca_dev, 0x02,
2064 sd->illum->val ? 0x77 : 0x74);
2065
2066
2067
2068 break;
2069 }
2070}
2071
2072static void setfreq(struct gspca_dev *gspca_dev)
2073{
2074 struct sd *sd = (struct sd *) gspca_dev;
2075
2076 if (sd->sensor == SENSOR_OV7660) {
2077 u8 com8;
2078
2079 com8 = 0xdf;
2080 switch (sd->freq->val) {
2081 case 0:
2082 i2c_w1(gspca_dev, 0x13, com8 | 0x20);
2083 break;
2084 case 1:
2085 i2c_w1(gspca_dev, 0x13, com8);
2086 i2c_w1(gspca_dev, 0x3b, 0x0a);
2087 break;
2088 case 2:
2089 i2c_w1(gspca_dev, 0x13, com8);
2090 i2c_w1(gspca_dev, 0x3b, 0x02);
2091 break;
2092 }
2093 } else {
2094 u8 reg2a = 0, reg2b = 0, reg2d = 0;
2095
2096
2097 switch (sd->sensor) {
2098 case SENSOR_OV7630:
2099 reg2a = 0x08;
2100 reg2d = 0x01;
2101 break;
2102 case SENSOR_OV7648:
2103 reg2a = 0x11;
2104 reg2d = 0x81;
2105 break;
2106 }
2107
2108 switch (sd->freq->val) {
2109 case 0:
2110 break;
2111 case 1:
2112 reg2a |= 0x80;
2113 reg2b = 0xac;
2114 reg2d |= 0x04;
2115 break;
2116 case 2:
2117 reg2a |= 0x80;
2118 reg2d |= 0x04;
2119 break;
2120 }
2121 i2c_w1(gspca_dev, 0x2a, reg2a);
2122 i2c_w1(gspca_dev, 0x2b, reg2b);
2123 i2c_w1(gspca_dev, 0x2d, reg2d);
2124 }
2125}
2126
2127static void setjpegqual(struct gspca_dev *gspca_dev)
2128{
2129 struct sd *sd = (struct sd *) gspca_dev;
2130
2131 jpeg_set_qual(sd->jpeg_hdr, sd->quality);
2132#if USB_BUF_SZ < 64
2133#error "No room enough in usb_buf for quantization table"
2134#endif
2135 memcpy(gspca_dev->usb_buf, &sd->jpeg_hdr[JPEG_QT0_OFFSET], 64);
2136 usb_control_msg(gspca_dev->dev,
2137 usb_sndctrlpipe(gspca_dev->dev, 0),
2138 0x08,
2139 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
2140 0x0100, 0,
2141 gspca_dev->usb_buf, 64,
2142 500);
2143 memcpy(gspca_dev->usb_buf, &sd->jpeg_hdr[JPEG_QT1_OFFSET], 64);
2144 usb_control_msg(gspca_dev->dev,
2145 usb_sndctrlpipe(gspca_dev->dev, 0),
2146 0x08,
2147 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
2148 0x0140, 0,
2149 gspca_dev->usb_buf, 64,
2150 500);
2151
2152 sd->reg18 ^= 0x40;
2153 reg_w1(gspca_dev, 0x18, sd->reg18);
2154}
2155
2156
2157
2158static void qual_upd(struct work_struct *work)
2159{
2160 struct sd *sd = container_of(work, struct sd, work);
2161 struct gspca_dev *gspca_dev = &sd->gspca_dev;
2162
2163
2164 mutex_lock(&gspca_dev->usb_lock);
2165 PDEBUG(D_STREAM, "qual_upd %d%%", sd->quality);
2166 gspca_dev->usb_err = 0;
2167 setjpegqual(gspca_dev);
2168 mutex_unlock(&gspca_dev->usb_lock);
2169}
2170
2171
2172static int sd_start(struct gspca_dev *gspca_dev)
2173{
2174 struct sd *sd = (struct sd *) gspca_dev;
2175 int i;
2176 u8 reg01, reg17;
2177 u8 reg0102[2];
2178 const u8 *sn9c1xx;
2179 const u8 (*init)[8];
2180 const u8 *reg9a;
2181 int mode;
2182 static const u8 reg9a_def[] =
2183 {0x00, 0x40, 0x20, 0x00, 0x00, 0x00};
2184 static const u8 reg9a_spec[] =
2185 {0x00, 0x40, 0x38, 0x30, 0x00, 0x20};
2186 static const u8 regd4[] = {0x60, 0x00, 0x00};
2187 static const u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f };
2188 static const u8 CA[] = { 0x28, 0xd8, 0x14, 0xec };
2189 static const u8 CA_adcm1700[] =
2190 { 0x14, 0xec, 0x0a, 0xf6 };
2191 static const u8 CA_po2030n[] =
2192 { 0x1e, 0xe2, 0x14, 0xec };
2193 static const u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd };
2194 static const u8 CE_gc0307[] =
2195 { 0x32, 0xce, 0x2d, 0xd3 };
2196 static const u8 CE_ov76xx[] =
2197 { 0x32, 0xdd, 0x32, 0xdd };
2198 static const u8 CE_po2030n[] =
2199 { 0x14, 0xe7, 0x1e, 0xdd };
2200
2201
2202 jpeg_define(sd->jpeg_hdr, gspca_dev->pixfmt.height,
2203 gspca_dev->pixfmt.width,
2204 0x21);
2205
2206
2207 sn9c1xx = sn_tb[sd->sensor];
2208
2209
2210
2211 reg01 = sn9c1xx[1];
2212 if (sd->flags & F_PDN_INV)
2213 reg01 ^= S_PDN_INV;
2214 reg_w1(gspca_dev, 0x01, reg01);
2215
2216
2217 reg0102[0] = reg01;
2218 reg0102[1] = sn9c1xx[2];
2219 if (gspca_dev->audio)
2220 reg0102[1] |= 0x04;
2221 reg_w(gspca_dev, 0x01, reg0102, 2);
2222 reg_w(gspca_dev, 0x08, &sn9c1xx[8], 2);
2223 reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 5);
2224 switch (sd->sensor) {
2225 case SENSOR_GC0307:
2226 case SENSOR_OV7660:
2227 case SENSOR_PO1030:
2228 case SENSOR_PO2030N:
2229 case SENSOR_SOI768:
2230 case SENSOR_SP80708:
2231 reg9a = reg9a_spec;
2232 break;
2233 default:
2234 reg9a = reg9a_def;
2235 break;
2236 }
2237 reg_w(gspca_dev, 0x9a, reg9a, 6);
2238
2239 reg_w(gspca_dev, 0xd4, regd4, sizeof regd4);
2240
2241 reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f);
2242
2243 reg17 = sn9c1xx[0x17];
2244 switch (sd->sensor) {
2245 case SENSOR_GC0307:
2246 msleep(50);
2247 break;
2248 case SENSOR_OM6802:
2249 msleep(10);
2250 reg_w1(gspca_dev, 0x02, 0x73);
2251 reg17 |= SEN_CLK_EN;
2252 reg_w1(gspca_dev, 0x17, reg17);
2253 reg_w1(gspca_dev, 0x01, 0x22);
2254 msleep(100);
2255 reg01 = SCL_SEL_OD | S_PDN_INV;
2256 reg17 &= ~MCK_SIZE_MASK;
2257 reg17 |= 0x04;
2258 break;
2259 }
2260 reg01 |= SYS_SEL_48M;
2261 reg_w1(gspca_dev, 0x01, reg01);
2262 reg17 |= SEN_CLK_EN;
2263 reg_w1(gspca_dev, 0x17, reg17);
2264 reg01 &= ~S_PWR_DN;
2265 reg_w1(gspca_dev, 0x01, reg01);
2266 reg01 &= ~SCL_SEL_OD;
2267 reg_w1(gspca_dev, 0x01, reg01);
2268
2269 switch (sd->sensor) {
2270 case SENSOR_HV7131R:
2271 hv7131r_probe(gspca_dev);
2272 break;
2273 case SENSOR_OM6802:
2274 msleep(10);
2275 reg_w1(gspca_dev, 0x01, reg01);
2276 i2c_w8(gspca_dev, om6802_init0[0]);
2277 i2c_w8(gspca_dev, om6802_init0[1]);
2278 msleep(15);
2279 reg_w1(gspca_dev, 0x02, 0x71);
2280 msleep(150);
2281 break;
2282 case SENSOR_SP80708:
2283 msleep(100);
2284 reg_w1(gspca_dev, 0x02, 0x62);
2285 break;
2286 }
2287
2288
2289 i2c_w_seq(gspca_dev, sensor_init[sd->sensor]);
2290
2291 reg_w1(gspca_dev, 0x15, sn9c1xx[0x15]);
2292 reg_w1(gspca_dev, 0x16, sn9c1xx[0x16]);
2293 reg_w1(gspca_dev, 0x12, sn9c1xx[0x12]);
2294 reg_w1(gspca_dev, 0x13, sn9c1xx[0x13]);
2295 reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]);
2296 if (sd->sensor == SENSOR_ADCM1700) {
2297 reg_w1(gspca_dev, 0xd2, 0x3a);
2298 reg_w1(gspca_dev, 0xd3, 0x30);
2299 } else {
2300 reg_w1(gspca_dev, 0xd2, 0x6a);
2301 reg_w1(gspca_dev, 0xd3, 0x50);
2302 }
2303 reg_w1(gspca_dev, 0xc6, 0x00);
2304 reg_w1(gspca_dev, 0xc7, 0x00);
2305 if (sd->sensor == SENSOR_ADCM1700) {
2306 reg_w1(gspca_dev, 0xc8, 0x2c);
2307 reg_w1(gspca_dev, 0xc9, 0x24);
2308 } else {
2309 reg_w1(gspca_dev, 0xc8, 0x50);
2310 reg_w1(gspca_dev, 0xc9, 0x3c);
2311 }
2312 reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]);
2313 switch (sd->sensor) {
2314 case SENSOR_OM6802:
2315
2316 break;
2317 default:
2318 reg17 |= DEF_EN;
2319 break;
2320 }
2321 reg_w1(gspca_dev, 0x17, reg17);
2322
2323 reg_w1(gspca_dev, 0x05, 0x00);
2324 reg_w1(gspca_dev, 0x07, 0x00);
2325 reg_w1(gspca_dev, 0x06, 0x00);
2326 reg_w1(gspca_dev, 0x14, sn9c1xx[0x14]);
2327
2328 setgamma(gspca_dev);
2329
2330
2331 for (i = 0; i < 8; i++)
2332 reg_w(gspca_dev, 0x84, reg84, sizeof reg84);
2333 switch (sd->sensor) {
2334 case SENSOR_ADCM1700:
2335 case SENSOR_OV7660:
2336 case SENSOR_SP80708:
2337 reg_w1(gspca_dev, 0x9a, 0x05);
2338 break;
2339 case SENSOR_GC0307:
2340 case SENSOR_MT9V111:
2341 case SENSOR_MI0360B:
2342 reg_w1(gspca_dev, 0x9a, 0x07);
2343 break;
2344 case SENSOR_OV7630:
2345 case SENSOR_OV7648:
2346 reg_w1(gspca_dev, 0x9a, 0x0a);
2347 break;
2348 case SENSOR_PO2030N:
2349 case SENSOR_SOI768:
2350 reg_w1(gspca_dev, 0x9a, 0x06);
2351 break;
2352 default:
2353 reg_w1(gspca_dev, 0x9a, 0x08);
2354 break;
2355 }
2356 setsharpness(gspca_dev);
2357
2358 reg_w(gspca_dev, 0x84, reg84, sizeof reg84);
2359 reg_w1(gspca_dev, 0x05, 0x20);
2360 reg_w1(gspca_dev, 0x07, 0x20);
2361 reg_w1(gspca_dev, 0x06, 0x20);
2362
2363 init = NULL;
2364 mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv;
2365 reg01 |= SYS_SEL_48M | V_TX_EN;
2366 reg17 &= ~MCK_SIZE_MASK;
2367 reg17 |= 0x02;
2368 switch (sd->sensor) {
2369 case SENSOR_ADCM1700:
2370 init = adcm1700_sensor_param1;
2371 break;
2372 case SENSOR_GC0307:
2373 init = gc0307_sensor_param1;
2374 break;
2375 case SENSOR_HV7131R:
2376 case SENSOR_MI0360:
2377 if (!mode)
2378 reg01 &= ~SYS_SEL_48M;
2379 reg17 &= ~MCK_SIZE_MASK;
2380 reg17 |= 0x01;
2381 break;
2382 case SENSOR_MI0360B:
2383 init = mi0360b_sensor_param1;
2384 break;
2385 case SENSOR_MO4000:
2386 if (mode) {
2387 reg01 &= ~SYS_SEL_48M;
2388 reg17 &= ~MCK_SIZE_MASK;
2389 reg17 |= 0x01;
2390 }
2391 break;
2392 case SENSOR_MT9V111:
2393 init = mt9v111_sensor_param1;
2394 break;
2395 case SENSOR_OM6802:
2396 init = om6802_sensor_param1;
2397 if (!mode) {
2398 reg17 &= ~MCK_SIZE_MASK;
2399 reg17 |= 0x04;
2400 } else {
2401 reg01 &= ~SYS_SEL_48M;
2402 reg17 &= ~MCK_SIZE_MASK;
2403 reg17 |= 0x02;
2404 }
2405 break;
2406 case SENSOR_OV7630:
2407 init = ov7630_sensor_param1;
2408 break;
2409 case SENSOR_OV7648:
2410 init = ov7648_sensor_param1;
2411 reg17 &= ~MCK_SIZE_MASK;
2412 reg17 |= 0x01;
2413 break;
2414 case SENSOR_OV7660:
2415 init = ov7660_sensor_param1;
2416 break;
2417 case SENSOR_PO1030:
2418 init = po1030_sensor_param1;
2419 break;
2420 case SENSOR_PO2030N:
2421 init = po2030n_sensor_param1;
2422 break;
2423 case SENSOR_SOI768:
2424 init = soi768_sensor_param1;
2425 break;
2426 case SENSOR_SP80708:
2427 init = sp80708_sensor_param1;
2428 break;
2429 }
2430
2431
2432 if (init != NULL) {
2433 i2c_w_seq(gspca_dev, init);
2434
2435 }
2436
2437 reg_w(gspca_dev, 0xc0, C0, 6);
2438 switch (sd->sensor) {
2439 case SENSOR_ADCM1700:
2440 case SENSOR_GC0307:
2441 case SENSOR_SOI768:
2442 reg_w(gspca_dev, 0xca, CA_adcm1700, 4);
2443 break;
2444 case SENSOR_PO2030N:
2445 reg_w(gspca_dev, 0xca, CA_po2030n, 4);
2446 break;
2447 default:
2448 reg_w(gspca_dev, 0xca, CA, 4);
2449 break;
2450 }
2451 switch (sd->sensor) {
2452 case SENSOR_ADCM1700:
2453 case SENSOR_OV7630:
2454 case SENSOR_OV7648:
2455 case SENSOR_OV7660:
2456 case SENSOR_SOI768:
2457 reg_w(gspca_dev, 0xce, CE_ov76xx, 4);
2458 break;
2459 case SENSOR_GC0307:
2460 reg_w(gspca_dev, 0xce, CE_gc0307, 4);
2461 break;
2462 case SENSOR_PO2030N:
2463 reg_w(gspca_dev, 0xce, CE_po2030n, 4);
2464 break;
2465 default:
2466 reg_w(gspca_dev, 0xce, CE, 4);
2467
2468 break;
2469 }
2470
2471
2472 sd->reg18 = sn9c1xx[0x18] | (mode << 4) | 0x40;
2473 reg_w1(gspca_dev, 0x18, sd->reg18);
2474 setjpegqual(gspca_dev);
2475
2476 reg_w1(gspca_dev, 0x17, reg17);
2477 reg_w1(gspca_dev, 0x01, reg01);
2478 sd->reg01 = reg01;
2479 sd->reg17 = reg17;
2480
2481 sd->pktsz = sd->npkt = 0;
2482 sd->nchg = sd->short_mark = 0;
2483
2484 return gspca_dev->usb_err;
2485}
2486
2487static void sd_stopN(struct gspca_dev *gspca_dev)
2488{
2489 struct sd *sd = (struct sd *) gspca_dev;
2490 static const u8 stophv7131[] =
2491 { 0xa1, 0x11, 0x02, 0x09, 0x00, 0x00, 0x00, 0x10 };
2492 static const u8 stopmi0360[] =
2493 { 0xb1, 0x5d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10 };
2494 static const u8 stopov7648[] =
2495 { 0xa1, 0x21, 0x76, 0x20, 0x00, 0x00, 0x00, 0x10 };
2496 static const u8 stopsoi768[] =
2497 { 0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10 };
2498 u8 reg01;
2499 u8 reg17;
2500
2501 reg01 = sd->reg01;
2502 reg17 = sd->reg17 & ~SEN_CLK_EN;
2503 switch (sd->sensor) {
2504 case SENSOR_ADCM1700:
2505 case SENSOR_GC0307:
2506 case SENSOR_PO2030N:
2507 case SENSOR_SP80708:
2508 reg01 |= LED;
2509 reg_w1(gspca_dev, 0x01, reg01);
2510 reg01 &= ~(LED | V_TX_EN);
2511 reg_w1(gspca_dev, 0x01, reg01);
2512
2513 break;
2514 case SENSOR_HV7131R:
2515 reg01 &= ~V_TX_EN;
2516 reg_w1(gspca_dev, 0x01, reg01);
2517 i2c_w8(gspca_dev, stophv7131);
2518 break;
2519 case SENSOR_MI0360:
2520 case SENSOR_MI0360B:
2521 reg01 &= ~V_TX_EN;
2522 reg_w1(gspca_dev, 0x01, reg01);
2523
2524 i2c_w8(gspca_dev, stopmi0360);
2525 break;
2526 case SENSOR_MT9V111:
2527 case SENSOR_OM6802:
2528 case SENSOR_PO1030:
2529 reg01 &= ~V_TX_EN;
2530 reg_w1(gspca_dev, 0x01, reg01);
2531 break;
2532 case SENSOR_OV7630:
2533 case SENSOR_OV7648:
2534 reg01 &= ~V_TX_EN;
2535 reg_w1(gspca_dev, 0x01, reg01);
2536 i2c_w8(gspca_dev, stopov7648);
2537 break;
2538 case SENSOR_OV7660:
2539 reg01 &= ~V_TX_EN;
2540 reg_w1(gspca_dev, 0x01, reg01);
2541 break;
2542 case SENSOR_SOI768:
2543 i2c_w8(gspca_dev, stopsoi768);
2544 break;
2545 }
2546
2547 reg01 |= SCL_SEL_OD;
2548 reg_w1(gspca_dev, 0x01, reg01);
2549 reg01 |= S_PWR_DN;
2550 reg_w1(gspca_dev, 0x01, reg01);
2551 reg_w1(gspca_dev, 0x17, reg17);
2552 reg01 &= ~SYS_SEL_48M;
2553 reg_w1(gspca_dev, 0x01, reg01);
2554 reg01 |= LED;
2555 reg_w1(gspca_dev, 0x01, reg01);
2556
2557
2558}
2559
2560
2561
2562static void sd_stop0(struct gspca_dev *gspca_dev)
2563{
2564 struct sd *sd = (struct sd *) gspca_dev;
2565
2566 mutex_unlock(&gspca_dev->usb_lock);
2567 flush_work(&sd->work);
2568 mutex_lock(&gspca_dev->usb_lock);
2569}
2570
2571static void do_autogain(struct gspca_dev *gspca_dev)
2572{
2573 struct sd *sd = (struct sd *) gspca_dev;
2574 int delta;
2575 int expotimes;
2576 u8 luma_mean = 130;
2577 u8 luma_delta = 20;
2578
2579
2580 if (sd->ag_cnt < 0)
2581 return;
2582 if (--sd->ag_cnt >= 0)
2583 return;
2584 sd->ag_cnt = AG_CNT_START;
2585
2586 delta = atomic_read(&sd->avg_lum);
2587 PDEBUG(D_FRAM, "mean lum %d", delta);
2588
2589 if (sd->sensor == SENSOR_PO2030N) {
2590 gspca_expo_autogain(gspca_dev, delta, luma_mean, luma_delta,
2591 15, 1024);
2592 return;
2593 }
2594
2595 if (delta < luma_mean - luma_delta ||
2596 delta > luma_mean + luma_delta) {
2597 switch (sd->sensor) {
2598 case SENSOR_GC0307:
2599 expotimes = sd->exposure;
2600 expotimes += (luma_mean - delta) >> 6;
2601 if (expotimes < 0)
2602 expotimes = 0;
2603 sd->exposure = expo_adjust(gspca_dev,
2604 (unsigned int) expotimes);
2605 break;
2606 case SENSOR_HV7131R:
2607 expotimes = sd->exposure >> 8;
2608 expotimes += (luma_mean - delta) >> 4;
2609 if (expotimes < 0)
2610 expotimes = 0;
2611 sd->exposure = expo_adjust(gspca_dev,
2612 (unsigned int) (expotimes << 8));
2613 break;
2614 case SENSOR_OM6802:
2615 case SENSOR_MT9V111:
2616 expotimes = sd->exposure;
2617 expotimes += (luma_mean - delta) >> 2;
2618 if (expotimes < 0)
2619 expotimes = 0;
2620 sd->exposure = expo_adjust(gspca_dev,
2621 (unsigned int) expotimes);
2622 setredblue(gspca_dev);
2623 break;
2624 default:
2625
2626
2627
2628 expotimes = sd->exposure;
2629 expotimes += (luma_mean - delta) >> 6;
2630 if (expotimes < 0)
2631 expotimes = 0;
2632 sd->exposure = expo_adjust(gspca_dev,
2633 (unsigned int) expotimes);
2634 setredblue(gspca_dev);
2635 break;
2636 }
2637 }
2638}
2639
2640
2641static void set_lum(struct sd *sd,
2642 u8 *data)
2643{
2644 int avg_lum;
2645
2646
2647
2648
2649
2650 avg_lum = (data[27] << 8) + data[28]
2651
2652 + (data[31] << 8) + data[32]
2653
2654 + (data[23] << 8) + data[24]
2655
2656 + (data[35] << 8) + data[36]
2657
2658 + (data[29] << 10) + (data[30] << 2);
2659 avg_lum >>= 10;
2660 atomic_set(&sd->avg_lum, avg_lum);
2661}
2662
2663
2664
2665static void sd_pkt_scan(struct gspca_dev *gspca_dev,
2666 u8 *data,
2667 int len)
2668{
2669 struct sd *sd = (struct sd *) gspca_dev;
2670 int i, new_qual;
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689 sd->npkt++;
2690 sd->pktsz += len;
2691
2692
2693
2694
2695
2696
2697 i = sd->short_mark;
2698 if (i != 0) {
2699 sd->short_mark = 0;
2700 if (i < 0
2701 && data[0] == 0xff
2702 && data[1] == 0x00)
2703 goto marker_found;
2704 if (data[0] == 0xff && data[1] == 0xff) {
2705 i = 0;
2706 goto marker_found;
2707 }
2708 len -= i;
2709 if (len <= 0)
2710 return;
2711 data += i;
2712 }
2713
2714
2715 for (i = len - 1; --i >= 0; ) {
2716 if (data[i] != 0xff) {
2717 i--;
2718 continue;
2719 }
2720 if (data[i + 1] == 0xff) {
2721
2722
2723 if (i + 2 >= len || data[i + 2] == 0x00)
2724 goto marker_found;
2725 }
2726 }
2727
2728
2729
2730 if (data[len - 1] == 0xff)
2731 sd->short_mark = -1;
2732 if (gspca_dev->last_packet_type == LAST_PACKET)
2733 gspca_frame_add(gspca_dev, FIRST_PACKET,
2734 sd->jpeg_hdr, JPEG_HDR_SZ);
2735 gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
2736 return;
2737
2738
2739
2740marker_found:
2741 new_qual = 0;
2742 if (i > 2) {
2743 if (data[i - 2] != 0xff || data[i - 1] != 0xd9) {
2744 gspca_dev->last_packet_type = DISCARD_PACKET;
2745 new_qual = -3;
2746 }
2747 } else if (i + 6 < len) {
2748 if (data[i + 6] & 0x08) {
2749 gspca_dev->last_packet_type = DISCARD_PACKET;
2750 new_qual = -5;
2751 }
2752 }
2753
2754 gspca_frame_add(gspca_dev, LAST_PACKET, data, i);
2755
2756
2757 if (new_qual == 0) {
2758 int r;
2759
2760 r = (sd->pktsz * 100) /
2761 (sd->npkt *
2762 gspca_dev->urb[0]->iso_frame_desc[0].length);
2763 if (r >= 85)
2764 new_qual = -3;
2765 else if (r < 75)
2766 new_qual = 2;
2767 }
2768 if (new_qual != 0) {
2769 sd->nchg += new_qual;
2770 if (sd->nchg < -6 || sd->nchg >= 12) {
2771 sd->nchg = 0;
2772 new_qual += sd->quality;
2773 if (new_qual < QUALITY_MIN)
2774 new_qual = QUALITY_MIN;
2775 else if (new_qual > QUALITY_MAX)
2776 new_qual = QUALITY_MAX;
2777 if (new_qual != sd->quality) {
2778 sd->quality = new_qual;
2779 schedule_work(&sd->work);
2780 }
2781 }
2782 } else {
2783 sd->nchg = 0;
2784 }
2785 sd->pktsz = sd->npkt = 0;
2786
2787
2788
2789 if (i + 62 > len) {
2790 sd->short_mark = i + 62 - len;
2791 return;
2792 }
2793 if (sd->ag_cnt >= 0)
2794 set_lum(sd, data + i);
2795
2796
2797 i += 62;
2798 if (i < len) {
2799 data += i;
2800 len -= i;
2801 gspca_frame_add(gspca_dev, FIRST_PACKET,
2802 sd->jpeg_hdr, JPEG_HDR_SZ);
2803 gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
2804 }
2805}
2806
2807static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
2808{
2809 struct gspca_dev *gspca_dev =
2810 container_of(ctrl->handler, struct gspca_dev, ctrl_handler);
2811
2812 gspca_dev->usb_err = 0;
2813
2814 if (!gspca_dev->streaming)
2815 return 0;
2816
2817 switch (ctrl->id) {
2818 case V4L2_CID_BRIGHTNESS:
2819 setbrightness(gspca_dev);
2820 break;
2821 case V4L2_CID_CONTRAST:
2822 setcontrast(gspca_dev);
2823 break;
2824 case V4L2_CID_SATURATION:
2825 setcolors(gspca_dev);
2826 break;
2827 case V4L2_CID_RED_BALANCE:
2828 setredblue(gspca_dev);
2829 break;
2830 case V4L2_CID_GAMMA:
2831 setgamma(gspca_dev);
2832 break;
2833 case V4L2_CID_AUTOGAIN:
2834 setautogain(gspca_dev);
2835 setexposure(gspca_dev);
2836 setgain(gspca_dev);
2837 break;
2838 case V4L2_CID_VFLIP:
2839 sethvflip(gspca_dev);
2840 break;
2841 case V4L2_CID_SHARPNESS:
2842 setsharpness(gspca_dev);
2843 break;
2844 case V4L2_CID_ILLUMINATORS_1:
2845 setillum(gspca_dev);
2846 break;
2847 case V4L2_CID_POWER_LINE_FREQUENCY:
2848 setfreq(gspca_dev);
2849 break;
2850 default:
2851 return -EINVAL;
2852 }
2853 return gspca_dev->usb_err;
2854}
2855
2856#if IS_ENABLED(CONFIG_INPUT)
2857static int sd_int_pkt_scan(struct gspca_dev *gspca_dev,
2858 u8 *data,
2859 int len)
2860{
2861 int ret = -EINVAL;
2862
2863 if (len == 1 && data[0] == 1) {
2864 input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1);
2865 input_sync(gspca_dev->input_dev);
2866 input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0);
2867 input_sync(gspca_dev->input_dev);
2868 ret = 0;
2869 }
2870
2871 return ret;
2872}
2873#endif
2874
2875
2876static const struct sd_desc sd_desc = {
2877 .name = MODULE_NAME,
2878 .config = sd_config,
2879 .init = sd_init,
2880 .init_controls = sd_init_controls,
2881 .start = sd_start,
2882 .stopN = sd_stopN,
2883 .stop0 = sd_stop0,
2884 .pkt_scan = sd_pkt_scan,
2885 .dq_callback = do_autogain,
2886#if IS_ENABLED(CONFIG_INPUT)
2887 .int_pkt_scan = sd_int_pkt_scan,
2888#endif
2889};
2890
2891
2892#define BS(bridge, sensor) \
2893 .driver_info = (BRIDGE_ ## bridge << 16) \
2894 | (SENSOR_ ## sensor << 8)
2895#define BSF(bridge, sensor, flags) \
2896 .driver_info = (BRIDGE_ ## bridge << 16) \
2897 | (SENSOR_ ## sensor << 8) \
2898 | (flags)
2899static const struct usb_device_id device_table[] = {
2900 {USB_DEVICE(0x0458, 0x7025), BSF(SN9C120, MI0360B, F_PDN_INV)},
2901 {USB_DEVICE(0x0458, 0x702e), BS(SN9C120, OV7660)},
2902 {USB_DEVICE(0x045e, 0x00f5), BSF(SN9C105, OV7660, F_PDN_INV)},
2903 {USB_DEVICE(0x045e, 0x00f7), BSF(SN9C105, OV7660, F_PDN_INV)},
2904 {USB_DEVICE(0x0471, 0x0327), BS(SN9C105, MI0360)},
2905 {USB_DEVICE(0x0471, 0x0328), BS(SN9C105, MI0360)},
2906 {USB_DEVICE(0x0471, 0x0330), BS(SN9C105, MI0360)},
2907 {USB_DEVICE(0x06f8, 0x3004), BS(SN9C105, OV7660)},
2908 {USB_DEVICE(0x06f8, 0x3008), BS(SN9C105, OV7660)},
2909
2910 {USB_DEVICE(0x0c45, 0x6040), BS(SN9C102P, HV7131R)},
2911
2912
2913 {USB_DEVICE(0x0c45, 0x607c), BS(SN9C102P, HV7131R)},
2914
2915 {USB_DEVICE(0x0c45, 0x60c0), BSF(SN9C105, MI0360, F_ILLUM)},
2916
2917
2918
2919
2920 {USB_DEVICE(0x0c45, 0x60ce), BS(SN9C105, SP80708)},
2921 {USB_DEVICE(0x0c45, 0x60ec), BS(SN9C105, MO4000)},
2922
2923
2924
2925 {USB_DEVICE(0x0c45, 0x60fb), BS(SN9C105, OV7660)},
2926 {USB_DEVICE(0x0c45, 0x60fc), BS(SN9C105, HV7131R)},
2927 {USB_DEVICE(0x0c45, 0x60fe), BS(SN9C105, OV7630)},
2928 {USB_DEVICE(0x0c45, 0x6100), BS(SN9C120, MI0360)},
2929 {USB_DEVICE(0x0c45, 0x6102), BS(SN9C120, PO2030N)},
2930
2931 {USB_DEVICE(0x0c45, 0x610a), BS(SN9C120, OV7648)},
2932 {USB_DEVICE(0x0c45, 0x610b), BS(SN9C120, OV7660)},
2933 {USB_DEVICE(0x0c45, 0x610c), BS(SN9C120, HV7131R)},
2934 {USB_DEVICE(0x0c45, 0x610e), BS(SN9C120, OV7630)},
2935
2936
2937
2938 {USB_DEVICE(0x0c45, 0x6128), BS(SN9C120, OM6802)},
2939
2940 {USB_DEVICE(0x0c45, 0x612a), BS(SN9C120, OV7648)},
2941 {USB_DEVICE(0x0c45, 0x612b), BS(SN9C110, ADCM1700)},
2942 {USB_DEVICE(0x0c45, 0x612c), BS(SN9C110, MO4000)},
2943 {USB_DEVICE(0x0c45, 0x612e), BS(SN9C110, OV7630)},
2944
2945 {USB_DEVICE(0x0c45, 0x6130), BS(SN9C120, MI0360)},
2946
2947
2948 {USB_DEVICE(0x0c45, 0x6138), BS(SN9C120, MO4000)},
2949 {USB_DEVICE(0x0c45, 0x613a), BS(SN9C120, OV7648)},
2950 {USB_DEVICE(0x0c45, 0x613b), BS(SN9C120, OV7660)},
2951 {USB_DEVICE(0x0c45, 0x613c), BS(SN9C120, HV7131R)},
2952 {USB_DEVICE(0x0c45, 0x613e), BS(SN9C120, OV7630)},
2953 {USB_DEVICE(0x0c45, 0x6142), BS(SN9C120, PO2030N)},
2954
2955 {USB_DEVICE(0x0c45, 0x6143), BS(SN9C120, SP80708)},
2956 {USB_DEVICE(0x0c45, 0x6148), BS(SN9C120, OM6802)},
2957 {USB_DEVICE(0x0c45, 0x614a), BSF(SN9C120, ADCM1700, F_ILLUM)},
2958
2959 {}
2960};
2961MODULE_DEVICE_TABLE(usb, device_table);
2962
2963
2964static int sd_probe(struct usb_interface *intf,
2965 const struct usb_device_id *id)
2966{
2967 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
2968 THIS_MODULE);
2969}
2970
2971static struct usb_driver sd_driver = {
2972 .name = MODULE_NAME,
2973 .id_table = device_table,
2974 .probe = sd_probe,
2975 .disconnect = gspca_disconnect,
2976#ifdef CONFIG_PM
2977 .suspend = gspca_suspend,
2978 .resume = gspca_resume,
2979 .reset_resume = gspca_resume,
2980#endif
2981};
2982
2983module_usb_driver(sd_driver);
2984