blob: 5d5bdbeff504bd68a2630792dafa33c9598cc9f3 [file] [log] [blame]
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001/*
2 * Z-star vc0321 library
3 * Copyright (C) 2006 Koninski Artur takeshi87@o2.pl
4 * Copyright (C) 2006 Michel Xhaard
5 *
6 * V4L2 by Jean-Francois Moine <http://moinejf.free.fr>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#define MODULE_NAME "vc032x"
24
25#include "gspca.h"
26
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030027MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
28MODULE_DESCRIPTION("GSPCA/VC032X USB Camera Driver");
29MODULE_LICENSE("GPL");
30
31/* specific webcam descriptor */
32struct sd {
33 struct gspca_dev gspca_dev; /* !! must be the first item */
34
35 unsigned char autogain;
36 unsigned char lightfreq;
37
38 char qindex;
39 char bridge;
40#define BRIDGE_VC0321 0
41#define BRIDGE_VC0323 1
42 char sensor;
43#define SENSOR_HV7131R 0
Jean-Francois Moinecbb05542008-11-26 16:17:13 -030044#define SENSOR_MI0360 1
45#define SENSOR_MI1320 2
46#define SENSOR_MI1310_SOC 3
47#define SENSOR_OV7660 4
48#define SENSOR_OV7670 5
49#define SENSOR_PO3130NC 6
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030050};
51
52/* V4L2 controls supported by the driver */
53static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val);
54static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val);
55static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val);
56static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val);
57
58static struct ctrl sd_ctrls[] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030059 {
60 {
61 .id = V4L2_CID_AUTOGAIN,
62 .type = V4L2_CTRL_TYPE_BOOLEAN,
63 .name = "Auto Gain",
64 .minimum = 0,
65 .maximum = 1,
66 .step = 1,
Jean-Francois Moined0d0e392008-07-10 07:06:44 -030067#define AUTOGAIN_DEF 1
68 .default_value = AUTOGAIN_DEF,
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030069 },
70 .set = sd_setautogain,
71 .get = sd_getautogain,
72 },
Jean-Francois Moinef50ba1b2008-09-03 17:12:14 -030073#define LIGHTFREQ_IDX 1
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030074 {
75 {
76 .id = V4L2_CID_POWER_LINE_FREQUENCY,
77 .type = V4L2_CTRL_TYPE_MENU,
78 .name = "Light frequency filter",
79 .minimum = 0,
Jean-Francois Moined0d0e392008-07-10 07:06:44 -030080 .maximum = 2, /* 0: No, 1: 50Hz, 2:60Hz */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030081 .step = 1,
Jean-Francois Moined0d0e392008-07-10 07:06:44 -030082#define FREQ_DEF 1
83 .default_value = FREQ_DEF,
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030084 },
85 .set = sd_setfreq,
86 .get = sd_getfreq,
87 },
88};
89
Jean-Francois Moinec2446b32008-07-05 11:49:20 -030090static struct v4l2_pix_format vc0321_mode[] = {
Jean-Francois Moine20122542008-09-03 17:12:20 -030091 {320, 240, V4L2_PIX_FMT_YVYU, V4L2_FIELD_NONE,
Jean-Francois Moine00b27ce2008-07-30 05:47:54 -030092 .bytesperline = 320,
Jean-Francois Moinec2446b32008-07-05 11:49:20 -030093 .sizeimage = 320 * 240 * 2,
94 .colorspace = V4L2_COLORSPACE_SRGB,
95 .priv = 1},
Jean-Francois Moine20122542008-09-03 17:12:20 -030096 {640, 480, V4L2_PIX_FMT_YVYU, V4L2_FIELD_NONE,
Jean-Francois Moine00b27ce2008-07-30 05:47:54 -030097 .bytesperline = 640,
Jean-Francois Moinec2446b32008-07-05 11:49:20 -030098 .sizeimage = 640 * 480 * 2,
99 .colorspace = V4L2_COLORSPACE_SRGB,
100 .priv = 0},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300101};
Jean-Francois Moinec2446b32008-07-05 11:49:20 -0300102static struct v4l2_pix_format vc0323_mode[] = {
103 {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
104 .bytesperline = 320,
105 .sizeimage = 320 * 240 * 3 / 8 + 590,
106 .colorspace = V4L2_COLORSPACE_JPEG,
107 .priv = 1},
108 {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
109 .bytesperline = 640,
110 .sizeimage = 640 * 480 * 3 / 8 + 590,
111 .colorspace = V4L2_COLORSPACE_JPEG,
112 .priv = 0},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300113};
114
Jean-Francois Moinecbb05542008-11-26 16:17:13 -0300115static const __u8 mi0360_matrix[9] = {
116 0x50, 0xf8, 0xf8, 0xf5, 0x50, 0xfb, 0xff, 0xf1, 0x50
117};
118
119static const __u8 mi0360_initVGA_JPG[][4] = {
120 {0xb0, 0x03, 0x19, 0xcc},
121 {0xb0, 0x04, 0x02, 0xcc},
122 {0xb3, 0x00, 0x24, 0xcc},
123 {0xb3, 0x00, 0x25, 0xcc},
124 {0xb3, 0x08, 0x01, 0xcc},
125 {0xb3, 0x09, 0x0c, 0xcc},
126 {0xb3, 0x05, 0x01, 0xcc},
127 {0xb3, 0x06, 0x03, 0xcc},
128 {0xb3, 0x03, 0x0a, 0xcc},
129 {0xb3, 0x20, 0x00, 0xcc},
130 {0xb3, 0x21, 0x00, 0xcc},
131 {0xb3, 0x22, 0x01, 0xcc},
132 {0xb3, 0x23, 0xe0, 0xcc},
133 {0xb3, 0x04, 0x05, 0xcc},
134 {0xb3, 0x14, 0x00, 0xcc},
135 {0xb3, 0x15, 0x00, 0xcc},
136 {0xb3, 0x16, 0x02, 0xcc},
137 {0xb3, 0x17, 0x7f, 0xcc},
138 {0xb3, 0x35, 0xdd, 0xcc},
139 {0xb3, 0x34, 0x02, 0xcc},
140 {0xb3, 0x00, 0x25, 0xcc},
141 {0xbc, 0x00, 0x71, 0xcc},
142 {0xb8, 0x00, 0x13, 0xcc},
143 {0xb8, 0x27, 0x20, 0xcc},
144 {0xb8, 0x2c, 0x50, 0xcc},
145 {0xb8, 0x2d, 0xf8, 0xcc},
146 {0xb8, 0x2e, 0xf8, 0xcc},
147 {0xb8, 0x2f, 0xf8, 0xcc},
148 {0xb8, 0x30, 0x50, 0xcc},
149 {0xb8, 0x31, 0xf8, 0xcc},
150 {0xb8, 0x32, 0xf8, 0xcc},
151 {0xb8, 0x33, 0xf8, 0xcc},
152 {0xb8, 0x34, 0x50, 0xcc},
153 {0xb8, 0x35, 0x00, 0xcc},
154 {0xb8, 0x36, 0x00, 0xcc},
155 {0xb8, 0x37, 0x00, 0xcc},
156 {0xb8, 0x01, 0x79, 0xcc},
157 {0xb8, 0x08, 0xe0, 0xcc},
158 {0xb3, 0x01, 0x41, 0xcc},
159 {0xb8, 0x01, 0x79, 0xcc},
160 {0xb8, 0x14, 0x18, 0xcc},
161 {0xb8, 0xb2, 0x0a, 0xcc},
162 {0xb8, 0xb4, 0x0a, 0xcc},
163 {0xb8, 0xb5, 0x0a, 0xcc},
164 {0xb8, 0xfe, 0x00, 0xcc},
165 {0xb8, 0xff, 0x28, 0xcc},
166 {0xb9, 0x00, 0x28, 0xcc},
167 {0xb9, 0x01, 0x28, 0xcc},
168 {0xb9, 0x02, 0x28, 0xcc},
169 {0xb9, 0x03, 0x00, 0xcc},
170 {0xb9, 0x04, 0x00, 0xcc},
171 {0xb9, 0x05, 0x3c, 0xcc},
172 {0xb9, 0x06, 0x3c, 0xcc},
173 {0xb9, 0x07, 0x3c, 0xcc},
174 {0xb9, 0x08, 0x3c, 0xcc},
175 {0xb8, 0x8e, 0x00, 0xcc},
176 {0xb8, 0x8f, 0xff, 0xcc},
177 {0xb8, 0x81, 0x09, 0xcc},
178 {0x31, 0x00, 0x00, 0xbb},
179 {0x09, 0x01, 0xc7, 0xbb},
180 {0x34, 0x01, 0x00, 0xbb},
181 {0x2b, 0x00, 0x28, 0xbb},
182 {0x2c, 0x00, 0x30, 0xbb},
183 {0x2d, 0x00, 0x30, 0xbb},
184 {0x2e, 0x00, 0x28, 0xbb},
185 {0x62, 0x04, 0x11, 0xbb},
186 {0x03, 0x01, 0xe0, 0xbb},
187 {0x2c, 0x00, 0x2c, 0xbb},
188 {0x20, 0xd0, 0x00, 0xbb},
189 {0x01, 0x00, 0x08, 0xbb},
190 {0x06, 0x00, 0x10, 0xbb},
191 {0x05, 0x00, 0x20, 0xbb},
192 {0x20, 0x00, 0x00, 0xbb},
193 {0xb6, 0x00, 0x00, 0xcc},
194 {0xb6, 0x03, 0x02, 0xcc},
195 {0xb6, 0x02, 0x80, 0xcc},
196 {0xb6, 0x05, 0x01, 0xcc},
197 {0xb6, 0x04, 0xe0, 0xcc},
198 {0xb6, 0x12, 0x78, 0xcc},
199 {0xb6, 0x18, 0x02, 0xcc},
200 {0xb6, 0x17, 0x58, 0xcc},
201 {0xb6, 0x16, 0x00, 0xcc},
202 {0xb6, 0x22, 0x12, 0xcc},
203 {0xb6, 0x23, 0x0b, 0xcc},
204 {0xb3, 0x02, 0x02, 0xcc},
205 {0xbf, 0xc0, 0x39, 0xcc},
206 {0xbf, 0xc1, 0x04, 0xcc},
207 {0xbf, 0xcc, 0x10, 0xcc},
208 {0xb9, 0x12, 0x00, 0xcc},
209 {0xb9, 0x13, 0x0a, 0xcc},
210 {0xb9, 0x14, 0x0a, 0xcc},
211 {0xb9, 0x15, 0x0a, 0xcc},
212 {0xb9, 0x16, 0x0a, 0xcc},
213 {0xb9, 0x18, 0x00, 0xcc},
214 {0xb9, 0x19, 0x0f, 0xcc},
215 {0xb9, 0x1a, 0x0f, 0xcc},
216 {0xb9, 0x1b, 0x0f, 0xcc},
217 {0xb9, 0x1c, 0x0f, 0xcc},
218 {0xb8, 0x8e, 0x00, 0xcc},
219 {0xb8, 0x8f, 0xff, 0xcc},
220 {0xb6, 0x12, 0xf8, 0xcc},
221 {0xb8, 0x0c, 0x20, 0xcc},
222 {0xb8, 0x0d, 0x70, 0xcc},
223 {0xb6, 0x13, 0x13, 0xcc},
224 {0x35, 0x00, 0x60, 0xbb},
225 {0xb3, 0x5c, 0x01, 0xcc},
226 {}
227};
228static const __u8 mi0360_initQVGA_JPG[][4] = {
229 {0xb0, 0x03, 0x19, 0xcc},
230 {0xb0, 0x04, 0x02, 0xcc},
231 {0xb3, 0x00, 0x24, 0xcc},
232 {0xb3, 0x00, 0x25, 0xcc},
233 {0xb3, 0x08, 0x01, 0xcc},
234 {0xb3, 0x09, 0x0c, 0xcc},
235 {0xb3, 0x05, 0x01, 0xcc},
236 {0xb3, 0x06, 0x03, 0xcc},
237 {0xb3, 0x03, 0x0a, 0xcc},
238 {0xb3, 0x20, 0x00, 0xcc},
239 {0xb3, 0x21, 0x00, 0xcc},
240 {0xb3, 0x22, 0x01, 0xcc},
241 {0xb3, 0x23, 0xe0, 0xcc},
242 {0xb3, 0x04, 0x05, 0xcc},
243 {0xb3, 0x14, 0x00, 0xcc},
244 {0xb3, 0x15, 0x00, 0xcc},
245 {0xb3, 0x16, 0x02, 0xcc},
246 {0xb3, 0x17, 0x7f, 0xcc},
247 {0xb3, 0x35, 0xdd, 0xcc},
248 {0xb3, 0x34, 0x02, 0xcc},
249 {0xb3, 0x00, 0x25, 0xcc},
250 {0xbc, 0x00, 0xd1, 0xcc},
251 {0xb8, 0x00, 0x13, 0xcc},
252 {0xb8, 0x27, 0x20, 0xcc},
253 {0xb8, 0x2c, 0x50, 0xcc},
254 {0xb8, 0x2d, 0xf8, 0xcc},
255 {0xb8, 0x2e, 0xf8, 0xcc},
256 {0xb8, 0x2f, 0xf8, 0xcc},
257 {0xb8, 0x30, 0x50, 0xcc},
258 {0xb8, 0x31, 0xf8, 0xcc},
259 {0xb8, 0x32, 0xf8, 0xcc},
260 {0xb8, 0x33, 0xf8, 0xcc},
261 {0xb8, 0x34, 0x50, 0xcc},
262 {0xb8, 0x35, 0x00, 0xcc},
263 {0xb8, 0x36, 0x00, 0xcc},
264 {0xb8, 0x37, 0x00, 0xcc},
265 {0xb8, 0x01, 0x79, 0xcc},
266 {0xb8, 0x08, 0xe0, 0xcc},
267 {0xb3, 0x01, 0x41, 0xcc},
268 {0xb8, 0x01, 0x79, 0xcc},
269 {0xb8, 0x14, 0x18, 0xcc},
270 {0xb8, 0xb2, 0x0a, 0xcc},
271 {0xb8, 0xb4, 0x0a, 0xcc},
272 {0xb8, 0xb5, 0x0a, 0xcc},
273 {0xb8, 0xfe, 0x00, 0xcc},
274 {0xb8, 0xff, 0x28, 0xcc},
275 {0xb9, 0x00, 0x28, 0xcc},
276 {0xb9, 0x01, 0x28, 0xcc},
277 {0xb9, 0x02, 0x28, 0xcc},
278 {0xb9, 0x03, 0x00, 0xcc},
279 {0xb9, 0x04, 0x00, 0xcc},
280 {0xb9, 0x05, 0x3c, 0xcc},
281 {0xb9, 0x06, 0x3c, 0xcc},
282 {0xb9, 0x07, 0x3c, 0xcc},
283 {0xb9, 0x08, 0x3c, 0xcc},
284 {0xb8, 0x8e, 0x00, 0xcc},
285 {0xb8, 0x8f, 0xff, 0xcc},
286 {0xb8, 0x81, 0x09, 0xcc},
287 {0x31, 0x00, 0x00, 0xbb},
288 {0x09, 0x01, 0xc7, 0xbb},
289 {0x34, 0x01, 0x00, 0xbb},
290 {0x2b, 0x00, 0x28, 0xbb},
291 {0x2c, 0x00, 0x30, 0xbb},
292 {0x2d, 0x00, 0x30, 0xbb},
293 {0x2e, 0x00, 0x28, 0xbb},
294 {0x62, 0x04, 0x11, 0xbb},
295 {0x03, 0x01, 0xe0, 0xbb},
296 {0x2c, 0x00, 0x2c, 0xbb},
297 {0x20, 0xd0, 0x00, 0xbb},
298 {0x01, 0x00, 0x08, 0xbb},
299 {0x06, 0x00, 0x10, 0xbb},
300 {0x05, 0x00, 0x20, 0xbb},
301 {0x20, 0x00, 0x00, 0xbb},
302 {0xb6, 0x00, 0x00, 0xcc},
303 {0xb6, 0x03, 0x01, 0xcc},
304 {0xb6, 0x02, 0x40, 0xcc},
305 {0xb6, 0x05, 0x00, 0xcc},
306 {0xb6, 0x04, 0xf0, 0xcc},
307 {0xb6, 0x12, 0x78, 0xcc},
308 {0xb6, 0x18, 0x00, 0xcc},
309 {0xb6, 0x17, 0x96, 0xcc},
310 {0xb6, 0x16, 0x00, 0xcc},
311 {0xb6, 0x22, 0x12, 0xcc},
312 {0xb6, 0x23, 0x0b, 0xcc},
313 {0xb3, 0x02, 0x02, 0xcc},
314 {0xbf, 0xc0, 0x39, 0xcc},
315 {0xbf, 0xc1, 0x04, 0xcc},
316 {0xbf, 0xcc, 0x10, 0xcc},
317 {0xb9, 0x12, 0x00, 0xcc},
318 {0xb9, 0x13, 0x0a, 0xcc},
319 {0xb9, 0x14, 0x0a, 0xcc},
320 {0xb9, 0x15, 0x0a, 0xcc},
321 {0xb9, 0x16, 0x0a, 0xcc},
322 {0xb9, 0x18, 0x00, 0xcc},
323 {0xb9, 0x19, 0x0f, 0xcc},
324 {0xb9, 0x1a, 0x0f, 0xcc},
325 {0xb9, 0x1b, 0x0f, 0xcc},
326 {0xb9, 0x1c, 0x0f, 0xcc},
327 {0xb8, 0x8e, 0x00, 0xcc},
328 {0xb8, 0x8f, 0xff, 0xcc},
329 {0xb6, 0x12, 0xf8, 0xcc},
330 {0xb6, 0x13, 0x13, 0xcc},
331 {0xbc, 0x02, 0x18, 0xcc},
332 {0xbc, 0x03, 0x50, 0xcc},
333 {0xbc, 0x04, 0x18, 0xcc},
334 {0xbc, 0x05, 0x00, 0xcc},
335 {0xbc, 0x06, 0x00, 0xcc},
336 {0xbc, 0x08, 0x30, 0xcc},
337 {0xbc, 0x09, 0x40, 0xcc},
338 {0xbc, 0x0a, 0x10, 0xcc},
339 {0xb8, 0x0c, 0x20, 0xcc},
340 {0xb8, 0x0d, 0x70, 0xcc},
341 {0xbc, 0x0b, 0x00, 0xcc},
342 {0xbc, 0x0c, 0x00, 0xcc},
343 {0x35, 0x00, 0xef, 0xbb},
344 {0xb3, 0x5c, 0x01, 0xcc},
345 {}
346};
347
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -0300348static const __u8 mi1310_socinitVGA_JPG[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300349 {0xb0, 0x03, 0x19, 0xcc},
350 {0xb0, 0x04, 0x02, 0xcc},
351 {0xb3, 0x00, 0x64, 0xcc},
352 {0xb3, 0x00, 0x65, 0xcc},
353 {0xb3, 0x05, 0x00, 0xcc},
354 {0xb3, 0x06, 0x00, 0xcc},
355 {0xb3, 0x08, 0x01, 0xcc},
356 {0xb3, 0x09, 0x0c, 0xcc},
357 {0xb3, 0x34, 0x02, 0xcc},
358 {0xb3, 0x35, 0xdd, 0xcc},
359 {0xb3, 0x02, 0x00, 0xcc},
360 {0xb3, 0x03, 0x0a, 0xcc},
361 {0xb3, 0x04, 0x05, 0xcc},
362 {0xb3, 0x20, 0x00, 0xcc},
363 {0xb3, 0x21, 0x00, 0xcc},
364 {0xb3, 0x22, 0x03, 0xcc},
365 {0xb3, 0x23, 0xc0, 0xcc},
366 {0xb3, 0x14, 0x00, 0xcc},
367 {0xb3, 0x15, 0x00, 0xcc},
368 {0xb3, 0x16, 0x04, 0xcc},
369 {0xb3, 0x17, 0xff, 0xcc},
370 {0xb3, 0x00, 0x65, 0xcc},
371 {0xb8, 0x00, 0x00, 0xcc},
372 {0xbc, 0x00, 0xd0, 0xcc},
373 {0xbc, 0x01, 0x01, 0xcc},
374 {0xf0, 0x00, 0x02, 0xbb},
375 {0xc8, 0x9f, 0x0b, 0xbb},
376 {0x5b, 0x00, 0x01, 0xbb},
377 {0x2f, 0xde, 0x20, 0xbb},
378 {0xf0, 0x00, 0x00, 0xbb},
379 {0x20, 0x03, 0x02, 0xbb},
380 {0xf0, 0x00, 0x01, 0xbb},
381 {0x05, 0x00, 0x07, 0xbb},
382 {0x34, 0x00, 0x00, 0xbb},
383 {0x35, 0xff, 0x00, 0xbb},
384 {0xdc, 0x07, 0x02, 0xbb},
385 {0xdd, 0x3c, 0x18, 0xbb},
386 {0xde, 0x92, 0x6d, 0xbb},
387 {0xdf, 0xcd, 0xb1, 0xbb},
388 {0xe0, 0xff, 0xe7, 0xbb},
389 {0x06, 0xf0, 0x0d, 0xbb},
390 {0x06, 0x70, 0x0e, 0xbb},
391 {0x4c, 0x00, 0x01, 0xbb},
392 {0x4d, 0x00, 0x01, 0xbb},
393 {0xf0, 0x00, 0x02, 0xbb},
394 {0x2e, 0x0c, 0x55, 0xbb},
395 {0x21, 0xb6, 0x6e, 0xbb},
396 {0x36, 0x30, 0x10, 0xbb},
397 {0x37, 0x00, 0xc1, 0xbb},
398 {0xf0, 0x00, 0x00, 0xbb},
399 {0x07, 0x00, 0x84, 0xbb},
400 {0x08, 0x02, 0x4a, 0xbb},
401 {0x05, 0x01, 0x10, 0xbb},
402 {0x06, 0x00, 0x39, 0xbb},
403 {0xf0, 0x00, 0x02, 0xbb},
404 {0x58, 0x02, 0x67, 0xbb},
405 {0x57, 0x02, 0x00, 0xbb},
406 {0x5a, 0x02, 0x67, 0xbb},
407 {0x59, 0x02, 0x00, 0xbb},
408 {0x5c, 0x12, 0x0d, 0xbb},
409 {0x5d, 0x16, 0x11, 0xbb},
410 {0x39, 0x06, 0x18, 0xbb},
411 {0x3a, 0x06, 0x18, 0xbb},
412 {0x3b, 0x06, 0x18, 0xbb},
413 {0x3c, 0x06, 0x18, 0xbb},
414 {0x64, 0x7b, 0x5b, 0xbb},
415 {0xf0, 0x00, 0x02, 0xbb},
416 {0x36, 0x30, 0x10, 0xbb},
417 {0x37, 0x00, 0xc0, 0xbb},
418 {0xbc, 0x0e, 0x00, 0xcc},
419 {0xbc, 0x0f, 0x05, 0xcc},
420 {0xbc, 0x10, 0xc0, 0xcc},
421 {0xbc, 0x11, 0x03, 0xcc},
422 {0xb6, 0x00, 0x00, 0xcc},
423 {0xb6, 0x03, 0x02, 0xcc},
424 {0xb6, 0x02, 0x80, 0xcc},
425 {0xb6, 0x05, 0x01, 0xcc},
426 {0xb6, 0x04, 0xe0, 0xcc},
427 {0xb6, 0x12, 0xf8, 0xcc},
428 {0xb6, 0x13, 0x25, 0xcc},
429 {0xb6, 0x18, 0x02, 0xcc},
430 {0xb6, 0x17, 0x58, 0xcc},
431 {0xb6, 0x16, 0x00, 0xcc},
432 {0xb6, 0x22, 0x12, 0xcc},
433 {0xb6, 0x23, 0x0b, 0xcc},
434 {0xbf, 0xc0, 0x39, 0xcc},
435 {0xbf, 0xc1, 0x04, 0xcc},
436 {0xbf, 0xcc, 0x00, 0xcc},
437 {0xbc, 0x02, 0x18, 0xcc},
438 {0xbc, 0x03, 0x50, 0xcc},
439 {0xbc, 0x04, 0x18, 0xcc},
440 {0xbc, 0x05, 0x00, 0xcc},
441 {0xbc, 0x06, 0x00, 0xcc},
442 {0xbc, 0x08, 0x30, 0xcc},
443 {0xbc, 0x09, 0x40, 0xcc},
444 {0xbc, 0x0a, 0x10, 0xcc},
445 {0xbc, 0x0b, 0x00, 0xcc},
446 {0xbc, 0x0c, 0x00, 0xcc},
447 {0xb3, 0x5c, 0x01, 0xcc},
448 {0xf0, 0x00, 0x01, 0xbb},
449 {0x80, 0x00, 0x03, 0xbb},
450 {0x81, 0xc7, 0x14, 0xbb},
451 {0x82, 0xeb, 0xe8, 0xbb},
452 {0x83, 0xfe, 0xf4, 0xbb},
453 {0x84, 0xcd, 0x10, 0xbb},
454 {0x85, 0xf3, 0xee, 0xbb},
455 {0x86, 0xff, 0xf1, 0xbb},
456 {0x87, 0xcd, 0x10, 0xbb},
457 {0x88, 0xf3, 0xee, 0xbb},
458 {0x89, 0x01, 0xf1, 0xbb},
459 {0x8a, 0xe5, 0x17, 0xbb},
460 {0x8b, 0xe8, 0xe2, 0xbb},
461 {0x8c, 0xf7, 0xed, 0xbb},
462 {0x8d, 0x00, 0xff, 0xbb},
463 {0x8e, 0xec, 0x10, 0xbb},
464 {0x8f, 0xf0, 0xed, 0xbb},
465 {0x90, 0xf9, 0xf2, 0xbb},
466 {0x91, 0x00, 0x00, 0xbb},
467 {0x92, 0xe9, 0x0d, 0xbb},
468 {0x93, 0xf4, 0xf2, 0xbb},
469 {0x94, 0xfb, 0xf5, 0xbb},
470 {0x95, 0x00, 0xff, 0xbb},
471 {0xb6, 0x0f, 0x08, 0xbb},
472 {0xb7, 0x3d, 0x16, 0xbb},
473 {0xb8, 0x0c, 0x04, 0xbb},
474 {0xb9, 0x1c, 0x07, 0xbb},
475 {0xba, 0x0a, 0x03, 0xbb},
476 {0xbb, 0x1b, 0x09, 0xbb},
477 {0xbc, 0x17, 0x0d, 0xbb},
478 {0xbd, 0x23, 0x1d, 0xbb},
479 {0xbe, 0x00, 0x28, 0xbb},
480 {0xbf, 0x11, 0x09, 0xbb},
481 {0xc0, 0x16, 0x15, 0xbb},
482 {0xc1, 0x00, 0x1b, 0xbb},
483 {0xc2, 0x0e, 0x07, 0xbb},
484 {0xc3, 0x14, 0x10, 0xbb},
485 {0xc4, 0x00, 0x17, 0xbb},
486 {0x06, 0x74, 0x8e, 0xbb},
487 {0xf0, 0x00, 0x01, 0xbb},
488 {0x06, 0xf4, 0x8e, 0xbb},
489 {0x00, 0x00, 0x50, 0xdd},
490 {0x06, 0x74, 0x8e, 0xbb},
491 {0xf0, 0x00, 0x02, 0xbb},
492 {0x24, 0x50, 0x20, 0xbb},
493 {0xf0, 0x00, 0x02, 0xbb},
494 {0x34, 0x0c, 0x50, 0xbb},
495 {0xb3, 0x01, 0x41, 0xcc},
496 {0xf0, 0x00, 0x00, 0xbb},
497 {0x03, 0x03, 0xc0, 0xbb},
498 {},
499};
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -0300500static const __u8 mi1310_socinitQVGA_JPG[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300501 {0xb0, 0x03, 0x19, 0xcc}, {0xb0, 0x04, 0x02, 0xcc},
502 {0xb3, 0x00, 0x64, 0xcc}, {0xb3, 0x00, 0x65, 0xcc},
503 {0xb3, 0x05, 0x00, 0xcc}, {0xb3, 0x06, 0x00, 0xcc},
504 {0xb3, 0x08, 0x01, 0xcc}, {0xb3, 0x09, 0x0c, 0xcc},
505 {0xb3, 0x34, 0x02, 0xcc}, {0xb3, 0x35, 0xdd, 0xcc},
506 {0xb3, 0x02, 0x00, 0xcc}, {0xb3, 0x03, 0x0a, 0xcc},
507 {0xb3, 0x04, 0x05, 0xcc}, {0xb3, 0x20, 0x00, 0xcc},
508 {0xb3, 0x21, 0x00, 0xcc}, {0xb3, 0x22, 0x03, 0xcc},
509 {0xb3, 0x23, 0xc0, 0xcc}, {0xb3, 0x14, 0x00, 0xcc},
510 {0xb3, 0x15, 0x00, 0xcc}, {0xb3, 0x16, 0x04, 0xcc},
511 {0xb3, 0x17, 0xff, 0xcc}, {0xb3, 0x00, 0x65, 0xcc},
512 {0xb8, 0x00, 0x00, 0xcc}, {0xbc, 0x00, 0xf0, 0xcc},
513 {0xbc, 0x01, 0x01, 0xcc}, {0xf0, 0x00, 0x02, 0xbb},
514 {0xc8, 0x9f, 0x0b, 0xbb}, {0x5b, 0x00, 0x01, 0xbb},
515 {0x2f, 0xde, 0x20, 0xbb}, {0xf0, 0x00, 0x00, 0xbb},
516 {0x20, 0x03, 0x02, 0xbb}, {0xf0, 0x00, 0x01, 0xbb},
517 {0x05, 0x00, 0x07, 0xbb}, {0x34, 0x00, 0x00, 0xbb},
518 {0x35, 0xff, 0x00, 0xbb}, {0xdc, 0x07, 0x02, 0xbb},
519 {0xdd, 0x3c, 0x18, 0xbb}, {0xde, 0x92, 0x6d, 0xbb},
520 {0xdf, 0xcd, 0xb1, 0xbb}, {0xe0, 0xff, 0xe7, 0xbb},
521 {0x06, 0xf0, 0x0d, 0xbb}, {0x06, 0x70, 0x0e, 0xbb},
522 {0x4c, 0x00, 0x01, 0xbb}, {0x4d, 0x00, 0x01, 0xbb},
523 {0xf0, 0x00, 0x02, 0xbb}, {0x2e, 0x0c, 0x55, 0xbb},
524 {0x21, 0xb6, 0x6e, 0xbb}, {0x36, 0x30, 0x10, 0xbb},
525 {0x37, 0x00, 0xc1, 0xbb}, {0xf0, 0x00, 0x00, 0xbb},
526 {0x07, 0x00, 0x84, 0xbb}, {0x08, 0x02, 0x4a, 0xbb},
527 {0x05, 0x01, 0x10, 0xbb}, {0x06, 0x00, 0x39, 0xbb},
528 {0xf0, 0x00, 0x02, 0xbb}, {0x58, 0x02, 0x67, 0xbb},
529 {0x57, 0x02, 0x00, 0xbb}, {0x5a, 0x02, 0x67, 0xbb},
530 {0x59, 0x02, 0x00, 0xbb}, {0x5c, 0x12, 0x0d, 0xbb},
531 {0x5d, 0x16, 0x11, 0xbb}, {0x39, 0x06, 0x18, 0xbb},
532 {0x3a, 0x06, 0x18, 0xbb}, {0x3b, 0x06, 0x18, 0xbb},
533 {0x3c, 0x06, 0x18, 0xbb}, {0x64, 0x7b, 0x5b, 0xbb},
534 {0xf0, 0x00, 0x02, 0xbb}, {0x36, 0x30, 0x10, 0xbb},
535 {0x37, 0x00, 0xc0, 0xbb}, {0xbc, 0x0e, 0x00, 0xcc},
536 {0xbc, 0x0f, 0x05, 0xcc}, {0xbc, 0x10, 0xc0, 0xcc},
537 {0xbc, 0x11, 0x03, 0xcc}, {0xb6, 0x00, 0x00, 0xcc},
538 {0xb6, 0x03, 0x01, 0xcc}, {0xb6, 0x02, 0x40, 0xcc},
539 {0xb6, 0x05, 0x00, 0xcc}, {0xb6, 0x04, 0xf0, 0xcc},
540 {0xb6, 0x12, 0xf8, 0xcc}, {0xb6, 0x13, 0x25, 0xcc},
541 {0xb6, 0x18, 0x00, 0xcc}, {0xb6, 0x17, 0x96, 0xcc},
542 {0xb6, 0x16, 0x00, 0xcc}, {0xb6, 0x22, 0x12, 0xcc},
543 {0xb6, 0x23, 0x0b, 0xcc}, {0xbf, 0xc0, 0x39, 0xcc},
544 {0xbf, 0xc1, 0x04, 0xcc}, {0xbf, 0xcc, 0x00, 0xcc},
545 {0xb3, 0x5c, 0x01, 0xcc}, {0xf0, 0x00, 0x01, 0xbb},
546 {0x80, 0x00, 0x03, 0xbb}, {0x81, 0xc7, 0x14, 0xbb},
547 {0x82, 0xeb, 0xe8, 0xbb}, {0x83, 0xfe, 0xf4, 0xbb},
548 {0x84, 0xcd, 0x10, 0xbb}, {0x85, 0xf3, 0xee, 0xbb},
549 {0x86, 0xff, 0xf1, 0xbb}, {0x87, 0xcd, 0x10, 0xbb},
550 {0x88, 0xf3, 0xee, 0xbb}, {0x89, 0x01, 0xf1, 0xbb},
551 {0x8a, 0xe5, 0x17, 0xbb}, {0x8b, 0xe8, 0xe2, 0xbb},
552 {0x8c, 0xf7, 0xed, 0xbb}, {0x8d, 0x00, 0xff, 0xbb},
553 {0x8e, 0xec, 0x10, 0xbb}, {0x8f, 0xf0, 0xed, 0xbb},
554 {0x90, 0xf9, 0xf2, 0xbb}, {0x91, 0x00, 0x00, 0xbb},
555 {0x92, 0xe9, 0x0d, 0xbb}, {0x93, 0xf4, 0xf2, 0xbb},
556 {0x94, 0xfb, 0xf5, 0xbb}, {0x95, 0x00, 0xff, 0xbb},
557 {0xb6, 0x0f, 0x08, 0xbb}, {0xb7, 0x3d, 0x16, 0xbb},
558 {0xb8, 0x0c, 0x04, 0xbb}, {0xb9, 0x1c, 0x07, 0xbb},
559 {0xba, 0x0a, 0x03, 0xbb}, {0xbb, 0x1b, 0x09, 0xbb},
560 {0xbc, 0x17, 0x0d, 0xbb}, {0xbd, 0x23, 0x1d, 0xbb},
561 {0xbe, 0x00, 0x28, 0xbb}, {0xbf, 0x11, 0x09, 0xbb},
562 {0xc0, 0x16, 0x15, 0xbb}, {0xc1, 0x00, 0x1b, 0xbb},
563 {0xc2, 0x0e, 0x07, 0xbb}, {0xc3, 0x14, 0x10, 0xbb},
564 {0xc4, 0x00, 0x17, 0xbb}, {0x06, 0x74, 0x8e, 0xbb},
565 {0xf0, 0x00, 0x01, 0xbb}, {0x06, 0xf4, 0x8e, 0xbb},
566 {0x00, 0x00, 0x50, 0xdd}, {0x06, 0x74, 0x8e, 0xbb},
567 {0xf0, 0x00, 0x02, 0xbb}, {0x24, 0x50, 0x20, 0xbb},
568 {0xf0, 0x00, 0x02, 0xbb}, {0x34, 0x0c, 0x50, 0xbb},
569 {0xb3, 0x01, 0x41, 0xcc}, {0xf0, 0x00, 0x00, 0xbb},
570 {0x03, 0x03, 0xc0, 0xbb},
571 {},
572};
573
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -0300574static const __u8 mi1320_gamma[17] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300575 0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
576 0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
577};
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -0300578static const __u8 mi1320_matrix[9] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300579 0x54, 0xda, 0x06, 0xf1, 0x50, 0xf4, 0xf7, 0xea, 0x52
580};
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -0300581static const __u8 mi1320_initVGA_data[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300582 {0xb3, 0x01, 0x01, 0xcc}, {0x00, 0x00, 0x33, 0xdd},
583 {0xb0, 0x03, 0x19, 0xcc}, {0x00, 0x00, 0x33, 0xdd},
584 {0xb0, 0x04, 0x02, 0xcc}, {0x00, 0x00, 0x33, 0xdd},
585 {0xb3, 0x00, 0x64, 0xcc}, {0xb3, 0x00, 0x65, 0xcc},
586 {0xb0, 0x16, 0x03, 0xcc}, {0xb3, 0x05, 0x00, 0xcc},
587 {0xb3, 0x06, 0x00, 0xcc}, {0xb3, 0x08, 0x01, 0xcc},
588 {0xb3, 0x09, 0x0c, 0xcc}, {0xb3, 0x34, 0x02, 0xcc},
589 {0xb3, 0x35, 0xc8, 0xcc}, {0xb3, 0x02, 0x00, 0xcc},
590 {0xb3, 0x03, 0x0a, 0xcc}, {0xb3, 0x04, 0x05, 0xcc},
591 {0xb3, 0x20, 0x00, 0xcc}, {0xb3, 0x21, 0x00, 0xcc},
592 {0xb3, 0x22, 0x03, 0xcc}, {0xb3, 0x23, 0xc0, 0xcc},
593 {0xb3, 0x14, 0x00, 0xcc}, {0xb3, 0x15, 0x00, 0xcc},
594 {0xb3, 0x16, 0x04, 0xcc}, {0xb3, 0x17, 0xff, 0xcc},
595 {0xb3, 0x00, 0x67, 0xcc}, {0xbc, 0x00, 0xd0, 0xcc},
596 {0xbc, 0x01, 0x01, 0xcc}, {0xf0, 0x00, 0x00, 0xbb},
597 {0x0d, 0x00, 0x09, 0xbb}, {0x00, 0x01, 0x00, 0xdd},
598 {0x0d, 0x00, 0x08, 0xbb}, {0xf0, 0x00, 0x01, 0xbb},
599 {0xa1, 0x05, 0x00, 0xbb}, {0xa4, 0x03, 0xc0, 0xbb},
600 {0xf0, 0x00, 0x02, 0xbb}, {0x00, 0x00, 0x10, 0xdd},
601 {0xc8, 0x9f, 0x0b, 0xbb}, {0x00, 0x00, 0x10, 0xdd},
602 {0xf0, 0x00, 0x00, 0xbb}, {0x00, 0x00, 0x10, 0xdd},
603 {0x20, 0x01, 0x00, 0xbb}, {0x00, 0x00, 0x10, 0xdd},
604 {0xf0, 0x00, 0x01, 0xbb}, {0x9d, 0x3c, 0xa0, 0xbb},
605 {0x47, 0x30, 0x30, 0xbb}, {0xf0, 0x00, 0x00, 0xbb},
606 {0x0a, 0x80, 0x11, 0xbb}, {0x35, 0x00, 0x22, 0xbb},
607 {0xf0, 0x00, 0x02, 0xbb}, {0x9d, 0xc5, 0x05, 0xbb},
608 {0xdc, 0x0f, 0xfc, 0xbb}, {0xf0, 0x00, 0x01, 0xbb},
609 {0x06, 0x74, 0x0e, 0xbb}, {0x80, 0x00, 0x06, 0xbb},
610 {0x81, 0x04, 0x00, 0xbb}, {0x82, 0x01, 0x02, 0xbb},
611 {0x83, 0x03, 0x02, 0xbb}, {0x84, 0x05, 0x00, 0xbb},
612 {0x85, 0x01, 0x00, 0xbb}, {0x86, 0x03, 0x02, 0xbb},
613 {0x87, 0x05, 0x00, 0xbb}, {0x88, 0x01, 0x00, 0xbb},
614 {0x89, 0x02, 0x02, 0xbb}, {0x8a, 0xfd, 0x04, 0xbb},
615 {0x8b, 0xfc, 0xfd, 0xbb}, {0x8c, 0xff, 0xfd, 0xbb},
616 {0x8d, 0x00, 0x00, 0xbb}, {0x8e, 0xfe, 0x05, 0xbb},
617 {0x8f, 0xfc, 0xfd, 0xbb}, {0x90, 0xfe, 0xfd, 0xbb},
618 {0x91, 0x00, 0x00, 0xbb}, {0x92, 0xfe, 0x03, 0xbb},
619 {0x93, 0xfd, 0xfe, 0xbb}, {0x94, 0xff, 0xfd, 0xbb},
620 {0x95, 0x00, 0x00, 0xbb}, {0xb6, 0x07, 0x05, 0xbb},
621 {0xb7, 0x13, 0x06, 0xbb}, {0xb8, 0x08, 0x06, 0xbb},
622 {0xb9, 0x14, 0x08, 0xbb}, {0xba, 0x06, 0x05, 0xbb},
623 {0xbb, 0x13, 0x06, 0xbb}, {0xbc, 0x03, 0x01, 0xbb},
624 {0xbd, 0x03, 0x04, 0xbb}, {0xbe, 0x00, 0x02, 0xbb},
625 {0xbf, 0x03, 0x01, 0xbb}, {0xc0, 0x02, 0x04, 0xbb},
626 {0xc1, 0x00, 0x04, 0xbb}, {0xc2, 0x02, 0x01, 0xbb},
627 {0xc3, 0x01, 0x03, 0xbb}, {0xc4, 0x00, 0x04, 0xbb},
628 {0xf0, 0x00, 0x00, 0xbb}, {0x05, 0x01, 0x13, 0xbb},
629 {0x06, 0x00, 0x11, 0xbb}, {0x07, 0x00, 0x85, 0xbb},
630 {0x08, 0x00, 0x27, 0xbb}, {0x20, 0x01, 0x03, 0xbb},
631 {0x21, 0x80, 0x00, 0xbb}, {0x22, 0x0d, 0x0f, 0xbb},
632 {0x24, 0x80, 0x00, 0xbb}, {0x59, 0x00, 0xff, 0xbb},
633 {0xf0, 0x00, 0x02, 0xbb}, {0x39, 0x03, 0x0d, 0xbb},
634 {0x3a, 0x06, 0x1b, 0xbb}, {0x3b, 0x00, 0x95, 0xbb},
635 {0x3c, 0x04, 0xdb, 0xbb}, {0x57, 0x02, 0x00, 0xbb},
636 {0x58, 0x02, 0x66, 0xbb}, {0x59, 0x00, 0xff, 0xbb},
637 {0x5a, 0x01, 0x33, 0xbb}, {0x5c, 0x12, 0x0d, 0xbb},
638 {0x5d, 0x16, 0x11, 0xbb}, {0x64, 0x5e, 0x1c, 0xbb},
639 {0xf0, 0x00, 0x02, 0xbb}, {0x2f, 0xd1, 0x00, 0xbb},
640 {0x5b, 0x00, 0x01, 0xbb}, {0xf0, 0x00, 0x02, 0xbb},
641 {0x36, 0x68, 0x10, 0xbb}, {0x00, 0x00, 0x30, 0xdd},
642 {0x37, 0x82, 0x00, 0xbb}, {0xbc, 0x0e, 0x00, 0xcc},
643 {0xbc, 0x0f, 0x05, 0xcc}, {0xbc, 0x10, 0xc0, 0xcc},
644 {0xbc, 0x11, 0x03, 0xcc}, {0xb6, 0x00, 0x00, 0xcc},
645 {0xb6, 0x03, 0x05, 0xcc}, {0xb6, 0x02, 0x00, 0xcc},
646 {0xb6, 0x05, 0x04, 0xcc}, {0xb6, 0x04, 0x00, 0xcc},
647 {0xb6, 0x12, 0xf8, 0xcc}, {0xb6, 0x13, 0x29, 0xcc},
648 {0xb6, 0x18, 0x0a, 0xcc}, {0xb6, 0x17, 0x00, 0xcc},
649 {0xb6, 0x16, 0x00, 0xcc}, {0xb6, 0x22, 0x12, 0xcc},
650 {0xb6, 0x23, 0x0b, 0xcc}, {0xbf, 0xc0, 0x26, 0xcc},
651 {0xbf, 0xc1, 0x02, 0xcc}, {0xbf, 0xcc, 0x04, 0xcc},
652 {0xbc, 0x02, 0x18, 0xcc}, {0xbc, 0x03, 0x50, 0xcc},
653 {0xbc, 0x04, 0x18, 0xcc}, {0xbc, 0x05, 0x00, 0xcc},
654 {0xbc, 0x06, 0x00, 0xcc}, {0xbc, 0x08, 0x30, 0xcc},
655 {0xbc, 0x09, 0x40, 0xcc}, {0xbc, 0x0a, 0x10, 0xcc},
656 {0xbc, 0x0b, 0x00, 0xcc}, {0xbc, 0x0c, 0x00, 0xcc},
657 {0xb3, 0x5c, 0x01, 0xcc}, {0xb3, 0x01, 0x41, 0xcc},
658 {}
659};
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -0300660static const __u8 mi1320_initQVGA_data[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300661 {0xb3, 0x01, 0x01, 0xcc}, {0x00, 0x00, 0x33, 0xdd},
662 {0xb0, 0x03, 0x19, 0xcc}, {0x00, 0x00, 0x33, 0xdd},
663 {0xb0, 0x04, 0x02, 0xcc}, {0x00, 0x00, 0x33, 0xdd},
664 {0xb3, 0x00, 0x64, 0xcc}, {0xb3, 0x00, 0x65, 0xcc},
665 {0xb0, 0x16, 0x03, 0xcc}, {0xb3, 0x05, 0x01, 0xcc},
666 {0xb3, 0x06, 0x01, 0xcc}, {0xb3, 0x08, 0x01, 0xcc},
667 {0xb3, 0x09, 0x0c, 0xcc}, {0xb3, 0x34, 0x02, 0xcc},
668 {0xb3, 0x35, 0xc8, 0xcc}, {0xb3, 0x02, 0x00, 0xcc},
669 {0xb3, 0x03, 0x0a, 0xcc}, {0xb3, 0x04, 0x05, 0xcc},
670 {0xb3, 0x20, 0x00, 0xcc}, {0xb3, 0x21, 0x00, 0xcc},
671 {0xb3, 0x22, 0x01, 0xcc}, {0xb3, 0x23, 0xe0, 0xcc},
672 {0xb3, 0x14, 0x00, 0xcc}, {0xb3, 0x15, 0x00, 0xcc},
673 {0xb3, 0x16, 0x02, 0xcc}, {0xb3, 0x17, 0x7f, 0xcc},
674 {0xb3, 0x00, 0x65, 0xcc}, {0xb8, 0x00, 0x00, 0xcc},
675 {0xbc, 0x00, 0xd0, 0xcc}, {0xbc, 0x01, 0x01, 0xcc},
676 {0xf0, 0x00, 0x00, 0xbb}, {0x0d, 0x00, 0x09, 0xbb},
677 {0x00, 0x01, 0x00, 0xdd}, {0x0d, 0x00, 0x08, 0xbb},
678 {0xf0, 0x00, 0x00, 0xbb}, {0x02, 0x00, 0x64, 0xbb},
679 {0x05, 0x01, 0x78, 0xbb}, {0x06, 0x00, 0x11, 0xbb},
680 {0x07, 0x01, 0x42, 0xbb}, {0x08, 0x00, 0x11, 0xbb},
681 {0x20, 0x01, 0x00, 0xbb}, {0x21, 0x80, 0x00, 0xbb},
682 {0x22, 0x0d, 0x0f, 0xbb}, {0x24, 0x80, 0x00, 0xbb},
683 {0x59, 0x00, 0xff, 0xbb}, {0xf0, 0x00, 0x01, 0xbb},
684 {0x9d, 0x3c, 0xa0, 0xbb}, {0x47, 0x30, 0x30, 0xbb},
685 {0xf0, 0x00, 0x00, 0xbb}, {0x0a, 0x80, 0x11, 0xbb},
686 {0x35, 0x00, 0x22, 0xbb}, {0xf0, 0x00, 0x02, 0xbb},
687 {0x9d, 0xc5, 0x05, 0xbb}, {0xdc, 0x0f, 0xfc, 0xbb},
688 {0xf0, 0x00, 0x01, 0xbb}, {0x06, 0x74, 0x0e, 0xbb},
689 {0x80, 0x00, 0x06, 0xbb}, {0x81, 0x04, 0x00, 0xbb},
690 {0x82, 0x01, 0x02, 0xbb}, {0x83, 0x03, 0x02, 0xbb},
691 {0x84, 0x05, 0x00, 0xbb}, {0x85, 0x01, 0x00, 0xbb},
692 {0x86, 0x03, 0x02, 0xbb}, {0x87, 0x05, 0x00, 0xbb},
693 {0x88, 0x01, 0x00, 0xbb}, {0x89, 0x02, 0x02, 0xbb},
694 {0x8a, 0xfd, 0x04, 0xbb}, {0x8b, 0xfc, 0xfd, 0xbb},
695 {0x8c, 0xff, 0xfd, 0xbb}, {0x8d, 0x00, 0x00, 0xbb},
696 {0x8e, 0xfe, 0x05, 0xbb}, {0x8f, 0xfc, 0xfd, 0xbb},
697 {0x90, 0xfe, 0xfd, 0xbb}, {0x91, 0x00, 0x00, 0xbb},
698 {0x92, 0xfe, 0x03, 0xbb}, {0x93, 0xfd, 0xfe, 0xbb},
699 {0x94, 0xff, 0xfd, 0xbb}, {0x95, 0x00, 0x00, 0xbb},
700 {0xb6, 0x07, 0x05, 0xbb}, {0xb7, 0x13, 0x06, 0xbb},
701 {0xb8, 0x08, 0x06, 0xbb}, {0xb9, 0x14, 0x08, 0xbb},
702 {0xba, 0x06, 0x05, 0xbb}, {0xbb, 0x13, 0x06, 0xbb},
703 {0xbc, 0x03, 0x01, 0xbb}, {0xbd, 0x03, 0x04, 0xbb},
704 {0xbe, 0x00, 0x02, 0xbb}, {0xbf, 0x03, 0x01, 0xbb},
705 {0xc0, 0x02, 0x04, 0xbb}, {0xc1, 0x00, 0x04, 0xbb},
706 {0xc2, 0x02, 0x01, 0xbb}, {0xc3, 0x01, 0x03, 0xbb},
707 {0xc4, 0x00, 0x04, 0xbb}, {0xf0, 0x00, 0x02, 0xbb},
708 {0xc8, 0x00, 0x00, 0xbb}, {0x2e, 0x00, 0x00, 0xbb},
709 {0x2e, 0x0c, 0x5b, 0xbb}, {0x2f, 0xd1, 0x00, 0xbb},
710 {0x39, 0x03, 0xca, 0xbb}, {0x3a, 0x06, 0x80, 0xbb},
711 {0x3b, 0x01, 0x52, 0xbb}, {0x3c, 0x05, 0x40, 0xbb},
712 {0x57, 0x01, 0x9c, 0xbb}, {0x58, 0x01, 0xee, 0xbb},
713 {0x59, 0x00, 0xf0, 0xbb}, {0x5a, 0x01, 0x20, 0xbb},
714 {0x5c, 0x1d, 0x17, 0xbb}, {0x5d, 0x22, 0x1c, 0xbb},
715 {0x64, 0x1e, 0x1c, 0xbb}, {0x5b, 0x00, 0x01, 0xbb},
716 {0xf0, 0x00, 0x02, 0xbb}, {0x36, 0x68, 0x10, 0xbb},
717 {0x00, 0x00, 0x30, 0xdd}, {0x37, 0x81, 0x00, 0xbb},
718 {0xbc, 0x02, 0x18, 0xcc}, {0xbc, 0x03, 0x50, 0xcc},
719 {0xbc, 0x04, 0x18, 0xcc}, {0xbc, 0x05, 0x00, 0xcc},
720 {0xbc, 0x06, 0x00, 0xcc}, {0xbc, 0x08, 0x30, 0xcc},
721 {0xbc, 0x09, 0x40, 0xcc}, {0xbc, 0x0a, 0x10, 0xcc},
722 {0xbc, 0x0b, 0x00, 0xcc}, {0xbc, 0x0c, 0x00, 0xcc},
723 {0xbf, 0xc0, 0x26, 0xcc}, {0xbf, 0xc1, 0x02, 0xcc},
724 {0xbf, 0xcc, 0x04, 0xcc}, {0xb3, 0x5c, 0x01, 0xcc},
725 {0xb3, 0x01, 0x41, 0xcc},
726 {}
727};
728
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -0300729static const __u8 po3130_gamma[17] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300730 0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
731 0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
732};
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -0300733static const __u8 po3130_matrix[9] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300734 0x5f, 0xec, 0xf5, 0xf1, 0x5a, 0xf5, 0xf1, 0xec, 0x63
735};
736
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -0300737static const __u8 po3130_initVGA_data[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300738 {0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc},
739 {0x00, 0x00, 0x50, 0xdd}, {0xb0, 0x03, 0x01, 0xcc},
740 {0xb3, 0x00, 0x04, 0xcc}, {0xb3, 0x00, 0x24, 0xcc},
741 {0xb3, 0x00, 0x25, 0xcc}, {0xb3, 0x08, 0x01, 0xcc},
742 {0xb3, 0x09, 0x0c, 0xcc}, {0xb3, 0x05, 0x00, 0xcc},
743 {0xb3, 0x06, 0x01, 0xcc}, {0xb3, 0x03, 0x1a, 0xcc},
744 {0xb3, 0x04, 0x15, 0xcc}, {0xb3, 0x20, 0x00, 0xcc},
745 {0xb3, 0x21, 0x00, 0xcc}, {0xb3, 0x22, 0x01, 0xcc},
746 {0xb3, 0x23, 0xe8, 0xcc}, {0xb8, 0x08, 0xe8, 0xcc},
747 {0xb3, 0x14, 0x00, 0xcc}, {0xb3, 0x15, 0x00, 0xcc},
748 {0xb3, 0x16, 0x02, 0xcc}, {0xb3, 0x17, 0x7f, 0xcc},
749 {0xb3, 0x34, 0x01, 0xcc}, {0xb3, 0x35, 0xf6, 0xcc},
750 {0xb3, 0x00, 0x27, 0xcc}, {0xbc, 0x00, 0x71, 0xcc},
751 {0xb8, 0x00, 0x21, 0xcc}, {0xb8, 0x27, 0x20, 0xcc},
752 {0xb8, 0x01, 0x79, 0xcc}, {0xb8, 0x81, 0x09, 0xcc},
753 {0xb8, 0x2c, 0x50, 0xcc}, {0xb8, 0x2d, 0xf8, 0xcc},
754 {0xb8, 0x2e, 0xf8, 0xcc}, {0xb8, 0x2f, 0xf8, 0xcc},
755 {0xb8, 0x30, 0x50, 0xcc}, {0xb8, 0x31, 0xf8, 0xcc},
756 {0xb8, 0x32, 0xf8, 0xcc}, {0xb8, 0x33, 0xf8, 0xcc},
757 {0xb8, 0x34, 0x50, 0xcc}, {0xb8, 0x35, 0x00, 0xcc},
758 {0xb8, 0x36, 0x00, 0xcc}, {0xb8, 0x37, 0x00, 0xcc},
759 {0x00, 0x1e, 0xc6, 0xaa}, {0x00, 0x20, 0x44, 0xaa},
760 {0x00, 0xad, 0x02, 0xaa}, {0x00, 0xae, 0x2c, 0xaa},
761 {0x00, 0x12, 0x08, 0xaa}, {0x00, 0x17, 0x41, 0xaa},
762 {0x00, 0x19, 0x41, 0xaa}, {0x00, 0x1e, 0x06, 0xaa},
763 {0x00, 0x21, 0x00, 0xaa}, {0x00, 0x36, 0xc0, 0xaa},
764 {0x00, 0x37, 0xc8, 0xaa}, {0x00, 0x3b, 0x36, 0xaa},
765 {0x00, 0x4b, 0xfe, 0xaa}, {0x00, 0x51, 0x1c, 0xaa},
766 {0x00, 0x52, 0x01, 0xaa}, {0x00, 0x55, 0x0a, 0xaa},
767 {0x00, 0x59, 0x02, 0xaa}, {0x00, 0x5a, 0x04, 0xaa},
768 {0x00, 0x5c, 0x10, 0xaa}, {0x00, 0x5d, 0x10, 0xaa},
769 {0x00, 0x5e, 0x10, 0xaa}, {0x00, 0x5f, 0x10, 0xaa},
770 {0x00, 0x61, 0x00, 0xaa}, {0x00, 0x62, 0x18, 0xaa},
771 {0x00, 0x63, 0x30, 0xaa}, {0x00, 0x70, 0x68, 0xaa},
772 {0x00, 0x80, 0x71, 0xaa}, {0x00, 0x81, 0x08, 0xaa},
773 {0x00, 0x82, 0x00, 0xaa}, {0x00, 0x83, 0x55, 0xaa},
774 {0x00, 0x84, 0x06, 0xaa}, {0x00, 0x85, 0x06, 0xaa},
775 {0x00, 0x86, 0x13, 0xaa}, {0x00, 0x87, 0x18, 0xaa},
776 {0x00, 0xaa, 0x3f, 0xaa}, {0x00, 0xab, 0x44, 0xaa},
777 {0x00, 0xb0, 0x68, 0xaa}, {0x00, 0xb5, 0x10, 0xaa},
778 {0x00, 0xb8, 0x20, 0xaa}, {0x00, 0xb9, 0xa0, 0xaa},
779 {0x00, 0xbc, 0x04, 0xaa}, {0x00, 0x8b, 0x40, 0xaa},
780 {0x00, 0x8c, 0x91, 0xaa}, {0x00, 0x8d, 0x8f, 0xaa},
781 {0x00, 0x8e, 0x91, 0xaa}, {0x00, 0x8f, 0x43, 0xaa},
782 {0x00, 0x90, 0x92, 0xaa}, {0x00, 0x91, 0x89, 0xaa},
783 {0x00, 0x92, 0x9d, 0xaa}, {0x00, 0x93, 0x46, 0xaa},
784 {0x00, 0xd6, 0x22, 0xaa}, {0x00, 0x73, 0x00, 0xaa},
785 {0x00, 0x74, 0x10, 0xaa}, {0x00, 0x75, 0x20, 0xaa},
786 {0x00, 0x76, 0x2b, 0xaa}, {0x00, 0x77, 0x36, 0xaa},
787 {0x00, 0x78, 0x49, 0xaa}, {0x00, 0x79, 0x5a, 0xaa},
788 {0x00, 0x7a, 0x7f, 0xaa}, {0x00, 0x7b, 0x9b, 0xaa},
789 {0x00, 0x7c, 0xba, 0xaa}, {0x00, 0x7d, 0xd4, 0xaa},
790 {0x00, 0x7e, 0xea, 0xaa}, {0x00, 0xd6, 0x62, 0xaa},
791 {0x00, 0x73, 0x00, 0xaa}, {0x00, 0x74, 0x10, 0xaa},
792 {0x00, 0x75, 0x20, 0xaa}, {0x00, 0x76, 0x2b, 0xaa},
793 {0x00, 0x77, 0x36, 0xaa}, {0x00, 0x78, 0x49, 0xaa},
794 {0x00, 0x79, 0x5a, 0xaa}, {0x00, 0x7a, 0x7f, 0xaa},
795 {0x00, 0x7b, 0x9b, 0xaa}, {0x00, 0x7c, 0xba, 0xaa},
796 {0x00, 0x7d, 0xd4, 0xaa}, {0x00, 0x7e, 0xea, 0xaa},
797 {0x00, 0xd6, 0xa2, 0xaa}, {0x00, 0x73, 0x00, 0xaa},
798 {0x00, 0x74, 0x10, 0xaa}, {0x00, 0x75, 0x20, 0xaa},
799 {0x00, 0x76, 0x2b, 0xaa}, {0x00, 0x77, 0x36, 0xaa},
800 {0x00, 0x78, 0x49, 0xaa}, {0x00, 0x79, 0x5a, 0xaa},
801 {0x00, 0x7a, 0x7f, 0xaa}, {0x00, 0x7b, 0x9b, 0xaa},
802 {0x00, 0x7c, 0xba, 0xaa}, {0x00, 0x7d, 0xd4, 0xaa},
803 {0x00, 0x7e, 0xea, 0xaa},
804 {0x00, 0x4c, 0x07, 0xaa},
805 {0x00, 0x4b, 0xe0, 0xaa}, {0x00, 0x4e, 0x77, 0xaa},
806 {0x00, 0x59, 0x02, 0xaa}, {0x00, 0x4d, 0x0a, 0xaa},
807/* {0x00, 0xd1, 0x00, 0xaa}, {0x00, 0x20, 0xc4, 0xaa},
808 {0xb8, 0x8e, 0x00, 0xcc}, {0xb8, 0x8f, 0xff, 0xcc}, */
809 {0x00, 0xd1, 0x3c, 0xaa}, {0x00, 0x20, 0xc4, 0xaa},
810 {0xb8, 0x8e, 0x00, 0xcc}, {0xb8, 0x8f, 0xff, 0xcc},
811 {0xb8, 0xfe, 0x00, 0xcc}, {0xb8, 0xff, 0x28, 0xcc},
812 {0xb9, 0x00, 0x28, 0xcc}, {0xb9, 0x01, 0x28, 0xcc},
813 {0xb9, 0x02, 0x28, 0xcc}, {0xb9, 0x03, 0x00, 0xcc},
814 {0xb9, 0x04, 0x00, 0xcc}, {0xb9, 0x05, 0x3c, 0xcc},
815 {0xb9, 0x06, 0x3c, 0xcc}, {0xb9, 0x07, 0x3c, 0xcc},
816 {0xb9, 0x08, 0x3c, 0xcc}, {0x00, 0x05, 0x00, 0xaa},
817 {0xb3, 0x5c, 0x00, 0xcc}, {0xb3, 0x01, 0x41, 0xcc},
818 {}
819};
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -0300820static const __u8 po3130_rundata[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300821 {0x00, 0x47, 0x45, 0xaa}, {0x00, 0x48, 0x9b, 0xaa},
822 {0x00, 0x49, 0x3a, 0xaa}, {0x00, 0x4a, 0x01, 0xaa},
823 {0x00, 0x44, 0x40, 0xaa},
824/* {0x00, 0xd5, 0x7c, 0xaa}, */
825 {0x00, 0xad, 0x04, 0xaa}, {0x00, 0xae, 0x00, 0xaa},
826 {0x00, 0xb0, 0x78, 0xaa}, {0x00, 0x98, 0x02, 0xaa},
827 {0x00, 0x94, 0x25, 0xaa}, {0x00, 0x95, 0x25, 0xaa},
828 {0x00, 0x59, 0x68, 0xaa}, {0x00, 0x44, 0x20, 0xaa},
829 {0x00, 0x17, 0x50, 0xaa}, {0x00, 0x19, 0x50, 0xaa},
830 {0x00, 0xd1, 0x3c, 0xaa}, {0x00, 0xd1, 0x3c, 0xaa},
831 {0x00, 0x1e, 0x06, 0xaa}, {0x00, 0x1e, 0x06, 0xaa},
832 {}
833};
834
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -0300835static const __u8 po3130_initQVGA_data[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300836 {0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc},
837 {0x00, 0x00, 0x50, 0xdd}, {0xb0, 0x03, 0x09, 0xcc},
838 {0xb3, 0x00, 0x04, 0xcc}, {0xb3, 0x00, 0x24, 0xcc},
839 {0xb3, 0x00, 0x25, 0xcc}, {0xb3, 0x08, 0x01, 0xcc},
840 {0xb3, 0x09, 0x0c, 0xcc}, {0xb3, 0x05, 0x00, 0xcc},
841 {0xb3, 0x06, 0x01, 0xcc}, {0xb3, 0x03, 0x1a, 0xcc},
842 {0xb3, 0x04, 0x15, 0xcc}, {0xb3, 0x20, 0x00, 0xcc},
843 {0xb3, 0x21, 0x00, 0xcc}, {0xb3, 0x22, 0x01, 0xcc},
844 {0xb3, 0x23, 0xe0, 0xcc}, {0xb8, 0x08, 0xe0, 0xcc},
845 {0xb3, 0x14, 0x00, 0xcc}, {0xb3, 0x15, 0x00, 0xcc},
846 {0xb3, 0x16, 0x02, 0xcc}, {0xb3, 0x17, 0x7f, 0xcc},
847 {0xb3, 0x34, 0x01, 0xcc}, {0xb3, 0x35, 0xf6, 0xcc},
848 {0xb3, 0x00, 0x27, 0xcc}, {0xbc, 0x00, 0xd1, 0xcc},
849 {0xb8, 0x00, 0x21, 0xcc}, {0xb8, 0x27, 0x20, 0xcc},
850 {0xb8, 0x01, 0x79, 0xcc}, {0xb8, 0x81, 0x09, 0xcc},
851 {0xb8, 0x2c, 0x50, 0xcc}, {0xb8, 0x2d, 0xf8, 0xcc},
852 {0xb8, 0x2e, 0xf8, 0xcc}, {0xb8, 0x2f, 0xf8, 0xcc},
853 {0xb8, 0x30, 0x50, 0xcc}, {0xb8, 0x31, 0xf8, 0xcc},
854 {0xb8, 0x32, 0xf8, 0xcc}, {0xb8, 0x33, 0xf8, 0xcc},
855 {0xb8, 0x34, 0x50, 0xcc}, {0xb8, 0x35, 0x00, 0xcc},
856 {0xb8, 0x36, 0x00, 0xcc}, {0xb8, 0x37, 0x00, 0xcc},
857 {0x00, 0x1e, 0xc6, 0xaa}, {0x00, 0x20, 0x44, 0xaa},
858 {0x00, 0xad, 0x02, 0xaa}, {0x00, 0xae, 0x2c, 0xaa},
859 {0x00, 0x12, 0x08, 0xaa}, {0x00, 0x17, 0x41, 0xaa},
860 {0x00, 0x19, 0x41, 0xaa}, {0x00, 0x1e, 0x06, 0xaa},
861 {0x00, 0x21, 0x00, 0xaa}, {0x00, 0x36, 0xc0, 0xaa},
862 {0x00, 0x37, 0xc8, 0xaa}, {0x00, 0x3b, 0x36, 0xaa},
863 {0x00, 0x4b, 0xfe, 0xaa}, {0x00, 0x51, 0x1c, 0xaa},
864 {0x00, 0x52, 0x01, 0xaa}, {0x00, 0x55, 0x0a, 0xaa},
865 {0x00, 0x59, 0x6f, 0xaa}, {0x00, 0x5a, 0x04, 0xaa},
866 {0x00, 0x5c, 0x10, 0xaa}, {0x00, 0x5d, 0x10, 0xaa},
867 {0x00, 0x5e, 0x10, 0xaa}, {0x00, 0x5f, 0x10, 0xaa},
868 {0x00, 0x61, 0x00, 0xaa}, {0x00, 0x62, 0x18, 0xaa},
869 {0x00, 0x63, 0x30, 0xaa}, {0x00, 0x70, 0x68, 0xaa},
870 {0x00, 0x80, 0x71, 0xaa}, {0x00, 0x81, 0x08, 0xaa},
871 {0x00, 0x82, 0x00, 0xaa}, {0x00, 0x83, 0x55, 0xaa},
872 {0x00, 0x84, 0x06, 0xaa}, {0x00, 0x85, 0x06, 0xaa},
873 {0x00, 0x86, 0x13, 0xaa}, {0x00, 0x87, 0x18, 0xaa},
874 {0x00, 0xaa, 0x3f, 0xaa}, {0x00, 0xab, 0x44, 0xaa},
875 {0x00, 0xb0, 0x68, 0xaa}, {0x00, 0xb5, 0x10, 0xaa},
876 {0x00, 0xb8, 0x20, 0xaa}, {0x00, 0xb9, 0xa0, 0xaa},
877 {0x00, 0xbc, 0x04, 0xaa}, {0x00, 0x8b, 0x40, 0xaa},
878 {0x00, 0x8c, 0x91, 0xaa}, {0x00, 0x8d, 0x8f, 0xaa},
879 {0x00, 0x8e, 0x91, 0xaa}, {0x00, 0x8f, 0x43, 0xaa},
880 {0x00, 0x90, 0x92, 0xaa}, {0x00, 0x91, 0x89, 0xaa},
881 {0x00, 0x92, 0x9d, 0xaa}, {0x00, 0x93, 0x46, 0xaa},
882 {0x00, 0xd6, 0x22, 0xaa}, {0x00, 0x73, 0x00, 0xaa},
883 {0x00, 0x74, 0x10, 0xaa}, {0x00, 0x75, 0x20, 0xaa},
884 {0x00, 0x76, 0x2b, 0xaa}, {0x00, 0x77, 0x36, 0xaa},
885 {0x00, 0x78, 0x49, 0xaa}, {0x00, 0x79, 0x5a, 0xaa},
886 {0x00, 0x7a, 0x7f, 0xaa}, {0x00, 0x7b, 0x9b, 0xaa},
887 {0x00, 0x7c, 0xba, 0xaa}, {0x00, 0x7d, 0xd4, 0xaa},
888 {0x00, 0x7e, 0xea, 0xaa}, {0x00, 0xd6, 0x62, 0xaa},
889 {0x00, 0x73, 0x00, 0xaa}, {0x00, 0x74, 0x10, 0xaa},
890 {0x00, 0x75, 0x20, 0xaa}, {0x00, 0x76, 0x2b, 0xaa},
891 {0x00, 0x77, 0x36, 0xaa}, {0x00, 0x78, 0x49, 0xaa},
892 {0x00, 0x79, 0x5a, 0xaa}, {0x00, 0x7a, 0x7f, 0xaa},
893 {0x00, 0x7b, 0x9b, 0xaa}, {0x00, 0x7c, 0xba, 0xaa},
894 {0x00, 0x7d, 0xd4, 0xaa}, {0x00, 0x7e, 0xea, 0xaa},
895 {0x00, 0xd6, 0xa2, 0xaa}, {0x00, 0x73, 0x00, 0xaa},
896 {0x00, 0x74, 0x10, 0xaa}, {0x00, 0x75, 0x20, 0xaa},
897 {0x00, 0x76, 0x2b, 0xaa}, {0x00, 0x77, 0x36, 0xaa},
898 {0x00, 0x78, 0x49, 0xaa}, {0x00, 0x79, 0x5a, 0xaa},
899 {0x00, 0x7a, 0x7f, 0xaa}, {0x00, 0x7b, 0x9b, 0xaa},
900 {0x00, 0x7c, 0xba, 0xaa}, {0x00, 0x7d, 0xd4, 0xaa},
901 {0x00, 0x7e, 0xea, 0xaa}, {0x00, 0x4c, 0x07, 0xaa},
902 {0x00, 0x4b, 0xe0, 0xaa}, {0x00, 0x4e, 0x77, 0xaa},
903 {0x00, 0x59, 0x66, 0xaa}, {0x00, 0x4d, 0x0a, 0xaa},
904 {0x00, 0xd1, 0x00, 0xaa}, {0x00, 0x20, 0xc4, 0xaa},
905 {0xb8, 0x8e, 0x00, 0xcc}, {0xb8, 0x8f, 0xff, 0xcc},
906 {0xb8, 0xfe, 0x00, 0xcc}, {0xb8, 0xff, 0x28, 0xcc},
907 {0xb9, 0x00, 0x28, 0xcc}, {0xb9, 0x01, 0x28, 0xcc},
908 {0xb9, 0x02, 0x28, 0xcc}, {0xb9, 0x03, 0x00, 0xcc},
909 {0xb9, 0x04, 0x00, 0xcc}, {0xb9, 0x05, 0x3c, 0xcc},
910 {0xb9, 0x06, 0x3c, 0xcc}, {0xb9, 0x07, 0x3c, 0xcc},
911 {0xb9, 0x08, 0x3c, 0xcc}, {0xbc, 0x02, 0x18, 0xcc},
912 {0xbc, 0x03, 0x50, 0xcc}, {0xbc, 0x04, 0x18, 0xcc},
913 {0xbc, 0x05, 0x00, 0xcc}, {0xbc, 0x06, 0x00, 0xcc},
914 {0xbc, 0x08, 0x30, 0xcc}, {0xbc, 0x09, 0x40, 0xcc},
915 {0xbc, 0x0a, 0x10, 0xcc}, {0xbc, 0x0b, 0x00, 0xcc},
916 {0xbc, 0x0c, 0x00, 0xcc}, {0x00, 0x05, 0x00, 0xaa},
917 {0xb3, 0x5c, 0x00, 0xcc}, {0xb3, 0x01, 0x41, 0xcc},
918 {}
919};
920
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -0300921static const __u8 hv7131r_gamma[17] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300922/* 0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
923 * 0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff */
924 0x04, 0x1a, 0x36, 0x55, 0x6f, 0x87, 0x9d, 0xb0, 0xc1,
925 0xcf, 0xda, 0xe4, 0xec, 0xf3, 0xf8, 0xfd, 0xff
926};
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -0300927static const __u8 hv7131r_matrix[9] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300928 0x5f, 0xec, 0xf5, 0xf1, 0x5a, 0xf5, 0xf1, 0xec, 0x63
929};
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -0300930static const __u8 hv7131r_initVGA_data[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300931 {0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc},
932 {0x00, 0x00, 0x50, 0xdd}, {0xb0, 0x03, 0x01, 0xcc},
933 {0xb3, 0x00, 0x24, 0xcc},
934 {0xb3, 0x00, 0x25, 0xcc}, {0xb3, 0x08, 0x01, 0xcc},
935 {0xb3, 0x09, 0x0c, 0xcc}, {0xb3, 0x05, 0x00, 0xcc},
936 {0xb3, 0x06, 0x01, 0xcc},
937 {0xb3, 0x01, 0x45, 0xcc}, {0xb3, 0x03, 0x0b, 0xcc},
938 {0xb3, 0x04, 0x05, 0xcc}, {0xb3, 0x20, 0x00, 0xcc},
939 {0xb3, 0x21, 0x00, 0xcc},
940 {0xb3, 0x22, 0x01, 0xcc}, {0xb3, 0x23, 0xe0, 0xcc},
941 {0xb3, 0x14, 0x00, 0xcc}, {0xb3, 0x15, 0x00, 0xcc},
942 {0xb3, 0x16, 0x02, 0xcc},
943 {0xb3, 0x17, 0x7f, 0xcc}, {0xb3, 0x34, 0x01, 0xcc},
944 {0xb3, 0x35, 0x91, 0xcc}, {0xb3, 0x00, 0x27, 0xcc},
945 {0xbc, 0x00, 0x73, 0xcc},
946 {0xb8, 0x00, 0x23, 0xcc}, {0x00, 0x01, 0x0c, 0xaa},
947 {0x00, 0x14, 0x01, 0xaa}, {0x00, 0x15, 0xe6, 0xaa},
948 {0x00, 0x16, 0x02, 0xaa},
949 {0x00, 0x17, 0x86, 0xaa}, {0x00, 0x23, 0x00, 0xaa},
950 {0x00, 0x25, 0x09, 0xaa}, {0x00, 0x26, 0x27, 0xaa},
951 {0x00, 0x27, 0xc0, 0xaa},
952 {0xb8, 0x2c, 0x60, 0xcc}, {0xb8, 0x2d, 0xf8, 0xcc},
953 {0xb8, 0x2e, 0xf8, 0xcc}, {0xb8, 0x2f, 0xf8, 0xcc},
954 {0xb8, 0x30, 0x50, 0xcc},
955 {0xb8, 0x31, 0xf8, 0xcc}, {0xb8, 0x32, 0xf8, 0xcc},
956 {0xb8, 0x33, 0xf8, 0xcc}, {0xb8, 0x34, 0x65, 0xcc},
957 {0xb8, 0x35, 0x00, 0xcc},
958 {0xb8, 0x36, 0x00, 0xcc}, {0xb8, 0x37, 0x00, 0xcc},
959 {0xb8, 0x27, 0x20, 0xcc}, {0xb8, 0x01, 0x7d, 0xcc},
960 {0xb8, 0x81, 0x09, 0xcc},
961 {0xb3, 0x01, 0x41, 0xcc}, {0xb8, 0xfe, 0x00, 0xcc},
962 {0xb8, 0xff, 0x28, 0xcc}, {0xb9, 0x00, 0x28, 0xcc},
963 {0xb9, 0x01, 0x28, 0xcc},
964 {0xb9, 0x02, 0x28, 0xcc}, {0xb9, 0x03, 0x00, 0xcc},
965 {0xb9, 0x04, 0x00, 0xcc}, {0xb9, 0x05, 0x3c, 0xcc},
966 {0xb9, 0x06, 0x3c, 0xcc},
967 {0xb9, 0x07, 0x3c, 0xcc}, {0xb9, 0x08, 0x3c, 0xcc},
968 {0xb8, 0x8e, 0x00, 0xcc}, {0xb8, 0x8f, 0xff, 0xcc},
969 {0x00, 0x30, 0x18, 0xaa},
970 {}
971};
972
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -0300973static const __u8 hv7131r_initQVGA_data[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300974 {0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc},
975 {0x00, 0x00, 0x50, 0xdd}, {0xb0, 0x03, 0x01, 0xcc},
976 {0xb3, 0x00, 0x24, 0xcc},
977 {0xb3, 0x00, 0x25, 0xcc}, {0xb3, 0x08, 0x01, 0xcc},
978 {0xb3, 0x09, 0x0c, 0xcc}, {0xb3, 0x05, 0x00, 0xcc},
979 {0xb3, 0x06, 0x01, 0xcc},
980 {0xb3, 0x03, 0x0b, 0xcc}, {0xb3, 0x04, 0x05, 0xcc},
981 {0xb3, 0x20, 0x00, 0xcc}, {0xb3, 0x21, 0x00, 0xcc},
982 {0xb3, 0x22, 0x01, 0xcc},
983 {0xb3, 0x23, 0xe0, 0xcc}, {0xb3, 0x14, 0x00, 0xcc},
984 {0xb3, 0x15, 0x00, 0xcc}, {0xb3, 0x16, 0x02, 0xcc},
985 {0xb3, 0x17, 0x7f, 0xcc},
986 {0xb3, 0x34, 0x01, 0xcc}, {0xb3, 0x35, 0x91, 0xcc},
987 {0xb3, 0x00, 0x27, 0xcc}, {0xbc, 0x00, 0xd1, 0xcc},
988 {0xb8, 0x00, 0x21, 0xcc},
989 {0x00, 0x01, 0x0c, 0xaa}, {0x00, 0x14, 0x01, 0xaa},
990 {0x00, 0x15, 0xe6, 0xaa}, {0x00, 0x16, 0x02, 0xaa},
991 {0x00, 0x17, 0x86, 0xaa},
992 {0x00, 0x23, 0x00, 0xaa}, {0x00, 0x25, 0x01, 0xaa},
993 {0x00, 0x26, 0xd4, 0xaa}, {0x00, 0x27, 0xc0, 0xaa},
994 {0xbc, 0x02, 0x08, 0xcc},
995 {0xbc, 0x03, 0x70, 0xcc}, {0xbc, 0x04, 0x08, 0xcc},
996 {0xbc, 0x05, 0x00, 0xcc}, {0xbc, 0x06, 0x00, 0xcc},
997 {0xbc, 0x08, 0x3c, 0xcc},
998 {0xbc, 0x09, 0x40, 0xcc}, {0xbc, 0x0a, 0x04, 0xcc},
999 {0xbc, 0x0b, 0x00, 0xcc}, {0xbc, 0x0c, 0x00, 0xcc},
1000 {0xb8, 0xfe, 0x02, 0xcc},
1001 {0xb8, 0xff, 0x07, 0xcc}, {0xb9, 0x00, 0x14, 0xcc},
1002 {0xb9, 0x01, 0x14, 0xcc}, {0xb9, 0x02, 0x14, 0xcc},
1003 {0xb9, 0x03, 0x00, 0xcc},
1004 {0xb9, 0x04, 0x02, 0xcc}, {0xb9, 0x05, 0x05, 0xcc},
1005 {0xb9, 0x06, 0x0f, 0xcc}, {0xb9, 0x07, 0x0f, 0xcc},
1006 {0xb9, 0x08, 0x0f, 0xcc},
1007 {0xb8, 0x2c, 0x60, 0xcc}, {0xb8, 0x2d, 0xf8, 0xcc},
1008 {0xb8, 0x2e, 0xf8, 0xcc}, {0xb8, 0x2f, 0xf8, 0xcc},
1009 {0xb8, 0x30, 0x50, 0xcc},
1010 {0xb8, 0x31, 0xf8, 0xcc}, {0xb8, 0x32, 0xf8, 0xcc},
1011 {0xb8, 0x33, 0xf8, 0xcc},
1012 {0xb8, 0x34, 0x65, 0xcc}, {0xb8, 0x35, 0x00, 0xcc},
1013 {0xb8, 0x36, 0x00, 0xcc}, {0xb8, 0x37, 0x00, 0xcc},
1014 {0xb8, 0x27, 0x20, 0xcc},
1015 {0xb8, 0x01, 0x7d, 0xcc}, {0xb8, 0x81, 0x09, 0xcc},
1016 {0xb3, 0x01, 0x41, 0xcc}, {0xb8, 0xfe, 0x00, 0xcc},
1017 {0xb8, 0xff, 0x28, 0xcc},
1018 {0xb9, 0x00, 0x28, 0xcc}, {0xb9, 0x01, 0x28, 0xcc},
1019 {0xb9, 0x02, 0x28, 0xcc}, {0xb9, 0x03, 0x00, 0xcc},
1020 {0xb9, 0x04, 0x00, 0xcc},
1021 {0xb9, 0x05, 0x3c, 0xcc}, {0xb9, 0x06, 0x3c, 0xcc},
1022 {0xb9, 0x07, 0x3c, 0xcc}, {0xb9, 0x08, 0x3c, 0xcc},
1023 {0xb8, 0x8e, 0x00, 0xcc},
1024 {0xb8, 0x8f, 0xff, 0xcc}, {0x00, 0x30, 0x18, 0xaa},
1025 {}
1026};
1027
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -03001028static const __u8 ov7660_gamma[17] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001029 0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
1030 0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
1031};
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -03001032static const __u8 ov7660_matrix[9] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001033 0x5a, 0xf0, 0xf6, 0xf3, 0x57, 0xf6, 0xf3, 0xef, 0x62
1034};
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -03001035static const __u8 ov7660_initVGA_data[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001036 {0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc},
1037 {0x00, 0x00, 0x50, 0xdd},
1038 {0xb0, 0x03, 0x01, 0xcc},
1039 {0xb3, 0x00, 0x21, 0xcc}, {0xb3, 0x00, 0x26, 0xcc},
1040 {0xb3, 0x05, 0x01, 0xcc},
1041 {0xb3, 0x06, 0x03, 0xcc},
1042 {0xb3, 0x03, 0x1f, 0xcc}, {0xb3, 0x04, 0x05, 0xcc},
1043 {0xb3, 0x05, 0x00, 0xcc},
1044 {0xb3, 0x06, 0x01, 0xcc},
1045 {0xb3, 0x15, 0x00, 0xcc},/* 0xb315 <-0 href startl */
1046 {0xb3, 0x16, 0x02, 0xcc}, {0xb3, 0x17, 0x7f, 0xcc},
1047 {0xb3, 0x21, 0x00, 0xcc},
1048 {0xb3, 0x23, 0xe0, 0xcc}, {0xb3, 0x1d, 0x01, 0xcc},
1049 {0xb3, 0x1f, 0x02, 0xcc},
1050 {0xb3, 0x34, 0x01, 0xcc},
1051 {0xb3, 0x35, 0xa1, 0xcc}, {0xb3, 0x00, 0x26, 0xcc},
1052 {0xb8, 0x00, 0x33, 0xcc}, /* 13 */
1053 {0xb8, 0x01, 0x7d, 0xcc},
1054 {0xbc, 0x00, 0x73, 0xcc}, {0xb8, 0x81, 0x09, 0xcc},
1055 {0xb8, 0x27, 0x20, 0xcc},
1056 {0xb8, 0x8f, 0x50, 0xcc},
1057 {0x00, 0x01, 0x80, 0xaa}, {0x00, 0x02, 0x80, 0xaa},
1058 {0x00, 0x12, 0x80, 0xaa},
1059 {0x00, 0x12, 0x05, 0xaa},
1060 {0x00, 0x1e, 0x01, 0xaa},
1061 {0x00, 0x3d, 0x40, 0xaa}, /* 0x3d <-40 gamma 01 */
1062 {0x00, 0x41, 0x00, 0xaa}, /* edge 00 */
1063 {0x00, 0x0d, 0x48, 0xaa}, {0x00, 0x0e, 0x04, 0xaa},
1064 {0x00, 0x13, 0xa7, 0xaa},
1065 {0x00, 0x40, 0xc1, 0xaa}, {0x00, 0x35, 0x00, 0xaa},
1066 {0x00, 0x36, 0x00, 0xaa},
1067 {0x00, 0x3c, 0x68, 0xaa}, {0x00, 0x1b, 0x05, 0xaa},
1068 {0x00, 0x39, 0x43, 0xaa},
1069 {0x00, 0x8d, 0xcf, 0xaa},
1070 {0x00, 0x8b, 0xcc, 0xaa}, {0x00, 0x8c, 0xcc, 0xaa},
1071 {0x00, 0x0f, 0x62, 0xaa},
1072 {0x00, 0x35, 0x84, 0xaa},
1073 {0x00, 0x3b, 0x08, 0xaa}, /* 0 * Nightframe 1/4 + 50Hz -> 0xC8 */
1074 {0x00, 0x3a, 0x00, 0xaa}, /* mx change yuyv format 00, 04, 01; 08, 0c*/
1075 {0x00, 0x14, 0x2a, 0xaa}, /* agc ampli */
1076 {0x00, 0x9e, 0x40, 0xaa}, {0xb8, 0x8f, 0x50, 0xcc},
1077 {0x00, 0x01, 0x80, 0xaa},
1078 {0x00, 0x02, 0x80, 0xaa},
1079 {0xb8, 0xfe, 0x00, 0xcc}, {0xb8, 0xff, 0x28, 0xcc},
1080 {0xb9, 0x00, 0x28, 0xcc},
1081 {0xb9, 0x01, 0x28, 0xcc}, {0xb9, 0x02, 0x28, 0xcc},
1082 {0xb9, 0x03, 0x00, 0xcc},
1083 {0xb9, 0x04, 0x00, 0xcc},
1084 {0xb9, 0x05, 0x3c, 0xcc}, {0xb9, 0x06, 0x3c, 0xcc},
1085 {0xb9, 0x07, 0x3c, 0xcc},
1086 {0xb9, 0x08, 0x3c, 0xcc},
1087
1088 {0xb8, 0x8e, 0x00, 0xcc}, {0xb8, 0x8f, 0xff, 0xcc},
1089
1090 {0x00, 0x29, 0x3c, 0xaa}, {0xb3, 0x01, 0x45, 0xcc},
1091 {}
1092};
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -03001093static const __u8 ov7660_initQVGA_data[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001094 {0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc},
1095 {0x00, 0x00, 0x50, 0xdd}, {0xb0, 0x03, 0x01, 0xcc},
1096 {0xb3, 0x00, 0x21, 0xcc}, {0xb3, 0x00, 0x26, 0xcc},
1097 {0xb3, 0x05, 0x01, 0xcc}, {0xb3, 0x06, 0x03, 0xcc},
1098 {0xb3, 0x03, 0x1f, 0xcc}, {0xb3, 0x04, 0x05, 0xcc},
1099 {0xb3, 0x05, 0x00, 0xcc}, {0xb3, 0x06, 0x01, 0xcc},
1100 {0xb3, 0x15, 0x00, 0xcc},/* 0xb315 <-0 href startl */
1101 {0xb3, 0x16, 0x02, 0xcc}, {0xb3, 0x17, 0x7f, 0xcc},
1102 {0xb3, 0x21, 0x00, 0xcc},
1103 {0xb3, 0x23, 0xe0, 0xcc}, {0xb3, 0x1d, 0x01, 0xcc},
1104 {0xb3, 0x1f, 0x02, 0xcc}, {0xb3, 0x34, 0x01, 0xcc},
1105 {0xb3, 0x35, 0xa1, 0xcc}, {0xb3, 0x00, 0x26, 0xcc},
1106 {0xb8, 0x00, 0x33, 0xcc}, /* 13 */
1107 {0xb8, 0x01, 0x7d, 0xcc},
1108/* sizer */
1109 {0xbc, 0x00, 0xd3, 0xcc},
1110 {0xb8, 0x81, 0x09, 0xcc}, {0xb8, 0x81, 0x09, 0xcc},
1111 {0xb8, 0x27, 0x20, 0xcc}, {0xb8, 0x8f, 0x50, 0xcc},
1112 {0x00, 0x01, 0x80, 0xaa}, {0x00, 0x02, 0x80, 0xaa},
1113 {0x00, 0x12, 0x80, 0xaa}, {0x00, 0x12, 0x05, 0xaa},
1114 {0x00, 0x1e, 0x01, 0xaa},
1115 {0x00, 0x3d, 0x40, 0xaa}, /* 0x3d <-40 gamma 01 */
1116 {0x00, 0x41, 0x00, 0xaa}, /* edge 00 */
1117 {0x00, 0x0d, 0x48, 0xaa}, {0x00, 0x0e, 0x04, 0xaa},
1118 {0x00, 0x13, 0xa7, 0xaa},
1119 {0x00, 0x40, 0xc1, 0xaa}, {0x00, 0x35, 0x00, 0xaa},
1120 {0x00, 0x36, 0x00, 0xaa},
1121 {0x00, 0x3c, 0x68, 0xaa}, {0x00, 0x1b, 0x05, 0xaa},
1122 {0x00, 0x39, 0x43, 0xaa}, {0x00, 0x8d, 0xcf, 0xaa},
1123 {0x00, 0x8b, 0xcc, 0xaa}, {0x00, 0x8c, 0xcc, 0xaa},
1124 {0x00, 0x0f, 0x62, 0xaa}, {0x00, 0x35, 0x84, 0xaa},
1125 {0x00, 0x3b, 0x08, 0xaa}, /* 0 * Nightframe 1/4 + 50Hz -> 0xC8 */
1126 {0x00, 0x3a, 0x00, 0xaa}, /* mx change yuyv format 00, 04, 01; 08, 0c*/
1127 {0x00, 0x14, 0x2a, 0xaa}, /* agc ampli */
1128 {0x00, 0x9e, 0x40, 0xaa}, {0xb8, 0x8f, 0x50, 0xcc},
1129 {0x00, 0x01, 0x80, 0xaa},
1130 {0x00, 0x02, 0x80, 0xaa},
1131/* sizer filters */
1132 {0xbc, 0x02, 0x08, 0xcc},
1133 {0xbc, 0x03, 0x70, 0xcc},
1134 {0xb8, 0x35, 0x00, 0xcc},
1135 {0xb8, 0x36, 0x00, 0xcc},
1136 {0xb8, 0x37, 0x00, 0xcc},
1137 {0xbc, 0x04, 0x08, 0xcc},
1138 {0xbc, 0x05, 0x00, 0xcc},
1139 {0xbc, 0x06, 0x00, 0xcc},
1140 {0xbc, 0x08, 0x3c, 0xcc},
1141 {0xbc, 0x09, 0x40, 0xcc},
1142 {0xbc, 0x0a, 0x04, 0xcc},
1143 {0xbc, 0x0b, 0x00, 0xcc},
1144 {0xbc, 0x0c, 0x00, 0xcc},
1145/* */
1146 {0xb8, 0xfe, 0x00, 0xcc},
1147 {0xb8, 0xff, 0x28, 0xcc},
1148/* */
1149 {0xb9, 0x00, 0x28, 0xcc}, {0xb9, 0x01, 0x28, 0xcc},
1150 {0xb9, 0x02, 0x28, 0xcc}, {0xb9, 0x03, 0x00, 0xcc},
1151 {0xb9, 0x04, 0x00, 0xcc}, {0xb9, 0x05, 0x3c, 0xcc},
1152 {0xb9, 0x06, 0x3c, 0xcc}, {0xb9, 0x07, 0x3c, 0xcc},
1153 {0xb9, 0x08, 0x3c, 0xcc},
1154/* */
1155 {0xb8, 0x8e, 0x00, 0xcc},
1156 {0xb8, 0x8f, 0xff, 0xcc}, /* ff */
1157 {0x00, 0x29, 0x3c, 0xaa},
1158 {0xb3, 0x01, 0x45, 0xcc}, /* 45 */
Jean-Francois Moine1ff1e482008-07-17 09:37:57 -03001159 {}
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001160};
1161
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -03001162static const __u8 ov7660_50HZ[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001163 {0x00, 0x3b, 0x08, 0xaa},
1164 {0x00, 0x9d, 0x40, 0xaa},
1165 {0x00, 0x13, 0xa7, 0xaa},
Jean-Francois Moine1ff1e482008-07-17 09:37:57 -03001166 {}
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001167};
1168
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -03001169static const __u8 ov7660_60HZ[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001170 {0x00, 0x3b, 0x00, 0xaa},
1171 {0x00, 0x9e, 0x40, 0xaa},
1172 {0x00, 0x13, 0xa7, 0xaa},
1173 {}
1174};
1175
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -03001176static const __u8 ov7660_NoFliker[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001177 {0x00, 0x13, 0x87, 0xaa},
1178 {}
1179};
1180
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -03001181static const __u8 ov7670_initVGA_JPG[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001182 {0xb3, 0x01, 0x05, 0xcc},
1183 {0x00, 0x00, 0x30, 0xdd}, {0xb0, 0x03, 0x19, 0xcc},
1184 {0x00, 0x00, 0x10, 0xdd},
1185 {0xb0, 0x04, 0x02, 0xcc}, {0x00, 0x00, 0x10, 0xdd},
1186 {0xb3, 0x00, 0x66, 0xcc}, {0xb3, 0x00, 0x67, 0xcc},
1187 {0xb3, 0x35, 0xa1, 0xcc}, {0xb3, 0x34, 0x01, 0xcc},
1188 {0xb3, 0x05, 0x01, 0xcc}, {0xb3, 0x06, 0x01, 0xcc},
1189 {0xb3, 0x08, 0x01, 0xcc}, {0xb3, 0x09, 0x0c, 0xcc},
1190 {0xb3, 0x02, 0x02, 0xcc}, {0xb3, 0x03, 0x1f, 0xcc},
1191 {0xb3, 0x14, 0x00, 0xcc}, {0xb3, 0x15, 0x00, 0xcc},
1192 {0xb3, 0x16, 0x02, 0xcc}, {0xb3, 0x17, 0x7f, 0xcc},
1193 {0xb3, 0x04, 0x05, 0xcc}, {0xb3, 0x20, 0x00, 0xcc},
1194 {0xb3, 0x21, 0x00, 0xcc}, {0xb3, 0x22, 0x01, 0xcc},
1195 {0xb3, 0x23, 0xe0, 0xcc}, {0xbc, 0x00, 0x41, 0xcc},
1196 {0xbc, 0x01, 0x01, 0xcc}, {0x00, 0x12, 0x80, 0xaa},
1197 {0x00, 0x00, 0x20, 0xdd}, {0x00, 0x12, 0x00, 0xaa},
1198 {0x00, 0x11, 0x40, 0xaa}, {0x00, 0x6b, 0x0a, 0xaa},
1199 {0x00, 0x3a, 0x04, 0xaa}, {0x00, 0x40, 0xc0, 0xaa},
1200 {0x00, 0x8c, 0x00, 0xaa}, {0x00, 0x7a, 0x29, 0xaa},
1201 {0x00, 0x7b, 0x0e, 0xaa}, {0x00, 0x7c, 0x1a, 0xaa},
1202 {0x00, 0x7d, 0x31, 0xaa}, {0x00, 0x7e, 0x53, 0xaa},
1203 {0x00, 0x7f, 0x60, 0xaa}, {0x00, 0x80, 0x6b, 0xaa},
1204 {0x00, 0x81, 0x73, 0xaa}, {0x00, 0x82, 0x7b, 0xaa},
1205 {0x00, 0x83, 0x82, 0xaa}, {0x00, 0x84, 0x89, 0xaa},
1206 {0x00, 0x85, 0x96, 0xaa}, {0x00, 0x86, 0xa1, 0xaa},
1207 {0x00, 0x87, 0xb7, 0xaa}, {0x00, 0x88, 0xcc, 0xaa},
1208 {0x00, 0x89, 0xe1, 0xaa}, {0x00, 0x13, 0xe0, 0xaa},
1209 {0x00, 0x00, 0x00, 0xaa}, {0x00, 0x10, 0x00, 0xaa},
1210 {0x00, 0x0d, 0x40, 0xaa}, {0x00, 0x14, 0x28, 0xaa},
1211 {0x00, 0xa5, 0x05, 0xaa}, {0x00, 0xab, 0x07, 0xaa},
1212 {0x00, 0x24, 0x95, 0xaa}, {0x00, 0x25, 0x33, 0xaa},
1213 {0x00, 0x26, 0xe3, 0xaa}, {0x00, 0x9f, 0x88, 0xaa},
1214 {0x00, 0xa0, 0x78, 0xaa}, {0x00, 0x55, 0x90, 0xaa},
1215 {0x00, 0xa1, 0x03, 0xaa}, {0x00, 0xa6, 0xe0, 0xaa},
1216 {0x00, 0xa7, 0xd8, 0xaa}, {0x00, 0xa8, 0xf0, 0xaa},
1217 {0x00, 0xa9, 0x90, 0xaa}, {0x00, 0xaa, 0x14, 0xaa},
1218 {0x00, 0x13, 0xe5, 0xaa}, {0x00, 0x0e, 0x61, 0xaa},
1219 {0x00, 0x0f, 0x4b, 0xaa}, {0x00, 0x16, 0x02, 0xaa},
1220 {0x00, 0x1e, 0x07, 0xaa}, {0x00, 0x21, 0x02, 0xaa},
1221 {0x00, 0x22, 0x91, 0xaa}, {0x00, 0x29, 0x07, 0xaa},
1222 {0x00, 0x33, 0x0b, 0xaa}, {0x00, 0x35, 0x0b, 0xaa},
1223 {0x00, 0x37, 0x1d, 0xaa}, {0x00, 0x38, 0x71, 0xaa},
1224 {0x00, 0x39, 0x2a, 0xaa}, {0x00, 0x3c, 0x78, 0xaa},
1225 {0x00, 0x4d, 0x40, 0xaa}, {0x00, 0x4e, 0x20, 0xaa},
1226 {0x00, 0x74, 0x19, 0xaa}, {0x00, 0x8d, 0x4f, 0xaa},
1227 {0x00, 0x8e, 0x00, 0xaa}, {0x00, 0x8f, 0x00, 0xaa},
1228 {0x00, 0x90, 0x00, 0xaa}, {0x00, 0x91, 0x00, 0xaa},
1229 {0x00, 0x96, 0x00, 0xaa}, {0x00, 0x9a, 0x80, 0xaa},
1230 {0x00, 0xb0, 0x84, 0xaa}, {0x00, 0xb1, 0x0c, 0xaa},
1231 {0x00, 0xb2, 0x0e, 0xaa}, {0x00, 0xb3, 0x82, 0xaa},
1232 {0x00, 0xb8, 0x0a, 0xaa}, {0x00, 0x43, 0x14, 0xaa},
1233 {0x00, 0x44, 0xf0, 0xaa}, {0x00, 0x45, 0x45, 0xaa},
1234 {0x00, 0x46, 0x63, 0xaa}, {0x00, 0x47, 0x2d, 0xaa},
1235 {0x00, 0x48, 0x46, 0xaa}, {0x00, 0x59, 0x88, 0xaa},
1236 {0x00, 0x5a, 0xa0, 0xaa}, {0x00, 0x5b, 0xc6, 0xaa},
1237 {0x00, 0x5c, 0x7d, 0xaa}, {0x00, 0x5d, 0x5f, 0xaa},
1238 {0x00, 0x5e, 0x19, 0xaa}, {0x00, 0x6c, 0x0a, 0xaa},
1239 {0x00, 0x6d, 0x55, 0xaa}, {0x00, 0x6e, 0x11, 0xaa},
1240 {0x00, 0x6f, 0x9e, 0xaa}, {0x00, 0x69, 0x00, 0xaa},
1241 {0x00, 0x6a, 0x40, 0xaa}, {0x00, 0x01, 0x40, 0xaa},
1242 {0x00, 0x02, 0x40, 0xaa}, {0x00, 0x13, 0xe7, 0xaa},
1243 {0x00, 0x5f, 0xf0, 0xaa}, {0x00, 0x60, 0xf0, 0xaa},
1244 {0x00, 0x61, 0xf0, 0xaa}, {0x00, 0x27, 0xa0, 0xaa},
1245 {0x00, 0x28, 0x80, 0xaa}, {0x00, 0x2c, 0x90, 0xaa},
1246 {0x00, 0x4f, 0x66, 0xaa}, {0x00, 0x50, 0x66, 0xaa},
1247 {0x00, 0x51, 0x00, 0xaa}, {0x00, 0x52, 0x22, 0xaa},
1248 {0x00, 0x53, 0x5e, 0xaa}, {0x00, 0x54, 0x80, 0xaa},
1249 {0x00, 0x58, 0x9e, 0xaa}, {0x00, 0x41, 0x08, 0xaa},
1250 {0x00, 0x3f, 0x00, 0xaa}, {0x00, 0x75, 0x85, 0xaa},
1251 {0x00, 0x76, 0xe1, 0xaa}, {0x00, 0x4c, 0x00, 0xaa},
1252 {0x00, 0x77, 0x0a, 0xaa}, {0x00, 0x3d, 0x88, 0xaa},
1253 {0x00, 0x4b, 0x09, 0xaa}, {0x00, 0xc9, 0x60, 0xaa},
1254 {0x00, 0x41, 0x38, 0xaa}, {0x00, 0x62, 0x30, 0xaa},
1255 {0x00, 0x63, 0x30, 0xaa}, {0x00, 0x64, 0x08, 0xaa},
1256 {0x00, 0x94, 0x07, 0xaa}, {0x00, 0x95, 0x0b, 0xaa},
1257 {0x00, 0x65, 0x00, 0xaa}, {0x00, 0x66, 0x05, 0xaa},
1258 {0x00, 0x56, 0x50, 0xaa}, {0x00, 0x34, 0x11, 0xaa},
1259 {0x00, 0xa4, 0x88, 0xaa}, {0x00, 0x96, 0x00, 0xaa},
1260 {0x00, 0x97, 0x30, 0xaa}, {0x00, 0x98, 0x20, 0xaa},
1261 {0x00, 0x99, 0x30, 0xaa}, {0x00, 0x9a, 0x84, 0xaa},
1262 {0x00, 0x9b, 0x29, 0xaa}, {0x00, 0x9c, 0x03, 0xaa},
1263 {0x00, 0x78, 0x04, 0xaa}, {0x00, 0x79, 0x01, 0xaa},
1264 {0x00, 0xc8, 0xf0, 0xaa}, {0x00, 0x79, 0x0f, 0xaa},
1265 {0x00, 0xc8, 0x00, 0xaa}, {0x00, 0x79, 0x10, 0xaa},
1266 {0x00, 0xc8, 0x7e, 0xaa}, {0x00, 0x79, 0x0a, 0xaa},
1267 {0x00, 0xc8, 0x80, 0xaa}, {0x00, 0x79, 0x0b, 0xaa},
1268 {0x00, 0xc8, 0x01, 0xaa}, {0x00, 0x79, 0x0c, 0xaa},
1269 {0x00, 0xc8, 0x0f, 0xaa}, {0x00, 0x79, 0x0d, 0xaa},
1270 {0x00, 0xc8, 0x20, 0xaa}, {0x00, 0x79, 0x09, 0xaa},
1271 {0x00, 0xc8, 0x80, 0xaa}, {0x00, 0x79, 0x02, 0xaa},
1272 {0x00, 0xc8, 0xc0, 0xaa}, {0x00, 0x79, 0x03, 0xaa},
1273 {0x00, 0xc8, 0x40, 0xaa}, {0x00, 0x79, 0x05, 0xaa},
1274 {0x00, 0xc8, 0x30, 0xaa}, {0x00, 0x79, 0x26, 0xaa},
1275 {0x00, 0x11, 0x40, 0xaa}, {0x00, 0x3a, 0x04, 0xaa},
1276 {0x00, 0x12, 0x00, 0xaa}, {0x00, 0x40, 0xc0, 0xaa},
1277 {0x00, 0x8c, 0x00, 0xaa}, {0x00, 0x17, 0x14, 0xaa},
1278 {0x00, 0x18, 0x02, 0xaa}, {0x00, 0x32, 0x92, 0xaa},
1279 {0x00, 0x19, 0x02, 0xaa}, {0x00, 0x1a, 0x7a, 0xaa},
1280 {0x00, 0x03, 0x0a, 0xaa}, {0x00, 0x0c, 0x00, 0xaa},
1281 {0x00, 0x3e, 0x00, 0xaa}, {0x00, 0x70, 0x3a, 0xaa},
1282 {0x00, 0x71, 0x35, 0xaa}, {0x00, 0x72, 0x11, 0xaa},
1283 {0x00, 0x73, 0xf0, 0xaa}, {0x00, 0xa2, 0x02, 0xaa},
1284 {0x00, 0xb1, 0x00, 0xaa}, {0x00, 0xb1, 0x0c, 0xaa},
1285 {0x00, 0x1e, 0x37, 0xaa}, {0x00, 0xaa, 0x14, 0xaa},
1286 {0x00, 0x24, 0x80, 0xaa}, {0x00, 0x25, 0x74, 0xaa},
1287 {0x00, 0x26, 0xd3, 0xaa}, {0x00, 0x0d, 0x00, 0xaa},
1288 {0x00, 0x14, 0x18, 0xaa}, {0x00, 0x9d, 0x99, 0xaa},
1289 {0x00, 0x9e, 0x7f, 0xaa}, {0x00, 0x64, 0x08, 0xaa},
1290 {0x00, 0x94, 0x07, 0xaa}, {0x00, 0x95, 0x06, 0xaa},
1291 {0x00, 0x66, 0x05, 0xaa}, {0x00, 0x41, 0x08, 0xaa},
1292 {0x00, 0x3f, 0x00, 0xaa}, {0x00, 0x75, 0x07, 0xaa},
1293 {0x00, 0x76, 0xe1, 0xaa}, {0x00, 0x4c, 0x00, 0xaa},
1294 {0x00, 0x77, 0x00, 0xaa}, {0x00, 0x3d, 0xc2, 0xaa},
1295 {0x00, 0x4b, 0x09, 0xaa}, {0x00, 0xc9, 0x60, 0xaa},
1296 {0x00, 0x41, 0x38, 0xaa}, {0xb6, 0x00, 0x00, 0xcc},
1297 {0xb6, 0x03, 0x02, 0xcc}, {0xb6, 0x02, 0x80, 0xcc},
1298 {0xb6, 0x05, 0x01, 0xcc}, {0xb6, 0x04, 0xe0, 0xcc},
1299 {0xb6, 0x12, 0xf8, 0xcc}, {0xb6, 0x13, 0x13, 0xcc},
1300 {0xb6, 0x18, 0x02, 0xcc}, {0xb6, 0x17, 0x58, 0xcc},
1301 {0xb6, 0x16, 0x00, 0xcc}, {0xb6, 0x22, 0x12, 0xcc},
1302 {0xb6, 0x23, 0x0b, 0xcc}, {0xbf, 0xc0, 0x39, 0xcc},
1303 {0xbf, 0xc1, 0x04, 0xcc}, {0xbf, 0xcc, 0x00, 0xcc},
1304 {0xb3, 0x5c, 0x01, 0xcc}, {0xb3, 0x01, 0x45, 0xcc},
1305 {0x00, 0x77, 0x05, 0xaa},
1306 {},
1307};
1308
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -03001309static const __u8 ov7670_initQVGA_JPG[][4] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001310 {0xb3, 0x01, 0x05, 0xcc}, {0x00, 0x00, 0x30, 0xdd},
1311 {0xb0, 0x03, 0x19, 0xcc}, {0x00, 0x00, 0x10, 0xdd},
1312 {0xb0, 0x04, 0x02, 0xcc}, {0x00, 0x00, 0x10, 0xdd},
1313 {0xb3, 0x00, 0x66, 0xcc}, {0xb3, 0x00, 0x67, 0xcc},
1314 {0xb3, 0x35, 0xa1, 0xcc}, {0xb3, 0x34, 0x01, 0xcc},
1315 {0xb3, 0x05, 0x01, 0xcc}, {0xb3, 0x06, 0x01, 0xcc},
1316 {0xb3, 0x08, 0x01, 0xcc}, {0xb3, 0x09, 0x0c, 0xcc},
1317 {0xb3, 0x02, 0x02, 0xcc}, {0xb3, 0x03, 0x1f, 0xcc},
1318 {0xb3, 0x14, 0x00, 0xcc}, {0xb3, 0x15, 0x00, 0xcc},
1319 {0xb3, 0x16, 0x02, 0xcc}, {0xb3, 0x17, 0x7f, 0xcc},
1320 {0xb3, 0x04, 0x05, 0xcc}, {0xb3, 0x20, 0x00, 0xcc},
1321 {0xb3, 0x21, 0x00, 0xcc}, {0xb3, 0x22, 0x01, 0xcc},
1322 {0xb3, 0x23, 0xe0, 0xcc}, {0xbc, 0x00, 0xd1, 0xcc},
1323 {0xbc, 0x01, 0x01, 0xcc}, {0x00, 0x12, 0x80, 0xaa},
1324 {0x00, 0x00, 0x20, 0xdd}, {0x00, 0x12, 0x00, 0xaa},
1325 {0x00, 0x11, 0x40, 0xaa}, {0x00, 0x6b, 0x0a, 0xaa},
1326 {0x00, 0x3a, 0x04, 0xaa}, {0x00, 0x40, 0xc0, 0xaa},
1327 {0x00, 0x8c, 0x00, 0xaa}, {0x00, 0x7a, 0x29, 0xaa},
1328 {0x00, 0x7b, 0x0e, 0xaa}, {0x00, 0x7c, 0x1a, 0xaa},
1329 {0x00, 0x7d, 0x31, 0xaa}, {0x00, 0x7e, 0x53, 0xaa},
1330 {0x00, 0x7f, 0x60, 0xaa}, {0x00, 0x80, 0x6b, 0xaa},
1331 {0x00, 0x81, 0x73, 0xaa}, {0x00, 0x82, 0x7b, 0xaa},
1332 {0x00, 0x83, 0x82, 0xaa}, {0x00, 0x84, 0x89, 0xaa},
1333 {0x00, 0x85, 0x96, 0xaa}, {0x00, 0x86, 0xa1, 0xaa},
1334 {0x00, 0x87, 0xb7, 0xaa}, {0x00, 0x88, 0xcc, 0xaa},
1335 {0x00, 0x89, 0xe1, 0xaa}, {0x00, 0x13, 0xe0, 0xaa},
1336 {0x00, 0x00, 0x00, 0xaa}, {0x00, 0x10, 0x00, 0xaa},
1337 {0x00, 0x0d, 0x40, 0xaa}, {0x00, 0x14, 0x28, 0xaa},
1338 {0x00, 0xa5, 0x05, 0xaa}, {0x00, 0xab, 0x07, 0xaa},
1339 {0x00, 0x24, 0x95, 0xaa}, {0x00, 0x25, 0x33, 0xaa},
1340 {0x00, 0x26, 0xe3, 0xaa}, {0x00, 0x9f, 0x88, 0xaa},
1341 {0x00, 0xa0, 0x78, 0xaa}, {0x00, 0x55, 0x90, 0xaa},
1342 {0x00, 0xa1, 0x03, 0xaa}, {0x00, 0xa6, 0xe0, 0xaa},
1343 {0x00, 0xa7, 0xd8, 0xaa}, {0x00, 0xa8, 0xf0, 0xaa},
1344 {0x00, 0xa9, 0x90, 0xaa}, {0x00, 0xaa, 0x14, 0xaa},
1345 {0x00, 0x13, 0xe5, 0xaa}, {0x00, 0x0e, 0x61, 0xaa},
1346 {0x00, 0x0f, 0x4b, 0xaa}, {0x00, 0x16, 0x02, 0xaa},
1347 {0x00, 0x1e, 0x07, 0xaa}, {0x00, 0x21, 0x02, 0xaa},
1348 {0x00, 0x22, 0x91, 0xaa}, {0x00, 0x29, 0x07, 0xaa},
1349 {0x00, 0x33, 0x0b, 0xaa}, {0x00, 0x35, 0x0b, 0xaa},
1350 {0x00, 0x37, 0x1d, 0xaa}, {0x00, 0x38, 0x71, 0xaa},
1351 {0x00, 0x39, 0x2a, 0xaa}, {0x00, 0x3c, 0x78, 0xaa},
1352 {0x00, 0x4d, 0x40, 0xaa}, {0x00, 0x4e, 0x20, 0xaa},
1353 {0x00, 0x74, 0x19, 0xaa}, {0x00, 0x8d, 0x4f, 0xaa},
1354 {0x00, 0x8e, 0x00, 0xaa}, {0x00, 0x8f, 0x00, 0xaa},
1355 {0x00, 0x90, 0x00, 0xaa}, {0x00, 0x91, 0x00, 0xaa},
1356 {0x00, 0x96, 0x00, 0xaa}, {0x00, 0x9a, 0x80, 0xaa},
1357 {0x00, 0xb0, 0x84, 0xaa}, {0x00, 0xb1, 0x0c, 0xaa},
1358 {0x00, 0xb2, 0x0e, 0xaa}, {0x00, 0xb3, 0x82, 0xaa},
1359 {0x00, 0xb8, 0x0a, 0xaa}, {0x00, 0x43, 0x14, 0xaa},
1360 {0x00, 0x44, 0xf0, 0xaa}, {0x00, 0x45, 0x45, 0xaa},
1361 {0x00, 0x46, 0x63, 0xaa}, {0x00, 0x47, 0x2d, 0xaa},
1362 {0x00, 0x48, 0x46, 0xaa}, {0x00, 0x59, 0x88, 0xaa},
1363 {0x00, 0x5a, 0xa0, 0xaa}, {0x00, 0x5b, 0xc6, 0xaa},
1364 {0x00, 0x5c, 0x7d, 0xaa}, {0x00, 0x5d, 0x5f, 0xaa},
1365 {0x00, 0x5e, 0x19, 0xaa}, {0x00, 0x6c, 0x0a, 0xaa},
1366 {0x00, 0x6d, 0x55, 0xaa}, {0x00, 0x6e, 0x11, 0xaa},
1367 {0x00, 0x6f, 0x9e, 0xaa}, {0x00, 0x69, 0x00, 0xaa},
1368 {0x00, 0x6a, 0x40, 0xaa}, {0x00, 0x01, 0x40, 0xaa},
1369 {0x00, 0x02, 0x40, 0xaa}, {0x00, 0x13, 0xe7, 0xaa},
1370 {0x00, 0x5f, 0xf0, 0xaa}, {0x00, 0x60, 0xf0, 0xaa},
1371 {0x00, 0x61, 0xf0, 0xaa}, {0x00, 0x27, 0xa0, 0xaa},
1372 {0x00, 0x28, 0x80, 0xaa}, {0x00, 0x2c, 0x90, 0xaa},
1373 {0x00, 0x4f, 0x66, 0xaa}, {0x00, 0x50, 0x66, 0xaa},
1374 {0x00, 0x51, 0x00, 0xaa}, {0x00, 0x52, 0x22, 0xaa},
1375 {0x00, 0x53, 0x5e, 0xaa}, {0x00, 0x54, 0x80, 0xaa},
1376 {0x00, 0x58, 0x9e, 0xaa}, {0x00, 0x41, 0x08, 0xaa},
1377 {0x00, 0x3f, 0x00, 0xaa}, {0x00, 0x75, 0x85, 0xaa},
1378 {0x00, 0x76, 0xe1, 0xaa}, {0x00, 0x4c, 0x00, 0xaa},
1379 {0x00, 0x77, 0x0a, 0xaa}, {0x00, 0x3d, 0x88, 0xaa},
1380 {0x00, 0x4b, 0x09, 0xaa}, {0x00, 0xc9, 0x60, 0xaa},
1381 {0x00, 0x41, 0x38, 0xaa}, {0x00, 0x62, 0x30, 0xaa},
1382 {0x00, 0x63, 0x30, 0xaa}, {0x00, 0x64, 0x08, 0xaa},
1383 {0x00, 0x94, 0x07, 0xaa}, {0x00, 0x95, 0x0b, 0xaa},
1384 {0x00, 0x65, 0x00, 0xaa}, {0x00, 0x66, 0x05, 0xaa},
1385 {0x00, 0x56, 0x50, 0xaa}, {0x00, 0x34, 0x11, 0xaa},
1386 {0x00, 0xa4, 0x88, 0xaa}, {0x00, 0x96, 0x00, 0xaa},
1387 {0x00, 0x97, 0x30, 0xaa}, {0x00, 0x98, 0x20, 0xaa},
1388 {0x00, 0x99, 0x30, 0xaa}, {0x00, 0x9a, 0x84, 0xaa},
1389 {0x00, 0x9b, 0x29, 0xaa}, {0x00, 0x9c, 0x03, 0xaa},
1390 {0x00, 0x78, 0x04, 0xaa}, {0x00, 0x79, 0x01, 0xaa},
1391 {0x00, 0xc8, 0xf0, 0xaa}, {0x00, 0x79, 0x0f, 0xaa},
1392 {0x00, 0xc8, 0x00, 0xaa}, {0x00, 0x79, 0x10, 0xaa},
1393 {0x00, 0xc8, 0x7e, 0xaa}, {0x00, 0x79, 0x0a, 0xaa},
1394 {0x00, 0xc8, 0x80, 0xaa}, {0x00, 0x79, 0x0b, 0xaa},
1395 {0x00, 0xc8, 0x01, 0xaa}, {0x00, 0x79, 0x0c, 0xaa},
1396 {0x00, 0xc8, 0x0f, 0xaa}, {0x00, 0x79, 0x0d, 0xaa},
1397 {0x00, 0xc8, 0x20, 0xaa}, {0x00, 0x79, 0x09, 0xaa},
1398 {0x00, 0xc8, 0x80, 0xaa}, {0x00, 0x79, 0x02, 0xaa},
1399 {0x00, 0xc8, 0xc0, 0xaa}, {0x00, 0x79, 0x03, 0xaa},
1400 {0x00, 0xc8, 0x40, 0xaa}, {0x00, 0x79, 0x05, 0xaa},
1401 {0x00, 0xc8, 0x30, 0xaa}, {0x00, 0x79, 0x26, 0xaa},
1402 {0x00, 0x11, 0x40, 0xaa}, {0x00, 0x3a, 0x04, 0xaa},
1403 {0x00, 0x12, 0x00, 0xaa}, {0x00, 0x40, 0xc0, 0xaa},
1404 {0x00, 0x8c, 0x00, 0xaa}, {0x00, 0x17, 0x14, 0xaa},
1405 {0x00, 0x18, 0x02, 0xaa}, {0x00, 0x32, 0x92, 0xaa},
1406 {0x00, 0x19, 0x02, 0xaa}, {0x00, 0x1a, 0x7a, 0xaa},
1407 {0x00, 0x03, 0x0a, 0xaa}, {0x00, 0x0c, 0x00, 0xaa},
1408 {0x00, 0x3e, 0x00, 0xaa}, {0x00, 0x70, 0x3a, 0xaa},
1409 {0x00, 0x71, 0x35, 0xaa}, {0x00, 0x72, 0x11, 0xaa},
1410 {0x00, 0x73, 0xf0, 0xaa}, {0x00, 0xa2, 0x02, 0xaa},
1411 {0x00, 0xb1, 0x00, 0xaa}, {0x00, 0xb1, 0x0c, 0xaa},
1412 {0x00, 0x1e, 0x37, 0xaa}, {0x00, 0xaa, 0x14, 0xaa},
1413 {0x00, 0x24, 0x80, 0xaa}, {0x00, 0x25, 0x74, 0xaa},
1414 {0x00, 0x26, 0xd3, 0xaa}, {0x00, 0x0d, 0x00, 0xaa},
1415 {0x00, 0x14, 0x18, 0xaa}, {0x00, 0x9d, 0x99, 0xaa},
1416 {0x00, 0x9e, 0x7f, 0xaa}, {0x00, 0x64, 0x08, 0xaa},
1417 {0x00, 0x94, 0x07, 0xaa}, {0x00, 0x95, 0x06, 0xaa},
1418 {0x00, 0x66, 0x05, 0xaa}, {0x00, 0x41, 0x08, 0xaa},
1419 {0x00, 0x3f, 0x00, 0xaa}, {0x00, 0x75, 0x07, 0xaa},
1420 {0x00, 0x76, 0xe1, 0xaa}, {0x00, 0x4c, 0x00, 0xaa},
1421 {0x00, 0x77, 0x00, 0xaa}, {0x00, 0x3d, 0xc2, 0xaa},
1422 {0x00, 0x4b, 0x09, 0xaa}, {0x00, 0xc9, 0x60, 0xaa},
1423 {0x00, 0x41, 0x38, 0xaa}, {0xb6, 0x00, 0x00, 0xcc},
1424 {0xb6, 0x03, 0x01, 0xcc}, {0xb6, 0x02, 0x40, 0xcc},
1425 {0xb6, 0x05, 0x00, 0xcc}, {0xb6, 0x04, 0xf0, 0xcc},
1426 {0xb6, 0x12, 0xf8, 0xcc}, {0xb6, 0x13, 0x21, 0xcc},
1427 {0xb6, 0x18, 0x00, 0xcc}, {0xb6, 0x17, 0x96, 0xcc},
1428 {0xb6, 0x16, 0x00, 0xcc}, {0xb6, 0x22, 0x12, 0xcc},
1429 {0xb6, 0x23, 0x0b, 0xcc}, {0xbf, 0xc0, 0x39, 0xcc},
1430 {0xbf, 0xc1, 0x04, 0xcc}, {0xbf, 0xcc, 0x00, 0xcc},
1431 {0xbc, 0x02, 0x18, 0xcc}, {0xbc, 0x03, 0x50, 0xcc},
1432 {0xbc, 0x04, 0x18, 0xcc}, {0xbc, 0x05, 0x00, 0xcc},
1433 {0xbc, 0x06, 0x00, 0xcc}, {0xbc, 0x08, 0x30, 0xcc},
1434 {0xbc, 0x09, 0x40, 0xcc}, {0xbc, 0x0a, 0x10, 0xcc},
1435 {0xbc, 0x0b, 0x00, 0xcc}, {0xbc, 0x0c, 0x00, 0xcc},
1436 {0xb3, 0x5c, 0x01, 0xcc}, {0xb3, 0x01, 0x45, 0xcc},
1437 {0x00, 0x77, 0x05, 0xaa },
1438 {},
1439};
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001440struct sensor_info {
1441 int sensorId;
1442 __u8 I2cAdd;
1443 __u8 IdAdd;
1444 __u16 VpId;
1445 __u8 m1;
1446 __u8 m2;
1447 __u8 op;
1448 };
1449
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -03001450static const struct sensor_info sensor_info_data[] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001451/* sensorId, I2cAdd, IdAdd, VpId, m1, m2, op */
1452 {SENSOR_HV7131R, 0x80 | 0x11, 0x00, 0x0209, 0x24, 0x25, 0x01},
1453 {SENSOR_OV7660, 0x80 | 0x21, 0x0a, 0x7660, 0x26, 0x26, 0x05},
1454 {SENSOR_PO3130NC, 0x80 | 0x76, 0x00, 0x3130, 0x24, 0x25, 0x01},
1455 {SENSOR_MI1320, 0x80 | 0xc8, 0x00, 0x148c, 0x64, 0x65, 0x01},
1456 {SENSOR_OV7670, 0x80 | 0x21, 0x0a, 0x7673, 0x66, 0x67, 0x05},
1457 {SENSOR_MI1310_SOC, 0x80 | 0x5d, 0x00, 0x143a, 0x24, 0x25, 0x01},
Jean-Francois Moinecbb05542008-11-26 16:17:13 -03001458/* (tested in vc032x_probe_sensor) */
Jean-Francois Moinee18fd012008-12-08 04:48:21 -03001459/* {SENSOR_MI0360, 0x80 | 0x5d, 0x00, 0x8243, 0x24, 0x25, 0x01}, */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001460};
1461
Jean-Francois Moine739570b2008-07-14 09:38:29 -03001462/* read 'len' bytes in gspca_dev->usb_buf */
1463static void reg_r(struct gspca_dev *gspca_dev,
1464 __u16 req,
1465 __u16 index,
1466 __u16 len)
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001467{
Jean-Francois Moine739570b2008-07-14 09:38:29 -03001468 usb_control_msg(gspca_dev->dev,
1469 usb_rcvctrlpipe(gspca_dev->dev, 0),
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001470 req,
1471 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
1472 1, /* value */
Jean-Francois Moine739570b2008-07-14 09:38:29 -03001473 index, gspca_dev->usb_buf, len,
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001474 500);
1475}
1476
1477static void reg_w(struct usb_device *dev,
1478 __u16 req,
1479 __u16 value,
1480 __u16 index)
1481{
1482 usb_control_msg(dev,
1483 usb_sndctrlpipe(dev, 0),
1484 req,
1485 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
1486 value, index, NULL, 0,
1487 500);
1488}
1489
Jean-Francois Moine739570b2008-07-14 09:38:29 -03001490static void read_sensor_register(struct gspca_dev *gspca_dev,
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001491 __u16 address, __u16 *value)
1492{
Jean-Francois Moine739570b2008-07-14 09:38:29 -03001493 struct usb_device *dev = gspca_dev->dev;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001494 __u8 ldata, mdata, hdata;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001495 int retry = 50;
Jean-Francois Moine739570b2008-07-14 09:38:29 -03001496
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001497 *value = 0;
1498
Jean-Francois Moine739570b2008-07-14 09:38:29 -03001499 reg_r(gspca_dev, 0xa1, 0xb33f, 1);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001500 /*PDEBUG(D_PROBE, " I2c Bus Busy Wait 0x%02X ", tmpvalue); */
Jean-Francois Moine739570b2008-07-14 09:38:29 -03001501 if (!(gspca_dev->usb_buf[0] & 0x02)) {
1502 PDEBUG(D_ERR, "I2c Bus Busy Wait %d",
1503 gspca_dev->usb_buf[0] & 0x02);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001504 return;
1505 }
1506 reg_w(dev, 0xa0, address, 0xb33a);
1507 reg_w(dev, 0xa0, 0x02, 0xb339);
1508
Jean-Francois Moine739570b2008-07-14 09:38:29 -03001509 reg_r(gspca_dev, 0xa1, 0xb33b, 1);
1510 while (retry-- && gspca_dev->usb_buf[0]) {
1511 reg_r(gspca_dev, 0xa1, 0xb33b, 1);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001512/* PDEBUG(D_PROBE, "Read again 0xb33b %d", tmpvalue); */
1513 msleep(1);
1514 }
Jean-Francois Moine739570b2008-07-14 09:38:29 -03001515 reg_r(gspca_dev, 0xa1, 0xb33e, 1);
Jean-Francois Moinee18fd012008-12-08 04:48:21 -03001516 ldata = gspca_dev->usb_buf[0];
Jean-Francois Moine739570b2008-07-14 09:38:29 -03001517 reg_r(gspca_dev, 0xa1, 0xb33d, 1);
1518 mdata = gspca_dev->usb_buf[0];
1519 reg_r(gspca_dev, 0xa1, 0xb33c, 1);
Jean-Francois Moinee18fd012008-12-08 04:48:21 -03001520 hdata = gspca_dev->usb_buf[0];
1521 PDEBUG(D_PROBE, "Read Sensor %02x%02x %02x",
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001522 hdata, mdata, ldata);
Jean-Francois Moine739570b2008-07-14 09:38:29 -03001523 reg_r(gspca_dev, 0xa1, 0xb334, 1);
1524 if (gspca_dev->usb_buf[0] == 0x02)
Jean-Francois Moinee18fd012008-12-08 04:48:21 -03001525 *value = (hdata << 8) + mdata;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001526 else
Jean-Francois Moinee18fd012008-12-08 04:48:21 -03001527 *value = hdata;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001528}
Jean-Francois Moine739570b2008-07-14 09:38:29 -03001529
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001530static int vc032x_probe_sensor(struct gspca_dev *gspca_dev)
1531{
1532 struct usb_device *dev = gspca_dev->dev;
1533 int i;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001534 __u16 value;
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -03001535 const struct sensor_info *ptsensor_info;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001536
Jean-Francois Moine739570b2008-07-14 09:38:29 -03001537 reg_r(gspca_dev, 0xa1, 0xbfcf, 1);
Jean-Francois Moinecbb05542008-11-26 16:17:13 -03001538 PDEBUG(D_PROBE, "check sensor header %02x", gspca_dev->usb_buf[0]);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001539 for (i = 0; i < ARRAY_SIZE(sensor_info_data); i++) {
1540 ptsensor_info = &sensor_info_data[i];
1541 reg_w(dev, 0xa0, 0x02, 0xb334);
1542 reg_w(dev, 0xa0, ptsensor_info->m1, 0xb300);
1543 reg_w(dev, 0xa0, ptsensor_info->m2, 0xb300);
1544 reg_w(dev, 0xa0, 0x01, 0xb308);
1545 reg_w(dev, 0xa0, 0x0c, 0xb309);
1546 reg_w(dev, 0xa0, ptsensor_info->I2cAdd, 0xb335);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001547 reg_w(dev, 0xa0, ptsensor_info->op, 0xb301);
Jean-Francois Moine739570b2008-07-14 09:38:29 -03001548 read_sensor_register(gspca_dev, ptsensor_info->IdAdd, &value);
Jean-Francois Moinecbb05542008-11-26 16:17:13 -03001549 if (value == ptsensor_info->VpId)
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001550 return ptsensor_info->sensorId;
Jean-Francois Moinecbb05542008-11-26 16:17:13 -03001551
1552 /* special case for MI0360 */
1553 if (ptsensor_info->sensorId == SENSOR_MI1310_SOC
Jean-Francois Moinee18fd012008-12-08 04:48:21 -03001554 && value == 0x8243)
Jean-Francois Moinecbb05542008-11-26 16:17:13 -03001555 return ptsensor_info->sensorId;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001556 }
1557 return -1;
1558}
1559
Jean-Francois Moine739570b2008-07-14 09:38:29 -03001560static __u8 i2c_write(struct gspca_dev *gspca_dev,
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -03001561 __u8 reg, const __u8 *val, __u8 size)
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001562{
Jean-Francois Moine739570b2008-07-14 09:38:29 -03001563 struct usb_device *dev = gspca_dev->dev;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001564
1565 if (size > 3 || size < 1)
1566 return -EINVAL;
Jean-Francois Moine739570b2008-07-14 09:38:29 -03001567 reg_r(gspca_dev, 0xa1, 0xb33f, 1);
Jean-Francois Moinec41492c2008-07-07 08:31:16 -03001568 reg_w(dev, 0xa0, size, 0xb334);
1569 reg_w(dev, 0xa0, reg, 0xb33a);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001570 switch (size) {
1571 case 1:
Jean-Francois Moinec41492c2008-07-07 08:31:16 -03001572 reg_w(dev, 0xa0, val[0], 0xb336);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001573 break;
1574 case 2:
Jean-Francois Moinec41492c2008-07-07 08:31:16 -03001575 reg_w(dev, 0xa0, val[0], 0xb336);
1576 reg_w(dev, 0xa0, val[1], 0xb337);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001577 break;
1578 case 3:
Jean-Francois Moinec41492c2008-07-07 08:31:16 -03001579 reg_w(dev, 0xa0, val[0], 0xb336);
1580 reg_w(dev, 0xa0, val[1], 0xb337);
1581 reg_w(dev, 0xa0, val[2], 0xb338);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001582 break;
1583 default:
1584 reg_w(dev, 0xa0, 0x01, 0xb334);
1585 return -EINVAL;
1586 }
1587 reg_w(dev, 0xa0, 0x01, 0xb339);
Jean-Francois Moine739570b2008-07-14 09:38:29 -03001588 reg_r(gspca_dev, 0xa1, 0xb33b, 1);
1589 return gspca_dev->usb_buf[0] == 0;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001590}
1591
1592static void put_tab_to_reg(struct gspca_dev *gspca_dev,
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -03001593 const __u8 *tab, __u8 tabsize, __u16 addr)
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001594{
1595 int j;
1596 __u16 ad = addr;
1597
1598 for (j = 0; j < tabsize; j++)
1599 reg_w(gspca_dev->dev, 0xa0, tab[j], ad++);
1600}
1601
1602static void usb_exchange(struct gspca_dev *gspca_dev,
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -03001603 const __u8 data[][4])
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001604{
1605 struct usb_device *dev = gspca_dev->dev;
1606 int i = 0;
1607
1608 for (;;) {
1609 switch (data[i][3]) {
1610 default:
1611 return;
1612 case 0xcc: /* normal write */
1613 reg_w(dev, 0xa0, data[i][2],
1614 ((data[i][0])<<8) | data[i][1]);
1615 break;
1616 case 0xaa: /* i2c op */
Jean-Francois Moine739570b2008-07-14 09:38:29 -03001617 i2c_write(gspca_dev, data[i][1], &data[i][2], 1);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001618 break;
1619 case 0xbb: /* i2c op */
Jean-Francois Moine739570b2008-07-14 09:38:29 -03001620 i2c_write(gspca_dev, data[i][0], &data[i][1], 2);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001621 break;
1622 case 0xdd:
1623 msleep(data[i][2] + 10);
1624 break;
1625 }
1626 i++;
1627 }
1628 /*not reached*/
1629}
1630
1631/*
1632 "GammaT"=hex:04,17,31,4f,6a,83,99,ad,bf,ce,da,e5,ee,f5,fb,ff,ff
1633 "MatrixT"=hex:60,f9,e5,e7,50,05,f3,e6,66
1634 */
1635
1636static void vc0321_reset(struct gspca_dev *gspca_dev)
1637{
1638 reg_w(gspca_dev->dev, 0xa0, 0x00, 0xb04d);
1639 reg_w(gspca_dev->dev, 0xa0, 0x01, 0xb301);
1640 msleep(100);
1641 reg_w(gspca_dev->dev, 0xa0, 0x01, 0xb003);
1642 msleep(100);
1643}
1644
1645/* this function is called at probe time */
1646static int sd_config(struct gspca_dev *gspca_dev,
1647 const struct usb_device_id *id)
1648{
1649 struct sd *sd = (struct sd *) gspca_dev;
1650 struct usb_device *dev = gspca_dev->dev;
1651 struct cam *cam;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001652 int sensor;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001653
1654 cam = &gspca_dev->cam;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001655 cam->epaddr = 0x02;
Jean-Francois Moine9d64fdb2008-07-25 08:53:03 -03001656 sd->bridge = id->driver_info;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001657
1658 vc0321_reset(gspca_dev);
1659 sensor = vc032x_probe_sensor(gspca_dev);
1660 switch (sensor) {
1661 case -1:
1662 PDEBUG(D_PROBE, "Unknown sensor...");
1663 return -EINVAL;
1664 case SENSOR_HV7131R:
1665 PDEBUG(D_PROBE, "Find Sensor HV7131R");
Jean-Francois Moinecbb05542008-11-26 16:17:13 -03001666 break;
1667 case SENSOR_MI0360:
1668 PDEBUG(D_PROBE, "Find Sensor MI0360");
1669 sd->bridge = BRIDGE_VC0323;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001670 break;
1671 case SENSOR_MI1310_SOC:
1672 PDEBUG(D_PROBE, "Find Sensor MI1310_SOC");
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001673 break;
1674 case SENSOR_MI1320:
1675 PDEBUG(D_PROBE, "Find Sensor MI1320");
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001676 break;
1677 case SENSOR_OV7660:
1678 PDEBUG(D_PROBE, "Find Sensor OV7660");
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001679 break;
1680 case SENSOR_OV7670:
1681 PDEBUG(D_PROBE, "Find Sensor OV7670");
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001682 break;
1683 case SENSOR_PO3130NC:
1684 PDEBUG(D_PROBE, "Find Sensor PO3130NC");
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001685 break;
1686 }
Jean-Francois Moinecbb05542008-11-26 16:17:13 -03001687 sd->sensor = sensor;
1688
1689 if (sd->bridge == BRIDGE_VC0321) {
1690 cam->cam_mode = vc0321_mode;
1691 cam->nmodes = ARRAY_SIZE(vc0321_mode);
1692 } else {
1693 cam->cam_mode = vc0323_mode;
1694 cam->nmodes = ARRAY_SIZE(vc0323_mode);
1695 }
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001696
1697 sd->qindex = 7;
Jean-Francois Moined0d0e392008-07-10 07:06:44 -03001698 sd->autogain = AUTOGAIN_DEF;
1699 sd->lightfreq = FREQ_DEF;
Jean-Francois Moinef50ba1b2008-09-03 17:12:14 -03001700 if (sd->sensor != SENSOR_OV7670)
1701 gspca_dev->ctrl_dis = (1 << LIGHTFREQ_IDX);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001702
1703 if (sd->bridge == BRIDGE_VC0321) {
Jean-Francois Moine739570b2008-07-14 09:38:29 -03001704 reg_r(gspca_dev, 0x8a, 0, 3);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001705 reg_w(dev, 0x87, 0x00, 0x0f0f);
1706
Jean-Francois Moine739570b2008-07-14 09:38:29 -03001707 reg_r(gspca_dev, 0x8b, 0, 3);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001708 reg_w(dev, 0x88, 0x00, 0x0202);
1709 }
1710 return 0;
1711}
1712
Jean-Francois Moine012d6b02008-09-03 17:12:16 -03001713/* this function is called at probe and time */
1714static int sd_init(struct gspca_dev *gspca_dev)
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001715{
1716 return 0;
1717}
1718
1719static void setquality(struct gspca_dev *gspca_dev)
1720{
1721}
1722
1723static void setautogain(struct gspca_dev *gspca_dev)
1724{
1725}
1726
1727static void setlightfreq(struct gspca_dev *gspca_dev)
1728{
1729 struct sd *sd = (struct sd *) gspca_dev;
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -03001730 static const __u8 (*ov7660_freq_tb[3])[4] =
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001731 {ov7660_NoFliker, ov7660_50HZ, ov7660_60HZ};
1732
1733 if (sd->sensor != SENSOR_OV7660)
1734 return;
1735 usb_exchange(gspca_dev, ov7660_freq_tb[sd->lightfreq]);
1736}
1737
Jean-Francois Moine72ab97c2008-09-20 06:39:08 -03001738static int sd_start(struct gspca_dev *gspca_dev)
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001739{
1740 struct sd *sd = (struct sd *) gspca_dev;
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -03001741 const __u8 *GammaT = NULL;
1742 const __u8 *MatrixT = NULL;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001743 int mode;
1744
1745 /* Assume start use the good resolution from gspca_dev->mode */
1746 if (sd->bridge == BRIDGE_VC0321) {
1747 reg_w(gspca_dev->dev, 0xa0, 0xff, 0xbfec);
1748 reg_w(gspca_dev->dev, 0xa0, 0xff, 0xbfed);
1749 reg_w(gspca_dev->dev, 0xa0, 0xff, 0xbfee);
1750 reg_w(gspca_dev->dev, 0xa0, 0xff, 0xbfef);
1751 }
1752
Jean-Francois Moinec2446b32008-07-05 11:49:20 -03001753 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001754 switch (sd->sensor) {
1755 case SENSOR_HV7131R:
1756 GammaT = hv7131r_gamma;
1757 MatrixT = hv7131r_matrix;
1758 if (mode) {
1759 /* 320x240 */
1760 usb_exchange(gspca_dev, hv7131r_initQVGA_data);
1761 } else {
1762 /* 640x480 */
1763 usb_exchange(gspca_dev, hv7131r_initVGA_data);
1764 }
1765 break;
1766 case SENSOR_OV7660:
1767 GammaT = ov7660_gamma;
1768 MatrixT = ov7660_matrix;
1769 if (mode) {
1770 /* 320x240 */
1771 usb_exchange(gspca_dev, ov7660_initQVGA_data);
1772 } else {
1773 /* 640x480 */
1774 usb_exchange(gspca_dev, ov7660_initVGA_data);
1775 }
1776 break;
1777 case SENSOR_OV7670:
1778 /*GammaT = ov7660_gamma; */
1779 /*MatrixT = ov7660_matrix; */
1780 if (mode) {
1781 /* 320x240 */
1782 usb_exchange(gspca_dev, ov7670_initQVGA_JPG);
1783 } else {
1784 /* 640x480 */
1785 usb_exchange(gspca_dev, ov7670_initVGA_JPG);
1786 }
1787 break;
Jean-Francois Moinecbb05542008-11-26 16:17:13 -03001788 case SENSOR_MI0360:
1789 GammaT = mi1320_gamma;
1790 MatrixT = mi0360_matrix;
1791 if (mode) {
1792 /* 320x240 */
1793 usb_exchange(gspca_dev, mi0360_initQVGA_JPG);
1794 } else {
1795 /* 640x480 */
1796 usb_exchange(gspca_dev, mi0360_initVGA_JPG);
1797 }
1798 break;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001799 case SENSOR_MI1310_SOC:
1800 if (mode) {
1801 /* 320x240 */
1802 usb_exchange(gspca_dev, mi1310_socinitQVGA_JPG);
1803 } else {
1804 /* 640x480 */
1805 usb_exchange(gspca_dev, mi1310_socinitVGA_JPG);
1806 }
1807 break;
1808 case SENSOR_MI1320:
1809 GammaT = mi1320_gamma;
1810 MatrixT = mi1320_matrix;
1811 if (mode) {
1812 /* 320x240 */
1813 usb_exchange(gspca_dev, mi1320_initQVGA_data);
1814 } else {
1815 /* 640x480 */
1816 usb_exchange(gspca_dev, mi1320_initVGA_data);
1817 }
1818 break;
1819 case SENSOR_PO3130NC:
1820 GammaT = po3130_gamma;
1821 MatrixT = po3130_matrix;
1822 if (mode) {
1823 /* 320x240 */
1824 usb_exchange(gspca_dev, po3130_initQVGA_data);
1825 } else {
1826 /* 640x480 */
1827 usb_exchange(gspca_dev, po3130_initVGA_data);
1828 }
1829 usb_exchange(gspca_dev, po3130_rundata);
1830 break;
1831 default:
1832 PDEBUG(D_PROBE, "Damned !! no sensor found Bye");
Jean-Francois Moine72ab97c2008-09-20 06:39:08 -03001833 return -EMEDIUMTYPE;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001834 }
1835 if (GammaT && MatrixT) {
1836 put_tab_to_reg(gspca_dev, GammaT, 17, 0xb84a);
1837 put_tab_to_reg(gspca_dev, GammaT, 17, 0xb85b);
1838 put_tab_to_reg(gspca_dev, GammaT, 17, 0xb86c);
1839 put_tab_to_reg(gspca_dev, MatrixT, 9, 0xb82c);
1840
1841 /* Seem SHARPNESS */
1842 /*
1843 reg_w(gspca_dev->dev, 0xa0, 0x80, 0xb80a);
1844 reg_w(gspca_dev->dev, 0xa0, 0xff, 0xb80b);
1845 reg_w(gspca_dev->dev, 0xa0, 0xff, 0xb80e);
1846 */
1847 /* all 0x40 ??? do nothing
1848 reg_w(gspca_dev->dev, 0xa0, 0x40, 0xb822);
1849 reg_w(gspca_dev->dev, 0xa0, 0x40, 0xb823);
1850 reg_w(gspca_dev->dev, 0xa0, 0x40, 0xb824);
1851 */
1852 /* Only works for HV7131R ??
Jean-Francois Moine739570b2008-07-14 09:38:29 -03001853 reg_r (gspca_dev, 0xa1, 0xb881, 1);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001854 reg_w(gspca_dev->dev, 0xa0, 0xfe01, 0xb881);
1855 reg_w(gspca_dev->dev, 0xa0, 0x79, 0xb801);
1856 */
1857 /* only hv7131r et ov7660
1858 reg_w(gspca_dev->dev, 0xa0, 0x20, 0xb827);
1859 reg_w(gspca_dev->dev, 0xa0, 0xff, 0xb826); * ISP_GAIN 80
1860 reg_w(gspca_dev->dev, 0xa0, 0x23, 0xb800); * ISP CTRL_BAS
1861 */
1862 /* set the led on 0x0892 0x0896 */
1863 reg_w(gspca_dev->dev, 0x89, 0xffff, 0xfdff);
1864 msleep(100);
1865 setquality(gspca_dev);
1866 setautogain(gspca_dev);
1867 setlightfreq(gspca_dev);
1868 }
Jean-Francois Moine72ab97c2008-09-20 06:39:08 -03001869 return 0;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001870}
1871
1872static void sd_stopN(struct gspca_dev *gspca_dev)
1873{
1874 struct usb_device *dev = gspca_dev->dev;
1875
1876 reg_w(dev, 0x89, 0xffff, 0xffff);
1877 reg_w(dev, 0xa0, 0x01, 0xb301);
1878 reg_w(dev, 0xa0, 0x09, 0xb003);
1879}
1880
Jean-Francois Moine98522a72008-11-18 06:33:08 -03001881/* called on streamoff with alt 0 and on disconnect */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001882static void sd_stop0(struct gspca_dev *gspca_dev)
1883{
1884 struct usb_device *dev = gspca_dev->dev;
1885
Jean-Francois Moine98522a72008-11-18 06:33:08 -03001886 if (!gspca_dev->present)
1887 return;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001888 reg_w(dev, 0x89, 0xffff, 0xffff);
1889}
1890
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001891static void sd_pkt_scan(struct gspca_dev *gspca_dev,
1892 struct gspca_frame *frame, /* target */
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -03001893 __u8 *data, /* isoc packet */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001894 int len) /* iso pkt length */
1895{
1896 struct sd *sd = (struct sd *) gspca_dev;
1897
1898 if (data[0] == 0xff && data[1] == 0xd8) {
1899 PDEBUG(D_PACK,
1900 "vc032x header packet found len %d", len);
1901 frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame,
1902 data, 0);
1903 if (sd->bridge == BRIDGE_VC0321) {
1904#define VCHDRSZ 46
1905 data += VCHDRSZ;
1906 len -= VCHDRSZ;
1907#undef VCHDRSZ
1908 }
1909 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
1910 data, len);
1911 return;
1912 }
1913 gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len);
1914}
1915
1916static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val)
1917{
1918 struct sd *sd = (struct sd *) gspca_dev;
1919
1920 sd->autogain = val;
1921 if (gspca_dev->streaming)
1922 setautogain(gspca_dev);
1923 return 0;
1924}
1925
1926static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val)
1927{
1928 struct sd *sd = (struct sd *) gspca_dev;
1929
1930 *val = sd->autogain;
1931 return 0;
1932}
1933
1934static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val)
1935{
1936 struct sd *sd = (struct sd *) gspca_dev;
1937
1938 sd->lightfreq = val;
1939 if (gspca_dev->streaming)
1940 setlightfreq(gspca_dev);
1941 return 0;
1942}
1943
1944static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val)
1945{
1946 struct sd *sd = (struct sd *) gspca_dev;
1947
1948 *val = sd->lightfreq;
1949 return 0;
1950}
1951
1952static int sd_querymenu(struct gspca_dev *gspca_dev,
1953 struct v4l2_querymenu *menu)
1954{
1955 switch (menu->id) {
1956 case V4L2_CID_POWER_LINE_FREQUENCY:
1957 switch (menu->index) {
1958 case 0: /* V4L2_CID_POWER_LINE_FREQUENCY_DISABLED */
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -03001959 strcpy((char *) menu->name, "NoFliker");
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001960 return 0;
1961 case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -03001962 strcpy((char *) menu->name, "50 Hz");
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001963 return 0;
1964 case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -03001965 strcpy((char *) menu->name, "60 Hz");
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001966 return 0;
1967 }
1968 break;
1969 }
1970 return -EINVAL;
1971}
1972
1973/* sub-driver description */
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -03001974static const struct sd_desc sd_desc = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001975 .name = MODULE_NAME,
1976 .ctrls = sd_ctrls,
1977 .nctrls = ARRAY_SIZE(sd_ctrls),
1978 .config = sd_config,
Jean-Francois Moine012d6b02008-09-03 17:12:16 -03001979 .init = sd_init,
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001980 .start = sd_start,
1981 .stopN = sd_stopN,
1982 .stop0 = sd_stop0,
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001983 .pkt_scan = sd_pkt_scan,
1984 .querymenu = sd_querymenu,
1985};
1986
1987/* -- module initialisation -- */
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -03001988static const __devinitdata struct usb_device_id device_table[] = {
Jean-Francois Moine87581aa2008-07-26 14:30:01 -03001989 {USB_DEVICE(0x046d, 0x0892), .driver_info = BRIDGE_VC0321},
1990 {USB_DEVICE(0x046d, 0x0896), .driver_info = BRIDGE_VC0321},
1991 {USB_DEVICE(0x0ac8, 0x0321), .driver_info = BRIDGE_VC0321},
1992 {USB_DEVICE(0x0ac8, 0x0323), .driver_info = BRIDGE_VC0323},
1993 {USB_DEVICE(0x0ac8, 0x0328), .driver_info = BRIDGE_VC0321},
1994 {USB_DEVICE(0x0ac8, 0xc001), .driver_info = BRIDGE_VC0321},
1995 {USB_DEVICE(0x0ac8, 0xc002), .driver_info = BRIDGE_VC0321},
1996 {USB_DEVICE(0x17ef, 0x4802), .driver_info = BRIDGE_VC0323},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001997 {}
1998};
1999MODULE_DEVICE_TABLE(usb, device_table);
2000
2001/* -- device connect -- */
2002static int sd_probe(struct usb_interface *intf,
2003 const struct usb_device_id *id)
2004{
2005 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
2006 THIS_MODULE);
2007}
2008
2009static struct usb_driver sd_driver = {
2010 .name = MODULE_NAME,
2011 .id_table = device_table,
2012 .probe = sd_probe,
2013 .disconnect = gspca_disconnect,
Jean-Francois Moine6a709742008-09-03 16:48:10 -03002014#ifdef CONFIG_PM
2015 .suspend = gspca_suspend,
2016 .resume = gspca_resume,
2017#endif
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03002018};
2019
2020/* -- module insert / remove -- */
2021static int __init sd_mod_init(void)
2022{
2023 if (usb_register(&sd_driver) < 0)
2024 return -1;
Jean-Francois Moine10b0e962008-07-22 05:35:10 -03002025 PDEBUG(D_PROBE, "registered");
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03002026 return 0;
2027}
2028static void __exit sd_mod_exit(void)
2029{
2030 usb_deregister(&sd_driver);
2031 PDEBUG(D_PROBE, "deregistered");
2032}
2033
2034module_init(sd_mod_init);
2035module_exit(sd_mod_exit);