V4L/DVB (12090): gspca_sonixj: enable autogain control for the ov7620
[linux-2.6] / drivers / media / video / gspca / vc032x.c
1 /*
2  *              Z-star vc0321 library
3  *              Copyright (C) 2006 Koninski Artur takeshi87@o2.pl
4  *              Copyright (C) 2006 Michel Xhaard
5  *
6  * V4L2 by Jean-Francois Moine <http://moinejf.free.fr>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21  */
22
23 #define MODULE_NAME "vc032x"
24
25 #include "gspca.h"
26
27 MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
28 MODULE_DESCRIPTION("GSPCA/VC032X USB Camera Driver");
29 MODULE_LICENSE("GPL");
30
31 /* specific webcam descriptor */
32 struct sd {
33         struct gspca_dev gspca_dev;     /* !! must be the first item */
34
35         __u8 hflip;
36         __u8 vflip;
37         __u8 lightfreq;
38         __u8 sharpness;
39
40         u8 image_offset;
41
42         char bridge;
43 #define BRIDGE_VC0321 0
44 #define BRIDGE_VC0323 1
45         u8 sensor;
46 #define SENSOR_HV7131R 0
47 #define SENSOR_MI0360 1
48 #define SENSOR_MI1310_SOC 2
49 #define SENSOR_MI1320 3
50 #define SENSOR_MI1320_SOC 4
51 #define SENSOR_OV7660 5
52 #define SENSOR_OV7670 6
53 #define SENSOR_PO1200 7
54 #define SENSOR_PO3130NC 8
55 };
56
57 /* V4L2 controls supported by the driver */
58 static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val);
59 static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val);
60 static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val);
61 static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val);
62 static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val);
63 static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val);
64 static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val);
65 static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val);
66
67 static struct ctrl sd_ctrls[] = {
68 /* next 2 controls work with ov7660 and ov7670 only */
69 #define HFLIP_IDX 0
70         {
71             {
72                 .id      = V4L2_CID_HFLIP,
73                 .type    = V4L2_CTRL_TYPE_BOOLEAN,
74                 .name    = "Mirror",
75                 .minimum = 0,
76                 .maximum = 1,
77                 .step    = 1,
78 #define HFLIP_DEF 0
79                 .default_value = HFLIP_DEF,
80             },
81             .set = sd_sethflip,
82             .get = sd_gethflip,
83         },
84 #define VFLIP_IDX 1
85         {
86             {
87                 .id      = V4L2_CID_VFLIP,
88                 .type    = V4L2_CTRL_TYPE_BOOLEAN,
89                 .name    = "Vflip",
90                 .minimum = 0,
91                 .maximum = 1,
92                 .step    = 1,
93 #define VFLIP_DEF 0
94                 .default_value = VFLIP_DEF,
95             },
96             .set = sd_setvflip,
97             .get = sd_getvflip,
98         },
99 #define LIGHTFREQ_IDX 2
100         {
101             {
102                 .id      = V4L2_CID_POWER_LINE_FREQUENCY,
103                 .type    = V4L2_CTRL_TYPE_MENU,
104                 .name    = "Light frequency filter",
105                 .minimum = 0,
106                 .maximum = 2,   /* 0: No, 1: 50Hz, 2:60Hz */
107                 .step    = 1,
108 #define FREQ_DEF 1
109                 .default_value = FREQ_DEF,
110             },
111             .set = sd_setfreq,
112             .get = sd_getfreq,
113         },
114 /* po1200 only */
115 #define SHARPNESS_IDX 3
116         {
117          {
118           .id = V4L2_CID_SHARPNESS,
119           .type = V4L2_CTRL_TYPE_INTEGER,
120           .name = "Sharpness",
121           .minimum = 0,
122           .maximum = 2,
123           .step = 1,
124 #define SHARPNESS_DEF 1
125           .default_value = SHARPNESS_DEF,
126           },
127          .set = sd_setsharpness,
128          .get = sd_getsharpness,
129          },
130 };
131
132 static const struct v4l2_pix_format vc0321_mode[] = {
133         {320, 240, V4L2_PIX_FMT_YVYU, V4L2_FIELD_NONE,
134                 .bytesperline = 320,
135                 .sizeimage = 320 * 240 * 2,
136                 .colorspace = V4L2_COLORSPACE_SRGB,
137                 .priv = 1},
138         {640, 480, V4L2_PIX_FMT_YVYU, V4L2_FIELD_NONE,
139                 .bytesperline = 640,
140                 .sizeimage = 640 * 480 * 2,
141                 .colorspace = V4L2_COLORSPACE_SRGB,
142                 .priv = 0},
143 };
144 static const struct v4l2_pix_format vc0323_mode[] = {
145         {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
146                 .bytesperline = 320,
147                 .sizeimage = 320 * 240 * 3 / 8 + 590,
148                 .colorspace = V4L2_COLORSPACE_JPEG,
149                 .priv = 1},
150         {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
151                 .bytesperline = 640,
152                 .sizeimage = 640 * 480 * 3 / 8 + 590,
153                 .colorspace = V4L2_COLORSPACE_JPEG,
154                 .priv = 0},
155         {1280, 1024, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, /* mi13x0_soc only */
156                 .bytesperline = 1280,
157                 .sizeimage = 1280 * 1024 * 1 / 4 + 590,
158                 .colorspace = V4L2_COLORSPACE_JPEG,
159                 .priv = 2},
160 };
161 static const struct v4l2_pix_format bi_mode[] = {
162         {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
163                 .bytesperline = 320,
164                 .sizeimage = 320 * 240 * 2,
165                 .colorspace = V4L2_COLORSPACE_SRGB,
166                 .priv = 2},
167         {640, 480, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
168                 .bytesperline = 640,
169                 .sizeimage = 640 * 480 * 2,
170                 .colorspace = V4L2_COLORSPACE_SRGB,
171                 .priv = 1},
172         {1280, 1024, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
173                 .bytesperline = 1280,
174                 .sizeimage = 1280 * 1024 * 2,
175                 .colorspace = V4L2_COLORSPACE_SRGB,
176                 .priv = 0},
177 };
178 static const struct v4l2_pix_format svga_mode[] = {
179         {800, 600, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
180                 .bytesperline = 800,
181                 .sizeimage = 800 * 600 * 1 / 4 + 590,
182                 .colorspace = V4L2_COLORSPACE_JPEG,
183                 .priv = 0},
184 };
185
186 /* OV7660/7670 registers */
187 #define OV7660_REG_MVFP 0x1e
188 #define OV7660_MVFP_MIRROR      0x20
189 #define OV7660_MVFP_VFLIP       0x10
190
191 static const __u8 mi0360_matrix[9] = {
192         0x50, 0xf8, 0xf8, 0xf5, 0x50, 0xfb, 0xff, 0xf1, 0x50
193 };
194
195 static const __u8 mi0360_initVGA_JPG[][4] = {
196         {0xb0, 0x03, 0x19, 0xcc},
197         {0xb0, 0x04, 0x02, 0xcc},
198         {0xb3, 0x00, 0x24, 0xcc},
199         {0xb3, 0x00, 0x25, 0xcc},
200         {0xb3, 0x08, 0x01, 0xcc},
201         {0xb3, 0x09, 0x0c, 0xcc},
202         {0xb3, 0x05, 0x01, 0xcc},
203         {0xb3, 0x06, 0x03, 0xcc},
204         {0xb3, 0x03, 0x0a, 0xcc},
205         {0xb3, 0x20, 0x00, 0xcc},
206         {0xb3, 0x21, 0x00, 0xcc},
207         {0xb3, 0x22, 0x01, 0xcc},
208         {0xb3, 0x23, 0xe0, 0xcc},
209         {0xb3, 0x04, 0x05, 0xcc},
210         {0xb3, 0x14, 0x00, 0xcc},
211         {0xb3, 0x15, 0x00, 0xcc},
212         {0xb3, 0x16, 0x02, 0xcc},
213         {0xb3, 0x17, 0x7f, 0xcc},
214         {0xb3, 0x35, 0xdd, 0xcc},
215         {0xb3, 0x34, 0x02, 0xcc},
216         {0xb3, 0x00, 0x25, 0xcc},
217         {0xbc, 0x00, 0x71, 0xcc},
218         {0xb8, 0x00, 0x13, 0xcc},
219         {0xb8, 0x27, 0x20, 0xcc},
220         {0xb8, 0x2c, 0x50, 0xcc},
221         {0xb8, 0x2d, 0xf8, 0xcc},
222         {0xb8, 0x2e, 0xf8, 0xcc},
223         {0xb8, 0x2f, 0xf8, 0xcc},
224         {0xb8, 0x30, 0x50, 0xcc},
225         {0xb8, 0x31, 0xf8, 0xcc},
226         {0xb8, 0x32, 0xf8, 0xcc},
227         {0xb8, 0x33, 0xf8, 0xcc},
228         {0xb8, 0x34, 0x50, 0xcc},
229         {0xb8, 0x35, 0x00, 0xcc},
230         {0xb8, 0x36, 0x00, 0xcc},
231         {0xb8, 0x37, 0x00, 0xcc},
232         {0xb8, 0x01, 0x79, 0xcc},
233         {0xb8, 0x08, 0xe0, 0xcc},
234         {0xb3, 0x01, 0x41, 0xcc},
235         {0xb8, 0x01, 0x79, 0xcc},
236         {0xb8, 0x14, 0x18, 0xcc},
237         {0xb8, 0xb2, 0x0a, 0xcc},
238         {0xb8, 0xb4, 0x0a, 0xcc},
239         {0xb8, 0xb5, 0x0a, 0xcc},
240         {0xb8, 0xfe, 0x00, 0xcc},
241         {0xb8, 0xff, 0x28, 0xcc},
242         {0xb9, 0x00, 0x28, 0xcc},
243         {0xb9, 0x01, 0x28, 0xcc},
244         {0xb9, 0x02, 0x28, 0xcc},
245         {0xb9, 0x03, 0x00, 0xcc},
246         {0xb9, 0x04, 0x00, 0xcc},
247         {0xb9, 0x05, 0x3c, 0xcc},
248         {0xb9, 0x06, 0x3c, 0xcc},
249         {0xb9, 0x07, 0x3c, 0xcc},
250         {0xb9, 0x08, 0x3c, 0xcc},
251         {0xb8, 0x8e, 0x00, 0xcc},
252         {0xb8, 0x8f, 0xff, 0xcc},
253         {0xb8, 0x81, 0x09, 0xcc},
254         {0x31, 0x00, 0x00, 0xbb},
255         {0x09, 0x01, 0xc7, 0xbb},
256         {0x34, 0x01, 0x00, 0xbb},
257         {0x2b, 0x00, 0x28, 0xbb},
258         {0x2c, 0x00, 0x30, 0xbb},
259         {0x2d, 0x00, 0x30, 0xbb},
260         {0x2e, 0x00, 0x28, 0xbb},
261         {0x62, 0x04, 0x11, 0xbb},
262         {0x03, 0x01, 0xe0, 0xbb},
263         {0x2c, 0x00, 0x2c, 0xbb},
264         {0x20, 0xd0, 0x00, 0xbb},
265         {0x01, 0x00, 0x08, 0xbb},
266         {0x06, 0x00, 0x10, 0xbb},
267         {0x05, 0x00, 0x20, 0xbb},
268         {0x20, 0x00, 0x00, 0xbb},
269         {0xb6, 0x00, 0x00, 0xcc},
270         {0xb6, 0x03, 0x02, 0xcc},
271         {0xb6, 0x02, 0x80, 0xcc},
272         {0xb6, 0x05, 0x01, 0xcc},
273         {0xb6, 0x04, 0xe0, 0xcc},
274         {0xb6, 0x12, 0x78, 0xcc},
275         {0xb6, 0x18, 0x02, 0xcc},
276         {0xb6, 0x17, 0x58, 0xcc},
277         {0xb6, 0x16, 0x00, 0xcc},
278         {0xb6, 0x22, 0x12, 0xcc},
279         {0xb6, 0x23, 0x0b, 0xcc},
280         {0xb3, 0x02, 0x02, 0xcc},
281         {0xbf, 0xc0, 0x39, 0xcc},
282         {0xbf, 0xc1, 0x04, 0xcc},
283         {0xbf, 0xcc, 0x10, 0xcc},
284         {0xb9, 0x12, 0x00, 0xcc},
285         {0xb9, 0x13, 0x0a, 0xcc},
286         {0xb9, 0x14, 0x0a, 0xcc},
287         {0xb9, 0x15, 0x0a, 0xcc},
288         {0xb9, 0x16, 0x0a, 0xcc},
289         {0xb9, 0x18, 0x00, 0xcc},
290         {0xb9, 0x19, 0x0f, 0xcc},
291         {0xb9, 0x1a, 0x0f, 0xcc},
292         {0xb9, 0x1b, 0x0f, 0xcc},
293         {0xb9, 0x1c, 0x0f, 0xcc},
294         {0xb8, 0x8e, 0x00, 0xcc},
295         {0xb8, 0x8f, 0xff, 0xcc},
296         {0xb6, 0x12, 0xf8, 0xcc},
297         {0xb8, 0x0c, 0x20, 0xcc},
298         {0xb8, 0x0d, 0x70, 0xcc},
299         {0xb6, 0x13, 0x13, 0xcc},
300         {0x35, 0x00, 0x60, 0xbb},
301         {0xb3, 0x5c, 0x01, 0xcc},
302         {}
303 };
304 static const __u8 mi0360_initQVGA_JPG[][4] = {
305         {0xb0, 0x03, 0x19, 0xcc},
306         {0xb0, 0x04, 0x02, 0xcc},
307         {0xb3, 0x00, 0x24, 0xcc},
308         {0xb3, 0x00, 0x25, 0xcc},
309         {0xb3, 0x08, 0x01, 0xcc},
310         {0xb3, 0x09, 0x0c, 0xcc},
311         {0xb3, 0x05, 0x01, 0xcc},
312         {0xb3, 0x06, 0x03, 0xcc},
313         {0xb3, 0x03, 0x0a, 0xcc},
314         {0xb3, 0x20, 0x00, 0xcc},
315         {0xb3, 0x21, 0x00, 0xcc},
316         {0xb3, 0x22, 0x01, 0xcc},
317         {0xb3, 0x23, 0xe0, 0xcc},
318         {0xb3, 0x04, 0x05, 0xcc},
319         {0xb3, 0x14, 0x00, 0xcc},
320         {0xb3, 0x15, 0x00, 0xcc},
321         {0xb3, 0x16, 0x02, 0xcc},
322         {0xb3, 0x17, 0x7f, 0xcc},
323         {0xb3, 0x35, 0xdd, 0xcc},
324         {0xb3, 0x34, 0x02, 0xcc},
325         {0xb3, 0x00, 0x25, 0xcc},
326         {0xbc, 0x00, 0xd1, 0xcc},
327         {0xb8, 0x00, 0x13, 0xcc},
328         {0xb8, 0x27, 0x20, 0xcc},
329         {0xb8, 0x2c, 0x50, 0xcc},
330         {0xb8, 0x2d, 0xf8, 0xcc},
331         {0xb8, 0x2e, 0xf8, 0xcc},
332         {0xb8, 0x2f, 0xf8, 0xcc},
333         {0xb8, 0x30, 0x50, 0xcc},
334         {0xb8, 0x31, 0xf8, 0xcc},
335         {0xb8, 0x32, 0xf8, 0xcc},
336         {0xb8, 0x33, 0xf8, 0xcc},
337         {0xb8, 0x34, 0x50, 0xcc},
338         {0xb8, 0x35, 0x00, 0xcc},
339         {0xb8, 0x36, 0x00, 0xcc},
340         {0xb8, 0x37, 0x00, 0xcc},
341         {0xb8, 0x01, 0x79, 0xcc},
342         {0xb8, 0x08, 0xe0, 0xcc},
343         {0xb3, 0x01, 0x41, 0xcc},
344         {0xb8, 0x01, 0x79, 0xcc},
345         {0xb8, 0x14, 0x18, 0xcc},
346         {0xb8, 0xb2, 0x0a, 0xcc},
347         {0xb8, 0xb4, 0x0a, 0xcc},
348         {0xb8, 0xb5, 0x0a, 0xcc},
349         {0xb8, 0xfe, 0x00, 0xcc},
350         {0xb8, 0xff, 0x28, 0xcc},
351         {0xb9, 0x00, 0x28, 0xcc},
352         {0xb9, 0x01, 0x28, 0xcc},
353         {0xb9, 0x02, 0x28, 0xcc},
354         {0xb9, 0x03, 0x00, 0xcc},
355         {0xb9, 0x04, 0x00, 0xcc},
356         {0xb9, 0x05, 0x3c, 0xcc},
357         {0xb9, 0x06, 0x3c, 0xcc},
358         {0xb9, 0x07, 0x3c, 0xcc},
359         {0xb9, 0x08, 0x3c, 0xcc},
360         {0xb8, 0x8e, 0x00, 0xcc},
361         {0xb8, 0x8f, 0xff, 0xcc},
362         {0xb8, 0x81, 0x09, 0xcc},
363         {0x31, 0x00, 0x00, 0xbb},
364         {0x09, 0x01, 0xc7, 0xbb},
365         {0x34, 0x01, 0x00, 0xbb},
366         {0x2b, 0x00, 0x28, 0xbb},
367         {0x2c, 0x00, 0x30, 0xbb},
368         {0x2d, 0x00, 0x30, 0xbb},
369         {0x2e, 0x00, 0x28, 0xbb},
370         {0x62, 0x04, 0x11, 0xbb},
371         {0x03, 0x01, 0xe0, 0xbb},
372         {0x2c, 0x00, 0x2c, 0xbb},
373         {0x20, 0xd0, 0x00, 0xbb},
374         {0x01, 0x00, 0x08, 0xbb},
375         {0x06, 0x00, 0x10, 0xbb},
376         {0x05, 0x00, 0x20, 0xbb},
377         {0x20, 0x00, 0x00, 0xbb},
378         {0xb6, 0x00, 0x00, 0xcc},
379         {0xb6, 0x03, 0x01, 0xcc},
380         {0xb6, 0x02, 0x40, 0xcc},
381         {0xb6, 0x05, 0x00, 0xcc},
382         {0xb6, 0x04, 0xf0, 0xcc},
383         {0xb6, 0x12, 0x78, 0xcc},
384         {0xb6, 0x18, 0x00, 0xcc},
385         {0xb6, 0x17, 0x96, 0xcc},
386         {0xb6, 0x16, 0x00, 0xcc},
387         {0xb6, 0x22, 0x12, 0xcc},
388         {0xb6, 0x23, 0x0b, 0xcc},
389         {0xb3, 0x02, 0x02, 0xcc},
390         {0xbf, 0xc0, 0x39, 0xcc},
391         {0xbf, 0xc1, 0x04, 0xcc},
392         {0xbf, 0xcc, 0x10, 0xcc},
393         {0xb9, 0x12, 0x00, 0xcc},
394         {0xb9, 0x13, 0x0a, 0xcc},
395         {0xb9, 0x14, 0x0a, 0xcc},
396         {0xb9, 0x15, 0x0a, 0xcc},
397         {0xb9, 0x16, 0x0a, 0xcc},
398         {0xb9, 0x18, 0x00, 0xcc},
399         {0xb9, 0x19, 0x0f, 0xcc},
400         {0xb9, 0x1a, 0x0f, 0xcc},
401         {0xb9, 0x1b, 0x0f, 0xcc},
402         {0xb9, 0x1c, 0x0f, 0xcc},
403         {0xb8, 0x8e, 0x00, 0xcc},
404         {0xb8, 0x8f, 0xff, 0xcc},
405         {0xb6, 0x12, 0xf8, 0xcc},
406         {0xb6, 0x13, 0x13, 0xcc},
407         {0xbc, 0x02, 0x18, 0xcc},
408         {0xbc, 0x03, 0x50, 0xcc},
409         {0xbc, 0x04, 0x18, 0xcc},
410         {0xbc, 0x05, 0x00, 0xcc},
411         {0xbc, 0x06, 0x00, 0xcc},
412         {0xbc, 0x08, 0x30, 0xcc},
413         {0xbc, 0x09, 0x40, 0xcc},
414         {0xbc, 0x0a, 0x10, 0xcc},
415         {0xb8, 0x0c, 0x20, 0xcc},
416         {0xb8, 0x0d, 0x70, 0xcc},
417         {0xbc, 0x0b, 0x00, 0xcc},
418         {0xbc, 0x0c, 0x00, 0xcc},
419         {0x35, 0x00, 0xef, 0xbb},
420         {0xb3, 0x5c, 0x01, 0xcc},
421         {}
422 };
423
424 static const __u8 mi1310_socinitVGA_JPG[][4] = {
425         {0xb0, 0x03, 0x19, 0xcc},
426         {0xb0, 0x04, 0x02, 0xcc},
427         {0xb3, 0x00, 0x24, 0xcc},
428         {0xb3, 0x00, 0x25, 0xcc},
429         {0xb3, 0x05, 0x01, 0xcc},
430         {0xb3, 0x06, 0x03, 0xcc},
431         {0xb3, 0x5c, 0x01, 0xcc},
432         {0xb3, 0x08, 0x01, 0xcc},
433         {0xb3, 0x09, 0x0c, 0xcc},
434         {0xb3, 0x34, 0x02, 0xcc},
435         {0xb3, 0x35, 0xdd, 0xcc},
436         {0xb3, 0x03, 0x0a, 0xcc},
437         {0xb3, 0x04, 0x0d, 0xcc},
438         {0xb3, 0x20, 0x00, 0xcc},
439         {0xb3, 0x21, 0x00, 0xcc},
440         {0xb3, 0x22, 0x01, 0xcc},
441         {0xb3, 0x23, 0xe0, 0xcc},
442         {0xb3, 0x14, 0x00, 0xcc},
443         {0xb3, 0x15, 0x00, 0xcc},
444         {0xb3, 0x16, 0x02, 0xcc},
445         {0xb3, 0x17, 0x7f, 0xcc},
446         {0xb8, 0x01, 0x7d, 0xcc},
447         {0xb8, 0x81, 0x09, 0xcc},
448         {0xb8, 0x27, 0x20, 0xcc},
449         {0xb8, 0x26, 0x80, 0xcc},
450         {0xb3, 0x00, 0x25, 0xcc},
451         {0xb8, 0x00, 0x13, 0xcc},
452         {0xbc, 0x00, 0x71, 0xcc},
453         {0xb8, 0x81, 0x01, 0xcc},
454         {0xb8, 0x2c, 0x5a, 0xcc},
455         {0xb8, 0x2d, 0xff, 0xcc},
456         {0xb8, 0x2e, 0xee, 0xcc},
457         {0xb8, 0x2f, 0xfb, 0xcc},
458         {0xb8, 0x30, 0x52, 0xcc},
459         {0xb8, 0x31, 0xf8, 0xcc},
460         {0xb8, 0x32, 0xf1, 0xcc},
461         {0xb8, 0x33, 0xff, 0xcc},
462         {0xb8, 0x34, 0x54, 0xcc},
463         {0xb8, 0x35, 0x00, 0xcc},
464         {0xb8, 0x36, 0x00, 0xcc},
465         {0xb8, 0x37, 0x00, 0xcc},
466         {0xf0, 0x00, 0x00, 0xbb},
467         {0x00, 0x01, 0x00, 0xdd},
468         {0x0d, 0x00, 0x09, 0xbb},
469         {0x0d, 0x00, 0x08, 0xbb},
470         {0xf0, 0x00, 0x01, 0xbb},
471         {0x00, 0x01, 0x00, 0xdd},
472         {0x06, 0x00, 0x14, 0xbb},
473         {0x3a, 0x10, 0x00, 0xbb},
474         {0x00, 0x00, 0x10, 0xdd},
475         {0x9b, 0x10, 0x00, 0xbb},
476         {0x00, 0x00, 0x10, 0xdd},
477         {0xf0, 0x00, 0x00, 0xbb},
478         {0x00, 0x01, 0x00, 0xdd},
479         {0x2b, 0x00, 0x28, 0xbb},
480         {0x2c, 0x00, 0x30, 0xbb},
481         {0x2d, 0x00, 0x30, 0xbb},
482         {0x2e, 0x00, 0x28, 0xbb},
483         {0x41, 0x00, 0xd7, 0xbb},
484         {0x09, 0x02, 0x3a, 0xbb},
485         {0x0c, 0x00, 0x00, 0xbb},
486         {0x20, 0x00, 0x00, 0xbb},
487         {0x05, 0x00, 0x8c, 0xbb},
488         {0x06, 0x00, 0x32, 0xbb},
489         {0x07, 0x00, 0xc6, 0xbb},
490         {0x08, 0x00, 0x19, 0xbb},
491         {0x24, 0x80, 0x6f, 0xbb},
492         {0xc8, 0x00, 0x0f, 0xbb},
493         {0x20, 0x00, 0x0f, 0xbb},
494         {0xb6, 0x00, 0x00, 0xcc},
495         {0xb6, 0x03, 0x02, 0xcc},
496         {0xb6, 0x02, 0x80, 0xcc},
497         {0xb6, 0x05, 0x01, 0xcc},
498         {0xb6, 0x04, 0xe0, 0xcc},
499         {0xb6, 0x12, 0x78, 0xcc},
500         {0xb6, 0x18, 0x02, 0xcc},
501         {0xb6, 0x17, 0x58, 0xcc},
502         {0xb6, 0x16, 0x00, 0xcc},
503         {0xb6, 0x22, 0x12, 0xcc},
504         {0xb6, 0x23, 0x0b, 0xcc},
505         {0xb3, 0x02, 0x02, 0xcc},
506         {0xbf, 0xc0, 0x39, 0xcc},
507         {0xbf, 0xc1, 0x04, 0xcc},
508         {0xbf, 0xcc, 0x10, 0xcc},
509         {0xb9, 0x12, 0x00, 0xcc},
510         {0xb9, 0x13, 0x0a, 0xcc},
511         {0xb9, 0x14, 0x0a, 0xcc},
512         {0xb9, 0x15, 0x0a, 0xcc},
513         {0xb9, 0x16, 0x0a, 0xcc},
514         {0xb9, 0x18, 0x00, 0xcc},
515         {0xb9, 0x19, 0x0f, 0xcc},
516         {0xb9, 0x1a, 0x0f, 0xcc},
517         {0xb9, 0x1b, 0x0f, 0xcc},
518         {0xb9, 0x1c, 0x0f, 0xcc},
519         {0xb8, 0x8e, 0x00, 0xcc},
520         {0xb8, 0x8f, 0xff, 0xcc},
521         {0xb3, 0x01, 0x41, 0xcc},
522         {0x03, 0x03, 0xc0, 0xbb},
523         {0x06, 0x00, 0x10, 0xbb},
524         {0xb6, 0x12, 0xf8, 0xcc},
525         {0xb8, 0x0c, 0x20, 0xcc},
526         {0xb8, 0x0d, 0x70, 0xcc},
527         {0xb6, 0x13, 0x13, 0xcc},
528         {0x2f, 0x00, 0xC0, 0xbb},
529         {0xb8, 0xa0, 0x12, 0xcc},
530         {},
531 };
532 static const __u8 mi1310_socinitQVGA_JPG[][4] = {
533         {0xb0, 0x03, 0x19, 0xcc},
534         {0xb0, 0x04, 0x02, 0xcc},
535         {0xb3, 0x00, 0x24, 0xcc},
536         {0xb3, 0x00, 0x25, 0xcc},
537         {0xb3, 0x05, 0x01, 0xcc},
538         {0xb3, 0x06, 0x03, 0xcc},
539         {0xb3, 0x5c, 0x01, 0xcc},
540         {0xb3, 0x08, 0x01, 0xcc},
541         {0xb3, 0x09, 0x0c, 0xcc},
542         {0xb3, 0x34, 0x02, 0xcc},
543         {0xb3, 0x35, 0xdd, 0xcc},
544         {0xb3, 0x03, 0x0a, 0xcc},
545         {0xb3, 0x04, 0x0d, 0xcc},
546         {0xb3, 0x20, 0x00, 0xcc},
547         {0xb3, 0x21, 0x00, 0xcc},
548         {0xb3, 0x22, 0x01, 0xcc},
549         {0xb3, 0x23, 0xe0, 0xcc},
550         {0xb3, 0x14, 0x00, 0xcc},
551         {0xb3, 0x15, 0x00, 0xcc},
552         {0xb3, 0x16, 0x02, 0xcc},
553         {0xb3, 0x17, 0x7f, 0xcc},
554         {0xb8, 0x01, 0x7d, 0xcc},
555         {0xb8, 0x81, 0x09, 0xcc},
556         {0xb8, 0x27, 0x20, 0xcc},
557         {0xb8, 0x26, 0x80, 0xcc},
558         {0xb3, 0x00, 0x25, 0xcc},
559         {0xb8, 0x00, 0x13, 0xcc},
560         {0xbc, 0x00, 0xd1, 0xcc},
561         {0xb8, 0x81, 0x01, 0xcc},
562         {0xb8, 0x2c, 0x5a, 0xcc},
563         {0xb8, 0x2d, 0xff, 0xcc},
564         {0xb8, 0x2e, 0xee, 0xcc},
565         {0xb8, 0x2f, 0xfb, 0xcc},
566         {0xb8, 0x30, 0x52, 0xcc},
567         {0xb8, 0x31, 0xf8, 0xcc},
568         {0xb8, 0x32, 0xf1, 0xcc},
569         {0xb8, 0x33, 0xff, 0xcc},
570         {0xb8, 0x34, 0x54, 0xcc},
571         {0xb8, 0x35, 0x00, 0xcc},
572         {0xb8, 0x36, 0x00, 0xcc},
573         {0xb8, 0x37, 0x00, 0xcc},
574         {0xf0, 0x00, 0x00, 0xbb},
575         {0x00, 0x01, 0x00, 0xdd},
576         {0x0d, 0x00, 0x09, 0xbb},
577         {0x0d, 0x00, 0x08, 0xbb},
578         {0xf0, 0x00, 0x01, 0xbb},
579         {0x00, 0x01, 0x00, 0xdd},
580         {0x06, 0x00, 0x14, 0xbb},
581         {0x3a, 0x10, 0x00, 0xbb},
582         {0x00, 0x00, 0x10, 0xdd},
583         {0x9b, 0x10, 0x00, 0xbb},
584         {0x00, 0x00, 0x10, 0xdd},
585         {0xf0, 0x00, 0x00, 0xbb},
586         {0x00, 0x01, 0x00, 0xdd},
587         {0x2b, 0x00, 0x28, 0xbb},
588         {0x2c, 0x00, 0x30, 0xbb},
589         {0x2d, 0x00, 0x30, 0xbb},
590         {0x2e, 0x00, 0x28, 0xbb},
591         {0x41, 0x00, 0xd7, 0xbb},
592         {0x09, 0x02, 0x3a, 0xbb},
593         {0x0c, 0x00, 0x00, 0xbb},
594         {0x20, 0x00, 0x00, 0xbb},
595         {0x05, 0x00, 0x8c, 0xbb},
596         {0x06, 0x00, 0x32, 0xbb},
597         {0x07, 0x00, 0xc6, 0xbb},
598         {0x08, 0x00, 0x19, 0xbb},
599         {0x24, 0x80, 0x6f, 0xbb},
600         {0xc8, 0x00, 0x0f, 0xbb},
601         {0x20, 0x00, 0x0f, 0xbb},
602         {0xb6, 0x00, 0x00, 0xcc},
603         {0xb6, 0x03, 0x01, 0xcc},
604         {0xb6, 0x02, 0x40, 0xcc},
605         {0xb6, 0x05, 0x00, 0xcc},
606         {0xb6, 0x04, 0xf0, 0xcc},
607         {0xb6, 0x12, 0x78, 0xcc},
608         {0xb6, 0x18, 0x00, 0xcc},
609         {0xb6, 0x17, 0x96, 0xcc},
610         {0xb6, 0x16, 0x00, 0xcc},
611         {0xb6, 0x22, 0x12, 0xcc},
612         {0xb6, 0x23, 0x0b, 0xcc},
613         {0xb3, 0x02, 0x02, 0xcc},
614         {0xbf, 0xc0, 0x39, 0xcc},
615         {0xbf, 0xc1, 0x04, 0xcc},
616         {0xbf, 0xcc, 0x10, 0xcc},
617         {0xb9, 0x12, 0x00, 0xcc},
618         {0xb9, 0x13, 0x0a, 0xcc},
619         {0xb9, 0x14, 0x0a, 0xcc},
620         {0xb9, 0x15, 0x0a, 0xcc},
621         {0xb9, 0x16, 0x0a, 0xcc},
622         {0xb9, 0x18, 0x00, 0xcc},
623         {0xb9, 0x19, 0x0f, 0xcc},
624         {0xb9, 0x1a, 0x0f, 0xcc},
625         {0xb9, 0x1b, 0x0f, 0xcc},
626         {0xb9, 0x1c, 0x0f, 0xcc},
627         {0xb8, 0x8e, 0x00, 0xcc},
628         {0xb8, 0x8f, 0xff, 0xcc},
629         {0xbc, 0x02, 0x18, 0xcc},
630         {0xbc, 0x03, 0x50, 0xcc},
631         {0xbc, 0x04, 0x18, 0xcc},
632         {0xbc, 0x05, 0x00, 0xcc},
633         {0xbc, 0x06, 0x00, 0xcc},
634         {0xbc, 0x08, 0x30, 0xcc},
635         {0xbc, 0x09, 0x40, 0xcc},
636         {0xbc, 0x0a, 0x10, 0xcc},
637         {0xbc, 0x0b, 0x00, 0xcc},
638         {0xbc, 0x0c, 0x00, 0xcc},
639         {0xb3, 0x01, 0x41, 0xcc},
640         {0x03, 0x03, 0xc0, 0xbb},
641         {0x06, 0x00, 0x10, 0xbb},
642         {0xb6, 0x12, 0xf8, 0xcc},
643         {0xb8, 0x0c, 0x20, 0xcc},
644         {0xb8, 0x0d, 0x70, 0xcc},
645         {0xb6, 0x13, 0x13, 0xcc},
646         {0x2f, 0x00, 0xC0, 0xbb},
647         {0xb8, 0xa0, 0x12, 0xcc},
648         {},
649 };
650 static const u8 mi1310_soc_InitSXGA_JPG[][4] = {
651         {0xb0, 0x03, 0x19, 0xcc},
652         {0xb0, 0x04, 0x02, 0xcc},
653         {0xb3, 0x00, 0x24, 0xcc},
654         {0xb3, 0x00, 0x25, 0xcc},
655         {0xb3, 0x05, 0x00, 0xcc},
656         {0xb3, 0x06, 0x01, 0xcc},
657         {0xb3, 0x5c, 0x01, 0xcc},
658         {0xb3, 0x08, 0x01, 0xcc},
659         {0xb3, 0x09, 0x0c, 0xcc},
660         {0xb3, 0x34, 0x02, 0xcc},
661         {0xb3, 0x35, 0xdd, 0xcc},
662         {0xb3, 0x03, 0x0a, 0xcc},
663         {0xb3, 0x04, 0x0d, 0xcc},
664         {0xb3, 0x20, 0x00, 0xcc},
665         {0xb3, 0x21, 0x00, 0xcc},
666         {0xb3, 0x22, 0x04, 0xcc},
667         {0xb3, 0x23, 0x00, 0xcc},
668         {0xb3, 0x14, 0x00, 0xcc},
669         {0xb3, 0x15, 0x00, 0xcc},
670         {0xb3, 0x16, 0x04, 0xcc},
671         {0xb3, 0x17, 0xff, 0xcc},
672         {0xb8, 0x01, 0x7d, 0xcc},
673         {0xb8, 0x81, 0x09, 0xcc},
674         {0xb8, 0x27, 0x20, 0xcc},
675         {0xb8, 0x26, 0x80, 0xcc},
676         {0xb8, 0x06, 0x00, 0xcc},
677         {0xb8, 0x07, 0x05, 0xcc},
678         {0xb8, 0x08, 0x00, 0xcc},
679         {0xb8, 0x09, 0x04, 0xcc},
680         {0xb3, 0x00, 0x25, 0xcc},
681         {0xb8, 0x00, 0x11, 0xcc},
682         {0xbc, 0x00, 0x71, 0xcc},
683         {0xb8, 0x81, 0x01, 0xcc},
684         {0xb8, 0x2c, 0x5a, 0xcc},
685         {0xb8, 0x2d, 0xff, 0xcc},
686         {0xb8, 0x2e, 0xee, 0xcc},
687         {0xb8, 0x2f, 0xfb, 0xcc},
688         {0xb8, 0x30, 0x52, 0xcc},
689         {0xb8, 0x31, 0xf8, 0xcc},
690         {0xb8, 0x32, 0xf1, 0xcc},
691         {0xb8, 0x33, 0xff, 0xcc},
692         {0xb8, 0x34, 0x54, 0xcc},
693         {0xf0, 0x00, 0x00, 0xbb},
694         {0x00, 0x01, 0x00, 0xdd},
695         {0x0d, 0x00, 0x09, 0xbb},
696         {0x0d, 0x00, 0x08, 0xbb},
697         {0xf0, 0x00, 0x01, 0xbb},
698         {0x00, 0x01, 0x00, 0xdd},
699         {0x06, 0x00, 0x14, 0xbb},
700         {0x3a, 0x10, 0x00, 0xbb},
701         {0x00, 0x00, 0x10, 0xdd},
702         {0x9b, 0x10, 0x00, 0xbb},
703         {0x00, 0x00, 0x10, 0xdd},
704         {0xf0, 0x00, 0x00, 0xbb},
705         {0x00, 0x01, 0x00, 0xdd},
706         {0x2b, 0x00, 0x28, 0xbb},
707         {0x2c, 0x00, 0x30, 0xbb},
708         {0x2d, 0x00, 0x30, 0xbb},
709         {0x2e, 0x00, 0x28, 0xbb},
710         {0x41, 0x00, 0xd7, 0xbb},
711         {0x09, 0x02, 0x3a, 0xbb},
712         {0x0c, 0x00, 0x00, 0xbb},
713         {0x20, 0x00, 0x00, 0xbb},
714         {0x05, 0x00, 0x8c, 0xbb},
715         {0x06, 0x00, 0x32, 0xbb},
716         {0x07, 0x00, 0xc6, 0xbb},
717         {0x08, 0x00, 0x19, 0xbb},
718         {0x24, 0x80, 0x6f, 0xbb},
719         {0xc8, 0x00, 0x0f, 0xbb},
720         {0x20, 0x00, 0x03, 0xbb},
721         {0xb6, 0x00, 0x00, 0xcc},
722         {0xb6, 0x03, 0x05, 0xcc},
723         {0xb6, 0x02, 0x00, 0xcc},
724         {0xb6, 0x05, 0x04, 0xcc},
725         {0xb6, 0x04, 0x00, 0xcc},
726         {0xb6, 0x12, 0xf8, 0xcc},
727         {0xb6, 0x18, 0x0a, 0xcc},
728         {0xb6, 0x17, 0x00, 0xcc},
729         {0xb6, 0x16, 0x00, 0xcc},
730         {0xb6, 0x22, 0x12, 0xcc},
731         {0xb6, 0x23, 0x0b, 0xcc},
732         {0xb3, 0x02, 0x02, 0xcc},
733         {0xbf, 0xc0, 0x39, 0xcc},
734         {0xbf, 0xc1, 0x04, 0xcc},
735         {0xbf, 0xcc, 0x10, 0xcc},
736         {0xb9, 0x12, 0x00, 0xcc},
737         {0xb9, 0x13, 0x14, 0xcc},
738         {0xb9, 0x14, 0x14, 0xcc},
739         {0xb9, 0x15, 0x14, 0xcc},
740         {0xb9, 0x16, 0x14, 0xcc},
741         {0xb9, 0x18, 0x00, 0xcc},
742         {0xb9, 0x19, 0x1e, 0xcc},
743         {0xb9, 0x1a, 0x1e, 0xcc},
744         {0xb9, 0x1b, 0x1e, 0xcc},
745         {0xb9, 0x1c, 0x1e, 0xcc},
746         {0xb3, 0x01, 0x41, 0xcc},
747         {0xb8, 0x8e, 0x00, 0xcc},
748         {0xb8, 0x8f, 0xff, 0xcc},
749         {0xb6, 0x12, 0xf8, 0xcc},
750         {0xb8, 0x0c, 0x20, 0xcc},
751         {0xb8, 0x0d, 0x70, 0xcc},
752         {0xb6, 0x13, 0x13, 0xcc},
753         {0x2f, 0x00, 0xC0, 0xbb},
754         {0xb8, 0xa0, 0x12, 0xcc},
755         {}
756 };
757
758 static const __u8 mi1320_gamma[17] = {
759         0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
760         0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
761 };
762 static const __u8 mi1320_matrix[9] = {
763         0x54, 0xda, 0x06, 0xf1, 0x50, 0xf4, 0xf7, 0xea, 0x52
764 };
765 static const __u8 mi1320_initVGA_data[][4] = {
766         {0xb3, 0x01, 0x01, 0xcc},       {0x00, 0x00, 0x33, 0xdd},
767         {0xb0, 0x03, 0x19, 0xcc},       {0x00, 0x00, 0x33, 0xdd},
768         {0xb0, 0x04, 0x02, 0xcc},       {0x00, 0x00, 0x33, 0xdd},
769         {0xb3, 0x00, 0x64, 0xcc},       {0xb3, 0x00, 0x65, 0xcc},
770         {0xb0, 0x16, 0x03, 0xcc},       {0xb3, 0x05, 0x00, 0xcc},
771         {0xb3, 0x06, 0x00, 0xcc},       {0xb3, 0x08, 0x01, 0xcc},
772         {0xb3, 0x09, 0x0c, 0xcc},       {0xb3, 0x34, 0x02, 0xcc},
773         {0xb3, 0x35, 0xc8, 0xcc},       {0xb3, 0x02, 0x00, 0xcc},
774         {0xb3, 0x03, 0x0a, 0xcc},       {0xb3, 0x04, 0x05, 0xcc},
775         {0xb3, 0x20, 0x00, 0xcc},       {0xb3, 0x21, 0x00, 0xcc},
776         {0xb3, 0x22, 0x03, 0xcc},       {0xb3, 0x23, 0xc0, 0xcc},
777         {0xb3, 0x14, 0x00, 0xcc},       {0xb3, 0x15, 0x00, 0xcc},
778         {0xb3, 0x16, 0x04, 0xcc},       {0xb3, 0x17, 0xff, 0xcc},
779         {0xb3, 0x00, 0x67, 0xcc},       {0xbc, 0x00, 0xd0, 0xcc},
780         {0xbc, 0x01, 0x01, 0xcc},       {0xf0, 0x00, 0x00, 0xbb},
781         {0x0d, 0x00, 0x09, 0xbb},       {0x00, 0x01, 0x00, 0xdd},
782         {0x0d, 0x00, 0x08, 0xbb},       {0xf0, 0x00, 0x01, 0xbb},
783         {0xa1, 0x05, 0x00, 0xbb},       {0xa4, 0x03, 0xc0, 0xbb},
784         {0xf0, 0x00, 0x02, 0xbb},       {0x00, 0x00, 0x10, 0xdd},
785         {0xc8, 0x9f, 0x0b, 0xbb},       {0x00, 0x00, 0x10, 0xdd},
786         {0xf0, 0x00, 0x00, 0xbb},       {0x00, 0x00, 0x10, 0xdd},
787         {0x20, 0x01, 0x00, 0xbb},       {0x00, 0x00, 0x10, 0xdd},
788         {0xf0, 0x00, 0x01, 0xbb},       {0x9d, 0x3c, 0xa0, 0xbb},
789         {0x47, 0x30, 0x30, 0xbb},       {0xf0, 0x00, 0x00, 0xbb},
790         {0x0a, 0x80, 0x11, 0xbb},       {0x35, 0x00, 0x22, 0xbb},
791         {0xf0, 0x00, 0x02, 0xbb},       {0x9d, 0xc5, 0x05, 0xbb},
792         {0xdc, 0x0f, 0xfc, 0xbb},       {0xf0, 0x00, 0x01, 0xbb},
793         {0x06, 0x74, 0x0e, 0xbb},       {0x80, 0x00, 0x06, 0xbb},
794         {0x81, 0x04, 0x00, 0xbb},       {0x82, 0x01, 0x02, 0xbb},
795         {0x83, 0x03, 0x02, 0xbb},       {0x84, 0x05, 0x00, 0xbb},
796         {0x85, 0x01, 0x00, 0xbb},       {0x86, 0x03, 0x02, 0xbb},
797         {0x87, 0x05, 0x00, 0xbb},       {0x88, 0x01, 0x00, 0xbb},
798         {0x89, 0x02, 0x02, 0xbb},       {0x8a, 0xfd, 0x04, 0xbb},
799         {0x8b, 0xfc, 0xfd, 0xbb},       {0x8c, 0xff, 0xfd, 0xbb},
800         {0x8d, 0x00, 0x00, 0xbb},       {0x8e, 0xfe, 0x05, 0xbb},
801         {0x8f, 0xfc, 0xfd, 0xbb},       {0x90, 0xfe, 0xfd, 0xbb},
802         {0x91, 0x00, 0x00, 0xbb},       {0x92, 0xfe, 0x03, 0xbb},
803         {0x93, 0xfd, 0xfe, 0xbb},       {0x94, 0xff, 0xfd, 0xbb},
804         {0x95, 0x00, 0x00, 0xbb},       {0xb6, 0x07, 0x05, 0xbb},
805         {0xb7, 0x13, 0x06, 0xbb},       {0xb8, 0x08, 0x06, 0xbb},
806         {0xb9, 0x14, 0x08, 0xbb},       {0xba, 0x06, 0x05, 0xbb},
807         {0xbb, 0x13, 0x06, 0xbb},       {0xbc, 0x03, 0x01, 0xbb},
808         {0xbd, 0x03, 0x04, 0xbb},       {0xbe, 0x00, 0x02, 0xbb},
809         {0xbf, 0x03, 0x01, 0xbb},       {0xc0, 0x02, 0x04, 0xbb},
810         {0xc1, 0x00, 0x04, 0xbb},       {0xc2, 0x02, 0x01, 0xbb},
811         {0xc3, 0x01, 0x03, 0xbb},       {0xc4, 0x00, 0x04, 0xbb},
812         {0xf0, 0x00, 0x00, 0xbb},       {0x05, 0x01, 0x13, 0xbb},
813         {0x06, 0x00, 0x11, 0xbb},       {0x07, 0x00, 0x85, 0xbb},
814         {0x08, 0x00, 0x27, 0xbb},       {0x20, 0x01, 0x03, 0xbb},
815         {0x21, 0x80, 0x00, 0xbb},       {0x22, 0x0d, 0x0f, 0xbb},
816         {0x24, 0x80, 0x00, 0xbb},       {0x59, 0x00, 0xff, 0xbb},
817         {0xf0, 0x00, 0x02, 0xbb},       {0x39, 0x03, 0x0d, 0xbb},
818         {0x3a, 0x06, 0x1b, 0xbb},       {0x3b, 0x00, 0x95, 0xbb},
819         {0x3c, 0x04, 0xdb, 0xbb},       {0x57, 0x02, 0x00, 0xbb},
820         {0x58, 0x02, 0x66, 0xbb},       {0x59, 0x00, 0xff, 0xbb},
821         {0x5a, 0x01, 0x33, 0xbb},       {0x5c, 0x12, 0x0d, 0xbb},
822         {0x5d, 0x16, 0x11, 0xbb},       {0x64, 0x5e, 0x1c, 0xbb},
823         {0xf0, 0x00, 0x02, 0xbb},       {0x2f, 0xd1, 0x00, 0xbb},
824         {0x5b, 0x00, 0x01, 0xbb},       {0xf0, 0x00, 0x02, 0xbb},
825         {0x36, 0x68, 0x10, 0xbb},       {0x00, 0x00, 0x30, 0xdd},
826         {0x37, 0x82, 0x00, 0xbb},       {0xbc, 0x0e, 0x00, 0xcc},
827         {0xbc, 0x0f, 0x05, 0xcc},       {0xbc, 0x10, 0xc0, 0xcc},
828         {0xbc, 0x11, 0x03, 0xcc},       {0xb6, 0x00, 0x00, 0xcc},
829         {0xb6, 0x03, 0x05, 0xcc},       {0xb6, 0x02, 0x00, 0xcc},
830         {0xb6, 0x05, 0x04, 0xcc},       {0xb6, 0x04, 0x00, 0xcc},
831         {0xb6, 0x12, 0xf8, 0xcc},       {0xb6, 0x13, 0x29, 0xcc},
832         {0xb6, 0x18, 0x0a, 0xcc},       {0xb6, 0x17, 0x00, 0xcc},
833         {0xb6, 0x16, 0x00, 0xcc},       {0xb6, 0x22, 0x12, 0xcc},
834         {0xb6, 0x23, 0x0b, 0xcc},       {0xbf, 0xc0, 0x26, 0xcc},
835         {0xbf, 0xc1, 0x02, 0xcc},       {0xbf, 0xcc, 0x04, 0xcc},
836         {0xbc, 0x02, 0x18, 0xcc},       {0xbc, 0x03, 0x50, 0xcc},
837         {0xbc, 0x04, 0x18, 0xcc},       {0xbc, 0x05, 0x00, 0xcc},
838         {0xbc, 0x06, 0x00, 0xcc},       {0xbc, 0x08, 0x30, 0xcc},
839         {0xbc, 0x09, 0x40, 0xcc},       {0xbc, 0x0a, 0x10, 0xcc},
840         {0xbc, 0x0b, 0x00, 0xcc},       {0xbc, 0x0c, 0x00, 0xcc},
841         {0xb3, 0x5c, 0x01, 0xcc},       {0xb3, 0x01, 0x41, 0xcc},
842         {}
843 };
844 static const __u8 mi1320_initQVGA_data[][4] = {
845         {0xb3, 0x01, 0x01, 0xcc},       {0x00, 0x00, 0x33, 0xdd},
846         {0xb0, 0x03, 0x19, 0xcc},       {0x00, 0x00, 0x33, 0xdd},
847         {0xb0, 0x04, 0x02, 0xcc},       {0x00, 0x00, 0x33, 0xdd},
848         {0xb3, 0x00, 0x64, 0xcc},       {0xb3, 0x00, 0x65, 0xcc},
849         {0xb0, 0x16, 0x03, 0xcc},       {0xb3, 0x05, 0x01, 0xcc},
850         {0xb3, 0x06, 0x01, 0xcc},       {0xb3, 0x08, 0x01, 0xcc},
851         {0xb3, 0x09, 0x0c, 0xcc},       {0xb3, 0x34, 0x02, 0xcc},
852         {0xb3, 0x35, 0xc8, 0xcc},       {0xb3, 0x02, 0x00, 0xcc},
853         {0xb3, 0x03, 0x0a, 0xcc},       {0xb3, 0x04, 0x05, 0xcc},
854         {0xb3, 0x20, 0x00, 0xcc},       {0xb3, 0x21, 0x00, 0xcc},
855         {0xb3, 0x22, 0x01, 0xcc},       {0xb3, 0x23, 0xe0, 0xcc},
856         {0xb3, 0x14, 0x00, 0xcc},       {0xb3, 0x15, 0x00, 0xcc},
857         {0xb3, 0x16, 0x02, 0xcc},       {0xb3, 0x17, 0x7f, 0xcc},
858         {0xb3, 0x00, 0x65, 0xcc},       {0xb8, 0x00, 0x00, 0xcc},
859         {0xbc, 0x00, 0xd0, 0xcc},       {0xbc, 0x01, 0x01, 0xcc},
860         {0xf0, 0x00, 0x00, 0xbb},       {0x0d, 0x00, 0x09, 0xbb},
861         {0x00, 0x01, 0x00, 0xdd},       {0x0d, 0x00, 0x08, 0xbb},
862         {0xf0, 0x00, 0x00, 0xbb},       {0x02, 0x00, 0x64, 0xbb},
863         {0x05, 0x01, 0x78, 0xbb},       {0x06, 0x00, 0x11, 0xbb},
864         {0x07, 0x01, 0x42, 0xbb},       {0x08, 0x00, 0x11, 0xbb},
865         {0x20, 0x01, 0x00, 0xbb},       {0x21, 0x80, 0x00, 0xbb},
866         {0x22, 0x0d, 0x0f, 0xbb},       {0x24, 0x80, 0x00, 0xbb},
867         {0x59, 0x00, 0xff, 0xbb},       {0xf0, 0x00, 0x01, 0xbb},
868         {0x9d, 0x3c, 0xa0, 0xbb},       {0x47, 0x30, 0x30, 0xbb},
869         {0xf0, 0x00, 0x00, 0xbb},       {0x0a, 0x80, 0x11, 0xbb},
870         {0x35, 0x00, 0x22, 0xbb},       {0xf0, 0x00, 0x02, 0xbb},
871         {0x9d, 0xc5, 0x05, 0xbb},       {0xdc, 0x0f, 0xfc, 0xbb},
872         {0xf0, 0x00, 0x01, 0xbb},       {0x06, 0x74, 0x0e, 0xbb},
873         {0x80, 0x00, 0x06, 0xbb},       {0x81, 0x04, 0x00, 0xbb},
874         {0x82, 0x01, 0x02, 0xbb},       {0x83, 0x03, 0x02, 0xbb},
875         {0x84, 0x05, 0x00, 0xbb},       {0x85, 0x01, 0x00, 0xbb},
876         {0x86, 0x03, 0x02, 0xbb},       {0x87, 0x05, 0x00, 0xbb},
877         {0x88, 0x01, 0x00, 0xbb},       {0x89, 0x02, 0x02, 0xbb},
878         {0x8a, 0xfd, 0x04, 0xbb},       {0x8b, 0xfc, 0xfd, 0xbb},
879         {0x8c, 0xff, 0xfd, 0xbb},       {0x8d, 0x00, 0x00, 0xbb},
880         {0x8e, 0xfe, 0x05, 0xbb},       {0x8f, 0xfc, 0xfd, 0xbb},
881         {0x90, 0xfe, 0xfd, 0xbb},       {0x91, 0x00, 0x00, 0xbb},
882         {0x92, 0xfe, 0x03, 0xbb},       {0x93, 0xfd, 0xfe, 0xbb},
883         {0x94, 0xff, 0xfd, 0xbb},       {0x95, 0x00, 0x00, 0xbb},
884         {0xb6, 0x07, 0x05, 0xbb},       {0xb7, 0x13, 0x06, 0xbb},
885         {0xb8, 0x08, 0x06, 0xbb},       {0xb9, 0x14, 0x08, 0xbb},
886         {0xba, 0x06, 0x05, 0xbb},       {0xbb, 0x13, 0x06, 0xbb},
887         {0xbc, 0x03, 0x01, 0xbb},       {0xbd, 0x03, 0x04, 0xbb},
888         {0xbe, 0x00, 0x02, 0xbb},       {0xbf, 0x03, 0x01, 0xbb},
889         {0xc0, 0x02, 0x04, 0xbb},       {0xc1, 0x00, 0x04, 0xbb},
890         {0xc2, 0x02, 0x01, 0xbb},       {0xc3, 0x01, 0x03, 0xbb},
891         {0xc4, 0x00, 0x04, 0xbb},       {0xf0, 0x00, 0x02, 0xbb},
892         {0xc8, 0x00, 0x00, 0xbb},       {0x2e, 0x00, 0x00, 0xbb},
893         {0x2e, 0x0c, 0x5b, 0xbb},       {0x2f, 0xd1, 0x00, 0xbb},
894         {0x39, 0x03, 0xca, 0xbb},       {0x3a, 0x06, 0x80, 0xbb},
895         {0x3b, 0x01, 0x52, 0xbb},       {0x3c, 0x05, 0x40, 0xbb},
896         {0x57, 0x01, 0x9c, 0xbb},       {0x58, 0x01, 0xee, 0xbb},
897         {0x59, 0x00, 0xf0, 0xbb},       {0x5a, 0x01, 0x20, 0xbb},
898         {0x5c, 0x1d, 0x17, 0xbb},       {0x5d, 0x22, 0x1c, 0xbb},
899         {0x64, 0x1e, 0x1c, 0xbb},       {0x5b, 0x00, 0x01, 0xbb},
900         {0xf0, 0x00, 0x02, 0xbb},       {0x36, 0x68, 0x10, 0xbb},
901         {0x00, 0x00, 0x30, 0xdd},       {0x37, 0x81, 0x00, 0xbb},
902         {0xbc, 0x02, 0x18, 0xcc},       {0xbc, 0x03, 0x50, 0xcc},
903         {0xbc, 0x04, 0x18, 0xcc},       {0xbc, 0x05, 0x00, 0xcc},
904         {0xbc, 0x06, 0x00, 0xcc},       {0xbc, 0x08, 0x30, 0xcc},
905         {0xbc, 0x09, 0x40, 0xcc},       {0xbc, 0x0a, 0x10, 0xcc},
906         {0xbc, 0x0b, 0x00, 0xcc},       {0xbc, 0x0c, 0x00, 0xcc},
907         {0xbf, 0xc0, 0x26, 0xcc},       {0xbf, 0xc1, 0x02, 0xcc},
908         {0xbf, 0xcc, 0x04, 0xcc},       {0xb3, 0x5c, 0x01, 0xcc},
909         {0xb3, 0x01, 0x41, 0xcc},
910         {}
911 };
912
913 static const u8 mi1320_soc_InitVGA[][4] = {
914         {0xb3, 0x01, 0x01, 0xcc},
915         {0xb0, 0x03, 0x19, 0xcc},
916         {0xb0, 0x04, 0x02, 0xcc},
917         {0x00, 0x00, 0x30, 0xdd},
918         {0xb3, 0x00, 0x64, 0xcc},
919         {0xb3, 0x00, 0x67, 0xcc},
920         {0xb3, 0x05, 0x01, 0xcc},
921         {0xb3, 0x06, 0x01, 0xcc},
922         {0xb3, 0x08, 0x01, 0xcc},
923         {0xb3, 0x09, 0x0c, 0xcc},
924         {0xb3, 0x34, 0x02, 0xcc},
925         {0xb3, 0x35, 0xc8, 0xcc},
926         {0xb3, 0x02, 0x00, 0xcc},
927         {0xb3, 0x03, 0x0a, 0xcc},
928         {0xb3, 0x04, 0x05, 0xcc},
929         {0xb3, 0x20, 0x00, 0xcc},
930         {0xb3, 0x21, 0x00, 0xcc},
931         {0xb3, 0x22, 0x01, 0xcc},
932         {0xb3, 0x23, 0xe0, 0xcc},
933         {0xb3, 0x14, 0x00, 0xcc},
934         {0xb3, 0x15, 0x00, 0xcc},
935         {0xb3, 0x16, 0x02, 0xcc},
936         {0xb3, 0x17, 0x7f, 0xcc},
937         {0xb3, 0x00, 0x67, 0xcc},
938         {0xb8, 0x00, 0x00, 0xcc},
939         {0xbc, 0x00, 0x71, 0xcc},
940         {0xbc, 0x01, 0x01, 0xcc},
941         {0xb3, 0x5c, 0x01, 0xcc},
942         {0xf0, 0x00, 0x02, 0xbb},
943         {0x00, 0x00, 0x10, 0xdd},
944         {0xc8, 0x00, 0x00, 0xbb},
945         {0x00, 0x00, 0x30, 0xdd},
946         {0xf0, 0x00, 0x00, 0xbb},
947         {0x00, 0x00, 0x10, 0xdd},
948         {0x07, 0x00, 0xe0, 0xbb},
949         {0x08, 0x00, 0x0b, 0xbb},
950         {0x21, 0x00, 0x0c, 0xbb},
951         {0x20, 0x01, 0x03, 0xbb},
952         {0xbf, 0xc0, 0x26, 0xcc},
953         {0xbf, 0xc1, 0x02, 0xcc},
954         {0xbf, 0xcc, 0x04, 0xcc},
955         {0xb3, 0x01, 0x41, 0xcc},
956         {0xf0, 0x00, 0x00, 0xbb},
957         {0x05, 0x01, 0x78, 0xbb},
958         {0x06, 0x00, 0x11, 0xbb},
959         {0x07, 0x01, 0x42, 0xbb},
960         {0x08, 0x00, 0x11, 0xbb},
961         {0x20, 0x01, 0x03, 0xbb},
962         {0x21, 0x80, 0x00, 0xbb},
963         {0x22, 0x0d, 0x0f, 0xbb},
964         {0x24, 0x80, 0x00, 0xbb},
965         {0x59, 0x00, 0xff, 0xbb},
966         {0xf0, 0x00, 0x02, 0xbb},
967         {0x39, 0x03, 0xca, 0xbb},
968         {0x3a, 0x06, 0x80, 0xbb},
969         {0x3b, 0x01, 0x52, 0xbb},
970         {0x3c, 0x05, 0x40, 0xbb},
971         {0x57, 0x01, 0x9c, 0xbb},
972         {0x58, 0x01, 0xee, 0xbb},
973         {0x59, 0x00, 0xf0, 0xbb},
974         {0x5a, 0x01, 0x20, 0xbb},
975         {0x5c, 0x1d, 0x17, 0xbb},
976         {0x5d, 0x22, 0x1c, 0xbb},
977         {0x64, 0x1e, 0x1c, 0xbb},
978         {0x5b, 0x00, 0x00, 0xbb},
979         {0xf0, 0x00, 0x02, 0xbb},
980         {0x22, 0xa0, 0x78, 0xbb},
981         {0x23, 0xa0, 0x78, 0xbb},
982         {0x24, 0x7f, 0x00, 0xbb},
983         {0x28, 0xea, 0x02, 0xbb},
984         {0x29, 0x86, 0x7a, 0xbb},
985         {0x5e, 0x52, 0x4c, 0xbb},
986         {0x5f, 0x20, 0x24, 0xbb},
987         {0x60, 0x00, 0x02, 0xbb},
988         {0x02, 0x00, 0xee, 0xbb},
989         {0x03, 0x39, 0x23, 0xbb},
990         {0x04, 0x07, 0x24, 0xbb},
991         {0x09, 0x00, 0xc0, 0xbb},
992         {0x0a, 0x00, 0x79, 0xbb},
993         {0x0b, 0x00, 0x04, 0xbb},
994         {0x0c, 0x00, 0x5c, 0xbb},
995         {0x0d, 0x00, 0xd9, 0xbb},
996         {0x0e, 0x00, 0x53, 0xbb},
997         {0x0f, 0x00, 0x21, 0xbb},
998         {0x10, 0x00, 0xa4, 0xbb},
999         {0x11, 0x00, 0xe5, 0xbb},
1000         {0x15, 0x00, 0x00, 0xbb},
1001         {0x16, 0x00, 0x00, 0xbb},
1002         {0x17, 0x00, 0x00, 0xbb},
1003         {0x18, 0x00, 0x00, 0xbb},
1004         {0x19, 0x00, 0x00, 0xbb},
1005         {0x1a, 0x00, 0x00, 0xbb},
1006         {0x1b, 0x00, 0x00, 0xbb},
1007         {0x1c, 0x00, 0x00, 0xbb},
1008         {0x1d, 0x00, 0x00, 0xbb},
1009         {0x1e, 0x00, 0x00, 0xbb},
1010         {0xf0, 0x00, 0x01, 0xbb},
1011         {0x06, 0xe0, 0x0e, 0xbb},
1012         {0x06, 0x60, 0x0e, 0xbb},
1013         {0xb3, 0x5c, 0x01, 0xcc},
1014         {}
1015 };
1016 static const u8 mi1320_soc_InitQVGA[][4] = {
1017         {0xb3, 0x01, 0x01, 0xcc},
1018         {0xb0, 0x03, 0x19, 0xcc},
1019         {0xb0, 0x04, 0x02, 0xcc},
1020         {0x00, 0x00, 0x30, 0xdd},
1021         {0xb3, 0x00, 0x64, 0xcc},
1022         {0xb3, 0x00, 0x67, 0xcc},
1023         {0xb3, 0x05, 0x01, 0xcc},
1024         {0xb3, 0x06, 0x01, 0xcc},
1025         {0xb3, 0x08, 0x01, 0xcc},
1026         {0xb3, 0x09, 0x0c, 0xcc},
1027         {0xb3, 0x34, 0x02, 0xcc},
1028         {0xb3, 0x35, 0xc8, 0xcc},
1029         {0xb3, 0x02, 0x00, 0xcc},
1030         {0xb3, 0x03, 0x0a, 0xcc},
1031         {0xb3, 0x04, 0x05, 0xcc},
1032         {0xb3, 0x20, 0x00, 0xcc},
1033         {0xb3, 0x21, 0x00, 0xcc},
1034         {0xb3, 0x22, 0x01, 0xcc},
1035         {0xb3, 0x23, 0xe0, 0xcc},
1036         {0xb3, 0x14, 0x00, 0xcc},
1037         {0xb3, 0x15, 0x00, 0xcc},
1038         {0xb3, 0x16, 0x02, 0xcc},
1039         {0xb3, 0x17, 0x7f, 0xcc},
1040         {0xb3, 0x00, 0x67, 0xcc},
1041         {0xb8, 0x00, 0x00, 0xcc},
1042         {0xbc, 0x00, 0xd1, 0xcc},
1043         {0xbc, 0x01, 0x01, 0xcc},
1044         {0xb3, 0x5c, 0x01, 0xcc},
1045         {0xf0, 0x00, 0x02, 0xbb},
1046         {0x00, 0x00, 0x10, 0xdd},
1047         {0xc8, 0x00, 0x00, 0xbb},
1048         {0x00, 0x00, 0x30, 0xdd},
1049         {0xf0, 0x00, 0x00, 0xbb},
1050         {0x00, 0x00, 0x10, 0xdd},
1051         {0x07, 0x00, 0xe0, 0xbb},
1052         {0x08, 0x00, 0x0b, 0xbb},
1053         {0x21, 0x00, 0x0c, 0xbb},
1054         {0x20, 0x01, 0x03, 0xbb},
1055         {0xbf, 0xc0, 0x26, 0xcc},
1056         {0xbf, 0xc1, 0x02, 0xcc},
1057         {0xbf, 0xcc, 0x04, 0xcc},
1058         {0xbc, 0x02, 0x18, 0xcc},
1059         {0xbc, 0x03, 0x50, 0xcc},
1060         {0xbc, 0x04, 0x18, 0xcc},
1061         {0xbc, 0x05, 0x00, 0xcc},
1062         {0xbc, 0x06, 0x00, 0xcc},
1063         {0xbc, 0x08, 0x30, 0xcc},
1064         {0xbc, 0x09, 0x40, 0xcc},
1065         {0xbc, 0x0a, 0x10, 0xcc},
1066         {0xbc, 0x0b, 0x00, 0xcc},
1067         {0xbc, 0x0c, 0x00, 0xcc},
1068         {0xb3, 0x01, 0x41, 0xcc},
1069         {0xf0, 0x00, 0x00, 0xbb},
1070         {0x05, 0x01, 0x78, 0xbb},
1071         {0x06, 0x00, 0x11, 0xbb},
1072         {0x07, 0x01, 0x42, 0xbb},
1073         {0x08, 0x00, 0x11, 0xbb},
1074         {0x20, 0x01, 0x03, 0xbb},
1075         {0x21, 0x80, 0x00, 0xbb},
1076         {0x22, 0x0d, 0x0f, 0xbb},
1077         {0x24, 0x80, 0x00, 0xbb},
1078         {0x59, 0x00, 0xff, 0xbb},
1079         {0xf0, 0x00, 0x02, 0xbb},
1080         {0x39, 0x03, 0xca, 0xbb},
1081         {0x3a, 0x06, 0x80, 0xbb},
1082         {0x3b, 0x01, 0x52, 0xbb},
1083         {0x3c, 0x05, 0x40, 0xbb},
1084         {0x57, 0x01, 0x9c, 0xbb},
1085         {0x58, 0x01, 0xee, 0xbb},
1086         {0x59, 0x00, 0xf0, 0xbb},
1087         {0x5a, 0x01, 0x20, 0xbb},
1088         {0x5c, 0x1d, 0x17, 0xbb},
1089         {0x5d, 0x22, 0x1c, 0xbb},
1090         {0x64, 0x1e, 0x1c, 0xbb},
1091         {0x5b, 0x00, 0x00, 0xbb},
1092         {0xf0, 0x00, 0x02, 0xbb},
1093         {0x22, 0xa0, 0x78, 0xbb},
1094         {0x23, 0xa0, 0x78, 0xbb},
1095         {0x24, 0x7f, 0x00, 0xbb},
1096         {0x28, 0xea, 0x02, 0xbb},
1097         {0x29, 0x86, 0x7a, 0xbb},
1098         {0x5e, 0x52, 0x4c, 0xbb},
1099         {0x5f, 0x20, 0x24, 0xbb},
1100         {0x60, 0x00, 0x02, 0xbb},
1101         {0x02, 0x00, 0xee, 0xbb},
1102         {0x03, 0x39, 0x23, 0xbb},
1103         {0x04, 0x07, 0x24, 0xbb},
1104         {0x09, 0x00, 0xc0, 0xbb},
1105         {0x0a, 0x00, 0x79, 0xbb},
1106         {0x0b, 0x00, 0x04, 0xbb},
1107         {0x0c, 0x00, 0x5c, 0xbb},
1108         {0x0d, 0x00, 0xd9, 0xbb},
1109         {0x0e, 0x00, 0x53, 0xbb},
1110         {0x0f, 0x00, 0x21, 0xbb},
1111         {0x10, 0x00, 0xa4, 0xbb},
1112         {0x11, 0x00, 0xe5, 0xbb},
1113         {0x15, 0x00, 0x00, 0xbb},
1114         {0x16, 0x00, 0x00, 0xbb},
1115         {0x17, 0x00, 0x00, 0xbb},
1116         {0x18, 0x00, 0x00, 0xbb},
1117         {0x19, 0x00, 0x00, 0xbb},
1118         {0x1a, 0x00, 0x00, 0xbb},
1119         {0x1b, 0x00, 0x00, 0xbb},
1120         {0x1c, 0x00, 0x00, 0xbb},
1121         {0x1d, 0x00, 0x00, 0xbb},
1122         {0x1e, 0x00, 0x00, 0xbb},
1123         {0xf0, 0x00, 0x01, 0xbb},
1124         {0x06, 0xe0, 0x0e, 0xbb},
1125         {0x06, 0x60, 0x0e, 0xbb},
1126         {0xb3, 0x5c, 0x01, 0xcc},
1127         {}
1128 };
1129 static const u8 mi1320_soc_InitSXGA[][4] = {
1130         {0xb3, 0x01, 0x01, 0xcc},
1131         {0xb0, 0x03, 0x19, 0xcc},
1132         {0x00, 0x00, 0x30, 0xdd},
1133         {0xb3, 0x00, 0x64, 0xcc},
1134         {0xb3, 0x00, 0x67, 0xcc},
1135         {0xb3, 0x05, 0x01, 0xcc},
1136         {0xb3, 0x06, 0x01, 0xcc},
1137         {0xb3, 0x08, 0x01, 0xcc},
1138         {0xb3, 0x09, 0x0c, 0xcc},
1139         {0xb3, 0x34, 0x02, 0xcc},
1140         {0xb3, 0x35, 0xc8, 0xcc},
1141         {0xb3, 0x02, 0x00, 0xcc},
1142         {0xb3, 0x03, 0x0a, 0xcc},
1143         {0xb3, 0x04, 0x05, 0xcc},
1144         {0xb3, 0x20, 0x00, 0xcc},
1145         {0xb3, 0x21, 0x00, 0xcc},
1146         {0xb3, 0x22, 0x04, 0xcc},
1147         {0xb3, 0x23, 0x00, 0xcc},
1148         {0xb3, 0x14, 0x00, 0xcc},
1149         {0xb3, 0x15, 0x00, 0xcc},
1150         {0xb3, 0x16, 0x04, 0xcc},
1151         {0xb3, 0x17, 0xff, 0xcc},
1152         {0xb3, 0x00, 0x67, 0xcc},
1153         {0xbc, 0x00, 0x71, 0xcc},
1154         {0xbc, 0x01, 0x01, 0xcc},
1155         {0xb3, 0x5c, 0x01, 0xcc},
1156         {0xf0, 0x00, 0x02, 0xbb},
1157         {0x00, 0x00, 0x30, 0xdd},
1158         {0xc8, 0x9f, 0x0b, 0xbb},
1159         {0x00, 0x00, 0x20, 0xdd},
1160         {0x5b, 0x00, 0x01, 0xbb},
1161         {0x00, 0x00, 0x20, 0xdd},
1162         {0xf0, 0x00, 0x00, 0xbb},
1163         {0x00, 0x00, 0x30, 0xdd},
1164         {0x20, 0x01, 0x03, 0xbb},
1165         {0x00, 0x00, 0x20, 0xdd},
1166         {0xbf, 0xc0, 0x26, 0xcc},
1167         {0xbf, 0xc1, 0x02, 0xcc},
1168         {0xbf, 0xcc, 0x04, 0xcc},
1169         {0xb3, 0x01, 0x41, 0xcc},
1170         {0xf0, 0x00, 0x00, 0xbb},
1171         {0x05, 0x01, 0x78, 0xbb},
1172         {0x06, 0x00, 0x11, 0xbb},
1173         {0x07, 0x01, 0x42, 0xbb},
1174         {0x08, 0x00, 0x11, 0xbb},
1175         {0x20, 0x01, 0x03, 0xbb},
1176         {0x21, 0x80, 0x00, 0xbb},
1177         {0x22, 0x0d, 0x0f, 0xbb},
1178         {0x24, 0x80, 0x00, 0xbb},
1179         {0x59, 0x00, 0xff, 0xbb},
1180         {0xf0, 0x00, 0x02, 0xbb},
1181         {0x39, 0x03, 0xca, 0xbb},
1182         {0x3a, 0x06, 0x80, 0xbb},
1183         {0x3b, 0x01, 0x52, 0xbb},
1184         {0x3c, 0x05, 0x40, 0xbb},
1185         {0x57, 0x01, 0x9c, 0xbb},
1186         {0x58, 0x01, 0xee, 0xbb},
1187         {0x59, 0x00, 0xf0, 0xbb},
1188         {0x5a, 0x01, 0x20, 0xbb},
1189         {0x5c, 0x1d, 0x17, 0xbb},
1190         {0x5d, 0x22, 0x1c, 0xbb},
1191         {0x64, 0x1e, 0x1c, 0xbb},
1192         {0x5b, 0x00, 0x00, 0xbb},
1193         {0xf0, 0x00, 0x02, 0xbb},
1194         {0x22, 0xa0, 0x78, 0xbb},
1195         {0x23, 0xa0, 0x78, 0xbb},
1196         {0x24, 0x7f, 0x00, 0xbb},
1197         {0x28, 0xea, 0x02, 0xbb},
1198         {0x29, 0x86, 0x7a, 0xbb},
1199         {0x5e, 0x52, 0x4c, 0xbb},
1200         {0x5f, 0x20, 0x24, 0xbb},
1201         {0x60, 0x00, 0x02, 0xbb},
1202         {0x02, 0x00, 0xee, 0xbb},
1203         {0x03, 0x39, 0x23, 0xbb},
1204         {0x04, 0x07, 0x24, 0xbb},
1205         {0x09, 0x00, 0xc0, 0xbb},
1206         {0x0a, 0x00, 0x79, 0xbb},
1207         {0x0b, 0x00, 0x04, 0xbb},
1208         {0x0c, 0x00, 0x5c, 0xbb},
1209         {0x0d, 0x00, 0xd9, 0xbb},
1210         {0x0e, 0x00, 0x53, 0xbb},
1211         {0x0f, 0x00, 0x21, 0xbb},
1212         {0x10, 0x00, 0xa4, 0xbb},
1213         {0x11, 0x00, 0xe5, 0xbb},
1214         {0x15, 0x00, 0x00, 0xbb},
1215         {0x16, 0x00, 0x00, 0xbb},
1216         {0x17, 0x00, 0x00, 0xbb},
1217         {0x18, 0x00, 0x00, 0xbb},
1218         {0x19, 0x00, 0x00, 0xbb},
1219         {0x1a, 0x00, 0x00, 0xbb},
1220         {0x1b, 0x00, 0x00, 0xbb},
1221         {0x1c, 0x00, 0x00, 0xbb},
1222         {0x1d, 0x00, 0x00, 0xbb},
1223         {0x1e, 0x00, 0x00, 0xbb},
1224         {0xf0, 0x00, 0x01, 0xbb},
1225         {0x06, 0xe0, 0x0e, 0xbb},
1226         {0x06, 0x60, 0x0e, 0xbb},
1227         {0xb3, 0x5c, 0x01, 0xcc},
1228         {0xf0, 0x00, 0x00, 0xbb},
1229         {0x05, 0x01, 0x13, 0xbb},
1230         {0x06, 0x00, 0x11, 0xbb},
1231         {0x07, 0x00, 0x85, 0xbb},
1232         {0x08, 0x00, 0x27, 0xbb},
1233         {0x20, 0x01, 0x03, 0xbb},
1234         {0x21, 0x80, 0x00, 0xbb},
1235         {0x22, 0x0d, 0x0f, 0xbb},
1236         {0x24, 0x80, 0x00, 0xbb},
1237         {0x59, 0x00, 0xff, 0xbb},
1238         {0xf0, 0x00, 0x02, 0xbb},
1239         {0x39, 0x03, 0x0d, 0xbb},
1240         {0x3a, 0x06, 0x1b, 0xbb},
1241         {0x3b, 0x00, 0x95, 0xbb},
1242         {0x3c, 0x04, 0xdb, 0xbb},
1243         {0x57, 0x02, 0x00, 0xbb},
1244         {0x58, 0x02, 0x66, 0xbb},
1245         {0x59, 0x00, 0xff, 0xbb},
1246         {0x5a, 0x01, 0x33, 0xbb},
1247         {0x5c, 0x12, 0x0d, 0xbb},
1248         {0x5d, 0x16, 0x11, 0xbb},
1249         {0x64, 0x5e, 0x1c, 0xbb},
1250         {}
1251 };
1252 static const __u8 po3130_gamma[17] = {
1253         0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
1254         0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
1255 };
1256 static const __u8 po3130_matrix[9] = {
1257         0x5f, 0xec, 0xf5, 0xf1, 0x5a, 0xf5, 0xf1, 0xec, 0x63
1258 };
1259
1260 static const __u8 po3130_initVGA_data[][4] = {
1261         {0xb0, 0x4d, 0x00, 0xcc},       {0xb3, 0x01, 0x01, 0xcc},
1262         {0x00, 0x00, 0x50, 0xdd},       {0xb0, 0x03, 0x01, 0xcc},
1263         {0xb3, 0x00, 0x04, 0xcc},       {0xb3, 0x00, 0x24, 0xcc},
1264         {0xb3, 0x00, 0x25, 0xcc},       {0xb3, 0x08, 0x01, 0xcc},
1265         {0xb3, 0x09, 0x0c, 0xcc},       {0xb3, 0x05, 0x00, 0xcc},
1266         {0xb3, 0x06, 0x01, 0xcc},       {0xb3, 0x03, 0x1a, 0xcc},
1267         {0xb3, 0x04, 0x15, 0xcc},       {0xb3, 0x20, 0x00, 0xcc},
1268         {0xb3, 0x21, 0x00, 0xcc},       {0xb3, 0x22, 0x01, 0xcc},
1269         {0xb3, 0x23, 0xe8, 0xcc},       {0xb8, 0x08, 0xe8, 0xcc},
1270         {0xb3, 0x14, 0x00, 0xcc},       {0xb3, 0x15, 0x00, 0xcc},
1271         {0xb3, 0x16, 0x02, 0xcc},       {0xb3, 0x17, 0x7f, 0xcc},
1272         {0xb3, 0x34, 0x01, 0xcc},       {0xb3, 0x35, 0xf6, 0xcc},
1273         {0xb3, 0x00, 0x27, 0xcc},       {0xbc, 0x00, 0x71, 0xcc},
1274         {0xb8, 0x00, 0x21, 0xcc},       {0xb8, 0x27, 0x20, 0xcc},
1275         {0xb8, 0x01, 0x79, 0xcc},       {0xb8, 0x81, 0x09, 0xcc},
1276         {0xb8, 0x2c, 0x50, 0xcc},       {0xb8, 0x2d, 0xf8, 0xcc},
1277         {0xb8, 0x2e, 0xf8, 0xcc},       {0xb8, 0x2f, 0xf8, 0xcc},
1278         {0xb8, 0x30, 0x50, 0xcc},       {0xb8, 0x31, 0xf8, 0xcc},
1279         {0xb8, 0x32, 0xf8, 0xcc},       {0xb8, 0x33, 0xf8, 0xcc},
1280         {0xb8, 0x34, 0x50, 0xcc},       {0xb8, 0x35, 0x00, 0xcc},
1281         {0xb8, 0x36, 0x00, 0xcc},       {0xb8, 0x37, 0x00, 0xcc},
1282         {0x00, 0x1e, 0xc6, 0xaa},       {0x00, 0x20, 0x44, 0xaa},
1283         {0x00, 0xad, 0x02, 0xaa},       {0x00, 0xae, 0x2c, 0xaa},
1284         {0x00, 0x12, 0x08, 0xaa},       {0x00, 0x17, 0x41, 0xaa},
1285         {0x00, 0x19, 0x41, 0xaa},       {0x00, 0x1e, 0x06, 0xaa},
1286         {0x00, 0x21, 0x00, 0xaa},       {0x00, 0x36, 0xc0, 0xaa},
1287         {0x00, 0x37, 0xc8, 0xaa},       {0x00, 0x3b, 0x36, 0xaa},
1288         {0x00, 0x4b, 0xfe, 0xaa},       {0x00, 0x51, 0x1c, 0xaa},
1289         {0x00, 0x52, 0x01, 0xaa},       {0x00, 0x55, 0x0a, 0xaa},
1290         {0x00, 0x59, 0x02, 0xaa},       {0x00, 0x5a, 0x04, 0xaa},
1291         {0x00, 0x5c, 0x10, 0xaa},       {0x00, 0x5d, 0x10, 0xaa},
1292         {0x00, 0x5e, 0x10, 0xaa},       {0x00, 0x5f, 0x10, 0xaa},
1293         {0x00, 0x61, 0x00, 0xaa},       {0x00, 0x62, 0x18, 0xaa},
1294         {0x00, 0x63, 0x30, 0xaa},       {0x00, 0x70, 0x68, 0xaa},
1295         {0x00, 0x80, 0x71, 0xaa},       {0x00, 0x81, 0x08, 0xaa},
1296         {0x00, 0x82, 0x00, 0xaa},       {0x00, 0x83, 0x55, 0xaa},
1297         {0x00, 0x84, 0x06, 0xaa},       {0x00, 0x85, 0x06, 0xaa},
1298         {0x00, 0x86, 0x13, 0xaa},       {0x00, 0x87, 0x18, 0xaa},
1299         {0x00, 0xaa, 0x3f, 0xaa},       {0x00, 0xab, 0x44, 0xaa},
1300         {0x00, 0xb0, 0x68, 0xaa},       {0x00, 0xb5, 0x10, 0xaa},
1301         {0x00, 0xb8, 0x20, 0xaa},       {0x00, 0xb9, 0xa0, 0xaa},
1302         {0x00, 0xbc, 0x04, 0xaa},       {0x00, 0x8b, 0x40, 0xaa},
1303         {0x00, 0x8c, 0x91, 0xaa},       {0x00, 0x8d, 0x8f, 0xaa},
1304         {0x00, 0x8e, 0x91, 0xaa},       {0x00, 0x8f, 0x43, 0xaa},
1305         {0x00, 0x90, 0x92, 0xaa},       {0x00, 0x91, 0x89, 0xaa},
1306         {0x00, 0x92, 0x9d, 0xaa},       {0x00, 0x93, 0x46, 0xaa},
1307         {0x00, 0xd6, 0x22, 0xaa},       {0x00, 0x73, 0x00, 0xaa},
1308         {0x00, 0x74, 0x10, 0xaa},       {0x00, 0x75, 0x20, 0xaa},
1309         {0x00, 0x76, 0x2b, 0xaa},       {0x00, 0x77, 0x36, 0xaa},
1310         {0x00, 0x78, 0x49, 0xaa},       {0x00, 0x79, 0x5a, 0xaa},
1311         {0x00, 0x7a, 0x7f, 0xaa},       {0x00, 0x7b, 0x9b, 0xaa},
1312         {0x00, 0x7c, 0xba, 0xaa},       {0x00, 0x7d, 0xd4, 0xaa},
1313         {0x00, 0x7e, 0xea, 0xaa},       {0x00, 0xd6, 0x62, 0xaa},
1314         {0x00, 0x73, 0x00, 0xaa},       {0x00, 0x74, 0x10, 0xaa},
1315         {0x00, 0x75, 0x20, 0xaa},       {0x00, 0x76, 0x2b, 0xaa},
1316         {0x00, 0x77, 0x36, 0xaa},       {0x00, 0x78, 0x49, 0xaa},
1317         {0x00, 0x79, 0x5a, 0xaa},       {0x00, 0x7a, 0x7f, 0xaa},
1318         {0x00, 0x7b, 0x9b, 0xaa},       {0x00, 0x7c, 0xba, 0xaa},
1319         {0x00, 0x7d, 0xd4, 0xaa},       {0x00, 0x7e, 0xea, 0xaa},
1320         {0x00, 0xd6, 0xa2, 0xaa},       {0x00, 0x73, 0x00, 0xaa},
1321         {0x00, 0x74, 0x10, 0xaa},       {0x00, 0x75, 0x20, 0xaa},
1322         {0x00, 0x76, 0x2b, 0xaa},       {0x00, 0x77, 0x36, 0xaa},
1323         {0x00, 0x78, 0x49, 0xaa},       {0x00, 0x79, 0x5a, 0xaa},
1324         {0x00, 0x7a, 0x7f, 0xaa},       {0x00, 0x7b, 0x9b, 0xaa},
1325         {0x00, 0x7c, 0xba, 0xaa},       {0x00, 0x7d, 0xd4, 0xaa},
1326         {0x00, 0x7e, 0xea, 0xaa},
1327         {0x00, 0x4c, 0x07, 0xaa},
1328         {0x00, 0x4b, 0xe0, 0xaa},       {0x00, 0x4e, 0x77, 0xaa},
1329         {0x00, 0x59, 0x02, 0xaa},       {0x00, 0x4d, 0x0a, 0xaa},
1330 /*      {0x00, 0xd1, 0x00, 0xaa},       {0x00, 0x20, 0xc4, 0xaa},
1331         {0xb8, 0x8e, 0x00, 0xcc},       {0xb8, 0x8f, 0xff, 0xcc}, */
1332         {0x00, 0xd1, 0x3c, 0xaa},       {0x00, 0x20, 0xc4, 0xaa},
1333         {0xb8, 0x8e, 0x00, 0xcc},       {0xb8, 0x8f, 0xff, 0xcc},
1334         {0xb8, 0xfe, 0x00, 0xcc},       {0xb8, 0xff, 0x28, 0xcc},
1335         {0xb9, 0x00, 0x28, 0xcc},       {0xb9, 0x01, 0x28, 0xcc},
1336         {0xb9, 0x02, 0x28, 0xcc},       {0xb9, 0x03, 0x00, 0xcc},
1337         {0xb9, 0x04, 0x00, 0xcc},       {0xb9, 0x05, 0x3c, 0xcc},
1338         {0xb9, 0x06, 0x3c, 0xcc},       {0xb9, 0x07, 0x3c, 0xcc},
1339         {0xb9, 0x08, 0x3c, 0xcc},       {0x00, 0x05, 0x00, 0xaa},
1340         {0xb3, 0x5c, 0x00, 0xcc},       {0xb3, 0x01, 0x41, 0xcc},
1341         {}
1342 };
1343 static const __u8 po3130_rundata[][4] = {
1344         {0x00, 0x47, 0x45, 0xaa},       {0x00, 0x48, 0x9b, 0xaa},
1345         {0x00, 0x49, 0x3a, 0xaa},       {0x00, 0x4a, 0x01, 0xaa},
1346         {0x00, 0x44, 0x40, 0xaa},
1347 /*      {0x00, 0xd5, 0x7c, 0xaa}, */
1348         {0x00, 0xad, 0x04, 0xaa},       {0x00, 0xae, 0x00, 0xaa},
1349         {0x00, 0xb0, 0x78, 0xaa},       {0x00, 0x98, 0x02, 0xaa},
1350         {0x00, 0x94, 0x25, 0xaa},       {0x00, 0x95, 0x25, 0xaa},
1351         {0x00, 0x59, 0x68, 0xaa},       {0x00, 0x44, 0x20, 0xaa},
1352         {0x00, 0x17, 0x50, 0xaa},       {0x00, 0x19, 0x50, 0xaa},
1353         {0x00, 0xd1, 0x3c, 0xaa},       {0x00, 0xd1, 0x3c, 0xaa},
1354         {0x00, 0x1e, 0x06, 0xaa},       {0x00, 0x1e, 0x06, 0xaa},
1355         {}
1356 };
1357
1358 static const __u8 po3130_initQVGA_data[][4] = {
1359         {0xb0, 0x4d, 0x00, 0xcc},       {0xb3, 0x01, 0x01, 0xcc},
1360         {0x00, 0x00, 0x50, 0xdd},       {0xb0, 0x03, 0x09, 0xcc},
1361         {0xb3, 0x00, 0x04, 0xcc},       {0xb3, 0x00, 0x24, 0xcc},
1362         {0xb3, 0x00, 0x25, 0xcc},       {0xb3, 0x08, 0x01, 0xcc},
1363         {0xb3, 0x09, 0x0c, 0xcc},       {0xb3, 0x05, 0x00, 0xcc},
1364         {0xb3, 0x06, 0x01, 0xcc},       {0xb3, 0x03, 0x1a, 0xcc},
1365         {0xb3, 0x04, 0x15, 0xcc},       {0xb3, 0x20, 0x00, 0xcc},
1366         {0xb3, 0x21, 0x00, 0xcc},       {0xb3, 0x22, 0x01, 0xcc},
1367         {0xb3, 0x23, 0xe0, 0xcc},       {0xb8, 0x08, 0xe0, 0xcc},
1368         {0xb3, 0x14, 0x00, 0xcc},       {0xb3, 0x15, 0x00, 0xcc},
1369         {0xb3, 0x16, 0x02, 0xcc},       {0xb3, 0x17, 0x7f, 0xcc},
1370         {0xb3, 0x34, 0x01, 0xcc},       {0xb3, 0x35, 0xf6, 0xcc},
1371         {0xb3, 0x00, 0x27, 0xcc},       {0xbc, 0x00, 0xd1, 0xcc},
1372         {0xb8, 0x00, 0x21, 0xcc},       {0xb8, 0x27, 0x20, 0xcc},
1373         {0xb8, 0x01, 0x79, 0xcc},       {0xb8, 0x81, 0x09, 0xcc},
1374         {0xb8, 0x2c, 0x50, 0xcc},       {0xb8, 0x2d, 0xf8, 0xcc},
1375         {0xb8, 0x2e, 0xf8, 0xcc},       {0xb8, 0x2f, 0xf8, 0xcc},
1376         {0xb8, 0x30, 0x50, 0xcc},       {0xb8, 0x31, 0xf8, 0xcc},
1377         {0xb8, 0x32, 0xf8, 0xcc},       {0xb8, 0x33, 0xf8, 0xcc},
1378         {0xb8, 0x34, 0x50, 0xcc},       {0xb8, 0x35, 0x00, 0xcc},
1379         {0xb8, 0x36, 0x00, 0xcc},       {0xb8, 0x37, 0x00, 0xcc},
1380         {0x00, 0x1e, 0xc6, 0xaa},       {0x00, 0x20, 0x44, 0xaa},
1381         {0x00, 0xad, 0x02, 0xaa},       {0x00, 0xae, 0x2c, 0xaa},
1382         {0x00, 0x12, 0x08, 0xaa},       {0x00, 0x17, 0x41, 0xaa},
1383         {0x00, 0x19, 0x41, 0xaa},       {0x00, 0x1e, 0x06, 0xaa},
1384         {0x00, 0x21, 0x00, 0xaa},       {0x00, 0x36, 0xc0, 0xaa},
1385         {0x00, 0x37, 0xc8, 0xaa},       {0x00, 0x3b, 0x36, 0xaa},
1386         {0x00, 0x4b, 0xfe, 0xaa},       {0x00, 0x51, 0x1c, 0xaa},
1387         {0x00, 0x52, 0x01, 0xaa},       {0x00, 0x55, 0x0a, 0xaa},
1388         {0x00, 0x59, 0x6f, 0xaa},       {0x00, 0x5a, 0x04, 0xaa},
1389         {0x00, 0x5c, 0x10, 0xaa},       {0x00, 0x5d, 0x10, 0xaa},
1390         {0x00, 0x5e, 0x10, 0xaa},       {0x00, 0x5f, 0x10, 0xaa},
1391         {0x00, 0x61, 0x00, 0xaa},       {0x00, 0x62, 0x18, 0xaa},
1392         {0x00, 0x63, 0x30, 0xaa},       {0x00, 0x70, 0x68, 0xaa},
1393         {0x00, 0x80, 0x71, 0xaa},       {0x00, 0x81, 0x08, 0xaa},
1394         {0x00, 0x82, 0x00, 0xaa},       {0x00, 0x83, 0x55, 0xaa},
1395         {0x00, 0x84, 0x06, 0xaa},       {0x00, 0x85, 0x06, 0xaa},
1396         {0x00, 0x86, 0x13, 0xaa},       {0x00, 0x87, 0x18, 0xaa},
1397         {0x00, 0xaa, 0x3f, 0xaa},       {0x00, 0xab, 0x44, 0xaa},
1398         {0x00, 0xb0, 0x68, 0xaa},       {0x00, 0xb5, 0x10, 0xaa},
1399         {0x00, 0xb8, 0x20, 0xaa},       {0x00, 0xb9, 0xa0, 0xaa},
1400         {0x00, 0xbc, 0x04, 0xaa},       {0x00, 0x8b, 0x40, 0xaa},
1401         {0x00, 0x8c, 0x91, 0xaa},       {0x00, 0x8d, 0x8f, 0xaa},
1402         {0x00, 0x8e, 0x91, 0xaa},       {0x00, 0x8f, 0x43, 0xaa},
1403         {0x00, 0x90, 0x92, 0xaa},       {0x00, 0x91, 0x89, 0xaa},
1404         {0x00, 0x92, 0x9d, 0xaa},       {0x00, 0x93, 0x46, 0xaa},
1405         {0x00, 0xd6, 0x22, 0xaa},       {0x00, 0x73, 0x00, 0xaa},
1406         {0x00, 0x74, 0x10, 0xaa},       {0x00, 0x75, 0x20, 0xaa},
1407         {0x00, 0x76, 0x2b, 0xaa},       {0x00, 0x77, 0x36, 0xaa},
1408         {0x00, 0x78, 0x49, 0xaa},       {0x00, 0x79, 0x5a, 0xaa},
1409         {0x00, 0x7a, 0x7f, 0xaa},       {0x00, 0x7b, 0x9b, 0xaa},
1410         {0x00, 0x7c, 0xba, 0xaa},       {0x00, 0x7d, 0xd4, 0xaa},
1411         {0x00, 0x7e, 0xea, 0xaa},       {0x00, 0xd6, 0x62, 0xaa},
1412         {0x00, 0x73, 0x00, 0xaa},       {0x00, 0x74, 0x10, 0xaa},
1413         {0x00, 0x75, 0x20, 0xaa},       {0x00, 0x76, 0x2b, 0xaa},
1414         {0x00, 0x77, 0x36, 0xaa},       {0x00, 0x78, 0x49, 0xaa},
1415         {0x00, 0x79, 0x5a, 0xaa},       {0x00, 0x7a, 0x7f, 0xaa},
1416         {0x00, 0x7b, 0x9b, 0xaa},       {0x00, 0x7c, 0xba, 0xaa},
1417         {0x00, 0x7d, 0xd4, 0xaa},       {0x00, 0x7e, 0xea, 0xaa},
1418         {0x00, 0xd6, 0xa2, 0xaa},       {0x00, 0x73, 0x00, 0xaa},
1419         {0x00, 0x74, 0x10, 0xaa},       {0x00, 0x75, 0x20, 0xaa},
1420         {0x00, 0x76, 0x2b, 0xaa},       {0x00, 0x77, 0x36, 0xaa},
1421         {0x00, 0x78, 0x49, 0xaa},       {0x00, 0x79, 0x5a, 0xaa},
1422         {0x00, 0x7a, 0x7f, 0xaa},       {0x00, 0x7b, 0x9b, 0xaa},
1423         {0x00, 0x7c, 0xba, 0xaa},       {0x00, 0x7d, 0xd4, 0xaa},
1424         {0x00, 0x7e, 0xea, 0xaa},       {0x00, 0x4c, 0x07, 0xaa},
1425         {0x00, 0x4b, 0xe0, 0xaa},       {0x00, 0x4e, 0x77, 0xaa},
1426         {0x00, 0x59, 0x66, 0xaa},       {0x00, 0x4d, 0x0a, 0xaa},
1427         {0x00, 0xd1, 0x00, 0xaa},       {0x00, 0x20, 0xc4, 0xaa},
1428         {0xb8, 0x8e, 0x00, 0xcc},       {0xb8, 0x8f, 0xff, 0xcc},
1429         {0xb8, 0xfe, 0x00, 0xcc},       {0xb8, 0xff, 0x28, 0xcc},
1430         {0xb9, 0x00, 0x28, 0xcc},       {0xb9, 0x01, 0x28, 0xcc},
1431         {0xb9, 0x02, 0x28, 0xcc},       {0xb9, 0x03, 0x00, 0xcc},
1432         {0xb9, 0x04, 0x00, 0xcc},       {0xb9, 0x05, 0x3c, 0xcc},
1433         {0xb9, 0x06, 0x3c, 0xcc},       {0xb9, 0x07, 0x3c, 0xcc},
1434         {0xb9, 0x08, 0x3c, 0xcc},       {0xbc, 0x02, 0x18, 0xcc},
1435         {0xbc, 0x03, 0x50, 0xcc},       {0xbc, 0x04, 0x18, 0xcc},
1436         {0xbc, 0x05, 0x00, 0xcc},       {0xbc, 0x06, 0x00, 0xcc},
1437         {0xbc, 0x08, 0x30, 0xcc},       {0xbc, 0x09, 0x40, 0xcc},
1438         {0xbc, 0x0a, 0x10, 0xcc},       {0xbc, 0x0b, 0x00, 0xcc},
1439         {0xbc, 0x0c, 0x00, 0xcc},       {0x00, 0x05, 0x00, 0xaa},
1440         {0xb3, 0x5c, 0x00, 0xcc},       {0xb3, 0x01, 0x41, 0xcc},
1441         {}
1442 };
1443
1444 static const __u8 hv7131r_gamma[17] = {
1445 /*      0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
1446  *      0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff */
1447         0x04, 0x1a, 0x36, 0x55, 0x6f, 0x87, 0x9d, 0xb0, 0xc1,
1448         0xcf, 0xda, 0xe4, 0xec, 0xf3, 0xf8, 0xfd, 0xff
1449 };
1450 static const __u8 hv7131r_matrix[9] = {
1451         0x5f, 0xec, 0xf5, 0xf1, 0x5a, 0xf5, 0xf1, 0xec, 0x63
1452 };
1453 static const __u8 hv7131r_initVGA_data[][4] = {
1454         {0xb0, 0x4d, 0x00, 0xcc},       {0xb3, 0x01, 0x01, 0xcc},
1455         {0x00, 0x00, 0x50, 0xdd},       {0xb0, 0x03, 0x01, 0xcc},
1456         {0xb3, 0x00, 0x24, 0xcc},
1457         {0xb3, 0x00, 0x25, 0xcc},       {0xb3, 0x08, 0x01, 0xcc},
1458         {0xb3, 0x09, 0x0c, 0xcc},       {0xb3, 0x05, 0x00, 0xcc},
1459         {0xb3, 0x06, 0x01, 0xcc},
1460         {0xb3, 0x01, 0x45, 0xcc},       {0xb3, 0x03, 0x0b, 0xcc},
1461         {0xb3, 0x04, 0x05, 0xcc},       {0xb3, 0x20, 0x00, 0xcc},
1462         {0xb3, 0x21, 0x00, 0xcc},
1463         {0xb3, 0x22, 0x01, 0xcc},       {0xb3, 0x23, 0xe0, 0xcc},
1464         {0xb3, 0x14, 0x00, 0xcc},       {0xb3, 0x15, 0x00, 0xcc},
1465         {0xb3, 0x16, 0x02, 0xcc},
1466         {0xb3, 0x17, 0x7f, 0xcc},       {0xb3, 0x34, 0x01, 0xcc},
1467         {0xb3, 0x35, 0x91, 0xcc},       {0xb3, 0x00, 0x27, 0xcc},
1468         {0xbc, 0x00, 0x73, 0xcc},
1469         {0xb8, 0x00, 0x23, 0xcc},       {0x00, 0x01, 0x0c, 0xaa},
1470         {0x00, 0x14, 0x01, 0xaa},       {0x00, 0x15, 0xe6, 0xaa},
1471         {0x00, 0x16, 0x02, 0xaa},
1472         {0x00, 0x17, 0x86, 0xaa},       {0x00, 0x23, 0x00, 0xaa},
1473         {0x00, 0x25, 0x09, 0xaa},       {0x00, 0x26, 0x27, 0xaa},
1474         {0x00, 0x27, 0xc0, 0xaa},
1475         {0xb8, 0x2c, 0x60, 0xcc},       {0xb8, 0x2d, 0xf8, 0xcc},
1476         {0xb8, 0x2e, 0xf8, 0xcc},       {0xb8, 0x2f, 0xf8, 0xcc},
1477         {0xb8, 0x30, 0x50, 0xcc},
1478         {0xb8, 0x31, 0xf8, 0xcc},       {0xb8, 0x32, 0xf8, 0xcc},
1479         {0xb8, 0x33, 0xf8, 0xcc},       {0xb8, 0x34, 0x65, 0xcc},
1480         {0xb8, 0x35, 0x00, 0xcc},
1481         {0xb8, 0x36, 0x00, 0xcc},       {0xb8, 0x37, 0x00, 0xcc},
1482         {0xb8, 0x27, 0x20, 0xcc},       {0xb8, 0x01, 0x7d, 0xcc},
1483         {0xb8, 0x81, 0x09, 0xcc},
1484         {0xb3, 0x01, 0x41, 0xcc},       {0xb8, 0xfe, 0x00, 0xcc},
1485         {0xb8, 0xff, 0x28, 0xcc},       {0xb9, 0x00, 0x28, 0xcc},
1486         {0xb9, 0x01, 0x28, 0xcc},
1487         {0xb9, 0x02, 0x28, 0xcc},       {0xb9, 0x03, 0x00, 0xcc},
1488         {0xb9, 0x04, 0x00, 0xcc},       {0xb9, 0x05, 0x3c, 0xcc},
1489         {0xb9, 0x06, 0x3c, 0xcc},
1490         {0xb9, 0x07, 0x3c, 0xcc},       {0xb9, 0x08, 0x3c, 0xcc},
1491         {0xb8, 0x8e, 0x00, 0xcc},       {0xb8, 0x8f, 0xff, 0xcc},
1492         {0x00, 0x30, 0x18, 0xaa},
1493         {}
1494 };
1495
1496 static const __u8 hv7131r_initQVGA_data[][4] = {
1497         {0xb0, 0x4d, 0x00, 0xcc},       {0xb3, 0x01, 0x01, 0xcc},
1498         {0x00, 0x00, 0x50, 0xdd},       {0xb0, 0x03, 0x01, 0xcc},
1499         {0xb3, 0x00, 0x24, 0xcc},
1500         {0xb3, 0x00, 0x25, 0xcc},       {0xb3, 0x08, 0x01, 0xcc},
1501         {0xb3, 0x09, 0x0c, 0xcc},       {0xb3, 0x05, 0x00, 0xcc},
1502         {0xb3, 0x06, 0x01, 0xcc},
1503         {0xb3, 0x03, 0x0b, 0xcc},       {0xb3, 0x04, 0x05, 0xcc},
1504         {0xb3, 0x20, 0x00, 0xcc},       {0xb3, 0x21, 0x00, 0xcc},
1505         {0xb3, 0x22, 0x01, 0xcc},
1506         {0xb3, 0x23, 0xe0, 0xcc},       {0xb3, 0x14, 0x00, 0xcc},
1507         {0xb3, 0x15, 0x00, 0xcc},       {0xb3, 0x16, 0x02, 0xcc},
1508         {0xb3, 0x17, 0x7f, 0xcc},
1509         {0xb3, 0x34, 0x01, 0xcc},       {0xb3, 0x35, 0x91, 0xcc},
1510         {0xb3, 0x00, 0x27, 0xcc},       {0xbc, 0x00, 0xd1, 0xcc},
1511         {0xb8, 0x00, 0x21, 0xcc},
1512         {0x00, 0x01, 0x0c, 0xaa},       {0x00, 0x14, 0x01, 0xaa},
1513         {0x00, 0x15, 0xe6, 0xaa},       {0x00, 0x16, 0x02, 0xaa},
1514         {0x00, 0x17, 0x86, 0xaa},
1515         {0x00, 0x23, 0x00, 0xaa},       {0x00, 0x25, 0x01, 0xaa},
1516         {0x00, 0x26, 0xd4, 0xaa},       {0x00, 0x27, 0xc0, 0xaa},
1517         {0xbc, 0x02, 0x08, 0xcc},
1518         {0xbc, 0x03, 0x70, 0xcc},       {0xbc, 0x04, 0x08, 0xcc},
1519         {0xbc, 0x05, 0x00, 0xcc},       {0xbc, 0x06, 0x00, 0xcc},
1520         {0xbc, 0x08, 0x3c, 0xcc},
1521         {0xbc, 0x09, 0x40, 0xcc},       {0xbc, 0x0a, 0x04, 0xcc},
1522         {0xbc, 0x0b, 0x00, 0xcc},       {0xbc, 0x0c, 0x00, 0xcc},
1523         {0xb8, 0xfe, 0x02, 0xcc},
1524         {0xb8, 0xff, 0x07, 0xcc},       {0xb9, 0x00, 0x14, 0xcc},
1525         {0xb9, 0x01, 0x14, 0xcc},       {0xb9, 0x02, 0x14, 0xcc},
1526         {0xb9, 0x03, 0x00, 0xcc},
1527         {0xb9, 0x04, 0x02, 0xcc},       {0xb9, 0x05, 0x05, 0xcc},
1528         {0xb9, 0x06, 0x0f, 0xcc},       {0xb9, 0x07, 0x0f, 0xcc},
1529         {0xb9, 0x08, 0x0f, 0xcc},
1530         {0xb8, 0x2c, 0x60, 0xcc},       {0xb8, 0x2d, 0xf8, 0xcc},
1531         {0xb8, 0x2e, 0xf8, 0xcc},       {0xb8, 0x2f, 0xf8, 0xcc},
1532         {0xb8, 0x30, 0x50, 0xcc},
1533         {0xb8, 0x31, 0xf8, 0xcc},       {0xb8, 0x32, 0xf8, 0xcc},
1534         {0xb8, 0x33, 0xf8, 0xcc},
1535         {0xb8, 0x34, 0x65, 0xcc},       {0xb8, 0x35, 0x00, 0xcc},
1536         {0xb8, 0x36, 0x00, 0xcc},       {0xb8, 0x37, 0x00, 0xcc},
1537         {0xb8, 0x27, 0x20, 0xcc},
1538         {0xb8, 0x01, 0x7d, 0xcc},       {0xb8, 0x81, 0x09, 0xcc},
1539         {0xb3, 0x01, 0x41, 0xcc},       {0xb8, 0xfe, 0x00, 0xcc},
1540         {0xb8, 0xff, 0x28, 0xcc},
1541         {0xb9, 0x00, 0x28, 0xcc},       {0xb9, 0x01, 0x28, 0xcc},
1542         {0xb9, 0x02, 0x28, 0xcc},       {0xb9, 0x03, 0x00, 0xcc},
1543         {0xb9, 0x04, 0x00, 0xcc},
1544         {0xb9, 0x05, 0x3c, 0xcc},       {0xb9, 0x06, 0x3c, 0xcc},
1545         {0xb9, 0x07, 0x3c, 0xcc},       {0xb9, 0x08, 0x3c, 0xcc},
1546         {0xb8, 0x8e, 0x00, 0xcc},
1547         {0xb8, 0x8f, 0xff, 0xcc},       {0x00, 0x30, 0x18, 0xaa},
1548         {}
1549 };
1550
1551 static const __u8 ov7660_gamma[17] = {
1552         0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
1553         0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
1554 };
1555 static const __u8 ov7660_matrix[9] = {
1556         0x5a, 0xf0, 0xf6, 0xf3, 0x57, 0xf6, 0xf3, 0xef, 0x62
1557 };
1558 static const __u8 ov7660_initVGA_data[][4] = {
1559         {0xb0, 0x4d, 0x00, 0xcc},       {0xb3, 0x01, 0x01, 0xcc},
1560         {0x00, 0x00, 0x50, 0xdd},
1561         {0xb0, 0x03, 0x01, 0xcc},
1562         {0xb3, 0x00, 0x21, 0xcc},       {0xb3, 0x00, 0x26, 0xcc},
1563         {0xb3, 0x05, 0x01, 0xcc},
1564         {0xb3, 0x06, 0x03, 0xcc},
1565         {0xb3, 0x03, 0x1f, 0xcc},       {0xb3, 0x04, 0x05, 0xcc},
1566         {0xb3, 0x05, 0x00, 0xcc},
1567         {0xb3, 0x06, 0x01, 0xcc},
1568         {0xb3, 0x15, 0x00, 0xcc},/* 0xb315  <-0 href startl */
1569         {0xb3, 0x16, 0x02, 0xcc},       {0xb3, 0x17, 0x7f, 0xcc},
1570         {0xb3, 0x21, 0x00, 0xcc},
1571         {0xb3, 0x23, 0xe0, 0xcc},       {0xb3, 0x1d, 0x01, 0xcc},
1572         {0xb3, 0x1f, 0x02, 0xcc},
1573         {0xb3, 0x34, 0x01, 0xcc},
1574         {0xb3, 0x35, 0xa1, 0xcc},       {0xb3, 0x00, 0x26, 0xcc},
1575         {0xb8, 0x00, 0x33, 0xcc}, /* 13 */
1576         {0xb8, 0x01, 0x7d, 0xcc},
1577         {0xbc, 0x00, 0x73, 0xcc},       {0xb8, 0x81, 0x09, 0xcc},
1578         {0xb8, 0x27, 0x20, 0xcc},
1579         {0xb8, 0x8f, 0x50, 0xcc},
1580         {0x00, 0x01, 0x80, 0xaa},       {0x00, 0x02, 0x80, 0xaa},
1581         {0x00, 0x12, 0x80, 0xaa},
1582         {0x00, 0x12, 0x05, 0xaa},
1583         {0x00, 0x1e, 0x01, 0xaa},       /* MVFP */
1584         {0x00, 0x3d, 0x40, 0xaa}, /* 0x3d <-40 gamma 01 */
1585         {0x00, 0x41, 0x00, 0xaa}, /* edge 00 */
1586         {0x00, 0x0d, 0x48, 0xaa},       {0x00, 0x0e, 0x04, 0xaa},
1587         {0x00, 0x13, 0xa7, 0xaa},
1588         {0x00, 0x40, 0xc1, 0xaa},       {0x00, 0x35, 0x00, 0xaa},
1589         {0x00, 0x36, 0x00, 0xaa},
1590         {0x00, 0x3c, 0x68, 0xaa},       {0x00, 0x1b, 0x05, 0xaa},
1591         {0x00, 0x39, 0x43, 0xaa},
1592         {0x00, 0x8d, 0xcf, 0xaa},
1593         {0x00, 0x8b, 0xcc, 0xaa},       {0x00, 0x8c, 0xcc, 0xaa},
1594         {0x00, 0x0f, 0x62, 0xaa},
1595         {0x00, 0x35, 0x84, 0xaa},
1596         {0x00, 0x3b, 0x08, 0xaa}, /* 0 * Nightframe 1/4 + 50Hz -> 0xC8 */
1597         {0x00, 0x3a, 0x00, 0xaa}, /* mx change yuyv format 00, 04, 01; 08, 0c*/
1598         {0x00, 0x14, 0x2a, 0xaa}, /* agc ampli */
1599         {0x00, 0x9e, 0x40, 0xaa},       {0xb8, 0x8f, 0x50, 0xcc},
1600         {0x00, 0x01, 0x80, 0xaa},
1601         {0x00, 0x02, 0x80, 0xaa},
1602         {0xb8, 0xfe, 0x00, 0xcc},       {0xb8, 0xff, 0x28, 0xcc},
1603         {0xb9, 0x00, 0x28, 0xcc},
1604         {0xb9, 0x01, 0x28, 0xcc},       {0xb9, 0x02, 0x28, 0xcc},
1605         {0xb9, 0x03, 0x00, 0xcc},
1606         {0xb9, 0x04, 0x00, 0xcc},
1607         {0xb9, 0x05, 0x3c, 0xcc},       {0xb9, 0x06, 0x3c, 0xcc},
1608         {0xb9, 0x07, 0x3c, 0xcc},
1609         {0xb9, 0x08, 0x3c, 0xcc},
1610
1611         {0xb8, 0x8e, 0x00, 0xcc},       {0xb8, 0x8f, 0xff, 0xcc},
1612
1613         {0x00, 0x29, 0x3c, 0xaa},       {0xb3, 0x01, 0x45, 0xcc},
1614         {}
1615 };
1616 static const __u8 ov7660_initQVGA_data[][4] = {
1617         {0xb0, 0x4d, 0x00, 0xcc},       {0xb3, 0x01, 0x01, 0xcc},
1618         {0x00, 0x00, 0x50, 0xdd},       {0xb0, 0x03, 0x01, 0xcc},
1619         {0xb3, 0x00, 0x21, 0xcc},       {0xb3, 0x00, 0x26, 0xcc},
1620         {0xb3, 0x05, 0x01, 0xcc},       {0xb3, 0x06, 0x03, 0xcc},
1621         {0xb3, 0x03, 0x1f, 0xcc},       {0xb3, 0x04, 0x05, 0xcc},
1622         {0xb3, 0x05, 0x00, 0xcc},       {0xb3, 0x06, 0x01, 0xcc},
1623         {0xb3, 0x15, 0x00, 0xcc},/* 0xb315  <-0 href startl */
1624         {0xb3, 0x16, 0x02, 0xcc},       {0xb3, 0x17, 0x7f, 0xcc},
1625         {0xb3, 0x21, 0x00, 0xcc},
1626         {0xb3, 0x23, 0xe0, 0xcc},       {0xb3, 0x1d, 0x01, 0xcc},
1627         {0xb3, 0x1f, 0x02, 0xcc},       {0xb3, 0x34, 0x01, 0xcc},
1628         {0xb3, 0x35, 0xa1, 0xcc},       {0xb3, 0x00, 0x26, 0xcc},
1629         {0xb8, 0x00, 0x33, 0xcc}, /* 13 */
1630         {0xb8, 0x01, 0x7d, 0xcc},
1631 /* sizer */
1632         {0xbc, 0x00, 0xd3, 0xcc},
1633         {0xb8, 0x81, 0x09, 0xcc},       {0xb8, 0x81, 0x09, 0xcc},
1634         {0xb8, 0x27, 0x20, 0xcc},       {0xb8, 0x8f, 0x50, 0xcc},
1635         {0x00, 0x01, 0x80, 0xaa},       {0x00, 0x02, 0x80, 0xaa},
1636         {0x00, 0x12, 0x80, 0xaa},       {0x00, 0x12, 0x05, 0xaa},
1637         {0x00, 0x1e, 0x01, 0xaa},       /* MVFP */
1638         {0x00, 0x3d, 0x40, 0xaa}, /* 0x3d <-40 gamma 01 */
1639         {0x00, 0x41, 0x00, 0xaa}, /* edge 00 */
1640         {0x00, 0x0d, 0x48, 0xaa},       {0x00, 0x0e, 0x04, 0xaa},
1641         {0x00, 0x13, 0xa7, 0xaa},
1642         {0x00, 0x40, 0xc1, 0xaa},       {0x00, 0x35, 0x00, 0xaa},
1643         {0x00, 0x36, 0x00, 0xaa},
1644         {0x00, 0x3c, 0x68, 0xaa},       {0x00, 0x1b, 0x05, 0xaa},
1645         {0x00, 0x39, 0x43, 0xaa},       {0x00, 0x8d, 0xcf, 0xaa},
1646         {0x00, 0x8b, 0xcc, 0xaa},       {0x00, 0x8c, 0xcc, 0xaa},
1647         {0x00, 0x0f, 0x62, 0xaa},       {0x00, 0x35, 0x84, 0xaa},
1648         {0x00, 0x3b, 0x08, 0xaa}, /* 0  * Nightframe 1/4 + 50Hz -> 0xC8 */
1649         {0x00, 0x3a, 0x00, 0xaa}, /* mx change yuyv format 00, 04, 01; 08, 0c*/
1650         {0x00, 0x14, 0x2a, 0xaa}, /* agc ampli */
1651         {0x00, 0x9e, 0x40, 0xaa},       {0xb8, 0x8f, 0x50, 0xcc},
1652         {0x00, 0x01, 0x80, 0xaa},
1653         {0x00, 0x02, 0x80, 0xaa},
1654 /* sizer filters */
1655         {0xbc, 0x02, 0x08, 0xcc},
1656         {0xbc, 0x03, 0x70, 0xcc},
1657         {0xb8, 0x35, 0x00, 0xcc},
1658         {0xb8, 0x36, 0x00, 0xcc},
1659         {0xb8, 0x37, 0x00, 0xcc},
1660         {0xbc, 0x04, 0x08, 0xcc},
1661         {0xbc, 0x05, 0x00, 0xcc},
1662         {0xbc, 0x06, 0x00, 0xcc},
1663         {0xbc, 0x08, 0x3c, 0xcc},
1664         {0xbc, 0x09, 0x40, 0xcc},
1665         {0xbc, 0x0a, 0x04, 0xcc},
1666         {0xbc, 0x0b, 0x00, 0xcc},
1667         {0xbc, 0x0c, 0x00, 0xcc},
1668 /* */
1669         {0xb8, 0xfe, 0x00, 0xcc},
1670         {0xb8, 0xff, 0x28, 0xcc},
1671 /* */
1672         {0xb9, 0x00, 0x28, 0xcc},       {0xb9, 0x01, 0x28, 0xcc},
1673         {0xb9, 0x02, 0x28, 0xcc},       {0xb9, 0x03, 0x00, 0xcc},
1674         {0xb9, 0x04, 0x00, 0xcc},       {0xb9, 0x05, 0x3c, 0xcc},
1675         {0xb9, 0x06, 0x3c, 0xcc},       {0xb9, 0x07, 0x3c, 0xcc},
1676         {0xb9, 0x08, 0x3c, 0xcc},
1677 /* */
1678         {0xb8, 0x8e, 0x00, 0xcc},
1679         {0xb8, 0x8f, 0xff, 0xcc}, /* ff */
1680         {0x00, 0x29, 0x3c, 0xaa},
1681         {0xb3, 0x01, 0x45, 0xcc}, /* 45 */
1682         {}
1683 };
1684
1685 static const __u8 ov7660_50HZ[][4] = {
1686         {0x00, 0x3b, 0x08, 0xaa},
1687         {0x00, 0x9d, 0x40, 0xaa},
1688         {0x00, 0x13, 0xa7, 0xaa},
1689         {}
1690 };
1691
1692 static const __u8 ov7660_60HZ[][4] = {
1693         {0x00, 0x3b, 0x00, 0xaa},
1694         {0x00, 0x9e, 0x40, 0xaa},
1695         {0x00, 0x13, 0xa7, 0xaa},
1696         {}
1697 };
1698
1699 static const __u8 ov7660_NoFliker[][4] = {
1700         {0x00, 0x13, 0x87, 0xaa},
1701         {}
1702 };
1703
1704 static const __u8 ov7670_initVGA_JPG[][4] = {
1705         {0xb3, 0x01, 0x05, 0xcc},
1706         {0x00, 0x00, 0x30, 0xdd},       {0xb0, 0x03, 0x19, 0xcc},
1707         {0x00, 0x00, 0x10, 0xdd},
1708         {0xb0, 0x04, 0x02, 0xcc},       {0x00, 0x00, 0x10, 0xdd},
1709         {0xb3, 0x00, 0x66, 0xcc},       {0xb3, 0x00, 0x67, 0xcc},
1710         {0xb3, 0x35, 0xa1, 0xcc},       {0xb3, 0x34, 0x01, 0xcc},
1711         {0xb3, 0x05, 0x01, 0xcc},       {0xb3, 0x06, 0x01, 0xcc},
1712         {0xb3, 0x08, 0x01, 0xcc},       {0xb3, 0x09, 0x0c, 0xcc},
1713         {0xb3, 0x02, 0x02, 0xcc},       {0xb3, 0x03, 0x1f, 0xcc},
1714         {0xb3, 0x14, 0x00, 0xcc},       {0xb3, 0x15, 0x00, 0xcc},
1715         {0xb3, 0x16, 0x02, 0xcc},       {0xb3, 0x17, 0x7f, 0xcc},
1716         {0xb3, 0x04, 0x05, 0xcc},       {0xb3, 0x20, 0x00, 0xcc},
1717         {0xb3, 0x21, 0x00, 0xcc},       {0xb3, 0x22, 0x01, 0xcc},
1718         {0xb3, 0x23, 0xe0, 0xcc},       {0xbc, 0x00, 0x41, 0xcc},
1719         {0xbc, 0x01, 0x01, 0xcc},       {0x00, 0x12, 0x80, 0xaa},
1720         {0x00, 0x00, 0x20, 0xdd},       {0x00, 0x12, 0x00, 0xaa},
1721         {0x00, 0x11, 0x40, 0xaa},       {0x00, 0x6b, 0x0a, 0xaa},
1722         {0x00, 0x3a, 0x04, 0xaa},       {0x00, 0x40, 0xc0, 0xaa},
1723         {0x00, 0x8c, 0x00, 0xaa},       {0x00, 0x7a, 0x29, 0xaa},
1724         {0x00, 0x7b, 0x0e, 0xaa},       {0x00, 0x7c, 0x1a, 0xaa},
1725         {0x00, 0x7d, 0x31, 0xaa},       {0x00, 0x7e, 0x53, 0xaa},
1726         {0x00, 0x7f, 0x60, 0xaa},       {0x00, 0x80, 0x6b, 0xaa},
1727         {0x00, 0x81, 0x73, 0xaa},       {0x00, 0x82, 0x7b, 0xaa},
1728         {0x00, 0x83, 0x82, 0xaa},       {0x00, 0x84, 0x89, 0xaa},
1729         {0x00, 0x85, 0x96, 0xaa},       {0x00, 0x86, 0xa1, 0xaa},
1730         {0x00, 0x87, 0xb7, 0xaa},       {0x00, 0x88, 0xcc, 0xaa},
1731         {0x00, 0x89, 0xe1, 0xaa},       {0x00, 0x13, 0xe0, 0xaa},
1732         {0x00, 0x00, 0x00, 0xaa},       {0x00, 0x10, 0x00, 0xaa},
1733         {0x00, 0x0d, 0x40, 0xaa},       {0x00, 0x14, 0x28, 0xaa},
1734         {0x00, 0xa5, 0x05, 0xaa},       {0x00, 0xab, 0x07, 0xaa},
1735         {0x00, 0x24, 0x95, 0xaa},       {0x00, 0x25, 0x33, 0xaa},
1736         {0x00, 0x26, 0xe3, 0xaa},       {0x00, 0x9f, 0x88, 0xaa},
1737         {0x00, 0xa0, 0x78, 0xaa},       {0x00, 0x55, 0x90, 0xaa},
1738         {0x00, 0xa1, 0x03, 0xaa},       {0x00, 0xa6, 0xe0, 0xaa},
1739         {0x00, 0xa7, 0xd8, 0xaa},       {0x00, 0xa8, 0xf0, 0xaa},
1740         {0x00, 0xa9, 0x90, 0xaa},       {0x00, 0xaa, 0x14, 0xaa},
1741         {0x00, 0x13, 0xe5, 0xaa},       {0x00, 0x0e, 0x61, 0xaa},
1742         {0x00, 0x0f, 0x4b, 0xaa},       {0x00, 0x16, 0x02, 0xaa},
1743         {0x00, 0x1e, 0x07, 0xaa},       /* MVFP */
1744         {0x00, 0x21, 0x02, 0xaa},
1745         {0x00, 0x22, 0x91, 0xaa},       {0x00, 0x29, 0x07, 0xaa},
1746         {0x00, 0x33, 0x0b, 0xaa},       {0x00, 0x35, 0x0b, 0xaa},
1747         {0x00, 0x37, 0x1d, 0xaa},       {0x00, 0x38, 0x71, 0xaa},
1748         {0x00, 0x39, 0x2a, 0xaa},       {0x00, 0x3c, 0x78, 0xaa},
1749         {0x00, 0x4d, 0x40, 0xaa},       {0x00, 0x4e, 0x20, 0xaa},
1750         {0x00, 0x74, 0x19, 0xaa},       {0x00, 0x8d, 0x4f, 0xaa},
1751         {0x00, 0x8e, 0x00, 0xaa},       {0x00, 0x8f, 0x00, 0xaa},
1752         {0x00, 0x90, 0x00, 0xaa},       {0x00, 0x91, 0x00, 0xaa},
1753         {0x00, 0x96, 0x00, 0xaa},       {0x00, 0x9a, 0x80, 0xaa},
1754         {0x00, 0xb0, 0x84, 0xaa},       {0x00, 0xb1, 0x0c, 0xaa},
1755         {0x00, 0xb2, 0x0e, 0xaa},       {0x00, 0xb3, 0x82, 0xaa},
1756         {0x00, 0xb8, 0x0a, 0xaa},       {0x00, 0x43, 0x14, 0xaa},
1757         {0x00, 0x44, 0xf0, 0xaa},       {0x00, 0x45, 0x45, 0xaa},
1758         {0x00, 0x46, 0x63, 0xaa},       {0x00, 0x47, 0x2d, 0xaa},
1759         {0x00, 0x48, 0x46, 0xaa},       {0x00, 0x59, 0x88, 0xaa},
1760         {0x00, 0x5a, 0xa0, 0xaa},       {0x00, 0x5b, 0xc6, 0xaa},
1761         {0x00, 0x5c, 0x7d, 0xaa},       {0x00, 0x5d, 0x5f, 0xaa},
1762         {0x00, 0x5e, 0x19, 0xaa},       {0x00, 0x6c, 0x0a, 0xaa},
1763         {0x00, 0x6d, 0x55, 0xaa},       {0x00, 0x6e, 0x11, 0xaa},
1764         {0x00, 0x6f, 0x9e, 0xaa},       {0x00, 0x69, 0x00, 0xaa},
1765         {0x00, 0x6a, 0x40, 0xaa},       {0x00, 0x01, 0x40, 0xaa},
1766         {0x00, 0x02, 0x40, 0xaa},       {0x00, 0x13, 0xe7, 0xaa},
1767         {0x00, 0x5f, 0xf0, 0xaa},       {0x00, 0x60, 0xf0, 0xaa},
1768         {0x00, 0x61, 0xf0, 0xaa},       {0x00, 0x27, 0xa0, 0xaa},
1769         {0x00, 0x28, 0x80, 0xaa},       {0x00, 0x2c, 0x90, 0xaa},
1770         {0x00, 0x4f, 0x66, 0xaa},       {0x00, 0x50, 0x66, 0xaa},
1771         {0x00, 0x51, 0x00, 0xaa},       {0x00, 0x52, 0x22, 0xaa},
1772         {0x00, 0x53, 0x5e, 0xaa},       {0x00, 0x54, 0x80, 0xaa},
1773         {0x00, 0x58, 0x9e, 0xaa},       {0x00, 0x41, 0x08, 0xaa},
1774         {0x00, 0x3f, 0x00, 0xaa},       {0x00, 0x75, 0x85, 0xaa},
1775         {0x00, 0x76, 0xe1, 0xaa},       {0x00, 0x4c, 0x00, 0xaa},
1776         {0x00, 0x77, 0x0a, 0xaa},       {0x00, 0x3d, 0x88, 0xaa},
1777         {0x00, 0x4b, 0x09, 0xaa},       {0x00, 0xc9, 0x60, 0xaa},
1778         {0x00, 0x41, 0x38, 0xaa},       {0x00, 0x62, 0x30, 0xaa},
1779         {0x00, 0x63, 0x30, 0xaa},       {0x00, 0x64, 0x08, 0xaa},
1780         {0x00, 0x94, 0x07, 0xaa},       {0x00, 0x95, 0x0b, 0xaa},
1781         {0x00, 0x65, 0x00, 0xaa},       {0x00, 0x66, 0x05, 0xaa},
1782         {0x00, 0x56, 0x50, 0xaa},       {0x00, 0x34, 0x11, 0xaa},
1783         {0x00, 0xa4, 0x88, 0xaa},       {0x00, 0x96, 0x00, 0xaa},
1784         {0x00, 0x97, 0x30, 0xaa},       {0x00, 0x98, 0x20, 0xaa},
1785         {0x00, 0x99, 0x30, 0xaa},       {0x00, 0x9a, 0x84, 0xaa},
1786         {0x00, 0x9b, 0x29, 0xaa},       {0x00, 0x9c, 0x03, 0xaa},
1787         {0x00, 0x78, 0x04, 0xaa},       {0x00, 0x79, 0x01, 0xaa},
1788         {0x00, 0xc8, 0xf0, 0xaa},       {0x00, 0x79, 0x0f, 0xaa},
1789         {0x00, 0xc8, 0x00, 0xaa},       {0x00, 0x79, 0x10, 0xaa},
1790         {0x00, 0xc8, 0x7e, 0xaa},       {0x00, 0x79, 0x0a, 0xaa},
1791         {0x00, 0xc8, 0x80, 0xaa},       {0x00, 0x79, 0x0b, 0xaa},
1792         {0x00, 0xc8, 0x01, 0xaa},       {0x00, 0x79, 0x0c, 0xaa},
1793         {0x00, 0xc8, 0x0f, 0xaa},       {0x00, 0x79, 0x0d, 0xaa},
1794         {0x00, 0xc8, 0x20, 0xaa},       {0x00, 0x79, 0x09, 0xaa},
1795         {0x00, 0xc8, 0x80, 0xaa},       {0x00, 0x79, 0x02, 0xaa},
1796         {0x00, 0xc8, 0xc0, 0xaa},       {0x00, 0x79, 0x03, 0xaa},
1797         {0x00, 0xc8, 0x40, 0xaa},       {0x00, 0x79, 0x05, 0xaa},
1798         {0x00, 0xc8, 0x30, 0xaa},       {0x00, 0x79, 0x26, 0xaa},
1799         {0x00, 0x11, 0x40, 0xaa},       {0x00, 0x3a, 0x04, 0xaa},
1800         {0x00, 0x12, 0x00, 0xaa},       {0x00, 0x40, 0xc0, 0xaa},
1801         {0x00, 0x8c, 0x00, 0xaa},       {0x00, 0x17, 0x14, 0xaa},
1802         {0x00, 0x18, 0x02, 0xaa},       {0x00, 0x32, 0x92, 0xaa},
1803         {0x00, 0x19, 0x02, 0xaa},       {0x00, 0x1a, 0x7a, 0xaa},
1804         {0x00, 0x03, 0x0a, 0xaa},       {0x00, 0x0c, 0x00, 0xaa},
1805         {0x00, 0x3e, 0x00, 0xaa},       {0x00, 0x70, 0x3a, 0xaa},
1806         {0x00, 0x71, 0x35, 0xaa},       {0x00, 0x72, 0x11, 0xaa},
1807         {0x00, 0x73, 0xf0, 0xaa},       {0x00, 0xa2, 0x02, 0xaa},
1808         {0x00, 0xb1, 0x00, 0xaa},       {0x00, 0xb1, 0x0c, 0xaa},
1809         {0x00, 0x1e, 0x37, 0xaa},       /* MVFP */
1810         {0x00, 0xaa, 0x14, 0xaa},
1811         {0x00, 0x24, 0x80, 0xaa},       {0x00, 0x25, 0x74, 0xaa},
1812         {0x00, 0x26, 0xd3, 0xaa},       {0x00, 0x0d, 0x00, 0xaa},
1813         {0x00, 0x14, 0x18, 0xaa},       {0x00, 0x9d, 0x99, 0xaa},
1814         {0x00, 0x9e, 0x7f, 0xaa},       {0x00, 0x64, 0x08, 0xaa},
1815         {0x00, 0x94, 0x07, 0xaa},       {0x00, 0x95, 0x06, 0xaa},
1816         {0x00, 0x66, 0x05, 0xaa},       {0x00, 0x41, 0x08, 0xaa},
1817         {0x00, 0x3f, 0x00, 0xaa},       {0x00, 0x75, 0x07, 0xaa},
1818         {0x00, 0x76, 0xe1, 0xaa},       {0x00, 0x4c, 0x00, 0xaa},
1819         {0x00, 0x77, 0x00, 0xaa},       {0x00, 0x3d, 0xc2, 0xaa},
1820         {0x00, 0x4b, 0x09, 0xaa},       {0x00, 0xc9, 0x60, 0xaa},
1821         {0x00, 0x41, 0x38, 0xaa},       {0xb6, 0x00, 0x00, 0xcc},
1822         {0xb6, 0x03, 0x02, 0xcc},       {0xb6, 0x02, 0x80, 0xcc},
1823         {0xb6, 0x05, 0x01, 0xcc},       {0xb6, 0x04, 0xe0, 0xcc},
1824         {0xb6, 0x12, 0xf8, 0xcc},       {0xb6, 0x13, 0x13, 0xcc},
1825         {0xb6, 0x18, 0x02, 0xcc},       {0xb6, 0x17, 0x58, 0xcc},
1826         {0xb6, 0x16, 0x00, 0xcc},       {0xb6, 0x22, 0x12, 0xcc},
1827         {0xb6, 0x23, 0x0b, 0xcc},       {0xbf, 0xc0, 0x39, 0xcc},
1828         {0xbf, 0xc1, 0x04, 0xcc},       {0xbf, 0xcc, 0x00, 0xcc},
1829         {0xb3, 0x5c, 0x01, 0xcc},       {0xb3, 0x01, 0x45, 0xcc},
1830         {0x00, 0x77, 0x05, 0xaa},
1831         {},
1832 };
1833
1834 static const __u8 ov7670_initQVGA_JPG[][4] = {
1835         {0xb3, 0x01, 0x05, 0xcc},       {0x00, 0x00, 0x30, 0xdd},
1836         {0xb0, 0x03, 0x19, 0xcc},       {0x00, 0x00, 0x10, 0xdd},
1837         {0xb0, 0x04, 0x02, 0xcc},       {0x00, 0x00, 0x10, 0xdd},
1838         {0xb3, 0x00, 0x66, 0xcc},       {0xb3, 0x00, 0x67, 0xcc},
1839         {0xb3, 0x35, 0xa1, 0xcc},       {0xb3, 0x34, 0x01, 0xcc},
1840         {0xb3, 0x05, 0x01, 0xcc},       {0xb3, 0x06, 0x01, 0xcc},
1841         {0xb3, 0x08, 0x01, 0xcc},       {0xb3, 0x09, 0x0c, 0xcc},
1842         {0xb3, 0x02, 0x02, 0xcc},       {0xb3, 0x03, 0x1f, 0xcc},
1843         {0xb3, 0x14, 0x00, 0xcc},       {0xb3, 0x15, 0x00, 0xcc},
1844         {0xb3, 0x16, 0x02, 0xcc},       {0xb3, 0x17, 0x7f, 0xcc},
1845         {0xb3, 0x04, 0x05, 0xcc},       {0xb3, 0x20, 0x00, 0xcc},
1846         {0xb3, 0x21, 0x00, 0xcc},       {0xb3, 0x22, 0x01, 0xcc},
1847         {0xb3, 0x23, 0xe0, 0xcc},       {0xbc, 0x00, 0xd1, 0xcc},
1848         {0xbc, 0x01, 0x01, 0xcc},       {0x00, 0x12, 0x80, 0xaa},
1849         {0x00, 0x00, 0x20, 0xdd},       {0x00, 0x12, 0x00, 0xaa},
1850         {0x00, 0x11, 0x40, 0xaa},       {0x00, 0x6b, 0x0a, 0xaa},
1851         {0x00, 0x3a, 0x04, 0xaa},       {0x00, 0x40, 0xc0, 0xaa},
1852         {0x00, 0x8c, 0x00, 0xaa},       {0x00, 0x7a, 0x29, 0xaa},
1853         {0x00, 0x7b, 0x0e, 0xaa},       {0x00, 0x7c, 0x1a, 0xaa},
1854         {0x00, 0x7d, 0x31, 0xaa},       {0x00, 0x7e, 0x53, 0xaa},
1855         {0x00, 0x7f, 0x60, 0xaa},       {0x00, 0x80, 0x6b, 0xaa},
1856         {0x00, 0x81, 0x73, 0xaa},       {0x00, 0x82, 0x7b, 0xaa},
1857         {0x00, 0x83, 0x82, 0xaa},       {0x00, 0x84, 0x89, 0xaa},
1858         {0x00, 0x85, 0x96, 0xaa},       {0x00, 0x86, 0xa1, 0xaa},
1859         {0x00, 0x87, 0xb7, 0xaa},       {0x00, 0x88, 0xcc, 0xaa},
1860         {0x00, 0x89, 0xe1, 0xaa},       {0x00, 0x13, 0xe0, 0xaa},
1861         {0x00, 0x00, 0x00, 0xaa},       {0x00, 0x10, 0x00, 0xaa},
1862         {0x00, 0x0d, 0x40, 0xaa},       {0x00, 0x14, 0x28, 0xaa},
1863         {0x00, 0xa5, 0x05, 0xaa},       {0x00, 0xab, 0x07, 0xaa},
1864         {0x00, 0x24, 0x95, 0xaa},       {0x00, 0x25, 0x33, 0xaa},
1865         {0x00, 0x26, 0xe3, 0xaa},       {0x00, 0x9f, 0x88, 0xaa},
1866         {0x00, 0xa0, 0x78, 0xaa},       {0x00, 0x55, 0x90, 0xaa},
1867         {0x00, 0xa1, 0x03, 0xaa},       {0x00, 0xa6, 0xe0, 0xaa},
1868         {0x00, 0xa7, 0xd8, 0xaa},       {0x00, 0xa8, 0xf0, 0xaa},
1869         {0x00, 0xa9, 0x90, 0xaa},       {0x00, 0xaa, 0x14, 0xaa},
1870         {0x00, 0x13, 0xe5, 0xaa},       {0x00, 0x0e, 0x61, 0xaa},
1871         {0x00, 0x0f, 0x4b, 0xaa},       {0x00, 0x16, 0x02, 0xaa},
1872         {0x00, 0x1e, 0x07, 0xaa},       /* MVFP */
1873         {0x00, 0x21, 0x02, 0xaa},
1874         {0x00, 0x22, 0x91, 0xaa},       {0x00, 0x29, 0x07, 0xaa},
1875         {0x00, 0x33, 0x0b, 0xaa},       {0x00, 0x35, 0x0b, 0xaa},
1876         {0x00, 0x37, 0x1d, 0xaa},       {0x00, 0x38, 0x71, 0xaa},
1877         {0x00, 0x39, 0x2a, 0xaa},       {0x00, 0x3c, 0x78, 0xaa},
1878         {0x00, 0x4d, 0x40, 0xaa},       {0x00, 0x4e, 0x20, 0xaa},
1879         {0x00, 0x74, 0x19, 0xaa},       {0x00, 0x8d, 0x4f, 0xaa},
1880         {0x00, 0x8e, 0x00, 0xaa},       {0x00, 0x8f, 0x00, 0xaa},
1881         {0x00, 0x90, 0x00, 0xaa},       {0x00, 0x91, 0x00, 0xaa},
1882         {0x00, 0x96, 0x00, 0xaa},       {0x00, 0x9a, 0x80, 0xaa},
1883         {0x00, 0xb0, 0x84, 0xaa},       {0x00, 0xb1, 0x0c, 0xaa},
1884         {0x00, 0xb2, 0x0e, 0xaa},       {0x00, 0xb3, 0x82, 0xaa},
1885         {0x00, 0xb8, 0x0a, 0xaa},       {0x00, 0x43, 0x14, 0xaa},
1886         {0x00, 0x44, 0xf0, 0xaa},       {0x00, 0x45, 0x45, 0xaa},
1887         {0x00, 0x46, 0x63, 0xaa},       {0x00, 0x47, 0x2d, 0xaa},
1888         {0x00, 0x48, 0x46, 0xaa},       {0x00, 0x59, 0x88, 0xaa},
1889         {0x00, 0x5a, 0xa0, 0xaa},       {0x00, 0x5b, 0xc6, 0xaa},
1890         {0x00, 0x5c, 0x7d, 0xaa},       {0x00, 0x5d, 0x5f, 0xaa},
1891         {0x00, 0x5e, 0x19, 0xaa},       {0x00, 0x6c, 0x0a, 0xaa},
1892         {0x00, 0x6d, 0x55, 0xaa},       {0x00, 0x6e, 0x11, 0xaa},
1893         {0x00, 0x6f, 0x9e, 0xaa},       {0x00, 0x69, 0x00, 0xaa},
1894         {0x00, 0x6a, 0x40, 0xaa},       {0x00, 0x01, 0x40, 0xaa},
1895         {0x00, 0x02, 0x40, 0xaa},       {0x00, 0x13, 0xe7, 0xaa},
1896         {0x00, 0x5f, 0xf0, 0xaa},       {0x00, 0x60, 0xf0, 0xaa},
1897         {0x00, 0x61, 0xf0, 0xaa},       {0x00, 0x27, 0xa0, 0xaa},
1898         {0x00, 0x28, 0x80, 0xaa},       {0x00, 0x2c, 0x90, 0xaa},
1899         {0x00, 0x4f, 0x66, 0xaa},       {0x00, 0x50, 0x66, 0xaa},
1900         {0x00, 0x51, 0x00, 0xaa},       {0x00, 0x52, 0x22, 0xaa},
1901         {0x00, 0x53, 0x5e, 0xaa},       {0x00, 0x54, 0x80, 0xaa},
1902         {0x00, 0x58, 0x9e, 0xaa},       {0x00, 0x41, 0x08, 0xaa},
1903         {0x00, 0x3f, 0x00, 0xaa},       {0x00, 0x75, 0x85, 0xaa},
1904         {0x00, 0x76, 0xe1, 0xaa},       {0x00, 0x4c, 0x00, 0xaa},
1905         {0x00, 0x77, 0x0a, 0xaa},       {0x00, 0x3d, 0x88, 0xaa},
1906         {0x00, 0x4b, 0x09, 0xaa},       {0x00, 0xc9, 0x60, 0xaa},
1907         {0x00, 0x41, 0x38, 0xaa},       {0x00, 0x62, 0x30, 0xaa},
1908         {0x00, 0x63, 0x30, 0xaa},       {0x00, 0x64, 0x08, 0xaa},
1909         {0x00, 0x94, 0x07, 0xaa},       {0x00, 0x95, 0x0b, 0xaa},
1910         {0x00, 0x65, 0x00, 0xaa},       {0x00, 0x66, 0x05, 0xaa},
1911         {0x00, 0x56, 0x50, 0xaa},       {0x00, 0x34, 0x11, 0xaa},
1912         {0x00, 0xa4, 0x88, 0xaa},       {0x00, 0x96, 0x00, 0xaa},
1913         {0x00, 0x97, 0x30, 0xaa},       {0x00, 0x98, 0x20, 0xaa},
1914         {0x00, 0x99, 0x30, 0xaa},       {0x00, 0x9a, 0x84, 0xaa},
1915         {0x00, 0x9b, 0x29, 0xaa},       {0x00, 0x9c, 0x03, 0xaa},
1916         {0x00, 0x78, 0x04, 0xaa},       {0x00, 0x79, 0x01, 0xaa},
1917         {0x00, 0xc8, 0xf0, 0xaa},       {0x00, 0x79, 0x0f, 0xaa},
1918         {0x00, 0xc8, 0x00, 0xaa},       {0x00, 0x79, 0x10, 0xaa},
1919         {0x00, 0xc8, 0x7e, 0xaa},       {0x00, 0x79, 0x0a, 0xaa},
1920         {0x00, 0xc8, 0x80, 0xaa},       {0x00, 0x79, 0x0b, 0xaa},
1921         {0x00, 0xc8, 0x01, 0xaa},       {0x00, 0x79, 0x0c, 0xaa},
1922         {0x00, 0xc8, 0x0f, 0xaa},       {0x00, 0x79, 0x0d, 0xaa},
1923         {0x00, 0xc8, 0x20, 0xaa},       {0x00, 0x79, 0x09, 0xaa},
1924         {0x00, 0xc8, 0x80, 0xaa},       {0x00, 0x79, 0x02, 0xaa},
1925         {0x00, 0xc8, 0xc0, 0xaa},       {0x00, 0x79, 0x03, 0xaa},
1926         {0x00, 0xc8, 0x40, 0xaa},       {0x00, 0x79, 0x05, 0xaa},
1927         {0x00, 0xc8, 0x30, 0xaa},       {0x00, 0x79, 0x26, 0xaa},
1928         {0x00, 0x11, 0x40, 0xaa},       {0x00, 0x3a, 0x04, 0xaa},
1929         {0x00, 0x12, 0x00, 0xaa},       {0x00, 0x40, 0xc0, 0xaa},
1930         {0x00, 0x8c, 0x00, 0xaa},       {0x00, 0x17, 0x14, 0xaa},
1931         {0x00, 0x18, 0x02, 0xaa},       {0x00, 0x32, 0x92, 0xaa},
1932         {0x00, 0x19, 0x02, 0xaa},       {0x00, 0x1a, 0x7a, 0xaa},
1933         {0x00, 0x03, 0x0a, 0xaa},       {0x00, 0x0c, 0x00, 0xaa},
1934         {0x00, 0x3e, 0x00, 0xaa},       {0x00, 0x70, 0x3a, 0xaa},
1935         {0x00, 0x71, 0x35, 0xaa},       {0x00, 0x72, 0x11, 0xaa},
1936         {0x00, 0x73, 0xf0, 0xaa},       {0x00, 0xa2, 0x02, 0xaa},
1937         {0x00, 0xb1, 0x00, 0xaa},       {0x00, 0xb1, 0x0c, 0xaa},
1938         {0x00, 0x1e, 0x37, 0xaa},       /* MVFP */
1939         {0x00, 0xaa, 0x14, 0xaa},
1940         {0x00, 0x24, 0x80, 0xaa},       {0x00, 0x25, 0x74, 0xaa},
1941         {0x00, 0x26, 0xd3, 0xaa},       {0x00, 0x0d, 0x00, 0xaa},
1942         {0x00, 0x14, 0x18, 0xaa},       {0x00, 0x9d, 0x99, 0xaa},
1943         {0x00, 0x9e, 0x7f, 0xaa},       {0x00, 0x64, 0x08, 0xaa},
1944         {0x00, 0x94, 0x07, 0xaa},       {0x00, 0x95, 0x06, 0xaa},
1945         {0x00, 0x66, 0x05, 0xaa},       {0x00, 0x41, 0x08, 0xaa},
1946         {0x00, 0x3f, 0x00, 0xaa},       {0x00, 0x75, 0x07, 0xaa},
1947         {0x00, 0x76, 0xe1, 0xaa},       {0x00, 0x4c, 0x00, 0xaa},
1948         {0x00, 0x77, 0x00, 0xaa},       {0x00, 0x3d, 0xc2, 0xaa},
1949         {0x00, 0x4b, 0x09, 0xaa},       {0x00, 0xc9, 0x60, 0xaa},
1950         {0x00, 0x41, 0x38, 0xaa},       {0xb6, 0x00, 0x00, 0xcc},
1951         {0xb6, 0x03, 0x01, 0xcc},       {0xb6, 0x02, 0x40, 0xcc},
1952         {0xb6, 0x05, 0x00, 0xcc},       {0xb6, 0x04, 0xf0, 0xcc},
1953         {0xb6, 0x12, 0xf8, 0xcc},       {0xb6, 0x13, 0x21, 0xcc},
1954         {0xb6, 0x18, 0x00, 0xcc},       {0xb6, 0x17, 0x96, 0xcc},
1955         {0xb6, 0x16, 0x00, 0xcc},       {0xb6, 0x22, 0x12, 0xcc},
1956         {0xb6, 0x23, 0x0b, 0xcc},       {0xbf, 0xc0, 0x39, 0xcc},
1957         {0xbf, 0xc1, 0x04, 0xcc},       {0xbf, 0xcc, 0x00, 0xcc},
1958         {0xbc, 0x02, 0x18, 0xcc},       {0xbc, 0x03, 0x50, 0xcc},
1959         {0xbc, 0x04, 0x18, 0xcc},       {0xbc, 0x05, 0x00, 0xcc},
1960         {0xbc, 0x06, 0x00, 0xcc},       {0xbc, 0x08, 0x30, 0xcc},
1961         {0xbc, 0x09, 0x40, 0xcc},       {0xbc, 0x0a, 0x10, 0xcc},
1962         {0xbc, 0x0b, 0x00, 0xcc},       {0xbc, 0x0c, 0x00, 0xcc},
1963         {0xb3, 0x5c, 0x01, 0xcc},       {0xb3, 0x01, 0x45, 0xcc},
1964         {0x00, 0x77, 0x05, 0xaa },
1965         {},
1966 };
1967
1968 /* PO1200 - values from usbvm326.inf and ms-win trace */
1969 static const __u8 po1200_gamma[17] = {
1970         0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
1971         0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
1972 };
1973 static const __u8 po1200_matrix[9] = {
1974         0x60, 0xf9, 0xe5, 0xe7, 0x50, 0x05, 0xf3, 0xe6, 0x5e
1975 };
1976 static const __u8 po1200_initVGA_data[][4] = {
1977         {0xb0, 0x03, 0x19, 0xcc},       /* reset? */
1978         {0xb0, 0x03, 0x19, 0xcc},
1979 /*      {0x00, 0x00, 0x33, 0xdd}, */
1980         {0xb0, 0x04, 0x02, 0xcc},
1981         {0xb0, 0x02, 0x02, 0xcc},
1982         {0xb3, 0x5d, 0x00, 0xcc},
1983         {0xb3, 0x01, 0x01, 0xcc},
1984         {0xb3, 0x00, 0x64, 0xcc},
1985         {0xb3, 0x00, 0x65, 0xcc},
1986         {0xb3, 0x05, 0x01, 0xcc},
1987         {0xb3, 0x06, 0x01, 0xcc},
1988         {0xb3, 0x5c, 0x01, 0xcc},
1989         {0xb3, 0x08, 0x01, 0xcc},
1990         {0xb3, 0x09, 0x0c, 0xcc},
1991         {0xb3, 0x00, 0x67, 0xcc},
1992         {0xb3, 0x02, 0xb2, 0xcc},
1993         {0xb3, 0x03, 0x18, 0xcc},
1994         {0xb3, 0x04, 0x15, 0xcc},
1995         {0xb3, 0x20, 0x00, 0xcc},
1996         {0xb3, 0x21, 0x00, 0xcc},
1997         {0xb3, 0x22, 0x02, 0xcc},
1998         {0xb3, 0x23, 0x58, 0xcc},
1999         {0xb3, 0x14, 0x00, 0xcc},
2000         {0xb3, 0x15, 0x00, 0xcc},
2001         {0xb3, 0x16, 0x03, 0xcc},
2002         {0xb3, 0x17, 0x1f, 0xcc},
2003         {0xbc, 0x00, 0x71, 0xcc},
2004         {0xbc, 0x01, 0x01, 0xcc},
2005         {0xb0, 0x54, 0x13, 0xcc},
2006         {0xb3, 0x00, 0x67, 0xcc},
2007         {0xb3, 0x34, 0x01, 0xcc},
2008         {0xb3, 0x35, 0xdc, 0xcc},
2009         {0x00, 0x03, 0x00, 0xaa},
2010         {0x00, 0x12, 0x05, 0xaa},
2011         {0x00, 0x13, 0x02, 0xaa},
2012         {0x00, 0x1e, 0xc6, 0xaa},       /* h/v flip */
2013         {0x00, 0x21, 0x00, 0xaa},
2014         {0x00, 0x25, 0x02, 0xaa},
2015         {0x00, 0x3c, 0x4f, 0xaa},
2016         {0x00, 0x3f, 0xe0, 0xaa},
2017         {0x00, 0x42, 0xff, 0xaa},
2018         {0x00, 0x45, 0x34, 0xaa},
2019         {0x00, 0x55, 0xfe, 0xaa},
2020         {0x00, 0x59, 0xd3, 0xaa},
2021         {0x00, 0x5e, 0x04, 0xaa},
2022         {0x00, 0x61, 0xb8, 0xaa},       /* sharpness */
2023         {0x00, 0x62, 0x02, 0xaa},
2024         {0x00, 0xa7, 0x31, 0xaa},
2025         {0x00, 0xa9, 0x66, 0xaa},
2026         {0x00, 0xb0, 0x00, 0xaa},
2027         {0x00, 0xb1, 0x00, 0xaa},
2028         {0x00, 0xb3, 0x11, 0xaa},
2029         {0x00, 0xb6, 0x26, 0xaa},
2030         {0x00, 0xb7, 0x20, 0xaa},
2031         {0x00, 0xba, 0x04, 0xaa},
2032         {0x00, 0x88, 0x42, 0xaa},
2033         {0x00, 0x89, 0x9a, 0xaa},
2034         {0x00, 0x8a, 0x88, 0xaa},
2035         {0x00, 0x8b, 0x8e, 0xaa},
2036         {0x00, 0x8c, 0x3e, 0xaa},
2037         {0x00, 0x8d, 0x90, 0xaa},
2038         {0x00, 0x8e, 0x87, 0xaa},
2039         {0x00, 0x8f, 0x96, 0xaa},
2040         {0x00, 0x90, 0x3d, 0xaa},
2041         {0x00, 0x64, 0x00, 0xaa},
2042         {0x00, 0x65, 0x10, 0xaa},
2043         {0x00, 0x66, 0x20, 0xaa},
2044         {0x00, 0x67, 0x2b, 0xaa},
2045         {0x00, 0x68, 0x36, 0xaa},
2046         {0x00, 0x69, 0x49, 0xaa},
2047         {0x00, 0x6a, 0x5a, 0xaa},
2048         {0x00, 0x6b, 0x7f, 0xaa},
2049         {0x00, 0x6c, 0x9b, 0xaa},
2050         {0x00, 0x6d, 0xba, 0xaa},
2051         {0x00, 0x6e, 0xd4, 0xaa},
2052         {0x00, 0x6f, 0xea, 0xaa},
2053         {0x00, 0x70, 0x00, 0xaa},
2054         {0x00, 0x71, 0x10, 0xaa},
2055         {0x00, 0x72, 0x20, 0xaa},
2056         {0x00, 0x73, 0x2b, 0xaa},
2057         {0x00, 0x74, 0x36, 0xaa},
2058         {0x00, 0x75, 0x49, 0xaa},
2059         {0x00, 0x76, 0x5a, 0xaa},
2060         {0x00, 0x77, 0x7f, 0xaa},
2061         {0x00, 0x78, 0x9b, 0xaa},
2062         {0x00, 0x79, 0xba, 0xaa},
2063         {0x00, 0x7a, 0xd4, 0xaa},
2064         {0x00, 0x7b, 0xea, 0xaa},
2065         {0x00, 0x7c, 0x00, 0xaa},
2066         {0x00, 0x7d, 0x10, 0xaa},
2067         {0x00, 0x7e, 0x20, 0xaa},
2068         {0x00, 0x7f, 0x2b, 0xaa},
2069         {0x00, 0x80, 0x36, 0xaa},
2070         {0x00, 0x81, 0x49, 0xaa},
2071         {0x00, 0x82, 0x5a, 0xaa},
2072         {0x00, 0x83, 0x7f, 0xaa},
2073         {0x00, 0x84, 0x9b, 0xaa},
2074         {0x00, 0x85, 0xba, 0xaa},
2075         {0x00, 0x86, 0xd4, 0xaa},
2076         {0x00, 0x87, 0xea, 0xaa},
2077         {0x00, 0x57, 0x2a, 0xaa},
2078         {0x00, 0x03, 0x01, 0xaa},
2079         {0x00, 0x04, 0x10, 0xaa},
2080         {0x00, 0x05, 0x10, 0xaa},
2081         {0x00, 0x06, 0x10, 0xaa},
2082         {0x00, 0x07, 0x10, 0xaa},
2083         {0x00, 0x08, 0x13, 0xaa},
2084         {0x00, 0x0a, 0x00, 0xaa},
2085         {0x00, 0x0b, 0x10, 0xaa},
2086         {0x00, 0x0c, 0x20, 0xaa},
2087         {0x00, 0x0d, 0x18, 0xaa},
2088         {0x00, 0x22, 0x01, 0xaa},
2089         {0x00, 0x23, 0x60, 0xaa},
2090         {0x00, 0x25, 0x08, 0xaa},
2091         {0x00, 0x26, 0x82, 0xaa},
2092         {0x00, 0x2e, 0x0f, 0xaa},
2093         {0x00, 0x2f, 0x1e, 0xaa},
2094         {0x00, 0x30, 0x2d, 0xaa},
2095         {0x00, 0x31, 0x3c, 0xaa},
2096         {0x00, 0x32, 0x4b, 0xaa},
2097         {0x00, 0x33, 0x5a, 0xaa},
2098         {0x00, 0x34, 0x69, 0xaa},
2099         {0x00, 0x35, 0x78, 0xaa},
2100         {0x00, 0x36, 0x87, 0xaa},
2101         {0x00, 0x37, 0x96, 0xaa},
2102         {0x00, 0x38, 0xa5, 0xaa},
2103         {0x00, 0x39, 0xb4, 0xaa},
2104         {0x00, 0x3a, 0xc3, 0xaa},
2105         {0x00, 0x3b, 0xd2, 0xaa},
2106         {0x00, 0x3c, 0xe1, 0xaa},
2107         {0x00, 0x3e, 0xff, 0xaa},
2108         {0x00, 0x3f, 0xff, 0xaa},
2109         {0x00, 0x40, 0xff, 0xaa},
2110         {0x00, 0x41, 0xff, 0xaa},
2111         {0x00, 0x42, 0xff, 0xaa},
2112         {0x00, 0x43, 0xff, 0xaa},
2113         {0x00, 0x03, 0x00, 0xaa},
2114         {0x00, 0x03, 0x00, 0xaa},
2115         {0x00, 0x20, 0xc4, 0xaa},
2116         {0x00, 0x13, 0x03, 0xaa},
2117         {0x00, 0x3c, 0x50, 0xaa},
2118         {0x00, 0x61, 0x6a, 0xaa},       /* sharpness? */
2119         {0x00, 0x51, 0x5b, 0xaa},
2120         {0x00, 0x52, 0x91, 0xaa},
2121         {0x00, 0x53, 0x4c, 0xaa},
2122         {0x00, 0x54, 0x50, 0xaa},
2123         {0x00, 0x56, 0x02, 0xaa},
2124         {0xb6, 0x00, 0x00, 0xcc},
2125         {0xb6, 0x03, 0x03, 0xcc},
2126         {0xb6, 0x02, 0x20, 0xcc},
2127         {0xb6, 0x05, 0x02, 0xcc},
2128         {0xb6, 0x04, 0x58, 0xcc},
2129         {0xb6, 0x12, 0xf8, 0xcc},
2130         {0xb6, 0x13, 0x21, 0xcc},
2131         {0xb6, 0x18, 0x03, 0xcc},
2132         {0xb6, 0x17, 0xa9, 0xcc},
2133         {0xb6, 0x16, 0x80, 0xcc},
2134         {0xb6, 0x22, 0x12, 0xcc},
2135         {0xb6, 0x23, 0x0b, 0xcc},
2136         {0xbf, 0xc0, 0x39, 0xcc},
2137         {0xbf, 0xc1, 0x04, 0xcc},
2138         {0xbf, 0xcc, 0x00, 0xcc},
2139         {0xb8, 0x06, 0x20, 0xcc},
2140         {0xb8, 0x07, 0x03, 0xcc},
2141         {0xb8, 0x08, 0x58, 0xcc},
2142         {0xb8, 0x09, 0x02, 0xcc},
2143         {0xb3, 0x01, 0x41, 0xcc},
2144         {0x00, 0x03, 0x00, 0xaa},
2145         {0x00, 0xd9, 0x0f, 0xaa},
2146         {0x00, 0xda, 0xaa, 0xaa},
2147         {0x00, 0xd9, 0x10, 0xaa},
2148         {0x00, 0xda, 0xaa, 0xaa},
2149         {0x00, 0xd9, 0x11, 0xaa},
2150         {0x00, 0xda, 0x00, 0xaa},
2151         {0x00, 0xd9, 0x12, 0xaa},
2152         {0x00, 0xda, 0xff, 0xaa},
2153         {0x00, 0xd9, 0x13, 0xaa},
2154         {0x00, 0xda, 0xff, 0xaa},
2155         {0x00, 0xe8, 0x11, 0xaa},
2156         {0x00, 0xe9, 0x12, 0xaa},
2157         {0x00, 0xea, 0x5c, 0xaa},
2158         {0x00, 0xeb, 0xff, 0xaa},
2159         {0x00, 0xd8, 0x80, 0xaa},
2160         {0x00, 0xe6, 0x02, 0xaa},
2161         {0x00, 0xd6, 0x40, 0xaa},
2162         {0x00, 0xe3, 0x05, 0xaa},
2163         {0x00, 0xe0, 0x40, 0xaa},
2164         {0x00, 0xde, 0x03, 0xaa},
2165         {0x00, 0xdf, 0x03, 0xaa},
2166         {0x00, 0xdb, 0x02, 0xaa},
2167         {0x00, 0xdc, 0x00, 0xaa},
2168         {0x00, 0xdd, 0x03, 0xaa},
2169         {0x00, 0xe1, 0x08, 0xaa},
2170         {0x00, 0xe2, 0x01, 0xaa},
2171         {0x00, 0xd6, 0x40, 0xaa},
2172         {0x00, 0xe4, 0x40, 0xaa},
2173         {0x00, 0xa8, 0x8f, 0xaa},
2174         {0x00, 0xb4, 0x16, 0xaa},
2175         {0xb0, 0x02, 0x06, 0xcc},
2176         {0xb0, 0x18, 0x06, 0xcc},
2177         {0xb0, 0x19, 0x06, 0xcc},
2178         {0xb3, 0x5d, 0x18, 0xcc},
2179         {0xb3, 0x05, 0x00, 0xcc},
2180         {0xb3, 0x06, 0x00, 0xcc},
2181         {0x00, 0xb4, 0x0e, 0xaa},
2182         {0x00, 0xb5, 0x49, 0xaa},
2183         {0x00, 0xb6, 0x1c, 0xaa},
2184         {0x00, 0xb7, 0x96, 0xaa},
2185 /* end of usbvm326.inf - start of ms-win trace */
2186         {0xb6, 0x12, 0xf8, 0xcc},
2187         {0xb6, 0x13, 0x3d, 0xcc},
2188 /*read b306*/
2189         {0x00, 0x03, 0x00, 0xaa},
2190         {0x00, 0x1a, 0x09, 0xaa},
2191         {0x00, 0x1b, 0x8a, 0xaa},
2192 /*read b827*/
2193         {0xb8, 0x27, 0x00, 0xcc},
2194         {0xb8, 0x26, 0x60, 0xcc},
2195         {0xb8, 0x26, 0x60, 0xcc},
2196 /*gamma - to do?*/
2197         {0x00, 0x03, 0x00, 0xaa},
2198         {0x00, 0xae, 0x84, 0xaa},
2199 /*gamma again*/
2200         {0x00, 0x03, 0x00, 0xaa},
2201         {0x00, 0x96, 0xa0, 0xaa},
2202 /*matrix*/
2203         {0x00, 0x03, 0x00, 0xaa},
2204         {0x00, 0x91, 0x35, 0xaa},
2205         {0x00, 0x92, 0x22, 0xaa},
2206 /*gamma*/
2207         {0x00, 0x03, 0x00, 0xaa},
2208         {0x00, 0x95, 0x85, 0xaa},
2209 /*matrix*/
2210         {0x00, 0x03, 0x00, 0xaa},
2211         {0x00, 0x4d, 0x20, 0xaa},
2212         {0xb8, 0x22, 0x40, 0xcc},
2213         {0xb8, 0x23, 0x40, 0xcc},
2214         {0xb8, 0x24, 0x40, 0xcc},
2215         {0xb8, 0x81, 0x09, 0xcc},
2216         {0x00, 0x00, 0x64, 0xdd},
2217         {0x00, 0x03, 0x01, 0xaa},
2218 /*read 46*/
2219         {0x00, 0x46, 0x3c, 0xaa},
2220         {0x00, 0x03, 0x00, 0xaa},
2221         {0x00, 0x16, 0x40, 0xaa},
2222         {0x00, 0x17, 0x40, 0xaa},
2223         {0x00, 0x18, 0x40, 0xaa},
2224         {0x00, 0x19, 0x41, 0xaa},
2225         {0x00, 0x03, 0x01, 0xaa},
2226         {0x00, 0x46, 0x3c, 0xaa},
2227         {0x00, 0x00, 0x18, 0xdd},
2228 /*read bfff*/
2229         {0x00, 0x03, 0x00, 0xaa},
2230         {0x00, 0xb4, 0x1c, 0xaa},
2231         {0x00, 0xb5, 0x92, 0xaa},
2232         {0x00, 0xb6, 0x39, 0xaa},
2233         {0x00, 0xb7, 0x24, 0xaa},
2234 /*write 89 0400 1415*/
2235 };
2236
2237 struct sensor_info {
2238         s8 sensorId;
2239         u8 I2cAdd;
2240         u8 IdAdd;
2241         u16 VpId;
2242         u8 m1;
2243         u8 m2;
2244         u8 op;
2245 };
2246
2247 static const struct sensor_info sensor_info_data[] = {
2248 /*      sensorId,         I2cAdd,       IdAdd,  VpId,  m1,    m2,  op */
2249         {-1,                0x80 | 0x30, 0x0a, 0x0000, 0x25, 0x24, 0x05},
2250         {-1,                0x80 | 0x20, 0x82, 0x0000, 0x24, 0x25, 0x01},
2251 /* (tested in vc032x_probe_sensor) */
2252 /*      {-1,                0x80 | 0x20, 0x83, 0x0000, 0x24, 0x25, 0x01}, */
2253         {SENSOR_PO3130NC,   0x80 | 0x76, 0x00, 0x3130, 0x24, 0x25, 0x01},
2254         {SENSOR_MI1310_SOC, 0x80 | 0x5d, 0x00, 0x143a, 0x24, 0x25, 0x01},
2255 /* (tested in vc032x_probe_sensor) */
2256 /*      {SENSOR_MI0360,     0x80 | 0x5d, 0x00, 0x8243, 0x24, 0x25, 0x01}, */
2257         {SENSOR_HV7131R,    0x80 | 0x11, 0x00, 0x0209, 0x24, 0x25, 0x01},
2258         {-1,                0x80 | 0x21, 0x0a, 0x0000, 0x21, 0x20, 0x05},
2259         {-1,                0x80 | 0x40, 0x00, 0x0000, 0x20, 0x22, 0x05},
2260         {SENSOR_OV7660,     0x80 | 0x21, 0x0a, 0x7660, 0x26, 0x26, 0x05},
2261 /*      {SENSOR_PO3130NC,   0x80 | 0x76, 0x00, 0x0000, 0x24, 0x25, 0x01}, */
2262         {-1,                0x80 | 0x6e, 0x00, 0x0000, 0x24, 0x25, 0x01},
2263 /*      {SENSOR_MI1310_SOC, 0x80 | 0x5d, 0x00, 0x0000, 0x24, 0x25, 0x01}, */
2264 /*      {-1,                0x80 | 0x30, 0x0a, 0x0000, 0x25, 0x24, 0x05}, */
2265         {-1,                0x80 | 0x11, 0x39, 0x0000, 0x24, 0x25, 0x01},
2266         {SENSOR_PO1200,     0x80 | 0x5c, 0x00, 0x1200, 0x67, 0x67, 0x01},
2267         {-1,                0x80 | 0x2d, 0x00, 0x0000, 0x65, 0x67, 0x01},
2268         {-1,                0x80 | 0x6e, 0x00, 0x0000, 0x24, 0x25, 0x01},
2269         {-1,                0x80 | 0x56, 0x01, 0x0000, 0x64, 0x67, 0x01},
2270         {SENSOR_MI1320_SOC, 0x80 | 0x48, 0x00, 0x148c, 0x64, 0x67, 0x01},
2271 /*fixme: previously detected?*/
2272         {SENSOR_MI1320,     0x80 | 0x48, 0x00, 0x148c, 0x64, 0x65, 0x01},
2273 /*fixme: not in the ms-win probe - may be found before?*/
2274         {SENSOR_OV7670,     0x80 | 0x21, 0x0a, 0x7673, 0x66, 0x67, 0x05},
2275 };
2276
2277 /* read 'len' bytes in gspca_dev->usb_buf */
2278 static void reg_r(struct gspca_dev *gspca_dev,
2279                   __u16 req,
2280                   __u16 index,
2281                   __u16 len)
2282 {
2283         usb_control_msg(gspca_dev->dev,
2284                         usb_rcvctrlpipe(gspca_dev->dev, 0),
2285                         req,
2286                         USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
2287                         1,                      /* value */
2288                         index, gspca_dev->usb_buf, len,
2289                         500);
2290 }
2291
2292 static void reg_w(struct usb_device *dev,
2293                             __u16 req,
2294                             __u16 value,
2295                             __u16 index)
2296 {
2297         usb_control_msg(dev,
2298                         usb_sndctrlpipe(dev, 0),
2299                         req,
2300                         USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
2301                         value, index, NULL, 0,
2302                         500);
2303 }
2304
2305 static u16 read_sensor_register(struct gspca_dev *gspca_dev,
2306                                 u16 address)
2307 {
2308         struct usb_device *dev = gspca_dev->dev;
2309         u8 ldata, mdata, hdata;
2310         int retry = 50;
2311
2312         reg_r(gspca_dev, 0xa1, 0xb33f, 1);
2313         if (!(gspca_dev->usb_buf[0] & 0x02)) {
2314                 PDEBUG(D_ERR, "I2c Bus Busy Wait %02x",
2315                         gspca_dev->usb_buf[0]);
2316                 return 0;
2317         }
2318         reg_w(dev, 0xa0, address, 0xb33a);
2319         reg_w(dev, 0xa0, 0x02, 0xb339);
2320
2321         do {
2322                 reg_r(gspca_dev, 0xa1, 0xb33b, 1);
2323                 if (gspca_dev->usb_buf[0] == 0x00)
2324                         break;
2325                 msleep(40);
2326         } while (--retry >= 0);
2327
2328         reg_r(gspca_dev, 0xa1, 0xb33e, 1);
2329         ldata = gspca_dev->usb_buf[0];
2330         reg_r(gspca_dev, 0xa1, 0xb33d, 1);
2331         mdata = gspca_dev->usb_buf[0];
2332         reg_r(gspca_dev, 0xa1, 0xb33c, 1);
2333         hdata = gspca_dev->usb_buf[0];
2334         if (hdata != 0 && mdata != 0 && ldata != 0)
2335                 PDEBUG(D_PROBE, "Read Sensor %02x%02x %02x",
2336                         hdata, mdata, ldata);
2337         reg_r(gspca_dev, 0xa1, 0xb334, 1);
2338         if (gspca_dev->usb_buf[0] == 0x02)
2339                 return (hdata << 8) + mdata;
2340         return hdata;
2341 }
2342
2343 static int vc032x_probe_sensor(struct gspca_dev *gspca_dev)
2344 {
2345         struct usb_device *dev = gspca_dev->dev;
2346         int i;
2347         u16 value;
2348         const struct sensor_info *ptsensor_info;
2349
2350         reg_r(gspca_dev, 0xa1, 0xbfcf, 1);
2351         PDEBUG(D_PROBE, "check sensor header %02x", gspca_dev->usb_buf[0]);
2352         for (i = 0; i < ARRAY_SIZE(sensor_info_data); i++) {
2353                 ptsensor_info = &sensor_info_data[i];
2354                 reg_w(dev, 0xa0, 0x02, 0xb334);
2355                 reg_w(dev, 0xa0, ptsensor_info->m1, 0xb300);
2356                 reg_w(dev, 0xa0, ptsensor_info->m2, 0xb300);
2357                 reg_w(dev, 0xa0, 0x01, 0xb308);
2358                 reg_w(dev, 0xa0, 0x0c, 0xb309);
2359                 reg_w(dev, 0xa0, ptsensor_info->I2cAdd, 0xb335);
2360                 reg_w(dev, 0xa0, ptsensor_info->op, 0xb301);
2361                 value = read_sensor_register(gspca_dev, ptsensor_info->IdAdd);
2362                 if (value == 0 && ptsensor_info->IdAdd == 0x82)
2363                         value = read_sensor_register(gspca_dev, 0x83);
2364                 if (value != 0) {
2365                         PDEBUG(D_ERR|D_PROBE, "Sensor ID %04x (%d)",
2366                                 value, i);
2367                         if (value == ptsensor_info->VpId)
2368                                 return ptsensor_info->sensorId;
2369
2370                         switch (value) {
2371                         case 0x7673:
2372                                 return SENSOR_OV7670;
2373                         case 0x8243:
2374                                 return SENSOR_MI0360;
2375                         }
2376 /*fixme: should return here*/
2377                 }
2378         }
2379         return -1;
2380 }
2381
2382 static void i2c_write(struct gspca_dev *gspca_dev,
2383                         u8 reg, const u8 *val,
2384                         u8 size)                /* 1 or 2 */
2385 {
2386         struct usb_device *dev = gspca_dev->dev;
2387         int retry;
2388
2389         reg_r(gspca_dev, 0xa1, 0xb33f, 1);
2390 /*fixme:should check if (!(gspca_dev->usb_buf[0] & 0x02)) error*/
2391         reg_w(dev, 0xa0, size, 0xb334);
2392         reg_w(dev, 0xa0, reg, 0xb33a);
2393         reg_w(dev, 0xa0, val[0], 0xb336);
2394         if (size > 1)
2395                 reg_w(dev, 0xa0, val[1], 0xb337);
2396         reg_w(dev, 0xa0, 0x01, 0xb339);
2397         retry = 4;
2398         do {
2399                 reg_r(gspca_dev, 0xa1, 0xb33b, 1);
2400                 if (gspca_dev->usb_buf[0] == 0)
2401                         break;
2402                 msleep(20);
2403         } while (--retry > 0);
2404         if (retry <= 0)
2405                 PDEBUG(D_ERR, "i2c_write failed");
2406 }
2407
2408 static void put_tab_to_reg(struct gspca_dev *gspca_dev,
2409                         const __u8 *tab, __u8 tabsize, __u16 addr)
2410 {
2411         int j;
2412         __u16 ad = addr;
2413
2414         for (j = 0; j < tabsize; j++)
2415                 reg_w(gspca_dev->dev, 0xa0, tab[j], ad++);
2416 }
2417
2418 static void usb_exchange(struct gspca_dev *gspca_dev,
2419                         const __u8 data[][4])
2420 {
2421         struct usb_device *dev = gspca_dev->dev;
2422         int i = 0;
2423
2424         for (;;) {
2425                 switch (data[i][3]) {
2426                 default:
2427                         return;
2428                 case 0xcc:                      /* normal write */
2429                         reg_w(dev, 0xa0, data[i][2],
2430                                         (data[i][0]) << 8 | data[i][1]);
2431                         break;
2432                 case 0xaa:                      /* i2c op */
2433                         i2c_write(gspca_dev, data[i][1], &data[i][2], 1);
2434                         break;
2435                 case 0xbb:                      /* i2c op */
2436                         i2c_write(gspca_dev, data[i][0], &data[i][1], 2);
2437                         break;
2438                 case 0xdd:
2439                         msleep(data[i][2] + 10);
2440                         break;
2441                 }
2442                 i++;
2443         }
2444         /*not reached*/
2445 }
2446
2447
2448 /* this function is called at probe time */
2449 static int sd_config(struct gspca_dev *gspca_dev,
2450                         const struct usb_device_id *id)
2451 {
2452         struct sd *sd = (struct sd *) gspca_dev;
2453         struct usb_device *dev = gspca_dev->dev;
2454         struct cam *cam;
2455         int sensor;
2456         static u8 npkt[] = {    /* number of packets per ISOC message */
2457                 64,             /* HV7131R 0 */
2458                 32,             /* MI0360 1 */
2459                 32,             /* MI1310_SOC 2 */
2460                 64,             /* MI1320 3 */
2461                 128,            /* MI1320_SOC 4 */
2462                 32,             /* OV7660 5 */
2463                 64,             /* OV7670 6 */
2464                 128,            /* PO1200 7 */
2465                 128,            /* PO3130NC 8 */
2466         };
2467
2468         cam = &gspca_dev->cam;
2469         sd->bridge = id->driver_info;
2470         sensor = vc032x_probe_sensor(gspca_dev);
2471         switch (sensor) {
2472         case -1:
2473                 PDEBUG(D_PROBE, "Unknown sensor...");
2474                 return -EINVAL;
2475         case SENSOR_HV7131R:
2476                 PDEBUG(D_PROBE, "Find Sensor HV7131R");
2477                 break;
2478         case SENSOR_MI0360:
2479                 PDEBUG(D_PROBE, "Find Sensor MI0360");
2480                 sd->bridge = BRIDGE_VC0323;
2481                 break;
2482         case SENSOR_MI1310_SOC:
2483                 PDEBUG(D_PROBE, "Find Sensor MI1310_SOC");
2484                 break;
2485         case SENSOR_MI1320:
2486                 PDEBUG(D_PROBE, "Find Sensor MI1320");
2487                 break;
2488         case SENSOR_MI1320_SOC:
2489                 PDEBUG(D_PROBE, "Find Sensor MI1320_SOC");
2490                 break;
2491         case SENSOR_OV7660:
2492                 PDEBUG(D_PROBE, "Find Sensor OV7660");
2493                 break;
2494         case SENSOR_OV7670:
2495                 PDEBUG(D_PROBE, "Find Sensor OV7670");
2496                 break;
2497         case SENSOR_PO1200:
2498                 PDEBUG(D_PROBE, "Find Sensor PO1200");
2499                 break;
2500         case SENSOR_PO3130NC:
2501                 PDEBUG(D_PROBE, "Find Sensor PO3130NC");
2502                 break;
2503         }
2504         sd->sensor = sensor;
2505
2506         if (sd->bridge == BRIDGE_VC0321) {
2507                 cam->cam_mode = vc0321_mode;
2508                 cam->nmodes = ARRAY_SIZE(vc0321_mode);
2509         } else {
2510                 switch (sensor) {
2511                 case SENSOR_PO1200:
2512                         cam->cam_mode = svga_mode;
2513                         cam->nmodes = ARRAY_SIZE(svga_mode);
2514                         break;
2515                 case SENSOR_MI1310_SOC:
2516                         cam->cam_mode = vc0323_mode;
2517                         cam->nmodes = ARRAY_SIZE(vc0323_mode);
2518                         break;
2519                 case SENSOR_MI1320_SOC:
2520                         cam->cam_mode = bi_mode;
2521                         cam->nmodes = ARRAY_SIZE(bi_mode);
2522                         cam->input_flags = V4L2_IN_ST_VFLIP |
2523                                            V4L2_IN_ST_HFLIP;
2524                         break;
2525                 default:
2526                         cam->cam_mode = vc0323_mode;
2527                         cam->nmodes = ARRAY_SIZE(vc0323_mode) - 1;
2528                         break;
2529                 }
2530         }
2531         cam->npkt = npkt[sd->sensor];
2532
2533         sd->hflip = HFLIP_DEF;
2534         sd->vflip = VFLIP_DEF;
2535         if (sd->sensor == SENSOR_OV7670) {
2536                 sd->hflip = 1;
2537                 sd->vflip = 1;
2538         }
2539         sd->lightfreq = FREQ_DEF;
2540         if (sd->sensor != SENSOR_OV7670)
2541                 gspca_dev->ctrl_dis = (1 << LIGHTFREQ_IDX);
2542         switch (sd->sensor) {
2543         case SENSOR_OV7660:
2544         case SENSOR_OV7670:
2545         case SENSOR_PO1200:
2546                 break;
2547         default:
2548                 gspca_dev->ctrl_dis = (1 << HFLIP_IDX)
2549                                         | (1 << VFLIP_IDX);
2550                 break;
2551         }
2552
2553         sd->sharpness = SHARPNESS_DEF;
2554
2555         if (sd->bridge == BRIDGE_VC0321) {
2556                 reg_r(gspca_dev, 0x8a, 0, 3);
2557                 reg_w(dev, 0x87, 0x00, 0x0f0f);
2558
2559                 reg_r(gspca_dev, 0x8b, 0, 3);
2560                 reg_w(dev, 0x88, 0x00, 0x0202);
2561         }
2562         return 0;
2563 }
2564
2565 /* this function is called at probe and resume time */
2566 static int sd_init(struct gspca_dev *gspca_dev)
2567 {
2568         return 0;
2569 }
2570
2571 /* for OV7660 and OV7670 only */
2572 static void sethvflip(struct gspca_dev *gspca_dev)
2573 {
2574         struct sd *sd = (struct sd *) gspca_dev;
2575         __u8 data;
2576
2577         switch (sd->sensor) {
2578         case SENSOR_OV7660:
2579                 data = 1;
2580                 break;
2581         case SENSOR_OV7670:
2582                 data = 7;
2583                 break;
2584         case SENSOR_PO1200:
2585                 data = 0;
2586                 i2c_write(gspca_dev, 0x03, &data, 1);
2587                 data = 0x80 * sd->hflip
2588                         | 0x40 * sd->vflip
2589                         | 0x06;
2590                 i2c_write(gspca_dev, 0x1e, &data, 1);
2591                 return;
2592         default:
2593                 return;
2594         }
2595         data |= OV7660_MVFP_MIRROR * sd->hflip
2596                 | OV7660_MVFP_VFLIP * sd->vflip;
2597         i2c_write(gspca_dev, OV7660_REG_MVFP, &data, 1);
2598 }
2599
2600 static void setlightfreq(struct gspca_dev *gspca_dev)
2601 {
2602         struct sd *sd = (struct sd *) gspca_dev;
2603         static const __u8 (*ov7660_freq_tb[3])[4] =
2604                 {ov7660_NoFliker, ov7660_50HZ, ov7660_60HZ};
2605
2606         if (sd->sensor != SENSOR_OV7660)
2607                 return;
2608         usb_exchange(gspca_dev, ov7660_freq_tb[sd->lightfreq]);
2609 }
2610
2611 /* po1200 only */
2612 static void setsharpness(struct gspca_dev *gspca_dev)
2613 {
2614         struct sd *sd = (struct sd *) gspca_dev;
2615         __u8 data;
2616
2617         if (sd->sensor != SENSOR_PO1200)
2618                 return;
2619         data = 0;
2620         i2c_write(gspca_dev, 0x03, &data, 1);
2621         data = 0xb5 + sd->sharpness * 3;
2622         i2c_write(gspca_dev, 0x61, &data, 1);
2623 }
2624
2625 static int sd_start(struct gspca_dev *gspca_dev)
2626 {
2627         struct sd *sd = (struct sd *) gspca_dev;
2628         const __u8 (*init)[4];
2629         const __u8 *GammaT = NULL;
2630         const __u8 *MatrixT = NULL;
2631         int mode;
2632         static const u8 (*mi1320_soc_init[])[4] = {
2633                 mi1320_soc_InitSXGA,
2634                 mi1320_soc_InitVGA,
2635                 mi1320_soc_InitQVGA,
2636         };
2637
2638         /* Assume start use the good resolution from gspca_dev->mode */
2639         if (sd->bridge == BRIDGE_VC0321) {
2640                 reg_w(gspca_dev->dev, 0xa0, 0xff, 0xbfec);
2641                 reg_w(gspca_dev->dev, 0xa0, 0xff, 0xbfed);
2642                 reg_w(gspca_dev->dev, 0xa0, 0xff, 0xbfee);
2643                 reg_w(gspca_dev->dev, 0xa0, 0xff, 0xbfef);
2644                 sd->image_offset = 46;
2645         } else {
2646                 if (gspca_dev->cam.cam_mode[gspca_dev->curr_mode].pixelformat
2647                                 == V4L2_PIX_FMT_JPEG)
2648                         sd->image_offset = 0;
2649                 else
2650                         sd->image_offset = 32;
2651         }
2652
2653         mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
2654         switch (sd->sensor) {
2655         case SENSOR_HV7131R:
2656                 GammaT = hv7131r_gamma;
2657                 MatrixT = hv7131r_matrix;
2658                 if (mode)
2659                         init = hv7131r_initQVGA_data;   /* 320x240 */
2660                 else
2661                         init = hv7131r_initVGA_data;    /* 640x480 */
2662                 break;
2663         case SENSOR_OV7660:
2664                 GammaT = ov7660_gamma;
2665                 MatrixT = ov7660_matrix;
2666                 if (mode)
2667                         init = ov7660_initQVGA_data;    /* 320x240 */
2668                 else
2669                         init = ov7660_initVGA_data;     /* 640x480 */
2670                 break;
2671         case SENSOR_OV7670:
2672                 /*GammaT = ov7660_gamma; */
2673                 /*MatrixT = ov7660_matrix; */
2674                 if (mode)
2675                         init = ov7670_initQVGA_JPG;     /* 320x240 */
2676                 else
2677                         init = ov7670_initVGA_JPG;      /* 640x480 */
2678                 break;
2679         case SENSOR_MI0360:
2680                 GammaT = mi1320_gamma;
2681                 MatrixT = mi0360_matrix;
2682                 if (mode)
2683                         init = mi0360_initQVGA_JPG;     /* 320x240 */
2684                 else
2685                         init = mi0360_initVGA_JPG;      /* 640x480 */
2686                 break;
2687         case SENSOR_MI1310_SOC:
2688                 GammaT = mi1320_gamma;
2689                 MatrixT = mi1320_matrix;
2690                 switch (mode) {
2691                 case 1:
2692                         init = mi1310_socinitQVGA_JPG;  /* 320x240 */
2693                         break;
2694                 case 0:
2695                         init = mi1310_socinitVGA_JPG;   /* 640x480 */
2696                         break;
2697                 default:
2698                         init = mi1310_soc_InitSXGA_JPG; /* 1280x1024 */
2699                         break;
2700                 }
2701                 break;
2702         case SENSOR_MI1320:
2703                 GammaT = mi1320_gamma;
2704                 MatrixT = mi1320_matrix;
2705                 if (mode)
2706                         init = mi1320_initQVGA_data;    /* 320x240 */
2707                 else
2708                         init = mi1320_initVGA_data;     /* 640x480 */
2709                 break;
2710         case SENSOR_MI1320_SOC:
2711                 GammaT = mi1320_gamma;
2712                 MatrixT = mi1320_matrix;
2713                 init = mi1320_soc_init[mode];
2714                 break;
2715         case SENSOR_PO3130NC:
2716                 GammaT = po3130_gamma;
2717                 MatrixT = po3130_matrix;
2718                 if (mode)
2719                         init = po3130_initQVGA_data;    /* 320x240 */
2720                 else
2721                         init = po3130_initVGA_data;     /* 640x480 */
2722                 usb_exchange(gspca_dev, init);
2723                 init = po3130_rundata;
2724                 break;
2725         default:
2726 /*      case SENSOR_PO1200: */
2727                 GammaT = po1200_gamma;
2728                 MatrixT = po1200_matrix;
2729                 init = po1200_initVGA_data;
2730                 break;
2731         }
2732         usb_exchange(gspca_dev, init);
2733         if (GammaT && MatrixT) {
2734                 put_tab_to_reg(gspca_dev, GammaT, 17, 0xb84a);
2735                 put_tab_to_reg(gspca_dev, GammaT, 17, 0xb85b);
2736                 put_tab_to_reg(gspca_dev, GammaT, 17, 0xb86c);
2737                 put_tab_to_reg(gspca_dev, MatrixT, 9, 0xb82c);
2738
2739                 /* set the led on 0x0892 0x0896 */
2740                 if (sd->sensor != SENSOR_PO1200) {
2741                         reg_w(gspca_dev->dev, 0x89, 0xffff, 0xfdff);
2742                         msleep(100);
2743                         sethvflip(gspca_dev);
2744                         setlightfreq(gspca_dev);
2745                 } else {
2746                         setsharpness(gspca_dev);
2747                         sethvflip(gspca_dev);
2748                         reg_w(gspca_dev->dev, 0x89, 0x0400, 0x1415);
2749                 }
2750         }
2751         return 0;
2752 }
2753
2754 static void sd_stopN(struct gspca_dev *gspca_dev)
2755 {
2756         struct usb_device *dev = gspca_dev->dev;
2757
2758         reg_w(dev, 0x89, 0xffff, 0xffff);
2759         reg_w(dev, 0xa0, 0x01, 0xb301);
2760         reg_w(dev, 0xa0, 0x09, 0xb003);
2761 }
2762
2763 /* called on streamoff with alt 0 and on disconnect */
2764 static void sd_stop0(struct gspca_dev *gspca_dev)
2765 {
2766         struct usb_device *dev = gspca_dev->dev;
2767
2768         if (!gspca_dev->present)
2769                 return;
2770         reg_w(dev, 0x89, 0xffff, 0xffff);
2771 }
2772
2773 static void sd_pkt_scan(struct gspca_dev *gspca_dev,
2774                         struct gspca_frame *frame,      /* target */
2775                         __u8 *data,                     /* isoc packet */
2776                         int len)                        /* iso pkt length */
2777 {
2778         struct sd *sd = (struct sd *) gspca_dev;
2779
2780         if (data[0] == 0xff && data[1] == 0xd8) {
2781                 PDEBUG(D_PACK,
2782                         "vc032x header packet found len %d", len);
2783                 frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame,
2784                                                 data, 0);
2785                 data += sd->image_offset;
2786                 len -= sd->image_offset;
2787                 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
2788                                 data, len);
2789                 return;
2790         }
2791
2792         /* The vc0321 sends some additional data after sending the complete
2793          * frame, we ignore this. */
2794         if (sd->bridge == BRIDGE_VC0321
2795             && len > frame->v4l2_buf.length - (frame->data_end - frame->data))
2796                 len = frame->v4l2_buf.length - (frame->data_end - frame->data);
2797         gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len);
2798 }
2799
2800 static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val)
2801 {
2802         struct sd *sd = (struct sd *) gspca_dev;
2803
2804         sd->hflip = val;
2805         if (gspca_dev->streaming)
2806                 sethvflip(gspca_dev);
2807         return 0;
2808 }
2809
2810 static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val)
2811 {
2812         struct sd *sd = (struct sd *) gspca_dev;
2813
2814         *val = sd->hflip;
2815         return 0;
2816 }
2817
2818 static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val)
2819 {
2820         struct sd *sd = (struct sd *) gspca_dev;
2821
2822         sd->vflip = val;
2823         if (gspca_dev->streaming)
2824                 sethvflip(gspca_dev);
2825         return 0;
2826 }
2827
2828 static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val)
2829 {
2830         struct sd *sd = (struct sd *) gspca_dev;
2831
2832         *val = sd->vflip;
2833         return 0;
2834 }
2835
2836 static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val)
2837 {
2838         struct sd *sd = (struct sd *) gspca_dev;
2839
2840         sd->lightfreq = val;
2841         if (gspca_dev->streaming)
2842                 setlightfreq(gspca_dev);
2843         return 0;
2844 }
2845
2846 static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val)
2847 {
2848         struct sd *sd = (struct sd *) gspca_dev;
2849
2850         *val = sd->lightfreq;
2851         return 0;
2852 }
2853
2854 static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val)
2855 {
2856         struct sd *sd = (struct sd *) gspca_dev;
2857
2858         sd->sharpness = val;
2859         if (gspca_dev->streaming)
2860                 setsharpness(gspca_dev);
2861         return 0;
2862 }
2863
2864 static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val)
2865 {
2866         struct sd *sd = (struct sd *) gspca_dev;
2867
2868         *val = sd->sharpness;
2869         return 0;
2870 }
2871
2872 static int sd_querymenu(struct gspca_dev *gspca_dev,
2873                         struct v4l2_querymenu *menu)
2874 {
2875         switch (menu->id) {
2876         case V4L2_CID_POWER_LINE_FREQUENCY:
2877                 switch (menu->index) {
2878                 case 0:         /* V4L2_CID_POWER_LINE_FREQUENCY_DISABLED */
2879                         strcpy((char *) menu->name, "NoFliker");
2880                         return 0;
2881                 case 1:         /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */
2882                         strcpy((char *) menu->name, "50 Hz");
2883                         return 0;
2884                 default:
2885 /*              case 2:          * V4L2_CID_POWER_LINE_FREQUENCY_60HZ */
2886                         strcpy((char *) menu->name, "60 Hz");
2887                         return 0;
2888                 }
2889                 break;
2890         }
2891         return -EINVAL;
2892 }
2893
2894 /* sub-driver description */
2895 static const struct sd_desc sd_desc = {
2896         .name = MODULE_NAME,
2897         .ctrls = sd_ctrls,
2898         .nctrls = ARRAY_SIZE(sd_ctrls),
2899         .config = sd_config,
2900         .init = sd_init,
2901         .start = sd_start,
2902         .stopN = sd_stopN,
2903         .stop0 = sd_stop0,
2904         .pkt_scan = sd_pkt_scan,
2905         .querymenu = sd_querymenu,
2906 };
2907
2908 /* -- module initialisation -- */
2909 static const __devinitdata struct usb_device_id device_table[] = {
2910         {USB_DEVICE(0x041e, 0x405b), .driver_info = BRIDGE_VC0323},
2911         {USB_DEVICE(0x046d, 0x0892), .driver_info = BRIDGE_VC0321},
2912         {USB_DEVICE(0x046d, 0x0896), .driver_info = BRIDGE_VC0321},
2913         {USB_DEVICE(0x046d, 0x0897), .driver_info = BRIDGE_VC0321},
2914         {USB_DEVICE(0x0ac8, 0x0321), .driver_info = BRIDGE_VC0321},
2915         {USB_DEVICE(0x0ac8, 0x0323), .driver_info = BRIDGE_VC0323},
2916         {USB_DEVICE(0x0ac8, 0x0328), .driver_info = BRIDGE_VC0321},
2917         {USB_DEVICE(0x0ac8, 0xc001), .driver_info = BRIDGE_VC0321},
2918         {USB_DEVICE(0x0ac8, 0xc002), .driver_info = BRIDGE_VC0321},
2919         {USB_DEVICE(0x15b8, 0x6001), .driver_info = BRIDGE_VC0323},
2920         {USB_DEVICE(0x15b8, 0x6002), .driver_info = BRIDGE_VC0323},
2921         {USB_DEVICE(0x17ef, 0x4802), .driver_info = BRIDGE_VC0323},
2922         {}
2923 };
2924 MODULE_DEVICE_TABLE(usb, device_table);
2925
2926 /* -- device connect -- */
2927 static int sd_probe(struct usb_interface *intf,
2928                         const struct usb_device_id *id)
2929 {
2930         return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
2931                                 THIS_MODULE);
2932 }
2933
2934 static struct usb_driver sd_driver = {
2935         .name = MODULE_NAME,
2936         .id_table = device_table,
2937         .probe = sd_probe,
2938         .disconnect = gspca_disconnect,
2939 #ifdef CONFIG_PM
2940         .suspend = gspca_suspend,
2941         .resume = gspca_resume,
2942 #endif
2943 };
2944
2945 /* -- module insert / remove -- */
2946 static int __init sd_mod_init(void)
2947 {
2948         int ret;
2949
2950         ret = usb_register(&sd_driver);
2951         if (ret < 0)
2952                 return ret;
2953         PDEBUG(D_PROBE, "registered");
2954         return 0;
2955 }
2956 static void __exit sd_mod_exit(void)
2957 {
2958         usb_deregister(&sd_driver);
2959         PDEBUG(D_PROBE, "deregistered");
2960 }
2961
2962 module_init(sd_mod_init);
2963 module_exit(sd_mod_exit);