aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/vc032x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/gspca/vc032x.c')
-rw-r--r--drivers/media/video/gspca/vc032x.c819
1 files changed, 752 insertions, 67 deletions
diff --git a/drivers/media/video/gspca/vc032x.c b/drivers/media/video/gspca/vc032x.c
index 17af353ddd1c..0525ea51a6de 100644
--- a/drivers/media/video/gspca/vc032x.c
+++ b/drivers/media/video/gspca/vc032x.c
@@ -32,44 +32,68 @@ MODULE_LICENSE("GPL");
32struct sd { 32struct sd {
33 struct gspca_dev gspca_dev; /* !! must be the first item */ 33 struct gspca_dev gspca_dev; /* !! must be the first item */
34 34
35 unsigned char autogain; 35 __u8 hflip;
36 unsigned char lightfreq; 36 __u8 vflip;
37 __u8 lightfreq;
38 __u8 sharpness;
37 39
38 char qindex;
39 char bridge; 40 char bridge;
40#define BRIDGE_VC0321 0 41#define BRIDGE_VC0321 0
41#define BRIDGE_VC0323 1 42#define BRIDGE_VC0323 1
42 char sensor; 43 char sensor;
43#define SENSOR_HV7131R 0 44#define SENSOR_HV7131R 0
44#define SENSOR_MI1320 1 45#define SENSOR_MI0360 1
45#define SENSOR_MI1310_SOC 2 46#define SENSOR_MI1320 2
46#define SENSOR_OV7660 3 47#define SENSOR_MI1310_SOC 3
47#define SENSOR_OV7670 4 48#define SENSOR_OV7660 4
48#define SENSOR_PO3130NC 5 49#define SENSOR_OV7670 5
50#define SENSOR_PO1200 6
51#define SENSOR_PO3130NC 7
49}; 52};
50 53
51/* V4L2 controls supported by the driver */ 54/* V4L2 controls supported by the driver */
52static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val); 55static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val);
53static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val); 56static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val);
57static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val);
58static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val);
54static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val); 59static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val);
55static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val); 60static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val);
61static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val);
62static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val);
56 63
57static struct ctrl sd_ctrls[] = { 64static struct ctrl sd_ctrls[] = {
65/* next 2 controls work with ov7660 and ov7670 only */
66#define HFLIP_IDX 0
58 { 67 {
59 { 68 {
60 .id = V4L2_CID_AUTOGAIN, 69 .id = V4L2_CID_HFLIP,
61 .type = V4L2_CTRL_TYPE_BOOLEAN, 70 .type = V4L2_CTRL_TYPE_BOOLEAN,
62 .name = "Auto Gain", 71 .name = "Mirror",
63 .minimum = 0, 72 .minimum = 0,
64 .maximum = 1, 73 .maximum = 1,
65 .step = 1, 74 .step = 1,
66#define AUTOGAIN_DEF 1 75#define HFLIP_DEF 0
67 .default_value = AUTOGAIN_DEF, 76 .default_value = HFLIP_DEF,
68 }, 77 },
69 .set = sd_setautogain, 78 .set = sd_sethflip,
70 .get = sd_getautogain, 79 .get = sd_gethflip,
71 }, 80 },
72#define LIGHTFREQ_IDX 1 81#define VFLIP_IDX 1
82 {
83 {
84 .id = V4L2_CID_VFLIP,
85 .type = V4L2_CTRL_TYPE_BOOLEAN,
86 .name = "Vflip",
87 .minimum = 0,
88 .maximum = 1,
89 .step = 1,
90#define VFLIP_DEF 0
91 .default_value = VFLIP_DEF,
92 },
93 .set = sd_setvflip,
94 .get = sd_getvflip,
95 },
96#define LIGHTFREQ_IDX 2
73 { 97 {
74 { 98 {
75 .id = V4L2_CID_POWER_LINE_FREQUENCY, 99 .id = V4L2_CID_POWER_LINE_FREQUENCY,
@@ -84,9 +108,25 @@ static struct ctrl sd_ctrls[] = {
84 .set = sd_setfreq, 108 .set = sd_setfreq,
85 .get = sd_getfreq, 109 .get = sd_getfreq,
86 }, 110 },
111/* po1200 only */
112#define SHARPNESS_IDX 3
113 {
114 {
115 .id = V4L2_CID_SHARPNESS,
116 .type = V4L2_CTRL_TYPE_INTEGER,
117 .name = "Sharpness",
118 .minimum = 0,
119 .maximum = 2,
120 .step = 1,
121#define SHARPNESS_DEF 1
122 .default_value = SHARPNESS_DEF,
123 },
124 .set = sd_setsharpness,
125 .get = sd_getsharpness,
126 },
87}; 127};
88 128
89static struct v4l2_pix_format vc0321_mode[] = { 129static const struct v4l2_pix_format vc0321_mode[] = {
90 {320, 240, V4L2_PIX_FMT_YVYU, V4L2_FIELD_NONE, 130 {320, 240, V4L2_PIX_FMT_YVYU, V4L2_FIELD_NONE,
91 .bytesperline = 320, 131 .bytesperline = 320,
92 .sizeimage = 320 * 240 * 2, 132 .sizeimage = 320 * 240 * 2,
@@ -98,7 +138,7 @@ static struct v4l2_pix_format vc0321_mode[] = {
98 .colorspace = V4L2_COLORSPACE_SRGB, 138 .colorspace = V4L2_COLORSPACE_SRGB,
99 .priv = 0}, 139 .priv = 0},
100}; 140};
101static struct v4l2_pix_format vc0323_mode[] = { 141static const struct v4l2_pix_format vc0323_mode[] = {
102 {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, 142 {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
103 .bytesperline = 320, 143 .bytesperline = 320,
104 .sizeimage = 320 * 240 * 3 / 8 + 590, 144 .sizeimage = 320 * 240 * 3 / 8 + 590,
@@ -111,6 +151,252 @@ static struct v4l2_pix_format vc0323_mode[] = {
111 .priv = 0}, 151 .priv = 0},
112}; 152};
113 153
154static const struct v4l2_pix_format svga_mode[] = {
155 {800, 600, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
156 .bytesperline = 800,
157 .sizeimage = 800 * 600 * 1 / 4 + 590,
158 .colorspace = V4L2_COLORSPACE_JPEG,
159 .priv = 0},
160};
161
162/* OV7660/7670 registers */
163#define OV7660_REG_MVFP 0x1e
164#define OV7660_MVFP_MIRROR 0x20
165#define OV7660_MVFP_VFLIP 0x10
166
167static const __u8 mi0360_matrix[9] = {
168 0x50, 0xf8, 0xf8, 0xf5, 0x50, 0xfb, 0xff, 0xf1, 0x50
169};
170
171static const __u8 mi0360_initVGA_JPG[][4] = {
172 {0xb0, 0x03, 0x19, 0xcc},
173 {0xb0, 0x04, 0x02, 0xcc},
174 {0xb3, 0x00, 0x24, 0xcc},
175 {0xb3, 0x00, 0x25, 0xcc},
176 {0xb3, 0x08, 0x01, 0xcc},
177 {0xb3, 0x09, 0x0c, 0xcc},
178 {0xb3, 0x05, 0x01, 0xcc},
179 {0xb3, 0x06, 0x03, 0xcc},
180 {0xb3, 0x03, 0x0a, 0xcc},
181 {0xb3, 0x20, 0x00, 0xcc},
182 {0xb3, 0x21, 0x00, 0xcc},
183 {0xb3, 0x22, 0x01, 0xcc},
184 {0xb3, 0x23, 0xe0, 0xcc},
185 {0xb3, 0x04, 0x05, 0xcc},
186 {0xb3, 0x14, 0x00, 0xcc},
187 {0xb3, 0x15, 0x00, 0xcc},
188 {0xb3, 0x16, 0x02, 0xcc},
189 {0xb3, 0x17, 0x7f, 0xcc},
190 {0xb3, 0x35, 0xdd, 0xcc},
191 {0xb3, 0x34, 0x02, 0xcc},
192 {0xb3, 0x00, 0x25, 0xcc},
193 {0xbc, 0x00, 0x71, 0xcc},
194 {0xb8, 0x00, 0x13, 0xcc},
195 {0xb8, 0x27, 0x20, 0xcc},
196 {0xb8, 0x2c, 0x50, 0xcc},
197 {0xb8, 0x2d, 0xf8, 0xcc},
198 {0xb8, 0x2e, 0xf8, 0xcc},
199 {0xb8, 0x2f, 0xf8, 0xcc},
200 {0xb8, 0x30, 0x50, 0xcc},
201 {0xb8, 0x31, 0xf8, 0xcc},
202 {0xb8, 0x32, 0xf8, 0xcc},
203 {0xb8, 0x33, 0xf8, 0xcc},
204 {0xb8, 0x34, 0x50, 0xcc},
205 {0xb8, 0x35, 0x00, 0xcc},
206 {0xb8, 0x36, 0x00, 0xcc},
207 {0xb8, 0x37, 0x00, 0xcc},
208 {0xb8, 0x01, 0x79, 0xcc},
209 {0xb8, 0x08, 0xe0, 0xcc},
210 {0xb3, 0x01, 0x41, 0xcc},
211 {0xb8, 0x01, 0x79, 0xcc},
212 {0xb8, 0x14, 0x18, 0xcc},
213 {0xb8, 0xb2, 0x0a, 0xcc},
214 {0xb8, 0xb4, 0x0a, 0xcc},
215 {0xb8, 0xb5, 0x0a, 0xcc},
216 {0xb8, 0xfe, 0x00, 0xcc},
217 {0xb8, 0xff, 0x28, 0xcc},
218 {0xb9, 0x00, 0x28, 0xcc},
219 {0xb9, 0x01, 0x28, 0xcc},
220 {0xb9, 0x02, 0x28, 0xcc},
221 {0xb9, 0x03, 0x00, 0xcc},
222 {0xb9, 0x04, 0x00, 0xcc},
223 {0xb9, 0x05, 0x3c, 0xcc},
224 {0xb9, 0x06, 0x3c, 0xcc},
225 {0xb9, 0x07, 0x3c, 0xcc},
226 {0xb9, 0x08, 0x3c, 0xcc},
227 {0xb8, 0x8e, 0x00, 0xcc},
228 {0xb8, 0x8f, 0xff, 0xcc},
229 {0xb8, 0x81, 0x09, 0xcc},
230 {0x31, 0x00, 0x00, 0xbb},
231 {0x09, 0x01, 0xc7, 0xbb},
232 {0x34, 0x01, 0x00, 0xbb},
233 {0x2b, 0x00, 0x28, 0xbb},
234 {0x2c, 0x00, 0x30, 0xbb},
235 {0x2d, 0x00, 0x30, 0xbb},
236 {0x2e, 0x00, 0x28, 0xbb},
237 {0x62, 0x04, 0x11, 0xbb},
238 {0x03, 0x01, 0xe0, 0xbb},
239 {0x2c, 0x00, 0x2c, 0xbb},
240 {0x20, 0xd0, 0x00, 0xbb},
241 {0x01, 0x00, 0x08, 0xbb},
242 {0x06, 0x00, 0x10, 0xbb},
243 {0x05, 0x00, 0x20, 0xbb},
244 {0x20, 0x00, 0x00, 0xbb},
245 {0xb6, 0x00, 0x00, 0xcc},
246 {0xb6, 0x03, 0x02, 0xcc},
247 {0xb6, 0x02, 0x80, 0xcc},
248 {0xb6, 0x05, 0x01, 0xcc},
249 {0xb6, 0x04, 0xe0, 0xcc},
250 {0xb6, 0x12, 0x78, 0xcc},
251 {0xb6, 0x18, 0x02, 0xcc},
252 {0xb6, 0x17, 0x58, 0xcc},
253 {0xb6, 0x16, 0x00, 0xcc},
254 {0xb6, 0x22, 0x12, 0xcc},
255 {0xb6, 0x23, 0x0b, 0xcc},
256 {0xb3, 0x02, 0x02, 0xcc},
257 {0xbf, 0xc0, 0x39, 0xcc},
258 {0xbf, 0xc1, 0x04, 0xcc},
259 {0xbf, 0xcc, 0x10, 0xcc},
260 {0xb9, 0x12, 0x00, 0xcc},
261 {0xb9, 0x13, 0x0a, 0xcc},
262 {0xb9, 0x14, 0x0a, 0xcc},
263 {0xb9, 0x15, 0x0a, 0xcc},
264 {0xb9, 0x16, 0x0a, 0xcc},
265 {0xb9, 0x18, 0x00, 0xcc},
266 {0xb9, 0x19, 0x0f, 0xcc},
267 {0xb9, 0x1a, 0x0f, 0xcc},
268 {0xb9, 0x1b, 0x0f, 0xcc},
269 {0xb9, 0x1c, 0x0f, 0xcc},
270 {0xb8, 0x8e, 0x00, 0xcc},
271 {0xb8, 0x8f, 0xff, 0xcc},
272 {0xb6, 0x12, 0xf8, 0xcc},
273 {0xb8, 0x0c, 0x20, 0xcc},
274 {0xb8, 0x0d, 0x70, 0xcc},
275 {0xb6, 0x13, 0x13, 0xcc},
276 {0x35, 0x00, 0x60, 0xbb},
277 {0xb3, 0x5c, 0x01, 0xcc},
278 {}
279};
280static const __u8 mi0360_initQVGA_JPG[][4] = {
281 {0xb0, 0x03, 0x19, 0xcc},
282 {0xb0, 0x04, 0x02, 0xcc},
283 {0xb3, 0x00, 0x24, 0xcc},
284 {0xb3, 0x00, 0x25, 0xcc},
285 {0xb3, 0x08, 0x01, 0xcc},
286 {0xb3, 0x09, 0x0c, 0xcc},
287 {0xb3, 0x05, 0x01, 0xcc},
288 {0xb3, 0x06, 0x03, 0xcc},
289 {0xb3, 0x03, 0x0a, 0xcc},
290 {0xb3, 0x20, 0x00, 0xcc},
291 {0xb3, 0x21, 0x00, 0xcc},
292 {0xb3, 0x22, 0x01, 0xcc},
293 {0xb3, 0x23, 0xe0, 0xcc},
294 {0xb3, 0x04, 0x05, 0xcc},
295 {0xb3, 0x14, 0x00, 0xcc},
296 {0xb3, 0x15, 0x00, 0xcc},
297 {0xb3, 0x16, 0x02, 0xcc},
298 {0xb3, 0x17, 0x7f, 0xcc},
299 {0xb3, 0x35, 0xdd, 0xcc},
300 {0xb3, 0x34, 0x02, 0xcc},
301 {0xb3, 0x00, 0x25, 0xcc},
302 {0xbc, 0x00, 0xd1, 0xcc},
303 {0xb8, 0x00, 0x13, 0xcc},
304 {0xb8, 0x27, 0x20, 0xcc},
305 {0xb8, 0x2c, 0x50, 0xcc},
306 {0xb8, 0x2d, 0xf8, 0xcc},
307 {0xb8, 0x2e, 0xf8, 0xcc},
308 {0xb8, 0x2f, 0xf8, 0xcc},
309 {0xb8, 0x30, 0x50, 0xcc},
310 {0xb8, 0x31, 0xf8, 0xcc},
311 {0xb8, 0x32, 0xf8, 0xcc},
312 {0xb8, 0x33, 0xf8, 0xcc},
313 {0xb8, 0x34, 0x50, 0xcc},
314 {0xb8, 0x35, 0x00, 0xcc},
315 {0xb8, 0x36, 0x00, 0xcc},
316 {0xb8, 0x37, 0x00, 0xcc},
317 {0xb8, 0x01, 0x79, 0xcc},
318 {0xb8, 0x08, 0xe0, 0xcc},
319 {0xb3, 0x01, 0x41, 0xcc},
320 {0xb8, 0x01, 0x79, 0xcc},
321 {0xb8, 0x14, 0x18, 0xcc},
322 {0xb8, 0xb2, 0x0a, 0xcc},
323 {0xb8, 0xb4, 0x0a, 0xcc},
324 {0xb8, 0xb5, 0x0a, 0xcc},
325 {0xb8, 0xfe, 0x00, 0xcc},
326 {0xb8, 0xff, 0x28, 0xcc},
327 {0xb9, 0x00, 0x28, 0xcc},
328 {0xb9, 0x01, 0x28, 0xcc},
329 {0xb9, 0x02, 0x28, 0xcc},
330 {0xb9, 0x03, 0x00, 0xcc},
331 {0xb9, 0x04, 0x00, 0xcc},
332 {0xb9, 0x05, 0x3c, 0xcc},
333 {0xb9, 0x06, 0x3c, 0xcc},
334 {0xb9, 0x07, 0x3c, 0xcc},
335 {0xb9, 0x08, 0x3c, 0xcc},
336 {0xb8, 0x8e, 0x00, 0xcc},
337 {0xb8, 0x8f, 0xff, 0xcc},
338 {0xb8, 0x81, 0x09, 0xcc},
339 {0x31, 0x00, 0x00, 0xbb},
340 {0x09, 0x01, 0xc7, 0xbb},
341 {0x34, 0x01, 0x00, 0xbb},
342 {0x2b, 0x00, 0x28, 0xbb},
343 {0x2c, 0x00, 0x30, 0xbb},
344 {0x2d, 0x00, 0x30, 0xbb},
345 {0x2e, 0x00, 0x28, 0xbb},
346 {0x62, 0x04, 0x11, 0xbb},
347 {0x03, 0x01, 0xe0, 0xbb},
348 {0x2c, 0x00, 0x2c, 0xbb},
349 {0x20, 0xd0, 0x00, 0xbb},
350 {0x01, 0x00, 0x08, 0xbb},
351 {0x06, 0x00, 0x10, 0xbb},
352 {0x05, 0x00, 0x20, 0xbb},
353 {0x20, 0x00, 0x00, 0xbb},
354 {0xb6, 0x00, 0x00, 0xcc},
355 {0xb6, 0x03, 0x01, 0xcc},
356 {0xb6, 0x02, 0x40, 0xcc},
357 {0xb6, 0x05, 0x00, 0xcc},
358 {0xb6, 0x04, 0xf0, 0xcc},
359 {0xb6, 0x12, 0x78, 0xcc},
360 {0xb6, 0x18, 0x00, 0xcc},
361 {0xb6, 0x17, 0x96, 0xcc},
362 {0xb6, 0x16, 0x00, 0xcc},
363 {0xb6, 0x22, 0x12, 0xcc},
364 {0xb6, 0x23, 0x0b, 0xcc},
365 {0xb3, 0x02, 0x02, 0xcc},
366 {0xbf, 0xc0, 0x39, 0xcc},
367 {0xbf, 0xc1, 0x04, 0xcc},
368 {0xbf, 0xcc, 0x10, 0xcc},
369 {0xb9, 0x12, 0x00, 0xcc},
370 {0xb9, 0x13, 0x0a, 0xcc},
371 {0xb9, 0x14, 0x0a, 0xcc},
372 {0xb9, 0x15, 0x0a, 0xcc},
373 {0xb9, 0x16, 0x0a, 0xcc},
374 {0xb9, 0x18, 0x00, 0xcc},
375 {0xb9, 0x19, 0x0f, 0xcc},
376 {0xb9, 0x1a, 0x0f, 0xcc},
377 {0xb9, 0x1b, 0x0f, 0xcc},
378 {0xb9, 0x1c, 0x0f, 0xcc},
379 {0xb8, 0x8e, 0x00, 0xcc},
380 {0xb8, 0x8f, 0xff, 0xcc},
381 {0xb6, 0x12, 0xf8, 0xcc},
382 {0xb6, 0x13, 0x13, 0xcc},
383 {0xbc, 0x02, 0x18, 0xcc},
384 {0xbc, 0x03, 0x50, 0xcc},
385 {0xbc, 0x04, 0x18, 0xcc},
386 {0xbc, 0x05, 0x00, 0xcc},
387 {0xbc, 0x06, 0x00, 0xcc},
388 {0xbc, 0x08, 0x30, 0xcc},
389 {0xbc, 0x09, 0x40, 0xcc},
390 {0xbc, 0x0a, 0x10, 0xcc},
391 {0xb8, 0x0c, 0x20, 0xcc},
392 {0xb8, 0x0d, 0x70, 0xcc},
393 {0xbc, 0x0b, 0x00, 0xcc},
394 {0xbc, 0x0c, 0x00, 0xcc},
395 {0x35, 0x00, 0xef, 0xbb},
396 {0xb3, 0x5c, 0x01, 0xcc},
397 {}
398};
399
114static const __u8 mi1310_socinitVGA_JPG[][4] = { 400static const __u8 mi1310_socinitVGA_JPG[][4] = {
115 {0xb0, 0x03, 0x19, 0xcc}, 401 {0xb0, 0x03, 0x19, 0xcc},
116 {0xb0, 0x04, 0x02, 0xcc}, 402 {0xb0, 0x04, 0x02, 0xcc},
@@ -823,7 +1109,7 @@ static const __u8 ov7660_initVGA_data[][4] = {
823 {0x00, 0x01, 0x80, 0xaa}, {0x00, 0x02, 0x80, 0xaa}, 1109 {0x00, 0x01, 0x80, 0xaa}, {0x00, 0x02, 0x80, 0xaa},
824 {0x00, 0x12, 0x80, 0xaa}, 1110 {0x00, 0x12, 0x80, 0xaa},
825 {0x00, 0x12, 0x05, 0xaa}, 1111 {0x00, 0x12, 0x05, 0xaa},
826 {0x00, 0x1e, 0x01, 0xaa}, 1112 {0x00, 0x1e, 0x01, 0xaa}, /* MVFP */
827 {0x00, 0x3d, 0x40, 0xaa}, /* 0x3d <-40 gamma 01 */ 1113 {0x00, 0x3d, 0x40, 0xaa}, /* 0x3d <-40 gamma 01 */
828 {0x00, 0x41, 0x00, 0xaa}, /* edge 00 */ 1114 {0x00, 0x41, 0x00, 0xaa}, /* edge 00 */
829 {0x00, 0x0d, 0x48, 0xaa}, {0x00, 0x0e, 0x04, 0xaa}, 1115 {0x00, 0x0d, 0x48, 0xaa}, {0x00, 0x0e, 0x04, 0xaa},
@@ -877,7 +1163,7 @@ static const __u8 ov7660_initQVGA_data[][4] = {
877 {0xb8, 0x27, 0x20, 0xcc}, {0xb8, 0x8f, 0x50, 0xcc}, 1163 {0xb8, 0x27, 0x20, 0xcc}, {0xb8, 0x8f, 0x50, 0xcc},
878 {0x00, 0x01, 0x80, 0xaa}, {0x00, 0x02, 0x80, 0xaa}, 1164 {0x00, 0x01, 0x80, 0xaa}, {0x00, 0x02, 0x80, 0xaa},
879 {0x00, 0x12, 0x80, 0xaa}, {0x00, 0x12, 0x05, 0xaa}, 1165 {0x00, 0x12, 0x80, 0xaa}, {0x00, 0x12, 0x05, 0xaa},
880 {0x00, 0x1e, 0x01, 0xaa}, 1166 {0x00, 0x1e, 0x01, 0xaa}, /* MVFP */
881 {0x00, 0x3d, 0x40, 0xaa}, /* 0x3d <-40 gamma 01 */ 1167 {0x00, 0x3d, 0x40, 0xaa}, /* 0x3d <-40 gamma 01 */
882 {0x00, 0x41, 0x00, 0xaa}, /* edge 00 */ 1168 {0x00, 0x41, 0x00, 0xaa}, /* edge 00 */
883 {0x00, 0x0d, 0x48, 0xaa}, {0x00, 0x0e, 0x04, 0xaa}, 1169 {0x00, 0x0d, 0x48, 0xaa}, {0x00, 0x0e, 0x04, 0xaa},
@@ -983,7 +1269,8 @@ static const __u8 ov7670_initVGA_JPG[][4] = {
983 {0x00, 0xa9, 0x90, 0xaa}, {0x00, 0xaa, 0x14, 0xaa}, 1269 {0x00, 0xa9, 0x90, 0xaa}, {0x00, 0xaa, 0x14, 0xaa},
984 {0x00, 0x13, 0xe5, 0xaa}, {0x00, 0x0e, 0x61, 0xaa}, 1270 {0x00, 0x13, 0xe5, 0xaa}, {0x00, 0x0e, 0x61, 0xaa},
985 {0x00, 0x0f, 0x4b, 0xaa}, {0x00, 0x16, 0x02, 0xaa}, 1271 {0x00, 0x0f, 0x4b, 0xaa}, {0x00, 0x16, 0x02, 0xaa},
986 {0x00, 0x1e, 0x07, 0xaa}, {0x00, 0x21, 0x02, 0xaa}, 1272 {0x00, 0x1e, 0x07, 0xaa}, /* MVFP */
1273 {0x00, 0x21, 0x02, 0xaa},
987 {0x00, 0x22, 0x91, 0xaa}, {0x00, 0x29, 0x07, 0xaa}, 1274 {0x00, 0x22, 0x91, 0xaa}, {0x00, 0x29, 0x07, 0xaa},
988 {0x00, 0x33, 0x0b, 0xaa}, {0x00, 0x35, 0x0b, 0xaa}, 1275 {0x00, 0x33, 0x0b, 0xaa}, {0x00, 0x35, 0x0b, 0xaa},
989 {0x00, 0x37, 0x1d, 0xaa}, {0x00, 0x38, 0x71, 0xaa}, 1276 {0x00, 0x37, 0x1d, 0xaa}, {0x00, 0x38, 0x71, 0xaa},
@@ -1048,7 +1335,8 @@ static const __u8 ov7670_initVGA_JPG[][4] = {
1048 {0x00, 0x71, 0x35, 0xaa}, {0x00, 0x72, 0x11, 0xaa}, 1335 {0x00, 0x71, 0x35, 0xaa}, {0x00, 0x72, 0x11, 0xaa},
1049 {0x00, 0x73, 0xf0, 0xaa}, {0x00, 0xa2, 0x02, 0xaa}, 1336 {0x00, 0x73, 0xf0, 0xaa}, {0x00, 0xa2, 0x02, 0xaa},
1050 {0x00, 0xb1, 0x00, 0xaa}, {0x00, 0xb1, 0x0c, 0xaa}, 1337 {0x00, 0xb1, 0x00, 0xaa}, {0x00, 0xb1, 0x0c, 0xaa},
1051 {0x00, 0x1e, 0x37, 0xaa}, {0x00, 0xaa, 0x14, 0xaa}, 1338 {0x00, 0x1e, 0x37, 0xaa}, /* MVFP */
1339 {0x00, 0xaa, 0x14, 0xaa},
1052 {0x00, 0x24, 0x80, 0xaa}, {0x00, 0x25, 0x74, 0xaa}, 1340 {0x00, 0x24, 0x80, 0xaa}, {0x00, 0x25, 0x74, 0xaa},
1053 {0x00, 0x26, 0xd3, 0xaa}, {0x00, 0x0d, 0x00, 0xaa}, 1341 {0x00, 0x26, 0xd3, 0xaa}, {0x00, 0x0d, 0x00, 0xaa},
1054 {0x00, 0x14, 0x18, 0xaa}, {0x00, 0x9d, 0x99, 0xaa}, 1342 {0x00, 0x14, 0x18, 0xaa}, {0x00, 0x9d, 0x99, 0xaa},
@@ -1110,7 +1398,8 @@ static const __u8 ov7670_initQVGA_JPG[][4] = {
1110 {0x00, 0xa9, 0x90, 0xaa}, {0x00, 0xaa, 0x14, 0xaa}, 1398 {0x00, 0xa9, 0x90, 0xaa}, {0x00, 0xaa, 0x14, 0xaa},
1111 {0x00, 0x13, 0xe5, 0xaa}, {0x00, 0x0e, 0x61, 0xaa}, 1399 {0x00, 0x13, 0xe5, 0xaa}, {0x00, 0x0e, 0x61, 0xaa},
1112 {0x00, 0x0f, 0x4b, 0xaa}, {0x00, 0x16, 0x02, 0xaa}, 1400 {0x00, 0x0f, 0x4b, 0xaa}, {0x00, 0x16, 0x02, 0xaa},
1113 {0x00, 0x1e, 0x07, 0xaa}, {0x00, 0x21, 0x02, 0xaa}, 1401 {0x00, 0x1e, 0x07, 0xaa}, /* MVFP */
1402 {0x00, 0x21, 0x02, 0xaa},
1114 {0x00, 0x22, 0x91, 0xaa}, {0x00, 0x29, 0x07, 0xaa}, 1403 {0x00, 0x22, 0x91, 0xaa}, {0x00, 0x29, 0x07, 0xaa},
1115 {0x00, 0x33, 0x0b, 0xaa}, {0x00, 0x35, 0x0b, 0xaa}, 1404 {0x00, 0x33, 0x0b, 0xaa}, {0x00, 0x35, 0x0b, 0xaa},
1116 {0x00, 0x37, 0x1d, 0xaa}, {0x00, 0x38, 0x71, 0xaa}, 1405 {0x00, 0x37, 0x1d, 0xaa}, {0x00, 0x38, 0x71, 0xaa},
@@ -1175,7 +1464,8 @@ static const __u8 ov7670_initQVGA_JPG[][4] = {
1175 {0x00, 0x71, 0x35, 0xaa}, {0x00, 0x72, 0x11, 0xaa}, 1464 {0x00, 0x71, 0x35, 0xaa}, {0x00, 0x72, 0x11, 0xaa},
1176 {0x00, 0x73, 0xf0, 0xaa}, {0x00, 0xa2, 0x02, 0xaa}, 1465 {0x00, 0x73, 0xf0, 0xaa}, {0x00, 0xa2, 0x02, 0xaa},
1177 {0x00, 0xb1, 0x00, 0xaa}, {0x00, 0xb1, 0x0c, 0xaa}, 1466 {0x00, 0xb1, 0x00, 0xaa}, {0x00, 0xb1, 0x0c, 0xaa},
1178 {0x00, 0x1e, 0x37, 0xaa}, {0x00, 0xaa, 0x14, 0xaa}, 1467 {0x00, 0x1e, 0x37, 0xaa}, /* MVFP */
1468 {0x00, 0xaa, 0x14, 0xaa},
1179 {0x00, 0x24, 0x80, 0xaa}, {0x00, 0x25, 0x74, 0xaa}, 1469 {0x00, 0x24, 0x80, 0xaa}, {0x00, 0x25, 0x74, 0xaa},
1180 {0x00, 0x26, 0xd3, 0xaa}, {0x00, 0x0d, 0x00, 0xaa}, 1470 {0x00, 0x26, 0xd3, 0xaa}, {0x00, 0x0d, 0x00, 0xaa},
1181 {0x00, 0x14, 0x18, 0xaa}, {0x00, 0x9d, 0x99, 0xaa}, 1471 {0x00, 0x14, 0x18, 0xaa}, {0x00, 0x9d, 0x99, 0xaa},
@@ -1204,6 +1494,275 @@ static const __u8 ov7670_initQVGA_JPG[][4] = {
1204 {}, 1494 {},
1205}; 1495};
1206 1496
1497/* PO1200 - values from usbvm326.inf and ms-win trace */
1498static const __u8 po1200_gamma[17] = {
1499 0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
1500 0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
1501};
1502static const __u8 po1200_matrix[9] = {
1503 0x60, 0xf9, 0xe5, 0xe7, 0x50, 0x05, 0xf3, 0xe6, 0x5e
1504};
1505static const __u8 po1200_initVGA_data[][4] = {
1506 {0xb0, 0x03, 0x19, 0xcc}, /* reset? */
1507 {0xb0, 0x03, 0x19, 0xcc},
1508/* {0x00, 0x00, 0x33, 0xdd}, */
1509 {0xb0, 0x04, 0x02, 0xcc},
1510 {0xb0, 0x02, 0x02, 0xcc},
1511 {0xb3, 0x5d, 0x00, 0xcc},
1512 {0xb3, 0x01, 0x01, 0xcc},
1513 {0xb3, 0x00, 0x64, 0xcc},
1514 {0xb3, 0x00, 0x65, 0xcc},
1515 {0xb3, 0x05, 0x01, 0xcc},
1516 {0xb3, 0x06, 0x01, 0xcc},
1517 {0xb3, 0x5c, 0x01, 0xcc},
1518 {0xb3, 0x08, 0x01, 0xcc},
1519 {0xb3, 0x09, 0x0c, 0xcc},
1520 {0xb3, 0x00, 0x67, 0xcc},
1521 {0xb3, 0x02, 0xb2, 0xcc},
1522 {0xb3, 0x03, 0x18, 0xcc},
1523 {0xb3, 0x04, 0x15, 0xcc},
1524 {0xb3, 0x20, 0x00, 0xcc},
1525 {0xb3, 0x21, 0x00, 0xcc},
1526 {0xb3, 0x22, 0x02, 0xcc},
1527 {0xb3, 0x23, 0x58, 0xcc},
1528 {0xb3, 0x14, 0x00, 0xcc},
1529 {0xb3, 0x15, 0x00, 0xcc},
1530 {0xb3, 0x16, 0x03, 0xcc},
1531 {0xb3, 0x17, 0x1f, 0xcc},
1532 {0xbc, 0x00, 0x71, 0xcc},
1533 {0xbc, 0x01, 0x01, 0xcc},
1534 {0xb0, 0x54, 0x13, 0xcc},
1535 {0xb3, 0x00, 0x67, 0xcc},
1536 {0xb3, 0x34, 0x01, 0xcc},
1537 {0xb3, 0x35, 0xdc, 0xcc},
1538 {0x00, 0x03, 0x00, 0xaa},
1539 {0x00, 0x12, 0x05, 0xaa},
1540 {0x00, 0x13, 0x02, 0xaa},
1541 {0x00, 0x1e, 0xc6, 0xaa}, /* h/v flip */
1542 {0x00, 0x21, 0x00, 0xaa},
1543 {0x00, 0x25, 0x02, 0xaa},
1544 {0x00, 0x3c, 0x4f, 0xaa},
1545 {0x00, 0x3f, 0xe0, 0xaa},
1546 {0x00, 0x42, 0xff, 0xaa},
1547 {0x00, 0x45, 0x34, 0xaa},
1548 {0x00, 0x55, 0xfe, 0xaa},
1549 {0x00, 0x59, 0xd3, 0xaa},
1550 {0x00, 0x5e, 0x04, 0xaa},
1551 {0x00, 0x61, 0xb8, 0xaa}, /* sharpness */
1552 {0x00, 0x62, 0x02, 0xaa},
1553 {0x00, 0xa7, 0x31, 0xaa},
1554 {0x00, 0xa9, 0x66, 0xaa},
1555 {0x00, 0xb0, 0x00, 0xaa},
1556 {0x00, 0xb1, 0x00, 0xaa},
1557 {0x00, 0xb3, 0x11, 0xaa},
1558 {0x00, 0xb6, 0x26, 0xaa},
1559 {0x00, 0xb7, 0x20, 0xaa},
1560 {0x00, 0xba, 0x04, 0xaa},
1561 {0x00, 0x88, 0x42, 0xaa},
1562 {0x00, 0x89, 0x9a, 0xaa},
1563 {0x00, 0x8a, 0x88, 0xaa},
1564 {0x00, 0x8b, 0x8e, 0xaa},
1565 {0x00, 0x8c, 0x3e, 0xaa},
1566 {0x00, 0x8d, 0x90, 0xaa},
1567 {0x00, 0x8e, 0x87, 0xaa},
1568 {0x00, 0x8f, 0x96, 0xaa},
1569 {0x00, 0x90, 0x3d, 0xaa},
1570 {0x00, 0x64, 0x00, 0xaa},
1571 {0x00, 0x65, 0x10, 0xaa},
1572 {0x00, 0x66, 0x20, 0xaa},
1573 {0x00, 0x67, 0x2b, 0xaa},
1574 {0x00, 0x68, 0x36, 0xaa},
1575 {0x00, 0x69, 0x49, 0xaa},
1576 {0x00, 0x6a, 0x5a, 0xaa},
1577 {0x00, 0x6b, 0x7f, 0xaa},
1578 {0x00, 0x6c, 0x9b, 0xaa},
1579 {0x00, 0x6d, 0xba, 0xaa},
1580 {0x00, 0x6e, 0xd4, 0xaa},
1581 {0x00, 0x6f, 0xea, 0xaa},
1582 {0x00, 0x70, 0x00, 0xaa},
1583 {0x00, 0x71, 0x10, 0xaa},
1584 {0x00, 0x72, 0x20, 0xaa},
1585 {0x00, 0x73, 0x2b, 0xaa},
1586 {0x00, 0x74, 0x36, 0xaa},
1587 {0x00, 0x75, 0x49, 0xaa},
1588 {0x00, 0x76, 0x5a, 0xaa},
1589 {0x00, 0x77, 0x7f, 0xaa},
1590 {0x00, 0x78, 0x9b, 0xaa},
1591 {0x00, 0x79, 0xba, 0xaa},
1592 {0x00, 0x7a, 0xd4, 0xaa},
1593 {0x00, 0x7b, 0xea, 0xaa},
1594 {0x00, 0x7c, 0x00, 0xaa},
1595 {0x00, 0x7d, 0x10, 0xaa},
1596 {0x00, 0x7e, 0x20, 0xaa},
1597 {0x00, 0x7f, 0x2b, 0xaa},
1598 {0x00, 0x80, 0x36, 0xaa},
1599 {0x00, 0x81, 0x49, 0xaa},
1600 {0x00, 0x82, 0x5a, 0xaa},
1601 {0x00, 0x83, 0x7f, 0xaa},
1602 {0x00, 0x84, 0x9b, 0xaa},
1603 {0x00, 0x85, 0xba, 0xaa},
1604 {0x00, 0x86, 0xd4, 0xaa},
1605 {0x00, 0x87, 0xea, 0xaa},
1606 {0x00, 0x57, 0x2a, 0xaa},
1607 {0x00, 0x03, 0x01, 0xaa},
1608 {0x00, 0x04, 0x10, 0xaa},
1609 {0x00, 0x05, 0x10, 0xaa},
1610 {0x00, 0x06, 0x10, 0xaa},
1611 {0x00, 0x07, 0x10, 0xaa},
1612 {0x00, 0x08, 0x13, 0xaa},
1613 {0x00, 0x0a, 0x00, 0xaa},
1614 {0x00, 0x0b, 0x10, 0xaa},
1615 {0x00, 0x0c, 0x20, 0xaa},
1616 {0x00, 0x0d, 0x18, 0xaa},
1617 {0x00, 0x22, 0x01, 0xaa},
1618 {0x00, 0x23, 0x60, 0xaa},
1619 {0x00, 0x25, 0x08, 0xaa},
1620 {0x00, 0x26, 0x82, 0xaa},
1621 {0x00, 0x2e, 0x0f, 0xaa},
1622 {0x00, 0x2f, 0x1e, 0xaa},
1623 {0x00, 0x30, 0x2d, 0xaa},
1624 {0x00, 0x31, 0x3c, 0xaa},
1625 {0x00, 0x32, 0x4b, 0xaa},
1626 {0x00, 0x33, 0x5a, 0xaa},
1627 {0x00, 0x34, 0x69, 0xaa},
1628 {0x00, 0x35, 0x78, 0xaa},
1629 {0x00, 0x36, 0x87, 0xaa},
1630 {0x00, 0x37, 0x96, 0xaa},
1631 {0x00, 0x38, 0xa5, 0xaa},
1632 {0x00, 0x39, 0xb4, 0xaa},
1633 {0x00, 0x3a, 0xc3, 0xaa},
1634 {0x00, 0x3b, 0xd2, 0xaa},
1635 {0x00, 0x3c, 0xe1, 0xaa},
1636 {0x00, 0x3e, 0xff, 0xaa},
1637 {0x00, 0x3f, 0xff, 0xaa},
1638 {0x00, 0x40, 0xff, 0xaa},
1639 {0x00, 0x41, 0xff, 0xaa},
1640 {0x00, 0x42, 0xff, 0xaa},
1641 {0x00, 0x43, 0xff, 0xaa},
1642 {0x00, 0x03, 0x00, 0xaa},
1643 {0x00, 0x03, 0x00, 0xaa},
1644 {0x00, 0x20, 0xc4, 0xaa},
1645 {0x00, 0x13, 0x03, 0xaa},
1646 {0x00, 0x3c, 0x50, 0xaa},
1647 {0x00, 0x61, 0x6a, 0xaa}, /* sharpness? */
1648 {0x00, 0x51, 0x5b, 0xaa},
1649 {0x00, 0x52, 0x91, 0xaa},
1650 {0x00, 0x53, 0x4c, 0xaa},
1651 {0x00, 0x54, 0x50, 0xaa},
1652 {0x00, 0x56, 0x02, 0xaa},
1653 {0xb6, 0x00, 0x00, 0xcc},
1654 {0xb6, 0x03, 0x03, 0xcc},
1655 {0xb6, 0x02, 0x20, 0xcc},
1656 {0xb6, 0x05, 0x02, 0xcc},
1657 {0xb6, 0x04, 0x58, 0xcc},
1658 {0xb6, 0x12, 0xf8, 0xcc},
1659 {0xb6, 0x13, 0x21, 0xcc},
1660 {0xb6, 0x18, 0x03, 0xcc},
1661 {0xb6, 0x17, 0xa9, 0xcc},
1662 {0xb6, 0x16, 0x80, 0xcc},
1663 {0xb6, 0x22, 0x12, 0xcc},
1664 {0xb6, 0x23, 0x0b, 0xcc},
1665 {0xbf, 0xc0, 0x39, 0xcc},
1666 {0xbf, 0xc1, 0x04, 0xcc},
1667 {0xbf, 0xcc, 0x00, 0xcc},
1668 {0xb8, 0x06, 0x20, 0xcc},
1669 {0xb8, 0x07, 0x03, 0xcc},
1670 {0xb8, 0x08, 0x58, 0xcc},
1671 {0xb8, 0x09, 0x02, 0xcc},
1672 {0xb3, 0x01, 0x41, 0xcc},
1673 {0x00, 0x03, 0x00, 0xaa},
1674 {0x00, 0xd9, 0x0f, 0xaa},
1675 {0x00, 0xda, 0xaa, 0xaa},
1676 {0x00, 0xd9, 0x10, 0xaa},
1677 {0x00, 0xda, 0xaa, 0xaa},
1678 {0x00, 0xd9, 0x11, 0xaa},
1679 {0x00, 0xda, 0x00, 0xaa},
1680 {0x00, 0xd9, 0x12, 0xaa},
1681 {0x00, 0xda, 0xff, 0xaa},
1682 {0x00, 0xd9, 0x13, 0xaa},
1683 {0x00, 0xda, 0xff, 0xaa},
1684 {0x00, 0xe8, 0x11, 0xaa},
1685 {0x00, 0xe9, 0x12, 0xaa},
1686 {0x00, 0xea, 0x5c, 0xaa},
1687 {0x00, 0xeb, 0xff, 0xaa},
1688 {0x00, 0xd8, 0x80, 0xaa},
1689 {0x00, 0xe6, 0x02, 0xaa},
1690 {0x00, 0xd6, 0x40, 0xaa},
1691 {0x00, 0xe3, 0x05, 0xaa},
1692 {0x00, 0xe0, 0x40, 0xaa},
1693 {0x00, 0xde, 0x03, 0xaa},
1694 {0x00, 0xdf, 0x03, 0xaa},
1695 {0x00, 0xdb, 0x02, 0xaa},
1696 {0x00, 0xdc, 0x00, 0xaa},
1697 {0x00, 0xdd, 0x03, 0xaa},
1698 {0x00, 0xe1, 0x08, 0xaa},
1699 {0x00, 0xe2, 0x01, 0xaa},
1700 {0x00, 0xd6, 0x40, 0xaa},
1701 {0x00, 0xe4, 0x40, 0xaa},
1702 {0x00, 0xa8, 0x8f, 0xaa},
1703 {0x00, 0xb4, 0x16, 0xaa},
1704 {0xb0, 0x02, 0x06, 0xcc},
1705 {0xb0, 0x18, 0x06, 0xcc},
1706 {0xb0, 0x19, 0x06, 0xcc},
1707 {0xb3, 0x5d, 0x18, 0xcc},
1708 {0xb3, 0x05, 0x00, 0xcc},
1709 {0xb3, 0x06, 0x00, 0xcc},
1710 {0x00, 0xb4, 0x0e, 0xaa},
1711 {0x00, 0xb5, 0x49, 0xaa},
1712 {0x00, 0xb6, 0x1c, 0xaa},
1713 {0x00, 0xb7, 0x96, 0xaa},
1714/* end of usbvm326.inf - start of ms-win trace */
1715 {0xb6, 0x12, 0xf8, 0xcc},
1716 {0xb6, 0x13, 0x3d, 0xcc},
1717/*read b306*/
1718 {0x00, 0x03, 0x00, 0xaa},
1719 {0x00, 0x1a, 0x09, 0xaa},
1720 {0x00, 0x1b, 0x8a, 0xaa},
1721/*read b827*/
1722 {0xb8, 0x27, 0x00, 0xcc},
1723 {0xb8, 0x26, 0x60, 0xcc},
1724 {0xb8, 0x26, 0x60, 0xcc},
1725/*gamma - to do?*/
1726 {0x00, 0x03, 0x00, 0xaa},
1727 {0x00, 0xae, 0x84, 0xaa},
1728/*gamma again*/
1729 {0x00, 0x03, 0x00, 0xaa},
1730 {0x00, 0x96, 0xa0, 0xaa},
1731/*matrix*/
1732 {0x00, 0x03, 0x00, 0xaa},
1733 {0x00, 0x91, 0x35, 0xaa},
1734 {0x00, 0x92, 0x22, 0xaa},
1735/*gamma*/
1736 {0x00, 0x03, 0x00, 0xaa},
1737 {0x00, 0x95, 0x85, 0xaa},
1738/*matrix*/
1739 {0x00, 0x03, 0x00, 0xaa},
1740 {0x00, 0x4d, 0x20, 0xaa},
1741 {0xb8, 0x22, 0x40, 0xcc},
1742 {0xb8, 0x23, 0x40, 0xcc},
1743 {0xb8, 0x24, 0x40, 0xcc},
1744 {0xb8, 0x81, 0x09, 0xcc},
1745 {0x00, 0x00, 0x64, 0xdd},
1746 {0x00, 0x03, 0x01, 0xaa},
1747/*read 46*/
1748 {0x00, 0x46, 0x3c, 0xaa},
1749 {0x00, 0x03, 0x00, 0xaa},
1750 {0x00, 0x16, 0x40, 0xaa},
1751 {0x00, 0x17, 0x40, 0xaa},
1752 {0x00, 0x18, 0x40, 0xaa},
1753 {0x00, 0x19, 0x41, 0xaa},
1754 {0x00, 0x03, 0x01, 0xaa},
1755 {0x00, 0x46, 0x3c, 0xaa},
1756 {0x00, 0x00, 0x18, 0xdd},
1757/*read bfff*/
1758 {0x00, 0x03, 0x00, 0xaa},
1759 {0x00, 0xb4, 0x1c, 0xaa},
1760 {0x00, 0xb5, 0x92, 0xaa},
1761 {0x00, 0xb6, 0x39, 0xaa},
1762 {0x00, 0xb7, 0x24, 0xaa},
1763/*write 89 0400 1415*/
1764};
1765
1207struct sensor_info { 1766struct sensor_info {
1208 int sensorId; 1767 int sensorId;
1209 __u8 I2cAdd; 1768 __u8 I2cAdd;
@@ -1222,6 +1781,9 @@ static const struct sensor_info sensor_info_data[] = {
1222 {SENSOR_MI1320, 0x80 | 0xc8, 0x00, 0x148c, 0x64, 0x65, 0x01}, 1781 {SENSOR_MI1320, 0x80 | 0xc8, 0x00, 0x148c, 0x64, 0x65, 0x01},
1223 {SENSOR_OV7670, 0x80 | 0x21, 0x0a, 0x7673, 0x66, 0x67, 0x05}, 1782 {SENSOR_OV7670, 0x80 | 0x21, 0x0a, 0x7673, 0x66, 0x67, 0x05},
1224 {SENSOR_MI1310_SOC, 0x80 | 0x5d, 0x00, 0x143a, 0x24, 0x25, 0x01}, 1783 {SENSOR_MI1310_SOC, 0x80 | 0x5d, 0x00, 0x143a, 0x24, 0x25, 0x01},
1784/* (tested in vc032x_probe_sensor) */
1785/* {SENSOR_MI0360, 0x80 | 0x5d, 0x00, 0x8243, 0x24, 0x25, 0x01}, */
1786 {SENSOR_PO1200, 0x80 | 0x5c, 0x00, 0x1200, 0x67, 0x67, 0x01},
1225}; 1787};
1226 1788
1227/* read 'len' bytes in gspca_dev->usb_buf */ 1789/* read 'len' bytes in gspca_dev->usb_buf */
@@ -1278,18 +1840,18 @@ static void read_sensor_register(struct gspca_dev *gspca_dev,
1278 msleep(1); 1840 msleep(1);
1279 } 1841 }
1280 reg_r(gspca_dev, 0xa1, 0xb33e, 1); 1842 reg_r(gspca_dev, 0xa1, 0xb33e, 1);
1281 hdata = gspca_dev->usb_buf[0]; 1843 ldata = gspca_dev->usb_buf[0];
1282 reg_r(gspca_dev, 0xa1, 0xb33d, 1); 1844 reg_r(gspca_dev, 0xa1, 0xb33d, 1);
1283 mdata = gspca_dev->usb_buf[0]; 1845 mdata = gspca_dev->usb_buf[0];
1284 reg_r(gspca_dev, 0xa1, 0xb33c, 1); 1846 reg_r(gspca_dev, 0xa1, 0xb33c, 1);
1285 ldata = gspca_dev->usb_buf[0]; 1847 hdata = gspca_dev->usb_buf[0];
1286 PDEBUG(D_PROBE, "Read Sensor h (0x%02X) m (0x%02X) l (0x%02X)", 1848 PDEBUG(D_PROBE, "Read Sensor %02x%02x %02x",
1287 hdata, mdata, ldata); 1849 hdata, mdata, ldata);
1288 reg_r(gspca_dev, 0xa1, 0xb334, 1); 1850 reg_r(gspca_dev, 0xa1, 0xb334, 1);
1289 if (gspca_dev->usb_buf[0] == 0x02) 1851 if (gspca_dev->usb_buf[0] == 0x02)
1290 *value = (ldata << 8) + mdata; 1852 *value = (hdata << 8) + mdata;
1291 else 1853 else
1292 *value = ldata; 1854 *value = hdata;
1293} 1855}
1294 1856
1295static int vc032x_probe_sensor(struct gspca_dev *gspca_dev) 1857static int vc032x_probe_sensor(struct gspca_dev *gspca_dev)
@@ -1300,7 +1862,7 @@ static int vc032x_probe_sensor(struct gspca_dev *gspca_dev)
1300 const struct sensor_info *ptsensor_info; 1862 const struct sensor_info *ptsensor_info;
1301 1863
1302 reg_r(gspca_dev, 0xa1, 0xbfcf, 1); 1864 reg_r(gspca_dev, 0xa1, 0xbfcf, 1);
1303 PDEBUG(D_PROBE, "check sensor header %d", gspca_dev->usb_buf[0]); 1865 PDEBUG(D_PROBE, "check sensor header %02x", gspca_dev->usb_buf[0]);
1304 for (i = 0; i < ARRAY_SIZE(sensor_info_data); i++) { 1866 for (i = 0; i < ARRAY_SIZE(sensor_info_data); i++) {
1305 ptsensor_info = &sensor_info_data[i]; 1867 ptsensor_info = &sensor_info_data[i];
1306 reg_w(dev, 0xa0, 0x02, 0xb334); 1868 reg_w(dev, 0xa0, 0x02, 0xb334);
@@ -1309,16 +1871,15 @@ static int vc032x_probe_sensor(struct gspca_dev *gspca_dev)
1309 reg_w(dev, 0xa0, 0x01, 0xb308); 1871 reg_w(dev, 0xa0, 0x01, 0xb308);
1310 reg_w(dev, 0xa0, 0x0c, 0xb309); 1872 reg_w(dev, 0xa0, 0x0c, 0xb309);
1311 reg_w(dev, 0xa0, ptsensor_info->I2cAdd, 0xb335); 1873 reg_w(dev, 0xa0, ptsensor_info->I2cAdd, 0xb335);
1312/* PDEBUG(D_PROBE,
1313 "check sensor VC032X -> %d Add -> ox%02X!",
1314 i, ptsensor_info->I2cAdd); */
1315 reg_w(dev, 0xa0, ptsensor_info->op, 0xb301); 1874 reg_w(dev, 0xa0, ptsensor_info->op, 0xb301);
1316 read_sensor_register(gspca_dev, ptsensor_info->IdAdd, &value); 1875 read_sensor_register(gspca_dev, ptsensor_info->IdAdd, &value);
1317 if (value == ptsensor_info->VpId) { 1876 if (value == ptsensor_info->VpId)
1318/* PDEBUG(D_PROBE, "find sensor VC032X -> ox%04X!",
1319 ptsensor_info->VpId); */
1320 return ptsensor_info->sensorId; 1877 return ptsensor_info->sensorId;
1321 } 1878
1879 /* special case for MI0360 */
1880 if (ptsensor_info->sensorId == SENSOR_MI1310_SOC
1881 && value == 0x8243)
1882 return SENSOR_MI0360;
1322 } 1883 }
1323 return -1; 1884 return -1;
1324} 1885}
@@ -1420,13 +1981,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
1420 cam = &gspca_dev->cam; 1981 cam = &gspca_dev->cam;
1421 cam->epaddr = 0x02; 1982 cam->epaddr = 0x02;
1422 sd->bridge = id->driver_info; 1983 sd->bridge = id->driver_info;
1423 if (sd->bridge == BRIDGE_VC0321) {
1424 cam->cam_mode = vc0321_mode;
1425 cam->nmodes = ARRAY_SIZE(vc0321_mode);
1426 } else {
1427 cam->cam_mode = vc0323_mode;
1428 cam->nmodes = ARRAY_SIZE(vc0323_mode);
1429 }
1430 1984
1431 vc0321_reset(gspca_dev); 1985 vc0321_reset(gspca_dev);
1432 sensor = vc032x_probe_sensor(gspca_dev); 1986 sensor = vc032x_probe_sensor(gspca_dev);
@@ -1436,35 +1990,66 @@ static int sd_config(struct gspca_dev *gspca_dev,
1436 return -EINVAL; 1990 return -EINVAL;
1437 case SENSOR_HV7131R: 1991 case SENSOR_HV7131R:
1438 PDEBUG(D_PROBE, "Find Sensor HV7131R"); 1992 PDEBUG(D_PROBE, "Find Sensor HV7131R");
1439 sd->sensor = SENSOR_HV7131R; 1993 break;
1994 case SENSOR_MI0360:
1995 PDEBUG(D_PROBE, "Find Sensor MI0360");
1996 sd->bridge = BRIDGE_VC0323;
1440 break; 1997 break;
1441 case SENSOR_MI1310_SOC: 1998 case SENSOR_MI1310_SOC:
1442 PDEBUG(D_PROBE, "Find Sensor MI1310_SOC"); 1999 PDEBUG(D_PROBE, "Find Sensor MI1310_SOC");
1443 sd->sensor = SENSOR_MI1310_SOC;
1444 break; 2000 break;
1445 case SENSOR_MI1320: 2001 case SENSOR_MI1320:
1446 PDEBUG(D_PROBE, "Find Sensor MI1320"); 2002 PDEBUG(D_PROBE, "Find Sensor MI1320");
1447 sd->sensor = SENSOR_MI1320;
1448 break; 2003 break;
1449 case SENSOR_OV7660: 2004 case SENSOR_OV7660:
1450 PDEBUG(D_PROBE, "Find Sensor OV7660"); 2005 PDEBUG(D_PROBE, "Find Sensor OV7660");
1451 sd->sensor = SENSOR_OV7660;
1452 break; 2006 break;
1453 case SENSOR_OV7670: 2007 case SENSOR_OV7670:
1454 PDEBUG(D_PROBE, "Find Sensor OV7670"); 2008 PDEBUG(D_PROBE, "Find Sensor OV7670");
1455 sd->sensor = SENSOR_OV7670; 2009 break;
2010 case SENSOR_PO1200:
2011 PDEBUG(D_PROBE, "Find Sensor PO1200");
1456 break; 2012 break;
1457 case SENSOR_PO3130NC: 2013 case SENSOR_PO3130NC:
1458 PDEBUG(D_PROBE, "Find Sensor PO3130NC"); 2014 PDEBUG(D_PROBE, "Find Sensor PO3130NC");
1459 sd->sensor = SENSOR_PO3130NC;
1460 break; 2015 break;
1461 } 2016 }
2017 sd->sensor = sensor;
1462 2018
1463 sd->qindex = 7; 2019 if (sd->bridge == BRIDGE_VC0321) {
1464 sd->autogain = AUTOGAIN_DEF; 2020 cam->cam_mode = vc0321_mode;
2021 cam->nmodes = ARRAY_SIZE(vc0321_mode);
2022 } else {
2023 if (sensor != SENSOR_PO1200) {
2024 cam->cam_mode = vc0323_mode;
2025 cam->nmodes = ARRAY_SIZE(vc0323_mode);
2026 } else {
2027 cam->cam_mode = svga_mode;
2028 cam->nmodes = ARRAY_SIZE(svga_mode);
2029 }
2030 }
2031
2032 sd->hflip = HFLIP_DEF;
2033 sd->vflip = VFLIP_DEF;
2034 if (sd->sensor == SENSOR_OV7670) {
2035 sd->hflip = 1;
2036 sd->vflip = 1;
2037 }
1465 sd->lightfreq = FREQ_DEF; 2038 sd->lightfreq = FREQ_DEF;
1466 if (sd->sensor != SENSOR_OV7670) 2039 if (sd->sensor != SENSOR_OV7670)
1467 gspca_dev->ctrl_dis = (1 << LIGHTFREQ_IDX); 2040 gspca_dev->ctrl_dis = (1 << LIGHTFREQ_IDX);
2041 switch (sd->sensor) {
2042 case SENSOR_OV7660:
2043 case SENSOR_OV7670:
2044 case SENSOR_PO1200:
2045 break;
2046 default:
2047 gspca_dev->ctrl_dis = (1 << HFLIP_IDX)
2048 | (1 << VFLIP_IDX);
2049 break;
2050 }
2051
2052 sd->sharpness = SHARPNESS_DEF;
1468 2053
1469 if (sd->bridge == BRIDGE_VC0321) { 2054 if (sd->bridge == BRIDGE_VC0321) {
1470 reg_r(gspca_dev, 0x8a, 0, 3); 2055 reg_r(gspca_dev, 0x8a, 0, 3);
@@ -1482,12 +2067,33 @@ static int sd_init(struct gspca_dev *gspca_dev)
1482 return 0; 2067 return 0;
1483} 2068}
1484 2069
1485static void setquality(struct gspca_dev *gspca_dev) 2070/* for OV7660 and OV7670 only */
2071static void sethvflip(struct gspca_dev *gspca_dev)
1486{ 2072{
1487} 2073 struct sd *sd = (struct sd *) gspca_dev;
2074 __u8 data;
1488 2075
1489static void setautogain(struct gspca_dev *gspca_dev) 2076 switch (sd->sensor) {
1490{ 2077 case SENSOR_OV7660:
2078 data = 1;
2079 break;
2080 case SENSOR_OV7670:
2081 data = 7;
2082 break;
2083 case SENSOR_PO1200:
2084 data = 0;
2085 i2c_write(gspca_dev, 0x03, &data, 1);
2086 data = 0x80 * sd->hflip
2087 | 0x40 * sd->vflip
2088 | 0x06;
2089 i2c_write(gspca_dev, 0x1e, &data, 1);
2090 return;
2091 default:
2092 return;
2093 }
2094 data |= OV7660_MVFP_MIRROR * sd->hflip
2095 | OV7660_MVFP_VFLIP * sd->vflip;
2096 i2c_write(gspca_dev, OV7660_REG_MVFP, &data, 1);
1491} 2097}
1492 2098
1493static void setlightfreq(struct gspca_dev *gspca_dev) 2099static void setlightfreq(struct gspca_dev *gspca_dev)
@@ -1501,6 +2107,20 @@ static void setlightfreq(struct gspca_dev *gspca_dev)
1501 usb_exchange(gspca_dev, ov7660_freq_tb[sd->lightfreq]); 2107 usb_exchange(gspca_dev, ov7660_freq_tb[sd->lightfreq]);
1502} 2108}
1503 2109
2110/* po1200 only */
2111static void setsharpness(struct gspca_dev *gspca_dev)
2112{
2113 struct sd *sd = (struct sd *) gspca_dev;
2114 __u8 data;
2115
2116 if (sd->sensor != SENSOR_PO1200)
2117 return;
2118 data = 0;
2119 i2c_write(gspca_dev, 0x03, &data, 1);
2120 data = 0xb5 + sd->sharpness * 3;
2121 i2c_write(gspca_dev, 0x61, &data, 1);
2122}
2123
1504static int sd_start(struct gspca_dev *gspca_dev) 2124static int sd_start(struct gspca_dev *gspca_dev)
1505{ 2125{
1506 struct sd *sd = (struct sd *) gspca_dev; 2126 struct sd *sd = (struct sd *) gspca_dev;
@@ -1551,6 +2171,17 @@ static int sd_start(struct gspca_dev *gspca_dev)
1551 usb_exchange(gspca_dev, ov7670_initVGA_JPG); 2171 usb_exchange(gspca_dev, ov7670_initVGA_JPG);
1552 } 2172 }
1553 break; 2173 break;
2174 case SENSOR_MI0360:
2175 GammaT = mi1320_gamma;
2176 MatrixT = mi0360_matrix;
2177 if (mode) {
2178 /* 320x240 */
2179 usb_exchange(gspca_dev, mi0360_initQVGA_JPG);
2180 } else {
2181 /* 640x480 */
2182 usb_exchange(gspca_dev, mi0360_initVGA_JPG);
2183 }
2184 break;
1554 case SENSOR_MI1310_SOC: 2185 case SENSOR_MI1310_SOC:
1555 if (mode) { 2186 if (mode) {
1556 /* 320x240 */ 2187 /* 320x240 */
@@ -1583,6 +2214,11 @@ static int sd_start(struct gspca_dev *gspca_dev)
1583 } 2214 }
1584 usb_exchange(gspca_dev, po3130_rundata); 2215 usb_exchange(gspca_dev, po3130_rundata);
1585 break; 2216 break;
2217 case SENSOR_PO1200:
2218 GammaT = po1200_gamma;
2219 MatrixT = po1200_matrix;
2220 usb_exchange(gspca_dev, po1200_initVGA_data);
2221 break;
1586 default: 2222 default:
1587 PDEBUG(D_PROBE, "Damned !! no sensor found Bye"); 2223 PDEBUG(D_PROBE, "Damned !! no sensor found Bye");
1588 return -EMEDIUMTYPE; 2224 return -EMEDIUMTYPE;
@@ -1615,11 +2251,16 @@ static int sd_start(struct gspca_dev *gspca_dev)
1615 reg_w(gspca_dev->dev, 0xa0, 0x23, 0xb800); * ISP CTRL_BAS 2251 reg_w(gspca_dev->dev, 0xa0, 0x23, 0xb800); * ISP CTRL_BAS
1616 */ 2252 */
1617 /* set the led on 0x0892 0x0896 */ 2253 /* set the led on 0x0892 0x0896 */
1618 reg_w(gspca_dev->dev, 0x89, 0xffff, 0xfdff); 2254 if (sd->sensor != SENSOR_PO1200) {
1619 msleep(100); 2255 reg_w(gspca_dev->dev, 0x89, 0xffff, 0xfdff);
1620 setquality(gspca_dev); 2256 msleep(100);
1621 setautogain(gspca_dev); 2257 sethvflip(gspca_dev);
1622 setlightfreq(gspca_dev); 2258 setlightfreq(gspca_dev);
2259 } else {
2260 setsharpness(gspca_dev);
2261 sethvflip(gspca_dev);
2262 reg_w(gspca_dev->dev, 0x89, 0x0400, 0x1415);
2263 }
1623 } 2264 }
1624 return 0; 2265 return 0;
1625} 2266}
@@ -1665,24 +2306,48 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
1665 data, len); 2306 data, len);
1666 return; 2307 return;
1667 } 2308 }
2309
2310 /* The vc0321 sends some additional data after sending the complete
2311 * frame, we ignore this. */
2312 if (sd->bridge == BRIDGE_VC0321
2313 && len > frame->v4l2_buf.length - (frame->data_end - frame->data))
2314 len = frame->v4l2_buf.length - (frame->data_end - frame->data);
1668 gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len); 2315 gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len);
1669} 2316}
1670 2317
1671static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val) 2318static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val)
2319{
2320 struct sd *sd = (struct sd *) gspca_dev;
2321
2322 sd->hflip = val;
2323 if (gspca_dev->streaming)
2324 sethvflip(gspca_dev);
2325 return 0;
2326}
2327
2328static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val)
2329{
2330 struct sd *sd = (struct sd *) gspca_dev;
2331
2332 *val = sd->hflip;
2333 return 0;
2334}
2335
2336static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val)
1672{ 2337{
1673 struct sd *sd = (struct sd *) gspca_dev; 2338 struct sd *sd = (struct sd *) gspca_dev;
1674 2339
1675 sd->autogain = val; 2340 sd->vflip = val;
1676 if (gspca_dev->streaming) 2341 if (gspca_dev->streaming)
1677 setautogain(gspca_dev); 2342 sethvflip(gspca_dev);
1678 return 0; 2343 return 0;
1679} 2344}
1680 2345
1681static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val) 2346static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val)
1682{ 2347{
1683 struct sd *sd = (struct sd *) gspca_dev; 2348 struct sd *sd = (struct sd *) gspca_dev;
1684 2349
1685 *val = sd->autogain; 2350 *val = sd->vflip;
1686 return 0; 2351 return 0;
1687} 2352}
1688 2353
@@ -1704,6 +2369,24 @@ static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val)
1704 return 0; 2369 return 0;
1705} 2370}
1706 2371
2372static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val)
2373{
2374 struct sd *sd = (struct sd *) gspca_dev;
2375
2376 sd->sharpness = val;
2377 if (gspca_dev->streaming)
2378 setsharpness(gspca_dev);
2379 return 0;
2380}
2381
2382static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val)
2383{
2384 struct sd *sd = (struct sd *) gspca_dev;
2385
2386 *val = sd->sharpness;
2387 return 0;
2388}
2389
1707static int sd_querymenu(struct gspca_dev *gspca_dev, 2390static int sd_querymenu(struct gspca_dev *gspca_dev,
1708 struct v4l2_querymenu *menu) 2391 struct v4l2_querymenu *menu)
1709{ 2392{
@@ -1743,11 +2426,13 @@ static const struct sd_desc sd_desc = {
1743static const __devinitdata struct usb_device_id device_table[] = { 2426static const __devinitdata struct usb_device_id device_table[] = {
1744 {USB_DEVICE(0x046d, 0x0892), .driver_info = BRIDGE_VC0321}, 2427 {USB_DEVICE(0x046d, 0x0892), .driver_info = BRIDGE_VC0321},
1745 {USB_DEVICE(0x046d, 0x0896), .driver_info = BRIDGE_VC0321}, 2428 {USB_DEVICE(0x046d, 0x0896), .driver_info = BRIDGE_VC0321},
2429 {USB_DEVICE(0x046d, 0x0897), .driver_info = BRIDGE_VC0321},
1746 {USB_DEVICE(0x0ac8, 0x0321), .driver_info = BRIDGE_VC0321}, 2430 {USB_DEVICE(0x0ac8, 0x0321), .driver_info = BRIDGE_VC0321},
1747 {USB_DEVICE(0x0ac8, 0x0323), .driver_info = BRIDGE_VC0323}, 2431 {USB_DEVICE(0x0ac8, 0x0323), .driver_info = BRIDGE_VC0323},
1748 {USB_DEVICE(0x0ac8, 0x0328), .driver_info = BRIDGE_VC0321}, 2432 {USB_DEVICE(0x0ac8, 0x0328), .driver_info = BRIDGE_VC0321},
1749 {USB_DEVICE(0x0ac8, 0xc001), .driver_info = BRIDGE_VC0321}, 2433 {USB_DEVICE(0x0ac8, 0xc001), .driver_info = BRIDGE_VC0321},
1750 {USB_DEVICE(0x0ac8, 0xc002), .driver_info = BRIDGE_VC0321}, 2434 {USB_DEVICE(0x0ac8, 0xc002), .driver_info = BRIDGE_VC0321},
2435 {USB_DEVICE(0x15b8, 0x6002), .driver_info = BRIDGE_VC0323},
1751 {USB_DEVICE(0x17ef, 0x4802), .driver_info = BRIDGE_VC0323}, 2436 {USB_DEVICE(0x17ef, 0x4802), .driver_info = BRIDGE_VC0323},
1752 {} 2437 {}
1753}; 2438};