1/*
2 * Z-star vc0321 library
3 *
4 * Copyright (C) 2009-2010 Jean-François Moine <http://moinejf.free.fr>
5 * Copyright (C) 2006 Koninski Artur takeshi87@o2.pl
6 * Copyright (C) 2006 Michel Xhaard
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 pr_fmt(fmt) KBUILD_MODNAME ": " fmt
24
25#define MODULE_NAME "vc032x"
26
27#include "gspca.h"
28
29MODULE_AUTHOR("Jean-François Moine <http://moinejf.free.fr>");
30MODULE_DESCRIPTION("GSPCA/VC032X USB Camera Driver");
31MODULE_LICENSE("GPL");
32
33/* specific webcam descriptor */
34struct sd {
35	struct gspca_dev gspca_dev;	/* !! must be the first item */
36
37	u8 brightness;
38	u8 contrast;
39	u8 colors;
40	u8 hflip;
41	u8 vflip;
42	u8 lightfreq;
43	s8 sharpness;
44	u16 exposure;
45	u8 gain;
46	u8 autogain;
47	u8 backlight;
48
49	u8 image_offset;
50
51	u8 bridge;
52	u8 sensor;
53	u8 flags;
54#define FL_SAMSUNG 0x01		/* SamsungQ1 (2 sensors) */
55#define FL_HFLIP 0x02		/* mirrored by default */
56#define FL_VFLIP 0x04		/* vertical flipped by default */
57};
58enum bridges {
59	BRIDGE_VC0321,
60	BRIDGE_VC0323,
61};
62enum sensors {
63	SENSOR_HV7131R,
64	SENSOR_MI0360,
65	SENSOR_MI1310_SOC,
66	SENSOR_MI1320,
67	SENSOR_MI1320_SOC,
68	SENSOR_OV7660,
69	SENSOR_OV7670,
70	SENSOR_PO1200,
71	SENSOR_PO3130NC,
72	SENSOR_POxxxx,
73	NSENSORS
74};
75
76/* V4L2 controls supported by the driver */
77static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val);
78static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val);
79static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val);
80static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val);
81static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val);
82static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val);
83static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val);
84static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val);
85static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val);
86static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val);
87static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val);
88static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val);
89static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val);
90static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val);
91static int sd_setgain(struct gspca_dev *gspca_dev, __s32 val);
92static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val);
93static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val);
94static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val);
95static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val);
96static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val);
97static int sd_setbacklight(struct gspca_dev *gspca_dev, __s32 val);
98static int sd_getbacklight(struct gspca_dev *gspca_dev, __s32 *val);
99
100static const struct ctrl sd_ctrls[] = {
101#define BRIGHTNESS_IDX 0
102	{
103	    {
104		.id      = V4L2_CID_BRIGHTNESS,
105		.type    = V4L2_CTRL_TYPE_INTEGER,
106		.name    = "Brightness",
107		.minimum = 0,
108		.maximum = 255,
109		.step    = 1,
110#define BRIGHTNESS_DEF 128
111		.default_value = BRIGHTNESS_DEF,
112	    },
113	    .set = sd_setbrightness,
114	    .get = sd_getbrightness,
115	},
116#define CONTRAST_IDX 1
117	{
118	    {
119		.id      = V4L2_CID_CONTRAST,
120		.type    = V4L2_CTRL_TYPE_INTEGER,
121		.name    = "Contrast",
122		.minimum = 0,
123		.maximum = 255,
124		.step    = 1,
125#define CONTRAST_DEF 127
126		.default_value = CONTRAST_DEF,
127	    },
128	    .set = sd_setcontrast,
129	    .get = sd_getcontrast,
130	},
131#define COLORS_IDX 2
132	{
133	    {
134		.id      = V4L2_CID_SATURATION,
135		.type    = V4L2_CTRL_TYPE_INTEGER,
136		.name    = "Saturation",
137		.minimum = 1,
138		.maximum = 127,
139		.step    = 1,
140#define COLOR_DEF 63
141		.default_value = COLOR_DEF,
142	    },
143	    .set = sd_setcolors,
144	    .get = sd_getcolors,
145	},
146/* next 2 controls work with some sensors only */
147#define HFLIP_IDX 3
148	{
149	    {
150		.id      = V4L2_CID_HFLIP,
151		.type    = V4L2_CTRL_TYPE_BOOLEAN,
152		.name    = "Mirror",
153		.minimum = 0,
154		.maximum = 1,
155		.step    = 1,
156#define HFLIP_DEF 0
157		.default_value = HFLIP_DEF,
158	    },
159	    .set = sd_sethflip,
160	    .get = sd_gethflip,
161	},
162#define VFLIP_IDX 4
163	{
164	    {
165		.id      = V4L2_CID_VFLIP,
166		.type    = V4L2_CTRL_TYPE_BOOLEAN,
167		.name    = "Vflip",
168		.minimum = 0,
169		.maximum = 1,
170		.step    = 1,
171#define VFLIP_DEF 0
172		.default_value = VFLIP_DEF,
173	    },
174	    .set = sd_setvflip,
175	    .get = sd_getvflip,
176	},
177#define LIGHTFREQ_IDX 5
178	{
179	    {
180		.id	 = V4L2_CID_POWER_LINE_FREQUENCY,
181		.type    = V4L2_CTRL_TYPE_MENU,
182		.name    = "Light frequency filter",
183		.minimum = 0,
184		.maximum = 2,	/* 0: No, 1: 50Hz, 2:60Hz */
185		.step    = 1,
186#define FREQ_DEF 1
187		.default_value = FREQ_DEF,
188	    },
189	    .set = sd_setfreq,
190	    .get = sd_getfreq,
191	},
192#define SHARPNESS_IDX 6
193	{
194	 {
195	  .id = V4L2_CID_SHARPNESS,
196	  .type = V4L2_CTRL_TYPE_INTEGER,
197	  .name = "Sharpness",
198	  .minimum = -1,
199	  .maximum = 2,
200	  .step = 1,
201#define SHARPNESS_DEF -1
202	  .default_value = SHARPNESS_DEF,
203	  },
204	 .set = sd_setsharpness,
205	 .get = sd_getsharpness,
206	 },
207#define GAIN_IDX 7
208	{
209	    {
210		.id      = V4L2_CID_GAIN,
211		.type    = V4L2_CTRL_TYPE_INTEGER,
212		.name    = "Gain",
213		.minimum = 0,
214		.maximum = 78,
215		.step    = 1,
216#define GAIN_DEF 0
217		.default_value = GAIN_DEF,
218	    },
219	    .set = sd_setgain,
220	    .get = sd_getgain,
221	},
222#define EXPOSURE_IDX 8
223	{
224		{
225			.id = V4L2_CID_EXPOSURE,
226			.type = V4L2_CTRL_TYPE_INTEGER,
227			.name = "Exposure",
228#define EXPOSURE_DEF 450
229			.minimum = 0,
230			.maximum = 4095,
231			.step = 1,
232			.default_value = EXPOSURE_DEF,
233		},
234		.set = sd_setexposure,
235		.get = sd_getexposure,
236	},
237#define AUTOGAIN_IDX 9
238	{
239		{
240			.id = V4L2_CID_AUTOGAIN,
241			.type = V4L2_CTRL_TYPE_BOOLEAN,
242			.name = "Automatic Gain and Exposure",
243			.minimum = 0,
244			.maximum = 1,
245			.step = 1,
246#define AUTOGAIN_DEF 1
247			.default_value = AUTOGAIN_DEF,
248		},
249		.set = sd_setautogain,
250		.get = sd_getautogain,
251	},
252#define BACKLIGHT_IDX 10
253	{
254		{
255			.id = V4L2_CID_BACKLIGHT_COMPENSATION,
256			.type = V4L2_CTRL_TYPE_BOOLEAN,
257			.name = "Backlight Compensation",
258			.minimum = 0,
259			.maximum = 15,
260			.step = 1,
261#define BACKLIGHT_DEF 15
262			.default_value = BACKLIGHT_DEF,
263		},
264		.set = sd_setbacklight,
265		.get = sd_getbacklight,
266	},
267};
268
269/* table of the disabled controls */
270static u32 ctrl_dis[NSENSORS] = {
271    [SENSOR_HV7131R] =
272	(1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX)
273		| (1 << HFLIP_IDX) | (1 << VFLIP_IDX) | (1 << LIGHTFREQ_IDX)
274		| (1 << SHARPNESS_IDX)
275		| (1 << GAIN_IDX) | (1 << EXPOSURE_IDX)
276		| (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX),
277    [SENSOR_MI0360] =
278	(1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX)
279		| (1 << HFLIP_IDX) | (1 << VFLIP_IDX) | (1 << LIGHTFREQ_IDX)
280		| (1 << SHARPNESS_IDX)
281		| (1 << GAIN_IDX) | (1 << EXPOSURE_IDX)
282		| (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX),
283    [SENSOR_MI1310_SOC] =
284	(1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX)
285		| (1 << LIGHTFREQ_IDX) | (1 << SHARPNESS_IDX)
286		| (1 << GAIN_IDX) | (1 << EXPOSURE_IDX)
287		| (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX),
288    [SENSOR_MI1320] =
289	(1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX)
290		| (1 << LIGHTFREQ_IDX) | (1 << SHARPNESS_IDX)
291		| (1 << GAIN_IDX) | (1 << EXPOSURE_IDX)
292		| (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX),
293    [SENSOR_MI1320_SOC] =
294	(1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX)
295		| (1 << LIGHTFREQ_IDX) | (1 << SHARPNESS_IDX)
296		| (1 << GAIN_IDX) | (1 << EXPOSURE_IDX)
297		| (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX),
298    [SENSOR_OV7660] =
299	(1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX)
300		| (1 << LIGHTFREQ_IDX) | (1 << SHARPNESS_IDX)
301		| (1 << GAIN_IDX) | (1 << EXPOSURE_IDX)
302		| (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX),
303    [SENSOR_OV7670] =
304	(1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX)
305		| (1 << SHARPNESS_IDX)
306		| (1 << GAIN_IDX) | (1 << EXPOSURE_IDX)
307		| (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX),
308    [SENSOR_PO1200] =
309	(1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX)
310		| (1 << LIGHTFREQ_IDX)
311		| (1 << GAIN_IDX) | (1 << EXPOSURE_IDX)
312		| (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX),
313    [SENSOR_PO3130NC] =
314	(1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX)
315		| (1 << HFLIP_IDX) | (1 << VFLIP_IDX) | (1 << LIGHTFREQ_IDX)
316		| (1 << SHARPNESS_IDX)
317		| (1 << GAIN_IDX) | (1 << EXPOSURE_IDX)
318		| (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX),
319    [SENSOR_POxxxx] =
320	(1 << HFLIP_IDX) | (1 << VFLIP_IDX) | (1 << LIGHTFREQ_IDX),
321};
322
323static const struct v4l2_pix_format vc0321_mode[] = {
324	{320, 240, V4L2_PIX_FMT_YVYU, V4L2_FIELD_NONE,
325		.bytesperline = 320,
326		.sizeimage = 320 * 240 * 2,
327		.colorspace = V4L2_COLORSPACE_SRGB,
328		.priv = 1},
329	{640, 480, V4L2_PIX_FMT_YVYU, V4L2_FIELD_NONE,
330		.bytesperline = 640,
331		.sizeimage = 640 * 480 * 2,
332		.colorspace = V4L2_COLORSPACE_SRGB,
333		.priv = 0},
334};
335static const struct v4l2_pix_format vc0323_mode[] = {
336	{320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
337		.bytesperline = 320,
338		.sizeimage = 320 * 240 * 3 / 8 + 590,
339		.colorspace = V4L2_COLORSPACE_JPEG,
340		.priv = 1},
341	{640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
342		.bytesperline = 640,
343		.sizeimage = 640 * 480 * 3 / 8 + 590,
344		.colorspace = V4L2_COLORSPACE_JPEG,
345		.priv = 0},
346	{1280, 960, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, /* mi1310_soc only */
347		.bytesperline = 1280,
348		.sizeimage = 1280 * 960 * 3 / 8 + 590,
349		.colorspace = V4L2_COLORSPACE_JPEG,
350		.priv = 2},
351};
352static const struct v4l2_pix_format bi_mode[] = {
353	{320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
354		.bytesperline = 320,
355		.sizeimage = 320 * 240 * 2,
356		.colorspace = V4L2_COLORSPACE_SRGB,
357		.priv = 2},
358	{640, 480, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
359		.bytesperline = 640,
360		.sizeimage = 640 * 480 * 2,
361		.colorspace = V4L2_COLORSPACE_SRGB,
362		.priv = 1},
363	{1280, 1024, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
364		.bytesperline = 1280,
365		.sizeimage = 1280 * 1024 * 2,
366		.colorspace = V4L2_COLORSPACE_SRGB,
367		.priv = 0},
368};
369static const struct v4l2_pix_format svga_mode[] = {
370	{800, 600, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
371		.bytesperline = 800,
372		.sizeimage = 800 * 600 * 1 / 4 + 590,
373		.colorspace = V4L2_COLORSPACE_JPEG,
374		.priv = 0},
375};
376
377/* OV7660/7670 registers */
378#define OV7660_REG_MVFP 0x1e
379#define OV7660_MVFP_MIRROR	0x20
380#define OV7660_MVFP_VFLIP	0x10
381
382static const u8 mi0360_matrix[9] = {
383	0x50, 0xf8, 0xf8, 0xf5, 0x50, 0xfb, 0xff, 0xf1, 0x50
384};
385
386static const u8 mi0360_initVGA_JPG[][4] = {
387	{0xb0, 0x03, 0x19, 0xcc},
388	{0xb0, 0x04, 0x02, 0xcc},
389	{0xb3, 0x00, 0x24, 0xcc},
390	{0xb3, 0x00, 0x25, 0xcc},
391	{0xb3, 0x08, 0x01, 0xcc},
392	{0xb3, 0x09, 0x0c, 0xcc},
393	{0xb3, 0x05, 0x01, 0xcc},
394	{0xb3, 0x06, 0x03, 0xcc},
395	{0xb3, 0x03, 0x0a, 0xcc},
396	{0xb3, 0x20, 0x00, 0xcc},
397	{0xb3, 0x21, 0x00, 0xcc},
398	{0xb3, 0x22, 0x01, 0xcc},
399	{0xb3, 0x23, 0xe0, 0xcc},
400	{0xb3, 0x04, 0x05, 0xcc},
401	{0xb3, 0x14, 0x00, 0xcc},
402	{0xb3, 0x15, 0x00, 0xcc},
403	{0xb3, 0x16, 0x02, 0xcc},
404	{0xb3, 0x17, 0x7f, 0xcc},
405	{0xb3, 0x35, 0xdd, 0xcc},	/* i2c add: 5d */
406	{0xb3, 0x34, 0x02, 0xcc},
407	{0xb3, 0x00, 0x25, 0xcc},
408	{0xbc, 0x00, 0x71, 0xcc},
409	{0xb8, 0x00, 0x13, 0xcc},
410	{0xb8, 0x27, 0x20, 0xcc},
411	{0xb8, 0x2c, 0x50, 0xcc},
412	{0xb8, 0x2d, 0xf8, 0xcc},
413	{0xb8, 0x2e, 0xf8, 0xcc},
414	{0xb8, 0x2f, 0xf8, 0xcc},
415	{0xb8, 0x30, 0x50, 0xcc},
416	{0xb8, 0x31, 0xf8, 0xcc},
417	{0xb8, 0x32, 0xf8, 0xcc},
418	{0xb8, 0x33, 0xf8, 0xcc},
419	{0xb8, 0x34, 0x50, 0xcc},
420	{0xb8, 0x35, 0x00, 0xcc},
421	{0xb8, 0x36, 0x00, 0xcc},
422	{0xb8, 0x37, 0x00, 0xcc},
423	{0xb8, 0x01, 0x79, 0xcc},
424	{0xb8, 0x08, 0xe0, 0xcc},
425	{0xb3, 0x01, 0x41, 0xcc},
426	{0xb8, 0x01, 0x79, 0xcc},
427	{0xb8, 0x14, 0x18, 0xcc},
428	{0xb8, 0xb2, 0x0a, 0xcc},
429	{0xb8, 0xb4, 0x0a, 0xcc},
430	{0xb8, 0xb5, 0x0a, 0xcc},
431	{0xb8, 0xfe, 0x00, 0xcc},
432	{0xb8, 0xff, 0x28, 0xcc},
433	{0xb9, 0x00, 0x28, 0xcc},
434	{0xb9, 0x01, 0x28, 0xcc},
435	{0xb9, 0x02, 0x28, 0xcc},
436	{0xb9, 0x03, 0x00, 0xcc},
437	{0xb9, 0x04, 0x00, 0xcc},
438	{0xb9, 0x05, 0x3c, 0xcc},
439	{0xb9, 0x06, 0x3c, 0xcc},
440	{0xb9, 0x07, 0x3c, 0xcc},
441	{0xb9, 0x08, 0x3c, 0xcc},
442	{0xb8, 0x8e, 0x00, 0xcc},
443	{0xb8, 0x8f, 0xff, 0xcc},
444	{0xb8, 0x81, 0x09, 0xcc},
445	{0x31, 0x00, 0x00, 0xbb},
446	{0x09, 0x01, 0xc7, 0xbb},
447	{0x34, 0x01, 0x00, 0xbb},
448	{0x2b, 0x00, 0x28, 0xbb},
449	{0x2c, 0x00, 0x30, 0xbb},
450	{0x2d, 0x00, 0x30, 0xbb},
451	{0x2e, 0x00, 0x28, 0xbb},
452	{0x62, 0x04, 0x11, 0xbb},
453	{0x03, 0x01, 0xe0, 0xbb},
454	{0x2c, 0x00, 0x2c, 0xbb},
455	{0x20, 0xd0, 0x00, 0xbb},
456	{0x01, 0x00, 0x08, 0xbb},
457	{0x06, 0x00, 0x10, 0xbb},
458	{0x05, 0x00, 0x20, 0xbb},
459	{0x20, 0x00, 0x00, 0xbb},
460	{0xb6, 0x00, 0x00, 0xcc},
461	{0xb6, 0x03, 0x02, 0xcc},
462	{0xb6, 0x02, 0x80, 0xcc},
463	{0xb6, 0x05, 0x01, 0xcc},
464	{0xb6, 0x04, 0xe0, 0xcc},
465	{0xb6, 0x12, 0x78, 0xcc},
466	{0xb6, 0x18, 0x02, 0xcc},
467	{0xb6, 0x17, 0x58, 0xcc},
468	{0xb6, 0x16, 0x00, 0xcc},
469	{0xb6, 0x22, 0x12, 0xcc},
470	{0xb6, 0x23, 0x0b, 0xcc},
471	{0xb3, 0x02, 0x02, 0xcc},
472	{0xbf, 0xc0, 0x39, 0xcc},
473	{0xbf, 0xc1, 0x04, 0xcc},
474	{0xbf, 0xcc, 0x10, 0xcc},
475	{0xb9, 0x12, 0x00, 0xcc},
476	{0xb9, 0x13, 0x0a, 0xcc},
477	{0xb9, 0x14, 0x0a, 0xcc},
478	{0xb9, 0x15, 0x0a, 0xcc},
479	{0xb9, 0x16, 0x0a, 0xcc},
480	{0xb9, 0x18, 0x00, 0xcc},
481	{0xb9, 0x19, 0x0f, 0xcc},
482	{0xb9, 0x1a, 0x0f, 0xcc},
483	{0xb9, 0x1b, 0x0f, 0xcc},
484	{0xb9, 0x1c, 0x0f, 0xcc},
485	{0xb8, 0x8e, 0x00, 0xcc},
486	{0xb8, 0x8f, 0xff, 0xcc},
487	{0xb6, 0x12, 0xf8, 0xcc},
488	{0xb8, 0x0c, 0x20, 0xcc},
489	{0xb8, 0x0d, 0x70, 0xcc},
490	{0xb6, 0x13, 0x13, 0xcc},
491	{0x35, 0x00, 0x60, 0xbb},
492	{0xb3, 0x5c, 0x01, 0xcc},
493	{}
494};
495static const u8 mi0360_initQVGA_JPG[][4] = {
496	{0xb0, 0x03, 0x19, 0xcc},
497	{0xb0, 0x04, 0x02, 0xcc},
498	{0xb3, 0x00, 0x24, 0xcc},
499	{0xb3, 0x00, 0x25, 0xcc},
500	{0xb3, 0x08, 0x01, 0xcc},
501	{0xb3, 0x09, 0x0c, 0xcc},
502	{0xb3, 0x05, 0x01, 0xcc},
503	{0xb3, 0x06, 0x03, 0xcc},
504	{0xb3, 0x03, 0x0a, 0xcc},
505	{0xb3, 0x20, 0x00, 0xcc},
506	{0xb3, 0x21, 0x00, 0xcc},
507	{0xb3, 0x22, 0x01, 0xcc},
508	{0xb3, 0x23, 0xe0, 0xcc},
509	{0xb3, 0x04, 0x05, 0xcc},
510	{0xb3, 0x14, 0x00, 0xcc},
511	{0xb3, 0x15, 0x00, 0xcc},
512	{0xb3, 0x16, 0x02, 0xcc},
513	{0xb3, 0x17, 0x7f, 0xcc},
514	{0xb3, 0x35, 0xdd, 0xcc},
515	{0xb3, 0x34, 0x02, 0xcc},
516	{0xb3, 0x00, 0x25, 0xcc},
517	{0xbc, 0x00, 0xd1, 0xcc},
518	{0xb8, 0x00, 0x13, 0xcc},
519	{0xb8, 0x27, 0x20, 0xcc},
520	{0xb8, 0x2c, 0x50, 0xcc},
521	{0xb8, 0x2d, 0xf8, 0xcc},
522	{0xb8, 0x2e, 0xf8, 0xcc},
523	{0xb8, 0x2f, 0xf8, 0xcc},
524	{0xb8, 0x30, 0x50, 0xcc},
525	{0xb8, 0x31, 0xf8, 0xcc},
526	{0xb8, 0x32, 0xf8, 0xcc},
527	{0xb8, 0x33, 0xf8, 0xcc},
528	{0xb8, 0x34, 0x50, 0xcc},
529	{0xb8, 0x35, 0x00, 0xcc},
530	{0xb8, 0x36, 0x00, 0xcc},
531	{0xb8, 0x37, 0x00, 0xcc},
532	{0xb8, 0x01, 0x79, 0xcc},
533	{0xb8, 0x08, 0xe0, 0xcc},
534	{0xb3, 0x01, 0x41, 0xcc},
535	{0xb8, 0x01, 0x79, 0xcc},
536	{0xb8, 0x14, 0x18, 0xcc},
537	{0xb8, 0xb2, 0x0a, 0xcc},
538	{0xb8, 0xb4, 0x0a, 0xcc},
539	{0xb8, 0xb5, 0x0a, 0xcc},
540	{0xb8, 0xfe, 0x00, 0xcc},
541	{0xb8, 0xff, 0x28, 0xcc},
542	{0xb9, 0x00, 0x28, 0xcc},
543	{0xb9, 0x01, 0x28, 0xcc},
544	{0xb9, 0x02, 0x28, 0xcc},
545	{0xb9, 0x03, 0x00, 0xcc},
546	{0xb9, 0x04, 0x00, 0xcc},
547	{0xb9, 0x05, 0x3c, 0xcc},
548	{0xb9, 0x06, 0x3c, 0xcc},
549	{0xb9, 0x07, 0x3c, 0xcc},
550	{0xb9, 0x08, 0x3c, 0xcc},
551	{0xb8, 0x8e, 0x00, 0xcc},
552	{0xb8, 0x8f, 0xff, 0xcc},
553	{0xb8, 0x81, 0x09, 0xcc},
554	{0x31, 0x00, 0x00, 0xbb},
555	{0x09, 0x01, 0xc7, 0xbb},
556	{0x34, 0x01, 0x00, 0xbb},
557	{0x2b, 0x00, 0x28, 0xbb},
558	{0x2c, 0x00, 0x30, 0xbb},
559	{0x2d, 0x00, 0x30, 0xbb},
560	{0x2e, 0x00, 0x28, 0xbb},
561	{0x62, 0x04, 0x11, 0xbb},
562	{0x03, 0x01, 0xe0, 0xbb},
563	{0x2c, 0x00, 0x2c, 0xbb},
564	{0x20, 0xd0, 0x00, 0xbb},
565	{0x01, 0x00, 0x08, 0xbb},
566	{0x06, 0x00, 0x10, 0xbb},
567	{0x05, 0x00, 0x20, 0xbb},
568	{0x20, 0x00, 0x00, 0xbb},
569	{0xb6, 0x00, 0x00, 0xcc},
570	{0xb6, 0x03, 0x01, 0xcc},
571	{0xb6, 0x02, 0x40, 0xcc},
572	{0xb6, 0x05, 0x00, 0xcc},
573	{0xb6, 0x04, 0xf0, 0xcc},
574	{0xb6, 0x12, 0x78, 0xcc},
575	{0xb6, 0x18, 0x00, 0xcc},
576	{0xb6, 0x17, 0x96, 0xcc},
577	{0xb6, 0x16, 0x00, 0xcc},
578	{0xb6, 0x22, 0x12, 0xcc},
579	{0xb6, 0x23, 0x0b, 0xcc},
580	{0xb3, 0x02, 0x02, 0xcc},
581	{0xbf, 0xc0, 0x39, 0xcc},
582	{0xbf, 0xc1, 0x04, 0xcc},
583	{0xbf, 0xcc, 0x10, 0xcc},
584	{0xb9, 0x12, 0x00, 0xcc},
585	{0xb9, 0x13, 0x0a, 0xcc},
586	{0xb9, 0x14, 0x0a, 0xcc},
587	{0xb9, 0x15, 0x0a, 0xcc},
588	{0xb9, 0x16, 0x0a, 0xcc},
589	{0xb9, 0x18, 0x00, 0xcc},
590	{0xb9, 0x19, 0x0f, 0xcc},
591	{0xb9, 0x1a, 0x0f, 0xcc},
592	{0xb9, 0x1b, 0x0f, 0xcc},
593	{0xb9, 0x1c, 0x0f, 0xcc},
594	{0xb8, 0x8e, 0x00, 0xcc},
595	{0xb8, 0x8f, 0xff, 0xcc},
596	{0xb6, 0x12, 0xf8, 0xcc},
597	{0xb6, 0x13, 0x13, 0xcc},
598	{0xbc, 0x02, 0x18, 0xcc},
599	{0xbc, 0x03, 0x50, 0xcc},
600	{0xbc, 0x04, 0x18, 0xcc},
601	{0xbc, 0x05, 0x00, 0xcc},
602	{0xbc, 0x06, 0x00, 0xcc},
603	{0xbc, 0x08, 0x30, 0xcc},
604	{0xbc, 0x09, 0x40, 0xcc},
605	{0xbc, 0x0a, 0x10, 0xcc},
606	{0xb8, 0x0c, 0x20, 0xcc},
607	{0xb8, 0x0d, 0x70, 0xcc},
608	{0xbc, 0x0b, 0x00, 0xcc},
609	{0xbc, 0x0c, 0x00, 0xcc},
610	{0x35, 0x00, 0xef, 0xbb},
611	{0xb3, 0x5c, 0x01, 0xcc},
612	{}
613};
614
615static const u8 mi1310_socinitVGA_JPG[][4] = {
616	{0xb0, 0x03, 0x19, 0xcc},
617	{0xb0, 0x04, 0x02, 0xcc},
618	{0xb3, 0x00, 0x64, 0xcc},
619	{0xb3, 0x00, 0x65, 0xcc},
620	{0xb3, 0x05, 0x00, 0xcc},
621	{0xb3, 0x06, 0x00, 0xcc},
622	{0xb3, 0x08, 0x01, 0xcc},
623	{0xb3, 0x09, 0x0c, 0xcc},
624	{0xb3, 0x34, 0x02, 0xcc},
625	{0xb3, 0x35, 0xdd, 0xcc},	/* i2c add: 5d */
626	{0xb3, 0x02, 0x00, 0xcc},
627	{0xb3, 0x03, 0x0a, 0xcc},
628	{0xb3, 0x04, 0x05, 0xcc},
629	{0xb3, 0x20, 0x00, 0xcc},
630	{0xb3, 0x21, 0x00, 0xcc},
631	{0xb3, 0x22, 0x03, 0xcc},
632	{0xb3, 0x23, 0xc0, 0xcc},
633	{0xb3, 0x14, 0x00, 0xcc},
634	{0xb3, 0x15, 0x00, 0xcc},
635	{0xb3, 0x16, 0x04, 0xcc},
636	{0xb3, 0x17, 0xff, 0xcc},
637	{0xb3, 0x00, 0x65, 0xcc},
638	{0xb8, 0x00, 0x00, 0xcc},
639	{0xbc, 0x00, 0xd0, 0xcc},
640	{0xbc, 0x01, 0x01, 0xcc},
641	{0xf0, 0x00, 0x02, 0xbb},
642	{0xc8, 0x9f, 0x0b, 0xbb},
643	{0x5b, 0x00, 0x01, 0xbb},
644	{0x2f, 0xde, 0x20, 0xbb},
645	{0xf0, 0x00, 0x00, 0xbb},
646	{0x20, 0x03, 0x02, 0xbb},	/* h/v flip */
647	{0xf0, 0x00, 0x01, 0xbb},
648	{0x05, 0x00, 0x07, 0xbb},
649	{0x34, 0x00, 0x00, 0xbb},
650	{0x35, 0xff, 0x00, 0xbb},
651	{0xdc, 0x07, 0x02, 0xbb},
652	{0xdd, 0x3c, 0x18, 0xbb},
653	{0xde, 0x92, 0x6d, 0xbb},
654	{0xdf, 0xcd, 0xb1, 0xbb},
655	{0xe0, 0xff, 0xe7, 0xbb},
656	{0x06, 0xf0, 0x0d, 0xbb},
657	{0x06, 0x70, 0x0e, 0xbb},
658	{0x4c, 0x00, 0x01, 0xbb},
659	{0x4d, 0x00, 0x01, 0xbb},
660	{0xf0, 0x00, 0x02, 0xbb},
661	{0x2e, 0x0c, 0x55, 0xbb},
662	{0x21, 0xb6, 0x6e, 0xbb},
663	{0x36, 0x30, 0x10, 0xbb},
664	{0x37, 0x00, 0xc1, 0xbb},
665	{0xf0, 0x00, 0x00, 0xbb},
666	{0x07, 0x00, 0x84, 0xbb},
667	{0x08, 0x02, 0x4a, 0xbb},
668	{0x05, 0x01, 0x10, 0xbb},
669	{0x06, 0x00, 0x39, 0xbb},
670	{0xf0, 0x00, 0x02, 0xbb},
671	{0x58, 0x02, 0x67, 0xbb},
672	{0x57, 0x02, 0x00, 0xbb},
673	{0x5a, 0x02, 0x67, 0xbb},
674	{0x59, 0x02, 0x00, 0xbb},
675	{0x5c, 0x12, 0x0d, 0xbb},
676	{0x5d, 0x16, 0x11, 0xbb},
677	{0x39, 0x06, 0x18, 0xbb},
678	{0x3a, 0x06, 0x18, 0xbb},
679	{0x3b, 0x06, 0x18, 0xbb},
680	{0x3c, 0x06, 0x18, 0xbb},
681	{0x64, 0x7b, 0x5b, 0xbb},
682	{0xf0, 0x00, 0x02, 0xbb},
683	{0x36, 0x30, 0x10, 0xbb},
684	{0x37, 0x00, 0xc0, 0xbb},
685	{0xbc, 0x0e, 0x00, 0xcc},
686	{0xbc, 0x0f, 0x05, 0xcc},
687	{0xbc, 0x10, 0xc0, 0xcc},
688	{0xbc, 0x11, 0x03, 0xcc},
689	{0xb6, 0x00, 0x00, 0xcc},
690	{0xb6, 0x03, 0x02, 0xcc},
691	{0xb6, 0x02, 0x80, 0xcc},
692	{0xb6, 0x05, 0x01, 0xcc},
693	{0xb6, 0x04, 0xe0, 0xcc},
694	{0xb6, 0x12, 0xf8, 0xcc},
695	{0xb6, 0x13, 0x25, 0xcc},
696	{0xb6, 0x18, 0x02, 0xcc},
697	{0xb6, 0x17, 0x58, 0xcc},
698	{0xb6, 0x16, 0x00, 0xcc},
699	{0xb6, 0x22, 0x12, 0xcc},
700	{0xb6, 0x23, 0x0b, 0xcc},
701	{0xbf, 0xc0, 0x39, 0xcc},
702	{0xbf, 0xc1, 0x04, 0xcc},
703	{0xbf, 0xcc, 0x00, 0xcc},
704	{0xbc, 0x02, 0x18, 0xcc},
705	{0xbc, 0x03, 0x50, 0xcc},
706	{0xbc, 0x04, 0x18, 0xcc},
707	{0xbc, 0x05, 0x00, 0xcc},
708	{0xbc, 0x06, 0x00, 0xcc},
709	{0xbc, 0x08, 0x30, 0xcc},
710	{0xbc, 0x09, 0x40, 0xcc},
711	{0xbc, 0x0a, 0x10, 0xcc},
712	{0xbc, 0x0b, 0x00, 0xcc},
713	{0xbc, 0x0c, 0x00, 0xcc},
714	{0xb3, 0x5c, 0x01, 0xcc},
715	{0xf0, 0x00, 0x01, 0xbb},
716	{0x80, 0x00, 0x03, 0xbb},
717	{0x81, 0xc7, 0x14, 0xbb},
718	{0x82, 0xeb, 0xe8, 0xbb},
719	{0x83, 0xfe, 0xf4, 0xbb},
720	{0x84, 0xcd, 0x10, 0xbb},
721	{0x85, 0xf3, 0xee, 0xbb},
722	{0x86, 0xff, 0xf1, 0xbb},
723	{0x87, 0xcd, 0x10, 0xbb},
724	{0x88, 0xf3, 0xee, 0xbb},
725	{0x89, 0x01, 0xf1, 0xbb},
726	{0x8a, 0xe5, 0x17, 0xbb},
727	{0x8b, 0xe8, 0xe2, 0xbb},
728	{0x8c, 0xf7, 0xed, 0xbb},
729	{0x8d, 0x00, 0xff, 0xbb},
730	{0x8e, 0xec, 0x10, 0xbb},
731	{0x8f, 0xf0, 0xed, 0xbb},
732	{0x90, 0xf9, 0xf2, 0xbb},
733	{0x91, 0x00, 0x00, 0xbb},
734	{0x92, 0xe9, 0x0d, 0xbb},
735	{0x93, 0xf4, 0xf2, 0xbb},
736	{0x94, 0xfb, 0xf5, 0xbb},
737	{0x95, 0x00, 0xff, 0xbb},
738	{0xb6, 0x0f, 0x08, 0xbb},
739	{0xb7, 0x3d, 0x16, 0xbb},
740	{0xb8, 0x0c, 0x04, 0xbb},
741	{0xb9, 0x1c, 0x07, 0xbb},
742	{0xba, 0x0a, 0x03, 0xbb},
743	{0xbb, 0x1b, 0x09, 0xbb},
744	{0xbc, 0x17, 0x0d, 0xbb},
745	{0xbd, 0x23, 0x1d, 0xbb},
746	{0xbe, 0x00, 0x28, 0xbb},
747	{0xbf, 0x11, 0x09, 0xbb},
748	{0xc0, 0x16, 0x15, 0xbb},
749	{0xc1, 0x00, 0x1b, 0xbb},
750	{0xc2, 0x0e, 0x07, 0xbb},
751	{0xc3, 0x14, 0x10, 0xbb},
752	{0xc4, 0x00, 0x17, 0xbb},
753	{0x06, 0x74, 0x8e, 0xbb},
754	{0xf0, 0x00, 0x01, 0xbb},
755	{0x06, 0xf4, 0x8e, 0xbb},
756	{0x00, 0x00, 0x50, 0xdd},
757	{0x06, 0x74, 0x8e, 0xbb},
758	{0xf0, 0x00, 0x02, 0xbb},
759	{0x24, 0x50, 0x20, 0xbb},
760	{0xf0, 0x00, 0x02, 0xbb},
761	{0x34, 0x0c, 0x50, 0xbb},
762	{0xb3, 0x01, 0x41, 0xcc},
763	{0xf0, 0x00, 0x00, 0xbb},
764	{0x03, 0x03, 0xc0, 0xbb},
765	{},
766};
767static const u8 mi1310_socinitQVGA_JPG[][4] = {
768	{0xb0, 0x03, 0x19, 0xcc},	{0xb0, 0x04, 0x02, 0xcc},
769	{0xb3, 0x00, 0x64, 0xcc},	{0xb3, 0x00, 0x65, 0xcc},
770	{0xb3, 0x05, 0x00, 0xcc},	{0xb3, 0x06, 0x00, 0xcc},
771	{0xb3, 0x08, 0x01, 0xcc},	{0xb3, 0x09, 0x0c, 0xcc},
772	{0xb3, 0x34, 0x02, 0xcc},	{0xb3, 0x35, 0xdd, 0xcc},
773	{0xb3, 0x02, 0x00, 0xcc},	{0xb3, 0x03, 0x0a, 0xcc},
774	{0xb3, 0x04, 0x05, 0xcc},	{0xb3, 0x20, 0x00, 0xcc},
775	{0xb3, 0x21, 0x00, 0xcc},	{0xb3, 0x22, 0x03, 0xcc},
776	{0xb3, 0x23, 0xc0, 0xcc},	{0xb3, 0x14, 0x00, 0xcc},
777	{0xb3, 0x15, 0x00, 0xcc},	{0xb3, 0x16, 0x04, 0xcc},
778	{0xb3, 0x17, 0xff, 0xcc},	{0xb3, 0x00, 0x65, 0xcc},
779	{0xb8, 0x00, 0x00, 0xcc},	{0xbc, 0x00, 0xf0, 0xcc},
780	{0xbc, 0x01, 0x01, 0xcc},	{0xf0, 0x00, 0x02, 0xbb},
781	{0xc8, 0x9f, 0x0b, 0xbb},	{0x5b, 0x00, 0x01, 0xbb},
782	{0x2f, 0xde, 0x20, 0xbb},	{0xf0, 0x00, 0x00, 0xbb},
783	{0x20, 0x03, 0x02, 0xbb},	/* h/v flip */
784	{0xf0, 0x00, 0x01, 0xbb},
785	{0x05, 0x00, 0x07, 0xbb},	{0x34, 0x00, 0x00, 0xbb},
786	{0x35, 0xff, 0x00, 0xbb},	{0xdc, 0x07, 0x02, 0xbb},
787	{0xdd, 0x3c, 0x18, 0xbb},	{0xde, 0x92, 0x6d, 0xbb},
788	{0xdf, 0xcd, 0xb1, 0xbb},	{0xe0, 0xff, 0xe7, 0xbb},
789	{0x06, 0xf0, 0x0d, 0xbb},	{0x06, 0x70, 0x0e, 0xbb},
790	{0x4c, 0x00, 0x01, 0xbb},	{0x4d, 0x00, 0x01, 0xbb},
791	{0xf0, 0x00, 0x02, 0xbb},	{0x2e, 0x0c, 0x55, 0xbb},
792	{0x21, 0xb6, 0x6e, 0xbb},	{0x36, 0x30, 0x10, 0xbb},
793	{0x37, 0x00, 0xc1, 0xbb},	{0xf0, 0x00, 0x00, 0xbb},
794	{0x07, 0x00, 0x84, 0xbb},	{0x08, 0x02, 0x4a, 0xbb},
795	{0x05, 0x01, 0x10, 0xbb},	{0x06, 0x00, 0x39, 0xbb},
796	{0xf0, 0x00, 0x02, 0xbb},	{0x58, 0x02, 0x67, 0xbb},
797	{0x57, 0x02, 0x00, 0xbb},	{0x5a, 0x02, 0x67, 0xbb},
798	{0x59, 0x02, 0x00, 0xbb},	{0x5c, 0x12, 0x0d, 0xbb},
799	{0x5d, 0x16, 0x11, 0xbb},	{0x39, 0x06, 0x18, 0xbb},
800	{0x3a, 0x06, 0x18, 0xbb},	{0x3b, 0x06, 0x18, 0xbb},
801	{0x3c, 0x06, 0x18, 0xbb},	{0x64, 0x7b, 0x5b, 0xbb},
802	{0xf0, 0x00, 0x02, 0xbb},	{0x36, 0x30, 0x10, 0xbb},
803	{0x37, 0x00, 0xc0, 0xbb},	{0xbc, 0x0e, 0x00, 0xcc},
804	{0xbc, 0x0f, 0x05, 0xcc},	{0xbc, 0x10, 0xc0, 0xcc},
805	{0xbc, 0x11, 0x03, 0xcc},	{0xb6, 0x00, 0x00, 0xcc},
806	{0xb6, 0x03, 0x01, 0xcc},	{0xb6, 0x02, 0x40, 0xcc},
807	{0xb6, 0x05, 0x00, 0xcc},	{0xb6, 0x04, 0xf0, 0xcc},
808	{0xb6, 0x12, 0xf8, 0xcc},	{0xb6, 0x13, 0x25, 0xcc},
809	{0xb6, 0x18, 0x00, 0xcc},	{0xb6, 0x17, 0x96, 0xcc},
810	{0xb6, 0x16, 0x00, 0xcc},	{0xb6, 0x22, 0x12, 0xcc},
811	{0xb6, 0x23, 0x0b, 0xcc},	{0xbf, 0xc0, 0x39, 0xcc},
812	{0xbf, 0xc1, 0x04, 0xcc},	{0xbf, 0xcc, 0x00, 0xcc},
813	{0xb3, 0x5c, 0x01, 0xcc},	{0xf0, 0x00, 0x01, 0xbb},
814	{0x80, 0x00, 0x03, 0xbb},	{0x81, 0xc7, 0x14, 0xbb},
815	{0x82, 0xeb, 0xe8, 0xbb},	{0x83, 0xfe, 0xf4, 0xbb},
816	{0x84, 0xcd, 0x10, 0xbb},	{0x85, 0xf3, 0xee, 0xbb},
817	{0x86, 0xff, 0xf1, 0xbb},	{0x87, 0xcd, 0x10, 0xbb},
818	{0x88, 0xf3, 0xee, 0xbb},	{0x89, 0x01, 0xf1, 0xbb},
819	{0x8a, 0xe5, 0x17, 0xbb},	{0x8b, 0xe8, 0xe2, 0xbb},
820	{0x8c, 0xf7, 0xed, 0xbb},	{0x8d, 0x00, 0xff, 0xbb},
821	{0x8e, 0xec, 0x10, 0xbb},	{0x8f, 0xf0, 0xed, 0xbb},
822	{0x90, 0xf9, 0xf2, 0xbb},	{0x91, 0x00, 0x00, 0xbb},
823	{0x92, 0xe9, 0x0d, 0xbb},	{0x93, 0xf4, 0xf2, 0xbb},
824	{0x94, 0xfb, 0xf5, 0xbb},	{0x95, 0x00, 0xff, 0xbb},
825	{0xb6, 0x0f, 0x08, 0xbb},	{0xb7, 0x3d, 0x16, 0xbb},
826	{0xb8, 0x0c, 0x04, 0xbb},	{0xb9, 0x1c, 0x07, 0xbb},
827	{0xba, 0x0a, 0x03, 0xbb},	{0xbb, 0x1b, 0x09, 0xbb},
828	{0xbc, 0x17, 0x0d, 0xbb},	{0xbd, 0x23, 0x1d, 0xbb},
829	{0xbe, 0x00, 0x28, 0xbb},	{0xbf, 0x11, 0x09, 0xbb},
830	{0xc0, 0x16, 0x15, 0xbb},	{0xc1, 0x00, 0x1b, 0xbb},
831	{0xc2, 0x0e, 0x07, 0xbb},	{0xc3, 0x14, 0x10, 0xbb},
832	{0xc4, 0x00, 0x17, 0xbb},	{0x06, 0x74, 0x8e, 0xbb},
833	{0xf0, 0x00, 0x01, 0xbb},	{0x06, 0xf4, 0x8e, 0xbb},
834	{0x00, 0x00, 0x50, 0xdd},	{0x06, 0x74, 0x8e, 0xbb},
835	{0xf0, 0x00, 0x02, 0xbb},	{0x24, 0x50, 0x20, 0xbb},
836	{0xf0, 0x00, 0x02, 0xbb},	{0x34, 0x0c, 0x50, 0xbb},
837	{0xb3, 0x01, 0x41, 0xcc},	{0xf0, 0x00, 0x00, 0xbb},
838	{0x03, 0x03, 0xc0, 0xbb},
839	{},
840};
841static const u8 mi1310_soc_InitSXGA_JPG[][4] = {
842	{0xb0, 0x03, 0x19, 0xcc},
843	{0xb0, 0x04, 0x02, 0xcc},
844	{0xb3, 0x00, 0x64, 0xcc},
845	{0xb3, 0x00, 0x65, 0xcc},
846	{0xb3, 0x05, 0x00, 0xcc},
847	{0xb3, 0x06, 0x00, 0xcc},
848	{0xb3, 0x08, 0x01, 0xcc},
849	{0xb3, 0x09, 0x0c, 0xcc},
850	{0xb3, 0x34, 0x02, 0xcc},
851	{0xb3, 0x35, 0xdd, 0xcc},
852	{0xb3, 0x02, 0x00, 0xcc},
853	{0xb3, 0x03, 0x0a, 0xcc},
854	{0xb3, 0x04, 0x0d, 0xcc},
855	{0xb3, 0x20, 0x00, 0xcc},
856	{0xb3, 0x21, 0x00, 0xcc},
857	{0xb3, 0x22, 0x03, 0xcc},
858	{0xb3, 0x23, 0xc0, 0xcc},
859	{0xb3, 0x14, 0x00, 0xcc},
860	{0xb3, 0x15, 0x00, 0xcc},
861	{0xb3, 0x16, 0x04, 0xcc},
862	{0xb3, 0x17, 0xff, 0xcc},
863	{0xb3, 0x00, 0x65, 0xcc},
864	{0xb8, 0x00, 0x00, 0xcc},
865	{0xbc, 0x00, 0x70, 0xcc},
866	{0xbc, 0x01, 0x01, 0xcc},
867	{0xf0, 0x00, 0x02, 0xbb},
868	{0xc8, 0x9f, 0x0b, 0xbb},
869	{0x5b, 0x00, 0x01, 0xbb},
870	{0xf0, 0x00, 0x00, 0xbb},
871	{0x20, 0x03, 0x02, 0xbb},	/* h/v flip */
872	{0xf0, 0x00, 0x01, 0xbb},
873	{0x05, 0x00, 0x07, 0xbb},
874	{0x34, 0x00, 0x00, 0xbb},
875	{0x35, 0xff, 0x00, 0xbb},
876	{0xdc, 0x07, 0x02, 0xbb},
877	{0xdd, 0x3c, 0x18, 0xbb},
878	{0xde, 0x92, 0x6d, 0xbb},
879	{0xdf, 0xcd, 0xb1, 0xbb},
880	{0xe0, 0xff, 0xe7, 0xbb},
881	{0x06, 0xf0, 0x0d, 0xbb},
882	{0x06, 0x70, 0x0e, 0xbb},
883	{0x4c, 0x00, 0x01, 0xbb},
884	{0x4d, 0x00, 0x01, 0xbb},
885	{0xf0, 0x00, 0x02, 0xbb},
886	{0x2e, 0x0c, 0x60, 0xbb},
887	{0x21, 0xb6, 0x6e, 0xbb},
888	{0x37, 0x01, 0x40, 0xbb},
889	{0xf0, 0x00, 0x00, 0xbb},
890	{0x07, 0x00, 0x84, 0xbb},
891	{0x08, 0x02, 0x4a, 0xbb},
892	{0x05, 0x01, 0x10, 0xbb},
893	{0x06, 0x00, 0x39, 0xbb},
894	{0xf0, 0x00, 0x02, 0xbb},
895	{0x58, 0x02, 0x67, 0xbb},
896	{0x57, 0x02, 0x00, 0xbb},
897	{0x5a, 0x02, 0x67, 0xbb},
898	{0x59, 0x02, 0x00, 0xbb},
899	{0x5c, 0x12, 0x0d, 0xbb},
900	{0x5d, 0x16, 0x11, 0xbb},
901	{0x39, 0x06, 0x18, 0xbb},
902	{0x3a, 0x06, 0x18, 0xbb},
903	{0x3b, 0x06, 0x18, 0xbb},
904	{0x3c, 0x06, 0x18, 0xbb},
905	{0x64, 0x7b, 0x5b, 0xbb},
906	{0xb6, 0x00, 0x00, 0xcc},
907	{0xb6, 0x03, 0x05, 0xcc},
908	{0xb6, 0x02, 0x00, 0xcc},
909	{0xb6, 0x05, 0x03, 0xcc},
910	{0xb6, 0x04, 0xc0, 0xcc},
911	{0xb6, 0x12, 0xf8, 0xcc},
912	{0xb6, 0x13, 0x29, 0xcc},
913	{0xb6, 0x18, 0x09, 0xcc},
914	{0xb6, 0x17, 0x60, 0xcc},
915	{0xb6, 0x16, 0x00, 0xcc},
916	{0xb6, 0x22, 0x12, 0xcc},
917	{0xb6, 0x23, 0x0b, 0xcc},
918	{0xbf, 0xc0, 0x39, 0xcc},
919	{0xbf, 0xc1, 0x04, 0xcc},
920	{0xbf, 0xcc, 0x00, 0xcc},
921	{0xb3, 0x01, 0x41, 0xcc},
922	{0x00, 0x00, 0x80, 0xdd},
923	{0xf0, 0x00, 0x02, 0xbb},
924	{0x00, 0x00, 0x10, 0xdd},
925	{0x22, 0xa0, 0x78, 0xbb},
926	{0x23, 0xa0, 0x78, 0xbb},
927	{0x24, 0x7f, 0x00, 0xbb},
928	{0x28, 0xea, 0x02, 0xbb},
929	{0x29, 0x86, 0x7a, 0xbb},
930	{0x5e, 0x52, 0x4c, 0xbb},
931	{0x5f, 0x20, 0x24, 0xbb},
932	{0x60, 0x00, 0x02, 0xbb},
933	{0x02, 0x00, 0xee, 0xbb},
934	{0x03, 0x39, 0x23, 0xbb},
935	{0x04, 0x07, 0x24, 0xbb},
936	{0x09, 0x00, 0xc0, 0xbb},
937	{0x0a, 0x00, 0x79, 0xbb},
938	{0x0b, 0x00, 0x04, 0xbb},
939	{0x0c, 0x00, 0x5c, 0xbb},
940	{0x0d, 0x00, 0xd9, 0xbb},
941	{0x0e, 0x00, 0x53, 0xbb},
942	{0x0f, 0x00, 0x21, 0xbb},
943	{0x10, 0x00, 0xa4, 0xbb},
944	{0x11, 0x00, 0xe5, 0xbb},
945	{0x15, 0x00, 0x00, 0xbb},
946	{0x16, 0x00, 0x00, 0xbb},
947	{0x17, 0x00, 0x00, 0xbb},
948	{0x18, 0x00, 0x00, 0xbb},
949	{0x19, 0x00, 0x00, 0xbb},
950	{0x1a, 0x00, 0x00, 0xbb},
951	{0x1b, 0x00, 0x00, 0xbb},
952	{0x1c, 0x00, 0x00, 0xbb},
953	{0x1d, 0x00, 0x00, 0xbb},
954	{0x1e, 0x00, 0x00, 0xbb},
955	{0xf0, 0x00, 0x01, 0xbb},
956	{0x00, 0x00, 0x20, 0xdd},
957	{0x06, 0xf0, 0x8e, 0xbb},
958	{0x00, 0x00, 0x80, 0xdd},
959	{0x06, 0x70, 0x8e, 0xbb},
960	{0xf0, 0x00, 0x02, 0xbb},
961	{0x00, 0x00, 0x20, 0xdd},
962	{0x5e, 0x6a, 0x53, 0xbb},
963	{0x5f, 0x40, 0x2c, 0xbb},
964	{0xf0, 0x00, 0x01, 0xbb},
965	{0x00, 0x00, 0x20, 0xdd},
966	{0x58, 0x00, 0x00, 0xbb},
967	{0x53, 0x09, 0x03, 0xbb},
968	{0x54, 0x31, 0x18, 0xbb},
969	{0x55, 0x8b, 0x5f, 0xbb},
970	{0x56, 0xc0, 0xa9, 0xbb},
971	{0x57, 0xe0, 0xd2, 0xbb},
972	{0xe1, 0x00, 0x00, 0xbb},
973	{0xdc, 0x09, 0x03, 0xbb},
974	{0xdd, 0x31, 0x18, 0xbb},
975	{0xde, 0x8b, 0x5f, 0xbb},
976	{0xdf, 0xc0, 0xa9, 0xbb},
977	{0xe0, 0xe0, 0xd2, 0xbb},
978	{0xb3, 0x5c, 0x01, 0xcc},
979	{0xf0, 0x00, 0x01, 0xbb},
980	{0x06, 0xf0, 0x8e, 0xbb},
981	{0xf0, 0x00, 0x02, 0xbb},
982	{0x2f, 0xde, 0x20, 0xbb},
983	{0xf0, 0x00, 0x02, 0xbb},
984	{0x24, 0x50, 0x20, 0xbb},
985	{0xbc, 0x0e, 0x00, 0xcc},
986	{0xbc, 0x0f, 0x05, 0xcc},
987	{0xbc, 0x10, 0xc0, 0xcc},
988	{0xf0, 0x00, 0x02, 0xbb},
989	{0x34, 0x0c, 0x50, 0xbb},
990	{0xbc, 0x11, 0x03, 0xcc},
991	{0xf0, 0x00, 0x01, 0xbb},
992	{0x80, 0x00, 0x03, 0xbb},
993	{0x81, 0xc7, 0x14, 0xbb},
994	{0x82, 0xeb, 0xe8, 0xbb},
995	{0x83, 0xfe, 0xf4, 0xbb},
996	{0x84, 0xcd, 0x10, 0xbb},
997	{0x85, 0xf3, 0xee, 0xbb},
998	{0x86, 0xff, 0xf1, 0xbb},
999	{0x87, 0xcd, 0x10, 0xbb},
1000	{0x88, 0xf3, 0xee, 0xbb},
1001	{0x89, 0x01, 0xf1, 0xbb},
1002	{0x8a, 0xe5, 0x17, 0xbb},
1003	{0x8b, 0xe8, 0xe2, 0xbb},
1004	{0x8c, 0xf7, 0xed, 0xbb},
1005	{0x8d, 0x00, 0xff, 0xbb},
1006	{0x8e, 0xec, 0x10, 0xbb},
1007	{0x8f, 0xf0, 0xed, 0xbb},
1008	{0x90, 0xf9, 0xf2, 0xbb},
1009	{0x91, 0x00, 0x00, 0xbb},
1010	{0x92, 0xe9, 0x0d, 0xbb},
1011	{0x93, 0xf4, 0xf2, 0xbb},
1012	{0x94, 0xfb, 0xf5, 0xbb},
1013	{0x95, 0x00, 0xff, 0xbb},
1014	{0xb6, 0x0f, 0x08, 0xbb},
1015	{0xb7, 0x3d, 0x16, 0xbb},
1016	{0xb8, 0x0c, 0x04, 0xbb},
1017	{0xb9, 0x1c, 0x07, 0xbb},
1018	{0xba, 0x0a, 0x03, 0xbb},
1019	{0xbb, 0x1b, 0x09, 0xbb},
1020	{0xbc, 0x17, 0x0d, 0xbb},
1021	{0xbd, 0x23, 0x1d, 0xbb},
1022	{0xbe, 0x00, 0x28, 0xbb},
1023	{0xbf, 0x11, 0x09, 0xbb},
1024	{0xc0, 0x16, 0x15, 0xbb},
1025	{0xc1, 0x00, 0x1b, 0xbb},
1026	{0xc2, 0x0e, 0x07, 0xbb},
1027	{0xc3, 0x14, 0x10, 0xbb},
1028	{0xc4, 0x00, 0x17, 0xbb},
1029	{0x06, 0x74, 0x8e, 0xbb},
1030	{0xf0, 0x00, 0x00, 0xbb},
1031	{0x03, 0x03, 0xc0, 0xbb},
1032	{}
1033};
1034
1035static const u8 mi1320_gamma[17] = {
1036	0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
1037	0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
1038};
1039static const u8 mi1320_matrix[9] = {
1040	0x54, 0xda, 0x06, 0xf1, 0x50, 0xf4, 0xf7, 0xea, 0x52
1041};
1042static const u8 mi1320_initVGA_data[][4] = {
1043	{0xb3, 0x01, 0x01, 0xcc},	{0x00, 0x00, 0x33, 0xdd},
1044	{0xb0, 0x03, 0x19, 0xcc},	{0x00, 0x00, 0x33, 0xdd},
1045	{0xb0, 0x04, 0x02, 0xcc},	{0x00, 0x00, 0x33, 0xdd},
1046	{0xb3, 0x00, 0x64, 0xcc},	{0xb3, 0x00, 0x65, 0xcc},
1047	{0xb0, 0x16, 0x03, 0xcc},	{0xb3, 0x05, 0x00, 0xcc},
1048	{0xb3, 0x06, 0x00, 0xcc},	{0xb3, 0x08, 0x01, 0xcc},
1049	{0xb3, 0x09, 0x0c, 0xcc},	{0xb3, 0x34, 0x02, 0xcc},
1050	{0xb3, 0x35, 0xc8, 0xcc},	/* i2c add: 48 */
1051	{0xb3, 0x02, 0x00, 0xcc},
1052	{0xb3, 0x03, 0x0a, 0xcc},	{0xb3, 0x04, 0x05, 0xcc},
1053	{0xb3, 0x20, 0x00, 0xcc},	{0xb3, 0x21, 0x00, 0xcc},
1054	{0xb3, 0x22, 0x03, 0xcc},	{0xb3, 0x23, 0xc0, 0xcc},
1055	{0xb3, 0x14, 0x00, 0xcc},	{0xb3, 0x15, 0x00, 0xcc},
1056	{0xb3, 0x16, 0x04, 0xcc},	{0xb3, 0x17, 0xff, 0xcc},
1057	{0xb3, 0x00, 0x67, 0xcc},	{0xbc, 0x00, 0xd0, 0xcc},
1058	{0xbc, 0x01, 0x01, 0xcc},	{0xf0, 0x00, 0x00, 0xbb},
1059	{0x0d, 0x00, 0x09, 0xbb},	{0x00, 0x01, 0x00, 0xdd},
1060	{0x0d, 0x00, 0x08, 0xbb},	{0xf0, 0x00, 0x01, 0xbb},
1061	{0xa1, 0x05, 0x00, 0xbb},	{0xa4, 0x03, 0xc0, 0xbb},
1062	{0xf0, 0x00, 0x02, 0xbb},	{0x00, 0x00, 0x10, 0xdd},
1063	{0xc8, 0x9f, 0x0b, 0xbb},	{0x00, 0x00, 0x10, 0xdd},
1064	{0xf0, 0x00, 0x00, 0xbb},	{0x00, 0x00, 0x10, 0xdd},
1065	{0x20, 0x01, 0x00, 0xbb},	{0x00, 0x00, 0x10, 0xdd},
1066	{0xf0, 0x00, 0x01, 0xbb},	{0x9d, 0x3c, 0xa0, 0xbb},
1067	{0x47, 0x30, 0x30, 0xbb},	{0xf0, 0x00, 0x00, 0xbb},
1068	{0x0a, 0x80, 0x11, 0xbb},	{0x35, 0x00, 0x22, 0xbb},
1069	{0xf0, 0x00, 0x02, 0xbb},	{0x9d, 0xc5, 0x05, 0xbb},
1070	{0xdc, 0x0f, 0xfc, 0xbb},	{0xf0, 0x00, 0x01, 0xbb},
1071	{0x06, 0x74, 0x0e, 0xbb},	{0x80, 0x00, 0x06, 0xbb},
1072	{0x81, 0x04, 0x00, 0xbb},	{0x82, 0x01, 0x02, 0xbb},
1073	{0x83, 0x03, 0x02, 0xbb},	{0x84, 0x05, 0x00, 0xbb},
1074	{0x85, 0x01, 0x00, 0xbb},	{0x86, 0x03, 0x02, 0xbb},
1075	{0x87, 0x05, 0x00, 0xbb},	{0x88, 0x01, 0x00, 0xbb},
1076	{0x89, 0x02, 0x02, 0xbb},	{0x8a, 0xfd, 0x04, 0xbb},
1077	{0x8b, 0xfc, 0xfd, 0xbb},	{0x8c, 0xff, 0xfd, 0xbb},
1078	{0x8d, 0x00, 0x00, 0xbb},	{0x8e, 0xfe, 0x05, 0xbb},
1079	{0x8f, 0xfc, 0xfd, 0xbb},	{0x90, 0xfe, 0xfd, 0xbb},
1080	{0x91, 0x00, 0x00, 0xbb},	{0x92, 0xfe, 0x03, 0xbb},
1081	{0x93, 0xfd, 0xfe, 0xbb},	{0x94, 0xff, 0xfd, 0xbb},
1082	{0x95, 0x00, 0x00, 0xbb},	{0xb6, 0x07, 0x05, 0xbb},
1083	{0xb7, 0x13, 0x06, 0xbb},	{0xb8, 0x08, 0x06, 0xbb},
1084	{0xb9, 0x14, 0x08, 0xbb},	{0xba, 0x06, 0x05, 0xbb},
1085	{0xbb, 0x13, 0x06, 0xbb},	{0xbc, 0x03, 0x01, 0xbb},
1086	{0xbd, 0x03, 0x04, 0xbb},	{0xbe, 0x00, 0x02, 0xbb},
1087	{0xbf, 0x03, 0x01, 0xbb},	{0xc0, 0x02, 0x04, 0xbb},
1088	{0xc1, 0x00, 0x04, 0xbb},	{0xc2, 0x02, 0x01, 0xbb},
1089	{0xc3, 0x01, 0x03, 0xbb},	{0xc4, 0x00, 0x04, 0xbb},
1090	{0xf0, 0x00, 0x00, 0xbb},	{0x05, 0x01, 0x13, 0xbb},
1091	{0x06, 0x00, 0x11, 0xbb},	{0x07, 0x00, 0x85, 0xbb},
1092	{0x08, 0x00, 0x27, 0xbb},
1093	{0x20, 0x01, 0x00, 0xbb},	/* h/v flips - was 03 */
1094	{0x21, 0x80, 0x00, 0xbb},	{0x22, 0x0d, 0x0f, 0xbb},
1095	{0x24, 0x80, 0x00, 0xbb},	{0x59, 0x00, 0xff, 0xbb},
1096	{0xf0, 0x00, 0x02, 0xbb},	{0x39, 0x03, 0x0d, 0xbb},
1097	{0x3a, 0x06, 0x1b, 0xbb},	{0x3b, 0x00, 0x95, 0xbb},
1098	{0x3c, 0x04, 0xdb, 0xbb},	{0x57, 0x02, 0x00, 0xbb},
1099	{0x58, 0x02, 0x66, 0xbb},	{0x59, 0x00, 0xff, 0xbb},
1100	{0x5a, 0x01, 0x33, 0xbb},	{0x5c, 0x12, 0x0d, 0xbb},
1101	{0x5d, 0x16, 0x11, 0xbb},	{0x64, 0x5e, 0x1c, 0xbb},
1102	{0xf0, 0x00, 0x02, 0xbb},	{0x2f, 0xd1, 0x00, 0xbb},
1103	{0x5b, 0x00, 0x01, 0xbb},	{0xf0, 0x00, 0x02, 0xbb},
1104	{0x36, 0x68, 0x10, 0xbb},	{0x00, 0x00, 0x30, 0xdd},
1105	{0x37, 0x82, 0x00, 0xbb},	{0xbc, 0x0e, 0x00, 0xcc},
1106	{0xbc, 0x0f, 0x05, 0xcc},	{0xbc, 0x10, 0xc0, 0xcc},
1107	{0xbc, 0x11, 0x03, 0xcc},	{0xb6, 0x00, 0x00, 0xcc},
1108	{0xb6, 0x03, 0x05, 0xcc},	{0xb6, 0x02, 0x00, 0xcc},
1109	{0xb6, 0x05, 0x04, 0xcc},	{0xb6, 0x04, 0x00, 0xcc},
1110	{0xb6, 0x12, 0xf8, 0xcc},	{0xb6, 0x13, 0x29, 0xcc},
1111	{0xb6, 0x18, 0x0a, 0xcc},	{0xb6, 0x17, 0x00, 0xcc},
1112	{0xb6, 0x16, 0x00, 0xcc},	{0xb6, 0x22, 0x12, 0xcc},
1113	{0xb6, 0x23, 0x0b, 0xcc},	{0xbf, 0xc0, 0x26, 0xcc},
1114	{0xbf, 0xc1, 0x02, 0xcc},	{0xbf, 0xcc, 0x04, 0xcc},
1115	{0xbc, 0x02, 0x18, 0xcc},	{0xbc, 0x03, 0x50, 0xcc},
1116	{0xbc, 0x04, 0x18, 0xcc},	{0xbc, 0x05, 0x00, 0xcc},
1117	{0xbc, 0x06, 0x00, 0xcc},	{0xbc, 0x08, 0x30, 0xcc},
1118	{0xbc, 0x09, 0x40, 0xcc},	{0xbc, 0x0a, 0x10, 0xcc},
1119	{0xbc, 0x0b, 0x00, 0xcc},	{0xbc, 0x0c, 0x00, 0xcc},
1120	{0xb3, 0x5c, 0x01, 0xcc},	{0xb3, 0x01, 0x41, 0xcc},
1121	{}
1122};
1123static const u8 mi1320_initQVGA_data[][4] = {
1124	{0xb3, 0x01, 0x01, 0xcc},	{0x00, 0x00, 0x33, 0xdd},
1125	{0xb0, 0x03, 0x19, 0xcc},	{0x00, 0x00, 0x33, 0xdd},
1126	{0xb0, 0x04, 0x02, 0xcc},	{0x00, 0x00, 0x33, 0xdd},
1127	{0xb3, 0x00, 0x64, 0xcc},	{0xb3, 0x00, 0x65, 0xcc},
1128	{0xb0, 0x16, 0x03, 0xcc},	{0xb3, 0x05, 0x01, 0xcc},
1129	{0xb3, 0x06, 0x01, 0xcc},	{0xb3, 0x08, 0x01, 0xcc},
1130	{0xb3, 0x09, 0x0c, 0xcc},	{0xb3, 0x34, 0x02, 0xcc},
1131	{0xb3, 0x35, 0xc8, 0xcc},	{0xb3, 0x02, 0x00, 0xcc},
1132	{0xb3, 0x03, 0x0a, 0xcc},	{0xb3, 0x04, 0x05, 0xcc},
1133	{0xb3, 0x20, 0x00, 0xcc},	{0xb3, 0x21, 0x00, 0xcc},
1134	{0xb3, 0x22, 0x01, 0xcc},	{0xb3, 0x23, 0xe0, 0xcc},
1135	{0xb3, 0x14, 0x00, 0xcc},	{0xb3, 0x15, 0x00, 0xcc},
1136	{0xb3, 0x16, 0x02, 0xcc},	{0xb3, 0x17, 0x7f, 0xcc},
1137	{0xb3, 0x00, 0x65, 0xcc},	{0xb8, 0x00, 0x00, 0xcc},
1138	{0xbc, 0x00, 0xd0, 0xcc},	{0xbc, 0x01, 0x01, 0xcc},
1139	{0xf0, 0x00, 0x00, 0xbb},	{0x0d, 0x00, 0x09, 0xbb},
1140	{0x00, 0x01, 0x00, 0xdd},	{0x0d, 0x00, 0x08, 0xbb},
1141	{0xf0, 0x00, 0x00, 0xbb},	{0x02, 0x00, 0x64, 0xbb},
1142	{0x05, 0x01, 0x78, 0xbb},	{0x06, 0x00, 0x11, 0xbb},
1143	{0x07, 0x01, 0x42, 0xbb},	{0x08, 0x00, 0x11, 0xbb},
1144	{0x20, 0x01, 0x00, 0xbb},	{0x21, 0x80, 0x00, 0xbb},
1145	{0x22, 0x0d, 0x0f, 0xbb},	{0x24, 0x80, 0x00, 0xbb},
1146	{0x59, 0x00, 0xff, 0xbb},	{0xf0, 0x00, 0x01, 0xbb},
1147	{0x9d, 0x3c, 0xa0, 0xbb},	{0x47, 0x30, 0x30, 0xbb},
1148	{0xf0, 0x00, 0x00, 0xbb},	{0x0a, 0x80, 0x11, 0xbb},
1149	{0x35, 0x00, 0x22, 0xbb},	{0xf0, 0x00, 0x02, 0xbb},
1150	{0x9d, 0xc5, 0x05, 0xbb},	{0xdc, 0x0f, 0xfc, 0xbb},
1151	{0xf0, 0x00, 0x01, 0xbb},	{0x06, 0x74, 0x0e, 0xbb},
1152	{0x80, 0x00, 0x06, 0xbb},	{0x81, 0x04, 0x00, 0xbb},
1153	{0x82, 0x01, 0x02, 0xbb},	{0x83, 0x03, 0x02, 0xbb},
1154	{0x84, 0x05, 0x00, 0xbb},	{0x85, 0x01, 0x00, 0xbb},
1155	{0x86, 0x03, 0x02, 0xbb},	{0x87, 0x05, 0x00, 0xbb},
1156	{0x88, 0x01, 0x00, 0xbb},	{0x89, 0x02, 0x02, 0xbb},
1157	{0x8a, 0xfd, 0x04, 0xbb},	{0x8b, 0xfc, 0xfd, 0xbb},
1158	{0x8c, 0xff, 0xfd, 0xbb},	{0x8d, 0x00, 0x00, 0xbb},
1159	{0x8e, 0xfe, 0x05, 0xbb},	{0x8f, 0xfc, 0xfd, 0xbb},
1160	{0x90, 0xfe, 0xfd, 0xbb},	{0x91, 0x00, 0x00, 0xbb},
1161	{0x92, 0xfe, 0x03, 0xbb},	{0x93, 0xfd, 0xfe, 0xbb},
1162	{0x94, 0xff, 0xfd, 0xbb},	{0x95, 0x00, 0x00, 0xbb},
1163	{0xb6, 0x07, 0x05, 0xbb},	{0xb7, 0x13, 0x06, 0xbb},
1164	{0xb8, 0x08, 0x06, 0xbb},	{0xb9, 0x14, 0x08, 0xbb},
1165	{0xba, 0x06, 0x05, 0xbb},	{0xbb, 0x13, 0x06, 0xbb},
1166	{0xbc, 0x03, 0x01, 0xbb},	{0xbd, 0x03, 0x04, 0xbb},
1167	{0xbe, 0x00, 0x02, 0xbb},	{0xbf, 0x03, 0x01, 0xbb},
1168	{0xc0, 0x02, 0x04, 0xbb},	{0xc1, 0x00, 0x04, 0xbb},
1169	{0xc2, 0x02, 0x01, 0xbb},	{0xc3, 0x01, 0x03, 0xbb},
1170	{0xc4, 0x00, 0x04, 0xbb},	{0xf0, 0x00, 0x02, 0xbb},
1171	{0xc8, 0x00, 0x00, 0xbb},	{0x2e, 0x00, 0x00, 0xbb},
1172	{0x2e, 0x0c, 0x5b, 0xbb},	{0x2f, 0xd1, 0x00, 0xbb},
1173	{0x39, 0x03, 0xca, 0xbb},	{0x3a, 0x06, 0x80, 0xbb},
1174	{0x3b, 0x01, 0x52, 0xbb},	{0x3c, 0x05, 0x40, 0xbb},
1175	{0x57, 0x01, 0x9c, 0xbb},	{0x58, 0x01, 0xee, 0xbb},
1176	{0x59, 0x00, 0xf0, 0xbb},	{0x5a, 0x01, 0x20, 0xbb},
1177	{0x5c, 0x1d, 0x17, 0xbb},	{0x5d, 0x22, 0x1c, 0xbb},
1178	{0x64, 0x1e, 0x1c, 0xbb},	{0x5b, 0x00, 0x01, 0xbb},
1179	{0xf0, 0x00, 0x02, 0xbb},	{0x36, 0x68, 0x10, 0xbb},
1180	{0x00, 0x00, 0x30, 0xdd},	{0x37, 0x81, 0x00, 0xbb},
1181	{0xbc, 0x02, 0x18, 0xcc},	{0xbc, 0x03, 0x50, 0xcc},
1182	{0xbc, 0x04, 0x18, 0xcc},	{0xbc, 0x05, 0x00, 0xcc},
1183	{0xbc, 0x06, 0x00, 0xcc},	{0xbc, 0x08, 0x30, 0xcc},
1184	{0xbc, 0x09, 0x40, 0xcc},	{0xbc, 0x0a, 0x10, 0xcc},
1185	{0xbc, 0x0b, 0x00, 0xcc},	{0xbc, 0x0c, 0x00, 0xcc},
1186	{0xbf, 0xc0, 0x26, 0xcc},	{0xbf, 0xc1, 0x02, 0xcc},
1187	{0xbf, 0xcc, 0x04, 0xcc},	{0xb3, 0x5c, 0x01, 0xcc},
1188	{0xb3, 0x01, 0x41, 0xcc},
1189	{}
1190};
1191
1192static const u8 mi1320_soc_InitVGA[][4] = {
1193	{0xb3, 0x01, 0x01, 0xcc},
1194	{0xb0, 0x03, 0x19, 0xcc},
1195	{0xb0, 0x04, 0x02, 0xcc},
1196	{0x00, 0x00, 0x30, 0xdd},
1197	{0xb3, 0x00, 0x64, 0xcc},
1198	{0xb3, 0x00, 0x67, 0xcc},
1199	{0xb3, 0x05, 0x01, 0xcc},
1200	{0xb3, 0x06, 0x01, 0xcc},
1201	{0xb3, 0x08, 0x01, 0xcc},
1202	{0xb3, 0x09, 0x0c, 0xcc},
1203	{0xb3, 0x34, 0x02, 0xcc},
1204	{0xb3, 0x35, 0xc8, 0xcc},	/* i2c add: 48 */
1205	{0xb3, 0x02, 0x00, 0xcc},
1206	{0xb3, 0x03, 0x0a, 0xcc},
1207	{0xb3, 0x04, 0x05, 0xcc},
1208	{0xb3, 0x20, 0x00, 0xcc},
1209	{0xb3, 0x21, 0x00, 0xcc},
1210	{0xb3, 0x22, 0x01, 0xcc},
1211	{0xb3, 0x23, 0xe0, 0xcc},
1212	{0xb3, 0x14, 0x00, 0xcc},
1213	{0xb3, 0x15, 0x00, 0xcc},
1214	{0xb3, 0x16, 0x02, 0xcc},
1215	{0xb3, 0x17, 0x7f, 0xcc},
1216	{0xb3, 0x00, 0x67, 0xcc},
1217	{0xb8, 0x00, 0x00, 0xcc},
1218	{0xbc, 0x00, 0x71, 0xcc},
1219	{0xbc, 0x01, 0x01, 0xcc},
1220	{0xb3, 0x5c, 0x01, 0xcc},
1221	{0xf0, 0x00, 0x02, 0xbb},
1222	{0x00, 0x00, 0x10, 0xdd},
1223	{0xc8, 0x00, 0x00, 0xbb},
1224	{0x00, 0x00, 0x30, 0xdd},
1225	{0xf0, 0x00, 0x00, 0xbb},
1226	{0x00, 0x00, 0x10, 0xdd},
1227	{0x07, 0x00, 0xe0, 0xbb},
1228	{0x08, 0x00, 0x0b, 0xbb},
1229	{0x21, 0x00, 0x0c, 0xbb},
1230	{0x20, 0x01, 0x03, 0xbb},	/* h/v flip */
1231	{0xbf, 0xc0, 0x26, 0xcc},
1232	{0xbf, 0xc1, 0x02, 0xcc},
1233	{0xbf, 0xcc, 0x04, 0xcc},
1234	{0xb3, 0x01, 0x41, 0xcc},
1235	{0xf0, 0x00, 0x00, 0xbb},
1236	{0x05, 0x01, 0x78, 0xbb},
1237	{0x06, 0x00, 0x11, 0xbb},
1238	{0x07, 0x01, 0x42, 0xbb},
1239	{0x08, 0x00, 0x11, 0xbb},
1240	{0x20, 0x01, 0x03, 0xbb},	/* h/v flip */
1241	{0x21, 0x80, 0x00, 0xbb},
1242	{0x22, 0x0d, 0x0f, 0xbb},
1243	{0x24, 0x80, 0x00, 0xbb},
1244	{0x59, 0x00, 0xff, 0xbb},
1245	{0xf0, 0x00, 0x02, 0xbb},
1246	{0x39, 0x03, 0xca, 0xbb},
1247	{0x3a, 0x06, 0x80, 0xbb},
1248	{0x3b, 0x01, 0x52, 0xbb},
1249	{0x3c, 0x05, 0x40, 0xbb},
1250	{0x57, 0x01, 0x9c, 0xbb},
1251	{0x58, 0x01, 0xee, 0xbb},
1252	{0x59, 0x00, 0xf0, 0xbb},
1253	{0x5a, 0x01, 0x20, 0xbb},
1254	{0x5c, 0x1d, 0x17, 0xbb},
1255	{0x5d, 0x22, 0x1c, 0xbb},
1256	{0x64, 0x1e, 0x1c, 0xbb},
1257	{0x5b, 0x00, 0x00, 0xbb},
1258	{0xf0, 0x00, 0x02, 0xbb},
1259	{0x22, 0xa0, 0x78, 0xbb},
1260	{0x23, 0xa0, 0x78, 0xbb},
1261	{0x24, 0x7f, 0x00, 0xbb},
1262	{0x28, 0xea, 0x02, 0xbb},
1263	{0x29, 0x86, 0x7a, 0xbb},
1264	{0x5e, 0x52, 0x4c, 0xbb},
1265	{0x5f, 0x20, 0x24, 0xbb},
1266	{0x60, 0x00, 0x02, 0xbb},
1267	{0x02, 0x00, 0xee, 0xbb},
1268	{0x03, 0x39, 0x23, 0xbb},
1269	{0x04, 0x07, 0x24, 0xbb},
1270	{0x09, 0x00, 0xc0, 0xbb},
1271	{0x0a, 0x00, 0x79, 0xbb},
1272	{0x0b, 0x00, 0x04, 0xbb},
1273	{0x0c, 0x00, 0x5c, 0xbb},
1274	{0x0d, 0x00, 0xd9, 0xbb},
1275	{0x0e, 0x00, 0x53, 0xbb},
1276	{0x0f, 0x00, 0x21, 0xbb},
1277	{0x10, 0x00, 0xa4, 0xbb},
1278	{0x11, 0x00, 0xe5, 0xbb},
1279	{0x15, 0x00, 0x00, 0xbb},
1280	{0x16, 0x00, 0x00, 0xbb},
1281	{0x17, 0x00, 0x00, 0xbb},
1282	{0x18, 0x00, 0x00, 0xbb},
1283	{0x19, 0x00, 0x00, 0xbb},
1284	{0x1a, 0x00, 0x00, 0xbb},
1285	{0x1b, 0x00, 0x00, 0xbb},
1286	{0x1c, 0x00, 0x00, 0xbb},
1287	{0x1d, 0x00, 0x00, 0xbb},
1288	{0x1e, 0x00, 0x00, 0xbb},
1289	{0xf0, 0x00, 0x01, 0xbb},
1290	{0x06, 0xe0, 0x0e, 0xbb},
1291	{0x06, 0x60, 0x0e, 0xbb},
1292	{0xb3, 0x5c, 0x01, 0xcc},
1293	{}
1294};
1295static const u8 mi1320_soc_InitQVGA[][4] = {
1296	{0xb3, 0x01, 0x01, 0xcc},
1297	{0xb0, 0x03, 0x19, 0xcc},
1298	{0xb0, 0x04, 0x02, 0xcc},
1299	{0x00, 0x00, 0x30, 0xdd},
1300	{0xb3, 0x00, 0x64, 0xcc},
1301	{0xb3, 0x00, 0x67, 0xcc},
1302	{0xb3, 0x05, 0x01, 0xcc},
1303	{0xb3, 0x06, 0x01, 0xcc},
1304	{0xb3, 0x08, 0x01, 0xcc},
1305	{0xb3, 0x09, 0x0c, 0xcc},
1306	{0xb3, 0x34, 0x02, 0xcc},
1307	{0xb3, 0x35, 0xc8, 0xcc},
1308	{0xb3, 0x02, 0x00, 0xcc},
1309	{0xb3, 0x03, 0x0a, 0xcc},
1310	{0xb3, 0x04, 0x05, 0xcc},
1311	{0xb3, 0x20, 0x00, 0xcc},
1312	{0xb3, 0x21, 0x00, 0xcc},
1313	{0xb3, 0x22, 0x01, 0xcc},
1314	{0xb3, 0x23, 0xe0, 0xcc},
1315	{0xb3, 0x14, 0x00, 0xcc},
1316	{0xb3, 0x15, 0x00, 0xcc},
1317	{0xb3, 0x16, 0x02, 0xcc},
1318	{0xb3, 0x17, 0x7f, 0xcc},
1319	{0xb3, 0x00, 0x67, 0xcc},
1320	{0xb8, 0x00, 0x00, 0xcc},
1321	{0xbc, 0x00, 0xd1, 0xcc},
1322	{0xbc, 0x01, 0x01, 0xcc},
1323	{0xb3, 0x5c, 0x01, 0xcc},
1324	{0xf0, 0x00, 0x02, 0xbb},
1325	{0x00, 0x00, 0x10, 0xdd},
1326	{0xc8, 0x00, 0x00, 0xbb},
1327	{0x00, 0x00, 0x30, 0xdd},
1328	{0xf0, 0x00, 0x00, 0xbb},
1329	{0x00, 0x00, 0x10, 0xdd},
1330	{0x07, 0x00, 0xe0, 0xbb},
1331	{0x08, 0x00, 0x0b, 0xbb},
1332	{0x21, 0x00, 0x0c, 0xbb},
1333	{0x20, 0x01, 0x03, 0xbb},	/* h/v flip */
1334	{0xbf, 0xc0, 0x26, 0xcc},
1335	{0xbf, 0xc1, 0x02, 0xcc},
1336	{0xbf, 0xcc, 0x04, 0xcc},
1337	{0xbc, 0x02, 0x18, 0xcc},
1338	{0xbc, 0x03, 0x50, 0xcc},
1339	{0xbc, 0x04, 0x18, 0xcc},
1340	{0xbc, 0x05, 0x00, 0xcc},
1341	{0xbc, 0x06, 0x00, 0xcc},
1342	{0xbc, 0x08, 0x30, 0xcc},
1343	{0xbc, 0x09, 0x40, 0xcc},
1344	{0xbc, 0x0a, 0x10, 0xcc},
1345	{0xbc, 0x0b, 0x00, 0xcc},
1346	{0xbc, 0x0c, 0x00, 0xcc},
1347	{0xb3, 0x01, 0x41, 0xcc},
1348	{0xf0, 0x00, 0x00, 0xbb},
1349	{0x05, 0x01, 0x78, 0xbb},
1350	{0x06, 0x00, 0x11, 0xbb},
1351	{0x07, 0x01, 0x42, 0xbb},
1352	{0x08, 0x00, 0x11, 0xbb},
1353	{0x20, 0x01, 0x03, 0xbb},	/* h/v flip */
1354	{0x21, 0x80, 0x00, 0xbb},
1355	{0x22, 0x0d, 0x0f, 0xbb},
1356	{0x24, 0x80, 0x00, 0xbb},
1357	{0x59, 0x00, 0xff, 0xbb},
1358	{0xf0, 0x00, 0x02, 0xbb},
1359	{0x39, 0x03, 0xca, 0xbb},
1360	{0x3a, 0x06, 0x80, 0xbb},
1361	{0x3b, 0x01, 0x52, 0xbb},
1362	{0x3c, 0x05, 0x40, 0xbb},
1363	{0x57, 0x01, 0x9c, 0xbb},
1364	{0x58, 0x01, 0xee, 0xbb},
1365	{0x59, 0x00, 0xf0, 0xbb},
1366	{0x5a, 0x01, 0x20, 0xbb},
1367	{0x5c, 0x1d, 0x17, 0xbb},
1368	{0x5d, 0x22, 0x1c, 0xbb},
1369	{0x64, 0x1e, 0x1c, 0xbb},
1370	{0x5b, 0x00, 0x00, 0xbb},
1371	{0xf0, 0x00, 0x02, 0xbb},
1372	{0x22, 0xa0, 0x78, 0xbb},
1373	{0x23, 0xa0, 0x78, 0xbb},
1374	{0x24, 0x7f, 0x00, 0xbb},
1375	{0x28, 0xea, 0x02, 0xbb},
1376	{0x29, 0x86, 0x7a, 0xbb},
1377	{0x5e, 0x52, 0x4c, 0xbb},
1378	{0x5f, 0x20, 0x24, 0xbb},
1379	{0x60, 0x00, 0x02, 0xbb},
1380	{0x02, 0x00, 0xee, 0xbb},
1381	{0x03, 0x39, 0x23, 0xbb},
1382	{0x04, 0x07, 0x24, 0xbb},
1383	{0x09, 0x00, 0xc0, 0xbb},
1384	{0x0a, 0x00, 0x79, 0xbb},
1385	{0x0b, 0x00, 0x04, 0xbb},
1386	{0x0c, 0x00, 0x5c, 0xbb},
1387	{0x0d, 0x00, 0xd9, 0xbb},
1388	{0x0e, 0x00, 0x53, 0xbb},
1389	{0x0f, 0x00, 0x21, 0xbb},
1390	{0x10, 0x00, 0xa4, 0xbb},
1391	{0x11, 0x00, 0xe5, 0xbb},
1392	{0x15, 0x00, 0x00, 0xbb},
1393	{0x16, 0x00, 0x00, 0xbb},
1394	{0x17, 0x00, 0x00, 0xbb},
1395	{0x18, 0x00, 0x00, 0xbb},
1396	{0x19, 0x00, 0x00, 0xbb},
1397	{0x1a, 0x00, 0x00, 0xbb},
1398	{0x1b, 0x00, 0x00, 0xbb},
1399	{0x1c, 0x00, 0x00, 0xbb},
1400	{0x1d, 0x00, 0x00, 0xbb},
1401	{0x1e, 0x00, 0x00, 0xbb},
1402	{0xf0, 0x00, 0x01, 0xbb},
1403	{0x06, 0xe0, 0x0e, 0xbb},
1404	{0x06, 0x60, 0x0e, 0xbb},
1405	{0xb3, 0x5c, 0x01, 0xcc},
1406	{}
1407};
1408static const u8 mi1320_soc_InitSXGA[][4] = {
1409	{0xb3, 0x01, 0x01, 0xcc},
1410	{0xb0, 0x03, 0x19, 0xcc},
1411	{0x00, 0x00, 0x30, 0xdd},
1412	{0xb3, 0x00, 0x64, 0xcc},
1413	{0xb3, 0x00, 0x67, 0xcc},
1414	{0xb3, 0x05, 0x01, 0xcc},
1415	{0xb3, 0x06, 0x01, 0xcc},
1416	{0xb3, 0x08, 0x01, 0xcc},
1417	{0xb3, 0x09, 0x0c, 0xcc},
1418	{0xb3, 0x34, 0x02, 0xcc},
1419	{0xb3, 0x35, 0xc8, 0xcc},
1420	{0xb3, 0x02, 0x00, 0xcc},
1421	{0xb3, 0x03, 0x0a, 0xcc},
1422	{0xb3, 0x04, 0x05, 0xcc},
1423	{0xb3, 0x20, 0x00, 0xcc},
1424	{0xb3, 0x21, 0x00, 0xcc},
1425	{0xb3, 0x22, 0x04, 0xcc},
1426	{0xb3, 0x23, 0x00, 0xcc},
1427	{0xb3, 0x14, 0x00, 0xcc},
1428	{0xb3, 0x15, 0x00, 0xcc},
1429	{0xb3, 0x16, 0x04, 0xcc},
1430	{0xb3, 0x17, 0xff, 0xcc},
1431	{0xb3, 0x00, 0x67, 0xcc},
1432	{0xbc, 0x00, 0x71, 0xcc},
1433	{0xbc, 0x01, 0x01, 0xcc},
1434	{0xb3, 0x5c, 0x01, 0xcc},
1435	{0xf0, 0x00, 0x02, 0xbb},
1436	{0x00, 0x00, 0x30, 0xdd},
1437	{0xc8, 0x9f, 0x0b, 0xbb},
1438	{0x00, 0x00, 0x20, 0xdd},
1439	{0x5b, 0x00, 0x01, 0xbb},
1440	{0x00, 0x00, 0x20, 0xdd},
1441	{0xf0, 0x00, 0x00, 0xbb},
1442	{0x00, 0x00, 0x30, 0xdd},
1443	{0x20, 0x01, 0x03, 0xbb},	/* h/v flip */
1444	{0x00, 0x00, 0x20, 0xdd},
1445	{0xbf, 0xc0, 0x26, 0xcc},
1446	{0xbf, 0xc1, 0x02, 0xcc},
1447	{0xbf, 0xcc, 0x04, 0xcc},
1448	{0xb3, 0x01, 0x41, 0xcc},
1449	{0xf0, 0x00, 0x00, 0xbb},
1450	{0x05, 0x01, 0x78, 0xbb},
1451	{0x06, 0x00, 0x11, 0xbb},
1452	{0x07, 0x01, 0x42, 0xbb},
1453	{0x08, 0x00, 0x11, 0xbb},
1454	{0x20, 0x01, 0x03, 0xbb},	/* h/v flip */
1455	{0x21, 0x80, 0x00, 0xbb},
1456	{0x22, 0x0d, 0x0f, 0xbb},
1457	{0x24, 0x80, 0x00, 0xbb},
1458	{0x59, 0x00, 0xff, 0xbb},
1459	{0xf0, 0x00, 0x02, 0xbb},
1460	{0x39, 0x03, 0xca, 0xbb},
1461	{0x3a, 0x06, 0x80, 0xbb},
1462	{0x3b, 0x01, 0x52, 0xbb},
1463	{0x3c, 0x05, 0x40, 0xbb},
1464	{0x57, 0x01, 0x9c, 0xbb},
1465	{0x58, 0x01, 0xee, 0xbb},
1466	{0x59, 0x00, 0xf0, 0xbb},
1467	{0x5a, 0x01, 0x20, 0xbb},
1468	{0x5c, 0x1d, 0x17, 0xbb},
1469	{0x5d, 0x22, 0x1c, 0xbb},
1470	{0x64, 0x1e, 0x1c, 0xbb},
1471	{0x5b, 0x00, 0x00, 0xbb},
1472	{0xf0, 0x00, 0x02, 0xbb},
1473	{0x22, 0xa0, 0x78, 0xbb},
1474	{0x23, 0xa0, 0x78, 0xbb},
1475	{0x24, 0x7f, 0x00, 0xbb},
1476	{0x28, 0xea, 0x02, 0xbb},
1477	{0x29, 0x86, 0x7a, 0xbb},
1478	{0x5e, 0x52, 0x4c, 0xbb},
1479	{0x5f, 0x20, 0x24, 0xbb},
1480	{0x60, 0x00, 0x02, 0xbb},
1481	{0x02, 0x00, 0xee, 0xbb},
1482	{0x03, 0x39, 0x23, 0xbb},
1483	{0x04, 0x07, 0x24, 0xbb},
1484	{0x09, 0x00, 0xc0, 0xbb},
1485	{0x0a, 0x00, 0x79, 0xbb},
1486	{0x0b, 0x00, 0x04, 0xbb},
1487	{0x0c, 0x00, 0x5c, 0xbb},
1488	{0x0d, 0x00, 0xd9, 0xbb},
1489	{0x0e, 0x00, 0x53, 0xbb},
1490	{0x0f, 0x00, 0x21, 0xbb},
1491	{0x10, 0x00, 0xa4, 0xbb},
1492	{0x11, 0x00, 0xe5, 0xbb},
1493	{0x15, 0x00, 0x00, 0xbb},
1494	{0x16, 0x00, 0x00, 0xbb},
1495	{0x17, 0x00, 0x00, 0xbb},
1496	{0x18, 0x00, 0x00, 0xbb},
1497	{0x19, 0x00, 0x00, 0xbb},
1498	{0x1a, 0x00, 0x00, 0xbb},
1499	{0x1b, 0x00, 0x00, 0xbb},
1500	{0x1c, 0x00, 0x00, 0xbb},
1501	{0x1d, 0x00, 0x00, 0xbb},
1502	{0x1e, 0x00, 0x00, 0xbb},
1503	{0xf0, 0x00, 0x01, 0xbb},
1504	{0x06, 0xe0, 0x0e, 0xbb},
1505	{0x06, 0x60, 0x0e, 0xbb},
1506	{0xb3, 0x5c, 0x01, 0xcc},
1507	{0xf0, 0x00, 0x00, 0xbb},
1508	{0x05, 0x01, 0x13, 0xbb},
1509	{0x06, 0x00, 0x11, 0xbb},
1510	{0x07, 0x00, 0x85, 0xbb},
1511	{0x08, 0x00, 0x27, 0xbb},
1512	{0x20, 0x01, 0x03, 0xbb},	/* h/v flip */
1513	{0x21, 0x80, 0x00, 0xbb},
1514	{0x22, 0x0d, 0x0f, 0xbb},
1515	{0x24, 0x80, 0x00, 0xbb},
1516	{0x59, 0x00, 0xff, 0xbb},
1517	{0xf0, 0x00, 0x02, 0xbb},
1518	{0x39, 0x03, 0x0d, 0xbb},
1519	{0x3a, 0x06, 0x1b, 0xbb},
1520	{0x3b, 0x00, 0x95, 0xbb},
1521	{0x3c, 0x04, 0xdb, 0xbb},
1522	{0x57, 0x02, 0x00, 0xbb},
1523	{0x58, 0x02, 0x66, 0xbb},
1524	{0x59, 0x00, 0xff, 0xbb},
1525	{0x5a, 0x01, 0x33, 0xbb},
1526	{0x5c, 0x12, 0x0d, 0xbb},
1527	{0x5d, 0x16, 0x11, 0xbb},
1528	{0x64, 0x5e, 0x1c, 0xbb},
1529	{}
1530};
1531static const u8 po3130_gamma[17] = {
1532	0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
1533	0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
1534};
1535static const u8 po3130_matrix[9] = {
1536	0x5f, 0xec, 0xf5, 0xf1, 0x5a, 0xf5, 0xf1, 0xec, 0x63
1537};
1538
1539static const u8 po3130_initVGA_data[][4] = {
1540	{0xb0, 0x4d, 0x00, 0xcc},	{0xb3, 0x01, 0x01, 0xcc},
1541	{0x00, 0x00, 0x50, 0xdd},	{0xb0, 0x03, 0x01, 0xcc},
1542	{0xb3, 0x00, 0x04, 0xcc},	{0xb3, 0x00, 0x24, 0xcc},
1543	{0xb3, 0x00, 0x25, 0xcc},	{0xb3, 0x08, 0x01, 0xcc},
1544	{0xb3, 0x09, 0x0c, 0xcc},	{0xb3, 0x05, 0x00, 0xcc},
1545	{0xb3, 0x06, 0x01, 0xcc},	{0xb3, 0x03, 0x1a, 0xcc},
1546	{0xb3, 0x04, 0x15, 0xcc},	{0xb3, 0x20, 0x00, 0xcc},
1547	{0xb3, 0x21, 0x00, 0xcc},	{0xb3, 0x22, 0x01, 0xcc},
1548	{0xb3, 0x23, 0xe8, 0xcc},	{0xb8, 0x08, 0xe8, 0xcc},
1549	{0xb3, 0x14, 0x00, 0xcc},	{0xb3, 0x15, 0x00, 0xcc},
1550	{0xb3, 0x16, 0x02, 0xcc},	{0xb3, 0x17, 0x7f, 0xcc},
1551	{0xb3, 0x34, 0x01, 0xcc},
1552	{0xb3, 0x35, 0xf6, 0xcc},	/* i2c add: 76 */
1553	{0xb3, 0x00, 0x27, 0xcc},	{0xbc, 0x00, 0x71, 0xcc},
1554	{0xb8, 0x00, 0x21, 0xcc},	{0xb8, 0x27, 0x20, 0xcc},
1555	{0xb8, 0x01, 0x79, 0xcc},	{0xb8, 0x81, 0x09, 0xcc},
1556	{0xb8, 0x2c, 0x50, 0xcc},	{0xb8, 0x2d, 0xf8, 0xcc},
1557	{0xb8, 0x2e, 0xf8, 0xcc},	{0xb8, 0x2f, 0xf8, 0xcc},
1558	{0xb8, 0x30, 0x50, 0xcc},	{0xb8, 0x31, 0xf8, 0xcc},
1559	{0xb8, 0x32, 0xf8, 0xcc},	{0xb8, 0x33, 0xf8, 0xcc},
1560	{0xb8, 0x34, 0x50, 0xcc},	{0xb8, 0x35, 0x00, 0xcc},
1561	{0xb8, 0x36, 0x00, 0xcc},	{0xb8, 0x37, 0x00, 0xcc},
1562	{0x00, 0x1e, 0xc6, 0xaa},	{0x00, 0x20, 0x44, 0xaa},
1563	{0x00, 0xad, 0x02, 0xaa},	{0x00, 0xae, 0x2c, 0xaa},
1564	{0x00, 0x12, 0x08, 0xaa},	{0x00, 0x17, 0x41, 0xaa},
1565	{0x00, 0x19, 0x41, 0xaa},	{0x00, 0x1e, 0x06, 0xaa},
1566	{0x00, 0x21, 0x00, 0xaa},	{0x00, 0x36, 0xc0, 0xaa},
1567	{0x00, 0x37, 0xc8, 0xaa},	{0x00, 0x3b, 0x36, 0xaa},
1568	{0x00, 0x4b, 0xfe, 0xaa},	{0x00, 0x51, 0x1c, 0xaa},
1569	{0x00, 0x52, 0x01, 0xaa},	{0x00, 0x55, 0x0a, 0xaa},
1570	{0x00, 0x59, 0x02, 0xaa},	{0x00, 0x5a, 0x04, 0xaa},
1571	{0x00, 0x5c, 0x10, 0xaa},	{0x00, 0x5d, 0x10, 0xaa},
1572	{0x00, 0x5e, 0x10, 0xaa},	{0x00, 0x5f, 0x10, 0xaa},
1573	{0x00, 0x61, 0x00, 0xaa},	{0x00, 0x62, 0x18, 0xaa},
1574	{0x00, 0x63, 0x30, 0xaa},	{0x00, 0x70, 0x68, 0xaa},
1575	{0x00, 0x80, 0x71, 0xaa},	{0x00, 0x81, 0x08, 0xaa},
1576	{0x00, 0x82, 0x00, 0xaa},	{0x00, 0x83, 0x55, 0xaa},
1577	{0x00, 0x84, 0x06, 0xaa},	{0x00, 0x85, 0x06, 0xaa},
1578	{0x00, 0x86, 0x13, 0xaa},	{0x00, 0x87, 0x18, 0xaa},
1579	{0x00, 0xaa, 0x3f, 0xaa},	{0x00, 0xab, 0x44, 0xaa},
1580	{0x00, 0xb0, 0x68, 0xaa},	{0x00, 0xb5, 0x10, 0xaa},
1581	{0x00, 0xb8, 0x20, 0xaa},	{0x00, 0xb9, 0xa0, 0xaa},
1582	{0x00, 0xbc, 0x04, 0xaa},	{0x00, 0x8b, 0x40, 0xaa},
1583	{0x00, 0x8c, 0x91, 0xaa},	{0x00, 0x8d, 0x8f, 0xaa},
1584	{0x00, 0x8e, 0x91, 0xaa},	{0x00, 0x8f, 0x43, 0xaa},
1585	{0x00, 0x90, 0x92, 0xaa},	{0x00, 0x91, 0x89, 0xaa},
1586	{0x00, 0x92, 0x9d, 0xaa},	{0x00, 0x93, 0x46, 0xaa},
1587	{0x00, 0xd6, 0x22, 0xaa},	{0x00, 0x73, 0x00, 0xaa},
1588	{0x00, 0x74, 0x10, 0xaa},	{0x00, 0x75, 0x20, 0xaa},
1589	{0x00, 0x76, 0x2b, 0xaa},	{0x00, 0x77, 0x36, 0xaa},
1590	{0x00, 0x78, 0x49, 0xaa},	{0x00, 0x79, 0x5a, 0xaa},
1591	{0x00, 0x7a, 0x7f, 0xaa},	{0x00, 0x7b, 0x9b, 0xaa},
1592	{0x00, 0x7c, 0xba, 0xaa},	{0x00, 0x7d, 0xd4, 0xaa},
1593	{0x00, 0x7e, 0xea, 0xaa},	{0x00, 0xd6, 0x62, 0xaa},
1594	{0x00, 0x73, 0x00, 0xaa},	{0x00, 0x74, 0x10, 0xaa},
1595	{0x00, 0x75, 0x20, 0xaa},	{0x00, 0x76, 0x2b, 0xaa},
1596	{0x00, 0x77, 0x36, 0xaa},	{0x00, 0x78, 0x49, 0xaa},
1597	{0x00, 0x79, 0x5a, 0xaa},	{0x00, 0x7a, 0x7f, 0xaa},
1598	{0x00, 0x7b, 0x9b, 0xaa},	{0x00, 0x7c, 0xba, 0xaa},
1599	{0x00, 0x7d, 0xd4, 0xaa},	{0x00, 0x7e, 0xea, 0xaa},
1600	{0x00, 0xd6, 0xa2, 0xaa},	{0x00, 0x73, 0x00, 0xaa},
1601	{0x00, 0x74, 0x10, 0xaa},	{0x00, 0x75, 0x20, 0xaa},
1602	{0x00, 0x76, 0x2b, 0xaa},	{0x00, 0x77, 0x36, 0xaa},
1603	{0x00, 0x78, 0x49, 0xaa},	{0x00, 0x79, 0x5a, 0xaa},
1604	{0x00, 0x7a, 0x7f, 0xaa},	{0x00, 0x7b, 0x9b, 0xaa},
1605	{0x00, 0x7c, 0xba, 0xaa},	{0x00, 0x7d, 0xd4, 0xaa},
1606	{0x00, 0x7e, 0xea, 0xaa},
1607	{0x00, 0x4c, 0x07, 0xaa},
1608	{0x00, 0x4b, 0xe0, 0xaa},	{0x00, 0x4e, 0x77, 0xaa},
1609	{0x00, 0x59, 0x02, 0xaa},	{0x00, 0x4d, 0x0a, 0xaa},
1610/*	{0x00, 0xd1, 0x00, 0xaa},	{0x00, 0x20, 0xc4, 0xaa},
1611	{0xb8, 0x8e, 0x00, 0xcc},	{0xb8, 0x8f, 0xff, 0xcc}, */
1612	{0x00, 0xd1, 0x3c, 0xaa},	{0x00, 0x20, 0xc4, 0xaa},
1613	{0xb8, 0x8e, 0x00, 0xcc},	{0xb8, 0x8f, 0xff, 0xcc},
1614	{0xb8, 0xfe, 0x00, 0xcc},	{0xb8, 0xff, 0x28, 0xcc},
1615	{0xb9, 0x00, 0x28, 0xcc},	{0xb9, 0x01, 0x28, 0xcc},
1616	{0xb9, 0x02, 0x28, 0xcc},	{0xb9, 0x03, 0x00, 0xcc},
1617	{0xb9, 0x04, 0x00, 0xcc},	{0xb9, 0x05, 0x3c, 0xcc},
1618	{0xb9, 0x06, 0x3c, 0xcc},	{0xb9, 0x07, 0x3c, 0xcc},
1619	{0xb9, 0x08, 0x3c, 0xcc},	{0x00, 0x05, 0x00, 0xaa},
1620	{0xb3, 0x5c, 0x00, 0xcc},	{0xb3, 0x01, 0x41, 0xcc},
1621	{}
1622};
1623static const u8 po3130_rundata[][4] = {
1624	{0x00, 0x47, 0x45, 0xaa},	{0x00, 0x48, 0x9b, 0xaa},
1625	{0x00, 0x49, 0x3a, 0xaa},	{0x00, 0x4a, 0x01, 0xaa},
1626	{0x00, 0x44, 0x40, 0xaa},
1627/*	{0x00, 0xd5, 0x7c, 0xaa}, */
1628	{0x00, 0xad, 0x04, 0xaa},	{0x00, 0xae, 0x00, 0xaa},
1629	{0x00, 0xb0, 0x78, 0xaa},	{0x00, 0x98, 0x02, 0xaa},
1630	{0x00, 0x94, 0x25, 0xaa},	{0x00, 0x95, 0x25, 0xaa},
1631	{0x00, 0x59, 0x68, 0xaa},	{0x00, 0x44, 0x20, 0xaa},
1632	{0x00, 0x17, 0x50, 0xaa},	{0x00, 0x19, 0x50, 0xaa},
1633	{0x00, 0xd1, 0x3c, 0xaa},	{0x00, 0xd1, 0x3c, 0xaa},
1634	{0x00, 0x1e, 0x06, 0xaa},	{0x00, 0x1e, 0x06, 0xaa},
1635	{}
1636};
1637
1638static const u8 po3130_initQVGA_data[][4] = {
1639	{0xb0, 0x4d, 0x00, 0xcc},	{0xb3, 0x01, 0x01, 0xcc},
1640	{0x00, 0x00, 0x50, 0xdd},	{0xb0, 0x03, 0x09, 0xcc},
1641	{0xb3, 0x00, 0x04, 0xcc},	{0xb3, 0x00, 0x24, 0xcc},
1642	{0xb3, 0x00, 0x25, 0xcc},	{0xb3, 0x08, 0x01, 0xcc},
1643	{0xb3, 0x09, 0x0c, 0xcc},	{0xb3, 0x05, 0x00, 0xcc},
1644	{0xb3, 0x06, 0x01, 0xcc},	{0xb3, 0x03, 0x1a, 0xcc},
1645	{0xb3, 0x04, 0x15, 0xcc},	{0xb3, 0x20, 0x00, 0xcc},
1646	{0xb3, 0x21, 0x00, 0xcc},	{0xb3, 0x22, 0x01, 0xcc},
1647	{0xb3, 0x23, 0xe0, 0xcc},	{0xb8, 0x08, 0xe0, 0xcc},
1648	{0xb3, 0x14, 0x00, 0xcc},	{0xb3, 0x15, 0x00, 0xcc},
1649	{0xb3, 0x16, 0x02, 0xcc},	{0xb3, 0x17, 0x7f, 0xcc},
1650	{0xb3, 0x34, 0x01, 0xcc},	{0xb3, 0x35, 0xf6, 0xcc},
1651	{0xb3, 0x00, 0x27, 0xcc},	{0xbc, 0x00, 0xd1, 0xcc},
1652	{0xb8, 0x00, 0x21, 0xcc},	{0xb8, 0x27, 0x20, 0xcc},
1653	{0xb8, 0x01, 0x79, 0xcc},	{0xb8, 0x81, 0x09, 0xcc},
1654	{0xb8, 0x2c, 0x50, 0xcc},	{0xb8, 0x2d, 0xf8, 0xcc},
1655	{0xb8, 0x2e, 0xf8, 0xcc},	{0xb8, 0x2f, 0xf8, 0xcc},
1656	{0xb8, 0x30, 0x50, 0xcc},	{0xb8, 0x31, 0xf8, 0xcc},
1657	{0xb8, 0x32, 0xf8, 0xcc},	{0xb8, 0x33, 0xf8, 0xcc},
1658	{0xb8, 0x34, 0x50, 0xcc},	{0xb8, 0x35, 0x00, 0xcc},
1659	{0xb8, 0x36, 0x00, 0xcc},	{0xb8, 0x37, 0x00, 0xcc},
1660	{0x00, 0x1e, 0xc6, 0xaa},	{0x00, 0x20, 0x44, 0xaa},
1661	{0x00, 0xad, 0x02, 0xaa},	{0x00, 0xae, 0x2c, 0xaa},
1662	{0x00, 0x12, 0x08, 0xaa},	{0x00, 0x17, 0x41, 0xaa},
1663	{0x00, 0x19, 0x41, 0xaa},	{0x00, 0x1e, 0x06, 0xaa},
1664	{0x00, 0x21, 0x00, 0xaa},	{0x00, 0x36, 0xc0, 0xaa},
1665	{0x00, 0x37, 0xc8, 0xaa},	{0x00, 0x3b, 0x36, 0xaa},
1666	{0x00, 0x4b, 0xfe, 0xaa},	{0x00, 0x51, 0x1c, 0xaa},
1667	{0x00, 0x52, 0x01, 0xaa},	{0x00, 0x55, 0x0a, 0xaa},
1668	{0x00, 0x59, 0x6f, 0xaa},	{0x00, 0x5a, 0x04, 0xaa},
1669	{0x00, 0x5c, 0x10, 0xaa},	{0x00, 0x5d, 0x10, 0xaa},
1670	{0x00, 0x5e, 0x10, 0xaa},	{0x00, 0x5f, 0x10, 0xaa},
1671	{0x00, 0x61, 0x00, 0xaa},	{0x00, 0x62, 0x18, 0xaa},
1672	{0x00, 0x63, 0x30, 0xaa},	{0x00, 0x70, 0x68, 0xaa},
1673	{0x00, 0x80, 0x71, 0xaa},	{0x00, 0x81, 0x08, 0xaa},
1674	{0x00, 0x82, 0x00, 0xaa},	{0x00, 0x83, 0x55, 0xaa},
1675	{0x00, 0x84, 0x06, 0xaa},	{0x00, 0x85, 0x06, 0xaa},
1676	{0x00, 0x86, 0x13, 0xaa},	{0x00, 0x87, 0x18, 0xaa},
1677	{0x00, 0xaa, 0x3f, 0xaa},	{0x00, 0xab, 0x44, 0xaa},
1678	{0x00, 0xb0, 0x68, 0xaa},	{0x00, 0xb5, 0x10, 0xaa},
1679	{0x00, 0xb8, 0x20, 0xaa},	{0x00, 0xb9, 0xa0, 0xaa},
1680	{0x00, 0xbc, 0x04, 0xaa},	{0x00, 0x8b, 0x40, 0xaa},
1681	{0x00, 0x8c, 0x91, 0xaa},	{0x00, 0x8d, 0x8f, 0xaa},
1682	{0x00, 0x8e, 0x91, 0xaa},	{0x00, 0x8f, 0x43, 0xaa},
1683	{0x00, 0x90, 0x92, 0xaa},	{0x00, 0x91, 0x89, 0xaa},
1684	{0x00, 0x92, 0x9d, 0xaa},	{0x00, 0x93, 0x46, 0xaa},
1685	{0x00, 0xd6, 0x22, 0xaa},	{0x00, 0x73, 0x00, 0xaa},
1686	{0x00, 0x74, 0x10, 0xaa},	{0x00, 0x75, 0x20, 0xaa},
1687	{0x00, 0x76, 0x2b, 0xaa},	{0x00, 0x77, 0x36, 0xaa},
1688	{0x00, 0x78, 0x49, 0xaa},	{0x00, 0x79, 0x5a, 0xaa},
1689	{0x00, 0x7a, 0x7f, 0xaa},	{0x00, 0x7b, 0x9b, 0xaa},
1690	{0x00, 0x7c, 0xba, 0xaa},	{0x00, 0x7d, 0xd4, 0xaa},
1691	{0x00, 0x7e, 0xea, 0xaa},	{0x00, 0xd6, 0x62, 0xaa},
1692	{0x00, 0x73, 0x00, 0xaa},	{0x00, 0x74, 0x10, 0xaa},
1693	{0x00, 0x75, 0x20, 0xaa},	{0x00, 0x76, 0x2b, 0xaa},
1694	{0x00, 0x77, 0x36, 0xaa},	{0x00, 0x78, 0x49, 0xaa},
1695	{0x00, 0x79, 0x5a, 0xaa},	{0x00, 0x7a, 0x7f, 0xaa},
1696	{0x00, 0x7b, 0x9b, 0xaa},	{0x00, 0x7c, 0xba, 0xaa},
1697	{0x00, 0x7d, 0xd4, 0xaa},	{0x00, 0x7e, 0xea, 0xaa},
1698	{0x00, 0xd6, 0xa2, 0xaa},	{0x00, 0x73, 0x00, 0xaa},
1699	{0x00, 0x74, 0x10, 0xaa},	{0x00, 0x75, 0x20, 0xaa},
1700	{0x00, 0x76, 0x2b, 0xaa},	{0x00, 0x77, 0x36, 0xaa},
1701	{0x00, 0x78, 0x49, 0xaa},	{0x00, 0x79, 0x5a, 0xaa},
1702	{0x00, 0x7a, 0x7f, 0xaa},	{0x00, 0x7b, 0x9b, 0xaa},
1703	{0x00, 0x7c, 0xba, 0xaa},	{0x00, 0x7d, 0xd4, 0xaa},
1704	{0x00, 0x7e, 0xea, 0xaa},	{0x00, 0x4c, 0x07, 0xaa},
1705	{0x00, 0x4b, 0xe0, 0xaa},	{0x00, 0x4e, 0x77, 0xaa},
1706	{0x00, 0x59, 0x66, 0xaa},	{0x00, 0x4d, 0x0a, 0xaa},
1707	{0x00, 0xd1, 0x00, 0xaa},	{0x00, 0x20, 0xc4, 0xaa},
1708	{0xb8, 0x8e, 0x00, 0xcc},	{0xb8, 0x8f, 0xff, 0xcc},
1709	{0xb8, 0xfe, 0x00, 0xcc},	{0xb8, 0xff, 0x28, 0xcc},
1710	{0xb9, 0x00, 0x28, 0xcc},	{0xb9, 0x01, 0x28, 0xcc},
1711	{0xb9, 0x02, 0x28, 0xcc},	{0xb9, 0x03, 0x00, 0xcc},
1712	{0xb9, 0x04, 0x00, 0xcc},	{0xb9, 0x05, 0x3c, 0xcc},
1713	{0xb9, 0x06, 0x3c, 0xcc},	{0xb9, 0x07, 0x3c, 0xcc},
1714	{0xb9, 0x08, 0x3c, 0xcc},	{0xbc, 0x02, 0x18, 0xcc},
1715	{0xbc, 0x03, 0x50, 0xcc},	{0xbc, 0x04, 0x18, 0xcc},
1716	{0xbc, 0x05, 0x00, 0xcc},	{0xbc, 0x06, 0x00, 0xcc},
1717	{0xbc, 0x08, 0x30, 0xcc},	{0xbc, 0x09, 0x40, 0xcc},
1718	{0xbc, 0x0a, 0x10, 0xcc},	{0xbc, 0x0b, 0x00, 0xcc},
1719	{0xbc, 0x0c, 0x00, 0xcc},	{0x00, 0x05, 0x00, 0xaa},
1720	{0xb3, 0x5c, 0x00, 0xcc},	{0xb3, 0x01, 0x41, 0xcc},
1721	{}
1722};
1723
1724static const u8 hv7131r_gamma[17] = {
1725	0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
1726	0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
1727};
1728static const u8 hv7131r_matrix[9] = {
1729	0x5f, 0xec, 0xf5, 0xf1, 0x5a, 0xf5, 0xf1, 0xec, 0x63
1730};
1731static const u8 hv7131r_initVGA_data[][4] = {
1732	{0xb3, 0x01, 0x01, 0xcc},
1733	{0xb0, 0x03, 0x19, 0xcc},
1734	{0xb0, 0x04, 0x02, 0xcc},
1735	{0x00, 0x00, 0x20, 0xdd},
1736	{0xb3, 0x00, 0x24, 0xcc},
1737	{0xb3, 0x00, 0x25, 0xcc},
1738	{0xb3, 0x08, 0x01, 0xcc},
1739	{0xb3, 0x09, 0x0c, 0xcc},
1740	{0xb3, 0x05, 0x01, 0xcc},
1741	{0xb3, 0x06, 0x03, 0xcc},
1742	{0xb3, 0x01, 0x45, 0xcc},
1743	{0xb3, 0x03, 0x0b, 0xcc},
1744	{0xb3, 0x04, 0x05, 0xcc},
1745	{0xb3, 0x20, 0x00, 0xcc},
1746	{0xb3, 0x21, 0x00, 0xcc},
1747	{0xb3, 0x22, 0x01, 0xcc},
1748	{0xb3, 0x23, 0xe0, 0xcc},
1749	{0xb3, 0x14, 0x00, 0xcc},
1750	{0xb3, 0x15, 0x02, 0xcc},
1751	{0xb3, 0x16, 0x02, 0xcc},
1752	{0xb3, 0x17, 0x7f, 0xcc},
1753	{0xb3, 0x34, 0x01, 0xcc},
1754	{0xb3, 0x35, 0x91, 0xcc},	/* i2c add: 11 */
1755	{0xb3, 0x00, 0x27, 0xcc},
1756	{0xbc, 0x00, 0x73, 0xcc},
1757	{0xb8, 0x00, 0x23, 0xcc},
1758	{0xb8, 0x2c, 0x50, 0xcc},
1759	{0xb8, 0x2d, 0xf8, 0xcc},
1760	{0xb8, 0x2e, 0xf8, 0xcc},
1761	{0xb8, 0x2f, 0xf8, 0xcc},
1762	{0xb8, 0x30, 0x50, 0xcc},
1763	{0xb8, 0x31, 0xf8, 0xcc},
1764	{0xb8, 0x32, 0xf8, 0xcc},
1765	{0xb8, 0x33, 0xf8, 0xcc},
1766	{0xb8, 0x34, 0x58, 0xcc},
1767	{0xb8, 0x35, 0x00, 0xcc},
1768	{0xb8, 0x36, 0x00, 0xcc},
1769	{0xb8, 0x37, 0x00, 0xcc},
1770	{0xb8, 0x27, 0x20, 0xcc},
1771	{0xb8, 0x01, 0x7d, 0xcc},
1772	{0xb8, 0x81, 0x09, 0xcc},
1773	{0xb3, 0x01, 0x41, 0xcc},
1774	{0xb8, 0x8e, 0x00, 0xcc},
1775	{0xb8, 0x8f, 0xff, 0xcc},
1776	{0x00, 0x01, 0x0c, 0xaa},
1777	{0x00, 0x14, 0x01, 0xaa},
1778	{0x00, 0x15, 0xe6, 0xaa},
1779	{0x00, 0x16, 0x02, 0xaa},
1780	{0x00, 0x17, 0x86, 0xaa},
1781	{0x00, 0x23, 0x00, 0xaa},
1782	{0x00, 0x25, 0x03, 0xaa},
1783	{0x00, 0x26, 0xa9, 0xaa},
1784	{0x00, 0x27, 0x80, 0xaa},
1785	{0x00, 0x30, 0x18, 0xaa},
1786	{0xb6, 0x00, 0x00, 0xcc},
1787	{0xb6, 0x03, 0x02, 0xcc},
1788	{0xb6, 0x02, 0x80, 0xcc},
1789	{0xb6, 0x05, 0x01, 0xcc},
1790	{0xb6, 0x04, 0xe0, 0xcc},
1791	{0xb6, 0x12, 0x78, 0xcc},
1792	{0xb6, 0x18, 0x02, 0xcc},
1793	{0xb6, 0x17, 0x58, 0xcc},
1794	{0xb6, 0x16, 0x00, 0xcc},
1795	{0xb6, 0x22, 0x12, 0xcc},
1796	{0xb6, 0x23, 0x0b, 0xcc},
1797	{0xb3, 0x02, 0x02, 0xcc},
1798	{0xbf, 0xc0, 0x39, 0xcc},
1799	{0xbf, 0xc1, 0x04, 0xcc},
1800	{0xbf, 0xcc, 0x10, 0xcc},
1801	{0xb6, 0x12, 0xf8, 0xcc},
1802	{0xb6, 0x13, 0x13, 0xcc},
1803	{0xb9, 0x12, 0x00, 0xcc},
1804	{0xb9, 0x13, 0x0a, 0xcc},
1805	{0xb9, 0x14, 0x0a, 0xcc},
1806	{0xb9, 0x15, 0x0a, 0xcc},
1807	{0xb9, 0x16, 0x0a, 0xcc},
1808	{0xb8, 0x0c, 0x20, 0xcc},
1809	{0xb8, 0x0d, 0x70, 0xcc},
1810	{0xb9, 0x18, 0x00, 0xcc},
1811	{0xb9, 0x19, 0x0f, 0xcc},
1812	{0xb9, 0x1a, 0x0f, 0xcc},
1813	{0xb9, 0x1b, 0x0f, 0xcc},
1814	{0xb9, 0x1c, 0x0f, 0xcc},
1815	{0xb3, 0x5c, 0x01, 0xcc},
1816	{}
1817};
1818
1819static const u8 hv7131r_initQVGA_data[][4] = {
1820	{0xb3, 0x01, 0x01, 0xcc},
1821	{0xb0, 0x03, 0x19, 0xcc},
1822	{0xb0, 0x04, 0x02, 0xcc},
1823	{0x00, 0x00, 0x20, 0xdd},
1824	{0xb3, 0x00, 0x24, 0xcc},
1825	{0xb3, 0x00, 0x25, 0xcc},
1826	{0xb3, 0x08, 0x01, 0xcc},
1827	{0xb3, 0x09, 0x0c, 0xcc},
1828	{0xb3, 0x05, 0x01, 0xcc},
1829	{0xb3, 0x06, 0x03, 0xcc},
1830	{0xb3, 0x01, 0x45, 0xcc},
1831	{0xb3, 0x03, 0x0b, 0xcc},
1832	{0xb3, 0x04, 0x05, 0xcc},
1833	{0xb3, 0x20, 0x00, 0xcc},
1834	{0xb3, 0x21, 0x00, 0xcc},
1835	{0xb3, 0x22, 0x01, 0xcc},
1836	{0xb3, 0x23, 0xe0, 0xcc},
1837	{0xb3, 0x14, 0x00, 0xcc},
1838	{0xb3, 0x15, 0x02, 0xcc},
1839	{0xb3, 0x16, 0x02, 0xcc},
1840	{0xb3, 0x17, 0x7f, 0xcc},
1841	{0xb3, 0x34, 0x01, 0xcc},
1842	{0xb3, 0x35, 0x91, 0xcc},
1843	{0xb3, 0x00, 0x27, 0xcc},
1844	{0xbc, 0x00, 0xd3, 0xcc},
1845	{0xb8, 0x00, 0x23, 0xcc},
1846	{0xb8, 0x2c, 0x50, 0xcc},
1847	{0xb8, 0x2d, 0xf8, 0xcc},
1848	{0xb8, 0x2e, 0xf8, 0xcc},
1849	{0xb8, 0x2f, 0xf8, 0xcc},
1850	{0xb8, 0x30, 0x50, 0xcc},
1851	{0xb8, 0x31, 0xf8, 0xcc},
1852	{0xb8, 0x32, 0xf8, 0xcc},
1853	{0xb8, 0x33, 0xf8, 0xcc},
1854	{0xb8, 0x34, 0x58, 0xcc},
1855	{0xb8, 0x35, 0x00, 0xcc},
1856	{0xb8, 0x36, 0x00, 0xcc},
1857	{0xb8, 0x37, 0x00, 0xcc},
1858	{0xb8, 0x27, 0x20, 0xcc},
1859	{0xb8, 0x01, 0x7d, 0xcc},
1860	{0xb8, 0x81, 0x09, 0xcc},
1861	{0xb3, 0x01, 0x41, 0xcc},
1862	{0xb8, 0x8e, 0x00, 0xcc},
1863	{0xb8, 0x8f, 0xff, 0xcc},
1864	{0x00, 0x01, 0x0c, 0xaa},
1865	{0x00, 0x14, 0x01, 0xaa},
1866	{0x00, 0x15, 0xe6, 0xaa},
1867	{0x00, 0x16, 0x02, 0xaa},
1868	{0x00, 0x17, 0x86, 0xaa},
1869	{0x00, 0x23, 0x00, 0xaa},
1870	{0x00, 0x25, 0x03, 0xaa},
1871	{0x00, 0x26, 0xa9, 0xaa},
1872	{0x00, 0x27, 0x80, 0xaa},
1873	{0x00, 0x30, 0x18, 0xaa},
1874	{0xb6, 0x00, 0x00, 0xcc},
1875	{0xb6, 0x03, 0x01, 0xcc},
1876	{0xb6, 0x02, 0x40, 0xcc},
1877	{0xb6, 0x05, 0x00, 0xcc},
1878	{0xb6, 0x04, 0xf0, 0xcc},
1879	{0xb6, 0x12, 0x78, 0xcc},
1880	{0xb6, 0x18, 0x00, 0xcc},
1881	{0xb6, 0x17, 0x96, 0xcc},
1882	{0xb6, 0x16, 0x00, 0xcc},
1883	{0xb6, 0x22, 0x12, 0xcc},
1884	{0xb6, 0x23, 0x0b, 0xcc},
1885	{0xb3, 0x02, 0x02, 0xcc},
1886	{0xbf, 0xc0, 0x39, 0xcc},
1887	{0xbf, 0xc1, 0x04, 0xcc},
1888	{0xbf, 0xcc, 0x10, 0xcc},
1889	{0xbc, 0x02, 0x18, 0xcc},
1890	{0xbc, 0x03, 0x50, 0xcc},
1891	{0xbc, 0x04, 0x18, 0xcc},
1892	{0xbc, 0x05, 0x00, 0xcc},
1893	{0xbc, 0x06, 0x00, 0xcc},
1894	{0xbc, 0x08, 0x30, 0xcc},
1895	{0xbc, 0x09, 0x40, 0xcc},
1896	{0xbc, 0x0a, 0x10, 0xcc},
1897	{0xbc, 0x0b, 0x00, 0xcc},
1898	{0xbc, 0x0c, 0x00, 0xcc},
1899	{0xb9, 0x12, 0x00, 0xcc},
1900	{0xb9, 0x13, 0x0a, 0xcc},
1901	{0xb9, 0x14, 0x0a, 0xcc},
1902	{0xb9, 0x15, 0x0a, 0xcc},
1903	{0xb9, 0x16, 0x0a, 0xcc},
1904	{0xb9, 0x18, 0x00, 0xcc},
1905	{0xb9, 0x19, 0x0f, 0xcc},
1906	{0xb8, 0x0c, 0x20, 0xcc},
1907	{0xb8, 0x0d, 0x70, 0xcc},
1908	{0xb9, 0x1a, 0x0f, 0xcc},
1909	{0xb9, 0x1b, 0x0f, 0xcc},
1910	{0xb9, 0x1c, 0x0f, 0xcc},
1911	{0xb6, 0x12, 0xf8, 0xcc},
1912	{0xb6, 0x13, 0x13, 0xcc},
1913	{0xb3, 0x5c, 0x01, 0xcc},
1914	{}
1915};
1916
1917static const u8 ov7660_gamma[17] = {
1918	0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
1919	0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
1920};
1921static const u8 ov7660_matrix[9] = {
1922	0x5a, 0xf0, 0xf6, 0xf3, 0x57, 0xf6, 0xf3, 0xef, 0x62
1923};
1924static const u8 ov7660_initVGA_data[][4] = {
1925	{0xb0, 0x4d, 0x00, 0xcc},	{0xb3, 0x01, 0x01, 0xcc},
1926	{0x00, 0x00, 0x50, 0xdd},
1927	{0xb0, 0x03, 0x01, 0xcc},
1928	{0xb3, 0x00, 0x21, 0xcc},	{0xb3, 0x00, 0x26, 0xcc},
1929	{0xb3, 0x05, 0x01, 0xcc},
1930	{0xb3, 0x06, 0x03, 0xcc},
1931	{0xb3, 0x03, 0x1f, 0xcc},	{0xb3, 0x04, 0x05, 0xcc},
1932	{0xb3, 0x05, 0x00, 0xcc},
1933	{0xb3, 0x06, 0x01, 0xcc},
1934	{0xb3, 0x15, 0x00, 0xcc},/* 0xb315  <-0 href startl */
1935	{0xb3, 0x16, 0x02, 0xcc},	{0xb3, 0x17, 0x7f, 0xcc},
1936	{0xb3, 0x21, 0x00, 0xcc},
1937	{0xb3, 0x23, 0xe0, 0xcc},	{0xb3, 0x1d, 0x01, 0xcc},
1938	{0xb3, 0x1f, 0x02, 0xcc},
1939	{0xb3, 0x34, 0x01, 0xcc},
1940	{0xb3, 0x35, 0xa1, 0xcc},	/* i2c add: 21 */
1941	{0xb3, 0x00, 0x26, 0xcc},
1942	{0xb8, 0x00, 0x33, 0xcc}, /* 13 */
1943	{0xb8, 0x01, 0x7d, 0xcc},
1944	{0xbc, 0x00, 0x73, 0xcc},	{0xb8, 0x81, 0x09, 0xcc},
1945	{0xb8, 0x27, 0x20, 0xcc},
1946	{0xb8, 0x8f, 0x50, 0xcc},
1947	{0x00, 0x01, 0x80, 0xaa},	{0x00, 0x02, 0x80, 0xaa},
1948	{0x00, 0x12, 0x80, 0xaa},
1949	{0x00, 0x12, 0x05, 0xaa},
1950	{0x00, 0x1e, 0x01, 0xaa},	/* MVFP */
1951	{0x00, 0x3d, 0x40, 0xaa}, /* 0x3d <-40 gamma 01 */
1952	{0x00, 0x41, 0x00, 0xaa}, /* edge 00 */
1953	{0x00, 0x0d, 0x48, 0xaa},	{0x00, 0x0e, 0x04, 0xaa},
1954	{0x00, 0x13, 0xa7, 0xaa},
1955	{0x00, 0x40, 0xc1, 0xaa},	{0x00, 0x35, 0x00, 0xaa},
1956	{0x00, 0x36, 0x00, 0xaa},
1957	{0x00, 0x3c, 0x68, 0xaa},	{0x00, 0x1b, 0x05, 0xaa},
1958	{0x00, 0x39, 0x43, 0xaa},
1959	{0x00, 0x8d, 0xcf, 0xaa},
1960	{0x00, 0x8b, 0xcc, 0xaa},	{0x00, 0x8c, 0xcc, 0xaa},
1961	{0x00, 0x0f, 0x62, 0xaa},
1962	{0x00, 0x35, 0x84, 0xaa},
1963	{0x00, 0x3b, 0x08, 0xaa}, /* 0 * Nightframe 1/4 + 50Hz -> 0xC8 */
1964	{0x00, 0x3a, 0x00, 0xaa}, /* mx change yuyv format 00, 04, 01; 08, 0c*/
1965	{0x00, 0x14, 0x2a, 0xaa}, /* agc ampli */
1966	{0x00, 0x9e, 0x40, 0xaa},	{0xb8, 0x8f, 0x50, 0xcc},
1967	{0x00, 0x01, 0x80, 0xaa},
1968	{0x00, 0x02, 0x80, 0xaa},
1969	{0xb8, 0xfe, 0x00, 0xcc},	{0xb8, 0xff, 0x28, 0xcc},
1970	{0xb9, 0x00, 0x28, 0xcc},
1971	{0xb9, 0x01, 0x28, 0xcc},	{0xb9, 0x02, 0x28, 0xcc},
1972	{0xb9, 0x03, 0x00, 0xcc},
1973	{0xb9, 0x04, 0x00, 0xcc},
1974	{0xb9, 0x05, 0x3c, 0xcc},	{0xb9, 0x06, 0x3c, 0xcc},
1975	{0xb9, 0x07, 0x3c, 0xcc},
1976	{0xb9, 0x08, 0x3c, 0xcc},
1977
1978	{0xb8, 0x8e, 0x00, 0xcc},	{0xb8, 0x8f, 0xff, 0xcc},
1979
1980	{0x00, 0x29, 0x3c, 0xaa},	{0xb3, 0x01, 0x45, 0xcc},
1981	{}
1982};
1983static const u8 ov7660_initQVGA_data[][4] = {
1984	{0xb0, 0x4d, 0x00, 0xcc},	{0xb3, 0x01, 0x01, 0xcc},
1985	{0x00, 0x00, 0x50, 0xdd},	{0xb0, 0x03, 0x01, 0xcc},
1986	{0xb3, 0x00, 0x21, 0xcc},	{0xb3, 0x00, 0x26, 0xcc},
1987	{0xb3, 0x05, 0x01, 0xcc},	{0xb3, 0x06, 0x03, 0xcc},
1988	{0xb3, 0x03, 0x1f, 0xcc},	{0xb3, 0x04, 0x05, 0xcc},
1989	{0xb3, 0x05, 0x00, 0xcc},	{0xb3, 0x06, 0x01, 0xcc},
1990	{0xb3, 0x15, 0x00, 0xcc},/* 0xb315  <-0 href startl */
1991	{0xb3, 0x16, 0x02, 0xcc},	{0xb3, 0x17, 0x7f, 0xcc},
1992	{0xb3, 0x21, 0x00, 0xcc},
1993	{0xb3, 0x23, 0xe0, 0xcc},	{0xb3, 0x1d, 0x01, 0xcc},
1994	{0xb3, 0x1f, 0x02, 0xcc},	{0xb3, 0x34, 0x01, 0xcc},
1995	{0xb3, 0x35, 0xa1, 0xcc},	{0xb3, 0x00, 0x26, 0xcc},
1996	{0xb8, 0x00, 0x33, 0xcc}, /* 13 */
1997	{0xb8, 0x01, 0x7d, 0xcc},
1998/* sizer */
1999	{0xbc, 0x00, 0xd3, 0xcc},
2000	{0xb8, 0x81, 0x09, 0xcc},	{0xb8, 0x81, 0x09, 0xcc},
2001	{0xb8, 0x27, 0x20, 0xcc},	{0xb8, 0x8f, 0x50, 0xcc},
2002	{0x00, 0x01, 0x80, 0xaa},	{0x00, 0x02, 0x80, 0xaa},
2003	{0x00, 0x12, 0x80, 0xaa},	{0x00, 0x12, 0x05, 0xaa},
2004	{0x00, 0x1e, 0x01, 0xaa},	/* MVFP */
2005	{0x00, 0x3d, 0x40, 0xaa}, /* 0x3d <-40 gamma 01 */
2006	{0x00, 0x41, 0x00, 0xaa}, /* edge 00 */
2007	{0x00, 0x0d, 0x48, 0xaa},	{0x00, 0x0e, 0x04, 0xaa},
2008	{0x00, 0x13, 0xa7, 0xaa},
2009	{0x00, 0x40, 0xc1, 0xaa},	{0x00, 0x35, 0x00, 0xaa},
2010	{0x00, 0x36, 0x00, 0xaa},
2011	{0x00, 0x3c, 0x68, 0xaa},	{0x00, 0x1b, 0x05, 0xaa},
2012	{0x00, 0x39, 0x43, 0xaa},	{0x00, 0x8d, 0xcf, 0xaa},
2013	{0x00, 0x8b, 0xcc, 0xaa},	{0x00, 0x8c, 0xcc, 0xaa},
2014	{0x00, 0x0f, 0x62, 0xaa},	{0x00, 0x35, 0x84, 0xaa},
2015	{0x00, 0x3b, 0x08, 0xaa}, /* 0  * Nightframe 1/4 + 50Hz -> 0xC8 */
2016	{0x00, 0x3a, 0x00, 0xaa}, /* mx change yuyv format 00, 04, 01; 08, 0c*/
2017	{0x00, 0x14, 0x2a, 0xaa}, /* agc ampli */
2018	{0x00, 0x9e, 0x40, 0xaa},	{0xb8, 0x8f, 0x50, 0xcc},
2019	{0x00, 0x01, 0x80, 0xaa},
2020	{0x00, 0x02, 0x80, 0xaa},
2021/* sizer filters */
2022	{0xbc, 0x02, 0x08, 0xcc},
2023	{0xbc, 0x03, 0x70, 0xcc},
2024	{0xb8, 0x35, 0x00, 0xcc},
2025	{0xb8, 0x36, 0x00, 0xcc},
2026	{0xb8, 0x37, 0x00, 0xcc},
2027	{0xbc, 0x04, 0x08, 0xcc},
2028	{0xbc, 0x05, 0x00, 0xcc},
2029	{0xbc, 0x06, 0x00, 0xcc},
2030	{0xbc, 0x08, 0x3c, 0xcc},
2031	{0xbc, 0x09, 0x40, 0xcc},
2032	{0xbc, 0x0a, 0x04, 0xcc},
2033	{0xbc, 0x0b, 0x00, 0xcc},
2034	{0xbc, 0x0c, 0x00, 0xcc},
2035/* */
2036	{0xb8, 0xfe, 0x00, 0xcc},
2037	{0xb8, 0xff, 0x28, 0xcc},
2038/* */
2039	{0xb9, 0x00, 0x28, 0xcc},	{0xb9, 0x01, 0x28, 0xcc},
2040	{0xb9, 0x02, 0x28, 0xcc},	{0xb9, 0x03, 0x00, 0xcc},
2041	{0xb9, 0x04, 0x00, 0xcc},	{0xb9, 0x05, 0x3c, 0xcc},
2042	{0xb9, 0x06, 0x3c, 0xcc},	{0xb9, 0x07, 0x3c, 0xcc},
2043	{0xb9, 0x08, 0x3c, 0xcc},
2044/* */
2045	{0xb8, 0x8e, 0x00, 0xcc},
2046	{0xb8, 0x8f, 0xff, 0xcc}, /* ff */
2047	{0x00, 0x29, 0x3c, 0xaa},
2048	{0xb3, 0x01, 0x45, 0xcc}, /* 45 */
2049	{}
2050};
2051
2052static const u8 ov7660_50HZ[][4] = {
2053	{0x00, 0x3b, 0x08, 0xaa},
2054	{0x00, 0x9d, 0x40, 0xaa},
2055	{0x00, 0x13, 0xa7, 0xaa},
2056	{}
2057};
2058
2059static const u8 ov7660_60HZ[][4] = {
2060	{0x00, 0x3b, 0x00, 0xaa},
2061	{0x00, 0x9e, 0x40, 0xaa},
2062	{0x00, 0x13, 0xa7, 0xaa},
2063	{}
2064};
2065
2066static const u8 ov7660_NoFliker[][4] = {
2067	{0x00, 0x13, 0x87, 0xaa},
2068	{}
2069};
2070
2071static const u8 ov7670_InitVGA[][4] = {
2072	{0xb3, 0x01, 0x05, 0xcc},
2073	{0x00, 0x00, 0x30, 0xdd},
2074	{0xb0, 0x03, 0x19, 0xcc},
2075	{0x00, 0x00, 0x10, 0xdd},
2076	{0xb0, 0x04, 0x02, 0xcc},
2077	{0x00, 0x00, 0x10, 0xdd},
2078	{0xb3, 0x00, 0x66, 0xcc},
2079	{0xb3, 0x00, 0x67, 0xcc},
2080	{0xb0, 0x16, 0x01, 0xcc},
2081	{0xb3, 0x35, 0xa1, 0xcc},	/* i2c add: 21 */
2082	{0xb3, 0x34, 0x01, 0xcc},
2083	{0xb3, 0x05, 0x01, 0xcc},
2084	{0xb3, 0x06, 0x01, 0xcc},
2085	{0xb3, 0x08, 0x01, 0xcc},
2086	{0xb3, 0x09, 0x0c, 0xcc},
2087	{0xb3, 0x02, 0x02, 0xcc},
2088	{0xb3, 0x03, 0x1f, 0xcc},
2089	{0xb3, 0x14, 0x00, 0xcc},
2090	{0xb3, 0x15, 0x00, 0xcc},
2091	{0xb3, 0x16, 0x02, 0xcc},
2092	{0xb3, 0x17, 0x7f, 0xcc},
2093	{0xb3, 0x04, 0x05, 0xcc},
2094	{0xb3, 0x20, 0x00, 0xcc},
2095	{0xb3, 0x21, 0x00, 0xcc},
2096	{0xb3, 0x22, 0x01, 0xcc},
2097	{0xb3, 0x23, 0xe0, 0xcc},
2098	{0xbc, 0x00, 0x41, 0xcc},
2099	{0xbc, 0x01, 0x01, 0xcc},
2100	{0x00, 0x12, 0x80, 0xaa},
2101	{0x00, 0x00, 0x20, 0xdd},
2102	{0x00, 0x12, 0x00, 0xaa},
2103	{0x00, 0x11, 0x40, 0xaa},
2104	{0x00, 0x6b, 0x0a, 0xaa},
2105	{0x00, 0x3a, 0x04, 0xaa},
2106	{0x00, 0x40, 0xc0, 0xaa},
2107	{0x00, 0x8c, 0x00, 0xaa},
2108	{0x00, 0x7a, 0x29, 0xaa},
2109	{0x00, 0x7b, 0x0e, 0xaa},
2110	{0x00, 0x7c, 0x1a, 0xaa},
2111	{0x00, 0x7d, 0x31, 0xaa},
2112	{0x00, 0x7e, 0x53, 0xaa},
2113	{0x00, 0x7f, 0x60, 0xaa},
2114	{0x00, 0x80, 0x6b, 0xaa},
2115	{0x00, 0x81, 0x73, 0xaa},
2116	{0x00, 0x82, 0x7b, 0xaa},
2117	{0x00, 0x83, 0x82, 0xaa},
2118	{0x00, 0x84, 0x89, 0xaa},
2119	{0x00, 0x85, 0x96, 0xaa},
2120	{0x00, 0x86, 0xa1, 0xaa},
2121	{0x00, 0x87, 0xb7, 0xaa},
2122	{0x00, 0x88, 0xcc, 0xaa},
2123	{0x00, 0x89, 0xe1, 0xaa},
2124	{0x00, 0x13, 0xe0, 0xaa},
2125	{0x00, 0x00, 0x00, 0xaa},
2126	{0x00, 0x10, 0x00, 0xaa},
2127	{0x00, 0x0d, 0x40, 0xaa},
2128	{0x00, 0x14, 0x28, 0xaa},
2129	{0x00, 0xa5, 0x05, 0xaa},
2130	{0x00, 0xab, 0x07, 0xaa},
2131	{0x00, 0x24, 0x95, 0xaa},
2132	{0x00, 0x25, 0x33, 0xaa},
2133	{0x00, 0x26, 0xe3, 0xaa},
2134	{0x00, 0x9f, 0x88, 0xaa},
2135	{0x00, 0xa0, 0x78, 0xaa},
2136	{0x00, 0x55, 0x90, 0xaa},
2137	{0x00, 0xa1, 0x03, 0xaa},
2138	{0x00, 0xa6, 0xe0, 0xaa},
2139	{0x00, 0xa7, 0xd8, 0xaa},
2140	{0x00, 0xa8, 0xf0, 0xaa},
2141	{0x00, 0xa9, 0x90, 0xaa},
2142	{0x00, 0xaa, 0x14, 0xaa},
2143	{0x00, 0x13, 0xe5, 0xaa},
2144	{0x00, 0x0e, 0x61, 0xaa},
2145	{0x00, 0x0f, 0x4b, 0xaa},
2146	{0x00, 0x16, 0x02, 0xaa},
2147	{0x00, 0x1e, 0x07, 0xaa},	/* MVFP */
2148	{0x00, 0x21, 0x02, 0xaa},
2149	{0x00, 0x22, 0x91, 0xaa},
2150	{0x00, 0x29, 0x07, 0xaa},
2151	{0x00, 0x33, 0x0b, 0xaa},
2152	{0x00, 0x35, 0x0b, 0xaa},
2153	{0x00, 0x37, 0x1d, 0xaa},
2154	{0x00, 0x38, 0x71, 0xaa},
2155	{0x00, 0x39, 0x2a, 0xaa},
2156	{0x00, 0x3c, 0x78, 0xaa},
2157	{0x00, 0x4d, 0x40, 0xaa},
2158	{0x00, 0x4e, 0x20, 0xaa},
2159	{0x00, 0x74, 0x19, 0xaa},
2160	{0x00, 0x8d, 0x4f, 0xaa},
2161	{0x00, 0x8e, 0x00, 0xaa},
2162	{0x00, 0x8f, 0x00, 0xaa},
2163	{0x00, 0x90, 0x00, 0xaa},
2164	{0x00, 0x91, 0x00, 0xaa},
2165	{0x00, 0x96, 0x00, 0xaa},
2166	{0x00, 0x9a, 0x80, 0xaa},
2167	{0x00, 0xb0, 0x84, 0xaa},
2168	{0x00, 0xb1, 0x0c, 0xaa},
2169	{0x00, 0xb2, 0x0e, 0xaa},
2170	{0x00, 0xb3, 0x82, 0xaa},
2171	{0x00, 0xb8, 0x0a, 0xaa},
2172	{0x00, 0x43, 0x14, 0xaa},
2173	{0x00, 0x44, 0xf0, 0xaa},
2174	{0x00, 0x45, 0x45, 0xaa},
2175	{0x00, 0x46, 0x63, 0xaa},
2176	{0x00, 0x47, 0x2d, 0xaa},
2177	{0x00, 0x48, 0x46, 0xaa},
2178	{0x00, 0x59, 0x88, 0xaa},
2179	{0x00, 0x5a, 0xa0, 0xaa},
2180	{0x00, 0x5b, 0xc6, 0xaa},
2181	{0x00, 0x5c, 0x7d, 0xaa},
2182	{0x00, 0x5d, 0x5f, 0xaa},
2183	{0x00, 0x5e, 0x19, 0xaa},
2184	{0x00, 0x6c, 0x0a, 0xaa},
2185	{0x00, 0x6d, 0x55, 0xaa},
2186	{0x00, 0x6e, 0x11, 0xaa},
2187	{0x00, 0x6f, 0x9e, 0xaa},
2188	{0x00, 0x69, 0x00, 0xaa},
2189	{0x00, 0x6a, 0x40, 0xaa},
2190	{0x00, 0x01, 0x40, 0xaa},
2191	{0x00, 0x02, 0x40, 0xaa},
2192	{0x00, 0x13, 0xe7, 0xaa},
2193	{0x00, 0x5f, 0xf0, 0xaa},
2194	{0x00, 0x60, 0xf0, 0xaa},
2195	{0x00, 0x61, 0xf0, 0xaa},
2196	{0x00, 0x27, 0xa0, 0xaa},
2197	{0x00, 0x28, 0x80, 0xaa},
2198	{0x00, 0x2c, 0x90, 0xaa},
2199	{0x00, 0x4f, 0x66, 0xaa},
2200	{0x00, 0x50, 0x66, 0xaa},
2201	{0x00, 0x51, 0x00, 0xaa},
2202	{0x00, 0x52, 0x22, 0xaa},
2203	{0x00, 0x53, 0x5e, 0xaa},
2204	{0x00, 0x54, 0x80, 0xaa},
2205	{0x00, 0x58, 0x9e, 0xaa},
2206	{0x00, 0x41, 0x08, 0xaa},
2207	{0x00, 0x3f, 0x00, 0xaa},
2208	{0x00, 0x75, 0x85, 0xaa},
2209	{0x00, 0x76, 0xe1, 0xaa},
2210	{0x00, 0x4c, 0x00, 0xaa},
2211	{0x00, 0x77, 0x0a, 0xaa},
2212	{0x00, 0x3d, 0x88, 0xaa},
2213	{0x00, 0x4b, 0x09, 0xaa},
2214	{0x00, 0xc9, 0x60, 0xaa},
2215	{0x00, 0x41, 0x38, 0xaa},
2216	{0x00, 0x62, 0x30, 0xaa},
2217	{0x00, 0x63, 0x30, 0xaa},
2218	{0x00, 0x64, 0x08, 0xaa},
2219	{0x00, 0x94, 0x07, 0xaa},
2220	{0x00, 0x95, 0x0b, 0xaa},
2221	{0x00, 0x65, 0x00, 0xaa},
2222	{0x00, 0x66, 0x05, 0xaa},
2223	{0x00, 0x56, 0x50, 0xaa},
2224	{0x00, 0x34, 0x11, 0xaa},
2225	{0x00, 0xa4, 0x88, 0xaa},
2226	{0x00, 0x96, 0x00, 0xaa},
2227	{0x00, 0x97, 0x30, 0xaa},
2228	{0x00, 0x98, 0x20, 0xaa},
2229	{0x00, 0x99, 0x30, 0xaa},
2230	{0x00, 0x9a, 0x84, 0xaa},
2231	{0x00, 0x9b, 0x29, 0xaa},
2232	{0x00, 0x9c, 0x03, 0xaa},
2233	{0x00, 0x78, 0x04, 0xaa},
2234	{0x00, 0x79, 0x01, 0xaa},
2235	{0x00, 0xc8, 0xf0, 0xaa},
2236	{0x00, 0x79, 0x0f, 0xaa},
2237	{0x00, 0xc8, 0x00, 0xaa},
2238	{0x00, 0x79, 0x10, 0xaa},
2239	{0x00, 0xc8, 0x7e, 0xaa},
2240	{0x00, 0x79, 0x0a, 0xaa},
2241	{0x00, 0xc8, 0x80, 0xaa},
2242	{0x00, 0x79, 0x0b, 0xaa},
2243	{0x00, 0xc8, 0x01, 0xaa},
2244	{0x00, 0x79, 0x0c, 0xaa},
2245	{0x00, 0xc8, 0x0f, 0xaa},
2246	{0x00, 0x79, 0x0d, 0xaa},
2247	{0x00, 0xc8, 0x20, 0xaa},
2248	{0x00, 0x79, 0x09, 0xaa},
2249	{0x00, 0xc8, 0x80, 0xaa},
2250	{0x00, 0x79, 0x02, 0xaa},
2251	{0x00, 0xc8, 0xc0, 0xaa},
2252	{0x00, 0x79, 0x03, 0xaa},
2253	{0x00, 0xc8, 0x40, 0xaa},
2254	{0x00, 0x79, 0x05, 0xaa},
2255	{0x00, 0xc8, 0x30, 0xaa},
2256	{0x00, 0x79, 0x26, 0xaa},
2257	{0x00, 0x11, 0x40, 0xaa},
2258	{0x00, 0x3a, 0x04, 0xaa},
2259	{0x00, 0x12, 0x00, 0xaa},
2260	{0x00, 0x40, 0xc0, 0xaa},
2261	{0x00, 0x8c, 0x00, 0xaa},
2262	{0x00, 0x17, 0x14, 0xaa},
2263	{0x00, 0x18, 0x02, 0xaa},
2264	{0x00, 0x32, 0x92, 0xaa},
2265	{0x00, 0x19, 0x02, 0xaa},
2266	{0x00, 0x1a, 0x7a, 0xaa},
2267	{0x00, 0x03, 0x0a, 0xaa},
2268	{0x00, 0x0c, 0x00, 0xaa},
2269	{0x00, 0x3e, 0x00, 0xaa},
2270	{0x00, 0x70, 0x3a, 0xaa},
2271	{0x00, 0x71, 0x35, 0xaa},
2272	{0x00, 0x72, 0x11, 0xaa},
2273	{0x00, 0x73, 0xf0, 0xaa},
2274	{0x00, 0xa2, 0x02, 0xaa},
2275	{0x00, 0xb1, 0x00, 0xaa},
2276	{0x00, 0xb1, 0x0c, 0xaa},
2277	{0x00, 0x1e, 0x37, 0xaa},	/* MVFP */
2278	{0x00, 0xaa, 0x14, 0xaa},
2279	{0x00, 0x24, 0x80, 0xaa},
2280	{0x00, 0x25, 0x74, 0xaa},
2281	{0x00, 0x26, 0xd3, 0xaa},
2282	{0x00, 0x0d, 0x00, 0xaa},
2283	{0x00, 0x14, 0x18, 0xaa},
2284	{0x00, 0x9d, 0x99, 0xaa},
2285	{0x00, 0x9e, 0x7f, 0xaa},
2286	{0x00, 0x64, 0x08, 0xaa},
2287	{0x00, 0x94, 0x07, 0xaa},
2288	{0x00, 0x95, 0x06, 0xaa},
2289	{0x00, 0x66, 0x05, 0xaa},
2290	{0x00, 0x41, 0x08, 0xaa},
2291	{0x00, 0x3f, 0x00, 0xaa},
2292	{0x00, 0x75, 0x07, 0xaa},
2293	{0x00, 0x76, 0xe1, 0xaa},
2294	{0x00, 0x4c, 0x00, 0xaa},
2295	{0x00, 0x77, 0x00, 0xaa},
2296	{0x00, 0x3d, 0xc2, 0xaa},
2297	{0x00, 0x4b, 0x09, 0xaa},
2298	{0x00, 0xc9, 0x60, 0xaa},
2299	{0x00, 0x41, 0x38, 0xaa},
2300	{0xbf, 0xc0, 0x26, 0xcc},
2301	{0xbf, 0xc1, 0x02, 0xcc},
2302	{0xbf, 0xcc, 0x04, 0xcc},
2303	{0xb3, 0x5c, 0x01, 0xcc},
2304	{0xb3, 0x01, 0x45, 0xcc},
2305	{0x00, 0x77, 0x05, 0xaa},
2306	{},
2307};
2308
2309static const u8 ov7670_InitQVGA[][4] = {
2310	{0xb3, 0x01, 0x05, 0xcc},
2311	{0x00, 0x00, 0x30, 0xdd},
2312	{0xb0, 0x03, 0x19, 0xcc},
2313	{0x00, 0x00, 0x10, 0xdd},
2314	{0xb0, 0x04, 0x02, 0xcc},
2315	{0x00, 0x00, 0x10, 0xdd},
2316	{0xb3, 0x00, 0x66, 0xcc},
2317	{0xb3, 0x00, 0x67, 0xcc},
2318	{0xb0, 0x16, 0x01, 0xcc},
2319	{0xb3, 0x35, 0xa1, 0xcc},	/* i2c add: 21 */
2320	{0xb3, 0x34, 0x01, 0xcc},
2321	{0xb3, 0x05, 0x01, 0xcc},
2322	{0xb3, 0x06, 0x01, 0xcc},
2323	{0xb3, 0x08, 0x01, 0xcc},
2324	{0xb3, 0x09, 0x0c, 0xcc},
2325	{0xb3, 0x02, 0x02, 0xcc},
2326	{0xb3, 0x03, 0x1f, 0xcc},
2327	{0xb3, 0x14, 0x00, 0xcc},
2328	{0xb3, 0x15, 0x00, 0xcc},
2329	{0xb3, 0x16, 0x02, 0xcc},
2330	{0xb3, 0x17, 0x7f, 0xcc},
2331	{0xb3, 0x04, 0x05, 0xcc},
2332	{0xb3, 0x20, 0x00, 0xcc},
2333	{0xb3, 0x21, 0x00, 0xcc},
2334	{0xb3, 0x22, 0x01, 0xcc},
2335	{0xb3, 0x23, 0xe0, 0xcc},
2336	{0xbc, 0x00, 0xd1, 0xcc},
2337	{0xbc, 0x01, 0x01, 0xcc},
2338	{0x00, 0x12, 0x80, 0xaa},
2339	{0x00, 0x00, 0x20, 0xdd},
2340	{0x00, 0x12, 0x00, 0xaa},
2341	{0x00, 0x11, 0x40, 0xaa},
2342	{0x00, 0x6b, 0x0a, 0xaa},
2343	{0x00, 0x3a, 0x04, 0xaa},
2344	{0x00, 0x40, 0xc0, 0xaa},
2345	{0x00, 0x8c, 0x00, 0xaa},
2346	{0x00, 0x7a, 0x29, 0xaa},
2347	{0x00, 0x7b, 0x0e, 0xaa},
2348	{0x00, 0x7c, 0x1a, 0xaa},
2349	{0x00, 0x7d, 0x31, 0xaa},
2350	{0x00, 0x7e, 0x53, 0xaa},
2351	{0x00, 0x7f, 0x60, 0xaa},
2352	{0x00, 0x80, 0x6b, 0xaa},
2353	{0x00, 0x81, 0x73, 0xaa},
2354	{0x00, 0x82, 0x7b, 0xaa},
2355	{0x00, 0x83, 0x82, 0xaa},
2356	{0x00, 0x84, 0x89, 0xaa},
2357	{0x00, 0x85, 0x96, 0xaa},
2358	{0x00, 0x86, 0xa1, 0xaa},
2359	{0x00, 0x87, 0xb7, 0xaa},
2360	{0x00, 0x88, 0xcc, 0xaa},
2361	{0x00, 0x89, 0xe1, 0xaa},
2362	{0x00, 0x13, 0xe0, 0xaa},
2363	{0x00, 0x00, 0x00, 0xaa},
2364	{0x00, 0x10, 0x00, 0xaa},
2365	{0x00, 0x0d, 0x40, 0xaa},
2366	{0x00, 0x14, 0x28, 0xaa},
2367	{0x00, 0xa5, 0x05, 0xaa},
2368	{0x00, 0xab, 0x07, 0xaa},
2369	{0x00, 0x24, 0x95, 0xaa},
2370	{0x00, 0x25, 0x33, 0xaa},
2371	{0x00, 0x26, 0xe3, 0xaa},
2372	{0x00, 0x9f, 0x88, 0xaa},
2373	{0x00, 0xa0, 0x78, 0xaa},
2374	{0x00, 0x55, 0x90, 0xaa},
2375	{0x00, 0xa1, 0x03, 0xaa},
2376	{0x00, 0xa6, 0xe0, 0xaa},
2377	{0x00, 0xa7, 0xd8, 0xaa},
2378	{0x00, 0xa8, 0xf0, 0xaa},
2379	{0x00, 0xa9, 0x90, 0xaa},
2380	{0x00, 0xaa, 0x14, 0xaa},
2381	{0x00, 0x13, 0xe5, 0xaa},
2382	{0x00, 0x0e, 0x61, 0xaa},
2383	{0x00, 0x0f, 0x4b, 0xaa},
2384	{0x00, 0x16, 0x02, 0xaa},
2385	{0x00, 0x1e, 0x07, 0xaa},	/* MVFP */
2386	{0x00, 0x21, 0x02, 0xaa},
2387	{0x00, 0x22, 0x91, 0xaa},
2388	{0x00, 0x29, 0x07, 0xaa},
2389	{0x00, 0x33, 0x0b, 0xaa},
2390	{0x00, 0x35, 0x0b, 0xaa},
2391	{0x00, 0x37, 0x1d, 0xaa},
2392	{0x00, 0x38, 0x71, 0xaa},
2393	{0x00, 0x39, 0x2a, 0xaa},
2394	{0x00, 0x3c, 0x78, 0xaa},
2395	{0x00, 0x4d, 0x40, 0xaa},
2396	{0x00, 0x4e, 0x20, 0xaa},
2397	{0x00, 0x74, 0x19, 0xaa},
2398	{0x00, 0x8d, 0x4f, 0xaa},
2399	{0x00, 0x8e, 0x00, 0xaa},
2400	{0x00, 0x8f, 0x00, 0xaa},
2401	{0x00, 0x90, 0x00, 0xaa},
2402	{0x00, 0x91, 0x00, 0xaa},
2403	{0x00, 0x96, 0x00, 0xaa},
2404	{0x00, 0x9a, 0x80, 0xaa},
2405	{0x00, 0xb0, 0x84, 0xaa},
2406	{0x00, 0xb1, 0x0c, 0xaa},
2407	{0x00, 0xb2, 0x0e, 0xaa},
2408	{0x00, 0xb3, 0x82, 0xaa},
2409	{0x00, 0xb8, 0x0a, 0xaa},
2410	{0x00, 0x43, 0x14, 0xaa},
2411	{0x00, 0x44, 0xf0, 0xaa},
2412	{0x00, 0x45, 0x45, 0xaa},
2413	{0x00, 0x46, 0x63, 0xaa},
2414	{0x00, 0x47, 0x2d, 0xaa},
2415	{0x00, 0x48, 0x46, 0xaa},
2416	{0x00, 0x59, 0x88, 0xaa},
2417	{0x00, 0x5a, 0xa0, 0xaa},
2418	{0x00, 0x5b, 0xc6, 0xaa},
2419	{0x00, 0x5c, 0x7d, 0xaa},
2420	{0x00, 0x5d, 0x5f, 0xaa},
2421	{0x00, 0x5e, 0x19, 0xaa},
2422	{0x00, 0x6c, 0x0a, 0xaa},
2423	{0x00, 0x6d, 0x55, 0xaa},
2424	{0x00, 0x6e, 0x11, 0xaa},
2425	{0x00, 0x6f, 0x9e, 0xaa},
2426	{0x00, 0x69, 0x00, 0xaa},
2427	{0x00, 0x6a, 0x40, 0xaa},
2428	{0x00, 0x01, 0x40, 0xaa},
2429	{0x00, 0x02, 0x40, 0xaa},
2430	{0x00, 0x13, 0xe7, 0xaa},
2431	{0x00, 0x5f, 0xf0, 0xaa},
2432	{0x00, 0x60, 0xf0, 0xaa},
2433	{0x00, 0x61, 0xf0, 0xaa},
2434	{0x00, 0x27, 0xa0, 0xaa},
2435	{0x00, 0x28, 0x80, 0xaa},
2436	{0x00, 0x2c, 0x90, 0xaa},
2437	{0x00, 0x4f, 0x66, 0xaa},
2438	{0x00, 0x50, 0x66, 0xaa},
2439	{0x00, 0x51, 0x00, 0xaa},
2440	{0x00, 0x52, 0x22, 0xaa},
2441	{0x00, 0x53, 0x5e, 0xaa},
2442	{0x00, 0x54, 0x80, 0xaa},
2443	{0x00, 0x58, 0x9e, 0xaa},
2444	{0x00, 0x41, 0x08, 0xaa},
2445	{0x00, 0x3f, 0x00, 0xaa},
2446	{0x00, 0x75, 0x85, 0xaa},
2447	{0x00, 0x76, 0xe1, 0xaa},
2448	{0x00, 0x4c, 0x00, 0xaa},
2449	{0x00, 0x77, 0x0a, 0xaa},
2450	{0x00, 0x3d, 0x88, 0xaa},
2451	{0x00, 0x4b, 0x09, 0xaa},
2452	{0x00, 0xc9, 0x60, 0xaa},
2453	{0x00, 0x41, 0x38, 0xaa},
2454	{0x00, 0x62, 0x30, 0xaa},
2455	{0x00, 0x63, 0x30, 0xaa},
2456	{0x00, 0x64, 0x08, 0xaa},
2457	{0x00, 0x94, 0x07, 0xaa},
2458	{0x00, 0x95, 0x0b, 0xaa},
2459	{0x00, 0x65, 0x00, 0xaa},
2460	{0x00, 0x66, 0x05, 0xaa},
2461	{0x00, 0x56, 0x50, 0xaa},
2462	{0x00, 0x34, 0x11, 0xaa},
2463	{0x00, 0xa4, 0x88, 0xaa},
2464	{0x00, 0x96, 0x00, 0xaa},
2465	{0x00, 0x97, 0x30, 0xaa},
2466	{0x00, 0x98, 0x20, 0xaa},
2467	{0x00, 0x99, 0x30, 0xaa},
2468	{0x00, 0x9a, 0x84, 0xaa},
2469	{0x00, 0x9b, 0x29, 0xaa},
2470	{0x00, 0x9c, 0x03, 0xaa},
2471	{0x00, 0x78, 0x04, 0xaa},
2472	{0x00, 0x79, 0x01, 0xaa},
2473	{0x00, 0xc8, 0xf0, 0xaa},
2474	{0x00, 0x79, 0x0f, 0xaa},
2475	{0x00, 0xc8, 0x00, 0xaa},
2476	{0x00, 0x79, 0x10, 0xaa},
2477	{0x00, 0xc8, 0x7e, 0xaa},
2478	{0x00, 0x79, 0x0a, 0xaa},
2479	{0x00, 0xc8, 0x80, 0xaa},
2480	{0x00, 0x79, 0x0b, 0xaa},
2481	{0x00, 0xc8, 0x01, 0xaa},
2482	{0x00, 0x79, 0x0c, 0xaa},
2483	{0x00, 0xc8, 0x0f, 0xaa},
2484	{0x00, 0x79, 0x0d, 0xaa},
2485	{0x00, 0xc8, 0x20, 0xaa},
2486	{0x00, 0x79, 0x09, 0xaa},
2487	{0x00, 0xc8, 0x80, 0xaa},
2488	{0x00, 0x79, 0x02, 0xaa},
2489	{0x00, 0xc8, 0xc0, 0xaa},
2490	{0x00, 0x79, 0x03, 0xaa},
2491	{0x00, 0xc8, 0x40, 0xaa},
2492	{0x00, 0x79, 0x05, 0xaa},
2493	{0x00, 0xc8, 0x30, 0xaa},
2494	{0x00, 0x79, 0x26, 0xaa},
2495	{0x00, 0x11, 0x40, 0xaa},
2496	{0x00, 0x3a, 0x04, 0xaa},
2497	{0x00, 0x12, 0x00, 0xaa},
2498	{0x00, 0x40, 0xc0, 0xaa},
2499	{0x00, 0x8c, 0x00, 0xaa},
2500	{0x00, 0x17, 0x14, 0xaa},
2501	{0x00, 0x18, 0x02, 0xaa},
2502	{0x00, 0x32, 0x92, 0xaa},
2503	{0x00, 0x19, 0x02, 0xaa},
2504	{0x00, 0x1a, 0x7a, 0xaa},
2505	{0x00, 0x03, 0x0a, 0xaa},
2506	{0x00, 0x0c, 0x00, 0xaa},
2507	{0x00, 0x3e, 0x00, 0xaa},
2508	{0x00, 0x70, 0x3a, 0xaa},
2509	{0x00, 0x71, 0x35, 0xaa},
2510	{0x00, 0x72, 0x11, 0xaa},
2511	{0x00, 0x73, 0xf0, 0xaa},
2512	{0x00, 0xa2, 0x02, 0xaa},
2513	{0x00, 0xb1, 0x00, 0xaa},
2514	{0x00, 0xb1, 0x0c, 0xaa},
2515	{0x00, 0x1e, 0x37, 0xaa},	/* MVFP */
2516	{0x00, 0xaa, 0x14, 0xaa},
2517	{0x00, 0x24, 0x80, 0xaa},
2518	{0x00, 0x25, 0x74, 0xaa},
2519	{0x00, 0x26, 0xd3, 0xaa},
2520	{0x00, 0x0d, 0x00, 0xaa},
2521	{0x00, 0x14, 0x18, 0xaa},
2522	{0x00, 0x9d, 0x99, 0xaa},
2523	{0x00, 0x9e, 0x7f, 0xaa},
2524	{0x00, 0x64, 0x08, 0xaa},
2525	{0x00, 0x94, 0x07, 0xaa},
2526	{0x00, 0x95, 0x06, 0xaa},
2527	{0x00, 0x66, 0x05, 0xaa},
2528	{0x00, 0x41, 0x08, 0xaa},
2529	{0x00, 0x3f, 0x00, 0xaa},
2530	{0x00, 0x75, 0x07, 0xaa},
2531	{0x00, 0x76, 0xe1, 0xaa},
2532	{0x00, 0x4c, 0x00, 0xaa},
2533	{0x00, 0x77, 0x00, 0xaa},
2534	{0x00, 0x3d, 0xc2, 0xaa},
2535	{0x00, 0x4b, 0x09, 0xaa},
2536	{0x00, 0xc9, 0x60, 0xaa},
2537	{0x00, 0x41, 0x38, 0xaa},
2538	{0xbc, 0x02, 0x18, 0xcc},
2539	{0xbc, 0x03, 0x50, 0xcc},
2540	{0xbc, 0x04, 0x18, 0xcc},
2541	{0xbc, 0x05, 0x00, 0xcc},
2542	{0xbc, 0x06, 0x00, 0xcc},
2543	{0xbc, 0x08, 0x30, 0xcc},
2544	{0xbc, 0x09, 0x40, 0xcc},
2545	{0xbc, 0x0a, 0x10, 0xcc},
2546	{0xbc, 0x0b, 0x00, 0xcc},
2547	{0xbc, 0x0c, 0x00, 0xcc},
2548	{0xbf, 0xc0, 0x26, 0xcc},
2549	{0xbf, 0xc1, 0x02, 0xcc},
2550	{0xbf, 0xcc, 0x04, 0xcc},
2551	{0xb3, 0x5c, 0x01, 0xcc},
2552	{0xb3, 0x01, 0x45, 0xcc},
2553	{0x00, 0x77, 0x05, 0xaa},
2554	{},
2555};
2556
2557/* PO1200 - values from usbvm326.inf and ms-win trace */
2558static const u8 po1200_gamma[17] = {
2559	0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
2560	0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
2561};
2562static const u8 po1200_matrix[9] = {
2563	0x60, 0xf9, 0xe5, 0xe7, 0x50, 0x05, 0xf3, 0xe6, 0x5e
2564};
2565static const u8 po1200_initVGA_data[][4] = {
2566	{0xb0, 0x03, 0x19, 0xcc},	/* reset? */
2567	{0xb0, 0x03, 0x19, 0xcc},
2568/*	{0x00, 0x00, 0x33, 0xdd}, */
2569	{0xb0, 0x04, 0x02, 0xcc},
2570	{0xb0, 0x02, 0x02, 0xcc},
2571	{0xb3, 0x5d, 0x00, 0xcc},
2572	{0xb3, 0x01, 0x01, 0xcc},
2573	{0xb3, 0x00, 0x64, 0xcc},
2574	{0xb3, 0x00, 0x65, 0xcc},
2575	{0xb3, 0x05, 0x01, 0xcc},
2576	{0xb3, 0x06, 0x01, 0xcc},
2577	{0xb3, 0x5c, 0x01, 0xcc},
2578	{0xb3, 0x08, 0x01, 0xcc},
2579	{0xb3, 0x09, 0x0c, 0xcc},
2580	{0xb3, 0x00, 0x67, 0xcc},
2581	{0xb3, 0x02, 0xb2, 0xcc},
2582	{0xb3, 0x03, 0x18, 0xcc},
2583	{0xb3, 0x04, 0x15, 0xcc},
2584	{0xb3, 0x20, 0x00, 0xcc},
2585	{0xb3, 0x21, 0x00, 0xcc},
2586	{0xb3, 0x22, 0x02, 0xcc},
2587	{0xb3, 0x23, 0x58, 0xcc},
2588	{0xb3, 0x14, 0x00, 0xcc},
2589	{0xb3, 0x15, 0x00, 0xcc},
2590	{0xb3, 0x16, 0x03, 0xcc},
2591	{0xb3, 0x17, 0x1f, 0xcc},
2592	{0xbc, 0x00, 0x71, 0xcc},
2593	{0xbc, 0x01, 0x01, 0xcc},
2594	{0xb0, 0x54, 0x13, 0xcc},
2595	{0xb3, 0x00, 0x67, 0xcc},
2596	{0xb3, 0x34, 0x01, 0xcc},
2597	{0xb3, 0x35, 0xdc, 0xcc},	/* i2c add: 5c */
2598	{0x00, 0x03, 0x00, 0xaa},
2599	{0x00, 0x12, 0x05, 0xaa},
2600	{0x00, 0x13, 0x02, 0xaa},
2601	{0x00, 0x1e, 0xc6, 0xaa},	/* h/v flip */
2602	{0x00, 0x21, 0x00, 0xaa},
2603	{0x00, 0x25, 0x02, 0xaa},
2604	{0x00, 0x3c, 0x4f, 0xaa},
2605	{0x00, 0x3f, 0xe0, 0xaa},
2606	{0x00, 0x42, 0xff, 0xaa},
2607	{0x00, 0x45, 0x34, 0xaa},
2608	{0x00, 0x55, 0xfe, 0xaa},
2609	{0x00, 0x59, 0xd3, 0xaa},
2610	{0x00, 0x5e, 0x04, 0xaa},
2611	{0x00, 0x61, 0xb8, 0xaa},	/* sharpness */
2612	{0x00, 0x62, 0x02, 0xaa},
2613	{0x00, 0xa7, 0x31, 0xaa},
2614	{0x00, 0xa9, 0x66, 0xaa},
2615	{0x00, 0xb0, 0x00, 0xaa},
2616	{0x00, 0xb1, 0x00, 0xaa},
2617	{0x00, 0xb3, 0x11, 0xaa},
2618	{0x00, 0xb6, 0x26, 0xaa},
2619	{0x00, 0xb7, 0x20, 0xaa},
2620	{0x00, 0xba, 0x04, 0xaa},
2621	{0x00, 0x88, 0x42, 0xaa},
2622	{0x00, 0x89, 0x9a, 0xaa},
2623	{0x00, 0x8a, 0x88, 0xaa},
2624	{0x00, 0x8b, 0x8e, 0xaa},
2625	{0x00, 0x8c, 0x3e, 0xaa},
2626	{0x00, 0x8d, 0x90, 0xaa},
2627	{0x00, 0x8e, 0x87, 0xaa},
2628	{0x00, 0x8f, 0x96, 0xaa},
2629	{0x00, 0x90, 0x3d, 0xaa},
2630	{0x00, 0x64, 0x00, 0xaa},
2631	{0x00, 0x65, 0x10, 0xaa},
2632	{0x00, 0x66, 0x20, 0xaa},
2633	{0x00, 0x67, 0x2b, 0xaa},
2634	{0x00, 0x68, 0x36, 0xaa},
2635	{0x00, 0x69, 0x49, 0xaa},
2636	{0x00, 0x6a, 0x5a, 0xaa},
2637	{0x00, 0x6b, 0x7f, 0xaa},
2638	{0x00, 0x6c, 0x9b, 0xaa},
2639	{0x00, 0x6d, 0xba, 0xaa},
2640	{0x00, 0x6e, 0xd4, 0xaa},
2641	{0x00, 0x6f, 0xea, 0xaa},
2642	{0x00, 0x70, 0x00, 0xaa},
2643	{0x00, 0x71, 0x10, 0xaa},
2644	{0x00, 0x72, 0x20, 0xaa},
2645	{0x00, 0x73, 0x2b, 0xaa},
2646	{0x00, 0x74, 0x36, 0xaa},
2647	{0x00, 0x75, 0x49, 0xaa},
2648	{0x00, 0x76, 0x5a, 0xaa},
2649	{0x00, 0x77, 0x7f, 0xaa},
2650	{0x00, 0x78, 0x9b, 0xaa},
2651	{0x00, 0x79, 0xba, 0xaa},
2652	{0x00, 0x7a, 0xd4, 0xaa},
2653	{0x00, 0x7b, 0xea, 0xaa},
2654	{0x00, 0x7c, 0x00, 0xaa},
2655	{0x00, 0x7d, 0x10, 0xaa},
2656	{0x00, 0x7e, 0x20, 0xaa},
2657	{0x00, 0x7f, 0x2b, 0xaa},
2658	{0x00, 0x80, 0x36, 0xaa},
2659	{0x00, 0x81, 0x49, 0xaa},
2660	{0x00, 0x82, 0x5a, 0xaa},
2661	{0x00, 0x83, 0x7f, 0xaa},
2662	{0x00, 0x84, 0x9b, 0xaa},
2663	{0x00, 0x85, 0xba, 0xaa},
2664	{0x00, 0x86, 0xd4, 0xaa},
2665	{0x00, 0x87, 0xea, 0xaa},
2666	{0x00, 0x57, 0x2a, 0xaa},
2667	{0x00, 0x03, 0x01, 0xaa},
2668	{0x00, 0x04, 0x10, 0xaa},
2669	{0x00, 0x05, 0x10, 0xaa},
2670	{0x00, 0x06, 0x10, 0xaa},
2671	{0x00, 0x07, 0x10, 0xaa},
2672	{0x00, 0x08, 0x13, 0xaa},
2673	{0x00, 0x0a, 0x00, 0xaa},
2674	{0x00, 0x0b, 0x10, 0xaa},
2675	{0x00, 0x0c, 0x20, 0xaa},
2676	{0x00, 0x0d, 0x18, 0xaa},
2677	{0x00, 0x22, 0x01, 0xaa},
2678	{0x00, 0x23, 0x60, 0xaa},
2679	{0x00, 0x25, 0x08, 0xaa},
2680	{0x00, 0x26, 0x82, 0xaa},
2681	{0x00, 0x2e, 0x0f, 0xaa},
2682	{0x00, 0x2f, 0x1e, 0xaa},
2683	{0x00, 0x30, 0x2d, 0xaa},
2684	{0x00, 0x31, 0x3c, 0xaa},
2685	{0x00, 0x32, 0x4b, 0xaa},
2686	{0x00, 0x33, 0x5a, 0xaa},
2687	{0x00, 0x34, 0x69, 0xaa},
2688	{0x00, 0x35, 0x78, 0xaa},
2689	{0x00, 0x36, 0x87, 0xaa},
2690	{0x00, 0x37, 0x96, 0xaa},
2691	{0x00, 0x38, 0xa5, 0xaa},
2692	{0x00, 0x39, 0xb4, 0xaa},
2693	{0x00, 0x3a, 0xc3, 0xaa},
2694	{0x00, 0x3b, 0xd2, 0xaa},
2695	{0x00, 0x3c, 0xe1, 0xaa},
2696	{0x00, 0x3e, 0xff, 0xaa},
2697	{0x00, 0x3f, 0xff, 0xaa},
2698	{0x00, 0x40, 0xff, 0xaa},
2699	{0x00, 0x41, 0xff, 0xaa},
2700	{0x00, 0x42, 0xff, 0xaa},
2701	{0x00, 0x43, 0xff, 0xaa},
2702	{0x00, 0x03, 0x00, 0xaa},
2703	{0x00, 0x03, 0x00, 0xaa},
2704	{0x00, 0x20, 0xc4, 0xaa},
2705	{0x00, 0x13, 0x03, 0xaa},
2706	{0x00, 0x3c, 0x50, 0xaa},
2707	{0x00, 0x61, 0x6a, 0xaa},	/* sharpness? */
2708	{0x00, 0x51, 0x5b, 0xaa},
2709	{0x00, 0x52, 0x91, 0xaa},
2710	{0x00, 0x53, 0x4c, 0xaa},
2711	{0x00, 0x54, 0x50, 0xaa},
2712	{0x00, 0x56, 0x02, 0xaa},
2713	{0xb6, 0x00, 0x00, 0xcc},
2714	{0xb6, 0x03, 0x03, 0xcc},
2715	{0xb6, 0x02, 0x20, 0xcc},
2716	{0xb6, 0x05, 0x02, 0xcc},
2717	{0xb6, 0x04, 0x58, 0xcc},
2718	{0xb6, 0x12, 0xf8, 0xcc},
2719	{0xb6, 0x13, 0x21, 0xcc},
2720	{0xb6, 0x18, 0x03, 0xcc},
2721	{0xb6, 0x17, 0xa9, 0xcc},
2722	{0xb6, 0x16, 0x80, 0xcc},
2723	{0xb6, 0x22, 0x12, 0xcc},
2724	{0xb6, 0x23, 0x0b, 0xcc},
2725	{0xbf, 0xc0, 0x39, 0xcc},
2726	{0xbf, 0xc1, 0x04, 0xcc},
2727	{0xbf, 0xcc, 0x00, 0xcc},
2728	{0xb8, 0x06, 0x20, 0xcc},
2729	{0xb8, 0x07, 0x03, 0xcc},
2730	{0xb8, 0x08, 0x58, 0xcc},
2731	{0xb8, 0x09, 0x02, 0xcc},
2732	{0xb3, 0x01, 0x41, 0xcc},
2733	{0x00, 0x03, 0x00, 0xaa},
2734	{0x00, 0xd9, 0x0f, 0xaa},
2735	{0x00, 0xda, 0xaa, 0xaa},
2736	{0x00, 0xd9, 0x10, 0xaa},
2737	{0x00, 0xda, 0xaa, 0xaa},
2738	{0x00, 0xd9, 0x11, 0xaa},
2739	{0x00, 0xda, 0x00, 0xaa},
2740	{0x00, 0xd9, 0x12, 0xaa},
2741	{0x00, 0xda, 0xff, 0xaa},
2742	{0x00, 0xd9, 0x13, 0xaa},
2743	{0x00, 0xda, 0xff, 0xaa},
2744	{0x00, 0xe8, 0x11, 0xaa},
2745	{0x00, 0xe9, 0x12, 0xaa},
2746	{0x00, 0xea, 0x5c, 0xaa},
2747	{0x00, 0xeb, 0xff, 0xaa},
2748	{0x00, 0xd8, 0x80, 0xaa},
2749	{0x00, 0xe6, 0x02, 0xaa},
2750	{0x00, 0xd6, 0x40, 0xaa},
2751	{0x00, 0xe3, 0x05, 0xaa},
2752	{0x00, 0xe0, 0x40, 0xaa},
2753	{0x00, 0xde, 0x03, 0xaa},
2754	{0x00, 0xdf, 0x03, 0xaa},
2755	{0x00, 0xdb, 0x02, 0xaa},
2756	{0x00, 0xdc, 0x00, 0xaa},
2757	{0x00, 0xdd, 0x03, 0xaa},
2758	{0x00, 0xe1, 0x08, 0xaa},
2759	{0x00, 0xe2, 0x01, 0xaa},
2760	{0x00, 0xd6, 0x40, 0xaa},
2761	{0x00, 0xe4, 0x40, 0xaa},
2762	{0x00, 0xa8, 0x8f, 0xaa},
2763	{0x00, 0xb4, 0x16, 0xaa},
2764	{0xb0, 0x02, 0x06, 0xcc},
2765	{0xb0, 0x18, 0x06, 0xcc},
2766	{0xb0, 0x19, 0x06, 0xcc},
2767	{0xb3, 0x5d, 0x18, 0xcc},
2768	{0xb3, 0x05, 0x00, 0xcc},
2769	{0xb3, 0x06, 0x00, 0xcc},
2770	{0x00, 0xb4, 0x0e, 0xaa},
2771	{0x00, 0xb5, 0x49, 0xaa},
2772	{0x00, 0xb6, 0x1c, 0xaa},
2773	{0x00, 0xb7, 0x96, 0xaa},
2774/* end of usbvm326.inf - start of ms-win trace */
2775	{0xb6, 0x12, 0xf8, 0xcc},
2776	{0xb6, 0x13, 0x3d, 0xcc},
2777/*read b306*/
2778	{0x00, 0x03, 0x00, 0xaa},
2779	{0x00, 0x1a, 0x09, 0xaa},
2780	{0x00, 0x1b, 0x8a, 0xaa},
2781/*read b827*/
2782	{0xb8, 0x27, 0x00, 0xcc},
2783	{0xb8, 0x26, 0x60, 0xcc},
2784	{0xb8, 0x26, 0x60, 0xcc},
2785/*gamma - to do?*/
2786	{0x00, 0x03, 0x00, 0xaa},
2787	{0x00, 0xae, 0x84, 0xaa},
2788/*gamma again*/
2789	{0x00, 0x03, 0x00, 0xaa},
2790	{0x00, 0x96, 0xa0, 0xaa},
2791/*matrix*/
2792	{0x00, 0x03, 0x00, 0xaa},
2793	{0x00, 0x91, 0x35, 0xaa},
2794	{0x00, 0x92, 0x22, 0xaa},
2795/*gamma*/
2796	{0x00, 0x03, 0x00, 0xaa},
2797	{0x00, 0x95, 0x85, 0xaa},
2798/*matrix*/
2799	{0x00, 0x03, 0x00, 0xaa},
2800	{0x00, 0x4d, 0x20, 0xaa},
2801	{0xb8, 0x22, 0x40, 0xcc},
2802	{0xb8, 0x23, 0x40, 0xcc},
2803	{0xb8, 0x24, 0x40, 0xcc},
2804	{0xb8, 0x81, 0x09, 0xcc},
2805	{0x00, 0x00, 0x64, 0xdd},
2806	{0x00, 0x03, 0x01, 0xaa},
2807/*read 46*/
2808	{0x00, 0x46, 0x3c, 0xaa},
2809	{0x00, 0x03, 0x00, 0xaa},
2810	{0x00, 0x16, 0x40, 0xaa},
2811	{0x00, 0x17, 0x40, 0xaa},
2812	{0x00, 0x18, 0x40, 0xaa},
2813	{0x00, 0x19, 0x41, 0xaa},
2814	{0x00, 0x03, 0x01, 0xaa},
2815	{0x00, 0x46, 0x3c, 0xaa},
2816	{0x00, 0x00, 0x18, 0xdd},
2817/*read bfff*/
2818	{0x00, 0x03, 0x00, 0xaa},
2819	{0x00, 0xb4, 0x1c, 0xaa},
2820	{0x00, 0xb5, 0x92, 0xaa},
2821	{0x00, 0xb6, 0x39, 0xaa},
2822	{0x00, 0xb7, 0x24, 0xaa},
2823/*write 89 0400 1415*/
2824	{}
2825};
2826
2827static const u8 poxxxx_init_common[][4] = {
2828	{0xb3, 0x00, 0x04, 0xcc},
2829	{0x00, 0x00, 0x10, 0xdd},
2830	{0xb3, 0x00, 0x64, 0xcc},
2831	{0x00, 0x00, 0x10, 0xdd},
2832	{0xb3, 0x00, 0x65, 0xcc},
2833	{0x00, 0x00, 0x10, 0xdd},
2834	{0xb3, 0x00, 0x67, 0xcc},
2835	{0xb0, 0x03, 0x09, 0xcc},
2836	{0xb3, 0x05, 0x00, 0xcc},
2837	{0xb3, 0x06, 0x00, 0xcc},
2838	{0xb3, 0x5c, 0x01, 0xcc},
2839	{0xb3, 0x08, 0x01, 0xcc},
2840	{0xb3, 0x09, 0x0c, 0xcc},
2841	{0xb3, 0x34, 0x01, 0xcc},
2842	{0xb3, 0x35, 0xf6, 0xcc},	/* i2c add: 76 */
2843	{0xb3, 0x02, 0xb0, 0xcc},
2844	{0xb3, 0x03, 0x18, 0xcc},
2845	{0xb3, 0x04, 0x15, 0xcc},
2846	{0xb3, 0x20, 0x00, 0xcc},
2847	{0xb3, 0x21, 0x00, 0xcc},
2848	{0xb3, 0x22, 0x04, 0xcc},	/* sensor height = 1024 */
2849	{0xb3, 0x23, 0x00, 0xcc},
2850	{0xb3, 0x14, 0x00, 0xcc},
2851	{0xb3, 0x15, 0x00, 0xcc},
2852	{0xb3, 0x16, 0x04, 0xcc},	/* sensor width = 1280 */
2853	{0xb3, 0x17, 0xff, 0xcc},
2854	{0xb3, 0x2c, 0x03, 0xcc},
2855	{0xb3, 0x2d, 0x56, 0xcc},
2856	{0xb3, 0x2e, 0x02, 0xcc},
2857	{0xb3, 0x2f, 0x0a, 0xcc},
2858	{0xb3, 0x40, 0x00, 0xcc},
2859	{0xb3, 0x41, 0x34, 0xcc},
2860	{0xb3, 0x42, 0x01, 0xcc},
2861	{0xb3, 0x43, 0xe0, 0xcc},
2862	{0xbc, 0x00, 0x71, 0xcc},
2863	{0xbc, 0x01, 0x01, 0xcc},
2864	{0xb3, 0x01, 0x41, 0xcc},
2865	{0xb3, 0x4d, 0x00, 0xcc},
2866	{0x00, 0x0b, 0x2a, 0xaa},
2867	{0x00, 0x0e, 0x03, 0xaa},
2868	{0x00, 0x0f, 0xea, 0xaa},
2869	{0x00, 0x12, 0x08, 0xaa},
2870	{0x00, 0x1e, 0x06, 0xaa},
2871	{0x00, 0x21, 0x00, 0xaa},
2872	{0x00, 0x31, 0x1f, 0xaa},
2873	{0x00, 0x33, 0x38, 0xaa},
2874	{0x00, 0x36, 0xc0, 0xaa},
2875	{0x00, 0x37, 0xc8, 0xaa},
2876	{0x00, 0x3b, 0x36, 0xaa},
2877	{0x00, 0x4b, 0xfe, 0xaa},
2878	{0x00, 0x4d, 0x2e, 0xaa},
2879	{0x00, 0x51, 0x1c, 0xaa},
2880	{0x00, 0x52, 0x01, 0xaa},
2881	{0x00, 0x55, 0x0a, 0xaa},
2882	{0x00, 0x56, 0x0a, 0xaa},
2883	{0x00, 0x57, 0x07, 0xaa},
2884	{0x00, 0x58, 0x07, 0xaa},
2885	{0x00, 0x59, 0x04, 0xaa},
2886	{0x00, 0x70, 0x68, 0xaa},
2887	{0x00, 0x71, 0x04, 0xaa},
2888	{0x00, 0x72, 0x10, 0xaa},
2889	{0x00, 0x80, 0x71, 0xaa},
2890	{0x00, 0x81, 0x08, 0xaa},
2891	{0x00, 0x82, 0x00, 0xaa},
2892	{0x00, 0x83, 0x55, 0xaa},
2893	{0x00, 0x84, 0x06, 0xaa},
2894	{0x00, 0x85, 0x06, 0xaa},
2895	{0x00, 0x8b, 0x25, 0xaa},
2896	{0x00, 0x8c, 0x00, 0xaa},
2897	{0x00, 0x8d, 0x86, 0xaa},
2898	{0x00, 0x8e, 0x82, 0xaa},
2899	{0x00, 0x8f, 0x2d, 0xaa},
2900	{0x00, 0x90, 0x8b, 0xaa},
2901	{0x00, 0x91, 0x81, 0xaa},
2902	{0x00, 0x92, 0x81, 0xaa},
2903	{0x00, 0x93, 0x23, 0xaa},
2904	{0x00, 0xa3, 0x2a, 0xaa},
2905	{0x00, 0xa4, 0x03, 0xaa},
2906	{0x00, 0xa5, 0xea, 0xaa},
2907	{0x00, 0xb0, 0x68, 0xaa},
2908	{0x00, 0xbc, 0x04, 0xaa},
2909	{0x00, 0xbe, 0x3b, 0xaa},
2910	{0x00, 0x4e, 0x40, 0xaa},
2911	{0x00, 0x06, 0x04, 0xaa},
2912	{0x00, 0x07, 0x03, 0xaa},
2913	{0x00, 0xcd, 0x18, 0xaa},
2914	{0x00, 0x28, 0x03, 0xaa},
2915	{0x00, 0x29, 0xef, 0xaa},
2916/* reinit on alt 2 (qvga) or alt7 (vga) */
2917	{0xb3, 0x05, 0x00, 0xcc},
2918	{0xb3, 0x06, 0x00, 0xcc},
2919	{0xb8, 0x00, 0x01, 0xcc},
2920
2921	{0x00, 0x1d, 0x85, 0xaa},
2922	{0x00, 0x1e, 0xc6, 0xaa},
2923	{0x00, 0x00, 0x40, 0xdd},
2924	{0x00, 0x1d, 0x05, 0xaa},
2925	{}
2926};
2927static const u8 poxxxx_gamma[][4] = {
2928	{0x00, 0xd6, 0x22, 0xaa},	/* gamma 0 */
2929	{0x00, 0x73, 0x00, 0xaa},
2930	{0x00, 0x74, 0x0a, 0xaa},
2931	{0x00, 0x75, 0x16, 0xaa},
2932	{0x00, 0x76, 0x25, 0xaa},
2933	{0x00, 0x77, 0x34, 0xaa},
2934	{0x00, 0x78, 0x49, 0xaa},
2935	{0x00, 0x79, 0x5a, 0xaa},
2936	{0x00, 0x7a, 0x7f, 0xaa},
2937	{0x00, 0x7b, 0x9b, 0xaa},
2938	{0x00, 0x7c, 0xba, 0xaa},
2939	{0x00, 0x7d, 0xd4, 0xaa},
2940	{0x00, 0x7e, 0xea, 0xaa},
2941
2942	{0x00, 0xd6, 0x62, 0xaa},	/* gamma 1 */
2943	{0x00, 0x73, 0x00, 0xaa},
2944	{0x00, 0x74, 0x0a, 0xaa},
2945	{0x00, 0x75, 0x16, 0xaa},
2946	{0x00, 0x76, 0x25, 0xaa},
2947	{0x00, 0x77, 0x34, 0xaa},
2948	{0x00, 0x78, 0x49, 0xaa},
2949	{0x00, 0x79, 0x5a, 0xaa},
2950	{0x00, 0x7a, 0x7f, 0xaa},
2951	{0x00, 0x7b, 0x9b, 0xaa},
2952	{0x00, 0x7c, 0xba, 0xaa},
2953	{0x00, 0x7d, 0xd4, 0xaa},
2954	{0x00, 0x7e, 0xea, 0xaa},
2955
2956	{0x00, 0xd6, 0xa2, 0xaa},	/* gamma 2 */
2957	{0x00, 0x73, 0x00, 0xaa},
2958	{0x00, 0x74, 0x0a, 0xaa},
2959	{0x00, 0x75, 0x16, 0xaa},
2960	{0x00, 0x76, 0x25, 0xaa},
2961	{0x00, 0x77, 0x34, 0xaa},
2962	{0x00, 0x78, 0x49, 0xaa},
2963	{0x00, 0x79, 0x5a, 0xaa},
2964	{0x00, 0x7a, 0x7f, 0xaa},
2965	{0x00, 0x7b, 0x9b, 0xaa},
2966	{0x00, 0x7c, 0xba, 0xaa},
2967	{0x00, 0x7d, 0xd4, 0xaa},
2968	{0x00, 0x7e, 0xea, 0xaa},
2969	{}
2970};
2971static const u8 poxxxx_init_start_3[][4] = {
2972	{0x00, 0xb8, 0x28, 0xaa},
2973	{0x00, 0xb9, 0x1e, 0xaa},
2974	{0x00, 0xb6, 0x14, 0xaa},
2975	{0x00, 0xb7, 0x0f, 0xaa},
2976	{0x00, 0x5c, 0x10, 0xaa},
2977	{0x00, 0x5d, 0x18, 0xaa},
2978	{0x00, 0x5e, 0x24, 0xaa},
2979	{0x00, 0x5f, 0x24, 0xaa},
2980	{0x00, 0x86, 0x1a, 0xaa},
2981	{0x00, 0x60, 0x00, 0xaa},
2982	{0x00, 0x61, 0x1b, 0xaa},
2983	{0x00, 0x62, 0x30, 0xaa},
2984	{0x00, 0x63, 0x40, 0xaa},
2985	{0x00, 0x87, 0x1a, 0xaa},
2986	{0x00, 0x64, 0x00, 0xaa},
2987	{0x00, 0x65, 0x08, 0xaa},
2988	{0x00, 0x66, 0x10, 0xaa},
2989	{0x00, 0x67, 0x20, 0xaa},
2990	{0x00, 0x88, 0x10, 0xaa},
2991	{0x00, 0x68, 0x00, 0xaa},
2992	{0x00, 0x69, 0x08, 0xaa},
2993	{0x00, 0x6a, 0x0f, 0xaa},
2994	{0x00, 0x6b, 0x0f, 0xaa},
2995	{0x00, 0x89, 0x07, 0xaa},
2996	{0x00, 0xd5, 0x4c, 0xaa},
2997	{0x00, 0x0a, 0x00, 0xaa},
2998	{0x00, 0x0b, 0x2a, 0xaa},
2999	{0x00, 0x0e, 0x03, 0xaa},
3000	{0x00, 0x0f, 0xea, 0xaa},
3001	{0x00, 0xa2, 0x00, 0xaa},
3002	{0x00, 0xa3, 0x2a, 0xaa},
3003	{0x00, 0xa4, 0x03, 0xaa},
3004	{0x00, 0xa5, 0xea, 0xaa},
3005	{}
3006};
3007static const u8 poxxxx_initVGA[][4] = {
3008	{0x00, 0x20, 0x11, 0xaa},
3009	{0x00, 0x33, 0x38, 0xaa},
3010	{0x00, 0xbb, 0x0d, 0xaa},
3011	{0xb3, 0x22, 0x01, 0xcc},	/* change to 640x480 */
3012	{0xb3, 0x23, 0xe0, 0xcc},
3013	{0xb3, 0x16, 0x02, 0xcc},
3014	{0xb3, 0x17, 0x7f, 0xcc},
3015	{0xb3, 0x02, 0xb0, 0xcc},
3016	{0xb3, 0x06, 0x00, 0xcc},
3017	{0xb3, 0x5c, 0x01, 0xcc},
3018	{0x00, 0x04, 0x06, 0xaa},
3019	{0x00, 0x05, 0x3f, 0xaa},
3020	{0x00, 0x04, 0x00, 0xdd},	/* delay 1s */
3021	{}
3022};
3023static const u8 poxxxx_initQVGA[][4] = {
3024	{0x00, 0x20, 0x33, 0xaa},
3025	{0x00, 0x33, 0x38, 0xaa},
3026	{0x00, 0xbb, 0x0d, 0xaa},
3027	{0xb3, 0x22, 0x00, 0xcc},	/* change to 320x240 */
3028	{0xb3, 0x23, 0xf0, 0xcc},
3029	{0xb3, 0x16, 0x01, 0xcc},
3030	{0xb3, 0x17, 0x3f, 0xcc},
3031	{0xb3, 0x02, 0xb0, 0xcc},
3032	{0xb3, 0x06, 0x01, 0xcc},
3033	{0xb3, 0x5c, 0x00, 0xcc},
3034	{0x00, 0x04, 0x06, 0xaa},
3035	{0x00, 0x05, 0x3f, 0xaa},
3036	{0x00, 0x04, 0x00, 0xdd},	/* delay 1s */
3037	{}
3038};
3039static const u8 poxxxx_init_end_1[][4] = {
3040	{0x00, 0x47, 0x25, 0xaa},
3041	{0x00, 0x48, 0x80, 0xaa},
3042	{0x00, 0x49, 0x1f, 0xaa},
3043	{0x00, 0x4a, 0x40, 0xaa},
3044	{0x00, 0x44, 0x40, 0xaa},
3045	{0x00, 0xab, 0x4a, 0xaa},
3046	{0x00, 0xb1, 0x00, 0xaa},
3047	{0x00, 0xb2, 0x04, 0xaa},
3048	{0x00, 0xb3, 0x08, 0xaa},
3049	{0x00, 0xb4, 0x0b, 0xaa},
3050	{0x00, 0xb5, 0x0d, 0xaa},
3051	{}
3052};
3053static const u8 poxxxx_init_end_2[][4] = {
3054	{0x00, 0x1d, 0x85, 0xaa},
3055	{0x00, 0x1e, 0x06, 0xaa},
3056	{0x00, 0x1d, 0x05, 0xaa},
3057	{}
3058};
3059
3060struct sensor_info {
3061	s8 sensorId;
3062	u8 I2cAdd;
3063	u8 IdAdd;
3064	u16 VpId;
3065	u8 m1;
3066	u8 m2;
3067	u8 op;
3068};
3069
3070/* probe values */
3071static const struct sensor_info vc0321_probe_data[] = {
3072/*      sensorId,	   I2cAdd,	IdAdd,  VpId,  m1,    m2,  op */
3073/* 0 OV9640 */
3074	{-1,		    0x80 | 0x30, 0x0a, 0x0000, 0x25, 0x24, 0x05},
3075/* 1 ICM108T (may respond on IdAdd == 0x83 - tested in vc032x_probe_sensor) */
3076	{-1,		    0x80 | 0x20, 0x82, 0x0000, 0x24, 0x25, 0x01},
3077/* 2 PO2130 (may detect PO3130NC - tested in vc032x_probe_sensor)*/
3078	{-1,		    0x80 | 0x76, 0x00, 0x0000, 0x24, 0x25, 0x01},
3079/* 3 MI1310 */
3080	{-1,		    0x80 | 0x5d, 0x00, 0x0000, 0x24, 0x25, 0x01},
3081/* 4 MI360 - tested in vc032x_probe_sensor */
3082/*	{SENSOR_MI0360,	    0x80 | 0x5d, 0x00, 0x8243, 0x24, 0x25, 0x01}, */
3083/* 5 7131R */
3084	{SENSOR_HV7131R,    0x80 | 0x11, 0x00, 0x0209, 0x24, 0x25, 0x01},
3085/* 6 OV7649 */
3086	{-1,		    0x80 | 0x21, 0x0a, 0x0000, 0x21, 0x20, 0x05},
3087/* 7 PAS302BCW */
3088	{-1,		    0x80 | 0x40, 0x00, 0x0000, 0x20, 0x22, 0x05},
3089/* 8 OV7660 */
3090	{SENSOR_OV7660,     0x80 | 0x21, 0x0a, 0x7660, 0x26, 0x26, 0x05},
3091/* 9 PO3130NC - (tested in vc032x_probe_sensor) */
3092/*	{SENSOR_PO3130NC,   0x80 | 0x76, 0x00, 0x3130, 0x24, 0x25, 0x01}, */
3093/* 10 PO1030KC */
3094	{-1,		    0x80 | 0x6e, 0x00, 0x0000, 0x24, 0x25, 0x01},
3095/* 11 MI1310_SOC */
3096	{SENSOR_MI1310_SOC, 0x80 | 0x5d, 0x00, 0x143a, 0x24, 0x25, 0x01},
3097/* 12 OV9650 */
3098	{-1,		    0x80 | 0x30, 0x0a, 0x0000, 0x25, 0x24, 0x05},
3099/* 13 S5K532 */
3100	{-1,		    0x80 | 0x11, 0x39, 0x0000, 0x24, 0x25, 0x01},
3101/* 14 MI360_SOC - ??? */
3102/* 15 PO1200N */
3103	{SENSOR_PO1200,     0x80 | 0x5c, 0x00, 0x1200, 0x67, 0x67, 0x01},
3104/* 16 PO3030K */
3105	{-1,		    0x80 | 0x18, 0x00, 0x0000, 0x24, 0x25, 0x01},
3106/* 17 PO2030 */
3107	{-1,		    0x80 | 0x6e, 0x00, 0x0000, 0x24, 0x25, 0x01},
3108/* ?? */
3109	{-1,		    0x80 | 0x56, 0x01, 0x0000, 0x64, 0x67, 0x01},
3110	{SENSOR_MI1320,     0x80 | 0x48, 0x00, 0x148c, 0x64, 0x65, 0x01},
3111};
3112static const struct sensor_info vc0323_probe_data[] = {
3113/*      sensorId,	   I2cAdd,	IdAdd,  VpId,  m1,    m2,  op */
3114/* 0 OV9640 */
3115	{-1,		    0x80 | 0x30, 0x0a, 0x0000, 0x25, 0x24, 0x05},
3116/* 1 ICM108T (may respond on IdAdd == 0x83 - tested in vc032x_probe_sensor) */
3117	{-1,		    0x80 | 0x20, 0x82, 0x0000, 0x24, 0x25, 0x01},
3118/* 2 PO2130 (may detect PO3130NC - tested in vc032x_probe_sensor)*/
3119	{-1,		    0x80 | 0x76, 0x00, 0x0000, 0x24, 0x25, 0x01},
3120/* 3 MI1310 */
3121	{-1,		    0x80 | 0x5d, 0x00, 0x0000, 0x24, 0x25, 0x01},
3122/* 4 MI360 - tested in vc032x_probe_sensor */
3123/*	{SENSOR_MI0360,	    0x80 | 0x5d, 0x00, 0x8243, 0x24, 0x25, 0x01}, */
3124/* 5 7131R */
3125	{SENSOR_HV7131R,    0x80 | 0x11, 0x00, 0x0209, 0x24, 0x25, 0x01},
3126/* 6 OV7649 */
3127	{-1,		    0x80 | 0x21, 0x0a, 0x0000, 0x21, 0x20, 0x05},
3128/* 7 PAS302BCW */
3129	{-1,		    0x80 | 0x40, 0x00, 0x0000, 0x20, 0x22, 0x05},
3130/* 8 OV7660 */
3131	{SENSOR_OV7660,     0x80 | 0x21, 0x0a, 0x7660, 0x26, 0x26, 0x05},
3132/* 9 PO3130NC - (tested in vc032x_probe_sensor) */
3133/*	{SENSOR_PO3130NC,   0x80 | 0x76, 0x00, 0x3130, 0x24, 0x25, 0x01}, */
3134/* 10 PO1030KC */
3135	{-1,		    0x80 | 0x6e, 0x00, 0x0000, 0x24, 0x25, 0x01},
3136/* 11 MI1310_SOC */
3137	{SENSOR_MI1310_SOC, 0x80 | 0x5d, 0x00, 0x143a, 0x24, 0x25, 0x01},
3138/* 12 OV9650 */
3139	{-1,		    0x80 | 0x30, 0x0a, 0x0000, 0x25, 0x24, 0x05},
3140/* 13 S5K532 */
3141	{-1,		    0x80 | 0x11, 0x39, 0x0000, 0x24, 0x25, 0x01},
3142/* 14 MI360_SOC - ??? */
3143/* 15 PO1200N */
3144	{SENSOR_PO1200,     0x80 | 0x5c, 0x00, 0x1200, 0x67, 0x67, 0x01},
3145/* 16 ?? */
3146	{-1,		    0x80 | 0x2d, 0x00, 0x0000, 0x65, 0x67, 0x01},
3147/* 17 PO2030 */
3148	{-1,		    0x80 | 0x6e, 0x00, 0x0000, 0x24, 0x25, 0x01},
3149/* ?? */
3150	{-1,		    0x80 | 0x56, 0x01, 0x0000, 0x64, 0x67, 0x01},
3151	{SENSOR_MI1320_SOC, 0x80 | 0x48, 0x00, 0x148c, 0x64, 0x67, 0x01},
3152/*fixme: not in the ms-win probe - may be found before? */
3153	{SENSOR_OV7670,     0x80 | 0x21, 0x0a, 0x7673, 0x66, 0x67, 0x05},
3154};
3155
3156/* read 'len' bytes in gspca_dev->usb_buf */
3157static void reg_r_i(struct gspca_dev *gspca_dev,
3158		  u16 req,
3159		  u16 index,
3160		  u16 len)
3161{
3162	int ret;
3163
3164	if (gspca_dev->usb_err < 0)
3165		return;
3166	ret = usb_control_msg(gspca_dev->dev,
3167			usb_rcvctrlpipe(gspca_dev->dev, 0),
3168			req,
3169			USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
3170			1,			/* value */
3171			index, gspca_dev->usb_buf, len,
3172			500);
3173	if (ret < 0) {
3174		pr_err("reg_r err %d\n", ret);
3175		gspca_dev->usb_err = ret;
3176	}
3177}
3178static void reg_r(struct gspca_dev *gspca_dev,
3179		  u16 req,
3180		  u16 index,
3181		  u16 len)
3182{
3183	reg_r_i(gspca_dev, req, index, len);
3184#ifdef GSPCA_DEBUG
3185	if (gspca_dev->usb_err < 0)
3186		return;
3187	if (len == 1)
3188		PDEBUG(D_USBI, "GET %02x 0001 %04x %02x", req, index,
3189				gspca_dev->usb_buf[0]);
3190	else
3191		PDEBUG(D_USBI, "GET %02x 0001 %04x %02x %02x %02x",
3192				req, index,
3193				gspca_dev->usb_buf[0],
3194				gspca_dev->usb_buf[1],
3195				gspca_dev->usb_buf[2]);
3196#endif
3197}
3198
3199static void reg_w_i(struct gspca_dev *gspca_dev,
3200			    u16 req,
3201			    u16 value,
3202			    u16 index)
3203{
3204	int ret;
3205
3206	if (gspca_dev->usb_err < 0)
3207		return;
3208	ret = usb_control_msg(gspca_dev->dev,
3209			usb_sndctrlpipe(gspca_dev->dev, 0),
3210			req,
3211			USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
3212			value, index, NULL, 0,
3213			500);
3214	if (ret < 0) {
3215		pr_err("reg_w err %d\n", ret);
3216		gspca_dev->usb_err = ret;
3217	}
3218}
3219static void reg_w(struct gspca_dev *gspca_dev,
3220			    u16 req,
3221			    u16 value,
3222			    u16 index)
3223{
3224#ifdef GSPCA_DEBUG
3225	if (gspca_dev->usb_err < 0)
3226		return;
3227	PDEBUG(D_USBO, "SET %02x %04x %04x", req, value, index);
3228#endif
3229	reg_w_i(gspca_dev, req, value, index);
3230}
3231
3232static u16 read_sensor_register(struct gspca_dev *gspca_dev,
3233				u16 address)
3234{
3235	u8 ldata, mdata, hdata;
3236	int retry = 50;
3237
3238	reg_r(gspca_dev, 0xa1, 0xb33f, 1);
3239	if (!(gspca_dev->usb_buf[0] & 0x02)) {
3240		pr_err("I2c Bus Busy Wait %02x\n", gspca_dev->usb_buf[0]);
3241		return 0;
3242	}
3243	reg_w(gspca_dev, 0xa0, address, 0xb33a);
3244	reg_w(gspca_dev, 0xa0, 0x02, 0xb339);
3245
3246	do {
3247		reg_r(gspca_dev, 0xa1, 0xb33b, 1);
3248		if (gspca_dev->usb_buf[0] == 0x00)
3249			break;
3250		msleep(40);
3251	} while (--retry >= 0);
3252
3253	reg_r(gspca_dev, 0xa1, 0xb33e, 1);
3254	ldata = gspca_dev->usb_buf[0];
3255	reg_r(gspca_dev, 0xa1, 0xb33d, 1);
3256	mdata = gspca_dev->usb_buf[0];
3257	reg_r(gspca_dev, 0xa1, 0xb33c, 1);
3258	hdata = gspca_dev->usb_buf[0];
3259	if (hdata != 0 && mdata != 0 && ldata != 0)
3260		PDEBUG(D_PROBE, "Read Sensor %02x%02x %02x",
3261			hdata, mdata, ldata);
3262	reg_r(gspca_dev, 0xa1, 0xb334, 1);
3263	if (gspca_dev->usb_buf[0] == 0x02)
3264		return (hdata << 8) + mdata;
3265	return hdata;
3266}
3267
3268static int vc032x_probe_sensor(struct gspca_dev *gspca_dev)
3269{
3270	struct sd *sd = (struct sd *) gspca_dev;
3271	int i, n;
3272	u16 value;
3273	const struct sensor_info *ptsensor_info;
3274
3275/*fixme: should also check the other sensor (back mi1320_soc, front mc501cb)*/
3276	if (sd->flags & FL_SAMSUNG) {
3277		reg_w(gspca_dev, 0xa0, 0x01, 0xb301);
3278		reg_w(gspca_dev, 0x89, 0xf0ff, 0xffff);
3279						/* select the back sensor */
3280	}
3281
3282	reg_r(gspca_dev, 0xa1, 0xbfcf, 1);
3283	PDEBUG(D_PROBE, "vc032%d check sensor header %02x",
3284		sd->bridge == BRIDGE_VC0321 ? 1 : 3, gspca_dev->usb_buf[0]);
3285	if (sd->bridge == BRIDGE_VC0321) {
3286		ptsensor_info = vc0321_probe_data;
3287		n = ARRAY_SIZE(vc0321_probe_data);
3288	} else {
3289		ptsensor_info = vc0323_probe_data;
3290		n = ARRAY_SIZE(vc0323_probe_data);
3291	}
3292	for (i = 0; i < n; i++) {
3293		reg_w(gspca_dev, 0xa0, 0x02, 0xb334);
3294		reg_w(gspca_dev, 0xa0, ptsensor_info->m1, 0xb300);
3295		reg_w(gspca_dev, 0xa0, ptsensor_info->m2, 0xb300);
3296		reg_w(gspca_dev, 0xa0, 0x01, 0xb308);
3297		reg_w(gspca_dev, 0xa0, 0x0c, 0xb309);
3298		reg_w(gspca_dev, 0xa0, ptsensor_info->I2cAdd, 0xb335);
3299		reg_w(gspca_dev, 0xa0, ptsensor_info->op, 0xb301);
3300		value = read_sensor_register(gspca_dev, ptsensor_info->IdAdd);
3301		if (value == 0 && ptsensor_info->IdAdd == 0x82)
3302			value = read_sensor_register(gspca_dev, 0x83);
3303		if (value != 0) {
3304			PDEBUG(D_ERR|D_PROBE, "Sensor ID %04x (%d)",
3305				value, i);
3306			if (value == ptsensor_info->VpId)
3307				return ptsensor_info->sensorId;
3308
3309			switch (value) {
3310			case 0x3130:
3311				return SENSOR_PO3130NC;
3312			case 0x7673:
3313				return SENSOR_OV7670;
3314			case 0x8243:
3315				return SENSOR_MI0360;
3316			}
3317		}
3318		ptsensor_info++;
3319	}
3320	return -1;
3321}
3322
3323static void i2c_write(struct gspca_dev *gspca_dev,
3324			u8 reg, const u8 *val,
3325			u8 size)		/* 1 or 2 */
3326{
3327	int retry;
3328
3329#ifdef GSPCA_DEBUG
3330	if (gspca_dev->usb_err < 0)
3331		return;
3332	if (size == 1)
3333		PDEBUG(D_USBO, "i2c_w %02x %02x", reg, *val);
3334	else
3335		PDEBUG(D_USBO, "i2c_w %02x %02x%02x", reg, *val, val[1]);
3336#endif
3337	reg_r_i(gspca_dev, 0xa1, 0xb33f, 1);
3338/*fixme:should check if (!(gspca_dev->usb_buf[0] & 0x02)) error*/
3339	reg_w_i(gspca_dev, 0xa0, size, 0xb334);
3340	reg_w_i(gspca_dev, 0xa0, reg, 0xb33a);
3341	reg_w_i(gspca_dev, 0xa0, val[0], 0xb336);
3342	if (size > 1)
3343		reg_w_i(gspca_dev, 0xa0, val[1], 0xb337);
3344	reg_w_i(gspca_dev, 0xa0, 0x01, 0xb339);
3345	retry = 4;
3346	do {
3347		reg_r_i(gspca_dev, 0xa1, 0xb33b, 1);
3348		if (gspca_dev->usb_buf[0] == 0)
3349			break;
3350		msleep(20);
3351	} while (--retry > 0);
3352	if (retry <= 0)
3353		pr_err("i2c_write timeout\n");
3354}
3355
3356static void put_tab_to_reg(struct gspca_dev *gspca_dev,
3357			const u8 *tab, u8 tabsize, u16 addr)
3358{
3359	int j;
3360	u16 ad = addr;
3361
3362	for (j = 0; j < tabsize; j++)
3363		reg_w(gspca_dev, 0xa0, tab[j], ad++);
3364}
3365
3366static void usb_exchange(struct gspca_dev *gspca_dev,
3367			const u8 data[][4])
3368{
3369	int i = 0;
3370
3371	for (;;) {
3372		switch (data[i][3]) {
3373		default:
3374			return;
3375		case 0xcc:			/* normal write */
3376			reg_w(gspca_dev, 0xa0, data[i][2],
3377					(data[i][0]) << 8 | data[i][1]);
3378			break;
3379		case 0xaa:			/* i2c op */
3380			i2c_write(gspca_dev, data[i][1], &data[i][2], 1);
3381			break;
3382		case 0xbb:			/* i2c op */
3383			i2c_write(gspca_dev, data[i][0], &data[i][1], 2);
3384			break;
3385		case 0xdd:
3386			msleep(data[i][1] * 256 + data[i][2] + 10);
3387			break;
3388		}
3389		i++;
3390	}
3391	/*not reached*/
3392}
3393
3394
3395/* this function is called at probe time */
3396static int sd_config(struct gspca_dev *gspca_dev,
3397			const struct usb_device_id *id)
3398{
3399	struct sd *sd = (struct sd *) gspca_dev;
3400
3401	sd->bridge = id->driver_info >> 8;
3402	sd->flags = id->driver_info & 0xff;
3403
3404	if (id->idVendor == 0x046d &&
3405	    (id->idProduct == 0x0892 || id->idProduct == 0x0896))
3406		sd->sensor = SENSOR_POxxxx;	/* no probe */
3407
3408	sd->brightness = BRIGHTNESS_DEF;
3409	sd->contrast = CONTRAST_DEF;
3410	sd->colors = COLOR_DEF;
3411	sd->hflip = HFLIP_DEF;
3412	sd->vflip = VFLIP_DEF;
3413	sd->lightfreq = FREQ_DEF;
3414	sd->sharpness = SHARPNESS_DEF;
3415	sd->gain = GAIN_DEF;
3416	sd->exposure = EXPOSURE_DEF;
3417	sd->autogain = AUTOGAIN_DEF;
3418	sd->backlight = BACKLIGHT_DEF;
3419
3420	return 0;
3421}
3422
3423/* this function is called at probe and resume time */
3424static int sd_init(struct gspca_dev *gspca_dev)
3425{
3426	struct sd *sd = (struct sd *) gspca_dev;
3427	struct cam *cam;
3428	int sensor;
3429	/* number of packets per ISOC message */
3430	static u8 npkt[NSENSORS] = {
3431		[SENSOR_HV7131R] =	64,
3432		[SENSOR_MI0360] =	32,
3433		[SENSOR_MI1310_SOC] =	32,
3434		[SENSOR_MI1320] =	64,
3435		[SENSOR_MI1320_SOC] =	128,
3436		[SENSOR_OV7660] =	32,
3437		[SENSOR_OV7670] =	64,
3438		[SENSOR_PO1200] =	128,
3439		[SENSOR_PO3130NC] =	128,
3440		[SENSOR_POxxxx] =	128,
3441	};
3442
3443	if (sd->sensor != SENSOR_POxxxx)
3444		sensor = vc032x_probe_sensor(gspca_dev);
3445	else
3446		sensor = sd->sensor;
3447
3448	switch (sensor) {
3449	case -1:
3450		pr_err("Unknown sensor...\n");
3451		return -EINVAL;
3452	case SENSOR_HV7131R:
3453		PDEBUG(D_PROBE, "Find Sensor HV7131R");
3454		break;
3455	case SENSOR_MI0360:
3456		PDEBUG(D_PROBE, "Find Sensor MI0360");
3457		sd->bridge = BRIDGE_VC0323;
3458		break;
3459	case SENSOR_MI1310_SOC:
3460		PDEBUG(D_PROBE, "Find Sensor MI1310_SOC");
3461		break;
3462	case SENSOR_MI1320:
3463		PDEBUG(D_PROBE, "Find Sensor MI1320");
3464		break;
3465	case SENSOR_MI1320_SOC:
3466		PDEBUG(D_PROBE, "Find Sensor MI1320_SOC");
3467		break;
3468	case SENSOR_OV7660:
3469		PDEBUG(D_PROBE, "Find Sensor OV7660");
3470		break;
3471	case SENSOR_OV7670:
3472		PDEBUG(D_PROBE, "Find Sensor OV7670");
3473		break;
3474	case SENSOR_PO1200:
3475		PDEBUG(D_PROBE, "Find Sensor PO1200");
3476		break;
3477	case SENSOR_PO3130NC:
3478		PDEBUG(D_PROBE, "Find Sensor PO3130NC");
3479		break;
3480	case SENSOR_POxxxx:
3481		PDEBUG(D_PROBE, "Sensor POxxxx");
3482		break;
3483	}
3484	sd->sensor = sensor;
3485
3486	cam = &gspca_dev->cam;
3487	if (sd->bridge == BRIDGE_VC0321) {
3488		cam->cam_mode = vc0321_mode;
3489		cam->nmodes = ARRAY_SIZE(vc0321_mode);
3490	} else {
3491		switch (sensor) {
3492		case SENSOR_PO1200:
3493			cam->cam_mode = svga_mode;
3494			cam->nmodes = ARRAY_SIZE(svga_mode);
3495			break;
3496		case SENSOR_MI1310_SOC:
3497			cam->cam_mode = vc0323_mode;
3498			cam->nmodes = ARRAY_SIZE(vc0323_mode);
3499			break;
3500		case SENSOR_MI1320_SOC:
3501			cam->cam_mode = bi_mode;
3502			cam->nmodes = ARRAY_SIZE(bi_mode);
3503			break;
3504		case SENSOR_OV7670:
3505			cam->cam_mode = bi_mode;
3506			cam->nmodes = ARRAY_SIZE(bi_mode) - 1;
3507			break;
3508		default:
3509			cam->cam_mode = vc0323_mode;
3510			cam->nmodes = ARRAY_SIZE(vc0323_mode) - 1;
3511			break;
3512		}
3513	}
3514	cam->npkt = npkt[sd->sensor];
3515	gspca_dev->ctrl_dis = ctrl_dis[sd->sensor];
3516
3517	if (sd->sensor == SENSOR_OV7670)
3518		sd->flags |= FL_HFLIP | FL_VFLIP;
3519
3520	if (sd->bridge == BRIDGE_VC0321) {
3521		reg_r(gspca_dev, 0x8a, 0, 3);
3522		reg_w(gspca_dev, 0x87, 0x00, 0x0f0f);
3523		reg_r(gspca_dev, 0x8b, 0, 3);
3524		reg_w(gspca_dev, 0x88, 0x00, 0x0202);
3525		if (sd->sensor == SENSOR_POxxxx) {
3526			reg_r(gspca_dev, 0xa1, 0xb300, 1);
3527			if (gspca_dev->usb_buf[0] != 0) {
3528				reg_w(gspca_dev, 0xa0, 0x26, 0xb300);
3529				reg_w(gspca_dev, 0xa0, 0x04, 0xb300);
3530			}
3531			reg_w(gspca_dev, 0xa0, 0x00, 0xb300);
3532		}
3533	}
3534	return gspca_dev->usb_err;
3535}
3536
3537static void setbrightness(struct gspca_dev *gspca_dev)
3538{
3539	struct sd *sd = (struct sd *) gspca_dev;
3540	u8 data;
3541
3542	if (gspca_dev->ctrl_dis & (1 << BRIGHTNESS_IDX))
3543		return;
3544	data = sd->brightness;
3545	if (data >= 0x80)
3546		data &= 0x7f;
3547	else
3548		data = 0xff ^ data;
3549	i2c_write(gspca_dev, 0x98, &data, 1);
3550}
3551
3552static void setcontrast(struct gspca_dev *gspca_dev)
3553{
3554	struct sd *sd = (struct sd *) gspca_dev;
3555
3556	if (gspca_dev->ctrl_dis & (1 << CONTRAST_IDX))
3557		return;
3558	i2c_write(gspca_dev, 0x99, &sd->contrast, 1);
3559}
3560
3561static void setcolors(struct gspca_dev *gspca_dev)
3562{
3563	struct sd *sd = (struct sd *) gspca_dev;
3564	u8 data;
3565
3566	if (gspca_dev->ctrl_dis & (1 << COLORS_IDX))
3567		return;
3568	data = sd->colors - (sd->colors >> 3) - 1;
3569	i2c_write(gspca_dev, 0x94, &data, 1);
3570	i2c_write(gspca_dev, 0x95, &sd->colors, 1);
3571}
3572
3573static void sethvflip(struct gspca_dev *gspca_dev)
3574{
3575	struct sd *sd = (struct sd *) gspca_dev;
3576	u8 data[2], hflip, vflip;
3577
3578	hflip = sd->hflip;
3579	if (sd->flags & FL_HFLIP)
3580		hflip = !hflip;
3581	vflip = sd->vflip;
3582	if (sd->flags & FL_VFLIP)
3583		vflip = !vflip;
3584	switch (sd->sensor) {
3585	case SENSOR_MI1310_SOC:
3586	case SENSOR_MI1320:
3587	case SENSOR_MI1320_SOC:
3588		data[0] = data[1] = 0;		/* select page 0 */
3589		i2c_write(gspca_dev, 0xf0, data, 2);
3590		data[0] = sd->sensor == SENSOR_MI1310_SOC ? 0x03 : 0x01;
3591		data[1] = 0x02 * hflip
3592			| 0x01 * vflip;
3593		i2c_write(gspca_dev, 0x20, data, 2);
3594		break;
3595	case SENSOR_OV7660:
3596	case SENSOR_OV7670:
3597		data[0] = sd->sensor == SENSOR_OV7660 ? 0x01 : 0x07;
3598		data[0] |= OV7660_MVFP_MIRROR * hflip
3599			| OV7660_MVFP_VFLIP * vflip;
3600		i2c_write(gspca_dev, OV7660_REG_MVFP, data, 1);
3601		break;
3602	case SENSOR_PO1200:
3603		data[0] = 0;
3604		i2c_write(gspca_dev, 0x03, data, 1);
3605		data[0] = 0x80 * hflip
3606			| 0x40 * vflip
3607			| 0x06;
3608		i2c_write(gspca_dev, 0x1e, data, 1);
3609		break;
3610	}
3611}
3612
3613static void setlightfreq(struct gspca_dev *gspca_dev)
3614{
3615	struct sd *sd = (struct sd *) gspca_dev;
3616	static const u8 (*ov7660_freq_tb[3])[4] =
3617		{ov7660_NoFliker, ov7660_50HZ, ov7660_60HZ};
3618
3619	if (sd->sensor != SENSOR_OV7660)
3620		return;
3621	usb_exchange(gspca_dev, ov7660_freq_tb[sd->lightfreq]);
3622}
3623
3624static void setsharpness(struct gspca_dev *gspca_dev)
3625{
3626	struct sd *sd = (struct sd *) gspca_dev;
3627	u8 data;
3628
3629	switch (sd->sensor) {
3630	case SENSOR_PO1200:
3631		data = 0;
3632		i2c_write(gspca_dev, 0x03, &data, 1);
3633		if (sd->sharpness < 0)
3634			data = 0x6a;
3635		else
3636			data = 0xb5 + sd->sharpness * 3;
3637		i2c_write(gspca_dev, 0x61, &data, 1);
3638		break;
3639	case SENSOR_POxxxx:
3640		if (sd->sharpness < 0)
3641			data = 0x7e;	/* def = max */
3642		else
3643			data = 0x60 + sd->sharpness * 0x0f;
3644		i2c_write(gspca_dev, 0x59, &data, 1);
3645		break;
3646	}
3647}
3648static void setgain(struct gspca_dev *gspca_dev)
3649{
3650	struct sd *sd = (struct sd *) gspca_dev;
3651
3652	if (gspca_dev->ctrl_dis & (1 << GAIN_IDX))
3653		return;
3654	i2c_write(gspca_dev, 0x15, &sd->gain, 1);
3655}
3656
3657static void setexposure(struct gspca_dev *gspca_dev)
3658{
3659	struct sd *sd = (struct sd *) gspca_dev;
3660	u8 data;
3661
3662	if (gspca_dev->ctrl_dis & (1 << EXPOSURE_IDX))
3663		return;
3664	data = sd->exposure >> 8;
3665	i2c_write(gspca_dev, 0x1a, &data, 1);
3666	data = sd->exposure;
3667	i2c_write(gspca_dev, 0x1b, &data, 1);
3668}
3669
3670static void setautogain(struct gspca_dev *gspca_dev)
3671{
3672	struct sd *sd = (struct sd *) gspca_dev;
3673	static const u8 data[2] = {0x28, 0x3c};
3674
3675	if (gspca_dev->ctrl_dis & (1 << AUTOGAIN_IDX))
3676		return;
3677	i2c_write(gspca_dev, 0xd1, &data[sd->autogain], 1);
3678}
3679
3680static void setgamma(struct gspca_dev *gspca_dev)
3681{
3682/*fixme:to do */
3683	usb_exchange(gspca_dev, poxxxx_gamma);
3684}
3685
3686static void setbacklight(struct gspca_dev *gspca_dev)
3687{
3688	struct sd *sd = (struct sd *) gspca_dev;
3689	u16 v;
3690	u8 data;
3691
3692	data = (sd->backlight << 4) | 0x0f;
3693	i2c_write(gspca_dev, 0xaa, &data, 1);
3694	v = 613 + 12 * sd->backlight;
3695	data = v >> 8;
3696	i2c_write(gspca_dev, 0xc4, &data, 1);
3697	data = v;
3698	i2c_write(gspca_dev, 0xc5, &data, 1);
3699	v = 1093 - 12 * sd->backlight;
3700	data = v >> 8;
3701	i2c_write(gspca_dev, 0xc6, &data, 1);
3702	data = v;
3703	i2c_write(gspca_dev, 0xc7, &data, 1);
3704	v = 342 + 9 * sd->backlight;
3705	data = v >> 8;
3706	i2c_write(gspca_dev, 0xc8, &data, 1);
3707	data = v;
3708	i2c_write(gspca_dev, 0xc9, &data, 1);
3709	v = 702 - 9 * sd->backlight;
3710	data = v >> 8;
3711	i2c_write(gspca_dev, 0xca, &data, 1);
3712	data = v;
3713	i2c_write(gspca_dev, 0xcb, &data, 1);
3714}
3715
3716static void setwb(struct gspca_dev *gspca_dev)
3717{
3718/*fixme:to do - valid when reg d1 = 0x1c - (reg16 + reg15 = 0xa3)*/
3719	static const u8 data[2] = {0x00, 0x00};
3720
3721	i2c_write(gspca_dev, 0x16, &data[0], 1);
3722	i2c_write(gspca_dev, 0x18, &data[1], 1);
3723}
3724
3725static int sd_start(struct gspca_dev *gspca_dev)
3726{
3727	struct sd *sd = (struct sd *) gspca_dev;
3728	const u8 (*init)[4];
3729	const u8 *GammaT = NULL;
3730	const u8 *MatrixT = NULL;
3731	int mode;
3732	static const u8 (*mi1320_soc_init[])[4] = {
3733		mi1320_soc_InitSXGA,
3734		mi1320_soc_InitVGA,
3735		mi1320_soc_InitQVGA,
3736	};
3737
3738/*fixme: back sensor only*/
3739	if (sd->flags & FL_SAMSUNG) {
3740		reg_w(gspca_dev, 0x89, 0xf0ff, 0xffff);
3741		reg_w(gspca_dev, 0xa9, 0x8348, 0x000e);
3742		reg_w(gspca_dev, 0xa9, 0x0000, 0x001a);
3743	}
3744
3745	/* Assume start use the good resolution from gspca_dev->mode */
3746	if (sd->bridge == BRIDGE_VC0321) {
3747		reg_w(gspca_dev, 0xa0, 0xff, 0xbfec);
3748		reg_w(gspca_dev, 0xa0, 0xff, 0xbfed);
3749		reg_w(gspca_dev, 0xa0, 0xff, 0xbfee);
3750		reg_w(gspca_dev, 0xa0, 0xff, 0xbfef);
3751		sd->image_offset = 46;
3752	} else {
3753		if (gspca_dev->cam.cam_mode[gspca_dev->curr_mode].pixelformat
3754				== V4L2_PIX_FMT_JPEG)
3755			sd->image_offset = 0;
3756		else
3757			sd->image_offset = 32;
3758	}
3759
3760	mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
3761	switch (sd->sensor) {
3762	case SENSOR_HV7131R:
3763		GammaT = hv7131r_gamma;
3764		MatrixT = hv7131r_matrix;
3765		if (mode)
3766			init = hv7131r_initQVGA_data;	/* 320x240 */
3767		else
3768			init = hv7131r_initVGA_data;	/* 640x480 */
3769		break;
3770	case SENSOR_OV7660:
3771		GammaT = ov7660_gamma;
3772		MatrixT = ov7660_matrix;
3773		if (mode)
3774			init = ov7660_initQVGA_data;	/* 320x240 */
3775		else
3776			init = ov7660_initVGA_data;	/* 640x480 */
3777		break;
3778	case SENSOR_MI0360:
3779		GammaT = mi1320_gamma;
3780		MatrixT = mi0360_matrix;
3781		if (mode)
3782			init = mi0360_initQVGA_JPG;	/* 320x240 */
3783		else
3784			init = mi0360_initVGA_JPG;	/* 640x480 */
3785		break;
3786	case SENSOR_MI1310_SOC:
3787		GammaT = mi1320_gamma;
3788		MatrixT = mi1320_matrix;
3789		switch (mode) {
3790		case 1:
3791			init = mi1310_socinitQVGA_JPG;	/* 320x240 */
3792			break;
3793		case 0:
3794			init = mi1310_socinitVGA_JPG;	/* 640x480 */
3795			break;
3796		default:
3797			init = mi1310_soc_InitSXGA_JPG;	/* 1280x1024 */
3798			break;
3799		}
3800		break;
3801	case SENSOR_MI1320:
3802		GammaT = mi1320_gamma;
3803		MatrixT = mi1320_matrix;
3804		if (mode)
3805			init = mi1320_initQVGA_data;	/* 320x240 */
3806		else
3807			init = mi1320_initVGA_data;	/* 640x480 */
3808		break;
3809	case SENSOR_MI1320_SOC:
3810		GammaT = mi1320_gamma;
3811		MatrixT = mi1320_matrix;
3812		init = mi1320_soc_init[mode];
3813		break;
3814	case SENSOR_OV7670:
3815		init = mode == 1 ? ov7670_InitVGA : ov7670_InitQVGA;
3816		break;
3817	case SENSOR_PO3130NC:
3818		GammaT = po3130_gamma;
3819		MatrixT = po3130_matrix;
3820		if (mode)
3821			init = po3130_initQVGA_data;	/* 320x240 */
3822		else
3823			init = po3130_initVGA_data;	/* 640x480 */
3824		usb_exchange(gspca_dev, init);
3825		init = po3130_rundata;
3826		break;
3827	case SENSOR_PO1200:
3828		GammaT = po1200_gamma;
3829		MatrixT = po1200_matrix;
3830		init = po1200_initVGA_data;
3831		break;
3832	default:
3833/*	case SENSOR_POxxxx: */
3834		usb_exchange(gspca_dev, poxxxx_init_common);
3835		setgamma(gspca_dev);
3836		setbacklight(gspca_dev);
3837		setbrightness(gspca_dev);
3838		setcontrast(gspca_dev);
3839		setcolors(gspca_dev);
3840		setsharpness(gspca_dev);
3841		setautogain(gspca_dev);
3842		setexposure(gspca_dev);
3843		setgain(gspca_dev);
3844		usb_exchange(gspca_dev, poxxxx_init_start_3);
3845		if (mode)
3846			init = poxxxx_initQVGA;
3847		else
3848			init = poxxxx_initVGA;
3849		usb_exchange(gspca_dev, init);
3850		reg_r(gspca_dev, 0x8c, 0x0000, 3);
3851		reg_w(gspca_dev, 0xa0,
3852				gspca_dev->usb_buf[2] & 1 ? 0 : 1,
3853				0xb35c);
3854		msleep(300);
3855/*fixme: i2c read 04 and 05*/
3856		init = poxxxx_init_end_1;
3857		break;
3858	}
3859	usb_exchange(gspca_dev, init);
3860	if (GammaT && MatrixT) {
3861		put_tab_to_reg(gspca_dev, GammaT, 17, 0xb84a);
3862		put_tab_to_reg(gspca_dev, GammaT, 17, 0xb85b);
3863		put_tab_to_reg(gspca_dev, GammaT, 17, 0xb86c);
3864		put_tab_to_reg(gspca_dev, MatrixT, 9, 0xb82c);
3865
3866		switch (sd->sensor) {
3867		case SENSOR_PO1200:
3868		case SENSOR_HV7131R:
3869			reg_w(gspca_dev, 0x89, 0x0400, 0x1415);
3870			break;
3871		case SENSOR_MI1310_SOC:
3872			reg_w(gspca_dev, 0x89, 0x058c, 0x0000);
3873			break;
3874		}
3875		msleep(100);
3876		sethvflip(gspca_dev);
3877		setlightfreq(gspca_dev);
3878	}
3879	switch (sd->sensor) {
3880	case SENSOR_OV7670:
3881		reg_w(gspca_dev, 0x87, 0xffff, 0xffff);
3882		reg_w(gspca_dev, 0x88, 0xff00, 0xf0f1);
3883		reg_w(gspca_dev, 0xa0, 0x0000, 0xbfff);
3884		break;
3885	case SENSOR_POxxxx:
3886		usb_exchange(gspca_dev, poxxxx_init_end_2);
3887		setwb(gspca_dev);
3888		msleep(80);		/* led on */
3889		reg_w(gspca_dev, 0x89, 0xffff, 0xfdff);
3890		break;
3891	}
3892	return gspca_dev->usb_err;
3893}
3894
3895static void sd_stopN(struct gspca_dev *gspca_dev)
3896{
3897	struct sd *sd = (struct sd *) gspca_dev;
3898
3899	switch (sd->sensor) {
3900	case SENSOR_MI1310_SOC:
3901		reg_w(gspca_dev, 0x89, 0x058c, 0x00ff);
3902		break;
3903	case SENSOR_POxxxx:
3904		return;
3905	default:
3906		if (!(sd->flags & FL_SAMSUNG))
3907			reg_w(gspca_dev, 0x89, 0xffff, 0xffff);
3908		break;
3909	}
3910	reg_w(gspca_dev, 0xa0, 0x01, 0xb301);
3911	reg_w(gspca_dev, 0xa0, 0x09, 0xb003);
3912}
3913
3914/* called on streamoff with alt 0 and on disconnect */
3915static void sd_stop0(struct gspca_dev *gspca_dev)
3916{
3917	struct sd *sd = (struct sd *) gspca_dev;
3918
3919	if (!gspca_dev->present)
3920		return;
3921/*fixme: is this useful?*/
3922	if (sd->sensor == SENSOR_MI1310_SOC)
3923		reg_w(gspca_dev, 0x89, 0x058c, 0x00ff);
3924	else if (!(sd->flags & FL_SAMSUNG))
3925		reg_w(gspca_dev, 0x89, 0xffff, 0xffff);
3926
3927	if (sd->sensor == SENSOR_POxxxx) {
3928		reg_w(gspca_dev, 0xa0, 0x26, 0xb300);
3929		reg_w(gspca_dev, 0xa0, 0x04, 0xb300);
3930		reg_w(gspca_dev, 0xa0, 0x00, 0xb300);
3931	}
3932}
3933
3934static void sd_pkt_scan(struct gspca_dev *gspca_dev,
3935			u8 *data,			/* isoc packet */
3936			int len)			/* iso pkt length */
3937{
3938	struct sd *sd = (struct sd *) gspca_dev;
3939
3940	if (data[0] == 0xff && data[1] == 0xd8) {
3941		PDEBUG(D_PACK,
3942			"vc032x header packet found len %d", len);
3943		gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);
3944		data += sd->image_offset;
3945		len -= sd->image_offset;
3946		gspca_frame_add(gspca_dev, FIRST_PACKET, data, len);
3947		return;
3948	}
3949
3950	/* The vc0321 sends some additional data after sending the complete
3951	 * frame, we ignore this. */
3952	if (sd->bridge == BRIDGE_VC0321) {
3953		int size, l;
3954
3955		l = gspca_dev->image_len;
3956		size = gspca_dev->frsz;
3957		if (len > size - l)
3958			len = size - l;
3959	}
3960	gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
3961}
3962
3963static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
3964{
3965	struct sd *sd = (struct sd *) gspca_dev;
3966
3967	sd->brightness = val;
3968	if (gspca_dev->streaming)
3969		setbrightness(gspca_dev);
3970	return gspca_dev->usb_err;
3971}
3972
3973static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val)
3974{
3975	struct sd *sd = (struct sd *) gspca_dev;
3976
3977	*val = sd->brightness;
3978	return 0;
3979}
3980
3981static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val)
3982{
3983	struct sd *sd = (struct sd *) gspca_dev;
3984
3985	sd->contrast = val;
3986	if (gspca_dev->streaming)
3987		setcontrast(gspca_dev);
3988	return gspca_dev->usb_err;
3989}
3990
3991static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val)
3992{
3993	struct sd *sd = (struct sd *) gspca_dev;
3994
3995	*val = sd->contrast;
3996	return 0;
3997}
3998
3999static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val)
4000{
4001	struct sd *sd = (struct sd *) gspca_dev;
4002
4003	sd->colors = val;
4004	if (gspca_dev->streaming)
4005		setcolors(gspca_dev);
4006	return gspca_dev->usb_err;
4007}
4008
4009static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val)
4010{
4011	struct sd *sd = (struct sd *) gspca_dev;
4012
4013	*val = sd->colors;
4014	return 0;
4015}
4016
4017static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val)
4018{
4019	struct sd *sd = (struct sd *) gspca_dev;
4020
4021	sd->hflip = val;
4022	if (gspca_dev->streaming)
4023		sethvflip(gspca_dev);
4024	return gspca_dev->usb_err;
4025}
4026
4027static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val)
4028{
4029	struct sd *sd = (struct sd *) gspca_dev;
4030
4031	*val = sd->hflip;
4032	return 0;
4033}
4034
4035static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val)
4036{
4037	struct sd *sd = (struct sd *) gspca_dev;
4038
4039	sd->vflip = val;
4040	if (gspca_dev->streaming)
4041		sethvflip(gspca_dev);
4042	return gspca_dev->usb_err;
4043}
4044
4045static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val)
4046{
4047	struct sd *sd = (struct sd *) gspca_dev;
4048
4049	*val = sd->vflip;
4050	return 0;
4051}
4052
4053static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val)
4054{
4055	struct sd *sd = (struct sd *) gspca_dev;
4056
4057	sd->lightfreq = val;
4058	if (gspca_dev->streaming)
4059		setlightfreq(gspca_dev);
4060	return gspca_dev->usb_err;
4061}
4062
4063static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val)
4064{
4065	struct sd *sd = (struct sd *) gspca_dev;
4066
4067	*val = sd->lightfreq;
4068	return 0;
4069}
4070
4071static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val)
4072{
4073	struct sd *sd = (struct sd *) gspca_dev;
4074
4075	sd->sharpness = val;
4076	if (gspca_dev->streaming)
4077		setsharpness(gspca_dev);
4078	return gspca_dev->usb_err;
4079}
4080
4081static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val)
4082{
4083	struct sd *sd = (struct sd *) gspca_dev;
4084
4085	*val = sd->sharpness;
4086	return 0;
4087}
4088
4089static int sd_setgain(struct gspca_dev *gspca_dev, __s32 val)
4090{
4091	struct sd *sd = (struct sd *) gspca_dev;
4092
4093	sd->gain = val;
4094	if (gspca_dev->streaming)
4095		setgain(gspca_dev);
4096	return gspca_dev->usb_err;
4097}
4098
4099static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val)
4100{
4101	struct sd *sd = (struct sd *) gspca_dev;
4102
4103	*val = sd->gain;
4104	return 0;
4105}
4106
4107static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val)
4108{
4109	struct sd *sd = (struct sd *) gspca_dev;
4110
4111	sd->exposure = val;
4112	if (gspca_dev->streaming)
4113		setexposure(gspca_dev);
4114	return gspca_dev->usb_err;
4115}
4116
4117static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val)
4118{
4119	struct sd *sd = (struct sd *) gspca_dev;
4120
4121	*val = sd->exposure;
4122	return 0;
4123}
4124
4125static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val)
4126{
4127	struct sd *sd = (struct sd *) gspca_dev;
4128
4129	sd->autogain = val;
4130	if (gspca_dev->streaming)
4131		setautogain(gspca_dev);
4132
4133	return gspca_dev->usb_err;
4134}
4135
4136static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val)
4137{
4138	struct sd *sd = (struct sd *) gspca_dev;
4139
4140	*val = sd->autogain;
4141	return 0;
4142}
4143
4144static int sd_setbacklight(struct gspca_dev *gspca_dev, __s32 val)
4145{
4146	struct sd *sd = (struct sd *) gspca_dev;
4147
4148	sd->backlight = val;
4149	if (gspca_dev->streaming)
4150		setbacklight(gspca_dev);
4151
4152	return gspca_dev->usb_err;
4153}
4154
4155static int sd_getbacklight(struct gspca_dev *gspca_dev, __s32 *val)
4156{
4157	struct sd *sd = (struct sd *) gspca_dev;
4158
4159	*val = sd->backlight;
4160	return 0;
4161}
4162
4163static int sd_querymenu(struct gspca_dev *gspca_dev,
4164			struct v4l2_querymenu *menu)
4165{
4166	static const char *freq_nm[3] = {"NoFliker", "50 Hz", "60 Hz"};
4167
4168	switch (menu->id) {
4169	case V4L2_CID_POWER_LINE_FREQUENCY:
4170		if (menu->index >= ARRAY_SIZE(freq_nm))
4171			break;
4172		strcpy((char *) menu->name, freq_nm[menu->index]);
4173		return 0;
4174	}
4175	return -EINVAL;
4176}
4177
4178/* sub-driver description */
4179static const struct sd_desc sd_desc = {
4180	.name = MODULE_NAME,
4181	.ctrls = sd_ctrls,
4182	.nctrls = ARRAY_SIZE(sd_ctrls),
4183	.config = sd_config,
4184	.init = sd_init,
4185	.start = sd_start,
4186	.stopN = sd_stopN,
4187	.stop0 = sd_stop0,
4188	.pkt_scan = sd_pkt_scan,
4189	.querymenu = sd_querymenu,
4190};
4191
4192/* -- module initialisation -- */
4193#define BF(bridge, flags) \
4194	.driver_info = (BRIDGE_ ## bridge << 8) \
4195		| (flags)
4196static const struct usb_device_id device_table[] = {
4197	{USB_DEVICE(0x041e, 0x405b), BF(VC0323, FL_VFLIP)},
4198	{USB_DEVICE(0x046d, 0x0892), BF(VC0321, 0)},
4199	{USB_DEVICE(0x046d, 0x0896), BF(VC0321, 0)},
4200	{USB_DEVICE(0x046d, 0x0897), BF(VC0321, 0)},
4201	{USB_DEVICE(0x0ac8, 0x0321), BF(VC0321, 0)},
4202	{USB_DEVICE(0x0ac8, 0x0323), BF(VC0323, 0)},
4203	{USB_DEVICE(0x0ac8, 0x0328), BF(VC0321, 0)},
4204	{USB_DEVICE(0x0ac8, 0xc001), BF(VC0321, 0)},
4205	{USB_DEVICE(0x0ac8, 0xc002), BF(VC0321, 0)},
4206	{USB_DEVICE(0x0ac8, 0xc301), BF(VC0323, FL_SAMSUNG)},
4207	{USB_DEVICE(0x15b8, 0x6001), BF(VC0323, 0)},
4208	{USB_DEVICE(0x15b8, 0x6002), BF(VC0323, 0)},
4209	{USB_DEVICE(0x17ef, 0x4802), BF(VC0323, 0)},
4210	{}
4211};
4212MODULE_DEVICE_TABLE(usb, device_table);
4213
4214/* -- device connect -- */
4215static int sd_probe(struct usb_interface *intf,
4216			const struct usb_device_id *id)
4217{
4218	return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
4219				THIS_MODULE);
4220}
4221
4222static struct usb_driver sd_driver = {
4223	.name = MODULE_NAME,
4224	.id_table = device_table,
4225	.probe = sd_probe,
4226	.disconnect = gspca_disconnect,
4227#ifdef CONFIG_PM
4228	.suspend = gspca_suspend,
4229	.resume = gspca_resume,
4230#endif
4231};
4232
4233module_usb_driver(sd_driver);
4234