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