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