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