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