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