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 gspca_err(gspca_dev, "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 gspca_dbg(gspca_dev, D_USBI, "reg_r [%02x] -> %02x\n",
1170 value, gspca_dev->usb_buf[0]);
1171 if (ret < 0) {
1172 pr_err("reg_r err %d\n", ret);
1173 gspca_dev->usb_err = ret;
1174 }
1175}
1176
1177static void reg_w1(struct gspca_dev *gspca_dev,
1178 u16 value,
1179 u8 data)
1180{
1181 int ret;
1182
1183 if (gspca_dev->usb_err < 0)
1184 return;
1185 gspca_dbg(gspca_dev, D_USBO, "reg_w1 [%04x] = %02x\n", value, data);
1186 gspca_dev->usb_buf[0] = data;
1187 ret = usb_control_msg(gspca_dev->dev,
1188 usb_sndctrlpipe(gspca_dev->dev, 0),
1189 0x08,
1190 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
1191 value,
1192 0,
1193 gspca_dev->usb_buf, 1,
1194 500);
1195 if (ret < 0) {
1196 pr_err("reg_w1 err %d\n", ret);
1197 gspca_dev->usb_err = ret;
1198 }
1199}
1200static void reg_w(struct gspca_dev *gspca_dev,
1201 u16 value,
1202 const u8 *buffer,
1203 int len)
1204{
1205 int ret;
1206
1207 if (gspca_dev->usb_err < 0)
1208 return;
1209 gspca_dbg(gspca_dev, D_USBO, "reg_w [%04x] = %02x %02x ..\n",
1210 value, buffer[0], buffer[1]);
1211
1212 if (len > USB_BUF_SZ) {
1213 gspca_err(gspca_dev, "reg_w: buffer overflow\n");
1214 return;
1215 }
1216
1217 memcpy(gspca_dev->usb_buf, buffer, len);
1218 ret = usb_control_msg(gspca_dev->dev,
1219 usb_sndctrlpipe(gspca_dev->dev, 0),
1220 0x08,
1221 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
1222 value, 0,
1223 gspca_dev->usb_buf, len,
1224 500);
1225 if (ret < 0) {
1226 pr_err("reg_w err %d\n", ret);
1227 gspca_dev->usb_err = ret;
1228 }
1229}
1230
1231
1232static void i2c_w1(struct gspca_dev *gspca_dev, u8 reg, u8 val)
1233{
1234 struct sd *sd = (struct sd *) gspca_dev;
1235 int ret;
1236
1237 if (gspca_dev->usb_err < 0)
1238 return;
1239 gspca_dbg(gspca_dev, D_USBO, "i2c_w1 [%02x] = %02x\n", reg, val);
1240 switch (sd->sensor) {
1241 case SENSOR_ADCM1700:
1242 case SENSOR_OM6802:
1243 case SENSOR_GC0307:
1244 gspca_dev->usb_buf[0] = 0x80 | (2 << 4);
1245 break;
1246 default:
1247 gspca_dev->usb_buf[0] = 0x81 | (2 << 4);
1248 break;
1249 }
1250 gspca_dev->usb_buf[1] = sd->i2c_addr;
1251 gspca_dev->usb_buf[2] = reg;
1252 gspca_dev->usb_buf[3] = val;
1253 gspca_dev->usb_buf[4] = 0;
1254 gspca_dev->usb_buf[5] = 0;
1255 gspca_dev->usb_buf[6] = 0;
1256 gspca_dev->usb_buf[7] = 0x10;
1257 ret = usb_control_msg(gspca_dev->dev,
1258 usb_sndctrlpipe(gspca_dev->dev, 0),
1259 0x08,
1260 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
1261 0x08,
1262 0,
1263 gspca_dev->usb_buf, 8,
1264 500);
1265 msleep(2);
1266 if (ret < 0) {
1267 pr_err("i2c_w1 err %d\n", ret);
1268 gspca_dev->usb_err = ret;
1269 }
1270}
1271
1272
1273static void i2c_w8(struct gspca_dev *gspca_dev,
1274 const u8 *buffer)
1275{
1276 int ret;
1277
1278 if (gspca_dev->usb_err < 0)
1279 return;
1280 gspca_dbg(gspca_dev, D_USBO, "i2c_w8 [%02x] = %02x ..\n",
1281 buffer[2], buffer[3]);
1282 memcpy(gspca_dev->usb_buf, buffer, 8);
1283 ret = usb_control_msg(gspca_dev->dev,
1284 usb_sndctrlpipe(gspca_dev->dev, 0),
1285 0x08,
1286 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
1287 0x08, 0,
1288 gspca_dev->usb_buf, 8,
1289 500);
1290 msleep(2);
1291 if (ret < 0) {
1292 pr_err("i2c_w8 err %d\n", ret);
1293 gspca_dev->usb_err = ret;
1294 }
1295}
1296
1297
1298static void i2c_r(struct gspca_dev *gspca_dev, u8 reg, int len)
1299{
1300 struct sd *sd = (struct sd *) gspca_dev;
1301 u8 mode[8];
1302
1303 switch (sd->sensor) {
1304 case SENSOR_ADCM1700:
1305 case SENSOR_OM6802:
1306 case SENSOR_GC0307:
1307 mode[0] = 0x80 | 0x10;
1308 break;
1309 default:
1310 mode[0] = 0x81 | 0x10;
1311 break;
1312 }
1313 mode[1] = sd->i2c_addr;
1314 mode[2] = reg;
1315 mode[3] = 0;
1316 mode[4] = 0;
1317 mode[5] = 0;
1318 mode[6] = 0;
1319 mode[7] = 0x10;
1320 i2c_w8(gspca_dev, mode);
1321 msleep(2);
1322 mode[0] = (mode[0] & 0x81) | (len << 4) | 0x02;
1323 mode[2] = 0;
1324 i2c_w8(gspca_dev, mode);
1325 msleep(2);
1326 reg_r(gspca_dev, 0x0a, 5);
1327}
1328
1329static void i2c_w_seq(struct gspca_dev *gspca_dev,
1330 const u8 (*data)[8])
1331{
1332 while ((*data)[0] != 0) {
1333 if ((*data)[0] != DELAY)
1334 i2c_w8(gspca_dev, *data);
1335 else
1336 msleep((*data)[1]);
1337 data++;
1338 }
1339}
1340
1341
1342
1343static void hv7131r_probe(struct gspca_dev *gspca_dev)
1344{
1345 i2c_w1(gspca_dev, 0x02, 0);
1346 msleep(10);
1347 reg_w1(gspca_dev, 0x02, 0x66);
1348 msleep(10);
1349 i2c_r(gspca_dev, 0, 5);
1350 if (gspca_dev->usb_buf[0] == 0x02
1351 && gspca_dev->usb_buf[1] == 0x09
1352 && gspca_dev->usb_buf[2] == 0x01) {
1353 gspca_dbg(gspca_dev, D_PROBE, "Sensor HV7131R found\n");
1354 return;
1355 }
1356 pr_warn("Erroneous HV7131R ID 0x%02x 0x%02x 0x%02x\n",
1357 gspca_dev->usb_buf[0], gspca_dev->usb_buf[1],
1358 gspca_dev->usb_buf[2]);
1359}
1360
1361static void mi0360_probe(struct gspca_dev *gspca_dev)
1362{
1363 struct sd *sd = (struct sd *) gspca_dev;
1364 int i, j;
1365 u16 val = 0;
1366 static const u8 probe_tb[][4][8] = {
1367 {
1368 {0xb0, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10},
1369 {0x90, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10},
1370 {0xa2, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10},
1371 {0xb0, 0x5d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10}
1372 },
1373 {
1374 {0xb0, 0x5c, 0x01, 0x00, 0x04, 0x00, 0x00, 0x10},
1375 {0x90, 0x5c, 0x36, 0x00, 0x00, 0x00, 0x00, 0x10},
1376 {0xa2, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10},
1377 {}
1378 },
1379 };
1380
1381 for (i = 0; i < ARRAY_SIZE(probe_tb); i++) {
1382 reg_w1(gspca_dev, 0x17, 0x62);
1383 reg_w1(gspca_dev, 0x01, 0x08);
1384 for (j = 0; j < 3; j++)
1385 i2c_w8(gspca_dev, probe_tb[i][j]);
1386 msleep(2);
1387 reg_r(gspca_dev, 0x0a, 5);
1388 val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4];
1389 if (probe_tb[i][3][0] != 0)
1390 i2c_w8(gspca_dev, probe_tb[i][3]);
1391 reg_w1(gspca_dev, 0x01, 0x29);
1392 reg_w1(gspca_dev, 0x17, 0x42);
1393 if (val != 0xffff)
1394 break;
1395 }
1396 if (gspca_dev->usb_err < 0)
1397 return;
1398 switch (val) {
1399 case 0x8221:
1400 gspca_dbg(gspca_dev, D_PROBE, "Sensor mi0360b\n");
1401 sd->sensor = SENSOR_MI0360B;
1402 break;
1403 case 0x823a:
1404 gspca_dbg(gspca_dev, D_PROBE, "Sensor mt9v111\n");
1405 sd->sensor = SENSOR_MT9V111;
1406 break;
1407 case 0x8243:
1408 gspca_dbg(gspca_dev, D_PROBE, "Sensor mi0360\n");
1409 break;
1410 default:
1411 gspca_dbg(gspca_dev, D_PROBE, "Unknown sensor %04x - forced to mi0360\n",
1412 val);
1413 break;
1414 }
1415}
1416
1417static void ov7630_probe(struct gspca_dev *gspca_dev)
1418{
1419 struct sd *sd = (struct sd *) gspca_dev;
1420 u16 val;
1421
1422
1423 reg_w1(gspca_dev, 0x17, 0x62);
1424 reg_w1(gspca_dev, 0x01, 0x08);
1425 sd->i2c_addr = 0x21;
1426 i2c_r(gspca_dev, 0x0a, 2);
1427 val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4];
1428 reg_w1(gspca_dev, 0x01, 0x29);
1429 reg_w1(gspca_dev, 0x17, 0x42);
1430 if (gspca_dev->usb_err < 0)
1431 return;
1432 if (val == 0x7628) {
1433 sd->sensor = SENSOR_SOI768;
1434
1435 gspca_dev->cam.input_flags =
1436 V4L2_IN_ST_VFLIP | V4L2_IN_ST_HFLIP;
1437 gspca_dbg(gspca_dev, D_PROBE, "Sensor soi768\n");
1438 return;
1439 }
1440 gspca_dbg(gspca_dev, D_PROBE, "Sensor ov%04x\n", val);
1441}
1442
1443static void ov7648_probe(struct gspca_dev *gspca_dev)
1444{
1445 struct sd *sd = (struct sd *) gspca_dev;
1446 u16 val;
1447
1448
1449 reg_w1(gspca_dev, 0x17, 0x62);
1450 reg_w1(gspca_dev, 0x01, 0x08);
1451 sd->i2c_addr = 0x21;
1452 i2c_r(gspca_dev, 0x0a, 2);
1453 val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4];
1454 reg_w1(gspca_dev, 0x01, 0x29);
1455 reg_w1(gspca_dev, 0x17, 0x42);
1456 if ((val & 0xff00) == 0x7600) {
1457 gspca_dbg(gspca_dev, D_PROBE, "Sensor ov%04x\n", val);
1458 return;
1459 }
1460
1461
1462 reg_w1(gspca_dev, 0x17, 0x62);
1463 reg_w1(gspca_dev, 0x01, 0x08);
1464 sd->i2c_addr = 0x6e;
1465 i2c_r(gspca_dev, 0x00, 2);
1466 val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4];
1467 reg_w1(gspca_dev, 0x01, 0x29);
1468 reg_w1(gspca_dev, 0x17, 0x42);
1469 if (gspca_dev->usb_err < 0)
1470 return;
1471 if (val == 0x1030) {
1472 gspca_dbg(gspca_dev, D_PROBE, "Sensor po1030\n");
1473 sd->sensor = SENSOR_PO1030;
1474 return;
1475 }
1476 pr_err("Unknown sensor %04x\n", val);
1477}
1478
1479
1480static void po2030n_probe(struct gspca_dev *gspca_dev)
1481{
1482 struct sd *sd = (struct sd *) gspca_dev;
1483 u16 val;
1484
1485
1486 reg_w1(gspca_dev, 0x17, 0x62);
1487 reg_w1(gspca_dev, 0x01, 0x08);
1488 reg_w1(gspca_dev, 0x02, 0x22);
1489 sd->i2c_addr = 0x21;
1490 i2c_r(gspca_dev, 0x00, 1);
1491 val = gspca_dev->usb_buf[4];
1492 reg_w1(gspca_dev, 0x01, 0x29);
1493 reg_w1(gspca_dev, 0x17, 0x42);
1494 if (val == 0x99) {
1495 gspca_dbg(gspca_dev, D_PROBE, "Sensor gc0307\n");
1496 sd->sensor = SENSOR_GC0307;
1497 return;
1498 }
1499
1500
1501 reg_w1(gspca_dev, 0x17, 0x62);
1502 reg_w1(gspca_dev, 0x01, 0x0a);
1503 sd->i2c_addr = 0x6e;
1504 i2c_r(gspca_dev, 0x00, 2);
1505 val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4];
1506 reg_w1(gspca_dev, 0x01, 0x29);
1507 reg_w1(gspca_dev, 0x17, 0x42);
1508 if (gspca_dev->usb_err < 0)
1509 return;
1510 if (val == 0x2030) {
1511 gspca_dbg(gspca_dev, D_PROBE, "Sensor po2030n\n");
1512
1513 } else {
1514 pr_err("Unknown sensor ID %04x\n", val);
1515 }
1516}
1517
1518
1519static int sd_config(struct gspca_dev *gspca_dev,
1520 const struct usb_device_id *id)
1521{
1522 struct sd *sd = (struct sd *) gspca_dev;
1523 struct cam *cam;
1524
1525 sd->bridge = id->driver_info >> 16;
1526 sd->sensor = id->driver_info >> 8;
1527 sd->flags = id->driver_info;
1528
1529 cam = &gspca_dev->cam;
1530 if (sd->sensor == SENSOR_ADCM1700) {
1531 cam->cam_mode = cif_mode;
1532 cam->nmodes = ARRAY_SIZE(cif_mode);
1533 } else {
1534 cam->cam_mode = vga_mode;
1535 cam->nmodes = ARRAY_SIZE(vga_mode);
1536 }
1537 cam->npkt = 24;
1538
1539 sd->ag_cnt = -1;
1540 sd->quality = QUALITY_DEF;
1541
1542 INIT_WORK(&sd->work, qual_upd);
1543
1544 return 0;
1545}
1546
1547
1548static int sd_init(struct gspca_dev *gspca_dev)
1549{
1550 struct sd *sd = (struct sd *) gspca_dev;
1551 const u8 *sn9c1xx;
1552 u8 regGpio[] = { 0x29, 0x70 };
1553 u8 regF1;
1554
1555
1556 reg_w1(gspca_dev, 0xf1, 0x01);
1557 reg_r(gspca_dev, 0x00, 1);
1558 reg_w1(gspca_dev, 0xf1, 0x00);
1559 reg_r(gspca_dev, 0x00, 1);
1560 regF1 = gspca_dev->usb_buf[0];
1561 if (gspca_dev->usb_err < 0)
1562 return gspca_dev->usb_err;
1563 gspca_dbg(gspca_dev, D_PROBE, "Sonix chip id: %02x\n", regF1);
1564 if (gspca_dev->audio)
1565 regGpio[1] |= 0x04;
1566 switch (sd->bridge) {
1567 case BRIDGE_SN9C102P:
1568 case BRIDGE_SN9C105:
1569 if (regF1 != 0x11)
1570 return -ENODEV;
1571 break;
1572 default:
1573
1574
1575 if (regF1 != 0x12)
1576 return -ENODEV;
1577 }
1578
1579 switch (sd->sensor) {
1580 case SENSOR_MI0360:
1581 mi0360_probe(gspca_dev);
1582 break;
1583 case SENSOR_OV7630:
1584 ov7630_probe(gspca_dev);
1585 break;
1586 case SENSOR_OV7648:
1587 ov7648_probe(gspca_dev);
1588 break;
1589 case SENSOR_PO2030N:
1590 po2030n_probe(gspca_dev);
1591 break;
1592 }
1593
1594 switch (sd->bridge) {
1595 case BRIDGE_SN9C102P:
1596 reg_w1(gspca_dev, 0x02, regGpio[1]);
1597 break;
1598 default:
1599 reg_w(gspca_dev, 0x01, regGpio, 2);
1600 break;
1601 }
1602
1603
1604
1605 reg_w1(gspca_dev, 0xf1, 0x00);
1606
1607
1608 sn9c1xx = sn_tb[sd->sensor];
1609 sd->i2c_addr = sn9c1xx[9];
1610
1611 return gspca_dev->usb_err;
1612}
1613
1614static int sd_s_ctrl(struct v4l2_ctrl *ctrl);
1615
1616static const struct v4l2_ctrl_ops sd_ctrl_ops = {
1617 .s_ctrl = sd_s_ctrl,
1618};
1619
1620
1621static int sd_init_controls(struct gspca_dev *gspca_dev)
1622{
1623 struct sd *sd = (struct sd *) gspca_dev;
1624 struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler;
1625
1626 gspca_dev->vdev.ctrl_handler = hdl;
1627 v4l2_ctrl_handler_init(hdl, 14);
1628
1629 sd->brightness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1630 V4L2_CID_BRIGHTNESS, 0, 255, 1, 128);
1631#define CONTRAST_MAX 127
1632 sd->contrast = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1633 V4L2_CID_CONTRAST, 0, CONTRAST_MAX, 1, 20);
1634#define COLORS_DEF 25
1635 sd->saturation = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1636 V4L2_CID_SATURATION, 0, 40, 1, COLORS_DEF);
1637 sd->red_bal = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1638 V4L2_CID_RED_BALANCE, 24, 40, 1, 32);
1639 sd->blue_bal = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1640 V4L2_CID_BLUE_BALANCE, 24, 40, 1, 32);
1641#define GAMMA_DEF 20
1642 sd->gamma = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1643 V4L2_CID_GAMMA, 0, 40, 1, GAMMA_DEF);
1644
1645 if (sd->sensor == SENSOR_OM6802)
1646 sd->sharpness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1647 V4L2_CID_SHARPNESS, 0, 255, 1, 16);
1648 else
1649 sd->sharpness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1650 V4L2_CID_SHARPNESS, 0, 255, 1, 90);
1651
1652 if (sd->flags & F_ILLUM)
1653 sd->illum = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1654 V4L2_CID_ILLUMINATORS_1, 0, 1, 1, 0);
1655
1656 if (sd->sensor == SENSOR_PO2030N) {
1657 gspca_dev->exposure = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1658 V4L2_CID_EXPOSURE, 500, 1500, 1, 1024);
1659 gspca_dev->gain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1660 V4L2_CID_GAIN, 4, 49, 1, 15);
1661 sd->hflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1662 V4L2_CID_HFLIP, 0, 1, 1, 0);
1663 }
1664
1665 if (sd->sensor != SENSOR_ADCM1700 && sd->sensor != SENSOR_OV7660 &&
1666 sd->sensor != SENSOR_PO1030 && sd->sensor != SENSOR_SOI768 &&
1667 sd->sensor != SENSOR_SP80708)
1668 gspca_dev->autogain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1669 V4L2_CID_AUTOGAIN, 0, 1, 1, 1);
1670
1671 if (sd->sensor == SENSOR_HV7131R || sd->sensor == SENSOR_OV7630 ||
1672 sd->sensor == SENSOR_OV7648 || sd->sensor == SENSOR_PO2030N)
1673 sd->vflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1674 V4L2_CID_VFLIP, 0, 1, 1, 0);
1675
1676 if (sd->sensor == SENSOR_OV7630 || sd->sensor == SENSOR_OV7648 ||
1677 sd->sensor == SENSOR_OV7660)
1678 sd->freq = v4l2_ctrl_new_std_menu(hdl, &sd_ctrl_ops,
1679 V4L2_CID_POWER_LINE_FREQUENCY,
1680 V4L2_CID_POWER_LINE_FREQUENCY_60HZ, 0,
1681 V4L2_CID_POWER_LINE_FREQUENCY_50HZ);
1682
1683 if (hdl->error) {
1684 pr_err("Could not initialize controls\n");
1685 return hdl->error;
1686 }
1687
1688 v4l2_ctrl_cluster(2, &sd->red_bal);
1689 if (sd->sensor == SENSOR_PO2030N) {
1690 v4l2_ctrl_cluster(2, &sd->vflip);
1691 v4l2_ctrl_auto_cluster(3, &gspca_dev->autogain, 0, false);
1692 }
1693
1694 return 0;
1695}
1696
1697static u32 expo_adjust(struct gspca_dev *gspca_dev,
1698 u32 expo)
1699{
1700 struct sd *sd = (struct sd *) gspca_dev;
1701
1702 switch (sd->sensor) {
1703 case SENSOR_GC0307: {
1704 int a, b;
1705
1706
1707 a = 19 + expo * 25 / 256;
1708 i2c_w1(gspca_dev, 0x68, a);
1709 a -= 12;
1710 b = a * a * 4;
1711 i2c_w1(gspca_dev, 0x03, b >> 8);
1712 i2c_w1(gspca_dev, 0x04, b);
1713 break;
1714 }
1715 case SENSOR_HV7131R: {
1716 u8 Expodoit[] =
1717 { 0xc1, 0x11, 0x25, 0x00, 0x00, 0x00, 0x00, 0x16 };
1718
1719 Expodoit[3] = expo >> 16;
1720 Expodoit[4] = expo >> 8;
1721 Expodoit[5] = expo;
1722 i2c_w8(gspca_dev, Expodoit);
1723 break;
1724 }
1725 case SENSOR_MI0360:
1726 case SENSOR_MI0360B: {
1727 u8 expoMi[] =
1728 { 0xb1, 0x5d, 0x09, 0x00, 0x00, 0x00, 0x00, 0x16 };
1729 static const u8 doit[] =
1730 { 0xb1, 0x5d, 0x07, 0x00, 0x03, 0x00, 0x00, 0x10 };
1731 static const u8 sensorgo[] =
1732 { 0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10 };
1733
1734 if (expo > 0x0635)
1735 expo = 0x0635;
1736 else if (expo < 0x0001)
1737 expo = 0x0001;
1738 expoMi[3] = expo >> 8;
1739 expoMi[4] = expo;
1740 i2c_w8(gspca_dev, expoMi);
1741 i2c_w8(gspca_dev, doit);
1742 i2c_w8(gspca_dev, sensorgo);
1743 break;
1744 }
1745 case SENSOR_MO4000: {
1746 u8 expoMof[] =
1747 { 0xa1, 0x21, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x10 };
1748 u8 expoMo10[] =
1749 { 0xa1, 0x21, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10 };
1750 static const u8 gainMo[] =
1751 { 0xa1, 0x21, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1d };
1752
1753 if (expo > 0x1fff)
1754 expo = 0x1fff;
1755 else if (expo < 0x0001)
1756 expo = 0x0001;
1757 expoMof[3] = (expo & 0x03fc) >> 2;
1758 i2c_w8(gspca_dev, expoMof);
1759 expoMo10[3] = ((expo & 0x1c00) >> 10)
1760 | ((expo & 0x0003) << 4);
1761 i2c_w8(gspca_dev, expoMo10);
1762 i2c_w8(gspca_dev, gainMo);
1763 gspca_dbg(gspca_dev, D_FRAM, "set exposure %d\n",
1764 ((expoMo10[3] & 0x07) << 10)
1765 | (expoMof[3] << 2)
1766 | ((expoMo10[3] & 0x30) >> 4));
1767 break;
1768 }
1769 case SENSOR_MT9V111: {
1770 u8 expo_c1[] =
1771 { 0xb1, 0x5c, 0x09, 0x00, 0x00, 0x00, 0x00, 0x10 };
1772
1773 if (expo > 0x0390)
1774 expo = 0x0390;
1775 else if (expo < 0x0060)
1776 expo = 0x0060;
1777 expo_c1[3] = expo >> 8;
1778 expo_c1[4] = expo;
1779 i2c_w8(gspca_dev, expo_c1);
1780 break;
1781 }
1782 case SENSOR_OM6802: {
1783 u8 gainOm[] =
1784 { 0xa0, 0x34, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x10 };
1785
1786
1787 if (expo > 0x03ff)
1788 expo = 0x03ff;
1789 if (expo < 0x0001)
1790 expo = 0x0001;
1791 gainOm[3] = expo >> 2;
1792 i2c_w8(gspca_dev, gainOm);
1793 reg_w1(gspca_dev, 0x96, expo >> 5);
1794 gspca_dbg(gspca_dev, D_FRAM, "set exposure %d\n", gainOm[3]);
1795 break;
1796 }
1797 }
1798 return expo;
1799}
1800
1801static void setbrightness(struct gspca_dev *gspca_dev)
1802{
1803 struct sd *sd = (struct sd *) gspca_dev;
1804 unsigned int expo;
1805 int brightness = sd->brightness->val;
1806 u8 k2;
1807
1808 k2 = (brightness - 0x80) >> 2;
1809 switch (sd->sensor) {
1810 case SENSOR_ADCM1700:
1811 if (k2 > 0x1f)
1812 k2 = 0;
1813 break;
1814 case SENSOR_HV7131R:
1815 expo = brightness << 12;
1816 if (expo > 0x002dc6c0)
1817 expo = 0x002dc6c0;
1818 else if (expo < 0x02a0)
1819 expo = 0x02a0;
1820 sd->exposure = expo_adjust(gspca_dev, expo);
1821 break;
1822 case SENSOR_MI0360:
1823 case SENSOR_MO4000:
1824 expo = brightness << 4;
1825 sd->exposure = expo_adjust(gspca_dev, expo);
1826 break;
1827 case SENSOR_MI0360B:
1828 expo = brightness << 2;
1829 sd->exposure = expo_adjust(gspca_dev, expo);
1830 break;
1831 case SENSOR_GC0307:
1832 expo = brightness;
1833 sd->exposure = expo_adjust(gspca_dev, expo);
1834 return;
1835 case SENSOR_MT9V111:
1836 expo = brightness << 2;
1837 sd->exposure = expo_adjust(gspca_dev, expo);
1838 return;
1839 case SENSOR_OM6802:
1840 expo = brightness << 2;
1841 sd->exposure = expo_adjust(gspca_dev, expo);
1842 return;
1843 }
1844
1845 reg_w1(gspca_dev, 0x96, k2);
1846}
1847
1848static void setcontrast(struct gspca_dev *gspca_dev)
1849{
1850 struct sd *sd = (struct sd *) gspca_dev;
1851 u8 k2;
1852 u8 contrast[6];
1853
1854 k2 = sd->contrast->val * 37 / (CONTRAST_MAX + 1)
1855 + 37;
1856 contrast[0] = (k2 + 1) / 2;
1857 contrast[1] = 0;
1858 contrast[2] = k2;
1859 contrast[3] = 0;
1860 contrast[4] = k2 / 5;
1861 contrast[5] = 0;
1862 reg_w(gspca_dev, 0x84, contrast, sizeof contrast);
1863}
1864
1865static void setcolors(struct gspca_dev *gspca_dev)
1866{
1867 struct sd *sd = (struct sd *) gspca_dev;
1868 int i, v, colors;
1869 const s16 *uv;
1870 u8 reg8a[12];
1871 static const s16 uv_com[6] = {
1872 -24, -38, 64,
1873 62, -51, -9
1874 };
1875 static const s16 uv_mi0360b[6] = {
1876 -20, -38, 64,
1877 60, -51, -9
1878 };
1879
1880 colors = sd->saturation->val;
1881 if (sd->sensor == SENSOR_MI0360B)
1882 uv = uv_mi0360b;
1883 else
1884 uv = uv_com;
1885 for (i = 0; i < 6; i++) {
1886 v = uv[i] * colors / COLORS_DEF;
1887 reg8a[i * 2] = v;
1888 reg8a[i * 2 + 1] = (v >> 8) & 0x0f;
1889 }
1890 reg_w(gspca_dev, 0x8a, reg8a, sizeof reg8a);
1891}
1892
1893static void setredblue(struct gspca_dev *gspca_dev)
1894{
1895 struct sd *sd = (struct sd *) gspca_dev;
1896
1897 if (sd->sensor == SENSOR_PO2030N) {
1898 u8 rg1b[] =
1899 {0xc1, 0x6e, 0x16, 0x00, 0x40, 0x00, 0x00, 0x10};
1900
1901
1902 rg1b[3] = sd->red_bal->val * 2;
1903 rg1b[5] = sd->blue_bal->val * 2;
1904 i2c_w8(gspca_dev, rg1b);
1905 return;
1906 }
1907 reg_w1(gspca_dev, 0x05, sd->red_bal->val);
1908
1909 reg_w1(gspca_dev, 0x06, sd->blue_bal->val);
1910}
1911
1912static void setgamma(struct gspca_dev *gspca_dev)
1913{
1914 struct sd *sd = (struct sd *) gspca_dev;
1915 int i, val;
1916 u8 gamma[17];
1917 const u8 *gamma_base;
1918 static const u8 delta[17] = {
1919 0x00, 0x14, 0x1c, 0x1c, 0x1c, 0x1c, 0x1b, 0x1a,
1920 0x18, 0x13, 0x10, 0x0e, 0x08, 0x07, 0x04, 0x02, 0x00
1921 };
1922
1923 switch (sd->sensor) {
1924 case SENSOR_ADCM1700:
1925 gamma_base = gamma_spec_0;
1926 break;
1927 case SENSOR_HV7131R:
1928 case SENSOR_MI0360B:
1929 case SENSOR_MT9V111:
1930 gamma_base = gamma_spec_1;
1931 break;
1932 case SENSOR_GC0307:
1933 gamma_base = gamma_spec_2;
1934 break;
1935 case SENSOR_SP80708:
1936 gamma_base = gamma_spec_3;
1937 break;
1938 default:
1939 gamma_base = gamma_def;
1940 break;
1941 }
1942
1943 val = sd->gamma->val;
1944 for (i = 0; i < sizeof gamma; i++)
1945 gamma[i] = gamma_base[i]
1946 + delta[i] * (val - GAMMA_DEF) / 32;
1947 reg_w(gspca_dev, 0x20, gamma, sizeof gamma);
1948}
1949
1950static void setexposure(struct gspca_dev *gspca_dev)
1951{
1952 struct sd *sd = (struct sd *) gspca_dev;
1953
1954 if (sd->sensor == SENSOR_PO2030N) {
1955 u8 rexpo[] =
1956 {0xa1, 0x6e, 0x1a, 0x00, 0x40, 0x00, 0x00, 0x10};
1957
1958 rexpo[3] = gspca_dev->exposure->val >> 8;
1959 i2c_w8(gspca_dev, rexpo);
1960 msleep(6);
1961 rexpo[2] = 0x1b;
1962 rexpo[3] = gspca_dev->exposure->val;
1963 i2c_w8(gspca_dev, rexpo);
1964 }
1965}
1966
1967static void setautogain(struct gspca_dev *gspca_dev)
1968{
1969 struct sd *sd = (struct sd *) gspca_dev;
1970
1971 switch (sd->sensor) {
1972 case SENSOR_OV7630:
1973 case SENSOR_OV7648: {
1974 u8 comb;
1975
1976 if (sd->sensor == SENSOR_OV7630)
1977 comb = 0xc0;
1978 else
1979 comb = 0xa0;
1980 if (gspca_dev->autogain->val)
1981 comb |= 0x03;
1982 i2c_w1(&sd->gspca_dev, 0x13, comb);
1983 return;
1984 }
1985 }
1986 if (gspca_dev->autogain->val)
1987 sd->ag_cnt = AG_CNT_START;
1988 else
1989 sd->ag_cnt = -1;
1990}
1991
1992static void setgain(struct gspca_dev *gspca_dev)
1993{
1994 struct sd *sd = (struct sd *) gspca_dev;
1995
1996 if (sd->sensor == SENSOR_PO2030N) {
1997 u8 rgain[] =
1998 {0xa1, 0x6e, 0x15, 0x00, 0x40, 0x00, 0x00, 0x15};
1999
2000 rgain[3] = gspca_dev->gain->val;
2001 i2c_w8(gspca_dev, rgain);
2002 }
2003}
2004
2005static void sethvflip(struct gspca_dev *gspca_dev)
2006{
2007 struct sd *sd = (struct sd *) gspca_dev;
2008 u8 comn;
2009
2010 switch (sd->sensor) {
2011 case SENSOR_HV7131R:
2012 comn = 0x18;
2013 if (sd->vflip->val)
2014 comn |= 0x01;
2015 i2c_w1(gspca_dev, 0x01, comn);
2016 break;
2017 case SENSOR_OV7630:
2018 comn = 0x02;
2019 if (!sd->vflip->val)
2020 comn |= 0x80;
2021 i2c_w1(gspca_dev, 0x75, comn);
2022 break;
2023 case SENSOR_OV7648:
2024 comn = 0x06;
2025 if (sd->vflip->val)
2026 comn |= 0x80;
2027 i2c_w1(gspca_dev, 0x75, comn);
2028 break;
2029 case SENSOR_PO2030N:
2030
2031
2032
2033
2034
2035
2036
2037
2038 comn = 0x0a;
2039 if (sd->hflip->val)
2040 comn |= 0x80;
2041 if (sd->vflip->val)
2042 comn |= 0x40;
2043 i2c_w1(&sd->gspca_dev, 0x1e, comn);
2044 break;
2045 }
2046}
2047
2048static void setsharpness(struct gspca_dev *gspca_dev)
2049{
2050 struct sd *sd = (struct sd *) gspca_dev;
2051
2052 reg_w1(gspca_dev, 0x99, sd->sharpness->val);
2053}
2054
2055static void setillum(struct gspca_dev *gspca_dev)
2056{
2057 struct sd *sd = (struct sd *) gspca_dev;
2058
2059 switch (sd->sensor) {
2060 case SENSOR_ADCM1700:
2061 reg_w1(gspca_dev, 0x02,
2062 sd->illum->val ? 0x64 : 0x60);
2063 break;
2064 case SENSOR_MT9V111:
2065 reg_w1(gspca_dev, 0x02,
2066 sd->illum->val ? 0x77 : 0x74);
2067
2068
2069
2070 break;
2071 }
2072}
2073
2074static void setfreq(struct gspca_dev *gspca_dev)
2075{
2076 struct sd *sd = (struct sd *) gspca_dev;
2077
2078 if (sd->sensor == SENSOR_OV7660) {
2079 u8 com8;
2080
2081 com8 = 0xdf;
2082 switch (sd->freq->val) {
2083 case 0:
2084 i2c_w1(gspca_dev, 0x13, com8 | 0x20);
2085 break;
2086 case 1:
2087 i2c_w1(gspca_dev, 0x13, com8);
2088 i2c_w1(gspca_dev, 0x3b, 0x0a);
2089 break;
2090 case 2:
2091 i2c_w1(gspca_dev, 0x13, com8);
2092 i2c_w1(gspca_dev, 0x3b, 0x02);
2093 break;
2094 }
2095 } else {
2096 u8 reg2a = 0, reg2b = 0, reg2d = 0;
2097
2098
2099 switch (sd->sensor) {
2100 case SENSOR_OV7630:
2101 reg2a = 0x08;
2102 reg2d = 0x01;
2103 break;
2104 case SENSOR_OV7648:
2105 reg2a = 0x11;
2106 reg2d = 0x81;
2107 break;
2108 }
2109
2110 switch (sd->freq->val) {
2111 case 0:
2112 break;
2113 case 1:
2114 reg2a |= 0x80;
2115 reg2b = 0xac;
2116 reg2d |= 0x04;
2117 break;
2118 case 2:
2119 reg2a |= 0x80;
2120 reg2d |= 0x04;
2121 break;
2122 }
2123 i2c_w1(gspca_dev, 0x2a, reg2a);
2124 i2c_w1(gspca_dev, 0x2b, reg2b);
2125 i2c_w1(gspca_dev, 0x2d, reg2d);
2126 }
2127}
2128
2129static void setjpegqual(struct gspca_dev *gspca_dev)
2130{
2131 struct sd *sd = (struct sd *) gspca_dev;
2132
2133 jpeg_set_qual(sd->jpeg_hdr, sd->quality);
2134#if USB_BUF_SZ < 64
2135#error "No room enough in usb_buf for quantization table"
2136#endif
2137 memcpy(gspca_dev->usb_buf, &sd->jpeg_hdr[JPEG_QT0_OFFSET], 64);
2138 usb_control_msg(gspca_dev->dev,
2139 usb_sndctrlpipe(gspca_dev->dev, 0),
2140 0x08,
2141 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
2142 0x0100, 0,
2143 gspca_dev->usb_buf, 64,
2144 500);
2145 memcpy(gspca_dev->usb_buf, &sd->jpeg_hdr[JPEG_QT1_OFFSET], 64);
2146 usb_control_msg(gspca_dev->dev,
2147 usb_sndctrlpipe(gspca_dev->dev, 0),
2148 0x08,
2149 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
2150 0x0140, 0,
2151 gspca_dev->usb_buf, 64,
2152 500);
2153
2154 sd->reg18 ^= 0x40;
2155 reg_w1(gspca_dev, 0x18, sd->reg18);
2156}
2157
2158
2159
2160static void qual_upd(struct work_struct *work)
2161{
2162 struct sd *sd = container_of(work, struct sd, work);
2163 struct gspca_dev *gspca_dev = &sd->gspca_dev;
2164
2165
2166 mutex_lock(&gspca_dev->usb_lock);
2167 gspca_dbg(gspca_dev, D_STREAM, "qual_upd %d%%\n", sd->quality);
2168 gspca_dev->usb_err = 0;
2169 setjpegqual(gspca_dev);
2170 mutex_unlock(&gspca_dev->usb_lock);
2171}
2172
2173
2174static int sd_start(struct gspca_dev *gspca_dev)
2175{
2176 struct sd *sd = (struct sd *) gspca_dev;
2177 int i;
2178 u8 reg01, reg17;
2179 u8 reg0102[2];
2180 const u8 *sn9c1xx;
2181 const u8 (*init)[8];
2182 const u8 *reg9a;
2183 int mode;
2184 static const u8 reg9a_def[] =
2185 {0x00, 0x40, 0x20, 0x00, 0x00, 0x00};
2186 static const u8 reg9a_spec[] =
2187 {0x00, 0x40, 0x38, 0x30, 0x00, 0x20};
2188 static const u8 regd4[] = {0x60, 0x00, 0x00};
2189 static const u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f };
2190 static const u8 CA[] = { 0x28, 0xd8, 0x14, 0xec };
2191 static const u8 CA_adcm1700[] =
2192 { 0x14, 0xec, 0x0a, 0xf6 };
2193 static const u8 CA_po2030n[] =
2194 { 0x1e, 0xe2, 0x14, 0xec };
2195 static const u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd };
2196 static const u8 CE_gc0307[] =
2197 { 0x32, 0xce, 0x2d, 0xd3 };
2198 static const u8 CE_ov76xx[] =
2199 { 0x32, 0xdd, 0x32, 0xdd };
2200 static const u8 CE_po2030n[] =
2201 { 0x14, 0xe7, 0x1e, 0xdd };
2202
2203
2204 jpeg_define(sd->jpeg_hdr, gspca_dev->pixfmt.height,
2205 gspca_dev->pixfmt.width,
2206 0x21);
2207
2208
2209 sn9c1xx = sn_tb[sd->sensor];
2210
2211
2212
2213 reg01 = sn9c1xx[1];
2214 if (sd->flags & F_PDN_INV)
2215 reg01 ^= S_PDN_INV;
2216 reg_w1(gspca_dev, 0x01, reg01);
2217
2218
2219 reg0102[0] = reg01;
2220 reg0102[1] = sn9c1xx[2];
2221 if (gspca_dev->audio)
2222 reg0102[1] |= 0x04;
2223 reg_w(gspca_dev, 0x01, reg0102, 2);
2224 reg_w(gspca_dev, 0x08, &sn9c1xx[8], 2);
2225 reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 5);
2226 switch (sd->sensor) {
2227 case SENSOR_GC0307:
2228 case SENSOR_OV7660:
2229 case SENSOR_PO1030:
2230 case SENSOR_PO2030N:
2231 case SENSOR_SOI768:
2232 case SENSOR_SP80708:
2233 reg9a = reg9a_spec;
2234 break;
2235 default:
2236 reg9a = reg9a_def;
2237 break;
2238 }
2239 reg_w(gspca_dev, 0x9a, reg9a, 6);
2240
2241 reg_w(gspca_dev, 0xd4, regd4, sizeof regd4);
2242
2243 reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f);
2244
2245 reg17 = sn9c1xx[0x17];
2246 switch (sd->sensor) {
2247 case SENSOR_GC0307:
2248 msleep(50);
2249 break;
2250 case SENSOR_OM6802:
2251 msleep(10);
2252 reg_w1(gspca_dev, 0x02, 0x73);
2253 reg17 |= SEN_CLK_EN;
2254 reg_w1(gspca_dev, 0x17, reg17);
2255 reg_w1(gspca_dev, 0x01, 0x22);
2256 msleep(100);
2257 reg01 = SCL_SEL_OD | S_PDN_INV;
2258 reg17 &= ~MCK_SIZE_MASK;
2259 reg17 |= 0x04;
2260 break;
2261 }
2262 reg01 |= SYS_SEL_48M;
2263 reg_w1(gspca_dev, 0x01, reg01);
2264 reg17 |= SEN_CLK_EN;
2265 reg_w1(gspca_dev, 0x17, reg17);
2266 reg01 &= ~S_PWR_DN;
2267 reg_w1(gspca_dev, 0x01, reg01);
2268 reg01 &= ~SCL_SEL_OD;
2269 reg_w1(gspca_dev, 0x01, reg01);
2270
2271 switch (sd->sensor) {
2272 case SENSOR_HV7131R:
2273 hv7131r_probe(gspca_dev);
2274 break;
2275 case SENSOR_OM6802:
2276 msleep(10);
2277 reg_w1(gspca_dev, 0x01, reg01);
2278 i2c_w8(gspca_dev, om6802_init0[0]);
2279 i2c_w8(gspca_dev, om6802_init0[1]);
2280 msleep(15);
2281 reg_w1(gspca_dev, 0x02, 0x71);
2282 msleep(150);
2283 break;
2284 case SENSOR_SP80708:
2285 msleep(100);
2286 reg_w1(gspca_dev, 0x02, 0x62);
2287 break;
2288 }
2289
2290
2291 i2c_w_seq(gspca_dev, sensor_init[sd->sensor]);
2292
2293 reg_w1(gspca_dev, 0x15, sn9c1xx[0x15]);
2294 reg_w1(gspca_dev, 0x16, sn9c1xx[0x16]);
2295 reg_w1(gspca_dev, 0x12, sn9c1xx[0x12]);
2296 reg_w1(gspca_dev, 0x13, sn9c1xx[0x13]);
2297 reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]);
2298 if (sd->sensor == SENSOR_ADCM1700) {
2299 reg_w1(gspca_dev, 0xd2, 0x3a);
2300 reg_w1(gspca_dev, 0xd3, 0x30);
2301 } else {
2302 reg_w1(gspca_dev, 0xd2, 0x6a);
2303 reg_w1(gspca_dev, 0xd3, 0x50);
2304 }
2305 reg_w1(gspca_dev, 0xc6, 0x00);
2306 reg_w1(gspca_dev, 0xc7, 0x00);
2307 if (sd->sensor == SENSOR_ADCM1700) {
2308 reg_w1(gspca_dev, 0xc8, 0x2c);
2309 reg_w1(gspca_dev, 0xc9, 0x24);
2310 } else {
2311 reg_w1(gspca_dev, 0xc8, 0x50);
2312 reg_w1(gspca_dev, 0xc9, 0x3c);
2313 }
2314 reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]);
2315 switch (sd->sensor) {
2316 case SENSOR_OM6802:
2317
2318 break;
2319 default:
2320 reg17 |= DEF_EN;
2321 break;
2322 }
2323 reg_w1(gspca_dev, 0x17, reg17);
2324
2325 reg_w1(gspca_dev, 0x05, 0x00);
2326 reg_w1(gspca_dev, 0x07, 0x00);
2327 reg_w1(gspca_dev, 0x06, 0x00);
2328 reg_w1(gspca_dev, 0x14, sn9c1xx[0x14]);
2329
2330 setgamma(gspca_dev);
2331
2332
2333 for (i = 0; i < 8; i++)
2334 reg_w(gspca_dev, 0x84, reg84, sizeof reg84);
2335 switch (sd->sensor) {
2336 case SENSOR_ADCM1700:
2337 case SENSOR_OV7660:
2338 case SENSOR_SP80708:
2339 reg_w1(gspca_dev, 0x9a, 0x05);
2340 break;
2341 case SENSOR_GC0307:
2342 case SENSOR_MT9V111:
2343 case SENSOR_MI0360B:
2344 reg_w1(gspca_dev, 0x9a, 0x07);
2345 break;
2346 case SENSOR_OV7630:
2347 case SENSOR_OV7648:
2348 reg_w1(gspca_dev, 0x9a, 0x0a);
2349 break;
2350 case SENSOR_PO2030N:
2351 case SENSOR_SOI768:
2352 reg_w1(gspca_dev, 0x9a, 0x06);
2353 break;
2354 default:
2355 reg_w1(gspca_dev, 0x9a, 0x08);
2356 break;
2357 }
2358 setsharpness(gspca_dev);
2359
2360 reg_w(gspca_dev, 0x84, reg84, sizeof reg84);
2361 reg_w1(gspca_dev, 0x05, 0x20);
2362 reg_w1(gspca_dev, 0x07, 0x20);
2363 reg_w1(gspca_dev, 0x06, 0x20);
2364
2365 init = NULL;
2366 mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv;
2367 reg01 |= SYS_SEL_48M | V_TX_EN;
2368 reg17 &= ~MCK_SIZE_MASK;
2369 reg17 |= 0x02;
2370 switch (sd->sensor) {
2371 case SENSOR_ADCM1700:
2372 init = adcm1700_sensor_param1;
2373 break;
2374 case SENSOR_GC0307:
2375 init = gc0307_sensor_param1;
2376 break;
2377 case SENSOR_HV7131R:
2378 case SENSOR_MI0360:
2379 if (!mode)
2380 reg01 &= ~SYS_SEL_48M;
2381 reg17 &= ~MCK_SIZE_MASK;
2382 reg17 |= 0x01;
2383 break;
2384 case SENSOR_MI0360B:
2385 init = mi0360b_sensor_param1;
2386 break;
2387 case SENSOR_MO4000:
2388 if (mode) {
2389 reg01 &= ~SYS_SEL_48M;
2390 reg17 &= ~MCK_SIZE_MASK;
2391 reg17 |= 0x01;
2392 }
2393 break;
2394 case SENSOR_MT9V111:
2395 init = mt9v111_sensor_param1;
2396 break;
2397 case SENSOR_OM6802:
2398 init = om6802_sensor_param1;
2399 if (!mode) {
2400 reg17 &= ~MCK_SIZE_MASK;
2401 reg17 |= 0x04;
2402 } else {
2403 reg01 &= ~SYS_SEL_48M;
2404 reg17 &= ~MCK_SIZE_MASK;
2405 reg17 |= 0x02;
2406 }
2407 break;
2408 case SENSOR_OV7630:
2409 init = ov7630_sensor_param1;
2410 break;
2411 case SENSOR_OV7648:
2412 init = ov7648_sensor_param1;
2413 reg17 &= ~MCK_SIZE_MASK;
2414 reg17 |= 0x01;
2415 break;
2416 case SENSOR_OV7660:
2417 init = ov7660_sensor_param1;
2418 break;
2419 case SENSOR_PO1030:
2420 init = po1030_sensor_param1;
2421 break;
2422 case SENSOR_PO2030N:
2423 init = po2030n_sensor_param1;
2424 break;
2425 case SENSOR_SOI768:
2426 init = soi768_sensor_param1;
2427 break;
2428 case SENSOR_SP80708:
2429 init = sp80708_sensor_param1;
2430 break;
2431 }
2432
2433
2434 if (init != NULL) {
2435 i2c_w_seq(gspca_dev, init);
2436
2437 }
2438
2439 reg_w(gspca_dev, 0xc0, C0, 6);
2440 switch (sd->sensor) {
2441 case SENSOR_ADCM1700:
2442 case SENSOR_GC0307:
2443 case SENSOR_SOI768:
2444 reg_w(gspca_dev, 0xca, CA_adcm1700, 4);
2445 break;
2446 case SENSOR_PO2030N:
2447 reg_w(gspca_dev, 0xca, CA_po2030n, 4);
2448 break;
2449 default:
2450 reg_w(gspca_dev, 0xca, CA, 4);
2451 break;
2452 }
2453 switch (sd->sensor) {
2454 case SENSOR_ADCM1700:
2455 case SENSOR_OV7630:
2456 case SENSOR_OV7648:
2457 case SENSOR_OV7660:
2458 case SENSOR_SOI768:
2459 reg_w(gspca_dev, 0xce, CE_ov76xx, 4);
2460 break;
2461 case SENSOR_GC0307:
2462 reg_w(gspca_dev, 0xce, CE_gc0307, 4);
2463 break;
2464 case SENSOR_PO2030N:
2465 reg_w(gspca_dev, 0xce, CE_po2030n, 4);
2466 break;
2467 default:
2468 reg_w(gspca_dev, 0xce, CE, 4);
2469
2470 break;
2471 }
2472
2473
2474 sd->reg18 = sn9c1xx[0x18] | (mode << 4) | 0x40;
2475 reg_w1(gspca_dev, 0x18, sd->reg18);
2476 setjpegqual(gspca_dev);
2477
2478 reg_w1(gspca_dev, 0x17, reg17);
2479 reg_w1(gspca_dev, 0x01, reg01);
2480 sd->reg01 = reg01;
2481 sd->reg17 = reg17;
2482
2483 sd->pktsz = sd->npkt = 0;
2484 sd->nchg = sd->short_mark = 0;
2485
2486 return gspca_dev->usb_err;
2487}
2488
2489static void sd_stopN(struct gspca_dev *gspca_dev)
2490{
2491 struct sd *sd = (struct sd *) gspca_dev;
2492 static const u8 stophv7131[] =
2493 { 0xa1, 0x11, 0x02, 0x09, 0x00, 0x00, 0x00, 0x10 };
2494 static const u8 stopmi0360[] =
2495 { 0xb1, 0x5d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10 };
2496 static const u8 stopov7648[] =
2497 { 0xa1, 0x21, 0x76, 0x20, 0x00, 0x00, 0x00, 0x10 };
2498 static const u8 stopsoi768[] =
2499 { 0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10 };
2500 u8 reg01;
2501 u8 reg17;
2502
2503 reg01 = sd->reg01;
2504 reg17 = sd->reg17 & ~SEN_CLK_EN;
2505 switch (sd->sensor) {
2506 case SENSOR_ADCM1700:
2507 case SENSOR_GC0307:
2508 case SENSOR_PO2030N:
2509 case SENSOR_SP80708:
2510 reg01 |= LED;
2511 reg_w1(gspca_dev, 0x01, reg01);
2512 reg01 &= ~(LED | V_TX_EN);
2513 reg_w1(gspca_dev, 0x01, reg01);
2514
2515 break;
2516 case SENSOR_HV7131R:
2517 reg01 &= ~V_TX_EN;
2518 reg_w1(gspca_dev, 0x01, reg01);
2519 i2c_w8(gspca_dev, stophv7131);
2520 break;
2521 case SENSOR_MI0360:
2522 case SENSOR_MI0360B:
2523 reg01 &= ~V_TX_EN;
2524 reg_w1(gspca_dev, 0x01, reg01);
2525
2526 i2c_w8(gspca_dev, stopmi0360);
2527 break;
2528 case SENSOR_MT9V111:
2529 case SENSOR_OM6802:
2530 case SENSOR_PO1030:
2531 reg01 &= ~V_TX_EN;
2532 reg_w1(gspca_dev, 0x01, reg01);
2533 break;
2534 case SENSOR_OV7630:
2535 case SENSOR_OV7648:
2536 reg01 &= ~V_TX_EN;
2537 reg_w1(gspca_dev, 0x01, reg01);
2538 i2c_w8(gspca_dev, stopov7648);
2539 break;
2540 case SENSOR_OV7660:
2541 reg01 &= ~V_TX_EN;
2542 reg_w1(gspca_dev, 0x01, reg01);
2543 break;
2544 case SENSOR_SOI768:
2545 i2c_w8(gspca_dev, stopsoi768);
2546 break;
2547 }
2548
2549 reg01 |= SCL_SEL_OD;
2550 reg_w1(gspca_dev, 0x01, reg01);
2551 reg01 |= S_PWR_DN;
2552 reg_w1(gspca_dev, 0x01, reg01);
2553 reg_w1(gspca_dev, 0x17, reg17);
2554 reg01 &= ~SYS_SEL_48M;
2555 reg_w1(gspca_dev, 0x01, reg01);
2556 reg01 |= LED;
2557 reg_w1(gspca_dev, 0x01, reg01);
2558
2559
2560}
2561
2562
2563
2564static void sd_stop0(struct gspca_dev *gspca_dev)
2565{
2566 struct sd *sd = (struct sd *) gspca_dev;
2567
2568 mutex_unlock(&gspca_dev->usb_lock);
2569 flush_work(&sd->work);
2570 mutex_lock(&gspca_dev->usb_lock);
2571}
2572
2573static void do_autogain(struct gspca_dev *gspca_dev)
2574{
2575 struct sd *sd = (struct sd *) gspca_dev;
2576 int delta;
2577 int expotimes;
2578 u8 luma_mean = 130;
2579 u8 luma_delta = 20;
2580
2581
2582 if (sd->ag_cnt < 0)
2583 return;
2584 if (--sd->ag_cnt >= 0)
2585 return;
2586 sd->ag_cnt = AG_CNT_START;
2587
2588 delta = atomic_read(&sd->avg_lum);
2589 gspca_dbg(gspca_dev, D_FRAM, "mean lum %d\n", delta);
2590
2591 if (sd->sensor == SENSOR_PO2030N) {
2592 gspca_expo_autogain(gspca_dev, delta, luma_mean, luma_delta,
2593 15, 1024);
2594 return;
2595 }
2596
2597 if (delta < luma_mean - luma_delta ||
2598 delta > luma_mean + luma_delta) {
2599 switch (sd->sensor) {
2600 case SENSOR_GC0307:
2601 expotimes = sd->exposure;
2602 expotimes += (luma_mean - delta) >> 6;
2603 if (expotimes < 0)
2604 expotimes = 0;
2605 sd->exposure = expo_adjust(gspca_dev,
2606 (unsigned int) expotimes);
2607 break;
2608 case SENSOR_HV7131R:
2609 expotimes = sd->exposure >> 8;
2610 expotimes += (luma_mean - delta) >> 4;
2611 if (expotimes < 0)
2612 expotimes = 0;
2613 sd->exposure = expo_adjust(gspca_dev,
2614 (unsigned int) (expotimes << 8));
2615 break;
2616 case SENSOR_OM6802:
2617 case SENSOR_MT9V111:
2618 expotimes = sd->exposure;
2619 expotimes += (luma_mean - delta) >> 2;
2620 if (expotimes < 0)
2621 expotimes = 0;
2622 sd->exposure = expo_adjust(gspca_dev,
2623 (unsigned int) expotimes);
2624 setredblue(gspca_dev);
2625 break;
2626 default:
2627
2628
2629
2630 expotimes = sd->exposure;
2631 expotimes += (luma_mean - delta) >> 6;
2632 if (expotimes < 0)
2633 expotimes = 0;
2634 sd->exposure = expo_adjust(gspca_dev,
2635 (unsigned int) expotimes);
2636 setredblue(gspca_dev);
2637 break;
2638 }
2639 }
2640}
2641
2642
2643static void set_lum(struct sd *sd,
2644 u8 *data)
2645{
2646 int avg_lum;
2647
2648
2649
2650
2651
2652 avg_lum = (data[27] << 8) + data[28]
2653
2654 + (data[31] << 8) + data[32]
2655
2656 + (data[23] << 8) + data[24]
2657
2658 + (data[35] << 8) + data[36]
2659
2660 + (data[29] << 10) + (data[30] << 2);
2661 avg_lum >>= 10;
2662 atomic_set(&sd->avg_lum, avg_lum);
2663}
2664
2665
2666
2667static void sd_pkt_scan(struct gspca_dev *gspca_dev,
2668 u8 *data,
2669 int len)
2670{
2671 struct sd *sd = (struct sd *) gspca_dev;
2672 int i, new_qual;
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691 sd->npkt++;
2692 sd->pktsz += len;
2693
2694
2695
2696
2697
2698
2699 i = sd->short_mark;
2700 if (i != 0) {
2701 sd->short_mark = 0;
2702 if (i < 0
2703 && data[0] == 0xff
2704 && data[1] == 0x00)
2705 goto marker_found;
2706 if (data[0] == 0xff && data[1] == 0xff) {
2707 i = 0;
2708 goto marker_found;
2709 }
2710 len -= i;
2711 if (len <= 0)
2712 return;
2713 data += i;
2714 }
2715
2716
2717 for (i = len - 1; --i >= 0; ) {
2718 if (data[i] != 0xff) {
2719 i--;
2720 continue;
2721 }
2722 if (data[i + 1] == 0xff) {
2723
2724
2725 if (i + 2 >= len || data[i + 2] == 0x00)
2726 goto marker_found;
2727 }
2728 }
2729
2730
2731
2732 if (data[len - 1] == 0xff)
2733 sd->short_mark = -1;
2734 if (gspca_dev->last_packet_type == LAST_PACKET)
2735 gspca_frame_add(gspca_dev, FIRST_PACKET,
2736 sd->jpeg_hdr, JPEG_HDR_SZ);
2737 gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
2738 return;
2739
2740
2741
2742marker_found:
2743 new_qual = 0;
2744 if (i > 2) {
2745 if (data[i - 2] != 0xff || data[i - 1] != 0xd9) {
2746 gspca_dev->last_packet_type = DISCARD_PACKET;
2747 new_qual = -3;
2748 }
2749 } else if (i + 6 < len) {
2750 if (data[i + 6] & 0x08) {
2751 gspca_dev->last_packet_type = DISCARD_PACKET;
2752 new_qual = -5;
2753 }
2754 }
2755
2756 gspca_frame_add(gspca_dev, LAST_PACKET, data, i);
2757
2758
2759 if (new_qual == 0) {
2760 int r;
2761
2762 r = (sd->pktsz * 100) /
2763 (sd->npkt *
2764 gspca_dev->urb[0]->iso_frame_desc[0].length);
2765 if (r >= 85)
2766 new_qual = -3;
2767 else if (r < 75)
2768 new_qual = 2;
2769 }
2770 if (new_qual != 0) {
2771 sd->nchg += new_qual;
2772 if (sd->nchg < -6 || sd->nchg >= 12) {
2773 sd->nchg = 0;
2774 new_qual += sd->quality;
2775 if (new_qual < QUALITY_MIN)
2776 new_qual = QUALITY_MIN;
2777 else if (new_qual > QUALITY_MAX)
2778 new_qual = QUALITY_MAX;
2779 if (new_qual != sd->quality) {
2780 sd->quality = new_qual;
2781 schedule_work(&sd->work);
2782 }
2783 }
2784 } else {
2785 sd->nchg = 0;
2786 }
2787 sd->pktsz = sd->npkt = 0;
2788
2789
2790
2791 if (i + 62 > len) {
2792 sd->short_mark = i + 62 - len;
2793 return;
2794 }
2795 if (sd->ag_cnt >= 0)
2796 set_lum(sd, data + i);
2797
2798
2799 i += 62;
2800 if (i < len) {
2801 data += i;
2802 len -= i;
2803 gspca_frame_add(gspca_dev, FIRST_PACKET,
2804 sd->jpeg_hdr, JPEG_HDR_SZ);
2805 gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
2806 }
2807}
2808
2809static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
2810{
2811 struct gspca_dev *gspca_dev =
2812 container_of(ctrl->handler, struct gspca_dev, ctrl_handler);
2813
2814 gspca_dev->usb_err = 0;
2815
2816 if (!gspca_dev->streaming)
2817 return 0;
2818
2819 switch (ctrl->id) {
2820 case V4L2_CID_BRIGHTNESS:
2821 setbrightness(gspca_dev);
2822 break;
2823 case V4L2_CID_CONTRAST:
2824 setcontrast(gspca_dev);
2825 break;
2826 case V4L2_CID_SATURATION:
2827 setcolors(gspca_dev);
2828 break;
2829 case V4L2_CID_RED_BALANCE:
2830 setredblue(gspca_dev);
2831 break;
2832 case V4L2_CID_GAMMA:
2833 setgamma(gspca_dev);
2834 break;
2835 case V4L2_CID_AUTOGAIN:
2836 setautogain(gspca_dev);
2837 setexposure(gspca_dev);
2838 setgain(gspca_dev);
2839 break;
2840 case V4L2_CID_VFLIP:
2841 sethvflip(gspca_dev);
2842 break;
2843 case V4L2_CID_SHARPNESS:
2844 setsharpness(gspca_dev);
2845 break;
2846 case V4L2_CID_ILLUMINATORS_1:
2847 setillum(gspca_dev);
2848 break;
2849 case V4L2_CID_POWER_LINE_FREQUENCY:
2850 setfreq(gspca_dev);
2851 break;
2852 default:
2853 return -EINVAL;
2854 }
2855 return gspca_dev->usb_err;
2856}
2857
2858#if IS_ENABLED(CONFIG_INPUT)
2859static int sd_int_pkt_scan(struct gspca_dev *gspca_dev,
2860 u8 *data,
2861 int len)
2862{
2863 int ret = -EINVAL;
2864
2865 if (len == 1 && data[0] == 1) {
2866 input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1);
2867 input_sync(gspca_dev->input_dev);
2868 input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0);
2869 input_sync(gspca_dev->input_dev);
2870 ret = 0;
2871 }
2872
2873 return ret;
2874}
2875#endif
2876
2877
2878static const struct sd_desc sd_desc = {
2879 .name = MODULE_NAME,
2880 .config = sd_config,
2881 .init = sd_init,
2882 .init_controls = sd_init_controls,
2883 .start = sd_start,
2884 .stopN = sd_stopN,
2885 .stop0 = sd_stop0,
2886 .pkt_scan = sd_pkt_scan,
2887 .dq_callback = do_autogain,
2888#if IS_ENABLED(CONFIG_INPUT)
2889 .int_pkt_scan = sd_int_pkt_scan,
2890#endif
2891};
2892
2893
2894#define BS(bridge, sensor) \
2895 .driver_info = (BRIDGE_ ## bridge << 16) \
2896 | (SENSOR_ ## sensor << 8)
2897#define BSF(bridge, sensor, flags) \
2898 .driver_info = (BRIDGE_ ## bridge << 16) \
2899 | (SENSOR_ ## sensor << 8) \
2900 | (flags)
2901static const struct usb_device_id device_table[] = {
2902 {USB_DEVICE(0x0458, 0x7025), BSF(SN9C120, MI0360B, F_PDN_INV)},
2903 {USB_DEVICE(0x0458, 0x702e), BS(SN9C120, OV7660)},
2904 {USB_DEVICE(0x045e, 0x00f5), BSF(SN9C105, OV7660, F_PDN_INV)},
2905 {USB_DEVICE(0x045e, 0x00f7), BSF(SN9C105, OV7660, F_PDN_INV)},
2906 {USB_DEVICE(0x0471, 0x0327), BS(SN9C105, MI0360)},
2907 {USB_DEVICE(0x0471, 0x0328), BS(SN9C105, MI0360)},
2908 {USB_DEVICE(0x0471, 0x0330), BS(SN9C105, MI0360)},
2909 {USB_DEVICE(0x06f8, 0x3004), BS(SN9C105, OV7660)},
2910 {USB_DEVICE(0x06f8, 0x3008), BS(SN9C105, OV7660)},
2911
2912 {USB_DEVICE(0x0c45, 0x6040), BS(SN9C102P, HV7131R)},
2913
2914
2915 {USB_DEVICE(0x0c45, 0x607c), BS(SN9C102P, HV7131R)},
2916
2917 {USB_DEVICE(0x0c45, 0x60c0), BSF(SN9C105, MI0360, F_ILLUM)},
2918
2919
2920
2921
2922 {USB_DEVICE(0x0c45, 0x60ce), BS(SN9C105, SP80708)},
2923 {USB_DEVICE(0x0c45, 0x60ec), BS(SN9C105, MO4000)},
2924
2925
2926
2927 {USB_DEVICE(0x0c45, 0x60fb), BS(SN9C105, OV7660)},
2928 {USB_DEVICE(0x0c45, 0x60fc), BS(SN9C105, HV7131R)},
2929 {USB_DEVICE(0x0c45, 0x60fe), BS(SN9C105, OV7630)},
2930 {USB_DEVICE(0x0c45, 0x6100), BS(SN9C120, MI0360)},
2931 {USB_DEVICE(0x0c45, 0x6102), BS(SN9C120, PO2030N)},
2932
2933 {USB_DEVICE(0x0c45, 0x610a), BS(SN9C120, OV7648)},
2934 {USB_DEVICE(0x0c45, 0x610b), BS(SN9C120, OV7660)},
2935 {USB_DEVICE(0x0c45, 0x610c), BS(SN9C120, HV7131R)},
2936 {USB_DEVICE(0x0c45, 0x610e), BS(SN9C120, OV7630)},
2937
2938
2939
2940 {USB_DEVICE(0x0c45, 0x6128), BS(SN9C120, OM6802)},
2941
2942 {USB_DEVICE(0x0c45, 0x612a), BS(SN9C120, OV7648)},
2943 {USB_DEVICE(0x0c45, 0x612b), BS(SN9C110, ADCM1700)},
2944 {USB_DEVICE(0x0c45, 0x612c), BS(SN9C110, MO4000)},
2945 {USB_DEVICE(0x0c45, 0x612e), BS(SN9C110, OV7630)},
2946
2947 {USB_DEVICE(0x0c45, 0x6130), BS(SN9C120, MI0360)},
2948
2949
2950 {USB_DEVICE(0x0c45, 0x6138), BS(SN9C120, MO4000)},
2951 {USB_DEVICE(0x0c45, 0x613a), BS(SN9C120, OV7648)},
2952 {USB_DEVICE(0x0c45, 0x613b), BS(SN9C120, OV7660)},
2953 {USB_DEVICE(0x0c45, 0x613c), BS(SN9C120, HV7131R)},
2954 {USB_DEVICE(0x0c45, 0x613e), BS(SN9C120, OV7630)},
2955 {USB_DEVICE(0x0c45, 0x6142), BS(SN9C120, PO2030N)},
2956
2957 {USB_DEVICE(0x0c45, 0x6143), BS(SN9C120, SP80708)},
2958 {USB_DEVICE(0x0c45, 0x6148), BS(SN9C120, OM6802)},
2959 {USB_DEVICE(0x0c45, 0x614a), BSF(SN9C120, ADCM1700, F_ILLUM)},
2960
2961 {}
2962};
2963MODULE_DEVICE_TABLE(usb, device_table);
2964
2965
2966static int sd_probe(struct usb_interface *intf,
2967 const struct usb_device_id *id)
2968{
2969 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
2970 THIS_MODULE);
2971}
2972
2973static struct usb_driver sd_driver = {
2974 .name = MODULE_NAME,
2975 .id_table = device_table,
2976 .probe = sd_probe,
2977 .disconnect = gspca_disconnect,
2978#ifdef CONFIG_PM
2979 .suspend = gspca_suspend,
2980 .resume = gspca_resume,
2981 .reset_resume = gspca_resume,
2982#endif
2983};
2984
2985module_usb_driver(sd_driver);
2986