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