blob: c00ac57de5106e605c41fcc4590b73c083557fef [file] [log] [blame]
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001/*
Jean-François Moine27c6f9e2010-04-02 06:59:13 -03002 * Z-star vc0321 library
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003 *
Jean-François Moine27c6f9e2010-04-02 06:59:13 -03004 * 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
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03007 *
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
Joe Perches133a9fe2011-08-21 19:56:57 -030023#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
24
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030025#define MODULE_NAME "vc032x"
26
27#include "gspca.h"
28
Jean-François Moine27c6f9e2010-04-02 06:59:13 -030029MODULE_AUTHOR("Jean-François Moine <http://moinejf.free.fr>");
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030030MODULE_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 */
Hans Verkuil930806c2012-05-18 06:45:30 -030036 struct { /* hvflip cluster */
37 struct v4l2_ctrl *hflip;
38 struct v4l2_ctrl *vflip;
39 };
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030040
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -030041 u8 image_offset;
42
Jean-Francois Moine8b605f12009-07-27 06:28:37 -030043 u8 bridge;
Jean-Francois Moine49cb6b02009-04-25 13:29:01 -030044 u8 sensor;
Jean-Francois Moinee27188e2009-07-27 06:00:03 -030045 u8 flags;
46#define FL_SAMSUNG 0x01 /* SamsungQ1 (2 sensors) */
47#define FL_HFLIP 0x02 /* mirrored by default */
48#define FL_VFLIP 0x04 /* vertical flipped by default */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030049};
Jean-François Moine7e5f9052010-12-28 07:24:18 -030050enum bridges {
51 BRIDGE_VC0321,
52 BRIDGE_VC0323,
53};
54enum sensors {
55 SENSOR_HV7131R,
56 SENSOR_MI0360,
57 SENSOR_MI1310_SOC,
58 SENSOR_MI1320,
59 SENSOR_MI1320_SOC,
60 SENSOR_OV7660,
61 SENSOR_OV7670,
62 SENSOR_PO1200,
63 SENSOR_PO3130NC,
64 SENSOR_POxxxx,
65 NSENSORS
66};
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030067
Jean-Francois Moine83c94a12009-12-26 16:07:24 -030068
Jean-Francois Moinecc611b82008-12-29 07:49:41 -030069static const struct v4l2_pix_format vc0321_mode[] = {
Jean-Francois Moine20122542008-09-03 17:12:20 -030070 {320, 240, V4L2_PIX_FMT_YVYU, V4L2_FIELD_NONE,
Jean-Francois Moine00b27ce2008-07-30 05:47:54 -030071 .bytesperline = 320,
Jean-Francois Moinec2446b32008-07-05 11:49:20 -030072 .sizeimage = 320 * 240 * 2,
73 .colorspace = V4L2_COLORSPACE_SRGB,
74 .priv = 1},
Jean-Francois Moine20122542008-09-03 17:12:20 -030075 {640, 480, V4L2_PIX_FMT_YVYU, V4L2_FIELD_NONE,
Jean-Francois Moine00b27ce2008-07-30 05:47:54 -030076 .bytesperline = 640,
Jean-Francois Moinec2446b32008-07-05 11:49:20 -030077 .sizeimage = 640 * 480 * 2,
78 .colorspace = V4L2_COLORSPACE_SRGB,
79 .priv = 0},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030080};
Jean-Francois Moinecc611b82008-12-29 07:49:41 -030081static const struct v4l2_pix_format vc0323_mode[] = {
Jean-Francois Moinec2446b32008-07-05 11:49:20 -030082 {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
83 .bytesperline = 320,
84 .sizeimage = 320 * 240 * 3 / 8 + 590,
85 .colorspace = V4L2_COLORSPACE_JPEG,
86 .priv = 1},
87 {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
88 .bytesperline = 640,
89 .sizeimage = 640 * 480 * 3 / 8 + 590,
90 .colorspace = V4L2_COLORSPACE_JPEG,
91 .priv = 0},
Jean-Francois Moine111815e2009-07-27 05:52:27 -030092 {1280, 960, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, /* mi1310_soc only */
Jean-Francois Moine6af4e7a2009-01-29 16:34:25 -030093 .bytesperline = 1280,
Jean-Francois Moine111815e2009-07-27 05:52:27 -030094 .sizeimage = 1280 * 960 * 3 / 8 + 590,
Jean-Francois Moine6af4e7a2009-01-29 16:34:25 -030095 .colorspace = V4L2_COLORSPACE_JPEG,
96 .priv = 2},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030097};
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -030098static const struct v4l2_pix_format bi_mode[] = {
Jean-Francois Moine2c956102009-05-05 04:59:45 -030099 {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -0300100 .bytesperline = 320,
101 .sizeimage = 320 * 240 * 2,
102 .colorspace = V4L2_COLORSPACE_SRGB,
Jean-Francois Moine51412aa2009-03-26 06:03:28 -0300103 .priv = 2},
Jean-Francois Moine2c956102009-05-05 04:59:45 -0300104 {640, 480, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -0300105 .bytesperline = 640,
106 .sizeimage = 640 * 480 * 2,
107 .colorspace = V4L2_COLORSPACE_SRGB,
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -0300108 .priv = 1},
Jean-Francois Moine2c956102009-05-05 04:59:45 -0300109 {1280, 1024, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -0300110 .bytesperline = 1280,
111 .sizeimage = 1280 * 1024 * 2,
112 .colorspace = V4L2_COLORSPACE_SRGB,
113 .priv = 0},
114};
Jean-Francois Moinecc611b82008-12-29 07:49:41 -0300115static const struct v4l2_pix_format svga_mode[] = {
Jean-Francois Moine88521532008-12-10 05:06:13 -0300116 {800, 600, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
117 .bytesperline = 800,
118 .sizeimage = 800 * 600 * 1 / 4 + 590,
119 .colorspace = V4L2_COLORSPACE_JPEG,
120 .priv = 0},
121};
122
Jean-Francois Moine7dc7ad32008-12-08 05:13:53 -0300123/* OV7660/7670 registers */
124#define OV7660_REG_MVFP 0x1e
125#define OV7660_MVFP_MIRROR 0x20
126#define OV7660_MVFP_VFLIP 0x10
127
Jean-Francois Moine8b605f12009-07-27 06:28:37 -0300128static const u8 mi0360_matrix[9] = {
Jean-Francois Moinecbb05542008-11-26 16:17:13 -0300129 0x50, 0xf8, 0xf8, 0xf5, 0x50, 0xfb, 0xff, 0xf1, 0x50
130};
131
Jean-Francois Moine8b605f12009-07-27 06:28:37 -0300132static const u8 mi0360_initVGA_JPG[][4] = {
Jean-Francois Moinecbb05542008-11-26 16:17:13 -0300133 {0xb0, 0x03, 0x19, 0xcc},
134 {0xb0, 0x04, 0x02, 0xcc},
135 {0xb3, 0x00, 0x24, 0xcc},
136 {0xb3, 0x00, 0x25, 0xcc},
137 {0xb3, 0x08, 0x01, 0xcc},
138 {0xb3, 0x09, 0x0c, 0xcc},
139 {0xb3, 0x05, 0x01, 0xcc},
140 {0xb3, 0x06, 0x03, 0xcc},
141 {0xb3, 0x03, 0x0a, 0xcc},
142 {0xb3, 0x20, 0x00, 0xcc},
143 {0xb3, 0x21, 0x00, 0xcc},
144 {0xb3, 0x22, 0x01, 0xcc},
145 {0xb3, 0x23, 0xe0, 0xcc},
146 {0xb3, 0x04, 0x05, 0xcc},
147 {0xb3, 0x14, 0x00, 0xcc},
148 {0xb3, 0x15, 0x00, 0xcc},
149 {0xb3, 0x16, 0x02, 0xcc},
150 {0xb3, 0x17, 0x7f, 0xcc},
Jean-Francois Moineff1cf402009-12-26 15:18:02 -0300151 {0xb3, 0x35, 0xdd, 0xcc}, /* i2c add: 5d */
Jean-Francois Moinecbb05542008-11-26 16:17:13 -0300152 {0xb3, 0x34, 0x02, 0xcc},
153 {0xb3, 0x00, 0x25, 0xcc},
154 {0xbc, 0x00, 0x71, 0xcc},
155 {0xb8, 0x00, 0x13, 0xcc},
156 {0xb8, 0x27, 0x20, 0xcc},
157 {0xb8, 0x2c, 0x50, 0xcc},
158 {0xb8, 0x2d, 0xf8, 0xcc},
159 {0xb8, 0x2e, 0xf8, 0xcc},
160 {0xb8, 0x2f, 0xf8, 0xcc},
161 {0xb8, 0x30, 0x50, 0xcc},
162 {0xb8, 0x31, 0xf8, 0xcc},
163 {0xb8, 0x32, 0xf8, 0xcc},
164 {0xb8, 0x33, 0xf8, 0xcc},
165 {0xb8, 0x34, 0x50, 0xcc},
166 {0xb8, 0x35, 0x00, 0xcc},
167 {0xb8, 0x36, 0x00, 0xcc},
168 {0xb8, 0x37, 0x00, 0xcc},
169 {0xb8, 0x01, 0x79, 0xcc},
170 {0xb8, 0x08, 0xe0, 0xcc},
171 {0xb3, 0x01, 0x41, 0xcc},
172 {0xb8, 0x01, 0x79, 0xcc},
173 {0xb8, 0x14, 0x18, 0xcc},
174 {0xb8, 0xb2, 0x0a, 0xcc},
175 {0xb8, 0xb4, 0x0a, 0xcc},
176 {0xb8, 0xb5, 0x0a, 0xcc},
177 {0xb8, 0xfe, 0x00, 0xcc},
178 {0xb8, 0xff, 0x28, 0xcc},
179 {0xb9, 0x00, 0x28, 0xcc},
180 {0xb9, 0x01, 0x28, 0xcc},
181 {0xb9, 0x02, 0x28, 0xcc},
182 {0xb9, 0x03, 0x00, 0xcc},
183 {0xb9, 0x04, 0x00, 0xcc},
184 {0xb9, 0x05, 0x3c, 0xcc},
185 {0xb9, 0x06, 0x3c, 0xcc},
186 {0xb9, 0x07, 0x3c, 0xcc},
187 {0xb9, 0x08, 0x3c, 0xcc},
188 {0xb8, 0x8e, 0x00, 0xcc},
189 {0xb8, 0x8f, 0xff, 0xcc},
190 {0xb8, 0x81, 0x09, 0xcc},
191 {0x31, 0x00, 0x00, 0xbb},
192 {0x09, 0x01, 0xc7, 0xbb},
193 {0x34, 0x01, 0x00, 0xbb},
194 {0x2b, 0x00, 0x28, 0xbb},
195 {0x2c, 0x00, 0x30, 0xbb},
196 {0x2d, 0x00, 0x30, 0xbb},
197 {0x2e, 0x00, 0x28, 0xbb},
198 {0x62, 0x04, 0x11, 0xbb},
199 {0x03, 0x01, 0xe0, 0xbb},
200 {0x2c, 0x00, 0x2c, 0xbb},
201 {0x20, 0xd0, 0x00, 0xbb},
202 {0x01, 0x00, 0x08, 0xbb},
203 {0x06, 0x00, 0x10, 0xbb},
204 {0x05, 0x00, 0x20, 0xbb},
205 {0x20, 0x00, 0x00, 0xbb},
206 {0xb6, 0x00, 0x00, 0xcc},
207 {0xb6, 0x03, 0x02, 0xcc},
208 {0xb6, 0x02, 0x80, 0xcc},
209 {0xb6, 0x05, 0x01, 0xcc},
210 {0xb6, 0x04, 0xe0, 0xcc},
211 {0xb6, 0x12, 0x78, 0xcc},
212 {0xb6, 0x18, 0x02, 0xcc},
213 {0xb6, 0x17, 0x58, 0xcc},
214 {0xb6, 0x16, 0x00, 0xcc},
215 {0xb6, 0x22, 0x12, 0xcc},
216 {0xb6, 0x23, 0x0b, 0xcc},
217 {0xb3, 0x02, 0x02, 0xcc},
218 {0xbf, 0xc0, 0x39, 0xcc},
219 {0xbf, 0xc1, 0x04, 0xcc},
220 {0xbf, 0xcc, 0x10, 0xcc},
221 {0xb9, 0x12, 0x00, 0xcc},
222 {0xb9, 0x13, 0x0a, 0xcc},
223 {0xb9, 0x14, 0x0a, 0xcc},
224 {0xb9, 0x15, 0x0a, 0xcc},
225 {0xb9, 0x16, 0x0a, 0xcc},
226 {0xb9, 0x18, 0x00, 0xcc},
227 {0xb9, 0x19, 0x0f, 0xcc},
228 {0xb9, 0x1a, 0x0f, 0xcc},
229 {0xb9, 0x1b, 0x0f, 0xcc},
230 {0xb9, 0x1c, 0x0f, 0xcc},
231 {0xb8, 0x8e, 0x00, 0xcc},
232 {0xb8, 0x8f, 0xff, 0xcc},
233 {0xb6, 0x12, 0xf8, 0xcc},
234 {0xb8, 0x0c, 0x20, 0xcc},
235 {0xb8, 0x0d, 0x70, 0xcc},
236 {0xb6, 0x13, 0x13, 0xcc},
237 {0x35, 0x00, 0x60, 0xbb},
238 {0xb3, 0x5c, 0x01, 0xcc},
239 {}
240};
Jean-Francois Moine8b605f12009-07-27 06:28:37 -0300241static const u8 mi0360_initQVGA_JPG[][4] = {
Jean-Francois Moinecbb05542008-11-26 16:17:13 -0300242 {0xb0, 0x03, 0x19, 0xcc},
243 {0xb0, 0x04, 0x02, 0xcc},
244 {0xb3, 0x00, 0x24, 0xcc},
245 {0xb3, 0x00, 0x25, 0xcc},
246 {0xb3, 0x08, 0x01, 0xcc},
247 {0xb3, 0x09, 0x0c, 0xcc},
248 {0xb3, 0x05, 0x01, 0xcc},
249 {0xb3, 0x06, 0x03, 0xcc},
250 {0xb3, 0x03, 0x0a, 0xcc},
251 {0xb3, 0x20, 0x00, 0xcc},
252 {0xb3, 0x21, 0x00, 0xcc},
253 {0xb3, 0x22, 0x01, 0xcc},
254 {0xb3, 0x23, 0xe0, 0xcc},
255 {0xb3, 0x04, 0x05, 0xcc},
256 {0xb3, 0x14, 0x00, 0xcc},
257 {0xb3, 0x15, 0x00, 0xcc},
258 {0xb3, 0x16, 0x02, 0xcc},
259 {0xb3, 0x17, 0x7f, 0xcc},
260 {0xb3, 0x35, 0xdd, 0xcc},
261 {0xb3, 0x34, 0x02, 0xcc},
262 {0xb3, 0x00, 0x25, 0xcc},
263 {0xbc, 0x00, 0xd1, 0xcc},
264 {0xb8, 0x00, 0x13, 0xcc},
265 {0xb8, 0x27, 0x20, 0xcc},
266 {0xb8, 0x2c, 0x50, 0xcc},
267 {0xb8, 0x2d, 0xf8, 0xcc},
268 {0xb8, 0x2e, 0xf8, 0xcc},
269 {0xb8, 0x2f, 0xf8, 0xcc},
270 {0xb8, 0x30, 0x50, 0xcc},
271 {0xb8, 0x31, 0xf8, 0xcc},
272 {0xb8, 0x32, 0xf8, 0xcc},
273 {0xb8, 0x33, 0xf8, 0xcc},
274 {0xb8, 0x34, 0x50, 0xcc},
275 {0xb8, 0x35, 0x00, 0xcc},
276 {0xb8, 0x36, 0x00, 0xcc},
277 {0xb8, 0x37, 0x00, 0xcc},
278 {0xb8, 0x01, 0x79, 0xcc},
279 {0xb8, 0x08, 0xe0, 0xcc},
280 {0xb3, 0x01, 0x41, 0xcc},
281 {0xb8, 0x01, 0x79, 0xcc},
282 {0xb8, 0x14, 0x18, 0xcc},
283 {0xb8, 0xb2, 0x0a, 0xcc},
284 {0xb8, 0xb4, 0x0a, 0xcc},
285 {0xb8, 0xb5, 0x0a, 0xcc},
286 {0xb8, 0xfe, 0x00, 0xcc},
287 {0xb8, 0xff, 0x28, 0xcc},
288 {0xb9, 0x00, 0x28, 0xcc},
289 {0xb9, 0x01, 0x28, 0xcc},
290 {0xb9, 0x02, 0x28, 0xcc},
291 {0xb9, 0x03, 0x00, 0xcc},
292 {0xb9, 0x04, 0x00, 0xcc},
293 {0xb9, 0x05, 0x3c, 0xcc},
294 {0xb9, 0x06, 0x3c, 0xcc},
295 {0xb9, 0x07, 0x3c, 0xcc},
296 {0xb9, 0x08, 0x3c, 0xcc},
297 {0xb8, 0x8e, 0x00, 0xcc},
298 {0xb8, 0x8f, 0xff, 0xcc},
299 {0xb8, 0x81, 0x09, 0xcc},
300 {0x31, 0x00, 0x00, 0xbb},
301 {0x09, 0x01, 0xc7, 0xbb},
302 {0x34, 0x01, 0x00, 0xbb},
303 {0x2b, 0x00, 0x28, 0xbb},
304 {0x2c, 0x00, 0x30, 0xbb},
305 {0x2d, 0x00, 0x30, 0xbb},
306 {0x2e, 0x00, 0x28, 0xbb},
307 {0x62, 0x04, 0x11, 0xbb},
308 {0x03, 0x01, 0xe0, 0xbb},
309 {0x2c, 0x00, 0x2c, 0xbb},
310 {0x20, 0xd0, 0x00, 0xbb},
311 {0x01, 0x00, 0x08, 0xbb},
312 {0x06, 0x00, 0x10, 0xbb},
313 {0x05, 0x00, 0x20, 0xbb},
314 {0x20, 0x00, 0x00, 0xbb},
315 {0xb6, 0x00, 0x00, 0xcc},
316 {0xb6, 0x03, 0x01, 0xcc},
317 {0xb6, 0x02, 0x40, 0xcc},
318 {0xb6, 0x05, 0x00, 0xcc},
319 {0xb6, 0x04, 0xf0, 0xcc},
320 {0xb6, 0x12, 0x78, 0xcc},
321 {0xb6, 0x18, 0x00, 0xcc},
322 {0xb6, 0x17, 0x96, 0xcc},
323 {0xb6, 0x16, 0x00, 0xcc},
324 {0xb6, 0x22, 0x12, 0xcc},
325 {0xb6, 0x23, 0x0b, 0xcc},
326 {0xb3, 0x02, 0x02, 0xcc},
327 {0xbf, 0xc0, 0x39, 0xcc},
328 {0xbf, 0xc1, 0x04, 0xcc},
329 {0xbf, 0xcc, 0x10, 0xcc},
330 {0xb9, 0x12, 0x00, 0xcc},
331 {0xb9, 0x13, 0x0a, 0xcc},
332 {0xb9, 0x14, 0x0a, 0xcc},
333 {0xb9, 0x15, 0x0a, 0xcc},
334 {0xb9, 0x16, 0x0a, 0xcc},
335 {0xb9, 0x18, 0x00, 0xcc},
336 {0xb9, 0x19, 0x0f, 0xcc},
337 {0xb9, 0x1a, 0x0f, 0xcc},
338 {0xb9, 0x1b, 0x0f, 0xcc},
339 {0xb9, 0x1c, 0x0f, 0xcc},
340 {0xb8, 0x8e, 0x00, 0xcc},
341 {0xb8, 0x8f, 0xff, 0xcc},
342 {0xb6, 0x12, 0xf8, 0xcc},
343 {0xb6, 0x13, 0x13, 0xcc},
344 {0xbc, 0x02, 0x18, 0xcc},
345 {0xbc, 0x03, 0x50, 0xcc},
346 {0xbc, 0x04, 0x18, 0xcc},
347 {0xbc, 0x05, 0x00, 0xcc},
348 {0xbc, 0x06, 0x00, 0xcc},
349 {0xbc, 0x08, 0x30, 0xcc},
350 {0xbc, 0x09, 0x40, 0xcc},
351 {0xbc, 0x0a, 0x10, 0xcc},
352 {0xb8, 0x0c, 0x20, 0xcc},
353 {0xb8, 0x0d, 0x70, 0xcc},
354 {0xbc, 0x0b, 0x00, 0xcc},
355 {0xbc, 0x0c, 0x00, 0xcc},
356 {0x35, 0x00, 0xef, 0xbb},
357 {0xb3, 0x5c, 0x01, 0xcc},
358 {}
359};
360
Jean-Francois Moine8b605f12009-07-27 06:28:37 -0300361static const u8 mi1310_socinitVGA_JPG[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300362 {0xb0, 0x03, 0x19, 0xcc},
363 {0xb0, 0x04, 0x02, 0xcc},
AceLan Kao4041f6b2009-07-27 05:43:55 -0300364 {0xb3, 0x00, 0x64, 0xcc},
365 {0xb3, 0x00, 0x65, 0xcc},
366 {0xb3, 0x05, 0x00, 0xcc},
367 {0xb3, 0x06, 0x00, 0xcc},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300368 {0xb3, 0x08, 0x01, 0xcc},
369 {0xb3, 0x09, 0x0c, 0xcc},
370 {0xb3, 0x34, 0x02, 0xcc},
Jean-Francois Moineff1cf402009-12-26 15:18:02 -0300371 {0xb3, 0x35, 0xdd, 0xcc}, /* i2c add: 5d */
AceLan Kao4041f6b2009-07-27 05:43:55 -0300372 {0xb3, 0x02, 0x00, 0xcc},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300373 {0xb3, 0x03, 0x0a, 0xcc},
AceLan Kao4041f6b2009-07-27 05:43:55 -0300374 {0xb3, 0x04, 0x05, 0xcc},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300375 {0xb3, 0x20, 0x00, 0xcc},
376 {0xb3, 0x21, 0x00, 0xcc},
AceLan Kao4041f6b2009-07-27 05:43:55 -0300377 {0xb3, 0x22, 0x03, 0xcc},
378 {0xb3, 0x23, 0xc0, 0xcc},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300379 {0xb3, 0x14, 0x00, 0xcc},
380 {0xb3, 0x15, 0x00, 0xcc},
AceLan Kao4041f6b2009-07-27 05:43:55 -0300381 {0xb3, 0x16, 0x04, 0xcc},
382 {0xb3, 0x17, 0xff, 0xcc},
383 {0xb3, 0x00, 0x65, 0xcc},
384 {0xb8, 0x00, 0x00, 0xcc},
385 {0xbc, 0x00, 0xd0, 0xcc},
386 {0xbc, 0x01, 0x01, 0xcc},
387 {0xf0, 0x00, 0x02, 0xbb},
388 {0xc8, 0x9f, 0x0b, 0xbb},
389 {0x5b, 0x00, 0x01, 0xbb},
390 {0x2f, 0xde, 0x20, 0xbb},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300391 {0xf0, 0x00, 0x00, 0xbb},
Jean-Francois Moinee27188e2009-07-27 06:00:03 -0300392 {0x20, 0x03, 0x02, 0xbb}, /* h/v flip */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300393 {0xf0, 0x00, 0x01, 0xbb},
AceLan Kao4041f6b2009-07-27 05:43:55 -0300394 {0x05, 0x00, 0x07, 0xbb},
395 {0x34, 0x00, 0x00, 0xbb},
396 {0x35, 0xff, 0x00, 0xbb},
397 {0xdc, 0x07, 0x02, 0xbb},
398 {0xdd, 0x3c, 0x18, 0xbb},
399 {0xde, 0x92, 0x6d, 0xbb},
400 {0xdf, 0xcd, 0xb1, 0xbb},
401 {0xe0, 0xff, 0xe7, 0xbb},
402 {0x06, 0xf0, 0x0d, 0xbb},
403 {0x06, 0x70, 0x0e, 0xbb},
404 {0x4c, 0x00, 0x01, 0xbb},
405 {0x4d, 0x00, 0x01, 0xbb},
406 {0xf0, 0x00, 0x02, 0xbb},
407 {0x2e, 0x0c, 0x55, 0xbb},
408 {0x21, 0xb6, 0x6e, 0xbb},
409 {0x36, 0x30, 0x10, 0xbb},
410 {0x37, 0x00, 0xc1, 0xbb},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300411 {0xf0, 0x00, 0x00, 0xbb},
AceLan Kao4041f6b2009-07-27 05:43:55 -0300412 {0x07, 0x00, 0x84, 0xbb},
413 {0x08, 0x02, 0x4a, 0xbb},
414 {0x05, 0x01, 0x10, 0xbb},
415 {0x06, 0x00, 0x39, 0xbb},
416 {0xf0, 0x00, 0x02, 0xbb},
417 {0x58, 0x02, 0x67, 0xbb},
418 {0x57, 0x02, 0x00, 0xbb},
419 {0x5a, 0x02, 0x67, 0xbb},
420 {0x59, 0x02, 0x00, 0xbb},
421 {0x5c, 0x12, 0x0d, 0xbb},
422 {0x5d, 0x16, 0x11, 0xbb},
423 {0x39, 0x06, 0x18, 0xbb},
424 {0x3a, 0x06, 0x18, 0xbb},
425 {0x3b, 0x06, 0x18, 0xbb},
426 {0x3c, 0x06, 0x18, 0xbb},
427 {0x64, 0x7b, 0x5b, 0xbb},
428 {0xf0, 0x00, 0x02, 0xbb},
429 {0x36, 0x30, 0x10, 0xbb},
430 {0x37, 0x00, 0xc0, 0xbb},
431 {0xbc, 0x0e, 0x00, 0xcc},
432 {0xbc, 0x0f, 0x05, 0xcc},
433 {0xbc, 0x10, 0xc0, 0xcc},
434 {0xbc, 0x11, 0x03, 0xcc},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300435 {0xb6, 0x00, 0x00, 0xcc},
436 {0xb6, 0x03, 0x02, 0xcc},
437 {0xb6, 0x02, 0x80, 0xcc},
438 {0xb6, 0x05, 0x01, 0xcc},
439 {0xb6, 0x04, 0xe0, 0xcc},
AceLan Kao4041f6b2009-07-27 05:43:55 -0300440 {0xb6, 0x12, 0xf8, 0xcc},
441 {0xb6, 0x13, 0x25, 0xcc},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300442 {0xb6, 0x18, 0x02, 0xcc},
443 {0xb6, 0x17, 0x58, 0xcc},
444 {0xb6, 0x16, 0x00, 0xcc},
445 {0xb6, 0x22, 0x12, 0xcc},
446 {0xb6, 0x23, 0x0b, 0xcc},
447 {0xbf, 0xc0, 0x39, 0xcc},
448 {0xbf, 0xc1, 0x04, 0xcc},
AceLan Kao4041f6b2009-07-27 05:43:55 -0300449 {0xbf, 0xcc, 0x00, 0xcc},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300450 {0xbc, 0x02, 0x18, 0xcc},
451 {0xbc, 0x03, 0x50, 0xcc},
452 {0xbc, 0x04, 0x18, 0xcc},
453 {0xbc, 0x05, 0x00, 0xcc},
454 {0xbc, 0x06, 0x00, 0xcc},
455 {0xbc, 0x08, 0x30, 0xcc},
456 {0xbc, 0x09, 0x40, 0xcc},
457 {0xbc, 0x0a, 0x10, 0xcc},
458 {0xbc, 0x0b, 0x00, 0xcc},
459 {0xbc, 0x0c, 0x00, 0xcc},
AceLan Kao4041f6b2009-07-27 05:43:55 -0300460 {0xb3, 0x5c, 0x01, 0xcc},
461 {0xf0, 0x00, 0x01, 0xbb},
462 {0x80, 0x00, 0x03, 0xbb},
463 {0x81, 0xc7, 0x14, 0xbb},
464 {0x82, 0xeb, 0xe8, 0xbb},
465 {0x83, 0xfe, 0xf4, 0xbb},
466 {0x84, 0xcd, 0x10, 0xbb},
467 {0x85, 0xf3, 0xee, 0xbb},
468 {0x86, 0xff, 0xf1, 0xbb},
469 {0x87, 0xcd, 0x10, 0xbb},
470 {0x88, 0xf3, 0xee, 0xbb},
471 {0x89, 0x01, 0xf1, 0xbb},
472 {0x8a, 0xe5, 0x17, 0xbb},
473 {0x8b, 0xe8, 0xe2, 0xbb},
474 {0x8c, 0xf7, 0xed, 0xbb},
475 {0x8d, 0x00, 0xff, 0xbb},
476 {0x8e, 0xec, 0x10, 0xbb},
477 {0x8f, 0xf0, 0xed, 0xbb},
478 {0x90, 0xf9, 0xf2, 0xbb},
479 {0x91, 0x00, 0x00, 0xbb},
480 {0x92, 0xe9, 0x0d, 0xbb},
481 {0x93, 0xf4, 0xf2, 0xbb},
482 {0x94, 0xfb, 0xf5, 0xbb},
483 {0x95, 0x00, 0xff, 0xbb},
484 {0xb6, 0x0f, 0x08, 0xbb},
485 {0xb7, 0x3d, 0x16, 0xbb},
486 {0xb8, 0x0c, 0x04, 0xbb},
487 {0xb9, 0x1c, 0x07, 0xbb},
488 {0xba, 0x0a, 0x03, 0xbb},
489 {0xbb, 0x1b, 0x09, 0xbb},
490 {0xbc, 0x17, 0x0d, 0xbb},
491 {0xbd, 0x23, 0x1d, 0xbb},
492 {0xbe, 0x00, 0x28, 0xbb},
493 {0xbf, 0x11, 0x09, 0xbb},
494 {0xc0, 0x16, 0x15, 0xbb},
495 {0xc1, 0x00, 0x1b, 0xbb},
496 {0xc2, 0x0e, 0x07, 0xbb},
497 {0xc3, 0x14, 0x10, 0xbb},
498 {0xc4, 0x00, 0x17, 0xbb},
499 {0x06, 0x74, 0x8e, 0xbb},
500 {0xf0, 0x00, 0x01, 0xbb},
501 {0x06, 0xf4, 0x8e, 0xbb},
502 {0x00, 0x00, 0x50, 0xdd},
503 {0x06, 0x74, 0x8e, 0xbb},
504 {0xf0, 0x00, 0x02, 0xbb},
505 {0x24, 0x50, 0x20, 0xbb},
506 {0xf0, 0x00, 0x02, 0xbb},
507 {0x34, 0x0c, 0x50, 0xbb},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300508 {0xb3, 0x01, 0x41, 0xcc},
AceLan Kao4041f6b2009-07-27 05:43:55 -0300509 {0xf0, 0x00, 0x00, 0xbb},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300510 {0x03, 0x03, 0xc0, 0xbb},
AceLan Kao4041f6b2009-07-27 05:43:55 -0300511 {},
512};
Jean-Francois Moine8b605f12009-07-27 06:28:37 -0300513static const u8 mi1310_socinitQVGA_JPG[][4] = {
AceLan Kao4041f6b2009-07-27 05:43:55 -0300514 {0xb0, 0x03, 0x19, 0xcc}, {0xb0, 0x04, 0x02, 0xcc},
515 {0xb3, 0x00, 0x64, 0xcc}, {0xb3, 0x00, 0x65, 0xcc},
516 {0xb3, 0x05, 0x00, 0xcc}, {0xb3, 0x06, 0x00, 0xcc},
517 {0xb3, 0x08, 0x01, 0xcc}, {0xb3, 0x09, 0x0c, 0xcc},
518 {0xb3, 0x34, 0x02, 0xcc}, {0xb3, 0x35, 0xdd, 0xcc},
519 {0xb3, 0x02, 0x00, 0xcc}, {0xb3, 0x03, 0x0a, 0xcc},
520 {0xb3, 0x04, 0x05, 0xcc}, {0xb3, 0x20, 0x00, 0xcc},
521 {0xb3, 0x21, 0x00, 0xcc}, {0xb3, 0x22, 0x03, 0xcc},
522 {0xb3, 0x23, 0xc0, 0xcc}, {0xb3, 0x14, 0x00, 0xcc},
523 {0xb3, 0x15, 0x00, 0xcc}, {0xb3, 0x16, 0x04, 0xcc},
524 {0xb3, 0x17, 0xff, 0xcc}, {0xb3, 0x00, 0x65, 0xcc},
525 {0xb8, 0x00, 0x00, 0xcc}, {0xbc, 0x00, 0xf0, 0xcc},
526 {0xbc, 0x01, 0x01, 0xcc}, {0xf0, 0x00, 0x02, 0xbb},
527 {0xc8, 0x9f, 0x0b, 0xbb}, {0x5b, 0x00, 0x01, 0xbb},
528 {0x2f, 0xde, 0x20, 0xbb}, {0xf0, 0x00, 0x00, 0xbb},
Jean-Francois Moinee27188e2009-07-27 06:00:03 -0300529 {0x20, 0x03, 0x02, 0xbb}, /* h/v flip */
530 {0xf0, 0x00, 0x01, 0xbb},
AceLan Kao4041f6b2009-07-27 05:43:55 -0300531 {0x05, 0x00, 0x07, 0xbb}, {0x34, 0x00, 0x00, 0xbb},
532 {0x35, 0xff, 0x00, 0xbb}, {0xdc, 0x07, 0x02, 0xbb},
533 {0xdd, 0x3c, 0x18, 0xbb}, {0xde, 0x92, 0x6d, 0xbb},
534 {0xdf, 0xcd, 0xb1, 0xbb}, {0xe0, 0xff, 0xe7, 0xbb},
535 {0x06, 0xf0, 0x0d, 0xbb}, {0x06, 0x70, 0x0e, 0xbb},
536 {0x4c, 0x00, 0x01, 0xbb}, {0x4d, 0x00, 0x01, 0xbb},
537 {0xf0, 0x00, 0x02, 0xbb}, {0x2e, 0x0c, 0x55, 0xbb},
538 {0x21, 0xb6, 0x6e, 0xbb}, {0x36, 0x30, 0x10, 0xbb},
539 {0x37, 0x00, 0xc1, 0xbb}, {0xf0, 0x00, 0x00, 0xbb},
540 {0x07, 0x00, 0x84, 0xbb}, {0x08, 0x02, 0x4a, 0xbb},
541 {0x05, 0x01, 0x10, 0xbb}, {0x06, 0x00, 0x39, 0xbb},
542 {0xf0, 0x00, 0x02, 0xbb}, {0x58, 0x02, 0x67, 0xbb},
543 {0x57, 0x02, 0x00, 0xbb}, {0x5a, 0x02, 0x67, 0xbb},
544 {0x59, 0x02, 0x00, 0xbb}, {0x5c, 0x12, 0x0d, 0xbb},
545 {0x5d, 0x16, 0x11, 0xbb}, {0x39, 0x06, 0x18, 0xbb},
546 {0x3a, 0x06, 0x18, 0xbb}, {0x3b, 0x06, 0x18, 0xbb},
547 {0x3c, 0x06, 0x18, 0xbb}, {0x64, 0x7b, 0x5b, 0xbb},
548 {0xf0, 0x00, 0x02, 0xbb}, {0x36, 0x30, 0x10, 0xbb},
549 {0x37, 0x00, 0xc0, 0xbb}, {0xbc, 0x0e, 0x00, 0xcc},
550 {0xbc, 0x0f, 0x05, 0xcc}, {0xbc, 0x10, 0xc0, 0xcc},
551 {0xbc, 0x11, 0x03, 0xcc}, {0xb6, 0x00, 0x00, 0xcc},
552 {0xb6, 0x03, 0x01, 0xcc}, {0xb6, 0x02, 0x40, 0xcc},
553 {0xb6, 0x05, 0x00, 0xcc}, {0xb6, 0x04, 0xf0, 0xcc},
554 {0xb6, 0x12, 0xf8, 0xcc}, {0xb6, 0x13, 0x25, 0xcc},
555 {0xb6, 0x18, 0x00, 0xcc}, {0xb6, 0x17, 0x96, 0xcc},
556 {0xb6, 0x16, 0x00, 0xcc}, {0xb6, 0x22, 0x12, 0xcc},
557 {0xb6, 0x23, 0x0b, 0xcc}, {0xbf, 0xc0, 0x39, 0xcc},
558 {0xbf, 0xc1, 0x04, 0xcc}, {0xbf, 0xcc, 0x00, 0xcc},
559 {0xb3, 0x5c, 0x01, 0xcc}, {0xf0, 0x00, 0x01, 0xbb},
560 {0x80, 0x00, 0x03, 0xbb}, {0x81, 0xc7, 0x14, 0xbb},
561 {0x82, 0xeb, 0xe8, 0xbb}, {0x83, 0xfe, 0xf4, 0xbb},
562 {0x84, 0xcd, 0x10, 0xbb}, {0x85, 0xf3, 0xee, 0xbb},
563 {0x86, 0xff, 0xf1, 0xbb}, {0x87, 0xcd, 0x10, 0xbb},
564 {0x88, 0xf3, 0xee, 0xbb}, {0x89, 0x01, 0xf1, 0xbb},
565 {0x8a, 0xe5, 0x17, 0xbb}, {0x8b, 0xe8, 0xe2, 0xbb},
566 {0x8c, 0xf7, 0xed, 0xbb}, {0x8d, 0x00, 0xff, 0xbb},
567 {0x8e, 0xec, 0x10, 0xbb}, {0x8f, 0xf0, 0xed, 0xbb},
568 {0x90, 0xf9, 0xf2, 0xbb}, {0x91, 0x00, 0x00, 0xbb},
569 {0x92, 0xe9, 0x0d, 0xbb}, {0x93, 0xf4, 0xf2, 0xbb},
570 {0x94, 0xfb, 0xf5, 0xbb}, {0x95, 0x00, 0xff, 0xbb},
571 {0xb6, 0x0f, 0x08, 0xbb}, {0xb7, 0x3d, 0x16, 0xbb},
572 {0xb8, 0x0c, 0x04, 0xbb}, {0xb9, 0x1c, 0x07, 0xbb},
573 {0xba, 0x0a, 0x03, 0xbb}, {0xbb, 0x1b, 0x09, 0xbb},
574 {0xbc, 0x17, 0x0d, 0xbb}, {0xbd, 0x23, 0x1d, 0xbb},
575 {0xbe, 0x00, 0x28, 0xbb}, {0xbf, 0x11, 0x09, 0xbb},
576 {0xc0, 0x16, 0x15, 0xbb}, {0xc1, 0x00, 0x1b, 0xbb},
577 {0xc2, 0x0e, 0x07, 0xbb}, {0xc3, 0x14, 0x10, 0xbb},
578 {0xc4, 0x00, 0x17, 0xbb}, {0x06, 0x74, 0x8e, 0xbb},
579 {0xf0, 0x00, 0x01, 0xbb}, {0x06, 0xf4, 0x8e, 0xbb},
580 {0x00, 0x00, 0x50, 0xdd}, {0x06, 0x74, 0x8e, 0xbb},
581 {0xf0, 0x00, 0x02, 0xbb}, {0x24, 0x50, 0x20, 0xbb},
582 {0xf0, 0x00, 0x02, 0xbb}, {0x34, 0x0c, 0x50, 0xbb},
583 {0xb3, 0x01, 0x41, 0xcc}, {0xf0, 0x00, 0x00, 0xbb},
584 {0x03, 0x03, 0xc0, 0xbb},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300585 {},
586};
Jean-Francois Moine6af4e7a2009-01-29 16:34:25 -0300587static const u8 mi1310_soc_InitSXGA_JPG[][4] = {
588 {0xb0, 0x03, 0x19, 0xcc},
589 {0xb0, 0x04, 0x02, 0xcc},
Jean-Francois Moine111815e2009-07-27 05:52:27 -0300590 {0xb3, 0x00, 0x64, 0xcc},
591 {0xb3, 0x00, 0x65, 0xcc},
Jean-Francois Moine6af4e7a2009-01-29 16:34:25 -0300592 {0xb3, 0x05, 0x00, 0xcc},
Jean-Francois Moine111815e2009-07-27 05:52:27 -0300593 {0xb3, 0x06, 0x00, 0xcc},
Jean-Francois Moine6af4e7a2009-01-29 16:34:25 -0300594 {0xb3, 0x08, 0x01, 0xcc},
595 {0xb3, 0x09, 0x0c, 0xcc},
596 {0xb3, 0x34, 0x02, 0xcc},
597 {0xb3, 0x35, 0xdd, 0xcc},
Jean-Francois Moine111815e2009-07-27 05:52:27 -0300598 {0xb3, 0x02, 0x00, 0xcc},
Jean-Francois Moine6af4e7a2009-01-29 16:34:25 -0300599 {0xb3, 0x03, 0x0a, 0xcc},
600 {0xb3, 0x04, 0x0d, 0xcc},
601 {0xb3, 0x20, 0x00, 0xcc},
602 {0xb3, 0x21, 0x00, 0xcc},
Jean-Francois Moine111815e2009-07-27 05:52:27 -0300603 {0xb3, 0x22, 0x03, 0xcc},
604 {0xb3, 0x23, 0xc0, 0xcc},
Jean-Francois Moine6af4e7a2009-01-29 16:34:25 -0300605 {0xb3, 0x14, 0x00, 0xcc},
606 {0xb3, 0x15, 0x00, 0xcc},
607 {0xb3, 0x16, 0x04, 0xcc},
608 {0xb3, 0x17, 0xff, 0xcc},
Jean-Francois Moine111815e2009-07-27 05:52:27 -0300609 {0xb3, 0x00, 0x65, 0xcc},
610 {0xb8, 0x00, 0x00, 0xcc},
611 {0xbc, 0x00, 0x70, 0xcc},
612 {0xbc, 0x01, 0x01, 0xcc},
613 {0xf0, 0x00, 0x02, 0xbb},
614 {0xc8, 0x9f, 0x0b, 0xbb},
615 {0x5b, 0x00, 0x01, 0xbb},
Jean-Francois Moine6af4e7a2009-01-29 16:34:25 -0300616 {0xf0, 0x00, 0x00, 0xbb},
Jean-Francois Moinee27188e2009-07-27 06:00:03 -0300617 {0x20, 0x03, 0x02, 0xbb}, /* h/v flip */
Jean-Francois Moine6af4e7a2009-01-29 16:34:25 -0300618 {0xf0, 0x00, 0x01, 0xbb},
Jean-Francois Moine111815e2009-07-27 05:52:27 -0300619 {0x05, 0x00, 0x07, 0xbb},
620 {0x34, 0x00, 0x00, 0xbb},
621 {0x35, 0xff, 0x00, 0xbb},
622 {0xdc, 0x07, 0x02, 0xbb},
623 {0xdd, 0x3c, 0x18, 0xbb},
624 {0xde, 0x92, 0x6d, 0xbb},
625 {0xdf, 0xcd, 0xb1, 0xbb},
626 {0xe0, 0xff, 0xe7, 0xbb},
627 {0x06, 0xf0, 0x0d, 0xbb},
628 {0x06, 0x70, 0x0e, 0xbb},
629 {0x4c, 0x00, 0x01, 0xbb},
630 {0x4d, 0x00, 0x01, 0xbb},
631 {0xf0, 0x00, 0x02, 0xbb},
632 {0x2e, 0x0c, 0x60, 0xbb},
633 {0x21, 0xb6, 0x6e, 0xbb},
634 {0x37, 0x01, 0x40, 0xbb},
Jean-Francois Moine6af4e7a2009-01-29 16:34:25 -0300635 {0xf0, 0x00, 0x00, 0xbb},
Jean-Francois Moine111815e2009-07-27 05:52:27 -0300636 {0x07, 0x00, 0x84, 0xbb},
637 {0x08, 0x02, 0x4a, 0xbb},
638 {0x05, 0x01, 0x10, 0xbb},
639 {0x06, 0x00, 0x39, 0xbb},
640 {0xf0, 0x00, 0x02, 0xbb},
641 {0x58, 0x02, 0x67, 0xbb},
642 {0x57, 0x02, 0x00, 0xbb},
643 {0x5a, 0x02, 0x67, 0xbb},
644 {0x59, 0x02, 0x00, 0xbb},
645 {0x5c, 0x12, 0x0d, 0xbb},
646 {0x5d, 0x16, 0x11, 0xbb},
647 {0x39, 0x06, 0x18, 0xbb},
648 {0x3a, 0x06, 0x18, 0xbb},
649 {0x3b, 0x06, 0x18, 0xbb},
650 {0x3c, 0x06, 0x18, 0xbb},
651 {0x64, 0x7b, 0x5b, 0xbb},
Jean-Francois Moine6af4e7a2009-01-29 16:34:25 -0300652 {0xb6, 0x00, 0x00, 0xcc},
653 {0xb6, 0x03, 0x05, 0xcc},
654 {0xb6, 0x02, 0x00, 0xcc},
Jean-Francois Moine111815e2009-07-27 05:52:27 -0300655 {0xb6, 0x05, 0x03, 0xcc},
656 {0xb6, 0x04, 0xc0, 0xcc},
Jean-Francois Moine6af4e7a2009-01-29 16:34:25 -0300657 {0xb6, 0x12, 0xf8, 0xcc},
Jean-Francois Moine111815e2009-07-27 05:52:27 -0300658 {0xb6, 0x13, 0x29, 0xcc},
659 {0xb6, 0x18, 0x09, 0xcc},
660 {0xb6, 0x17, 0x60, 0xcc},
Jean-Francois Moine6af4e7a2009-01-29 16:34:25 -0300661 {0xb6, 0x16, 0x00, 0xcc},
662 {0xb6, 0x22, 0x12, 0xcc},
663 {0xb6, 0x23, 0x0b, 0xcc},
Jean-Francois Moine6af4e7a2009-01-29 16:34:25 -0300664 {0xbf, 0xc0, 0x39, 0xcc},
665 {0xbf, 0xc1, 0x04, 0xcc},
Jean-Francois Moine111815e2009-07-27 05:52:27 -0300666 {0xbf, 0xcc, 0x00, 0xcc},
Jean-Francois Moine6af4e7a2009-01-29 16:34:25 -0300667 {0xb3, 0x01, 0x41, 0xcc},
Jean-Francois Moine111815e2009-07-27 05:52:27 -0300668 {0x00, 0x00, 0x80, 0xdd},
669 {0xf0, 0x00, 0x02, 0xbb},
670 {0x00, 0x00, 0x10, 0xdd},
671 {0x22, 0xa0, 0x78, 0xbb},
672 {0x23, 0xa0, 0x78, 0xbb},
673 {0x24, 0x7f, 0x00, 0xbb},
674 {0x28, 0xea, 0x02, 0xbb},
675 {0x29, 0x86, 0x7a, 0xbb},
676 {0x5e, 0x52, 0x4c, 0xbb},
677 {0x5f, 0x20, 0x24, 0xbb},
678 {0x60, 0x00, 0x02, 0xbb},
679 {0x02, 0x00, 0xee, 0xbb},
680 {0x03, 0x39, 0x23, 0xbb},
681 {0x04, 0x07, 0x24, 0xbb},
682 {0x09, 0x00, 0xc0, 0xbb},
683 {0x0a, 0x00, 0x79, 0xbb},
684 {0x0b, 0x00, 0x04, 0xbb},
685 {0x0c, 0x00, 0x5c, 0xbb},
686 {0x0d, 0x00, 0xd9, 0xbb},
687 {0x0e, 0x00, 0x53, 0xbb},
688 {0x0f, 0x00, 0x21, 0xbb},
689 {0x10, 0x00, 0xa4, 0xbb},
690 {0x11, 0x00, 0xe5, 0xbb},
691 {0x15, 0x00, 0x00, 0xbb},
692 {0x16, 0x00, 0x00, 0xbb},
693 {0x17, 0x00, 0x00, 0xbb},
694 {0x18, 0x00, 0x00, 0xbb},
695 {0x19, 0x00, 0x00, 0xbb},
696 {0x1a, 0x00, 0x00, 0xbb},
697 {0x1b, 0x00, 0x00, 0xbb},
698 {0x1c, 0x00, 0x00, 0xbb},
699 {0x1d, 0x00, 0x00, 0xbb},
700 {0x1e, 0x00, 0x00, 0xbb},
701 {0xf0, 0x00, 0x01, 0xbb},
702 {0x00, 0x00, 0x20, 0xdd},
703 {0x06, 0xf0, 0x8e, 0xbb},
704 {0x00, 0x00, 0x80, 0xdd},
705 {0x06, 0x70, 0x8e, 0xbb},
706 {0xf0, 0x00, 0x02, 0xbb},
707 {0x00, 0x00, 0x20, 0xdd},
708 {0x5e, 0x6a, 0x53, 0xbb},
709 {0x5f, 0x40, 0x2c, 0xbb},
710 {0xf0, 0x00, 0x01, 0xbb},
711 {0x00, 0x00, 0x20, 0xdd},
712 {0x58, 0x00, 0x00, 0xbb},
713 {0x53, 0x09, 0x03, 0xbb},
714 {0x54, 0x31, 0x18, 0xbb},
715 {0x55, 0x8b, 0x5f, 0xbb},
716 {0x56, 0xc0, 0xa9, 0xbb},
717 {0x57, 0xe0, 0xd2, 0xbb},
718 {0xe1, 0x00, 0x00, 0xbb},
719 {0xdc, 0x09, 0x03, 0xbb},
720 {0xdd, 0x31, 0x18, 0xbb},
721 {0xde, 0x8b, 0x5f, 0xbb},
722 {0xdf, 0xc0, 0xa9, 0xbb},
723 {0xe0, 0xe0, 0xd2, 0xbb},
724 {0xb3, 0x5c, 0x01, 0xcc},
725 {0xf0, 0x00, 0x01, 0xbb},
726 {0x06, 0xf0, 0x8e, 0xbb},
727 {0xf0, 0x00, 0x02, 0xbb},
728 {0x2f, 0xde, 0x20, 0xbb},
729 {0xf0, 0x00, 0x02, 0xbb},
730 {0x24, 0x50, 0x20, 0xbb},
731 {0xbc, 0x0e, 0x00, 0xcc},
732 {0xbc, 0x0f, 0x05, 0xcc},
733 {0xbc, 0x10, 0xc0, 0xcc},
734 {0xf0, 0x00, 0x02, 0xbb},
735 {0x34, 0x0c, 0x50, 0xbb},
736 {0xbc, 0x11, 0x03, 0xcc},
737 {0xf0, 0x00, 0x01, 0xbb},
738 {0x80, 0x00, 0x03, 0xbb},
739 {0x81, 0xc7, 0x14, 0xbb},
740 {0x82, 0xeb, 0xe8, 0xbb},
741 {0x83, 0xfe, 0xf4, 0xbb},
742 {0x84, 0xcd, 0x10, 0xbb},
743 {0x85, 0xf3, 0xee, 0xbb},
744 {0x86, 0xff, 0xf1, 0xbb},
745 {0x87, 0xcd, 0x10, 0xbb},
746 {0x88, 0xf3, 0xee, 0xbb},
747 {0x89, 0x01, 0xf1, 0xbb},
748 {0x8a, 0xe5, 0x17, 0xbb},
749 {0x8b, 0xe8, 0xe2, 0xbb},
750 {0x8c, 0xf7, 0xed, 0xbb},
751 {0x8d, 0x00, 0xff, 0xbb},
752 {0x8e, 0xec, 0x10, 0xbb},
753 {0x8f, 0xf0, 0xed, 0xbb},
754 {0x90, 0xf9, 0xf2, 0xbb},
755 {0x91, 0x00, 0x00, 0xbb},
756 {0x92, 0xe9, 0x0d, 0xbb},
757 {0x93, 0xf4, 0xf2, 0xbb},
758 {0x94, 0xfb, 0xf5, 0xbb},
759 {0x95, 0x00, 0xff, 0xbb},
760 {0xb6, 0x0f, 0x08, 0xbb},
761 {0xb7, 0x3d, 0x16, 0xbb},
762 {0xb8, 0x0c, 0x04, 0xbb},
763 {0xb9, 0x1c, 0x07, 0xbb},
764 {0xba, 0x0a, 0x03, 0xbb},
765 {0xbb, 0x1b, 0x09, 0xbb},
766 {0xbc, 0x17, 0x0d, 0xbb},
767 {0xbd, 0x23, 0x1d, 0xbb},
768 {0xbe, 0x00, 0x28, 0xbb},
769 {0xbf, 0x11, 0x09, 0xbb},
770 {0xc0, 0x16, 0x15, 0xbb},
771 {0xc1, 0x00, 0x1b, 0xbb},
772 {0xc2, 0x0e, 0x07, 0xbb},
773 {0xc3, 0x14, 0x10, 0xbb},
774 {0xc4, 0x00, 0x17, 0xbb},
775 {0x06, 0x74, 0x8e, 0xbb},
776 {0xf0, 0x00, 0x00, 0xbb},
777 {0x03, 0x03, 0xc0, 0xbb},
Jean-Francois Moine6af4e7a2009-01-29 16:34:25 -0300778 {}
779};
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300780
Jean-Francois Moine8b605f12009-07-27 06:28:37 -0300781static const u8 mi1320_gamma[17] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300782 0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
783 0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
784};
Jean-Francois Moine8b605f12009-07-27 06:28:37 -0300785static const u8 mi1320_matrix[9] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300786 0x54, 0xda, 0x06, 0xf1, 0x50, 0xf4, 0xf7, 0xea, 0x52
787};
Jean-Francois Moine8b605f12009-07-27 06:28:37 -0300788static const u8 mi1320_initVGA_data[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300789 {0xb3, 0x01, 0x01, 0xcc}, {0x00, 0x00, 0x33, 0xdd},
790 {0xb0, 0x03, 0x19, 0xcc}, {0x00, 0x00, 0x33, 0xdd},
791 {0xb0, 0x04, 0x02, 0xcc}, {0x00, 0x00, 0x33, 0xdd},
792 {0xb3, 0x00, 0x64, 0xcc}, {0xb3, 0x00, 0x65, 0xcc},
793 {0xb0, 0x16, 0x03, 0xcc}, {0xb3, 0x05, 0x00, 0xcc},
794 {0xb3, 0x06, 0x00, 0xcc}, {0xb3, 0x08, 0x01, 0xcc},
795 {0xb3, 0x09, 0x0c, 0xcc}, {0xb3, 0x34, 0x02, 0xcc},
Jean-Francois Moineff1cf402009-12-26 15:18:02 -0300796 {0xb3, 0x35, 0xc8, 0xcc}, /* i2c add: 48 */
797 {0xb3, 0x02, 0x00, 0xcc},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300798 {0xb3, 0x03, 0x0a, 0xcc}, {0xb3, 0x04, 0x05, 0xcc},
799 {0xb3, 0x20, 0x00, 0xcc}, {0xb3, 0x21, 0x00, 0xcc},
800 {0xb3, 0x22, 0x03, 0xcc}, {0xb3, 0x23, 0xc0, 0xcc},
801 {0xb3, 0x14, 0x00, 0xcc}, {0xb3, 0x15, 0x00, 0xcc},
802 {0xb3, 0x16, 0x04, 0xcc}, {0xb3, 0x17, 0xff, 0xcc},
803 {0xb3, 0x00, 0x67, 0xcc}, {0xbc, 0x00, 0xd0, 0xcc},
804 {0xbc, 0x01, 0x01, 0xcc}, {0xf0, 0x00, 0x00, 0xbb},
805 {0x0d, 0x00, 0x09, 0xbb}, {0x00, 0x01, 0x00, 0xdd},
806 {0x0d, 0x00, 0x08, 0xbb}, {0xf0, 0x00, 0x01, 0xbb},
807 {0xa1, 0x05, 0x00, 0xbb}, {0xa4, 0x03, 0xc0, 0xbb},
808 {0xf0, 0x00, 0x02, 0xbb}, {0x00, 0x00, 0x10, 0xdd},
809 {0xc8, 0x9f, 0x0b, 0xbb}, {0x00, 0x00, 0x10, 0xdd},
810 {0xf0, 0x00, 0x00, 0xbb}, {0x00, 0x00, 0x10, 0xdd},
811 {0x20, 0x01, 0x00, 0xbb}, {0x00, 0x00, 0x10, 0xdd},
812 {0xf0, 0x00, 0x01, 0xbb}, {0x9d, 0x3c, 0xa0, 0xbb},
813 {0x47, 0x30, 0x30, 0xbb}, {0xf0, 0x00, 0x00, 0xbb},
814 {0x0a, 0x80, 0x11, 0xbb}, {0x35, 0x00, 0x22, 0xbb},
815 {0xf0, 0x00, 0x02, 0xbb}, {0x9d, 0xc5, 0x05, 0xbb},
816 {0xdc, 0x0f, 0xfc, 0xbb}, {0xf0, 0x00, 0x01, 0xbb},
817 {0x06, 0x74, 0x0e, 0xbb}, {0x80, 0x00, 0x06, 0xbb},
818 {0x81, 0x04, 0x00, 0xbb}, {0x82, 0x01, 0x02, 0xbb},
819 {0x83, 0x03, 0x02, 0xbb}, {0x84, 0x05, 0x00, 0xbb},
820 {0x85, 0x01, 0x00, 0xbb}, {0x86, 0x03, 0x02, 0xbb},
821 {0x87, 0x05, 0x00, 0xbb}, {0x88, 0x01, 0x00, 0xbb},
822 {0x89, 0x02, 0x02, 0xbb}, {0x8a, 0xfd, 0x04, 0xbb},
823 {0x8b, 0xfc, 0xfd, 0xbb}, {0x8c, 0xff, 0xfd, 0xbb},
824 {0x8d, 0x00, 0x00, 0xbb}, {0x8e, 0xfe, 0x05, 0xbb},
825 {0x8f, 0xfc, 0xfd, 0xbb}, {0x90, 0xfe, 0xfd, 0xbb},
826 {0x91, 0x00, 0x00, 0xbb}, {0x92, 0xfe, 0x03, 0xbb},
827 {0x93, 0xfd, 0xfe, 0xbb}, {0x94, 0xff, 0xfd, 0xbb},
828 {0x95, 0x00, 0x00, 0xbb}, {0xb6, 0x07, 0x05, 0xbb},
829 {0xb7, 0x13, 0x06, 0xbb}, {0xb8, 0x08, 0x06, 0xbb},
830 {0xb9, 0x14, 0x08, 0xbb}, {0xba, 0x06, 0x05, 0xbb},
831 {0xbb, 0x13, 0x06, 0xbb}, {0xbc, 0x03, 0x01, 0xbb},
832 {0xbd, 0x03, 0x04, 0xbb}, {0xbe, 0x00, 0x02, 0xbb},
833 {0xbf, 0x03, 0x01, 0xbb}, {0xc0, 0x02, 0x04, 0xbb},
834 {0xc1, 0x00, 0x04, 0xbb}, {0xc2, 0x02, 0x01, 0xbb},
835 {0xc3, 0x01, 0x03, 0xbb}, {0xc4, 0x00, 0x04, 0xbb},
836 {0xf0, 0x00, 0x00, 0xbb}, {0x05, 0x01, 0x13, 0xbb},
837 {0x06, 0x00, 0x11, 0xbb}, {0x07, 0x00, 0x85, 0xbb},
Jean-Francois Moineff1cf402009-12-26 15:18:02 -0300838 {0x08, 0x00, 0x27, 0xbb},
839 {0x20, 0x01, 0x00, 0xbb}, /* h/v flips - was 03 */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300840 {0x21, 0x80, 0x00, 0xbb}, {0x22, 0x0d, 0x0f, 0xbb},
841 {0x24, 0x80, 0x00, 0xbb}, {0x59, 0x00, 0xff, 0xbb},
842 {0xf0, 0x00, 0x02, 0xbb}, {0x39, 0x03, 0x0d, 0xbb},
843 {0x3a, 0x06, 0x1b, 0xbb}, {0x3b, 0x00, 0x95, 0xbb},
844 {0x3c, 0x04, 0xdb, 0xbb}, {0x57, 0x02, 0x00, 0xbb},
845 {0x58, 0x02, 0x66, 0xbb}, {0x59, 0x00, 0xff, 0xbb},
846 {0x5a, 0x01, 0x33, 0xbb}, {0x5c, 0x12, 0x0d, 0xbb},
847 {0x5d, 0x16, 0x11, 0xbb}, {0x64, 0x5e, 0x1c, 0xbb},
848 {0xf0, 0x00, 0x02, 0xbb}, {0x2f, 0xd1, 0x00, 0xbb},
849 {0x5b, 0x00, 0x01, 0xbb}, {0xf0, 0x00, 0x02, 0xbb},
850 {0x36, 0x68, 0x10, 0xbb}, {0x00, 0x00, 0x30, 0xdd},
851 {0x37, 0x82, 0x00, 0xbb}, {0xbc, 0x0e, 0x00, 0xcc},
852 {0xbc, 0x0f, 0x05, 0xcc}, {0xbc, 0x10, 0xc0, 0xcc},
853 {0xbc, 0x11, 0x03, 0xcc}, {0xb6, 0x00, 0x00, 0xcc},
854 {0xb6, 0x03, 0x05, 0xcc}, {0xb6, 0x02, 0x00, 0xcc},
855 {0xb6, 0x05, 0x04, 0xcc}, {0xb6, 0x04, 0x00, 0xcc},
856 {0xb6, 0x12, 0xf8, 0xcc}, {0xb6, 0x13, 0x29, 0xcc},
857 {0xb6, 0x18, 0x0a, 0xcc}, {0xb6, 0x17, 0x00, 0xcc},
858 {0xb6, 0x16, 0x00, 0xcc}, {0xb6, 0x22, 0x12, 0xcc},
859 {0xb6, 0x23, 0x0b, 0xcc}, {0xbf, 0xc0, 0x26, 0xcc},
860 {0xbf, 0xc1, 0x02, 0xcc}, {0xbf, 0xcc, 0x04, 0xcc},
861 {0xbc, 0x02, 0x18, 0xcc}, {0xbc, 0x03, 0x50, 0xcc},
862 {0xbc, 0x04, 0x18, 0xcc}, {0xbc, 0x05, 0x00, 0xcc},
863 {0xbc, 0x06, 0x00, 0xcc}, {0xbc, 0x08, 0x30, 0xcc},
864 {0xbc, 0x09, 0x40, 0xcc}, {0xbc, 0x0a, 0x10, 0xcc},
865 {0xbc, 0x0b, 0x00, 0xcc}, {0xbc, 0x0c, 0x00, 0xcc},
866 {0xb3, 0x5c, 0x01, 0xcc}, {0xb3, 0x01, 0x41, 0xcc},
867 {}
868};
Jean-Francois Moine8b605f12009-07-27 06:28:37 -0300869static const u8 mi1320_initQVGA_data[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300870 {0xb3, 0x01, 0x01, 0xcc}, {0x00, 0x00, 0x33, 0xdd},
871 {0xb0, 0x03, 0x19, 0xcc}, {0x00, 0x00, 0x33, 0xdd},
872 {0xb0, 0x04, 0x02, 0xcc}, {0x00, 0x00, 0x33, 0xdd},
873 {0xb3, 0x00, 0x64, 0xcc}, {0xb3, 0x00, 0x65, 0xcc},
874 {0xb0, 0x16, 0x03, 0xcc}, {0xb3, 0x05, 0x01, 0xcc},
875 {0xb3, 0x06, 0x01, 0xcc}, {0xb3, 0x08, 0x01, 0xcc},
876 {0xb3, 0x09, 0x0c, 0xcc}, {0xb3, 0x34, 0x02, 0xcc},
877 {0xb3, 0x35, 0xc8, 0xcc}, {0xb3, 0x02, 0x00, 0xcc},
878 {0xb3, 0x03, 0x0a, 0xcc}, {0xb3, 0x04, 0x05, 0xcc},
879 {0xb3, 0x20, 0x00, 0xcc}, {0xb3, 0x21, 0x00, 0xcc},
880 {0xb3, 0x22, 0x01, 0xcc}, {0xb3, 0x23, 0xe0, 0xcc},
881 {0xb3, 0x14, 0x00, 0xcc}, {0xb3, 0x15, 0x00, 0xcc},
882 {0xb3, 0x16, 0x02, 0xcc}, {0xb3, 0x17, 0x7f, 0xcc},
883 {0xb3, 0x00, 0x65, 0xcc}, {0xb8, 0x00, 0x00, 0xcc},
884 {0xbc, 0x00, 0xd0, 0xcc}, {0xbc, 0x01, 0x01, 0xcc},
885 {0xf0, 0x00, 0x00, 0xbb}, {0x0d, 0x00, 0x09, 0xbb},
886 {0x00, 0x01, 0x00, 0xdd}, {0x0d, 0x00, 0x08, 0xbb},
887 {0xf0, 0x00, 0x00, 0xbb}, {0x02, 0x00, 0x64, 0xbb},
888 {0x05, 0x01, 0x78, 0xbb}, {0x06, 0x00, 0x11, 0xbb},
889 {0x07, 0x01, 0x42, 0xbb}, {0x08, 0x00, 0x11, 0xbb},
890 {0x20, 0x01, 0x00, 0xbb}, {0x21, 0x80, 0x00, 0xbb},
891 {0x22, 0x0d, 0x0f, 0xbb}, {0x24, 0x80, 0x00, 0xbb},
892 {0x59, 0x00, 0xff, 0xbb}, {0xf0, 0x00, 0x01, 0xbb},
893 {0x9d, 0x3c, 0xa0, 0xbb}, {0x47, 0x30, 0x30, 0xbb},
894 {0xf0, 0x00, 0x00, 0xbb}, {0x0a, 0x80, 0x11, 0xbb},
895 {0x35, 0x00, 0x22, 0xbb}, {0xf0, 0x00, 0x02, 0xbb},
896 {0x9d, 0xc5, 0x05, 0xbb}, {0xdc, 0x0f, 0xfc, 0xbb},
897 {0xf0, 0x00, 0x01, 0xbb}, {0x06, 0x74, 0x0e, 0xbb},
898 {0x80, 0x00, 0x06, 0xbb}, {0x81, 0x04, 0x00, 0xbb},
899 {0x82, 0x01, 0x02, 0xbb}, {0x83, 0x03, 0x02, 0xbb},
900 {0x84, 0x05, 0x00, 0xbb}, {0x85, 0x01, 0x00, 0xbb},
901 {0x86, 0x03, 0x02, 0xbb}, {0x87, 0x05, 0x00, 0xbb},
902 {0x88, 0x01, 0x00, 0xbb}, {0x89, 0x02, 0x02, 0xbb},
903 {0x8a, 0xfd, 0x04, 0xbb}, {0x8b, 0xfc, 0xfd, 0xbb},
904 {0x8c, 0xff, 0xfd, 0xbb}, {0x8d, 0x00, 0x00, 0xbb},
905 {0x8e, 0xfe, 0x05, 0xbb}, {0x8f, 0xfc, 0xfd, 0xbb},
906 {0x90, 0xfe, 0xfd, 0xbb}, {0x91, 0x00, 0x00, 0xbb},
907 {0x92, 0xfe, 0x03, 0xbb}, {0x93, 0xfd, 0xfe, 0xbb},
908 {0x94, 0xff, 0xfd, 0xbb}, {0x95, 0x00, 0x00, 0xbb},
909 {0xb6, 0x07, 0x05, 0xbb}, {0xb7, 0x13, 0x06, 0xbb},
910 {0xb8, 0x08, 0x06, 0xbb}, {0xb9, 0x14, 0x08, 0xbb},
911 {0xba, 0x06, 0x05, 0xbb}, {0xbb, 0x13, 0x06, 0xbb},
912 {0xbc, 0x03, 0x01, 0xbb}, {0xbd, 0x03, 0x04, 0xbb},
913 {0xbe, 0x00, 0x02, 0xbb}, {0xbf, 0x03, 0x01, 0xbb},
914 {0xc0, 0x02, 0x04, 0xbb}, {0xc1, 0x00, 0x04, 0xbb},
915 {0xc2, 0x02, 0x01, 0xbb}, {0xc3, 0x01, 0x03, 0xbb},
916 {0xc4, 0x00, 0x04, 0xbb}, {0xf0, 0x00, 0x02, 0xbb},
917 {0xc8, 0x00, 0x00, 0xbb}, {0x2e, 0x00, 0x00, 0xbb},
918 {0x2e, 0x0c, 0x5b, 0xbb}, {0x2f, 0xd1, 0x00, 0xbb},
919 {0x39, 0x03, 0xca, 0xbb}, {0x3a, 0x06, 0x80, 0xbb},
920 {0x3b, 0x01, 0x52, 0xbb}, {0x3c, 0x05, 0x40, 0xbb},
921 {0x57, 0x01, 0x9c, 0xbb}, {0x58, 0x01, 0xee, 0xbb},
922 {0x59, 0x00, 0xf0, 0xbb}, {0x5a, 0x01, 0x20, 0xbb},
923 {0x5c, 0x1d, 0x17, 0xbb}, {0x5d, 0x22, 0x1c, 0xbb},
924 {0x64, 0x1e, 0x1c, 0xbb}, {0x5b, 0x00, 0x01, 0xbb},
925 {0xf0, 0x00, 0x02, 0xbb}, {0x36, 0x68, 0x10, 0xbb},
926 {0x00, 0x00, 0x30, 0xdd}, {0x37, 0x81, 0x00, 0xbb},
927 {0xbc, 0x02, 0x18, 0xcc}, {0xbc, 0x03, 0x50, 0xcc},
928 {0xbc, 0x04, 0x18, 0xcc}, {0xbc, 0x05, 0x00, 0xcc},
929 {0xbc, 0x06, 0x00, 0xcc}, {0xbc, 0x08, 0x30, 0xcc},
930 {0xbc, 0x09, 0x40, 0xcc}, {0xbc, 0x0a, 0x10, 0xcc},
931 {0xbc, 0x0b, 0x00, 0xcc}, {0xbc, 0x0c, 0x00, 0xcc},
932 {0xbf, 0xc0, 0x26, 0xcc}, {0xbf, 0xc1, 0x02, 0xcc},
933 {0xbf, 0xcc, 0x04, 0xcc}, {0xb3, 0x5c, 0x01, 0xcc},
934 {0xb3, 0x01, 0x41, 0xcc},
935 {}
936};
937
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -0300938static const u8 mi1320_soc_InitVGA[][4] = {
939 {0xb3, 0x01, 0x01, 0xcc},
940 {0xb0, 0x03, 0x19, 0xcc},
941 {0xb0, 0x04, 0x02, 0xcc},
942 {0x00, 0x00, 0x30, 0xdd},
943 {0xb3, 0x00, 0x64, 0xcc},
944 {0xb3, 0x00, 0x67, 0xcc},
945 {0xb3, 0x05, 0x01, 0xcc},
946 {0xb3, 0x06, 0x01, 0xcc},
947 {0xb3, 0x08, 0x01, 0xcc},
948 {0xb3, 0x09, 0x0c, 0xcc},
949 {0xb3, 0x34, 0x02, 0xcc},
Jean-Francois Moineff1cf402009-12-26 15:18:02 -0300950 {0xb3, 0x35, 0xc8, 0xcc}, /* i2c add: 48 */
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -0300951 {0xb3, 0x02, 0x00, 0xcc},
952 {0xb3, 0x03, 0x0a, 0xcc},
953 {0xb3, 0x04, 0x05, 0xcc},
954 {0xb3, 0x20, 0x00, 0xcc},
955 {0xb3, 0x21, 0x00, 0xcc},
956 {0xb3, 0x22, 0x01, 0xcc},
957 {0xb3, 0x23, 0xe0, 0xcc},
958 {0xb3, 0x14, 0x00, 0xcc},
959 {0xb3, 0x15, 0x00, 0xcc},
960 {0xb3, 0x16, 0x02, 0xcc},
961 {0xb3, 0x17, 0x7f, 0xcc},
962 {0xb3, 0x00, 0x67, 0xcc},
963 {0xb8, 0x00, 0x00, 0xcc},
964 {0xbc, 0x00, 0x71, 0xcc},
965 {0xbc, 0x01, 0x01, 0xcc},
966 {0xb3, 0x5c, 0x01, 0xcc},
967 {0xf0, 0x00, 0x02, 0xbb},
968 {0x00, 0x00, 0x10, 0xdd},
969 {0xc8, 0x00, 0x00, 0xbb},
970 {0x00, 0x00, 0x30, 0xdd},
971 {0xf0, 0x00, 0x00, 0xbb},
972 {0x00, 0x00, 0x10, 0xdd},
973 {0x07, 0x00, 0xe0, 0xbb},
974 {0x08, 0x00, 0x0b, 0xbb},
975 {0x21, 0x00, 0x0c, 0xbb},
Jean-Francois Moinee27188e2009-07-27 06:00:03 -0300976 {0x20, 0x01, 0x03, 0xbb}, /* h/v flip */
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -0300977 {0xbf, 0xc0, 0x26, 0xcc},
978 {0xbf, 0xc1, 0x02, 0xcc},
979 {0xbf, 0xcc, 0x04, 0xcc},
980 {0xb3, 0x01, 0x41, 0xcc},
981 {0xf0, 0x00, 0x00, 0xbb},
982 {0x05, 0x01, 0x78, 0xbb},
983 {0x06, 0x00, 0x11, 0xbb},
984 {0x07, 0x01, 0x42, 0xbb},
985 {0x08, 0x00, 0x11, 0xbb},
Jean-Francois Moinee27188e2009-07-27 06:00:03 -0300986 {0x20, 0x01, 0x03, 0xbb}, /* h/v flip */
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -0300987 {0x21, 0x80, 0x00, 0xbb},
988 {0x22, 0x0d, 0x0f, 0xbb},
989 {0x24, 0x80, 0x00, 0xbb},
990 {0x59, 0x00, 0xff, 0xbb},
991 {0xf0, 0x00, 0x02, 0xbb},
992 {0x39, 0x03, 0xca, 0xbb},
993 {0x3a, 0x06, 0x80, 0xbb},
994 {0x3b, 0x01, 0x52, 0xbb},
995 {0x3c, 0x05, 0x40, 0xbb},
996 {0x57, 0x01, 0x9c, 0xbb},
997 {0x58, 0x01, 0xee, 0xbb},
998 {0x59, 0x00, 0xf0, 0xbb},
999 {0x5a, 0x01, 0x20, 0xbb},
1000 {0x5c, 0x1d, 0x17, 0xbb},
1001 {0x5d, 0x22, 0x1c, 0xbb},
1002 {0x64, 0x1e, 0x1c, 0xbb},
1003 {0x5b, 0x00, 0x00, 0xbb},
1004 {0xf0, 0x00, 0x02, 0xbb},
1005 {0x22, 0xa0, 0x78, 0xbb},
1006 {0x23, 0xa0, 0x78, 0xbb},
1007 {0x24, 0x7f, 0x00, 0xbb},
1008 {0x28, 0xea, 0x02, 0xbb},
1009 {0x29, 0x86, 0x7a, 0xbb},
1010 {0x5e, 0x52, 0x4c, 0xbb},
1011 {0x5f, 0x20, 0x24, 0xbb},
1012 {0x60, 0x00, 0x02, 0xbb},
1013 {0x02, 0x00, 0xee, 0xbb},
1014 {0x03, 0x39, 0x23, 0xbb},
1015 {0x04, 0x07, 0x24, 0xbb},
1016 {0x09, 0x00, 0xc0, 0xbb},
1017 {0x0a, 0x00, 0x79, 0xbb},
1018 {0x0b, 0x00, 0x04, 0xbb},
1019 {0x0c, 0x00, 0x5c, 0xbb},
1020 {0x0d, 0x00, 0xd9, 0xbb},
1021 {0x0e, 0x00, 0x53, 0xbb},
1022 {0x0f, 0x00, 0x21, 0xbb},
1023 {0x10, 0x00, 0xa4, 0xbb},
1024 {0x11, 0x00, 0xe5, 0xbb},
1025 {0x15, 0x00, 0x00, 0xbb},
1026 {0x16, 0x00, 0x00, 0xbb},
1027 {0x17, 0x00, 0x00, 0xbb},
1028 {0x18, 0x00, 0x00, 0xbb},
1029 {0x19, 0x00, 0x00, 0xbb},
1030 {0x1a, 0x00, 0x00, 0xbb},
1031 {0x1b, 0x00, 0x00, 0xbb},
1032 {0x1c, 0x00, 0x00, 0xbb},
1033 {0x1d, 0x00, 0x00, 0xbb},
1034 {0x1e, 0x00, 0x00, 0xbb},
1035 {0xf0, 0x00, 0x01, 0xbb},
1036 {0x06, 0xe0, 0x0e, 0xbb},
1037 {0x06, 0x60, 0x0e, 0xbb},
1038 {0xb3, 0x5c, 0x01, 0xcc},
1039 {}
1040};
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -03001041static const u8 mi1320_soc_InitQVGA[][4] = {
1042 {0xb3, 0x01, 0x01, 0xcc},
1043 {0xb0, 0x03, 0x19, 0xcc},
1044 {0xb0, 0x04, 0x02, 0xcc},
1045 {0x00, 0x00, 0x30, 0xdd},
1046 {0xb3, 0x00, 0x64, 0xcc},
1047 {0xb3, 0x00, 0x67, 0xcc},
1048 {0xb3, 0x05, 0x01, 0xcc},
1049 {0xb3, 0x06, 0x01, 0xcc},
1050 {0xb3, 0x08, 0x01, 0xcc},
1051 {0xb3, 0x09, 0x0c, 0xcc},
1052 {0xb3, 0x34, 0x02, 0xcc},
1053 {0xb3, 0x35, 0xc8, 0xcc},
1054 {0xb3, 0x02, 0x00, 0xcc},
1055 {0xb3, 0x03, 0x0a, 0xcc},
1056 {0xb3, 0x04, 0x05, 0xcc},
1057 {0xb3, 0x20, 0x00, 0xcc},
1058 {0xb3, 0x21, 0x00, 0xcc},
1059 {0xb3, 0x22, 0x01, 0xcc},
1060 {0xb3, 0x23, 0xe0, 0xcc},
1061 {0xb3, 0x14, 0x00, 0xcc},
1062 {0xb3, 0x15, 0x00, 0xcc},
1063 {0xb3, 0x16, 0x02, 0xcc},
1064 {0xb3, 0x17, 0x7f, 0xcc},
1065 {0xb3, 0x00, 0x67, 0xcc},
1066 {0xb8, 0x00, 0x00, 0xcc},
1067 {0xbc, 0x00, 0xd1, 0xcc},
1068 {0xbc, 0x01, 0x01, 0xcc},
1069 {0xb3, 0x5c, 0x01, 0xcc},
1070 {0xf0, 0x00, 0x02, 0xbb},
1071 {0x00, 0x00, 0x10, 0xdd},
1072 {0xc8, 0x00, 0x00, 0xbb},
1073 {0x00, 0x00, 0x30, 0xdd},
1074 {0xf0, 0x00, 0x00, 0xbb},
1075 {0x00, 0x00, 0x10, 0xdd},
1076 {0x07, 0x00, 0xe0, 0xbb},
1077 {0x08, 0x00, 0x0b, 0xbb},
1078 {0x21, 0x00, 0x0c, 0xbb},
Jean-Francois Moinee27188e2009-07-27 06:00:03 -03001079 {0x20, 0x01, 0x03, 0xbb}, /* h/v flip */
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -03001080 {0xbf, 0xc0, 0x26, 0xcc},
1081 {0xbf, 0xc1, 0x02, 0xcc},
1082 {0xbf, 0xcc, 0x04, 0xcc},
1083 {0xbc, 0x02, 0x18, 0xcc},
1084 {0xbc, 0x03, 0x50, 0xcc},
1085 {0xbc, 0x04, 0x18, 0xcc},
1086 {0xbc, 0x05, 0x00, 0xcc},
1087 {0xbc, 0x06, 0x00, 0xcc},
1088 {0xbc, 0x08, 0x30, 0xcc},
1089 {0xbc, 0x09, 0x40, 0xcc},
1090 {0xbc, 0x0a, 0x10, 0xcc},
1091 {0xbc, 0x0b, 0x00, 0xcc},
1092 {0xbc, 0x0c, 0x00, 0xcc},
1093 {0xb3, 0x01, 0x41, 0xcc},
1094 {0xf0, 0x00, 0x00, 0xbb},
1095 {0x05, 0x01, 0x78, 0xbb},
1096 {0x06, 0x00, 0x11, 0xbb},
1097 {0x07, 0x01, 0x42, 0xbb},
1098 {0x08, 0x00, 0x11, 0xbb},
Jean-Francois Moinee27188e2009-07-27 06:00:03 -03001099 {0x20, 0x01, 0x03, 0xbb}, /* h/v flip */
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -03001100 {0x21, 0x80, 0x00, 0xbb},
1101 {0x22, 0x0d, 0x0f, 0xbb},
1102 {0x24, 0x80, 0x00, 0xbb},
1103 {0x59, 0x00, 0xff, 0xbb},
1104 {0xf0, 0x00, 0x02, 0xbb},
1105 {0x39, 0x03, 0xca, 0xbb},
1106 {0x3a, 0x06, 0x80, 0xbb},
1107 {0x3b, 0x01, 0x52, 0xbb},
1108 {0x3c, 0x05, 0x40, 0xbb},
1109 {0x57, 0x01, 0x9c, 0xbb},
1110 {0x58, 0x01, 0xee, 0xbb},
1111 {0x59, 0x00, 0xf0, 0xbb},
1112 {0x5a, 0x01, 0x20, 0xbb},
1113 {0x5c, 0x1d, 0x17, 0xbb},
1114 {0x5d, 0x22, 0x1c, 0xbb},
1115 {0x64, 0x1e, 0x1c, 0xbb},
1116 {0x5b, 0x00, 0x00, 0xbb},
1117 {0xf0, 0x00, 0x02, 0xbb},
1118 {0x22, 0xa0, 0x78, 0xbb},
1119 {0x23, 0xa0, 0x78, 0xbb},
1120 {0x24, 0x7f, 0x00, 0xbb},
1121 {0x28, 0xea, 0x02, 0xbb},
1122 {0x29, 0x86, 0x7a, 0xbb},
1123 {0x5e, 0x52, 0x4c, 0xbb},
1124 {0x5f, 0x20, 0x24, 0xbb},
1125 {0x60, 0x00, 0x02, 0xbb},
1126 {0x02, 0x00, 0xee, 0xbb},
1127 {0x03, 0x39, 0x23, 0xbb},
1128 {0x04, 0x07, 0x24, 0xbb},
1129 {0x09, 0x00, 0xc0, 0xbb},
1130 {0x0a, 0x00, 0x79, 0xbb},
1131 {0x0b, 0x00, 0x04, 0xbb},
1132 {0x0c, 0x00, 0x5c, 0xbb},
1133 {0x0d, 0x00, 0xd9, 0xbb},
1134 {0x0e, 0x00, 0x53, 0xbb},
1135 {0x0f, 0x00, 0x21, 0xbb},
1136 {0x10, 0x00, 0xa4, 0xbb},
1137 {0x11, 0x00, 0xe5, 0xbb},
1138 {0x15, 0x00, 0x00, 0xbb},
1139 {0x16, 0x00, 0x00, 0xbb},
1140 {0x17, 0x00, 0x00, 0xbb},
1141 {0x18, 0x00, 0x00, 0xbb},
1142 {0x19, 0x00, 0x00, 0xbb},
1143 {0x1a, 0x00, 0x00, 0xbb},
1144 {0x1b, 0x00, 0x00, 0xbb},
1145 {0x1c, 0x00, 0x00, 0xbb},
1146 {0x1d, 0x00, 0x00, 0xbb},
1147 {0x1e, 0x00, 0x00, 0xbb},
1148 {0xf0, 0x00, 0x01, 0xbb},
1149 {0x06, 0xe0, 0x0e, 0xbb},
1150 {0x06, 0x60, 0x0e, 0xbb},
1151 {0xb3, 0x5c, 0x01, 0xcc},
1152 {}
1153};
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -03001154static const u8 mi1320_soc_InitSXGA[][4] = {
1155 {0xb3, 0x01, 0x01, 0xcc},
1156 {0xb0, 0x03, 0x19, 0xcc},
1157 {0x00, 0x00, 0x30, 0xdd},
1158 {0xb3, 0x00, 0x64, 0xcc},
1159 {0xb3, 0x00, 0x67, 0xcc},
1160 {0xb3, 0x05, 0x01, 0xcc},
1161 {0xb3, 0x06, 0x01, 0xcc},
1162 {0xb3, 0x08, 0x01, 0xcc},
1163 {0xb3, 0x09, 0x0c, 0xcc},
1164 {0xb3, 0x34, 0x02, 0xcc},
1165 {0xb3, 0x35, 0xc8, 0xcc},
1166 {0xb3, 0x02, 0x00, 0xcc},
1167 {0xb3, 0x03, 0x0a, 0xcc},
1168 {0xb3, 0x04, 0x05, 0xcc},
1169 {0xb3, 0x20, 0x00, 0xcc},
1170 {0xb3, 0x21, 0x00, 0xcc},
1171 {0xb3, 0x22, 0x04, 0xcc},
1172 {0xb3, 0x23, 0x00, 0xcc},
1173 {0xb3, 0x14, 0x00, 0xcc},
1174 {0xb3, 0x15, 0x00, 0xcc},
1175 {0xb3, 0x16, 0x04, 0xcc},
1176 {0xb3, 0x17, 0xff, 0xcc},
1177 {0xb3, 0x00, 0x67, 0xcc},
1178 {0xbc, 0x00, 0x71, 0xcc},
1179 {0xbc, 0x01, 0x01, 0xcc},
1180 {0xb3, 0x5c, 0x01, 0xcc},
1181 {0xf0, 0x00, 0x02, 0xbb},
1182 {0x00, 0x00, 0x30, 0xdd},
1183 {0xc8, 0x9f, 0x0b, 0xbb},
1184 {0x00, 0x00, 0x20, 0xdd},
1185 {0x5b, 0x00, 0x01, 0xbb},
1186 {0x00, 0x00, 0x20, 0xdd},
1187 {0xf0, 0x00, 0x00, 0xbb},
1188 {0x00, 0x00, 0x30, 0xdd},
Jean-Francois Moinee27188e2009-07-27 06:00:03 -03001189 {0x20, 0x01, 0x03, 0xbb}, /* h/v flip */
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -03001190 {0x00, 0x00, 0x20, 0xdd},
1191 {0xbf, 0xc0, 0x26, 0xcc},
1192 {0xbf, 0xc1, 0x02, 0xcc},
1193 {0xbf, 0xcc, 0x04, 0xcc},
1194 {0xb3, 0x01, 0x41, 0xcc},
1195 {0xf0, 0x00, 0x00, 0xbb},
1196 {0x05, 0x01, 0x78, 0xbb},
1197 {0x06, 0x00, 0x11, 0xbb},
1198 {0x07, 0x01, 0x42, 0xbb},
1199 {0x08, 0x00, 0x11, 0xbb},
Jean-Francois Moinee27188e2009-07-27 06:00:03 -03001200 {0x20, 0x01, 0x03, 0xbb}, /* h/v flip */
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -03001201 {0x21, 0x80, 0x00, 0xbb},
1202 {0x22, 0x0d, 0x0f, 0xbb},
1203 {0x24, 0x80, 0x00, 0xbb},
1204 {0x59, 0x00, 0xff, 0xbb},
1205 {0xf0, 0x00, 0x02, 0xbb},
1206 {0x39, 0x03, 0xca, 0xbb},
1207 {0x3a, 0x06, 0x80, 0xbb},
1208 {0x3b, 0x01, 0x52, 0xbb},
1209 {0x3c, 0x05, 0x40, 0xbb},
1210 {0x57, 0x01, 0x9c, 0xbb},
1211 {0x58, 0x01, 0xee, 0xbb},
1212 {0x59, 0x00, 0xf0, 0xbb},
1213 {0x5a, 0x01, 0x20, 0xbb},
1214 {0x5c, 0x1d, 0x17, 0xbb},
1215 {0x5d, 0x22, 0x1c, 0xbb},
1216 {0x64, 0x1e, 0x1c, 0xbb},
1217 {0x5b, 0x00, 0x00, 0xbb},
1218 {0xf0, 0x00, 0x02, 0xbb},
1219 {0x22, 0xa0, 0x78, 0xbb},
1220 {0x23, 0xa0, 0x78, 0xbb},
1221 {0x24, 0x7f, 0x00, 0xbb},
1222 {0x28, 0xea, 0x02, 0xbb},
1223 {0x29, 0x86, 0x7a, 0xbb},
1224 {0x5e, 0x52, 0x4c, 0xbb},
1225 {0x5f, 0x20, 0x24, 0xbb},
1226 {0x60, 0x00, 0x02, 0xbb},
1227 {0x02, 0x00, 0xee, 0xbb},
1228 {0x03, 0x39, 0x23, 0xbb},
1229 {0x04, 0x07, 0x24, 0xbb},
1230 {0x09, 0x00, 0xc0, 0xbb},
1231 {0x0a, 0x00, 0x79, 0xbb},
1232 {0x0b, 0x00, 0x04, 0xbb},
1233 {0x0c, 0x00, 0x5c, 0xbb},
1234 {0x0d, 0x00, 0xd9, 0xbb},
1235 {0x0e, 0x00, 0x53, 0xbb},
1236 {0x0f, 0x00, 0x21, 0xbb},
1237 {0x10, 0x00, 0xa4, 0xbb},
1238 {0x11, 0x00, 0xe5, 0xbb},
1239 {0x15, 0x00, 0x00, 0xbb},
1240 {0x16, 0x00, 0x00, 0xbb},
1241 {0x17, 0x00, 0x00, 0xbb},
1242 {0x18, 0x00, 0x00, 0xbb},
1243 {0x19, 0x00, 0x00, 0xbb},
1244 {0x1a, 0x00, 0x00, 0xbb},
1245 {0x1b, 0x00, 0x00, 0xbb},
1246 {0x1c, 0x00, 0x00, 0xbb},
1247 {0x1d, 0x00, 0x00, 0xbb},
1248 {0x1e, 0x00, 0x00, 0xbb},
1249 {0xf0, 0x00, 0x01, 0xbb},
1250 {0x06, 0xe0, 0x0e, 0xbb},
1251 {0x06, 0x60, 0x0e, 0xbb},
1252 {0xb3, 0x5c, 0x01, 0xcc},
1253 {0xf0, 0x00, 0x00, 0xbb},
1254 {0x05, 0x01, 0x13, 0xbb},
1255 {0x06, 0x00, 0x11, 0xbb},
1256 {0x07, 0x00, 0x85, 0xbb},
1257 {0x08, 0x00, 0x27, 0xbb},
Jean-Francois Moinee27188e2009-07-27 06:00:03 -03001258 {0x20, 0x01, 0x03, 0xbb}, /* h/v flip */
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -03001259 {0x21, 0x80, 0x00, 0xbb},
1260 {0x22, 0x0d, 0x0f, 0xbb},
1261 {0x24, 0x80, 0x00, 0xbb},
1262 {0x59, 0x00, 0xff, 0xbb},
1263 {0xf0, 0x00, 0x02, 0xbb},
1264 {0x39, 0x03, 0x0d, 0xbb},
1265 {0x3a, 0x06, 0x1b, 0xbb},
1266 {0x3b, 0x00, 0x95, 0xbb},
1267 {0x3c, 0x04, 0xdb, 0xbb},
1268 {0x57, 0x02, 0x00, 0xbb},
1269 {0x58, 0x02, 0x66, 0xbb},
1270 {0x59, 0x00, 0xff, 0xbb},
1271 {0x5a, 0x01, 0x33, 0xbb},
1272 {0x5c, 0x12, 0x0d, 0xbb},
1273 {0x5d, 0x16, 0x11, 0xbb},
1274 {0x64, 0x5e, 0x1c, 0xbb},
1275 {}
1276};
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03001277static const u8 po3130_gamma[17] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001278 0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
1279 0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
1280};
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03001281static const u8 po3130_matrix[9] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001282 0x5f, 0xec, 0xf5, 0xf1, 0x5a, 0xf5, 0xf1, 0xec, 0x63
1283};
1284
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03001285static const u8 po3130_initVGA_data[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001286 {0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc},
1287 {0x00, 0x00, 0x50, 0xdd}, {0xb0, 0x03, 0x01, 0xcc},
1288 {0xb3, 0x00, 0x04, 0xcc}, {0xb3, 0x00, 0x24, 0xcc},
1289 {0xb3, 0x00, 0x25, 0xcc}, {0xb3, 0x08, 0x01, 0xcc},
1290 {0xb3, 0x09, 0x0c, 0xcc}, {0xb3, 0x05, 0x00, 0xcc},
1291 {0xb3, 0x06, 0x01, 0xcc}, {0xb3, 0x03, 0x1a, 0xcc},
1292 {0xb3, 0x04, 0x15, 0xcc}, {0xb3, 0x20, 0x00, 0xcc},
1293 {0xb3, 0x21, 0x00, 0xcc}, {0xb3, 0x22, 0x01, 0xcc},
1294 {0xb3, 0x23, 0xe8, 0xcc}, {0xb8, 0x08, 0xe8, 0xcc},
1295 {0xb3, 0x14, 0x00, 0xcc}, {0xb3, 0x15, 0x00, 0xcc},
1296 {0xb3, 0x16, 0x02, 0xcc}, {0xb3, 0x17, 0x7f, 0xcc},
Jean-Francois Moineff1cf402009-12-26 15:18:02 -03001297 {0xb3, 0x34, 0x01, 0xcc},
1298 {0xb3, 0x35, 0xf6, 0xcc}, /* i2c add: 76 */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001299 {0xb3, 0x00, 0x27, 0xcc}, {0xbc, 0x00, 0x71, 0xcc},
1300 {0xb8, 0x00, 0x21, 0xcc}, {0xb8, 0x27, 0x20, 0xcc},
1301 {0xb8, 0x01, 0x79, 0xcc}, {0xb8, 0x81, 0x09, 0xcc},
1302 {0xb8, 0x2c, 0x50, 0xcc}, {0xb8, 0x2d, 0xf8, 0xcc},
1303 {0xb8, 0x2e, 0xf8, 0xcc}, {0xb8, 0x2f, 0xf8, 0xcc},
1304 {0xb8, 0x30, 0x50, 0xcc}, {0xb8, 0x31, 0xf8, 0xcc},
1305 {0xb8, 0x32, 0xf8, 0xcc}, {0xb8, 0x33, 0xf8, 0xcc},
1306 {0xb8, 0x34, 0x50, 0xcc}, {0xb8, 0x35, 0x00, 0xcc},
1307 {0xb8, 0x36, 0x00, 0xcc}, {0xb8, 0x37, 0x00, 0xcc},
1308 {0x00, 0x1e, 0xc6, 0xaa}, {0x00, 0x20, 0x44, 0xaa},
1309 {0x00, 0xad, 0x02, 0xaa}, {0x00, 0xae, 0x2c, 0xaa},
1310 {0x00, 0x12, 0x08, 0xaa}, {0x00, 0x17, 0x41, 0xaa},
1311 {0x00, 0x19, 0x41, 0xaa}, {0x00, 0x1e, 0x06, 0xaa},
1312 {0x00, 0x21, 0x00, 0xaa}, {0x00, 0x36, 0xc0, 0xaa},
1313 {0x00, 0x37, 0xc8, 0xaa}, {0x00, 0x3b, 0x36, 0xaa},
1314 {0x00, 0x4b, 0xfe, 0xaa}, {0x00, 0x51, 0x1c, 0xaa},
1315 {0x00, 0x52, 0x01, 0xaa}, {0x00, 0x55, 0x0a, 0xaa},
1316 {0x00, 0x59, 0x02, 0xaa}, {0x00, 0x5a, 0x04, 0xaa},
1317 {0x00, 0x5c, 0x10, 0xaa}, {0x00, 0x5d, 0x10, 0xaa},
1318 {0x00, 0x5e, 0x10, 0xaa}, {0x00, 0x5f, 0x10, 0xaa},
1319 {0x00, 0x61, 0x00, 0xaa}, {0x00, 0x62, 0x18, 0xaa},
1320 {0x00, 0x63, 0x30, 0xaa}, {0x00, 0x70, 0x68, 0xaa},
1321 {0x00, 0x80, 0x71, 0xaa}, {0x00, 0x81, 0x08, 0xaa},
1322 {0x00, 0x82, 0x00, 0xaa}, {0x00, 0x83, 0x55, 0xaa},
1323 {0x00, 0x84, 0x06, 0xaa}, {0x00, 0x85, 0x06, 0xaa},
1324 {0x00, 0x86, 0x13, 0xaa}, {0x00, 0x87, 0x18, 0xaa},
1325 {0x00, 0xaa, 0x3f, 0xaa}, {0x00, 0xab, 0x44, 0xaa},
1326 {0x00, 0xb0, 0x68, 0xaa}, {0x00, 0xb5, 0x10, 0xaa},
1327 {0x00, 0xb8, 0x20, 0xaa}, {0x00, 0xb9, 0xa0, 0xaa},
1328 {0x00, 0xbc, 0x04, 0xaa}, {0x00, 0x8b, 0x40, 0xaa},
1329 {0x00, 0x8c, 0x91, 0xaa}, {0x00, 0x8d, 0x8f, 0xaa},
1330 {0x00, 0x8e, 0x91, 0xaa}, {0x00, 0x8f, 0x43, 0xaa},
1331 {0x00, 0x90, 0x92, 0xaa}, {0x00, 0x91, 0x89, 0xaa},
1332 {0x00, 0x92, 0x9d, 0xaa}, {0x00, 0x93, 0x46, 0xaa},
1333 {0x00, 0xd6, 0x22, 0xaa}, {0x00, 0x73, 0x00, 0xaa},
1334 {0x00, 0x74, 0x10, 0xaa}, {0x00, 0x75, 0x20, 0xaa},
1335 {0x00, 0x76, 0x2b, 0xaa}, {0x00, 0x77, 0x36, 0xaa},
1336 {0x00, 0x78, 0x49, 0xaa}, {0x00, 0x79, 0x5a, 0xaa},
1337 {0x00, 0x7a, 0x7f, 0xaa}, {0x00, 0x7b, 0x9b, 0xaa},
1338 {0x00, 0x7c, 0xba, 0xaa}, {0x00, 0x7d, 0xd4, 0xaa},
1339 {0x00, 0x7e, 0xea, 0xaa}, {0x00, 0xd6, 0x62, 0xaa},
1340 {0x00, 0x73, 0x00, 0xaa}, {0x00, 0x74, 0x10, 0xaa},
1341 {0x00, 0x75, 0x20, 0xaa}, {0x00, 0x76, 0x2b, 0xaa},
1342 {0x00, 0x77, 0x36, 0xaa}, {0x00, 0x78, 0x49, 0xaa},
1343 {0x00, 0x79, 0x5a, 0xaa}, {0x00, 0x7a, 0x7f, 0xaa},
1344 {0x00, 0x7b, 0x9b, 0xaa}, {0x00, 0x7c, 0xba, 0xaa},
1345 {0x00, 0x7d, 0xd4, 0xaa}, {0x00, 0x7e, 0xea, 0xaa},
1346 {0x00, 0xd6, 0xa2, 0xaa}, {0x00, 0x73, 0x00, 0xaa},
1347 {0x00, 0x74, 0x10, 0xaa}, {0x00, 0x75, 0x20, 0xaa},
1348 {0x00, 0x76, 0x2b, 0xaa}, {0x00, 0x77, 0x36, 0xaa},
1349 {0x00, 0x78, 0x49, 0xaa}, {0x00, 0x79, 0x5a, 0xaa},
1350 {0x00, 0x7a, 0x7f, 0xaa}, {0x00, 0x7b, 0x9b, 0xaa},
1351 {0x00, 0x7c, 0xba, 0xaa}, {0x00, 0x7d, 0xd4, 0xaa},
1352 {0x00, 0x7e, 0xea, 0xaa},
1353 {0x00, 0x4c, 0x07, 0xaa},
1354 {0x00, 0x4b, 0xe0, 0xaa}, {0x00, 0x4e, 0x77, 0xaa},
1355 {0x00, 0x59, 0x02, 0xaa}, {0x00, 0x4d, 0x0a, 0xaa},
1356/* {0x00, 0xd1, 0x00, 0xaa}, {0x00, 0x20, 0xc4, 0xaa},
1357 {0xb8, 0x8e, 0x00, 0xcc}, {0xb8, 0x8f, 0xff, 0xcc}, */
1358 {0x00, 0xd1, 0x3c, 0xaa}, {0x00, 0x20, 0xc4, 0xaa},
1359 {0xb8, 0x8e, 0x00, 0xcc}, {0xb8, 0x8f, 0xff, 0xcc},
1360 {0xb8, 0xfe, 0x00, 0xcc}, {0xb8, 0xff, 0x28, 0xcc},
1361 {0xb9, 0x00, 0x28, 0xcc}, {0xb9, 0x01, 0x28, 0xcc},
1362 {0xb9, 0x02, 0x28, 0xcc}, {0xb9, 0x03, 0x00, 0xcc},
1363 {0xb9, 0x04, 0x00, 0xcc}, {0xb9, 0x05, 0x3c, 0xcc},
1364 {0xb9, 0x06, 0x3c, 0xcc}, {0xb9, 0x07, 0x3c, 0xcc},
1365 {0xb9, 0x08, 0x3c, 0xcc}, {0x00, 0x05, 0x00, 0xaa},
1366 {0xb3, 0x5c, 0x00, 0xcc}, {0xb3, 0x01, 0x41, 0xcc},
1367 {}
1368};
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03001369static const u8 po3130_rundata[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001370 {0x00, 0x47, 0x45, 0xaa}, {0x00, 0x48, 0x9b, 0xaa},
1371 {0x00, 0x49, 0x3a, 0xaa}, {0x00, 0x4a, 0x01, 0xaa},
1372 {0x00, 0x44, 0x40, 0xaa},
1373/* {0x00, 0xd5, 0x7c, 0xaa}, */
1374 {0x00, 0xad, 0x04, 0xaa}, {0x00, 0xae, 0x00, 0xaa},
1375 {0x00, 0xb0, 0x78, 0xaa}, {0x00, 0x98, 0x02, 0xaa},
1376 {0x00, 0x94, 0x25, 0xaa}, {0x00, 0x95, 0x25, 0xaa},
1377 {0x00, 0x59, 0x68, 0xaa}, {0x00, 0x44, 0x20, 0xaa},
1378 {0x00, 0x17, 0x50, 0xaa}, {0x00, 0x19, 0x50, 0xaa},
1379 {0x00, 0xd1, 0x3c, 0xaa}, {0x00, 0xd1, 0x3c, 0xaa},
1380 {0x00, 0x1e, 0x06, 0xaa}, {0x00, 0x1e, 0x06, 0xaa},
1381 {}
1382};
1383
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03001384static const u8 po3130_initQVGA_data[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001385 {0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc},
1386 {0x00, 0x00, 0x50, 0xdd}, {0xb0, 0x03, 0x09, 0xcc},
1387 {0xb3, 0x00, 0x04, 0xcc}, {0xb3, 0x00, 0x24, 0xcc},
1388 {0xb3, 0x00, 0x25, 0xcc}, {0xb3, 0x08, 0x01, 0xcc},
1389 {0xb3, 0x09, 0x0c, 0xcc}, {0xb3, 0x05, 0x00, 0xcc},
1390 {0xb3, 0x06, 0x01, 0xcc}, {0xb3, 0x03, 0x1a, 0xcc},
1391 {0xb3, 0x04, 0x15, 0xcc}, {0xb3, 0x20, 0x00, 0xcc},
1392 {0xb3, 0x21, 0x00, 0xcc}, {0xb3, 0x22, 0x01, 0xcc},
1393 {0xb3, 0x23, 0xe0, 0xcc}, {0xb8, 0x08, 0xe0, 0xcc},
1394 {0xb3, 0x14, 0x00, 0xcc}, {0xb3, 0x15, 0x00, 0xcc},
1395 {0xb3, 0x16, 0x02, 0xcc}, {0xb3, 0x17, 0x7f, 0xcc},
1396 {0xb3, 0x34, 0x01, 0xcc}, {0xb3, 0x35, 0xf6, 0xcc},
1397 {0xb3, 0x00, 0x27, 0xcc}, {0xbc, 0x00, 0xd1, 0xcc},
1398 {0xb8, 0x00, 0x21, 0xcc}, {0xb8, 0x27, 0x20, 0xcc},
1399 {0xb8, 0x01, 0x79, 0xcc}, {0xb8, 0x81, 0x09, 0xcc},
1400 {0xb8, 0x2c, 0x50, 0xcc}, {0xb8, 0x2d, 0xf8, 0xcc},
1401 {0xb8, 0x2e, 0xf8, 0xcc}, {0xb8, 0x2f, 0xf8, 0xcc},
1402 {0xb8, 0x30, 0x50, 0xcc}, {0xb8, 0x31, 0xf8, 0xcc},
1403 {0xb8, 0x32, 0xf8, 0xcc}, {0xb8, 0x33, 0xf8, 0xcc},
1404 {0xb8, 0x34, 0x50, 0xcc}, {0xb8, 0x35, 0x00, 0xcc},
1405 {0xb8, 0x36, 0x00, 0xcc}, {0xb8, 0x37, 0x00, 0xcc},
1406 {0x00, 0x1e, 0xc6, 0xaa}, {0x00, 0x20, 0x44, 0xaa},
1407 {0x00, 0xad, 0x02, 0xaa}, {0x00, 0xae, 0x2c, 0xaa},
1408 {0x00, 0x12, 0x08, 0xaa}, {0x00, 0x17, 0x41, 0xaa},
1409 {0x00, 0x19, 0x41, 0xaa}, {0x00, 0x1e, 0x06, 0xaa},
1410 {0x00, 0x21, 0x00, 0xaa}, {0x00, 0x36, 0xc0, 0xaa},
1411 {0x00, 0x37, 0xc8, 0xaa}, {0x00, 0x3b, 0x36, 0xaa},
1412 {0x00, 0x4b, 0xfe, 0xaa}, {0x00, 0x51, 0x1c, 0xaa},
1413 {0x00, 0x52, 0x01, 0xaa}, {0x00, 0x55, 0x0a, 0xaa},
1414 {0x00, 0x59, 0x6f, 0xaa}, {0x00, 0x5a, 0x04, 0xaa},
1415 {0x00, 0x5c, 0x10, 0xaa}, {0x00, 0x5d, 0x10, 0xaa},
1416 {0x00, 0x5e, 0x10, 0xaa}, {0x00, 0x5f, 0x10, 0xaa},
1417 {0x00, 0x61, 0x00, 0xaa}, {0x00, 0x62, 0x18, 0xaa},
1418 {0x00, 0x63, 0x30, 0xaa}, {0x00, 0x70, 0x68, 0xaa},
1419 {0x00, 0x80, 0x71, 0xaa}, {0x00, 0x81, 0x08, 0xaa},
1420 {0x00, 0x82, 0x00, 0xaa}, {0x00, 0x83, 0x55, 0xaa},
1421 {0x00, 0x84, 0x06, 0xaa}, {0x00, 0x85, 0x06, 0xaa},
1422 {0x00, 0x86, 0x13, 0xaa}, {0x00, 0x87, 0x18, 0xaa},
1423 {0x00, 0xaa, 0x3f, 0xaa}, {0x00, 0xab, 0x44, 0xaa},
1424 {0x00, 0xb0, 0x68, 0xaa}, {0x00, 0xb5, 0x10, 0xaa},
1425 {0x00, 0xb8, 0x20, 0xaa}, {0x00, 0xb9, 0xa0, 0xaa},
1426 {0x00, 0xbc, 0x04, 0xaa}, {0x00, 0x8b, 0x40, 0xaa},
1427 {0x00, 0x8c, 0x91, 0xaa}, {0x00, 0x8d, 0x8f, 0xaa},
1428 {0x00, 0x8e, 0x91, 0xaa}, {0x00, 0x8f, 0x43, 0xaa},
1429 {0x00, 0x90, 0x92, 0xaa}, {0x00, 0x91, 0x89, 0xaa},
1430 {0x00, 0x92, 0x9d, 0xaa}, {0x00, 0x93, 0x46, 0xaa},
1431 {0x00, 0xd6, 0x22, 0xaa}, {0x00, 0x73, 0x00, 0xaa},
1432 {0x00, 0x74, 0x10, 0xaa}, {0x00, 0x75, 0x20, 0xaa},
1433 {0x00, 0x76, 0x2b, 0xaa}, {0x00, 0x77, 0x36, 0xaa},
1434 {0x00, 0x78, 0x49, 0xaa}, {0x00, 0x79, 0x5a, 0xaa},
1435 {0x00, 0x7a, 0x7f, 0xaa}, {0x00, 0x7b, 0x9b, 0xaa},
1436 {0x00, 0x7c, 0xba, 0xaa}, {0x00, 0x7d, 0xd4, 0xaa},
1437 {0x00, 0x7e, 0xea, 0xaa}, {0x00, 0xd6, 0x62, 0xaa},
1438 {0x00, 0x73, 0x00, 0xaa}, {0x00, 0x74, 0x10, 0xaa},
1439 {0x00, 0x75, 0x20, 0xaa}, {0x00, 0x76, 0x2b, 0xaa},
1440 {0x00, 0x77, 0x36, 0xaa}, {0x00, 0x78, 0x49, 0xaa},
1441 {0x00, 0x79, 0x5a, 0xaa}, {0x00, 0x7a, 0x7f, 0xaa},
1442 {0x00, 0x7b, 0x9b, 0xaa}, {0x00, 0x7c, 0xba, 0xaa},
1443 {0x00, 0x7d, 0xd4, 0xaa}, {0x00, 0x7e, 0xea, 0xaa},
1444 {0x00, 0xd6, 0xa2, 0xaa}, {0x00, 0x73, 0x00, 0xaa},
1445 {0x00, 0x74, 0x10, 0xaa}, {0x00, 0x75, 0x20, 0xaa},
1446 {0x00, 0x76, 0x2b, 0xaa}, {0x00, 0x77, 0x36, 0xaa},
1447 {0x00, 0x78, 0x49, 0xaa}, {0x00, 0x79, 0x5a, 0xaa},
1448 {0x00, 0x7a, 0x7f, 0xaa}, {0x00, 0x7b, 0x9b, 0xaa},
1449 {0x00, 0x7c, 0xba, 0xaa}, {0x00, 0x7d, 0xd4, 0xaa},
1450 {0x00, 0x7e, 0xea, 0xaa}, {0x00, 0x4c, 0x07, 0xaa},
1451 {0x00, 0x4b, 0xe0, 0xaa}, {0x00, 0x4e, 0x77, 0xaa},
1452 {0x00, 0x59, 0x66, 0xaa}, {0x00, 0x4d, 0x0a, 0xaa},
1453 {0x00, 0xd1, 0x00, 0xaa}, {0x00, 0x20, 0xc4, 0xaa},
1454 {0xb8, 0x8e, 0x00, 0xcc}, {0xb8, 0x8f, 0xff, 0xcc},
1455 {0xb8, 0xfe, 0x00, 0xcc}, {0xb8, 0xff, 0x28, 0xcc},
1456 {0xb9, 0x00, 0x28, 0xcc}, {0xb9, 0x01, 0x28, 0xcc},
1457 {0xb9, 0x02, 0x28, 0xcc}, {0xb9, 0x03, 0x00, 0xcc},
1458 {0xb9, 0x04, 0x00, 0xcc}, {0xb9, 0x05, 0x3c, 0xcc},
1459 {0xb9, 0x06, 0x3c, 0xcc}, {0xb9, 0x07, 0x3c, 0xcc},
1460 {0xb9, 0x08, 0x3c, 0xcc}, {0xbc, 0x02, 0x18, 0xcc},
1461 {0xbc, 0x03, 0x50, 0xcc}, {0xbc, 0x04, 0x18, 0xcc},
1462 {0xbc, 0x05, 0x00, 0xcc}, {0xbc, 0x06, 0x00, 0xcc},
1463 {0xbc, 0x08, 0x30, 0xcc}, {0xbc, 0x09, 0x40, 0xcc},
1464 {0xbc, 0x0a, 0x10, 0xcc}, {0xbc, 0x0b, 0x00, 0xcc},
1465 {0xbc, 0x0c, 0x00, 0xcc}, {0x00, 0x05, 0x00, 0xaa},
1466 {0xb3, 0x5c, 0x00, 0xcc}, {0xb3, 0x01, 0x41, 0xcc},
1467 {}
1468};
1469
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03001470static const u8 hv7131r_gamma[17] = {
Jean-Francois Moine0ee7e4d2009-09-01 13:49:05 -03001471 0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
1472 0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001473};
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03001474static const u8 hv7131r_matrix[9] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001475 0x5f, 0xec, 0xf5, 0xf1, 0x5a, 0xf5, 0xf1, 0xec, 0x63
1476};
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03001477static const u8 hv7131r_initVGA_data[][4] = {
Jean-Francois Moine0ee7e4d2009-09-01 13:49:05 -03001478 {0xb3, 0x01, 0x01, 0xcc},
1479 {0xb0, 0x03, 0x19, 0xcc},
1480 {0xb0, 0x04, 0x02, 0xcc},
1481 {0x00, 0x00, 0x20, 0xdd},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001482 {0xb3, 0x00, 0x24, 0xcc},
Jean-Francois Moine0ee7e4d2009-09-01 13:49:05 -03001483 {0xb3, 0x00, 0x25, 0xcc},
1484 {0xb3, 0x08, 0x01, 0xcc},
1485 {0xb3, 0x09, 0x0c, 0xcc},
1486 {0xb3, 0x05, 0x01, 0xcc},
1487 {0xb3, 0x06, 0x03, 0xcc},
1488 {0xb3, 0x01, 0x45, 0xcc},
1489 {0xb3, 0x03, 0x0b, 0xcc},
1490 {0xb3, 0x04, 0x05, 0xcc},
1491 {0xb3, 0x20, 0x00, 0xcc},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001492 {0xb3, 0x21, 0x00, 0xcc},
Jean-Francois Moine0ee7e4d2009-09-01 13:49:05 -03001493 {0xb3, 0x22, 0x01, 0xcc},
1494 {0xb3, 0x23, 0xe0, 0xcc},
1495 {0xb3, 0x14, 0x00, 0xcc},
1496 {0xb3, 0x15, 0x02, 0xcc},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001497 {0xb3, 0x16, 0x02, 0xcc},
Jean-Francois Moine0ee7e4d2009-09-01 13:49:05 -03001498 {0xb3, 0x17, 0x7f, 0xcc},
1499 {0xb3, 0x34, 0x01, 0xcc},
Jean-Francois Moineff1cf402009-12-26 15:18:02 -03001500 {0xb3, 0x35, 0x91, 0xcc}, /* i2c add: 11 */
Jean-Francois Moine0ee7e4d2009-09-01 13:49:05 -03001501 {0xb3, 0x00, 0x27, 0xcc},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001502 {0xbc, 0x00, 0x73, 0xcc},
Jean-Francois Moine0ee7e4d2009-09-01 13:49:05 -03001503 {0xb8, 0x00, 0x23, 0xcc},
1504 {0xb8, 0x2c, 0x50, 0xcc},
1505 {0xb8, 0x2d, 0xf8, 0xcc},
1506 {0xb8, 0x2e, 0xf8, 0xcc},
1507 {0xb8, 0x2f, 0xf8, 0xcc},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001508 {0xb8, 0x30, 0x50, 0xcc},
Jean-Francois Moine0ee7e4d2009-09-01 13:49:05 -03001509 {0xb8, 0x31, 0xf8, 0xcc},
1510 {0xb8, 0x32, 0xf8, 0xcc},
1511 {0xb8, 0x33, 0xf8, 0xcc},
1512 {0xb8, 0x34, 0x58, 0xcc},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001513 {0xb8, 0x35, 0x00, 0xcc},
Jean-Francois Moine0ee7e4d2009-09-01 13:49:05 -03001514 {0xb8, 0x36, 0x00, 0xcc},
1515 {0xb8, 0x37, 0x00, 0xcc},
1516 {0xb8, 0x27, 0x20, 0xcc},
1517 {0xb8, 0x01, 0x7d, 0xcc},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001518 {0xb8, 0x81, 0x09, 0xcc},
Jean-Francois Moine0ee7e4d2009-09-01 13:49:05 -03001519 {0xb3, 0x01, 0x41, 0xcc},
1520 {0xb8, 0x8e, 0x00, 0xcc},
1521 {0xb8, 0x8f, 0xff, 0xcc},
1522 {0x00, 0x01, 0x0c, 0xaa},
1523 {0x00, 0x14, 0x01, 0xaa},
1524 {0x00, 0x15, 0xe6, 0xaa},
1525 {0x00, 0x16, 0x02, 0xaa},
1526 {0x00, 0x17, 0x86, 0xaa},
1527 {0x00, 0x23, 0x00, 0xaa},
1528 {0x00, 0x25, 0x03, 0xaa},
1529 {0x00, 0x26, 0xa9, 0xaa},
1530 {0x00, 0x27, 0x80, 0xaa},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001531 {0x00, 0x30, 0x18, 0xaa},
Jean-Francois Moine0ee7e4d2009-09-01 13:49:05 -03001532 {0xb6, 0x00, 0x00, 0xcc},
1533 {0xb6, 0x03, 0x02, 0xcc},
1534 {0xb6, 0x02, 0x80, 0xcc},
1535 {0xb6, 0x05, 0x01, 0xcc},
1536 {0xb6, 0x04, 0xe0, 0xcc},
1537 {0xb6, 0x12, 0x78, 0xcc},
1538 {0xb6, 0x18, 0x02, 0xcc},
1539 {0xb6, 0x17, 0x58, 0xcc},
1540 {0xb6, 0x16, 0x00, 0xcc},
1541 {0xb6, 0x22, 0x12, 0xcc},
1542 {0xb6, 0x23, 0x0b, 0xcc},
1543 {0xb3, 0x02, 0x02, 0xcc},
1544 {0xbf, 0xc0, 0x39, 0xcc},
1545 {0xbf, 0xc1, 0x04, 0xcc},
1546 {0xbf, 0xcc, 0x10, 0xcc},
1547 {0xb6, 0x12, 0xf8, 0xcc},
1548 {0xb6, 0x13, 0x13, 0xcc},
1549 {0xb9, 0x12, 0x00, 0xcc},
1550 {0xb9, 0x13, 0x0a, 0xcc},
1551 {0xb9, 0x14, 0x0a, 0xcc},
1552 {0xb9, 0x15, 0x0a, 0xcc},
1553 {0xb9, 0x16, 0x0a, 0xcc},
1554 {0xb8, 0x0c, 0x20, 0xcc},
1555 {0xb8, 0x0d, 0x70, 0xcc},
1556 {0xb9, 0x18, 0x00, 0xcc},
1557 {0xb9, 0x19, 0x0f, 0xcc},
1558 {0xb9, 0x1a, 0x0f, 0xcc},
1559 {0xb9, 0x1b, 0x0f, 0xcc},
1560 {0xb9, 0x1c, 0x0f, 0xcc},
1561 {0xb3, 0x5c, 0x01, 0xcc},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001562 {}
1563};
1564
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03001565static const u8 hv7131r_initQVGA_data[][4] = {
Jean-Francois Moine0ee7e4d2009-09-01 13:49:05 -03001566 {0xb3, 0x01, 0x01, 0xcc},
1567 {0xb0, 0x03, 0x19, 0xcc},
1568 {0xb0, 0x04, 0x02, 0xcc},
1569 {0x00, 0x00, 0x20, 0xdd},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001570 {0xb3, 0x00, 0x24, 0xcc},
Jean-Francois Moine0ee7e4d2009-09-01 13:49:05 -03001571 {0xb3, 0x00, 0x25, 0xcc},
1572 {0xb3, 0x08, 0x01, 0xcc},
1573 {0xb3, 0x09, 0x0c, 0xcc},
1574 {0xb3, 0x05, 0x01, 0xcc},
1575 {0xb3, 0x06, 0x03, 0xcc},
1576 {0xb3, 0x01, 0x45, 0xcc},
1577 {0xb3, 0x03, 0x0b, 0xcc},
1578 {0xb3, 0x04, 0x05, 0xcc},
1579 {0xb3, 0x20, 0x00, 0xcc},
1580 {0xb3, 0x21, 0x00, 0xcc},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001581 {0xb3, 0x22, 0x01, 0xcc},
Jean-Francois Moine0ee7e4d2009-09-01 13:49:05 -03001582 {0xb3, 0x23, 0xe0, 0xcc},
1583 {0xb3, 0x14, 0x00, 0xcc},
1584 {0xb3, 0x15, 0x02, 0xcc},
1585 {0xb3, 0x16, 0x02, 0xcc},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001586 {0xb3, 0x17, 0x7f, 0xcc},
Jean-Francois Moine0ee7e4d2009-09-01 13:49:05 -03001587 {0xb3, 0x34, 0x01, 0xcc},
1588 {0xb3, 0x35, 0x91, 0xcc},
1589 {0xb3, 0x00, 0x27, 0xcc},
1590 {0xbc, 0x00, 0xd3, 0xcc},
1591 {0xb8, 0x00, 0x23, 0xcc},
1592 {0xb8, 0x2c, 0x50, 0xcc},
1593 {0xb8, 0x2d, 0xf8, 0xcc},
1594 {0xb8, 0x2e, 0xf8, 0xcc},
1595 {0xb8, 0x2f, 0xf8, 0xcc},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001596 {0xb8, 0x30, 0x50, 0xcc},
Jean-Francois Moine0ee7e4d2009-09-01 13:49:05 -03001597 {0xb8, 0x31, 0xf8, 0xcc},
1598 {0xb8, 0x32, 0xf8, 0xcc},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001599 {0xb8, 0x33, 0xf8, 0xcc},
Jean-Francois Moine0ee7e4d2009-09-01 13:49:05 -03001600 {0xb8, 0x34, 0x58, 0xcc},
1601 {0xb8, 0x35, 0x00, 0xcc},
1602 {0xb8, 0x36, 0x00, 0xcc},
1603 {0xb8, 0x37, 0x00, 0xcc},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001604 {0xb8, 0x27, 0x20, 0xcc},
Jean-Francois Moine0ee7e4d2009-09-01 13:49:05 -03001605 {0xb8, 0x01, 0x7d, 0xcc},
1606 {0xb8, 0x81, 0x09, 0xcc},
1607 {0xb3, 0x01, 0x41, 0xcc},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001608 {0xb8, 0x8e, 0x00, 0xcc},
Jean-Francois Moine0ee7e4d2009-09-01 13:49:05 -03001609 {0xb8, 0x8f, 0xff, 0xcc},
1610 {0x00, 0x01, 0x0c, 0xaa},
1611 {0x00, 0x14, 0x01, 0xaa},
1612 {0x00, 0x15, 0xe6, 0xaa},
1613 {0x00, 0x16, 0x02, 0xaa},
1614 {0x00, 0x17, 0x86, 0xaa},
1615 {0x00, 0x23, 0x00, 0xaa},
1616 {0x00, 0x25, 0x03, 0xaa},
1617 {0x00, 0x26, 0xa9, 0xaa},
1618 {0x00, 0x27, 0x80, 0xaa},
1619 {0x00, 0x30, 0x18, 0xaa},
1620 {0xb6, 0x00, 0x00, 0xcc},
1621 {0xb6, 0x03, 0x01, 0xcc},
1622 {0xb6, 0x02, 0x40, 0xcc},
1623 {0xb6, 0x05, 0x00, 0xcc},
1624 {0xb6, 0x04, 0xf0, 0xcc},
1625 {0xb6, 0x12, 0x78, 0xcc},
1626 {0xb6, 0x18, 0x00, 0xcc},
1627 {0xb6, 0x17, 0x96, 0xcc},
1628 {0xb6, 0x16, 0x00, 0xcc},
1629 {0xb6, 0x22, 0x12, 0xcc},
1630 {0xb6, 0x23, 0x0b, 0xcc},
1631 {0xb3, 0x02, 0x02, 0xcc},
1632 {0xbf, 0xc0, 0x39, 0xcc},
1633 {0xbf, 0xc1, 0x04, 0xcc},
1634 {0xbf, 0xcc, 0x10, 0xcc},
1635 {0xbc, 0x02, 0x18, 0xcc},
1636 {0xbc, 0x03, 0x50, 0xcc},
1637 {0xbc, 0x04, 0x18, 0xcc},
1638 {0xbc, 0x05, 0x00, 0xcc},
1639 {0xbc, 0x06, 0x00, 0xcc},
1640 {0xbc, 0x08, 0x30, 0xcc},
1641 {0xbc, 0x09, 0x40, 0xcc},
1642 {0xbc, 0x0a, 0x10, 0xcc},
1643 {0xbc, 0x0b, 0x00, 0xcc},
1644 {0xbc, 0x0c, 0x00, 0xcc},
1645 {0xb9, 0x12, 0x00, 0xcc},
1646 {0xb9, 0x13, 0x0a, 0xcc},
1647 {0xb9, 0x14, 0x0a, 0xcc},
1648 {0xb9, 0x15, 0x0a, 0xcc},
1649 {0xb9, 0x16, 0x0a, 0xcc},
1650 {0xb9, 0x18, 0x00, 0xcc},
1651 {0xb9, 0x19, 0x0f, 0xcc},
1652 {0xb8, 0x0c, 0x20, 0xcc},
1653 {0xb8, 0x0d, 0x70, 0xcc},
1654 {0xb9, 0x1a, 0x0f, 0xcc},
1655 {0xb9, 0x1b, 0x0f, 0xcc},
1656 {0xb9, 0x1c, 0x0f, 0xcc},
1657 {0xb6, 0x12, 0xf8, 0xcc},
1658 {0xb6, 0x13, 0x13, 0xcc},
1659 {0xb3, 0x5c, 0x01, 0xcc},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001660 {}
1661};
1662
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03001663static const u8 ov7660_gamma[17] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001664 0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
1665 0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
1666};
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03001667static const u8 ov7660_matrix[9] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001668 0x5a, 0xf0, 0xf6, 0xf3, 0x57, 0xf6, 0xf3, 0xef, 0x62
1669};
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03001670static const u8 ov7660_initVGA_data[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001671 {0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc},
1672 {0x00, 0x00, 0x50, 0xdd},
1673 {0xb0, 0x03, 0x01, 0xcc},
1674 {0xb3, 0x00, 0x21, 0xcc}, {0xb3, 0x00, 0x26, 0xcc},
1675 {0xb3, 0x05, 0x01, 0xcc},
1676 {0xb3, 0x06, 0x03, 0xcc},
1677 {0xb3, 0x03, 0x1f, 0xcc}, {0xb3, 0x04, 0x05, 0xcc},
1678 {0xb3, 0x05, 0x00, 0xcc},
1679 {0xb3, 0x06, 0x01, 0xcc},
1680 {0xb3, 0x15, 0x00, 0xcc},/* 0xb315 <-0 href startl */
1681 {0xb3, 0x16, 0x02, 0xcc}, {0xb3, 0x17, 0x7f, 0xcc},
1682 {0xb3, 0x21, 0x00, 0xcc},
1683 {0xb3, 0x23, 0xe0, 0xcc}, {0xb3, 0x1d, 0x01, 0xcc},
1684 {0xb3, 0x1f, 0x02, 0xcc},
1685 {0xb3, 0x34, 0x01, 0xcc},
Jean-Francois Moineff1cf402009-12-26 15:18:02 -03001686 {0xb3, 0x35, 0xa1, 0xcc}, /* i2c add: 21 */
1687 {0xb3, 0x00, 0x26, 0xcc},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001688 {0xb8, 0x00, 0x33, 0xcc}, /* 13 */
1689 {0xb8, 0x01, 0x7d, 0xcc},
1690 {0xbc, 0x00, 0x73, 0xcc}, {0xb8, 0x81, 0x09, 0xcc},
1691 {0xb8, 0x27, 0x20, 0xcc},
1692 {0xb8, 0x8f, 0x50, 0xcc},
1693 {0x00, 0x01, 0x80, 0xaa}, {0x00, 0x02, 0x80, 0xaa},
1694 {0x00, 0x12, 0x80, 0xaa},
1695 {0x00, 0x12, 0x05, 0xaa},
Jean-Francois Moine7dc7ad32008-12-08 05:13:53 -03001696 {0x00, 0x1e, 0x01, 0xaa}, /* MVFP */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001697 {0x00, 0x3d, 0x40, 0xaa}, /* 0x3d <-40 gamma 01 */
1698 {0x00, 0x41, 0x00, 0xaa}, /* edge 00 */
1699 {0x00, 0x0d, 0x48, 0xaa}, {0x00, 0x0e, 0x04, 0xaa},
1700 {0x00, 0x13, 0xa7, 0xaa},
1701 {0x00, 0x40, 0xc1, 0xaa}, {0x00, 0x35, 0x00, 0xaa},
1702 {0x00, 0x36, 0x00, 0xaa},
1703 {0x00, 0x3c, 0x68, 0xaa}, {0x00, 0x1b, 0x05, 0xaa},
1704 {0x00, 0x39, 0x43, 0xaa},
1705 {0x00, 0x8d, 0xcf, 0xaa},
1706 {0x00, 0x8b, 0xcc, 0xaa}, {0x00, 0x8c, 0xcc, 0xaa},
1707 {0x00, 0x0f, 0x62, 0xaa},
1708 {0x00, 0x35, 0x84, 0xaa},
1709 {0x00, 0x3b, 0x08, 0xaa}, /* 0 * Nightframe 1/4 + 50Hz -> 0xC8 */
1710 {0x00, 0x3a, 0x00, 0xaa}, /* mx change yuyv format 00, 04, 01; 08, 0c*/
1711 {0x00, 0x14, 0x2a, 0xaa}, /* agc ampli */
1712 {0x00, 0x9e, 0x40, 0xaa}, {0xb8, 0x8f, 0x50, 0xcc},
1713 {0x00, 0x01, 0x80, 0xaa},
1714 {0x00, 0x02, 0x80, 0xaa},
1715 {0xb8, 0xfe, 0x00, 0xcc}, {0xb8, 0xff, 0x28, 0xcc},
1716 {0xb9, 0x00, 0x28, 0xcc},
1717 {0xb9, 0x01, 0x28, 0xcc}, {0xb9, 0x02, 0x28, 0xcc},
1718 {0xb9, 0x03, 0x00, 0xcc},
1719 {0xb9, 0x04, 0x00, 0xcc},
1720 {0xb9, 0x05, 0x3c, 0xcc}, {0xb9, 0x06, 0x3c, 0xcc},
1721 {0xb9, 0x07, 0x3c, 0xcc},
1722 {0xb9, 0x08, 0x3c, 0xcc},
1723
1724 {0xb8, 0x8e, 0x00, 0xcc}, {0xb8, 0x8f, 0xff, 0xcc},
1725
1726 {0x00, 0x29, 0x3c, 0xaa}, {0xb3, 0x01, 0x45, 0xcc},
1727 {}
1728};
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03001729static const u8 ov7660_initQVGA_data[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001730 {0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc},
1731 {0x00, 0x00, 0x50, 0xdd}, {0xb0, 0x03, 0x01, 0xcc},
1732 {0xb3, 0x00, 0x21, 0xcc}, {0xb3, 0x00, 0x26, 0xcc},
1733 {0xb3, 0x05, 0x01, 0xcc}, {0xb3, 0x06, 0x03, 0xcc},
1734 {0xb3, 0x03, 0x1f, 0xcc}, {0xb3, 0x04, 0x05, 0xcc},
1735 {0xb3, 0x05, 0x00, 0xcc}, {0xb3, 0x06, 0x01, 0xcc},
1736 {0xb3, 0x15, 0x00, 0xcc},/* 0xb315 <-0 href startl */
1737 {0xb3, 0x16, 0x02, 0xcc}, {0xb3, 0x17, 0x7f, 0xcc},
1738 {0xb3, 0x21, 0x00, 0xcc},
1739 {0xb3, 0x23, 0xe0, 0xcc}, {0xb3, 0x1d, 0x01, 0xcc},
1740 {0xb3, 0x1f, 0x02, 0xcc}, {0xb3, 0x34, 0x01, 0xcc},
1741 {0xb3, 0x35, 0xa1, 0xcc}, {0xb3, 0x00, 0x26, 0xcc},
1742 {0xb8, 0x00, 0x33, 0xcc}, /* 13 */
1743 {0xb8, 0x01, 0x7d, 0xcc},
1744/* sizer */
1745 {0xbc, 0x00, 0xd3, 0xcc},
1746 {0xb8, 0x81, 0x09, 0xcc}, {0xb8, 0x81, 0x09, 0xcc},
1747 {0xb8, 0x27, 0x20, 0xcc}, {0xb8, 0x8f, 0x50, 0xcc},
1748 {0x00, 0x01, 0x80, 0xaa}, {0x00, 0x02, 0x80, 0xaa},
1749 {0x00, 0x12, 0x80, 0xaa}, {0x00, 0x12, 0x05, 0xaa},
Jean-Francois Moine7dc7ad32008-12-08 05:13:53 -03001750 {0x00, 0x1e, 0x01, 0xaa}, /* MVFP */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001751 {0x00, 0x3d, 0x40, 0xaa}, /* 0x3d <-40 gamma 01 */
1752 {0x00, 0x41, 0x00, 0xaa}, /* edge 00 */
1753 {0x00, 0x0d, 0x48, 0xaa}, {0x00, 0x0e, 0x04, 0xaa},
1754 {0x00, 0x13, 0xa7, 0xaa},
1755 {0x00, 0x40, 0xc1, 0xaa}, {0x00, 0x35, 0x00, 0xaa},
1756 {0x00, 0x36, 0x00, 0xaa},
1757 {0x00, 0x3c, 0x68, 0xaa}, {0x00, 0x1b, 0x05, 0xaa},
1758 {0x00, 0x39, 0x43, 0xaa}, {0x00, 0x8d, 0xcf, 0xaa},
1759 {0x00, 0x8b, 0xcc, 0xaa}, {0x00, 0x8c, 0xcc, 0xaa},
1760 {0x00, 0x0f, 0x62, 0xaa}, {0x00, 0x35, 0x84, 0xaa},
1761 {0x00, 0x3b, 0x08, 0xaa}, /* 0 * Nightframe 1/4 + 50Hz -> 0xC8 */
1762 {0x00, 0x3a, 0x00, 0xaa}, /* mx change yuyv format 00, 04, 01; 08, 0c*/
1763 {0x00, 0x14, 0x2a, 0xaa}, /* agc ampli */
1764 {0x00, 0x9e, 0x40, 0xaa}, {0xb8, 0x8f, 0x50, 0xcc},
1765 {0x00, 0x01, 0x80, 0xaa},
1766 {0x00, 0x02, 0x80, 0xaa},
1767/* sizer filters */
1768 {0xbc, 0x02, 0x08, 0xcc},
1769 {0xbc, 0x03, 0x70, 0xcc},
1770 {0xb8, 0x35, 0x00, 0xcc},
1771 {0xb8, 0x36, 0x00, 0xcc},
1772 {0xb8, 0x37, 0x00, 0xcc},
1773 {0xbc, 0x04, 0x08, 0xcc},
1774 {0xbc, 0x05, 0x00, 0xcc},
1775 {0xbc, 0x06, 0x00, 0xcc},
1776 {0xbc, 0x08, 0x3c, 0xcc},
1777 {0xbc, 0x09, 0x40, 0xcc},
1778 {0xbc, 0x0a, 0x04, 0xcc},
1779 {0xbc, 0x0b, 0x00, 0xcc},
1780 {0xbc, 0x0c, 0x00, 0xcc},
1781/* */
1782 {0xb8, 0xfe, 0x00, 0xcc},
1783 {0xb8, 0xff, 0x28, 0xcc},
1784/* */
1785 {0xb9, 0x00, 0x28, 0xcc}, {0xb9, 0x01, 0x28, 0xcc},
1786 {0xb9, 0x02, 0x28, 0xcc}, {0xb9, 0x03, 0x00, 0xcc},
1787 {0xb9, 0x04, 0x00, 0xcc}, {0xb9, 0x05, 0x3c, 0xcc},
1788 {0xb9, 0x06, 0x3c, 0xcc}, {0xb9, 0x07, 0x3c, 0xcc},
1789 {0xb9, 0x08, 0x3c, 0xcc},
1790/* */
1791 {0xb8, 0x8e, 0x00, 0xcc},
1792 {0xb8, 0x8f, 0xff, 0xcc}, /* ff */
1793 {0x00, 0x29, 0x3c, 0xaa},
1794 {0xb3, 0x01, 0x45, 0xcc}, /* 45 */
Jean-Francois Moine1ff1e482008-07-17 09:37:57 -03001795 {}
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001796};
1797
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03001798static const u8 ov7660_50HZ[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001799 {0x00, 0x3b, 0x08, 0xaa},
1800 {0x00, 0x9d, 0x40, 0xaa},
1801 {0x00, 0x13, 0xa7, 0xaa},
Jean-Francois Moine1ff1e482008-07-17 09:37:57 -03001802 {}
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001803};
1804
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03001805static const u8 ov7660_60HZ[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001806 {0x00, 0x3b, 0x00, 0xaa},
1807 {0x00, 0x9e, 0x40, 0xaa},
1808 {0x00, 0x13, 0xa7, 0xaa},
1809 {}
1810};
1811
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03001812static const u8 ov7660_NoFliker[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001813 {0x00, 0x13, 0x87, 0xaa},
1814 {}
1815};
1816
Jean-François Moine5624c642010-04-02 07:12:42 -03001817static const u8 ov7670_InitVGA[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001818 {0xb3, 0x01, 0x05, 0xcc},
Jean-François Moine5624c642010-04-02 07:12:42 -03001819 {0x00, 0x00, 0x30, 0xdd},
1820 {0xb0, 0x03, 0x19, 0xcc},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001821 {0x00, 0x00, 0x10, 0xdd},
Jean-François Moine5624c642010-04-02 07:12:42 -03001822 {0xb0, 0x04, 0x02, 0xcc},
1823 {0x00, 0x00, 0x10, 0xdd},
1824 {0xb3, 0x00, 0x66, 0xcc},
1825 {0xb3, 0x00, 0x67, 0xcc},
1826 {0xb0, 0x16, 0x01, 0xcc},
Jean-Francois Moineff1cf402009-12-26 15:18:02 -03001827 {0xb3, 0x35, 0xa1, 0xcc}, /* i2c add: 21 */
1828 {0xb3, 0x34, 0x01, 0xcc},
Jean-François Moine5624c642010-04-02 07:12:42 -03001829 {0xb3, 0x05, 0x01, 0xcc},
1830 {0xb3, 0x06, 0x01, 0xcc},
1831 {0xb3, 0x08, 0x01, 0xcc},
1832 {0xb3, 0x09, 0x0c, 0xcc},
1833 {0xb3, 0x02, 0x02, 0xcc},
1834 {0xb3, 0x03, 0x1f, 0xcc},
1835 {0xb3, 0x14, 0x00, 0xcc},
1836 {0xb3, 0x15, 0x00, 0xcc},
1837 {0xb3, 0x16, 0x02, 0xcc},
1838 {0xb3, 0x17, 0x7f, 0xcc},
1839 {0xb3, 0x04, 0x05, 0xcc},
1840 {0xb3, 0x20, 0x00, 0xcc},
1841 {0xb3, 0x21, 0x00, 0xcc},
1842 {0xb3, 0x22, 0x01, 0xcc},
1843 {0xb3, 0x23, 0xe0, 0xcc},
1844 {0xbc, 0x00, 0x41, 0xcc},
1845 {0xbc, 0x01, 0x01, 0xcc},
1846 {0x00, 0x12, 0x80, 0xaa},
1847 {0x00, 0x00, 0x20, 0xdd},
1848 {0x00, 0x12, 0x00, 0xaa},
1849 {0x00, 0x11, 0x40, 0xaa},
1850 {0x00, 0x6b, 0x0a, 0xaa},
1851 {0x00, 0x3a, 0x04, 0xaa},
1852 {0x00, 0x40, 0xc0, 0xaa},
1853 {0x00, 0x8c, 0x00, 0xaa},
1854 {0x00, 0x7a, 0x29, 0xaa},
1855 {0x00, 0x7b, 0x0e, 0xaa},
1856 {0x00, 0x7c, 0x1a, 0xaa},
1857 {0x00, 0x7d, 0x31, 0xaa},
1858 {0x00, 0x7e, 0x53, 0xaa},
1859 {0x00, 0x7f, 0x60, 0xaa},
1860 {0x00, 0x80, 0x6b, 0xaa},
1861 {0x00, 0x81, 0x73, 0xaa},
1862 {0x00, 0x82, 0x7b, 0xaa},
1863 {0x00, 0x83, 0x82, 0xaa},
1864 {0x00, 0x84, 0x89, 0xaa},
1865 {0x00, 0x85, 0x96, 0xaa},
1866 {0x00, 0x86, 0xa1, 0xaa},
1867 {0x00, 0x87, 0xb7, 0xaa},
1868 {0x00, 0x88, 0xcc, 0xaa},
1869 {0x00, 0x89, 0xe1, 0xaa},
1870 {0x00, 0x13, 0xe0, 0xaa},
1871 {0x00, 0x00, 0x00, 0xaa},
1872 {0x00, 0x10, 0x00, 0xaa},
1873 {0x00, 0x0d, 0x40, 0xaa},
1874 {0x00, 0x14, 0x28, 0xaa},
1875 {0x00, 0xa5, 0x05, 0xaa},
1876 {0x00, 0xab, 0x07, 0xaa},
1877 {0x00, 0x24, 0x95, 0xaa},
1878 {0x00, 0x25, 0x33, 0xaa},
1879 {0x00, 0x26, 0xe3, 0xaa},
1880 {0x00, 0x9f, 0x88, 0xaa},
1881 {0x00, 0xa0, 0x78, 0xaa},
1882 {0x00, 0x55, 0x90, 0xaa},
1883 {0x00, 0xa1, 0x03, 0xaa},
1884 {0x00, 0xa6, 0xe0, 0xaa},
1885 {0x00, 0xa7, 0xd8, 0xaa},
1886 {0x00, 0xa8, 0xf0, 0xaa},
1887 {0x00, 0xa9, 0x90, 0xaa},
1888 {0x00, 0xaa, 0x14, 0xaa},
1889 {0x00, 0x13, 0xe5, 0xaa},
1890 {0x00, 0x0e, 0x61, 0xaa},
1891 {0x00, 0x0f, 0x4b, 0xaa},
1892 {0x00, 0x16, 0x02, 0xaa},
Jean-Francois Moine7dc7ad32008-12-08 05:13:53 -03001893 {0x00, 0x1e, 0x07, 0xaa}, /* MVFP */
1894 {0x00, 0x21, 0x02, 0xaa},
Jean-François Moine5624c642010-04-02 07:12:42 -03001895 {0x00, 0x22, 0x91, 0xaa},
1896 {0x00, 0x29, 0x07, 0xaa},
1897 {0x00, 0x33, 0x0b, 0xaa},
1898 {0x00, 0x35, 0x0b, 0xaa},
1899 {0x00, 0x37, 0x1d, 0xaa},
1900 {0x00, 0x38, 0x71, 0xaa},
1901 {0x00, 0x39, 0x2a, 0xaa},
1902 {0x00, 0x3c, 0x78, 0xaa},
1903 {0x00, 0x4d, 0x40, 0xaa},
1904 {0x00, 0x4e, 0x20, 0xaa},
1905 {0x00, 0x74, 0x19, 0xaa},
1906 {0x00, 0x8d, 0x4f, 0xaa},
1907 {0x00, 0x8e, 0x00, 0xaa},
1908 {0x00, 0x8f, 0x00, 0xaa},
1909 {0x00, 0x90, 0x00, 0xaa},
1910 {0x00, 0x91, 0x00, 0xaa},
1911 {0x00, 0x96, 0x00, 0xaa},
1912 {0x00, 0x9a, 0x80, 0xaa},
1913 {0x00, 0xb0, 0x84, 0xaa},
1914 {0x00, 0xb1, 0x0c, 0xaa},
1915 {0x00, 0xb2, 0x0e, 0xaa},
1916 {0x00, 0xb3, 0x82, 0xaa},
1917 {0x00, 0xb8, 0x0a, 0xaa},
1918 {0x00, 0x43, 0x14, 0xaa},
1919 {0x00, 0x44, 0xf0, 0xaa},
1920 {0x00, 0x45, 0x45, 0xaa},
1921 {0x00, 0x46, 0x63, 0xaa},
1922 {0x00, 0x47, 0x2d, 0xaa},
1923 {0x00, 0x48, 0x46, 0xaa},
1924 {0x00, 0x59, 0x88, 0xaa},
1925 {0x00, 0x5a, 0xa0, 0xaa},
1926 {0x00, 0x5b, 0xc6, 0xaa},
1927 {0x00, 0x5c, 0x7d, 0xaa},
1928 {0x00, 0x5d, 0x5f, 0xaa},
1929 {0x00, 0x5e, 0x19, 0xaa},
1930 {0x00, 0x6c, 0x0a, 0xaa},
1931 {0x00, 0x6d, 0x55, 0xaa},
1932 {0x00, 0x6e, 0x11, 0xaa},
1933 {0x00, 0x6f, 0x9e, 0xaa},
1934 {0x00, 0x69, 0x00, 0xaa},
1935 {0x00, 0x6a, 0x40, 0xaa},
1936 {0x00, 0x01, 0x40, 0xaa},
1937 {0x00, 0x02, 0x40, 0xaa},
1938 {0x00, 0x13, 0xe7, 0xaa},
1939 {0x00, 0x5f, 0xf0, 0xaa},
1940 {0x00, 0x60, 0xf0, 0xaa},
1941 {0x00, 0x61, 0xf0, 0xaa},
1942 {0x00, 0x27, 0xa0, 0xaa},
1943 {0x00, 0x28, 0x80, 0xaa},
1944 {0x00, 0x2c, 0x90, 0xaa},
1945 {0x00, 0x4f, 0x66, 0xaa},
1946 {0x00, 0x50, 0x66, 0xaa},
1947 {0x00, 0x51, 0x00, 0xaa},
1948 {0x00, 0x52, 0x22, 0xaa},
1949 {0x00, 0x53, 0x5e, 0xaa},
1950 {0x00, 0x54, 0x80, 0xaa},
1951 {0x00, 0x58, 0x9e, 0xaa},
1952 {0x00, 0x41, 0x08, 0xaa},
1953 {0x00, 0x3f, 0x00, 0xaa},
1954 {0x00, 0x75, 0x85, 0xaa},
1955 {0x00, 0x76, 0xe1, 0xaa},
1956 {0x00, 0x4c, 0x00, 0xaa},
1957 {0x00, 0x77, 0x0a, 0xaa},
1958 {0x00, 0x3d, 0x88, 0xaa},
1959 {0x00, 0x4b, 0x09, 0xaa},
1960 {0x00, 0xc9, 0x60, 0xaa},
1961 {0x00, 0x41, 0x38, 0xaa},
1962 {0x00, 0x62, 0x30, 0xaa},
1963 {0x00, 0x63, 0x30, 0xaa},
1964 {0x00, 0x64, 0x08, 0xaa},
1965 {0x00, 0x94, 0x07, 0xaa},
1966 {0x00, 0x95, 0x0b, 0xaa},
1967 {0x00, 0x65, 0x00, 0xaa},
1968 {0x00, 0x66, 0x05, 0xaa},
1969 {0x00, 0x56, 0x50, 0xaa},
1970 {0x00, 0x34, 0x11, 0xaa},
1971 {0x00, 0xa4, 0x88, 0xaa},
1972 {0x00, 0x96, 0x00, 0xaa},
1973 {0x00, 0x97, 0x30, 0xaa},
1974 {0x00, 0x98, 0x20, 0xaa},
1975 {0x00, 0x99, 0x30, 0xaa},
1976 {0x00, 0x9a, 0x84, 0xaa},
1977 {0x00, 0x9b, 0x29, 0xaa},
1978 {0x00, 0x9c, 0x03, 0xaa},
1979 {0x00, 0x78, 0x04, 0xaa},
1980 {0x00, 0x79, 0x01, 0xaa},
1981 {0x00, 0xc8, 0xf0, 0xaa},
1982 {0x00, 0x79, 0x0f, 0xaa},
1983 {0x00, 0xc8, 0x00, 0xaa},
1984 {0x00, 0x79, 0x10, 0xaa},
1985 {0x00, 0xc8, 0x7e, 0xaa},
1986 {0x00, 0x79, 0x0a, 0xaa},
1987 {0x00, 0xc8, 0x80, 0xaa},
1988 {0x00, 0x79, 0x0b, 0xaa},
1989 {0x00, 0xc8, 0x01, 0xaa},
1990 {0x00, 0x79, 0x0c, 0xaa},
1991 {0x00, 0xc8, 0x0f, 0xaa},
1992 {0x00, 0x79, 0x0d, 0xaa},
1993 {0x00, 0xc8, 0x20, 0xaa},
1994 {0x00, 0x79, 0x09, 0xaa},
1995 {0x00, 0xc8, 0x80, 0xaa},
1996 {0x00, 0x79, 0x02, 0xaa},
1997 {0x00, 0xc8, 0xc0, 0xaa},
1998 {0x00, 0x79, 0x03, 0xaa},
1999 {0x00, 0xc8, 0x40, 0xaa},
2000 {0x00, 0x79, 0x05, 0xaa},
2001 {0x00, 0xc8, 0x30, 0xaa},
2002 {0x00, 0x79, 0x26, 0xaa},
2003 {0x00, 0x11, 0x40, 0xaa},
2004 {0x00, 0x3a, 0x04, 0xaa},
2005 {0x00, 0x12, 0x00, 0xaa},
2006 {0x00, 0x40, 0xc0, 0xaa},
2007 {0x00, 0x8c, 0x00, 0xaa},
2008 {0x00, 0x17, 0x14, 0xaa},
2009 {0x00, 0x18, 0x02, 0xaa},
2010 {0x00, 0x32, 0x92, 0xaa},
2011 {0x00, 0x19, 0x02, 0xaa},
2012 {0x00, 0x1a, 0x7a, 0xaa},
2013 {0x00, 0x03, 0x0a, 0xaa},
2014 {0x00, 0x0c, 0x00, 0xaa},
2015 {0x00, 0x3e, 0x00, 0xaa},
2016 {0x00, 0x70, 0x3a, 0xaa},
2017 {0x00, 0x71, 0x35, 0xaa},
2018 {0x00, 0x72, 0x11, 0xaa},
2019 {0x00, 0x73, 0xf0, 0xaa},
2020 {0x00, 0xa2, 0x02, 0xaa},
2021 {0x00, 0xb1, 0x00, 0xaa},
2022 {0x00, 0xb1, 0x0c, 0xaa},
Jean-Francois Moine7dc7ad32008-12-08 05:13:53 -03002023 {0x00, 0x1e, 0x37, 0xaa}, /* MVFP */
2024 {0x00, 0xaa, 0x14, 0xaa},
Jean-François Moine5624c642010-04-02 07:12:42 -03002025 {0x00, 0x24, 0x80, 0xaa},
2026 {0x00, 0x25, 0x74, 0xaa},
2027 {0x00, 0x26, 0xd3, 0xaa},
2028 {0x00, 0x0d, 0x00, 0xaa},
2029 {0x00, 0x14, 0x18, 0xaa},
2030 {0x00, 0x9d, 0x99, 0xaa},
2031 {0x00, 0x9e, 0x7f, 0xaa},
2032 {0x00, 0x64, 0x08, 0xaa},
2033 {0x00, 0x94, 0x07, 0xaa},
2034 {0x00, 0x95, 0x06, 0xaa},
2035 {0x00, 0x66, 0x05, 0xaa},
2036 {0x00, 0x41, 0x08, 0xaa},
2037 {0x00, 0x3f, 0x00, 0xaa},
2038 {0x00, 0x75, 0x07, 0xaa},
2039 {0x00, 0x76, 0xe1, 0xaa},
2040 {0x00, 0x4c, 0x00, 0xaa},
2041 {0x00, 0x77, 0x00, 0xaa},
2042 {0x00, 0x3d, 0xc2, 0xaa},
2043 {0x00, 0x4b, 0x09, 0xaa},
2044 {0x00, 0xc9, 0x60, 0xaa},
2045 {0x00, 0x41, 0x38, 0xaa},
2046 {0xbf, 0xc0, 0x26, 0xcc},
2047 {0xbf, 0xc1, 0x02, 0xcc},
2048 {0xbf, 0xcc, 0x04, 0xcc},
2049 {0xb3, 0x5c, 0x01, 0xcc},
2050 {0xb3, 0x01, 0x45, 0xcc},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03002051 {0x00, 0x77, 0x05, 0xaa},
2052 {},
2053};
2054
Jean-François Moine5624c642010-04-02 07:12:42 -03002055static const u8 ov7670_InitQVGA[][4] = {
2056 {0xb3, 0x01, 0x05, 0xcc},
2057 {0x00, 0x00, 0x30, 0xdd},
2058 {0xb0, 0x03, 0x19, 0xcc},
2059 {0x00, 0x00, 0x10, 0xdd},
2060 {0xb0, 0x04, 0x02, 0xcc},
2061 {0x00, 0x00, 0x10, 0xdd},
2062 {0xb3, 0x00, 0x66, 0xcc},
2063 {0xb3, 0x00, 0x67, 0xcc},
2064 {0xb0, 0x16, 0x01, 0xcc},
2065 {0xb3, 0x35, 0xa1, 0xcc}, /* i2c add: 21 */
2066 {0xb3, 0x34, 0x01, 0xcc},
2067 {0xb3, 0x05, 0x01, 0xcc},
2068 {0xb3, 0x06, 0x01, 0xcc},
2069 {0xb3, 0x08, 0x01, 0xcc},
2070 {0xb3, 0x09, 0x0c, 0xcc},
2071 {0xb3, 0x02, 0x02, 0xcc},
2072 {0xb3, 0x03, 0x1f, 0xcc},
2073 {0xb3, 0x14, 0x00, 0xcc},
2074 {0xb3, 0x15, 0x00, 0xcc},
2075 {0xb3, 0x16, 0x02, 0xcc},
2076 {0xb3, 0x17, 0x7f, 0xcc},
2077 {0xb3, 0x04, 0x05, 0xcc},
2078 {0xb3, 0x20, 0x00, 0xcc},
2079 {0xb3, 0x21, 0x00, 0xcc},
2080 {0xb3, 0x22, 0x01, 0xcc},
2081 {0xb3, 0x23, 0xe0, 0xcc},
2082 {0xbc, 0x00, 0xd1, 0xcc},
2083 {0xbc, 0x01, 0x01, 0xcc},
2084 {0x00, 0x12, 0x80, 0xaa},
2085 {0x00, 0x00, 0x20, 0xdd},
2086 {0x00, 0x12, 0x00, 0xaa},
2087 {0x00, 0x11, 0x40, 0xaa},
2088 {0x00, 0x6b, 0x0a, 0xaa},
2089 {0x00, 0x3a, 0x04, 0xaa},
2090 {0x00, 0x40, 0xc0, 0xaa},
2091 {0x00, 0x8c, 0x00, 0xaa},
2092 {0x00, 0x7a, 0x29, 0xaa},
2093 {0x00, 0x7b, 0x0e, 0xaa},
2094 {0x00, 0x7c, 0x1a, 0xaa},
2095 {0x00, 0x7d, 0x31, 0xaa},
2096 {0x00, 0x7e, 0x53, 0xaa},
2097 {0x00, 0x7f, 0x60, 0xaa},
2098 {0x00, 0x80, 0x6b, 0xaa},
2099 {0x00, 0x81, 0x73, 0xaa},
2100 {0x00, 0x82, 0x7b, 0xaa},
2101 {0x00, 0x83, 0x82, 0xaa},
2102 {0x00, 0x84, 0x89, 0xaa},
2103 {0x00, 0x85, 0x96, 0xaa},
2104 {0x00, 0x86, 0xa1, 0xaa},
2105 {0x00, 0x87, 0xb7, 0xaa},
2106 {0x00, 0x88, 0xcc, 0xaa},
2107 {0x00, 0x89, 0xe1, 0xaa},
2108 {0x00, 0x13, 0xe0, 0xaa},
2109 {0x00, 0x00, 0x00, 0xaa},
2110 {0x00, 0x10, 0x00, 0xaa},
2111 {0x00, 0x0d, 0x40, 0xaa},
2112 {0x00, 0x14, 0x28, 0xaa},
2113 {0x00, 0xa5, 0x05, 0xaa},
2114 {0x00, 0xab, 0x07, 0xaa},
2115 {0x00, 0x24, 0x95, 0xaa},
2116 {0x00, 0x25, 0x33, 0xaa},
2117 {0x00, 0x26, 0xe3, 0xaa},
2118 {0x00, 0x9f, 0x88, 0xaa},
2119 {0x00, 0xa0, 0x78, 0xaa},
2120 {0x00, 0x55, 0x90, 0xaa},
2121 {0x00, 0xa1, 0x03, 0xaa},
2122 {0x00, 0xa6, 0xe0, 0xaa},
2123 {0x00, 0xa7, 0xd8, 0xaa},
2124 {0x00, 0xa8, 0xf0, 0xaa},
2125 {0x00, 0xa9, 0x90, 0xaa},
2126 {0x00, 0xaa, 0x14, 0xaa},
2127 {0x00, 0x13, 0xe5, 0xaa},
2128 {0x00, 0x0e, 0x61, 0xaa},
2129 {0x00, 0x0f, 0x4b, 0xaa},
2130 {0x00, 0x16, 0x02, 0xaa},
Jean-Francois Moine7dc7ad32008-12-08 05:13:53 -03002131 {0x00, 0x1e, 0x07, 0xaa}, /* MVFP */
2132 {0x00, 0x21, 0x02, 0xaa},
Jean-François Moine5624c642010-04-02 07:12:42 -03002133 {0x00, 0x22, 0x91, 0xaa},
2134 {0x00, 0x29, 0x07, 0xaa},
2135 {0x00, 0x33, 0x0b, 0xaa},
2136 {0x00, 0x35, 0x0b, 0xaa},
2137 {0x00, 0x37, 0x1d, 0xaa},
2138 {0x00, 0x38, 0x71, 0xaa},
2139 {0x00, 0x39, 0x2a, 0xaa},
2140 {0x00, 0x3c, 0x78, 0xaa},
2141 {0x00, 0x4d, 0x40, 0xaa},
2142 {0x00, 0x4e, 0x20, 0xaa},
2143 {0x00, 0x74, 0x19, 0xaa},
2144 {0x00, 0x8d, 0x4f, 0xaa},
2145 {0x00, 0x8e, 0x00, 0xaa},
2146 {0x00, 0x8f, 0x00, 0xaa},
2147 {0x00, 0x90, 0x00, 0xaa},
2148 {0x00, 0x91, 0x00, 0xaa},
2149 {0x00, 0x96, 0x00, 0xaa},
2150 {0x00, 0x9a, 0x80, 0xaa},
2151 {0x00, 0xb0, 0x84, 0xaa},
2152 {0x00, 0xb1, 0x0c, 0xaa},
2153 {0x00, 0xb2, 0x0e, 0xaa},
2154 {0x00, 0xb3, 0x82, 0xaa},
2155 {0x00, 0xb8, 0x0a, 0xaa},
2156 {0x00, 0x43, 0x14, 0xaa},
2157 {0x00, 0x44, 0xf0, 0xaa},
2158 {0x00, 0x45, 0x45, 0xaa},
2159 {0x00, 0x46, 0x63, 0xaa},
2160 {0x00, 0x47, 0x2d, 0xaa},
2161 {0x00, 0x48, 0x46, 0xaa},
2162 {0x00, 0x59, 0x88, 0xaa},
2163 {0x00, 0x5a, 0xa0, 0xaa},
2164 {0x00, 0x5b, 0xc6, 0xaa},
2165 {0x00, 0x5c, 0x7d, 0xaa},
2166 {0x00, 0x5d, 0x5f, 0xaa},
2167 {0x00, 0x5e, 0x19, 0xaa},
2168 {0x00, 0x6c, 0x0a, 0xaa},
2169 {0x00, 0x6d, 0x55, 0xaa},
2170 {0x00, 0x6e, 0x11, 0xaa},
2171 {0x00, 0x6f, 0x9e, 0xaa},
2172 {0x00, 0x69, 0x00, 0xaa},
2173 {0x00, 0x6a, 0x40, 0xaa},
2174 {0x00, 0x01, 0x40, 0xaa},
2175 {0x00, 0x02, 0x40, 0xaa},
2176 {0x00, 0x13, 0xe7, 0xaa},
2177 {0x00, 0x5f, 0xf0, 0xaa},
2178 {0x00, 0x60, 0xf0, 0xaa},
2179 {0x00, 0x61, 0xf0, 0xaa},
2180 {0x00, 0x27, 0xa0, 0xaa},
2181 {0x00, 0x28, 0x80, 0xaa},
2182 {0x00, 0x2c, 0x90, 0xaa},
2183 {0x00, 0x4f, 0x66, 0xaa},
2184 {0x00, 0x50, 0x66, 0xaa},
2185 {0x00, 0x51, 0x00, 0xaa},
2186 {0x00, 0x52, 0x22, 0xaa},
2187 {0x00, 0x53, 0x5e, 0xaa},
2188 {0x00, 0x54, 0x80, 0xaa},
2189 {0x00, 0x58, 0x9e, 0xaa},
2190 {0x00, 0x41, 0x08, 0xaa},
2191 {0x00, 0x3f, 0x00, 0xaa},
2192 {0x00, 0x75, 0x85, 0xaa},
2193 {0x00, 0x76, 0xe1, 0xaa},
2194 {0x00, 0x4c, 0x00, 0xaa},
2195 {0x00, 0x77, 0x0a, 0xaa},
2196 {0x00, 0x3d, 0x88, 0xaa},
2197 {0x00, 0x4b, 0x09, 0xaa},
2198 {0x00, 0xc9, 0x60, 0xaa},
2199 {0x00, 0x41, 0x38, 0xaa},
2200 {0x00, 0x62, 0x30, 0xaa},
2201 {0x00, 0x63, 0x30, 0xaa},
2202 {0x00, 0x64, 0x08, 0xaa},
2203 {0x00, 0x94, 0x07, 0xaa},
2204 {0x00, 0x95, 0x0b, 0xaa},
2205 {0x00, 0x65, 0x00, 0xaa},
2206 {0x00, 0x66, 0x05, 0xaa},
2207 {0x00, 0x56, 0x50, 0xaa},
2208 {0x00, 0x34, 0x11, 0xaa},
2209 {0x00, 0xa4, 0x88, 0xaa},
2210 {0x00, 0x96, 0x00, 0xaa},
2211 {0x00, 0x97, 0x30, 0xaa},
2212 {0x00, 0x98, 0x20, 0xaa},
2213 {0x00, 0x99, 0x30, 0xaa},
2214 {0x00, 0x9a, 0x84, 0xaa},
2215 {0x00, 0x9b, 0x29, 0xaa},
2216 {0x00, 0x9c, 0x03, 0xaa},
2217 {0x00, 0x78, 0x04, 0xaa},
2218 {0x00, 0x79, 0x01, 0xaa},
2219 {0x00, 0xc8, 0xf0, 0xaa},
2220 {0x00, 0x79, 0x0f, 0xaa},
2221 {0x00, 0xc8, 0x00, 0xaa},
2222 {0x00, 0x79, 0x10, 0xaa},
2223 {0x00, 0xc8, 0x7e, 0xaa},
2224 {0x00, 0x79, 0x0a, 0xaa},
2225 {0x00, 0xc8, 0x80, 0xaa},
2226 {0x00, 0x79, 0x0b, 0xaa},
2227 {0x00, 0xc8, 0x01, 0xaa},
2228 {0x00, 0x79, 0x0c, 0xaa},
2229 {0x00, 0xc8, 0x0f, 0xaa},
2230 {0x00, 0x79, 0x0d, 0xaa},
2231 {0x00, 0xc8, 0x20, 0xaa},
2232 {0x00, 0x79, 0x09, 0xaa},
2233 {0x00, 0xc8, 0x80, 0xaa},
2234 {0x00, 0x79, 0x02, 0xaa},
2235 {0x00, 0xc8, 0xc0, 0xaa},
2236 {0x00, 0x79, 0x03, 0xaa},
2237 {0x00, 0xc8, 0x40, 0xaa},
2238 {0x00, 0x79, 0x05, 0xaa},
2239 {0x00, 0xc8, 0x30, 0xaa},
2240 {0x00, 0x79, 0x26, 0xaa},
2241 {0x00, 0x11, 0x40, 0xaa},
2242 {0x00, 0x3a, 0x04, 0xaa},
2243 {0x00, 0x12, 0x00, 0xaa},
2244 {0x00, 0x40, 0xc0, 0xaa},
2245 {0x00, 0x8c, 0x00, 0xaa},
2246 {0x00, 0x17, 0x14, 0xaa},
2247 {0x00, 0x18, 0x02, 0xaa},
2248 {0x00, 0x32, 0x92, 0xaa},
2249 {0x00, 0x19, 0x02, 0xaa},
2250 {0x00, 0x1a, 0x7a, 0xaa},
2251 {0x00, 0x03, 0x0a, 0xaa},
2252 {0x00, 0x0c, 0x00, 0xaa},
2253 {0x00, 0x3e, 0x00, 0xaa},
2254 {0x00, 0x70, 0x3a, 0xaa},
2255 {0x00, 0x71, 0x35, 0xaa},
2256 {0x00, 0x72, 0x11, 0xaa},
2257 {0x00, 0x73, 0xf0, 0xaa},
2258 {0x00, 0xa2, 0x02, 0xaa},
2259 {0x00, 0xb1, 0x00, 0xaa},
2260 {0x00, 0xb1, 0x0c, 0xaa},
Jean-Francois Moine7dc7ad32008-12-08 05:13:53 -03002261 {0x00, 0x1e, 0x37, 0xaa}, /* MVFP */
2262 {0x00, 0xaa, 0x14, 0xaa},
Jean-François Moine5624c642010-04-02 07:12:42 -03002263 {0x00, 0x24, 0x80, 0xaa},
2264 {0x00, 0x25, 0x74, 0xaa},
2265 {0x00, 0x26, 0xd3, 0xaa},
2266 {0x00, 0x0d, 0x00, 0xaa},
2267 {0x00, 0x14, 0x18, 0xaa},
2268 {0x00, 0x9d, 0x99, 0xaa},
2269 {0x00, 0x9e, 0x7f, 0xaa},
2270 {0x00, 0x64, 0x08, 0xaa},
2271 {0x00, 0x94, 0x07, 0xaa},
2272 {0x00, 0x95, 0x06, 0xaa},
2273 {0x00, 0x66, 0x05, 0xaa},
2274 {0x00, 0x41, 0x08, 0xaa},
2275 {0x00, 0x3f, 0x00, 0xaa},
2276 {0x00, 0x75, 0x07, 0xaa},
2277 {0x00, 0x76, 0xe1, 0xaa},
2278 {0x00, 0x4c, 0x00, 0xaa},
2279 {0x00, 0x77, 0x00, 0xaa},
2280 {0x00, 0x3d, 0xc2, 0xaa},
2281 {0x00, 0x4b, 0x09, 0xaa},
2282 {0x00, 0xc9, 0x60, 0xaa},
2283 {0x00, 0x41, 0x38, 0xaa},
2284 {0xbc, 0x02, 0x18, 0xcc},
2285 {0xbc, 0x03, 0x50, 0xcc},
2286 {0xbc, 0x04, 0x18, 0xcc},
2287 {0xbc, 0x05, 0x00, 0xcc},
2288 {0xbc, 0x06, 0x00, 0xcc},
2289 {0xbc, 0x08, 0x30, 0xcc},
2290 {0xbc, 0x09, 0x40, 0xcc},
2291 {0xbc, 0x0a, 0x10, 0xcc},
2292 {0xbc, 0x0b, 0x00, 0xcc},
2293 {0xbc, 0x0c, 0x00, 0xcc},
2294 {0xbf, 0xc0, 0x26, 0xcc},
2295 {0xbf, 0xc1, 0x02, 0xcc},
2296 {0xbf, 0xcc, 0x04, 0xcc},
2297 {0xb3, 0x5c, 0x01, 0xcc},
2298 {0xb3, 0x01, 0x45, 0xcc},
2299 {0x00, 0x77, 0x05, 0xaa},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03002300 {},
2301};
Jean-Francois Moine88521532008-12-10 05:06:13 -03002302
2303/* PO1200 - values from usbvm326.inf and ms-win trace */
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03002304static const u8 po1200_gamma[17] = {
Jean-Francois Moine88521532008-12-10 05:06:13 -03002305 0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
2306 0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
2307};
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03002308static const u8 po1200_matrix[9] = {
Jean-Francois Moine88521532008-12-10 05:06:13 -03002309 0x60, 0xf9, 0xe5, 0xe7, 0x50, 0x05, 0xf3, 0xe6, 0x5e
2310};
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03002311static const u8 po1200_initVGA_data[][4] = {
Jean-Francois Moine88521532008-12-10 05:06:13 -03002312 {0xb0, 0x03, 0x19, 0xcc}, /* reset? */
2313 {0xb0, 0x03, 0x19, 0xcc},
2314/* {0x00, 0x00, 0x33, 0xdd}, */
2315 {0xb0, 0x04, 0x02, 0xcc},
2316 {0xb0, 0x02, 0x02, 0xcc},
2317 {0xb3, 0x5d, 0x00, 0xcc},
2318 {0xb3, 0x01, 0x01, 0xcc},
2319 {0xb3, 0x00, 0x64, 0xcc},
2320 {0xb3, 0x00, 0x65, 0xcc},
2321 {0xb3, 0x05, 0x01, 0xcc},
2322 {0xb3, 0x06, 0x01, 0xcc},
2323 {0xb3, 0x5c, 0x01, 0xcc},
2324 {0xb3, 0x08, 0x01, 0xcc},
2325 {0xb3, 0x09, 0x0c, 0xcc},
2326 {0xb3, 0x00, 0x67, 0xcc},
2327 {0xb3, 0x02, 0xb2, 0xcc},
2328 {0xb3, 0x03, 0x18, 0xcc},
2329 {0xb3, 0x04, 0x15, 0xcc},
2330 {0xb3, 0x20, 0x00, 0xcc},
2331 {0xb3, 0x21, 0x00, 0xcc},
2332 {0xb3, 0x22, 0x02, 0xcc},
2333 {0xb3, 0x23, 0x58, 0xcc},
2334 {0xb3, 0x14, 0x00, 0xcc},
2335 {0xb3, 0x15, 0x00, 0xcc},
2336 {0xb3, 0x16, 0x03, 0xcc},
2337 {0xb3, 0x17, 0x1f, 0xcc},
2338 {0xbc, 0x00, 0x71, 0xcc},
2339 {0xbc, 0x01, 0x01, 0xcc},
2340 {0xb0, 0x54, 0x13, 0xcc},
2341 {0xb3, 0x00, 0x67, 0xcc},
2342 {0xb3, 0x34, 0x01, 0xcc},
Jean-Francois Moineff1cf402009-12-26 15:18:02 -03002343 {0xb3, 0x35, 0xdc, 0xcc}, /* i2c add: 5c */
Jean-Francois Moine88521532008-12-10 05:06:13 -03002344 {0x00, 0x03, 0x00, 0xaa},
2345 {0x00, 0x12, 0x05, 0xaa},
2346 {0x00, 0x13, 0x02, 0xaa},
Jean-Francois Moine47a42b02008-12-13 07:45:34 -03002347 {0x00, 0x1e, 0xc6, 0xaa}, /* h/v flip */
Jean-Francois Moine88521532008-12-10 05:06:13 -03002348 {0x00, 0x21, 0x00, 0xaa},
2349 {0x00, 0x25, 0x02, 0xaa},
2350 {0x00, 0x3c, 0x4f, 0xaa},
2351 {0x00, 0x3f, 0xe0, 0xaa},
2352 {0x00, 0x42, 0xff, 0xaa},
2353 {0x00, 0x45, 0x34, 0xaa},
2354 {0x00, 0x55, 0xfe, 0xaa},
2355 {0x00, 0x59, 0xd3, 0xaa},
2356 {0x00, 0x5e, 0x04, 0xaa},
Jean-Francois Moine47a42b02008-12-13 07:45:34 -03002357 {0x00, 0x61, 0xb8, 0xaa}, /* sharpness */
Jean-Francois Moine88521532008-12-10 05:06:13 -03002358 {0x00, 0x62, 0x02, 0xaa},
2359 {0x00, 0xa7, 0x31, 0xaa},
2360 {0x00, 0xa9, 0x66, 0xaa},
2361 {0x00, 0xb0, 0x00, 0xaa},
2362 {0x00, 0xb1, 0x00, 0xaa},
2363 {0x00, 0xb3, 0x11, 0xaa},
2364 {0x00, 0xb6, 0x26, 0xaa},
2365 {0x00, 0xb7, 0x20, 0xaa},
2366 {0x00, 0xba, 0x04, 0xaa},
2367 {0x00, 0x88, 0x42, 0xaa},
2368 {0x00, 0x89, 0x9a, 0xaa},
2369 {0x00, 0x8a, 0x88, 0xaa},
2370 {0x00, 0x8b, 0x8e, 0xaa},
2371 {0x00, 0x8c, 0x3e, 0xaa},
2372 {0x00, 0x8d, 0x90, 0xaa},
2373 {0x00, 0x8e, 0x87, 0xaa},
2374 {0x00, 0x8f, 0x96, 0xaa},
2375 {0x00, 0x90, 0x3d, 0xaa},
2376 {0x00, 0x64, 0x00, 0xaa},
2377 {0x00, 0x65, 0x10, 0xaa},
2378 {0x00, 0x66, 0x20, 0xaa},
2379 {0x00, 0x67, 0x2b, 0xaa},
2380 {0x00, 0x68, 0x36, 0xaa},
2381 {0x00, 0x69, 0x49, 0xaa},
2382 {0x00, 0x6a, 0x5a, 0xaa},
2383 {0x00, 0x6b, 0x7f, 0xaa},
2384 {0x00, 0x6c, 0x9b, 0xaa},
2385 {0x00, 0x6d, 0xba, 0xaa},
2386 {0x00, 0x6e, 0xd4, 0xaa},
2387 {0x00, 0x6f, 0xea, 0xaa},
2388 {0x00, 0x70, 0x00, 0xaa},
2389 {0x00, 0x71, 0x10, 0xaa},
2390 {0x00, 0x72, 0x20, 0xaa},
2391 {0x00, 0x73, 0x2b, 0xaa},
2392 {0x00, 0x74, 0x36, 0xaa},
2393 {0x00, 0x75, 0x49, 0xaa},
2394 {0x00, 0x76, 0x5a, 0xaa},
2395 {0x00, 0x77, 0x7f, 0xaa},
2396 {0x00, 0x78, 0x9b, 0xaa},
2397 {0x00, 0x79, 0xba, 0xaa},
2398 {0x00, 0x7a, 0xd4, 0xaa},
2399 {0x00, 0x7b, 0xea, 0xaa},
2400 {0x00, 0x7c, 0x00, 0xaa},
2401 {0x00, 0x7d, 0x10, 0xaa},
2402 {0x00, 0x7e, 0x20, 0xaa},
2403 {0x00, 0x7f, 0x2b, 0xaa},
2404 {0x00, 0x80, 0x36, 0xaa},
2405 {0x00, 0x81, 0x49, 0xaa},
2406 {0x00, 0x82, 0x5a, 0xaa},
2407 {0x00, 0x83, 0x7f, 0xaa},
2408 {0x00, 0x84, 0x9b, 0xaa},
2409 {0x00, 0x85, 0xba, 0xaa},
2410 {0x00, 0x86, 0xd4, 0xaa},
2411 {0x00, 0x87, 0xea, 0xaa},
2412 {0x00, 0x57, 0x2a, 0xaa},
2413 {0x00, 0x03, 0x01, 0xaa},
2414 {0x00, 0x04, 0x10, 0xaa},
2415 {0x00, 0x05, 0x10, 0xaa},
2416 {0x00, 0x06, 0x10, 0xaa},
2417 {0x00, 0x07, 0x10, 0xaa},
2418 {0x00, 0x08, 0x13, 0xaa},
2419 {0x00, 0x0a, 0x00, 0xaa},
2420 {0x00, 0x0b, 0x10, 0xaa},
2421 {0x00, 0x0c, 0x20, 0xaa},
2422 {0x00, 0x0d, 0x18, 0xaa},
2423 {0x00, 0x22, 0x01, 0xaa},
2424 {0x00, 0x23, 0x60, 0xaa},
2425 {0x00, 0x25, 0x08, 0xaa},
2426 {0x00, 0x26, 0x82, 0xaa},
2427 {0x00, 0x2e, 0x0f, 0xaa},
2428 {0x00, 0x2f, 0x1e, 0xaa},
2429 {0x00, 0x30, 0x2d, 0xaa},
2430 {0x00, 0x31, 0x3c, 0xaa},
2431 {0x00, 0x32, 0x4b, 0xaa},
2432 {0x00, 0x33, 0x5a, 0xaa},
2433 {0x00, 0x34, 0x69, 0xaa},
2434 {0x00, 0x35, 0x78, 0xaa},
2435 {0x00, 0x36, 0x87, 0xaa},
2436 {0x00, 0x37, 0x96, 0xaa},
2437 {0x00, 0x38, 0xa5, 0xaa},
2438 {0x00, 0x39, 0xb4, 0xaa},
2439 {0x00, 0x3a, 0xc3, 0xaa},
2440 {0x00, 0x3b, 0xd2, 0xaa},
2441 {0x00, 0x3c, 0xe1, 0xaa},
2442 {0x00, 0x3e, 0xff, 0xaa},
2443 {0x00, 0x3f, 0xff, 0xaa},
2444 {0x00, 0x40, 0xff, 0xaa},
2445 {0x00, 0x41, 0xff, 0xaa},
2446 {0x00, 0x42, 0xff, 0xaa},
2447 {0x00, 0x43, 0xff, 0xaa},
2448 {0x00, 0x03, 0x00, 0xaa},
2449 {0x00, 0x03, 0x00, 0xaa},
2450 {0x00, 0x20, 0xc4, 0xaa},
2451 {0x00, 0x13, 0x03, 0xaa},
2452 {0x00, 0x3c, 0x50, 0xaa},
Jean-Francois Moine47a42b02008-12-13 07:45:34 -03002453 {0x00, 0x61, 0x6a, 0xaa}, /* sharpness? */
Jean-Francois Moine88521532008-12-10 05:06:13 -03002454 {0x00, 0x51, 0x5b, 0xaa},
2455 {0x00, 0x52, 0x91, 0xaa},
2456 {0x00, 0x53, 0x4c, 0xaa},
2457 {0x00, 0x54, 0x50, 0xaa},
2458 {0x00, 0x56, 0x02, 0xaa},
2459 {0xb6, 0x00, 0x00, 0xcc},
2460 {0xb6, 0x03, 0x03, 0xcc},
2461 {0xb6, 0x02, 0x20, 0xcc},
2462 {0xb6, 0x05, 0x02, 0xcc},
2463 {0xb6, 0x04, 0x58, 0xcc},
2464 {0xb6, 0x12, 0xf8, 0xcc},
2465 {0xb6, 0x13, 0x21, 0xcc},
2466 {0xb6, 0x18, 0x03, 0xcc},
2467 {0xb6, 0x17, 0xa9, 0xcc},
2468 {0xb6, 0x16, 0x80, 0xcc},
2469 {0xb6, 0x22, 0x12, 0xcc},
2470 {0xb6, 0x23, 0x0b, 0xcc},
2471 {0xbf, 0xc0, 0x39, 0xcc},
2472 {0xbf, 0xc1, 0x04, 0xcc},
2473 {0xbf, 0xcc, 0x00, 0xcc},
2474 {0xb8, 0x06, 0x20, 0xcc},
2475 {0xb8, 0x07, 0x03, 0xcc},
2476 {0xb8, 0x08, 0x58, 0xcc},
2477 {0xb8, 0x09, 0x02, 0xcc},
2478 {0xb3, 0x01, 0x41, 0xcc},
2479 {0x00, 0x03, 0x00, 0xaa},
2480 {0x00, 0xd9, 0x0f, 0xaa},
2481 {0x00, 0xda, 0xaa, 0xaa},
2482 {0x00, 0xd9, 0x10, 0xaa},
2483 {0x00, 0xda, 0xaa, 0xaa},
2484 {0x00, 0xd9, 0x11, 0xaa},
2485 {0x00, 0xda, 0x00, 0xaa},
2486 {0x00, 0xd9, 0x12, 0xaa},
2487 {0x00, 0xda, 0xff, 0xaa},
2488 {0x00, 0xd9, 0x13, 0xaa},
2489 {0x00, 0xda, 0xff, 0xaa},
2490 {0x00, 0xe8, 0x11, 0xaa},
2491 {0x00, 0xe9, 0x12, 0xaa},
2492 {0x00, 0xea, 0x5c, 0xaa},
2493 {0x00, 0xeb, 0xff, 0xaa},
2494 {0x00, 0xd8, 0x80, 0xaa},
2495 {0x00, 0xe6, 0x02, 0xaa},
2496 {0x00, 0xd6, 0x40, 0xaa},
2497 {0x00, 0xe3, 0x05, 0xaa},
2498 {0x00, 0xe0, 0x40, 0xaa},
2499 {0x00, 0xde, 0x03, 0xaa},
2500 {0x00, 0xdf, 0x03, 0xaa},
2501 {0x00, 0xdb, 0x02, 0xaa},
2502 {0x00, 0xdc, 0x00, 0xaa},
2503 {0x00, 0xdd, 0x03, 0xaa},
2504 {0x00, 0xe1, 0x08, 0xaa},
2505 {0x00, 0xe2, 0x01, 0xaa},
2506 {0x00, 0xd6, 0x40, 0xaa},
2507 {0x00, 0xe4, 0x40, 0xaa},
Jean-Francois Moine47a42b02008-12-13 07:45:34 -03002508 {0x00, 0xa8, 0x8f, 0xaa},
Jean-Francois Moine88521532008-12-10 05:06:13 -03002509 {0x00, 0xb4, 0x16, 0xaa},
2510 {0xb0, 0x02, 0x06, 0xcc},
2511 {0xb0, 0x18, 0x06, 0xcc},
2512 {0xb0, 0x19, 0x06, 0xcc},
2513 {0xb3, 0x5d, 0x18, 0xcc},
2514 {0xb3, 0x05, 0x00, 0xcc},
2515 {0xb3, 0x06, 0x00, 0xcc},
2516 {0x00, 0xb4, 0x0e, 0xaa},
2517 {0x00, 0xb5, 0x49, 0xaa},
2518 {0x00, 0xb6, 0x1c, 0xaa},
2519 {0x00, 0xb7, 0x96, 0xaa},
2520/* end of usbvm326.inf - start of ms-win trace */
2521 {0xb6, 0x12, 0xf8, 0xcc},
2522 {0xb6, 0x13, 0x3d, 0xcc},
2523/*read b306*/
2524 {0x00, 0x03, 0x00, 0xaa},
2525 {0x00, 0x1a, 0x09, 0xaa},
2526 {0x00, 0x1b, 0x8a, 0xaa},
2527/*read b827*/
2528 {0xb8, 0x27, 0x00, 0xcc},
2529 {0xb8, 0x26, 0x60, 0xcc},
2530 {0xb8, 0x26, 0x60, 0xcc},
2531/*gamma - to do?*/
2532 {0x00, 0x03, 0x00, 0xaa},
2533 {0x00, 0xae, 0x84, 0xaa},
2534/*gamma again*/
2535 {0x00, 0x03, 0x00, 0xaa},
2536 {0x00, 0x96, 0xa0, 0xaa},
2537/*matrix*/
2538 {0x00, 0x03, 0x00, 0xaa},
2539 {0x00, 0x91, 0x35, 0xaa},
2540 {0x00, 0x92, 0x22, 0xaa},
2541/*gamma*/
2542 {0x00, 0x03, 0x00, 0xaa},
2543 {0x00, 0x95, 0x85, 0xaa},
2544/*matrix*/
2545 {0x00, 0x03, 0x00, 0xaa},
Jean-Francois Moine88521532008-12-10 05:06:13 -03002546 {0x00, 0x4d, 0x20, 0xaa},
2547 {0xb8, 0x22, 0x40, 0xcc},
2548 {0xb8, 0x23, 0x40, 0xcc},
2549 {0xb8, 0x24, 0x40, 0xcc},
2550 {0xb8, 0x81, 0x09, 0xcc},
2551 {0x00, 0x00, 0x64, 0xdd},
2552 {0x00, 0x03, 0x01, 0xaa},
2553/*read 46*/
2554 {0x00, 0x46, 0x3c, 0xaa},
2555 {0x00, 0x03, 0x00, 0xaa},
2556 {0x00, 0x16, 0x40, 0xaa},
2557 {0x00, 0x17, 0x40, 0xaa},
2558 {0x00, 0x18, 0x40, 0xaa},
2559 {0x00, 0x19, 0x41, 0xaa},
2560 {0x00, 0x03, 0x01, 0xaa},
2561 {0x00, 0x46, 0x3c, 0xaa},
2562 {0x00, 0x00, 0x18, 0xdd},
2563/*read bfff*/
2564 {0x00, 0x03, 0x00, 0xaa},
Jean-Francois Moine88521532008-12-10 05:06:13 -03002565 {0x00, 0xb4, 0x1c, 0xaa},
2566 {0x00, 0xb5, 0x92, 0xaa},
2567 {0x00, 0xb6, 0x39, 0xaa},
2568 {0x00, 0xb7, 0x24, 0xaa},
2569/*write 89 0400 1415*/
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03002570 {}
2571};
2572
2573static const u8 poxxxx_init_common[][4] = {
2574 {0xb3, 0x00, 0x04, 0xcc},
2575 {0x00, 0x00, 0x10, 0xdd},
2576 {0xb3, 0x00, 0x64, 0xcc},
2577 {0x00, 0x00, 0x10, 0xdd},
2578 {0xb3, 0x00, 0x65, 0xcc},
2579 {0x00, 0x00, 0x10, 0xdd},
2580 {0xb3, 0x00, 0x67, 0xcc},
2581 {0xb0, 0x03, 0x09, 0xcc},
2582 {0xb3, 0x05, 0x00, 0xcc},
2583 {0xb3, 0x06, 0x00, 0xcc},
2584 {0xb3, 0x5c, 0x01, 0xcc},
2585 {0xb3, 0x08, 0x01, 0xcc},
2586 {0xb3, 0x09, 0x0c, 0xcc},
2587 {0xb3, 0x34, 0x01, 0xcc},
2588 {0xb3, 0x35, 0xf6, 0xcc}, /* i2c add: 76 */
2589 {0xb3, 0x02, 0xb0, 0xcc},
2590 {0xb3, 0x03, 0x18, 0xcc},
2591 {0xb3, 0x04, 0x15, 0xcc},
2592 {0xb3, 0x20, 0x00, 0xcc},
2593 {0xb3, 0x21, 0x00, 0xcc},
Jean-François Moine98475cb2010-07-06 04:44:54 -03002594 {0xb3, 0x22, 0x04, 0xcc}, /* sensor height = 1024 */
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03002595 {0xb3, 0x23, 0x00, 0xcc},
2596 {0xb3, 0x14, 0x00, 0xcc},
2597 {0xb3, 0x15, 0x00, 0xcc},
Jean-François Moine98475cb2010-07-06 04:44:54 -03002598 {0xb3, 0x16, 0x04, 0xcc}, /* sensor width = 1280 */
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03002599 {0xb3, 0x17, 0xff, 0xcc},
2600 {0xb3, 0x2c, 0x03, 0xcc},
2601 {0xb3, 0x2d, 0x56, 0xcc},
2602 {0xb3, 0x2e, 0x02, 0xcc},
2603 {0xb3, 0x2f, 0x0a, 0xcc},
2604 {0xb3, 0x40, 0x00, 0xcc},
2605 {0xb3, 0x41, 0x34, 0xcc},
2606 {0xb3, 0x42, 0x01, 0xcc},
2607 {0xb3, 0x43, 0xe0, 0xcc},
2608 {0xbc, 0x00, 0x71, 0xcc},
2609 {0xbc, 0x01, 0x01, 0xcc},
2610 {0xb3, 0x01, 0x41, 0xcc},
2611 {0xb3, 0x4d, 0x00, 0xcc},
2612 {0x00, 0x0b, 0x2a, 0xaa},
2613 {0x00, 0x0e, 0x03, 0xaa},
2614 {0x00, 0x0f, 0xea, 0xaa},
2615 {0x00, 0x12, 0x08, 0xaa},
2616 {0x00, 0x1e, 0x06, 0xaa},
2617 {0x00, 0x21, 0x00, 0xaa},
2618 {0x00, 0x31, 0x1f, 0xaa},
2619 {0x00, 0x33, 0x38, 0xaa},
2620 {0x00, 0x36, 0xc0, 0xaa},
2621 {0x00, 0x37, 0xc8, 0xaa},
2622 {0x00, 0x3b, 0x36, 0xaa},
2623 {0x00, 0x4b, 0xfe, 0xaa},
2624 {0x00, 0x4d, 0x2e, 0xaa},
2625 {0x00, 0x51, 0x1c, 0xaa},
2626 {0x00, 0x52, 0x01, 0xaa},
2627 {0x00, 0x55, 0x0a, 0xaa},
2628 {0x00, 0x56, 0x0a, 0xaa},
2629 {0x00, 0x57, 0x07, 0xaa},
2630 {0x00, 0x58, 0x07, 0xaa},
2631 {0x00, 0x59, 0x04, 0xaa},
2632 {0x00, 0x70, 0x68, 0xaa},
2633 {0x00, 0x71, 0x04, 0xaa},
2634 {0x00, 0x72, 0x10, 0xaa},
2635 {0x00, 0x80, 0x71, 0xaa},
2636 {0x00, 0x81, 0x08, 0xaa},
2637 {0x00, 0x82, 0x00, 0xaa},
2638 {0x00, 0x83, 0x55, 0xaa},
2639 {0x00, 0x84, 0x06, 0xaa},
2640 {0x00, 0x85, 0x06, 0xaa},
2641 {0x00, 0x8b, 0x25, 0xaa},
2642 {0x00, 0x8c, 0x00, 0xaa},
2643 {0x00, 0x8d, 0x86, 0xaa},
2644 {0x00, 0x8e, 0x82, 0xaa},
2645 {0x00, 0x8f, 0x2d, 0xaa},
2646 {0x00, 0x90, 0x8b, 0xaa},
2647 {0x00, 0x91, 0x81, 0xaa},
2648 {0x00, 0x92, 0x81, 0xaa},
2649 {0x00, 0x93, 0x23, 0xaa},
2650 {0x00, 0xa3, 0x2a, 0xaa},
2651 {0x00, 0xa4, 0x03, 0xaa},
2652 {0x00, 0xa5, 0xea, 0xaa},
2653 {0x00, 0xb0, 0x68, 0xaa},
2654 {0x00, 0xbc, 0x04, 0xaa},
2655 {0x00, 0xbe, 0x3b, 0xaa},
2656 {0x00, 0x4e, 0x40, 0xaa},
2657 {0x00, 0x06, 0x04, 0xaa},
2658 {0x00, 0x07, 0x03, 0xaa},
2659 {0x00, 0xcd, 0x18, 0xaa},
2660 {0x00, 0x28, 0x03, 0xaa},
2661 {0x00, 0x29, 0xef, 0xaa},
2662/* reinit on alt 2 (qvga) or alt7 (vga) */
2663 {0xb3, 0x05, 0x00, 0xcc},
2664 {0xb3, 0x06, 0x00, 0xcc},
2665 {0xb8, 0x00, 0x01, 0xcc},
2666
2667 {0x00, 0x1d, 0x85, 0xaa},
2668 {0x00, 0x1e, 0xc6, 0xaa},
2669 {0x00, 0x00, 0x40, 0xdd},
2670 {0x00, 0x1d, 0x05, 0xaa},
Jean-François Moine486cb2d2010-07-26 07:53:57 -03002671 {}
2672};
2673static const u8 poxxxx_gamma[][4] = {
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03002674 {0x00, 0xd6, 0x22, 0xaa}, /* gamma 0 */
2675 {0x00, 0x73, 0x00, 0xaa},
2676 {0x00, 0x74, 0x0a, 0xaa},
2677 {0x00, 0x75, 0x16, 0xaa},
2678 {0x00, 0x76, 0x25, 0xaa},
2679 {0x00, 0x77, 0x34, 0xaa},
2680 {0x00, 0x78, 0x49, 0xaa},
2681 {0x00, 0x79, 0x5a, 0xaa},
2682 {0x00, 0x7a, 0x7f, 0xaa},
2683 {0x00, 0x7b, 0x9b, 0xaa},
2684 {0x00, 0x7c, 0xba, 0xaa},
2685 {0x00, 0x7d, 0xd4, 0xaa},
2686 {0x00, 0x7e, 0xea, 0xaa},
2687
2688 {0x00, 0xd6, 0x62, 0xaa}, /* gamma 1 */
2689 {0x00, 0x73, 0x00, 0xaa},
2690 {0x00, 0x74, 0x0a, 0xaa},
2691 {0x00, 0x75, 0x16, 0xaa},
2692 {0x00, 0x76, 0x25, 0xaa},
2693 {0x00, 0x77, 0x34, 0xaa},
2694 {0x00, 0x78, 0x49, 0xaa},
2695 {0x00, 0x79, 0x5a, 0xaa},
2696 {0x00, 0x7a, 0x7f, 0xaa},
2697 {0x00, 0x7b, 0x9b, 0xaa},
2698 {0x00, 0x7c, 0xba, 0xaa},
2699 {0x00, 0x7d, 0xd4, 0xaa},
2700 {0x00, 0x7e, 0xea, 0xaa},
2701
2702 {0x00, 0xd6, 0xa2, 0xaa}, /* gamma 2 */
2703 {0x00, 0x73, 0x00, 0xaa},
2704 {0x00, 0x74, 0x0a, 0xaa},
2705 {0x00, 0x75, 0x16, 0xaa},
2706 {0x00, 0x76, 0x25, 0xaa},
2707 {0x00, 0x77, 0x34, 0xaa},
2708 {0x00, 0x78, 0x49, 0xaa},
2709 {0x00, 0x79, 0x5a, 0xaa},
2710 {0x00, 0x7a, 0x7f, 0xaa},
2711 {0x00, 0x7b, 0x9b, 0xaa},
2712 {0x00, 0x7c, 0xba, 0xaa},
2713 {0x00, 0x7d, 0xd4, 0xaa},
2714 {0x00, 0x7e, 0xea, 0xaa},
Jean-François Moine486cb2d2010-07-26 07:53:57 -03002715 {}
2716};
2717static const u8 poxxxx_init_start_3[][4] = {
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03002718 {0x00, 0xb8, 0x28, 0xaa},
2719 {0x00, 0xb9, 0x1e, 0xaa},
2720 {0x00, 0xb6, 0x14, 0xaa},
2721 {0x00, 0xb7, 0x0f, 0xaa},
2722 {0x00, 0x5c, 0x10, 0xaa},
2723 {0x00, 0x5d, 0x18, 0xaa},
2724 {0x00, 0x5e, 0x24, 0xaa},
2725 {0x00, 0x5f, 0x24, 0xaa},
2726 {0x00, 0x86, 0x1a, 0xaa},
2727 {0x00, 0x60, 0x00, 0xaa},
2728 {0x00, 0x61, 0x1b, 0xaa},
2729 {0x00, 0x62, 0x30, 0xaa},
2730 {0x00, 0x63, 0x40, 0xaa},
2731 {0x00, 0x87, 0x1a, 0xaa},
2732 {0x00, 0x64, 0x00, 0xaa},
2733 {0x00, 0x65, 0x08, 0xaa},
2734 {0x00, 0x66, 0x10, 0xaa},
2735 {0x00, 0x67, 0x20, 0xaa},
2736 {0x00, 0x88, 0x10, 0xaa},
2737 {0x00, 0x68, 0x00, 0xaa},
2738 {0x00, 0x69, 0x08, 0xaa},
2739 {0x00, 0x6a, 0x0f, 0xaa},
2740 {0x00, 0x6b, 0x0f, 0xaa},
2741 {0x00, 0x89, 0x07, 0xaa},
2742 {0x00, 0xd5, 0x4c, 0xaa},
2743 {0x00, 0x0a, 0x00, 0xaa},
2744 {0x00, 0x0b, 0x2a, 0xaa},
2745 {0x00, 0x0e, 0x03, 0xaa},
2746 {0x00, 0x0f, 0xea, 0xaa},
2747 {0x00, 0xa2, 0x00, 0xaa},
2748 {0x00, 0xa3, 0x2a, 0xaa},
2749 {0x00, 0xa4, 0x03, 0xaa},
2750 {0x00, 0xa5, 0xea, 0xaa},
2751 {}
2752};
2753static const u8 poxxxx_initVGA[][4] = {
2754 {0x00, 0x20, 0x11, 0xaa},
2755 {0x00, 0x33, 0x38, 0xaa},
2756 {0x00, 0xbb, 0x0d, 0xaa},
Jean-François Moine98475cb2010-07-06 04:44:54 -03002757 {0xb3, 0x22, 0x01, 0xcc}, /* change to 640x480 */
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03002758 {0xb3, 0x23, 0xe0, 0xcc},
2759 {0xb3, 0x16, 0x02, 0xcc},
2760 {0xb3, 0x17, 0x7f, 0xcc},
2761 {0xb3, 0x02, 0xb0, 0xcc},
2762 {0xb3, 0x06, 0x00, 0xcc},
2763 {0xb3, 0x5c, 0x01, 0xcc},
2764 {0x00, 0x04, 0x06, 0xaa},
2765 {0x00, 0x05, 0x3f, 0xaa},
2766 {0x00, 0x04, 0x00, 0xdd}, /* delay 1s */
2767 {}
2768};
2769static const u8 poxxxx_initQVGA[][4] = {
2770 {0x00, 0x20, 0x33, 0xaa},
2771 {0x00, 0x33, 0x38, 0xaa},
2772 {0x00, 0xbb, 0x0d, 0xaa},
Jean-François Moine98475cb2010-07-06 04:44:54 -03002773 {0xb3, 0x22, 0x00, 0xcc}, /* change to 320x240 */
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03002774 {0xb3, 0x23, 0xf0, 0xcc},
2775 {0xb3, 0x16, 0x01, 0xcc},
2776 {0xb3, 0x17, 0x3f, 0xcc},
2777 {0xb3, 0x02, 0xb0, 0xcc},
2778 {0xb3, 0x06, 0x01, 0xcc},
2779 {0xb3, 0x5c, 0x00, 0xcc},
2780 {0x00, 0x04, 0x06, 0xaa},
2781 {0x00, 0x05, 0x3f, 0xaa},
2782 {0x00, 0x04, 0x00, 0xdd}, /* delay 1s */
2783 {}
2784};
2785static const u8 poxxxx_init_end_1[][4] = {
2786 {0x00, 0x47, 0x25, 0xaa},
2787 {0x00, 0x48, 0x80, 0xaa},
2788 {0x00, 0x49, 0x1f, 0xaa},
2789 {0x00, 0x4a, 0x40, 0xaa},
2790 {0x00, 0x44, 0x40, 0xaa},
2791 {0x00, 0xab, 0x4a, 0xaa},
2792 {0x00, 0xb1, 0x00, 0xaa},
2793 {0x00, 0xb2, 0x04, 0xaa},
2794 {0x00, 0xb3, 0x08, 0xaa},
2795 {0x00, 0xb4, 0x0b, 0xaa},
2796 {0x00, 0xb5, 0x0d, 0xaa},
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03002797 {}
2798};
2799static const u8 poxxxx_init_end_2[][4] = {
2800 {0x00, 0x1d, 0x85, 0xaa},
2801 {0x00, 0x1e, 0x06, 0xaa},
2802 {0x00, 0x1d, 0x05, 0xaa},
2803 {}
Jean-Francois Moine88521532008-12-10 05:06:13 -03002804};
2805
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03002806struct sensor_info {
Jean-Francois Moine235d0ff2009-03-22 16:33:47 -03002807 s8 sensorId;
2808 u8 I2cAdd;
2809 u8 IdAdd;
2810 u16 VpId;
2811 u8 m1;
2812 u8 m2;
2813 u8 op;
2814};
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03002815
Jean-Francois Moineff1cf402009-12-26 15:18:02 -03002816/* probe values */
2817static const struct sensor_info vc0321_probe_data[] = {
2818/* sensorId, I2cAdd, IdAdd, VpId, m1, m2, op */
2819/* 0 OV9640 */
Jean-Francois Moine235d0ff2009-03-22 16:33:47 -03002820 {-1, 0x80 | 0x30, 0x0a, 0x0000, 0x25, 0x24, 0x05},
Jean-Francois Moineff1cf402009-12-26 15:18:02 -03002821/* 1 ICM108T (may respond on IdAdd == 0x83 - tested in vc032x_probe_sensor) */
Jean-Francois Moine235d0ff2009-03-22 16:33:47 -03002822 {-1, 0x80 | 0x20, 0x82, 0x0000, 0x24, 0x25, 0x01},
Jean-Francois Moineff1cf402009-12-26 15:18:02 -03002823/* 2 PO2130 (may detect PO3130NC - tested in vc032x_probe_sensor)*/
2824 {-1, 0x80 | 0x76, 0x00, 0x0000, 0x24, 0x25, 0x01},
2825/* 3 MI1310 */
2826 {-1, 0x80 | 0x5d, 0x00, 0x0000, 0x24, 0x25, 0x01},
2827/* 4 MI360 - tested in vc032x_probe_sensor */
Jean-Francois Moinee18fd012008-12-08 04:48:21 -03002828/* {SENSOR_MI0360, 0x80 | 0x5d, 0x00, 0x8243, 0x24, 0x25, 0x01}, */
Jean-Francois Moineff1cf402009-12-26 15:18:02 -03002829/* 5 7131R */
Jean-Francois Moine235d0ff2009-03-22 16:33:47 -03002830 {SENSOR_HV7131R, 0x80 | 0x11, 0x00, 0x0209, 0x24, 0x25, 0x01},
Jean-Francois Moineff1cf402009-12-26 15:18:02 -03002831/* 6 OV7649 */
Jean-Francois Moine235d0ff2009-03-22 16:33:47 -03002832 {-1, 0x80 | 0x21, 0x0a, 0x0000, 0x21, 0x20, 0x05},
Jean-Francois Moineff1cf402009-12-26 15:18:02 -03002833/* 7 PAS302BCW */
Jean-Francois Moine235d0ff2009-03-22 16:33:47 -03002834 {-1, 0x80 | 0x40, 0x00, 0x0000, 0x20, 0x22, 0x05},
Jean-Francois Moineff1cf402009-12-26 15:18:02 -03002835/* 8 OV7660 */
Jean-Francois Moine235d0ff2009-03-22 16:33:47 -03002836 {SENSOR_OV7660, 0x80 | 0x21, 0x0a, 0x7660, 0x26, 0x26, 0x05},
Jean-Francois Moineff1cf402009-12-26 15:18:02 -03002837/* 9 PO3130NC - (tested in vc032x_probe_sensor) */
2838/* {SENSOR_PO3130NC, 0x80 | 0x76, 0x00, 0x3130, 0x24, 0x25, 0x01}, */
2839/* 10 PO1030KC */
Jean-Francois Moine235d0ff2009-03-22 16:33:47 -03002840 {-1, 0x80 | 0x6e, 0x00, 0x0000, 0x24, 0x25, 0x01},
Jean-Francois Moineff1cf402009-12-26 15:18:02 -03002841/* 11 MI1310_SOC */
2842 {SENSOR_MI1310_SOC, 0x80 | 0x5d, 0x00, 0x143a, 0x24, 0x25, 0x01},
2843/* 12 OV9650 */
2844 {-1, 0x80 | 0x30, 0x0a, 0x0000, 0x25, 0x24, 0x05},
2845/* 13 S5K532 */
Jean-Francois Moine235d0ff2009-03-22 16:33:47 -03002846 {-1, 0x80 | 0x11, 0x39, 0x0000, 0x24, 0x25, 0x01},
Jean-Francois Moineff1cf402009-12-26 15:18:02 -03002847/* 14 MI360_SOC - ??? */
2848/* 15 PO1200N */
Jean-Francois Moine88521532008-12-10 05:06:13 -03002849 {SENSOR_PO1200, 0x80 | 0x5c, 0x00, 0x1200, 0x67, 0x67, 0x01},
Jean-Francois Moineff1cf402009-12-26 15:18:02 -03002850/* 16 PO3030K */
2851 {-1, 0x80 | 0x18, 0x00, 0x0000, 0x24, 0x25, 0x01},
2852/* 17 PO2030 */
Jean-Francois Moine235d0ff2009-03-22 16:33:47 -03002853 {-1, 0x80 | 0x6e, 0x00, 0x0000, 0x24, 0x25, 0x01},
Jean-Francois Moineff1cf402009-12-26 15:18:02 -03002854/* ?? */
2855 {-1, 0x80 | 0x56, 0x01, 0x0000, 0x64, 0x67, 0x01},
2856 {SENSOR_MI1320, 0x80 | 0x48, 0x00, 0x148c, 0x64, 0x65, 0x01},
2857};
2858static const struct sensor_info vc0323_probe_data[] = {
2859/* sensorId, I2cAdd, IdAdd, VpId, m1, m2, op */
2860/* 0 OV9640 */
2861 {-1, 0x80 | 0x30, 0x0a, 0x0000, 0x25, 0x24, 0x05},
2862/* 1 ICM108T (may respond on IdAdd == 0x83 - tested in vc032x_probe_sensor) */
2863 {-1, 0x80 | 0x20, 0x82, 0x0000, 0x24, 0x25, 0x01},
2864/* 2 PO2130 (may detect PO3130NC - tested in vc032x_probe_sensor)*/
2865 {-1, 0x80 | 0x76, 0x00, 0x0000, 0x24, 0x25, 0x01},
2866/* 3 MI1310 */
2867 {-1, 0x80 | 0x5d, 0x00, 0x0000, 0x24, 0x25, 0x01},
2868/* 4 MI360 - tested in vc032x_probe_sensor */
2869/* {SENSOR_MI0360, 0x80 | 0x5d, 0x00, 0x8243, 0x24, 0x25, 0x01}, */
2870/* 5 7131R */
2871 {SENSOR_HV7131R, 0x80 | 0x11, 0x00, 0x0209, 0x24, 0x25, 0x01},
2872/* 6 OV7649 */
2873 {-1, 0x80 | 0x21, 0x0a, 0x0000, 0x21, 0x20, 0x05},
2874/* 7 PAS302BCW */
2875 {-1, 0x80 | 0x40, 0x00, 0x0000, 0x20, 0x22, 0x05},
2876/* 8 OV7660 */
2877 {SENSOR_OV7660, 0x80 | 0x21, 0x0a, 0x7660, 0x26, 0x26, 0x05},
2878/* 9 PO3130NC - (tested in vc032x_probe_sensor) */
2879/* {SENSOR_PO3130NC, 0x80 | 0x76, 0x00, 0x3130, 0x24, 0x25, 0x01}, */
2880/* 10 PO1030KC */
2881 {-1, 0x80 | 0x6e, 0x00, 0x0000, 0x24, 0x25, 0x01},
2882/* 11 MI1310_SOC */
2883 {SENSOR_MI1310_SOC, 0x80 | 0x5d, 0x00, 0x143a, 0x24, 0x25, 0x01},
2884/* 12 OV9650 */
2885 {-1, 0x80 | 0x30, 0x0a, 0x0000, 0x25, 0x24, 0x05},
2886/* 13 S5K532 */
2887 {-1, 0x80 | 0x11, 0x39, 0x0000, 0x24, 0x25, 0x01},
2888/* 14 MI360_SOC - ??? */
2889/* 15 PO1200N */
2890 {SENSOR_PO1200, 0x80 | 0x5c, 0x00, 0x1200, 0x67, 0x67, 0x01},
2891/* 16 ?? */
2892 {-1, 0x80 | 0x2d, 0x00, 0x0000, 0x65, 0x67, 0x01},
2893/* 17 PO2030 */
2894 {-1, 0x80 | 0x6e, 0x00, 0x0000, 0x24, 0x25, 0x01},
2895/* ?? */
Jean-Francois Moine235d0ff2009-03-22 16:33:47 -03002896 {-1, 0x80 | 0x56, 0x01, 0x0000, 0x64, 0x67, 0x01},
Jean-Francois Moinedb786a32009-03-23 06:03:52 -03002897 {SENSOR_MI1320_SOC, 0x80 | 0x48, 0x00, 0x148c, 0x64, 0x67, 0x01},
Jean-Francois Moineff1cf402009-12-26 15:18:02 -03002898/*fixme: not in the ms-win probe - may be found before? */
Jean-Francois Moine235d0ff2009-03-22 16:33:47 -03002899 {SENSOR_OV7670, 0x80 | 0x21, 0x0a, 0x7673, 0x66, 0x67, 0x05},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03002900};
2901
Jean-Francois Moine739570b2008-07-14 09:38:29 -03002902/* read 'len' bytes in gspca_dev->usb_buf */
Jean-François Moineef35d342010-07-06 05:05:05 -03002903static void reg_r_i(struct gspca_dev *gspca_dev,
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03002904 u16 req,
2905 u16 index,
2906 u16 len)
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03002907{
Jean-François Moinefe854ec2010-07-06 05:00:07 -03002908 int ret;
2909
2910 if (gspca_dev->usb_err < 0)
2911 return;
2912 ret = usb_control_msg(gspca_dev->dev,
Jean-Francois Moine739570b2008-07-14 09:38:29 -03002913 usb_rcvctrlpipe(gspca_dev->dev, 0),
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03002914 req,
2915 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
2916 1, /* value */
Jean-Francois Moine739570b2008-07-14 09:38:29 -03002917 index, gspca_dev->usb_buf, len,
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03002918 500);
Jean-François Moinefe854ec2010-07-06 05:00:07 -03002919 if (ret < 0) {
Joe Perches133a9fe2011-08-21 19:56:57 -03002920 pr_err("reg_r err %d\n", ret);
Jean-François Moinefe854ec2010-07-06 05:00:07 -03002921 gspca_dev->usb_err = ret;
2922 }
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03002923}
Jean-François Moineef35d342010-07-06 05:05:05 -03002924static void reg_r(struct gspca_dev *gspca_dev,
2925 u16 req,
2926 u16 index,
2927 u16 len)
2928{
2929 reg_r_i(gspca_dev, req, index, len);
Jean-François Moineef35d342010-07-06 05:05:05 -03002930 if (gspca_dev->usb_err < 0)
2931 return;
2932 if (len == 1)
2933 PDEBUG(D_USBI, "GET %02x 0001 %04x %02x", req, index,
2934 gspca_dev->usb_buf[0]);
2935 else
Andy Shevchenko70aa3452012-08-07 12:43:07 -03002936 PDEBUG(D_USBI, "GET %02x 0001 %04x %*ph",
2937 req, index, 3, gspca_dev->usb_buf);
Jean-François Moineef35d342010-07-06 05:05:05 -03002938}
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03002939
Jean-François Moineef35d342010-07-06 05:05:05 -03002940static void reg_w_i(struct gspca_dev *gspca_dev,
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03002941 u16 req,
2942 u16 value,
2943 u16 index)
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03002944{
Jean-François Moinefe854ec2010-07-06 05:00:07 -03002945 int ret;
2946
2947 if (gspca_dev->usb_err < 0)
2948 return;
2949 ret = usb_control_msg(gspca_dev->dev,
2950 usb_sndctrlpipe(gspca_dev->dev, 0),
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03002951 req,
2952 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
2953 value, index, NULL, 0,
2954 500);
Jean-François Moinefe854ec2010-07-06 05:00:07 -03002955 if (ret < 0) {
Joe Perches133a9fe2011-08-21 19:56:57 -03002956 pr_err("reg_w err %d\n", ret);
Jean-François Moinefe854ec2010-07-06 05:00:07 -03002957 gspca_dev->usb_err = ret;
2958 }
2959}
2960static void reg_w(struct gspca_dev *gspca_dev,
2961 u16 req,
2962 u16 value,
2963 u16 index)
2964{
Jean-François Moinefe854ec2010-07-06 05:00:07 -03002965 if (gspca_dev->usb_err < 0)
2966 return;
2967 PDEBUG(D_USBO, "SET %02x %04x %04x", req, value, index);
Jean-François Moinefe854ec2010-07-06 05:00:07 -03002968 reg_w_i(gspca_dev, req, value, index);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03002969}
2970
Jean-Francois Moine49796e42009-02-02 06:33:31 -03002971static u16 read_sensor_register(struct gspca_dev *gspca_dev,
2972 u16 address)
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03002973{
Jean-Francois Moine235d0ff2009-03-22 16:33:47 -03002974 u8 ldata, mdata, hdata;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03002975 int retry = 50;
Jean-Francois Moine739570b2008-07-14 09:38:29 -03002976
Jean-Francois Moine739570b2008-07-14 09:38:29 -03002977 reg_r(gspca_dev, 0xa1, 0xb33f, 1);
Jean-Francois Moine739570b2008-07-14 09:38:29 -03002978 if (!(gspca_dev->usb_buf[0] & 0x02)) {
Joe Perches133a9fe2011-08-21 19:56:57 -03002979 pr_err("I2c Bus Busy Wait %02x\n", gspca_dev->usb_buf[0]);
Jean-Francois Moine49796e42009-02-02 06:33:31 -03002980 return 0;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03002981 }
Jean-François Moinefe854ec2010-07-06 05:00:07 -03002982 reg_w(gspca_dev, 0xa0, address, 0xb33a);
2983 reg_w(gspca_dev, 0xa0, 0x02, 0xb339);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03002984
Jean-Francois Moine49796e42009-02-02 06:33:31 -03002985 do {
Jean-Francois Moine739570b2008-07-14 09:38:29 -03002986 reg_r(gspca_dev, 0xa1, 0xb33b, 1);
Jean-Francois Moine235d0ff2009-03-22 16:33:47 -03002987 if (gspca_dev->usb_buf[0] == 0x00)
2988 break;
2989 msleep(40);
2990 } while (--retry >= 0);
Jean-Francois Moine49796e42009-02-02 06:33:31 -03002991
Jean-Francois Moine739570b2008-07-14 09:38:29 -03002992 reg_r(gspca_dev, 0xa1, 0xb33e, 1);
Jean-Francois Moinee18fd012008-12-08 04:48:21 -03002993 ldata = gspca_dev->usb_buf[0];
Jean-Francois Moine739570b2008-07-14 09:38:29 -03002994 reg_r(gspca_dev, 0xa1, 0xb33d, 1);
2995 mdata = gspca_dev->usb_buf[0];
2996 reg_r(gspca_dev, 0xa1, 0xb33c, 1);
Jean-Francois Moinee18fd012008-12-08 04:48:21 -03002997 hdata = gspca_dev->usb_buf[0];
Jean-Francois Moine49796e42009-02-02 06:33:31 -03002998 if (hdata != 0 && mdata != 0 && ldata != 0)
2999 PDEBUG(D_PROBE, "Read Sensor %02x%02x %02x",
3000 hdata, mdata, ldata);
Jean-Francois Moine739570b2008-07-14 09:38:29 -03003001 reg_r(gspca_dev, 0xa1, 0xb334, 1);
3002 if (gspca_dev->usb_buf[0] == 0x02)
Jean-Francois Moine49796e42009-02-02 06:33:31 -03003003 return (hdata << 8) + mdata;
3004 return hdata;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003005}
Jean-Francois Moine739570b2008-07-14 09:38:29 -03003006
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003007static int vc032x_probe_sensor(struct gspca_dev *gspca_dev)
3008{
Jean-Francois Moine1852e752009-06-27 05:33:48 -03003009 struct sd *sd = (struct sd *) gspca_dev;
Jean-Francois Moineff1cf402009-12-26 15:18:02 -03003010 int i, n;
Jean-Francois Moine235d0ff2009-03-22 16:33:47 -03003011 u16 value;
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -03003012 const struct sensor_info *ptsensor_info;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003013
Jean-Francois Moine1852e752009-06-27 05:33:48 -03003014/*fixme: should also check the other sensor (back mi1320_soc, front mc501cb)*/
Jean-Francois Moinee27188e2009-07-27 06:00:03 -03003015 if (sd->flags & FL_SAMSUNG) {
Jean-François Moinefe854ec2010-07-06 05:00:07 -03003016 reg_w(gspca_dev, 0xa0, 0x01, 0xb301);
3017 reg_w(gspca_dev, 0x89, 0xf0ff, 0xffff);
3018 /* select the back sensor */
Jean-Francois Moine1852e752009-06-27 05:33:48 -03003019 }
3020
Jean-Francois Moine739570b2008-07-14 09:38:29 -03003021 reg_r(gspca_dev, 0xa1, 0xbfcf, 1);
Jean-Francois Moineff1cf402009-12-26 15:18:02 -03003022 PDEBUG(D_PROBE, "vc032%d check sensor header %02x",
3023 sd->bridge == BRIDGE_VC0321 ? 1 : 3, gspca_dev->usb_buf[0]);
3024 if (sd->bridge == BRIDGE_VC0321) {
3025 ptsensor_info = vc0321_probe_data;
3026 n = ARRAY_SIZE(vc0321_probe_data);
3027 } else {
3028 ptsensor_info = vc0323_probe_data;
3029 n = ARRAY_SIZE(vc0323_probe_data);
3030 }
3031 for (i = 0; i < n; i++) {
Jean-François Moinefe854ec2010-07-06 05:00:07 -03003032 reg_w(gspca_dev, 0xa0, 0x02, 0xb334);
3033 reg_w(gspca_dev, 0xa0, ptsensor_info->m1, 0xb300);
3034 reg_w(gspca_dev, 0xa0, ptsensor_info->m2, 0xb300);
3035 reg_w(gspca_dev, 0xa0, 0x01, 0xb308);
3036 reg_w(gspca_dev, 0xa0, 0x0c, 0xb309);
3037 reg_w(gspca_dev, 0xa0, ptsensor_info->I2cAdd, 0xb335);
3038 reg_w(gspca_dev, 0xa0, ptsensor_info->op, 0xb301);
Jean-Francois Moine49796e42009-02-02 06:33:31 -03003039 value = read_sensor_register(gspca_dev, ptsensor_info->IdAdd);
Jean-Francois Moine235d0ff2009-03-22 16:33:47 -03003040 if (value == 0 && ptsensor_info->IdAdd == 0x82)
3041 value = read_sensor_register(gspca_dev, 0x83);
3042 if (value != 0) {
Theodore Kilgorec93396e2013-02-04 13:17:55 -03003043 PDEBUG(D_PROBE, "Sensor ID %04x (%d)", value, i);
Jean-Francois Moine235d0ff2009-03-22 16:33:47 -03003044 if (value == ptsensor_info->VpId)
3045 return ptsensor_info->sensorId;
Jean-Francois Moinecbb05542008-11-26 16:17:13 -03003046
Jean-Francois Moine235d0ff2009-03-22 16:33:47 -03003047 switch (value) {
Jean-Francois Moineff1cf402009-12-26 15:18:02 -03003048 case 0x3130:
3049 return SENSOR_PO3130NC;
Jean-Francois Moine235d0ff2009-03-22 16:33:47 -03003050 case 0x7673:
3051 return SENSOR_OV7670;
3052 case 0x8243:
3053 return SENSOR_MI0360;
3054 }
Jean-Francois Moine235d0ff2009-03-22 16:33:47 -03003055 }
Jean-Francois Moineff1cf402009-12-26 15:18:02 -03003056 ptsensor_info++;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003057 }
3058 return -1;
3059}
3060
Jean-Francois Moine49796e42009-02-02 06:33:31 -03003061static void i2c_write(struct gspca_dev *gspca_dev,
Jean-Francois Moine33f5b072009-03-25 07:04:11 -03003062 u8 reg, const u8 *val,
3063 u8 size) /* 1 or 2 */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003064{
Jean-Francois Moine49796e42009-02-02 06:33:31 -03003065 int retry;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003066
Jean-François Moineef35d342010-07-06 05:05:05 -03003067 if (gspca_dev->usb_err < 0)
3068 return;
3069 if (size == 1)
3070 PDEBUG(D_USBO, "i2c_w %02x %02x", reg, *val);
3071 else
3072 PDEBUG(D_USBO, "i2c_w %02x %02x%02x", reg, *val, val[1]);
Jean-François Moineef35d342010-07-06 05:05:05 -03003073 reg_r_i(gspca_dev, 0xa1, 0xb33f, 1);
Jean-Francois Moine33f5b072009-03-25 07:04:11 -03003074/*fixme:should check if (!(gspca_dev->usb_buf[0] & 0x02)) error*/
Jean-François Moineef35d342010-07-06 05:05:05 -03003075 reg_w_i(gspca_dev, 0xa0, size, 0xb334);
3076 reg_w_i(gspca_dev, 0xa0, reg, 0xb33a);
3077 reg_w_i(gspca_dev, 0xa0, val[0], 0xb336);
Jean-Francois Moine33f5b072009-03-25 07:04:11 -03003078 if (size > 1)
Jean-François Moineef35d342010-07-06 05:05:05 -03003079 reg_w_i(gspca_dev, 0xa0, val[1], 0xb337);
3080 reg_w_i(gspca_dev, 0xa0, 0x01, 0xb339);
Jean-Francois Moine49796e42009-02-02 06:33:31 -03003081 retry = 4;
3082 do {
Jean-François Moineef35d342010-07-06 05:05:05 -03003083 reg_r_i(gspca_dev, 0xa1, 0xb33b, 1);
Jean-Francois Moine49796e42009-02-02 06:33:31 -03003084 if (gspca_dev->usb_buf[0] == 0)
3085 break;
3086 msleep(20);
3087 } while (--retry > 0);
3088 if (retry <= 0)
Joe Perches133a9fe2011-08-21 19:56:57 -03003089 pr_err("i2c_write timeout\n");
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003090}
3091
3092static void put_tab_to_reg(struct gspca_dev *gspca_dev,
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03003093 const u8 *tab, u8 tabsize, u16 addr)
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003094{
3095 int j;
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03003096 u16 ad = addr;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003097
3098 for (j = 0; j < tabsize; j++)
Jean-François Moinefe854ec2010-07-06 05:00:07 -03003099 reg_w(gspca_dev, 0xa0, tab[j], ad++);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003100}
3101
3102static void usb_exchange(struct gspca_dev *gspca_dev,
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03003103 const u8 data[][4])
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003104{
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003105 int i = 0;
3106
3107 for (;;) {
3108 switch (data[i][3]) {
3109 default:
3110 return;
3111 case 0xcc: /* normal write */
Jean-François Moinefe854ec2010-07-06 05:00:07 -03003112 reg_w(gspca_dev, 0xa0, data[i][2],
Jean-Francois Moine49796e42009-02-02 06:33:31 -03003113 (data[i][0]) << 8 | data[i][1]);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003114 break;
3115 case 0xaa: /* i2c op */
Jean-Francois Moine739570b2008-07-14 09:38:29 -03003116 i2c_write(gspca_dev, data[i][1], &data[i][2], 1);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003117 break;
3118 case 0xbb: /* i2c op */
Jean-Francois Moine739570b2008-07-14 09:38:29 -03003119 i2c_write(gspca_dev, data[i][0], &data[i][1], 2);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003120 break;
3121 case 0xdd:
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003122 msleep(data[i][1] * 256 + data[i][2] + 10);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003123 break;
3124 }
3125 i++;
3126 }
3127 /*not reached*/
3128}
3129
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003130
3131/* this function is called at probe time */
3132static int sd_config(struct gspca_dev *gspca_dev,
3133 const struct usb_device_id *id)
3134{
3135 struct sd *sd = (struct sd *) gspca_dev;
Jean-François Moinebb44f562010-07-26 07:59:23 -03003136
3137 sd->bridge = id->driver_info >> 8;
3138 sd->flags = id->driver_info & 0xff;
3139
3140 if (id->idVendor == 0x046d &&
3141 (id->idProduct == 0x0892 || id->idProduct == 0x0896))
3142 sd->sensor = SENSOR_POxxxx; /* no probe */
3143
Jean-François Moinebb44f562010-07-26 07:59:23 -03003144 return 0;
3145}
3146
3147/* this function is called at probe and resume time */
3148static int sd_init(struct gspca_dev *gspca_dev)
3149{
3150 struct sd *sd = (struct sd *) gspca_dev;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003151 struct cam *cam;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003152 int sensor;
Jean-François Moine7e5f9052010-12-28 07:24:18 -03003153 /* number of packets per ISOC message */
3154 static u8 npkt[NSENSORS] = {
3155 [SENSOR_HV7131R] = 64,
3156 [SENSOR_MI0360] = 32,
3157 [SENSOR_MI1310_SOC] = 32,
3158 [SENSOR_MI1320] = 64,
3159 [SENSOR_MI1320_SOC] = 128,
3160 [SENSOR_OV7660] = 32,
3161 [SENSOR_OV7670] = 64,
3162 [SENSOR_PO1200] = 128,
3163 [SENSOR_PO3130NC] = 128,
3164 [SENSOR_POxxxx] = 128,
Jean-Francois Moine49cb6b02009-04-25 13:29:01 -03003165 };
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003166
Jean-François Moinebb44f562010-07-26 07:59:23 -03003167 if (sd->sensor != SENSOR_POxxxx)
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003168 sensor = vc032x_probe_sensor(gspca_dev);
Jean-François Moinebb44f562010-07-26 07:59:23 -03003169 else
3170 sensor = sd->sensor;
3171
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003172 switch (sensor) {
3173 case -1:
Joe Perches133a9fe2011-08-21 19:56:57 -03003174 pr_err("Unknown sensor...\n");
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003175 return -EINVAL;
3176 case SENSOR_HV7131R:
3177 PDEBUG(D_PROBE, "Find Sensor HV7131R");
Jean-Francois Moinecbb05542008-11-26 16:17:13 -03003178 break;
3179 case SENSOR_MI0360:
3180 PDEBUG(D_PROBE, "Find Sensor MI0360");
3181 sd->bridge = BRIDGE_VC0323;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003182 break;
3183 case SENSOR_MI1310_SOC:
3184 PDEBUG(D_PROBE, "Find Sensor MI1310_SOC");
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003185 break;
3186 case SENSOR_MI1320:
3187 PDEBUG(D_PROBE, "Find Sensor MI1320");
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003188 break;
Jean-Francois Moinedb786a32009-03-23 06:03:52 -03003189 case SENSOR_MI1320_SOC:
3190 PDEBUG(D_PROBE, "Find Sensor MI1320_SOC");
3191 break;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003192 case SENSOR_OV7660:
3193 PDEBUG(D_PROBE, "Find Sensor OV7660");
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003194 break;
3195 case SENSOR_OV7670:
3196 PDEBUG(D_PROBE, "Find Sensor OV7670");
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003197 break;
Jean-Francois Moine88521532008-12-10 05:06:13 -03003198 case SENSOR_PO1200:
3199 PDEBUG(D_PROBE, "Find Sensor PO1200");
3200 break;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003201 case SENSOR_PO3130NC:
3202 PDEBUG(D_PROBE, "Find Sensor PO3130NC");
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003203 break;
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003204 case SENSOR_POxxxx:
3205 PDEBUG(D_PROBE, "Sensor POxxxx");
3206 break;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003207 }
Jean-Francois Moinecbb05542008-11-26 16:17:13 -03003208 sd->sensor = sensor;
3209
Jean-François Moinebb44f562010-07-26 07:59:23 -03003210 cam = &gspca_dev->cam;
Jean-Francois Moinecbb05542008-11-26 16:17:13 -03003211 if (sd->bridge == BRIDGE_VC0321) {
3212 cam->cam_mode = vc0321_mode;
3213 cam->nmodes = ARRAY_SIZE(vc0321_mode);
3214 } else {
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -03003215 switch (sensor) {
3216 case SENSOR_PO1200:
Jean-Francois Moine88521532008-12-10 05:06:13 -03003217 cam->cam_mode = svga_mode;
3218 cam->nmodes = ARRAY_SIZE(svga_mode);
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -03003219 break;
3220 case SENSOR_MI1310_SOC:
3221 cam->cam_mode = vc0323_mode;
Jean-Francois Moine111815e2009-07-27 05:52:27 -03003222 cam->nmodes = ARRAY_SIZE(vc0323_mode);
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -03003223 break;
3224 case SENSOR_MI1320_SOC:
3225 cam->cam_mode = bi_mode;
3226 cam->nmodes = ARRAY_SIZE(bi_mode);
3227 break;
Jean-François Moine5624c642010-04-02 07:12:42 -03003228 case SENSOR_OV7670:
3229 cam->cam_mode = bi_mode;
3230 cam->nmodes = ARRAY_SIZE(bi_mode) - 1;
3231 break;
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -03003232 default:
3233 cam->cam_mode = vc0323_mode;
3234 cam->nmodes = ARRAY_SIZE(vc0323_mode) - 1;
3235 break;
Jean-Francois Moine88521532008-12-10 05:06:13 -03003236 }
Jean-Francois Moinecbb05542008-11-26 16:17:13 -03003237 }
Jean-Francois Moine49cb6b02009-04-25 13:29:01 -03003238 cam->npkt = npkt[sd->sensor];
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003239
Jean-Francois Moinee27188e2009-07-27 06:00:03 -03003240 if (sd->sensor == SENSOR_OV7670)
3241 sd->flags |= FL_HFLIP | FL_VFLIP;
Jean-Francois Moine47a42b02008-12-13 07:45:34 -03003242
Jean-François Moine76ed0fe2010-07-14 07:09:50 -03003243 if (sd->bridge == BRIDGE_VC0321) {
3244 reg_r(gspca_dev, 0x8a, 0, 3);
3245 reg_w(gspca_dev, 0x87, 0x00, 0x0f0f);
3246 reg_r(gspca_dev, 0x8b, 0, 3);
3247 reg_w(gspca_dev, 0x88, 0x00, 0x0202);
3248 if (sd->sensor == SENSOR_POxxxx) {
3249 reg_r(gspca_dev, 0xa1, 0xb300, 1);
3250 if (gspca_dev->usb_buf[0] != 0) {
3251 reg_w(gspca_dev, 0xa0, 0x26, 0xb300);
3252 reg_w(gspca_dev, 0xa0, 0x04, 0xb300);
Jean-François Moine76ed0fe2010-07-14 07:09:50 -03003253 }
Jean-François Moine3d217c82010-07-27 05:34:49 -03003254 reg_w(gspca_dev, 0xa0, 0x00, 0xb300);
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003255 }
3256 }
Jean-François Moinefe854ec2010-07-06 05:00:07 -03003257 return gspca_dev->usb_err;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003258}
3259
Hans Verkuil930806c2012-05-18 06:45:30 -03003260static void setbrightness(struct gspca_dev *gspca_dev, s32 val)
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003261{
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003262 u8 data;
3263
Hans Verkuil930806c2012-05-18 06:45:30 -03003264 data = val;
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003265 if (data >= 0x80)
3266 data &= 0x7f;
3267 else
3268 data = 0xff ^ data;
3269 i2c_write(gspca_dev, 0x98, &data, 1);
3270}
3271
Hans Verkuil930806c2012-05-18 06:45:30 -03003272static void setcontrast(struct gspca_dev *gspca_dev, u8 val)
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003273{
Hans Verkuil930806c2012-05-18 06:45:30 -03003274 i2c_write(gspca_dev, 0x99, &val, 1);
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003275}
3276
Hans Verkuil930806c2012-05-18 06:45:30 -03003277static void setcolors(struct gspca_dev *gspca_dev, u8 val)
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003278{
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003279 u8 data;
3280
Hans Verkuil930806c2012-05-18 06:45:30 -03003281 data = val - (val >> 3) - 1;
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003282 i2c_write(gspca_dev, 0x94, &data, 1);
Hans Verkuil930806c2012-05-18 06:45:30 -03003283 i2c_write(gspca_dev, 0x95, &val, 1);
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003284}
3285
Hans Verkuil930806c2012-05-18 06:45:30 -03003286static void sethvflip(struct gspca_dev *gspca_dev, bool hflip, bool vflip)
Jean-Francois Moine7dc7ad32008-12-08 05:13:53 -03003287{
3288 struct sd *sd = (struct sd *) gspca_dev;
Hans Verkuil930806c2012-05-18 06:45:30 -03003289 u8 data[2];
Jean-Francois Moine7dc7ad32008-12-08 05:13:53 -03003290
Jean-Francois Moinee27188e2009-07-27 06:00:03 -03003291 if (sd->flags & FL_HFLIP)
Jean-Francois Moinebb2c8182009-08-02 06:56:47 -03003292 hflip = !hflip;
Jean-Francois Moinee27188e2009-07-27 06:00:03 -03003293 if (sd->flags & FL_VFLIP)
Jean-Francois Moinebb2c8182009-08-02 06:56:47 -03003294 vflip = !vflip;
Jean-Francois Moine7dc7ad32008-12-08 05:13:53 -03003295 switch (sd->sensor) {
Jean-Francois Moinee27188e2009-07-27 06:00:03 -03003296 case SENSOR_MI1310_SOC:
Jean-Francois Moine219f30272009-12-26 15:21:57 -03003297 case SENSOR_MI1320:
Jean-Francois Moinee27188e2009-07-27 06:00:03 -03003298 case SENSOR_MI1320_SOC:
3299 data[0] = data[1] = 0; /* select page 0 */
3300 i2c_write(gspca_dev, 0xf0, data, 2);
3301 data[0] = sd->sensor == SENSOR_MI1310_SOC ? 0x03 : 0x01;
3302 data[1] = 0x02 * hflip
3303 | 0x01 * vflip;
3304 i2c_write(gspca_dev, 0x20, data, 2);
Jean-Francois Moine7dc7ad32008-12-08 05:13:53 -03003305 break;
Jean-Francois Moinee27188e2009-07-27 06:00:03 -03003306 case SENSOR_OV7660:
Jean-Francois Moine7dc7ad32008-12-08 05:13:53 -03003307 case SENSOR_OV7670:
Jean-Francois Moinee27188e2009-07-27 06:00:03 -03003308 data[0] = sd->sensor == SENSOR_OV7660 ? 0x01 : 0x07;
3309 data[0] |= OV7660_MVFP_MIRROR * hflip
3310 | OV7660_MVFP_VFLIP * vflip;
3311 i2c_write(gspca_dev, OV7660_REG_MVFP, data, 1);
Jean-Francois Moine7dc7ad32008-12-08 05:13:53 -03003312 break;
Jean-Francois Moine47a42b02008-12-13 07:45:34 -03003313 case SENSOR_PO1200:
Jean-Francois Moinee27188e2009-07-27 06:00:03 -03003314 data[0] = 0;
3315 i2c_write(gspca_dev, 0x03, data, 1);
3316 data[0] = 0x80 * hflip
3317 | 0x40 * vflip
Jean-Francois Moine47a42b02008-12-13 07:45:34 -03003318 | 0x06;
Jean-Francois Moinee27188e2009-07-27 06:00:03 -03003319 i2c_write(gspca_dev, 0x1e, data, 1);
3320 break;
Jean-Francois Moine7dc7ad32008-12-08 05:13:53 -03003321 }
Jean-Francois Moine7dc7ad32008-12-08 05:13:53 -03003322}
3323
Hans Verkuil930806c2012-05-18 06:45:30 -03003324static void setlightfreq(struct gspca_dev *gspca_dev, s32 val)
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003325{
3326 struct sd *sd = (struct sd *) gspca_dev;
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03003327 static const u8 (*ov7660_freq_tb[3])[4] =
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003328 {ov7660_NoFliker, ov7660_50HZ, ov7660_60HZ};
3329
3330 if (sd->sensor != SENSOR_OV7660)
3331 return;
Hans Verkuil930806c2012-05-18 06:45:30 -03003332 usb_exchange(gspca_dev, ov7660_freq_tb[val]);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003333}
3334
Hans Verkuil930806c2012-05-18 06:45:30 -03003335static void setsharpness(struct gspca_dev *gspca_dev, s32 val)
Jean-Francois Moine47a42b02008-12-13 07:45:34 -03003336{
3337 struct sd *sd = (struct sd *) gspca_dev;
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03003338 u8 data;
Jean-Francois Moine47a42b02008-12-13 07:45:34 -03003339
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003340 switch (sd->sensor) {
3341 case SENSOR_PO1200:
3342 data = 0;
3343 i2c_write(gspca_dev, 0x03, &data, 1);
Hans Verkuil930806c2012-05-18 06:45:30 -03003344 if (val < 0)
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003345 data = 0x6a;
3346 else
Hans Verkuil930806c2012-05-18 06:45:30 -03003347 data = 0xb5 + val * 3;
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003348 i2c_write(gspca_dev, 0x61, &data, 1);
3349 break;
3350 case SENSOR_POxxxx:
Hans Verkuil930806c2012-05-18 06:45:30 -03003351 if (val < 0)
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003352 data = 0x7e; /* def = max */
3353 else
Hans Verkuil930806c2012-05-18 06:45:30 -03003354 data = 0x60 + val * 0x0f;
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003355 i2c_write(gspca_dev, 0x59, &data, 1);
3356 break;
3357 }
Jean-Francois Moine47a42b02008-12-13 07:45:34 -03003358}
Hans Verkuil930806c2012-05-18 06:45:30 -03003359static void setgain(struct gspca_dev *gspca_dev, u8 val)
Jean-François Moine486cb2d2010-07-26 07:53:57 -03003360{
Hans Verkuil930806c2012-05-18 06:45:30 -03003361 i2c_write(gspca_dev, 0x15, &val, 1);
Jean-François Moine486cb2d2010-07-26 07:53:57 -03003362}
3363
Hans Verkuil930806c2012-05-18 06:45:30 -03003364static void setexposure(struct gspca_dev *gspca_dev, s32 val)
Jean-François Moine486cb2d2010-07-26 07:53:57 -03003365{
Jean-François Moine486cb2d2010-07-26 07:53:57 -03003366 u8 data;
3367
Hans Verkuil930806c2012-05-18 06:45:30 -03003368 data = val >> 8;
Jean-François Moine486cb2d2010-07-26 07:53:57 -03003369 i2c_write(gspca_dev, 0x1a, &data, 1);
Hans Verkuil930806c2012-05-18 06:45:30 -03003370 data = val;
Jean-François Moine486cb2d2010-07-26 07:53:57 -03003371 i2c_write(gspca_dev, 0x1b, &data, 1);
3372}
3373
Hans Verkuil930806c2012-05-18 06:45:30 -03003374static void setautogain(struct gspca_dev *gspca_dev, s32 val)
Jean-François Moine486cb2d2010-07-26 07:53:57 -03003375{
Jean-François Moine486cb2d2010-07-26 07:53:57 -03003376 static const u8 data[2] = {0x28, 0x3c};
3377
Hans Verkuil930806c2012-05-18 06:45:30 -03003378 i2c_write(gspca_dev, 0xd1, &data[val], 1);
Jean-François Moine486cb2d2010-07-26 07:53:57 -03003379}
3380
3381static void setgamma(struct gspca_dev *gspca_dev)
3382{
3383/*fixme:to do */
3384 usb_exchange(gspca_dev, poxxxx_gamma);
3385}
3386
Hans Verkuil930806c2012-05-18 06:45:30 -03003387static void setbacklight(struct gspca_dev *gspca_dev, s32 val)
Jean-François Moine486cb2d2010-07-26 07:53:57 -03003388{
Jean-François Moine486cb2d2010-07-26 07:53:57 -03003389 u16 v;
3390 u8 data;
3391
Hans Verkuil930806c2012-05-18 06:45:30 -03003392 data = (val << 4) | 0x0f;
Jean-François Moine486cb2d2010-07-26 07:53:57 -03003393 i2c_write(gspca_dev, 0xaa, &data, 1);
Hans Verkuil930806c2012-05-18 06:45:30 -03003394 v = 613 + 12 * val;
Jean-François Moine486cb2d2010-07-26 07:53:57 -03003395 data = v >> 8;
3396 i2c_write(gspca_dev, 0xc4, &data, 1);
3397 data = v;
3398 i2c_write(gspca_dev, 0xc5, &data, 1);
Hans Verkuil930806c2012-05-18 06:45:30 -03003399 v = 1093 - 12 * val;
Jean-François Moine486cb2d2010-07-26 07:53:57 -03003400 data = v >> 8;
3401 i2c_write(gspca_dev, 0xc6, &data, 1);
3402 data = v;
3403 i2c_write(gspca_dev, 0xc7, &data, 1);
Hans Verkuil930806c2012-05-18 06:45:30 -03003404 v = 342 + 9 * val;
Jean-François Moine486cb2d2010-07-26 07:53:57 -03003405 data = v >> 8;
3406 i2c_write(gspca_dev, 0xc8, &data, 1);
3407 data = v;
3408 i2c_write(gspca_dev, 0xc9, &data, 1);
Hans Verkuil930806c2012-05-18 06:45:30 -03003409 v = 702 - 9 * val;
Jean-François Moine486cb2d2010-07-26 07:53:57 -03003410 data = v >> 8;
3411 i2c_write(gspca_dev, 0xca, &data, 1);
3412 data = v;
3413 i2c_write(gspca_dev, 0xcb, &data, 1);
3414}
3415
3416static void setwb(struct gspca_dev *gspca_dev)
3417{
3418/*fixme:to do - valid when reg d1 = 0x1c - (reg16 + reg15 = 0xa3)*/
3419 static const u8 data[2] = {0x00, 0x00};
3420
3421 i2c_write(gspca_dev, 0x16, &data[0], 1);
3422 i2c_write(gspca_dev, 0x18, &data[1], 1);
3423}
Jean-Francois Moine47a42b02008-12-13 07:45:34 -03003424
Jean-Francois Moine72ab97c2008-09-20 06:39:08 -03003425static int sd_start(struct gspca_dev *gspca_dev)
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003426{
3427 struct sd *sd = (struct sd *) gspca_dev;
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03003428 const u8 (*init)[4];
3429 const u8 *GammaT = NULL;
3430 const u8 *MatrixT = NULL;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003431 int mode;
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -03003432 static const u8 (*mi1320_soc_init[])[4] = {
3433 mi1320_soc_InitSXGA,
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -03003434 mi1320_soc_InitVGA,
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -03003435 mi1320_soc_InitQVGA,
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -03003436 };
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003437
Jean-Francois Moine1852e752009-06-27 05:33:48 -03003438/*fixme: back sensor only*/
Jean-Francois Moinee27188e2009-07-27 06:00:03 -03003439 if (sd->flags & FL_SAMSUNG) {
Jean-François Moinefe854ec2010-07-06 05:00:07 -03003440 reg_w(gspca_dev, 0x89, 0xf0ff, 0xffff);
3441 reg_w(gspca_dev, 0xa9, 0x8348, 0x000e);
3442 reg_w(gspca_dev, 0xa9, 0x0000, 0x001a);
Jean-Francois Moine1852e752009-06-27 05:33:48 -03003443 }
3444
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003445 /* Assume start use the good resolution from gspca_dev->mode */
3446 if (sd->bridge == BRIDGE_VC0321) {
Jean-François Moinefe854ec2010-07-06 05:00:07 -03003447 reg_w(gspca_dev, 0xa0, 0xff, 0xbfec);
3448 reg_w(gspca_dev, 0xa0, 0xff, 0xbfed);
3449 reg_w(gspca_dev, 0xa0, 0xff, 0xbfee);
3450 reg_w(gspca_dev, 0xa0, 0xff, 0xbfef);
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -03003451 sd->image_offset = 46;
3452 } else {
3453 if (gspca_dev->cam.cam_mode[gspca_dev->curr_mode].pixelformat
3454 == V4L2_PIX_FMT_JPEG)
3455 sd->image_offset = 0;
3456 else
3457 sd->image_offset = 32;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003458 }
3459
Jean-Francois Moinec2446b32008-07-05 11:49:20 -03003460 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003461 switch (sd->sensor) {
3462 case SENSOR_HV7131R:
3463 GammaT = hv7131r_gamma;
3464 MatrixT = hv7131r_matrix;
Jean-Francois Moine6af4e7a2009-01-29 16:34:25 -03003465 if (mode)
3466 init = hv7131r_initQVGA_data; /* 320x240 */
3467 else
3468 init = hv7131r_initVGA_data; /* 640x480 */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003469 break;
3470 case SENSOR_OV7660:
3471 GammaT = ov7660_gamma;
3472 MatrixT = ov7660_matrix;
Jean-Francois Moine6af4e7a2009-01-29 16:34:25 -03003473 if (mode)
3474 init = ov7660_initQVGA_data; /* 320x240 */
3475 else
3476 init = ov7660_initVGA_data; /* 640x480 */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003477 break;
Jean-Francois Moinecbb05542008-11-26 16:17:13 -03003478 case SENSOR_MI0360:
3479 GammaT = mi1320_gamma;
3480 MatrixT = mi0360_matrix;
Jean-Francois Moine6af4e7a2009-01-29 16:34:25 -03003481 if (mode)
3482 init = mi0360_initQVGA_JPG; /* 320x240 */
3483 else
3484 init = mi0360_initVGA_JPG; /* 640x480 */
Jean-Francois Moinecbb05542008-11-26 16:17:13 -03003485 break;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003486 case SENSOR_MI1310_SOC:
Jean-Francois Moinea92e9062009-01-29 05:32:23 -03003487 GammaT = mi1320_gamma;
Jean-Francois Moinef985c702009-02-28 08:23:25 -03003488 MatrixT = mi1320_matrix;
Jean-Francois Moine6af4e7a2009-01-29 16:34:25 -03003489 switch (mode) {
3490 case 1:
3491 init = mi1310_socinitQVGA_JPG; /* 320x240 */
3492 break;
3493 case 0:
3494 init = mi1310_socinitVGA_JPG; /* 640x480 */
3495 break;
3496 default:
Jean-Francois Moinedb786a32009-03-23 06:03:52 -03003497 init = mi1310_soc_InitSXGA_JPG; /* 1280x1024 */
Jean-Francois Moine6af4e7a2009-01-29 16:34:25 -03003498 break;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003499 }
3500 break;
3501 case SENSOR_MI1320:
3502 GammaT = mi1320_gamma;
3503 MatrixT = mi1320_matrix;
Jean-Francois Moine6af4e7a2009-01-29 16:34:25 -03003504 if (mode)
3505 init = mi1320_initQVGA_data; /* 320x240 */
3506 else
3507 init = mi1320_initVGA_data; /* 640x480 */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003508 break;
Jean-Francois Moinedb786a32009-03-23 06:03:52 -03003509 case SENSOR_MI1320_SOC:
3510 GammaT = mi1320_gamma;
3511 MatrixT = mi1320_matrix;
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -03003512 init = mi1320_soc_init[mode];
Jean-Francois Moinedb786a32009-03-23 06:03:52 -03003513 break;
Jean-François Moine5624c642010-04-02 07:12:42 -03003514 case SENSOR_OV7670:
3515 init = mode == 1 ? ov7670_InitVGA : ov7670_InitQVGA;
3516 break;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003517 case SENSOR_PO3130NC:
3518 GammaT = po3130_gamma;
3519 MatrixT = po3130_matrix;
Jean-Francois Moine6af4e7a2009-01-29 16:34:25 -03003520 if (mode)
3521 init = po3130_initQVGA_data; /* 320x240 */
3522 else
3523 init = po3130_initVGA_data; /* 640x480 */
3524 usb_exchange(gspca_dev, init);
3525 init = po3130_rundata;
Jean-Francois Moine88521532008-12-10 05:06:13 -03003526 break;
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003527 case SENSOR_PO1200:
Jean-Francois Moine6af4e7a2009-01-29 16:34:25 -03003528 GammaT = po1200_gamma;
3529 MatrixT = po1200_matrix;
3530 init = po1200_initVGA_data;
3531 break;
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003532 default:
3533/* case SENSOR_POxxxx: */
3534 usb_exchange(gspca_dev, poxxxx_init_common);
Jean-François Moine486cb2d2010-07-26 07:53:57 -03003535 setgamma(gspca_dev);
Jean-François Moine486cb2d2010-07-26 07:53:57 -03003536 usb_exchange(gspca_dev, poxxxx_init_start_3);
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003537 if (mode)
3538 init = poxxxx_initQVGA;
3539 else
3540 init = poxxxx_initVGA;
3541 usb_exchange(gspca_dev, init);
3542 reg_r(gspca_dev, 0x8c, 0x0000, 3);
Jean-François Moinefe854ec2010-07-06 05:00:07 -03003543 reg_w(gspca_dev, 0xa0,
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003544 gspca_dev->usb_buf[2] & 1 ? 0 : 1,
3545 0xb35c);
3546 msleep(300);
3547/*fixme: i2c read 04 and 05*/
3548 init = poxxxx_init_end_1;
3549 break;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003550 }
Jean-Francois Moine6af4e7a2009-01-29 16:34:25 -03003551 usb_exchange(gspca_dev, init);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003552 if (GammaT && MatrixT) {
3553 put_tab_to_reg(gspca_dev, GammaT, 17, 0xb84a);
3554 put_tab_to_reg(gspca_dev, GammaT, 17, 0xb85b);
3555 put_tab_to_reg(gspca_dev, GammaT, 17, 0xb86c);
3556 put_tab_to_reg(gspca_dev, MatrixT, 9, 0xb82c);
Jean-Francois Moine49796e42009-02-02 06:33:31 -03003557
Jean-Francois Moineae310ee2009-09-01 14:02:22 -03003558 switch (sd->sensor) {
3559 case SENSOR_PO1200:
3560 case SENSOR_HV7131R:
Jean-François Moinefe854ec2010-07-06 05:00:07 -03003561 reg_w(gspca_dev, 0x89, 0x0400, 0x1415);
Jean-Francois Moineae310ee2009-09-01 14:02:22 -03003562 break;
3563 case SENSOR_MI1310_SOC:
Jean-François Moinefe854ec2010-07-06 05:00:07 -03003564 reg_w(gspca_dev, 0x89, 0x058c, 0x0000);
Jean-Francois Moineae310ee2009-09-01 14:02:22 -03003565 break;
Jean-Francois Moine88521532008-12-10 05:06:13 -03003566 }
Jean-Francois Moineae310ee2009-09-01 14:02:22 -03003567 msleep(100);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003568 }
Jean-François Moine5624c642010-04-02 07:12:42 -03003569 switch (sd->sensor) {
3570 case SENSOR_OV7670:
Jean-François Moinefe854ec2010-07-06 05:00:07 -03003571 reg_w(gspca_dev, 0x87, 0xffff, 0xffff);
3572 reg_w(gspca_dev, 0x88, 0xff00, 0xf0f1);
3573 reg_w(gspca_dev, 0xa0, 0x0000, 0xbfff);
Jean-François Moine5624c642010-04-02 07:12:42 -03003574 break;
3575 case SENSOR_POxxxx:
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003576 usb_exchange(gspca_dev, poxxxx_init_end_2);
Jean-François Moine486cb2d2010-07-26 07:53:57 -03003577 setwb(gspca_dev);
3578 msleep(80); /* led on */
3579 reg_w(gspca_dev, 0x89, 0xffff, 0xfdff);
Jean-François Moine5624c642010-04-02 07:12:42 -03003580 break;
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003581 }
Jean-François Moinefe854ec2010-07-06 05:00:07 -03003582 return gspca_dev->usb_err;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003583}
3584
3585static void sd_stopN(struct gspca_dev *gspca_dev)
3586{
AceLan Kao4041f6b2009-07-27 05:43:55 -03003587 struct sd *sd = (struct sd *) gspca_dev;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003588
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003589 switch (sd->sensor) {
3590 case SENSOR_MI1310_SOC:
Jean-François Moinefe854ec2010-07-06 05:00:07 -03003591 reg_w(gspca_dev, 0x89, 0x058c, 0x00ff);
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003592 break;
3593 case SENSOR_POxxxx:
3594 return;
3595 default:
3596 if (!(sd->flags & FL_SAMSUNG))
Jean-François Moinefe854ec2010-07-06 05:00:07 -03003597 reg_w(gspca_dev, 0x89, 0xffff, 0xffff);
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003598 break;
3599 }
Jean-François Moinefe854ec2010-07-06 05:00:07 -03003600 reg_w(gspca_dev, 0xa0, 0x01, 0xb301);
3601 reg_w(gspca_dev, 0xa0, 0x09, 0xb003);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003602}
3603
Jean-Francois Moine98522a72008-11-18 06:33:08 -03003604/* called on streamoff with alt 0 and on disconnect */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003605static void sd_stop0(struct gspca_dev *gspca_dev)
3606{
AceLan Kao4041f6b2009-07-27 05:43:55 -03003607 struct sd *sd = (struct sd *) gspca_dev;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003608
Jean-Francois Moine98522a72008-11-18 06:33:08 -03003609 if (!gspca_dev->present)
3610 return;
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03003611/*fixme: is this useful?*/
3612 if (sd->sensor == SENSOR_MI1310_SOC)
Jean-François Moinefe854ec2010-07-06 05:00:07 -03003613 reg_w(gspca_dev, 0x89, 0x058c, 0x00ff);
Jean-Francois Moineba624ce2009-09-03 13:46:59 -03003614 else if (!(sd->flags & FL_SAMSUNG))
Jean-François Moinefe854ec2010-07-06 05:00:07 -03003615 reg_w(gspca_dev, 0x89, 0xffff, 0xffff);
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003616
3617 if (sd->sensor == SENSOR_POxxxx) {
Jean-François Moinefe854ec2010-07-06 05:00:07 -03003618 reg_w(gspca_dev, 0xa0, 0x26, 0xb300);
3619 reg_w(gspca_dev, 0xa0, 0x04, 0xb300);
3620 reg_w(gspca_dev, 0xa0, 0x00, 0xb300);
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003621 }
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003622}
3623
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003624static void sd_pkt_scan(struct gspca_dev *gspca_dev,
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03003625 u8 *data, /* isoc packet */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003626 int len) /* iso pkt length */
3627{
3628 struct sd *sd = (struct sd *) gspca_dev;
3629
3630 if (data[0] == 0xff && data[1] == 0xd8) {
3631 PDEBUG(D_PACK,
3632 "vc032x header packet found len %d", len);
Jean-Francois Moine76dd2722009-11-13 09:21:03 -03003633 gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);
Jean-Francois Moine58e2ded2009-03-25 07:06:29 -03003634 data += sd->image_offset;
3635 len -= sd->image_offset;
Jean-Francois Moine76dd2722009-11-13 09:21:03 -03003636 gspca_frame_add(gspca_dev, FIRST_PACKET, data, len);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003637 return;
3638 }
Hans de Goeded473a002008-12-11 05:02:18 -03003639
3640 /* The vc0321 sends some additional data after sending the complete
3641 * frame, we ignore this. */
Jean-Francois Moine76dd2722009-11-13 09:21:03 -03003642 if (sd->bridge == BRIDGE_VC0321) {
Jean-François Moineb192ca92010-06-27 03:08:19 -03003643 int size, l;
Jean-Francois Moine76dd2722009-11-13 09:21:03 -03003644
Jean-François Moineb192ca92010-06-27 03:08:19 -03003645 l = gspca_dev->image_len;
3646 size = gspca_dev->frsz;
3647 if (len > size - l)
3648 len = size - l;
Jean-Francois Moine76dd2722009-11-13 09:21:03 -03003649 }
3650 gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003651}
3652
Hans Verkuil930806c2012-05-18 06:45:30 -03003653static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003654{
Hans Verkuil930806c2012-05-18 06:45:30 -03003655 struct gspca_dev *gspca_dev =
3656 container_of(ctrl->handler, struct gspca_dev, ctrl_handler);
3657 struct sd *sd = (struct sd *)gspca_dev;
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003658
Hans Verkuil930806c2012-05-18 06:45:30 -03003659 gspca_dev->usb_err = 0;
Jean-Francois Moine83c94a12009-12-26 16:07:24 -03003660
Hans Verkuil930806c2012-05-18 06:45:30 -03003661 if (!gspca_dev->streaming && ctrl->id != V4L2_CID_POWER_LINE_FREQUENCY)
Jean-Francois Moine8b605f12009-07-27 06:28:37 -03003662 return 0;
Hans Verkuil930806c2012-05-18 06:45:30 -03003663
3664 switch (ctrl->id) {
3665 case V4L2_CID_BRIGHTNESS:
3666 setbrightness(gspca_dev, ctrl->val);
3667 break;
3668 case V4L2_CID_CONTRAST:
3669 setcontrast(gspca_dev, ctrl->val);
3670 break;
3671 case V4L2_CID_SATURATION:
3672 setcolors(gspca_dev, ctrl->val);
3673 break;
3674 case V4L2_CID_HFLIP:
3675 sethvflip(gspca_dev, sd->hflip->val, sd->vflip->val);
3676 break;
3677 case V4L2_CID_SHARPNESS:
3678 setsharpness(gspca_dev, ctrl->val);
3679 break;
3680 case V4L2_CID_AUTOGAIN:
3681 setautogain(gspca_dev, ctrl->val);
3682 break;
3683 case V4L2_CID_GAIN:
3684 setgain(gspca_dev, ctrl->val);
3685 break;
3686 case V4L2_CID_EXPOSURE:
3687 setexposure(gspca_dev, ctrl->val);
3688 break;
3689 case V4L2_CID_BACKLIGHT_COMPENSATION:
3690 setbacklight(gspca_dev, ctrl->val);
3691 break;
3692 case V4L2_CID_POWER_LINE_FREQUENCY:
3693 setlightfreq(gspca_dev, ctrl->val);
3694 break;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003695 }
Hans Verkuil930806c2012-05-18 06:45:30 -03003696 return gspca_dev->usb_err;
3697}
3698
3699static const struct v4l2_ctrl_ops sd_ctrl_ops = {
3700 .s_ctrl = sd_s_ctrl,
3701};
3702
3703static int sd_init_controls(struct gspca_dev *gspca_dev)
3704{
3705 struct sd *sd = (struct sd *)gspca_dev;
3706 struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler;
3707 bool has_brightness = false;
3708 bool has_contrast = false;
3709 bool has_sat = false;
3710 bool has_hvflip = false;
3711 bool has_freq = false;
3712 bool has_backlight = false;
3713 bool has_exposure = false;
3714 bool has_autogain = false;
3715 bool has_gain = false;
3716 bool has_sharpness = false;
3717
3718 switch (sd->sensor) {
3719 case SENSOR_HV7131R:
3720 case SENSOR_MI0360:
3721 case SENSOR_PO3130NC:
3722 break;
3723 case SENSOR_MI1310_SOC:
3724 case SENSOR_MI1320:
3725 case SENSOR_MI1320_SOC:
3726 case SENSOR_OV7660:
3727 has_hvflip = true;
3728 break;
3729 case SENSOR_OV7670:
3730 has_hvflip = has_freq = true;
3731 break;
3732 case SENSOR_PO1200:
3733 has_hvflip = has_sharpness = true;
3734 break;
3735 case SENSOR_POxxxx:
3736 has_brightness = has_contrast = has_sat = has_backlight =
3737 has_exposure = has_autogain = has_gain =
3738 has_sharpness = true;
3739 break;
3740 }
3741
3742 gspca_dev->vdev.ctrl_handler = hdl;
3743 v4l2_ctrl_handler_init(hdl, 8);
3744 if (has_brightness)
3745 v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
3746 V4L2_CID_BRIGHTNESS, 0, 255, 1, 128);
3747 if (has_contrast)
3748 v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
3749 V4L2_CID_CONTRAST, 0, 255, 1, 127);
3750 if (has_sat)
3751 v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
3752 V4L2_CID_SATURATION, 1, 127, 1, 63);
3753 if (has_hvflip) {
3754 sd->hflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
3755 V4L2_CID_HFLIP, 0, 1, 1, 0);
3756 sd->vflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
3757 V4L2_CID_VFLIP, 0, 1, 1, 0);
3758 }
3759 if (has_sharpness)
3760 v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
3761 V4L2_CID_SHARPNESS, -1, 2, 1, -1);
3762 if (has_freq)
3763 v4l2_ctrl_new_std_menu(hdl, &sd_ctrl_ops,
3764 V4L2_CID_POWER_LINE_FREQUENCY,
3765 V4L2_CID_POWER_LINE_FREQUENCY_60HZ, 0,
3766 V4L2_CID_POWER_LINE_FREQUENCY_50HZ);
3767 if (has_autogain)
3768 v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
3769 V4L2_CID_AUTOGAIN, 0, 1, 1, 1);
3770 if (has_gain)
3771 v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
3772 V4L2_CID_GAIN, 0, 78, 1, 0);
3773 if (has_exposure)
3774 v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
3775 V4L2_CID_EXPOSURE, 0, 4095, 1, 450);
3776 if (has_backlight)
3777 v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
3778 V4L2_CID_BACKLIGHT_COMPENSATION, 0, 15, 1, 15);
3779
3780 if (hdl->error) {
3781 pr_err("Could not initialize controls\n");
3782 return hdl->error;
3783 }
3784 if (sd->hflip)
3785 v4l2_ctrl_cluster(2, &sd->hflip);
3786 return 0;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003787}
3788
3789/* sub-driver description */
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -03003790static const struct sd_desc sd_desc = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003791 .name = MODULE_NAME,
Hans Verkuil930806c2012-05-18 06:45:30 -03003792 .init_controls = sd_init_controls,
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003793 .config = sd_config,
Jean-Francois Moine012d6b02008-09-03 17:12:16 -03003794 .init = sd_init,
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003795 .start = sd_start,
3796 .stopN = sd_stopN,
3797 .stop0 = sd_stop0,
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003798 .pkt_scan = sd_pkt_scan,
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003799};
3800
3801/* -- module initialisation -- */
Jean-Francois Moine1852e752009-06-27 05:33:48 -03003802#define BF(bridge, flags) \
3803 .driver_info = (BRIDGE_ ## bridge << 8) \
3804 | (flags)
Jean-François Moine95c967c2011-01-13 05:20:29 -03003805static const struct usb_device_id device_table[] = {
Jean-Francois Moinee27188e2009-07-27 06:00:03 -03003806 {USB_DEVICE(0x041e, 0x405b), BF(VC0323, FL_VFLIP)},
Jean-Francois Moine1852e752009-06-27 05:33:48 -03003807 {USB_DEVICE(0x046d, 0x0892), BF(VC0321, 0)},
3808 {USB_DEVICE(0x046d, 0x0896), BF(VC0321, 0)},
3809 {USB_DEVICE(0x046d, 0x0897), BF(VC0321, 0)},
3810 {USB_DEVICE(0x0ac8, 0x0321), BF(VC0321, 0)},
3811 {USB_DEVICE(0x0ac8, 0x0323), BF(VC0323, 0)},
3812 {USB_DEVICE(0x0ac8, 0x0328), BF(VC0321, 0)},
3813 {USB_DEVICE(0x0ac8, 0xc001), BF(VC0321, 0)},
3814 {USB_DEVICE(0x0ac8, 0xc002), BF(VC0321, 0)},
Jean-Francois Moinee27188e2009-07-27 06:00:03 -03003815 {USB_DEVICE(0x0ac8, 0xc301), BF(VC0323, FL_SAMSUNG)},
Jean-Francois Moine1852e752009-06-27 05:33:48 -03003816 {USB_DEVICE(0x15b8, 0x6001), BF(VC0323, 0)},
3817 {USB_DEVICE(0x15b8, 0x6002), BF(VC0323, 0)},
3818 {USB_DEVICE(0x17ef, 0x4802), BF(VC0323, 0)},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003819 {}
3820};
3821MODULE_DEVICE_TABLE(usb, device_table);
3822
3823/* -- device connect -- */
3824static int sd_probe(struct usb_interface *intf,
3825 const struct usb_device_id *id)
3826{
3827 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
3828 THIS_MODULE);
3829}
3830
3831static struct usb_driver sd_driver = {
3832 .name = MODULE_NAME,
3833 .id_table = device_table,
3834 .probe = sd_probe,
3835 .disconnect = gspca_disconnect,
Jean-Francois Moine6a709742008-09-03 16:48:10 -03003836#ifdef CONFIG_PM
3837 .suspend = gspca_suspend,
3838 .resume = gspca_resume,
Hans de Goede8bb58962012-06-30 06:44:47 -03003839 .reset_resume = gspca_resume,
Jean-Francois Moine6a709742008-09-03 16:48:10 -03003840#endif
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03003841};
3842
Greg Kroah-Hartmanecb3b2b2011-11-18 09:46:12 -08003843module_usb_driver(sd_driver);