9ac66c9b558b8685168c58b15c5473e61b3b14ea
[linux-2.6.git] / 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
39         char qindex;
40         char bridge;
41 #define BRIDGE_VC0321 0
42 #define BRIDGE_VC0323 1
43         char sensor;
44 #define SENSOR_HV7131R 0
45 #define SENSOR_MI0360 1
46 #define SENSOR_MI1320 2
47 #define SENSOR_MI1310_SOC 3
48 #define SENSOR_OV7660 4
49 #define SENSOR_OV7670 5
50 #define SENSOR_PO3130NC 6
51 };
52
53 /* V4L2 controls supported by the driver */
54 static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val);
55 static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val);
56 static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val);
57 static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val);
58 static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val);
59 static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val);
60
61 static struct ctrl sd_ctrls[] = {
62 /* next 2 controls work with ov7660 and ov7670 only */
63 #define HFLIP_IDX 0
64         {
65             {
66                 .id      = V4L2_CID_HFLIP,
67                 .type    = V4L2_CTRL_TYPE_BOOLEAN,
68                 .name    = "Mirror",
69                 .minimum = 0,
70                 .maximum = 1,
71                 .step    = 1,
72 #define HFLIP_DEF 0
73                 .default_value = HFLIP_DEF,
74             },
75             .set = sd_sethflip,
76             .get = sd_gethflip,
77         },
78 #define VFLIP_IDX 1
79         {
80             {
81                 .id      = V4L2_CID_VFLIP,
82                 .type    = V4L2_CTRL_TYPE_BOOLEAN,
83                 .name    = "Vflip",
84                 .minimum = 0,
85                 .maximum = 1,
86                 .step    = 1,
87 #define VFLIP_DEF 0
88                 .default_value = VFLIP_DEF,
89             },
90             .set = sd_setvflip,
91             .get = sd_getvflip,
92         },
93 #define LIGHTFREQ_IDX 2
94         {
95             {
96                 .id      = V4L2_CID_POWER_LINE_FREQUENCY,
97                 .type    = V4L2_CTRL_TYPE_MENU,
98                 .name    = "Light frequency filter",
99                 .minimum = 0,
100                 .maximum = 2,   /* 0: No, 1: 50Hz, 2:60Hz */
101                 .step    = 1,
102 #define FREQ_DEF 1
103                 .default_value = FREQ_DEF,
104             },
105             .set = sd_setfreq,
106             .get = sd_getfreq,
107         },
108 };
109
110 static struct v4l2_pix_format vc0321_mode[] = {
111         {320, 240, V4L2_PIX_FMT_YVYU, V4L2_FIELD_NONE,
112                 .bytesperline = 320,
113                 .sizeimage = 320 * 240 * 2,
114                 .colorspace = V4L2_COLORSPACE_SRGB,
115                 .priv = 1},
116         {640, 480, V4L2_PIX_FMT_YVYU, V4L2_FIELD_NONE,
117                 .bytesperline = 640,
118                 .sizeimage = 640 * 480 * 2,
119                 .colorspace = V4L2_COLORSPACE_SRGB,
120                 .priv = 0},
121 };
122 static struct v4l2_pix_format vc0323_mode[] = {
123         {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
124                 .bytesperline = 320,
125                 .sizeimage = 320 * 240 * 3 / 8 + 590,
126                 .colorspace = V4L2_COLORSPACE_JPEG,
127                 .priv = 1},
128         {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
129                 .bytesperline = 640,
130                 .sizeimage = 640 * 480 * 3 / 8 + 590,
131                 .colorspace = V4L2_COLORSPACE_JPEG,
132                 .priv = 0},
133 };
134
135 /* OV7660/7670 registers */
136 #define OV7660_REG_MVFP 0x1e
137 #define OV7660_MVFP_MIRROR      0x20
138 #define OV7660_MVFP_VFLIP       0x10
139
140 static const __u8 mi0360_matrix[9] = {
141         0x50, 0xf8, 0xf8, 0xf5, 0x50, 0xfb, 0xff, 0xf1, 0x50
142 };
143
144 static const __u8 mi0360_initVGA_JPG[][4] = {
145         {0xb0, 0x03, 0x19, 0xcc},
146         {0xb0, 0x04, 0x02, 0xcc},
147         {0xb3, 0x00, 0x24, 0xcc},
148         {0xb3, 0x00, 0x25, 0xcc},
149         {0xb3, 0x08, 0x01, 0xcc},
150         {0xb3, 0x09, 0x0c, 0xcc},
151         {0xb3, 0x05, 0x01, 0xcc},
152         {0xb3, 0x06, 0x03, 0xcc},
153         {0xb3, 0x03, 0x0a, 0xcc},
154         {0xb3, 0x20, 0x00, 0xcc},
155         {0xb3, 0x21, 0x00, 0xcc},
156         {0xb3, 0x22, 0x01, 0xcc},
157         {0xb3, 0x23, 0xe0, 0xcc},
158         {0xb3, 0x04, 0x05, 0xcc},
159         {0xb3, 0x14, 0x00, 0xcc},
160         {0xb3, 0x15, 0x00, 0xcc},
161         {0xb3, 0x16, 0x02, 0xcc},
162         {0xb3, 0x17, 0x7f, 0xcc},
163         {0xb3, 0x35, 0xdd, 0xcc},
164         {0xb3, 0x34, 0x02, 0xcc},
165         {0xb3, 0x00, 0x25, 0xcc},
166         {0xbc, 0x00, 0x71, 0xcc},
167         {0xb8, 0x00, 0x13, 0xcc},
168         {0xb8, 0x27, 0x20, 0xcc},
169         {0xb8, 0x2c, 0x50, 0xcc},
170         {0xb8, 0x2d, 0xf8, 0xcc},
171         {0xb8, 0x2e, 0xf8, 0xcc},
172         {0xb8, 0x2f, 0xf8, 0xcc},
173         {0xb8, 0x30, 0x50, 0xcc},
174         {0xb8, 0x31, 0xf8, 0xcc},
175         {0xb8, 0x32, 0xf8, 0xcc},
176         {0xb8, 0x33, 0xf8, 0xcc},
177         {0xb8, 0x34, 0x50, 0xcc},
178         {0xb8, 0x35, 0x00, 0xcc},
179         {0xb8, 0x36, 0x00, 0xcc},
180         {0xb8, 0x37, 0x00, 0xcc},
181         {0xb8, 0x01, 0x79, 0xcc},
182         {0xb8, 0x08, 0xe0, 0xcc},
183         {0xb3, 0x01, 0x41, 0xcc},
184         {0xb8, 0x01, 0x79, 0xcc},
185         {0xb8, 0x14, 0x18, 0xcc},
186         {0xb8, 0xb2, 0x0a, 0xcc},
187         {0xb8, 0xb4, 0x0a, 0xcc},
188         {0xb8, 0xb5, 0x0a, 0xcc},
189         {0xb8, 0xfe, 0x00, 0xcc},
190         {0xb8, 0xff, 0x28, 0xcc},
191         {0xb9, 0x00, 0x28, 0xcc},
192         {0xb9, 0x01, 0x28, 0xcc},
193         {0xb9, 0x02, 0x28, 0xcc},
194         {0xb9, 0x03, 0x00, 0xcc},
195         {0xb9, 0x04, 0x00, 0xcc},
196         {0xb9, 0x05, 0x3c, 0xcc},
197         {0xb9, 0x06, 0x3c, 0xcc},
198         {0xb9, 0x07, 0x3c, 0xcc},
199         {0xb9, 0x08, 0x3c, 0xcc},
200         {0xb8, 0x8e, 0x00, 0xcc},
201         {0xb8, 0x8f, 0xff, 0xcc},
202         {0xb8, 0x81, 0x09, 0xcc},
203         {0x31, 0x00, 0x00, 0xbb},
204         {0x09, 0x01, 0xc7, 0xbb},
205         {0x34, 0x01, 0x00, 0xbb},
206         {0x2b, 0x00, 0x28, 0xbb},
207         {0x2c, 0x00, 0x30, 0xbb},
208         {0x2d, 0x00, 0x30, 0xbb},
209         {0x2e, 0x00, 0x28, 0xbb},
210         {0x62, 0x04, 0x11, 0xbb},
211         {0x03, 0x01, 0xe0, 0xbb},
212         {0x2c, 0x00, 0x2c, 0xbb},
213         {0x20, 0xd0, 0x00, 0xbb},
214         {0x01, 0x00, 0x08, 0xbb},
215         {0x06, 0x00, 0x10, 0xbb},
216         {0x05, 0x00, 0x20, 0xbb},
217         {0x20, 0x00, 0x00, 0xbb},
218         {0xb6, 0x00, 0x00, 0xcc},
219         {0xb6, 0x03, 0x02, 0xcc},
220         {0xb6, 0x02, 0x80, 0xcc},
221         {0xb6, 0x05, 0x01, 0xcc},
222         {0xb6, 0x04, 0xe0, 0xcc},
223         {0xb6, 0x12, 0x78, 0xcc},
224         {0xb6, 0x18, 0x02, 0xcc},
225         {0xb6, 0x17, 0x58, 0xcc},
226         {0xb6, 0x16, 0x00, 0xcc},
227         {0xb6, 0x22, 0x12, 0xcc},
228         {0xb6, 0x23, 0x0b, 0xcc},
229         {0xb3, 0x02, 0x02, 0xcc},
230         {0xbf, 0xc0, 0x39, 0xcc},
231         {0xbf, 0xc1, 0x04, 0xcc},
232         {0xbf, 0xcc, 0x10, 0xcc},
233         {0xb9, 0x12, 0x00, 0xcc},
234         {0xb9, 0x13, 0x0a, 0xcc},
235         {0xb9, 0x14, 0x0a, 0xcc},
236         {0xb9, 0x15, 0x0a, 0xcc},
237         {0xb9, 0x16, 0x0a, 0xcc},
238         {0xb9, 0x18, 0x00, 0xcc},
239         {0xb9, 0x19, 0x0f, 0xcc},
240         {0xb9, 0x1a, 0x0f, 0xcc},
241         {0xb9, 0x1b, 0x0f, 0xcc},
242         {0xb9, 0x1c, 0x0f, 0xcc},
243         {0xb8, 0x8e, 0x00, 0xcc},
244         {0xb8, 0x8f, 0xff, 0xcc},
245         {0xb6, 0x12, 0xf8, 0xcc},
246         {0xb8, 0x0c, 0x20, 0xcc},
247         {0xb8, 0x0d, 0x70, 0xcc},
248         {0xb6, 0x13, 0x13, 0xcc},
249         {0x35, 0x00, 0x60, 0xbb},
250         {0xb3, 0x5c, 0x01, 0xcc},
251         {}
252 };
253 static const __u8 mi0360_initQVGA_JPG[][4] = {
254         {0xb0, 0x03, 0x19, 0xcc},
255         {0xb0, 0x04, 0x02, 0xcc},
256         {0xb3, 0x00, 0x24, 0xcc},
257         {0xb3, 0x00, 0x25, 0xcc},
258         {0xb3, 0x08, 0x01, 0xcc},
259         {0xb3, 0x09, 0x0c, 0xcc},
260         {0xb3, 0x05, 0x01, 0xcc},
261         {0xb3, 0x06, 0x03, 0xcc},
262         {0xb3, 0x03, 0x0a, 0xcc},
263         {0xb3, 0x20, 0x00, 0xcc},
264         {0xb3, 0x21, 0x00, 0xcc},
265         {0xb3, 0x22, 0x01, 0xcc},
266         {0xb3, 0x23, 0xe0, 0xcc},
267         {0xb3, 0x04, 0x05, 0xcc},
268         {0xb3, 0x14, 0x00, 0xcc},
269         {0xb3, 0x15, 0x00, 0xcc},
270         {0xb3, 0x16, 0x02, 0xcc},
271         {0xb3, 0x17, 0x7f, 0xcc},
272         {0xb3, 0x35, 0xdd, 0xcc},
273         {0xb3, 0x34, 0x02, 0xcc},
274         {0xb3, 0x00, 0x25, 0xcc},
275         {0xbc, 0x00, 0xd1, 0xcc},
276         {0xb8, 0x00, 0x13, 0xcc},
277         {0xb8, 0x27, 0x20, 0xcc},
278         {0xb8, 0x2c, 0x50, 0xcc},
279         {0xb8, 0x2d, 0xf8, 0xcc},
280         {0xb8, 0x2e, 0xf8, 0xcc},
281         {0xb8, 0x2f, 0xf8, 0xcc},
282         {0xb8, 0x30, 0x50, 0xcc},
283         {0xb8, 0x31, 0xf8, 0xcc},
284         {0xb8, 0x32, 0xf8, 0xcc},
285         {0xb8, 0x33, 0xf8, 0xcc},
286         {0xb8, 0x34, 0x50, 0xcc},
287         {0xb8, 0x35, 0x00, 0xcc},
288         {0xb8, 0x36, 0x00, 0xcc},
289         {0xb8, 0x37, 0x00, 0xcc},
290         {0xb8, 0x01, 0x79, 0xcc},
291         {0xb8, 0x08, 0xe0, 0xcc},
292         {0xb3, 0x01, 0x41, 0xcc},
293         {0xb8, 0x01, 0x79, 0xcc},
294         {0xb8, 0x14, 0x18, 0xcc},
295         {0xb8, 0xb2, 0x0a, 0xcc},
296         {0xb8, 0xb4, 0x0a, 0xcc},
297         {0xb8, 0xb5, 0x0a, 0xcc},
298         {0xb8, 0xfe, 0x00, 0xcc},
299         {0xb8, 0xff, 0x28, 0xcc},
300         {0xb9, 0x00, 0x28, 0xcc},
301         {0xb9, 0x01, 0x28, 0xcc},
302         {0xb9, 0x02, 0x28, 0xcc},
303         {0xb9, 0x03, 0x00, 0xcc},
304         {0xb9, 0x04, 0x00, 0xcc},
305         {0xb9, 0x05, 0x3c, 0xcc},
306         {0xb9, 0x06, 0x3c, 0xcc},
307         {0xb9, 0x07, 0x3c, 0xcc},
308         {0xb9, 0x08, 0x3c, 0xcc},
309         {0xb8, 0x8e, 0x00, 0xcc},
310         {0xb8, 0x8f, 0xff, 0xcc},
311         {0xb8, 0x81, 0x09, 0xcc},
312         {0x31, 0x00, 0x00, 0xbb},
313         {0x09, 0x01, 0xc7, 0xbb},
314         {0x34, 0x01, 0x00, 0xbb},
315         {0x2b, 0x00, 0x28, 0xbb},
316         {0x2c, 0x00, 0x30, 0xbb},
317         {0x2d, 0x00, 0x30, 0xbb},
318         {0x2e, 0x00, 0x28, 0xbb},
319         {0x62, 0x04, 0x11, 0xbb},
320         {0x03, 0x01, 0xe0, 0xbb},
321         {0x2c, 0x00, 0x2c, 0xbb},
322         {0x20, 0xd0, 0x00, 0xbb},
323         {0x01, 0x00, 0x08, 0xbb},
324         {0x06, 0x00, 0x10, 0xbb},
325         {0x05, 0x00, 0x20, 0xbb},
326         {0x20, 0x00, 0x00, 0xbb},
327         {0xb6, 0x00, 0x00, 0xcc},
328         {0xb6, 0x03, 0x01, 0xcc},
329         {0xb6, 0x02, 0x40, 0xcc},
330         {0xb6, 0x05, 0x00, 0xcc},
331         {0xb6, 0x04, 0xf0, 0xcc},
332         {0xb6, 0x12, 0x78, 0xcc},
333         {0xb6, 0x18, 0x00, 0xcc},
334         {0xb6, 0x17, 0x96, 0xcc},
335         {0xb6, 0x16, 0x00, 0xcc},
336         {0xb6, 0x22, 0x12, 0xcc},
337         {0xb6, 0x23, 0x0b, 0xcc},
338         {0xb3, 0x02, 0x02, 0xcc},
339         {0xbf, 0xc0, 0x39, 0xcc},
340         {0xbf, 0xc1, 0x04, 0xcc},
341         {0xbf, 0xcc, 0x10, 0xcc},
342         {0xb9, 0x12, 0x00, 0xcc},
343         {0xb9, 0x13, 0x0a, 0xcc},
344         {0xb9, 0x14, 0x0a, 0xcc},
345         {0xb9, 0x15, 0x0a, 0xcc},
346         {0xb9, 0x16, 0x0a, 0xcc},
347         {0xb9, 0x18, 0x00, 0xcc},
348         {0xb9, 0x19, 0x0f, 0xcc},
349         {0xb9, 0x1a, 0x0f, 0xcc},
350         {0xb9, 0x1b, 0x0f, 0xcc},
351         {0xb9, 0x1c, 0x0f, 0xcc},
352         {0xb8, 0x8e, 0x00, 0xcc},
353         {0xb8, 0x8f, 0xff, 0xcc},
354         {0xb6, 0x12, 0xf8, 0xcc},
355         {0xb6, 0x13, 0x13, 0xcc},
356         {0xbc, 0x02, 0x18, 0xcc},
357         {0xbc, 0x03, 0x50, 0xcc},
358         {0xbc, 0x04, 0x18, 0xcc},
359         {0xbc, 0x05, 0x00, 0xcc},
360         {0xbc, 0x06, 0x00, 0xcc},
361         {0xbc, 0x08, 0x30, 0xcc},
362         {0xbc, 0x09, 0x40, 0xcc},
363         {0xbc, 0x0a, 0x10, 0xcc},
364         {0xb8, 0x0c, 0x20, 0xcc},
365         {0xb8, 0x0d, 0x70, 0xcc},
366         {0xbc, 0x0b, 0x00, 0xcc},
367         {0xbc, 0x0c, 0x00, 0xcc},
368         {0x35, 0x00, 0xef, 0xbb},
369         {0xb3, 0x5c, 0x01, 0xcc},
370         {}
371 };
372
373 static const __u8 mi1310_socinitVGA_JPG[][4] = {
374         {0xb0, 0x03, 0x19, 0xcc},
375         {0xb0, 0x04, 0x02, 0xcc},
376         {0xb3, 0x00, 0x64, 0xcc},
377         {0xb3, 0x00, 0x65, 0xcc},
378         {0xb3, 0x05, 0x00, 0xcc},
379         {0xb3, 0x06, 0x00, 0xcc},
380         {0xb3, 0x08, 0x01, 0xcc},
381         {0xb3, 0x09, 0x0c, 0xcc},
382         {0xb3, 0x34, 0x02, 0xcc},
383         {0xb3, 0x35, 0xdd, 0xcc},
384         {0xb3, 0x02, 0x00, 0xcc},
385         {0xb3, 0x03, 0x0a, 0xcc},
386         {0xb3, 0x04, 0x05, 0xcc},
387         {0xb3, 0x20, 0x00, 0xcc},
388         {0xb3, 0x21, 0x00, 0xcc},
389         {0xb3, 0x22, 0x03, 0xcc},
390         {0xb3, 0x23, 0xc0, 0xcc},
391         {0xb3, 0x14, 0x00, 0xcc},
392         {0xb3, 0x15, 0x00, 0xcc},
393         {0xb3, 0x16, 0x04, 0xcc},
394         {0xb3, 0x17, 0xff, 0xcc},
395         {0xb3, 0x00, 0x65, 0xcc},
396         {0xb8, 0x00, 0x00, 0xcc},
397         {0xbc, 0x00, 0xd0, 0xcc},
398         {0xbc, 0x01, 0x01, 0xcc},
399         {0xf0, 0x00, 0x02, 0xbb},
400         {0xc8, 0x9f, 0x0b, 0xbb},
401         {0x5b, 0x00, 0x01, 0xbb},
402         {0x2f, 0xde, 0x20, 0xbb},
403         {0xf0, 0x00, 0x00, 0xbb},
404         {0x20, 0x03, 0x02, 0xbb},
405         {0xf0, 0x00, 0x01, 0xbb},
406         {0x05, 0x00, 0x07, 0xbb},
407         {0x34, 0x00, 0x00, 0xbb},
408         {0x35, 0xff, 0x00, 0xbb},
409         {0xdc, 0x07, 0x02, 0xbb},
410         {0xdd, 0x3c, 0x18, 0xbb},
411         {0xde, 0x92, 0x6d, 0xbb},
412         {0xdf, 0xcd, 0xb1, 0xbb},
413         {0xe0, 0xff, 0xe7, 0xbb},
414         {0x06, 0xf0, 0x0d, 0xbb},
415         {0x06, 0x70, 0x0e, 0xbb},
416         {0x4c, 0x00, 0x01, 0xbb},
417         {0x4d, 0x00, 0x01, 0xbb},
418         {0xf0, 0x00, 0x02, 0xbb},
419         {0x2e, 0x0c, 0x55, 0xbb},
420         {0x21, 0xb6, 0x6e, 0xbb},
421         {0x36, 0x30, 0x10, 0xbb},
422         {0x37, 0x00, 0xc1, 0xbb},
423         {0xf0, 0x00, 0x00, 0xbb},
424         {0x07, 0x00, 0x84, 0xbb},
425         {0x08, 0x02, 0x4a, 0xbb},
426         {0x05, 0x01, 0x10, 0xbb},
427         {0x06, 0x00, 0x39, 0xbb},
428         {0xf0, 0x00, 0x02, 0xbb},
429         {0x58, 0x02, 0x67, 0xbb},
430         {0x57, 0x02, 0x00, 0xbb},
431         {0x5a, 0x02, 0x67, 0xbb},
432         {0x59, 0x02, 0x00, 0xbb},
433         {0x5c, 0x12, 0x0d, 0xbb},
434         {0x5d, 0x16, 0x11, 0xbb},
435         {0x39, 0x06, 0x18, 0xbb},
436         {0x3a, 0x06, 0x18, 0xbb},
437         {0x3b, 0x06, 0x18, 0xbb},
438         {0x3c, 0x06, 0x18, 0xbb},
439         {0x64, 0x7b, 0x5b, 0xbb},
440         {0xf0, 0x00, 0x02, 0xbb},
441         {0x36, 0x30, 0x10, 0xbb},
442         {0x37, 0x00, 0xc0, 0xbb},
443         {0xbc, 0x0e, 0x00, 0xcc},
444         {0xbc, 0x0f, 0x05, 0xcc},
445         {0xbc, 0x10, 0xc0, 0xcc},
446         {0xbc, 0x11, 0x03, 0xcc},
447         {0xb6, 0x00, 0x00, 0xcc},
448         {0xb6, 0x03, 0x02, 0xcc},
449         {0xb6, 0x02, 0x80, 0xcc},
450         {0xb6, 0x05, 0x01, 0xcc},
451         {0xb6, 0x04, 0xe0, 0xcc},
452         {0xb6, 0x12, 0xf8, 0xcc},
453         {0xb6, 0x13, 0x25, 0xcc},
454         {0xb6, 0x18, 0x02, 0xcc},
455         {0xb6, 0x17, 0x58, 0xcc},
456         {0xb6, 0x16, 0x00, 0xcc},
457         {0xb6, 0x22, 0x12, 0xcc},
458         {0xb6, 0x23, 0x0b, 0xcc},
459         {0xbf, 0xc0, 0x39, 0xcc},
460         {0xbf, 0xc1, 0x04, 0xcc},
461         {0xbf, 0xcc, 0x00, 0xcc},
462         {0xbc, 0x02, 0x18, 0xcc},
463         {0xbc, 0x03, 0x50, 0xcc},
464         {0xbc, 0x04, 0x18, 0xcc},
465         {0xbc, 0x05, 0x00, 0xcc},
466         {0xbc, 0x06, 0x00, 0xcc},
467         {0xbc, 0x08, 0x30, 0xcc},
468         {0xbc, 0x09, 0x40, 0xcc},
469         {0xbc, 0x0a, 0x10, 0xcc},
470         {0xbc, 0x0b, 0x00, 0xcc},
471         {0xbc, 0x0c, 0x00, 0xcc},
472         {0xb3, 0x5c, 0x01, 0xcc},
473         {0xf0, 0x00, 0x01, 0xbb},
474         {0x80, 0x00, 0x03, 0xbb},
475         {0x81, 0xc7, 0x14, 0xbb},
476         {0x82, 0xeb, 0xe8, 0xbb},
477         {0x83, 0xfe, 0xf4, 0xbb},
478         {0x84, 0xcd, 0x10, 0xbb},
479         {0x85, 0xf3, 0xee, 0xbb},
480         {0x86, 0xff, 0xf1, 0xbb},
481         {0x87, 0xcd, 0x10, 0xbb},
482         {0x88, 0xf3, 0xee, 0xbb},
483         {0x89, 0x01, 0xf1, 0xbb},
484         {0x8a, 0xe5, 0x17, 0xbb},
485         {0x8b, 0xe8, 0xe2, 0xbb},
486         {0x8c, 0xf7, 0xed, 0xbb},
487         {0x8d, 0x00, 0xff, 0xbb},
488         {0x8e, 0xec, 0x10, 0xbb},
489         {0x8f, 0xf0, 0xed, 0xbb},
490         {0x90, 0xf9, 0xf2, 0xbb},
491         {0x91, 0x00, 0x00, 0xbb},
492         {0x92, 0xe9, 0x0d, 0xbb},
493         {0x93, 0xf4, 0xf2, 0xbb},
494         {0x94, 0xfb, 0xf5, 0xbb},
495         {0x95, 0x00, 0xff, 0xbb},
496         {0xb6, 0x0f, 0x08, 0xbb},
497         {0xb7, 0x3d, 0x16, 0xbb},
498         {0xb8, 0x0c, 0x04, 0xbb},
499         {0xb9, 0x1c, 0x07, 0xbb},
500         {0xba, 0x0a, 0x03, 0xbb},
501         {0xbb, 0x1b, 0x09, 0xbb},
502         {0xbc, 0x17, 0x0d, 0xbb},
503         {0xbd, 0x23, 0x1d, 0xbb},
504         {0xbe, 0x00, 0x28, 0xbb},
505         {0xbf, 0x11, 0x09, 0xbb},
506         {0xc0, 0x16, 0x15, 0xbb},
507         {0xc1, 0x00, 0x1b, 0xbb},
508         {0xc2, 0x0e, 0x07, 0xbb},
509         {0xc3, 0x14, 0x10, 0xbb},
510         {0xc4, 0x00, 0x17, 0xbb},
511         {0x06, 0x74, 0x8e, 0xbb},
512         {0xf0, 0x00, 0x01, 0xbb},
513         {0x06, 0xf4, 0x8e, 0xbb},
514         {0x00, 0x00, 0x50, 0xdd},
515         {0x06, 0x74, 0x8e, 0xbb},
516         {0xf0, 0x00, 0x02, 0xbb},
517         {0x24, 0x50, 0x20, 0xbb},
518         {0xf0, 0x00, 0x02, 0xbb},
519         {0x34, 0x0c, 0x50, 0xbb},
520         {0xb3, 0x01, 0x41, 0xcc},
521         {0xf0, 0x00, 0x00, 0xbb},
522         {0x03, 0x03, 0xc0, 0xbb},
523         {},
524 };
525 static const __u8 mi1310_socinitQVGA_JPG[][4] = {
526         {0xb0, 0x03, 0x19, 0xcc},       {0xb0, 0x04, 0x02, 0xcc},
527         {0xb3, 0x00, 0x64, 0xcc},       {0xb3, 0x00, 0x65, 0xcc},
528         {0xb3, 0x05, 0x00, 0xcc},       {0xb3, 0x06, 0x00, 0xcc},
529         {0xb3, 0x08, 0x01, 0xcc},       {0xb3, 0x09, 0x0c, 0xcc},
530         {0xb3, 0x34, 0x02, 0xcc},       {0xb3, 0x35, 0xdd, 0xcc},
531         {0xb3, 0x02, 0x00, 0xcc},       {0xb3, 0x03, 0x0a, 0xcc},
532         {0xb3, 0x04, 0x05, 0xcc},       {0xb3, 0x20, 0x00, 0xcc},
533         {0xb3, 0x21, 0x00, 0xcc},       {0xb3, 0x22, 0x03, 0xcc},
534         {0xb3, 0x23, 0xc0, 0xcc},       {0xb3, 0x14, 0x00, 0xcc},
535         {0xb3, 0x15, 0x00, 0xcc},       {0xb3, 0x16, 0x04, 0xcc},
536         {0xb3, 0x17, 0xff, 0xcc},       {0xb3, 0x00, 0x65, 0xcc},
537         {0xb8, 0x00, 0x00, 0xcc},       {0xbc, 0x00, 0xf0, 0xcc},
538         {0xbc, 0x01, 0x01, 0xcc},       {0xf0, 0x00, 0x02, 0xbb},
539         {0xc8, 0x9f, 0x0b, 0xbb},       {0x5b, 0x00, 0x01, 0xbb},
540         {0x2f, 0xde, 0x20, 0xbb},       {0xf0, 0x00, 0x00, 0xbb},
541         {0x20, 0x03, 0x02, 0xbb},       {0xf0, 0x00, 0x01, 0xbb},
542         {0x05, 0x00, 0x07, 0xbb},       {0x34, 0x00, 0x00, 0xbb},
543         {0x35, 0xff, 0x00, 0xbb},       {0xdc, 0x07, 0x02, 0xbb},
544         {0xdd, 0x3c, 0x18, 0xbb},       {0xde, 0x92, 0x6d, 0xbb},
545         {0xdf, 0xcd, 0xb1, 0xbb},       {0xe0, 0xff, 0xe7, 0xbb},
546         {0x06, 0xf0, 0x0d, 0xbb},       {0x06, 0x70, 0x0e, 0xbb},
547         {0x4c, 0x00, 0x01, 0xbb},       {0x4d, 0x00, 0x01, 0xbb},
548         {0xf0, 0x00, 0x02, 0xbb},       {0x2e, 0x0c, 0x55, 0xbb},
549         {0x21, 0xb6, 0x6e, 0xbb},       {0x36, 0x30, 0x10, 0xbb},
550         {0x37, 0x00, 0xc1, 0xbb},       {0xf0, 0x00, 0x00, 0xbb},
551         {0x07, 0x00, 0x84, 0xbb},       {0x08, 0x02, 0x4a, 0xbb},
552         {0x05, 0x01, 0x10, 0xbb},       {0x06, 0x00, 0x39, 0xbb},
553         {0xf0, 0x00, 0x02, 0xbb},       {0x58, 0x02, 0x67, 0xbb},
554         {0x57, 0x02, 0x00, 0xbb},       {0x5a, 0x02, 0x67, 0xbb},
555         {0x59, 0x02, 0x00, 0xbb},       {0x5c, 0x12, 0x0d, 0xbb},
556         {0x5d, 0x16, 0x11, 0xbb},       {0x39, 0x06, 0x18, 0xbb},
557         {0x3a, 0x06, 0x18, 0xbb},       {0x3b, 0x06, 0x18, 0xbb},
558         {0x3c, 0x06, 0x18, 0xbb},       {0x64, 0x7b, 0x5b, 0xbb},
559         {0xf0, 0x00, 0x02, 0xbb},       {0x36, 0x30, 0x10, 0xbb},
560         {0x37, 0x00, 0xc0, 0xbb},       {0xbc, 0x0e, 0x00, 0xcc},
561         {0xbc, 0x0f, 0x05, 0xcc},       {0xbc, 0x10, 0xc0, 0xcc},
562         {0xbc, 0x11, 0x03, 0xcc},       {0xb6, 0x00, 0x00, 0xcc},
563         {0xb6, 0x03, 0x01, 0xcc},       {0xb6, 0x02, 0x40, 0xcc},
564         {0xb6, 0x05, 0x00, 0xcc},       {0xb6, 0x04, 0xf0, 0xcc},
565         {0xb6, 0x12, 0xf8, 0xcc},       {0xb6, 0x13, 0x25, 0xcc},
566         {0xb6, 0x18, 0x00, 0xcc},       {0xb6, 0x17, 0x96, 0xcc},
567         {0xb6, 0x16, 0x00, 0xcc},       {0xb6, 0x22, 0x12, 0xcc},
568         {0xb6, 0x23, 0x0b, 0xcc},       {0xbf, 0xc0, 0x39, 0xcc},
569         {0xbf, 0xc1, 0x04, 0xcc},       {0xbf, 0xcc, 0x00, 0xcc},
570         {0xb3, 0x5c, 0x01, 0xcc},       {0xf0, 0x00, 0x01, 0xbb},
571         {0x80, 0x00, 0x03, 0xbb},       {0x81, 0xc7, 0x14, 0xbb},
572         {0x82, 0xeb, 0xe8, 0xbb},       {0x83, 0xfe, 0xf4, 0xbb},
573         {0x84, 0xcd, 0x10, 0xbb},       {0x85, 0xf3, 0xee, 0xbb},
574         {0x86, 0xff, 0xf1, 0xbb},       {0x87, 0xcd, 0x10, 0xbb},
575         {0x88, 0xf3, 0xee, 0xbb},       {0x89, 0x01, 0xf1, 0xbb},
576         {0x8a, 0xe5, 0x17, 0xbb},       {0x8b, 0xe8, 0xe2, 0xbb},
577         {0x8c, 0xf7, 0xed, 0xbb},       {0x8d, 0x00, 0xff, 0xbb},
578         {0x8e, 0xec, 0x10, 0xbb},       {0x8f, 0xf0, 0xed, 0xbb},
579         {0x90, 0xf9, 0xf2, 0xbb},       {0x91, 0x00, 0x00, 0xbb},
580         {0x92, 0xe9, 0x0d, 0xbb},       {0x93, 0xf4, 0xf2, 0xbb},
581         {0x94, 0xfb, 0xf5, 0xbb},       {0x95, 0x00, 0xff, 0xbb},
582         {0xb6, 0x0f, 0x08, 0xbb},       {0xb7, 0x3d, 0x16, 0xbb},
583         {0xb8, 0x0c, 0x04, 0xbb},       {0xb9, 0x1c, 0x07, 0xbb},
584         {0xba, 0x0a, 0x03, 0xbb},       {0xbb, 0x1b, 0x09, 0xbb},
585         {0xbc, 0x17, 0x0d, 0xbb},       {0xbd, 0x23, 0x1d, 0xbb},
586         {0xbe, 0x00, 0x28, 0xbb},       {0xbf, 0x11, 0x09, 0xbb},
587         {0xc0, 0x16, 0x15, 0xbb},       {0xc1, 0x00, 0x1b, 0xbb},
588         {0xc2, 0x0e, 0x07, 0xbb},       {0xc3, 0x14, 0x10, 0xbb},
589         {0xc4, 0x00, 0x17, 0xbb},       {0x06, 0x74, 0x8e, 0xbb},
590         {0xf0, 0x00, 0x01, 0xbb},       {0x06, 0xf4, 0x8e, 0xbb},
591         {0x00, 0x00, 0x50, 0xdd},       {0x06, 0x74, 0x8e, 0xbb},
592         {0xf0, 0x00, 0x02, 0xbb},       {0x24, 0x50, 0x20, 0xbb},
593         {0xf0, 0x00, 0x02, 0xbb},       {0x34, 0x0c, 0x50, 0xbb},
594         {0xb3, 0x01, 0x41, 0xcc},       {0xf0, 0x00, 0x00, 0xbb},
595         {0x03, 0x03, 0xc0, 0xbb},
596         {},
597 };
598
599 static const __u8 mi1320_gamma[17] = {
600         0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
601         0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
602 };
603 static const __u8 mi1320_matrix[9] = {
604         0x54, 0xda, 0x06, 0xf1, 0x50, 0xf4, 0xf7, 0xea, 0x52
605 };
606 static const __u8 mi1320_initVGA_data[][4] = {
607         {0xb3, 0x01, 0x01, 0xcc},       {0x00, 0x00, 0x33, 0xdd},
608         {0xb0, 0x03, 0x19, 0xcc},       {0x00, 0x00, 0x33, 0xdd},
609         {0xb0, 0x04, 0x02, 0xcc},       {0x00, 0x00, 0x33, 0xdd},
610         {0xb3, 0x00, 0x64, 0xcc},       {0xb3, 0x00, 0x65, 0xcc},
611         {0xb0, 0x16, 0x03, 0xcc},       {0xb3, 0x05, 0x00, 0xcc},
612         {0xb3, 0x06, 0x00, 0xcc},       {0xb3, 0x08, 0x01, 0xcc},
613         {0xb3, 0x09, 0x0c, 0xcc},       {0xb3, 0x34, 0x02, 0xcc},
614         {0xb3, 0x35, 0xc8, 0xcc},       {0xb3, 0x02, 0x00, 0xcc},
615         {0xb3, 0x03, 0x0a, 0xcc},       {0xb3, 0x04, 0x05, 0xcc},
616         {0xb3, 0x20, 0x00, 0xcc},       {0xb3, 0x21, 0x00, 0xcc},
617         {0xb3, 0x22, 0x03, 0xcc},       {0xb3, 0x23, 0xc0, 0xcc},
618         {0xb3, 0x14, 0x00, 0xcc},       {0xb3, 0x15, 0x00, 0xcc},
619         {0xb3, 0x16, 0x04, 0xcc},       {0xb3, 0x17, 0xff, 0xcc},
620         {0xb3, 0x00, 0x67, 0xcc},       {0xbc, 0x00, 0xd0, 0xcc},
621         {0xbc, 0x01, 0x01, 0xcc},       {0xf0, 0x00, 0x00, 0xbb},
622         {0x0d, 0x00, 0x09, 0xbb},       {0x00, 0x01, 0x00, 0xdd},
623         {0x0d, 0x00, 0x08, 0xbb},       {0xf0, 0x00, 0x01, 0xbb},
624         {0xa1, 0x05, 0x00, 0xbb},       {0xa4, 0x03, 0xc0, 0xbb},
625         {0xf0, 0x00, 0x02, 0xbb},       {0x00, 0x00, 0x10, 0xdd},
626         {0xc8, 0x9f, 0x0b, 0xbb},       {0x00, 0x00, 0x10, 0xdd},
627         {0xf0, 0x00, 0x00, 0xbb},       {0x00, 0x00, 0x10, 0xdd},
628         {0x20, 0x01, 0x00, 0xbb},       {0x00, 0x00, 0x10, 0xdd},
629         {0xf0, 0x00, 0x01, 0xbb},       {0x9d, 0x3c, 0xa0, 0xbb},
630         {0x47, 0x30, 0x30, 0xbb},       {0xf0, 0x00, 0x00, 0xbb},
631         {0x0a, 0x80, 0x11, 0xbb},       {0x35, 0x00, 0x22, 0xbb},
632         {0xf0, 0x00, 0x02, 0xbb},       {0x9d, 0xc5, 0x05, 0xbb},
633         {0xdc, 0x0f, 0xfc, 0xbb},       {0xf0, 0x00, 0x01, 0xbb},
634         {0x06, 0x74, 0x0e, 0xbb},       {0x80, 0x00, 0x06, 0xbb},
635         {0x81, 0x04, 0x00, 0xbb},       {0x82, 0x01, 0x02, 0xbb},
636         {0x83, 0x03, 0x02, 0xbb},       {0x84, 0x05, 0x00, 0xbb},
637         {0x85, 0x01, 0x00, 0xbb},       {0x86, 0x03, 0x02, 0xbb},
638         {0x87, 0x05, 0x00, 0xbb},       {0x88, 0x01, 0x00, 0xbb},
639         {0x89, 0x02, 0x02, 0xbb},       {0x8a, 0xfd, 0x04, 0xbb},
640         {0x8b, 0xfc, 0xfd, 0xbb},       {0x8c, 0xff, 0xfd, 0xbb},
641         {0x8d, 0x00, 0x00, 0xbb},       {0x8e, 0xfe, 0x05, 0xbb},
642         {0x8f, 0xfc, 0xfd, 0xbb},       {0x90, 0xfe, 0xfd, 0xbb},
643         {0x91, 0x00, 0x00, 0xbb},       {0x92, 0xfe, 0x03, 0xbb},
644         {0x93, 0xfd, 0xfe, 0xbb},       {0x94, 0xff, 0xfd, 0xbb},
645         {0x95, 0x00, 0x00, 0xbb},       {0xb6, 0x07, 0x05, 0xbb},
646         {0xb7, 0x13, 0x06, 0xbb},       {0xb8, 0x08, 0x06, 0xbb},
647         {0xb9, 0x14, 0x08, 0xbb},       {0xba, 0x06, 0x05, 0xbb},
648         {0xbb, 0x13, 0x06, 0xbb},       {0xbc, 0x03, 0x01, 0xbb},
649         {0xbd, 0x03, 0x04, 0xbb},       {0xbe, 0x00, 0x02, 0xbb},
650         {0xbf, 0x03, 0x01, 0xbb},       {0xc0, 0x02, 0x04, 0xbb},
651         {0xc1, 0x00, 0x04, 0xbb},       {0xc2, 0x02, 0x01, 0xbb},
652         {0xc3, 0x01, 0x03, 0xbb},       {0xc4, 0x00, 0x04, 0xbb},
653         {0xf0, 0x00, 0x00, 0xbb},       {0x05, 0x01, 0x13, 0xbb},
654         {0x06, 0x00, 0x11, 0xbb},       {0x07, 0x00, 0x85, 0xbb},
655         {0x08, 0x00, 0x27, 0xbb},       {0x20, 0x01, 0x03, 0xbb},
656         {0x21, 0x80, 0x00, 0xbb},       {0x22, 0x0d, 0x0f, 0xbb},
657         {0x24, 0x80, 0x00, 0xbb},       {0x59, 0x00, 0xff, 0xbb},
658         {0xf0, 0x00, 0x02, 0xbb},       {0x39, 0x03, 0x0d, 0xbb},
659         {0x3a, 0x06, 0x1b, 0xbb},       {0x3b, 0x00, 0x95, 0xbb},
660         {0x3c, 0x04, 0xdb, 0xbb},       {0x57, 0x02, 0x00, 0xbb},
661         {0x58, 0x02, 0x66, 0xbb},       {0x59, 0x00, 0xff, 0xbb},
662         {0x5a, 0x01, 0x33, 0xbb},       {0x5c, 0x12, 0x0d, 0xbb},
663         {0x5d, 0x16, 0x11, 0xbb},       {0x64, 0x5e, 0x1c, 0xbb},
664         {0xf0, 0x00, 0x02, 0xbb},       {0x2f, 0xd1, 0x00, 0xbb},
665         {0x5b, 0x00, 0x01, 0xbb},       {0xf0, 0x00, 0x02, 0xbb},
666         {0x36, 0x68, 0x10, 0xbb},       {0x00, 0x00, 0x30, 0xdd},
667         {0x37, 0x82, 0x00, 0xbb},       {0xbc, 0x0e, 0x00, 0xcc},
668         {0xbc, 0x0f, 0x05, 0xcc},       {0xbc, 0x10, 0xc0, 0xcc},
669         {0xbc, 0x11, 0x03, 0xcc},       {0xb6, 0x00, 0x00, 0xcc},
670         {0xb6, 0x03, 0x05, 0xcc},       {0xb6, 0x02, 0x00, 0xcc},
671         {0xb6, 0x05, 0x04, 0xcc},       {0xb6, 0x04, 0x00, 0xcc},
672         {0xb6, 0x12, 0xf8, 0xcc},       {0xb6, 0x13, 0x29, 0xcc},
673         {0xb6, 0x18, 0x0a, 0xcc},       {0xb6, 0x17, 0x00, 0xcc},
674         {0xb6, 0x16, 0x00, 0xcc},       {0xb6, 0x22, 0x12, 0xcc},
675         {0xb6, 0x23, 0x0b, 0xcc},       {0xbf, 0xc0, 0x26, 0xcc},
676         {0xbf, 0xc1, 0x02, 0xcc},       {0xbf, 0xcc, 0x04, 0xcc},
677         {0xbc, 0x02, 0x18, 0xcc},       {0xbc, 0x03, 0x50, 0xcc},
678         {0xbc, 0x04, 0x18, 0xcc},       {0xbc, 0x05, 0x00, 0xcc},
679         {0xbc, 0x06, 0x00, 0xcc},       {0xbc, 0x08, 0x30, 0xcc},
680         {0xbc, 0x09, 0x40, 0xcc},       {0xbc, 0x0a, 0x10, 0xcc},
681         {0xbc, 0x0b, 0x00, 0xcc},       {0xbc, 0x0c, 0x00, 0xcc},
682         {0xb3, 0x5c, 0x01, 0xcc},       {0xb3, 0x01, 0x41, 0xcc},
683         {}
684 };
685 static const __u8 mi1320_initQVGA_data[][4] = {
686         {0xb3, 0x01, 0x01, 0xcc},       {0x00, 0x00, 0x33, 0xdd},
687         {0xb0, 0x03, 0x19, 0xcc},       {0x00, 0x00, 0x33, 0xdd},
688         {0xb0, 0x04, 0x02, 0xcc},       {0x00, 0x00, 0x33, 0xdd},
689         {0xb3, 0x00, 0x64, 0xcc},       {0xb3, 0x00, 0x65, 0xcc},
690         {0xb0, 0x16, 0x03, 0xcc},       {0xb3, 0x05, 0x01, 0xcc},
691         {0xb3, 0x06, 0x01, 0xcc},       {0xb3, 0x08, 0x01, 0xcc},
692         {0xb3, 0x09, 0x0c, 0xcc},       {0xb3, 0x34, 0x02, 0xcc},
693         {0xb3, 0x35, 0xc8, 0xcc},       {0xb3, 0x02, 0x00, 0xcc},
694         {0xb3, 0x03, 0x0a, 0xcc},       {0xb3, 0x04, 0x05, 0xcc},
695         {0xb3, 0x20, 0x00, 0xcc},       {0xb3, 0x21, 0x00, 0xcc},
696         {0xb3, 0x22, 0x01, 0xcc},       {0xb3, 0x23, 0xe0, 0xcc},
697         {0xb3, 0x14, 0x00, 0xcc},       {0xb3, 0x15, 0x00, 0xcc},
698         {0xb3, 0x16, 0x02, 0xcc},       {0xb3, 0x17, 0x7f, 0xcc},
699         {0xb3, 0x00, 0x65, 0xcc},       {0xb8, 0x00, 0x00, 0xcc},
700         {0xbc, 0x00, 0xd0, 0xcc},       {0xbc, 0x01, 0x01, 0xcc},
701         {0xf0, 0x00, 0x00, 0xbb},       {0x0d, 0x00, 0x09, 0xbb},
702         {0x00, 0x01, 0x00, 0xdd},       {0x0d, 0x00, 0x08, 0xbb},
703         {0xf0, 0x00, 0x00, 0xbb},       {0x02, 0x00, 0x64, 0xbb},
704         {0x05, 0x01, 0x78, 0xbb},       {0x06, 0x00, 0x11, 0xbb},
705         {0x07, 0x01, 0x42, 0xbb},       {0x08, 0x00, 0x11, 0xbb},
706         {0x20, 0x01, 0x00, 0xbb},       {0x21, 0x80, 0x00, 0xbb},
707         {0x22, 0x0d, 0x0f, 0xbb},       {0x24, 0x80, 0x00, 0xbb},
708         {0x59, 0x00, 0xff, 0xbb},       {0xf0, 0x00, 0x01, 0xbb},
709         {0x9d, 0x3c, 0xa0, 0xbb},       {0x47, 0x30, 0x30, 0xbb},
710         {0xf0, 0x00, 0x00, 0xbb},       {0x0a, 0x80, 0x11, 0xbb},
711         {0x35, 0x00, 0x22, 0xbb},       {0xf0, 0x00, 0x02, 0xbb},
712         {0x9d, 0xc5, 0x05, 0xbb},       {0xdc, 0x0f, 0xfc, 0xbb},
713         {0xf0, 0x00, 0x01, 0xbb},       {0x06, 0x74, 0x0e, 0xbb},
714         {0x80, 0x00, 0x06, 0xbb},       {0x81, 0x04, 0x00, 0xbb},
715         {0x82, 0x01, 0x02, 0xbb},       {0x83, 0x03, 0x02, 0xbb},
716         {0x84, 0x05, 0x00, 0xbb},       {0x85, 0x01, 0x00, 0xbb},
717         {0x86, 0x03, 0x02, 0xbb},       {0x87, 0x05, 0x00, 0xbb},
718         {0x88, 0x01, 0x00, 0xbb},       {0x89, 0x02, 0x02, 0xbb},
719         {0x8a, 0xfd, 0x04, 0xbb},       {0x8b, 0xfc, 0xfd, 0xbb},
720         {0x8c, 0xff, 0xfd, 0xbb},       {0x8d, 0x00, 0x00, 0xbb},
721         {0x8e, 0xfe, 0x05, 0xbb},       {0x8f, 0xfc, 0xfd, 0xbb},
722         {0x90, 0xfe, 0xfd, 0xbb},       {0x91, 0x00, 0x00, 0xbb},
723         {0x92, 0xfe, 0x03, 0xbb},       {0x93, 0xfd, 0xfe, 0xbb},
724         {0x94, 0xff, 0xfd, 0xbb},       {0x95, 0x00, 0x00, 0xbb},
725         {0xb6, 0x07, 0x05, 0xbb},       {0xb7, 0x13, 0x06, 0xbb},
726         {0xb8, 0x08, 0x06, 0xbb},       {0xb9, 0x14, 0x08, 0xbb},
727         {0xba, 0x06, 0x05, 0xbb},       {0xbb, 0x13, 0x06, 0xbb},
728         {0xbc, 0x03, 0x01, 0xbb},       {0xbd, 0x03, 0x04, 0xbb},
729         {0xbe, 0x00, 0x02, 0xbb},       {0xbf, 0x03, 0x01, 0xbb},
730         {0xc0, 0x02, 0x04, 0xbb},       {0xc1, 0x00, 0x04, 0xbb},
731         {0xc2, 0x02, 0x01, 0xbb},       {0xc3, 0x01, 0x03, 0xbb},
732         {0xc4, 0x00, 0x04, 0xbb},       {0xf0, 0x00, 0x02, 0xbb},
733         {0xc8, 0x00, 0x00, 0xbb},       {0x2e, 0x00, 0x00, 0xbb},
734         {0x2e, 0x0c, 0x5b, 0xbb},       {0x2f, 0xd1, 0x00, 0xbb},
735         {0x39, 0x03, 0xca, 0xbb},       {0x3a, 0x06, 0x80, 0xbb},
736         {0x3b, 0x01, 0x52, 0xbb},       {0x3c, 0x05, 0x40, 0xbb},
737         {0x57, 0x01, 0x9c, 0xbb},       {0x58, 0x01, 0xee, 0xbb},
738         {0x59, 0x00, 0xf0, 0xbb},       {0x5a, 0x01, 0x20, 0xbb},
739         {0x5c, 0x1d, 0x17, 0xbb},       {0x5d, 0x22, 0x1c, 0xbb},
740         {0x64, 0x1e, 0x1c, 0xbb},       {0x5b, 0x00, 0x01, 0xbb},
741         {0xf0, 0x00, 0x02, 0xbb},       {0x36, 0x68, 0x10, 0xbb},
742         {0x00, 0x00, 0x30, 0xdd},       {0x37, 0x81, 0x00, 0xbb},
743         {0xbc, 0x02, 0x18, 0xcc},       {0xbc, 0x03, 0x50, 0xcc},
744         {0xbc, 0x04, 0x18, 0xcc},       {0xbc, 0x05, 0x00, 0xcc},
745         {0xbc, 0x06, 0x00, 0xcc},       {0xbc, 0x08, 0x30, 0xcc},
746         {0xbc, 0x09, 0x40, 0xcc},       {0xbc, 0x0a, 0x10, 0xcc},
747         {0xbc, 0x0b, 0x00, 0xcc},       {0xbc, 0x0c, 0x00, 0xcc},
748         {0xbf, 0xc0, 0x26, 0xcc},       {0xbf, 0xc1, 0x02, 0xcc},
749         {0xbf, 0xcc, 0x04, 0xcc},       {0xb3, 0x5c, 0x01, 0xcc},
750         {0xb3, 0x01, 0x41, 0xcc},
751         {}
752 };
753
754 static const __u8 po3130_gamma[17] = {
755         0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
756         0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
757 };
758 static const __u8 po3130_matrix[9] = {
759         0x5f, 0xec, 0xf5, 0xf1, 0x5a, 0xf5, 0xf1, 0xec, 0x63
760 };
761
762 static const __u8 po3130_initVGA_data[][4] = {
763         {0xb0, 0x4d, 0x00, 0xcc},       {0xb3, 0x01, 0x01, 0xcc},
764         {0x00, 0x00, 0x50, 0xdd},       {0xb0, 0x03, 0x01, 0xcc},
765         {0xb3, 0x00, 0x04, 0xcc},       {0xb3, 0x00, 0x24, 0xcc},
766         {0xb3, 0x00, 0x25, 0xcc},       {0xb3, 0x08, 0x01, 0xcc},
767         {0xb3, 0x09, 0x0c, 0xcc},       {0xb3, 0x05, 0x00, 0xcc},
768         {0xb3, 0x06, 0x01, 0xcc},       {0xb3, 0x03, 0x1a, 0xcc},
769         {0xb3, 0x04, 0x15, 0xcc},       {0xb3, 0x20, 0x00, 0xcc},
770         {0xb3, 0x21, 0x00, 0xcc},       {0xb3, 0x22, 0x01, 0xcc},
771         {0xb3, 0x23, 0xe8, 0xcc},       {0xb8, 0x08, 0xe8, 0xcc},
772         {0xb3, 0x14, 0x00, 0xcc},       {0xb3, 0x15, 0x00, 0xcc},
773         {0xb3, 0x16, 0x02, 0xcc},       {0xb3, 0x17, 0x7f, 0xcc},
774         {0xb3, 0x34, 0x01, 0xcc},       {0xb3, 0x35, 0xf6, 0xcc},
775         {0xb3, 0x00, 0x27, 0xcc},       {0xbc, 0x00, 0x71, 0xcc},
776         {0xb8, 0x00, 0x21, 0xcc},       {0xb8, 0x27, 0x20, 0xcc},
777         {0xb8, 0x01, 0x79, 0xcc},       {0xb8, 0x81, 0x09, 0xcc},
778         {0xb8, 0x2c, 0x50, 0xcc},       {0xb8, 0x2d, 0xf8, 0xcc},
779         {0xb8, 0x2e, 0xf8, 0xcc},       {0xb8, 0x2f, 0xf8, 0xcc},
780         {0xb8, 0x30, 0x50, 0xcc},       {0xb8, 0x31, 0xf8, 0xcc},
781         {0xb8, 0x32, 0xf8, 0xcc},       {0xb8, 0x33, 0xf8, 0xcc},
782         {0xb8, 0x34, 0x50, 0xcc},       {0xb8, 0x35, 0x00, 0xcc},
783         {0xb8, 0x36, 0x00, 0xcc},       {0xb8, 0x37, 0x00, 0xcc},
784         {0x00, 0x1e, 0xc6, 0xaa},       {0x00, 0x20, 0x44, 0xaa},
785         {0x00, 0xad, 0x02, 0xaa},       {0x00, 0xae, 0x2c, 0xaa},
786         {0x00, 0x12, 0x08, 0xaa},       {0x00, 0x17, 0x41, 0xaa},
787         {0x00, 0x19, 0x41, 0xaa},       {0x00, 0x1e, 0x06, 0xaa},
788         {0x00, 0x21, 0x00, 0xaa},       {0x00, 0x36, 0xc0, 0xaa},
789         {0x00, 0x37, 0xc8, 0xaa},       {0x00, 0x3b, 0x36, 0xaa},
790         {0x00, 0x4b, 0xfe, 0xaa},       {0x00, 0x51, 0x1c, 0xaa},
791         {0x00, 0x52, 0x01, 0xaa},       {0x00, 0x55, 0x0a, 0xaa},
792         {0x00, 0x59, 0x02, 0xaa},       {0x00, 0x5a, 0x04, 0xaa},
793         {0x00, 0x5c, 0x10, 0xaa},       {0x00, 0x5d, 0x10, 0xaa},
794         {0x00, 0x5e, 0x10, 0xaa},       {0x00, 0x5f, 0x10, 0xaa},
795         {0x00, 0x61, 0x00, 0xaa},       {0x00, 0x62, 0x18, 0xaa},
796         {0x00, 0x63, 0x30, 0xaa},       {0x00, 0x70, 0x68, 0xaa},
797         {0x00, 0x80, 0x71, 0xaa},       {0x00, 0x81, 0x08, 0xaa},
798         {0x00, 0x82, 0x00, 0xaa},       {0x00, 0x83, 0x55, 0xaa},
799         {0x00, 0x84, 0x06, 0xaa},       {0x00, 0x85, 0x06, 0xaa},
800         {0x00, 0x86, 0x13, 0xaa},       {0x00, 0x87, 0x18, 0xaa},
801         {0x00, 0xaa, 0x3f, 0xaa},       {0x00, 0xab, 0x44, 0xaa},
802         {0x00, 0xb0, 0x68, 0xaa},       {0x00, 0xb5, 0x10, 0xaa},
803         {0x00, 0xb8, 0x20, 0xaa},       {0x00, 0xb9, 0xa0, 0xaa},
804         {0x00, 0xbc, 0x04, 0xaa},       {0x00, 0x8b, 0x40, 0xaa},
805         {0x00, 0x8c, 0x91, 0xaa},       {0x00, 0x8d, 0x8f, 0xaa},
806         {0x00, 0x8e, 0x91, 0xaa},       {0x00, 0x8f, 0x43, 0xaa},
807         {0x00, 0x90, 0x92, 0xaa},       {0x00, 0x91, 0x89, 0xaa},
808         {0x00, 0x92, 0x9d, 0xaa},       {0x00, 0x93, 0x46, 0xaa},
809         {0x00, 0xd6, 0x22, 0xaa},       {0x00, 0x73, 0x00, 0xaa},
810         {0x00, 0x74, 0x10, 0xaa},       {0x00, 0x75, 0x20, 0xaa},
811         {0x00, 0x76, 0x2b, 0xaa},       {0x00, 0x77, 0x36, 0xaa},
812         {0x00, 0x78, 0x49, 0xaa},       {0x00, 0x79, 0x5a, 0xaa},
813         {0x00, 0x7a, 0x7f, 0xaa},       {0x00, 0x7b, 0x9b, 0xaa},
814         {0x00, 0x7c, 0xba, 0xaa},       {0x00, 0x7d, 0xd4, 0xaa},
815         {0x00, 0x7e, 0xea, 0xaa},       {0x00, 0xd6, 0x62, 0xaa},
816         {0x00, 0x73, 0x00, 0xaa},       {0x00, 0x74, 0x10, 0xaa},
817         {0x00, 0x75, 0x20, 0xaa},       {0x00, 0x76, 0x2b, 0xaa},
818         {0x00, 0x77, 0x36, 0xaa},       {0x00, 0x78, 0x49, 0xaa},
819         {0x00, 0x79, 0x5a, 0xaa},       {0x00, 0x7a, 0x7f, 0xaa},
820         {0x00, 0x7b, 0x9b, 0xaa},       {0x00, 0x7c, 0xba, 0xaa},
821         {0x00, 0x7d, 0xd4, 0xaa},       {0x00, 0x7e, 0xea, 0xaa},
822         {0x00, 0xd6, 0xa2, 0xaa},       {0x00, 0x73, 0x00, 0xaa},
823         {0x00, 0x74, 0x10, 0xaa},       {0x00, 0x75, 0x20, 0xaa},
824         {0x00, 0x76, 0x2b, 0xaa},       {0x00, 0x77, 0x36, 0xaa},
825         {0x00, 0x78, 0x49, 0xaa},       {0x00, 0x79, 0x5a, 0xaa},
826         {0x00, 0x7a, 0x7f, 0xaa},       {0x00, 0x7b, 0x9b, 0xaa},
827         {0x00, 0x7c, 0xba, 0xaa},       {0x00, 0x7d, 0xd4, 0xaa},
828         {0x00, 0x7e, 0xea, 0xaa},
829         {0x00, 0x4c, 0x07, 0xaa},
830         {0x00, 0x4b, 0xe0, 0xaa},       {0x00, 0x4e, 0x77, 0xaa},
831         {0x00, 0x59, 0x02, 0xaa},       {0x00, 0x4d, 0x0a, 0xaa},
832 /*      {0x00, 0xd1, 0x00, 0xaa},       {0x00, 0x20, 0xc4, 0xaa},
833         {0xb8, 0x8e, 0x00, 0xcc},       {0xb8, 0x8f, 0xff, 0xcc}, */
834         {0x00, 0xd1, 0x3c, 0xaa},       {0x00, 0x20, 0xc4, 0xaa},
835         {0xb8, 0x8e, 0x00, 0xcc},       {0xb8, 0x8f, 0xff, 0xcc},
836         {0xb8, 0xfe, 0x00, 0xcc},       {0xb8, 0xff, 0x28, 0xcc},
837         {0xb9, 0x00, 0x28, 0xcc},       {0xb9, 0x01, 0x28, 0xcc},
838         {0xb9, 0x02, 0x28, 0xcc},       {0xb9, 0x03, 0x00, 0xcc},
839         {0xb9, 0x04, 0x00, 0xcc},       {0xb9, 0x05, 0x3c, 0xcc},
840         {0xb9, 0x06, 0x3c, 0xcc},       {0xb9, 0x07, 0x3c, 0xcc},
841         {0xb9, 0x08, 0x3c, 0xcc},       {0x00, 0x05, 0x00, 0xaa},
842         {0xb3, 0x5c, 0x00, 0xcc},       {0xb3, 0x01, 0x41, 0xcc},
843         {}
844 };
845 static const __u8 po3130_rundata[][4] = {
846         {0x00, 0x47, 0x45, 0xaa},       {0x00, 0x48, 0x9b, 0xaa},
847         {0x00, 0x49, 0x3a, 0xaa},       {0x00, 0x4a, 0x01, 0xaa},
848         {0x00, 0x44, 0x40, 0xaa},
849 /*      {0x00, 0xd5, 0x7c, 0xaa}, */
850         {0x00, 0xad, 0x04, 0xaa},       {0x00, 0xae, 0x00, 0xaa},
851         {0x00, 0xb0, 0x78, 0xaa},       {0x00, 0x98, 0x02, 0xaa},
852         {0x00, 0x94, 0x25, 0xaa},       {0x00, 0x95, 0x25, 0xaa},
853         {0x00, 0x59, 0x68, 0xaa},       {0x00, 0x44, 0x20, 0xaa},
854         {0x00, 0x17, 0x50, 0xaa},       {0x00, 0x19, 0x50, 0xaa},
855         {0x00, 0xd1, 0x3c, 0xaa},       {0x00, 0xd1, 0x3c, 0xaa},
856         {0x00, 0x1e, 0x06, 0xaa},       {0x00, 0x1e, 0x06, 0xaa},
857         {}
858 };
859
860 static const __u8 po3130_initQVGA_data[][4] = {
861         {0xb0, 0x4d, 0x00, 0xcc},       {0xb3, 0x01, 0x01, 0xcc},
862         {0x00, 0x00, 0x50, 0xdd},       {0xb0, 0x03, 0x09, 0xcc},
863         {0xb3, 0x00, 0x04, 0xcc},       {0xb3, 0x00, 0x24, 0xcc},
864         {0xb3, 0x00, 0x25, 0xcc},       {0xb3, 0x08, 0x01, 0xcc},
865         {0xb3, 0x09, 0x0c, 0xcc},       {0xb3, 0x05, 0x00, 0xcc},
866         {0xb3, 0x06, 0x01, 0xcc},       {0xb3, 0x03, 0x1a, 0xcc},
867         {0xb3, 0x04, 0x15, 0xcc},       {0xb3, 0x20, 0x00, 0xcc},
868         {0xb3, 0x21, 0x00, 0xcc},       {0xb3, 0x22, 0x01, 0xcc},
869         {0xb3, 0x23, 0xe0, 0xcc},       {0xb8, 0x08, 0xe0, 0xcc},
870         {0xb3, 0x14, 0x00, 0xcc},       {0xb3, 0x15, 0x00, 0xcc},
871         {0xb3, 0x16, 0x02, 0xcc},       {0xb3, 0x17, 0x7f, 0xcc},
872         {0xb3, 0x34, 0x01, 0xcc},       {0xb3, 0x35, 0xf6, 0xcc},
873         {0xb3, 0x00, 0x27, 0xcc},       {0xbc, 0x00, 0xd1, 0xcc},
874         {0xb8, 0x00, 0x21, 0xcc},       {0xb8, 0x27, 0x20, 0xcc},
875         {0xb8, 0x01, 0x79, 0xcc},       {0xb8, 0x81, 0x09, 0xcc},
876         {0xb8, 0x2c, 0x50, 0xcc},       {0xb8, 0x2d, 0xf8, 0xcc},
877         {0xb8, 0x2e, 0xf8, 0xcc},       {0xb8, 0x2f, 0xf8, 0xcc},
878         {0xb8, 0x30, 0x50, 0xcc},       {0xb8, 0x31, 0xf8, 0xcc},
879         {0xb8, 0x32, 0xf8, 0xcc},       {0xb8, 0x33, 0xf8, 0xcc},
880         {0xb8, 0x34, 0x50, 0xcc},       {0xb8, 0x35, 0x00, 0xcc},
881         {0xb8, 0x36, 0x00, 0xcc},       {0xb8, 0x37, 0x00, 0xcc},
882         {0x00, 0x1e, 0xc6, 0xaa},       {0x00, 0x20, 0x44, 0xaa},
883         {0x00, 0xad, 0x02, 0xaa},       {0x00, 0xae, 0x2c, 0xaa},
884         {0x00, 0x12, 0x08, 0xaa},       {0x00, 0x17, 0x41, 0xaa},
885         {0x00, 0x19, 0x41, 0xaa},       {0x00, 0x1e, 0x06, 0xaa},
886         {0x00, 0x21, 0x00, 0xaa},       {0x00, 0x36, 0xc0, 0xaa},
887         {0x00, 0x37, 0xc8, 0xaa},       {0x00, 0x3b, 0x36, 0xaa},
888         {0x00, 0x4b, 0xfe, 0xaa},       {0x00, 0x51, 0x1c, 0xaa},
889         {0x00, 0x52, 0x01, 0xaa},       {0x00, 0x55, 0x0a, 0xaa},
890         {0x00, 0x59, 0x6f, 0xaa},       {0x00, 0x5a, 0x04, 0xaa},
891         {0x00, 0x5c, 0x10, 0xaa},       {0x00, 0x5d, 0x10, 0xaa},
892         {0x00, 0x5e, 0x10, 0xaa},       {0x00, 0x5f, 0x10, 0xaa},
893         {0x00, 0x61, 0x00, 0xaa},       {0x00, 0x62, 0x18, 0xaa},
894         {0x00, 0x63, 0x30, 0xaa},       {0x00, 0x70, 0x68, 0xaa},
895         {0x00, 0x80, 0x71, 0xaa},       {0x00, 0x81, 0x08, 0xaa},
896         {0x00, 0x82, 0x00, 0xaa},       {0x00, 0x83, 0x55, 0xaa},
897         {0x00, 0x84, 0x06, 0xaa},       {0x00, 0x85, 0x06, 0xaa},
898         {0x00, 0x86, 0x13, 0xaa},       {0x00, 0x87, 0x18, 0xaa},
899         {0x00, 0xaa, 0x3f, 0xaa},       {0x00, 0xab, 0x44, 0xaa},
900         {0x00, 0xb0, 0x68, 0xaa},       {0x00, 0xb5, 0x10, 0xaa},
901         {0x00, 0xb8, 0x20, 0xaa},       {0x00, 0xb9, 0xa0, 0xaa},
902         {0x00, 0xbc, 0x04, 0xaa},       {0x00, 0x8b, 0x40, 0xaa},
903         {0x00, 0x8c, 0x91, 0xaa},       {0x00, 0x8d, 0x8f, 0xaa},
904         {0x00, 0x8e, 0x91, 0xaa},       {0x00, 0x8f, 0x43, 0xaa},
905         {0x00, 0x90, 0x92, 0xaa},       {0x00, 0x91, 0x89, 0xaa},
906         {0x00, 0x92, 0x9d, 0xaa},       {0x00, 0x93, 0x46, 0xaa},
907         {0x00, 0xd6, 0x22, 0xaa},       {0x00, 0x73, 0x00, 0xaa},
908         {0x00, 0x74, 0x10, 0xaa},       {0x00, 0x75, 0x20, 0xaa},
909         {0x00, 0x76, 0x2b, 0xaa},       {0x00, 0x77, 0x36, 0xaa},
910         {0x00, 0x78, 0x49, 0xaa},       {0x00, 0x79, 0x5a, 0xaa},
911         {0x00, 0x7a, 0x7f, 0xaa},       {0x00, 0x7b, 0x9b, 0xaa},
912         {0x00, 0x7c, 0xba, 0xaa},       {0x00, 0x7d, 0xd4, 0xaa},
913         {0x00, 0x7e, 0xea, 0xaa},       {0x00, 0xd6, 0x62, 0xaa},
914         {0x00, 0x73, 0x00, 0xaa},       {0x00, 0x74, 0x10, 0xaa},
915         {0x00, 0x75, 0x20, 0xaa},       {0x00, 0x76, 0x2b, 0xaa},
916         {0x00, 0x77, 0x36, 0xaa},       {0x00, 0x78, 0x49, 0xaa},
917         {0x00, 0x79, 0x5a, 0xaa},       {0x00, 0x7a, 0x7f, 0xaa},
918         {0x00, 0x7b, 0x9b, 0xaa},       {0x00, 0x7c, 0xba, 0xaa},
919         {0x00, 0x7d, 0xd4, 0xaa},       {0x00, 0x7e, 0xea, 0xaa},
920         {0x00, 0xd6, 0xa2, 0xaa},       {0x00, 0x73, 0x00, 0xaa},
921         {0x00, 0x74, 0x10, 0xaa},       {0x00, 0x75, 0x20, 0xaa},
922         {0x00, 0x76, 0x2b, 0xaa},       {0x00, 0x77, 0x36, 0xaa},
923         {0x00, 0x78, 0x49, 0xaa},       {0x00, 0x79, 0x5a, 0xaa},
924         {0x00, 0x7a, 0x7f, 0xaa},       {0x00, 0x7b, 0x9b, 0xaa},
925         {0x00, 0x7c, 0xba, 0xaa},       {0x00, 0x7d, 0xd4, 0xaa},
926         {0x00, 0x7e, 0xea, 0xaa},       {0x00, 0x4c, 0x07, 0xaa},
927         {0x00, 0x4b, 0xe0, 0xaa},       {0x00, 0x4e, 0x77, 0xaa},
928         {0x00, 0x59, 0x66, 0xaa},       {0x00, 0x4d, 0x0a, 0xaa},
929         {0x00, 0xd1, 0x00, 0xaa},       {0x00, 0x20, 0xc4, 0xaa},
930         {0xb8, 0x8e, 0x00, 0xcc},       {0xb8, 0x8f, 0xff, 0xcc},
931         {0xb8, 0xfe, 0x00, 0xcc},       {0xb8, 0xff, 0x28, 0xcc},
932         {0xb9, 0x00, 0x28, 0xcc},       {0xb9, 0x01, 0x28, 0xcc},
933         {0xb9, 0x02, 0x28, 0xcc},       {0xb9, 0x03, 0x00, 0xcc},
934         {0xb9, 0x04, 0x00, 0xcc},       {0xb9, 0x05, 0x3c, 0xcc},
935         {0xb9, 0x06, 0x3c, 0xcc},       {0xb9, 0x07, 0x3c, 0xcc},
936         {0xb9, 0x08, 0x3c, 0xcc},       {0xbc, 0x02, 0x18, 0xcc},
937         {0xbc, 0x03, 0x50, 0xcc},       {0xbc, 0x04, 0x18, 0xcc},
938         {0xbc, 0x05, 0x00, 0xcc},       {0xbc, 0x06, 0x00, 0xcc},
939         {0xbc, 0x08, 0x30, 0xcc},       {0xbc, 0x09, 0x40, 0xcc},
940         {0xbc, 0x0a, 0x10, 0xcc},       {0xbc, 0x0b, 0x00, 0xcc},
941         {0xbc, 0x0c, 0x00, 0xcc},       {0x00, 0x05, 0x00, 0xaa},
942         {0xb3, 0x5c, 0x00, 0xcc},       {0xb3, 0x01, 0x41, 0xcc},
943         {}
944 };
945
946 static const __u8 hv7131r_gamma[17] = {
947 /*      0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
948  *      0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff */
949         0x04, 0x1a, 0x36, 0x55, 0x6f, 0x87, 0x9d, 0xb0, 0xc1,
950         0xcf, 0xda, 0xe4, 0xec, 0xf3, 0xf8, 0xfd, 0xff
951 };
952 static const __u8 hv7131r_matrix[9] = {
953         0x5f, 0xec, 0xf5, 0xf1, 0x5a, 0xf5, 0xf1, 0xec, 0x63
954 };
955 static const __u8 hv7131r_initVGA_data[][4] = {
956         {0xb0, 0x4d, 0x00, 0xcc},       {0xb3, 0x01, 0x01, 0xcc},
957         {0x00, 0x00, 0x50, 0xdd},       {0xb0, 0x03, 0x01, 0xcc},
958         {0xb3, 0x00, 0x24, 0xcc},
959         {0xb3, 0x00, 0x25, 0xcc},       {0xb3, 0x08, 0x01, 0xcc},
960         {0xb3, 0x09, 0x0c, 0xcc},       {0xb3, 0x05, 0x00, 0xcc},
961         {0xb3, 0x06, 0x01, 0xcc},
962         {0xb3, 0x01, 0x45, 0xcc},       {0xb3, 0x03, 0x0b, 0xcc},
963         {0xb3, 0x04, 0x05, 0xcc},       {0xb3, 0x20, 0x00, 0xcc},
964         {0xb3, 0x21, 0x00, 0xcc},
965         {0xb3, 0x22, 0x01, 0xcc},       {0xb3, 0x23, 0xe0, 0xcc},
966         {0xb3, 0x14, 0x00, 0xcc},       {0xb3, 0x15, 0x00, 0xcc},
967         {0xb3, 0x16, 0x02, 0xcc},
968         {0xb3, 0x17, 0x7f, 0xcc},       {0xb3, 0x34, 0x01, 0xcc},
969         {0xb3, 0x35, 0x91, 0xcc},       {0xb3, 0x00, 0x27, 0xcc},
970         {0xbc, 0x00, 0x73, 0xcc},
971         {0xb8, 0x00, 0x23, 0xcc},       {0x00, 0x01, 0x0c, 0xaa},
972         {0x00, 0x14, 0x01, 0xaa},       {0x00, 0x15, 0xe6, 0xaa},
973         {0x00, 0x16, 0x02, 0xaa},
974         {0x00, 0x17, 0x86, 0xaa},       {0x00, 0x23, 0x00, 0xaa},
975         {0x00, 0x25, 0x09, 0xaa},       {0x00, 0x26, 0x27, 0xaa},
976         {0x00, 0x27, 0xc0, 0xaa},
977         {0xb8, 0x2c, 0x60, 0xcc},       {0xb8, 0x2d, 0xf8, 0xcc},
978         {0xb8, 0x2e, 0xf8, 0xcc},       {0xb8, 0x2f, 0xf8, 0xcc},
979         {0xb8, 0x30, 0x50, 0xcc},
980         {0xb8, 0x31, 0xf8, 0xcc},       {0xb8, 0x32, 0xf8, 0xcc},
981         {0xb8, 0x33, 0xf8, 0xcc},       {0xb8, 0x34, 0x65, 0xcc},
982         {0xb8, 0x35, 0x00, 0xcc},
983         {0xb8, 0x36, 0x00, 0xcc},       {0xb8, 0x37, 0x00, 0xcc},
984         {0xb8, 0x27, 0x20, 0xcc},       {0xb8, 0x01, 0x7d, 0xcc},
985         {0xb8, 0x81, 0x09, 0xcc},
986         {0xb3, 0x01, 0x41, 0xcc},       {0xb8, 0xfe, 0x00, 0xcc},
987         {0xb8, 0xff, 0x28, 0xcc},       {0xb9, 0x00, 0x28, 0xcc},
988         {0xb9, 0x01, 0x28, 0xcc},
989         {0xb9, 0x02, 0x28, 0xcc},       {0xb9, 0x03, 0x00, 0xcc},
990         {0xb9, 0x04, 0x00, 0xcc},       {0xb9, 0x05, 0x3c, 0xcc},
991         {0xb9, 0x06, 0x3c, 0xcc},
992         {0xb9, 0x07, 0x3c, 0xcc},       {0xb9, 0x08, 0x3c, 0xcc},
993         {0xb8, 0x8e, 0x00, 0xcc},       {0xb8, 0x8f, 0xff, 0xcc},
994         {0x00, 0x30, 0x18, 0xaa},
995         {}
996 };
997
998 static const __u8 hv7131r_initQVGA_data[][4] = {
999         {0xb0, 0x4d, 0x00, 0xcc},       {0xb3, 0x01, 0x01, 0xcc},
1000         {0x00, 0x00, 0x50, 0xdd},       {0xb0, 0x03, 0x01, 0xcc},
1001         {0xb3, 0x00, 0x24, 0xcc},
1002         {0xb3, 0x00, 0x25, 0xcc},       {0xb3, 0x08, 0x01, 0xcc},
1003         {0xb3, 0x09, 0x0c, 0xcc},       {0xb3, 0x05, 0x00, 0xcc},
1004         {0xb3, 0x06, 0x01, 0xcc},
1005         {0xb3, 0x03, 0x0b, 0xcc},       {0xb3, 0x04, 0x05, 0xcc},
1006         {0xb3, 0x20, 0x00, 0xcc},       {0xb3, 0x21, 0x00, 0xcc},
1007         {0xb3, 0x22, 0x01, 0xcc},
1008         {0xb3, 0x23, 0xe0, 0xcc},       {0xb3, 0x14, 0x00, 0xcc},
1009         {0xb3, 0x15, 0x00, 0xcc},       {0xb3, 0x16, 0x02, 0xcc},
1010         {0xb3, 0x17, 0x7f, 0xcc},
1011         {0xb3, 0x34, 0x01, 0xcc},       {0xb3, 0x35, 0x91, 0xcc},
1012         {0xb3, 0x00, 0x27, 0xcc},       {0xbc, 0x00, 0xd1, 0xcc},
1013         {0xb8, 0x00, 0x21, 0xcc},
1014         {0x00, 0x01, 0x0c, 0xaa},       {0x00, 0x14, 0x01, 0xaa},
1015         {0x00, 0x15, 0xe6, 0xaa},       {0x00, 0x16, 0x02, 0xaa},
1016         {0x00, 0x17, 0x86, 0xaa},
1017         {0x00, 0x23, 0x00, 0xaa},       {0x00, 0x25, 0x01, 0xaa},
1018         {0x00, 0x26, 0xd4, 0xaa},       {0x00, 0x27, 0xc0, 0xaa},
1019         {0xbc, 0x02, 0x08, 0xcc},
1020         {0xbc, 0x03, 0x70, 0xcc},       {0xbc, 0x04, 0x08, 0xcc},
1021         {0xbc, 0x05, 0x00, 0xcc},       {0xbc, 0x06, 0x00, 0xcc},
1022         {0xbc, 0x08, 0x3c, 0xcc},
1023         {0xbc, 0x09, 0x40, 0xcc},       {0xbc, 0x0a, 0x04, 0xcc},
1024         {0xbc, 0x0b, 0x00, 0xcc},       {0xbc, 0x0c, 0x00, 0xcc},
1025         {0xb8, 0xfe, 0x02, 0xcc},
1026         {0xb8, 0xff, 0x07, 0xcc},       {0xb9, 0x00, 0x14, 0xcc},
1027         {0xb9, 0x01, 0x14, 0xcc},       {0xb9, 0x02, 0x14, 0xcc},
1028         {0xb9, 0x03, 0x00, 0xcc},
1029         {0xb9, 0x04, 0x02, 0xcc},       {0xb9, 0x05, 0x05, 0xcc},
1030         {0xb9, 0x06, 0x0f, 0xcc},       {0xb9, 0x07, 0x0f, 0xcc},
1031         {0xb9, 0x08, 0x0f, 0xcc},
1032         {0xb8, 0x2c, 0x60, 0xcc},       {0xb8, 0x2d, 0xf8, 0xcc},
1033         {0xb8, 0x2e, 0xf8, 0xcc},       {0xb8, 0x2f, 0xf8, 0xcc},
1034         {0xb8, 0x30, 0x50, 0xcc},
1035         {0xb8, 0x31, 0xf8, 0xcc},       {0xb8, 0x32, 0xf8, 0xcc},
1036         {0xb8, 0x33, 0xf8, 0xcc},
1037         {0xb8, 0x34, 0x65, 0xcc},       {0xb8, 0x35, 0x00, 0xcc},
1038         {0xb8, 0x36, 0x00, 0xcc},       {0xb8, 0x37, 0x00, 0xcc},
1039         {0xb8, 0x27, 0x20, 0xcc},
1040         {0xb8, 0x01, 0x7d, 0xcc},       {0xb8, 0x81, 0x09, 0xcc},
1041         {0xb3, 0x01, 0x41, 0xcc},       {0xb8, 0xfe, 0x00, 0xcc},
1042         {0xb8, 0xff, 0x28, 0xcc},
1043         {0xb9, 0x00, 0x28, 0xcc},       {0xb9, 0x01, 0x28, 0xcc},
1044         {0xb9, 0x02, 0x28, 0xcc},       {0xb9, 0x03, 0x00, 0xcc},
1045         {0xb9, 0x04, 0x00, 0xcc},
1046         {0xb9, 0x05, 0x3c, 0xcc},       {0xb9, 0x06, 0x3c, 0xcc},
1047         {0xb9, 0x07, 0x3c, 0xcc},       {0xb9, 0x08, 0x3c, 0xcc},
1048         {0xb8, 0x8e, 0x00, 0xcc},
1049         {0xb8, 0x8f, 0xff, 0xcc},       {0x00, 0x30, 0x18, 0xaa},
1050         {}
1051 };
1052
1053 static const __u8 ov7660_gamma[17] = {
1054         0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
1055         0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
1056 };
1057 static const __u8 ov7660_matrix[9] = {
1058         0x5a, 0xf0, 0xf6, 0xf3, 0x57, 0xf6, 0xf3, 0xef, 0x62
1059 };
1060 static const __u8 ov7660_initVGA_data[][4] = {
1061         {0xb0, 0x4d, 0x00, 0xcc},       {0xb3, 0x01, 0x01, 0xcc},
1062         {0x00, 0x00, 0x50, 0xdd},
1063         {0xb0, 0x03, 0x01, 0xcc},
1064         {0xb3, 0x00, 0x21, 0xcc},       {0xb3, 0x00, 0x26, 0xcc},
1065         {0xb3, 0x05, 0x01, 0xcc},
1066         {0xb3, 0x06, 0x03, 0xcc},
1067         {0xb3, 0x03, 0x1f, 0xcc},       {0xb3, 0x04, 0x05, 0xcc},
1068         {0xb3, 0x05, 0x00, 0xcc},
1069         {0xb3, 0x06, 0x01, 0xcc},
1070         {0xb3, 0x15, 0x00, 0xcc},/* 0xb315  <-0 href startl */
1071         {0xb3, 0x16, 0x02, 0xcc},       {0xb3, 0x17, 0x7f, 0xcc},
1072         {0xb3, 0x21, 0x00, 0xcc},
1073         {0xb3, 0x23, 0xe0, 0xcc},       {0xb3, 0x1d, 0x01, 0xcc},
1074         {0xb3, 0x1f, 0x02, 0xcc},
1075         {0xb3, 0x34, 0x01, 0xcc},
1076         {0xb3, 0x35, 0xa1, 0xcc},       {0xb3, 0x00, 0x26, 0xcc},
1077         {0xb8, 0x00, 0x33, 0xcc}, /* 13 */
1078         {0xb8, 0x01, 0x7d, 0xcc},
1079         {0xbc, 0x00, 0x73, 0xcc},       {0xb8, 0x81, 0x09, 0xcc},
1080         {0xb8, 0x27, 0x20, 0xcc},
1081         {0xb8, 0x8f, 0x50, 0xcc},
1082         {0x00, 0x01, 0x80, 0xaa},       {0x00, 0x02, 0x80, 0xaa},
1083         {0x00, 0x12, 0x80, 0xaa},
1084         {0x00, 0x12, 0x05, 0xaa},
1085         {0x00, 0x1e, 0x01, 0xaa},       /* MVFP */
1086         {0x00, 0x3d, 0x40, 0xaa}, /* 0x3d <-40 gamma 01 */
1087         {0x00, 0x41, 0x00, 0xaa}, /* edge 00 */
1088         {0x00, 0x0d, 0x48, 0xaa},       {0x00, 0x0e, 0x04, 0xaa},
1089         {0x00, 0x13, 0xa7, 0xaa},
1090         {0x00, 0x40, 0xc1, 0xaa},       {0x00, 0x35, 0x00, 0xaa},
1091         {0x00, 0x36, 0x00, 0xaa},
1092         {0x00, 0x3c, 0x68, 0xaa},       {0x00, 0x1b, 0x05, 0xaa},
1093         {0x00, 0x39, 0x43, 0xaa},
1094         {0x00, 0x8d, 0xcf, 0xaa},
1095         {0x00, 0x8b, 0xcc, 0xaa},       {0x00, 0x8c, 0xcc, 0xaa},
1096         {0x00, 0x0f, 0x62, 0xaa},
1097         {0x00, 0x35, 0x84, 0xaa},
1098         {0x00, 0x3b, 0x08, 0xaa}, /* 0 * Nightframe 1/4 + 50Hz -> 0xC8 */
1099         {0x00, 0x3a, 0x00, 0xaa}, /* mx change yuyv format 00, 04, 01; 08, 0c*/
1100         {0x00, 0x14, 0x2a, 0xaa}, /* agc ampli */
1101         {0x00, 0x9e, 0x40, 0xaa},       {0xb8, 0x8f, 0x50, 0xcc},
1102         {0x00, 0x01, 0x80, 0xaa},
1103         {0x00, 0x02, 0x80, 0xaa},
1104         {0xb8, 0xfe, 0x00, 0xcc},       {0xb8, 0xff, 0x28, 0xcc},
1105         {0xb9, 0x00, 0x28, 0xcc},
1106         {0xb9, 0x01, 0x28, 0xcc},       {0xb9, 0x02, 0x28, 0xcc},
1107         {0xb9, 0x03, 0x00, 0xcc},
1108         {0xb9, 0x04, 0x00, 0xcc},
1109         {0xb9, 0x05, 0x3c, 0xcc},       {0xb9, 0x06, 0x3c, 0xcc},
1110         {0xb9, 0x07, 0x3c, 0xcc},
1111         {0xb9, 0x08, 0x3c, 0xcc},
1112
1113         {0xb8, 0x8e, 0x00, 0xcc},       {0xb8, 0x8f, 0xff, 0xcc},
1114
1115         {0x00, 0x29, 0x3c, 0xaa},       {0xb3, 0x01, 0x45, 0xcc},
1116         {}
1117 };
1118 static const __u8 ov7660_initQVGA_data[][4] = {
1119         {0xb0, 0x4d, 0x00, 0xcc},       {0xb3, 0x01, 0x01, 0xcc},
1120         {0x00, 0x00, 0x50, 0xdd},       {0xb0, 0x03, 0x01, 0xcc},
1121         {0xb3, 0x00, 0x21, 0xcc},       {0xb3, 0x00, 0x26, 0xcc},
1122         {0xb3, 0x05, 0x01, 0xcc},       {0xb3, 0x06, 0x03, 0xcc},
1123         {0xb3, 0x03, 0x1f, 0xcc},       {0xb3, 0x04, 0x05, 0xcc},
1124         {0xb3, 0x05, 0x00, 0xcc},       {0xb3, 0x06, 0x01, 0xcc},
1125         {0xb3, 0x15, 0x00, 0xcc},/* 0xb315  <-0 href startl */
1126         {0xb3, 0x16, 0x02, 0xcc},       {0xb3, 0x17, 0x7f, 0xcc},
1127         {0xb3, 0x21, 0x00, 0xcc},
1128         {0xb3, 0x23, 0xe0, 0xcc},       {0xb3, 0x1d, 0x01, 0xcc},
1129         {0xb3, 0x1f, 0x02, 0xcc},       {0xb3, 0x34, 0x01, 0xcc},
1130         {0xb3, 0x35, 0xa1, 0xcc},       {0xb3, 0x00, 0x26, 0xcc},
1131         {0xb8, 0x00, 0x33, 0xcc}, /* 13 */
1132         {0xb8, 0x01, 0x7d, 0xcc},
1133 /* sizer */
1134         {0xbc, 0x00, 0xd3, 0xcc},
1135         {0xb8, 0x81, 0x09, 0xcc},       {0xb8, 0x81, 0x09, 0xcc},
1136         {0xb8, 0x27, 0x20, 0xcc},       {0xb8, 0x8f, 0x50, 0xcc},
1137         {0x00, 0x01, 0x80, 0xaa},       {0x00, 0x02, 0x80, 0xaa},
1138         {0x00, 0x12, 0x80, 0xaa},       {0x00, 0x12, 0x05, 0xaa},
1139         {0x00, 0x1e, 0x01, 0xaa},       /* MVFP */
1140         {0x00, 0x3d, 0x40, 0xaa}, /* 0x3d <-40 gamma 01 */
1141         {0x00, 0x41, 0x00, 0xaa}, /* edge 00 */
1142         {0x00, 0x0d, 0x48, 0xaa},       {0x00, 0x0e, 0x04, 0xaa},
1143         {0x00, 0x13, 0xa7, 0xaa},
1144         {0x00, 0x40, 0xc1, 0xaa},       {0x00, 0x35, 0x00, 0xaa},
1145         {0x00, 0x36, 0x00, 0xaa},
1146         {0x00, 0x3c, 0x68, 0xaa},       {0x00, 0x1b, 0x05, 0xaa},
1147         {0x00, 0x39, 0x43, 0xaa},       {0x00, 0x8d, 0xcf, 0xaa},
1148         {0x00, 0x8b, 0xcc, 0xaa},       {0x00, 0x8c, 0xcc, 0xaa},
1149         {0x00, 0x0f, 0x62, 0xaa},       {0x00, 0x35, 0x84, 0xaa},
1150         {0x00, 0x3b, 0x08, 0xaa}, /* 0  * Nightframe 1/4 + 50Hz -> 0xC8 */
1151         {0x00, 0x3a, 0x00, 0xaa}, /* mx change yuyv format 00, 04, 01; 08, 0c*/
1152         {0x00, 0x14, 0x2a, 0xaa}, /* agc ampli */
1153         {0x00, 0x9e, 0x40, 0xaa},       {0xb8, 0x8f, 0x50, 0xcc},
1154         {0x00, 0x01, 0x80, 0xaa},
1155         {0x00, 0x02, 0x80, 0xaa},
1156 /* sizer filters */
1157         {0xbc, 0x02, 0x08, 0xcc},
1158         {0xbc, 0x03, 0x70, 0xcc},
1159         {0xb8, 0x35, 0x00, 0xcc},
1160         {0xb8, 0x36, 0x00, 0xcc},
1161         {0xb8, 0x37, 0x00, 0xcc},
1162         {0xbc, 0x04, 0x08, 0xcc},
1163         {0xbc, 0x05, 0x00, 0xcc},
1164         {0xbc, 0x06, 0x00, 0xcc},
1165         {0xbc, 0x08, 0x3c, 0xcc},
1166         {0xbc, 0x09, 0x40, 0xcc},
1167         {0xbc, 0x0a, 0x04, 0xcc},
1168         {0xbc, 0x0b, 0x00, 0xcc},
1169         {0xbc, 0x0c, 0x00, 0xcc},
1170 /* */
1171         {0xb8, 0xfe, 0x00, 0xcc},
1172         {0xb8, 0xff, 0x28, 0xcc},
1173 /* */
1174         {0xb9, 0x00, 0x28, 0xcc},       {0xb9, 0x01, 0x28, 0xcc},
1175         {0xb9, 0x02, 0x28, 0xcc},       {0xb9, 0x03, 0x00, 0xcc},
1176         {0xb9, 0x04, 0x00, 0xcc},       {0xb9, 0x05, 0x3c, 0xcc},
1177         {0xb9, 0x06, 0x3c, 0xcc},       {0xb9, 0x07, 0x3c, 0xcc},
1178         {0xb9, 0x08, 0x3c, 0xcc},
1179 /* */
1180         {0xb8, 0x8e, 0x00, 0xcc},
1181         {0xb8, 0x8f, 0xff, 0xcc}, /* ff */
1182         {0x00, 0x29, 0x3c, 0xaa},
1183         {0xb3, 0x01, 0x45, 0xcc}, /* 45 */
1184         {}
1185 };
1186
1187 static const __u8 ov7660_50HZ[][4] = {
1188         {0x00, 0x3b, 0x08, 0xaa},
1189         {0x00, 0x9d, 0x40, 0xaa},
1190         {0x00, 0x13, 0xa7, 0xaa},
1191         {}
1192 };
1193
1194 static const __u8 ov7660_60HZ[][4] = {
1195         {0x00, 0x3b, 0x00, 0xaa},
1196         {0x00, 0x9e, 0x40, 0xaa},
1197         {0x00, 0x13, 0xa7, 0xaa},
1198         {}
1199 };
1200
1201 static const __u8 ov7660_NoFliker[][4] = {
1202         {0x00, 0x13, 0x87, 0xaa},
1203         {}
1204 };
1205
1206 static const __u8 ov7670_initVGA_JPG[][4] = {
1207         {0xb3, 0x01, 0x05, 0xcc},
1208         {0x00, 0x00, 0x30, 0xdd},       {0xb0, 0x03, 0x19, 0xcc},
1209         {0x00, 0x00, 0x10, 0xdd},
1210         {0xb0, 0x04, 0x02, 0xcc},       {0x00, 0x00, 0x10, 0xdd},
1211         {0xb3, 0x00, 0x66, 0xcc},       {0xb3, 0x00, 0x67, 0xcc},
1212         {0xb3, 0x35, 0xa1, 0xcc},       {0xb3, 0x34, 0x01, 0xcc},
1213         {0xb3, 0x05, 0x01, 0xcc},       {0xb3, 0x06, 0x01, 0xcc},
1214         {0xb3, 0x08, 0x01, 0xcc},       {0xb3, 0x09, 0x0c, 0xcc},
1215         {0xb3, 0x02, 0x02, 0xcc},       {0xb3, 0x03, 0x1f, 0xcc},
1216         {0xb3, 0x14, 0x00, 0xcc},       {0xb3, 0x15, 0x00, 0xcc},
1217         {0xb3, 0x16, 0x02, 0xcc},       {0xb3, 0x17, 0x7f, 0xcc},
1218         {0xb3, 0x04, 0x05, 0xcc},       {0xb3, 0x20, 0x00, 0xcc},
1219         {0xb3, 0x21, 0x00, 0xcc},       {0xb3, 0x22, 0x01, 0xcc},
1220         {0xb3, 0x23, 0xe0, 0xcc},       {0xbc, 0x00, 0x41, 0xcc},
1221         {0xbc, 0x01, 0x01, 0xcc},       {0x00, 0x12, 0x80, 0xaa},
1222         {0x00, 0x00, 0x20, 0xdd},       {0x00, 0x12, 0x00, 0xaa},
1223         {0x00, 0x11, 0x40, 0xaa},       {0x00, 0x6b, 0x0a, 0xaa},
1224         {0x00, 0x3a, 0x04, 0xaa},       {0x00, 0x40, 0xc0, 0xaa},
1225         {0x00, 0x8c, 0x00, 0xaa},       {0x00, 0x7a, 0x29, 0xaa},
1226         {0x00, 0x7b, 0x0e, 0xaa},       {0x00, 0x7c, 0x1a, 0xaa},
1227         {0x00, 0x7d, 0x31, 0xaa},       {0x00, 0x7e, 0x53, 0xaa},
1228         {0x00, 0x7f, 0x60, 0xaa},       {0x00, 0x80, 0x6b, 0xaa},
1229         {0x00, 0x81, 0x73, 0xaa},       {0x00, 0x82, 0x7b, 0xaa},
1230         {0x00, 0x83, 0x82, 0xaa},       {0x00, 0x84, 0x89, 0xaa},
1231         {0x00, 0x85, 0x96, 0xaa},       {0x00, 0x86, 0xa1, 0xaa},
1232         {0x00, 0x87, 0xb7, 0xaa},       {0x00, 0x88, 0xcc, 0xaa},
1233         {0x00, 0x89, 0xe1, 0xaa},       {0x00, 0x13, 0xe0, 0xaa},
1234         {0x00, 0x00, 0x00, 0xaa},       {0x00, 0x10, 0x00, 0xaa},
1235         {0x00, 0x0d, 0x40, 0xaa},       {0x00, 0x14, 0x28, 0xaa},
1236         {0x00, 0xa5, 0x05, 0xaa},       {0x00, 0xab, 0x07, 0xaa},
1237         {0x00, 0x24, 0x95, 0xaa},       {0x00, 0x25, 0x33, 0xaa},
1238         {0x00, 0x26, 0xe3, 0xaa},       {0x00, 0x9f, 0x88, 0xaa},
1239         {0x00, 0xa0, 0x78, 0xaa},       {0x00, 0x55, 0x90, 0xaa},
1240         {0x00, 0xa1, 0x03, 0xaa},       {0x00, 0xa6, 0xe0, 0xaa},
1241         {0x00, 0xa7, 0xd8, 0xaa},       {0x00, 0xa8, 0xf0, 0xaa},
1242         {0x00, 0xa9, 0x90, 0xaa},       {0x00, 0xaa, 0x14, 0xaa},
1243         {0x00, 0x13, 0xe5, 0xaa},       {0x00, 0x0e, 0x61, 0xaa},
1244         {0x00, 0x0f, 0x4b, 0xaa},       {0x00, 0x16, 0x02, 0xaa},
1245         {0x00, 0x1e, 0x07, 0xaa},       /* MVFP */
1246         {0x00, 0x21, 0x02, 0xaa},
1247         {0x00, 0x22, 0x91, 0xaa},       {0x00, 0x29, 0x07, 0xaa},
1248         {0x00, 0x33, 0x0b, 0xaa},       {0x00, 0x35, 0x0b, 0xaa},
1249         {0x00, 0x37, 0x1d, 0xaa},       {0x00, 0x38, 0x71, 0xaa},
1250         {0x00, 0x39, 0x2a, 0xaa},       {0x00, 0x3c, 0x78, 0xaa},
1251         {0x00, 0x4d, 0x40, 0xaa},       {0x00, 0x4e, 0x20, 0xaa},
1252         {0x00, 0x74, 0x19, 0xaa},       {0x00, 0x8d, 0x4f, 0xaa},
1253         {0x00, 0x8e, 0x00, 0xaa},       {0x00, 0x8f, 0x00, 0xaa},
1254         {0x00, 0x90, 0x00, 0xaa},       {0x00, 0x91, 0x00, 0xaa},
1255         {0x00, 0x96, 0x00, 0xaa},       {0x00, 0x9a, 0x80, 0xaa},
1256         {0x00, 0xb0, 0x84, 0xaa},       {0x00, 0xb1, 0x0c, 0xaa},
1257         {0x00, 0xb2, 0x0e, 0xaa},       {0x00, 0xb3, 0x82, 0xaa},
1258         {0x00, 0xb8, 0x0a, 0xaa},       {0x00, 0x43, 0x14, 0xaa},
1259         {0x00, 0x44, 0xf0, 0xaa},       {0x00, 0x45, 0x45, 0xaa},
1260         {0x00, 0x46, 0x63, 0xaa},       {0x00, 0x47, 0x2d, 0xaa},
1261         {0x00, 0x48, 0x46, 0xaa},       {0x00, 0x59, 0x88, 0xaa},
1262         {0x00, 0x5a, 0xa0, 0xaa},       {0x00, 0x5b, 0xc6, 0xaa},
1263         {0x00, 0x5c, 0x7d, 0xaa},       {0x00, 0x5d, 0x5f, 0xaa},
1264         {0x00, 0x5e, 0x19, 0xaa},       {0x00, 0x6c, 0x0a, 0xaa},
1265         {0x00, 0x6d, 0x55, 0xaa},       {0x00, 0x6e, 0x11, 0xaa},
1266         {0x00, 0x6f, 0x9e, 0xaa},       {0x00, 0x69, 0x00, 0xaa},
1267         {0x00, 0x6a, 0x40, 0xaa},       {0x00, 0x01, 0x40, 0xaa},
1268         {0x00, 0x02, 0x40, 0xaa},       {0x00, 0x13, 0xe7, 0xaa},
1269         {0x00, 0x5f, 0xf0, 0xaa},       {0x00, 0x60, 0xf0, 0xaa},
1270         {0x00, 0x61, 0xf0, 0xaa},       {0x00, 0x27, 0xa0, 0xaa},
1271         {0x00, 0x28, 0x80, 0xaa},       {0x00, 0x2c, 0x90, 0xaa},
1272         {0x00, 0x4f, 0x66, 0xaa},       {0x00, 0x50, 0x66, 0xaa},
1273         {0x00, 0x51, 0x00, 0xaa},       {0x00, 0x52, 0x22, 0xaa},
1274         {0x00, 0x53, 0x5e, 0xaa},       {0x00, 0x54, 0x80, 0xaa},
1275         {0x00, 0x58, 0x9e, 0xaa},       {0x00, 0x41, 0x08, 0xaa},
1276         {0x00, 0x3f, 0x00, 0xaa},       {0x00, 0x75, 0x85, 0xaa},
1277         {0x00, 0x76, 0xe1, 0xaa},       {0x00, 0x4c, 0x00, 0xaa},
1278         {0x00, 0x77, 0x0a, 0xaa},       {0x00, 0x3d, 0x88, 0xaa},
1279         {0x00, 0x4b, 0x09, 0xaa},       {0x00, 0xc9, 0x60, 0xaa},
1280         {0x00, 0x41, 0x38, 0xaa},       {0x00, 0x62, 0x30, 0xaa},
1281         {0x00, 0x63, 0x30, 0xaa},       {0x00, 0x64, 0x08, 0xaa},
1282         {0x00, 0x94, 0x07, 0xaa},       {0x00, 0x95, 0x0b, 0xaa},
1283         {0x00, 0x65, 0x00, 0xaa},       {0x00, 0x66, 0x05, 0xaa},
1284         {0x00, 0x56, 0x50, 0xaa},       {0x00, 0x34, 0x11, 0xaa},
1285         {0x00, 0xa4, 0x88, 0xaa},       {0x00, 0x96, 0x00, 0xaa},
1286         {0x00, 0x97, 0x30, 0xaa},       {0x00, 0x98, 0x20, 0xaa},
1287         {0x00, 0x99, 0x30, 0xaa},       {0x00, 0x9a, 0x84, 0xaa},
1288         {0x00, 0x9b, 0x29, 0xaa},       {0x00, 0x9c, 0x03, 0xaa},
1289         {0x00, 0x78, 0x04, 0xaa},       {0x00, 0x79, 0x01, 0xaa},
1290         {0x00, 0xc8, 0xf0, 0xaa},       {0x00, 0x79, 0x0f, 0xaa},
1291         {0x00, 0xc8, 0x00, 0xaa},       {0x00, 0x79, 0x10, 0xaa},
1292         {0x00, 0xc8, 0x7e, 0xaa},       {0x00, 0x79, 0x0a, 0xaa},
1293         {0x00, 0xc8, 0x80, 0xaa},       {0x00, 0x79, 0x0b, 0xaa},
1294         {0x00, 0xc8, 0x01, 0xaa},       {0x00, 0x79, 0x0c, 0xaa},
1295         {0x00, 0xc8, 0x0f, 0xaa},       {0x00, 0x79, 0x0d, 0xaa},
1296         {0x00, 0xc8, 0x20, 0xaa},       {0x00, 0x79, 0x09, 0xaa},
1297         {0x00, 0xc8, 0x80, 0xaa},       {0x00, 0x79, 0x02, 0xaa},
1298         {0x00, 0xc8, 0xc0, 0xaa},       {0x00, 0x79, 0x03, 0xaa},
1299         {0x00, 0xc8, 0x40, 0xaa},       {0x00, 0x79, 0x05, 0xaa},
1300         {0x00, 0xc8, 0x30, 0xaa},       {0x00, 0x79, 0x26, 0xaa},
1301         {0x00, 0x11, 0x40, 0xaa},       {0x00, 0x3a, 0x04, 0xaa},
1302         {0x00, 0x12, 0x00, 0xaa},       {0x00, 0x40, 0xc0, 0xaa},
1303         {0x00, 0x8c, 0x00, 0xaa},       {0x00, 0x17, 0x14, 0xaa},
1304         {0x00, 0x18, 0x02, 0xaa},       {0x00, 0x32, 0x92, 0xaa},
1305         {0x00, 0x19, 0x02, 0xaa},       {0x00, 0x1a, 0x7a, 0xaa},
1306         {0x00, 0x03, 0x0a, 0xaa},       {0x00, 0x0c, 0x00, 0xaa},
1307         {0x00, 0x3e, 0x00, 0xaa},       {0x00, 0x70, 0x3a, 0xaa},
1308         {0x00, 0x71, 0x35, 0xaa},       {0x00, 0x72, 0x11, 0xaa},
1309         {0x00, 0x73, 0xf0, 0xaa},       {0x00, 0xa2, 0x02, 0xaa},
1310         {0x00, 0xb1, 0x00, 0xaa},       {0x00, 0xb1, 0x0c, 0xaa},
1311         {0x00, 0x1e, 0x37, 0xaa},       /* MVFP */
1312         {0x00, 0xaa, 0x14, 0xaa},
1313         {0x00, 0x24, 0x80, 0xaa},       {0x00, 0x25, 0x74, 0xaa},
1314         {0x00, 0x26, 0xd3, 0xaa},       {0x00, 0x0d, 0x00, 0xaa},
1315         {0x00, 0x14, 0x18, 0xaa},       {0x00, 0x9d, 0x99, 0xaa},
1316         {0x00, 0x9e, 0x7f, 0xaa},       {0x00, 0x64, 0x08, 0xaa},
1317         {0x00, 0x94, 0x07, 0xaa},       {0x00, 0x95, 0x06, 0xaa},
1318         {0x00, 0x66, 0x05, 0xaa},       {0x00, 0x41, 0x08, 0xaa},
1319         {0x00, 0x3f, 0x00, 0xaa},       {0x00, 0x75, 0x07, 0xaa},
1320         {0x00, 0x76, 0xe1, 0xaa},       {0x00, 0x4c, 0x00, 0xaa},
1321         {0x00, 0x77, 0x00, 0xaa},       {0x00, 0x3d, 0xc2, 0xaa},
1322         {0x00, 0x4b, 0x09, 0xaa},       {0x00, 0xc9, 0x60, 0xaa},
1323         {0x00, 0x41, 0x38, 0xaa},       {0xb6, 0x00, 0x00, 0xcc},
1324         {0xb6, 0x03, 0x02, 0xcc},       {0xb6, 0x02, 0x80, 0xcc},
1325         {0xb6, 0x05, 0x01, 0xcc},       {0xb6, 0x04, 0xe0, 0xcc},
1326         {0xb6, 0x12, 0xf8, 0xcc},       {0xb6, 0x13, 0x13, 0xcc},
1327         {0xb6, 0x18, 0x02, 0xcc},       {0xb6, 0x17, 0x58, 0xcc},
1328         {0xb6, 0x16, 0x00, 0xcc},       {0xb6, 0x22, 0x12, 0xcc},
1329         {0xb6, 0x23, 0x0b, 0xcc},       {0xbf, 0xc0, 0x39, 0xcc},
1330         {0xbf, 0xc1, 0x04, 0xcc},       {0xbf, 0xcc, 0x00, 0xcc},
1331         {0xb3, 0x5c, 0x01, 0xcc},       {0xb3, 0x01, 0x45, 0xcc},
1332         {0x00, 0x77, 0x05, 0xaa},
1333         {},
1334 };
1335
1336 static const __u8 ov7670_initQVGA_JPG[][4] = {
1337         {0xb3, 0x01, 0x05, 0xcc},       {0x00, 0x00, 0x30, 0xdd},
1338         {0xb0, 0x03, 0x19, 0xcc},       {0x00, 0x00, 0x10, 0xdd},
1339         {0xb0, 0x04, 0x02, 0xcc},       {0x00, 0x00, 0x10, 0xdd},
1340         {0xb3, 0x00, 0x66, 0xcc},       {0xb3, 0x00, 0x67, 0xcc},
1341         {0xb3, 0x35, 0xa1, 0xcc},       {0xb3, 0x34, 0x01, 0xcc},
1342         {0xb3, 0x05, 0x01, 0xcc},       {0xb3, 0x06, 0x01, 0xcc},
1343         {0xb3, 0x08, 0x01, 0xcc},       {0xb3, 0x09, 0x0c, 0xcc},
1344         {0xb3, 0x02, 0x02, 0xcc},       {0xb3, 0x03, 0x1f, 0xcc},
1345         {0xb3, 0x14, 0x00, 0xcc},       {0xb3, 0x15, 0x00, 0xcc},
1346         {0xb3, 0x16, 0x02, 0xcc},       {0xb3, 0x17, 0x7f, 0xcc},
1347         {0xb3, 0x04, 0x05, 0xcc},       {0xb3, 0x20, 0x00, 0xcc},
1348         {0xb3, 0x21, 0x00, 0xcc},       {0xb3, 0x22, 0x01, 0xcc},
1349         {0xb3, 0x23, 0xe0, 0xcc},       {0xbc, 0x00, 0xd1, 0xcc},
1350         {0xbc, 0x01, 0x01, 0xcc},       {0x00, 0x12, 0x80, 0xaa},
1351         {0x00, 0x00, 0x20, 0xdd},       {0x00, 0x12, 0x00, 0xaa},
1352         {0x00, 0x11, 0x40, 0xaa},       {0x00, 0x6b, 0x0a, 0xaa},
1353         {0x00, 0x3a, 0x04, 0xaa},       {0x00, 0x40, 0xc0, 0xaa},
1354         {0x00, 0x8c, 0x00, 0xaa},       {0x00, 0x7a, 0x29, 0xaa},
1355         {0x00, 0x7b, 0x0e, 0xaa},       {0x00, 0x7c, 0x1a, 0xaa},
1356         {0x00, 0x7d, 0x31, 0xaa},       {0x00, 0x7e, 0x53, 0xaa},
1357         {0x00, 0x7f, 0x60, 0xaa},       {0x00, 0x80, 0x6b, 0xaa},
1358         {0x00, 0x81, 0x73, 0xaa},       {0x00, 0x82, 0x7b, 0xaa},
1359         {0x00, 0x83, 0x82, 0xaa},       {0x00, 0x84, 0x89, 0xaa},
1360         {0x00, 0x85, 0x96, 0xaa},       {0x00, 0x86, 0xa1, 0xaa},
1361         {0x00, 0x87, 0xb7, 0xaa},       {0x00, 0x88, 0xcc, 0xaa},
1362         {0x00, 0x89, 0xe1, 0xaa},       {0x00, 0x13, 0xe0, 0xaa},
1363         {0x00, 0x00, 0x00, 0xaa},       {0x00, 0x10, 0x00, 0xaa},
1364         {0x00, 0x0d, 0x40, 0xaa},       {0x00, 0x14, 0x28, 0xaa},
1365         {0x00, 0xa5, 0x05, 0xaa},       {0x00, 0xab, 0x07, 0xaa},
1366         {0x00, 0x24, 0x95, 0xaa},       {0x00, 0x25, 0x33, 0xaa},
1367         {0x00, 0x26, 0xe3, 0xaa},       {0x00, 0x9f, 0x88, 0xaa},
1368         {0x00, 0xa0, 0x78, 0xaa},       {0x00, 0x55, 0x90, 0xaa},
1369         {0x00, 0xa1, 0x03, 0xaa},       {0x00, 0xa6, 0xe0, 0xaa},
1370         {0x00, 0xa7, 0xd8, 0xaa},       {0x00, 0xa8, 0xf0, 0xaa},
1371         {0x00, 0xa9, 0x90, 0xaa},       {0x00, 0xaa, 0x14, 0xaa},
1372         {0x00, 0x13, 0xe5, 0xaa},       {0x00, 0x0e, 0x61, 0xaa},
1373         {0x00, 0x0f, 0x4b, 0xaa},       {0x00, 0x16, 0x02, 0xaa},
1374         {0x00, 0x1e, 0x07, 0xaa},       /* MVFP */
1375         {0x00, 0x21, 0x02, 0xaa},
1376         {0x00, 0x22, 0x91, 0xaa},       {0x00, 0x29, 0x07, 0xaa},
1377         {0x00, 0x33, 0x0b, 0xaa},       {0x00, 0x35, 0x0b, 0xaa},
1378         {0x00, 0x37, 0x1d, 0xaa},       {0x00, 0x38, 0x71, 0xaa},
1379         {0x00, 0x39, 0x2a, 0xaa},       {0x00, 0x3c, 0x78, 0xaa},
1380         {0x00, 0x4d, 0x40, 0xaa},       {0x00, 0x4e, 0x20, 0xaa},
1381         {0x00, 0x74, 0x19, 0xaa},       {0x00, 0x8d, 0x4f, 0xaa},
1382         {0x00, 0x8e, 0x00, 0xaa},       {0x00, 0x8f, 0x00, 0xaa},
1383         {0x00, 0x90, 0x00, 0xaa},       {0x00, 0x91, 0x00, 0xaa},
1384         {0x00, 0x96, 0x00, 0xaa},       {0x00, 0x9a, 0x80, 0xaa},
1385         {0x00, 0xb0, 0x84, 0xaa},       {0x00, 0xb1, 0x0c, 0xaa},
1386         {0x00, 0xb2, 0x0e, 0xaa},       {0x00, 0xb3, 0x82, 0xaa},
1387         {0x00, 0xb8, 0x0a, 0xaa},       {0x00, 0x43, 0x14, 0xaa},
1388         {0x00, 0x44, 0xf0, 0xaa},       {0x00, 0x45, 0x45, 0xaa},
1389         {0x00, 0x46, 0x63, 0xaa},       {0x00, 0x47, 0x2d, 0xaa},
1390         {0x00, 0x48, 0x46, 0xaa},       {0x00, 0x59, 0x88, 0xaa},
1391         {0x00, 0x5a, 0xa0, 0xaa},       {0x00, 0x5b, 0xc6, 0xaa},
1392         {0x00, 0x5c, 0x7d, 0xaa},       {0x00, 0x5d, 0x5f, 0xaa},
1393         {0x00, 0x5e, 0x19, 0xaa},       {0x00, 0x6c, 0x0a, 0xaa},
1394         {0x00, 0x6d, 0x55, 0xaa},       {0x00, 0x6e, 0x11, 0xaa},
1395         {0x00, 0x6f, 0x9e, 0xaa},       {0x00, 0x69, 0x00, 0xaa},
1396         {0x00, 0x6a, 0x40, 0xaa},       {0x00, 0x01, 0x40, 0xaa},
1397         {0x00, 0x02, 0x40, 0xaa},       {0x00, 0x13, 0xe7, 0xaa},
1398         {0x00, 0x5f, 0xf0, 0xaa},       {0x00, 0x60, 0xf0, 0xaa},
1399         {0x00, 0x61, 0xf0, 0xaa},       {0x00, 0x27, 0xa0, 0xaa},
1400         {0x00, 0x28, 0x80, 0xaa},       {0x00, 0x2c, 0x90, 0xaa},
1401         {0x00, 0x4f, 0x66, 0xaa},       {0x00, 0x50, 0x66, 0xaa},
1402         {0x00, 0x51, 0x00, 0xaa},       {0x00, 0x52, 0x22, 0xaa},
1403         {0x00, 0x53, 0x5e, 0xaa},       {0x00, 0x54, 0x80, 0xaa},
1404         {0x00, 0x58, 0x9e, 0xaa},       {0x00, 0x41, 0x08, 0xaa},
1405         {0x00, 0x3f, 0x00, 0xaa},       {0x00, 0x75, 0x85, 0xaa},
1406         {0x00, 0x76, 0xe1, 0xaa},       {0x00, 0x4c, 0x00, 0xaa},
1407         {0x00, 0x77, 0x0a, 0xaa},       {0x00, 0x3d, 0x88, 0xaa},
1408         {0x00, 0x4b, 0x09, 0xaa},       {0x00, 0xc9, 0x60, 0xaa},
1409         {0x00, 0x41, 0x38, 0xaa},       {0x00, 0x62, 0x30, 0xaa},
1410         {0x00, 0x63, 0x30, 0xaa},       {0x00, 0x64, 0x08, 0xaa},
1411         {0x00, 0x94, 0x07, 0xaa},       {0x00, 0x95, 0x0b, 0xaa},
1412         {0x00, 0x65, 0x00, 0xaa},       {0x00, 0x66, 0x05, 0xaa},
1413         {0x00, 0x56, 0x50, 0xaa},       {0x00, 0x34, 0x11, 0xaa},
1414         {0x00, 0xa4, 0x88, 0xaa},       {0x00, 0x96, 0x00, 0xaa},
1415         {0x00, 0x97, 0x30, 0xaa},       {0x00, 0x98, 0x20, 0xaa},
1416         {0x00, 0x99, 0x30, 0xaa},       {0x00, 0x9a, 0x84, 0xaa},
1417         {0x00, 0x9b, 0x29, 0xaa},       {0x00, 0x9c, 0x03, 0xaa},
1418         {0x00, 0x78, 0x04, 0xaa},       {0x00, 0x79, 0x01, 0xaa},
1419         {0x00, 0xc8, 0xf0, 0xaa},       {0x00, 0x79, 0x0f, 0xaa},
1420         {0x00, 0xc8, 0x00, 0xaa},       {0x00, 0x79, 0x10, 0xaa},
1421         {0x00, 0xc8, 0x7e, 0xaa},       {0x00, 0x79, 0x0a, 0xaa},
1422         {0x00, 0xc8, 0x80, 0xaa},       {0x00, 0x79, 0x0b, 0xaa},
1423         {0x00, 0xc8, 0x01, 0xaa},       {0x00, 0x79, 0x0c, 0xaa},
1424         {0x00, 0xc8, 0x0f, 0xaa},       {0x00, 0x79, 0x0d, 0xaa},
1425         {0x00, 0xc8, 0x20, 0xaa},       {0x00, 0x79, 0x09, 0xaa},
1426         {0x00, 0xc8, 0x80, 0xaa},       {0x00, 0x79, 0x02, 0xaa},
1427         {0x00, 0xc8, 0xc0, 0xaa},       {0x00, 0x79, 0x03, 0xaa},
1428         {0x00, 0xc8, 0x40, 0xaa},       {0x00, 0x79, 0x05, 0xaa},
1429         {0x00, 0xc8, 0x30, 0xaa},       {0x00, 0x79, 0x26, 0xaa},
1430         {0x00, 0x11, 0x40, 0xaa},       {0x00, 0x3a, 0x04, 0xaa},
1431         {0x00, 0x12, 0x00, 0xaa},       {0x00, 0x40, 0xc0, 0xaa},
1432         {0x00, 0x8c, 0x00, 0xaa},       {0x00, 0x17, 0x14, 0xaa},
1433         {0x00, 0x18, 0x02, 0xaa},       {0x00, 0x32, 0x92, 0xaa},
1434         {0x00, 0x19, 0x02, 0xaa},       {0x00, 0x1a, 0x7a, 0xaa},
1435         {0x00, 0x03, 0x0a, 0xaa},       {0x00, 0x0c, 0x00, 0xaa},
1436         {0x00, 0x3e, 0x00, 0xaa},       {0x00, 0x70, 0x3a, 0xaa},
1437         {0x00, 0x71, 0x35, 0xaa},       {0x00, 0x72, 0x11, 0xaa},
1438         {0x00, 0x73, 0xf0, 0xaa},       {0x00, 0xa2, 0x02, 0xaa},
1439         {0x00, 0xb1, 0x00, 0xaa},       {0x00, 0xb1, 0x0c, 0xaa},
1440         {0x00, 0x1e, 0x37, 0xaa},       /* MVFP */
1441         {0x00, 0xaa, 0x14, 0xaa},
1442         {0x00, 0x24, 0x80, 0xaa},       {0x00, 0x25, 0x74, 0xaa},
1443         {0x00, 0x26, 0xd3, 0xaa},       {0x00, 0x0d, 0x00, 0xaa},
1444         {0x00, 0x14, 0x18, 0xaa},       {0x00, 0x9d, 0x99, 0xaa},
1445         {0x00, 0x9e, 0x7f, 0xaa},       {0x00, 0x64, 0x08, 0xaa},
1446         {0x00, 0x94, 0x07, 0xaa},       {0x00, 0x95, 0x06, 0xaa},
1447         {0x00, 0x66, 0x05, 0xaa},       {0x00, 0x41, 0x08, 0xaa},
1448         {0x00, 0x3f, 0x00, 0xaa},       {0x00, 0x75, 0x07, 0xaa},
1449         {0x00, 0x76, 0xe1, 0xaa},       {0x00, 0x4c, 0x00, 0xaa},
1450         {0x00, 0x77, 0x00, 0xaa},       {0x00, 0x3d, 0xc2, 0xaa},
1451         {0x00, 0x4b, 0x09, 0xaa},       {0x00, 0xc9, 0x60, 0xaa},
1452         {0x00, 0x41, 0x38, 0xaa},       {0xb6, 0x00, 0x00, 0xcc},
1453         {0xb6, 0x03, 0x01, 0xcc},       {0xb6, 0x02, 0x40, 0xcc},
1454         {0xb6, 0x05, 0x00, 0xcc},       {0xb6, 0x04, 0xf0, 0xcc},
1455         {0xb6, 0x12, 0xf8, 0xcc},       {0xb6, 0x13, 0x21, 0xcc},
1456         {0xb6, 0x18, 0x00, 0xcc},       {0xb6, 0x17, 0x96, 0xcc},
1457         {0xb6, 0x16, 0x00, 0xcc},       {0xb6, 0x22, 0x12, 0xcc},
1458         {0xb6, 0x23, 0x0b, 0xcc},       {0xbf, 0xc0, 0x39, 0xcc},
1459         {0xbf, 0xc1, 0x04, 0xcc},       {0xbf, 0xcc, 0x00, 0xcc},
1460         {0xbc, 0x02, 0x18, 0xcc},       {0xbc, 0x03, 0x50, 0xcc},
1461         {0xbc, 0x04, 0x18, 0xcc},       {0xbc, 0x05, 0x00, 0xcc},
1462         {0xbc, 0x06, 0x00, 0xcc},       {0xbc, 0x08, 0x30, 0xcc},
1463         {0xbc, 0x09, 0x40, 0xcc},       {0xbc, 0x0a, 0x10, 0xcc},
1464         {0xbc, 0x0b, 0x00, 0xcc},       {0xbc, 0x0c, 0x00, 0xcc},
1465         {0xb3, 0x5c, 0x01, 0xcc},       {0xb3, 0x01, 0x45, 0xcc},
1466         {0x00, 0x77, 0x05, 0xaa },
1467         {},
1468 };
1469 struct sensor_info {
1470         int sensorId;
1471         __u8 I2cAdd;
1472         __u8 IdAdd;
1473         __u16 VpId;
1474         __u8 m1;
1475         __u8 m2;
1476         __u8 op;
1477         };
1478
1479 static const struct sensor_info sensor_info_data[] = {
1480 /*      sensorId,         I2cAdd,       IdAdd,  VpId,  m1,    m2,  op */
1481         {SENSOR_HV7131R,    0x80 | 0x11, 0x00, 0x0209, 0x24, 0x25, 0x01},
1482         {SENSOR_OV7660,     0x80 | 0x21, 0x0a, 0x7660, 0x26, 0x26, 0x05},
1483         {SENSOR_PO3130NC,   0x80 | 0x76, 0x00, 0x3130, 0x24, 0x25, 0x01},
1484         {SENSOR_MI1320,     0x80 | 0xc8, 0x00, 0x148c, 0x64, 0x65, 0x01},
1485         {SENSOR_OV7670,     0x80 | 0x21, 0x0a, 0x7673, 0x66, 0x67, 0x05},
1486         {SENSOR_MI1310_SOC, 0x80 | 0x5d, 0x00, 0x143a, 0x24, 0x25, 0x01},
1487 /* (tested in vc032x_probe_sensor) */
1488 /*      {SENSOR_MI0360,     0x80 | 0x5d, 0x00, 0x8243, 0x24, 0x25, 0x01}, */
1489 };
1490
1491 /* read 'len' bytes in gspca_dev->usb_buf */
1492 static void reg_r(struct gspca_dev *gspca_dev,
1493                   __u16 req,
1494                   __u16 index,
1495                   __u16 len)
1496 {
1497         usb_control_msg(gspca_dev->dev,
1498                         usb_rcvctrlpipe(gspca_dev->dev, 0),
1499                         req,
1500                         USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
1501                         1,                      /* value */
1502                         index, gspca_dev->usb_buf, len,
1503                         500);
1504 }
1505
1506 static void reg_w(struct usb_device *dev,
1507                             __u16 req,
1508                             __u16 value,
1509                             __u16 index)
1510 {
1511         usb_control_msg(dev,
1512                         usb_sndctrlpipe(dev, 0),
1513                         req,
1514                         USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
1515                         value, index, NULL, 0,
1516                         500);
1517 }
1518
1519 static void read_sensor_register(struct gspca_dev *gspca_dev,
1520                                 __u16 address, __u16 *value)
1521 {
1522         struct usb_device *dev = gspca_dev->dev;
1523         __u8 ldata, mdata, hdata;
1524         int retry = 50;
1525
1526         *value = 0;
1527
1528         reg_r(gspca_dev, 0xa1, 0xb33f, 1);
1529         /*PDEBUG(D_PROBE, " I2c Bus Busy Wait  0x%02X ", tmpvalue); */
1530         if (!(gspca_dev->usb_buf[0] & 0x02)) {
1531                 PDEBUG(D_ERR, "I2c Bus Busy Wait %d",
1532                         gspca_dev->usb_buf[0] & 0x02);
1533                 return;
1534         }
1535         reg_w(dev, 0xa0, address, 0xb33a);
1536         reg_w(dev, 0xa0, 0x02, 0xb339);
1537
1538         reg_r(gspca_dev, 0xa1, 0xb33b, 1);
1539         while (retry-- && gspca_dev->usb_buf[0]) {
1540                 reg_r(gspca_dev, 0xa1, 0xb33b, 1);
1541 /*              PDEBUG(D_PROBE, "Read again 0xb33b %d", tmpvalue); */
1542                 msleep(1);
1543         }
1544         reg_r(gspca_dev, 0xa1, 0xb33e, 1);
1545         ldata = gspca_dev->usb_buf[0];
1546         reg_r(gspca_dev, 0xa1, 0xb33d, 1);
1547         mdata = gspca_dev->usb_buf[0];
1548         reg_r(gspca_dev, 0xa1, 0xb33c, 1);
1549         hdata = gspca_dev->usb_buf[0];
1550         PDEBUG(D_PROBE, "Read Sensor %02x%02x %02x",
1551                 hdata, mdata, ldata);
1552         reg_r(gspca_dev, 0xa1, 0xb334, 1);
1553         if (gspca_dev->usb_buf[0] == 0x02)
1554                 *value = (hdata << 8) + mdata;
1555         else
1556                 *value = hdata;
1557 }
1558
1559 static int vc032x_probe_sensor(struct gspca_dev *gspca_dev)
1560 {
1561         struct usb_device *dev = gspca_dev->dev;
1562         int i;
1563         __u16 value;
1564         const struct sensor_info *ptsensor_info;
1565
1566         reg_r(gspca_dev, 0xa1, 0xbfcf, 1);
1567         PDEBUG(D_PROBE, "check sensor header %02x", gspca_dev->usb_buf[0]);
1568         for (i = 0; i < ARRAY_SIZE(sensor_info_data); i++) {
1569                 ptsensor_info = &sensor_info_data[i];
1570                 reg_w(dev, 0xa0, 0x02, 0xb334);
1571                 reg_w(dev, 0xa0, ptsensor_info->m1, 0xb300);
1572                 reg_w(dev, 0xa0, ptsensor_info->m2, 0xb300);
1573                 reg_w(dev, 0xa0, 0x01, 0xb308);
1574                 reg_w(dev, 0xa0, 0x0c, 0xb309);
1575                 reg_w(dev, 0xa0, ptsensor_info->I2cAdd, 0xb335);
1576                 reg_w(dev, 0xa0, ptsensor_info->op, 0xb301);
1577                 read_sensor_register(gspca_dev, ptsensor_info->IdAdd, &value);
1578                 if (value == ptsensor_info->VpId)
1579                         return ptsensor_info->sensorId;
1580
1581                 /* special case for MI0360 */
1582                 if (ptsensor_info->sensorId == SENSOR_MI1310_SOC
1583                     && value == 0x8243)
1584                         return ptsensor_info->sensorId;
1585         }
1586         return -1;
1587 }
1588
1589 static __u8 i2c_write(struct gspca_dev *gspca_dev,
1590                         __u8 reg, const __u8 *val, __u8 size)
1591 {
1592         struct usb_device *dev = gspca_dev->dev;
1593
1594         if (size > 3 || size < 1)
1595                 return -EINVAL;
1596         reg_r(gspca_dev, 0xa1, 0xb33f, 1);
1597         reg_w(dev, 0xa0, size, 0xb334);
1598         reg_w(dev, 0xa0, reg, 0xb33a);
1599         switch (size) {
1600         case 1:
1601                 reg_w(dev, 0xa0, val[0], 0xb336);
1602                 break;
1603         case 2:
1604                 reg_w(dev, 0xa0, val[0], 0xb336);
1605                 reg_w(dev, 0xa0, val[1], 0xb337);
1606                 break;
1607         case 3:
1608                 reg_w(dev, 0xa0, val[0], 0xb336);
1609                 reg_w(dev, 0xa0, val[1], 0xb337);
1610                 reg_w(dev, 0xa0, val[2], 0xb338);
1611                 break;
1612         default:
1613                 reg_w(dev, 0xa0, 0x01, 0xb334);
1614                 return -EINVAL;
1615         }
1616         reg_w(dev, 0xa0, 0x01, 0xb339);
1617         reg_r(gspca_dev, 0xa1, 0xb33b, 1);
1618         return gspca_dev->usb_buf[0] == 0;
1619 }
1620
1621 static void put_tab_to_reg(struct gspca_dev *gspca_dev,
1622                         const __u8 *tab, __u8 tabsize, __u16 addr)
1623 {
1624         int j;
1625         __u16 ad = addr;
1626
1627         for (j = 0; j < tabsize; j++)
1628                 reg_w(gspca_dev->dev, 0xa0, tab[j], ad++);
1629 }
1630
1631 static void usb_exchange(struct gspca_dev *gspca_dev,
1632                         const __u8 data[][4])
1633 {
1634         struct usb_device *dev = gspca_dev->dev;
1635         int i = 0;
1636
1637         for (;;) {
1638                 switch (data[i][3]) {
1639                 default:
1640                         return;
1641                 case 0xcc:                      /* normal write */
1642                         reg_w(dev, 0xa0, data[i][2],
1643                                         ((data[i][0])<<8) | data[i][1]);
1644                         break;
1645                 case 0xaa:                      /* i2c op */
1646                         i2c_write(gspca_dev, data[i][1], &data[i][2], 1);
1647                         break;
1648                 case 0xbb:                      /* i2c op */
1649                         i2c_write(gspca_dev, data[i][0], &data[i][1], 2);
1650                         break;
1651                 case 0xdd:
1652                         msleep(data[i][2] + 10);
1653                         break;
1654                 }
1655                 i++;
1656         }
1657         /*not reached*/
1658 }
1659
1660 /*
1661  "GammaT"=hex:04,17,31,4f,6a,83,99,ad,bf,ce,da,e5,ee,f5,fb,ff,ff
1662  "MatrixT"=hex:60,f9,e5,e7,50,05,f3,e6,66
1663  */
1664
1665 static void vc0321_reset(struct gspca_dev *gspca_dev)
1666 {
1667         reg_w(gspca_dev->dev, 0xa0, 0x00, 0xb04d);
1668         reg_w(gspca_dev->dev, 0xa0, 0x01, 0xb301);
1669         msleep(100);
1670         reg_w(gspca_dev->dev, 0xa0, 0x01, 0xb003);
1671         msleep(100);
1672 }
1673
1674 /* this function is called at probe time */
1675 static int sd_config(struct gspca_dev *gspca_dev,
1676                         const struct usb_device_id *id)
1677 {
1678         struct sd *sd = (struct sd *) gspca_dev;
1679         struct usb_device *dev = gspca_dev->dev;
1680         struct cam *cam;
1681         int sensor;
1682
1683         cam = &gspca_dev->cam;
1684         cam->epaddr = 0x02;
1685         sd->bridge = id->driver_info;
1686
1687         vc0321_reset(gspca_dev);
1688         sensor = vc032x_probe_sensor(gspca_dev);
1689         switch (sensor) {
1690         case -1:
1691                 PDEBUG(D_PROBE, "Unknown sensor...");
1692                 return -EINVAL;
1693         case SENSOR_HV7131R:
1694                 PDEBUG(D_PROBE, "Find Sensor HV7131R");
1695                 break;
1696         case SENSOR_MI0360:
1697                 PDEBUG(D_PROBE, "Find Sensor MI0360");
1698                 sd->bridge = BRIDGE_VC0323;
1699                 break;
1700         case SENSOR_MI1310_SOC:
1701                 PDEBUG(D_PROBE, "Find Sensor MI1310_SOC");
1702                 break;
1703         case SENSOR_MI1320:
1704                 PDEBUG(D_PROBE, "Find Sensor MI1320");
1705                 break;
1706         case SENSOR_OV7660:
1707                 PDEBUG(D_PROBE, "Find Sensor OV7660");
1708                 break;
1709         case SENSOR_OV7670:
1710                 PDEBUG(D_PROBE, "Find Sensor OV7670");
1711                 break;
1712         case SENSOR_PO3130NC:
1713                 PDEBUG(D_PROBE, "Find Sensor PO3130NC");
1714                 break;
1715         }
1716         sd->sensor = sensor;
1717
1718         if (sd->bridge == BRIDGE_VC0321) {
1719                 cam->cam_mode = vc0321_mode;
1720                 cam->nmodes = ARRAY_SIZE(vc0321_mode);
1721         } else {
1722                 cam->cam_mode = vc0323_mode;
1723                 cam->nmodes = ARRAY_SIZE(vc0323_mode);
1724         }
1725
1726         sd->qindex = 7;
1727         sd->hflip = HFLIP_DEF;
1728         sd->vflip = VFLIP_DEF;
1729         if (sd->sensor == SENSOR_OV7670) {
1730                 sd->hflip = 1;
1731                 sd->vflip = 1;
1732         }
1733         sd->lightfreq = FREQ_DEF;
1734         if (sd->sensor != SENSOR_OV7670)
1735                 gspca_dev->ctrl_dis = (1 << LIGHTFREQ_IDX);
1736         switch (sd->sensor) {
1737         case SENSOR_OV7660:
1738         case SENSOR_OV7670:
1739                 break;
1740         default:
1741                 gspca_dev->ctrl_dis = (1 << HFLIP_IDX)
1742                                         | (1 << VFLIP_IDX);
1743                 break;
1744         }
1745
1746         if (sd->bridge == BRIDGE_VC0321) {
1747                 reg_r(gspca_dev, 0x8a, 0, 3);
1748                 reg_w(dev, 0x87, 0x00, 0x0f0f);
1749
1750                 reg_r(gspca_dev, 0x8b, 0, 3);
1751                 reg_w(dev, 0x88, 0x00, 0x0202);
1752         }
1753         return 0;
1754 }
1755
1756 /* this function is called at probe and time */
1757 static int sd_init(struct gspca_dev *gspca_dev)
1758 {
1759         return 0;
1760 }
1761
1762 static void setquality(struct gspca_dev *gspca_dev)
1763 {
1764 }
1765
1766 /* for OV7660 and OV7670 only */
1767 static void sethvflip(struct gspca_dev *gspca_dev)
1768 {
1769         struct sd *sd = (struct sd *) gspca_dev;
1770         __u8 data;
1771
1772         switch (sd->sensor) {
1773         case SENSOR_OV7660:
1774                 data = 1;
1775                 break;
1776         case SENSOR_OV7670:
1777                 data = 7;
1778                 break;
1779         default:
1780                 return;
1781         }
1782         data |= OV7660_MVFP_MIRROR * sd->hflip
1783                 | OV7660_MVFP_VFLIP * sd->vflip;
1784         i2c_write(gspca_dev, OV7660_REG_MVFP, &data, 1);
1785 }
1786
1787 static void setlightfreq(struct gspca_dev *gspca_dev)
1788 {
1789         struct sd *sd = (struct sd *) gspca_dev;
1790         static const __u8 (*ov7660_freq_tb[3])[4] =
1791                 {ov7660_NoFliker, ov7660_50HZ, ov7660_60HZ};
1792
1793         if (sd->sensor != SENSOR_OV7660)
1794                 return;
1795         usb_exchange(gspca_dev, ov7660_freq_tb[sd->lightfreq]);
1796 }
1797
1798 static int sd_start(struct gspca_dev *gspca_dev)
1799 {
1800         struct sd *sd = (struct sd *) gspca_dev;
1801         const __u8 *GammaT = NULL;
1802         const __u8 *MatrixT = NULL;
1803         int mode;
1804
1805         /* Assume start use the good resolution from gspca_dev->mode */
1806         if (sd->bridge == BRIDGE_VC0321) {
1807                 reg_w(gspca_dev->dev, 0xa0, 0xff, 0xbfec);
1808                 reg_w(gspca_dev->dev, 0xa0, 0xff, 0xbfed);
1809                 reg_w(gspca_dev->dev, 0xa0, 0xff, 0xbfee);
1810                 reg_w(gspca_dev->dev, 0xa0, 0xff, 0xbfef);
1811         }
1812
1813         mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
1814         switch (sd->sensor) {
1815         case SENSOR_HV7131R:
1816                 GammaT = hv7131r_gamma;
1817                 MatrixT = hv7131r_matrix;
1818                 if (mode) {
1819                         /* 320x240 */
1820                         usb_exchange(gspca_dev, hv7131r_initQVGA_data);
1821                 } else {
1822                         /* 640x480 */
1823                         usb_exchange(gspca_dev, hv7131r_initVGA_data);
1824                 }
1825                 break;
1826         case SENSOR_OV7660:
1827                 GammaT = ov7660_gamma;
1828                 MatrixT = ov7660_matrix;
1829                 if (mode) {
1830                         /* 320x240 */
1831                         usb_exchange(gspca_dev, ov7660_initQVGA_data);
1832                 } else {
1833                         /* 640x480 */
1834                         usb_exchange(gspca_dev, ov7660_initVGA_data);
1835                 }
1836                 break;
1837         case SENSOR_OV7670:
1838                 /*GammaT = ov7660_gamma; */
1839                 /*MatrixT = ov7660_matrix; */
1840                 if (mode) {
1841                         /* 320x240 */
1842                         usb_exchange(gspca_dev, ov7670_initQVGA_JPG);
1843                 } else {
1844                         /* 640x480 */
1845                         usb_exchange(gspca_dev, ov7670_initVGA_JPG);
1846                 }
1847                 break;
1848         case SENSOR_MI0360:
1849                 GammaT = mi1320_gamma;
1850                 MatrixT = mi0360_matrix;
1851                 if (mode) {
1852                         /* 320x240 */
1853                         usb_exchange(gspca_dev, mi0360_initQVGA_JPG);
1854                 } else {
1855                         /* 640x480 */
1856                         usb_exchange(gspca_dev, mi0360_initVGA_JPG);
1857                 }
1858                 break;
1859         case SENSOR_MI1310_SOC:
1860                 if (mode) {
1861                         /* 320x240 */
1862                         usb_exchange(gspca_dev, mi1310_socinitQVGA_JPG);
1863                 } else {
1864                         /* 640x480 */
1865                         usb_exchange(gspca_dev, mi1310_socinitVGA_JPG);
1866                 }
1867                 break;
1868         case SENSOR_MI1320:
1869                 GammaT = mi1320_gamma;
1870                 MatrixT = mi1320_matrix;
1871                 if (mode) {
1872                         /* 320x240 */
1873                         usb_exchange(gspca_dev, mi1320_initQVGA_data);
1874                 } else {
1875                         /* 640x480 */
1876                         usb_exchange(gspca_dev, mi1320_initVGA_data);
1877                 }
1878                 break;
1879         case SENSOR_PO3130NC:
1880                 GammaT = po3130_gamma;
1881                 MatrixT = po3130_matrix;
1882                 if (mode) {
1883                         /* 320x240 */
1884                         usb_exchange(gspca_dev, po3130_initQVGA_data);
1885                 } else {
1886                         /* 640x480 */
1887                         usb_exchange(gspca_dev, po3130_initVGA_data);
1888                 }
1889                 usb_exchange(gspca_dev, po3130_rundata);
1890                 break;
1891         default:
1892                 PDEBUG(D_PROBE, "Damned !! no sensor found Bye");
1893                 return -EMEDIUMTYPE;
1894         }
1895         if (GammaT && MatrixT) {
1896                 put_tab_to_reg(gspca_dev, GammaT, 17, 0xb84a);
1897                 put_tab_to_reg(gspca_dev, GammaT, 17, 0xb85b);
1898                 put_tab_to_reg(gspca_dev, GammaT, 17, 0xb86c);
1899                 put_tab_to_reg(gspca_dev, MatrixT, 9, 0xb82c);
1900
1901                 /* Seem SHARPNESS */
1902                 /*
1903                 reg_w(gspca_dev->dev, 0xa0, 0x80, 0xb80a);
1904                 reg_w(gspca_dev->dev, 0xa0, 0xff, 0xb80b);
1905                 reg_w(gspca_dev->dev, 0xa0, 0xff, 0xb80e);
1906                 */
1907                 /* all 0x40 ??? do nothing
1908                 reg_w(gspca_dev->dev, 0xa0, 0x40, 0xb822);
1909                 reg_w(gspca_dev->dev, 0xa0, 0x40, 0xb823);
1910                 reg_w(gspca_dev->dev, 0xa0, 0x40, 0xb824);
1911                 */
1912                 /* Only works for HV7131R ??
1913                 reg_r (gspca_dev, 0xa1, 0xb881, 1);
1914                 reg_w(gspca_dev->dev, 0xa0, 0xfe01, 0xb881);
1915                 reg_w(gspca_dev->dev, 0xa0, 0x79, 0xb801);
1916                 */
1917                 /* only hv7131r et ov7660
1918                 reg_w(gspca_dev->dev, 0xa0, 0x20, 0xb827);
1919                 reg_w(gspca_dev->dev, 0xa0, 0xff, 0xb826); * ISP_GAIN 80
1920                 reg_w(gspca_dev->dev, 0xa0, 0x23, 0xb800); * ISP CTRL_BAS
1921                 */
1922                 /* set the led on 0x0892 0x0896 */
1923                 reg_w(gspca_dev->dev, 0x89, 0xffff, 0xfdff);
1924                 msleep(100);
1925                 setquality(gspca_dev);
1926                 sethvflip(gspca_dev);
1927                 setlightfreq(gspca_dev);
1928         }
1929         return 0;
1930 }
1931
1932 static void sd_stopN(struct gspca_dev *gspca_dev)
1933 {
1934         struct usb_device *dev = gspca_dev->dev;
1935
1936         reg_w(dev, 0x89, 0xffff, 0xffff);
1937         reg_w(dev, 0xa0, 0x01, 0xb301);
1938         reg_w(dev, 0xa0, 0x09, 0xb003);
1939 }
1940
1941 /* called on streamoff with alt 0 and on disconnect */
1942 static void sd_stop0(struct gspca_dev *gspca_dev)
1943 {
1944         struct usb_device *dev = gspca_dev->dev;
1945
1946         if (!gspca_dev->present)
1947                 return;
1948         reg_w(dev, 0x89, 0xffff, 0xffff);
1949 }
1950
1951 static void sd_pkt_scan(struct gspca_dev *gspca_dev,
1952                         struct gspca_frame *frame,      /* target */
1953                         __u8 *data,                     /* isoc packet */
1954                         int len)                        /* iso pkt length */
1955 {
1956         struct sd *sd = (struct sd *) gspca_dev;
1957
1958         if (data[0] == 0xff && data[1] == 0xd8) {
1959                 PDEBUG(D_PACK,
1960                         "vc032x header packet found len %d", len);
1961                 frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame,
1962                                                 data, 0);
1963                 if (sd->bridge == BRIDGE_VC0321) {
1964 #define VCHDRSZ 46
1965                         data += VCHDRSZ;
1966                         len -= VCHDRSZ;
1967 #undef VCHDRSZ
1968                 }
1969                 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
1970                                 data, len);
1971                 return;
1972         }
1973         gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len);
1974 }
1975
1976 static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val)
1977 {
1978         struct sd *sd = (struct sd *) gspca_dev;
1979
1980         sd->hflip = val;
1981         if (gspca_dev->streaming)
1982                 sethvflip(gspca_dev);
1983         return 0;
1984 }
1985
1986 static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val)
1987 {
1988         struct sd *sd = (struct sd *) gspca_dev;
1989
1990         *val = sd->hflip;
1991         return 0;
1992 }
1993
1994 static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val)
1995 {
1996         struct sd *sd = (struct sd *) gspca_dev;
1997
1998         sd->vflip = val;
1999         if (gspca_dev->streaming)
2000                 sethvflip(gspca_dev);
2001         return 0;
2002 }
2003
2004 static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val)
2005 {
2006         struct sd *sd = (struct sd *) gspca_dev;
2007
2008         *val = sd->vflip;
2009         return 0;
2010 }
2011
2012 static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val)
2013 {
2014         struct sd *sd = (struct sd *) gspca_dev;
2015
2016         sd->lightfreq = val;
2017         if (gspca_dev->streaming)
2018                 setlightfreq(gspca_dev);
2019         return 0;
2020 }
2021
2022 static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val)
2023 {
2024         struct sd *sd = (struct sd *) gspca_dev;
2025
2026         *val = sd->lightfreq;
2027         return 0;
2028 }
2029
2030 static int sd_querymenu(struct gspca_dev *gspca_dev,
2031                         struct v4l2_querymenu *menu)
2032 {
2033         switch (menu->id) {
2034         case V4L2_CID_POWER_LINE_FREQUENCY:
2035                 switch (menu->index) {
2036                 case 0:         /* V4L2_CID_POWER_LINE_FREQUENCY_DISABLED */
2037                         strcpy((char *) menu->name, "NoFliker");
2038                         return 0;
2039                 case 1:         /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */
2040                         strcpy((char *) menu->name, "50 Hz");
2041                         return 0;
2042                 case 2:         /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */
2043                         strcpy((char *) menu->name, "60 Hz");
2044                         return 0;
2045                 }
2046                 break;
2047         }
2048         return -EINVAL;
2049 }
2050
2051 /* sub-driver description */
2052 static const struct sd_desc sd_desc = {
2053         .name = MODULE_NAME,
2054         .ctrls = sd_ctrls,
2055         .nctrls = ARRAY_SIZE(sd_ctrls),
2056         .config = sd_config,
2057         .init = sd_init,
2058         .start = sd_start,
2059         .stopN = sd_stopN,
2060         .stop0 = sd_stop0,
2061         .pkt_scan = sd_pkt_scan,
2062         .querymenu = sd_querymenu,
2063 };
2064
2065 /* -- module initialisation -- */
2066 static const __devinitdata struct usb_device_id device_table[] = {
2067         {USB_DEVICE(0x046d, 0x0892), .driver_info = BRIDGE_VC0321},
2068         {USB_DEVICE(0x046d, 0x0896), .driver_info = BRIDGE_VC0321},
2069         {USB_DEVICE(0x0ac8, 0x0321), .driver_info = BRIDGE_VC0321},
2070         {USB_DEVICE(0x0ac8, 0x0323), .driver_info = BRIDGE_VC0323},
2071         {USB_DEVICE(0x0ac8, 0x0328), .driver_info = BRIDGE_VC0321},
2072         {USB_DEVICE(0x0ac8, 0xc001), .driver_info = BRIDGE_VC0321},
2073         {USB_DEVICE(0x0ac8, 0xc002), .driver_info = BRIDGE_VC0321},
2074         {USB_DEVICE(0x17ef, 0x4802), .driver_info = BRIDGE_VC0323},
2075         {}
2076 };
2077 MODULE_DEVICE_TABLE(usb, device_table);
2078
2079 /* -- device connect -- */
2080 static int sd_probe(struct usb_interface *intf,
2081                         const struct usb_device_id *id)
2082 {
2083         return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
2084                                 THIS_MODULE);
2085 }
2086
2087 static struct usb_driver sd_driver = {
2088         .name = MODULE_NAME,
2089         .id_table = device_table,
2090         .probe = sd_probe,
2091         .disconnect = gspca_disconnect,
2092 #ifdef CONFIG_PM
2093         .suspend = gspca_suspend,
2094         .resume = gspca_resume,
2095 #endif
2096 };
2097
2098 /* -- module insert / remove -- */
2099 static int __init sd_mod_init(void)
2100 {
2101         if (usb_register(&sd_driver) < 0)
2102                 return -1;
2103         PDEBUG(D_PROBE, "registered");
2104         return 0;
2105 }
2106 static void __exit sd_mod_exit(void)
2107 {
2108         usb_deregister(&sd_driver);
2109         PDEBUG(D_PROBE, "deregistered");
2110 }
2111
2112 module_init(sd_mod_init);
2113 module_exit(sd_mod_exit);