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