1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Z-Star/Vimicro zc301/zc302p/vc30x driver
4 *
5 * Copyright (C) 2009-2012 Jean-Francois Moine <http://moinejf.free.fr>
6 * Copyright (C) 2004 2005 2006 Michel Xhaard mxhaard@magic.fr
7 */
8
9 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
10
11 #include <linux/input.h>
12 #include "gspca.h"
13 #include "jpeg.h"
14
15 MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>, Serge A. Suchkov <Serge.A.S@tochka.ru>");
16 MODULE_DESCRIPTION("GSPCA ZC03xx/VC3xx USB Camera Driver");
17 MODULE_LICENSE("GPL");
18
19 static int force_sensor = -1;
20
21 #define REG08_DEF 3 /* default JPEG compression (75%) */
22 #include "zc3xx-reg.h"
23
24 /* specific webcam descriptor */
25 struct sd {
26 struct gspca_dev gspca_dev; /* !! must be the first item */
27
28 struct { /* gamma/brightness/contrast control cluster */
29 struct v4l2_ctrl *gamma;
30 struct v4l2_ctrl *brightness;
31 struct v4l2_ctrl *contrast;
32 };
33 struct { /* autogain/exposure control cluster */
34 struct v4l2_ctrl *autogain;
35 struct v4l2_ctrl *exposure;
36 };
37 struct v4l2_ctrl *plfreq;
38 struct v4l2_ctrl *sharpness;
39 struct v4l2_ctrl *jpegqual;
40
41 struct work_struct work;
42
43 u8 reg08; /* webcam compression quality */
44
45 u8 bridge;
46 u8 sensor; /* Type of image sensor chip */
47 u16 chip_revision;
48
49 u8 jpeg_hdr[JPEG_HDR_SZ];
50 };
51 enum bridges {
52 BRIDGE_ZC301,
53 BRIDGE_ZC303,
54 };
55 enum sensors {
56 SENSOR_ADCM2700,
57 SENSOR_CS2102,
58 SENSOR_CS2102K,
59 SENSOR_GC0303,
60 SENSOR_GC0305,
61 SENSOR_HDCS2020,
62 SENSOR_HV7131B,
63 SENSOR_HV7131R,
64 SENSOR_ICM105A,
65 SENSOR_MC501CB,
66 SENSOR_MT9V111_1, /* (mi360soc) zc301 */
67 SENSOR_MT9V111_3, /* (mi360soc) zc303 */
68 SENSOR_OV7620, /* OV7648 - same values */
69 SENSOR_OV7630C,
70 SENSOR_PAS106,
71 SENSOR_PAS202B,
72 SENSOR_PB0330,
73 SENSOR_PO2030,
74 SENSOR_TAS5130C,
75 SENSOR_MAX
76 };
77
78 static const struct v4l2_pix_format vga_mode[] = {
79 {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
80 .bytesperline = 320,
81 .sizeimage = 320 * 240 * 3 / 8 + 590,
82 .colorspace = V4L2_COLORSPACE_JPEG,
83 .priv = 1},
84 {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
85 .bytesperline = 640,
86 .sizeimage = 640 * 480 * 3 / 8 + 590,
87 .colorspace = V4L2_COLORSPACE_JPEG,
88 .priv = 0},
89 };
90
91 static const struct v4l2_pix_format broken_vga_mode[] = {
92 {320, 232, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
93 .bytesperline = 320,
94 .sizeimage = 320 * 232 * 4 / 8 + 590,
95 .colorspace = V4L2_COLORSPACE_JPEG,
96 .priv = 1},
97 {640, 472, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
98 .bytesperline = 640,
99 .sizeimage = 640 * 472 * 3 / 8 + 590,
100 .colorspace = V4L2_COLORSPACE_JPEG,
101 .priv = 0},
102 };
103
104 static const struct v4l2_pix_format sif_mode[] = {
105 {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
106 .bytesperline = 176,
107 .sizeimage = 176 * 144 * 3 / 8 + 590,
108 .colorspace = V4L2_COLORSPACE_JPEG,
109 .priv = 1},
110 {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
111 .bytesperline = 352,
112 .sizeimage = 352 * 288 * 3 / 8 + 590,
113 .colorspace = V4L2_COLORSPACE_JPEG,
114 .priv = 0},
115 };
116
117 /*
118 * Bridge reg08 bits 1-2 -> JPEG quality conversion table. Note the highest
119 * quality setting is not usable as USB 1 does not have enough bandwidth.
120 */
121 static u8 jpeg_qual[] = {50, 75, 87, /* 94 */};
122
123 /* usb exchanges */
124 struct usb_action {
125 u8 req;
126 u8 val;
127 u16 idx;
128 };
129
130 static const struct usb_action adcm2700_Initial[] = {
131 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */
132 {0xa0, 0x04, ZC3XX_R002_CLOCKSELECT}, /* 00,02,04,cc */
133 {0xa0, 0x00, ZC3XX_R008_CLOCKSETTING}, /* 00,08,03,cc */
134 {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,0a,cc */
135 {0xa0, 0xd3, ZC3XX_R08B_I2CDEVICEADDR}, /* 00,8b,d3,cc */
136 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, /* 00,03,02,cc */
137 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, /* 00,04,80,cc */
138 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* 00,05,01,cc */
139 {0xa0, 0xd8, ZC3XX_R006_FRAMEHEIGHTLOW}, /* 00,06,d8,cc */
140 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* 00,01,01,cc */
141 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,03,cc */
142 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,01,cc */
143 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,05,cc */
144 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, /* 00,98,00,cc */
145 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, /* 00,9a,00,cc */
146 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* 01,1a,00,cc */
147 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, /* 01,1c,00,cc */
148 {0xa0, 0xde, ZC3XX_R09C_WINHEIGHTLOW}, /* 00,9c,de,cc */
149 {0xa0, 0x86, ZC3XX_R09E_WINWIDTHLOW}, /* 00,9e,86,cc */
150 {0xbb, 0x00, 0x0400}, /* 04,00,00,bb */
151 {0xdd, 0x00, 0x0010}, /* 00,00,10,dd */
152 {0xbb, 0x0f, 0x140f}, /* 14,0f,0f,bb */
153 {0xa0, 0xb7, ZC3XX_R101_SENSORCORRECTION}, /* 01,01,37,cc */
154 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0d,cc */
155 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* 01,89,06,cc */
156 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* 01,c5,03,cc */
157 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* 01,cb,13,cc */
158 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* 02,50,08,cc */
159 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* 03,01,08,cc */
160 {0xa0, 0x58, ZC3XX_R116_RGAIN}, /* 01,16,58,cc */
161 {0xa0, 0x5a, ZC3XX_R118_BGAIN}, /* 01,18,5a,cc */
162 {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,02,cc */
163 {0xa0, 0xd3, ZC3XX_R08B_I2CDEVICEADDR}, /* 00,8b,d3,cc */
164 {0xbb, 0x00, 0x0408}, /* 04,00,08,bb */
165 {0xdd, 0x00, 0x0200}, /* 00,02,00,dd */
166 {0xbb, 0x00, 0x0400}, /* 04,00,00,bb */
167 {0xdd, 0x00, 0x0010}, /* 00,00,10,dd */
168 {0xbb, 0x0f, 0x140f}, /* 14,0f,0f,bb */
169 {0xbb, 0xe0, 0x0c2e}, /* 0c,e0,2e,bb */
170 {0xbb, 0x01, 0x2000}, /* 20,01,00,bb */
171 {0xbb, 0x96, 0x2400}, /* 24,96,00,bb */
172 {0xbb, 0x06, 0x1006}, /* 10,06,06,bb */
173 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
174 {0xdd, 0x00, 0x0010}, /* 00,00,10,dd */
175 {0xaa, 0xfe, 0x0002}, /* 00,fe,02,aa */
176 {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,0a,cc */
177 {0xdd, 0x00, 0x0010}, /* 00,00,10,dd */
178 {0xbb, 0x5f, 0x2090}, /* 20,5f,90,bb */
179 {0xbb, 0x01, 0x8000}, /* 80,01,00,bb */
180 {0xbb, 0x09, 0x8400}, /* 84,09,00,bb */
181 {0xbb, 0x86, 0x0002}, /* 00,86,02,bb */
182 {0xbb, 0xe6, 0x0401}, /* 04,e6,01,bb */
183 {0xbb, 0x86, 0x0802}, /* 08,86,02,bb */
184 {0xbb, 0xe6, 0x0c01}, /* 0c,e6,01,bb */
185 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
186 {0xdd, 0x00, 0x0010}, /* 00,00,10,dd */
187 {0xaa, 0xfe, 0x0000}, /* 00,fe,00,aa */
188 {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,0a,cc */
189 {0xdd, 0x00, 0x0010}, /* 00,00,10,dd */
190 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
191 {0xaa, 0xfe, 0x0020}, /* 00,fe,20,aa */
192 /*mswin+*/
193 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT},
194 {0xaa, 0xfe, 0x0002},
195 {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT},
196 {0xaa, 0xb4, 0xcd37},
197 {0xaa, 0xa4, 0x0004},
198 {0xaa, 0xa8, 0x0007},
199 {0xaa, 0xac, 0x0004},
200 /*mswin-*/
201 {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,0a,cc */
202 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
203 {0xdd, 0x00, 0x0010}, /* 00,00,10,dd */
204 {0xaa, 0xfe, 0x0000}, /* 00,fe,00,aa */
205 {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,0a,cc */
206 {0xdd, 0x00, 0x0010}, /* 00,00,10,dd */
207 {0xbb, 0x04, 0x0400}, /* 04,04,00,bb */
208 {0xdd, 0x00, 0x0100}, /* 00,01,00,dd */
209 {0xbb, 0x01, 0x0400}, /* 04,01,00,bb */
210 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
211 {0xaa, 0xfe, 0x0002}, /* 00,fe,02,aa */
212 {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,0a,cc */
213 {0xbb, 0x41, 0x2803}, /* 28,41,03,bb */
214 {0xbb, 0x40, 0x2c03}, /* 2c,40,03,bb */
215 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
216 {0xaa, 0xfe, 0x0010}, /* 00,fe,10,aa */
217 {}
218 };
219 static const struct usb_action adcm2700_InitialScale[] = {
220 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */
221 {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT}, /* 00,02,10,cc */
222 {0xa0, 0x00, ZC3XX_R008_CLOCKSETTING}, /* 00,08,03,cc */
223 {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,0a,cc */
224 {0xa0, 0xd3, ZC3XX_R08B_I2CDEVICEADDR}, /* 00,8b,d3,cc */
225 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, /* 00,03,02,cc */
226 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, /* 00,04,80,cc */
227 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* 00,05,01,cc */
228 {0xa0, 0xd0, ZC3XX_R006_FRAMEHEIGHTLOW}, /* 00,06,d0,cc */
229 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* 00,01,01,cc */
230 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,03,cc */
231 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,01,cc */
232 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,05,cc */
233 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, /* 00,98,00,cc */
234 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, /* 00,9a,00,cc */
235 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* 01,1a,00,cc */
236 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, /* 01,1c,00,cc */
237 {0xa0, 0xd8, ZC3XX_R09C_WINHEIGHTLOW}, /* 00,9c,d8,cc */
238 {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW}, /* 00,9e,88,cc */
239 {0xbb, 0x00, 0x0400}, /* 04,00,00,bb */
240 {0xdd, 0x00, 0x0010}, /* 00,00,10,dd */
241 {0xbb, 0x0f, 0x140f}, /* 14,0f,0f,bb */
242 {0xa0, 0xb7, ZC3XX_R101_SENSORCORRECTION}, /* 01,01,37,cc */
243 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0d,cc */
244 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* 01,89,06,cc */
245 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* 01,c5,03,cc */
246 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* 01,cb,13,cc */
247 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* 02,50,08,cc */
248 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* 03,01,08,cc */
249 {0xa0, 0x58, ZC3XX_R116_RGAIN}, /* 01,16,58,cc */
250 {0xa0, 0x5a, ZC3XX_R118_BGAIN}, /* 01,18,5a,cc */
251 {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,02,cc */
252 {0xa0, 0xd3, ZC3XX_R08B_I2CDEVICEADDR}, /* 00,8b,d3,cc */
253 {0xbb, 0x00, 0x0408}, /* 04,00,08,bb */
254 {0xdd, 0x00, 0x0200}, /* 00,02,00,dd */
255 {0xbb, 0x00, 0x0400}, /* 04,00,00,bb */
256 {0xdd, 0x00, 0x0050}, /* 00,00,50,dd */
257 {0xbb, 0x0f, 0x140f}, /* 14,0f,0f,bb */
258 {0xbb, 0xe0, 0x0c2e}, /* 0c,e0,2e,bb */
259 {0xbb, 0x01, 0x2000}, /* 20,01,00,bb */
260 {0xbb, 0x96, 0x2400}, /* 24,96,00,bb */
261 {0xbb, 0x06, 0x1006}, /* 10,06,06,bb */
262 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
263 {0xdd, 0x00, 0x0010}, /* 00,00,10,dd */
264 {0xaa, 0xfe, 0x0002}, /* 00,fe,02,aa */
265 {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,0a,cc */
266 {0xdd, 0x00, 0x0010}, /* 00,00,10,dd */
267 {0xbb, 0x5f, 0x2090}, /* 20,5f,90,bb */
268 {0xbb, 0x01, 0x8000}, /* 80,01,00,bb */
269 {0xbb, 0x09, 0x8400}, /* 84,09,00,bb */
270 {0xbb, 0x86, 0x0002}, /* 00,88,02,bb */
271 {0xbb, 0xe6, 0x0401}, /* 04,e6,01,bb */
272 {0xbb, 0x86, 0x0802}, /* 08,88,02,bb */
273 {0xbb, 0xe6, 0x0c01}, /* 0c,e6,01,bb */
274 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
275 {0xdd, 0x00, 0x0010}, /* 00,00,10,dd */
276 {0xaa, 0xfe, 0x0000}, /* 00,fe,00,aa */
277 {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,0a,cc */
278 {0xdd, 0x00, 0x0010}, /* 00,00,10,dd */
279 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
280 {0xaa, 0xfe, 0x0020}, /* 00,fe,20,aa */
281 /*******/
282 {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,0a,cc */
283 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
284 {0xdd, 0x00, 0x0010}, /* 00,00,10,dd */
285 {0xaa, 0xfe, 0x0000}, /* 00,fe,00,aa */
286 {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,0a,cc */
287 {0xdd, 0x00, 0x0010}, /* 00,00,10,dd */
288 {0xbb, 0x04, 0x0400}, /* 04,04,00,bb */
289 {0xdd, 0x00, 0x0100}, /* 00,01,00,dd */
290 {0xbb, 0x01, 0x0400}, /* 04,01,00,bb */
291 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
292 {0xaa, 0xfe, 0x0002}, /* 00,fe,02,aa */
293 {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,0a,cc */
294 {0xbb, 0x41, 0x2803}, /* 28,41,03,bb */
295 {0xbb, 0x40, 0x2c03}, /* 2c,40,03,bb */
296 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
297 {0xaa, 0xfe, 0x0010}, /* 00,fe,10,aa */
298 {}
299 };
300 static const struct usb_action adcm2700_50HZ[] = {
301 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
302 {0xaa, 0xfe, 0x0002}, /* 00,fe,02,aa */
303 {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,0a,cc */
304 {0xbb, 0x05, 0x8400}, /* 84,05,00,bb */
305 {0xbb, 0xd0, 0xb007}, /* b0,d0,07,bb */
306 {0xbb, 0xa0, 0xb80f}, /* b8,a0,0f,bb */
307 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
308 {0xaa, 0xfe, 0x0010}, /* 00,fe,10,aa */
309 {0xaa, 0x26, 0x00d0}, /* 00,26,d0,aa */
310 {0xaa, 0x28, 0x0002}, /* 00,28,02,aa */
311 {}
312 };
313 static const struct usb_action adcm2700_60HZ[] = {
314 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
315 {0xaa, 0xfe, 0x0002}, /* 00,fe,02,aa */
316 {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,0a,cc */
317 {0xbb, 0x07, 0x8400}, /* 84,07,00,bb */
318 {0xbb, 0x82, 0xb006}, /* b0,82,06,bb */
319 {0xbb, 0x04, 0xb80d}, /* b8,04,0d,bb */
320 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
321 {0xaa, 0xfe, 0x0010}, /* 00,fe,10,aa */
322 {0xaa, 0x26, 0x0057}, /* 00,26,57,aa */
323 {0xaa, 0x28, 0x0002}, /* 00,28,02,aa */
324 {}
325 };
326 static const struct usb_action adcm2700_NoFlicker[] = {
327 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
328 {0xaa, 0xfe, 0x0002}, /* 00,fe,02,aa */
329 {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,0a,cc */
330 {0xbb, 0x07, 0x8400}, /* 84,07,00,bb */
331 {0xbb, 0x05, 0xb000}, /* b0,05,00,bb */
332 {0xbb, 0xa0, 0xb801}, /* b8,a0,01,bb */
333 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
334 {0xaa, 0xfe, 0x0010}, /* 00,fe,10,aa */
335 {}
336 };
337 static const struct usb_action cs2102_InitialScale[] = { /* 320x240 */
338 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
339 {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT},
340 {0xa0, 0x00, ZC3XX_R010_CMOSSENSORSELECT},
341 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
342 {0xa0, 0x20, ZC3XX_R080_HBLANKHIGH},
343 {0xa0, 0x21, ZC3XX_R081_HBLANKLOW},
344 {0xa0, 0x30, ZC3XX_R083_RGAINADDR},
345 {0xa0, 0x31, ZC3XX_R084_GGAINADDR},
346 {0xa0, 0x32, ZC3XX_R085_BGAINADDR},
347 {0xa0, 0x23, ZC3XX_R086_EXPTIMEHIGH},
348 {0xa0, 0x24, ZC3XX_R087_EXPTIMEMID},
349 {0xa0, 0x25, ZC3XX_R088_EXPTIMELOW},
350 {0xa0, 0xb3, ZC3XX_R08B_I2CDEVICEADDR},
351 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00 */
352 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC},
353 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC},
354 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH},
355 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW},
356 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},
357 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW},
358 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW},
359 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW},
360 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW},
361 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW},
362 {0xaa, 0x02, 0x0008},
363 {0xaa, 0x03, 0x0000},
364 {0xaa, 0x11, 0x0000},
365 {0xaa, 0x12, 0x0089},
366 {0xaa, 0x13, 0x0000},
367 {0xaa, 0x14, 0x00e9},
368 {0xaa, 0x20, 0x0000},
369 {0xaa, 0x22, 0x0000},
370 {0xaa, 0x0b, 0x0004},
371 {0xaa, 0x30, 0x0030},
372 {0xaa, 0x31, 0x0030},
373 {0xaa, 0x32, 0x0030},
374 {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION},
375 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
376 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
377 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
378 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
379 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
380 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
381 {0xa0, 0x10, 0x01ae},
382 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
383 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
384 {0xa0, 0x68, ZC3XX_R18D_YTARGET},
385 {0xa0, 0x00, 0x01ad},
386 {}
387 };
388
389 static const struct usb_action cs2102_Initial[] = { /* 640x480 */
390 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
391 {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT},
392 {0xa0, 0x00, ZC3XX_R010_CMOSSENSORSELECT},
393 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
394 {0xa0, 0x20, ZC3XX_R080_HBLANKHIGH},
395 {0xa0, 0x21, ZC3XX_R081_HBLANKLOW},
396 {0xa0, 0x30, ZC3XX_R083_RGAINADDR},
397 {0xa0, 0x31, ZC3XX_R084_GGAINADDR},
398 {0xa0, 0x32, ZC3XX_R085_BGAINADDR},
399 {0xa0, 0x23, ZC3XX_R086_EXPTIMEHIGH},
400 {0xa0, 0x24, ZC3XX_R087_EXPTIMEMID},
401 {0xa0, 0x25, ZC3XX_R088_EXPTIMELOW},
402 {0xa0, 0xb3, ZC3XX_R08B_I2CDEVICEADDR},
403 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00 */
404 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC},
405 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC},
406 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH},
407 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW},
408 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},
409 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW},
410 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW},
411 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW},
412 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW},
413 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW},
414 {0xaa, 0x02, 0x0008},
415 {0xaa, 0x03, 0x0000},
416 {0xaa, 0x11, 0x0001},
417 {0xaa, 0x12, 0x0087},
418 {0xaa, 0x13, 0x0001},
419 {0xaa, 0x14, 0x00e7},
420 {0xaa, 0x20, 0x0000},
421 {0xaa, 0x22, 0x0000},
422 {0xaa, 0x0b, 0x0004},
423 {0xaa, 0x30, 0x0030},
424 {0xaa, 0x31, 0x0030},
425 {0xaa, 0x32, 0x0030},
426 {0xa0, 0x77, ZC3XX_R101_SENSORCORRECTION},
427 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
428 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
429 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
430 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
431 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
432 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
433 {0xa0, 0x15, 0x01ae},
434 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
435 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
436 {0xa0, 0x68, ZC3XX_R18D_YTARGET},
437 {0xa0, 0x00, 0x01ad},
438 {}
439 };
440 static const struct usb_action cs2102_50HZScale[] = {
441 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
442 {0xaa, 0x23, 0x0001},
443 {0xaa, 0x24, 0x005f},
444 {0xaa, 0x25, 0x0090},
445 {0xaa, 0x21, 0x00dd},
446 {0xa0, 0x02, ZC3XX_R190_EXPOSURELIMITHIGH},
447 {0xa0, 0xbf, ZC3XX_R191_EXPOSURELIMITMID},
448 {0xa0, 0x20, ZC3XX_R192_EXPOSURELIMITLOW},
449 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
450 {0xa0, 0x3a, ZC3XX_R196_ANTIFLICKERMID},
451 {0xa0, 0x98, ZC3XX_R197_ANTIFLICKERLOW},
452 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE},
453 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},
454 {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF},
455 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP},
456 {0xa0, 0xdd, ZC3XX_R01D_HSYNC_0},
457 {0xa0, 0xe4, ZC3XX_R01E_HSYNC_1},
458 {0xa0, 0xf0, ZC3XX_R01F_HSYNC_2},
459 {0xa0, 0xff, ZC3XX_R020_HSYNC_3},
460 {}
461 };
462 static const struct usb_action cs2102_50HZ[] = {
463 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
464 {0xaa, 0x23, 0x0000},
465 {0xaa, 0x24, 0x00af},
466 {0xaa, 0x25, 0x00c8},
467 {0xaa, 0x21, 0x0068},
468 {0xa0, 0x01, ZC3XX_R190_EXPOSURELIMITHIGH},
469 {0xa0, 0x5f, ZC3XX_R191_EXPOSURELIMITMID},
470 {0xa0, 0x90, ZC3XX_R192_EXPOSURELIMITLOW},
471 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
472 {0xa0, 0x1d, ZC3XX_R196_ANTIFLICKERMID},
473 {0xa0, 0x4c, ZC3XX_R197_ANTIFLICKERLOW},
474 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE},
475 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},
476 {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF},
477 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP},
478 {0xa0, 0x68, ZC3XX_R01D_HSYNC_0},
479 {0xa0, 0xe3, ZC3XX_R01E_HSYNC_1},
480 {0xa0, 0xf0, ZC3XX_R01F_HSYNC_2},
481 {0xa0, 0xff, ZC3XX_R020_HSYNC_3},
482 {}
483 };
484 static const struct usb_action cs2102_60HZScale[] = {
485 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
486 {0xaa, 0x23, 0x0001},
487 {0xaa, 0x24, 0x0055},
488 {0xaa, 0x25, 0x00cc},
489 {0xaa, 0x21, 0x003f},
490 {0xa0, 0x02, ZC3XX_R190_EXPOSURELIMITHIGH},
491 {0xa0, 0xab, ZC3XX_R191_EXPOSURELIMITMID},
492 {0xa0, 0x98, ZC3XX_R192_EXPOSURELIMITLOW},
493 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
494 {0xa0, 0x30, ZC3XX_R196_ANTIFLICKERMID},
495 {0xa0, 0xd4, ZC3XX_R197_ANTIFLICKERLOW},
496 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE},
497 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},
498 {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF},
499 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP},
500 {0xa0, 0x39, ZC3XX_R01D_HSYNC_0},
501 {0xa0, 0x70, ZC3XX_R01E_HSYNC_1},
502 {0xa0, 0xb0, ZC3XX_R01F_HSYNC_2},
503 {0xa0, 0xff, ZC3XX_R020_HSYNC_3},
504 {}
505 };
506 static const struct usb_action cs2102_60HZ[] = {
507 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
508 {0xaa, 0x23, 0x0000},
509 {0xaa, 0x24, 0x00aa},
510 {0xaa, 0x25, 0x00e6},
511 {0xaa, 0x21, 0x003f},
512 {0xa0, 0x01, ZC3XX_R190_EXPOSURELIMITHIGH},
513 {0xa0, 0x55, ZC3XX_R191_EXPOSURELIMITMID},
514 {0xa0, 0xcc, ZC3XX_R192_EXPOSURELIMITLOW},
515 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
516 {0xa0, 0x18, ZC3XX_R196_ANTIFLICKERMID},
517 {0xa0, 0x6a, ZC3XX_R197_ANTIFLICKERLOW},
518 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE},
519 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},
520 {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF},
521 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP},
522 {0xa0, 0x3f, ZC3XX_R01D_HSYNC_0},
523 {0xa0, 0xa5, ZC3XX_R01E_HSYNC_1},
524 {0xa0, 0xf0, ZC3XX_R01F_HSYNC_2},
525 {0xa0, 0xff, ZC3XX_R020_HSYNC_3},
526 {}
527 };
528 static const struct usb_action cs2102_NoFlickerScale[] = {
529 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
530 {0xaa, 0x23, 0x0001},
531 {0xaa, 0x24, 0x005f},
532 {0xaa, 0x25, 0x0000},
533 {0xaa, 0x21, 0x0001},
534 {0xa0, 0x02, ZC3XX_R190_EXPOSURELIMITHIGH},
535 {0xa0, 0xbf, ZC3XX_R191_EXPOSURELIMITMID},
536 {0xa0, 0x00, ZC3XX_R192_EXPOSURELIMITLOW},
537 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
538 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
539 {0xa0, 0x80, ZC3XX_R197_ANTIFLICKERLOW},
540 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE},
541 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},
542 {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF},
543 {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP},
544 {0xa0, 0x01, ZC3XX_R01D_HSYNC_0},
545 {0xa0, 0x40, ZC3XX_R01E_HSYNC_1},
546 {0xa0, 0xa0, ZC3XX_R01F_HSYNC_2},
547 {0xa0, 0xff, ZC3XX_R020_HSYNC_3},
548 {}
549 };
550 static const struct usb_action cs2102_NoFlicker[] = {
551 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
552 {0xaa, 0x23, 0x0000},
553 {0xaa, 0x24, 0x00af},
554 {0xaa, 0x25, 0x0080},
555 {0xaa, 0x21, 0x0001},
556 {0xa0, 0x01, ZC3XX_R190_EXPOSURELIMITHIGH},
557 {0xa0, 0x5f, ZC3XX_R191_EXPOSURELIMITMID},
558 {0xa0, 0x80, ZC3XX_R192_EXPOSURELIMITLOW},
559 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
560 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
561 {0xa0, 0x80, ZC3XX_R197_ANTIFLICKERLOW},
562 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE},
563 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},
564 {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF},
565 {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP},
566 {0xa0, 0x01, ZC3XX_R01D_HSYNC_0},
567 {0xa0, 0x40, ZC3XX_R01E_HSYNC_1},
568 {0xa0, 0xa0, ZC3XX_R01F_HSYNC_2},
569 {0xa0, 0xff, ZC3XX_R020_HSYNC_3},
570 {}
571 };
572
573 /* CS2102_KOCOM */
574 static const struct usb_action cs2102K_InitialScale[] = {
575 {0xa0, 0x11, ZC3XX_R002_CLOCKSELECT},
576 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
577 {0xa0, 0x08, ZC3XX_R010_CMOSSENSORSELECT},
578 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH},
579 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW},
580 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},
581 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW},
582 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
583 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC},
584 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC},
585 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW},
586 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW},
587 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW},
588 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW},
589 {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW},
590 {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW},
591 {0xa0, 0x55, ZC3XX_R08B_I2CDEVICEADDR},
592 {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT},
593 {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE},
594 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
595 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
596 {0xa0, 0x0a, ZC3XX_R092_I2CADDRESSSELECT},
597 {0xa0, 0x02, ZC3XX_R093_I2CSETVALUE},
598 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
599 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
600 {0xa0, 0x0b, ZC3XX_R092_I2CADDRESSSELECT},
601 {0xa0, 0x02, ZC3XX_R093_I2CSETVALUE},
602 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
603 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
604 {0xa0, 0x0c, ZC3XX_R092_I2CADDRESSSELECT},
605 {0xa0, 0x7c, ZC3XX_R093_I2CSETVALUE},
606 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
607 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
608 {0xa0, 0x0d, ZC3XX_R092_I2CADDRESSSELECT},
609 {0xa0, 0xa3, ZC3XX_R093_I2CSETVALUE},
610 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
611 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
612 {0xa0, 0x03, ZC3XX_R092_I2CADDRESSSELECT},
613 {0xa0, 0xfb, ZC3XX_R093_I2CSETVALUE},
614 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
615 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
616 {0xa0, 0x05, ZC3XX_R092_I2CADDRESSSELECT},
617 {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE},
618 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
619 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
620 {0xa0, 0x06, ZC3XX_R092_I2CADDRESSSELECT},
621 {0xa0, 0x03, ZC3XX_R093_I2CSETVALUE},
622 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
623 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
624 {0xa0, 0x09, ZC3XX_R092_I2CADDRESSSELECT},
625 {0xa0, 0x08, ZC3XX_R093_I2CSETVALUE},
626 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
627 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
628 {0xa0, 0x0e, ZC3XX_R092_I2CADDRESSSELECT},
629 {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE},
630 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
631 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
632 {0xa0, 0x0f, ZC3XX_R092_I2CADDRESSSELECT},
633 {0xa0, 0x18, ZC3XX_R093_I2CSETVALUE},
634 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
635 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
636 {0xa0, 0x10, ZC3XX_R092_I2CADDRESSSELECT},
637 {0xa0, 0x18, ZC3XX_R093_I2CSETVALUE},
638 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
639 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
640 {0xa0, 0x11, ZC3XX_R092_I2CADDRESSSELECT},
641 {0xa0, 0x18, ZC3XX_R093_I2CSETVALUE},
642 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
643 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
644 {0xa0, 0x12, ZC3XX_R092_I2CADDRESSSELECT},
645 {0xa0, 0x18, ZC3XX_R093_I2CSETVALUE},
646 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
647 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
648 {0xa0, 0x15, ZC3XX_R092_I2CADDRESSSELECT},
649 {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE},
650 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
651 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
652 {0xa0, 0x16, ZC3XX_R092_I2CADDRESSSELECT},
653 {0xa0, 0x0c, ZC3XX_R093_I2CSETVALUE},
654 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
655 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
656 {0xa0, 0x17, ZC3XX_R092_I2CADDRESSSELECT},
657 {0xa0, 0x0c, ZC3XX_R093_I2CSETVALUE},
658 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
659 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
660 {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT},
661 {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE},
662 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
663 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
664 {0xa0, 0xb7, ZC3XX_R101_SENSORCORRECTION},
665 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
666 {0xa0, 0x78, ZC3XX_R18D_YTARGET},
667 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
668 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
669 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
670 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
671 {0xa0, 0x20, ZC3XX_R087_EXPTIMEMID},
672 {0xa0, 0x21, ZC3XX_R088_EXPTIMELOW},
673 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
674 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
675 {0xa0, 0x00, 0x01ad},
676 {0xa0, 0x01, 0x01b1},
677 {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE},
678 {0xa0, 0x60, ZC3XX_R116_RGAIN},
679 {0xa0, 0x40, ZC3XX_R117_GGAIN},
680 {0xa0, 0x4c, ZC3XX_R118_BGAIN},
681 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */
682 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */
683 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */
684 {0xa0, 0x13, ZC3XX_R120_GAMMA00}, /* gamma 4 */
685 {0xa0, 0x38, ZC3XX_R121_GAMMA01},
686 {0xa0, 0x59, ZC3XX_R122_GAMMA02},
687 {0xa0, 0x79, ZC3XX_R123_GAMMA03},
688 {0xa0, 0x92, ZC3XX_R124_GAMMA04},
689 {0xa0, 0xa7, ZC3XX_R125_GAMMA05},
690 {0xa0, 0xb9, ZC3XX_R126_GAMMA06},
691 {0xa0, 0xc8, ZC3XX_R127_GAMMA07},
692 {0xa0, 0xd4, ZC3XX_R128_GAMMA08},
693 {0xa0, 0xdf, ZC3XX_R129_GAMMA09},
694 {0xa0, 0xe7, ZC3XX_R12A_GAMMA0A},
695 {0xa0, 0xee, ZC3XX_R12B_GAMMA0B},
696 {0xa0, 0xf4, ZC3XX_R12C_GAMMA0C},
697 {0xa0, 0xf9, ZC3XX_R12D_GAMMA0D},
698 {0xa0, 0xfc, ZC3XX_R12E_GAMMA0E},
699 {0xa0, 0xff, ZC3XX_R12F_GAMMA0F},
700 {0xa0, 0x26, ZC3XX_R130_GAMMA10},
701 {0xa0, 0x22, ZC3XX_R131_GAMMA11},
702 {0xa0, 0x20, ZC3XX_R132_GAMMA12},
703 {0xa0, 0x1c, ZC3XX_R133_GAMMA13},
704 {0xa0, 0x16, ZC3XX_R134_GAMMA14},
705 {0xa0, 0x13, ZC3XX_R135_GAMMA15},
706 {0xa0, 0x10, ZC3XX_R136_GAMMA16},
707 {0xa0, 0x0d, ZC3XX_R137_GAMMA17},
708 {0xa0, 0x0b, ZC3XX_R138_GAMMA18},
709 {0xa0, 0x09, ZC3XX_R139_GAMMA19},
710 {0xa0, 0x07, ZC3XX_R13A_GAMMA1A},
711 {0xa0, 0x06, ZC3XX_R13B_GAMMA1B},
712 {0xa0, 0x05, ZC3XX_R13C_GAMMA1C},
713 {0xa0, 0x04, ZC3XX_R13D_GAMMA1D},
714 {0xa0, 0x03, ZC3XX_R13E_GAMMA1E},
715 {0xa0, 0x02, ZC3XX_R13F_GAMMA1F},
716 {0xa0, 0x58, ZC3XX_R10A_RGB00}, /* matrix */
717 {0xa0, 0xf4, ZC3XX_R10B_RGB01},
718 {0xa0, 0xf4, ZC3XX_R10C_RGB02},
719 {0xa0, 0xf4, ZC3XX_R10D_RGB10},
720 {0xa0, 0x58, ZC3XX_R10E_RGB11},
721 {0xa0, 0xf4, ZC3XX_R10F_RGB12},
722 {0xa0, 0xf4, ZC3XX_R110_RGB20},
723 {0xa0, 0xf4, ZC3XX_R111_RGB21},
724 {0xa0, 0x58, ZC3XX_R112_RGB22},
725 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
726 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
727 {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT},
728 {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE},
729 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
730 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
731 {0xa0, 0x13, ZC3XX_R092_I2CADDRESSSELECT},
732 {0xa0, 0x22, ZC3XX_R093_I2CSETVALUE},
733 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
734 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
735 {0xa0, 0x14, ZC3XX_R092_I2CADDRESSSELECT},
736 {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE},
737 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
738 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
739 {0xa0, 0x20, ZC3XX_R092_I2CADDRESSSELECT},
740 {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE},
741 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
742 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
743 {0xa0, 0x21, ZC3XX_R092_I2CADDRESSSELECT},
744 {0xa0, 0x22, ZC3XX_R093_I2CSETVALUE},
745 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
746 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
747 {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT},
748 {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE},
749 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
750 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
751 {0xa0, 0x01, ZC3XX_R0A3_EXPOSURETIMEHIGH},
752 {0xa0, 0x22, ZC3XX_R0A4_EXPOSURETIMELOW},
753 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
754 {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID},
755 {0xa0, 0xee, ZC3XX_R192_EXPOSURELIMITLOW},
756 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
757 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
758 {0xa0, 0x3a, ZC3XX_R197_ANTIFLICKERLOW},
759 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE},
760 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},
761 {0xa0, 0x0c, ZC3XX_R1A9_DIGITALLIMITDIFF},
762 {0xa0, 0x28, ZC3XX_R1AA_DIGITALGAINSTEP},
763 {0xa0, 0x04, ZC3XX_R01D_HSYNC_0},
764 {0xa0, 0x0f, ZC3XX_R01E_HSYNC_1},
765 {0xa0, 0x19, ZC3XX_R01F_HSYNC_2},
766 {0xa0, 0x1f, ZC3XX_R020_HSYNC_3},
767 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN},
768 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN},
769 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
770 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
771 {0xa0, 0x60, ZC3XX_R116_RGAIN},
772 {0xa0, 0x40, ZC3XX_R117_GGAIN},
773 {0xa0, 0x4c, ZC3XX_R118_BGAIN},
774 {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN},
775 {0xa0, 0x20, ZC3XX_R092_I2CADDRESSSELECT},
776 {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE},
777 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
778 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
779 {0xa0, 0x21, ZC3XX_R092_I2CADDRESSSELECT},
780 {0xa0, 0x5c, ZC3XX_R093_I2CSETVALUE},
781 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
782 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
783 {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT},
784 {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE},
785 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
786 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
787 {0xa0, 0x13, ZC3XX_R092_I2CADDRESSSELECT},
788 {0xa0, 0x5c, ZC3XX_R093_I2CSETVALUE},
789 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
790 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
791 {0xa0, 0x14, ZC3XX_R092_I2CADDRESSSELECT},
792 {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE},
793 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
794 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
795 {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT},
796 {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE},
797 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
798 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
799 {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN},
800 {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN},
801 {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN},
802 {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN},
803 {0xa0, 0x20, ZC3XX_R092_I2CADDRESSSELECT},
804 {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE},
805 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
806 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
807 {0xa0, 0x21, ZC3XX_R092_I2CADDRESSSELECT},
808 {0xa0, 0x96, ZC3XX_R093_I2CSETVALUE},
809 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
810 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
811 {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT},
812 {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE},
813 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
814 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
815 {0xa0, 0x13, ZC3XX_R092_I2CADDRESSSELECT},
816 {0xa0, 0x96, ZC3XX_R093_I2CSETVALUE},
817 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
818 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
819 {0xa0, 0x14, ZC3XX_R092_I2CADDRESSSELECT},
820 {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE},
821 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
822 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
823 {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT},
824 {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE},
825 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
826 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
827 {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN},
828 {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN},
829 {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN},
830 {}
831 };
832
833 static const struct usb_action cs2102K_Initial[] = {
834 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
835 {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT},
836 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
837 {0xa0, 0x08, ZC3XX_R010_CMOSSENSORSELECT},
838 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH},
839 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW},
840 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},
841 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW},
842 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
843 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC},
844 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC},
845 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW},
846 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW},
847 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW},
848 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW},
849 {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW},
850 {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW},
851 /*fixme: next sequence = i2c exchanges*/
852 {0xa0, 0x55, ZC3XX_R08B_I2CDEVICEADDR},
853 {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT},
854 {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE},
855 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
856 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
857 {0xa0, 0x0a, ZC3XX_R092_I2CADDRESSSELECT},
858 {0xa0, 0x02, ZC3XX_R093_I2CSETVALUE},
859 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
860 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
861 {0xa0, 0x0b, ZC3XX_R092_I2CADDRESSSELECT},
862 {0xa0, 0x02, ZC3XX_R093_I2CSETVALUE},
863 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
864 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
865 {0xa0, 0x0c, ZC3XX_R092_I2CADDRESSSELECT},
866 {0xa0, 0x7b, ZC3XX_R093_I2CSETVALUE},
867 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
868 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
869 {0xa0, 0x0d, ZC3XX_R092_I2CADDRESSSELECT},
870 {0xa0, 0xa3, ZC3XX_R093_I2CSETVALUE},
871 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
872 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
873 {0xa0, 0x03, ZC3XX_R092_I2CADDRESSSELECT},
874 {0xa0, 0xfb, ZC3XX_R093_I2CSETVALUE},
875 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
876 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
877 {0xa0, 0x05, ZC3XX_R092_I2CADDRESSSELECT},
878 {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE},
879 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
880 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
881 {0xa0, 0x06, ZC3XX_R092_I2CADDRESSSELECT},
882 {0xa0, 0x03, ZC3XX_R093_I2CSETVALUE},
883 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
884 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
885 {0xa0, 0x09, ZC3XX_R092_I2CADDRESSSELECT},
886 {0xa0, 0x08, ZC3XX_R093_I2CSETVALUE},
887 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
888 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
889 {0xa0, 0x0e, ZC3XX_R092_I2CADDRESSSELECT},
890 {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE},
891 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
892 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
893 {0xa0, 0x0f, ZC3XX_R092_I2CADDRESSSELECT},
894 {0xa0, 0x18, ZC3XX_R093_I2CSETVALUE},
895 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
896 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
897 {0xa0, 0x10, ZC3XX_R092_I2CADDRESSSELECT},
898 {0xa0, 0x18, ZC3XX_R093_I2CSETVALUE},
899 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
900 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
901 {0xa0, 0x11, ZC3XX_R092_I2CADDRESSSELECT},
902 {0xa0, 0x18, ZC3XX_R093_I2CSETVALUE},
903 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
904 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
905 {0xa0, 0x12, ZC3XX_R092_I2CADDRESSSELECT},
906 {0xa0, 0x18, ZC3XX_R093_I2CSETVALUE},
907 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
908 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
909 {0xa0, 0x15, ZC3XX_R092_I2CADDRESSSELECT},
910 {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE},
911 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
912 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
913 {0xa0, 0x16, ZC3XX_R092_I2CADDRESSSELECT},
914 {0xa0, 0x0c, ZC3XX_R093_I2CSETVALUE},
915 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
916 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
917 {0xa0, 0x17, ZC3XX_R092_I2CADDRESSSELECT},
918 {0xa0, 0x0c, ZC3XX_R093_I2CSETVALUE},
919 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
920 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
921 {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT},
922 {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE},
923 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
924 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
925 {0xa0, 0xf7, ZC3XX_R101_SENSORCORRECTION},
926 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
927 {0xa0, 0x78, ZC3XX_R18D_YTARGET},
928 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
929 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
930 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
931 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
932 {0xa0, 0x20, ZC3XX_R087_EXPTIMEMID},
933 {0xa0, 0x21, ZC3XX_R088_EXPTIMELOW},
934 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
935 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
936 {0xa0, 0x00, 0x01ad},
937 {0xa0, 0x01, 0x01b1},
938 {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE},
939 {0xa0, 0x60, ZC3XX_R116_RGAIN},
940 {0xa0, 0x40, ZC3XX_R117_GGAIN},
941 {0xa0, 0x4c, ZC3XX_R118_BGAIN},
942 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */
943 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */
944 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */
945 {0xa0, 0x13, ZC3XX_R120_GAMMA00}, /* gamma 4 */
946 {0xa0, 0x38, ZC3XX_R121_GAMMA01},
947 {0xa0, 0x59, ZC3XX_R122_GAMMA02},
948 {0xa0, 0x79, ZC3XX_R123_GAMMA03},
949 {0xa0, 0x92, ZC3XX_R124_GAMMA04},
950 {0xa0, 0xa7, ZC3XX_R125_GAMMA05},
951 {0xa0, 0xb9, ZC3XX_R126_GAMMA06},
952 {0xa0, 0xc8, ZC3XX_R127_GAMMA07},
953 {0xa0, 0xd4, ZC3XX_R128_GAMMA08},
954 {0xa0, 0xdf, ZC3XX_R129_GAMMA09},
955 {0xa0, 0xe7, ZC3XX_R12A_GAMMA0A},
956 {0xa0, 0xee, ZC3XX_R12B_GAMMA0B},
957 {0xa0, 0xf4, ZC3XX_R12C_GAMMA0C},
958 {0xa0, 0xf9, ZC3XX_R12D_GAMMA0D},
959 {0xa0, 0xfc, ZC3XX_R12E_GAMMA0E},
960 {0xa0, 0xff, ZC3XX_R12F_GAMMA0F},
961 {0xa0, 0x26, ZC3XX_R130_GAMMA10},
962 {0xa0, 0x22, ZC3XX_R131_GAMMA11},
963 {0xa0, 0x20, ZC3XX_R132_GAMMA12},
964 {0xa0, 0x1c, ZC3XX_R133_GAMMA13},
965 {0xa0, 0x16, ZC3XX_R134_GAMMA14},
966 {0xa0, 0x13, ZC3XX_R135_GAMMA15},
967 {0xa0, 0x10, ZC3XX_R136_GAMMA16},
968 {0xa0, 0x0d, ZC3XX_R137_GAMMA17},
969 {0xa0, 0x0b, ZC3XX_R138_GAMMA18},
970 {0xa0, 0x09, ZC3XX_R139_GAMMA19},
971 {0xa0, 0x07, ZC3XX_R13A_GAMMA1A},
972 {0xa0, 0x06, ZC3XX_R13B_GAMMA1B},
973 {0xa0, 0x05, ZC3XX_R13C_GAMMA1C},
974 {0xa0, 0x04, ZC3XX_R13D_GAMMA1D},
975 {0xa0, 0x03, ZC3XX_R13E_GAMMA1E},
976 {0xa0, 0x02, ZC3XX_R13F_GAMMA1F},
977 {0xa0, 0x58, ZC3XX_R10A_RGB00}, /* matrix */
978 {0xa0, 0xf4, ZC3XX_R10B_RGB01},
979 {0xa0, 0xf4, ZC3XX_R10C_RGB02},
980 {0xa0, 0xf4, ZC3XX_R10D_RGB10},
981 {0xa0, 0x58, ZC3XX_R10E_RGB11},
982 {0xa0, 0xf4, ZC3XX_R10F_RGB12},
983 {0xa0, 0xf4, ZC3XX_R110_RGB20},
984 {0xa0, 0xf4, ZC3XX_R111_RGB21},
985 {0xa0, 0x58, ZC3XX_R112_RGB22},
986 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
987 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
988 {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT},
989 {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE},
990 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
991 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
992 {0xa0, 0x13, ZC3XX_R092_I2CADDRESSSELECT},
993 {0xa0, 0x22, ZC3XX_R093_I2CSETVALUE},
994 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
995 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
996 {0xa0, 0x14, ZC3XX_R092_I2CADDRESSSELECT},
997 {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE},
998 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
999 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1000 {0xa0, 0x20, ZC3XX_R092_I2CADDRESSSELECT},
1001 {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE},
1002 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1003 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1004 {0xa0, 0x21, ZC3XX_R092_I2CADDRESSSELECT},
1005 {0xa0, 0x22, ZC3XX_R093_I2CSETVALUE},
1006 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1007 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1008 {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT},
1009 {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE},
1010 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1011 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1012 {0xa0, 0x01, ZC3XX_R0A3_EXPOSURETIMEHIGH},
1013 {0xa0, 0x22, ZC3XX_R0A4_EXPOSURETIMELOW},
1014 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
1015 {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID},
1016 {0xa0, 0xee, ZC3XX_R192_EXPOSURELIMITLOW},
1017 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
1018 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
1019 {0xa0, 0x3a, ZC3XX_R197_ANTIFLICKERLOW},
1020 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE},
1021 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},
1022 {0xa0, 0x0c, ZC3XX_R1A9_DIGITALLIMITDIFF},
1023 {0xa0, 0x28, ZC3XX_R1AA_DIGITALGAINSTEP},
1024 {0xa0, 0x04, ZC3XX_R01D_HSYNC_0},
1025 {0xa0, 0x0f, ZC3XX_R01E_HSYNC_1},
1026 {0xa0, 0x19, ZC3XX_R01F_HSYNC_2},
1027 {0xa0, 0x1f, ZC3XX_R020_HSYNC_3},
1028 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN},
1029 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN},
1030 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
1031 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
1032 {0xa0, 0x60, ZC3XX_R116_RGAIN},
1033 {0xa0, 0x40, ZC3XX_R117_GGAIN},
1034 {0xa0, 0x4c, ZC3XX_R118_BGAIN},
1035 {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN},
1036 {0xa0, 0x20, ZC3XX_R092_I2CADDRESSSELECT},
1037 {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE},
1038 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1039 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1040 {0xa0, 0x21, ZC3XX_R092_I2CADDRESSSELECT},
1041 {0xa0, 0x5c, ZC3XX_R093_I2CSETVALUE},
1042 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1043 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1044 {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT},
1045 {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE},
1046 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1047 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1048 {0xa0, 0x13, ZC3XX_R092_I2CADDRESSSELECT},
1049 {0xa0, 0x5c, ZC3XX_R093_I2CSETVALUE},
1050 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1051 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1052 {0xa0, 0x14, ZC3XX_R092_I2CADDRESSSELECT},
1053 {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE},
1054 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1055 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1056 {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT},
1057 {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE},
1058 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1059 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1060 {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN},
1061 {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN},
1062 {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN},
1063 {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN},
1064 {0xa0, 0x20, ZC3XX_R092_I2CADDRESSSELECT},
1065 {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE},
1066 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1067 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1068 {0xa0, 0x21, ZC3XX_R092_I2CADDRESSSELECT},
1069 {0xa0, 0x96, ZC3XX_R093_I2CSETVALUE},
1070 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1071 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1072 {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT},
1073 {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE},
1074 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1075 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1076 {0xa0, 0x13, ZC3XX_R092_I2CADDRESSSELECT},
1077 {0xa0, 0x96, ZC3XX_R093_I2CSETVALUE},
1078 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1079 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1080 {0xa0, 0x14, ZC3XX_R092_I2CADDRESSSELECT},
1081 {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE},
1082 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1083 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1084 {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT},
1085 {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE},
1086 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1087 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1088 {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN},
1089 {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN},
1090 {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN},
1091 /*fixme:what does the next sequence?*/
1092 {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN},
1093 {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN},
1094 {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN},
1095 {0xa0, 0x20, ZC3XX_R092_I2CADDRESSSELECT},
1096 {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE},
1097 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1098 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1099 {0xa0, 0x21, ZC3XX_R092_I2CADDRESSSELECT},
1100 {0xa0, 0xd0, ZC3XX_R093_I2CSETVALUE},
1101 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1102 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1103 {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT},
1104 {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE},
1105 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1106 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1107 {0xa0, 0x13, ZC3XX_R092_I2CADDRESSSELECT},
1108 {0xa0, 0xd0, ZC3XX_R093_I2CSETVALUE},
1109 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1110 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1111 {0xa0, 0x14, ZC3XX_R092_I2CADDRESSSELECT},
1112 {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE},
1113 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1114 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1115 {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT},
1116 {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE},
1117 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1118 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1119 {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN},
1120 {0xa0, 0x02, ZC3XX_R008_CLOCKSETTING},
1121 {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN},
1122 {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN},
1123 {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN},
1124 {0xa0, 0x20, ZC3XX_R092_I2CADDRESSSELECT},
1125 {0xa0, 0x02, ZC3XX_R093_I2CSETVALUE},
1126 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1127 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1128 {0xa0, 0x21, ZC3XX_R092_I2CADDRESSSELECT},
1129 {0xa0, 0x0a, ZC3XX_R093_I2CSETVALUE},
1130 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1131 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1132 {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT},
1133 {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE},
1134 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1135 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1136 {0xa0, 0x13, ZC3XX_R092_I2CADDRESSSELECT},
1137 {0xa0, 0x0a, ZC3XX_R093_I2CSETVALUE},
1138 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1139 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1140 {0xa0, 0x14, ZC3XX_R092_I2CADDRESSSELECT},
1141 {0xa0, 0x02, ZC3XX_R093_I2CSETVALUE},
1142 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1143 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1144 {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT},
1145 {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE},
1146 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1147 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1148 {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN},
1149 {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN},
1150 {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN},
1151 {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN},
1152 {0xa0, 0x20, ZC3XX_R092_I2CADDRESSSELECT},
1153 {0xa0, 0x02, ZC3XX_R093_I2CSETVALUE},
1154 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1155 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1156 {0xa0, 0x21, ZC3XX_R092_I2CADDRESSSELECT},
1157 {0xa0, 0x44, ZC3XX_R093_I2CSETVALUE},
1158 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1159 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1160 {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT},
1161 {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE},
1162 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1163 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1164 {0xa0, 0x13, ZC3XX_R092_I2CADDRESSSELECT},
1165 {0xa0, 0x44, ZC3XX_R093_I2CSETVALUE},
1166 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1167 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1168 {0xa0, 0x14, ZC3XX_R092_I2CADDRESSSELECT},
1169 {0xa0, 0x02, ZC3XX_R093_I2CSETVALUE},
1170 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1171 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1172 {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT},
1173 {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE},
1174 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1175 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1176 {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN},
1177 {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN},
1178 {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN},
1179 {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN},
1180 {0xa0, 0x20, ZC3XX_R092_I2CADDRESSSELECT},
1181 {0xa0, 0x02, ZC3XX_R093_I2CSETVALUE},
1182 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1183 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1184 {0xa0, 0x21, ZC3XX_R092_I2CADDRESSSELECT},
1185 {0xa0, 0x7e, ZC3XX_R093_I2CSETVALUE},
1186 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1187 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1188 {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT},
1189 {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE},
1190 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1191 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1192 {0xa0, 0x13, ZC3XX_R092_I2CADDRESSSELECT},
1193 {0xa0, 0x7e, ZC3XX_R093_I2CSETVALUE},
1194 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1195 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1196 {0xa0, 0x14, ZC3XX_R092_I2CADDRESSSELECT},
1197 {0xa0, 0x02, ZC3XX_R093_I2CSETVALUE},
1198 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1199 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1200 {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT},
1201 {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE},
1202 {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK},
1203 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
1204 {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN},
1205 {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN},
1206 {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN},
1207 {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN},
1208 {}
1209 };
1210
1211 static const struct usb_action gc0305_Initial[] = { /* 640x480 */
1212 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */
1213 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00,08,03,cc */
1214 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
1215 {0xa0, 0x04, ZC3XX_R002_CLOCKSELECT}, /* 00,02,04,cc */
1216 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, /* 00,03,02,cc */
1217 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, /* 00,04,80,cc */
1218 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* 00,05,01,cc */
1219 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, /* 00,06,e0,cc */
1220 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* 00,01,01,cc */
1221 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,03,cc */
1222 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,01,cc */
1223 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, /* 00,98,00,cc */
1224 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, /* 00,9a,00,cc */
1225 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* 01,1a,00,cc */
1226 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, /* 01,1c,00,cc */
1227 {0xa0, 0xe6, ZC3XX_R09C_WINHEIGHTLOW}, /* 00,9c,e6,cc */
1228 {0xa0, 0x86, ZC3XX_R09E_WINWIDTHLOW}, /* 00,9e,86,cc */
1229 {0xa0, 0x98, ZC3XX_R08B_I2CDEVICEADDR}, /* 00,8b,98,cc */
1230 {0xaa, 0x13, 0x0002}, /* 00,13,02,aa */
1231 {0xaa, 0x15, 0x0003}, /* 00,15,03,aa */
1232 {0xaa, 0x01, 0x0000}, /* 00,01,00,aa */
1233 {0xaa, 0x02, 0x0000}, /* 00,02,00,aa */
1234 {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa */
1235 {0xaa, 0x1c, 0x0017}, /* 00,1c,17,aa */
1236 {0xaa, 0x1d, 0x0080}, /* 00,1d,80,aa */
1237 {0xaa, 0x1f, 0x0008}, /* 00,1f,08,aa */
1238 {0xaa, 0x21, 0x0012}, /* 00,21,12,aa */
1239 {0xa0, 0x82, ZC3XX_R086_EXPTIMEHIGH}, /* 00,86,82,cc */
1240 {0xa0, 0x83, ZC3XX_R087_EXPTIMEMID}, /* 00,87,83,cc */
1241 {0xa0, 0x84, ZC3XX_R088_EXPTIMELOW}, /* 00,88,84,cc */
1242 {0xaa, 0x05, 0x0000}, /* 00,05,00,aa */
1243 {0xaa, 0x0a, 0x0000}, /* 00,0a,00,aa */
1244 {0xaa, 0x0b, 0x00b0}, /* 00,0b,b0,aa */
1245 {0xaa, 0x0c, 0x0000}, /* 00,0c,00,aa */
1246 {0xaa, 0x0d, 0x00b0}, /* 00,0d,b0,aa */
1247 {0xaa, 0x0e, 0x0000}, /* 00,0e,00,aa */
1248 {0xaa, 0x0f, 0x00b0}, /* 00,0f,b0,aa */
1249 {0xaa, 0x10, 0x0000}, /* 00,10,00,aa */
1250 {0xaa, 0x11, 0x00b0}, /* 00,11,b0,aa */
1251 {0xaa, 0x16, 0x0001}, /* 00,16,01,aa */
1252 {0xaa, 0x17, 0x00e6}, /* 00,17,e6,aa */
1253 {0xaa, 0x18, 0x0002}, /* 00,18,02,aa */
1254 {0xaa, 0x19, 0x0086}, /* 00,19,86,aa */
1255 {0xaa, 0x20, 0x0000}, /* 00,20,00,aa */
1256 {0xaa, 0x1b, 0x0020}, /* 00,1b,20,aa */
1257 {0xa0, 0xb7, ZC3XX_R101_SENSORCORRECTION}, /* 01,01,b7,cc */
1258 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,05,cc */
1259 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0d,cc */
1260 {0xa0, 0x76, ZC3XX_R189_AWBSTATUS}, /* 01,89,76,cc */
1261 {0xa0, 0x09, 0x01ad}, /* 01,ad,09,cc */
1262 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* 01,c5,03,cc */
1263 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* 01,cb,13,cc */
1264 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* 02,50,08,cc */
1265 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* 03,01,08,cc */
1266 {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN}, /* 01,a8,60,cc */
1267 {0xa0, 0x85, ZC3XX_R18D_YTARGET}, /* 01,8d,85,cc */
1268 {0xa0, 0x00, 0x011e}, /* 01,1e,00,cc */
1269 {0xa0, 0x52, ZC3XX_R116_RGAIN}, /* 01,16,52,cc */
1270 {0xa0, 0x40, ZC3XX_R117_GGAIN}, /* 01,17,40,cc */
1271 {0xa0, 0x52, ZC3XX_R118_BGAIN}, /* 01,18,52,cc */
1272 {0xa0, 0x03, ZC3XX_R113_RGB03}, /* 01,13,03,cc */
1273 {}
1274 };
1275 static const struct usb_action gc0305_InitialScale[] = { /* 320x240 */
1276 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */
1277 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00,08,03,cc */
1278 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
1279 {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT}, /* 00,02,10,cc */
1280 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, /* 00,03,02,cc */
1281 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, /* 00,04,80,cc */
1282 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* 00,05,01,cc */
1283 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, /* 00,06,e0,cc */
1284 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* 00,01,01,cc */
1285 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,03,cc */
1286 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,01,cc */
1287 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, /* 00,98,00,cc */
1288 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, /* 00,9a,00,cc */
1289 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* 01,1a,00,cc */
1290 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, /* 01,1c,00,cc */
1291 {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW}, /* 00,9c,e8,cc */
1292 {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW}, /* 00,9e,88,cc */
1293 {0xa0, 0x98, ZC3XX_R08B_I2CDEVICEADDR}, /* 00,8b,98,cc */
1294 {0xaa, 0x13, 0x0000}, /* 00,13,00,aa */
1295 {0xaa, 0x15, 0x0001}, /* 00,15,01,aa */
1296 {0xaa, 0x01, 0x0000}, /* 00,01,00,aa */
1297 {0xaa, 0x02, 0x0000}, /* 00,02,00,aa */
1298 {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa */
1299 {0xaa, 0x1c, 0x0017}, /* 00,1c,17,aa */
1300 {0xaa, 0x1d, 0x0080}, /* 00,1d,80,aa */
1301 {0xaa, 0x1f, 0x0008}, /* 00,1f,08,aa */
1302 {0xaa, 0x21, 0x0012}, /* 00,21,12,aa */
1303 {0xa0, 0x82, ZC3XX_R086_EXPTIMEHIGH}, /* 00,86,82,cc */
1304 {0xa0, 0x83, ZC3XX_R087_EXPTIMEMID}, /* 00,87,83,cc */
1305 {0xa0, 0x84, ZC3XX_R088_EXPTIMELOW}, /* 00,88,84,cc */
1306 {0xaa, 0x05, 0x0000}, /* 00,05,00,aa */
1307 {0xaa, 0x0a, 0x0000}, /* 00,0a,00,aa */
1308 {0xaa, 0x0b, 0x00b0}, /* 00,0b,b0,aa */
1309 {0xaa, 0x0c, 0x0000}, /* 00,0c,00,aa */
1310 {0xaa, 0x0d, 0x00b0}, /* 00,0d,b0,aa */
1311 {0xaa, 0x0e, 0x0000}, /* 00,0e,00,aa */
1312 {0xaa, 0x0f, 0x00b0}, /* 00,0f,b0,aa */
1313 {0xaa, 0x10, 0x0000}, /* 00,10,00,aa */
1314 {0xaa, 0x11, 0x00b0}, /* 00,11,b0,aa */
1315 {0xaa, 0x16, 0x0001}, /* 00,16,01,aa */
1316 {0xaa, 0x17, 0x00e8}, /* 00,17,e8,aa */
1317 {0xaa, 0x18, 0x0002}, /* 00,18,02,aa */
1318 {0xaa, 0x19, 0x0088}, /* 00,19,88,aa */
1319 {0xaa, 0x20, 0x0000}, /* 00,20,00,aa */
1320 {0xaa, 0x1b, 0x0020}, /* 00,1b,20,aa */
1321 {0xa0, 0xb7, ZC3XX_R101_SENSORCORRECTION}, /* 01,01,b7,cc */
1322 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,05,cc */
1323 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0d,cc */
1324 {0xa0, 0x76, ZC3XX_R189_AWBSTATUS}, /* 01,89,76,cc */
1325 {0xa0, 0x09, 0x01ad}, /* 01,ad,09,cc */
1326 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* 01,c5,03,cc */
1327 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* 01,cb,13,cc */
1328 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* 02,50,08,cc */
1329 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* 03,01,08,cc */
1330 {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN}, /* 01,a8,60,cc */
1331 {0xa0, 0x00, 0x011e}, /* 01,1e,00,cc */
1332 {0xa0, 0x52, ZC3XX_R116_RGAIN}, /* 01,16,52,cc */
1333 {0xa0, 0x40, ZC3XX_R117_GGAIN}, /* 01,17,40,cc */
1334 {0xa0, 0x52, ZC3XX_R118_BGAIN}, /* 01,18,52,cc */
1335 {0xa0, 0x03, ZC3XX_R113_RGB03}, /* 01,13,03,cc */
1336 {}
1337 };
1338 static const struct usb_action gc0305_50HZ[] = {
1339 {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
1340 {0xaa, 0x83, 0x0002}, /* 00,83,02,aa */
1341 {0xaa, 0x84, 0x0038}, /* 00,84,38,aa */ /* win: 00,84,ec */
1342 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
1343 {0xa0, 0x0b, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,0b,cc */
1344 {0xa0, 0x18, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,18,cc */
1345 /* win: 01,92,10 */
1346 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
1347 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
1348 {0xa0, 0x8e, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,8e,cc */
1349 /* win: 01,97,ec */
1350 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE}, /* 01,8c,0e,cc */
1351 {0xa0, 0x15, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,15,cc */
1352 {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc */
1353 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,24,cc */
1354 {0xa0, 0x62, ZC3XX_R01D_HSYNC_0}, /* 00,1d,62,cc */
1355 {0xa0, 0x90, ZC3XX_R01E_HSYNC_1}, /* 00,1e,90,cc */
1356 {0xa0, 0xc8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,c8,cc */
1357 {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */
1358 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN}, /* 01,1d,60,cc */
1359 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,42,cc */
1360 /* {0xa0, 0x85, ZC3XX_R18D_YTARGET}, * 01,8d,85,cc *
1361 * if 640x480 */
1362 {}
1363 };
1364 static const struct usb_action gc0305_60HZ[] = {
1365 {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
1366 {0xaa, 0x83, 0x0000}, /* 00,83,00,aa */
1367 {0xaa, 0x84, 0x00ec}, /* 00,84,ec,aa */
1368 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
1369 {0xa0, 0x0b, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,0b,cc */
1370 {0xa0, 0x10, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,10,cc */
1371 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
1372 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
1373 {0xa0, 0xec, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,ec,cc */
1374 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE}, /* 01,8c,0e,cc */
1375 {0xa0, 0x15, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,15,cc */
1376 {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc */
1377 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,24,cc */
1378 {0xa0, 0x62, ZC3XX_R01D_HSYNC_0}, /* 00,1d,62,cc */
1379 {0xa0, 0x90, ZC3XX_R01E_HSYNC_1}, /* 00,1e,90,cc */
1380 {0xa0, 0xc8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,c8,cc */
1381 {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */
1382 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN}, /* 01,1d,60,cc */
1383 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,42,cc */
1384 {0xa0, 0x80, ZC3XX_R18D_YTARGET}, /* 01,8d,80,cc */
1385 {}
1386 };
1387
1388 static const struct usb_action gc0305_NoFlicker[] = {
1389 {0xa0, 0x0c, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0c,cc */
1390 {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
1391 {0xaa, 0x83, 0x0000}, /* 00,83,00,aa */
1392 {0xaa, 0x84, 0x0020}, /* 00,84,20,aa */
1393 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
1394 {0xa0, 0x00, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,00,cc */
1395 {0xa0, 0x48, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,48,cc */
1396 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
1397 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
1398 {0xa0, 0x10, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,10,cc */
1399 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE}, /* 01,8c,0e,cc */
1400 {0xa0, 0x15, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,15,cc */
1401 {0xa0, 0x62, ZC3XX_R01D_HSYNC_0}, /* 00,1d,62,cc */
1402 {0xa0, 0x90, ZC3XX_R01E_HSYNC_1}, /* 00,1e,90,cc */
1403 {0xa0, 0xc8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,c8,cc */
1404 {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */
1405 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN}, /* 01,1d,60,cc */
1406 {0xa0, 0x03, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,03,cc */
1407 {0xa0, 0x80, ZC3XX_R18D_YTARGET}, /* 01,8d,80,cc */
1408 {}
1409 };
1410
1411 static const struct usb_action hdcs2020_InitialScale[] = {
1412 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
1413 {0xa0, 0x11, ZC3XX_R002_CLOCKSELECT},
1414 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* qtable 0x05 */
1415 {0xa0, 0x08, ZC3XX_R010_CMOSSENSORSELECT},
1416 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH},
1417 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW},
1418 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},
1419 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW},
1420 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
1421 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC},
1422 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC},
1423 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW},
1424 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW},
1425 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW},
1426 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW},
1427 {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW},
1428 {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW},
1429 {0xaa, 0x1c, 0x0000},
1430 {0xaa, 0x0a, 0x0001},
1431 {0xaa, 0x0b, 0x0006},
1432 {0xaa, 0x0c, 0x007b},
1433 {0xaa, 0x0d, 0x00a7},
1434 {0xaa, 0x03, 0x00fb},
1435 {0xaa, 0x05, 0x0000},
1436 {0xaa, 0x06, 0x0003},
1437 {0xaa, 0x09, 0x0008},
1438
1439 {0xaa, 0x0f, 0x0018}, /* set sensor gain */
1440 {0xaa, 0x10, 0x0018},
1441 {0xaa, 0x11, 0x0018},
1442 {0xaa, 0x12, 0x0018},
1443
1444 {0xaa, 0x15, 0x004e},
1445 {0xaa, 0x1c, 0x0004},
1446 {0xa0, 0xb7, ZC3XX_R101_SENSORCORRECTION},
1447 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
1448 {0xa0, 0x70, ZC3XX_R18D_YTARGET},
1449 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
1450 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
1451 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
1452 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
1453 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
1454 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
1455 {0xa1, 0x01, 0x0002},
1456 {0xa1, 0x01, 0x0008},
1457 {0xa1, 0x01, 0x0180},
1458 {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE},
1459 {0xa0, 0x40, ZC3XX_R116_RGAIN},
1460 {0xa0, 0x40, ZC3XX_R117_GGAIN},
1461 {0xa0, 0x40, ZC3XX_R118_BGAIN},
1462 {0xa1, 0x01, 0x0008},
1463 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */
1464 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */
1465 {0xa1, 0x01, 0x01c8},
1466 {0xa1, 0x01, 0x01c9},
1467 {0xa1, 0x01, 0x01ca},
1468 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */
1469 {0xa0, 0x13, ZC3XX_R120_GAMMA00}, /* gamma 4 */
1470 {0xa0, 0x38, ZC3XX_R121_GAMMA01},
1471 {0xa0, 0x59, ZC3XX_R122_GAMMA02},
1472 {0xa0, 0x79, ZC3XX_R123_GAMMA03},
1473 {0xa0, 0x92, ZC3XX_R124_GAMMA04},
1474 {0xa0, 0xa7, ZC3XX_R125_GAMMA05},
1475 {0xa0, 0xb9, ZC3XX_R126_GAMMA06},
1476 {0xa0, 0xc8, ZC3XX_R127_GAMMA07},
1477 {0xa0, 0xd4, ZC3XX_R128_GAMMA08},
1478 {0xa0, 0xdf, ZC3XX_R129_GAMMA09},
1479 {0xa0, 0xe7, ZC3XX_R12A_GAMMA0A},
1480 {0xa0, 0xee, ZC3XX_R12B_GAMMA0B},
1481 {0xa0, 0xf4, ZC3XX_R12C_GAMMA0C},
1482 {0xa0, 0xf9, ZC3XX_R12D_GAMMA0D},
1483 {0xa0, 0xfc, ZC3XX_R12E_GAMMA0E},
1484 {0xa0, 0xff, ZC3XX_R12F_GAMMA0F},
1485 {0xa0, 0x26, ZC3XX_R130_GAMMA10},
1486 {0xa0, 0x22, ZC3XX_R131_GAMMA11},
1487 {0xa0, 0x20, ZC3XX_R132_GAMMA12},
1488 {0xa0, 0x1c, ZC3XX_R133_GAMMA13},
1489 {0xa0, 0x16, ZC3XX_R134_GAMMA14},
1490 {0xa0, 0x13, ZC3XX_R135_GAMMA15},
1491 {0xa0, 0x10, ZC3XX_R136_GAMMA16},
1492 {0xa0, 0x0d, ZC3XX_R137_GAMMA17},
1493 {0xa0, 0x0b, ZC3XX_R138_GAMMA18},
1494 {0xa0, 0x09, ZC3XX_R139_GAMMA19},
1495 {0xa0, 0x07, ZC3XX_R13A_GAMMA1A},
1496 {0xa0, 0x06, ZC3XX_R13B_GAMMA1B},
1497 {0xa0, 0x05, ZC3XX_R13C_GAMMA1C},
1498 {0xa0, 0x04, ZC3XX_R13D_GAMMA1D},
1499 {0xa0, 0x03, ZC3XX_R13E_GAMMA1E},
1500 {0xa0, 0x02, ZC3XX_R13F_GAMMA1F},
1501
1502 {0xa0, 0x66, ZC3XX_R10A_RGB00}, /* matrix */
1503 {0xa0, 0xed, ZC3XX_R10B_RGB01},
1504 {0xa0, 0xed, ZC3XX_R10C_RGB02},
1505 {0xa0, 0xed, ZC3XX_R10D_RGB10},
1506 {0xa0, 0x66, ZC3XX_R10E_RGB11},
1507 {0xa0, 0xed, ZC3XX_R10F_RGB12},
1508 {0xa0, 0xed, ZC3XX_R110_RGB20},
1509 {0xa0, 0xed, ZC3XX_R111_RGB21},
1510 {0xa0, 0x66, ZC3XX_R112_RGB22},
1511
1512 {0xa1, 0x01, 0x0180},
1513 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
1514 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
1515 {0xaa, 0x13, 0x0031},
1516 {0xaa, 0x14, 0x0001},
1517 {0xaa, 0x0e, 0x0004},
1518 {0xaa, 0x19, 0x00cd},
1519 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
1520 {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID},
1521 {0xa0, 0x62, ZC3XX_R192_EXPOSURELIMITLOW},
1522 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
1523 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
1524 {0xa0, 0x3d, ZC3XX_R197_ANTIFLICKERLOW},
1525 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE},
1526 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},
1527
1528 {0xa0, 0x0c, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 0x14 */
1529 {0xa0, 0x28, ZC3XX_R1AA_DIGITALGAINSTEP},
1530 {0xa0, 0x04, ZC3XX_R01D_HSYNC_0},
1531 {0xa0, 0x18, ZC3XX_R01E_HSYNC_1},
1532 {0xa0, 0x2c, ZC3XX_R01F_HSYNC_2},
1533 {0xa0, 0x41, ZC3XX_R020_HSYNC_3},
1534 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN},
1535 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
1536 {0xa1, 0x01, 0x0180},
1537 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
1538 {0xa0, 0x40, ZC3XX_R116_RGAIN},
1539 {0xa0, 0x40, ZC3XX_R117_GGAIN},
1540 {0xa0, 0x40, ZC3XX_R118_BGAIN},
1541 {}
1542 };
1543 static const struct usb_action hdcs2020_Initial[] = {
1544 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
1545 {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT},
1546 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
1547 {0xa0, 0x08, ZC3XX_R010_CMOSSENSORSELECT},
1548 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH},
1549 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW},
1550 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},
1551 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW},
1552 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
1553 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC},
1554 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC},
1555 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW},
1556 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW},
1557 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW},
1558 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW},
1559 {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW},
1560 {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW},
1561 {0xaa, 0x1c, 0x0000},
1562 {0xaa, 0x0a, 0x0001},
1563 {0xaa, 0x0b, 0x0006},
1564 {0xaa, 0x0c, 0x007a},
1565 {0xaa, 0x0d, 0x00a7},
1566 {0xaa, 0x03, 0x00fb},
1567 {0xaa, 0x05, 0x0000},
1568 {0xaa, 0x06, 0x0003},
1569 {0xaa, 0x09, 0x0008},
1570 {0xaa, 0x0f, 0x0018}, /* original setting */
1571 {0xaa, 0x10, 0x0018},
1572 {0xaa, 0x11, 0x0018},
1573 {0xaa, 0x12, 0x0018},
1574 {0xaa, 0x15, 0x004e},
1575 {0xaa, 0x1c, 0x0004},
1576 {0xa0, 0xf7, ZC3XX_R101_SENSORCORRECTION},
1577 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
1578 {0xa0, 0x70, ZC3XX_R18D_YTARGET},
1579 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
1580 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
1581 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
1582 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
1583 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
1584 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
1585 {0xa1, 0x01, 0x0002},
1586 {0xa1, 0x01, 0x0008},
1587 {0xa1, 0x01, 0x0180},
1588 {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE},
1589 {0xa0, 0x40, ZC3XX_R116_RGAIN},
1590 {0xa0, 0x40, ZC3XX_R117_GGAIN},
1591 {0xa0, 0x40, ZC3XX_R118_BGAIN},
1592 {0xa1, 0x01, 0x0008},
1593 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */
1594 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */
1595 {0xa1, 0x01, 0x01c8},
1596 {0xa1, 0x01, 0x01c9},
1597 {0xa1, 0x01, 0x01ca},
1598 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */
1599 {0xa0, 0x13, ZC3XX_R120_GAMMA00}, /* gamma 4 */
1600 {0xa0, 0x38, ZC3XX_R121_GAMMA01},
1601 {0xa0, 0x59, ZC3XX_R122_GAMMA02},
1602 {0xa0, 0x79, ZC3XX_R123_GAMMA03},
1603 {0xa0, 0x92, ZC3XX_R124_GAMMA04},
1604 {0xa0, 0xa7, ZC3XX_R125_GAMMA05},
1605 {0xa0, 0xb9, ZC3XX_R126_GAMMA06},
1606 {0xa0, 0xc8, ZC3XX_R127_GAMMA07},
1607 {0xa0, 0xd4, ZC3XX_R128_GAMMA08},
1608 {0xa0, 0xdf, ZC3XX_R129_GAMMA09},
1609 {0xa0, 0xe7, ZC3XX_R12A_GAMMA0A},
1610 {0xa0, 0xee, ZC3XX_R12B_GAMMA0B},
1611 {0xa0, 0xf4, ZC3XX_R12C_GAMMA0C},
1612 {0xa0, 0xf9, ZC3XX_R12D_GAMMA0D},
1613 {0xa0, 0xfc, ZC3XX_R12E_GAMMA0E},
1614 {0xa0, 0xff, ZC3XX_R12F_GAMMA0F},
1615 {0xa0, 0x26, ZC3XX_R130_GAMMA10},
1616 {0xa0, 0x22, ZC3XX_R131_GAMMA11},
1617 {0xa0, 0x20, ZC3XX_R132_GAMMA12},
1618 {0xa0, 0x1c, ZC3XX_R133_GAMMA13},
1619 {0xa0, 0x16, ZC3XX_R134_GAMMA14},
1620 {0xa0, 0x13, ZC3XX_R135_GAMMA15},
1621 {0xa0, 0x10, ZC3XX_R136_GAMMA16},
1622 {0xa0, 0x0d, ZC3XX_R137_GAMMA17},
1623 {0xa0, 0x0b, ZC3XX_R138_GAMMA18},
1624 {0xa0, 0x09, ZC3XX_R139_GAMMA19},
1625 {0xa0, 0x07, ZC3XX_R13A_GAMMA1A},
1626 {0xa0, 0x06, ZC3XX_R13B_GAMMA1B},
1627 {0xa0, 0x05, ZC3XX_R13C_GAMMA1C},
1628 {0xa0, 0x04, ZC3XX_R13D_GAMMA1D},
1629 {0xa0, 0x03, ZC3XX_R13E_GAMMA1E},
1630 {0xa0, 0x02, ZC3XX_R13F_GAMMA1F},
1631 {0xa0, 0x66, ZC3XX_R10A_RGB00}, /* matrix */
1632 {0xa0, 0xed, ZC3XX_R10B_RGB01},
1633 {0xa0, 0xed, ZC3XX_R10C_RGB02},
1634 {0xa0, 0xed, ZC3XX_R10D_RGB10},
1635 {0xa0, 0x66, ZC3XX_R10E_RGB11},
1636 {0xa0, 0xed, ZC3XX_R10F_RGB12},
1637 {0xa0, 0xed, ZC3XX_R110_RGB20},
1638 {0xa0, 0xed, ZC3XX_R111_RGB21},
1639 {0xa0, 0x66, ZC3XX_R112_RGB22},
1640 {0xa1, 0x01, 0x0180},
1641 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
1642 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
1643 /**** set exposure ***/
1644 {0xaa, 0x13, 0x0031},
1645 {0xaa, 0x14, 0x0001},
1646 {0xaa, 0x0e, 0x0004},
1647 {0xaa, 0x19, 0x00cd},
1648 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
1649 {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID},
1650 {0xa0, 0x62, ZC3XX_R192_EXPOSURELIMITLOW},
1651 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
1652 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
1653 {0xa0, 0x3d, ZC3XX_R197_ANTIFLICKERLOW},
1654 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE},
1655 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},
1656 {0xa0, 0x0c, ZC3XX_R1A9_DIGITALLIMITDIFF},
1657 {0xa0, 0x28, ZC3XX_R1AA_DIGITALGAINSTEP},
1658 {0xa0, 0x04, ZC3XX_R01D_HSYNC_0},
1659 {0xa0, 0x18, ZC3XX_R01E_HSYNC_1},
1660 {0xa0, 0x2c, ZC3XX_R01F_HSYNC_2},
1661 {0xa0, 0x41, ZC3XX_R020_HSYNC_3},
1662 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN},
1663 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
1664 {0xa1, 0x01, 0x0180},
1665 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
1666 {0xa0, 0x40, ZC3XX_R116_RGAIN},
1667 {0xa0, 0x40, ZC3XX_R117_GGAIN},
1668 {0xa0, 0x40, ZC3XX_R118_BGAIN},
1669 {}
1670 };
1671 static const struct usb_action hdcs2020_50HZ[] = {
1672 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
1673 {0xaa, 0x13, 0x0018}, /* 00,13,18,aa */
1674 {0xaa, 0x14, 0x0001}, /* 00,14,01,aa */
1675 {0xaa, 0x0e, 0x0005}, /* 00,0e,05,aa */
1676 {0xaa, 0x19, 0x001f}, /* 00,19,1f,aa */
1677 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
1678 {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,02,cc */
1679 {0xa0, 0x76, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,76,cc */
1680 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
1681 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
1682 {0xa0, 0x46, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,46,cc */
1683 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */
1684 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */
1685 {0xa0, 0x0c, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,0c,cc */
1686 {0xa0, 0x28, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,28,cc */
1687 {0xa0, 0x05, ZC3XX_R01D_HSYNC_0}, /* 00,1d,05,cc */
1688 {0xa0, 0x1a, ZC3XX_R01E_HSYNC_1}, /* 00,1e,1a,cc */
1689 {0xa0, 0x2f, ZC3XX_R01F_HSYNC_2}, /* 00,1f,2f,cc */
1690 {}
1691 };
1692 static const struct usb_action hdcs2020_60HZ[] = {
1693 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
1694 {0xaa, 0x13, 0x0031}, /* 00,13,31,aa */
1695 {0xaa, 0x14, 0x0001}, /* 00,14,01,aa */
1696 {0xaa, 0x0e, 0x0004}, /* 00,0e,04,aa */
1697 {0xaa, 0x19, 0x00cd}, /* 00,19,cd,aa */
1698 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
1699 {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,02,cc */
1700 {0xa0, 0x62, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,62,cc */
1701 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
1702 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
1703 {0xa0, 0x3d, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,3d,cc */
1704 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */
1705 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */
1706 {0xa0, 0x0c, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,0c,cc */
1707 {0xa0, 0x28, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,28,cc */
1708 {0xa0, 0x04, ZC3XX_R01D_HSYNC_0}, /* 00,1d,04,cc */
1709 {0xa0, 0x18, ZC3XX_R01E_HSYNC_1}, /* 00,1e,18,cc */
1710 {0xa0, 0x2c, ZC3XX_R01F_HSYNC_2}, /* 00,1f,2c,cc */
1711 {}
1712 };
1713 static const struct usb_action hdcs2020_NoFlicker[] = {
1714 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
1715 {0xaa, 0x13, 0x0010}, /* 00,13,10,aa */
1716 {0xaa, 0x14, 0x0001}, /* 00,14,01,aa */
1717 {0xaa, 0x0e, 0x0004}, /* 00,0e,04,aa */
1718 {0xaa, 0x19, 0x0000}, /* 00,19,00,aa */
1719 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
1720 {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,02,cc */
1721 {0xa0, 0x70, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,70,cc */
1722 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
1723 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
1724 {0xa0, 0x10, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,10,cc */
1725 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */
1726 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */
1727 {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,00,cc */
1728 {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,00,cc */
1729 {0xa0, 0x04, ZC3XX_R01D_HSYNC_0}, /* 00,1d,04,cc */
1730 {0xa0, 0x17, ZC3XX_R01E_HSYNC_1}, /* 00,1e,17,cc */
1731 {0xa0, 0x2a, ZC3XX_R01F_HSYNC_2}, /* 00,1f,2a,cc */
1732 {}
1733 };
1734
1735 static const struct usb_action hv7131b_InitialScale[] = { /* 320x240 */
1736 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
1737 {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT},
1738 {0xa0, 0x00, ZC3XX_R010_CMOSSENSORSELECT},
1739 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
1740 {0xa0, 0x77, ZC3XX_R101_SENSORCORRECTION},
1741 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00 */
1742 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC},
1743 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC},
1744 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH},
1745 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW},
1746 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},
1747 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW},
1748 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW},
1749 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW},
1750 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW},
1751 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW},
1752 {0xaa, 0x30, 0x002d},
1753 {0xaa, 0x01, 0x0005},
1754 {0xaa, 0x11, 0x0000},
1755 {0xaa, 0x13, 0x0001}, /* {0xaa, 0x13, 0x0000}, */
1756 {0xaa, 0x14, 0x0001},
1757 {0xaa, 0x15, 0x00e8},
1758 {0xaa, 0x16, 0x0002},
1759 {0xaa, 0x17, 0x0086}, /* 00,17,88,aa */
1760 {0xaa, 0x31, 0x0038},
1761 {0xaa, 0x32, 0x0038},
1762 {0xaa, 0x33, 0x0038},
1763 {0xaa, 0x5b, 0x0001},
1764 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
1765 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
1766 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
1767 {0xa0, 0x68, ZC3XX_R18D_YTARGET},
1768 {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN},
1769 {0xa0, 0x00, 0x01ad},
1770 {0xa0, 0xc0, 0x019b},
1771 {0xa0, 0xa0, 0x019c},
1772 {0xa0, 0x02, ZC3XX_R188_MINGAIN},
1773 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
1774 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
1775 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
1776 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
1777 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
1778 {0xaa, 0x02, 0x0090}, /* 00,02,80,aa */
1779 {}
1780 };
1781
1782 static const struct usb_action hv7131b_Initial[] = { /* 640x480*/
1783 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
1784 {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT},
1785 {0xa0, 0x00, ZC3XX_R010_CMOSSENSORSELECT},
1786 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
1787 {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION},
1788 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00 */
1789 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC},
1790 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC},
1791 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH},
1792 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW},
1793 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},
1794 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW},
1795 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW},
1796 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW},
1797 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW},
1798 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW},
1799 {0xaa, 0x30, 0x002d},
1800 {0xaa, 0x01, 0x0005},
1801 {0xaa, 0x11, 0x0001},
1802 {0xaa, 0x13, 0x0000}, /* {0xaa, 0x13, 0x0001}; */
1803 {0xaa, 0x14, 0x0001},
1804 {0xaa, 0x15, 0x00e6},
1805 {0xaa, 0x16, 0x0002},
1806 {0xaa, 0x17, 0x0086},
1807 {0xaa, 0x31, 0x0038},
1808 {0xaa, 0x32, 0x0038},
1809 {0xaa, 0x33, 0x0038},
1810 {0xaa, 0x5b, 0x0001},
1811 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
1812 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
1813 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
1814 {0xa0, 0x70, ZC3XX_R18D_YTARGET},
1815 {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN},
1816 {0xa0, 0x00, 0x01ad},
1817 {0xa0, 0xc0, 0x019b},
1818 {0xa0, 0xa0, 0x019c},
1819 {0xa0, 0x02, ZC3XX_R188_MINGAIN},
1820 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
1821 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
1822 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
1823 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
1824 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
1825 {0xaa, 0x02, 0x0090}, /* {0xaa, 0x02, 0x0080}, */
1826 {}
1827 };
1828 static const struct usb_action hv7131b_50HZ[] = { /* 640x480*/
1829 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
1830 {0xaa, 0x25, 0x0007}, /* 00,25,07,aa */
1831 {0xaa, 0x26, 0x0053}, /* 00,26,53,aa */
1832 {0xaa, 0x27, 0x0000}, /* 00,27,00,aa */
1833 {0xaa, 0x20, 0x0000}, /* 00,20,00,aa */
1834 {0xaa, 0x21, 0x0050}, /* 00,21,50,aa */
1835 {0xaa, 0x22, 0x001b}, /* 00,22,1b,aa */
1836 {0xaa, 0x23, 0x00fc}, /* 00,23,fc,aa */
1837 {0xa0, 0x2f, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,2f,cc */
1838 {0xa0, 0x9b, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,9b,cc */
1839 {0xa0, 0x80, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,80,cc */
1840 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
1841 {0xa0, 0xea, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,ea,cc */
1842 {0xa0, 0x60, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,60,cc */
1843 {0xa0, 0x0c, ZC3XX_R18C_AEFREEZE}, /* 01,8c,0c,cc */
1844 {0xa0, 0x18, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,18,cc */
1845 {0xa0, 0x18, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,18,cc */
1846 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,24,cc */
1847 {0xa0, 0x00, ZC3XX_R01D_HSYNC_0}, /* 00,1d,00,cc */
1848 {0xa0, 0x50, ZC3XX_R01E_HSYNC_1}, /* 00,1e,50,cc */
1849 {0xa0, 0x1b, ZC3XX_R01F_HSYNC_2}, /* 00,1f,1b,cc */
1850 {0xa0, 0xfc, ZC3XX_R020_HSYNC_3}, /* 00,20,fc,cc */
1851 {}
1852 };
1853 static const struct usb_action hv7131b_50HZScale[] = { /* 320x240 */
1854 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
1855 {0xaa, 0x25, 0x0007}, /* 00,25,07,aa */
1856 {0xaa, 0x26, 0x0053}, /* 00,26,53,aa */
1857 {0xaa, 0x27, 0x0000}, /* 00,27,00,aa */
1858 {0xaa, 0x20, 0x0000}, /* 00,20,00,aa */
1859 {0xaa, 0x21, 0x0050}, /* 00,21,50,aa */
1860 {0xaa, 0x22, 0x0012}, /* 00,22,12,aa */
1861 {0xaa, 0x23, 0x0080}, /* 00,23,80,aa */
1862 {0xa0, 0x2f, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,2f,cc */
1863 {0xa0, 0x9b, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,9b,cc */
1864 {0xa0, 0x80, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,80,cc */
1865 {0xa0, 0x01, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,01,cc */
1866 {0xa0, 0xd4, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,d4,cc */
1867 {0xa0, 0xc0, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,c0,cc */
1868 {0xa0, 0x07, ZC3XX_R18C_AEFREEZE}, /* 01,8c,07,cc */
1869 {0xa0, 0x0f, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,0f,cc */
1870 {0xa0, 0x18, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,18,cc */
1871 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,24,cc */
1872 {0xa0, 0x00, ZC3XX_R01D_HSYNC_0}, /* 00,1d,00,cc */
1873 {0xa0, 0x50, ZC3XX_R01E_HSYNC_1}, /* 00,1e,50,cc */
1874 {0xa0, 0x12, ZC3XX_R01F_HSYNC_2}, /* 00,1f,12,cc */
1875 {0xa0, 0x80, ZC3XX_R020_HSYNC_3}, /* 00,20,80,cc */
1876 {}
1877 };
1878 static const struct usb_action hv7131b_60HZ[] = { /* 640x480*/
1879 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
1880 {0xaa, 0x25, 0x0007}, /* 00,25,07,aa */
1881 {0xaa, 0x26, 0x00a1}, /* 00,26,a1,aa */
1882 {0xaa, 0x27, 0x0020}, /* 00,27,20,aa */
1883 {0xaa, 0x20, 0x0000}, /* 00,20,00,aa */
1884 {0xaa, 0x21, 0x0040}, /* 00,21,40,aa */
1885 {0xaa, 0x22, 0x0013}, /* 00,22,13,aa */
1886 {0xaa, 0x23, 0x004c}, /* 00,23,4c,aa */
1887 {0xa0, 0x2f, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,2f,cc */
1888 {0xa0, 0x4d, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,4d,cc */
1889 {0xa0, 0x60, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,60,cc */
1890 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
1891 {0xa0, 0xc3, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,c3,cc */
1892 {0xa0, 0x50, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,50,cc */
1893 {0xa0, 0x0c, ZC3XX_R18C_AEFREEZE}, /* 01,8c,0c,cc */
1894 {0xa0, 0x18, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,18,cc */
1895 {0xa0, 0x18, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,18,cc */
1896 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,24,cc */
1897 {0xa0, 0x00, ZC3XX_R01D_HSYNC_0}, /* 00,1d,00,cc */
1898 {0xa0, 0x40, ZC3XX_R01E_HSYNC_1}, /* 00,1e,40,cc */
1899 {0xa0, 0x13, ZC3XX_R01F_HSYNC_2}, /* 00,1f,13,cc */
1900 {0xa0, 0x4c, ZC3XX_R020_HSYNC_3}, /* 00,20,4c,cc */
1901 {}
1902 };
1903 static const struct usb_action hv7131b_60HZScale[] = { /* 320x240 */
1904 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
1905 {0xaa, 0x25, 0x0007}, /* 00,25,07,aa */
1906 {0xaa, 0x26, 0x00a1}, /* 00,26,a1,aa */
1907 {0xaa, 0x27, 0x0020}, /* 00,27,20,aa */
1908 {0xaa, 0x20, 0x0000}, /* 00,20,00,aa */
1909 {0xaa, 0x21, 0x00a0}, /* 00,21,a0,aa */
1910 {0xaa, 0x22, 0x0016}, /* 00,22,16,aa */
1911 {0xaa, 0x23, 0x0040}, /* 00,23,40,aa */
1912 {0xa0, 0x2f, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,2f,cc */
1913 {0xa0, 0x4d, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,4d,cc */
1914 {0xa0, 0x60, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,60,cc */
1915 {0xa0, 0x01, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,01,cc */
1916 {0xa0, 0x86, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,86,cc */
1917 {0xa0, 0xa0, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,a0,cc */
1918 {0xa0, 0x07, ZC3XX_R18C_AEFREEZE}, /* 01,8c,07,cc */
1919 {0xa0, 0x0f, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,0f,cc */
1920 {0xa0, 0x18, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,18,cc */
1921 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,24,cc */
1922 {0xa0, 0x00, ZC3XX_R01D_HSYNC_0}, /* 00,1d,00,cc */
1923 {0xa0, 0xa0, ZC3XX_R01E_HSYNC_1}, /* 00,1e,a0,cc */
1924 {0xa0, 0x16, ZC3XX_R01F_HSYNC_2}, /* 00,1f,16,cc */
1925 {0xa0, 0x40, ZC3XX_R020_HSYNC_3}, /* 00,20,40,cc */
1926 {}
1927 };
1928 static const struct usb_action hv7131b_NoFlicker[] = { /* 640x480*/
1929 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
1930 {0xaa, 0x25, 0x0003}, /* 00,25,03,aa */
1931 {0xaa, 0x26, 0x0000}, /* 00,26,00,aa */
1932 {0xaa, 0x27, 0x0000}, /* 00,27,00,aa */
1933 {0xaa, 0x20, 0x0000}, /* 00,20,00,aa */
1934 {0xaa, 0x21, 0x0010}, /* 00,21,10,aa */
1935 {0xaa, 0x22, 0x0000}, /* 00,22,00,aa */
1936 {0xaa, 0x23, 0x0003}, /* 00,23,03,aa */
1937 {0xa0, 0x2f, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,2f,cc */
1938 {0xa0, 0xf8, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,f8,cc */
1939 {0xa0, 0x00, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,00,cc */
1940 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
1941 {0xa0, 0x02, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,02,cc */
1942 {0xa0, 0x00, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,00,cc */
1943 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */
1944 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */
1945 {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,00,cc */
1946 {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,00,cc */
1947 {0xa0, 0x00, ZC3XX_R01D_HSYNC_0}, /* 00,1d,00,cc */
1948 {0xa0, 0x10, ZC3XX_R01E_HSYNC_1}, /* 00,1e,10,cc */
1949 {0xa0, 0x00, ZC3XX_R01F_HSYNC_2}, /* 00,1f,00,cc */
1950 {0xa0, 0x03, ZC3XX_R020_HSYNC_3}, /* 00,20,03,cc */
1951 {}
1952 };
1953 static const struct usb_action hv7131b_NoFlickerScale[] = { /* 320x240 */
1954 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
1955 {0xaa, 0x25, 0x0003}, /* 00,25,03,aa */
1956 {0xaa, 0x26, 0x0000}, /* 00,26,00,aa */
1957 {0xaa, 0x27, 0x0000}, /* 00,27,00,aa */
1958 {0xaa, 0x20, 0x0000}, /* 00,20,00,aa */
1959 {0xaa, 0x21, 0x00a0}, /* 00,21,a0,aa */
1960 {0xaa, 0x22, 0x0016}, /* 00,22,16,aa */
1961 {0xaa, 0x23, 0x0040}, /* 00,23,40,aa */
1962 {0xa0, 0x2f, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,2f,cc */
1963 {0xa0, 0xf8, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,f8,cc */
1964 {0xa0, 0x00, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,00,cc */
1965 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
1966 {0xa0, 0x02, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,02,cc */
1967 {0xa0, 0x00, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,00,cc */
1968 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */
1969 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */
1970 {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,00,cc */
1971 {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,00,cc */
1972 {0xa0, 0x00, ZC3XX_R01D_HSYNC_0}, /* 00,1d,00,cc */
1973 {0xa0, 0xa0, ZC3XX_R01E_HSYNC_1}, /* 00,1e,a0,cc */
1974 {0xa0, 0x16, ZC3XX_R01F_HSYNC_2}, /* 00,1f,16,cc */
1975 {0xa0, 0x40, ZC3XX_R020_HSYNC_3}, /* 00,20,40,cc */
1976 {}
1977 };
1978
1979 /* from lPEPI264v.inf (hv7131b!) */
1980 static const struct usb_action hv7131r_InitialScale[] = {
1981 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
1982 {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT},
1983 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT},
1984 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
1985 {0xa0, 0x77, ZC3XX_R101_SENSORCORRECTION},
1986 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
1987 {0xa0, 0x07, ZC3XX_R012_VIDEOCONTROLFUNC},
1988 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC},
1989 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH},
1990 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW},
1991 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},
1992 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW},
1993 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW},
1994 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW},
1995 {0xa0, 0x01, ZC3XX_R09B_WINHEIGHTHIGH},
1996 {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW},
1997 {0xa0, 0x02, ZC3XX_R09D_WINWIDTHHIGH},
1998 {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW},
1999 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW},
2000 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW},
2001 {0xa0, 0x07, ZC3XX_R012_VIDEOCONTROLFUNC},
2002 {0xdd, 0x00, 0x0200},
2003 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
2004 {0xaa, 0x01, 0x000c},
2005 {0xaa, 0x11, 0x0000},
2006 {0xaa, 0x13, 0x0000},
2007 {0xaa, 0x14, 0x0001},
2008 {0xaa, 0x15, 0x00e8},
2009 {0xaa, 0x16, 0x0002},
2010 {0xaa, 0x17, 0x0088},
2011 {0xaa, 0x30, 0x000b},
2012 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
2013 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
2014 {0xa0, 0x78, ZC3XX_R18D_YTARGET},
2015 {0xa0, 0x50, ZC3XX_R1A8_DIGITALGAIN},
2016 {0xa0, 0x00, 0x01ad},
2017 {0xa0, 0xc0, 0x019b},
2018 {0xa0, 0xa0, 0x019c},
2019 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
2020 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
2021 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
2022 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
2023 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
2024 {}
2025 };
2026 static const struct usb_action hv7131r_Initial[] = {
2027 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
2028 {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT},
2029 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT},
2030 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
2031 {0xa0, 0x77, ZC3XX_R101_SENSORCORRECTION},
2032 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
2033 {0xa0, 0x07, ZC3XX_R012_VIDEOCONTROLFUNC},
2034 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC},
2035 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH},
2036 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW},
2037 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},
2038 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW},
2039 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW},
2040 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW},
2041 {0xa0, 0x01, ZC3XX_R09B_WINHEIGHTHIGH},
2042 {0xa0, 0xe6, ZC3XX_R09C_WINHEIGHTLOW},
2043 {0xa0, 0x02, ZC3XX_R09D_WINWIDTHHIGH},
2044 {0xa0, 0x86, ZC3XX_R09E_WINWIDTHLOW},
2045 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW},
2046 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW},
2047 {0xa0, 0x07, ZC3XX_R012_VIDEOCONTROLFUNC},
2048 {0xdd, 0x00, 0x0200},
2049 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
2050 {0xaa, 0x01, 0x000c},
2051 {0xaa, 0x11, 0x0000},
2052 {0xaa, 0x13, 0x0000},
2053 {0xaa, 0x14, 0x0001},
2054 {0xaa, 0x15, 0x00e6},
2055 {0xaa, 0x16, 0x0002},
2056 {0xaa, 0x17, 0x0086},
2057 {0xaa, 0x30, 0x000b},
2058 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
2059 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
2060 {0xa0, 0x78, ZC3XX_R18D_YTARGET},
2061 {0xa0, 0x50, ZC3XX_R1A8_DIGITALGAIN},
2062 {0xa0, 0x00, 0x01ad},
2063 {0xa0, 0xc0, 0x019b},
2064 {0xa0, 0xa0, 0x019c},
2065 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
2066 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
2067 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
2068 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
2069 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
2070 {}
2071 };
2072 static const struct usb_action hv7131r_50HZ[] = {
2073 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
2074 {0xa0, 0x06, ZC3XX_R190_EXPOSURELIMITHIGH},
2075 {0xa0, 0x68, ZC3XX_R191_EXPOSURELIMITMID},
2076 {0xa0, 0xa0, ZC3XX_R192_EXPOSURELIMITLOW},
2077 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
2078 {0xa0, 0xea, ZC3XX_R196_ANTIFLICKERMID},
2079 {0xa0, 0x60, ZC3XX_R197_ANTIFLICKERLOW},
2080 {0xa0, 0x18, ZC3XX_R18C_AEFREEZE},
2081 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},
2082 {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF},
2083 {0xa0, 0x66, ZC3XX_R1AA_DIGITALGAINSTEP},
2084 {0xa0, 0x00, ZC3XX_R01D_HSYNC_0},
2085 {0xa0, 0xd0, ZC3XX_R01E_HSYNC_1},
2086 {0xa0, 0x00, ZC3XX_R01F_HSYNC_2},
2087 {0xa0, 0x08, ZC3XX_R020_HSYNC_3},
2088 {}
2089 };
2090 static const struct usb_action hv7131r_50HZScale[] = {
2091 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
2092 {0xa0, 0x0c, ZC3XX_R190_EXPOSURELIMITHIGH},
2093 {0xa0, 0xd1, ZC3XX_R191_EXPOSURELIMITMID},
2094 {0xa0, 0x40, ZC3XX_R192_EXPOSURELIMITLOW},
2095 {0xa0, 0x01, ZC3XX_R195_ANTIFLICKERHIGH},
2096 {0xa0, 0xd4, ZC3XX_R196_ANTIFLICKERMID},
2097 {0xa0, 0xc0, ZC3XX_R197_ANTIFLICKERLOW},
2098 {0xa0, 0x18, ZC3XX_R18C_AEFREEZE},
2099 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},
2100 {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF},
2101 {0xa0, 0x66, ZC3XX_R1AA_DIGITALGAINSTEP},
2102 {0xa0, 0x00, ZC3XX_R01D_HSYNC_0},
2103 {0xa0, 0xd0, ZC3XX_R01E_HSYNC_1},
2104 {0xa0, 0x00, ZC3XX_R01F_HSYNC_2},
2105 {0xa0, 0x08, ZC3XX_R020_HSYNC_3},
2106 {}
2107 };
2108 static const struct usb_action hv7131r_60HZ[] = {
2109 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
2110 {0xa0, 0x06, ZC3XX_R190_EXPOSURELIMITHIGH},
2111 {0xa0, 0x1a, ZC3XX_R191_EXPOSURELIMITMID},
2112 {0xa0, 0x80, ZC3XX_R192_EXPOSURELIMITLOW},
2113 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
2114 {0xa0, 0xc3, ZC3XX_R196_ANTIFLICKERMID},
2115 {0xa0, 0x50, ZC3XX_R197_ANTIFLICKERLOW},
2116 {0xa0, 0x18, ZC3XX_R18C_AEFREEZE},
2117 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},
2118 {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF},
2119 {0xa0, 0x66, ZC3XX_R1AA_DIGITALGAINSTEP},
2120 {0xa0, 0x00, ZC3XX_R01D_HSYNC_0},
2121 {0xa0, 0xd0, ZC3XX_R01E_HSYNC_1},
2122 {0xa0, 0x00, ZC3XX_R01F_HSYNC_2},
2123 {0xa0, 0x08, ZC3XX_R020_HSYNC_3},
2124 {}
2125 };
2126 static const struct usb_action hv7131r_60HZScale[] = {
2127 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
2128 {0xa0, 0x0c, ZC3XX_R190_EXPOSURELIMITHIGH},
2129 {0xa0, 0x35, ZC3XX_R191_EXPOSURELIMITMID},
2130 {0xa0, 0x00, ZC3XX_R192_EXPOSURELIMITLOW},
2131 {0xa0, 0x01, ZC3XX_R195_ANTIFLICKERHIGH},
2132 {0xa0, 0x86, ZC3XX_R196_ANTIFLICKERMID},
2133 {0xa0, 0xa0, ZC3XX_R197_ANTIFLICKERLOW},
2134 {0xa0, 0x18, ZC3XX_R18C_AEFREEZE},
2135 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},
2136 {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF},
2137 {0xa0, 0x66, ZC3XX_R1AA_DIGITALGAINSTEP},
2138 {0xa0, 0x00, ZC3XX_R01D_HSYNC_0},
2139 {0xa0, 0xd0, ZC3XX_R01E_HSYNC_1},
2140 {0xa0, 0x00, ZC3XX_R01F_HSYNC_2},
2141 {0xa0, 0x08, ZC3XX_R020_HSYNC_3},
2142 {}
2143 };
2144 static const struct usb_action hv7131r_NoFlicker[] = {
2145 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
2146 {0xa0, 0x2f, ZC3XX_R190_EXPOSURELIMITHIGH},
2147 {0xa0, 0xf8, ZC3XX_R191_EXPOSURELIMITMID},
2148 {0xa0, 0x00, ZC3XX_R192_EXPOSURELIMITLOW},
2149 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
2150 {0xa0, 0x02, ZC3XX_R196_ANTIFLICKERMID},
2151 {0xa0, 0x58, ZC3XX_R197_ANTIFLICKERLOW},
2152 {0xa0, 0x0c, ZC3XX_R18C_AEFREEZE},
2153 {0xa0, 0x18, ZC3XX_R18F_AEUNFREEZE},
2154 {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF},
2155 {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP},
2156 {0xa0, 0x00, ZC3XX_R01D_HSYNC_0},
2157 {0xa0, 0xd0, ZC3XX_R01E_HSYNC_1},
2158 {0xa0, 0x00, ZC3XX_R01F_HSYNC_2},
2159 {0xa0, 0x08, ZC3XX_R020_HSYNC_3},
2160 {}
2161 };
2162 static const struct usb_action hv7131r_NoFlickerScale[] = {
2163 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
2164 {0xa0, 0x2f, ZC3XX_R190_EXPOSURELIMITHIGH},
2165 {0xa0, 0xf8, ZC3XX_R191_EXPOSURELIMITMID},
2166 {0xa0, 0x00, ZC3XX_R192_EXPOSURELIMITLOW},
2167 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
2168 {0xa0, 0x04, ZC3XX_R196_ANTIFLICKERMID},
2169 {0xa0, 0xb0, ZC3XX_R197_ANTIFLICKERLOW},
2170 {0xa0, 0x0c, ZC3XX_R18C_AEFREEZE},
2171 {0xa0, 0x18, ZC3XX_R18F_AEUNFREEZE},
2172 {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF},
2173 {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP},
2174 {0xa0, 0x00, ZC3XX_R01D_HSYNC_0},
2175 {0xa0, 0xd0, ZC3XX_R01E_HSYNC_1},
2176 {0xa0, 0x00, ZC3XX_R01F_HSYNC_2},
2177 {0xa0, 0x08, ZC3XX_R020_HSYNC_3},
2178 {}
2179 };
2180
2181 static const struct usb_action icm105a_InitialScale[] = {
2182 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
2183 {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT},
2184 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
2185 {0xa0, 0x0c, ZC3XX_R010_CMOSSENSORSELECT},
2186 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH},
2187 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW},
2188 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},
2189 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW},
2190 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
2191 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC},
2192 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC},
2193 {0xa0, 0xa1, ZC3XX_R08B_I2CDEVICEADDR},
2194 {0xa0, 0x00, ZC3XX_R097_WINYSTARTHIGH},
2195 {0xa0, 0x01, ZC3XX_R098_WINYSTARTLOW},
2196 {0xa0, 0x00, ZC3XX_R099_WINXSTARTHIGH},
2197 {0xa0, 0x01, ZC3XX_R09A_WINXSTARTLOW},
2198 {0xa0, 0x01, ZC3XX_R11A_FIRSTYLOW},
2199 {0xa0, 0x01, ZC3XX_R11C_FIRSTXLOW},
2200 {0xa0, 0x01, ZC3XX_R09B_WINHEIGHTHIGH},
2201 {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW},
2202 {0xa0, 0x02, ZC3XX_R09D_WINWIDTHHIGH},
2203 {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW},
2204 {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION},
2205 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
2206 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
2207 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
2208 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
2209 {0xaa, 0x01, 0x0010},
2210 {0xaa, 0x03, 0x0000},
2211 {0xaa, 0x04, 0x0001},
2212 {0xaa, 0x05, 0x0020},
2213 {0xaa, 0x06, 0x0001},
2214 {0xaa, 0x08, 0x0000},
2215 {0xaa, 0x03, 0x0001},
2216 {0xaa, 0x04, 0x0011},
2217 {0xaa, 0x05, 0x00a0},
2218 {0xaa, 0x06, 0x0001},
2219 {0xaa, 0x08, 0x0000},
2220 {0xaa, 0x03, 0x0002},
2221 {0xaa, 0x04, 0x0013},
2222 {0xaa, 0x05, 0x0020},
2223 {0xaa, 0x06, 0x0001},
2224 {0xaa, 0x08, 0x0000},
2225 {0xaa, 0x03, 0x0003},
2226 {0xaa, 0x04, 0x0015},
2227 {0xaa, 0x05, 0x0020},
2228 {0xaa, 0x06, 0x0005},
2229 {0xaa, 0x08, 0x0000},
2230 {0xaa, 0x03, 0x0004},
2231 {0xaa, 0x04, 0x0017},
2232 {0xaa, 0x05, 0x0020},
2233 {0xaa, 0x06, 0x000d},
2234 {0xaa, 0x08, 0x0000},
2235 {0xaa, 0x03, 0x0005},
2236 {0xaa, 0x04, 0x0019},
2237 {0xaa, 0x05, 0x0020},
2238 {0xaa, 0x06, 0x0005},
2239 {0xaa, 0x08, 0x0000},
2240 {0xaa, 0x03, 0x0006},
2241 {0xaa, 0x04, 0x0017},
2242 {0xaa, 0x05, 0x0026},
2243 {0xaa, 0x06, 0x0005},
2244 {0xaa, 0x08, 0x0000},
2245 {0xaa, 0x03, 0x0007},
2246 {0xaa, 0x04, 0x0019},
2247 {0xaa, 0x05, 0x0022},
2248 {0xaa, 0x06, 0x0005},
2249 {0xaa, 0x08, 0x0000},
2250 {0xaa, 0x03, 0x0008},
2251 {0xaa, 0x04, 0x0021},
2252 {0xaa, 0x05, 0x00aa},
2253 {0xaa, 0x06, 0x0005},
2254 {0xaa, 0x08, 0x0000},
2255 {0xaa, 0x03, 0x0009},
2256 {0xaa, 0x04, 0x0023},
2257 {0xaa, 0x05, 0x00aa},
2258 {0xaa, 0x06, 0x000d},
2259 {0xaa, 0x08, 0x0000},
2260 {0xaa, 0x03, 0x000a},
2261 {0xaa, 0x04, 0x0025},
2262 {0xaa, 0x05, 0x00aa},
2263 {0xaa, 0x06, 0x0005},
2264 {0xaa, 0x08, 0x0000},
2265 {0xaa, 0x03, 0x000b},
2266 {0xaa, 0x04, 0x00ec},
2267 {0xaa, 0x05, 0x002e},
2268 {0xaa, 0x06, 0x0005},
2269 {0xaa, 0x08, 0x0000},
2270 {0xaa, 0x03, 0x000c},
2271 {0xaa, 0x04, 0x00fa},
2272 {0xaa, 0x05, 0x002a},
2273 {0xaa, 0x06, 0x0005},
2274 {0xaa, 0x08, 0x0000},
2275 {0xaa, 0x07, 0x000d},
2276 {0xaa, 0x01, 0x0005},
2277 {0xaa, 0x94, 0x0002},
2278 {0xaa, 0x90, 0x0000},
2279 {0xaa, 0x91, 0x001f},
2280 {0xaa, 0x10, 0x0064},
2281 {0xaa, 0x9b, 0x00f0},
2282 {0xaa, 0x9c, 0x0002},
2283 {0xaa, 0x14, 0x001a},
2284 {0xaa, 0x20, 0x0080},
2285 {0xaa, 0x22, 0x0080},
2286 {0xaa, 0x24, 0x0080},
2287 {0xaa, 0x26, 0x0080},
2288 {0xaa, 0x00, 0x0084},
2289 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
2290 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
2291 {0xaa, 0xa8, 0x00c0},
2292 {0xa1, 0x01, 0x0002},
2293 {0xa1, 0x01, 0x0008},
2294 {0xa1, 0x01, 0x0180},
2295 {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE},
2296 {0xa0, 0x40, ZC3XX_R116_RGAIN},
2297 {0xa0, 0x40, ZC3XX_R117_GGAIN},
2298 {0xa0, 0x40, ZC3XX_R118_BGAIN},
2299 {0xa1, 0x01, 0x0008},
2300
2301 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */
2302 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */
2303 {0xa1, 0x01, 0x01c8},
2304 {0xa1, 0x01, 0x01c9},
2305 {0xa1, 0x01, 0x01ca},
2306 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */
2307 {0xa0, 0x52, ZC3XX_R10A_RGB00}, /* matrix */
2308 {0xa0, 0xf7, ZC3XX_R10B_RGB01},
2309 {0xa0, 0xf7, ZC3XX_R10C_RGB02},
2310 {0xa0, 0xf7, ZC3XX_R10D_RGB10},
2311 {0xa0, 0x52, ZC3XX_R10E_RGB11},
2312 {0xa0, 0xf7, ZC3XX_R10F_RGB12},
2313 {0xa0, 0xf7, ZC3XX_R110_RGB20},
2314 {0xa0, 0xf7, ZC3XX_R111_RGB21},
2315 {0xa0, 0x52, ZC3XX_R112_RGB22},
2316 {0xa1, 0x01, 0x0180},
2317 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
2318 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
2319 {0xaa, 0x0d, 0x0003},
2320 {0xaa, 0x0c, 0x008c},
2321 {0xaa, 0x0e, 0x0095},
2322 {0xaa, 0x0f, 0x0002},
2323 {0xaa, 0x1c, 0x0094},
2324 {0xaa, 0x1d, 0x0002},
2325 {0xaa, 0x20, 0x0080},
2326 {0xaa, 0x22, 0x0080},
2327 {0xaa, 0x24, 0x0080},
2328 {0xaa, 0x26, 0x0080},
2329 {0xaa, 0x00, 0x0084},
2330 {0xa0, 0x02, ZC3XX_R0A3_EXPOSURETIMEHIGH},
2331 {0xa0, 0x94, ZC3XX_R0A4_EXPOSURETIMELOW},
2332 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
2333 {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID},
2334 {0xa0, 0x20, ZC3XX_R192_EXPOSURELIMITLOW},
2335 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
2336 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
2337 {0xa0, 0x84, ZC3XX_R197_ANTIFLICKERLOW},
2338 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE},
2339 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},
2340 {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF},
2341 {0xa0, 0x12, ZC3XX_R1AA_DIGITALGAINSTEP},
2342 {0xa0, 0xe3, ZC3XX_R01D_HSYNC_0},
2343 {0xa0, 0xec, ZC3XX_R01E_HSYNC_1},
2344 {0xa0, 0xf5, ZC3XX_R01F_HSYNC_2},
2345 {0xa0, 0xff, ZC3XX_R020_HSYNC_3},
2346 {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN},
2347 {0xa0, 0xc0, ZC3XX_R1A8_DIGITALGAIN},
2348 {0xa0, 0xc0, ZC3XX_R11D_GLOBALGAIN},
2349 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
2350 {0xa1, 0x01, 0x0180},
2351 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
2352 {0xa0, 0x40, ZC3XX_R116_RGAIN},
2353 {0xa0, 0x40, ZC3XX_R117_GGAIN},
2354 {0xa0, 0x40, ZC3XX_R118_BGAIN},
2355 {}
2356 };
2357
2358 static const struct usb_action icm105a_Initial[] = {
2359 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
2360 {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT},
2361 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
2362 {0xa0, 0x0c, ZC3XX_R010_CMOSSENSORSELECT},
2363 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH},
2364 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW},
2365 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},
2366 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW},
2367 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
2368 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC},
2369 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC},
2370 {0xa0, 0xa1, ZC3XX_R08B_I2CDEVICEADDR},
2371 {0xa0, 0x00, ZC3XX_R097_WINYSTARTHIGH},
2372 {0xa0, 0x02, ZC3XX_R098_WINYSTARTLOW},
2373 {0xa0, 0x00, ZC3XX_R099_WINXSTARTHIGH},
2374 {0xa0, 0x02, ZC3XX_R09A_WINXSTARTLOW},
2375 {0xa0, 0x02, ZC3XX_R11A_FIRSTYLOW},
2376 {0xa0, 0x02, ZC3XX_R11C_FIRSTXLOW},
2377 {0xa0, 0x01, ZC3XX_R09B_WINHEIGHTHIGH},
2378 {0xa0, 0xe6, ZC3XX_R09C_WINHEIGHTLOW},
2379 {0xa0, 0x02, ZC3XX_R09D_WINWIDTHHIGH},
2380 {0xa0, 0x86, ZC3XX_R09E_WINWIDTHLOW},
2381 {0xa0, 0x77, ZC3XX_R101_SENSORCORRECTION},
2382 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
2383 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
2384 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
2385 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
2386 {0xaa, 0x01, 0x0010},
2387 {0xaa, 0x03, 0x0000},
2388 {0xaa, 0x04, 0x0001},
2389 {0xaa, 0x05, 0x0020},
2390 {0xaa, 0x06, 0x0001},
2391 {0xaa, 0x08, 0x0000},
2392 {0xaa, 0x03, 0x0001},
2393 {0xaa, 0x04, 0x0011},
2394 {0xaa, 0x05, 0x00a0},
2395 {0xaa, 0x06, 0x0001},
2396 {0xaa, 0x08, 0x0000},
2397 {0xaa, 0x03, 0x0002},
2398 {0xaa, 0x04, 0x0013},
2399 {0xaa, 0x05, 0x0020},
2400 {0xaa, 0x06, 0x0001},
2401 {0xaa, 0x08, 0x0000},
2402 {0xaa, 0x03, 0x0003},
2403 {0xaa, 0x04, 0x0015},
2404 {0xaa, 0x05, 0x0020},
2405 {0xaa, 0x06, 0x0005},
2406 {0xaa, 0x08, 0x0000},
2407 {0xaa, 0x03, 0x0004},
2408 {0xaa, 0x04, 0x0017},
2409 {0xaa, 0x05, 0x0020},
2410 {0xaa, 0x06, 0x000d},
2411 {0xaa, 0x08, 0x0000},
2412 {0xaa, 0x03, 0x0005},
2413 {0xa0, 0x04, ZC3XX_R092_I2CADDRESSSELECT},
2414 {0xa0, 0x19, ZC3XX_R093_I2CSETVALUE},
2415 {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND},
2416 {0xa1, 0x01, 0x0091},
2417 {0xaa, 0x05, 0x0020},
2418 {0xaa, 0x06, 0x0005},
2419 {0xaa, 0x08, 0x0000},
2420 {0xaa, 0x03, 0x0006},
2421 {0xaa, 0x04, 0x0017},
2422 {0xaa, 0x05, 0x0026},
2423 {0xaa, 0x06, 0x0005},
2424 {0xaa, 0x08, 0x0000},
2425 {0xaa, 0x03, 0x0007},
2426 {0xaa, 0x04, 0x0019},
2427 {0xaa, 0x05, 0x0022},
2428 {0xaa, 0x06, 0x0005},
2429 {0xaa, 0x08, 0x0000},
2430 {0xaa, 0x03, 0x0008},
2431 {0xaa, 0x04, 0x0021},
2432 {0xaa, 0x05, 0x00aa},
2433 {0xaa, 0x06, 0x0005},
2434 {0xaa, 0x08, 0x0000},
2435 {0xaa, 0x03, 0x0009},
2436 {0xaa, 0x04, 0x0023},
2437 {0xaa, 0x05, 0x00aa},
2438 {0xaa, 0x06, 0x000d},
2439 {0xaa, 0x08, 0x0000},
2440 {0xaa, 0x03, 0x000a},
2441 {0xaa, 0x04, 0x0025},
2442 {0xaa, 0x05, 0x00aa},
2443 {0xaa, 0x06, 0x0005},
2444 {0xaa, 0x08, 0x0000},
2445 {0xaa, 0x03, 0x000b},
2446 {0xaa, 0x04, 0x00ec},
2447 {0xaa, 0x05, 0x002e},
2448 {0xaa, 0x06, 0x0005},
2449 {0xaa, 0x08, 0x0000},
2450 {0xaa, 0x03, 0x000c},
2451 {0xaa, 0x04, 0x00fa},
2452 {0xaa, 0x05, 0x002a},
2453 {0xaa, 0x06, 0x0005},
2454 {0xaa, 0x08, 0x0000},
2455 {0xaa, 0x07, 0x000d},
2456 {0xaa, 0x01, 0x0005},
2457 {0xaa, 0x94, 0x0002},
2458 {0xaa, 0x90, 0x0000},
2459 {0xaa, 0x91, 0x0010},
2460 {0xaa, 0x10, 0x0064},
2461 {0xaa, 0x9b, 0x00f0},
2462 {0xaa, 0x9c, 0x0002},
2463 {0xaa, 0x14, 0x001a},
2464 {0xaa, 0x20, 0x0080},
2465 {0xaa, 0x22, 0x0080},
2466 {0xaa, 0x24, 0x0080},
2467 {0xaa, 0x26, 0x0080},
2468 {0xaa, 0x00, 0x0084},
2469 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
2470 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
2471 {0xaa, 0xa8, 0x0080},
2472 {0xa0, 0x78, ZC3XX_R18D_YTARGET},
2473 {0xa1, 0x01, 0x0002},
2474 {0xa1, 0x01, 0x0008},
2475 {0xa1, 0x01, 0x0180},
2476 {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE},
2477 {0xa0, 0x40, ZC3XX_R116_RGAIN},
2478 {0xa0, 0x40, ZC3XX_R117_GGAIN},
2479 {0xa0, 0x40, ZC3XX_R118_BGAIN},
2480 {0xa1, 0x01, 0x0008},
2481
2482 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */
2483 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */
2484 {0xa1, 0x01, 0x01c8},
2485 {0xa1, 0x01, 0x01c9},
2486 {0xa1, 0x01, 0x01ca},
2487 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */
2488
2489 {0xa0, 0x52, ZC3XX_R10A_RGB00}, /* matrix */
2490 {0xa0, 0xf7, ZC3XX_R10B_RGB01},
2491 {0xa0, 0xf7, ZC3XX_R10C_RGB02},
2492 {0xa0, 0xf7, ZC3XX_R10D_RGB10},
2493 {0xa0, 0x52, ZC3XX_R10E_RGB11},
2494 {0xa0, 0xf7, ZC3XX_R10F_RGB12},
2495 {0xa0, 0xf7, ZC3XX_R110_RGB20},
2496 {0xa0, 0xf7, ZC3XX_R111_RGB21},
2497 {0xa0, 0x52, ZC3XX_R112_RGB22},
2498 {0xa1, 0x01, 0x0180},
2499 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
2500 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
2501 {0xaa, 0x0d, 0x0003},
2502 {0xaa, 0x0c, 0x0020},
2503 {0xaa, 0x0e, 0x000e},
2504 {0xaa, 0x0f, 0x0002},
2505 {0xaa, 0x1c, 0x000d},
2506 {0xaa, 0x1d, 0x0002},
2507 {0xaa, 0x20, 0x0080},
2508 {0xaa, 0x22, 0x0080},
2509 {0xaa, 0x24, 0x0080},
2510 {0xaa, 0x26, 0x0080},
2511 {0xaa, 0x00, 0x0084},
2512 {0xa0, 0x02, ZC3XX_R0A3_EXPOSURETIMEHIGH},
2513 {0xa0, 0x0d, ZC3XX_R0A4_EXPOSURETIMELOW},
2514 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
2515 {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID},
2516 {0xa0, 0x1a, ZC3XX_R192_EXPOSURELIMITLOW},
2517 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
2518 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
2519 {0xa0, 0x4b, ZC3XX_R197_ANTIFLICKERLOW},
2520 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE},
2521 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},
2522 {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF},
2523 {0xa0, 0x12, ZC3XX_R1AA_DIGITALGAINSTEP},
2524 {0xa0, 0xc8, ZC3XX_R01D_HSYNC_0},
2525 {0xa0, 0xd8, ZC3XX_R01E_HSYNC_1},
2526 {0xa0, 0xea, ZC3XX_R01F_HSYNC_2},
2527 {0xa0, 0xff, ZC3XX_R020_HSYNC_3},
2528 {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN},
2529 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
2530 {0xa1, 0x01, 0x0180},
2531 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
2532 {0xa0, 0x40, ZC3XX_R116_RGAIN},
2533 {0xa0, 0x40, ZC3XX_R117_GGAIN},
2534 {0xa0, 0x40, ZC3XX_R118_BGAIN},
2535 {}
2536 };
2537 static const struct usb_action icm105a_50HZScale[] = {
2538 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
2539 {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */
2540 {0xaa, 0x0c, 0x0020}, /* 00,0c,20,aa */
2541 {0xaa, 0x0e, 0x000e}, /* 00,0e,0e,aa */
2542 {0xaa, 0x0f, 0x0002}, /* 00,0f,02,aa */
2543 {0xaa, 0x1c, 0x000d}, /* 00,1c,0d,aa */
2544 {0xaa, 0x1d, 0x0002}, /* 00,1d,02,aa */
2545 {0xaa, 0x20, 0x0080}, /* 00,20,80,aa */
2546 {0xaa, 0x22, 0x0080}, /* 00,22,80,aa */
2547 {0xaa, 0x24, 0x0080}, /* 00,24,80,aa */
2548 {0xaa, 0x26, 0x0080}, /* 00,26,80,aa */
2549 {0xaa, 0x00, 0x0084}, /* 00,00,84,aa */
2550 {0xa0, 0x02, ZC3XX_R0A3_EXPOSURETIMEHIGH}, /* 00,a3,02,cc */
2551 {0xa0, 0x0d, ZC3XX_R0A4_EXPOSURETIMELOW}, /* 00,a4,0d,cc */
2552 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
2553 {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,04,cc */
2554 {0xa0, 0x1a, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,1a,cc */
2555 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
2556 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
2557 {0xa0, 0x4b, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,4b,cc */
2558 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */
2559 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */
2560 {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc */
2561 {0xa0, 0x12, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,12,cc */
2562 {0xa0, 0xc8, ZC3XX_R01D_HSYNC_0}, /* 00,1d,c8,cc */
2563 {0xa0, 0xd8, ZC3XX_R01E_HSYNC_1}, /* 00,1e,d8,cc */
2564 {0xa0, 0xea, ZC3XX_R01F_HSYNC_2}, /* 00,1f,ea,cc */
2565 {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */
2566 {}
2567 };
2568 static const struct usb_action icm105a_50HZ[] = {
2569 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
2570 {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */
2571 {0xaa, 0x0c, 0x008c}, /* 00,0c,8c,aa */
2572 {0xaa, 0x0e, 0x0095}, /* 00,0e,95,aa */
2573 {0xaa, 0x0f, 0x0002}, /* 00,0f,02,aa */
2574 {0xaa, 0x1c, 0x0094}, /* 00,1c,94,aa */
2575 {0xaa, 0x1d, 0x0002}, /* 00,1d,02,aa */
2576 {0xaa, 0x20, 0x0080}, /* 00,20,80,aa */
2577 {0xaa, 0x22, 0x0080}, /* 00,22,80,aa */
2578 {0xaa, 0x24, 0x0080}, /* 00,24,80,aa */
2579 {0xaa, 0x26, 0x0080}, /* 00,26,80,aa */
2580 {0xaa, 0x00, 0x0084}, /* 00,00,84,aa */
2581 {0xa0, 0x02, ZC3XX_R0A3_EXPOSURETIMEHIGH}, /* 00,a3,02,cc */
2582 {0xa0, 0x94, ZC3XX_R0A4_EXPOSURETIMELOW}, /* 00,a4,94,cc */
2583 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
2584 {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,04,cc */
2585 {0xa0, 0x20, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,20,cc */
2586 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
2587 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
2588 {0xa0, 0x84, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,84,cc */
2589 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */
2590 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */
2591 {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc */
2592 {0xa0, 0x12, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,12,cc */
2593 {0xa0, 0xe3, ZC3XX_R01D_HSYNC_0}, /* 00,1d,e3,cc */
2594 {0xa0, 0xec, ZC3XX_R01E_HSYNC_1}, /* 00,1e,ec,cc */
2595 {0xa0, 0xf5, ZC3XX_R01F_HSYNC_2}, /* 00,1f,f5,cc */
2596 {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */
2597 {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN}, /* 01,a7,00,cc */
2598 {0xa0, 0xc0, ZC3XX_R1A8_DIGITALGAIN}, /* 01,a8,c0,cc */
2599 {}
2600 };
2601 static const struct usb_action icm105a_60HZScale[] = {
2602 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
2603 {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */
2604 {0xaa, 0x0c, 0x0004}, /* 00,0c,04,aa */
2605 {0xaa, 0x0e, 0x000d}, /* 00,0e,0d,aa */
2606 {0xaa, 0x0f, 0x0002}, /* 00,0f,02,aa */
2607 {0xaa, 0x1c, 0x0008}, /* 00,1c,08,aa */
2608 {0xaa, 0x1d, 0x0002}, /* 00,1d,02,aa */
2609 {0xaa, 0x20, 0x0080}, /* 00,20,80,aa */
2610 {0xaa, 0x22, 0x0080}, /* 00,22,80,aa */
2611 {0xaa, 0x24, 0x0080}, /* 00,24,80,aa */
2612 {0xaa, 0x26, 0x0080}, /* 00,26,80,aa */
2613 {0xaa, 0x00, 0x0084}, /* 00,00,84,aa */
2614 {0xa0, 0x02, ZC3XX_R0A3_EXPOSURETIMEHIGH}, /* 00,a3,02,cc */
2615 {0xa0, 0x08, ZC3XX_R0A4_EXPOSURETIMELOW}, /* 00,a4,08,cc */
2616 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
2617 {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,04,cc */
2618 {0xa0, 0x10, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,10,cc */
2619 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
2620 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
2621 {0xa0, 0x41, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,41,cc */
2622 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */
2623 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */
2624 {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc */
2625 {0xa0, 0x12, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,12,cc */
2626 {0xa0, 0xc1, ZC3XX_R01D_HSYNC_0}, /* 00,1d,c1,cc */
2627 {0xa0, 0xd4, ZC3XX_R01E_HSYNC_1}, /* 00,1e,d4,cc */
2628 {0xa0, 0xe8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,e8,cc */
2629 {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */
2630 {}
2631 };
2632 static const struct usb_action icm105a_60HZ[] = {
2633 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
2634 {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */
2635 {0xaa, 0x0c, 0x0008}, /* 00,0c,08,aa */
2636 {0xaa, 0x0e, 0x0086}, /* 00,0e,86,aa */
2637 {0xaa, 0x0f, 0x0002}, /* 00,0f,02,aa */
2638 {0xaa, 0x1c, 0x0085}, /* 00,1c,85,aa */
2639 {0xaa, 0x1d, 0x0002}, /* 00,1d,02,aa */
2640 {0xaa, 0x20, 0x0080}, /* 00,20,80,aa */
2641 {0xaa, 0x22, 0x0080}, /* 00,22,80,aa */
2642 {0xaa, 0x24, 0x0080}, /* 00,24,80,aa */
2643 {0xaa, 0x26, 0x0080}, /* 00,26,80,aa */
2644 {0xaa, 0x00, 0x0084}, /* 00,00,84,aa */
2645 {0xa0, 0x02, ZC3XX_R0A3_EXPOSURETIMEHIGH}, /* 00,a3,02,cc */
2646 {0xa0, 0x85, ZC3XX_R0A4_EXPOSURETIMELOW}, /* 00,a4,85,cc */
2647 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
2648 {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,04,cc */
2649 {0xa0, 0x08, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,08,cc */
2650 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
2651 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
2652 {0xa0, 0x81, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,81,cc */
2653 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */
2654 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */
2655 {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc */
2656 {0xa0, 0x12, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,12,cc */
2657 {0xa0, 0xc2, ZC3XX_R01D_HSYNC_0}, /* 00,1d,c2,cc */
2658 {0xa0, 0xd6, ZC3XX_R01E_HSYNC_1}, /* 00,1e,d6,cc */
2659 {0xa0, 0xea, ZC3XX_R01F_HSYNC_2}, /* 00,1f,ea,cc */
2660 {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */
2661 {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN}, /* 01,a7,00,cc */
2662 {0xa0, 0xc0, ZC3XX_R1A8_DIGITALGAIN}, /* 01,a8,c0,cc */
2663 {}
2664 };
2665 static const struct usb_action icm105a_NoFlickerScale[] = {
2666 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
2667 {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */
2668 {0xaa, 0x0c, 0x0004}, /* 00,0c,04,aa */
2669 {0xaa, 0x0e, 0x000d}, /* 00,0e,0d,aa */
2670 {0xaa, 0x0f, 0x0002}, /* 00,0f,02,aa */
2671 {0xaa, 0x1c, 0x0000}, /* 00,1c,00,aa */
2672 {0xaa, 0x1d, 0x0002}, /* 00,1d,02,aa */
2673 {0xaa, 0x20, 0x0080}, /* 00,20,80,aa */
2674 {0xaa, 0x22, 0x0080}, /* 00,22,80,aa */
2675 {0xaa, 0x24, 0x0080}, /* 00,24,80,aa */
2676 {0xaa, 0x26, 0x0080}, /* 00,26,80,aa */
2677 {0xaa, 0x00, 0x0084}, /* 00,00,84,aa */
2678 {0xa0, 0x02, ZC3XX_R0A3_EXPOSURETIMEHIGH}, /* 00,a3,02,cc */
2679 {0xa0, 0x00, ZC3XX_R0A4_EXPOSURETIMELOW}, /* 00,a4,00,cc */
2680 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
2681 {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,04,cc */
2682 {0xa0, 0x20, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,20,cc */
2683 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
2684 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
2685 {0xa0, 0x10, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,10,cc */
2686 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */
2687 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */
2688 {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,00,cc */
2689 {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,00,cc */
2690 {0xa0, 0xc1, ZC3XX_R01D_HSYNC_0}, /* 00,1d,c1,cc */
2691 {0xa0, 0xd4, ZC3XX_R01E_HSYNC_1}, /* 00,1e,d4,cc */
2692 {0xa0, 0xe8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,e8,cc */
2693 {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */
2694 {}
2695 };
2696 static const struct usb_action icm105a_NoFlicker[] = {
2697 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
2698 {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */
2699 {0xaa, 0x0c, 0x0004}, /* 00,0c,04,aa */
2700 {0xaa, 0x0e, 0x0081}, /* 00,0e,81,aa */
2701 {0xaa, 0x0f, 0x0002}, /* 00,0f,02,aa */
2702 {0xaa, 0x1c, 0x0080}, /* 00,1c,80,aa */
2703 {0xaa, 0x1d, 0x0002}, /* 00,1d,02,aa */
2704 {0xaa, 0x20, 0x0080}, /* 00,20,80,aa */
2705 {0xaa, 0x22, 0x0080}, /* 00,22,80,aa */
2706 {0xaa, 0x24, 0x0080}, /* 00,24,80,aa */
2707 {0xaa, 0x26, 0x0080}, /* 00,26,80,aa */
2708 {0xaa, 0x00, 0x0084}, /* 00,00,84,aa */
2709 {0xa0, 0x02, ZC3XX_R0A3_EXPOSURETIMEHIGH}, /* 00,a3,02,cc */
2710 {0xa0, 0x80, ZC3XX_R0A4_EXPOSURETIMELOW}, /* 00,a4,80,cc */
2711 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
2712 {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,04,cc */
2713 {0xa0, 0x20, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,20,cc */
2714 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
2715 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
2716 {0xa0, 0x10, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,10,cc */
2717 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */
2718 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */
2719 {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,00,cc */
2720 {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,00,cc */
2721 {0xa0, 0xc1, ZC3XX_R01D_HSYNC_0}, /* 00,1d,c1,cc */
2722 {0xa0, 0xd4, ZC3XX_R01E_HSYNC_1}, /* 00,1e,d4,cc */
2723 {0xa0, 0xe8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,e8,cc */
2724 {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */
2725 {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN}, /* 01,a7,00,cc */
2726 {0xa0, 0xc0, ZC3XX_R1A8_DIGITALGAIN}, /* 01,a8,c0,cc */
2727 {}
2728 };
2729
2730 static const struct usb_action mc501cb_Initial[] = {
2731 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */
2732 {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT}, /* 00,02,00,cc */
2733 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
2734 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* 00,01,01,cc */
2735 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00,08,03,cc */
2736 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,01,cc */
2737 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,05,cc */
2738 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, /* 00,03,02,cc */
2739 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, /* 00,04,80,cc */
2740 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* 00,05,01,cc */
2741 {0xa0, 0xd8, ZC3XX_R006_FRAMEHEIGHTLOW}, /* 00,06,d8,cc */
2742 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, /* 00,98,00,cc */
2743 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, /* 00,9a,00,cc */
2744 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* 01,1a,00,cc */
2745 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, /* 01,1c,00,cc */
2746 {0xa0, 0x01, ZC3XX_R09B_WINHEIGHTHIGH}, /* 00,9b,01,cc */
2747 {0xa0, 0xde, ZC3XX_R09C_WINHEIGHTLOW}, /* 00,9c,de,cc */
2748 {0xa0, 0x02, ZC3XX_R09D_WINWIDTHHIGH}, /* 00,9d,02,cc */
2749 {0xa0, 0x86, ZC3XX_R09E_WINWIDTHLOW}, /* 00,9e,86,cc */
2750 {0xa0, 0x33, ZC3XX_R086_EXPTIMEHIGH}, /* 00,86,33,cc */
2751 {0xa0, 0x34, ZC3XX_R087_EXPTIMEMID}, /* 00,87,34,cc */
2752 {0xa0, 0x35, ZC3XX_R088_EXPTIMELOW}, /* 00,88,35,cc */
2753 {0xa0, 0xb0, ZC3XX_R08B_I2CDEVICEADDR}, /* 00,8b,b0,cc */
2754 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,05,cc */
2755 {0xaa, 0x01, 0x0001}, /* 00,01,01,aa */
2756 {0xaa, 0x01, 0x0003}, /* 00,01,03,aa */
2757 {0xaa, 0x01, 0x0001}, /* 00,01,01,aa */
2758 {0xaa, 0x03, 0x0000}, /* 00,03,00,aa */
2759 {0xaa, 0x10, 0x0000}, /* 00,10,00,aa */
2760 {0xaa, 0x11, 0x0080}, /* 00,11,80,aa */
2761 {0xaa, 0x12, 0x0000}, /* 00,12,00,aa */
2762 {0xaa, 0x13, 0x0000}, /* 00,13,00,aa */
2763 {0xaa, 0x14, 0x0000}, /* 00,14,00,aa */
2764 {0xaa, 0x15, 0x0000}, /* 00,15,00,aa */
2765 {0xaa, 0x16, 0x0000}, /* 00,16,00,aa */
2766 {0xaa, 0x17, 0x0001}, /* 00,17,01,aa */
2767 {0xaa, 0x18, 0x00de}, /* 00,18,de,aa */
2768 {0xaa, 0x19, 0x0002}, /* 00,19,02,aa */
2769 {0xaa, 0x1a, 0x0086}, /* 00,1a,86,aa */
2770 {0xaa, 0x20, 0x00a8}, /* 00,20,a8,aa */
2771 {0xaa, 0x22, 0x0000}, /* 00,22,00,aa */
2772 {0xaa, 0x23, 0x0000}, /* 00,23,00,aa */
2773 {0xaa, 0x24, 0x0000}, /* 00,24,00,aa */
2774 {0xaa, 0x40, 0x0033}, /* 00,40,33,aa */
2775 {0xaa, 0x41, 0x0077}, /* 00,41,77,aa */
2776 {0xaa, 0x42, 0x0053}, /* 00,42,53,aa */
2777 {0xaa, 0x43, 0x00b0}, /* 00,43,b0,aa */
2778 {0xaa, 0x4b, 0x0001}, /* 00,4b,01,aa */
2779 {0xaa, 0x72, 0x0020}, /* 00,72,20,aa */
2780 {0xaa, 0x73, 0x0000}, /* 00,73,00,aa */
2781 {0xaa, 0x80, 0x0000}, /* 00,80,00,aa */
2782 {0xaa, 0x85, 0x0050}, /* 00,85,50,aa */
2783 {0xaa, 0x91, 0x0070}, /* 00,91,70,aa */
2784 {0xaa, 0x92, 0x0072}, /* 00,92,72,aa */
2785 {0xaa, 0x03, 0x0001}, /* 00,03,01,aa */
2786 {0xaa, 0x10, 0x00a0}, /* 00,10,a0,aa */
2787 {0xaa, 0x11, 0x0001}, /* 00,11,01,aa */
2788 {0xaa, 0x30, 0x0000}, /* 00,30,00,aa */
2789 {0xaa, 0x60, 0x0000}, /* 00,60,00,aa */
2790 {0xaa, 0xa0, 0x001a}, /* 00,a0,1a,aa */
2791 {0xaa, 0xa1, 0x0000}, /* 00,a1,00,aa */
2792 {0xaa, 0xa2, 0x003f}, /* 00,a2,3f,aa */
2793 {0xaa, 0xa3, 0x0028}, /* 00,a3,28,aa */
2794 {0xaa, 0xa4, 0x0010}, /* 00,a4,10,aa */
2795 {0xaa, 0xa5, 0x0020}, /* 00,a5,20,aa */
2796 {0xaa, 0xb1, 0x0044}, /* 00,b1,44,aa */
2797 {0xaa, 0xd0, 0x0001}, /* 00,d0,01,aa */
2798 {0xaa, 0xd1, 0x0085}, /* 00,d1,85,aa */
2799 {0xaa, 0xd2, 0x0080}, /* 00,d2,80,aa */
2800 {0xaa, 0xd3, 0x0080}, /* 00,d3,80,aa */
2801 {0xaa, 0xd4, 0x0080}, /* 00,d4,80,aa */
2802 {0xaa, 0xd5, 0x0080}, /* 00,d5,80,aa */
2803 {0xaa, 0xc0, 0x00c3}, /* 00,c0,c3,aa */
2804 {0xaa, 0xc2, 0x0044}, /* 00,c2,44,aa */
2805 {0xaa, 0xc4, 0x0040}, /* 00,c4,40,aa */
2806 {0xaa, 0xc5, 0x0020}, /* 00,c5,20,aa */
2807 {0xaa, 0xc6, 0x0008}, /* 00,c6,08,aa */
2808 {0xaa, 0x03, 0x0004}, /* 00,03,04,aa */
2809 {0xaa, 0x10, 0x0000}, /* 00,10,00,aa */
2810 {0xaa, 0x40, 0x0030}, /* 00,40,30,aa */
2811 {0xaa, 0x41, 0x0020}, /* 00,41,20,aa */
2812 {0xaa, 0x42, 0x002d}, /* 00,42,2d,aa */
2813 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
2814 {0xaa, 0x1c, 0x0050}, /* 00,1C,50,aa */
2815 {0xaa, 0x11, 0x0081}, /* 00,11,81,aa */
2816 {0xaa, 0x3b, 0x001d}, /* 00,3b,1D,aa */
2817 {0xaa, 0x3c, 0x004c}, /* 00,3c,4C,aa */
2818 {0xaa, 0x3d, 0x0018}, /* 00,3d,18,aa */
2819 {0xaa, 0x3e, 0x006a}, /* 00,3e,6A,aa */
2820 {0xaa, 0x01, 0x0000}, /* 00,01,00,aa */
2821 {0xaa, 0x52, 0x00ff}, /* 00,52,FF,aa */
2822 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
2823 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0d,cc */
2824 {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION}, /* 01,01,37,cc */
2825 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* 01,89,06,cc */
2826 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* 01,c5,03,cc */
2827 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* 01,cb,13,cc */
2828 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* 02,50,08,cc */
2829 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* 03,01,08,cc */
2830 {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,02,cc */
2831 {0xaa, 0x03, 0x0002}, /* 00,03,02,aa */
2832 {0xaa, 0x51, 0x0027}, /* 00,51,27,aa */
2833 {0xaa, 0x52, 0x0020}, /* 00,52,20,aa */
2834 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
2835 {0xaa, 0x50, 0x0010}, /* 00,50,10,aa */
2836 {0xaa, 0x51, 0x0010}, /* 00,51,10,aa */
2837 {0xaa, 0x54, 0x0010}, /* 00,54,10,aa */
2838 {0xaa, 0x55, 0x0010}, /* 00,55,10,aa */
2839 {0xa0, 0xf0, 0x0199}, /* 01,99,F0,cc */
2840 {0xa0, 0x80, 0x019a}, /* 01,9A,80,cc */
2841
2842 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
2843 {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
2844 {0xaa, 0x36, 0x001d}, /* 00,36,1D,aa */
2845 {0xaa, 0x37, 0x004c}, /* 00,37,4C,aa */
2846 {0xaa, 0x3b, 0x001d}, /* 00,3B,1D,aa */
2847 {}
2848 };
2849
2850 static const struct usb_action mc501cb_InitialScale[] = { /* 320x240 */
2851 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */
2852 {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT}, /* 00,02,10,cc */
2853 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
2854 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* 00,01,01,cc */
2855 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00,08,03,cc */
2856 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,01,cc */
2857 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,05,cc */
2858 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, /* 00,03,02,cc */
2859 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, /* 00,04,80,cc */
2860 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* 00,05,01,cc */
2861 {0xa0, 0xd0, ZC3XX_R006_FRAMEHEIGHTLOW}, /* 00,06,d0,cc */
2862 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, /* 00,98,00,cc */
2863 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, /* 00,9a,00,cc */
2864 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* 01,1a,00,cc */
2865 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, /* 01,1c,00,cc */
2866 {0xa0, 0x01, ZC3XX_R09B_WINHEIGHTHIGH}, /* 00,9b,01,cc */
2867 {0xa0, 0xd8, ZC3XX_R09C_WINHEIGHTLOW}, /* 00,9c,d8,cc */
2868 {0xa0, 0x02, ZC3XX_R09D_WINWIDTHHIGH}, /* 00,9d,02,cc */
2869 {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW}, /* 00,9e,88,cc */
2870 {0xa0, 0x33, ZC3XX_R086_EXPTIMEHIGH}, /* 00,86,33,cc */
2871 {0xa0, 0x34, ZC3XX_R087_EXPTIMEMID}, /* 00,87,34,cc */
2872 {0xa0, 0x35, ZC3XX_R088_EXPTIMELOW}, /* 00,88,35,cc */
2873 {0xa0, 0xb0, ZC3XX_R08B_I2CDEVICEADDR}, /* 00,8b,b0,cc */
2874 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,05,cc */
2875 {0xaa, 0x01, 0x0001}, /* 00,01,01,aa */
2876 {0xaa, 0x01, 0x0003}, /* 00,01,03,aa */
2877 {0xaa, 0x01, 0x0001}, /* 00,01,01,aa */
2878 {0xaa, 0x03, 0x0000}, /* 00,03,00,aa */
2879 {0xaa, 0x10, 0x0000}, /* 00,10,00,aa */
2880 {0xaa, 0x11, 0x0080}, /* 00,11,80,aa */
2881 {0xaa, 0x12, 0x0000}, /* 00,12,00,aa */
2882 {0xaa, 0x13, 0x0000}, /* 00,13,00,aa */
2883 {0xaa, 0x14, 0x0000}, /* 00,14,00,aa */
2884 {0xaa, 0x15, 0x0000}, /* 00,15,00,aa */
2885 {0xaa, 0x16, 0x0000}, /* 00,16,00,aa */
2886 {0xaa, 0x17, 0x0001}, /* 00,17,01,aa */
2887 {0xaa, 0x18, 0x00d8}, /* 00,18,d8,aa */
2888 {0xaa, 0x19, 0x0002}, /* 00,19,02,aa */
2889 {0xaa, 0x1a, 0x0088}, /* 00,1a,88,aa */
2890 {0xaa, 0x20, 0x00a8}, /* 00,20,a8,aa */
2891 {0xaa, 0x22, 0x0000}, /* 00,22,00,aa */
2892 {0xaa, 0x23, 0x0000}, /* 00,23,00,aa */
2893 {0xaa, 0x24, 0x0000}, /* 00,24,00,aa */
2894 {0xaa, 0x40, 0x0033}, /* 00,40,33,aa */
2895 {0xaa, 0x41, 0x0077}, /* 00,41,77,aa */
2896 {0xaa, 0x42, 0x0053}, /* 00,42,53,aa */
2897 {0xaa, 0x43, 0x00b0}, /* 00,43,b0,aa */
2898 {0xaa, 0x4b, 0x0001}, /* 00,4b,01,aa */
2899 {0xaa, 0x72, 0x0020}, /* 00,72,20,aa */
2900 {0xaa, 0x73, 0x0000}, /* 00,73,00,aa */
2901 {0xaa, 0x80, 0x0000}, /* 00,80,00,aa */
2902 {0xaa, 0x85, 0x0050}, /* 00,85,50,aa */
2903 {0xaa, 0x91, 0x0070}, /* 00,91,70,aa */
2904 {0xaa, 0x92, 0x0072}, /* 00,92,72,aa */
2905 {0xaa, 0x03, 0x0001}, /* 00,03,01,aa */
2906 {0xaa, 0x10, 0x00a0}, /* 00,10,a0,aa */
2907 {0xaa, 0x11, 0x0001}, /* 00,11,01,aa */
2908 {0xaa, 0x30, 0x0000}, /* 00,30,00,aa */
2909 {0xaa, 0x60, 0x0000}, /* 00,60,00,aa */
2910 {0xaa, 0xa0, 0x001a}, /* 00,a0,1a,aa */
2911 {0xaa, 0xa1, 0x0000}, /* 00,a1,00,aa */
2912 {0xaa, 0xa2, 0x003f}, /* 00,a2,3f,aa */
2913 {0xaa, 0xa3, 0x0028}, /* 00,a3,28,aa */
2914 {0xaa, 0xa4, 0x0010}, /* 00,a4,10,aa */
2915 {0xaa, 0xa5, 0x0020}, /* 00,a5,20,aa */
2916 {0xaa, 0xb1, 0x0044}, /* 00,b1,44,aa */
2917 {0xaa, 0xd0, 0x0001}, /* 00,d0,01,aa */
2918 {0xaa, 0xd1, 0x0085}, /* 00,d1,85,aa */
2919 {0xaa, 0xd2, 0x0080}, /* 00,d2,80,aa */
2920 {0xaa, 0xd3, 0x0080}, /* 00,d3,80,aa */
2921 {0xaa, 0xd4, 0x0080}, /* 00,d4,80,aa */
2922 {0xaa, 0xd5, 0x0080}, /* 00,d5,80,aa */
2923 {0xaa, 0xc0, 0x00c3}, /* 00,c0,c3,aa */
2924 {0xaa, 0xc2, 0x0044}, /* 00,c2,44,aa */
2925 {0xaa, 0xc4, 0x0040}, /* 00,c4,40,aa */
2926 {0xaa, 0xc5, 0x0020}, /* 00,c5,20,aa */
2927 {0xaa, 0xc6, 0x0008}, /* 00,c6,08,aa */
2928 {0xaa, 0x03, 0x0004}, /* 00,03,04,aa */
2929 {0xaa, 0x10, 0x0000}, /* 00,10,00,aa */
2930 {0xaa, 0x40, 0x0030}, /* 00,40,30,aa */
2931 {0xaa, 0x41, 0x0020}, /* 00,41,20,aa */
2932 {0xaa, 0x42, 0x002d}, /* 00,42,2d,aa */
2933 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
2934 {0xaa, 0x1c, 0x0050}, /* 00,1c,50,aa */
2935 {0xaa, 0x11, 0x0081}, /* 00,11,81,aa */
2936 {0xaa, 0x3b, 0x003a}, /* 00,3b,3A,aa */
2937 {0xaa, 0x3c, 0x0098}, /* 00,3c,98,aa */
2938 {0xaa, 0x3d, 0x0030}, /* 00,3d,30,aa */
2939 {0xaa, 0x3e, 0x00d4}, /* 00,3E,D4,aa */
2940 {0xaa, 0x01, 0x0000}, /* 00,01,00,aa */
2941 {0xaa, 0x52, 0x00ff}, /* 00,52,FF,aa */
2942 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
2943 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0d,cc */
2944 {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION}, /* 01,01,37,cc */
2945 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* 01,89,06,cc */
2946 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* 01,c5,03,cc */
2947 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* 01,cb,13,cc */
2948 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* 02,50,08,cc */
2949 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* 03,01,08,cc */
2950 {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,02,cc */
2951 {0xaa, 0x03, 0x0002}, /* 00,03,02,aa */
2952 {0xaa, 0x51, 0x004e}, /* 00,51,4E,aa */
2953 {0xaa, 0x52, 0x0041}, /* 00,52,41,aa */
2954 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
2955 {0xaa, 0x50, 0x0010}, /* 00,50,10,aa */
2956 {0xaa, 0x51, 0x0010}, /* 00,51,10,aa */
2957 {0xaa, 0x54, 0x0010}, /* 00,54,10,aa */
2958 {0xaa, 0x55, 0x0010}, /* 00,55,10,aa */
2959 {0xa0, 0xf0, 0x0199}, /* 01,99,F0,cc */
2960 {0xa0, 0x80, 0x019a}, /* 01,9A,80,cc */
2961 {}
2962 };
2963
2964 static const struct usb_action mc501cb_50HZ[] = {
2965 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
2966 {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
2967 {0xaa, 0x36, 0x001d}, /* 00,36,1D,aa */
2968 {0xaa, 0x37, 0x004c}, /* 00,37,4C,aa */
2969 {0xaa, 0x3b, 0x001d}, /* 00,3B,1D,aa */
2970 {0xaa, 0x3c, 0x004c}, /* 00,3C,4C,aa */
2971 {0xaa, 0x3d, 0x001d}, /* 00,3D,1D,aa */
2972 {0xaa, 0x3e, 0x004c}, /* 00,3E,4C,aa */
2973 {}
2974 };
2975
2976 static const struct usb_action mc501cb_50HZScale[] = {
2977 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
2978 {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
2979 {0xaa, 0x36, 0x003a}, /* 00,36,3A,aa */
2980 {0xaa, 0x37, 0x0098}, /* 00,37,98,aa */
2981 {0xaa, 0x3b, 0x003a}, /* 00,3B,3A,aa */
2982 {0xaa, 0x3c, 0x0098}, /* 00,3C,98,aa */
2983 {0xaa, 0x3d, 0x003a}, /* 00,3D,3A,aa */
2984 {0xaa, 0x3e, 0x0098}, /* 00,3E,98,aa */
2985 {}
2986 };
2987
2988 static const struct usb_action mc501cb_60HZ[] = {
2989 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
2990 {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
2991 {0xaa, 0x36, 0x0018}, /* 00,36,18,aa */
2992 {0xaa, 0x37, 0x006a}, /* 00,37,6A,aa */
2993 {0xaa, 0x3d, 0x0018}, /* 00,3D,18,aa */
2994 {0xaa, 0x3e, 0x006a}, /* 00,3E,6A,aa */
2995 {0xaa, 0x3b, 0x0018}, /* 00,3B,18,aa */
2996 {0xaa, 0x3c, 0x006a}, /* 00,3C,6A,aa */
2997 {}
2998 };
2999
3000 static const struct usb_action mc501cb_60HZScale[] = {
3001 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
3002 {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
3003 {0xaa, 0x36, 0x0030}, /* 00,36,30,aa */
3004 {0xaa, 0x37, 0x00d4}, /* 00,37,D4,aa */
3005 {0xaa, 0x3d, 0x0030}, /* 00,3D,30,aa */
3006 {0xaa, 0x3e, 0x00d4}, /* 00,3E,D4,aa */
3007 {0xaa, 0x3b, 0x0030}, /* 00,3B,30,aa */
3008 {0xaa, 0x3c, 0x00d4}, /* 00,3C,D4,aa */
3009 {}
3010 };
3011
3012 static const struct usb_action mc501cb_NoFlicker[] = {
3013 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
3014 {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
3015 {0xaa, 0x36, 0x0018}, /* 00,36,18,aa */
3016 {0xaa, 0x37, 0x006a}, /* 00,37,6A,aa */
3017 {0xaa, 0x3d, 0x0018}, /* 00,3D,18,aa */
3018 {0xaa, 0x3e, 0x006a}, /* 00,3E,6A,aa */
3019 {0xaa, 0x3b, 0x0018}, /* 00,3B,18,aa */
3020 {0xaa, 0x3c, 0x006a}, /* 00,3C,6A,aa */
3021 {}
3022 };
3023
3024 static const struct usb_action mc501cb_NoFlickerScale[] = {
3025 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
3026 {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
3027 {0xaa, 0x36, 0x0030}, /* 00,36,30,aa */
3028 {0xaa, 0x37, 0x00d4}, /* 00,37,D4,aa */
3029 {0xaa, 0x3d, 0x0030}, /* 00,3D,30,aa */
3030 {0xaa, 0x3e, 0x00d4}, /* 00,3E,D4,aa */
3031 {0xaa, 0x3b, 0x0030}, /* 00,3B,30,aa */
3032 {0xaa, 0x3c, 0x00d4}, /* 00,3C,D4,aa */
3033 {}
3034 };
3035
3036 /* from zs211.inf */
3037 static const struct usb_action ov7620_Initial[] = { /* 640x480 */
3038 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */
3039 {0xa0, 0x40, ZC3XX_R002_CLOCKSELECT}, /* 00,02,40,cc */
3040 {0xa0, 0x00, ZC3XX_R008_CLOCKSETTING}, /* 00,08,00,cc */
3041 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* 00,01,01,cc */
3042 {0xa0, 0x06, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,06,cc */
3043 {0xa0, 0x02, ZC3XX_R083_RGAINADDR}, /* 00,83,02,cc */
3044 {0xa0, 0x01, ZC3XX_R085_BGAINADDR}, /* 00,85,01,cc */
3045 {0xa0, 0x80, ZC3XX_R086_EXPTIMEHIGH}, /* 00,86,80,cc */
3046 {0xa0, 0x81, ZC3XX_R087_EXPTIMEMID}, /* 00,87,81,cc */
3047 {0xa0, 0x10, ZC3XX_R088_EXPTIMELOW}, /* 00,88,10,cc */
3048 {0xa0, 0xa1, ZC3XX_R08B_I2CDEVICEADDR}, /* 00,8b,a1,cc */
3049 {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE}, /* 00,8d,08,cc */
3050 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, /* 00,03,02,cc */
3051 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, /* 00,04,80,cc */
3052 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* 00,05,01,cc */
3053 {0xa0, 0xd8, ZC3XX_R006_FRAMEHEIGHTLOW}, /* 00,06,d8,cc */
3054 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,03,cc */
3055 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,01,cc */
3056 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, /* 00,98,00,cc */
3057 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, /* 00,9a,00,cc */
3058 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* 01,1a,00,cc */
3059 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, /* 01,1c,00,cc */
3060 {0xa0, 0xde, ZC3XX_R09C_WINHEIGHTLOW}, /* 00,9c,de,cc */
3061 {0xa0, 0x86, ZC3XX_R09E_WINWIDTHLOW}, /* 00,9e,86,cc */
3062 {0xaa, 0x12, 0x0088}, /* 00,12,88,aa */
3063 {0xaa, 0x12, 0x0048}, /* 00,12,48,aa */
3064 {0xaa, 0x75, 0x008a}, /* 00,75,8a,aa */
3065 {0xaa, 0x13, 0x00a3}, /* 00,13,a3,aa */
3066 {0xaa, 0x04, 0x0000}, /* 00,04,00,aa */
3067 {0xaa, 0x05, 0x0000}, /* 00,05,00,aa */
3068 {0xaa, 0x14, 0x0000}, /* 00,14,00,aa */
3069 {0xaa, 0x15, 0x0004}, /* 00,15,04,aa */
3070 {0xaa, 0x17, 0x0018}, /* 00,17,18,aa */
3071 {0xaa, 0x18, 0x00ba}, /* 00,18,ba,aa */
3072 {0xaa, 0x19, 0x0002}, /* 00,19,02,aa */
3073 {0xaa, 0x1a, 0x00f1}, /* 00,1a,f1,aa */
3074 {0xaa, 0x20, 0x0040}, /* 00,20,40,aa */
3075 {0xaa, 0x24, 0x0088}, /* 00,24,88,aa */
3076 {0xaa, 0x25, 0x0078}, /* 00,25,78,aa */
3077 {0xaa, 0x27, 0x00f6}, /* 00,27,f6,aa */
3078 {0xaa, 0x28, 0x00a0}, /* 00,28,a0,aa */
3079 {0xaa, 0x21, 0x0000}, /* 00,21,00,aa */
3080 {0xaa, 0x2a, 0x0083}, /* 00,2a,83,aa */
3081 {0xaa, 0x2b, 0x0096}, /* 00,2b,96,aa */
3082 {0xaa, 0x2d, 0x0005}, /* 00,2d,05,aa */
3083 {0xaa, 0x74, 0x0020}, /* 00,74,20,aa */
3084 {0xaa, 0x61, 0x0068}, /* 00,61,68,aa */
3085 {0xaa, 0x64, 0x0088}, /* 00,64,88,aa */
3086 {0xaa, 0x00, 0x0000}, /* 00,00,00,aa */
3087 {0xaa, 0x06, 0x0080}, /* 00,06,80,aa */
3088 {0xaa, 0x01, 0x0090}, /* 00,01,90,aa */
3089 {0xaa, 0x02, 0x0030}, /* 00,02,30,aa */
3090 {0xa0, 0x77, ZC3XX_R101_SENSORCORRECTION}, /* 01,01,77,cc */
3091 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,05,cc */
3092 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0d,cc */
3093 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* 01,89,06,cc */
3094 {0xa0, 0x00, 0x01ad}, /* 01,ad,00,cc */
3095 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* 01,c5,03,cc */
3096 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* 01,cb,13,cc */
3097 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* 02,50,08,cc */
3098 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* 03,01,08,cc */
3099 {0xa0, 0x68, ZC3XX_R116_RGAIN}, /* 01,16,68,cc */
3100 {0xa0, 0x52, ZC3XX_R118_BGAIN}, /* 01,18,52,cc */
3101 {0xa0, 0x40, ZC3XX_R11D_GLOBALGAIN}, /* 01,1d,40,cc */
3102 {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,02,cc */
3103 {0xa0, 0x50, ZC3XX_R1A8_DIGITALGAIN}, /* 01,a8,50,cc */
3104 {}
3105 };
3106 static const struct usb_action ov7620_InitialScale[] = { /* 320x240 */
3107 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */
3108 {0xa0, 0x50, ZC3XX_R002_CLOCKSELECT}, /* 00,02,50,cc */
3109 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00,08,00,cc */
3110 /* mx change? */
3111 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* 00,01,01,cc */
3112 {0xa0, 0x06, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,06,cc */
3113 {0xa0, 0x02, ZC3XX_R083_RGAINADDR}, /* 00,83,02,cc */
3114 {0xa0, 0x01, ZC3XX_R085_BGAINADDR}, /* 00,85,01,cc */
3115 {0xa0, 0x80, ZC3XX_R086_EXPTIMEHIGH}, /* 00,86,80,cc */
3116 {0xa0, 0x81, ZC3XX_R087_EXPTIMEMID}, /* 00,87,81,cc */
3117 {0xa0, 0x10, ZC3XX_R088_EXPTIMELOW}, /* 00,88,10,cc */
3118 {0xa0, 0xa1, ZC3XX_R08B_I2CDEVICEADDR}, /* 00,8b,a1,cc */
3119 {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE}, /* 00,8d,08,cc */
3120 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, /* 00,03,02,cc */
3121 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, /* 00,04,80,cc */
3122 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* 00,05,01,cc */
3123 {0xa0, 0xd0, ZC3XX_R006_FRAMEHEIGHTLOW}, /* 00,06,d0,cc */
3124 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,03,cc */
3125 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,01,cc */
3126 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, /* 00,98,00,cc */
3127 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, /* 00,9a,00,cc */
3128 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* 01,1a,00,cc */
3129 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, /* 01,1c,00,cc */
3130 {0xa0, 0xd6, ZC3XX_R09C_WINHEIGHTLOW}, /* 00,9c,d6,cc */
3131 /* OV7648 00,9c,d8,cc */
3132 {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW}, /* 00,9e,88,cc */
3133 {0xaa, 0x12, 0x0088}, /* 00,12,88,aa */
3134 {0xaa, 0x12, 0x0048}, /* 00,12,48,aa */
3135 {0xaa, 0x75, 0x008a}, /* 00,75,8a,aa */
3136 {0xaa, 0x13, 0x00a3}, /* 00,13,a3,aa */
3137 {0xaa, 0x04, 0x0000}, /* 00,04,00,aa */
3138 {0xaa, 0x05, 0x0000}, /* 00,05,00,aa */
3139 {0xaa, 0x14, 0x0000}, /* 00,14,00,aa */
3140 {0xaa, 0x15, 0x0004}, /* 00,15,04,aa */
3141 {0xaa, 0x24, 0x0088}, /* 00,24,88,aa */
3142 {0xaa, 0x25, 0x0078}, /* 00,25,78,aa */
3143 {0xaa, 0x17, 0x0018}, /* 00,17,18,aa */
3144 {0xaa, 0x18, 0x00ba}, /* 00,18,ba,aa */
3145 {0xaa, 0x19, 0x0002}, /* 00,19,02,aa */
3146 {0xaa, 0x1a, 0x00f2}, /* 00,1a,f2,aa */
3147 {0xaa, 0x20, 0x0040}, /* 00,20,40,aa */
3148 {0xaa, 0x27, 0x00f6}, /* 00,27,f6,aa */
3149 {0xaa, 0x28, 0x00a0}, /* 00,28,a0,aa */
3150 {0xaa, 0x21, 0x0000}, /* 00,21,00,aa */
3151 {0xaa, 0x2a, 0x0083}, /* 00,2a,83,aa */
3152 {0xaa, 0x2b, 0x0096}, /* 00,2b,96,aa */
3153 {0xaa, 0x2d, 0x0005}, /* 00,2d,05,aa */
3154 {0xaa, 0x74, 0x0020}, /* 00,74,20,aa */
3155 {0xaa, 0x61, 0x0068}, /* 00,61,68,aa */
3156 {0xaa, 0x64, 0x0088}, /* 00,64,88,aa */
3157 {0xaa, 0x00, 0x0000}, /* 00,00,00,aa */
3158 {0xaa, 0x06, 0x0080}, /* 00,06,80,aa */
3159 {0xaa, 0x01, 0x0090}, /* 00,01,90,aa */
3160 {0xaa, 0x02, 0x0030}, /* 00,02,30,aa */
3161 {0xa0, 0x77, ZC3XX_R101_SENSORCORRECTION}, /* 01,01,77,cc */
3162 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,05,cc */
3163 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0d,cc */
3164 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* 01,89,06,cc */
3165 {0xa0, 0x00, 0x01ad}, /* 01,ad,00,cc */
3166 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* 01,c5,03,cc */
3167 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* 01,cb,13,cc */
3168 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* 02,50,08,cc */
3169 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* 03,01,08,cc */
3170 {0xa0, 0x68, ZC3XX_R116_RGAIN}, /* 01,16,68,cc */
3171 {0xa0, 0x52, ZC3XX_R118_BGAIN}, /* 01,18,52,cc */
3172 {0xa0, 0x50, ZC3XX_R11D_GLOBALGAIN}, /* 01,1d,50,cc */
3173 {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,02,cc */
3174 {0xa0, 0x50, ZC3XX_R1A8_DIGITALGAIN}, /* 01,a8,50,cc */
3175 {}
3176 };
3177 static const struct usb_action ov7620_50HZ[] = {
3178 {0xdd, 0x00, 0x0100}, /* 00,01,00,dd */
3179 {0xaa, 0x2b, 0x0096}, /* 00,2b,96,aa */
3180 /* enable 1/120s & 1/100s exposures for banding filter */
3181 {0xaa, 0x75, 0x008e},
3182 {0xaa, 0x2d, 0x0005}, /* 00,2d,05,aa */
3183 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
3184 {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,04,cc */
3185 {0xa0, 0x18, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,18,cc */
3186 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
3187 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
3188 {0xa0, 0x83, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,83,cc */
3189 {0xaa, 0x76, 0x0003}, /* 00,76,03,aa */
3190 /* {0xa0, 0x40, ZC3XX_R002_CLOCKSELECT}, * 00,02,40,cc
3191 * if mode0 (640x480) */
3192 {}
3193 };
3194 static const struct usb_action ov7620_60HZ[] = {
3195 {0xdd, 0x00, 0x0100}, /* 00,01,00,dd */
3196 {0xaa, 0x2b, 0x0000}, /* 00,2b,00,aa */
3197 /* enable 1/120s & 1/100s exposures for banding filter */
3198 {0xaa, 0x75, 0x008e},
3199 {0xaa, 0x2d, 0x0005}, /* 00,2d,05,aa */
3200 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
3201 {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,04,cc */
3202 {0xa0, 0x18, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,18,cc */
3203 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
3204 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
3205 {0xa0, 0x83, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,83,cc */
3206 {0xaa, 0x76, 0x0003}, /* 00,76,03,aa */
3207 /* {0xa0, 0x40, ZC3XX_R002_CLOCKSELECT}, * 00,02,40,cc
3208 * if mode0 (640x480) */
3209 /* ?? in gspca v1, it was
3210 {0xa0, 0x00, 0x0039}, * 00,00,00,dd *
3211 {0xa1, 0x01, 0x0037}, */
3212 {}
3213 };
3214 static const struct usb_action ov7620_NoFlicker[] = {
3215 {0xdd, 0x00, 0x0100}, /* 00,01,00,dd */
3216 {0xaa, 0x2b, 0x0000}, /* 00,2b,00,aa */
3217 /* disable 1/120s & 1/100s exposures for banding filter */
3218 {0xaa, 0x75, 0x008a},
3219 {0xaa, 0x2d, 0x0001}, /* 00,2d,01,aa */
3220 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
3221 {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,04,cc */
3222 {0xa0, 0x18, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,18,cc */
3223 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
3224 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
3225 {0xa0, 0x01, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,01,cc */
3226 /* {0xa0, 0x44, ZC3XX_R002_CLOCKSELECT}, * 00,02,44,cc
3227 * if mode1 (320x240) */
3228 /* ?? was
3229 {0xa0, 0x00, 0x0039}, * 00,00,00,dd *
3230 {0xa1, 0x01, 0x0037}, */
3231 {}
3232 };
3233
3234 static const struct usb_action ov7630c_InitialScale[] = {
3235 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
3236 {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT},
3237 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
3238 {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT},
3239 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
3240 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
3241 {0xa0, 0x06, ZC3XX_R010_CMOSSENSORSELECT},
3242 {0xa0, 0xa1, ZC3XX_R08B_I2CDEVICEADDR},
3243 {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE},
3244 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH},
3245 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW},
3246 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},
3247 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW},
3248 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC},
3249 {0xaa, 0x12, 0x0080},
3250 {0xa0, 0x02, ZC3XX_R083_RGAINADDR},
3251 {0xa0, 0x01, ZC3XX_R085_BGAINADDR},
3252 {0xa0, 0x90, ZC3XX_R086_EXPTIMEHIGH},
3253 {0xa0, 0x91, ZC3XX_R087_EXPTIMEMID},
3254 {0xa0, 0x10, ZC3XX_R088_EXPTIMELOW},
3255 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW},
3256 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW},
3257 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW},
3258 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW},
3259 {0xa0, 0xd8, ZC3XX_R09C_WINHEIGHTLOW},
3260 {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW},
3261 {0xaa, 0x12, 0x0069},
3262 {0xaa, 0x04, 0x0020},
3263 {0xaa, 0x06, 0x0050},
3264 {0xaa, 0x13, 0x0083},
3265 {0xaa, 0x14, 0x0000},
3266 {0xaa, 0x15, 0x0024},
3267 {0xaa, 0x17, 0x0018},
3268 {0xaa, 0x18, 0x00ba},
3269 {0xaa, 0x19, 0x0002},
3270 {0xaa, 0x1a, 0x00f6},
3271 {0xaa, 0x1b, 0x0002},
3272 {0xaa, 0x20, 0x00c2},
3273 {0xaa, 0x24, 0x0060},
3274 {0xaa, 0x25, 0x0040},
3275 {0xaa, 0x26, 0x0030},
3276 {0xaa, 0x27, 0x00ea},
3277 {0xaa, 0x28, 0x00a0},
3278 {0xaa, 0x21, 0x0000},
3279 {0xaa, 0x2a, 0x0081},
3280 {0xaa, 0x2b, 0x0096},
3281 {0xaa, 0x2d, 0x0094},
3282 {0xaa, 0x2f, 0x003d},
3283 {0xaa, 0x30, 0x0024},
3284 {0xaa, 0x60, 0x0000},
3285 {0xaa, 0x61, 0x0040},
3286 {0xaa, 0x68, 0x007c},
3287 {0xaa, 0x6f, 0x0015},
3288 {0xaa, 0x75, 0x0088},
3289 {0xaa, 0x77, 0x00b5},
3290 {0xaa, 0x01, 0x0060},
3291 {0xaa, 0x02, 0x0060},
3292 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
3293 {0xa0, 0x77, ZC3XX_R101_SENSORCORRECTION},
3294 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
3295 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
3296 {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN},
3297 {0xa0, 0x00, 0x01ad},
3298 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
3299 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
3300 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
3301 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
3302 {0xa0, 0x60, ZC3XX_R116_RGAIN},
3303 {0xa0, 0x46, ZC3XX_R118_BGAIN},
3304 {0xa0, 0x04, ZC3XX_R113_RGB03},
3305 /* 0x10, */
3306 {0xa1, 0x01, 0x0002},
3307 {0xa0, 0x50, ZC3XX_R10A_RGB00}, /* matrix */
3308 {0xa0, 0xf8, ZC3XX_R10B_RGB01},
3309 {0xa0, 0xf8, ZC3XX_R10C_RGB02},
3310 {0xa0, 0xf8, ZC3XX_R10D_RGB10},
3311 {0xa0, 0x50, ZC3XX_R10E_RGB11},
3312 {0xa0, 0xf8, ZC3XX_R10F_RGB12},
3313 {0xa0, 0xf8, ZC3XX_R110_RGB20},
3314 {0xa0, 0xf8, ZC3XX_R111_RGB21},
3315 {0xa0, 0x50, ZC3XX_R112_RGB22},
3316 {0xa1, 0x01, 0x0008},
3317 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */
3318 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */
3319 {0xa1, 0x01, 0x01c8},
3320 {0xa1, 0x01, 0x01c9},
3321 {0xa1, 0x01, 0x01ca},
3322 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */
3323 {0xa0, 0x01, ZC3XX_R120_GAMMA00}, /* gamma 2 ?*/
3324 {0xa0, 0x0c, ZC3XX_R121_GAMMA01},
3325 {0xa0, 0x1f, ZC3XX_R122_GAMMA02},
3326 {0xa0, 0x3a, ZC3XX_R123_GAMMA03},
3327 {0xa0, 0x53, ZC3XX_R124_GAMMA04},
3328 {0xa0, 0x6d, ZC3XX_R125_GAMMA05},
3329 {0xa0, 0x85, ZC3XX_R126_GAMMA06},
3330 {0xa0, 0x9c, ZC3XX_R127_GAMMA07},
3331 {0xa0, 0xb0, ZC3XX_R128_GAMMA08},
3332 {0xa0, 0xc2, ZC3XX_R129_GAMMA09},
3333 {0xa0, 0xd1, ZC3XX_R12A_GAMMA0A},
3334 {0xa0, 0xde, ZC3XX_R12B_GAMMA0B},
3335 {0xa0, 0xe9, ZC3XX_R12C_GAMMA0C},
3336 {0xa0, 0xf2, ZC3XX_R12D_GAMMA0D},
3337 {0xa0, 0xf9, ZC3XX_R12E_GAMMA0E},
3338 {0xa0, 0xff, ZC3XX_R12F_GAMMA0F},
3339 {0xa0, 0x05, ZC3XX_R130_GAMMA10},
3340 {0xa0, 0x0f, ZC3XX_R131_GAMMA11},
3341 {0xa0, 0x16, ZC3XX_R132_GAMMA12},
3342 {0xa0, 0x1a, ZC3XX_R133_GAMMA13},
3343 {0xa0, 0x19, ZC3XX_R134_GAMMA14},
3344 {0xa0, 0x19, ZC3XX_R135_GAMMA15},
3345 {0xa0, 0x17, ZC3XX_R136_GAMMA16},
3346 {0xa0, 0x15, ZC3XX_R137_GAMMA17},
3347 {0xa0, 0x12, ZC3XX_R138_GAMMA18},
3348 {0xa0, 0x10, ZC3XX_R139_GAMMA19},
3349 {0xa0, 0x0e, ZC3XX_R13A_GAMMA1A},
3350 {0xa0, 0x0b, ZC3XX_R13B_GAMMA1B},
3351 {0xa0, 0x09, ZC3XX_R13C_GAMMA1C},
3352 {0xa0, 0x08, ZC3XX_R13D_GAMMA1D},
3353 {0xa0, 0x06, ZC3XX_R13E_GAMMA1E},
3354 {0xa0, 0x03, ZC3XX_R13F_GAMMA1F},
3355 {0xa0, 0x50, ZC3XX_R10A_RGB00}, /* matrix */
3356 {0xa0, 0xf8, ZC3XX_R10B_RGB01},
3357 {0xa0, 0xf8, ZC3XX_R10C_RGB02},
3358 {0xa0, 0xf8, ZC3XX_R10D_RGB10},
3359 {0xa0, 0x50, ZC3XX_R10E_RGB11},
3360 {0xa0, 0xf8, ZC3XX_R10F_RGB12},
3361 {0xa0, 0xf8, ZC3XX_R110_RGB20},
3362 {0xa0, 0xf8, ZC3XX_R111_RGB21},
3363 {0xa0, 0x50, ZC3XX_R112_RGB22},
3364
3365 {0xa1, 0x01, 0x0180},
3366 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
3367 {0xaa, 0x10, 0x001b},
3368 {0xaa, 0x76, 0x0002},
3369 {0xaa, 0x2a, 0x0081},
3370 {0xaa, 0x2b, 0x0000},
3371 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
3372 {0xa0, 0x01, ZC3XX_R191_EXPOSURELIMITMID},
3373 {0xa0, 0xb8, ZC3XX_R192_EXPOSURELIMITLOW},
3374 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
3375 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
3376 {0xa0, 0x37, ZC3XX_R197_ANTIFLICKERLOW},
3377 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE},
3378 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},
3379 {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF},
3380 {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP},
3381 {0xa0, 0x50, ZC3XX_R11D_GLOBALGAIN},
3382 {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE},
3383 {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE},
3384 {0xaa, 0x13, 0x0083}, /* 40 */
3385 {0xa1, 0x01, 0x0180},
3386 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
3387 {}
3388 };
3389
3390 static const struct usb_action ov7630c_Initial[] = {
3391 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
3392 {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT},
3393 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
3394 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
3395 {0xa0, 0x06, ZC3XX_R010_CMOSSENSORSELECT},
3396 {0xa0, 0xa1, ZC3XX_R08B_I2CDEVICEADDR},
3397 {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE},
3398 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH},
3399 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW},
3400 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},
3401 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW},
3402 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC},
3403
3404 {0xaa, 0x12, 0x0080},
3405 {0xa0, 0x02, ZC3XX_R083_RGAINADDR},
3406 {0xa0, 0x01, ZC3XX_R085_BGAINADDR},
3407 {0xa0, 0x90, ZC3XX_R086_EXPTIMEHIGH},
3408 {0xa0, 0x91, ZC3XX_R087_EXPTIMEMID},
3409 {0xa0, 0x10, ZC3XX_R088_EXPTIMELOW},
3410 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW},
3411 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW},
3412 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW},
3413 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW},
3414 {0xa0, 0xe6, ZC3XX_R09C_WINHEIGHTLOW},
3415 {0xa0, 0x86, ZC3XX_R09E_WINWIDTHLOW},
3416 {0xaa, 0x12, 0x0069}, /* i2c */
3417 {0xaa, 0x04, 0x0020},
3418 {0xaa, 0x06, 0x0050},
3419 {0xaa, 0x13, 0x00c3},
3420 {0xaa, 0x14, 0x0000},
3421 {0xaa, 0x15, 0x0024},
3422 {0xaa, 0x19, 0x0003},
3423 {0xaa, 0x1a, 0x00f6},
3424 {0xaa, 0x1b, 0x0002},
3425 {0xaa, 0x20, 0x00c2},
3426 {0xaa, 0x24, 0x0060},
3427 {0xaa, 0x25, 0x0040},
3428 {0xaa, 0x26, 0x0030},
3429 {0xaa, 0x27, 0x00ea},
3430 {0xaa, 0x28, 0x00a0},
3431 {0xaa, 0x21, 0x0000},
3432 {0xaa, 0x2a, 0x0081},
3433 {0xaa, 0x2b, 0x0096},
3434 {0xaa, 0x2d, 0x0084},
3435 {0xaa, 0x2f, 0x003d},
3436 {0xaa, 0x30, 0x0024},
3437 {0xaa, 0x60, 0x0000},
3438 {0xaa, 0x61, 0x0040},
3439 {0xaa, 0x68, 0x007c},
3440 {0xaa, 0x6f, 0x0015},
3441 {0xaa, 0x75, 0x0088},
3442 {0xaa, 0x77, 0x00b5},
3443 {0xaa, 0x01, 0x0060},
3444 {0xaa, 0x02, 0x0060},
3445 {0xaa, 0x17, 0x0018},
3446 {0xaa, 0x18, 0x00ba},
3447 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
3448 {0xa0, 0x77, ZC3XX_R101_SENSORCORRECTION},
3449 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
3450 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
3451 {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN},
3452 {0xa0, 0x00, 0x01ad},
3453 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
3454 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
3455 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
3456 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
3457 {0xa0, 0x60, ZC3XX_R116_RGAIN},
3458 {0xa0, 0x46, ZC3XX_R118_BGAIN},
3459 {0xa0, 0x04, ZC3XX_R113_RGB03},
3460
3461 {0xa1, 0x01, 0x0002},
3462 {0xa0, 0x4e, ZC3XX_R10A_RGB00}, /* matrix */
3463 {0xa0, 0xfe, ZC3XX_R10B_RGB01},
3464 {0xa0, 0xf4, ZC3XX_R10C_RGB02},
3465 {0xa0, 0xf7, ZC3XX_R10D_RGB10},
3466 {0xa0, 0x4d, ZC3XX_R10E_RGB11},
3467 {0xa0, 0xfc, ZC3XX_R10F_RGB12},
3468 {0xa0, 0x00, ZC3XX_R110_RGB20},
3469 {0xa0, 0xf6, ZC3XX_R111_RGB21},
3470 {0xa0, 0x4a, ZC3XX_R112_RGB22},
3471
3472 {0xa1, 0x01, 0x0008},
3473 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */
3474 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */
3475 {0xa1, 0x01, 0x01c8},
3476 {0xa1, 0x01, 0x01c9},
3477 {0xa1, 0x01, 0x01ca},
3478 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */
3479 {0xa0, 0x16, ZC3XX_R120_GAMMA00}, /* gamma ~4 */
3480 {0xa0, 0x3a, ZC3XX_R121_GAMMA01},
3481 {0xa0, 0x5b, ZC3XX_R122_GAMMA02},
3482 {0xa0, 0x7c, ZC3XX_R123_GAMMA03},
3483 {0xa0, 0x94, ZC3XX_R124_GAMMA04},
3484 {0xa0, 0xa9, ZC3XX_R125_GAMMA05},
3485 {0xa0, 0xbb, ZC3XX_R126_GAMMA06},
3486 {0xa0, 0xca, ZC3XX_R127_GAMMA07},
3487 {0xa0, 0xd7, ZC3XX_R128_GAMMA08},
3488 {0xa0, 0xe1, ZC3XX_R129_GAMMA09},
3489 {0xa0, 0xea, ZC3XX_R12A_GAMMA0A},
3490 {0xa0, 0xf1, ZC3XX_R12B_GAMMA0B},
3491 {0xa0, 0xf7, ZC3XX_R12C_GAMMA0C},
3492 {0xa0, 0xfc, ZC3XX_R12D_GAMMA0D},
3493 {0xa0, 0xff, ZC3XX_R12E_GAMMA0E},
3494 {0xa0, 0xff, ZC3XX_R12F_GAMMA0F},
3495 {0xa0, 0x20, ZC3XX_R130_GAMMA10},
3496 {0xa0, 0x22, ZC3XX_R131_GAMMA11},
3497 {0xa0, 0x20, ZC3XX_R132_GAMMA12},
3498 {0xa0, 0x1c, ZC3XX_R133_GAMMA13},
3499 {0xa0, 0x16, ZC3XX_R134_GAMMA14},
3500 {0xa0, 0x13, ZC3XX_R135_GAMMA15},
3501 {0xa0, 0x10, ZC3XX_R136_GAMMA16},
3502 {0xa0, 0x0d, ZC3XX_R137_GAMMA17},
3503 {0xa0, 0x0b, ZC3XX_R138_GAMMA18},
3504 {0xa0, 0x09, ZC3XX_R139_GAMMA19},
3505 {0xa0, 0x07, ZC3XX_R13A_GAMMA1A},
3506 {0xa0, 0x06, ZC3XX_R13B_GAMMA1B},
3507 {0xa0, 0x05, ZC3XX_R13C_GAMMA1C},
3508 {0xa0, 0x04, ZC3XX_R13D_GAMMA1D},
3509 {0xa0, 0x00, ZC3XX_R13E_GAMMA1E},
3510 {0xa0, 0x01, ZC3XX_R13F_GAMMA1F},
3511 {0xa0, 0x4e, ZC3XX_R10A_RGB00}, /* matrix */
3512 {0xa0, 0xfe, ZC3XX_R10B_RGB01},
3513 {0xa0, 0xf4, ZC3XX_R10C_RGB02},
3514 {0xa0, 0xf7, ZC3XX_R10D_RGB10},
3515 {0xa0, 0x4d, ZC3XX_R10E_RGB11},
3516 {0xa0, 0xfc, ZC3XX_R10F_RGB12},
3517 {0xa0, 0x00, ZC3XX_R110_RGB20},
3518 {0xa0, 0xf6, ZC3XX_R111_RGB21},
3519 {0xa0, 0x4a, ZC3XX_R112_RGB22},
3520
3521 {0xa1, 0x01, 0x0180},
3522 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
3523 {0xaa, 0x10, 0x000d},
3524 {0xaa, 0x76, 0x0002},
3525 {0xaa, 0x2a, 0x0081},
3526 {0xaa, 0x2b, 0x0000},
3527 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
3528 {0xa0, 0x00, ZC3XX_R191_EXPOSURELIMITMID},
3529 {0xa0, 0xd8, ZC3XX_R192_EXPOSURELIMITLOW},
3530 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
3531 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
3532 {0xa0, 0x1b, ZC3XX_R197_ANTIFLICKERLOW},
3533 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE},
3534 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},
3535 {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF},
3536 {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP},
3537 {0xa0, 0x50, ZC3XX_R11D_GLOBALGAIN},
3538 {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE},
3539 {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE},
3540 {0xaa, 0x13, 0x00c3},
3541
3542 {0xa1, 0x01, 0x0180},
3543 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
3544 {}
3545 };
3546
3547 static const struct usb_action pas106b_Initial_com[] = {
3548 /* Sream and Sensor specific */
3549 {0xa1, 0x01, 0x0010}, /* CMOSSensorSelect */
3550 /* System */
3551 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* SystemControl */
3552 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* SystemControl */
3553 /* Picture size */
3554 {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT}, /* ClockSelect */
3555 {0xa0, 0x03, 0x003a},
3556 {0xa0, 0x0c, 0x003b},
3557 {0xa0, 0x04, 0x0038},
3558 {}
3559 };
3560
3561 static const struct usb_action pas106b_InitialScale[] = { /* 176x144 */
3562 /* JPEG control */
3563 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
3564 /* Sream and Sensor specific */
3565 {0xa0, 0x0f, ZC3XX_R010_CMOSSENSORSELECT},
3566 /* Picture size */
3567 {0xa0, 0x00, ZC3XX_R003_FRAMEWIDTHHIGH},
3568 {0xa0, 0xb0, ZC3XX_R004_FRAMEWIDTHLOW},
3569 {0xa0, 0x00, ZC3XX_R005_FRAMEHEIGHTHIGH},
3570 {0xa0, 0x90, ZC3XX_R006_FRAMEHEIGHTLOW},
3571 /* System */
3572 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
3573 /* Sream and Sensor specific */
3574 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC},
3575 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC},
3576 /* Sensor Interface */
3577 {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE},
3578 /* Window inside sensor array */
3579 {0xa0, 0x03, ZC3XX_R09A_WINXSTARTLOW},
3580 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW},
3581 {0xa0, 0x03, ZC3XX_R11C_FIRSTXLOW},
3582 {0xa0, 0x28, ZC3XX_R09C_WINHEIGHTLOW},
3583 {0xa0, 0x68, ZC3XX_R09E_WINWIDTHLOW},
3584 /* Init the sensor */
3585 {0xaa, 0x02, 0x0004},
3586 {0xaa, 0x08, 0x0000},
3587 {0xaa, 0x09, 0x0005},
3588 {0xaa, 0x0a, 0x0002},
3589 {0xaa, 0x0b, 0x0002},
3590 {0xaa, 0x0c, 0x0005},
3591 {0xaa, 0x0d, 0x0000},
3592 {0xaa, 0x0e, 0x0002},
3593 {0xaa, 0x14, 0x0081},
3594 /* Other registers */
3595 {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION},
3596 /* Frame retrieving */
3597 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
3598 /* Gains */
3599 {0xa0, 0xa0, ZC3XX_R1A8_DIGITALGAIN},
3600 /* Unknown */
3601 {0xa0, 0x00, 0x01ad},
3602 /* Sharpness */
3603 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
3604 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
3605 /* Other registers */
3606 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
3607 /* Auto exposure and white balance */
3608 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
3609 /*Dead pixels */
3610 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
3611 /* EEPROM */
3612 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
3613 /* JPEG control */
3614 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
3615 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00},
3616 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05},
3617 /* Other registers */
3618 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
3619 /* Auto exposure and white balance */
3620 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
3621 /*Dead pixels */
3622 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
3623 /* EEPROM */
3624 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
3625 /* JPEG control */
3626 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
3627 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00},
3628 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05},
3629
3630 {0xa0, 0x58, ZC3XX_R10A_RGB00}, /* matrix */
3631 {0xa0, 0xf4, ZC3XX_R10B_RGB01},
3632 {0xa0, 0xf4, ZC3XX_R10C_RGB02},
3633 {0xa0, 0xf4, ZC3XX_R10D_RGB10},
3634 {0xa0, 0x58, ZC3XX_R10E_RGB11},
3635 {0xa0, 0xf4, ZC3XX_R10F_RGB12},
3636 {0xa0, 0xf4, ZC3XX_R110_RGB20},
3637 {0xa0, 0xf4, ZC3XX_R111_RGB21},
3638 {0xa0, 0x58, ZC3XX_R112_RGB22},
3639 /* Auto correction */
3640 {0xa0, 0x03, ZC3XX_R181_WINXSTART},
3641 {0xa0, 0x08, ZC3XX_R182_WINXWIDTH},
3642 {0xa0, 0x16, ZC3XX_R183_WINXCENTER},
3643 {0xa0, 0x03, ZC3XX_R184_WINYSTART},
3644 {0xa0, 0x05, ZC3XX_R185_WINYWIDTH},
3645 {0xa0, 0x14, ZC3XX_R186_WINYCENTER},
3646 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
3647 /* Auto exposure and white balance */
3648 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
3649 {0xa0, 0x03, ZC3XX_R191_EXPOSURELIMITMID},
3650 {0xa0, 0xb1, ZC3XX_R192_EXPOSURELIMITLOW},
3651 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
3652 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
3653 {0xa0, 0x87, ZC3XX_R197_ANTIFLICKERLOW},
3654 {0xa0, 0x0c, ZC3XX_R18C_AEFREEZE},
3655 {0xa0, 0x18, ZC3XX_R18F_AEUNFREEZE},
3656 /* sensor on */
3657 {0xaa, 0x07, 0x00b1},
3658 {0xaa, 0x05, 0x0003},
3659 {0xaa, 0x04, 0x0001},
3660 {0xaa, 0x03, 0x003b},
3661 /* Gains */
3662 {0xa0, 0x20, ZC3XX_R1A9_DIGITALLIMITDIFF},
3663 {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP},
3664 {0xa0, 0xa0, ZC3XX_R11D_GLOBALGAIN},
3665 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN},
3666 /* Auto correction */
3667 {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE},
3668 {0xa1, 0x01, 0x0180}, /* AutoCorrectEnable */
3669 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
3670 /* Gains */
3671 {0xa0, 0x40, ZC3XX_R116_RGAIN},
3672 {0xa0, 0x40, ZC3XX_R117_GGAIN},
3673 {0xa0, 0x40, ZC3XX_R118_BGAIN},
3674 {}
3675 };
3676
3677 static const struct usb_action pas106b_Initial[] = { /* 352x288 */
3678 /* JPEG control */
3679 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
3680 /* Sream and Sensor specific */
3681 {0xa0, 0x0f, ZC3XX_R010_CMOSSENSORSELECT},
3682 /* Picture size */
3683 {0xa0, 0x01, ZC3XX_R003_FRAMEWIDTHHIGH},
3684 {0xa0, 0x60, ZC3XX_R004_FRAMEWIDTHLOW},
3685 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},
3686 {0xa0, 0x20, ZC3XX_R006_FRAMEHEIGHTLOW},
3687 /* System */
3688 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
3689 /* Sream and Sensor specific */
3690 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC},
3691 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC},
3692 /* Sensor Interface */
3693 {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE},
3694 /* Window inside sensor array */
3695 {0xa0, 0x03, ZC3XX_R09A_WINXSTARTLOW},
3696 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW},
3697 {0xa0, 0x03, ZC3XX_R11C_FIRSTXLOW},
3698 {0xa0, 0x28, ZC3XX_R09C_WINHEIGHTLOW},
3699 {0xa0, 0x68, ZC3XX_R09E_WINWIDTHLOW},
3700 /* Init the sensor */
3701 {0xaa, 0x02, 0x0004},
3702 {0xaa, 0x08, 0x0000},
3703 {0xaa, 0x09, 0x0005},
3704 {0xaa, 0x0a, 0x0002},
3705 {0xaa, 0x0b, 0x0002},
3706 {0xaa, 0x0c, 0x0005},
3707 {0xaa, 0x0d, 0x0000},
3708 {0xaa, 0x0e, 0x0002},
3709 {0xaa, 0x14, 0x0081},
3710 /* Other registers */
3711 {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION},
3712 /* Frame retrieving */
3713 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
3714 /* Gains */
3715 {0xa0, 0xa0, ZC3XX_R1A8_DIGITALGAIN},
3716 /* Unknown */
3717 {0xa0, 0x00, 0x01ad},
3718 /* Sharpness */
3719 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
3720 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
3721 /* Other registers */
3722 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
3723 /* Auto exposure and white balance */
3724 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
3725 {0xa0, 0x80, ZC3XX_R18D_YTARGET},
3726 /*Dead pixels */
3727 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
3728 /* EEPROM */
3729 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
3730 /* JPEG control */
3731 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
3732 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00},
3733 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05},
3734 /* Other registers */
3735 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
3736 /* Auto exposure and white balance */
3737 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
3738 /*Dead pixels */
3739 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
3740 /* EEPROM */
3741 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
3742 /* JPEG control */
3743 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
3744 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00},
3745 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05},
3746
3747 {0xa0, 0x58, ZC3XX_R10A_RGB00}, /* matrix */
3748 {0xa0, 0xf4, ZC3XX_R10B_RGB01},
3749 {0xa0, 0xf4, ZC3XX_R10C_RGB02},
3750 {0xa0, 0xf4, ZC3XX_R10D_RGB10},
3751 {0xa0, 0x58, ZC3XX_R10E_RGB11},
3752 {0xa0, 0xf4, ZC3XX_R10F_RGB12},
3753 {0xa0, 0xf4, ZC3XX_R110_RGB20},
3754 {0xa0, 0xf4, ZC3XX_R111_RGB21},
3755 {0xa0, 0x58, ZC3XX_R112_RGB22},
3756 /* Auto correction */
3757 {0xa0, 0x03, ZC3XX_R181_WINXSTART},
3758 {0xa0, 0x08, ZC3XX_R182_WINXWIDTH},
3759 {0xa0, 0x16, ZC3XX_R183_WINXCENTER},
3760 {0xa0, 0x03, ZC3XX_R184_WINYSTART},
3761 {0xa0, 0x05, ZC3XX_R185_WINYWIDTH},
3762 {0xa0, 0x14, ZC3XX_R186_WINYCENTER},
3763 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
3764
3765 /* Auto exposure and white balance */
3766 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
3767 {0xa0, 0x03, ZC3XX_R191_EXPOSURELIMITMID},
3768 {0xa0, 0xb1, ZC3XX_R192_EXPOSURELIMITLOW},
3769
3770 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
3771 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
3772 {0xa0, 0x87, ZC3XX_R197_ANTIFLICKERLOW},
3773
3774 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE},
3775 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},
3776 /* sensor on */
3777 {0xaa, 0x07, 0x00b1},
3778 {0xaa, 0x05, 0x0003},
3779 {0xaa, 0x04, 0x0001},
3780 {0xaa, 0x03, 0x003b},
3781 /* Gains */
3782 {0xa0, 0x20, ZC3XX_R1A9_DIGITALLIMITDIFF},
3783 {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP},
3784 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN},
3785 /* Auto correction */
3786 {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE},
3787 {0xa1, 0x01, 0x0180}, /* AutoCorrectEnable */
3788 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
3789 /* Gains */
3790 {0xa0, 0x40, ZC3XX_R116_RGAIN},
3791 {0xa0, 0x40, ZC3XX_R117_GGAIN},
3792 {0xa0, 0x40, ZC3XX_R118_BGAIN},
3793
3794 {0xa0, 0x00, 0x0007}, /* AutoCorrectEnable */
3795 {0xa0, 0xff, ZC3XX_R018_FRAMELOST}, /* Frame adjust */
3796 {}
3797 };
3798 static const struct usb_action pas106b_50HZ[] = {
3799 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
3800 {0xa0, 0x06, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,06,cc */
3801 {0xa0, 0x54, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,54,cc */
3802 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
3803 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
3804 {0xa0, 0x87, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,87,cc */
3805 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */
3806 {0xa0, 0x30, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,30,cc */
3807 {0xaa, 0x03, 0x0021}, /* 00,03,21,aa */
3808 {0xaa, 0x04, 0x000c}, /* 00,04,0c,aa */
3809 {0xaa, 0x05, 0x0002}, /* 00,05,02,aa */
3810 {0xaa, 0x07, 0x001c}, /* 00,07,1c,aa */
3811 {0xa0, 0x04, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,04,cc */
3812 {}
3813 };
3814 static const struct usb_action pas106b_60HZ[] = {
3815 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
3816 {0xa0, 0x06, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,06,cc */
3817 {0xa0, 0x2e, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,2e,cc */
3818 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
3819 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
3820 {0xa0, 0x71, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,71,cc */
3821 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */
3822 {0xa0, 0x30, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,30,cc */
3823 {0xaa, 0x03, 0x001c}, /* 00,03,1c,aa */
3824 {0xaa, 0x04, 0x0004}, /* 00,04,04,aa */
3825 {0xaa, 0x05, 0x0001}, /* 00,05,01,aa */
3826 {0xaa, 0x07, 0x00c4}, /* 00,07,c4,aa */
3827 {0xa0, 0x04, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,04,cc */
3828 {}
3829 };
3830 static const struct usb_action pas106b_NoFlicker[] = {
3831 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
3832 {0xa0, 0x06, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,06,cc */
3833 {0xa0, 0x50, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,50,cc */
3834 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
3835 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
3836 {0xa0, 0x10, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,10,cc */
3837 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */
3838 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */
3839 {0xaa, 0x03, 0x0013}, /* 00,03,13,aa */
3840 {0xaa, 0x04, 0x0000}, /* 00,04,00,aa */
3841 {0xaa, 0x05, 0x0001}, /* 00,05,01,aa */
3842 {0xaa, 0x07, 0x0030}, /* 00,07,30,aa */
3843 {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,00,cc */
3844 {}
3845 };
3846
3847 /* from lvWIMv.inf 046d:08a2/:08aa 2007/06/03 */
3848 static const struct usb_action pas202b_Initial[] = { /* 640x480 */
3849 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */
3850 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
3851 {0xa0, 0x0e, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,0e,cc */
3852 {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT}, /* 00,02,00,cc */
3853 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, /* 00,03,02,cc */
3854 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, /* 00,04,80,cc */
3855 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* 00,05,01,cc */
3856 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, /* 00,06,e0,cc */
3857 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* 00,01,01,cc */
3858 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,03,cc */
3859 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,01,cc */
3860 {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE}, /* 00,8d,08,cc */
3861 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, /* 00,98,00,cc */
3862 {0xa0, 0x03, ZC3XX_R09A_WINXSTARTLOW}, /* 00,9a,03,cc */
3863 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* 01,1a,00,cc */
3864 {0xa0, 0x03, ZC3XX_R11C_FIRSTXLOW}, /* 01,1c,03,cc */
3865 {0xa0, 0x01, ZC3XX_R09B_WINHEIGHTHIGH}, /* 00,9b,01,cc */
3866 {0xa0, 0xe6, ZC3XX_R09C_WINHEIGHTLOW}, /* 00,9c,e6,cc */
3867 {0xa0, 0x02, ZC3XX_R09D_WINWIDTHHIGH}, /* 00,9d,02,cc */
3868 {0xa0, 0x86, ZC3XX_R09E_WINWIDTHLOW}, /* 00,9e,86,cc */
3869 {0xaa, 0x02, 0x0002}, /* 00,02,04,aa --> 02 */
3870 {0xaa, 0x07, 0x0006}, /* 00,07,06,aa */
3871 {0xaa, 0x08, 0x0002}, /* 00,08,02,aa */
3872 {0xaa, 0x09, 0x0006}, /* 00,09,06,aa */
3873 {0xaa, 0x0a, 0x0001}, /* 00,0a,01,aa */
3874 {0xaa, 0x0b, 0x0001}, /* 00,0b,01,aa */
3875 {0xaa, 0x0c, 0x0006},
3876 {0xaa, 0x0d, 0x0000}, /* 00,0d,00,aa */
3877 {0xaa, 0x10, 0x0000}, /* 00,10,00,aa */
3878 {0xaa, 0x12, 0x0005}, /* 00,12,05,aa */
3879 {0xaa, 0x13, 0x0063}, /* 00,13,63,aa */
3880 {0xaa, 0x15, 0x0070}, /* 00,15,70,aa */
3881 {0xa0, 0xb7, ZC3XX_R101_SENSORCORRECTION}, /* 01,01,b7,cc */
3882 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0d,cc */
3883 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* 01,89,06,cc */
3884 {0xa0, 0x00, 0x01ad}, /* 01,ad,00,cc */
3885 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* 01,c5,03,cc */
3886 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* 01,cb,13,cc */
3887 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* 02,50,08,cc */
3888 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* 03,01,08,cc */
3889 {0xa0, 0x70, ZC3XX_R18D_YTARGET}, /* 01,8d,70,cc */
3890 {}
3891 };
3892 static const struct usb_action pas202b_InitialScale[] = { /* 320x240 */
3893 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */
3894 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
3895 {0xa0, 0x0e, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,0e,cc */
3896 {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT}, /* 00,02,10,cc */
3897 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, /* 00,03,02,cc */
3898 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, /* 00,04,80,cc */
3899 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* 00,05,01,cc */
3900 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW},
3901 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* 00,01,01,cc */
3902 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,03,cc */
3903 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,01,cc */
3904 {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE}, /* 00,8d,08,cc */
3905 {0xa0, 0x08, ZC3XX_R098_WINYSTARTLOW}, /* 00,98,08,cc */
3906 {0xa0, 0x02, ZC3XX_R09A_WINXSTARTLOW}, /* 00,9a,02,cc */
3907 {0xa0, 0x08, ZC3XX_R11A_FIRSTYLOW}, /* 01,1a,08,cc */
3908 {0xa0, 0x02, ZC3XX_R11C_FIRSTXLOW}, /* 01,1c,02,cc */
3909 {0xa0, 0x01, ZC3XX_R09B_WINHEIGHTHIGH}, /* 00,9b,01,cc */
3910 {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW},
3911 {0xa0, 0x02, ZC3XX_R09D_WINWIDTHHIGH}, /* 00,9d,02,cc */
3912 {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW}, /* 00,9e,88,cc */
3913 {0xaa, 0x02, 0x0002}, /* 00,02,02,aa */
3914 {0xaa, 0x07, 0x0006}, /* 00,07,06,aa */
3915 {0xaa, 0x08, 0x0002}, /* 00,08,02,aa */
3916 {0xaa, 0x09, 0x0006}, /* 00,09,06,aa */
3917 {0xaa, 0x0a, 0x0001}, /* 00,0a,01,aa */
3918 {0xaa, 0x0b, 0x0001}, /* 00,0b,01,aa */
3919 {0xaa, 0x0c, 0x0006},
3920 {0xaa, 0x0d, 0x0000}, /* 00,0d,00,aa */
3921 {0xaa, 0x10, 0x0000}, /* 00,10,00,aa */
3922 {0xaa, 0x12, 0x0005}, /* 00,12,05,aa */
3923 {0xaa, 0x13, 0x0063}, /* 00,13,63,aa */
3924 {0xaa, 0x15, 0x0070}, /* 00,15,70,aa */
3925 {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION}, /* 01,01,37,cc */
3926 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0d,cc */
3927 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* 01,89,06,cc */
3928 {0xa0, 0x00, 0x01ad}, /* 01,ad,00,cc */
3929 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* 01,c5,03,cc */
3930 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* 01,cb,13,cc */
3931 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* 02,50,08,cc */
3932 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* 03,01,08,cc */
3933 {0xa0, 0x70, ZC3XX_R18D_YTARGET}, /* 01,8d,70,cc */
3934 {0xa0, 0xff, ZC3XX_R097_WINYSTARTHIGH},
3935 {0xa0, 0xfe, ZC3XX_R098_WINYSTARTLOW},
3936 {}
3937 };
3938 static const struct usb_action pas202b_50HZ[] = {
3939 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
3940 {0xa0, 0x20, ZC3XX_R087_EXPTIMEMID}, /* 00,87,20,cc */
3941 {0xa0, 0x21, ZC3XX_R088_EXPTIMELOW}, /* 00,88,21,cc */
3942 {0xaa, 0x20, 0x0002}, /* 00,20,02,aa */
3943 {0xaa, 0x21, 0x001b},
3944 {0xaa, 0x03, 0x0044}, /* 00,03,44,aa */
3945 {0xaa, 0x04, 0x0008},
3946 {0xaa, 0x05, 0x001b},
3947 {0xaa, 0x0e, 0x0001}, /* 00,0e,01,aa */
3948 {0xaa, 0x0f, 0x0000}, /* 00,0f,00,aa */
3949 {0xa0, 0x1c, ZC3XX_R1A9_DIGITALLIMITDIFF},
3950 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,24,cc */
3951 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
3952 {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID},
3953 {0xa0, 0x1b, ZC3XX_R192_EXPOSURELIMITLOW},
3954 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
3955 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
3956 {0xa0, 0x4d, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,4d,cc */
3957 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE},
3958 {0xa0, 0x1b, ZC3XX_R18F_AEUNFREEZE},
3959 {0xa0, 0x44, ZC3XX_R01D_HSYNC_0}, /* 00,1d,44,cc */
3960 {0xa0, 0x6f, ZC3XX_R01E_HSYNC_1}, /* 00,1e,6f,cc */
3961 {0xa0, 0xad, ZC3XX_R01F_HSYNC_2}, /* 00,1f,ad,cc */
3962 {0xa0, 0xeb, ZC3XX_R020_HSYNC_3}, /* 00,20,eb,cc */
3963 {0xa0, 0x0f, ZC3XX_R087_EXPTIMEMID}, /* 00,87,0f,cc */
3964 {0xa0, 0x0e, ZC3XX_R088_EXPTIMELOW}, /* 00,88,0e,cc */
3965 {}
3966 };
3967 static const struct usb_action pas202b_50HZScale[] = {
3968 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
3969 {0xa0, 0x20, ZC3XX_R087_EXPTIMEMID}, /* 00,87,20,cc */
3970 {0xa0, 0x21, ZC3XX_R088_EXPTIMELOW}, /* 00,88,21,cc */
3971 {0xaa, 0x20, 0x0004},
3972 {0xaa, 0x21, 0x003d},
3973 {0xaa, 0x03, 0x0041}, /* 00,03,41,aa */
3974 {0xaa, 0x04, 0x0010},
3975 {0xaa, 0x05, 0x003d},
3976 {0xaa, 0x0e, 0x0001}, /* 00,0e,01,aa */
3977 {0xaa, 0x0f, 0x0000}, /* 00,0f,00,aa */
3978 {0xa0, 0x1c, ZC3XX_R1A9_DIGITALLIMITDIFF},
3979 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,24,cc */
3980 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
3981 {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID},
3982 {0xa0, 0x3d, ZC3XX_R192_EXPOSURELIMITLOW},
3983 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
3984 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
3985 {0xa0, 0x9b, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,9b,cc */
3986 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE},
3987 {0xa0, 0x1b, ZC3XX_R18F_AEUNFREEZE},
3988 {0xa0, 0x41, ZC3XX_R01D_HSYNC_0}, /* 00,1d,41,cc */
3989 {0xa0, 0x6f, ZC3XX_R01E_HSYNC_1}, /* 00,1e,6f,cc */
3990 {0xa0, 0xad, ZC3XX_R01F_HSYNC_2}, /* 00,1f,ad,cc */
3991 {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */
3992 {0xa0, 0x0f, ZC3XX_R087_EXPTIMEMID}, /* 00,87,0f,cc */
3993 {0xa0, 0x0e, ZC3XX_R088_EXPTIMELOW}, /* 00,88,0e,cc */
3994 {}
3995 };
3996 static const struct usb_action pas202b_60HZ[] = {
3997 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
3998 {0xa0, 0x20, ZC3XX_R087_EXPTIMEMID}, /* 00,87,20,cc */
3999 {0xa0, 0x21, ZC3XX_R088_EXPTIMELOW}, /* 00,88,21,cc */
4000 {0xaa, 0x20, 0x0002}, /* 00,20,02,aa */
4001 {0xaa, 0x21, 0x0000}, /* 00,21,00,aa */
4002 {0xaa, 0x03, 0x0045}, /* 00,03,45,aa */
4003 {0xaa, 0x04, 0x0008}, /* 00,04,08,aa */
4004 {0xaa, 0x05, 0x0000}, /* 00,05,00,aa */
4005 {0xaa, 0x0e, 0x0001}, /* 00,0e,01,aa */
4006 {0xaa, 0x0f, 0x0000}, /* 00,0f,00,aa */
4007 {0xa0, 0x1c, ZC3XX_R1A9_DIGITALLIMITDIFF},
4008 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,24,cc */
4009 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
4010 {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID},
4011 {0xa0, 0x00, ZC3XX_R192_EXPOSURELIMITLOW},
4012 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
4013 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
4014 {0xa0, 0x40, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,40,cc */
4015 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE},
4016 {0xa0, 0x1b, ZC3XX_R18F_AEUNFREEZE},
4017 {0xa0, 0x45, ZC3XX_R01D_HSYNC_0}, /* 00,1d,45,cc */
4018 {0xa0, 0x8e, ZC3XX_R01E_HSYNC_1}, /* 00,1e,8e,cc */
4019 {0xa0, 0xc1, ZC3XX_R01F_HSYNC_2}, /* 00,1f,c1,cc */
4020 {0xa0, 0xf5, ZC3XX_R020_HSYNC_3}, /* 00,20,f5,cc */
4021 {0xa0, 0x0f, ZC3XX_R087_EXPTIMEMID}, /* 00,87,0f,cc */
4022 {0xa0, 0x0e, ZC3XX_R088_EXPTIMELOW}, /* 00,88,0e,cc */
4023 {}
4024 };
4025 static const struct usb_action pas202b_60HZScale[] = {
4026 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
4027 {0xa0, 0x20, ZC3XX_R087_EXPTIMEMID}, /* 00,87,20,cc */
4028 {0xa0, 0x21, ZC3XX_R088_EXPTIMELOW}, /* 00,88,21,cc */
4029 {0xaa, 0x20, 0x0004},
4030 {0xaa, 0x21, 0x0008},
4031 {0xaa, 0x03, 0x0042}, /* 00,03,42,aa */
4032 {0xaa, 0x04, 0x0010},
4033 {0xaa, 0x05, 0x0008},
4034 {0xaa, 0x0e, 0x0001}, /* 00,0e,01,aa */
4035 {0xaa, 0x0f, 0x0000}, /* 00,0f,00,aa */
4036 {0xa0, 0x1c, ZC3XX_R1A9_DIGITALLIMITDIFF},
4037 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,24,cc */
4038 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
4039 {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID},
4040 {0xa0, 0x08, ZC3XX_R192_EXPOSURELIMITLOW},
4041 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
4042 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
4043 {0xa0, 0x81, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,81,cc */
4044 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE},
4045 {0xa0, 0x1b, ZC3XX_R18F_AEUNFREEZE},
4046 {0xa0, 0x42, ZC3XX_R01D_HSYNC_0}, /* 00,1d,42,cc */
4047 {0xa0, 0x6f, ZC3XX_R01E_HSYNC_1}, /* 00,1e,6f,cc */
4048 {0xa0, 0xaf, ZC3XX_R01F_HSYNC_2}, /* 00,1f,af,cc */
4049 {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */
4050 {0xa0, 0x0f, ZC3XX_R087_EXPTIMEMID}, /* 00,87,0f,cc */
4051 {0xa0, 0x0e, ZC3XX_R088_EXPTIMELOW}, /* 00,88,0e,cc */
4052 {}
4053 };
4054 static const struct usb_action pas202b_NoFlicker[] = {
4055 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
4056 {0xa0, 0x20, ZC3XX_R087_EXPTIMEMID}, /* 00,87,20,cc */
4057 {0xa0, 0x21, ZC3XX_R088_EXPTIMELOW}, /* 00,88,21,cc */
4058 {0xaa, 0x20, 0x0002}, /* 00,20,02,aa */
4059 {0xaa, 0x21, 0x0006},
4060 {0xaa, 0x03, 0x0040}, /* 00,03,40,aa */
4061 {0xaa, 0x04, 0x0008}, /* 00,04,08,aa */
4062 {0xaa, 0x05, 0x0006},
4063 {0xaa, 0x0e, 0x0001}, /* 00,0e,01,aa */
4064 {0xaa, 0x0f, 0x0000}, /* 00,0f,00,aa */
4065 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
4066 {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID},
4067 {0xa0, 0x06, ZC3XX_R192_EXPOSURELIMITLOW},
4068 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
4069 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
4070 {0xa0, 0x01, ZC3XX_R197_ANTIFLICKERLOW},
4071 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */
4072 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */
4073 {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,00,cc */
4074 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP},
4075 {0xa0, 0x40, ZC3XX_R01D_HSYNC_0}, /* 00,1d,40,cc */
4076 {0xa0, 0x60, ZC3XX_R01E_HSYNC_1}, /* 00,1e,60,cc */
4077 {0xa0, 0x90, ZC3XX_R01F_HSYNC_2}, /* 00,1f,90,cc */
4078 {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */
4079 {0xa0, 0x0f, ZC3XX_R087_EXPTIMEMID}, /* 00,87,0f,cc */
4080 {0xa0, 0x0e, ZC3XX_R088_EXPTIMELOW}, /* 00,88,0e,cc */
4081 {}
4082 };
4083 static const struct usb_action pas202b_NoFlickerScale[] = {
4084 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
4085 {0xa0, 0x20, ZC3XX_R087_EXPTIMEMID}, /* 00,87,20,cc */
4086 {0xa0, 0x21, ZC3XX_R088_EXPTIMELOW}, /* 00,88,21,cc */
4087 {0xaa, 0x20, 0x0004},
4088 {0xaa, 0x21, 0x000c},
4089 {0xaa, 0x03, 0x0040}, /* 00,03,40,aa */
4090 {0xaa, 0x04, 0x0010},
4091 {0xaa, 0x05, 0x000c},
4092 {0xaa, 0x0e, 0x0001}, /* 00,0e,01,aa */
4093 {0xaa, 0x0f, 0x0000}, /* 00,0f,00,aa */
4094 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
4095 {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID},
4096 {0xa0, 0x0c, ZC3XX_R192_EXPOSURELIMITLOW},
4097 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
4098 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
4099 {0xa0, 0x02, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,02,cc */
4100 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */
4101 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */
4102 {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,00,cc */
4103 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP},
4104 {0xa0, 0x40, ZC3XX_R01D_HSYNC_0}, /* 00,1d,40,cc */
4105 {0xa0, 0x60, ZC3XX_R01E_HSYNC_1}, /* 00,1e,60,cc */
4106 {0xa0, 0x90, ZC3XX_R01F_HSYNC_2}, /* 00,1f,90,cc */
4107 {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */
4108 {0xa0, 0x0f, ZC3XX_R087_EXPTIMEMID}, /* 00,87,0f,cc */
4109 {0xa0, 0x0e, ZC3XX_R088_EXPTIMELOW}, /* 00,88,0e,cc */
4110 {}
4111 };
4112
4113 /* mt9v111 (mi0360soc) and pb0330 from vm30x.inf 0ac8:301b 07/02/13 */
4114 static const struct usb_action mt9v111_1_Initial[] = { /* 640x480 */
4115 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
4116 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
4117 {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT},
4118 {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT},
4119 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH},
4120 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW},
4121 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},
4122 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW},
4123 {0xa0, 0xdc, ZC3XX_R08B_I2CDEVICEADDR},
4124 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
4125 {0xa0, 0x07, ZC3XX_R012_VIDEOCONTROLFUNC},
4126 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW},
4127 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW},
4128 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW},
4129 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW},
4130 {0xa0, 0xdc, ZC3XX_R08B_I2CDEVICEADDR},
4131 {0xdd, 0x00, 0x0200},
4132 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
4133 {0xaa, 0x01, 0x0001},
4134 {0xaa, 0x06, 0x0000},
4135 {0xaa, 0x08, 0x0483},
4136 {0xaa, 0x01, 0x0004},
4137 {0xaa, 0x08, 0x0006},
4138 {0xaa, 0x02, 0x0011},
4139 {0xaa, 0x03, 0x01e5}, /*jfm: was 01e7*/
4140 {0xaa, 0x04, 0x0285}, /*jfm: was 0287*/
4141 {0xaa, 0x07, 0x3002},
4142 {0xaa, 0x20, 0x5100},
4143 {0xaa, 0x35, 0x507f},
4144 {0xaa, 0x30, 0x0005},
4145 {0xaa, 0x31, 0x0000},
4146 {0xaa, 0x58, 0x0078},
4147 {0xaa, 0x62, 0x0411},
4148 {0xaa, 0x2b, 0x007f},
4149 {0xaa, 0x2c, 0x007f}, /*jfm: was 0030*/
4150 {0xaa, 0x2d, 0x007f}, /*jfm: was 0030*/
4151 {0xaa, 0x2e, 0x007f}, /*jfm: was 0030*/
4152 {0xa0, 0x10, ZC3XX_R087_EXPTIMEMID},
4153 {0xa0, 0xb7, ZC3XX_R101_SENSORCORRECTION},
4154 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
4155 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
4156 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
4157 {0xa0, 0x09, 0x01ad}, /*jfm: was 00*/
4158 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
4159 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
4160 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
4161 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
4162 {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN},
4163 {0xa0, 0x6c, ZC3XX_R18D_YTARGET},
4164 {0xa0, 0x61, ZC3XX_R116_RGAIN},
4165 {0xa0, 0x65, ZC3XX_R118_BGAIN},
4166 {}
4167 };
4168 static const struct usb_action mt9v111_1_InitialScale[] = { /* 320x240 */
4169 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
4170 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
4171 {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT},
4172 {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT},
4173 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH},
4174 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW},
4175 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},
4176 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW},
4177 {0xa0, 0xdc, ZC3XX_R08B_I2CDEVICEADDR},
4178 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
4179 {0xa0, 0x07, ZC3XX_R012_VIDEOCONTROLFUNC},
4180 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW},
4181 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW},
4182 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW},
4183 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW},
4184 {0xa0, 0xdc, ZC3XX_R08B_I2CDEVICEADDR},
4185 {0xdd, 0x00, 0x0200},
4186 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
4187 {0xaa, 0x01, 0x0001},
4188 {0xaa, 0x06, 0x0000},
4189 {0xaa, 0x08, 0x0483},
4190 {0xaa, 0x01, 0x0004},
4191 {0xaa, 0x08, 0x0006},
4192 {0xaa, 0x02, 0x0011},
4193 {0xaa, 0x03, 0x01e7},
4194 {0xaa, 0x04, 0x0287},
4195 {0xaa, 0x07, 0x3002},
4196 {0xaa, 0x20, 0x5100},
4197 {0xaa, 0x35, 0x007f}, /*jfm: was 0050*/
4198 {0xaa, 0x30, 0x0005},
4199 {0xaa, 0x31, 0x0000},
4200 {0xaa, 0x58, 0x0078},
4201 {0xaa, 0x62, 0x0411},
4202 {0xaa, 0x2b, 0x007f}, /*jfm: was 28*/
4203 {0xaa, 0x2c, 0x007f}, /*jfm: was 30*/
4204 {0xaa, 0x2d, 0x007f}, /*jfm: was 30*/
4205 {0xaa, 0x2e, 0x007f}, /*jfm: was 28*/
4206 {0xa0, 0x10, ZC3XX_R087_EXPTIMEMID},
4207 {0xa0, 0xb7, ZC3XX_R101_SENSORCORRECTION},
4208 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
4209 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
4210 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
4211 {0xa0, 0x09, 0x01ad}, /*jfm: was 00*/
4212 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
4213 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
4214 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
4215 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
4216 {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN},
4217 {0xa0, 0x6c, ZC3XX_R18D_YTARGET},
4218 {0xa0, 0x61, ZC3XX_R116_RGAIN},
4219 {0xa0, 0x65, ZC3XX_R118_BGAIN},
4220 {}
4221 };
4222 static const struct usb_action mt9v111_1_AE50HZ[] = {
4223 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
4224 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
4225 {0xbb, 0x00, 0x0562},
4226 {0xbb, 0x01, 0x09aa},
4227 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
4228 {0xa0, 0x03, ZC3XX_R191_EXPOSURELIMITMID},
4229 {0xa0, 0x9b, ZC3XX_R192_EXPOSURELIMITLOW},
4230 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
4231 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
4232 {0xa0, 0x47, ZC3XX_R197_ANTIFLICKERLOW},
4233 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE},
4234 {0xa0, 0x1c, ZC3XX_R18F_AEUNFREEZE},
4235 {0xa0, 0x14, ZC3XX_R1A9_DIGITALLIMITDIFF},
4236 {0xa0, 0x66, ZC3XX_R1AA_DIGITALGAINSTEP},
4237 {0xa0, 0x62, ZC3XX_R01D_HSYNC_0},
4238 {0xa0, 0x90, ZC3XX_R01E_HSYNC_1},
4239 {0xa0, 0xc8, ZC3XX_R01F_HSYNC_2},
4240 {0xa0, 0xff, ZC3XX_R020_HSYNC_3},
4241 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN},
4242 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
4243 {}
4244 };
4245 static const struct usb_action mt9v111_1_AE50HZScale[] = {
4246 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
4247 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
4248 {0xbb, 0x00, 0x0509},
4249 {0xbb, 0x01, 0x0934},
4250 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
4251 {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID},
4252 {0xa0, 0xd2, ZC3XX_R192_EXPOSURELIMITLOW},
4253 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
4254 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
4255 {0xa0, 0x9a, ZC3XX_R197_ANTIFLICKERLOW},
4256 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE},
4257 {0xa0, 0x1c, ZC3XX_R18F_AEUNFREEZE},
4258 {0xa0, 0x14, ZC3XX_R1A9_DIGITALLIMITDIFF},
4259 {0xa0, 0x66, ZC3XX_R1AA_DIGITALGAINSTEP},
4260 {0xa0, 0xd7, ZC3XX_R01D_HSYNC_0},
4261 {0xa0, 0xf4, ZC3XX_R01E_HSYNC_1},
4262 {0xa0, 0xf9, ZC3XX_R01F_HSYNC_2},
4263 {0xa0, 0xff, ZC3XX_R020_HSYNC_3},
4264 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
4265 {}
4266 };
4267 static const struct usb_action mt9v111_1_AE60HZ[] = {
4268 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
4269 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
4270 {0xaa, 0x05, 0x003d},
4271 {0xaa, 0x09, 0x016e},
4272 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
4273 {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID},
4274 {0xa0, 0xdd, ZC3XX_R192_EXPOSURELIMITLOW},
4275 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
4276 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
4277 {0xa0, 0x3d, ZC3XX_R197_ANTIFLICKERLOW},
4278 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE},
4279 {0xa0, 0x1c, ZC3XX_R18F_AEUNFREEZE},
4280 {0xa0, 0x14, ZC3XX_R1A9_DIGITALLIMITDIFF},
4281 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP},
4282 {0xa0, 0x62, ZC3XX_R01D_HSYNC_0},
4283 {0xa0, 0x90, ZC3XX_R01E_HSYNC_1},
4284 {0xa0, 0xc8, ZC3XX_R01F_HSYNC_2},
4285 {0xa0, 0xff, ZC3XX_R020_HSYNC_3},
4286 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN},
4287 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
4288 {}
4289 };
4290 static const struct usb_action mt9v111_1_AE60HZScale[] = {
4291 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
4292 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
4293 {0xbb, 0x00, 0x0509},
4294 {0xbb, 0x01, 0x0983},
4295 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
4296 {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID},
4297 {0xa0, 0x8f, ZC3XX_R192_EXPOSURELIMITLOW},
4298 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
4299 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
4300 {0xa0, 0x81, ZC3XX_R197_ANTIFLICKERLOW},
4301 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE},
4302 {0xa0, 0x1c, ZC3XX_R18F_AEUNFREEZE},
4303 {0xa0, 0x14, ZC3XX_R1A9_DIGITALLIMITDIFF},
4304 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP},
4305 {0xa0, 0xd7, ZC3XX_R01D_HSYNC_0},
4306 {0xa0, 0xf4, ZC3XX_R01E_HSYNC_1},
4307 {0xa0, 0xf9, ZC3XX_R01F_HSYNC_2},
4308 {0xa0, 0xff, ZC3XX_R020_HSYNC_3},
4309 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
4310 {}
4311 };
4312 static const struct usb_action mt9v111_1_AENoFlicker[] = {
4313 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
4314 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
4315 {0xbb, 0x00, 0x0509},
4316 {0xbb, 0x01, 0x0960},
4317 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
4318 {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID},
4319 {0xa0, 0xf0, ZC3XX_R192_EXPOSURELIMITLOW},
4320 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
4321 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
4322 {0xa0, 0x04, ZC3XX_R197_ANTIFLICKERLOW},
4323 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE},
4324 {0xa0, 0x1c, ZC3XX_R18F_AEUNFREEZE},
4325 {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF},
4326 {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP},
4327 {0xa0, 0x09, ZC3XX_R01D_HSYNC_0},
4328 {0xa0, 0x40, ZC3XX_R01E_HSYNC_1},
4329 {0xa0, 0x90, ZC3XX_R01F_HSYNC_2},
4330 {0xa0, 0xe0, ZC3XX_R020_HSYNC_3},
4331 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN},
4332 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
4333 {}
4334 };
4335 static const struct usb_action mt9v111_1_AENoFlickerScale[] = {
4336 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
4337 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
4338 {0xbb, 0x00, 0x0534},
4339 {0xbb, 0x02, 0x0960},
4340 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
4341 {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID},
4342 {0xa0, 0xf0, ZC3XX_R192_EXPOSURELIMITLOW},
4343 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
4344 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
4345 {0xa0, 0x04, ZC3XX_R197_ANTIFLICKERLOW},
4346 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE},
4347 {0xa0, 0x1c, ZC3XX_R18F_AEUNFREEZE},
4348 {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF},
4349 {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP},
4350 {0xa0, 0x34, ZC3XX_R01D_HSYNC_0},
4351 {0xa0, 0x60, ZC3XX_R01E_HSYNC_1},
4352 {0xa0, 0x90, ZC3XX_R01F_HSYNC_2},
4353 {0xa0, 0xe0, ZC3XX_R020_HSYNC_3},
4354 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN},
4355 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
4356 {}
4357 };
4358 /* from usbvm303.inf 0ac8:303b 07/03/25 (3 - tas5130c) */
4359 static const struct usb_action mt9v111_3_Initial[] = {
4360 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
4361 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
4362 {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT},
4363 {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT},
4364 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH},
4365 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW},
4366 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},
4367 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW},
4368 {0xa0, 0xdc, ZC3XX_R08B_I2CDEVICEADDR},
4369 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
4370 {0xa0, 0x07, ZC3XX_R012_VIDEOCONTROLFUNC},
4371 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW},
4372 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW},
4373 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW},
4374 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW},
4375 {0xa0, 0xdc, ZC3XX_R08B_I2CDEVICEADDR},
4376 {0xdd, 0x00, 0x0200},
4377 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
4378 {0xaa, 0x01, 0x0001}, /* select IFP/SOC registers */
4379 {0xaa, 0x06, 0x0000}, /* operating mode control */
4380 {0xaa, 0x08, 0x0483}, /* output format control */
4381 /* H red first, V red or blue first,
4382 * raw Bayer, auto flicker */
4383 {0xaa, 0x01, 0x0004}, /* select sensor core registers */
4384 {0xaa, 0x08, 0x0006}, /* row start */
4385 {0xaa, 0x02, 0x0011}, /* column start */
4386 {0xaa, 0x03, 0x01e5}, /* window height - 1 */
4387 {0xaa, 0x04, 0x0285}, /* window width - 1 */
4388 {0xaa, 0x07, 0x3002}, /* output control */
4389 {0xaa, 0x20, 0x1100}, /* read mode: bits 8 & 12 (?) */
4390 {0xaa, 0x35, 0x007f}, /* global gain */
4391 {0xaa, 0x30, 0x0005},
4392 {0xaa, 0x31, 0x0000},
4393 {0xaa, 0x58, 0x0078},
4394 {0xaa, 0x62, 0x0411},
4395 {0xaa, 0x2b, 0x007f}, /* green1 gain */
4396 {0xaa, 0x2c, 0x007f}, /* blue gain */
4397 {0xaa, 0x2d, 0x007f}, /* red gain */
4398 {0xaa, 0x2e, 0x007f}, /* green2 gain */
4399 {0xa0, 0x10, ZC3XX_R087_EXPTIMEMID},
4400 {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION},
4401 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
4402 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
4403 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
4404 {0xa0, 0x00, 0x01ad},
4405 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
4406 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
4407 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
4408 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
4409 {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN},
4410 {0xa0, 0x80, ZC3XX_R18D_YTARGET},
4411 {0xa0, 0x61, ZC3XX_R116_RGAIN},
4412 {0xa0, 0x65, ZC3XX_R118_BGAIN},
4413 {}
4414 };
4415 static const struct usb_action mt9v111_3_InitialScale[] = {
4416 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
4417 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
4418 {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT},
4419 {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT},
4420 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH},
4421 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW},
4422 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},
4423 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW},
4424 {0xa0, 0xdc, ZC3XX_R08B_I2CDEVICEADDR},
4425 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
4426 {0xa0, 0x07, ZC3XX_R012_VIDEOCONTROLFUNC},
4427 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW},
4428 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW},
4429 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW},
4430 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW},
4431 {0xa0, 0xdc, ZC3XX_R08B_I2CDEVICEADDR},
4432 {0xdd, 0x00, 0x0200},
4433 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
4434 {0xaa, 0x01, 0x0001},
4435 {0xaa, 0x06, 0x0000},
4436 {0xaa, 0x08, 0x0483},
4437 {0xaa, 0x01, 0x0004},
4438 {0xaa, 0x08, 0x0006},
4439 {0xaa, 0x02, 0x0011},
4440 {0xaa, 0x03, 0x01e7},
4441 {0xaa, 0x04, 0x0287},
4442 {0xaa, 0x07, 0x3002},
4443 {0xaa, 0x20, 0x1100},
4444 {0xaa, 0x35, 0x007f},
4445 {0xaa, 0x30, 0x0005},
4446 {0xaa, 0x31, 0x0000},
4447 {0xaa, 0x58, 0x0078},
4448 {0xaa, 0x62, 0x0411},
4449 {0xaa, 0x2b, 0x007f},
4450 {0xaa, 0x2c, 0x007f},
4451 {0xaa, 0x2d, 0x007f},
4452 {0xaa, 0x2e, 0x007f},
4453 {0xa0, 0x10, ZC3XX_R087_EXPTIMEMID},
4454 {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION},
4455 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
4456 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
4457 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
4458 {0xa0, 0x00, 0x01ad},
4459 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
4460 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
4461 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
4462 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
4463 {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN},
4464 {0xa0, 0x80, ZC3XX_R18D_YTARGET},
4465 {0xa0, 0x61, ZC3XX_R116_RGAIN},
4466 {0xa0, 0x65, ZC3XX_R118_BGAIN},
4467 {}
4468 };
4469 static const struct usb_action mt9v111_3_AE50HZ[] = {
4470 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
4471 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
4472 {0xaa, 0x05, 0x0009}, /* horizontal blanking */
4473 {0xaa, 0x09, 0x01ce}, /* shutter width */
4474 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
4475 {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID},
4476 {0xa0, 0xd2, ZC3XX_R192_EXPOSURELIMITLOW},
4477 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
4478 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
4479 {0xa0, 0x9a, ZC3XX_R197_ANTIFLICKERLOW},
4480 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE},
4481 {0xa0, 0x1c, ZC3XX_R18F_AEUNFREEZE},
4482 {0xa0, 0x14, ZC3XX_R1A9_DIGITALLIMITDIFF},
4483 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP},
4484 {0xa0, 0xd7, ZC3XX_R01D_HSYNC_0},
4485 {0xa0, 0xf4, ZC3XX_R01E_HSYNC_1},
4486 {0xa0, 0xf9, ZC3XX_R01F_HSYNC_2},
4487 {0xa0, 0xff, ZC3XX_R020_HSYNC_3},
4488 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
4489 {}
4490 };
4491 static const struct usb_action mt9v111_3_AE50HZScale[] = {
4492 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
4493 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
4494 {0xaa, 0x05, 0x0009},
4495 {0xaa, 0x09, 0x01ce},
4496 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
4497 {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID},
4498 {0xa0, 0xd2, ZC3XX_R192_EXPOSURELIMITLOW},
4499 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
4500 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
4501 {0xa0, 0x9a, ZC3XX_R197_ANTIFLICKERLOW},
4502 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE},
4503 {0xa0, 0x1c, ZC3XX_R18F_AEUNFREEZE},
4504 {0xa0, 0x14, ZC3XX_R1A9_DIGITALLIMITDIFF},
4505 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP},
4506 {0xa0, 0xd7, ZC3XX_R01D_HSYNC_0},
4507 {0xa0, 0xf4, ZC3XX_R01E_HSYNC_1},
4508 {0xa0, 0xf9, ZC3XX_R01F_HSYNC_2},
4509 {0xa0, 0xff, ZC3XX_R020_HSYNC_3},
4510 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
4511 {}
4512 };
4513 static const struct usb_action mt9v111_3_AE60HZ[] = {
4514 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
4515 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
4516 {0xaa, 0x05, 0x0009},
4517 {0xaa, 0x09, 0x0083},
4518 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
4519 {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID},
4520 {0xa0, 0x8f, ZC3XX_R192_EXPOSURELIMITLOW},
4521 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
4522 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
4523 {0xa0, 0x81, ZC3XX_R197_ANTIFLICKERLOW},
4524 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE},
4525 {0xa0, 0x1c, ZC3XX_R18F_AEUNFREEZE},
4526 {0xa0, 0x14, ZC3XX_R1A9_DIGITALLIMITDIFF},
4527 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP},
4528 {0xa0, 0xd7, ZC3XX_R01D_HSYNC_0},
4529 {0xa0, 0xf4, ZC3XX_R01E_HSYNC_1},
4530 {0xa0, 0xf9, ZC3XX_R01F_HSYNC_2},
4531 {0xa0, 0xff, ZC3XX_R020_HSYNC_3},
4532 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
4533 {}
4534 };
4535 static const struct usb_action mt9v111_3_AE60HZScale[] = {
4536 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
4537 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
4538 {0xaa, 0x05, 0x0009},
4539 {0xaa, 0x09, 0x0083},
4540 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
4541 {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID},
4542 {0xa0, 0x8f, ZC3XX_R192_EXPOSURELIMITLOW},
4543 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
4544 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
4545 {0xa0, 0x81, ZC3XX_R197_ANTIFLICKERLOW},
4546 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE},
4547 {0xa0, 0x1c, ZC3XX_R18F_AEUNFREEZE},
4548 {0xa0, 0x14, ZC3XX_R1A9_DIGITALLIMITDIFF},
4549 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP},
4550 {0xa0, 0xd7, ZC3XX_R01D_HSYNC_0},
4551 {0xa0, 0xf4, ZC3XX_R01E_HSYNC_1},
4552 {0xa0, 0xf9, ZC3XX_R01F_HSYNC_2},
4553 {0xa0, 0xff, ZC3XX_R020_HSYNC_3},
4554 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
4555 {}
4556 };
4557 static const struct usb_action mt9v111_3_AENoFlicker[] = {
4558 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
4559 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
4560 {0xaa, 0x05, 0x0034},
4561 {0xaa, 0x09, 0x0260},
4562 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
4563 {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID},
4564 {0xa0, 0xf0, ZC3XX_R192_EXPOSURELIMITLOW},
4565 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
4566 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
4567 {0xa0, 0x04, ZC3XX_R197_ANTIFLICKERLOW},
4568 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE},
4569 {0xa0, 0x1c, ZC3XX_R18F_AEUNFREEZE},
4570 {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF},
4571 {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP},
4572 {0xa0, 0x34, ZC3XX_R01D_HSYNC_0},
4573 {0xa0, 0x60, ZC3XX_R01E_HSYNC_1},
4574 {0xa0, 0x90, ZC3XX_R01F_HSYNC_2},
4575 {0xa0, 0xe0, ZC3XX_R020_HSYNC_3},
4576 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN},
4577 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
4578 {}
4579 };
4580 static const struct usb_action mt9v111_3_AENoFlickerScale[] = {
4581 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
4582 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
4583 {0xaa, 0x05, 0x0034},
4584 {0xaa, 0x09, 0x0260},
4585 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
4586 {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID},
4587 {0xa0, 0xf0, ZC3XX_R192_EXPOSURELIMITLOW},
4588 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
4589 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
4590 {0xa0, 0x04, ZC3XX_R197_ANTIFLICKERLOW},
4591 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE},
4592 {0xa0, 0x1c, ZC3XX_R18F_AEUNFREEZE},
4593 {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF},
4594 {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP},
4595 {0xa0, 0x34, ZC3XX_R01D_HSYNC_0},
4596 {0xa0, 0x60, ZC3XX_R01E_HSYNC_1},
4597 {0xa0, 0x90, ZC3XX_R01F_HSYNC_2},
4598 {0xa0, 0xe0, ZC3XX_R020_HSYNC_3},
4599 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN},
4600 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
4601 {}
4602 };
4603
4604 static const struct usb_action pb0330_Initial[] = { /* 640x480 */
4605 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
4606 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00 */
4607 {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT},
4608 {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT},
4609 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH},
4610 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW},
4611 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},
4612 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW},
4613 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
4614 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
4615 {0xa0, 0x07, ZC3XX_R012_VIDEOCONTROLFUNC},
4616 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW},
4617 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW},
4618 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW},
4619 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW},
4620 {0xdd, 0x00, 0x0200},
4621 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
4622 {0xaa, 0x01, 0x0006},
4623 {0xaa, 0x02, 0x0011},
4624 {0xaa, 0x03, 0x01e5}, /*jfm: was 1e7*/
4625 {0xaa, 0x04, 0x0285}, /*jfm: was 0287*/
4626 {0xaa, 0x06, 0x0003},
4627 {0xaa, 0x07, 0x3002},
4628 {0xaa, 0x20, 0x1100},
4629 {0xaa, 0x2f, 0xf7b0},
4630 {0xaa, 0x30, 0x0005},
4631 {0xaa, 0x31, 0x0000},
4632 {0xaa, 0x34, 0x0100},
4633 {0xaa, 0x35, 0x0060},
4634 {0xaa, 0x3d, 0x068f},
4635 {0xaa, 0x40, 0x01e0},
4636 {0xaa, 0x58, 0x0078},
4637 {0xaa, 0x62, 0x0411},
4638 {0xa0, 0x10, ZC3XX_R087_EXPTIMEMID},
4639 {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION},
4640 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
4641 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
4642 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
4643 {0xa0, 0x09, 0x01ad}, /*jfm: was 00 */
4644 {0xa0, 0x15, 0x01ae},
4645 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
4646 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
4647 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
4648 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
4649 {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN},
4650 {0xa0, 0x78, ZC3XX_R18D_YTARGET}, /*jfm: was 6c*/
4651 {}
4652 };
4653 static const struct usb_action pb0330_InitialScale[] = { /* 320x240 */
4654 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
4655 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00 */
4656 {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT},
4657 {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT},
4658 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH},
4659 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW},
4660 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},
4661 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW},
4662 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
4663 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
4664 {0xa0, 0x07, ZC3XX_R012_VIDEOCONTROLFUNC},
4665 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW},
4666 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW},
4667 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW},
4668 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW},
4669 {0xdd, 0x00, 0x0200},
4670 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
4671 {0xaa, 0x01, 0x0006},
4672 {0xaa, 0x02, 0x0011},
4673 {0xaa, 0x03, 0x01e7},
4674 {0xaa, 0x04, 0x0287},
4675 {0xaa, 0x06, 0x0003},
4676 {0xaa, 0x07, 0x3002},
4677 {0xaa, 0x20, 0x1100},
4678 {0xaa, 0x2f, 0xf7b0},
4679 {0xaa, 0x30, 0x0005},
4680 {0xaa, 0x31, 0x0000},
4681 {0xaa, 0x34, 0x0100},
4682 {0xaa, 0x35, 0x0060},
4683 {0xaa, 0x3d, 0x068f},
4684 {0xaa, 0x40, 0x01e0},
4685 {0xaa, 0x58, 0x0078},
4686 {0xaa, 0x62, 0x0411},
4687 {0xa0, 0x10, ZC3XX_R087_EXPTIMEMID},
4688 {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION},
4689 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
4690 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
4691 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
4692 {0xa0, 0x09, 0x01ad},
4693 {0xa0, 0x15, 0x01ae},
4694 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
4695 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
4696 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
4697 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
4698 {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN},
4699 {0xa0, 0x78, ZC3XX_R18D_YTARGET}, /*jfm: was 6c*/
4700 {}
4701 };
4702 static const struct usb_action pb0330_50HZ[] = {
4703 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
4704 {0xbb, 0x00, 0x055c},
4705 {0xbb, 0x01, 0x09aa},
4706 {0xbb, 0x00, 0x1001},
4707 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN},
4708 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
4709 {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID},
4710 {0xa0, 0xc4, ZC3XX_R192_EXPOSURELIMITLOW},
4711 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
4712 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
4713 {0xa0, 0x47, ZC3XX_R197_ANTIFLICKERLOW},
4714 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE},
4715 {0xa0, 0x1a, ZC3XX_R18F_AEUNFREEZE},
4716 {0xa0, 0x14, ZC3XX_R1A9_DIGITALLIMITDIFF},
4717 {0xa0, 0x66, ZC3XX_R1AA_DIGITALGAINSTEP},
4718 {0xa0, 0x5c, ZC3XX_R01D_HSYNC_0},
4719 {0xa0, 0x90, ZC3XX_R01E_HSYNC_1},
4720 {0xa0, 0xc8, ZC3XX_R01F_HSYNC_2},
4721 {0xa0, 0xff, ZC3XX_R020_HSYNC_3},
4722 {}
4723 };
4724 static const struct usb_action pb0330_50HZScale[] = {
4725 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
4726 {0xbb, 0x00, 0x0566},
4727 {0xbb, 0x02, 0x09b2},
4728 {0xbb, 0x00, 0x1002},
4729 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN},
4730 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
4731 {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID},
4732 {0xa0, 0x8c, ZC3XX_R192_EXPOSURELIMITLOW},
4733 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
4734 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
4735 {0xa0, 0x8a, ZC3XX_R197_ANTIFLICKERLOW},
4736 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE},
4737 {0xa0, 0x1a, ZC3XX_R18F_AEUNFREEZE},
4738 {0xa0, 0x14, ZC3XX_R1A9_DIGITALLIMITDIFF},
4739 {0xa0, 0x66, ZC3XX_R1AA_DIGITALGAINSTEP},
4740 {0xa0, 0xd7, ZC3XX_R01D_HSYNC_0},
4741 {0xa0, 0xf0, ZC3XX_R01E_HSYNC_1},
4742 {0xa0, 0xf8, ZC3XX_R01F_HSYNC_2},
4743 {0xa0, 0xff, ZC3XX_R020_HSYNC_3},
4744 {}
4745 };
4746 static const struct usb_action pb0330_60HZ[] = {
4747 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
4748 {0xbb, 0x00, 0x0535},
4749 {0xbb, 0x01, 0x0974},
4750 {0xbb, 0x00, 0x1001},
4751 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN},
4752 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
4753 {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID},
4754 {0xa0, 0xfe, ZC3XX_R192_EXPOSURELIMITLOW},
4755 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
4756 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
4757 {0xa0, 0x3e, ZC3XX_R197_ANTIFLICKERLOW},
4758 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE},
4759 {0xa0, 0x1a, ZC3XX_R18F_AEUNFREEZE},
4760 {0xa0, 0x14, ZC3XX_R1A9_DIGITALLIMITDIFF},
4761 {0xa0, 0x66, ZC3XX_R1AA_DIGITALGAINSTEP},
4762 {0xa0, 0x35, ZC3XX_R01D_HSYNC_0},
4763 {0xa0, 0x50, ZC3XX_R01E_HSYNC_1},
4764 {0xa0, 0x90, ZC3XX_R01F_HSYNC_2},
4765 {0xa0, 0xd0, ZC3XX_R020_HSYNC_3},
4766 {}
4767 };
4768 static const struct usb_action pb0330_60HZScale[] = {
4769 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
4770 {0xbb, 0x00, 0x0535},
4771 {0xbb, 0x02, 0x096c},
4772 {0xbb, 0x00, 0x1002},
4773 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN},
4774 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
4775 {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID},
4776 {0xa0, 0xc0, ZC3XX_R192_EXPOSURELIMITLOW},
4777 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
4778 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
4779 {0xa0, 0x7c, ZC3XX_R197_ANTIFLICKERLOW},
4780 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE},
4781 {0xa0, 0x1a, ZC3XX_R18F_AEUNFREEZE},
4782 {0xa0, 0x14, ZC3XX_R1A9_DIGITALLIMITDIFF},
4783 {0xa0, 0x66, ZC3XX_R1AA_DIGITALGAINSTEP},
4784 {0xa0, 0x35, ZC3XX_R01D_HSYNC_0},
4785 {0xa0, 0x50, ZC3XX_R01E_HSYNC_1},
4786 {0xa0, 0x90, ZC3XX_R01F_HSYNC_2},
4787 {0xa0, 0xd0, ZC3XX_R020_HSYNC_3},
4788 {}
4789 };
4790 static const struct usb_action pb0330_NoFlicker[] = {
4791 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
4792 {0xbb, 0x00, 0x0509},
4793 {0xbb, 0x02, 0x0940},
4794 {0xbb, 0x00, 0x1002},
4795 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN},
4796 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
4797 {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID},
4798 {0xa0, 0xf0, ZC3XX_R192_EXPOSURELIMITLOW},
4799 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
4800 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
4801 {0xa0, 0x01, ZC3XX_R197_ANTIFLICKERLOW},
4802 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE},
4803 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},
4804 {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF},
4805 {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP},
4806 {0xa0, 0x09, ZC3XX_R01D_HSYNC_0},
4807 {0xa0, 0x40, ZC3XX_R01E_HSYNC_1},
4808 {0xa0, 0x90, ZC3XX_R01F_HSYNC_2},
4809 {0xa0, 0xe0, ZC3XX_R020_HSYNC_3},
4810 {}
4811 };
4812 static const struct usb_action pb0330_NoFlickerScale[] = {
4813 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
4814 {0xbb, 0x00, 0x0535},
4815 {0xbb, 0x01, 0x0980},
4816 {0xbb, 0x00, 0x1001},
4817 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN},
4818 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
4819 {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID},
4820 {0xa0, 0xf0, ZC3XX_R192_EXPOSURELIMITLOW},
4821 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
4822 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
4823 {0xa0, 0x01, ZC3XX_R197_ANTIFLICKERLOW},
4824 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE},
4825 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},
4826 {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF},
4827 {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP},
4828 {0xa0, 0x35, ZC3XX_R01D_HSYNC_0},
4829 {0xa0, 0x60, ZC3XX_R01E_HSYNC_1},
4830 {0xa0, 0x90, ZC3XX_R01F_HSYNC_2},
4831 {0xa0, 0xe0, ZC3XX_R020_HSYNC_3},
4832 {}
4833 };
4834
4835 /* from oem9.inf */
4836 static const struct usb_action po2030_Initial[] = { /* 640x480 */
4837 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */
4838 {0xa0, 0x04, ZC3XX_R002_CLOCKSELECT}, /* 00,02,04,cc */
4839 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
4840 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* 00,01,01,cc */
4841 {0xa0, 0x04, ZC3XX_R080_HBLANKHIGH}, /* 00,80,04,cc */
4842 {0xa0, 0x05, ZC3XX_R081_HBLANKLOW}, /* 00,81,05,cc */
4843 {0xa0, 0x16, ZC3XX_R083_RGAINADDR}, /* 00,83,16,cc */
4844 {0xa0, 0x18, ZC3XX_R085_BGAINADDR}, /* 00,85,18,cc */
4845 {0xa0, 0x1a, ZC3XX_R086_EXPTIMEHIGH}, /* 00,86,1a,cc */
4846 {0xa0, 0x1b, ZC3XX_R087_EXPTIMEMID}, /* 00,87,1b,cc */
4847 {0xa0, 0x1c, ZC3XX_R088_EXPTIMELOW}, /* 00,88,1c,cc */
4848 {0xa0, 0xee, ZC3XX_R08B_I2CDEVICEADDR}, /* 00,8b,ee,cc */
4849 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00,08,03,cc */
4850 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,03,cc */
4851 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,01,cc */
4852 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, /* 00,03,02,cc */
4853 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, /* 00,04,80,cc */
4854 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* 00,05,01,cc */
4855 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, /* 00,06,e0,cc */
4856 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,42,cc */
4857 {0xaa, 0x8d, 0x0008}, /* 00,8d,08,aa */
4858 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, /* 00,98,00,cc */
4859 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, /* 00,9a,00,cc */
4860 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* 01,1a,00,cc */
4861 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, /* 01,1c,00,cc */
4862 {0xa0, 0xe6, ZC3XX_R09C_WINHEIGHTLOW}, /* 00,9c,e6,cc */
4863 {0xa0, 0x86, ZC3XX_R09E_WINWIDTHLOW}, /* 00,9e,86,cc */
4864 {0xaa, 0x09, 0x00ce}, /* 00,09,ce,aa */
4865 {0xaa, 0x0b, 0x0005}, /* 00,0b,05,aa */
4866 {0xaa, 0x0d, 0x0054}, /* 00,0d,54,aa */
4867 {0xaa, 0x0f, 0x00eb}, /* 00,0f,eb,aa */
4868 {0xaa, 0x87, 0x0000}, /* 00,87,00,aa */
4869 {0xaa, 0x88, 0x0004}, /* 00,88,04,aa */
4870 {0xaa, 0x89, 0x0000}, /* 00,89,00,aa */
4871 {0xaa, 0x8a, 0x0005}, /* 00,8a,05,aa */
4872 {0xaa, 0x13, 0x0003}, /* 00,13,03,aa */
4873 {0xaa, 0x16, 0x0040}, /* 00,16,40,aa */
4874 {0xaa, 0x18, 0x0040}, /* 00,18,40,aa */
4875 {0xaa, 0x1d, 0x0002}, /* 00,1d,02,aa */
4876 {0xaa, 0x29, 0x00e8}, /* 00,29,e8,aa */
4877 {0xaa, 0x45, 0x0045}, /* 00,45,45,aa */
4878 {0xaa, 0x50, 0x00ed}, /* 00,50,ed,aa */
4879 {0xaa, 0x51, 0x0025}, /* 00,51,25,aa */
4880 {0xaa, 0x52, 0x0042}, /* 00,52,42,aa */
4881 {0xaa, 0x53, 0x002f}, /* 00,53,2f,aa */
4882 {0xaa, 0x79, 0x0025}, /* 00,79,25,aa */
4883 {0xaa, 0x7b, 0x0000}, /* 00,7b,00,aa */
4884 {0xaa, 0x7e, 0x0025}, /* 00,7e,25,aa */
4885 {0xaa, 0x7f, 0x0025}, /* 00,7f,25,aa */
4886 {0xaa, 0x21, 0x0000}, /* 00,21,00,aa */
4887 {0xaa, 0x33, 0x0036}, /* 00,33,36,aa */
4888 {0xaa, 0x36, 0x0060}, /* 00,36,60,aa */
4889 {0xaa, 0x37, 0x0008}, /* 00,37,08,aa */
4890 {0xaa, 0x3b, 0x0031}, /* 00,3b,31,aa */
4891 {0xaa, 0x44, 0x000f}, /* 00,44,0f,aa */
4892 {0xaa, 0x58, 0x0002}, /* 00,58,02,aa */
4893 {0xaa, 0x66, 0x00c0}, /* 00,66,c0,aa */
4894 {0xaa, 0x67, 0x0044}, /* 00,67,44,aa */
4895 {0xaa, 0x6b, 0x00a0}, /* 00,6b,a0,aa */
4896 {0xaa, 0x6c, 0x0054}, /* 00,6c,54,aa */
4897 {0xaa, 0xd6, 0x0007}, /* 00,d6,07,aa */
4898 {0xa0, 0xf7, ZC3XX_R101_SENSORCORRECTION}, /* 01,01,f7,cc */
4899 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,05,cc */
4900 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0d,cc */
4901 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* 01,89,06,cc */
4902 {0xa0, 0x00, 0x01ad}, /* 01,ad,00,cc */
4903 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* 01,c5,03,cc */
4904 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* 01,cb,13,cc */
4905 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* 02,50,08,cc */
4906 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* 03,01,08,cc */
4907 {0xa0, 0x7a, ZC3XX_R116_RGAIN}, /* 01,16,7a,cc */
4908 {0xa0, 0x4a, ZC3XX_R118_BGAIN}, /* 01,18,4a,cc */
4909 {}
4910 };
4911
4912 /* from oem9.inf */
4913 static const struct usb_action po2030_InitialScale[] = { /* 320x240 */
4914 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */
4915 {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT}, /* 00,02,10,cc */
4916 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
4917 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* 00,01,01,cc */
4918 {0xa0, 0x04, ZC3XX_R080_HBLANKHIGH}, /* 00,80,04,cc */
4919 {0xa0, 0x05, ZC3XX_R081_HBLANKLOW}, /* 00,81,05,cc */
4920 {0xa0, 0x16, ZC3XX_R083_RGAINADDR}, /* 00,83,16,cc */
4921 {0xa0, 0x18, ZC3XX_R085_BGAINADDR}, /* 00,85,18,cc */
4922 {0xa0, 0x1a, ZC3XX_R086_EXPTIMEHIGH}, /* 00,86,1a,cc */
4923 {0xa0, 0x1b, ZC3XX_R087_EXPTIMEMID}, /* 00,87,1b,cc */
4924 {0xa0, 0x1c, ZC3XX_R088_EXPTIMELOW}, /* 00,88,1c,cc */
4925 {0xa0, 0xee, ZC3XX_R08B_I2CDEVICEADDR}, /* 00,8b,ee,cc */
4926 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00,08,03,cc */
4927 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,03,cc */
4928 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,01,cc */
4929 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, /* 00,03,02,cc */
4930 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, /* 00,04,80,cc */
4931 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* 00,05,01,cc */
4932 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, /* 00,06,e0,cc */
4933 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,42,cc */
4934 {0xaa, 0x8d, 0x0008}, /* 00,8d,08,aa */
4935 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, /* 00,98,00,cc */
4936 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, /* 00,9a,00,cc */
4937 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* 01,1a,00,cc */
4938 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, /* 01,1c,00,cc */
4939 {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW}, /* 00,9c,e8,cc */
4940 {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW}, /* 00,9e,88,cc */
4941 {0xaa, 0x09, 0x00cc}, /* 00,09,cc,aa */
4942 {0xaa, 0x0b, 0x0005}, /* 00,0b,05,aa */
4943 {0xaa, 0x0d, 0x0058}, /* 00,0d,58,aa */
4944 {0xaa, 0x0f, 0x00ed}, /* 00,0f,ed,aa */
4945 {0xaa, 0x87, 0x0000}, /* 00,87,00,aa */
4946 {0xaa, 0x88, 0x0004}, /* 00,88,04,aa */
4947 {0xaa, 0x89, 0x0000}, /* 00,89,00,aa */
4948 {0xaa, 0x8a, 0x0005}, /* 00,8a,05,aa */
4949 {0xaa, 0x13, 0x0003}, /* 00,13,03,aa */
4950 {0xaa, 0x16, 0x0040}, /* 00,16,40,aa */
4951 {0xaa, 0x18, 0x0040}, /* 00,18,40,aa */
4952 {0xaa, 0x1d, 0x0002}, /* 00,1d,02,aa */
4953 {0xaa, 0x29, 0x00e8}, /* 00,29,e8,aa */
4954 {0xaa, 0x45, 0x0045}, /* 00,45,45,aa */
4955 {0xaa, 0x50, 0x00ed}, /* 00,50,ed,aa */
4956 {0xaa, 0x51, 0x0025}, /* 00,51,25,aa */
4957 {0xaa, 0x52, 0x0042}, /* 00,52,42,aa */
4958 {0xaa, 0x53, 0x002f}, /* 00,53,2f,aa */
4959 {0xaa, 0x79, 0x0025}, /* 00,79,25,aa */
4960 {0xaa, 0x7b, 0x0000}, /* 00,7b,00,aa */
4961 {0xaa, 0x7e, 0x0025}, /* 00,7e,25,aa */
4962 {0xaa, 0x7f, 0x0025}, /* 00,7f,25,aa */
4963 {0xaa, 0x21, 0x0000}, /* 00,21,00,aa */
4964 {0xaa, 0x33, 0x0036}, /* 00,33,36,aa */
4965 {0xaa, 0x36, 0x0060}, /* 00,36,60,aa */
4966 {0xaa, 0x37, 0x0008}, /* 00,37,08,aa */
4967 {0xaa, 0x3b, 0x0031}, /* 00,3b,31,aa */
4968 {0xaa, 0x44, 0x000f}, /* 00,44,0f,aa */
4969 {0xaa, 0x58, 0x0002}, /* 00,58,02,aa */
4970 {0xaa, 0x66, 0x00c0}, /* 00,66,c0,aa */
4971 {0xaa, 0x67, 0x0044}, /* 00,67,44,aa */
4972 {0xaa, 0x6b, 0x00a0}, /* 00,6b,a0,aa */
4973 {0xaa, 0x6c, 0x0054}, /* 00,6c,54,aa */
4974 {0xaa, 0xd6, 0x0007}, /* 00,d6,07,aa */
4975 {0xa0, 0xf7, ZC3XX_R101_SENSORCORRECTION}, /* 01,01,f7,cc */
4976 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,05,cc */
4977 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0d,cc */
4978 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* 01,89,06,cc */
4979 {0xa0, 0x00, 0x01ad}, /* 01,ad,00,cc */
4980 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* 01,c5,03,cc */
4981 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* 01,cb,13,cc */
4982 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* 02,50,08,cc */
4983 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* 03,01,08,cc */
4984 {0xa0, 0x7a, ZC3XX_R116_RGAIN}, /* 01,16,7a,cc */
4985 {0xa0, 0x4a, ZC3XX_R118_BGAIN}, /* 01,18,4a,cc */
4986 {}
4987 };
4988
4989 static const struct usb_action po2030_50HZ[] = {
4990 {0xaa, 0x8d, 0x0008}, /* 00,8d,08,aa */
4991 {0xaa, 0x1a, 0x0001}, /* 00,1a,01,aa */
4992 {0xaa, 0x1b, 0x000a}, /* 00,1b,0a,aa */
4993 {0xaa, 0x1c, 0x00b0}, /* 00,1c,b0,aa */
4994 {0xa0, 0x05, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,05,cc */
4995 {0xa0, 0x35, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,35,cc */
4996 {0xa0, 0x70, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,70,cc */
4997 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
4998 {0xa0, 0x85, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,85,cc */
4999 {0xa0, 0x58, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,58,cc */
5000 {0xa0, 0x0c, ZC3XX_R18C_AEFREEZE}, /* 01,8c,0c,cc */
5001 {0xa0, 0x18, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,18,cc */
5002 {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN}, /* 01,a8,60,cc */
5003 {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc */
5004 {0xa0, 0x22, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,22,cc */
5005 {0xa0, 0x88, ZC3XX_R18D_YTARGET}, /* 01,8d,88,cc */
5006 {0xa0, 0x58, ZC3XX_R11D_GLOBALGAIN}, /* 01,1d,58,cc */
5007 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,42,cc */
5008 {}
5009 };
5010
5011 static const struct usb_action po2030_60HZ[] = {
5012 {0xaa, 0x8d, 0x0008}, /* 00,8d,08,aa */
5013 {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa */
5014 {0xaa, 0x1b, 0x00de}, /* 00,1b,de,aa */
5015 {0xaa, 0x1c, 0x0040}, /* 00,1c,40,aa */
5016 {0xa0, 0x08, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,08,cc */
5017 {0xa0, 0xae, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,ae,cc */
5018 {0xa0, 0x80, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,80,cc */
5019 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
5020 {0xa0, 0x6f, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,6f,cc */
5021 {0xa0, 0x20, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,20,cc */
5022 {0xa0, 0x0c, ZC3XX_R18C_AEFREEZE}, /* 01,8c,0c,cc */
5023 {0xa0, 0x18, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,18,cc */
5024 {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN}, /* 01,a8,60,cc */
5025 {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc */
5026 {0xa0, 0x22, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,22,cc */
5027 {0xa0, 0x88, ZC3XX_R18D_YTARGET}, /* 01,8d,88,cc */
5028 /* win: 01,8d,80 */
5029 {0xa0, 0x58, ZC3XX_R11D_GLOBALGAIN}, /* 01,1d,58,cc */
5030 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,42,cc */
5031 {}
5032 };
5033
5034 static const struct usb_action po2030_NoFlicker[] = {
5035 {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,02,cc */
5036 {0xaa, 0x8d, 0x000d}, /* 00,8d,0d,aa */
5037 {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa */
5038 {0xaa, 0x1b, 0x0002}, /* 00,1b,02,aa */
5039 {0xaa, 0x1c, 0x0078}, /* 00,1c,78,aa */
5040 {0xaa, 0x46, 0x0000}, /* 00,46,00,aa */
5041 {0xaa, 0x15, 0x0000}, /* 00,15,00,aa */
5042 {}
5043 };
5044
5045 static const struct usb_action tas5130c_InitialScale[] = { /* 320x240 */
5046 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
5047 {0xa0, 0x50, ZC3XX_R002_CLOCKSELECT},
5048 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
5049 {0xa0, 0x02, ZC3XX_R010_CMOSSENSORSELECT},
5050 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
5051 {0xa0, 0x00, ZC3XX_R001_SYSTEMOPERATING},
5052 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC},
5053 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
5054 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
5055 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH},
5056 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW},
5057 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},
5058 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW},
5059
5060 {0xa0, 0x04, ZC3XX_R098_WINYSTARTLOW},
5061 {0xa0, 0x0f, ZC3XX_R09A_WINXSTARTLOW},
5062 {0xa0, 0x04, ZC3XX_R11A_FIRSTYLOW},
5063 {0xa0, 0x0f, ZC3XX_R11C_FIRSTXLOW},
5064 {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW},
5065 {0xa0, 0x02, ZC3XX_R09D_WINWIDTHHIGH},
5066 {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW},
5067 {0xa0, 0x06, ZC3XX_R08D_COMPABILITYMODE},
5068 {0xa0, 0xf7, ZC3XX_R101_SENSORCORRECTION},
5069 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
5070 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
5071 {0xa0, 0x70, ZC3XX_R18D_YTARGET},
5072 {0xa0, 0x50, ZC3XX_R1A8_DIGITALGAIN},
5073 {0xa0, 0x00, 0x01ad},
5074 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
5075 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
5076 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
5077 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
5078 {0xa0, 0x07, ZC3XX_R0A5_EXPOSUREGAIN},
5079 {0xa0, 0x02, ZC3XX_R0A6_EXPOSUREBLACKLVL},
5080 {}
5081 };
5082 static const struct usb_action tas5130c_Initial[] = { /* 640x480 */
5083 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
5084 {0xa0, 0x40, ZC3XX_R002_CLOCKSELECT},
5085 {0xa0, 0x00, ZC3XX_R008_CLOCKSETTING},
5086 {0xa0, 0x02, ZC3XX_R010_CMOSSENSORSELECT},
5087 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
5088 {0xa0, 0x00, ZC3XX_R001_SYSTEMOPERATING},
5089 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC},
5090 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
5091 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC},
5092 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH},
5093 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW},
5094 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},
5095 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW},
5096 {0xa0, 0x05, ZC3XX_R098_WINYSTARTLOW},
5097 {0xa0, 0x0f, ZC3XX_R09A_WINXSTARTLOW},
5098 {0xa0, 0x05, ZC3XX_R11A_FIRSTYLOW},
5099 {0xa0, 0x0f, ZC3XX_R11C_FIRSTXLOW},
5100 {0xa0, 0xe6, ZC3XX_R09C_WINHEIGHTLOW},
5101 {0xa0, 0x02, ZC3XX_R09D_WINWIDTHHIGH},
5102 {0xa0, 0x86, ZC3XX_R09E_WINWIDTHLOW},
5103 {0xa0, 0x06, ZC3XX_R08D_COMPABILITYMODE},
5104 {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION},
5105 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
5106 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
5107 {0xa0, 0x70, ZC3XX_R18D_YTARGET},
5108 {0xa0, 0x50, ZC3XX_R1A8_DIGITALGAIN},
5109 {0xa0, 0x00, 0x01ad},
5110 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
5111 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
5112 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
5113 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
5114 {0xa0, 0x07, ZC3XX_R0A5_EXPOSUREGAIN},
5115 {0xa0, 0x02, ZC3XX_R0A6_EXPOSUREBLACKLVL},
5116 {}
5117 };
5118 static const struct usb_action tas5130c_50HZ[] = {
5119 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
5120 {0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */
5121 {0xaa, 0xa4, 0x0063}, /* 00,a4,63,aa */
5122 {0xa0, 0x01, ZC3XX_R0A3_EXPOSURETIMEHIGH}, /* 00,a3,01,cc */
5123 {0xa0, 0x63, ZC3XX_R0A4_EXPOSURETIMELOW}, /* 00,a4,63,cc */
5124 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
5125 {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID},
5126 {0xa0, 0xfe, ZC3XX_R192_EXPOSURELIMITLOW},
5127 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
5128 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
5129 {0xa0, 0x47, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,47,cc */
5130 {0xa0, 0x0c, ZC3XX_R18C_AEFREEZE},
5131 {0xa0, 0x18, ZC3XX_R18F_AEUNFREEZE},
5132 {0xa0, 0x08, ZC3XX_R1A9_DIGITALLIMITDIFF},
5133 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP},
5134 {0xa0, 0xd3, ZC3XX_R01D_HSYNC_0}, /* 00,1d,d3,cc */
5135 {0xa0, 0xda, ZC3XX_R01E_HSYNC_1}, /* 00,1e,da,cc */
5136 {0xa0, 0xea, ZC3XX_R01F_HSYNC_2}, /* 00,1f,ea,cc */
5137 {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */
5138 {0xa0, 0x03, ZC3XX_R09F_MAXXHIGH}, /* 00,9f,03,cc */
5139 {0xa0, 0x4c, ZC3XX_R0A0_MAXXLOW},
5140 {0xa0, 0x50, ZC3XX_R11D_GLOBALGAIN},
5141 {}
5142 };
5143 static const struct usb_action tas5130c_50HZScale[] = {
5144 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
5145 {0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */
5146 {0xaa, 0xa4, 0x0077}, /* 00,a4,77,aa */
5147 {0xa0, 0x01, ZC3XX_R0A3_EXPOSURETIMEHIGH}, /* 00,a3,01,cc */
5148 {0xa0, 0x77, ZC3XX_R0A4_EXPOSURETIMELOW}, /* 00,a4,77,cc */
5149 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
5150 {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID},
5151 {0xa0, 0xd0, ZC3XX_R192_EXPOSURELIMITLOW},
5152 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
5153 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
5154 {0xa0, 0x7d, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,7d,cc */
5155 {0xa0, 0x0c, ZC3XX_R18C_AEFREEZE},
5156 {0xa0, 0x18, ZC3XX_R18F_AEUNFREEZE},
5157 {0xa0, 0x08, ZC3XX_R1A9_DIGITALLIMITDIFF},
5158 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP},
5159 {0xa0, 0xf0, ZC3XX_R01D_HSYNC_0}, /* 00,1d,f0,cc */
5160 {0xa0, 0xf4, ZC3XX_R01E_HSYNC_1}, /* 00,1e,f4,cc */
5161 {0xa0, 0xf8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,f8,cc */
5162 {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */
5163 {0xa0, 0x03, ZC3XX_R09F_MAXXHIGH}, /* 00,9f,03,cc */
5164 {0xa0, 0xc0, ZC3XX_R0A0_MAXXLOW},
5165 {0xa0, 0x50, ZC3XX_R11D_GLOBALGAIN},
5166 {}
5167 };
5168 static const struct usb_action tas5130c_60HZ[] = {
5169 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
5170 {0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */
5171 {0xaa, 0xa4, 0x0036}, /* 00,a4,36,aa */
5172 {0xa0, 0x01, ZC3XX_R0A3_EXPOSURETIMEHIGH}, /* 00,a3,01,cc */
5173 {0xa0, 0x36, ZC3XX_R0A4_EXPOSURETIMELOW}, /* 00,a4,36,cc */
5174 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
5175 {0xa0, 0x05, ZC3XX_R191_EXPOSURELIMITMID},
5176 {0xa0, 0x54, ZC3XX_R192_EXPOSURELIMITLOW},
5177 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
5178 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
5179 {0xa0, 0x3e, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,3e,cc */
5180 {0xa0, 0x0c, ZC3XX_R18C_AEFREEZE},
5181 {0xa0, 0x18, ZC3XX_R18F_AEUNFREEZE},
5182 {0xa0, 0x08, ZC3XX_R1A9_DIGITALLIMITDIFF},
5183 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP},
5184 {0xa0, 0xca, ZC3XX_R01D_HSYNC_0}, /* 00,1d,ca,cc */
5185 {0xa0, 0xd0, ZC3XX_R01E_HSYNC_1}, /* 00,1e,d0,cc */
5186 {0xa0, 0xe0, ZC3XX_R01F_HSYNC_2}, /* 00,1f,e0,cc */
5187 {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */
5188 {0xa0, 0x03, ZC3XX_R09F_MAXXHIGH}, /* 00,9f,03,cc */
5189 {0xa0, 0x28, ZC3XX_R0A0_MAXXLOW},
5190 {0xa0, 0x50, ZC3XX_R11D_GLOBALGAIN},
5191 {}
5192 };
5193 static const struct usb_action tas5130c_60HZScale[] = {
5194 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
5195 {0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */
5196 {0xaa, 0xa4, 0x0077}, /* 00,a4,77,aa */
5197 {0xa0, 0x01, ZC3XX_R0A3_EXPOSURETIMEHIGH}, /* 00,a3,01,cc */
5198 {0xa0, 0x77, ZC3XX_R0A4_EXPOSURETIMELOW}, /* 00,a4,77,cc */
5199 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
5200 {0xa0, 0x09, ZC3XX_R191_EXPOSURELIMITMID},
5201 {0xa0, 0x47, ZC3XX_R192_EXPOSURELIMITLOW},
5202 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */
5203 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */
5204 {0xa0, 0x7d, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,7d,cc */
5205 {0xa0, 0x0c, ZC3XX_R18C_AEFREEZE},
5206 {0xa0, 0x18, ZC3XX_R18F_AEUNFREEZE},
5207 {0xa0, 0x08, ZC3XX_R1A9_DIGITALLIMITDIFF},
5208 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP},
5209 {0xa0, 0xc8, ZC3XX_R01D_HSYNC_0}, /* 00,1d,c8,cc */
5210 {0xa0, 0xd0, ZC3XX_R01E_HSYNC_1}, /* 00,1e,d0,cc */
5211 {0xa0, 0xe0, ZC3XX_R01F_HSYNC_2}, /* 00,1f,e0,cc */
5212 {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */
5213 {0xa0, 0x03, ZC3XX_R09F_MAXXHIGH}, /* 00,9f,03,cc */
5214 {0xa0, 0x20, ZC3XX_R0A0_MAXXLOW},
5215 {0xa0, 0x50, ZC3XX_R11D_GLOBALGAIN},
5216 {}
5217 };
5218 static const struct usb_action tas5130c_NoFlicker[] = {
5219 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
5220 {0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */
5221 {0xaa, 0xa4, 0x0040}, /* 00,a4,40,aa */
5222 {0xa0, 0x01, ZC3XX_R0A3_EXPOSURETIMEHIGH}, /* 00,a3,01,cc */
5223 {0xa0, 0x40, ZC3XX_R0A4_EXPOSURETIMELOW}, /* 00,a4,40,cc */
5224 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
5225 {0xa0, 0x05, ZC3XX_R191_EXPOSURELIMITMID},
5226 {0xa0, 0xa0, ZC3XX_R192_EXPOSURELIMITLOW},
5227 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
5228 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
5229 {0xa0, 0x04, ZC3XX_R197_ANTIFLICKERLOW},
5230 {0xa0, 0x0c, ZC3XX_R18C_AEFREEZE},
5231 {0xa0, 0x18, ZC3XX_R18F_AEUNFREEZE},
5232 {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,00,cc */
5233 {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,00,cc */
5234 {0xa0, 0xbc, ZC3XX_R01D_HSYNC_0}, /* 00,1d,bc,cc */
5235 {0xa0, 0xd0, ZC3XX_R01E_HSYNC_1}, /* 00,1e,d0,cc */
5236 {0xa0, 0xe0, ZC3XX_R01F_HSYNC_2}, /* 00,1f,e0,cc */
5237 {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */
5238 {0xa0, 0x02, ZC3XX_R09F_MAXXHIGH}, /* 00,9f,02,cc */
5239 {0xa0, 0xf0, ZC3XX_R0A0_MAXXLOW},
5240 {0xa0, 0x50, ZC3XX_R11D_GLOBALGAIN},
5241 {}
5242 };
5243
5244 static const struct usb_action tas5130c_NoFlickerScale[] = {
5245 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
5246 {0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */
5247 {0xaa, 0xa4, 0x0090}, /* 00,a4,90,aa */
5248 {0xa0, 0x01, ZC3XX_R0A3_EXPOSURETIMEHIGH}, /* 00,a3,01,cc */
5249 {0xa0, 0x90, ZC3XX_R0A4_EXPOSURETIMELOW}, /* 00,a4,90,cc */
5250 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
5251 {0xa0, 0x0a, ZC3XX_R191_EXPOSURELIMITMID},
5252 {0xa0, 0x00, ZC3XX_R192_EXPOSURELIMITLOW},
5253 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
5254 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
5255 {0xa0, 0x04, ZC3XX_R197_ANTIFLICKERLOW},
5256 {0xa0, 0x0c, ZC3XX_R18C_AEFREEZE},
5257 {0xa0, 0x18, ZC3XX_R18F_AEUNFREEZE},
5258 {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,00,cc */
5259 {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,00,cc */
5260 {0xa0, 0xbc, ZC3XX_R01D_HSYNC_0}, /* 00,1d,bc,cc */
5261 {0xa0, 0xd0, ZC3XX_R01E_HSYNC_1}, /* 00,1e,d0,cc */
5262 {0xa0, 0xe0, ZC3XX_R01F_HSYNC_2}, /* 00,1f,e0,cc */
5263 {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */
5264 {0xa0, 0x02, ZC3XX_R09F_MAXXHIGH}, /* 00,9f,02,cc */
5265 {0xa0, 0xf0, ZC3XX_R0A0_MAXXLOW},
5266 {0xa0, 0x50, ZC3XX_R11D_GLOBALGAIN},
5267 {}
5268 };
5269
5270 /* from usbvm305.inf 0ac8:305b 07/06/15 (3 - tas5130c) */
5271 static const struct usb_action gc0303_Initial[] = {
5272 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc, */
5273 {0xa0, 0x02, ZC3XX_R008_CLOCKSETTING}, /* 00,08,02,cc, */
5274 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc, */
5275 {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT},
5276 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, /* 00,03,02,cc, */
5277 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, /* 00,04,80,cc, */
5278 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* 00,05,01,cc, */
5279 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, /* 00,06,e0,cc, */
5280 {0xa0, 0x98, ZC3XX_R08B_I2CDEVICEADDR}, /* 00,8b,98,cc, */
5281 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* 00,01,01,cc, */
5282 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,03,cc, */
5283 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,01,cc, */
5284 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, /* 00,98,00,cc, */
5285 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, /* 00,9a,00,cc, */
5286 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* 01,1a,00,cc, */
5287 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, /* 01,1c,00,cc, */
5288 {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW}, /* 00,9c,e6,cc,
5289 * 6<->8 */
5290 {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW}, /* 00,9e,86,cc,
5291 * 6<->8 */
5292 {0xa0, 0x10, ZC3XX_R087_EXPTIMEMID}, /* 00,87,10,cc, */
5293 {0xa0, 0x98, ZC3XX_R08B_I2CDEVICEADDR}, /* 00,8b,98,cc, */
5294 {0xaa, 0x01, 0x0000},
5295 {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa, */
5296 {0xaa, 0x1c, 0x0017}, /* 00,1c,17,aa, */
5297 {0xaa, 0x1b, 0x0000},
5298 {0xa0, 0x82, ZC3XX_R086_EXPTIMEHIGH}, /* 00,86,82,cc, */
5299 {0xa0, 0x83, ZC3XX_R087_EXPTIMEMID}, /* 00,87,83,cc, */
5300 {0xa0, 0x84, ZC3XX_R088_EXPTIMELOW}, /* 00,88,84,cc, */
5301 {0xaa, 0x05, 0x0010}, /* 00,05,10,aa, */
5302 {0xaa, 0x0a, 0x0002},
5303 {0xaa, 0x0b, 0x0000},
5304 {0xaa, 0x0c, 0x0002},
5305 {0xaa, 0x0d, 0x0000},
5306 {0xaa, 0x0e, 0x0002},
5307 {0xaa, 0x0f, 0x0000},
5308 {0xaa, 0x10, 0x0002},
5309 {0xaa, 0x11, 0x0000},
5310 {0xaa, 0x16, 0x0001}, /* 00,16,01,aa, */
5311 {0xaa, 0x17, 0x00e8}, /* 00,17,e6,aa, (e6 -> e8) */
5312 {0xaa, 0x18, 0x0002}, /* 00,18,02,aa, */
5313 {0xaa, 0x19, 0x0088}, /* 00,19,86,aa, */
5314 {0xaa, 0x20, 0x0020}, /* 00,20,20,aa, */
5315 {0xa0, 0xb7, ZC3XX_R101_SENSORCORRECTION}, /* 01,01,b7,cc, */
5316 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,05,cc, */
5317 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0d,cc, */
5318 {0xa0, 0x76, ZC3XX_R189_AWBSTATUS}, /* 01,89,76,cc, */
5319 {0xa0, 0x09, 0x01ad}, /* 01,ad,09,cc, */
5320 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* 01,c5,03,cc, */
5321 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* 01,cb,13,cc, */
5322 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* 02,50,08,cc, */
5323 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* 03,01,08,cc, */
5324 {0xa0, 0x58, ZC3XX_R1A8_DIGITALGAIN},
5325 {0xa0, 0x61, ZC3XX_R116_RGAIN}, /* 01,16,61,cc, */
5326 {0xa0, 0x65, ZC3XX_R118_BGAIN}, /* 01,18,65,cc */
5327 {0xaa, 0x1b, 0x0000},
5328 {}
5329 };
5330
5331 static const struct usb_action gc0303_InitialScale[] = {
5332 {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc, */
5333 {0xa0, 0x02, ZC3XX_R008_CLOCKSETTING}, /* 00,08,02,cc, */
5334 {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc, */
5335 {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT},
5336 {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, /* 00,03,02,cc, */
5337 {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, /* 00,04,80,cc, */
5338 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* 00,05,01,cc, */
5339 {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, /* 00,06,e0,cc, */
5340 {0xa0, 0x98, ZC3XX_R08B_I2CDEVICEADDR}, /* 00,8b,98,cc, */
5341 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* 00,01,01,cc, */
5342 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,03,cc, */
5343 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,01,cc, */
5344 {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, /* 00,98,00,cc, */
5345 {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, /* 00,9a,00,cc, */
5346 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* 01,1a,00,cc, */
5347 {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, /* 01,1c,00,cc, */
5348 {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW}, /* 00,9c,e8,cc,
5349 * 8<->6 */
5350 {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW}, /* 00,9e,88,cc,
5351 * 8<->6 */
5352 {0xa0, 0x10, ZC3XX_R087_EXPTIMEMID}, /* 00,87,10,cc, */
5353 {0xa0, 0x98, ZC3XX_R08B_I2CDEVICEADDR}, /* 00,8b,98,cc, */
5354 {0xaa, 0x01, 0x0000},
5355 {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa, */
5356 {0xaa, 0x1c, 0x0017}, /* 00,1c,17,aa, */
5357 {0xaa, 0x1b, 0x0000},
5358 {0xa0, 0x82, ZC3XX_R086_EXPTIMEHIGH}, /* 00,86,82,cc, */
5359 {0xa0, 0x83, ZC3XX_R087_EXPTIMEMID}, /* 00,87,83,cc, */
5360 {0xa0, 0x84, ZC3XX_R088_EXPTIMELOW}, /* 00,88,84,cc, */
5361 {0xaa, 0x05, 0x0010}, /* 00,05,10,aa, */
5362 {0xaa, 0x0a, 0x0001},
5363 {0xaa, 0x0b, 0x0000},
5364 {0xaa, 0x0c, 0x0001},
5365 {0xaa, 0x0d, 0x0000},
5366 {0xaa, 0x0e, 0x0001},
5367 {0xaa, 0x0f, 0x0000},
5368 {0xaa, 0x10, 0x0001},
5369 {0xaa, 0x11, 0x0000},
5370 {0xaa, 0x16, 0x0001}, /* 00,16,01,aa, */
5371 {0xaa, 0x17, 0x00e8}, /* 00,17,e6,aa (e6 -> e8) */
5372 {0xaa, 0x18, 0x0002}, /* 00,18,02,aa, */
5373 {0xaa, 0x19, 0x0088}, /* 00,19,88,aa, */
5374 {0xa0, 0xb7, ZC3XX_R101_SENSORCORRECTION}, /* 01,01,b7,cc, */
5375 {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,05,cc, */
5376 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0d,cc, */
5377 {0xa0, 0x76, ZC3XX_R189_AWBSTATUS}, /* 01,89,76,cc, */
5378 {0xa0, 0x09, 0x01ad}, /* 01,ad,09,cc, */
5379 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* 01,c5,03,cc, */
5380 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* 01,cb,13,cc, */
5381 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* 02,50,08,cc, */
5382 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* 03,01,08,cc, */
5383 {0xa0, 0x58, ZC3XX_R1A8_DIGITALGAIN},
5384 {0xa0, 0x61, ZC3XX_R116_RGAIN}, /* 01,16,61,cc, */
5385 {0xa0, 0x65, ZC3XX_R118_BGAIN}, /* 01,18,65,cc */
5386 {0xaa, 0x1b, 0x0000},
5387 {}
5388 };
5389 static const struct usb_action gc0303_50HZ[] = {
5390 {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
5391 {0xaa, 0x83, 0x0001}, /* 00,83,01,aa */
5392 {0xaa, 0x84, 0x0063},
5393 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc, */
5394 {0xa0, 0x06, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,0d,cc, */
5395 {0xa0, 0xa8, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,50,cc, */
5396 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc, */
5397 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc, */
5398 {0xa0, 0x47, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,47,cc, */
5399 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE}, /* 01,8c,0e,cc, */
5400 {0xa0, 0x15, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,15,cc, */
5401 {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc, */
5402 {0xa0, 0x48, ZC3XX_R1AA_DIGITALGAINSTEP},
5403 {0xa0, 0x62, ZC3XX_R01D_HSYNC_0}, /* 00,1d,62,cc, */
5404 {0xa0, 0x90, ZC3XX_R01E_HSYNC_1}, /* 00,1e,90,cc, */
5405 {0xa0, 0xc8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,c8,cc, */
5406 {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc, */
5407 {0xa0, 0x58, ZC3XX_R11D_GLOBALGAIN}, /* 01,1d,58,cc, */
5408 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,42,cc, */
5409 {0xa0, 0x7f, ZC3XX_R18D_YTARGET},
5410 {}
5411 };
5412
5413 static const struct usb_action gc0303_50HZScale[] = {
5414 {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
5415 {0xaa, 0x83, 0x0003}, /* 00,83,03,aa */
5416 {0xaa, 0x84, 0x0054}, /* 00,84,54,aa */
5417 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc, */
5418 {0xa0, 0x0d, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,0d,cc, */
5419 {0xa0, 0x50, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,50,cc, */
5420 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc, */
5421 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc, */
5422 {0xa0, 0x8e, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,8e,cc, */
5423 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE}, /* 01,8c,0e,cc, */
5424 {0xa0, 0x15, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,15,cc, */
5425 {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc, */
5426 {0xa0, 0x48, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,24,cc, */
5427 {0xa0, 0x62, ZC3XX_R01D_HSYNC_0}, /* 00,1d,62,cc, */
5428 {0xa0, 0x90, ZC3XX_R01E_HSYNC_1}, /* 00,1e,90,cc, */
5429 {0xa0, 0xc8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,c8,cc, */
5430 {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc, */
5431 {0xa0, 0x58, ZC3XX_R11D_GLOBALGAIN}, /* 01,1d,58,cc, */
5432 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,42,cc, */
5433 {0xa0, 0x7f, ZC3XX_R18D_YTARGET},
5434 {}
5435 };
5436
5437 static const struct usb_action gc0303_60HZ[] = {
5438 {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
5439 {0xaa, 0x83, 0x0000},
5440 {0xaa, 0x84, 0x003b},
5441 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc, */
5442 {0xa0, 0x05, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,05,cc, */
5443 {0xa0, 0x88, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,88,cc, */
5444 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc, */
5445 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc, */
5446 {0xa0, 0x3b, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,3b,cc, */
5447 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE}, /* 01,8c,0e,cc, */
5448 {0xa0, 0x15, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,15,cc, */
5449 {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc, */
5450 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,24,cc, */
5451 {0xa0, 0x62, ZC3XX_R01D_HSYNC_0}, /* 00,1d,62,cc, */
5452 {0xa0, 0x90, ZC3XX_R01E_HSYNC_1}, /* 00,1e,90,cc, */
5453 {0xa0, 0xc8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,c8,cc, */
5454 {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc, */
5455 {0xa0, 0x58, ZC3XX_R11D_GLOBALGAIN}, /* 01,1d,58,cc, */
5456 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,42,cc, */
5457 {0xa0, 0x80, ZC3XX_R18D_YTARGET},
5458 {}
5459 };
5460
5461 static const struct usb_action gc0303_60HZScale[] = {
5462 {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
5463 {0xaa, 0x83, 0x0000},
5464 {0xaa, 0x84, 0x0076},
5465 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc, */
5466 {0xa0, 0x0b, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,1,0b,cc, */
5467 {0xa0, 0x10, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,2,10,cc, */
5468 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,5,00,cc, */
5469 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,6,00,cc, */
5470 {0xa0, 0x76, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,7,76,cc, */
5471 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE}, /* 01,c,0e,cc, */
5472 {0xa0, 0x15, ZC3XX_R18F_AEUNFREEZE}, /* 01,f,15,cc, */
5473 {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,9,10,cc, */
5474 {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,a,24,cc, */
5475 {0xa0, 0x62, ZC3XX_R01D_HSYNC_0}, /* 00,d,62,cc, */
5476 {0xa0, 0x90, ZC3XX_R01E_HSYNC_1}, /* 00,e,90,cc, */
5477 {0xa0, 0xc8, ZC3XX_R01F_HSYNC_2}, /* 00,f,c8,cc, */
5478 {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,0,ff,cc, */
5479 {0xa0, 0x58, ZC3XX_R11D_GLOBALGAIN}, /* 01,d,58,cc, */
5480 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,42,cc, */
5481 {0xa0, 0x80, ZC3XX_R18D_YTARGET},
5482 {}
5483 };
5484
5485 static const struct usb_action gc0303_NoFlicker[] = {
5486 {0xa0, 0x0c, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0c,cc, */
5487 {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
5488 {0xaa, 0x83, 0x0000}, /* 00,83,00,aa */
5489 {0xaa, 0x84, 0x0020}, /* 00,84,20,aa */
5490 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,0,00,cc, */
5491 {0xa0, 0x00, ZC3XX_R191_EXPOSURELIMITMID},
5492 {0xa0, 0x48, ZC3XX_R192_EXPOSURELIMITLOW},
5493 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc, */
5494 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc, */
5495 {0xa0, 0x10, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,10,cc, */
5496 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE}, /* 01,8c,0e,cc, */
5497 {0xa0, 0x15, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,15,cc, */
5498 {0xa0, 0x62, ZC3XX_R01D_HSYNC_0}, /* 00,1d,62,cc, */
5499 {0xa0, 0x90, ZC3XX_R01E_HSYNC_1}, /* 00,1e,90,cc, */
5500 {0xa0, 0xc8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,c8,cc, */
5501 {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc, */
5502 {0xa0, 0x58, ZC3XX_R11D_GLOBALGAIN}, /* 01,1d,58,cc, */
5503 {0xa0, 0x03, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,03,cc */
5504 {}
5505 };
5506
5507 static const struct usb_action gc0303_NoFlickerScale[] = {
5508 {0xa0, 0x0c, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0c,cc, */
5509 {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
5510 {0xaa, 0x83, 0x0000}, /* 00,83,00,aa */
5511 {0xaa, 0x84, 0x0020}, /* 00,84,20,aa */
5512 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc, */
5513 {0xa0, 0x00, ZC3XX_R191_EXPOSURELIMITMID},
5514 {0xa0, 0x48, ZC3XX_R192_EXPOSURELIMITLOW},
5515 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc, */
5516 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc, */
5517 {0xa0, 0x10, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,10,cc, */
5518 {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE}, /* 01,8c,0e,cc, */
5519 {0xa0, 0x15, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,15,cc, */
5520 {0xa0, 0x62, ZC3XX_R01D_HSYNC_0}, /* 00,1d,62,cc, */
5521 {0xa0, 0x90, ZC3XX_R01E_HSYNC_1}, /* 00,1e,90,cc, */
5522 {0xa0, 0xc8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,c8,cc, */
5523 {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc, */
5524 {0xa0, 0x58, ZC3XX_R11D_GLOBALGAIN}, /* 01,1d,58,cc, */
5525 {0xa0, 0x03, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,03,cc */
5526 {}
5527 };
5528
reg_r(struct gspca_dev * gspca_dev,u16 index)5529 static u8 reg_r(struct gspca_dev *gspca_dev,
5530 u16 index)
5531 {
5532 int ret;
5533
5534 if (gspca_dev->usb_err < 0)
5535 return 0;
5536 ret = usb_control_msg(gspca_dev->dev,
5537 usb_rcvctrlpipe(gspca_dev->dev, 0),
5538 0xa1,
5539 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
5540 0x01, /* value */
5541 index, gspca_dev->usb_buf, 1,
5542 500);
5543 if (ret < 0) {
5544 pr_err("reg_r err %d\n", ret);
5545 gspca_dev->usb_err = ret;
5546 return 0;
5547 }
5548 return gspca_dev->usb_buf[0];
5549 }
5550
reg_w(struct gspca_dev * gspca_dev,u8 value,u16 index)5551 static void reg_w(struct gspca_dev *gspca_dev,
5552 u8 value,
5553 u16 index)
5554 {
5555 int ret;
5556
5557 if (gspca_dev->usb_err < 0)
5558 return;
5559 ret = usb_control_msg(gspca_dev->dev,
5560 usb_sndctrlpipe(gspca_dev->dev, 0),
5561 0xa0,
5562 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
5563 value, index, NULL, 0,
5564 500);
5565 if (ret < 0) {
5566 pr_err("reg_w_i err %d\n", ret);
5567 gspca_dev->usb_err = ret;
5568 }
5569 }
5570
i2c_read(struct gspca_dev * gspca_dev,u8 reg)5571 static u16 i2c_read(struct gspca_dev *gspca_dev,
5572 u8 reg)
5573 {
5574 u8 retbyte;
5575 u16 retval;
5576
5577 if (gspca_dev->usb_err < 0)
5578 return 0;
5579 reg_w(gspca_dev, reg, 0x0092);
5580 reg_w(gspca_dev, 0x02, 0x0090); /* <- read command */
5581 msleep(20);
5582 retbyte = reg_r(gspca_dev, 0x0091); /* read status */
5583 if (retbyte != 0x00)
5584 pr_err("i2c_r status error %02x\n", retbyte);
5585 retval = reg_r(gspca_dev, 0x0095); /* read Lowbyte */
5586 retval |= reg_r(gspca_dev, 0x0096) << 8; /* read Hightbyte */
5587 return retval;
5588 }
5589
i2c_write(struct gspca_dev * gspca_dev,u8 reg,u8 valL,u8 valH)5590 static u8 i2c_write(struct gspca_dev *gspca_dev,
5591 u8 reg,
5592 u8 valL,
5593 u8 valH)
5594 {
5595 u8 retbyte;
5596
5597 if (gspca_dev->usb_err < 0)
5598 return 0;
5599 reg_w(gspca_dev, reg, 0x92);
5600 reg_w(gspca_dev, valL, 0x93);
5601 reg_w(gspca_dev, valH, 0x94);
5602 reg_w(gspca_dev, 0x01, 0x90); /* <- write command */
5603 msleep(1);
5604 retbyte = reg_r(gspca_dev, 0x0091); /* read status */
5605 if (retbyte != 0x00)
5606 pr_err("i2c_w status error %02x\n", retbyte);
5607 return retbyte;
5608 }
5609
usb_exchange(struct gspca_dev * gspca_dev,const struct usb_action * action)5610 static void usb_exchange(struct gspca_dev *gspca_dev,
5611 const struct usb_action *action)
5612 {
5613 while (action->req) {
5614 switch (action->req) {
5615 case 0xa0: /* write register */
5616 reg_w(gspca_dev, action->val, action->idx);
5617 break;
5618 case 0xa1: /* read status */
5619 reg_r(gspca_dev, action->idx);
5620 break;
5621 case 0xaa:
5622 i2c_write(gspca_dev,
5623 action->val, /* reg */
5624 action->idx & 0xff, /* valL */
5625 action->idx >> 8); /* valH */
5626 break;
5627 case 0xbb:
5628 i2c_write(gspca_dev,
5629 action->idx >> 8, /* reg */
5630 action->idx & 0xff, /* valL */
5631 action->val); /* valH */
5632 break;
5633 default:
5634 /* case 0xdd: * delay */
5635 msleep(action->idx);
5636 break;
5637 }
5638 action++;
5639 msleep(1);
5640 }
5641 }
5642
setmatrix(struct gspca_dev * gspca_dev)5643 static void setmatrix(struct gspca_dev *gspca_dev)
5644 {
5645 struct sd *sd = (struct sd *) gspca_dev;
5646 int i;
5647 const u8 *matrix;
5648 static const u8 adcm2700_matrix[9] =
5649 /* {0x66, 0xed, 0xed, 0xed, 0x66, 0xed, 0xed, 0xed, 0x66}; */
5650 /*ms-win*/
5651 {0x74, 0xed, 0xed, 0xed, 0x74, 0xed, 0xed, 0xed, 0x74};
5652 static const u8 gc0305_matrix[9] =
5653 {0x50, 0xf8, 0xf8, 0xf8, 0x50, 0xf8, 0xf8, 0xf8, 0x50};
5654 static const u8 ov7620_matrix[9] =
5655 {0x58, 0xf4, 0xf4, 0xf4, 0x58, 0xf4, 0xf4, 0xf4, 0x58};
5656 static const u8 pas202b_matrix[9] =
5657 {0x4c, 0xf5, 0xff, 0xf9, 0x51, 0xf5, 0xfb, 0xed, 0x5f};
5658 static const u8 po2030_matrix[9] =
5659 {0x60, 0xf0, 0xf0, 0xf0, 0x60, 0xf0, 0xf0, 0xf0, 0x60};
5660 static const u8 tas5130c_matrix[9] =
5661 {0x68, 0xec, 0xec, 0xec, 0x68, 0xec, 0xec, 0xec, 0x68};
5662 static const u8 gc0303_matrix[9] =
5663 {0x6c, 0xea, 0xea, 0xea, 0x6c, 0xea, 0xea, 0xea, 0x6c};
5664 static const u8 *matrix_tb[SENSOR_MAX] = {
5665 [SENSOR_ADCM2700] = adcm2700_matrix,
5666 [SENSOR_CS2102] = ov7620_matrix,
5667 [SENSOR_CS2102K] = NULL,
5668 [SENSOR_GC0303] = gc0303_matrix,
5669 [SENSOR_GC0305] = gc0305_matrix,
5670 [SENSOR_HDCS2020] = NULL,
5671 [SENSOR_HV7131B] = NULL,
5672 [SENSOR_HV7131R] = po2030_matrix,
5673 [SENSOR_ICM105A] = po2030_matrix,
5674 [SENSOR_MC501CB] = NULL,
5675 [SENSOR_MT9V111_1] = gc0305_matrix,
5676 [SENSOR_MT9V111_3] = gc0305_matrix,
5677 [SENSOR_OV7620] = ov7620_matrix,
5678 [SENSOR_OV7630C] = NULL,
5679 [SENSOR_PAS106] = NULL,
5680 [SENSOR_PAS202B] = pas202b_matrix,
5681 [SENSOR_PB0330] = gc0305_matrix,
5682 [SENSOR_PO2030] = po2030_matrix,
5683 [SENSOR_TAS5130C] = tas5130c_matrix,
5684 };
5685
5686 matrix = matrix_tb[sd->sensor];
5687 if (matrix == NULL)
5688 return; /* matrix already loaded */
5689 for (i = 0; i < ARRAY_SIZE(ov7620_matrix); i++)
5690 reg_w(gspca_dev, matrix[i], 0x010a + i);
5691 }
5692
setsharpness(struct gspca_dev * gspca_dev,s32 val)5693 static void setsharpness(struct gspca_dev *gspca_dev, s32 val)
5694 {
5695 static const u8 sharpness_tb[][2] = {
5696 {0x02, 0x03},
5697 {0x04, 0x07},
5698 {0x08, 0x0f},
5699 {0x10, 0x1e}
5700 };
5701
5702 reg_w(gspca_dev, sharpness_tb[val][0], 0x01c6);
5703 reg_r(gspca_dev, 0x01c8);
5704 reg_r(gspca_dev, 0x01c9);
5705 reg_r(gspca_dev, 0x01ca);
5706 reg_w(gspca_dev, sharpness_tb[val][1], 0x01cb);
5707 }
5708
setcontrast(struct gspca_dev * gspca_dev,s32 gamma,s32 brightness,s32 contrast)5709 static void setcontrast(struct gspca_dev *gspca_dev,
5710 s32 gamma, s32 brightness, s32 contrast)
5711 {
5712 const u8 *Tgamma;
5713 int g, i, adj, gp1, gp2;
5714 u8 gr[16];
5715 static const u8 delta_b[16] = /* delta for brightness */
5716 {0x50, 0x38, 0x2d, 0x28, 0x24, 0x21, 0x1e, 0x1d,
5717 0x1d, 0x1b, 0x1b, 0x1b, 0x19, 0x18, 0x18, 0x18};
5718 static const u8 delta_c[16] = /* delta for contrast */
5719 {0x2c, 0x1a, 0x12, 0x0c, 0x0a, 0x06, 0x06, 0x06,
5720 0x04, 0x06, 0x04, 0x04, 0x03, 0x03, 0x02, 0x02};
5721 static const u8 gamma_tb[6][16] = {
5722 {0x00, 0x00, 0x03, 0x0d, 0x1b, 0x2e, 0x45, 0x5f,
5723 0x79, 0x93, 0xab, 0xc1, 0xd4, 0xe5, 0xf3, 0xff},
5724 {0x01, 0x0c, 0x1f, 0x3a, 0x53, 0x6d, 0x85, 0x9c,
5725 0xb0, 0xc2, 0xd1, 0xde, 0xe9, 0xf2, 0xf9, 0xff},
5726 {0x04, 0x16, 0x30, 0x4e, 0x68, 0x81, 0x98, 0xac,
5727 0xbe, 0xcd, 0xda, 0xe4, 0xed, 0xf5, 0xfb, 0xff},
5728 {0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
5729 0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff},
5730 {0x20, 0x4b, 0x6e, 0x8d, 0xa3, 0xb5, 0xc5, 0xd2,
5731 0xdc, 0xe5, 0xec, 0xf2, 0xf6, 0xfa, 0xfd, 0xff},
5732 {0x24, 0x44, 0x64, 0x84, 0x9d, 0xb2, 0xc4, 0xd3,
5733 0xe0, 0xeb, 0xf4, 0xff, 0xff, 0xff, 0xff, 0xff},
5734 };
5735
5736 Tgamma = gamma_tb[gamma - 1];
5737
5738 contrast -= 128; /* -128 / 127 */
5739 brightness -= 128; /* -128 / 92 */
5740 adj = 0;
5741 gp1 = gp2 = 0;
5742 for (i = 0; i < 16; i++) {
5743 g = Tgamma[i] + delta_b[i] * brightness / 256
5744 - delta_c[i] * contrast / 256 - adj / 2;
5745 if (g > 0xff)
5746 g = 0xff;
5747 else if (g < 0)
5748 g = 0;
5749 reg_w(gspca_dev, g, 0x0120 + i); /* gamma */
5750 if (contrast > 0)
5751 adj--;
5752 else if (contrast < 0)
5753 adj++;
5754 if (i > 1)
5755 gr[i - 1] = (g - gp2) / 2;
5756 else if (i != 0)
5757 gr[0] = gp1 == 0 ? 0 : (g - gp1);
5758 gp2 = gp1;
5759 gp1 = g;
5760 }
5761 gr[15] = (0xff - gp2) / 2;
5762 for (i = 0; i < 16; i++)
5763 reg_w(gspca_dev, gr[i], 0x0130 + i); /* gradient */
5764 }
5765
getexposure(struct gspca_dev * gspca_dev)5766 static s32 getexposure(struct gspca_dev *gspca_dev)
5767 {
5768 struct sd *sd = (struct sd *) gspca_dev;
5769
5770 switch (sd->sensor) {
5771 case SENSOR_HV7131R:
5772 return (i2c_read(gspca_dev, 0x25) << 9)
5773 | (i2c_read(gspca_dev, 0x26) << 1)
5774 | (i2c_read(gspca_dev, 0x27) >> 7);
5775 case SENSOR_OV7620:
5776 return i2c_read(gspca_dev, 0x10);
5777 default:
5778 return -1;
5779 }
5780 }
5781
setexposure(struct gspca_dev * gspca_dev,s32 val)5782 static void setexposure(struct gspca_dev *gspca_dev, s32 val)
5783 {
5784 struct sd *sd = (struct sd *) gspca_dev;
5785
5786 switch (sd->sensor) {
5787 case SENSOR_HV7131R:
5788 i2c_write(gspca_dev, 0x25, val >> 9, 0x00);
5789 i2c_write(gspca_dev, 0x26, val >> 1, 0x00);
5790 i2c_write(gspca_dev, 0x27, val << 7, 0x00);
5791 break;
5792 case SENSOR_OV7620:
5793 i2c_write(gspca_dev, 0x10, val, 0x00);
5794 break;
5795 }
5796 }
5797
setquality(struct gspca_dev * gspca_dev)5798 static void setquality(struct gspca_dev *gspca_dev)
5799 {
5800 struct sd *sd = (struct sd *) gspca_dev;
5801 jpeg_set_qual(sd->jpeg_hdr, jpeg_qual[sd->reg08 >> 1]);
5802 reg_w(gspca_dev, sd->reg08, ZC3XX_R008_CLOCKSETTING);
5803 }
5804
5805 /* Matches the sensor's internal frame rate to the lighting frequency.
5806 * Valid frequencies are:
5807 * 50Hz, for European and Asian lighting (default)
5808 * 60Hz, for American lighting
5809 * 0 = No Flicker (for outdoor usage)
5810 */
setlightfreq(struct gspca_dev * gspca_dev,s32 val)5811 static void setlightfreq(struct gspca_dev *gspca_dev, s32 val)
5812 {
5813 struct sd *sd = (struct sd *) gspca_dev;
5814 int i, mode;
5815 const struct usb_action *zc3_freq;
5816 static const struct usb_action *freq_tb[SENSOR_MAX][6] = {
5817 [SENSOR_ADCM2700] = {
5818 adcm2700_NoFlicker, adcm2700_NoFlicker,
5819 adcm2700_50HZ, adcm2700_50HZ,
5820 adcm2700_60HZ, adcm2700_60HZ},
5821 [SENSOR_CS2102] = {
5822 cs2102_NoFlicker, cs2102_NoFlickerScale,
5823 cs2102_50HZ, cs2102_50HZScale,
5824 cs2102_60HZ, cs2102_60HZScale},
5825 [SENSOR_CS2102K] = {
5826 cs2102_NoFlicker, cs2102_NoFlickerScale,
5827 NULL, NULL, /* currently disabled */
5828 NULL, NULL},
5829 [SENSOR_GC0303] = {
5830 gc0303_NoFlicker, gc0303_NoFlickerScale,
5831 gc0303_50HZ, gc0303_50HZScale,
5832 gc0303_60HZ, gc0303_60HZScale},
5833 [SENSOR_GC0305] = {
5834 gc0305_NoFlicker, gc0305_NoFlicker,
5835 gc0305_50HZ, gc0305_50HZ,
5836 gc0305_60HZ, gc0305_60HZ},
5837 [SENSOR_HDCS2020] = {
5838 hdcs2020_NoFlicker, hdcs2020_NoFlicker,
5839 hdcs2020_50HZ, hdcs2020_50HZ,
5840 hdcs2020_60HZ, hdcs2020_60HZ},
5841 [SENSOR_HV7131B] = {
5842 hv7131b_NoFlicker, hv7131b_NoFlickerScale,
5843 hv7131b_50HZ, hv7131b_50HZScale,
5844 hv7131b_60HZ, hv7131b_60HZScale},
5845 [SENSOR_HV7131R] = {
5846 hv7131r_NoFlicker, hv7131r_NoFlickerScale,
5847 hv7131r_50HZ, hv7131r_50HZScale,
5848 hv7131r_60HZ, hv7131r_60HZScale},
5849 [SENSOR_ICM105A] = {
5850 icm105a_NoFlicker, icm105a_NoFlickerScale,
5851 icm105a_50HZ, icm105a_50HZScale,
5852 icm105a_60HZ, icm105a_60HZScale},
5853 [SENSOR_MC501CB] = {
5854 mc501cb_NoFlicker, mc501cb_NoFlickerScale,
5855 mc501cb_50HZ, mc501cb_50HZScale,
5856 mc501cb_60HZ, mc501cb_60HZScale},
5857 [SENSOR_MT9V111_1] = {
5858 mt9v111_1_AENoFlicker, mt9v111_1_AENoFlickerScale,
5859 mt9v111_1_AE50HZ, mt9v111_1_AE50HZScale,
5860 mt9v111_1_AE60HZ, mt9v111_1_AE60HZScale},
5861 [SENSOR_MT9V111_3] = {
5862 mt9v111_3_AENoFlicker, mt9v111_3_AENoFlickerScale,
5863 mt9v111_3_AE50HZ, mt9v111_3_AE50HZScale,
5864 mt9v111_3_AE60HZ, mt9v111_3_AE60HZScale},
5865 [SENSOR_OV7620] = {
5866 ov7620_NoFlicker, ov7620_NoFlicker,
5867 ov7620_50HZ, ov7620_50HZ,
5868 ov7620_60HZ, ov7620_60HZ},
5869 [SENSOR_OV7630C] = {
5870 NULL, NULL,
5871 NULL, NULL,
5872 NULL, NULL},
5873 [SENSOR_PAS106] = {
5874 pas106b_NoFlicker, pas106b_NoFlicker,
5875 pas106b_50HZ, pas106b_50HZ,
5876 pas106b_60HZ, pas106b_60HZ},
5877 [SENSOR_PAS202B] = {
5878 pas202b_NoFlicker, pas202b_NoFlickerScale,
5879 pas202b_50HZ, pas202b_50HZScale,
5880 pas202b_60HZ, pas202b_60HZScale},
5881 [SENSOR_PB0330] = {
5882 pb0330_NoFlicker, pb0330_NoFlickerScale,
5883 pb0330_50HZ, pb0330_50HZScale,
5884 pb0330_60HZ, pb0330_60HZScale},
5885 [SENSOR_PO2030] = {
5886 po2030_NoFlicker, po2030_NoFlicker,
5887 po2030_50HZ, po2030_50HZ,
5888 po2030_60HZ, po2030_60HZ},
5889 [SENSOR_TAS5130C] = {
5890 tas5130c_NoFlicker, tas5130c_NoFlickerScale,
5891 tas5130c_50HZ, tas5130c_50HZScale,
5892 tas5130c_60HZ, tas5130c_60HZScale},
5893 };
5894
5895 i = val * 2;
5896 mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv;
5897 if (mode)
5898 i++; /* 320x240 */
5899 zc3_freq = freq_tb[sd->sensor][i];
5900 if (zc3_freq == NULL)
5901 return;
5902 usb_exchange(gspca_dev, zc3_freq);
5903 switch (sd->sensor) {
5904 case SENSOR_GC0305:
5905 if (mode /* if 320x240 */
5906 && val == 1) /* and 50Hz */
5907 reg_w(gspca_dev, 0x85, 0x018d);
5908 /* win: 0x80, 0x018d */
5909 break;
5910 case SENSOR_OV7620:
5911 if (!mode) { /* if 640x480 */
5912 if (val != 0) /* and filter */
5913 reg_w(gspca_dev, 0x40, 0x0002);
5914 else
5915 reg_w(gspca_dev, 0x44, 0x0002);
5916 }
5917 break;
5918 case SENSOR_PAS202B:
5919 reg_w(gspca_dev, 0x00, 0x01a7);
5920 break;
5921 }
5922 }
5923
setautogain(struct gspca_dev * gspca_dev,s32 val)5924 static void setautogain(struct gspca_dev *gspca_dev, s32 val)
5925 {
5926 struct sd *sd = (struct sd *) gspca_dev;
5927
5928 if (sd->sensor == SENSOR_OV7620)
5929 i2c_write(gspca_dev, 0x13, val ? 0xa3 : 0x80, 0x00);
5930 else
5931 reg_w(gspca_dev, val ? 0x42 : 0x02, 0x0180);
5932 }
5933
5934 /*
5935 * Update the transfer parameters.
5936 * This function is executed from a work queue.
5937 */
transfer_update(struct work_struct * work)5938 static void transfer_update(struct work_struct *work)
5939 {
5940 struct sd *sd = container_of(work, struct sd, work);
5941 struct gspca_dev *gspca_dev = &sd->gspca_dev;
5942 int change, good;
5943 u8 reg07, reg11;
5944
5945 /* reg07 gets set to 0 by sd_start before starting us */
5946 reg07 = 0;
5947
5948 good = 0;
5949 while (1) {
5950 msleep(100);
5951
5952 /* To protect gspca_dev->usb_buf and gspca_dev->usb_err */
5953 mutex_lock(&gspca_dev->usb_lock);
5954 #ifdef CONFIG_PM
5955 if (gspca_dev->frozen)
5956 break;
5957 #endif
5958 if (!gspca_dev->present || !gspca_dev->streaming)
5959 break;
5960
5961 /* Bit 0 of register 11 indicates FIFO overflow */
5962 gspca_dev->usb_err = 0;
5963 reg11 = reg_r(gspca_dev, 0x0011);
5964 if (gspca_dev->usb_err)
5965 break;
5966
5967 change = reg11 & 0x01;
5968 if (change) { /* overflow */
5969 good = 0;
5970
5971 if (reg07 == 0) /* Bit Rate Control not enabled? */
5972 reg07 = 0x32; /* Allow 98 bytes / unit */
5973 else if (reg07 > 2)
5974 reg07 -= 2; /* Decrease allowed bytes / unit */
5975 else
5976 change = 0;
5977 } else { /* no overflow */
5978 good++;
5979 if (good >= 10) {
5980 good = 0;
5981 if (reg07) { /* BRC enabled? */
5982 change = 1;
5983 if (reg07 < 0x32)
5984 reg07 += 2;
5985 else
5986 reg07 = 0;
5987 }
5988 }
5989 }
5990 if (change) {
5991 gspca_dev->usb_err = 0;
5992 reg_w(gspca_dev, reg07, 0x0007);
5993 if (gspca_dev->usb_err)
5994 break;
5995 }
5996 mutex_unlock(&gspca_dev->usb_lock);
5997 }
5998
5999 /* Something went wrong. Unlock and return */
6000 mutex_unlock(&gspca_dev->usb_lock);
6001 }
6002
send_unknown(struct gspca_dev * gspca_dev,int sensor)6003 static void send_unknown(struct gspca_dev *gspca_dev, int sensor)
6004 {
6005 reg_w(gspca_dev, 0x01, 0x0000); /* bridge reset */
6006 switch (sensor) {
6007 case SENSOR_PAS106:
6008 reg_w(gspca_dev, 0x03, 0x003a);
6009 reg_w(gspca_dev, 0x0c, 0x003b);
6010 reg_w(gspca_dev, 0x08, 0x0038);
6011 break;
6012 case SENSOR_ADCM2700:
6013 case SENSOR_GC0305:
6014 case SENSOR_OV7620:
6015 case SENSOR_MT9V111_1:
6016 case SENSOR_MT9V111_3:
6017 case SENSOR_PB0330:
6018 case SENSOR_PO2030:
6019 reg_w(gspca_dev, 0x0d, 0x003a);
6020 reg_w(gspca_dev, 0x02, 0x003b);
6021 reg_w(gspca_dev, 0x00, 0x0038);
6022 break;
6023 case SENSOR_HV7131R:
6024 case SENSOR_PAS202B:
6025 reg_w(gspca_dev, 0x03, 0x003b);
6026 reg_w(gspca_dev, 0x0c, 0x003a);
6027 reg_w(gspca_dev, 0x0b, 0x0039);
6028 if (sensor == SENSOR_PAS202B)
6029 reg_w(gspca_dev, 0x0b, 0x0038);
6030 break;
6031 }
6032 }
6033
6034 /* start probe 2 wires */
start_2wr_probe(struct gspca_dev * gspca_dev,int sensor)6035 static void start_2wr_probe(struct gspca_dev *gspca_dev, int sensor)
6036 {
6037 reg_w(gspca_dev, 0x01, 0x0000);
6038 reg_w(gspca_dev, sensor, 0x0010);
6039 reg_w(gspca_dev, 0x01, 0x0001);
6040 reg_w(gspca_dev, 0x03, 0x0012);
6041 reg_w(gspca_dev, 0x01, 0x0012);
6042 /* msleep(2); */
6043 }
6044
sif_probe(struct gspca_dev * gspca_dev)6045 static int sif_probe(struct gspca_dev *gspca_dev)
6046 {
6047 u16 checkword;
6048
6049 start_2wr_probe(gspca_dev, 0x0f); /* PAS106 */
6050 reg_w(gspca_dev, 0x08, 0x008d);
6051 msleep(150);
6052 checkword = ((i2c_read(gspca_dev, 0x00) & 0x0f) << 4)
6053 | ((i2c_read(gspca_dev, 0x01) & 0xf0) >> 4);
6054 gspca_dbg(gspca_dev, D_PROBE, "probe sif 0x%04x\n", checkword);
6055 if (checkword == 0x0007) {
6056 send_unknown(gspca_dev, SENSOR_PAS106);
6057 return 0x0f; /* PAS106 */
6058 }
6059 return -1;
6060 }
6061
vga_2wr_probe(struct gspca_dev * gspca_dev)6062 static int vga_2wr_probe(struct gspca_dev *gspca_dev)
6063 {
6064 u16 retword;
6065
6066 start_2wr_probe(gspca_dev, 0x00); /* HV7131B */
6067 i2c_write(gspca_dev, 0x01, 0xaa, 0x00);
6068 retword = i2c_read(gspca_dev, 0x01);
6069 if (retword != 0)
6070 return 0x00; /* HV7131B */
6071
6072 start_2wr_probe(gspca_dev, 0x04); /* CS2102 */
6073 i2c_write(gspca_dev, 0x01, 0xaa, 0x00);
6074 retword = i2c_read(gspca_dev, 0x01);
6075 if (retword != 0)
6076 return 0x04; /* CS2102 */
6077
6078 start_2wr_probe(gspca_dev, 0x06); /* OmniVision */
6079 reg_w(gspca_dev, 0x08, 0x008d);
6080 i2c_write(gspca_dev, 0x11, 0xaa, 0x00);
6081 retword = i2c_read(gspca_dev, 0x11);
6082 if (retword != 0) {
6083 /* (should have returned 0xaa) --> Omnivision? */
6084 /* reg_r 0x10 -> 0x06 --> */
6085 goto ov_check;
6086 }
6087
6088 start_2wr_probe(gspca_dev, 0x08); /* HDCS2020 */
6089 i2c_write(gspca_dev, 0x1c, 0x00, 0x00);
6090 i2c_write(gspca_dev, 0x15, 0xaa, 0x00);
6091 retword = i2c_read(gspca_dev, 0x15);
6092 if (retword != 0)
6093 return 0x08; /* HDCS2020 */
6094
6095 start_2wr_probe(gspca_dev, 0x0a); /* PB0330 */
6096 i2c_write(gspca_dev, 0x07, 0xaa, 0xaa);
6097 retword = i2c_read(gspca_dev, 0x07);
6098 if (retword != 0)
6099 return 0x0a; /* PB0330 */
6100 retword = i2c_read(gspca_dev, 0x03);
6101 if (retword != 0)
6102 return 0x0a; /* PB0330 ?? */
6103 retword = i2c_read(gspca_dev, 0x04);
6104 if (retword != 0)
6105 return 0x0a; /* PB0330 ?? */
6106
6107 start_2wr_probe(gspca_dev, 0x0c); /* ICM105A */
6108 i2c_write(gspca_dev, 0x01, 0x11, 0x00);
6109 retword = i2c_read(gspca_dev, 0x01);
6110 if (retword != 0)
6111 return 0x0c; /* ICM105A */
6112
6113 start_2wr_probe(gspca_dev, 0x0e); /* PAS202BCB */
6114 reg_w(gspca_dev, 0x08, 0x008d);
6115 i2c_write(gspca_dev, 0x03, 0xaa, 0x00);
6116 msleep(50);
6117 retword = i2c_read(gspca_dev, 0x03);
6118 if (retword != 0) {
6119 send_unknown(gspca_dev, SENSOR_PAS202B);
6120 return 0x0e; /* PAS202BCB */
6121 }
6122
6123 start_2wr_probe(gspca_dev, 0x02); /* TAS5130C */
6124 i2c_write(gspca_dev, 0x01, 0xaa, 0x00);
6125 retword = i2c_read(gspca_dev, 0x01);
6126 if (retword != 0)
6127 return 0x02; /* TAS5130C */
6128 ov_check:
6129 reg_r(gspca_dev, 0x0010); /* ?? */
6130 reg_r(gspca_dev, 0x0010);
6131
6132 reg_w(gspca_dev, 0x01, 0x0000);
6133 reg_w(gspca_dev, 0x01, 0x0001);
6134 reg_w(gspca_dev, 0x06, 0x0010); /* OmniVision */
6135 reg_w(gspca_dev, 0xa1, 0x008b);
6136 reg_w(gspca_dev, 0x08, 0x008d);
6137 msleep(500);
6138 reg_w(gspca_dev, 0x01, 0x0012);
6139 i2c_write(gspca_dev, 0x12, 0x80, 0x00); /* sensor reset */
6140 retword = i2c_read(gspca_dev, 0x0a) << 8;
6141 retword |= i2c_read(gspca_dev, 0x0b);
6142 gspca_dbg(gspca_dev, D_PROBE, "probe 2wr ov vga 0x%04x\n", retword);
6143 switch (retword) {
6144 case 0x7631: /* OV7630C */
6145 reg_w(gspca_dev, 0x06, 0x0010);
6146 break;
6147 case 0x7620: /* OV7620 */
6148 case 0x7648: /* OV7648 */
6149 break;
6150 default:
6151 return -1; /* not OmniVision */
6152 }
6153 return retword;
6154 }
6155
6156 struct sensor_by_chipset_revision {
6157 u16 revision;
6158 u8 internal_sensor_id;
6159 };
6160 static const struct sensor_by_chipset_revision chipset_revision_sensor[] = {
6161 {0xc000, 0x12}, /* TAS5130C */
6162 {0xc001, 0x13}, /* MT9V111 */
6163 {0xe001, 0x13},
6164 {0x8001, 0x13},
6165 {0x8000, 0x14}, /* CS2102K */
6166 {0x8400, 0x15}, /* MT9V111 */
6167 {0xe400, 0x15},
6168 };
6169
vga_3wr_probe(struct gspca_dev * gspca_dev)6170 static int vga_3wr_probe(struct gspca_dev *gspca_dev)
6171 {
6172 struct sd *sd = (struct sd *) gspca_dev;
6173 int i;
6174 u16 retword;
6175
6176 /*fixme: lack of 8b=b3 (11,12)-> 10, 8b=e0 (14,15,16)-> 12 found in gspcav1*/
6177 reg_w(gspca_dev, 0x02, 0x0010);
6178 reg_r(gspca_dev, 0x0010);
6179 reg_w(gspca_dev, 0x01, 0x0000);
6180 reg_w(gspca_dev, 0x00, 0x0010);
6181 reg_w(gspca_dev, 0x01, 0x0001);
6182 reg_w(gspca_dev, 0x91, 0x008b);
6183 reg_w(gspca_dev, 0x03, 0x0012);
6184 reg_w(gspca_dev, 0x01, 0x0012);
6185 reg_w(gspca_dev, 0x05, 0x0012);
6186 retword = i2c_read(gspca_dev, 0x14);
6187 if (retword != 0)
6188 return 0x11; /* HV7131R */
6189 retword = i2c_read(gspca_dev, 0x15);
6190 if (retword != 0)
6191 return 0x11; /* HV7131R */
6192 retword = i2c_read(gspca_dev, 0x16);
6193 if (retword != 0)
6194 return 0x11; /* HV7131R */
6195
6196 reg_w(gspca_dev, 0x02, 0x0010);
6197 retword = reg_r(gspca_dev, 0x000b) << 8;
6198 retword |= reg_r(gspca_dev, 0x000a);
6199 gspca_dbg(gspca_dev, D_PROBE, "probe 3wr vga 1 0x%04x\n", retword);
6200 reg_r(gspca_dev, 0x0010);
6201 if ((retword & 0xff00) == 0x6400)
6202 return 0x02; /* TAS5130C */
6203 for (i = 0; i < ARRAY_SIZE(chipset_revision_sensor); i++) {
6204 if (chipset_revision_sensor[i].revision == retword) {
6205 sd->chip_revision = retword;
6206 send_unknown(gspca_dev, SENSOR_PB0330);
6207 return chipset_revision_sensor[i].internal_sensor_id;
6208 }
6209 }
6210
6211 reg_w(gspca_dev, 0x01, 0x0000); /* check PB0330 */
6212 reg_w(gspca_dev, 0x01, 0x0001);
6213 reg_w(gspca_dev, 0xdd, 0x008b);
6214 reg_w(gspca_dev, 0x0a, 0x0010);
6215 reg_w(gspca_dev, 0x03, 0x0012);
6216 reg_w(gspca_dev, 0x01, 0x0012);
6217 retword = i2c_read(gspca_dev, 0x00);
6218 if (retword != 0) {
6219 gspca_dbg(gspca_dev, D_PROBE, "probe 3wr vga type 0a\n");
6220 return 0x0a; /* PB0330 */
6221 }
6222
6223 /* probe gc0303 / gc0305 */
6224 reg_w(gspca_dev, 0x01, 0x0000);
6225 reg_w(gspca_dev, 0x01, 0x0001);
6226 reg_w(gspca_dev, 0x98, 0x008b);
6227 reg_w(gspca_dev, 0x01, 0x0010);
6228 reg_w(gspca_dev, 0x03, 0x0012);
6229 msleep(2);
6230 reg_w(gspca_dev, 0x01, 0x0012);
6231 retword = i2c_read(gspca_dev, 0x00);
6232 if (retword != 0) {
6233 gspca_dbg(gspca_dev, D_PROBE, "probe 3wr vga type %02x\n",
6234 retword);
6235 if (retword == 0x0011) /* gc0303 */
6236 return 0x0303;
6237 if (retword == 0x0029) /* gc0305 */
6238 send_unknown(gspca_dev, SENSOR_GC0305);
6239 return retword;
6240 }
6241
6242 reg_w(gspca_dev, 0x01, 0x0000); /* check OmniVision */
6243 reg_w(gspca_dev, 0x01, 0x0001);
6244 reg_w(gspca_dev, 0xa1, 0x008b);
6245 reg_w(gspca_dev, 0x08, 0x008d);
6246 reg_w(gspca_dev, 0x06, 0x0010);
6247 reg_w(gspca_dev, 0x01, 0x0012);
6248 reg_w(gspca_dev, 0x05, 0x0012);
6249 if (i2c_read(gspca_dev, 0x1c) == 0x007f /* OV7610 - manufacturer ID */
6250 && i2c_read(gspca_dev, 0x1d) == 0x00a2) {
6251 send_unknown(gspca_dev, SENSOR_OV7620);
6252 return 0x06; /* OmniVision confirm ? */
6253 }
6254
6255 reg_w(gspca_dev, 0x01, 0x0000);
6256 reg_w(gspca_dev, 0x00, 0x0002);
6257 reg_w(gspca_dev, 0x01, 0x0010);
6258 reg_w(gspca_dev, 0x01, 0x0001);
6259 reg_w(gspca_dev, 0xee, 0x008b);
6260 reg_w(gspca_dev, 0x03, 0x0012);
6261 reg_w(gspca_dev, 0x01, 0x0012);
6262 reg_w(gspca_dev, 0x05, 0x0012);
6263 retword = i2c_read(gspca_dev, 0x00) << 8; /* ID 0 */
6264 retword |= i2c_read(gspca_dev, 0x01); /* ID 1 */
6265 gspca_dbg(gspca_dev, D_PROBE, "probe 3wr vga 2 0x%04x\n", retword);
6266 if (retword == 0x2030) {
6267 u8 retbyte;
6268
6269 retbyte = i2c_read(gspca_dev, 0x02); /* revision number */
6270 gspca_dbg(gspca_dev, D_PROBE, "sensor PO2030 rev 0x%02x\n",
6271 retbyte);
6272
6273 send_unknown(gspca_dev, SENSOR_PO2030);
6274 return retword;
6275 }
6276
6277 reg_w(gspca_dev, 0x01, 0x0000);
6278 reg_w(gspca_dev, 0x0a, 0x0010);
6279 reg_w(gspca_dev, 0xd3, 0x008b);
6280 reg_w(gspca_dev, 0x01, 0x0001);
6281 reg_w(gspca_dev, 0x03, 0x0012);
6282 reg_w(gspca_dev, 0x01, 0x0012);
6283 reg_w(gspca_dev, 0x05, 0x0012);
6284 reg_w(gspca_dev, 0xd3, 0x008b);
6285 retword = i2c_read(gspca_dev, 0x01);
6286 if (retword != 0) {
6287 gspca_dbg(gspca_dev, D_PROBE, "probe 3wr vga type 0a ? ret: %04x\n",
6288 retword);
6289 return 0x16; /* adcm2700 (6100/6200) */
6290 }
6291 return -1;
6292 }
6293
zcxx_probeSensor(struct gspca_dev * gspca_dev)6294 static int zcxx_probeSensor(struct gspca_dev *gspca_dev)
6295 {
6296 struct sd *sd = (struct sd *) gspca_dev;
6297 int sensor;
6298
6299 switch (sd->sensor) {
6300 case SENSOR_MC501CB:
6301 return -1; /* don't probe */
6302 case SENSOR_GC0303:
6303 /* may probe but with no write in reg 0x0010 */
6304 return -1; /* don't probe */
6305 case SENSOR_PAS106:
6306 sensor = sif_probe(gspca_dev);
6307 if (sensor >= 0)
6308 return sensor;
6309 break;
6310 }
6311 sensor = vga_2wr_probe(gspca_dev);
6312 if (sensor >= 0)
6313 return sensor;
6314 return vga_3wr_probe(gspca_dev);
6315 }
6316
6317 /* this function is called at probe time */
sd_config(struct gspca_dev * gspca_dev,const struct usb_device_id * id)6318 static int sd_config(struct gspca_dev *gspca_dev,
6319 const struct usb_device_id *id)
6320 {
6321 struct sd *sd = (struct sd *) gspca_dev;
6322
6323 if (id->idProduct == 0x301b)
6324 sd->bridge = BRIDGE_ZC301;
6325 else
6326 sd->bridge = BRIDGE_ZC303;
6327
6328 /* define some sensors from the vendor/product */
6329 sd->sensor = id->driver_info;
6330
6331 sd->reg08 = REG08_DEF;
6332
6333 INIT_WORK(&sd->work, transfer_update);
6334
6335 return 0;
6336 }
6337
zcxx_g_volatile_ctrl(struct v4l2_ctrl * ctrl)6338 static int zcxx_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
6339 {
6340 struct gspca_dev *gspca_dev =
6341 container_of(ctrl->handler, struct gspca_dev, ctrl_handler);
6342 struct sd *sd = (struct sd *)gspca_dev;
6343
6344 switch (ctrl->id) {
6345 case V4L2_CID_AUTOGAIN:
6346 gspca_dev->usb_err = 0;
6347 if (ctrl->val && sd->exposure && gspca_dev->streaming)
6348 sd->exposure->val = getexposure(gspca_dev);
6349 return gspca_dev->usb_err;
6350 }
6351 return -EINVAL;
6352 }
6353
zcxx_s_ctrl(struct v4l2_ctrl * ctrl)6354 static int zcxx_s_ctrl(struct v4l2_ctrl *ctrl)
6355 {
6356 struct gspca_dev *gspca_dev =
6357 container_of(ctrl->handler, struct gspca_dev, ctrl_handler);
6358 struct sd *sd = (struct sd *)gspca_dev;
6359 int i, qual;
6360
6361 gspca_dev->usb_err = 0;
6362
6363 if (ctrl->id == V4L2_CID_JPEG_COMPRESSION_QUALITY) {
6364 qual = sd->reg08 >> 1;
6365
6366 for (i = 0; i < ARRAY_SIZE(jpeg_qual); i++) {
6367 if (ctrl->val <= jpeg_qual[i])
6368 break;
6369 }
6370 if (i == ARRAY_SIZE(jpeg_qual) || (i > 0 && i == qual && ctrl->val < jpeg_qual[i]))
6371 i--;
6372
6373 /* With high quality settings we need max bandwidth */
6374 if (i >= 2 && gspca_dev->streaming &&
6375 !gspca_dev->cam.needs_full_bandwidth)
6376 return -EBUSY;
6377
6378 sd->reg08 = (i << 1) | 1;
6379 ctrl->val = jpeg_qual[i];
6380 }
6381
6382 if (!gspca_dev->streaming)
6383 return 0;
6384
6385 switch (ctrl->id) {
6386 /* gamma/brightness/contrast cluster */
6387 case V4L2_CID_GAMMA:
6388 setcontrast(gspca_dev, sd->gamma->val,
6389 sd->brightness->val, sd->contrast->val);
6390 break;
6391 /* autogain/exposure cluster */
6392 case V4L2_CID_AUTOGAIN:
6393 setautogain(gspca_dev, ctrl->val);
6394 if (!gspca_dev->usb_err && !ctrl->val && sd->exposure)
6395 setexposure(gspca_dev, sd->exposure->val);
6396 break;
6397 case V4L2_CID_POWER_LINE_FREQUENCY:
6398 setlightfreq(gspca_dev, ctrl->val);
6399 break;
6400 case V4L2_CID_SHARPNESS:
6401 setsharpness(gspca_dev, ctrl->val);
6402 break;
6403 case V4L2_CID_JPEG_COMPRESSION_QUALITY:
6404 setquality(gspca_dev);
6405 break;
6406 }
6407 return gspca_dev->usb_err;
6408 }
6409
6410 static const struct v4l2_ctrl_ops zcxx_ctrl_ops = {
6411 .g_volatile_ctrl = zcxx_g_volatile_ctrl,
6412 .s_ctrl = zcxx_s_ctrl,
6413 };
6414
sd_init_controls(struct gspca_dev * gspca_dev)6415 static int sd_init_controls(struct gspca_dev *gspca_dev)
6416 {
6417 struct sd *sd = (struct sd *)gspca_dev;
6418 struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler;
6419 static const u8 gamma[SENSOR_MAX] = {
6420 [SENSOR_ADCM2700] = 4,
6421 [SENSOR_CS2102] = 4,
6422 [SENSOR_CS2102K] = 5,
6423 [SENSOR_GC0303] = 3,
6424 [SENSOR_GC0305] = 4,
6425 [SENSOR_HDCS2020] = 4,
6426 [SENSOR_HV7131B] = 4,
6427 [SENSOR_HV7131R] = 4,
6428 [SENSOR_ICM105A] = 4,
6429 [SENSOR_MC501CB] = 4,
6430 [SENSOR_MT9V111_1] = 4,
6431 [SENSOR_MT9V111_3] = 4,
6432 [SENSOR_OV7620] = 3,
6433 [SENSOR_OV7630C] = 4,
6434 [SENSOR_PAS106] = 4,
6435 [SENSOR_PAS202B] = 4,
6436 [SENSOR_PB0330] = 4,
6437 [SENSOR_PO2030] = 4,
6438 [SENSOR_TAS5130C] = 3,
6439 };
6440
6441 gspca_dev->vdev.ctrl_handler = hdl;
6442 v4l2_ctrl_handler_init(hdl, 8);
6443 sd->brightness = v4l2_ctrl_new_std(hdl, &zcxx_ctrl_ops,
6444 V4L2_CID_BRIGHTNESS, 0, 255, 1, 128);
6445 sd->contrast = v4l2_ctrl_new_std(hdl, &zcxx_ctrl_ops,
6446 V4L2_CID_CONTRAST, 0, 255, 1, 128);
6447 sd->gamma = v4l2_ctrl_new_std(hdl, &zcxx_ctrl_ops,
6448 V4L2_CID_GAMMA, 1, 6, 1, gamma[sd->sensor]);
6449 if (sd->sensor == SENSOR_HV7131R)
6450 sd->exposure = v4l2_ctrl_new_std(hdl, &zcxx_ctrl_ops,
6451 V4L2_CID_EXPOSURE, 0x30d, 0x493e, 1, 0x927);
6452 else if (sd->sensor == SENSOR_OV7620)
6453 sd->exposure = v4l2_ctrl_new_std(hdl, &zcxx_ctrl_ops,
6454 V4L2_CID_EXPOSURE, 0, 255, 1, 0x41);
6455 sd->autogain = v4l2_ctrl_new_std(hdl, &zcxx_ctrl_ops,
6456 V4L2_CID_AUTOGAIN, 0, 1, 1, 1);
6457 if (sd->sensor != SENSOR_OV7630C)
6458 sd->plfreq = v4l2_ctrl_new_std_menu(hdl, &zcxx_ctrl_ops,
6459 V4L2_CID_POWER_LINE_FREQUENCY,
6460 V4L2_CID_POWER_LINE_FREQUENCY_60HZ, 0,
6461 V4L2_CID_POWER_LINE_FREQUENCY_DISABLED);
6462 sd->sharpness = v4l2_ctrl_new_std(hdl, &zcxx_ctrl_ops,
6463 V4L2_CID_SHARPNESS, 0, 3, 1,
6464 sd->sensor == SENSOR_PO2030 ? 0 : 2);
6465 sd->jpegqual = v4l2_ctrl_new_std(hdl, &zcxx_ctrl_ops,
6466 V4L2_CID_JPEG_COMPRESSION_QUALITY,
6467 jpeg_qual[0], jpeg_qual[ARRAY_SIZE(jpeg_qual) - 1], 1,
6468 jpeg_qual[REG08_DEF >> 1]);
6469 if (hdl->error) {
6470 pr_err("Could not initialize controls\n");
6471 return hdl->error;
6472 }
6473 v4l2_ctrl_cluster(3, &sd->gamma);
6474 if (sd->sensor == SENSOR_HV7131R || sd->sensor == SENSOR_OV7620)
6475 v4l2_ctrl_auto_cluster(2, &sd->autogain, 0, true);
6476 return 0;
6477 }
6478
6479 /* this function is called at probe and resume time */
sd_init(struct gspca_dev * gspca_dev)6480 static int sd_init(struct gspca_dev *gspca_dev)
6481 {
6482 struct sd *sd = (struct sd *) gspca_dev;
6483 struct cam *cam;
6484 int sensor;
6485 static const u8 mode_tb[SENSOR_MAX] = {
6486 [SENSOR_ADCM2700] = 2,
6487 [SENSOR_CS2102] = 1,
6488 [SENSOR_CS2102K] = 1,
6489 [SENSOR_GC0303] = 1,
6490 [SENSOR_GC0305] = 1,
6491 [SENSOR_HDCS2020] = 1,
6492 [SENSOR_HV7131B] = 1,
6493 [SENSOR_HV7131R] = 1,
6494 [SENSOR_ICM105A] = 1,
6495 [SENSOR_MC501CB] = 2,
6496 [SENSOR_MT9V111_1] = 1,
6497 [SENSOR_MT9V111_3] = 1,
6498 [SENSOR_OV7620] = 2,
6499 [SENSOR_OV7630C] = 1,
6500 [SENSOR_PAS106] = 0,
6501 [SENSOR_PAS202B] = 1,
6502 [SENSOR_PB0330] = 1,
6503 [SENSOR_PO2030] = 1,
6504 [SENSOR_TAS5130C] = 1,
6505 };
6506
6507 sensor = zcxx_probeSensor(gspca_dev);
6508 if (sensor >= 0)
6509 gspca_dbg(gspca_dev, D_PROBE, "probe sensor -> %04x\n", sensor);
6510 if ((unsigned) force_sensor < SENSOR_MAX) {
6511 sd->sensor = force_sensor;
6512 gspca_dbg(gspca_dev, D_PROBE, "sensor forced to %d\n",
6513 force_sensor);
6514 } else {
6515 switch (sensor) {
6516 case -1:
6517 switch (sd->sensor) {
6518 case SENSOR_MC501CB:
6519 gspca_dbg(gspca_dev, D_PROBE, "Sensor MC501CB\n");
6520 break;
6521 case SENSOR_GC0303:
6522 gspca_dbg(gspca_dev, D_PROBE, "Sensor GC0303\n");
6523 break;
6524 default:
6525 pr_warn("Unknown sensor - set to TAS5130C\n");
6526 sd->sensor = SENSOR_TAS5130C;
6527 }
6528 break;
6529 case 0:
6530 /* check the sensor type */
6531 sensor = i2c_read(gspca_dev, 0x00);
6532 gspca_dbg(gspca_dev, D_PROBE, "Sensor hv7131 type %d\n",
6533 sensor);
6534 switch (sensor) {
6535 case 0: /* hv7131b */
6536 case 1: /* hv7131e */
6537 gspca_dbg(gspca_dev, D_PROBE, "Find Sensor HV7131B\n");
6538 sd->sensor = SENSOR_HV7131B;
6539 break;
6540 default:
6541 /* case 2: * hv7131r */
6542 gspca_dbg(gspca_dev, D_PROBE, "Find Sensor HV7131R\n");
6543 sd->sensor = SENSOR_HV7131R;
6544 break;
6545 }
6546 break;
6547 case 0x02:
6548 gspca_dbg(gspca_dev, D_PROBE, "Sensor TAS5130C\n");
6549 sd->sensor = SENSOR_TAS5130C;
6550 break;
6551 case 0x04:
6552 gspca_dbg(gspca_dev, D_PROBE, "Find Sensor CS2102\n");
6553 sd->sensor = SENSOR_CS2102;
6554 break;
6555 case 0x08:
6556 gspca_dbg(gspca_dev, D_PROBE, "Find Sensor HDCS2020\n");
6557 sd->sensor = SENSOR_HDCS2020;
6558 break;
6559 case 0x0a:
6560 gspca_dbg(gspca_dev, D_PROBE,
6561 "Find Sensor PB0330. Chip revision %x\n",
6562 sd->chip_revision);
6563 sd->sensor = SENSOR_PB0330;
6564 break;
6565 case 0x0c:
6566 gspca_dbg(gspca_dev, D_PROBE, "Find Sensor ICM105A\n");
6567 sd->sensor = SENSOR_ICM105A;
6568 break;
6569 case 0x0e:
6570 gspca_dbg(gspca_dev, D_PROBE, "Find Sensor PAS202B\n");
6571 sd->sensor = SENSOR_PAS202B;
6572 break;
6573 case 0x0f:
6574 gspca_dbg(gspca_dev, D_PROBE, "Find Sensor PAS106\n");
6575 sd->sensor = SENSOR_PAS106;
6576 break;
6577 case 0x10:
6578 case 0x12:
6579 gspca_dbg(gspca_dev, D_PROBE, "Find Sensor TAS5130C\n");
6580 sd->sensor = SENSOR_TAS5130C;
6581 break;
6582 case 0x11:
6583 gspca_dbg(gspca_dev, D_PROBE, "Find Sensor HV7131R\n");
6584 sd->sensor = SENSOR_HV7131R;
6585 break;
6586 case 0x13:
6587 case 0x15:
6588 gspca_dbg(gspca_dev, D_PROBE,
6589 "Sensor MT9V111. Chip revision %04x\n",
6590 sd->chip_revision);
6591 sd->sensor = sd->bridge == BRIDGE_ZC301
6592 ? SENSOR_MT9V111_1
6593 : SENSOR_MT9V111_3;
6594 break;
6595 case 0x14:
6596 gspca_dbg(gspca_dev, D_PROBE,
6597 "Find Sensor CS2102K?. Chip revision %x\n",
6598 sd->chip_revision);
6599 sd->sensor = SENSOR_CS2102K;
6600 break;
6601 case 0x16:
6602 gspca_dbg(gspca_dev, D_PROBE, "Find Sensor ADCM2700\n");
6603 sd->sensor = SENSOR_ADCM2700;
6604 break;
6605 case 0x29:
6606 gspca_dbg(gspca_dev, D_PROBE, "Find Sensor GC0305\n");
6607 sd->sensor = SENSOR_GC0305;
6608 break;
6609 case 0x0303:
6610 gspca_dbg(gspca_dev, D_PROBE, "Sensor GC0303\n");
6611 sd->sensor = SENSOR_GC0303;
6612 break;
6613 case 0x2030:
6614 gspca_dbg(gspca_dev, D_PROBE, "Find Sensor PO2030\n");
6615 sd->sensor = SENSOR_PO2030;
6616 break;
6617 case 0x7620:
6618 gspca_dbg(gspca_dev, D_PROBE, "Find Sensor OV7620\n");
6619 sd->sensor = SENSOR_OV7620;
6620 break;
6621 case 0x7631:
6622 gspca_dbg(gspca_dev, D_PROBE, "Find Sensor OV7630C\n");
6623 sd->sensor = SENSOR_OV7630C;
6624 break;
6625 case 0x7648:
6626 gspca_dbg(gspca_dev, D_PROBE, "Find Sensor OV7648\n");
6627 sd->sensor = SENSOR_OV7620; /* same sensor (?) */
6628 break;
6629 default:
6630 pr_err("Unknown sensor %04x\n", sensor);
6631 return -EINVAL;
6632 }
6633 }
6634 if (sensor < 0x20) {
6635 if (sensor == -1 || sensor == 0x10 || sensor == 0x12)
6636 reg_w(gspca_dev, 0x02, 0x0010);
6637 reg_r(gspca_dev, 0x0010);
6638 }
6639
6640 cam = &gspca_dev->cam;
6641 switch (mode_tb[sd->sensor]) {
6642 case 0:
6643 cam->cam_mode = sif_mode;
6644 cam->nmodes = ARRAY_SIZE(sif_mode);
6645 break;
6646 case 1:
6647 cam->cam_mode = vga_mode;
6648 cam->nmodes = ARRAY_SIZE(vga_mode);
6649 break;
6650 default:
6651 /* case 2: */
6652 cam->cam_mode = broken_vga_mode;
6653 cam->nmodes = ARRAY_SIZE(broken_vga_mode);
6654 break;
6655 }
6656
6657 /* switch off the led */
6658 reg_w(gspca_dev, 0x01, 0x0000);
6659 return gspca_dev->usb_err;
6660 }
6661
sd_pre_start(struct gspca_dev * gspca_dev)6662 static int sd_pre_start(struct gspca_dev *gspca_dev)
6663 {
6664 struct sd *sd = (struct sd *) gspca_dev;
6665 gspca_dev->cam.needs_full_bandwidth = (sd->reg08 >= 4) ? 1 : 0;
6666 return 0;
6667 }
6668
sd_start(struct gspca_dev * gspca_dev)6669 static int sd_start(struct gspca_dev *gspca_dev)
6670 {
6671 struct sd *sd = (struct sd *) gspca_dev;
6672 int mode;
6673 static const struct usb_action *init_tb[SENSOR_MAX][2] = {
6674 [SENSOR_ADCM2700] =
6675 {adcm2700_Initial, adcm2700_InitialScale},
6676 [SENSOR_CS2102] =
6677 {cs2102_Initial, cs2102_InitialScale},
6678 [SENSOR_CS2102K] =
6679 {cs2102K_Initial, cs2102K_InitialScale},
6680 [SENSOR_GC0303] =
6681 {gc0303_Initial, gc0303_InitialScale},
6682 [SENSOR_GC0305] =
6683 {gc0305_Initial, gc0305_InitialScale},
6684 [SENSOR_HDCS2020] =
6685 {hdcs2020_Initial, hdcs2020_InitialScale},
6686 [SENSOR_HV7131B] =
6687 {hv7131b_Initial, hv7131b_InitialScale},
6688 [SENSOR_HV7131R] =
6689 {hv7131r_Initial, hv7131r_InitialScale},
6690 [SENSOR_ICM105A] =
6691 {icm105a_Initial, icm105a_InitialScale},
6692 [SENSOR_MC501CB] =
6693 {mc501cb_Initial, mc501cb_InitialScale},
6694 [SENSOR_MT9V111_1] =
6695 {mt9v111_1_Initial, mt9v111_1_InitialScale},
6696 [SENSOR_MT9V111_3] =
6697 {mt9v111_3_Initial, mt9v111_3_InitialScale},
6698 [SENSOR_OV7620] =
6699 {ov7620_Initial, ov7620_InitialScale},
6700 [SENSOR_OV7630C] =
6701 {ov7630c_Initial, ov7630c_InitialScale},
6702 [SENSOR_PAS106] =
6703 {pas106b_Initial, pas106b_InitialScale},
6704 [SENSOR_PAS202B] =
6705 {pas202b_Initial, pas202b_InitialScale},
6706 [SENSOR_PB0330] =
6707 {pb0330_Initial, pb0330_InitialScale},
6708 [SENSOR_PO2030] =
6709 {po2030_Initial, po2030_InitialScale},
6710 [SENSOR_TAS5130C] =
6711 {tas5130c_Initial, tas5130c_InitialScale},
6712 };
6713
6714 /* create the JPEG header */
6715 jpeg_define(sd->jpeg_hdr, gspca_dev->pixfmt.height,
6716 gspca_dev->pixfmt.width,
6717 0x21); /* JPEG 422 */
6718
6719 mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv;
6720 switch (sd->sensor) {
6721 case SENSOR_HV7131R:
6722 zcxx_probeSensor(gspca_dev);
6723 break;
6724 case SENSOR_PAS106:
6725 usb_exchange(gspca_dev, pas106b_Initial_com);
6726 break;
6727 }
6728 usb_exchange(gspca_dev, init_tb[sd->sensor][mode]);
6729
6730 switch (sd->sensor) {
6731 case SENSOR_ADCM2700:
6732 case SENSOR_GC0305:
6733 case SENSOR_OV7620:
6734 case SENSOR_PO2030:
6735 case SENSOR_TAS5130C:
6736 case SENSOR_GC0303:
6737 /* msleep(100); * ?? */
6738 reg_r(gspca_dev, 0x0002); /* --> 0x40 */
6739 reg_w(gspca_dev, 0x09, 0x01ad); /* (from win traces) */
6740 reg_w(gspca_dev, 0x15, 0x01ae);
6741 if (sd->sensor == SENSOR_TAS5130C)
6742 break;
6743 reg_w(gspca_dev, 0x0d, 0x003a);
6744 reg_w(gspca_dev, 0x02, 0x003b);
6745 reg_w(gspca_dev, 0x00, 0x0038);
6746 break;
6747 case SENSOR_HV7131R:
6748 case SENSOR_PAS202B:
6749 reg_w(gspca_dev, 0x03, 0x003b);
6750 reg_w(gspca_dev, 0x0c, 0x003a);
6751 reg_w(gspca_dev, 0x0b, 0x0039);
6752 if (sd->sensor == SENSOR_HV7131R)
6753 reg_w(gspca_dev, 0x50, ZC3XX_R11D_GLOBALGAIN);
6754 break;
6755 }
6756
6757 setmatrix(gspca_dev);
6758 switch (sd->sensor) {
6759 case SENSOR_ADCM2700:
6760 case SENSOR_OV7620:
6761 reg_r(gspca_dev, 0x0008);
6762 reg_w(gspca_dev, 0x00, 0x0008);
6763 break;
6764 case SENSOR_PAS202B:
6765 case SENSOR_GC0305:
6766 case SENSOR_HV7131R:
6767 case SENSOR_TAS5130C:
6768 reg_r(gspca_dev, 0x0008);
6769 fallthrough;
6770 case SENSOR_PO2030:
6771 reg_w(gspca_dev, 0x03, 0x0008);
6772 break;
6773 }
6774 setsharpness(gspca_dev, v4l2_ctrl_g_ctrl(sd->sharpness));
6775
6776 /* set the gamma tables when not set */
6777 switch (sd->sensor) {
6778 case SENSOR_CS2102K: /* gamma set in xxx_Initial */
6779 case SENSOR_HDCS2020:
6780 case SENSOR_OV7630C:
6781 break;
6782 default:
6783 setcontrast(gspca_dev, v4l2_ctrl_g_ctrl(sd->gamma),
6784 v4l2_ctrl_g_ctrl(sd->brightness),
6785 v4l2_ctrl_g_ctrl(sd->contrast));
6786 break;
6787 }
6788 setmatrix(gspca_dev); /* one more time? */
6789 switch (sd->sensor) {
6790 case SENSOR_OV7620:
6791 case SENSOR_PAS202B:
6792 reg_r(gspca_dev, 0x0180); /* from win */
6793 reg_w(gspca_dev, 0x00, 0x0180);
6794 break;
6795 }
6796 setquality(gspca_dev);
6797 /* Start with BRC disabled, transfer_update will enable it if needed */
6798 reg_w(gspca_dev, 0x00, 0x0007);
6799 if (sd->plfreq)
6800 setlightfreq(gspca_dev, v4l2_ctrl_g_ctrl(sd->plfreq));
6801
6802 switch (sd->sensor) {
6803 case SENSOR_ADCM2700:
6804 reg_w(gspca_dev, 0x09, 0x01ad); /* (from win traces) */
6805 reg_w(gspca_dev, 0x15, 0x01ae);
6806 reg_w(gspca_dev, 0x02, 0x0180);
6807 /* ms-win + */
6808 reg_w(gspca_dev, 0x40, 0x0117);
6809 break;
6810 case SENSOR_HV7131R:
6811 setexposure(gspca_dev, v4l2_ctrl_g_ctrl(sd->exposure));
6812 reg_w(gspca_dev, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN);
6813 break;
6814 case SENSOR_GC0305:
6815 case SENSOR_TAS5130C:
6816 reg_w(gspca_dev, 0x09, 0x01ad); /* (from win traces) */
6817 reg_w(gspca_dev, 0x15, 0x01ae);
6818 fallthrough;
6819 case SENSOR_PAS202B:
6820 case SENSOR_PO2030:
6821 /* reg_w(gspca_dev, 0x40, ZC3XX_R117_GGAIN); in win traces */
6822 reg_r(gspca_dev, 0x0180);
6823 break;
6824 case SENSOR_OV7620:
6825 reg_w(gspca_dev, 0x09, 0x01ad);
6826 reg_w(gspca_dev, 0x15, 0x01ae);
6827 i2c_read(gspca_dev, 0x13); /*fixme: returns 0xa3 */
6828 i2c_write(gspca_dev, 0x13, 0xa3, 0x00);
6829 /*fixme: returned value to send? */
6830 reg_w(gspca_dev, 0x40, 0x0117);
6831 reg_r(gspca_dev, 0x0180);
6832 break;
6833 }
6834
6835 setautogain(gspca_dev, v4l2_ctrl_g_ctrl(sd->autogain));
6836
6837 if (gspca_dev->usb_err < 0)
6838 return gspca_dev->usb_err;
6839
6840 /* Start the transfer parameters update thread */
6841 schedule_work(&sd->work);
6842
6843 return 0;
6844 }
6845
6846 /* called on streamoff with alt==0 and on disconnect */
6847 /* the usb_lock is held at entry - restore on exit */
sd_stop0(struct gspca_dev * gspca_dev)6848 static void sd_stop0(struct gspca_dev *gspca_dev)
6849 {
6850 struct sd *sd = (struct sd *) gspca_dev;
6851
6852 mutex_unlock(&gspca_dev->usb_lock);
6853 flush_work(&sd->work);
6854 mutex_lock(&gspca_dev->usb_lock);
6855 if (!gspca_dev->present)
6856 return;
6857 send_unknown(gspca_dev, sd->sensor);
6858 }
6859
sd_pkt_scan(struct gspca_dev * gspca_dev,u8 * data,int len)6860 static void sd_pkt_scan(struct gspca_dev *gspca_dev,
6861 u8 *data,
6862 int len)
6863 {
6864 struct sd *sd = (struct sd *) gspca_dev;
6865
6866 /* check the JPEG end of frame */
6867 if (len >= 3
6868 && data[len - 3] == 0xff && data[len - 2] == 0xd9) {
6869 /*fixme: what does the last byte mean?*/
6870 gspca_frame_add(gspca_dev, LAST_PACKET,
6871 data, len - 1);
6872 return;
6873 }
6874
6875 /* check the JPEG start of a frame */
6876 if (data[0] == 0xff && data[1] == 0xd8) {
6877 /* put the JPEG header in the new frame */
6878 gspca_frame_add(gspca_dev, FIRST_PACKET,
6879 sd->jpeg_hdr, JPEG_HDR_SZ);
6880
6881 /* remove the webcam's header:
6882 * ff d8 ff fe 00 0e 00 00 ss ss 00 01 ww ww hh hh pp pp
6883 * - 'ss ss' is the frame sequence number (BE)
6884 * - 'ww ww' and 'hh hh' are the window dimensions (BE)
6885 * - 'pp pp' is the packet sequence number (BE)
6886 */
6887 data += 18;
6888 len -= 18;
6889 }
6890 gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
6891 }
6892
sd_set_jcomp(struct gspca_dev * gspca_dev,const struct v4l2_jpegcompression * jcomp)6893 static int sd_set_jcomp(struct gspca_dev *gspca_dev,
6894 const struct v4l2_jpegcompression *jcomp)
6895 {
6896 struct sd *sd = (struct sd *) gspca_dev;
6897
6898 return v4l2_ctrl_s_ctrl(sd->jpegqual, jcomp->quality);
6899 }
6900
sd_get_jcomp(struct gspca_dev * gspca_dev,struct v4l2_jpegcompression * jcomp)6901 static int sd_get_jcomp(struct gspca_dev *gspca_dev,
6902 struct v4l2_jpegcompression *jcomp)
6903 {
6904 struct sd *sd = (struct sd *) gspca_dev;
6905
6906 memset(jcomp, 0, sizeof *jcomp);
6907 jcomp->quality = v4l2_ctrl_g_ctrl(sd->jpegqual);
6908 jcomp->jpeg_markers = V4L2_JPEG_MARKER_DHT
6909 | V4L2_JPEG_MARKER_DQT;
6910 return 0;
6911 }
6912
6913 #if IS_ENABLED(CONFIG_INPUT)
sd_int_pkt_scan(struct gspca_dev * gspca_dev,u8 * data,int len)6914 static int sd_int_pkt_scan(struct gspca_dev *gspca_dev,
6915 u8 *data, /* interrupt packet data */
6916 int len) /* interrupt packet length */
6917 {
6918 if (len == 8 && data[4] == 1) {
6919 input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1);
6920 input_sync(gspca_dev->input_dev);
6921 input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0);
6922 input_sync(gspca_dev->input_dev);
6923 }
6924
6925 return 0;
6926 }
6927 #endif
6928
6929 static const struct sd_desc sd_desc = {
6930 .name = KBUILD_MODNAME,
6931 .config = sd_config,
6932 .init = sd_init,
6933 .init_controls = sd_init_controls,
6934 .isoc_init = sd_pre_start,
6935 .start = sd_start,
6936 .stop0 = sd_stop0,
6937 .pkt_scan = sd_pkt_scan,
6938 .get_jcomp = sd_get_jcomp,
6939 .set_jcomp = sd_set_jcomp,
6940 #if IS_ENABLED(CONFIG_INPUT)
6941 .int_pkt_scan = sd_int_pkt_scan,
6942 #endif
6943 };
6944
6945 static const struct usb_device_id device_table[] = {
6946 {USB_DEVICE(0x03f0, 0x1b07)},
6947 {USB_DEVICE(0x041e, 0x041e)},
6948 {USB_DEVICE(0x041e, 0x4017)},
6949 {USB_DEVICE(0x041e, 0x401c), .driver_info = SENSOR_PAS106},
6950 {USB_DEVICE(0x041e, 0x401e)},
6951 {USB_DEVICE(0x041e, 0x401f)},
6952 {USB_DEVICE(0x041e, 0x4022)},
6953 {USB_DEVICE(0x041e, 0x4029)},
6954 {USB_DEVICE(0x041e, 0x4034), .driver_info = SENSOR_PAS106},
6955 {USB_DEVICE(0x041e, 0x4035), .driver_info = SENSOR_PAS106},
6956 {USB_DEVICE(0x041e, 0x4036)},
6957 {USB_DEVICE(0x041e, 0x403a)},
6958 {USB_DEVICE(0x041e, 0x4051), .driver_info = SENSOR_GC0303},
6959 {USB_DEVICE(0x041e, 0x4053), .driver_info = SENSOR_GC0303},
6960 {USB_DEVICE(0x0458, 0x7007)},
6961 {USB_DEVICE(0x0458, 0x700c)},
6962 {USB_DEVICE(0x0458, 0x700f)},
6963 {USB_DEVICE(0x0461, 0x0a00)},
6964 {USB_DEVICE(0x046d, 0x089d), .driver_info = SENSOR_MC501CB},
6965 {USB_DEVICE(0x046d, 0x08a0)},
6966 {USB_DEVICE(0x046d, 0x08a1)},
6967 {USB_DEVICE(0x046d, 0x08a2)},
6968 {USB_DEVICE(0x046d, 0x08a3)},
6969 {USB_DEVICE(0x046d, 0x08a6)},
6970 {USB_DEVICE(0x046d, 0x08a7)},
6971 {USB_DEVICE(0x046d, 0x08a9)},
6972 {USB_DEVICE(0x046d, 0x08aa)},
6973 {USB_DEVICE(0x046d, 0x08ac)},
6974 {USB_DEVICE(0x046d, 0x08ad)},
6975 {USB_DEVICE(0x046d, 0x08ae)},
6976 {USB_DEVICE(0x046d, 0x08af)},
6977 {USB_DEVICE(0x046d, 0x08b9)},
6978 {USB_DEVICE(0x046d, 0x08d7)},
6979 {USB_DEVICE(0x046d, 0x08d8)},
6980 {USB_DEVICE(0x046d, 0x08d9)},
6981 {USB_DEVICE(0x046d, 0x08da)},
6982 {USB_DEVICE(0x046d, 0x08dd), .driver_info = SENSOR_MC501CB},
6983 {USB_DEVICE(0x0471, 0x0325), .driver_info = SENSOR_PAS106},
6984 {USB_DEVICE(0x0471, 0x0326), .driver_info = SENSOR_PAS106},
6985 {USB_DEVICE(0x0471, 0x032d), .driver_info = SENSOR_PAS106},
6986 {USB_DEVICE(0x0471, 0x032e), .driver_info = SENSOR_PAS106},
6987 {USB_DEVICE(0x055f, 0xc005)},
6988 {USB_DEVICE(0x055f, 0xd003)},
6989 {USB_DEVICE(0x055f, 0xd004)},
6990 {USB_DEVICE(0x0698, 0x2003)},
6991 {USB_DEVICE(0x0ac8, 0x0301), .driver_info = SENSOR_PAS106},
6992 {USB_DEVICE(0x0ac8, 0x0302), .driver_info = SENSOR_PAS106},
6993 {USB_DEVICE(0x0ac8, 0x301b)},
6994 {USB_DEVICE(0x0ac8, 0x303b)},
6995 {USB_DEVICE(0x0ac8, 0x305b)},
6996 {USB_DEVICE(0x0ac8, 0x307b)},
6997 {USB_DEVICE(0x10fd, 0x0128)},
6998 {USB_DEVICE(0x10fd, 0x804d)},
6999 {USB_DEVICE(0x10fd, 0x8050)},
7000 {} /* end of entry */
7001 };
7002 MODULE_DEVICE_TABLE(usb, device_table);
7003
7004 /* -- device connect -- */
sd_probe(struct usb_interface * intf,const struct usb_device_id * id)7005 static int sd_probe(struct usb_interface *intf,
7006 const struct usb_device_id *id)
7007 {
7008 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
7009 THIS_MODULE);
7010 }
7011
7012 /* USB driver */
7013 static struct usb_driver sd_driver = {
7014 .name = KBUILD_MODNAME,
7015 .id_table = device_table,
7016 .probe = sd_probe,
7017 .disconnect = gspca_disconnect,
7018 #ifdef CONFIG_PM
7019 .suspend = gspca_suspend,
7020 .resume = gspca_resume,
7021 .reset_resume = gspca_resume,
7022 #endif
7023 };
7024
7025 module_usb_driver(sd_driver);
7026
7027 module_param(force_sensor, int, 0644);
7028 MODULE_PARM_DESC(force_sensor,
7029 "Force sensor. Only for experts!!!");
7030