xref: /linux/drivers/media/usb/gspca/spca501.c (revision e7d759f31ca295d589f7420719c311870bb3166f)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * SPCA501 chip based cameras initialization data
4  *
5  * V4L2 by Jean-Francois Moine <http://moinejf.free.fr>
6  */
7 
8 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
9 
10 #define MODULE_NAME "spca501"
11 
12 #include "gspca.h"
13 
14 MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
15 MODULE_DESCRIPTION("GSPCA/SPCA501 USB Camera Driver");
16 MODULE_LICENSE("GPL");
17 
18 /* specific webcam descriptor */
19 struct sd {
20 	struct gspca_dev gspca_dev;	/* !! must be the first item */
21 
22 	unsigned short contrast;
23 	__u8 brightness;
24 	__u8 colors;
25 	__u8 blue_balance;
26 	__u8 red_balance;
27 
28 	char subtype;
29 #define Arowana300KCMOSCamera 0
30 #define IntelCreateAndShare 1
31 #define KodakDVC325 2
32 #define MystFromOriUnknownCamera 3
33 #define SmileIntlCamera 4
34 #define ThreeComHomeConnectLite 5
35 #define ViewQuestM318B 6
36 };
37 
38 static const struct v4l2_pix_format vga_mode[] = {
39 	{160, 120, V4L2_PIX_FMT_SPCA501, V4L2_FIELD_NONE,
40 		.bytesperline = 160,
41 		.sizeimage = 160 * 120 * 3 / 2,
42 		.colorspace = V4L2_COLORSPACE_SRGB,
43 		.priv = 2},
44 	{320, 240, V4L2_PIX_FMT_SPCA501, V4L2_FIELD_NONE,
45 		.bytesperline = 320,
46 		.sizeimage = 320 * 240 * 3 / 2,
47 		.colorspace = V4L2_COLORSPACE_SRGB,
48 		.priv = 1},
49 	{640, 480, V4L2_PIX_FMT_SPCA501, V4L2_FIELD_NONE,
50 		.bytesperline = 640,
51 		.sizeimage = 640 * 480 * 3 / 2,
52 		.colorspace = V4L2_COLORSPACE_SRGB,
53 		.priv = 0},
54 };
55 
56 #define SPCA50X_REG_USB 0x2	/* spca505 501 */
57 /*
58  * Data to initialize a SPCA501. From a capture file provided by Bill Roehl
59  * With SPCA501 chip description
60  */
61 #define CCDSP_SET		/* set CCDSP parameters */
62 #define TG_SET			/* set time generator set */
63 #undef DSPWIN_SET		/* set DSP windows parameters */
64 #undef ALTER_GAMA	/* Set alternate set to YUV transform coeffs. */
65 #define SPCA501_SNAPBIT 0x80
66 #define SPCA501_SNAPCTRL 0x10
67 /* Frame packet header offsets for the spca501 */
68 #define SPCA501_OFFSET_GPIO   1
69 #define SPCA501_OFFSET_TYPE   2
70 #define SPCA501_OFFSET_TURN3A 3
71 #define SPCA501_OFFSET_FRAMSEQ 4
72 #define SPCA501_OFFSET_COMPRESS 5
73 #define SPCA501_OFFSET_QUANT 6
74 #define SPCA501_OFFSET_QUANT2 7
75 #define SPCA501_OFFSET_DATA 8
76 
77 #define SPCA501_PROP_COMP_ENABLE(d) ((d) & 1)
78 #define SPCA501_PROP_SNAP(d) ((d) & 0x40)
79 #define SPCA501_PROP_SNAP_CTRL(d) ((d) & 0x10)
80 #define SPCA501_PROP_COMP_THRESH(d) (((d) & 0x0e) >> 1)
81 #define SPCA501_PROP_COMP_QUANT(d) (((d) & 0x70) >> 4)
82 
83 /* SPCA501 CCDSP control */
84 #define SPCA501_REG_CCDSP 0x01
85 /* SPCA501 control/status registers */
86 #define SPCA501_REG_CTLRL 0x02
87 
88 /* registers for color correction and YUV transformation */
89 #define SPCA501_A11 0x08
90 #define SPCA501_A12 0x09
91 #define SPCA501_A13 0x0A
92 #define SPCA501_A21 0x0B
93 #define SPCA501_A22 0x0C
94 #define SPCA501_A23 0x0D
95 #define SPCA501_A31 0x0E
96 #define SPCA501_A32 0x0F
97 #define SPCA501_A33 0x10
98 
99 /* Data for video camera initialization before capturing */
100 static const __u16 spca501_open_data[][3] = {
101 	/* bmRequest,value,index */
102 
103 	{0x2, 0x50, 0x00},	/* C/S enable soft reset */
104 	{0x2, 0x40, 0x00},	/* C/S disable soft reset */
105 	{0x2, 0x02, 0x05},	/* C/S general purpose I/O data */
106 	{0x2, 0x03, 0x05},	/* C/S general purpose I/O data */
107 
108 #ifdef CCDSP_SET
109 	{0x1, 0x38, 0x01},	/* CCDSP options */
110 	{0x1, 0x05, 0x02}, /* CCDSP Optical black level for user settings */
111 	{0x1, 0xC0, 0x03},	/* CCDSP Optical black settings */
112 
113 	{0x1, 0x67, 0x07},
114 	{0x1, 0x63, 0x3f},	/* CCDSP CCD gamma enable */
115 	{0x1, 0x03, 0x56},	/* Add gamma correction */
116 
117 	{0x1, 0xFF, 0x15},	/* CCDSP High luminance for white balance */
118 	{0x1, 0x01, 0x16},	/* CCDSP Low luminance for white balance */
119 
120 /* Color correction and RGB-to-YUV transformation coefficients changing */
121 #ifdef ALTER_GAMA
122 	{0x0, 0x00, 0x08},	/* A11 */
123 	{0x0, 0x00, 0x09},	/* A12 */
124 	{0x0, 0x90, 0x0A},	/* A13 */
125 	{0x0, 0x12, 0x0B},	/* A21 */
126 	{0x0, 0x00, 0x0C},	/* A22 */
127 	{0x0, 0x00, 0x0D},	/* A23 */
128 	{0x0, 0x00, 0x0E},	/* A31 */
129 	{0x0, 0x02, 0x0F},	/* A32 */
130 	{0x0, 0x00, 0x10},	/* A33 */
131 #else
132 	{0x1, 0x2a, 0x08},	/* A11 0x31 */
133 	{0x1, 0xf8, 0x09},	/* A12 f8 */
134 	{0x1, 0xf8, 0x0A},	/* A13 f8 */
135 	{0x1, 0xf8, 0x0B},	/* A21 f8 */
136 	{0x1, 0x14, 0x0C},	/* A22 0x14 */
137 	{0x1, 0xf8, 0x0D},	/* A23 f8 */
138 	{0x1, 0xf8, 0x0E},	/* A31 f8 */
139 	{0x1, 0xf8, 0x0F},	/* A32 f8 */
140 	{0x1, 0x20, 0x10},	/* A33 0x20 */
141 #endif
142 	{0x1, 0x00, 0x11},	/* R offset */
143 	{0x1, 0x00, 0x12},	/* G offset */
144 	{0x1, 0x00, 0x13},	/* B offset */
145 	{0x1, 0x00, 0x14},	/* GB offset */
146 
147 #endif
148 
149 #ifdef TG_SET
150 	/* Time generator manipulations */
151 	{0x0, 0xfc, 0x0},	/* Set up high bits of shutter speed */
152 	{0x0, 0x01, 0x1},	/* Set up low bits of shutter speed */
153 
154 	{0x0, 0xe4, 0x04},	/* DCLK*2 clock phase adjustment */
155 	{0x0, 0x08, 0x05},	/* ADCK phase adjustment, inv. ext. VB */
156 	{0x0, 0x03, 0x06},	/* FR phase adjustment */
157 	{0x0, 0x01, 0x07},	/* FCDS phase adjustment */
158 	{0x0, 0x39, 0x08},	/* FS phase adjustment */
159 	{0x0, 0x88, 0x0a},	/* FH1 phase and delay adjustment */
160 	{0x0, 0x03, 0x0f},	/* pixel identification */
161 	{0x0, 0x00, 0x11},	/* clock source selection (default) */
162 
163 	/*VERY strange manipulations with
164 	 * select DMCLP or OBPX to be ADCLP output (0x0C)
165 	 * OPB always toggle or not (0x0D) but they allow
166 	 * us to set up brightness
167 	 */
168 	{0x0, 0x01, 0x0c},
169 	{0x0, 0xe0, 0x0d},
170 	/* Done */
171 #endif
172 
173 #ifdef DSPWIN_SET
174 	{0x1, 0xa0, 0x01},	/* Setting image processing parameters */
175 	{0x1, 0x1c, 0x17},	/* Changing Windows positions X1 */
176 	{0x1, 0xe2, 0x19},	/* X2 */
177 	{0x1, 0x1c, 0x1b},	/* X3 */
178 	{0x1, 0xe2, 0x1d},	/* X4 */
179 	{0x1, 0x5f, 0x1f},	/* X5 */
180 	{0x1, 0x32, 0x20},	/* Y5 */
181 	{0x1, 0x01, 0x10},	/* Changing A33 */
182 #endif
183 
184 	{0x2, 0x204a, 0x07},/* Setting video compression & resolution 160x120 */
185 	{0x2, 0x94, 0x06},	/* Setting video no compression */
186 	{}
187 };
188 
189 /*
190    The SPCAxxx docs from Sunplus document these values
191    in tables, one table per register number.  In the data
192    below, dmRequest is the register number, index is the Addr,
193    and value is a combination of Bit values.
194    Bit  Value (hex)
195    0    01
196    1    02
197    2    04
198    3    08
199    4    10
200    5    20
201    6    40
202    7    80
203  */
204 
205 /* Data for chip initialization (set default values) */
206 static const __u16 spca501_init_data[][3] = {
207 	/* Set all the values to powerup defaults */
208 	/* bmRequest,value,index */
209 	{0x0, 0xAA, 0x00},
210 	{0x0, 0x02, 0x01},
211 	{0x0, 0x01, 0x02},
212 	{0x0, 0x02, 0x03},
213 	{0x0, 0xCE, 0x04},
214 	{0x0, 0x00, 0x05},
215 	{0x0, 0x00, 0x06},
216 	{0x0, 0x00, 0x07},
217 	{0x0, 0x00, 0x08},
218 	{0x0, 0x00, 0x09},
219 	{0x0, 0x90, 0x0A},
220 	{0x0, 0x12, 0x0B},
221 	{0x0, 0x00, 0x0C},
222 	{0x0, 0x00, 0x0D},
223 	{0x0, 0x00, 0x0E},
224 	{0x0, 0x02, 0x0F},
225 	{0x0, 0x00, 0x10},
226 	{0x0, 0x00, 0x11},
227 	{0x0, 0x00, 0x12},
228 	{0x0, 0x00, 0x13},
229 	{0x0, 0x00, 0x14},
230 	{0x0, 0x00, 0x15},
231 	{0x0, 0x00, 0x16},
232 	{0x0, 0x00, 0x17},
233 	{0x0, 0x00, 0x18},
234 	{0x0, 0x00, 0x19},
235 	{0x0, 0x00, 0x1A},
236 	{0x0, 0x00, 0x1B},
237 	{0x0, 0x00, 0x1C},
238 	{0x0, 0x00, 0x1D},
239 	{0x0, 0x00, 0x1E},
240 	{0x0, 0x00, 0x1F},
241 	{0x0, 0x00, 0x20},
242 	{0x0, 0x00, 0x21},
243 	{0x0, 0x00, 0x22},
244 	{0x0, 0x00, 0x23},
245 	{0x0, 0x00, 0x24},
246 	{0x0, 0x00, 0x25},
247 	{0x0, 0x00, 0x26},
248 	{0x0, 0x00, 0x27},
249 	{0x0, 0x00, 0x28},
250 	{0x0, 0x00, 0x29},
251 	{0x0, 0x00, 0x2A},
252 	{0x0, 0x00, 0x2B},
253 	{0x0, 0x00, 0x2C},
254 	{0x0, 0x00, 0x2D},
255 	{0x0, 0x00, 0x2E},
256 	{0x0, 0x00, 0x2F},
257 	{0x0, 0x00, 0x30},
258 	{0x0, 0x00, 0x31},
259 	{0x0, 0x00, 0x32},
260 	{0x0, 0x00, 0x33},
261 	{0x0, 0x00, 0x34},
262 	{0x0, 0x00, 0x35},
263 	{0x0, 0x00, 0x36},
264 	{0x0, 0x00, 0x37},
265 	{0x0, 0x00, 0x38},
266 	{0x0, 0x00, 0x39},
267 	{0x0, 0x00, 0x3A},
268 	{0x0, 0x00, 0x3B},
269 	{0x0, 0x00, 0x3C},
270 	{0x0, 0x00, 0x3D},
271 	{0x0, 0x00, 0x3E},
272 	{0x0, 0x00, 0x3F},
273 	{0x0, 0x00, 0x40},
274 	{0x0, 0x00, 0x41},
275 	{0x0, 0x00, 0x42},
276 	{0x0, 0x00, 0x43},
277 	{0x0, 0x00, 0x44},
278 	{0x0, 0x00, 0x45},
279 	{0x0, 0x00, 0x46},
280 	{0x0, 0x00, 0x47},
281 	{0x0, 0x00, 0x48},
282 	{0x0, 0x00, 0x49},
283 	{0x0, 0x00, 0x4A},
284 	{0x0, 0x00, 0x4B},
285 	{0x0, 0x00, 0x4C},
286 	{0x0, 0x00, 0x4D},
287 	{0x0, 0x00, 0x4E},
288 	{0x0, 0x00, 0x4F},
289 	{0x0, 0x00, 0x50},
290 	{0x0, 0x00, 0x51},
291 	{0x0, 0x00, 0x52},
292 	{0x0, 0x00, 0x53},
293 	{0x0, 0x00, 0x54},
294 	{0x0, 0x00, 0x55},
295 	{0x0, 0x00, 0x56},
296 	{0x0, 0x00, 0x57},
297 	{0x0, 0x00, 0x58},
298 	{0x0, 0x00, 0x59},
299 	{0x0, 0x00, 0x5A},
300 	{0x0, 0x00, 0x5B},
301 	{0x0, 0x00, 0x5C},
302 	{0x0, 0x00, 0x5D},
303 	{0x0, 0x00, 0x5E},
304 	{0x0, 0x00, 0x5F},
305 	{0x0, 0x00, 0x60},
306 	{0x0, 0x00, 0x61},
307 	{0x0, 0x00, 0x62},
308 	{0x0, 0x00, 0x63},
309 	{0x0, 0x00, 0x64},
310 	{0x0, 0x00, 0x65},
311 	{0x0, 0x00, 0x66},
312 	{0x0, 0x00, 0x67},
313 	{0x0, 0x00, 0x68},
314 	{0x0, 0x00, 0x69},
315 	{0x0, 0x00, 0x6A},
316 	{0x0, 0x00, 0x6B},
317 	{0x0, 0x00, 0x6C},
318 	{0x0, 0x00, 0x6D},
319 	{0x0, 0x00, 0x6E},
320 	{0x0, 0x00, 0x6F},
321 	{0x0, 0x00, 0x70},
322 	{0x0, 0x00, 0x71},
323 	{0x0, 0x00, 0x72},
324 	{0x0, 0x00, 0x73},
325 	{0x0, 0x00, 0x74},
326 	{0x0, 0x00, 0x75},
327 	{0x0, 0x00, 0x76},
328 	{0x0, 0x00, 0x77},
329 	{0x0, 0x00, 0x78},
330 	{0x0, 0x00, 0x79},
331 	{0x0, 0x00, 0x7A},
332 	{0x0, 0x00, 0x7B},
333 	{0x0, 0x00, 0x7C},
334 	{0x0, 0x00, 0x7D},
335 	{0x0, 0x00, 0x7E},
336 	{0x0, 0x00, 0x7F},
337 	{0x0, 0x00, 0x80},
338 	{0x0, 0x00, 0x81},
339 	{0x0, 0x00, 0x82},
340 	{0x0, 0x00, 0x83},
341 	{0x0, 0x00, 0x84},
342 	{0x0, 0x00, 0x85},
343 	{0x0, 0x00, 0x86},
344 	{0x0, 0x00, 0x87},
345 	{0x0, 0x00, 0x88},
346 	{0x0, 0x00, 0x89},
347 	{0x0, 0x00, 0x8A},
348 	{0x0, 0x00, 0x8B},
349 	{0x0, 0x00, 0x8C},
350 	{0x0, 0x00, 0x8D},
351 	{0x0, 0x00, 0x8E},
352 	{0x0, 0x00, 0x8F},
353 	{0x0, 0x00, 0x90},
354 	{0x0, 0x00, 0x91},
355 	{0x0, 0x00, 0x92},
356 	{0x0, 0x00, 0x93},
357 	{0x0, 0x00, 0x94},
358 	{0x0, 0x00, 0x95},
359 	{0x0, 0x00, 0x96},
360 	{0x0, 0x00, 0x97},
361 	{0x0, 0x00, 0x98},
362 	{0x0, 0x00, 0x99},
363 	{0x0, 0x00, 0x9A},
364 	{0x0, 0x00, 0x9B},
365 	{0x0, 0x00, 0x9C},
366 	{0x0, 0x00, 0x9D},
367 	{0x0, 0x00, 0x9E},
368 	{0x0, 0x00, 0x9F},
369 	{0x0, 0x00, 0xA0},
370 	{0x0, 0x00, 0xA1},
371 	{0x0, 0x00, 0xA2},
372 	{0x0, 0x00, 0xA3},
373 	{0x0, 0x00, 0xA4},
374 	{0x0, 0x00, 0xA5},
375 	{0x0, 0x00, 0xA6},
376 	{0x0, 0x00, 0xA7},
377 	{0x0, 0x00, 0xA8},
378 	{0x0, 0x00, 0xA9},
379 	{0x0, 0x00, 0xAA},
380 	{0x0, 0x00, 0xAB},
381 	{0x0, 0x00, 0xAC},
382 	{0x0, 0x00, 0xAD},
383 	{0x0, 0x00, 0xAE},
384 	{0x0, 0x00, 0xAF},
385 	{0x0, 0x00, 0xB0},
386 	{0x0, 0x00, 0xB1},
387 	{0x0, 0x00, 0xB2},
388 	{0x0, 0x00, 0xB3},
389 	{0x0, 0x00, 0xB4},
390 	{0x0, 0x00, 0xB5},
391 	{0x0, 0x00, 0xB6},
392 	{0x0, 0x00, 0xB7},
393 	{0x0, 0x00, 0xB8},
394 	{0x0, 0x00, 0xB9},
395 	{0x0, 0x00, 0xBA},
396 	{0x0, 0x00, 0xBB},
397 	{0x0, 0x00, 0xBC},
398 	{0x0, 0x00, 0xBD},
399 	{0x0, 0x00, 0xBE},
400 	{0x0, 0x00, 0xBF},
401 	{0x0, 0x00, 0xC0},
402 	{0x0, 0x00, 0xC1},
403 	{0x0, 0x00, 0xC2},
404 	{0x0, 0x00, 0xC3},
405 	{0x0, 0x00, 0xC4},
406 	{0x0, 0x00, 0xC5},
407 	{0x0, 0x00, 0xC6},
408 	{0x0, 0x00, 0xC7},
409 	{0x0, 0x00, 0xC8},
410 	{0x0, 0x00, 0xC9},
411 	{0x0, 0x00, 0xCA},
412 	{0x0, 0x00, 0xCB},
413 	{0x0, 0x00, 0xCC},
414 	{0x1, 0xF4, 0x00},
415 	{0x1, 0x38, 0x01},
416 	{0x1, 0x40, 0x02},
417 	{0x1, 0x0A, 0x03},
418 	{0x1, 0x40, 0x04},
419 	{0x1, 0x40, 0x05},
420 	{0x1, 0x40, 0x06},
421 	{0x1, 0x67, 0x07},
422 	{0x1, 0x31, 0x08},
423 	{0x1, 0x00, 0x09},
424 	{0x1, 0x00, 0x0A},
425 	{0x1, 0x00, 0x0B},
426 	{0x1, 0x14, 0x0C},
427 	{0x1, 0x00, 0x0D},
428 	{0x1, 0x00, 0x0E},
429 	{0x1, 0x00, 0x0F},
430 	{0x1, 0x1E, 0x10},
431 	{0x1, 0x00, 0x11},
432 	{0x1, 0x00, 0x12},
433 	{0x1, 0x00, 0x13},
434 	{0x1, 0x00, 0x14},
435 	{0x1, 0xFF, 0x15},
436 	{0x1, 0x01, 0x16},
437 	{0x1, 0x32, 0x17},
438 	{0x1, 0x23, 0x18},
439 	{0x1, 0xCE, 0x19},
440 	{0x1, 0x23, 0x1A},
441 	{0x1, 0x32, 0x1B},
442 	{0x1, 0x8D, 0x1C},
443 	{0x1, 0xCE, 0x1D},
444 	{0x1, 0x8D, 0x1E},
445 	{0x1, 0x00, 0x1F},
446 	{0x1, 0x00, 0x20},
447 	{0x1, 0xFF, 0x3E},
448 	{0x1, 0x02, 0x3F},
449 	{0x1, 0x00, 0x40},
450 	{0x1, 0x00, 0x41},
451 	{0x1, 0x00, 0x42},
452 	{0x1, 0x00, 0x43},
453 	{0x1, 0x00, 0x44},
454 	{0x1, 0x00, 0x45},
455 	{0x1, 0x00, 0x46},
456 	{0x1, 0x00, 0x47},
457 	{0x1, 0x00, 0x48},
458 	{0x1, 0x00, 0x49},
459 	{0x1, 0x00, 0x4A},
460 	{0x1, 0x00, 0x4B},
461 	{0x1, 0x00, 0x4C},
462 	{0x1, 0x00, 0x4D},
463 	{0x1, 0x00, 0x4E},
464 	{0x1, 0x00, 0x4F},
465 	{0x1, 0x00, 0x50},
466 	{0x1, 0x00, 0x51},
467 	{0x1, 0x00, 0x52},
468 	{0x1, 0x00, 0x53},
469 	{0x1, 0x00, 0x54},
470 	{0x1, 0x00, 0x55},
471 	{0x1, 0x00, 0x56},
472 	{0x1, 0x00, 0x57},
473 	{0x1, 0x00, 0x58},
474 	{0x1, 0x00, 0x59},
475 	{0x1, 0x00, 0x5A},
476 	{0x2, 0x03, 0x00},
477 	{0x2, 0x00, 0x01},
478 	{0x2, 0x00, 0x05},
479 	{0x2, 0x00, 0x06},
480 	{0x2, 0x00, 0x07},
481 	{0x2, 0x00, 0x10},
482 	{0x2, 0x00, 0x11},
483 	/* Strange - looks like the 501 driver doesn't do anything
484 	 * at insert time except read the EEPROM
485 	 */
486 	{}
487 };
488 
489 /* Data for video camera init before capture.
490  * Capture and decoding by Colin Peart.
491  * This is for the 3com HomeConnect Lite which is spca501a based.
492  */
493 static const __u16 spca501_3com_open_data[][3] = {
494 	/* bmRequest,value,index */
495 	{0x2, 0x0050, 0x0000},	/* C/S Enable TG soft reset, timing mode=010 */
496 	{0x2, 0x0043, 0x0000},	/* C/S Disable TG soft reset, timing mode=010 */
497 	{0x2, 0x0002, 0x0005},	/* C/S GPIO */
498 	{0x2, 0x0003, 0x0005},	/* C/S GPIO */
499 
500 #ifdef CCDSP_SET
501 	{0x1, 0x0020, 0x0001},	/* CCDSP Options */
502 
503 	{0x1, 0x0020, 0x0002},	/* CCDSP Black Level */
504 	{0x1, 0x006e, 0x0007},	/* CCDSP Gamma options */
505 	{0x1, 0x0090, 0x0015},	/* CCDSP Luminance Low */
506 	{0x1, 0x00ff, 0x0016},	/* CCDSP Luminance High */
507 	{0x1, 0x0003, 0x003F},	/* CCDSP Gamma correction toggle */
508 
509 #ifdef ALTER_GAMMA
510 	{0x1, 0x0010, 0x0008},	/* CCDSP YUV A11 */
511 	{0x1, 0x0000, 0x0009},	/* CCDSP YUV A12 */
512 	{0x1, 0x0000, 0x000a},	/* CCDSP YUV A13 */
513 	{0x1, 0x0000, 0x000b},	/* CCDSP YUV A21 */
514 	{0x1, 0x0010, 0x000c},	/* CCDSP YUV A22 */
515 	{0x1, 0x0000, 0x000d},	/* CCDSP YUV A23 */
516 	{0x1, 0x0000, 0x000e},	/* CCDSP YUV A31 */
517 	{0x1, 0x0000, 0x000f},	/* CCDSP YUV A32 */
518 	{0x1, 0x0010, 0x0010},	/* CCDSP YUV A33 */
519 	{0x1, 0x0000, 0x0011},	/* CCDSP R Offset */
520 	{0x1, 0x0000, 0x0012},	/* CCDSP G Offset */
521 	{0x1, 0x0001, 0x0013},	/* CCDSP B Offset */
522 	{0x1, 0x0001, 0x0014},	/* CCDSP BG Offset */
523 	{0x1, 0x003f, 0x00C1},	/* CCDSP Gamma Correction Enable */
524 #endif
525 #endif
526 
527 #ifdef TG_SET
528 	{0x0, 0x00fc, 0x0000},	/* TG Shutter Speed High Bits */
529 	{0x0, 0x0000, 0x0001},	/* TG Shutter Speed Low Bits */
530 	{0x0, 0x00e4, 0x0004},	/* TG DCLK*2 Adjust */
531 	{0x0, 0x0008, 0x0005},	/* TG ADCK Adjust */
532 	{0x0, 0x0003, 0x0006},	/* TG FR Phase Adjust */
533 	{0x0, 0x0001, 0x0007},	/* TG FCDS Phase Adjust */
534 	{0x0, 0x0039, 0x0008},	/* TG FS Phase Adjust */
535 	{0x0, 0x0088, 0x000a},	/* TG MH1 */
536 	{0x0, 0x0003, 0x000f},	/* TG Pixel ID */
537 
538 	/* Like below, unexplained toglleing */
539 	{0x0, 0x0080, 0x000c},
540 	{0x0, 0x0000, 0x000d},
541 	{0x0, 0x0080, 0x000c},
542 	{0x0, 0x0004, 0x000d},
543 	{0x0, 0x0000, 0x000c},
544 	{0x0, 0x0000, 0x000d},
545 	{0x0, 0x0040, 0x000c},
546 	{0x0, 0x0017, 0x000d},
547 	{0x0, 0x00c0, 0x000c},
548 	{0x0, 0x0000, 0x000d},
549 	{0x0, 0x0080, 0x000c},
550 	{0x0, 0x0006, 0x000d},
551 	{0x0, 0x0080, 0x000c},
552 	{0x0, 0x0004, 0x000d},
553 	{0x0, 0x0002, 0x0003},
554 #endif
555 
556 #ifdef DSPWIN_SET
557 	{0x1, 0x001c, 0x0017},	/* CCDSP W1 Start X */
558 	{0x1, 0x00e2, 0x0019},	/* CCDSP W2 Start X */
559 	{0x1, 0x001c, 0x001b},	/* CCDSP W3 Start X */
560 	{0x1, 0x00e2, 0x001d},	/* CCDSP W4 Start X */
561 	{0x1, 0x00aa, 0x001f},	/* CCDSP W5 Start X */
562 	{0x1, 0x0070, 0x0020},	/* CCDSP W5 Start Y */
563 #endif
564 	{0x0, 0x0001, 0x0010},	/* TG Start Clock */
565 
566 /*	{0x2, 0x006a, 0x0001},	 * C/S Enable ISOSYNCH Packet Engine */
567 	{0x2, 0x0068, 0x0001},	/* C/S Disable ISOSYNCH Packet Engine */
568 	{0x2, 0x0000, 0x0005},
569 	{0x2, 0x0043, 0x0000},	/* C/S Set Timing Mode, Disable TG soft reset */
570 	{0x2, 0x0043, 0x0000},	/* C/S Set Timing Mode, Disable TG soft reset */
571 	{0x2, 0x0002, 0x0005},	/* C/S GPIO */
572 	{0x2, 0x0003, 0x0005},	/* C/S GPIO */
573 
574 	{0x2, 0x006a, 0x0001},	/* C/S Enable ISOSYNCH Packet Engine */
575 	{}
576 };
577 
578 /*
579  * Data used to initialize a SPCA501C with HV7131B sensor.
580  * From a capture file taken with USBSnoop v 1.5
581  * I have a "SPCA501C pc camera chipset" manual by sunplus, but some
582  * of the value meanings are obscure or simply "reserved".
583  * to do list:
584  * 1) Understand what every value means
585  * 2) Understand why some values seem to appear more than once
586  * 3) Write a small comment for each line of the following arrays.
587  */
588 static const __u16 spca501c_arowana_open_data[][3] = {
589 	/* bmRequest,value,index */
590 	{0x02, 0x0007, 0x0005},
591 	{0x02, 0xa048, 0x0000},
592 	{0x05, 0x0022, 0x0004},
593 	{0x01, 0x0006, 0x0011},
594 	{0x01, 0x00ff, 0x0012},
595 	{0x01, 0x0014, 0x0013},
596 	{0x01, 0x0000, 0x0014},
597 	{0x01, 0x0042, 0x0051},
598 	{0x01, 0x0040, 0x0052},
599 	{0x01, 0x0051, 0x0053},
600 	{0x01, 0x0040, 0x0054},
601 	{0x01, 0x0000, 0x0055},
602 	{0x00, 0x0025, 0x0000},
603 	{0x00, 0x0026, 0x0000},
604 	{0x00, 0x0001, 0x0000},
605 	{0x00, 0x0027, 0x0000},
606 	{0x00, 0x008a, 0x0000},
607 	{}
608 };
609 
610 static const __u16 spca501c_arowana_init_data[][3] = {
611 	/* bmRequest,value,index */
612 	{0x02, 0x0007, 0x0005},
613 	{0x02, 0xa048, 0x0000},
614 	{0x05, 0x0022, 0x0004},
615 	{0x01, 0x0006, 0x0011},
616 	{0x01, 0x00ff, 0x0012},
617 	{0x01, 0x0014, 0x0013},
618 	{0x01, 0x0000, 0x0014},
619 	{0x01, 0x0042, 0x0051},
620 	{0x01, 0x0040, 0x0052},
621 	{0x01, 0x0051, 0x0053},
622 	{0x01, 0x0040, 0x0054},
623 	{0x01, 0x0000, 0x0055},
624 	{0x00, 0x0025, 0x0000},
625 	{0x00, 0x0026, 0x0000},
626 	{0x00, 0x0001, 0x0000},
627 	{0x00, 0x0027, 0x0000},
628 	{0x00, 0x008a, 0x0000},
629 	{0x02, 0x0000, 0x0005},
630 	{0x02, 0x0007, 0x0005},
631 	{0x02, 0x2000, 0x0000},
632 	{0x05, 0x0022, 0x0004},
633 	{0x05, 0x0015, 0x0001},
634 	{0x05, 0x00ea, 0x0000},
635 	{0x05, 0x0021, 0x0001},
636 	{0x05, 0x00d2, 0x0000},
637 	{0x05, 0x0023, 0x0001},
638 	{0x05, 0x0003, 0x0000},
639 	{0x05, 0x0030, 0x0001},
640 	{0x05, 0x002b, 0x0000},
641 	{0x05, 0x0031, 0x0001},
642 	{0x05, 0x0023, 0x0000},
643 	{0x05, 0x0032, 0x0001},
644 	{0x05, 0x0023, 0x0000},
645 	{0x05, 0x0033, 0x0001},
646 	{0x05, 0x0023, 0x0000},
647 	{0x05, 0x0034, 0x0001},
648 	{0x05, 0x0002, 0x0000},
649 	{0x05, 0x0050, 0x0001},
650 	{0x05, 0x0000, 0x0000},
651 	{0x05, 0x0051, 0x0001},
652 	{0x05, 0x0000, 0x0000},
653 	{0x05, 0x0052, 0x0001},
654 	{0x05, 0x0000, 0x0000},
655 	{0x05, 0x0054, 0x0001},
656 	{0x05, 0x0001, 0x0000},
657 	{0x00, 0x0000, 0x0001},
658 	{0x00, 0x0000, 0x0002},
659 	{0x00, 0x000c, 0x0003},
660 	{0x00, 0x0000, 0x0004},
661 	{0x00, 0x0090, 0x0005},
662 	{0x00, 0x0000, 0x0006},
663 	{0x00, 0x0040, 0x0007},
664 	{0x00, 0x00c0, 0x0008},
665 	{0x00, 0x004a, 0x0009},
666 	{0x00, 0x0000, 0x000a},
667 	{0x00, 0x0000, 0x000b},
668 	{0x00, 0x0001, 0x000c},
669 	{0x00, 0x0001, 0x000d},
670 	{0x00, 0x0000, 0x000e},
671 	{0x00, 0x0002, 0x000f},
672 	{0x00, 0x0001, 0x0010},
673 	{0x00, 0x0000, 0x0011},
674 	{0x00, 0x0000, 0x0012},
675 	{0x00, 0x0002, 0x0020},
676 	{0x00, 0x0080, 0x0021},
677 	{0x00, 0x0001, 0x0022},
678 	{0x00, 0x00e0, 0x0023},
679 	{0x00, 0x0000, 0x0024},
680 	{0x00, 0x00d5, 0x0025},
681 	{0x00, 0x0000, 0x0026},
682 	{0x00, 0x000b, 0x0027},
683 	{0x00, 0x0000, 0x0046},
684 	{0x00, 0x0000, 0x0047},
685 	{0x00, 0x0000, 0x0048},
686 	{0x00, 0x0000, 0x0049},
687 	{0x00, 0x0008, 0x004a},
688 	{0xff, 0x0000, 0x00d0},
689 	{0xff, 0x00d8, 0x00d1},
690 	{0xff, 0x0000, 0x00d4},
691 	{0xff, 0x0000, 0x00d5},
692 	{0x01, 0x00a6, 0x0000},
693 	{0x01, 0x0028, 0x0001},
694 	{0x01, 0x0000, 0x0002},
695 	{0x01, 0x000a, 0x0003},
696 	{0x01, 0x0040, 0x0004},
697 	{0x01, 0x0066, 0x0007},
698 	{0x01, 0x0011, 0x0008},
699 	{0x01, 0x0032, 0x0009},
700 	{0x01, 0x00fd, 0x000a},
701 	{0x01, 0x0038, 0x000b},
702 	{0x01, 0x00d1, 0x000c},
703 	{0x01, 0x00f7, 0x000d},
704 	{0x01, 0x00ed, 0x000e},
705 	{0x01, 0x00d8, 0x000f},
706 	{0x01, 0x0038, 0x0010},
707 	{0x01, 0x00ff, 0x0015},
708 	{0x01, 0x0001, 0x0016},
709 	{0x01, 0x0032, 0x0017},
710 	{0x01, 0x0023, 0x0018},
711 	{0x01, 0x00ce, 0x0019},
712 	{0x01, 0x0023, 0x001a},
713 	{0x01, 0x0032, 0x001b},
714 	{0x01, 0x008d, 0x001c},
715 	{0x01, 0x00ce, 0x001d},
716 	{0x01, 0x008d, 0x001e},
717 	{0x01, 0x0000, 0x001f},
718 	{0x01, 0x0000, 0x0020},
719 	{0x01, 0x00ff, 0x003e},
720 	{0x01, 0x0003, 0x003f},
721 	{0x01, 0x0000, 0x0040},
722 	{0x01, 0x0035, 0x0041},
723 	{0x01, 0x0053, 0x0042},
724 	{0x01, 0x0069, 0x0043},
725 	{0x01, 0x007c, 0x0044},
726 	{0x01, 0x008c, 0x0045},
727 	{0x01, 0x009a, 0x0046},
728 	{0x01, 0x00a8, 0x0047},
729 	{0x01, 0x00b4, 0x0048},
730 	{0x01, 0x00bf, 0x0049},
731 	{0x01, 0x00ca, 0x004a},
732 	{0x01, 0x00d4, 0x004b},
733 	{0x01, 0x00dd, 0x004c},
734 	{0x01, 0x00e7, 0x004d},
735 	{0x01, 0x00ef, 0x004e},
736 	{0x01, 0x00f8, 0x004f},
737 	{0x01, 0x00ff, 0x0050},
738 	{0x01, 0x0001, 0x0056},
739 	{0x01, 0x0060, 0x0057},
740 	{0x01, 0x0040, 0x0058},
741 	{0x01, 0x0011, 0x0059},
742 	{0x01, 0x0001, 0x005a},
743 	{0x02, 0x0007, 0x0005},
744 	{0x02, 0xa048, 0x0000},
745 	{0x02, 0x0007, 0x0005},
746 	{0x02, 0x0015, 0x0006},
747 	{0x02, 0x100a, 0x0007},
748 	{0x02, 0xa048, 0x0000},
749 	{0x02, 0xc002, 0x0001},
750 	{0x02, 0x000f, 0x0005},
751 	{0x02, 0xa048, 0x0000},
752 	{0x05, 0x0022, 0x0004},
753 	{0x05, 0x0025, 0x0001},
754 	{0x05, 0x0000, 0x0000},
755 	{0x05, 0x0026, 0x0001},
756 	{0x05, 0x0001, 0x0000},
757 	{0x05, 0x0027, 0x0001},
758 	{0x05, 0x0000, 0x0000},
759 	{0x05, 0x0001, 0x0001},
760 	{0x05, 0x0000, 0x0000},
761 	{0x05, 0x0021, 0x0001},
762 	{0x05, 0x00d2, 0x0000},
763 	{0x05, 0x0020, 0x0001},
764 	{0x05, 0x0000, 0x0000},
765 	{0x00, 0x0090, 0x0005},
766 	{0x01, 0x00a6, 0x0000},
767 	{0x02, 0x0007, 0x0005},
768 	{0x02, 0x2000, 0x0000},
769 	{0x05, 0x0022, 0x0004},
770 	{0x05, 0x0015, 0x0001},
771 	{0x05, 0x00ea, 0x0000},
772 	{0x05, 0x0021, 0x0001},
773 	{0x05, 0x00d2, 0x0000},
774 	{0x05, 0x0023, 0x0001},
775 	{0x05, 0x0003, 0x0000},
776 	{0x05, 0x0030, 0x0001},
777 	{0x05, 0x002b, 0x0000},
778 	{0x05, 0x0031, 0x0001},
779 	{0x05, 0x0023, 0x0000},
780 	{0x05, 0x0032, 0x0001},
781 	{0x05, 0x0023, 0x0000},
782 	{0x05, 0x0033, 0x0001},
783 	{0x05, 0x0023, 0x0000},
784 	{0x05, 0x0034, 0x0001},
785 	{0x05, 0x0002, 0x0000},
786 	{0x05, 0x0050, 0x0001},
787 	{0x05, 0x0000, 0x0000},
788 	{0x05, 0x0051, 0x0001},
789 	{0x05, 0x0000, 0x0000},
790 	{0x05, 0x0052, 0x0001},
791 	{0x05, 0x0000, 0x0000},
792 	{0x05, 0x0054, 0x0001},
793 	{0x05, 0x0001, 0x0000},
794 	{0x00, 0x0000, 0x0001},
795 	{0x00, 0x0000, 0x0002},
796 	{0x00, 0x000c, 0x0003},
797 	{0x00, 0x0000, 0x0004},
798 	{0x00, 0x0090, 0x0005},
799 	{0x00, 0x0000, 0x0006},
800 	{0x00, 0x0040, 0x0007},
801 	{0x00, 0x00c0, 0x0008},
802 	{0x00, 0x004a, 0x0009},
803 	{0x00, 0x0000, 0x000a},
804 	{0x00, 0x0000, 0x000b},
805 	{0x00, 0x0001, 0x000c},
806 	{0x00, 0x0001, 0x000d},
807 	{0x00, 0x0000, 0x000e},
808 	{0x00, 0x0002, 0x000f},
809 	{0x00, 0x0001, 0x0010},
810 	{0x00, 0x0000, 0x0011},
811 	{0x00, 0x0000, 0x0012},
812 	{0x00, 0x0002, 0x0020},
813 	{0x00, 0x0080, 0x0021},
814 	{0x00, 0x0001, 0x0022},
815 	{0x00, 0x00e0, 0x0023},
816 	{0x00, 0x0000, 0x0024},
817 	{0x00, 0x00d5, 0x0025},
818 	{0x00, 0x0000, 0x0026},
819 	{0x00, 0x000b, 0x0027},
820 	{0x00, 0x0000, 0x0046},
821 	{0x00, 0x0000, 0x0047},
822 	{0x00, 0x0000, 0x0048},
823 	{0x00, 0x0000, 0x0049},
824 	{0x00, 0x0008, 0x004a},
825 	{0xff, 0x0000, 0x00d0},
826 	{0xff, 0x00d8, 0x00d1},
827 	{0xff, 0x0000, 0x00d4},
828 	{0xff, 0x0000, 0x00d5},
829 	{0x01, 0x00a6, 0x0000},
830 	{0x01, 0x0028, 0x0001},
831 	{0x01, 0x0000, 0x0002},
832 	{0x01, 0x000a, 0x0003},
833 	{0x01, 0x0040, 0x0004},
834 	{0x01, 0x0066, 0x0007},
835 	{0x01, 0x0011, 0x0008},
836 	{0x01, 0x0032, 0x0009},
837 	{0x01, 0x00fd, 0x000a},
838 	{0x01, 0x0038, 0x000b},
839 	{0x01, 0x00d1, 0x000c},
840 	{0x01, 0x00f7, 0x000d},
841 	{0x01, 0x00ed, 0x000e},
842 	{0x01, 0x00d8, 0x000f},
843 	{0x01, 0x0038, 0x0010},
844 	{0x01, 0x00ff, 0x0015},
845 	{0x01, 0x0001, 0x0016},
846 	{0x01, 0x0032, 0x0017},
847 	{0x01, 0x0023, 0x0018},
848 	{0x01, 0x00ce, 0x0019},
849 	{0x01, 0x0023, 0x001a},
850 	{0x01, 0x0032, 0x001b},
851 	{0x01, 0x008d, 0x001c},
852 	{0x01, 0x00ce, 0x001d},
853 	{0x01, 0x008d, 0x001e},
854 	{0x01, 0x0000, 0x001f},
855 	{0x01, 0x0000, 0x0020},
856 	{0x01, 0x00ff, 0x003e},
857 	{0x01, 0x0003, 0x003f},
858 	{0x01, 0x0000, 0x0040},
859 	{0x01, 0x0035, 0x0041},
860 	{0x01, 0x0053, 0x0042},
861 	{0x01, 0x0069, 0x0043},
862 	{0x01, 0x007c, 0x0044},
863 	{0x01, 0x008c, 0x0045},
864 	{0x01, 0x009a, 0x0046},
865 	{0x01, 0x00a8, 0x0047},
866 	{0x01, 0x00b4, 0x0048},
867 	{0x01, 0x00bf, 0x0049},
868 	{0x01, 0x00ca, 0x004a},
869 	{0x01, 0x00d4, 0x004b},
870 	{0x01, 0x00dd, 0x004c},
871 	{0x01, 0x00e7, 0x004d},
872 	{0x01, 0x00ef, 0x004e},
873 	{0x01, 0x00f8, 0x004f},
874 	{0x01, 0x00ff, 0x0050},
875 	{0x01, 0x0001, 0x0056},
876 	{0x01, 0x0060, 0x0057},
877 	{0x01, 0x0040, 0x0058},
878 	{0x01, 0x0011, 0x0059},
879 	{0x01, 0x0001, 0x005a},
880 	{0x02, 0x0007, 0x0005},
881 	{0x02, 0xa048, 0x0000},
882 	{0x02, 0x0007, 0x0005},
883 	{0x02, 0x0015, 0x0006},
884 	{0x02, 0x100a, 0x0007},
885 	{0x02, 0xa048, 0x0000},
886 	{0x02, 0xc002, 0x0001},
887 	{0x02, 0x000f, 0x0005},
888 	{0x02, 0xa048, 0x0000},
889 	{0x05, 0x0022, 0x0004},
890 	{0x05, 0x0025, 0x0001},
891 	{0x05, 0x0000, 0x0000},
892 	{0x05, 0x0026, 0x0001},
893 	{0x05, 0x0001, 0x0000},
894 	{0x05, 0x0027, 0x0001},
895 	{0x05, 0x0000, 0x0000},
896 	{0x05, 0x0001, 0x0001},
897 	{0x05, 0x0000, 0x0000},
898 	{0x05, 0x0021, 0x0001},
899 	{0x05, 0x00d2, 0x0000},
900 	{0x05, 0x0020, 0x0001},
901 	{0x05, 0x0000, 0x0000},
902 	{0x00, 0x0090, 0x0005},
903 	{0x01, 0x00a6, 0x0000},
904 	{0x01, 0x0003, 0x003f},
905 	{0x01, 0x0001, 0x0056},
906 	{0x01, 0x0011, 0x0008},
907 	{0x01, 0x0032, 0x0009},
908 	{0x01, 0xfffd, 0x000a},
909 	{0x01, 0x0023, 0x000b},
910 	{0x01, 0xffea, 0x000c},
911 	{0x01, 0xfff4, 0x000d},
912 	{0x01, 0xfffc, 0x000e},
913 	{0x01, 0xffe3, 0x000f},
914 	{0x01, 0x001f, 0x0010},
915 	{0x01, 0x00a8, 0x0001},
916 	{0x01, 0x0067, 0x0007},
917 	{0x01, 0x0032, 0x0017},
918 	{0x01, 0x0023, 0x0018},
919 	{0x01, 0x00ce, 0x0019},
920 	{0x01, 0x0023, 0x001a},
921 	{0x01, 0x0032, 0x001b},
922 	{0x01, 0x008d, 0x001c},
923 	{0x01, 0x00ce, 0x001d},
924 	{0x01, 0x008d, 0x001e},
925 	{0x01, 0x00c8, 0x0015},
926 	{0x01, 0x0032, 0x0016},
927 	{0x01, 0x0000, 0x0011},
928 	{0x01, 0x0000, 0x0012},
929 	{0x01, 0x0000, 0x0013},
930 	{0x01, 0x000a, 0x0003},
931 	{0x02, 0xc002, 0x0001},
932 	{0x02, 0x0007, 0x0005},
933 	{0x02, 0xc000, 0x0001},
934 	{0x02, 0x0000, 0x0005},
935 	{0x02, 0x0007, 0x0005},
936 	{0x02, 0x2000, 0x0000},
937 	{0x05, 0x0022, 0x0004},
938 	{0x05, 0x0015, 0x0001},
939 	{0x05, 0x00ea, 0x0000},
940 	{0x05, 0x0021, 0x0001},
941 	{0x05, 0x00d2, 0x0000},
942 	{0x05, 0x0023, 0x0001},
943 	{0x05, 0x0003, 0x0000},
944 	{0x05, 0x0030, 0x0001},
945 	{0x05, 0x002b, 0x0000},
946 	{0x05, 0x0031, 0x0001},
947 	{0x05, 0x0023, 0x0000},
948 	{0x05, 0x0032, 0x0001},
949 	{0x05, 0x0023, 0x0000},
950 	{0x05, 0x0033, 0x0001},
951 	{0x05, 0x0023, 0x0000},
952 	{0x05, 0x0034, 0x0001},
953 	{0x05, 0x0002, 0x0000},
954 	{0x05, 0x0050, 0x0001},
955 	{0x05, 0x0000, 0x0000},
956 	{0x05, 0x0051, 0x0001},
957 	{0x05, 0x0000, 0x0000},
958 	{0x05, 0x0052, 0x0001},
959 	{0x05, 0x0000, 0x0000},
960 	{0x05, 0x0054, 0x0001},
961 	{0x05, 0x0001, 0x0000},
962 	{0x00, 0x0000, 0x0001},
963 	{0x00, 0x0000, 0x0002},
964 	{0x00, 0x000c, 0x0003},
965 	{0x00, 0x0000, 0x0004},
966 	{0x00, 0x0090, 0x0005},
967 	{0x00, 0x0000, 0x0006},
968 	{0x00, 0x0040, 0x0007},
969 	{0x00, 0x00c0, 0x0008},
970 	{0x00, 0x004a, 0x0009},
971 	{0x00, 0x0000, 0x000a},
972 	{0x00, 0x0000, 0x000b},
973 	{0x00, 0x0001, 0x000c},
974 	{0x00, 0x0001, 0x000d},
975 	{0x00, 0x0000, 0x000e},
976 	{0x00, 0x0002, 0x000f},
977 	{0x00, 0x0001, 0x0010},
978 	{0x00, 0x0000, 0x0011},
979 	{0x00, 0x0000, 0x0012},
980 	{0x00, 0x0002, 0x0020},
981 	{0x00, 0x0080, 0x0021},
982 	{0x00, 0x0001, 0x0022},
983 	{0x00, 0x00e0, 0x0023},
984 	{0x00, 0x0000, 0x0024},
985 	{0x00, 0x00d5, 0x0025},
986 	{0x00, 0x0000, 0x0026},
987 	{0x00, 0x000b, 0x0027},
988 	{0x00, 0x0000, 0x0046},
989 	{0x00, 0x0000, 0x0047},
990 	{0x00, 0x0000, 0x0048},
991 	{0x00, 0x0000, 0x0049},
992 	{0x00, 0x0008, 0x004a},
993 	{0xff, 0x0000, 0x00d0},
994 	{0xff, 0x00d8, 0x00d1},
995 	{0xff, 0x0000, 0x00d4},
996 	{0xff, 0x0000, 0x00d5},
997 	{0x01, 0x00a6, 0x0000},
998 	{0x01, 0x0028, 0x0001},
999 	{0x01, 0x0000, 0x0002},
1000 	{0x01, 0x000a, 0x0003},
1001 	{0x01, 0x0040, 0x0004},
1002 	{0x01, 0x0066, 0x0007},
1003 	{0x01, 0x0011, 0x0008},
1004 	{0x01, 0x0032, 0x0009},
1005 	{0x01, 0x00fd, 0x000a},
1006 	{0x01, 0x0038, 0x000b},
1007 	{0x01, 0x00d1, 0x000c},
1008 	{0x01, 0x00f7, 0x000d},
1009 	{0x01, 0x00ed, 0x000e},
1010 	{0x01, 0x00d8, 0x000f},
1011 	{0x01, 0x0038, 0x0010},
1012 	{0x01, 0x00ff, 0x0015},
1013 	{0x01, 0x0001, 0x0016},
1014 	{0x01, 0x0032, 0x0017},
1015 	{0x01, 0x0023, 0x0018},
1016 	{0x01, 0x00ce, 0x0019},
1017 	{0x01, 0x0023, 0x001a},
1018 	{0x01, 0x0032, 0x001b},
1019 	{0x01, 0x008d, 0x001c},
1020 	{0x01, 0x00ce, 0x001d},
1021 	{0x01, 0x008d, 0x001e},
1022 	{0x01, 0x0000, 0x001f},
1023 	{0x01, 0x0000, 0x0020},
1024 	{0x01, 0x00ff, 0x003e},
1025 	{0x01, 0x0003, 0x003f},
1026 	{0x01, 0x0000, 0x0040},
1027 	{0x01, 0x0035, 0x0041},
1028 	{0x01, 0x0053, 0x0042},
1029 	{0x01, 0x0069, 0x0043},
1030 	{0x01, 0x007c, 0x0044},
1031 	{0x01, 0x008c, 0x0045},
1032 	{0x01, 0x009a, 0x0046},
1033 	{0x01, 0x00a8, 0x0047},
1034 	{0x01, 0x00b4, 0x0048},
1035 	{0x01, 0x00bf, 0x0049},
1036 	{0x01, 0x00ca, 0x004a},
1037 	{0x01, 0x00d4, 0x004b},
1038 	{0x01, 0x00dd, 0x004c},
1039 	{0x01, 0x00e7, 0x004d},
1040 	{0x01, 0x00ef, 0x004e},
1041 	{0x01, 0x00f8, 0x004f},
1042 	{0x01, 0x00ff, 0x0050},
1043 	{0x01, 0x0001, 0x0056},
1044 	{0x01, 0x0060, 0x0057},
1045 	{0x01, 0x0040, 0x0058},
1046 	{0x01, 0x0011, 0x0059},
1047 	{0x01, 0x0001, 0x005a},
1048 	{0x02, 0x0007, 0x0005},
1049 	{0x02, 0xa048, 0x0000},
1050 	{0x02, 0x0007, 0x0005},
1051 	{0x02, 0x0015, 0x0006},
1052 	{0x02, 0x100a, 0x0007},
1053 	{0x02, 0xa048, 0x0000},
1054 	{0x02, 0xc002, 0x0001},
1055 	{0x02, 0x000f, 0x0005},
1056 	{0x02, 0xa048, 0x0000},
1057 	{0x05, 0x0022, 0x0004},
1058 	{0x05, 0x0025, 0x0001},
1059 	{0x05, 0x0000, 0x0000},
1060 	{0x05, 0x0026, 0x0001},
1061 	{0x05, 0x0001, 0x0000},
1062 	{0x05, 0x0027, 0x0001},
1063 	{0x05, 0x0000, 0x0000},
1064 	{0x05, 0x0001, 0x0001},
1065 	{0x05, 0x0000, 0x0000},
1066 	{0x05, 0x0021, 0x0001},
1067 	{0x05, 0x00d2, 0x0000},
1068 	{0x05, 0x0020, 0x0001},
1069 	{0x05, 0x0000, 0x0000},
1070 	{0x00, 0x0090, 0x0005},
1071 	{0x01, 0x00a6, 0x0000},
1072 	{0x02, 0x0007, 0x0005},
1073 	{0x02, 0x2000, 0x0000},
1074 	{0x05, 0x0022, 0x0004},
1075 	{0x05, 0x0015, 0x0001},
1076 	{0x05, 0x00ea, 0x0000},
1077 	{0x05, 0x0021, 0x0001},
1078 	{0x05, 0x00d2, 0x0000},
1079 	{0x05, 0x0023, 0x0001},
1080 	{0x05, 0x0003, 0x0000},
1081 	{0x05, 0x0030, 0x0001},
1082 	{0x05, 0x002b, 0x0000},
1083 	{0x05, 0x0031, 0x0001},
1084 	{0x05, 0x0023, 0x0000},
1085 	{0x05, 0x0032, 0x0001},
1086 	{0x05, 0x0023, 0x0000},
1087 	{0x05, 0x0033, 0x0001},
1088 	{0x05, 0x0023, 0x0000},
1089 	{0x05, 0x0034, 0x0001},
1090 	{0x05, 0x0002, 0x0000},
1091 	{0x05, 0x0050, 0x0001},
1092 	{0x05, 0x0000, 0x0000},
1093 	{0x05, 0x0051, 0x0001},
1094 	{0x05, 0x0000, 0x0000},
1095 	{0x05, 0x0052, 0x0001},
1096 	{0x05, 0x0000, 0x0000},
1097 	{0x05, 0x0054, 0x0001},
1098 	{0x05, 0x0001, 0x0000},
1099 	{0x00, 0x0000, 0x0001},
1100 	{0x00, 0x0000, 0x0002},
1101 	{0x00, 0x000c, 0x0003},
1102 	{0x00, 0x0000, 0x0004},
1103 	{0x00, 0x0090, 0x0005},
1104 	{0x00, 0x0000, 0x0006},
1105 	{0x00, 0x0040, 0x0007},
1106 	{0x00, 0x00c0, 0x0008},
1107 	{0x00, 0x004a, 0x0009},
1108 	{0x00, 0x0000, 0x000a},
1109 	{0x00, 0x0000, 0x000b},
1110 	{0x00, 0x0001, 0x000c},
1111 	{0x00, 0x0001, 0x000d},
1112 	{0x00, 0x0000, 0x000e},
1113 	{0x00, 0x0002, 0x000f},
1114 	{0x00, 0x0001, 0x0010},
1115 	{0x00, 0x0000, 0x0011},
1116 	{0x00, 0x0000, 0x0012},
1117 	{0x00, 0x0002, 0x0020},
1118 	{0x00, 0x0080, 0x0021},
1119 	{0x00, 0x0001, 0x0022},
1120 	{0x00, 0x00e0, 0x0023},
1121 	{0x00, 0x0000, 0x0024},
1122 	{0x00, 0x00d5, 0x0025},
1123 	{0x00, 0x0000, 0x0026},
1124 	{0x00, 0x000b, 0x0027},
1125 	{0x00, 0x0000, 0x0046},
1126 	{0x00, 0x0000, 0x0047},
1127 	{0x00, 0x0000, 0x0048},
1128 	{0x00, 0x0000, 0x0049},
1129 	{0x00, 0x0008, 0x004a},
1130 	{0xff, 0x0000, 0x00d0},
1131 	{0xff, 0x00d8, 0x00d1},
1132 	{0xff, 0x0000, 0x00d4},
1133 	{0xff, 0x0000, 0x00d5},
1134 	{0x01, 0x00a6, 0x0000},
1135 	{0x01, 0x0028, 0x0001},
1136 	{0x01, 0x0000, 0x0002},
1137 	{0x01, 0x000a, 0x0003},
1138 	{0x01, 0x0040, 0x0004},
1139 	{0x01, 0x0066, 0x0007},
1140 	{0x01, 0x0011, 0x0008},
1141 	{0x01, 0x0032, 0x0009},
1142 	{0x01, 0x00fd, 0x000a},
1143 	{0x01, 0x0038, 0x000b},
1144 	{0x01, 0x00d1, 0x000c},
1145 	{0x01, 0x00f7, 0x000d},
1146 	{0x01, 0x00ed, 0x000e},
1147 	{0x01, 0x00d8, 0x000f},
1148 	{0x01, 0x0038, 0x0010},
1149 	{0x01, 0x00ff, 0x0015},
1150 	{0x01, 0x0001, 0x0016},
1151 	{0x01, 0x0032, 0x0017},
1152 	{0x01, 0x0023, 0x0018},
1153 	{0x01, 0x00ce, 0x0019},
1154 	{0x01, 0x0023, 0x001a},
1155 	{0x01, 0x0032, 0x001b},
1156 	{0x01, 0x008d, 0x001c},
1157 	{0x01, 0x00ce, 0x001d},
1158 	{0x01, 0x008d, 0x001e},
1159 	{0x01, 0x0000, 0x001f},
1160 	{0x01, 0x0000, 0x0020},
1161 	{0x01, 0x00ff, 0x003e},
1162 	{0x01, 0x0003, 0x003f},
1163 	{0x01, 0x0000, 0x0040},
1164 	{0x01, 0x0035, 0x0041},
1165 	{0x01, 0x0053, 0x0042},
1166 	{0x01, 0x0069, 0x0043},
1167 	{0x01, 0x007c, 0x0044},
1168 	{0x01, 0x008c, 0x0045},
1169 	{0x01, 0x009a, 0x0046},
1170 	{0x01, 0x00a8, 0x0047},
1171 	{0x01, 0x00b4, 0x0048},
1172 	{0x01, 0x00bf, 0x0049},
1173 	{0x01, 0x00ca, 0x004a},
1174 	{0x01, 0x00d4, 0x004b},
1175 	{0x01, 0x00dd, 0x004c},
1176 	{0x01, 0x00e7, 0x004d},
1177 	{0x01, 0x00ef, 0x004e},
1178 	{0x01, 0x00f8, 0x004f},
1179 	{0x01, 0x00ff, 0x0050},
1180 	{0x01, 0x0001, 0x0056},
1181 	{0x01, 0x0060, 0x0057},
1182 	{0x01, 0x0040, 0x0058},
1183 	{0x01, 0x0011, 0x0059},
1184 	{0x01, 0x0001, 0x005a},
1185 	{0x02, 0x0007, 0x0005},
1186 	{0x02, 0xa048, 0x0000},
1187 	{0x02, 0x0007, 0x0005},
1188 	{0x02, 0x0015, 0x0006},
1189 	{0x02, 0x100a, 0x0007},
1190 	{0x02, 0xa048, 0x0000},
1191 	{0x02, 0xc002, 0x0001},
1192 	{0x02, 0x000f, 0x0005},
1193 	{0x02, 0xa048, 0x0000},
1194 	{0x05, 0x0022, 0x0004},
1195 	{0x05, 0x0025, 0x0001},
1196 	{0x05, 0x0000, 0x0000},
1197 	{0x05, 0x0026, 0x0001},
1198 	{0x05, 0x0001, 0x0000},
1199 	{0x05, 0x0027, 0x0001},
1200 	{0x05, 0x0000, 0x0000},
1201 	{0x05, 0x0001, 0x0001},
1202 	{0x05, 0x0000, 0x0000},
1203 	{0x05, 0x0021, 0x0001},
1204 	{0x05, 0x00d2, 0x0000},
1205 	{0x05, 0x0020, 0x0001},
1206 	{0x05, 0x0000, 0x0000},
1207 	{0x00, 0x0090, 0x0005},
1208 	{0x01, 0x00a6, 0x0000},
1209 	{0x05, 0x0026, 0x0001},
1210 	{0x05, 0x0001, 0x0000},
1211 	{0x05, 0x0027, 0x0001},
1212 	{0x05, 0x000f, 0x0000},
1213 	{0x01, 0x0003, 0x003f},
1214 	{0x01, 0x0001, 0x0056},
1215 	{0x01, 0x0011, 0x0008},
1216 	{0x01, 0x0032, 0x0009},
1217 	{0x01, 0xfffd, 0x000a},
1218 	{0x01, 0x0023, 0x000b},
1219 	{0x01, 0xffea, 0x000c},
1220 	{0x01, 0xfff4, 0x000d},
1221 	{0x01, 0xfffc, 0x000e},
1222 	{0x01, 0xffe3, 0x000f},
1223 	{0x01, 0x001f, 0x0010},
1224 	{0x01, 0x00a8, 0x0001},
1225 	{0x01, 0x0067, 0x0007},
1226 	{0x01, 0x0042, 0x0051},
1227 	{0x01, 0x0051, 0x0053},
1228 	{0x01, 0x000a, 0x0003},
1229 	{0x02, 0xc002, 0x0001},
1230 	{0x02, 0x0007, 0x0005},
1231 	{0x02, 0xc000, 0x0001},
1232 	{0x02, 0x0000, 0x0005},
1233 	{0x02, 0x0007, 0x0005},
1234 	{0x02, 0x2000, 0x0000},
1235 	{0x05, 0x0022, 0x0004},
1236 	{0x05, 0x0015, 0x0001},
1237 	{0x05, 0x00ea, 0x0000},
1238 	{0x05, 0x0021, 0x0001},
1239 	{0x05, 0x00d2, 0x0000},
1240 	{0x05, 0x0023, 0x0001},
1241 	{0x05, 0x0003, 0x0000},
1242 	{0x05, 0x0030, 0x0001},
1243 	{0x05, 0x002b, 0x0000},
1244 	{0x05, 0x0031, 0x0001},
1245 	{0x05, 0x0023, 0x0000},
1246 	{0x05, 0x0032, 0x0001},
1247 	{0x05, 0x0023, 0x0000},
1248 	{0x05, 0x0033, 0x0001},
1249 	{0x05, 0x0023, 0x0000},
1250 	{0x05, 0x0034, 0x0001},
1251 	{0x05, 0x0002, 0x0000},
1252 	{0x05, 0x0050, 0x0001},
1253 	{0x05, 0x0000, 0x0000},
1254 	{0x05, 0x0051, 0x0001},
1255 	{0x05, 0x0000, 0x0000},
1256 	{0x05, 0x0052, 0x0001},
1257 	{0x05, 0x0000, 0x0000},
1258 	{0x05, 0x0054, 0x0001},
1259 	{0x05, 0x0001, 0x0000},
1260 	{0x00, 0x0000, 0x0001},
1261 	{0x00, 0x0000, 0x0002},
1262 	{0x00, 0x000c, 0x0003},
1263 	{0x00, 0x0000, 0x0004},
1264 	{0x00, 0x0090, 0x0005},
1265 	{0x00, 0x0000, 0x0006},
1266 	{0x00, 0x0040, 0x0007},
1267 	{0x00, 0x00c0, 0x0008},
1268 	{0x00, 0x004a, 0x0009},
1269 	{0x00, 0x0000, 0x000a},
1270 	{0x00, 0x0000, 0x000b},
1271 	{0x00, 0x0001, 0x000c},
1272 	{0x00, 0x0001, 0x000d},
1273 	{0x00, 0x0000, 0x000e},
1274 	{0x00, 0x0002, 0x000f},
1275 	{0x00, 0x0001, 0x0010},
1276 	{0x00, 0x0000, 0x0011},
1277 	{0x00, 0x0000, 0x0012},
1278 	{0x00, 0x0002, 0x0020},
1279 	{0x00, 0x0080, 0x0021},
1280 	{0x00, 0x0001, 0x0022},
1281 	{0x00, 0x00e0, 0x0023},
1282 	{0x00, 0x0000, 0x0024},
1283 	{0x00, 0x00d5, 0x0025},
1284 	{0x00, 0x0000, 0x0026},
1285 	{0x00, 0x000b, 0x0027},
1286 	{0x00, 0x0000, 0x0046},
1287 	{0x00, 0x0000, 0x0047},
1288 	{0x00, 0x0000, 0x0048},
1289 	{0x00, 0x0000, 0x0049},
1290 	{0x00, 0x0008, 0x004a},
1291 	{0xff, 0x0000, 0x00d0},
1292 	{0xff, 0x00d8, 0x00d1},
1293 	{0xff, 0x0000, 0x00d4},
1294 	{0xff, 0x0000, 0x00d5},
1295 	{0x01, 0x00a6, 0x0000},
1296 	{0x01, 0x0028, 0x0001},
1297 	{0x01, 0x0000, 0x0002},
1298 	{0x01, 0x000a, 0x0003},
1299 	{0x01, 0x0040, 0x0004},
1300 	{0x01, 0x0066, 0x0007},
1301 	{0x01, 0x0011, 0x0008},
1302 	{0x01, 0x0032, 0x0009},
1303 	{0x01, 0x00fd, 0x000a},
1304 	{0x01, 0x0038, 0x000b},
1305 	{0x01, 0x00d1, 0x000c},
1306 	{0x01, 0x00f7, 0x000d},
1307 	{0x01, 0x00ed, 0x000e},
1308 	{0x01, 0x00d8, 0x000f},
1309 	{0x01, 0x0038, 0x0010},
1310 	{0x01, 0x00ff, 0x0015},
1311 	{0x01, 0x0001, 0x0016},
1312 	{0x01, 0x0032, 0x0017},
1313 	{0x01, 0x0023, 0x0018},
1314 	{0x01, 0x00ce, 0x0019},
1315 	{0x01, 0x0023, 0x001a},
1316 	{0x01, 0x0032, 0x001b},
1317 	{0x01, 0x008d, 0x001c},
1318 	{0x01, 0x00ce, 0x001d},
1319 	{0x01, 0x008d, 0x001e},
1320 	{0x01, 0x0000, 0x001f},
1321 	{0x01, 0x0000, 0x0020},
1322 	{0x01, 0x00ff, 0x003e},
1323 	{0x01, 0x0003, 0x003f},
1324 	{0x01, 0x0000, 0x0040},
1325 	{0x01, 0x0035, 0x0041},
1326 	{0x01, 0x0053, 0x0042},
1327 	{0x01, 0x0069, 0x0043},
1328 	{0x01, 0x007c, 0x0044},
1329 	{0x01, 0x008c, 0x0045},
1330 	{0x01, 0x009a, 0x0046},
1331 	{0x01, 0x00a8, 0x0047},
1332 	{0x01, 0x00b4, 0x0048},
1333 	{0x01, 0x00bf, 0x0049},
1334 	{0x01, 0x00ca, 0x004a},
1335 	{0x01, 0x00d4, 0x004b},
1336 	{0x01, 0x00dd, 0x004c},
1337 	{0x01, 0x00e7, 0x004d},
1338 	{0x01, 0x00ef, 0x004e},
1339 	{0x01, 0x00f8, 0x004f},
1340 	{0x01, 0x00ff, 0x0050},
1341 	{0x01, 0x0001, 0x0056},
1342 	{0x01, 0x0060, 0x0057},
1343 	{0x01, 0x0040, 0x0058},
1344 	{0x01, 0x0011, 0x0059},
1345 	{0x01, 0x0001, 0x005a},
1346 	{0x02, 0x0007, 0x0005},
1347 	{0x02, 0xa048, 0x0000},
1348 	{0x02, 0x0007, 0x0005},
1349 	{0x02, 0x0015, 0x0006},
1350 	{0x02, 0x100a, 0x0007},
1351 	{0x02, 0xa048, 0x0000},
1352 	{0x02, 0xc002, 0x0001},
1353 	{0x02, 0x000f, 0x0005},
1354 	{0x02, 0xa048, 0x0000},
1355 	{0x05, 0x0022, 0x0004},
1356 	{0x05, 0x0025, 0x0001},
1357 	{0x05, 0x0000, 0x0000},
1358 	{0x05, 0x0026, 0x0001},
1359 	{0x05, 0x0001, 0x0000},
1360 	{0x05, 0x0027, 0x0001},
1361 	{0x05, 0x0000, 0x0000},
1362 	{0x05, 0x0001, 0x0001},
1363 	{0x05, 0x0000, 0x0000},
1364 	{0x05, 0x0021, 0x0001},
1365 	{0x05, 0x00d2, 0x0000},
1366 	{0x05, 0x0020, 0x0001},
1367 	{0x05, 0x0000, 0x0000},
1368 	{0x00, 0x0090, 0x0005},
1369 	{0x01, 0x00a6, 0x0000},
1370 	{0x02, 0x0007, 0x0005},
1371 	{0x02, 0x2000, 0x0000},
1372 	{0x05, 0x0022, 0x0004},
1373 	{0x05, 0x0015, 0x0001},
1374 	{0x05, 0x00ea, 0x0000},
1375 	{0x05, 0x0021, 0x0001},
1376 	{0x05, 0x00d2, 0x0000},
1377 	{0x05, 0x0023, 0x0001},
1378 	{0x05, 0x0003, 0x0000},
1379 	{0x05, 0x0030, 0x0001},
1380 	{0x05, 0x002b, 0x0000},
1381 	{0x05, 0x0031, 0x0001},
1382 	{0x05, 0x0023, 0x0000},
1383 	{0x05, 0x0032, 0x0001},
1384 	{0x05, 0x0023, 0x0000},
1385 	{0x05, 0x0033, 0x0001},
1386 	{0x05, 0x0023, 0x0000},
1387 	{0x05, 0x0034, 0x0001},
1388 	{0x05, 0x0002, 0x0000},
1389 	{0x05, 0x0050, 0x0001},
1390 	{0x05, 0x0000, 0x0000},
1391 	{0x05, 0x0051, 0x0001},
1392 	{0x05, 0x0000, 0x0000},
1393 	{0x05, 0x0052, 0x0001},
1394 	{0x05, 0x0000, 0x0000},
1395 	{0x05, 0x0054, 0x0001},
1396 	{0x05, 0x0001, 0x0000},
1397 	{0x00, 0x0000, 0x0001},
1398 	{0x00, 0x0000, 0x0002},
1399 	{0x00, 0x000c, 0x0003},
1400 	{0x00, 0x0000, 0x0004},
1401 	{0x00, 0x0090, 0x0005},
1402 	{0x00, 0x0000, 0x0006},
1403 	{0x00, 0x0040, 0x0007},
1404 	{0x00, 0x00c0, 0x0008},
1405 	{0x00, 0x004a, 0x0009},
1406 	{0x00, 0x0000, 0x000a},
1407 	{0x00, 0x0000, 0x000b},
1408 	{0x00, 0x0001, 0x000c},
1409 	{0x00, 0x0001, 0x000d},
1410 	{0x00, 0x0000, 0x000e},
1411 	{0x00, 0x0002, 0x000f},
1412 	{0x00, 0x0001, 0x0010},
1413 	{0x00, 0x0000, 0x0011},
1414 	{0x00, 0x0000, 0x0012},
1415 	{0x00, 0x0002, 0x0020},
1416 	{0x00, 0x0080, 0x0021},
1417 	{0x00, 0x0001, 0x0022},
1418 	{0x00, 0x00e0, 0x0023},
1419 	{0x00, 0x0000, 0x0024},
1420 	{0x00, 0x00d5, 0x0025},
1421 	{0x00, 0x0000, 0x0026},
1422 	{0x00, 0x000b, 0x0027},
1423 	{0x00, 0x0000, 0x0046},
1424 	{0x00, 0x0000, 0x0047},
1425 	{0x00, 0x0000, 0x0048},
1426 	{0x00, 0x0000, 0x0049},
1427 	{0x00, 0x0008, 0x004a},
1428 	{0xff, 0x0000, 0x00d0},
1429 	{0xff, 0x00d8, 0x00d1},
1430 	{0xff, 0x0000, 0x00d4},
1431 	{0xff, 0x0000, 0x00d5},
1432 	{0x01, 0x00a6, 0x0000},
1433 	{0x01, 0x0028, 0x0001},
1434 	{0x01, 0x0000, 0x0002},
1435 	{0x01, 0x000a, 0x0003},
1436 	{0x01, 0x0040, 0x0004},
1437 	{0x01, 0x0066, 0x0007},
1438 	{0x01, 0x0011, 0x0008},
1439 	{0x01, 0x0032, 0x0009},
1440 	{0x01, 0x00fd, 0x000a},
1441 	{0x01, 0x0038, 0x000b},
1442 	{0x01, 0x00d1, 0x000c},
1443 	{0x01, 0x00f7, 0x000d},
1444 	{0x01, 0x00ed, 0x000e},
1445 	{0x01, 0x00d8, 0x000f},
1446 	{0x01, 0x0038, 0x0010},
1447 	{0x01, 0x00ff, 0x0015},
1448 	{0x01, 0x0001, 0x0016},
1449 	{0x01, 0x0032, 0x0017},
1450 	{0x01, 0x0023, 0x0018},
1451 	{0x01, 0x00ce, 0x0019},
1452 	{0x01, 0x0023, 0x001a},
1453 	{0x01, 0x0032, 0x001b},
1454 	{0x01, 0x008d, 0x001c},
1455 	{0x01, 0x00ce, 0x001d},
1456 	{0x01, 0x008d, 0x001e},
1457 	{0x01, 0x0000, 0x001f},
1458 	{0x01, 0x0000, 0x0020},
1459 	{0x01, 0x00ff, 0x003e},
1460 	{0x01, 0x0003, 0x003f},
1461 	{0x01, 0x0000, 0x0040},
1462 	{0x01, 0x0035, 0x0041},
1463 	{0x01, 0x0053, 0x0042},
1464 	{0x01, 0x0069, 0x0043},
1465 	{0x01, 0x007c, 0x0044},
1466 	{0x01, 0x008c, 0x0045},
1467 	{0x01, 0x009a, 0x0046},
1468 	{0x01, 0x00a8, 0x0047},
1469 	{0x01, 0x00b4, 0x0048},
1470 	{0x01, 0x00bf, 0x0049},
1471 	{0x01, 0x00ca, 0x004a},
1472 	{0x01, 0x00d4, 0x004b},
1473 	{0x01, 0x00dd, 0x004c},
1474 	{0x01, 0x00e7, 0x004d},
1475 	{0x01, 0x00ef, 0x004e},
1476 	{0x01, 0x00f8, 0x004f},
1477 	{0x01, 0x00ff, 0x0050},
1478 	{0x01, 0x0001, 0x0056},
1479 	{0x01, 0x0060, 0x0057},
1480 	{0x01, 0x0040, 0x0058},
1481 	{0x01, 0x0011, 0x0059},
1482 	{0x01, 0x0001, 0x005a},
1483 	{0x02, 0x0007, 0x0005},
1484 	{0x02, 0xa048, 0x0000},
1485 	{0x02, 0x0007, 0x0005},
1486 	{0x02, 0x0015, 0x0006},
1487 	{0x02, 0x100a, 0x0007},
1488 	{0x02, 0xa048, 0x0000},
1489 	{0x02, 0xc002, 0x0001},
1490 	{0x02, 0x000f, 0x0005},
1491 	{0x02, 0xa048, 0x0000},
1492 	{0x05, 0x0022, 0x0004},
1493 	{0x05, 0x0025, 0x0001},
1494 	{0x05, 0x0000, 0x0000},
1495 	{0x05, 0x0026, 0x0001},
1496 	{0x05, 0x0001, 0x0000},
1497 	{0x05, 0x0027, 0x0001},
1498 	{0x05, 0x0000, 0x0000},
1499 	{0x05, 0x0001, 0x0001},
1500 	{0x05, 0x0000, 0x0000},
1501 	{0x05, 0x0021, 0x0001},
1502 	{0x05, 0x00d2, 0x0000},
1503 	{0x05, 0x0020, 0x0001},
1504 	{0x05, 0x0000, 0x0000},
1505 	{0x00, 0x0090, 0x0005},
1506 	{0x01, 0x00a6, 0x0000},
1507 	{0x05, 0x0026, 0x0001},
1508 	{0x05, 0x0001, 0x0000},
1509 	{0x05, 0x0027, 0x0001},
1510 	{0x05, 0x001e, 0x0000},
1511 	{0x01, 0x0003, 0x003f},
1512 	{0x01, 0x0001, 0x0056},
1513 	{0x01, 0x0011, 0x0008},
1514 	{0x01, 0x0032, 0x0009},
1515 	{0x01, 0xfffd, 0x000a},
1516 	{0x01, 0x0023, 0x000b},
1517 	{0x01, 0xffea, 0x000c},
1518 	{0x01, 0xfff4, 0x000d},
1519 	{0x01, 0xfffc, 0x000e},
1520 	{0x01, 0xffe3, 0x000f},
1521 	{0x01, 0x001f, 0x0010},
1522 	{0x01, 0x00a8, 0x0001},
1523 	{0x01, 0x0067, 0x0007},
1524 	{0x01, 0x0042, 0x0051},
1525 	{0x01, 0x0051, 0x0053},
1526 	{0x01, 0x000a, 0x0003},
1527 	{0x02, 0xc002, 0x0001},
1528 	{0x02, 0x0007, 0x0005},
1529 	{0x01, 0x0042, 0x0051},
1530 	{0x01, 0x0051, 0x0053},
1531 	{0x05, 0x0026, 0x0001},
1532 	{0x05, 0x0001, 0x0000},
1533 	{0x05, 0x0027, 0x0001},
1534 	{0x05, 0x002d, 0x0000},
1535 	{0x01, 0x0003, 0x003f},
1536 	{0x01, 0x0001, 0x0056},
1537 	{0x02, 0xc000, 0x0001},
1538 	{0x02, 0x0000, 0x0005},
1539 	{}
1540 };
1541 
1542 /* Unknown camera from Ori Usbid 0x0000:0x0000 */
1543 /* Based on snoops from Ori Cohen */
1544 static const __u16 spca501c_mysterious_open_data[][3] = {
1545 	{0x02, 0x000f, 0x0005},
1546 	{0x02, 0xa048, 0x0000},
1547 	{0x05, 0x0022, 0x0004},
1548 /* DSP Registers */
1549 	{0x01, 0x0016, 0x0011},	/* RGB offset */
1550 	{0x01, 0x0000, 0x0012},
1551 	{0x01, 0x0006, 0x0013},
1552 	{0x01, 0x0078, 0x0051},
1553 	{0x01, 0x0040, 0x0052},
1554 	{0x01, 0x0046, 0x0053},
1555 	{0x01, 0x0040, 0x0054},
1556 	{0x00, 0x0025, 0x0000},
1557 /*	{0x00, 0x0000, 0x0000 }, */
1558 /* Part 2 */
1559 /* TG Registers */
1560 	{0x00, 0x0026, 0x0000},
1561 	{0x00, 0x0001, 0x0000},
1562 	{0x00, 0x0027, 0x0000},
1563 	{0x00, 0x008a, 0x0000},
1564 	{0x02, 0x0007, 0x0005},
1565 	{0x02, 0x2000, 0x0000},
1566 	{0x05, 0x0022, 0x0004},
1567 	{0x05, 0x0015, 0x0001},
1568 	{0x05, 0x00ea, 0x0000},
1569 	{0x05, 0x0021, 0x0001},
1570 	{0x05, 0x00d2, 0x0000},
1571 	{0x05, 0x0023, 0x0001},
1572 	{0x05, 0x0003, 0x0000},
1573 	{0x05, 0x0030, 0x0001},
1574 	{0x05, 0x002b, 0x0000},
1575 	{0x05, 0x0031, 0x0001},
1576 	{0x05, 0x0023, 0x0000},
1577 	{0x05, 0x0032, 0x0001},
1578 	{0x05, 0x0023, 0x0000},
1579 	{0x05, 0x0033, 0x0001},
1580 	{0x05, 0x0023, 0x0000},
1581 	{0x05, 0x0034, 0x0001},
1582 	{0x05, 0x0002, 0x0000},
1583 	{0x05, 0x0050, 0x0001},
1584 	{0x05, 0x0000, 0x0000},
1585 	{0x05, 0x0051, 0x0001},
1586 	{0x05, 0x0000, 0x0000},
1587 	{0x05, 0x0052, 0x0001},
1588 	{0x05, 0x0000, 0x0000},
1589 	{0x05, 0x0054, 0x0001},
1590 	{0x05, 0x0001, 0x0000},
1591 	{}
1592 };
1593 
1594 /* Based on snoops from Ori Cohen */
1595 static const __u16 spca501c_mysterious_init_data[][3] = {
1596 /* Part 3 */
1597 /* TG registers */
1598 /*	{0x00, 0x0000, 0x0000}, */
1599 	{0x00, 0x0000, 0x0001},
1600 	{0x00, 0x0000, 0x0002},
1601 	{0x00, 0x0006, 0x0003},
1602 	{0x00, 0x0000, 0x0004},
1603 	{0x00, 0x0090, 0x0005},
1604 	{0x00, 0x0000, 0x0006},
1605 	{0x00, 0x0040, 0x0007},
1606 	{0x00, 0x00c0, 0x0008},
1607 	{0x00, 0x004a, 0x0009},
1608 	{0x00, 0x0000, 0x000a},
1609 	{0x00, 0x0000, 0x000b},
1610 	{0x00, 0x0001, 0x000c},
1611 	{0x00, 0x0001, 0x000d},
1612 	{0x00, 0x0000, 0x000e},
1613 	{0x00, 0x0002, 0x000f},
1614 	{0x00, 0x0001, 0x0010},
1615 	{0x00, 0x0000, 0x0011},
1616 	{0x00, 0x0001, 0x0012},
1617 	{0x00, 0x0002, 0x0020},
1618 	{0x00, 0x0080, 0x0021},	/* 640 */
1619 	{0x00, 0x0001, 0x0022},
1620 	{0x00, 0x00e0, 0x0023},	/* 480 */
1621 	{0x00, 0x0000, 0x0024},	/* Offset H hight */
1622 	{0x00, 0x00d3, 0x0025},	/* low */
1623 	{0x00, 0x0000, 0x0026},	/* Offset V */
1624 	{0x00, 0x000d, 0x0027},	/* low */
1625 	{0x00, 0x0000, 0x0046},
1626 	{0x00, 0x0000, 0x0047},
1627 	{0x00, 0x0000, 0x0048},
1628 	{0x00, 0x0000, 0x0049},
1629 	{0x00, 0x0008, 0x004a},
1630 /* DSP Registers	*/
1631 	{0x01, 0x00a6, 0x0000},
1632 	{0x01, 0x0028, 0x0001},
1633 	{0x01, 0x0000, 0x0002},
1634 	{0x01, 0x000a, 0x0003},	/* Level Calc bit7 ->1 Auto */
1635 	{0x01, 0x0040, 0x0004},
1636 	{0x01, 0x0066, 0x0007},
1637 	{0x01, 0x000f, 0x0008},	/* A11 Color correction coeff */
1638 	{0x01, 0x002d, 0x0009},	/* A12 */
1639 	{0x01, 0x0005, 0x000a},	/* A13 */
1640 	{0x01, 0x0023, 0x000b},	/* A21 */
1641 	{0x01, 0x00e0, 0x000c},	/* A22 */
1642 	{0x01, 0x00fd, 0x000d},	/* A23 */
1643 	{0x01, 0x00f4, 0x000e},	/* A31 */
1644 	{0x01, 0x00e4, 0x000f},	/* A32 */
1645 	{0x01, 0x0028, 0x0010},	/* A33 */
1646 	{0x01, 0x00ff, 0x0015},	/* Reserved */
1647 	{0x01, 0x0001, 0x0016},	/* Reserved */
1648 	{0x01, 0x0032, 0x0017},	/* Win1 Start begin */
1649 	{0x01, 0x0023, 0x0018},
1650 	{0x01, 0x00ce, 0x0019},
1651 	{0x01, 0x0023, 0x001a},
1652 	{0x01, 0x0032, 0x001b},
1653 	{0x01, 0x008d, 0x001c},
1654 	{0x01, 0x00ce, 0x001d},
1655 	{0x01, 0x008d, 0x001e},
1656 	{0x01, 0x0000, 0x001f},
1657 	{0x01, 0x0000, 0x0020},	/* Win1 Start end */
1658 	{0x01, 0x00ff, 0x003e},	/* Reserved begin */
1659 	{0x01, 0x0002, 0x003f},
1660 	{0x01, 0x0000, 0x0040},
1661 	{0x01, 0x0035, 0x0041},
1662 	{0x01, 0x0053, 0x0042},
1663 	{0x01, 0x0069, 0x0043},
1664 	{0x01, 0x007c, 0x0044},
1665 	{0x01, 0x008c, 0x0045},
1666 	{0x01, 0x009a, 0x0046},
1667 	{0x01, 0x00a8, 0x0047},
1668 	{0x01, 0x00b4, 0x0048},
1669 	{0x01, 0x00bf, 0x0049},
1670 	{0x01, 0x00ca, 0x004a},
1671 	{0x01, 0x00d4, 0x004b},
1672 	{0x01, 0x00dd, 0x004c},
1673 	{0x01, 0x00e7, 0x004d},
1674 	{0x01, 0x00ef, 0x004e},
1675 	{0x01, 0x00f8, 0x004f},
1676 	{0x01, 0x00ff, 0x0050},
1677 	{0x01, 0x0003, 0x0056},	/* Reserved end */
1678 	{0x01, 0x0060, 0x0057},	/* Edge Gain */
1679 	{0x01, 0x0040, 0x0058},
1680 	{0x01, 0x0011, 0x0059},	/* Edge Bandwidth */
1681 	{0x01, 0x0001, 0x005a},
1682 	{0x02, 0x0007, 0x0005},
1683 	{0x02, 0xa048, 0x0000},
1684 	{0x02, 0x0007, 0x0005},
1685 	{0x02, 0x0015, 0x0006},
1686 	{0x02, 0x200a, 0x0007},
1687 	{0x02, 0xa048, 0x0000},
1688 	{0x02, 0xc000, 0x0001},
1689 	{0x02, 0x000f, 0x0005},
1690 	{0x02, 0xa048, 0x0000},
1691 	{0x05, 0x0022, 0x0004},
1692 	{0x05, 0x0025, 0x0001},
1693 	{0x05, 0x0000, 0x0000},
1694 /* Part 4 */
1695 	{0x05, 0x0026, 0x0001},
1696 	{0x05, 0x0001, 0x0000},
1697 	{0x05, 0x0027, 0x0001},
1698 	{0x05, 0x0000, 0x0000},
1699 	{0x05, 0x0001, 0x0001},
1700 	{0x05, 0x0000, 0x0000},
1701 	{0x05, 0x0021, 0x0001},
1702 	{0x05, 0x00d2, 0x0000},
1703 	{0x05, 0x0020, 0x0001},
1704 	{0x05, 0x0000, 0x0000},
1705 	{0x00, 0x0090, 0x0005},
1706 	{0x01, 0x00a6, 0x0000},
1707 	{0x02, 0x0000, 0x0005},
1708 	{0x05, 0x0026, 0x0001},
1709 	{0x05, 0x0001, 0x0000},
1710 	{0x05, 0x0027, 0x0001},
1711 	{0x05, 0x004e, 0x0000},
1712 /* Part 5 */
1713 	{0x01, 0x0003, 0x003f},
1714 	{0x01, 0x0001, 0x0056},
1715 	{0x01, 0x000f, 0x0008},
1716 	{0x01, 0x002d, 0x0009},
1717 	{0x01, 0x0005, 0x000a},
1718 	{0x01, 0x0023, 0x000b},
1719 	{0x01, 0xffe0, 0x000c},
1720 	{0x01, 0xfffd, 0x000d},
1721 	{0x01, 0xfff4, 0x000e},
1722 	{0x01, 0xffe4, 0x000f},
1723 	{0x01, 0x0028, 0x0010},
1724 	{0x01, 0x00a8, 0x0001},
1725 	{0x01, 0x0066, 0x0007},
1726 	{0x01, 0x0032, 0x0017},
1727 	{0x01, 0x0023, 0x0018},
1728 	{0x01, 0x00ce, 0x0019},
1729 	{0x01, 0x0023, 0x001a},
1730 	{0x01, 0x0032, 0x001b},
1731 	{0x01, 0x008d, 0x001c},
1732 	{0x01, 0x00ce, 0x001d},
1733 	{0x01, 0x008d, 0x001e},
1734 	{0x01, 0x00c8, 0x0015},	/* c8 Poids fort Luma */
1735 	{0x01, 0x0032, 0x0016},	/* 32 */
1736 	{0x01, 0x0016, 0x0011},	/* R 00 */
1737 	{0x01, 0x0016, 0x0012},	/* G 00 */
1738 	{0x01, 0x0016, 0x0013},	/* B 00 */
1739 	{0x01, 0x000a, 0x0003},
1740 	{0x02, 0xc002, 0x0001},
1741 	{0x02, 0x0007, 0x0005},
1742 	{}
1743 };
1744 
1745 static int reg_write(struct gspca_dev *gspca_dev,
1746 					__u16 req, __u16 index, __u16 value)
1747 {
1748 	int ret;
1749 	struct usb_device *dev = gspca_dev->dev;
1750 
1751 	ret = usb_control_msg(dev,
1752 			usb_sndctrlpipe(dev, 0),
1753 			req,
1754 			USB_TYPE_VENDOR | USB_RECIP_DEVICE,
1755 			value, index, NULL, 0, 500);
1756 	gspca_dbg(gspca_dev, D_USBO, "reg write: 0x%02x 0x%02x 0x%02x\n",
1757 		  req, index, value);
1758 	if (ret < 0)
1759 		pr_err("reg write: error %d\n", ret);
1760 	return ret;
1761 }
1762 
1763 
1764 static int write_vector(struct gspca_dev *gspca_dev, const __u16 data[][3])
1765 {
1766 	int ret, i = 0;
1767 
1768 	while (data[i][0] != 0 || data[i][1] != 0 || data[i][2] != 0) {
1769 		ret = reg_write(gspca_dev, data[i][0], data[i][2],
1770 								data[i][1]);
1771 		if (ret < 0) {
1772 			gspca_err(gspca_dev, "Reg write failed for 0x%02x,0x%02x,0x%02x\n",
1773 				  data[i][0], data[i][1], data[i][2]);
1774 			return ret;
1775 		}
1776 		i++;
1777 	}
1778 	return 0;
1779 }
1780 
1781 static void setbrightness(struct gspca_dev *gspca_dev, s32 val)
1782 {
1783 	reg_write(gspca_dev, SPCA501_REG_CCDSP, 0x12, val);
1784 }
1785 
1786 static void setcontrast(struct gspca_dev *gspca_dev, s32 val)
1787 {
1788 	reg_write(gspca_dev, 0x00, 0x00, (val >> 8) & 0xff);
1789 	reg_write(gspca_dev, 0x00, 0x01, val & 0xff);
1790 }
1791 
1792 static void setcolors(struct gspca_dev *gspca_dev, s32 val)
1793 {
1794 	reg_write(gspca_dev, SPCA501_REG_CCDSP, 0x0c, val);
1795 }
1796 
1797 static void setblue_balance(struct gspca_dev *gspca_dev, s32 val)
1798 {
1799 	reg_write(gspca_dev, SPCA501_REG_CCDSP, 0x11, val);
1800 }
1801 
1802 static void setred_balance(struct gspca_dev *gspca_dev, s32 val)
1803 {
1804 	reg_write(gspca_dev, SPCA501_REG_CCDSP, 0x13, val);
1805 }
1806 
1807 /* this function is called at probe time */
1808 static int sd_config(struct gspca_dev *gspca_dev,
1809 			const struct usb_device_id *id)
1810 {
1811 	struct sd *sd = (struct sd *) gspca_dev;
1812 	struct cam *cam;
1813 
1814 	cam = &gspca_dev->cam;
1815 	cam->cam_mode = vga_mode;
1816 	cam->nmodes = ARRAY_SIZE(vga_mode);
1817 	sd->subtype = id->driver_info;
1818 
1819 	return 0;
1820 }
1821 
1822 /* this function is called at probe and resume time */
1823 static int sd_init(struct gspca_dev *gspca_dev)
1824 {
1825 	struct sd *sd = (struct sd *) gspca_dev;
1826 
1827 	switch (sd->subtype) {
1828 	case Arowana300KCMOSCamera:
1829 	case SmileIntlCamera:
1830 		/* Arowana 300k CMOS Camera data */
1831 		if (write_vector(gspca_dev, spca501c_arowana_init_data))
1832 			goto error;
1833 		break;
1834 	case MystFromOriUnknownCamera:
1835 		/* Unknown Ori CMOS Camera data */
1836 		if (write_vector(gspca_dev, spca501c_mysterious_open_data))
1837 			goto error;
1838 		break;
1839 	default:
1840 		/* generic spca501 init data */
1841 		if (write_vector(gspca_dev, spca501_init_data))
1842 			goto error;
1843 		break;
1844 	}
1845 	gspca_dbg(gspca_dev, D_STREAM, "Initializing SPCA501 finished\n");
1846 	return 0;
1847 error:
1848 	return -EINVAL;
1849 }
1850 
1851 static int sd_start(struct gspca_dev *gspca_dev)
1852 {
1853 	struct sd *sd = (struct sd *) gspca_dev;
1854 	int mode;
1855 
1856 	switch (sd->subtype) {
1857 	case ThreeComHomeConnectLite:
1858 		/* Special handling for 3com data */
1859 		write_vector(gspca_dev, spca501_3com_open_data);
1860 		break;
1861 	case Arowana300KCMOSCamera:
1862 	case SmileIntlCamera:
1863 		/* Arowana 300k CMOS Camera data */
1864 		write_vector(gspca_dev, spca501c_arowana_open_data);
1865 		break;
1866 	case MystFromOriUnknownCamera:
1867 		/* Unknown CMOS Camera data */
1868 		write_vector(gspca_dev, spca501c_mysterious_init_data);
1869 		break;
1870 	default:
1871 		/* Generic 501 open data */
1872 		write_vector(gspca_dev, spca501_open_data);
1873 	}
1874 
1875 	/* memorize the wanted pixel format */
1876 	mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
1877 
1878 	/* Enable ISO packet machine CTRL reg=2,
1879 	 * index=1 bitmask=0x2 (bit ordinal 1) */
1880 	reg_write(gspca_dev, SPCA50X_REG_USB, 0x6, 0x94);
1881 	switch (mode) {
1882 	case 0: /* 640x480 */
1883 		reg_write(gspca_dev, SPCA50X_REG_USB, 0x07, 0x004a);
1884 		break;
1885 	case 1: /* 320x240 */
1886 		reg_write(gspca_dev, SPCA50X_REG_USB, 0x07, 0x104a);
1887 		break;
1888 	default:
1889 /*	case 2:  * 160x120 */
1890 		reg_write(gspca_dev, SPCA50X_REG_USB, 0x07, 0x204a);
1891 		break;
1892 	}
1893 	reg_write(gspca_dev, SPCA501_REG_CTLRL, 0x01, 0x02);
1894 
1895 	return 0;
1896 }
1897 
1898 static void sd_stopN(struct gspca_dev *gspca_dev)
1899 {
1900 	/* Disable ISO packet
1901 	 * machine CTRL reg=2, index=1 bitmask=0x0 (bit ordinal 1) */
1902 	reg_write(gspca_dev, SPCA501_REG_CTLRL, 0x01, 0x00);
1903 }
1904 
1905 /* called on streamoff with alt 0 and on disconnect */
1906 static void sd_stop0(struct gspca_dev *gspca_dev)
1907 {
1908 	if (!gspca_dev->present)
1909 		return;
1910 	reg_write(gspca_dev, SPCA501_REG_CTLRL, 0x05, 0x00);
1911 }
1912 
1913 static void sd_pkt_scan(struct gspca_dev *gspca_dev,
1914 			u8 *data,			/* isoc packet */
1915 			int len)			/* iso packet length */
1916 {
1917 	switch (data[0]) {
1918 	case 0:				/* start of frame */
1919 		gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);
1920 		data += SPCA501_OFFSET_DATA;
1921 		len -= SPCA501_OFFSET_DATA;
1922 		gspca_frame_add(gspca_dev, FIRST_PACKET, data, len);
1923 		return;
1924 	case 0xff:			/* drop */
1925 /*		gspca_dev->last_packet_type = DISCARD_PACKET; */
1926 		return;
1927 	}
1928 	data++;
1929 	len--;
1930 	gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
1931 }
1932 
1933 static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
1934 {
1935 	struct gspca_dev *gspca_dev =
1936 		container_of(ctrl->handler, struct gspca_dev, ctrl_handler);
1937 
1938 	gspca_dev->usb_err = 0;
1939 
1940 	if (!gspca_dev->streaming)
1941 		return 0;
1942 
1943 	switch (ctrl->id) {
1944 	case V4L2_CID_BRIGHTNESS:
1945 		setbrightness(gspca_dev, ctrl->val);
1946 		break;
1947 	case V4L2_CID_CONTRAST:
1948 		setcontrast(gspca_dev, ctrl->val);
1949 		break;
1950 	case V4L2_CID_SATURATION:
1951 		setcolors(gspca_dev, ctrl->val);
1952 		break;
1953 	case V4L2_CID_BLUE_BALANCE:
1954 		setblue_balance(gspca_dev, ctrl->val);
1955 		break;
1956 	case V4L2_CID_RED_BALANCE:
1957 		setred_balance(gspca_dev, ctrl->val);
1958 		break;
1959 	}
1960 	return gspca_dev->usb_err;
1961 }
1962 
1963 static const struct v4l2_ctrl_ops sd_ctrl_ops = {
1964 	.s_ctrl = sd_s_ctrl,
1965 };
1966 
1967 static int sd_init_controls(struct gspca_dev *gspca_dev)
1968 {
1969 	struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler;
1970 
1971 	gspca_dev->vdev.ctrl_handler = hdl;
1972 	v4l2_ctrl_handler_init(hdl, 5);
1973 	v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1974 			V4L2_CID_BRIGHTNESS, 0, 127, 1, 0);
1975 	v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1976 			V4L2_CID_CONTRAST, 0, 64725, 1, 64725);
1977 	v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1978 			V4L2_CID_SATURATION, 0, 63, 1, 20);
1979 	v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1980 			V4L2_CID_BLUE_BALANCE, 0, 127, 1, 0);
1981 	v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1982 			V4L2_CID_RED_BALANCE, 0, 127, 1, 0);
1983 
1984 	if (hdl->error) {
1985 		pr_err("Could not initialize controls\n");
1986 		return hdl->error;
1987 	}
1988 	return 0;
1989 }
1990 
1991 /* sub-driver description */
1992 static const struct sd_desc sd_desc = {
1993 	.name = MODULE_NAME,
1994 	.config = sd_config,
1995 	.init = sd_init,
1996 	.init_controls = sd_init_controls,
1997 	.start = sd_start,
1998 	.stopN = sd_stopN,
1999 	.stop0 = sd_stop0,
2000 	.pkt_scan = sd_pkt_scan,
2001 };
2002 
2003 /* -- module initialisation -- */
2004 static const struct usb_device_id device_table[] = {
2005 	{USB_DEVICE(0x040a, 0x0002), .driver_info = KodakDVC325},
2006 	{USB_DEVICE(0x0497, 0xc001), .driver_info = SmileIntlCamera},
2007 	{USB_DEVICE(0x0506, 0x00df), .driver_info = ThreeComHomeConnectLite},
2008 	{USB_DEVICE(0x0733, 0x0401), .driver_info = IntelCreateAndShare},
2009 	{USB_DEVICE(0x0733, 0x0402), .driver_info = ViewQuestM318B},
2010 	{USB_DEVICE(0x1776, 0x501c), .driver_info = Arowana300KCMOSCamera},
2011 	{USB_DEVICE(0x0000, 0x0000), .driver_info = MystFromOriUnknownCamera},
2012 	{}
2013 };
2014 MODULE_DEVICE_TABLE(usb, device_table);
2015 
2016 /* -- device connect -- */
2017 static int sd_probe(struct usb_interface *intf,
2018 			const struct usb_device_id *id)
2019 {
2020 	return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
2021 				THIS_MODULE);
2022 }
2023 
2024 static struct usb_driver sd_driver = {
2025 	.name = MODULE_NAME,
2026 	.id_table = device_table,
2027 	.probe = sd_probe,
2028 	.disconnect = gspca_disconnect,
2029 #ifdef CONFIG_PM
2030 	.suspend = gspca_suspend,
2031 	.resume = gspca_resume,
2032 	.reset_resume = gspca_resume,
2033 #endif
2034 };
2035 
2036 module_usb_driver(sd_driver);
2037