diff options
Diffstat (limited to 'drivers/media/video/gspca/ov534.c')
-rw-r--r-- | drivers/media/video/gspca/ov534.c | 277 |
1 files changed, 196 insertions, 81 deletions
diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c index 19e0bc60de14..4b528b372911 100644 --- a/drivers/media/video/gspca/ov534.c +++ b/drivers/media/video/gspca/ov534.c | |||
@@ -60,10 +60,23 @@ struct sd { | |||
60 | static struct ctrl sd_ctrls[] = { | 60 | static struct ctrl sd_ctrls[] = { |
61 | }; | 61 | }; |
62 | 62 | ||
63 | static const struct v4l2_pix_format vga_mode[] = { | 63 | static const struct v4l2_pix_format vga_yuyv_mode[] = { |
64 | {640, 480, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, | 64 | {640, 480, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, |
65 | .bytesperline = 640 * 2, | 65 | .bytesperline = 640 * 2, |
66 | .sizeimage = 640 * 480 * 2, | 66 | .sizeimage = 640 * 480 * 2, |
67 | .colorspace = V4L2_COLORSPACE_SRGB, | ||
68 | .priv = 0}, | ||
69 | }; | ||
70 | |||
71 | static const struct v4l2_pix_format vga_jpeg_mode[] = { | ||
72 | {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, | ||
73 | .bytesperline = 320, | ||
74 | .sizeimage = 320 * 240 * 3 / 8 + 590, | ||
75 | .colorspace = V4L2_COLORSPACE_JPEG, | ||
76 | .priv = 1}, | ||
77 | {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, | ||
78 | .bytesperline = 640, | ||
79 | .sizeimage = 640 * 480 * 3 / 8 + 590, | ||
67 | .colorspace = V4L2_COLORSPACE_JPEG, | 80 | .colorspace = V4L2_COLORSPACE_JPEG, |
68 | .priv = 0}, | 81 | .priv = 0}, |
69 | }; | 82 | }; |
@@ -244,7 +257,7 @@ static const u8 bridge_init_ov965x[][2] = { | |||
244 | }; | 257 | }; |
245 | 258 | ||
246 | static const u8 sensor_init_ov965x[][2] = { | 259 | static const u8 sensor_init_ov965x[][2] = { |
247 | {0x12, 0x80}, /* com7 - reset */ | 260 | {0x12, 0x80}, /* com7 - SSCB reset */ |
248 | {0x00, 0x00}, /* gain */ | 261 | {0x00, 0x00}, /* gain */ |
249 | {0x01, 0x80}, /* blue */ | 262 | {0x01, 0x80}, /* blue */ |
250 | {0x02, 0x80}, /* red */ | 263 | {0x02, 0x80}, /* red */ |
@@ -254,10 +267,10 @@ static const u8 sensor_init_ov965x[][2] = { | |||
254 | {0x0e, 0x61}, /* com5 */ | 267 | {0x0e, 0x61}, /* com5 */ |
255 | {0x0f, 0x42}, /* com6 */ | 268 | {0x0f, 0x42}, /* com6 */ |
256 | {0x11, 0x00}, /* clkrc */ | 269 | {0x11, 0x00}, /* clkrc */ |
257 | {0x12, 0x02}, /* com7 */ | 270 | {0x12, 0x02}, /* com7 - 15fps VGA YUYV */ |
258 | {0x13, 0xe7}, /* com8 - everything (AGC, AWB and AEC) */ | 271 | {0x13, 0xe7}, /* com8 - everything (AGC, AWB and AEC) */ |
259 | {0x14, 0x28}, /* com9 */ | 272 | {0x14, 0x28}, /* com9 */ |
260 | {0x16, 0x24}, /* rsvd16 */ | 273 | {0x16, 0x24}, /* reg16 */ |
261 | {0x17, 0x1d}, /* hstart*/ | 274 | {0x17, 0x1d}, /* hstart*/ |
262 | {0x18, 0xbd}, /* hstop */ | 275 | {0x18, 0xbd}, /* hstop */ |
263 | {0x19, 0x01}, /* vstrt */ | 276 | {0x19, 0x01}, /* vstrt */ |
@@ -269,24 +282,24 @@ static const u8 sensor_init_ov965x[][2] = { | |||
269 | {0x27, 0x08}, /* bbias */ | 282 | {0x27, 0x08}, /* bbias */ |
270 | {0x28, 0x08}, /* gbbias */ | 283 | {0x28, 0x08}, /* gbbias */ |
271 | {0x29, 0x15}, /* gr com */ | 284 | {0x29, 0x15}, /* gr com */ |
272 | {0x2a, 0x00}, | 285 | {0x2a, 0x00}, /* exhch */ |
273 | {0x2b, 0x00}, | 286 | {0x2b, 0x00}, /* exhcl */ |
274 | {0x2c, 0x08}, /* rbias */ | 287 | {0x2c, 0x08}, /* rbias */ |
275 | {0x32, 0xff}, /* href */ | 288 | {0x32, 0xff}, /* href */ |
276 | {0x33, 0x00}, /* chlf */ | 289 | {0x33, 0x00}, /* chlf */ |
277 | {0x34, 0x3f}, /* arblm */ | 290 | {0x34, 0x3f}, /* aref1 */ |
278 | {0x35, 0x00}, /* rsvd35 */ | 291 | {0x35, 0x00}, /* aref2 */ |
279 | {0x36, 0xf8}, /* rsvd36 */ | 292 | {0x36, 0xf8}, /* aref3 */ |
280 | {0x38, 0x72}, /* acom38 */ | 293 | {0x38, 0x72}, /* adc2 */ |
281 | {0x39, 0x57}, /* ofon */ | 294 | {0x39, 0x57}, /* aref4 */ |
282 | {0x3a, 0x80}, /* tslb */ | 295 | {0x3a, 0x80}, /* tslb - yuyv */ |
283 | {0x3b, 0xc4}, | 296 | {0x3b, 0xc4}, /* com11 - night mode 1/4 frame rate */ |
284 | {0x3d, 0x99}, /* com13 */ | 297 | {0x3d, 0x99}, /* com13 */ |
285 | {0x3f, 0xc1}, | 298 | {0x3f, 0xc1}, /* edge */ |
286 | {0x40, 0xc0}, /* com15 */ | 299 | {0x40, 0xc0}, /* com15 */ |
287 | {0x41, 0x40}, /* com16 */ | 300 | {0x41, 0x40}, /* com16 */ |
288 | {0x42, 0xc0}, | 301 | {0x42, 0xc0}, /* com17 */ |
289 | {0x43, 0x0a}, | 302 | {0x43, 0x0a}, /* rsvd */ |
290 | {0x44, 0xf0}, | 303 | {0x44, 0xf0}, |
291 | {0x45, 0x46}, | 304 | {0x45, 0x46}, |
292 | {0x46, 0x62}, | 305 | {0x46, 0x62}, |
@@ -297,22 +310,22 @@ static const u8 sensor_init_ov965x[][2] = { | |||
297 | {0x4c, 0x7f}, | 310 | {0x4c, 0x7f}, |
298 | {0x4d, 0x7f}, | 311 | {0x4d, 0x7f}, |
299 | {0x4e, 0x7f}, | 312 | {0x4e, 0x7f}, |
300 | {0x4f, 0x98}, | 313 | {0x4f, 0x98}, /* matrix */ |
301 | {0x50, 0x98}, | 314 | {0x50, 0x98}, |
302 | {0x51, 0x00}, | 315 | {0x51, 0x00}, |
303 | {0x52, 0x28}, | 316 | {0x52, 0x28}, |
304 | {0x53, 0x70}, | 317 | {0x53, 0x70}, |
305 | {0x54, 0x98}, | 318 | {0x54, 0x98}, |
306 | {0x58, 0x1a}, | 319 | {0x58, 0x1a}, /* matrix coef sign */ |
307 | {0x59, 0x85}, | 320 | {0x59, 0x85}, /* AWB control */ |
308 | {0x5a, 0xa9}, | 321 | {0x5a, 0xa9}, |
309 | {0x5b, 0x64}, | 322 | {0x5b, 0x64}, |
310 | {0x5c, 0x84}, | 323 | {0x5c, 0x84}, |
311 | {0x5d, 0x53}, | 324 | {0x5d, 0x53}, |
312 | {0x5e, 0x0e}, | 325 | {0x5e, 0x0e}, |
313 | {0x5f, 0xf0}, | 326 | {0x5f, 0xf0}, /* AWB blue limit */ |
314 | {0x60, 0xf0}, | 327 | {0x60, 0xf0}, /* AWB red limit */ |
315 | {0x61, 0xf0}, | 328 | {0x61, 0xf0}, /* AWB green limit */ |
316 | {0x62, 0x00}, /* lcc1 */ | 329 | {0x62, 0x00}, /* lcc1 */ |
317 | {0x63, 0x00}, /* lcc2 */ | 330 | {0x63, 0x00}, /* lcc2 */ |
318 | {0x64, 0x02}, /* lcc3 */ | 331 | {0x64, 0x02}, /* lcc3 */ |
@@ -324,15 +337,15 @@ static const u8 sensor_init_ov965x[][2] = { | |||
324 | {0x6d, 0x55}, | 337 | {0x6d, 0x55}, |
325 | {0x6e, 0x00}, | 338 | {0x6e, 0x00}, |
326 | {0x6f, 0x9d}, | 339 | {0x6f, 0x9d}, |
327 | {0x70, 0x21}, | 340 | {0x70, 0x21}, /* dnsth */ |
328 | {0x71, 0x78}, | 341 | {0x71, 0x78}, |
329 | {0x72, 0x00}, | 342 | {0x72, 0x00}, /* poidx */ |
330 | {0x73, 0x01}, | 343 | {0x73, 0x01}, /* pckdv */ |
331 | {0x74, 0x3a}, | 344 | {0x74, 0x3a}, /* xindx */ |
332 | {0x75, 0x35}, | 345 | {0x75, 0x35}, /* yindx */ |
333 | {0x76, 0x01}, | 346 | {0x76, 0x01}, |
334 | {0x77, 0x02}, | 347 | {0x77, 0x02}, |
335 | {0x7a, 0x12}, | 348 | {0x7a, 0x12}, /* gamma curve */ |
336 | {0x7b, 0x08}, | 349 | {0x7b, 0x08}, |
337 | {0x7c, 0x16}, | 350 | {0x7c, 0x16}, |
338 | {0x7d, 0x30}, | 351 | {0x7d, 0x30}, |
@@ -349,33 +362,33 @@ static const u8 sensor_init_ov965x[][2] = { | |||
349 | {0x88, 0xe6}, | 362 | {0x88, 0xe6}, |
350 | {0x89, 0xf2}, | 363 | {0x89, 0xf2}, |
351 | {0x8a, 0x03}, | 364 | {0x8a, 0x03}, |
352 | {0x8c, 0x89}, | 365 | {0x8c, 0x89}, /* com19 */ |
353 | {0x14, 0x28}, /* com9 */ | 366 | {0x14, 0x28}, /* com9 */ |
354 | {0x90, 0x7d}, | 367 | {0x90, 0x7d}, |
355 | {0x91, 0x7b}, | 368 | {0x91, 0x7b}, |
356 | {0x9d, 0x03}, | 369 | {0x9d, 0x03}, /* lcc6 */ |
357 | {0x9e, 0x04}, | 370 | {0x9e, 0x04}, /* lcc7 */ |
358 | {0x9f, 0x7a}, | 371 | {0x9f, 0x7a}, |
359 | {0xa0, 0x79}, | 372 | {0xa0, 0x79}, |
360 | {0xa1, 0x40}, /* aechm */ | 373 | {0xa1, 0x40}, /* aechm */ |
361 | {0xa4, 0x50}, | 374 | {0xa4, 0x50}, /* com21 */ |
362 | {0xa5, 0x68}, /* com26 */ | 375 | {0xa5, 0x68}, /* com26 */ |
363 | {0xa6, 0x4a}, | 376 | {0xa6, 0x4a}, /* AWB green */ |
364 | {0xa8, 0xc1}, /* acoma8 */ | 377 | {0xa8, 0xc1}, /* refa8 */ |
365 | {0xa9, 0xef}, /* acoma9 */ | 378 | {0xa9, 0xef}, /* refa9 */ |
366 | {0xaa, 0x92}, | 379 | {0xaa, 0x92}, |
367 | {0xab, 0x04}, | 380 | {0xab, 0x04}, |
368 | {0xac, 0x80}, | 381 | {0xac, 0x80}, /* black level control */ |
369 | {0xad, 0x80}, | 382 | {0xad, 0x80}, |
370 | {0xae, 0x80}, | 383 | {0xae, 0x80}, |
371 | {0xaf, 0x80}, | 384 | {0xaf, 0x80}, |
372 | {0xb2, 0xf2}, | 385 | {0xb2, 0xf2}, |
373 | {0xb3, 0x20}, | 386 | {0xb3, 0x20}, |
374 | {0xb4, 0x20}, | 387 | {0xb4, 0x20}, /* ctrlb4 */ |
375 | {0xb5, 0x00}, | 388 | {0xb5, 0x00}, |
376 | {0xb6, 0xaf}, | 389 | {0xb6, 0xaf}, |
377 | {0xbb, 0xae}, | 390 | {0xbb, 0xae}, |
378 | {0xbc, 0x7f}, | 391 | {0xbc, 0x7f}, /* ADC channel offsets */ |
379 | {0xdb, 0x7f}, | 392 | {0xdb, 0x7f}, |
380 | {0xbe, 0x7f}, | 393 | {0xbe, 0x7f}, |
381 | {0xbf, 0x7f}, | 394 | {0xbf, 0x7f}, |
@@ -384,7 +397,7 @@ static const u8 sensor_init_ov965x[][2] = { | |||
384 | {0xc2, 0x01}, | 397 | {0xc2, 0x01}, |
385 | {0xc3, 0x4e}, | 398 | {0xc3, 0x4e}, |
386 | {0xc6, 0x85}, | 399 | {0xc6, 0x85}, |
387 | {0xc7, 0x80}, | 400 | {0xc7, 0x80}, /* com24 */ |
388 | {0xc9, 0xe0}, | 401 | {0xc9, 0xe0}, |
389 | {0xca, 0xe8}, | 402 | {0xca, 0xe8}, |
390 | {0xcb, 0xf0}, | 403 | {0xcb, 0xf0}, |
@@ -399,11 +412,11 @@ static const u8 sensor_init_ov965x[][2] = { | |||
399 | {0x58, 0x1a}, | 412 | {0x58, 0x1a}, |
400 | {0xff, 0x41}, /* read 41, write ff 00 */ | 413 | {0xff, 0x41}, /* read 41, write ff 00 */ |
401 | {0x41, 0x40}, /* com16 */ | 414 | {0x41, 0x40}, /* com16 */ |
402 | {0xc5, 0x03}, | 415 | {0xc5, 0x03}, /* 60 Hz banding filter */ |
403 | {0x6a, 0x02}, | 416 | {0x6a, 0x02}, /* 50 Hz banding filter */ |
404 | 417 | ||
405 | {0x12, 0x62}, /* com7 - VGA + CIF */ | 418 | {0x12, 0x62}, /* com7 - 30fps VGA YUV */ |
406 | {0x36, 0xfa}, /* rsvd36 */ | 419 | {0x36, 0xfa}, /* aref3 */ |
407 | {0x69, 0x0a}, /* hv */ | 420 | {0x69, 0x0a}, /* hv */ |
408 | {0x8c, 0x89}, /* com22 */ | 421 | {0x8c, 0x89}, /* com22 */ |
409 | {0x14, 0x28}, /* com9 */ | 422 | {0x14, 0x28}, /* com9 */ |
@@ -442,8 +455,8 @@ static const u8 bridge_init_ov965x_2[][2] = { | |||
442 | {0x52, 0x3c}, | 455 | {0x52, 0x3c}, |
443 | {0x53, 0x00}, | 456 | {0x53, 0x00}, |
444 | {0x54, 0x00}, | 457 | {0x54, 0x00}, |
445 | {0x55, 0x00}, | 458 | {0x55, 0x00}, /* brightness */ |
446 | {0x57, 0x00}, | 459 | {0x57, 0x00}, /* contrast 2 */ |
447 | {0x5c, 0x00}, | 460 | {0x5c, 0x00}, |
448 | {0x5a, 0xa0}, | 461 | {0x5a, 0xa0}, |
449 | {0x5b, 0x78}, | 462 | {0x5b, 0x78}, |
@@ -489,9 +502,66 @@ static const u8 sensor_init_ov965x_2[][2] = { | |||
489 | {0x13, 0xe7}, /* com8 - everything (AGC, AWB and AEC) */ | 502 | {0x13, 0xe7}, /* com8 - everything (AGC, AWB and AEC) */ |
490 | }; | 503 | }; |
491 | 504 | ||
505 | static const u8 sensor_start_ov965x[][2] = { | ||
506 | {0x12, 0x62}, /* com7 - 30fps VGA YUV */ | ||
507 | {0x36, 0xfa}, /* aref3 */ | ||
508 | {0x69, 0x0a}, /* hv */ | ||
509 | {0x8c, 0x89}, /* com22 */ | ||
510 | {0x14, 0x28}, /* com9 */ | ||
511 | {0x3e, 0x0c}, /* com14 */ | ||
512 | {0x41, 0x40}, /* com16 */ | ||
513 | {0x72, 0x00}, | ||
514 | {0x73, 0x00}, | ||
515 | {0x74, 0x3a}, | ||
516 | {0x75, 0x35}, | ||
517 | {0x76, 0x01}, | ||
518 | {0xc7, 0x80}, /* com24 */ | ||
519 | {0x03, 0x12}, /* vref */ | ||
520 | {0x17, 0x16}, /* hstart */ | ||
521 | {0x18, 0x02}, /* hstop */ | ||
522 | {0x19, 0x01}, /* vstrt */ | ||
523 | {0x1a, 0x3d}, /* vstop */ | ||
524 | {0x32, 0xff}, /* href */ | ||
525 | {0xc0, 0xaa}, | ||
526 | {} | ||
527 | }; | ||
528 | |||
492 | static const u8 bridge_start_ov965x[][2] = { | 529 | static const u8 bridge_start_ov965x[][2] = { |
530 | {0x94, 0xaa}, | ||
531 | {0xf1, 0x60}, | ||
532 | {0xe5, 0x04}, | ||
533 | {0xc0, 0x50}, | ||
534 | {0xc1, 0x3c}, | ||
535 | {0x8c, 0x00}, | ||
536 | {0x8d, 0x1c}, | ||
537 | {0x34, 0x05}, | ||
538 | {} | ||
539 | }; | ||
540 | |||
541 | static const u8 bridge_start_ov965x_vga[][2] = { | ||
542 | {0xc2, 0x0c}, | ||
543 | {0xc3, 0xf9}, | ||
544 | {0xda, 0x01}, | ||
545 | {0x50, 0x00}, | ||
546 | {0x51, 0xa0}, | ||
547 | {0x52, 0x3c}, | ||
548 | {0x53, 0x00}, | ||
549 | {0x54, 0x00}, | ||
550 | {0x55, 0x00}, | ||
551 | {0x57, 0x00}, | ||
552 | {0x5c, 0x00}, | ||
553 | {0x5a, 0xa0}, | ||
554 | {0x5b, 0x78}, | ||
555 | {0x35, 0x02}, | ||
556 | {0xd9, 0x10}, | ||
557 | {0x94, 0x11}, | ||
558 | {} | ||
559 | }; | ||
560 | |||
561 | static const u8 bridge_start_ov965x_cif[][2] = { | ||
493 | {0xc2, 0x4c}, | 562 | {0xc2, 0x4c}, |
494 | {0xc3, 0xf9}, | 563 | {0xc3, 0xf9}, |
564 | {0xda, 0x00}, | ||
495 | {0x50, 0x00}, | 565 | {0x50, 0x00}, |
496 | {0x51, 0xa0}, | 566 | {0x51, 0xa0}, |
497 | {0x52, 0x78}, | 567 | {0x52, 0x78}, |
@@ -500,30 +570,54 @@ static const u8 bridge_start_ov965x[][2] = { | |||
500 | {0x55, 0x00}, | 570 | {0x55, 0x00}, |
501 | {0x57, 0x00}, | 571 | {0x57, 0x00}, |
502 | {0x5c, 0x00}, | 572 | {0x5c, 0x00}, |
503 | {0x5a, 0x28}, | 573 | {0x5a, 0x50}, |
504 | {0x5b, 0x1e}, | 574 | {0x5b, 0x3c}, |
505 | {0x35, 0x00}, | 575 | {0x35, 0x02}, |
506 | {0xd9, 0x21}, | 576 | {0xd9, 0x10}, |
507 | {0x94, 0x11}, | 577 | {0x94, 0x11}, |
578 | {} | ||
508 | }; | 579 | }; |
509 | 580 | ||
510 | static const u8 sensor_start_ov965x[][2] = { | 581 | static const u8 sensor_start_ov965x_vga[][2] = { |
511 | {0x3b, 0xe4}, | 582 | {0x3b, 0xc4}, /* com11 - night mode 1/4 frame rate */ |
583 | {0x1e, 0x04}, /* mvfp */ | ||
584 | {0x13, 0xe0}, /* com8 */ | ||
585 | {0x00, 0x00}, | ||
586 | {0x13, 0xe7}, /* com8 - everything (AGC, AWB and AEC) */ | ||
587 | {0x11, 0x03}, /* clkrc */ | ||
588 | {0x6b, 0x5a}, /* dblv */ | ||
589 | {0x6a, 0x05}, /* 50 Hz banding filter */ | ||
590 | {0xc5, 0x07}, /* 60 Hz banding filter */ | ||
591 | {0xa2, 0x4b}, /* bd50 */ | ||
592 | {0xa3, 0x3e}, /* bd60 */ | ||
593 | |||
594 | {0x2d, 0x00}, /* advfl */ | ||
595 | {} | ||
596 | }; | ||
597 | |||
598 | static const u8 sensor_start_ov965x_cif[][2] = { | ||
599 | {0x3b, 0xe4}, /* com11 - night mode 1/4 frame rate */ | ||
512 | {0x1e, 0x04}, /* mvfp */ | 600 | {0x1e, 0x04}, /* mvfp */ |
513 | {0x13, 0xe0}, /* com8 */ | 601 | {0x13, 0xe0}, /* com8 */ |
514 | {0x00, 0x00}, | 602 | {0x00, 0x00}, |
515 | {0x13, 0xe7}, /* com8 - everything (AGC, AWB and AEC) */ | 603 | {0x13, 0xe7}, /* com8 - everything (AGC, AWB and AEC) */ |
516 | {0x11, 0x01}, /* clkrc */ | 604 | {0x11, 0x01}, /* clkrc */ |
517 | {0x6b, 0x5a}, /* dblv */ | 605 | {0x6b, 0x5a}, /* dblv */ |
518 | {0x6a, 0x02}, | 606 | {0x6a, 0x02}, /* 50 Hz banding filter */ |
519 | {0xc5, 0x03}, | 607 | {0xc5, 0x03}, /* 60 Hz banding filter */ |
520 | {0xa2, 0x96}, | 608 | {0xa2, 0x96}, /* bd50 */ |
521 | {0xa3, 0x7d}, | 609 | {0xa3, 0x7d}, /* bd60 */ |
610 | |||
522 | {0xff, 0x13}, /* read 13, write ff 00 */ | 611 | {0xff, 0x13}, /* read 13, write ff 00 */ |
523 | {0x13, 0xe7}, | 612 | {0x13, 0xe7}, |
524 | {0x3a, 0x80}, | 613 | {0x3a, 0x80}, /* tslb - yuyv */ |
614 | {} | ||
615 | }; | ||
616 | |||
617 | static const u8 sensor_start_ov965x_2[][2] = { | ||
525 | {0xff, 0x42}, /* read 42, write ff 00 */ | 618 | {0xff, 0x42}, /* read 42, write ff 00 */ |
526 | {0x42, 0xc1}, | 619 | {0x42, 0xc1}, /* com17 - 50 Hz filter */ |
620 | {} | ||
527 | }; | 621 | }; |
528 | 622 | ||
529 | 623 | ||
@@ -705,11 +799,17 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
705 | 799 | ||
706 | cam = &gspca_dev->cam; | 800 | cam = &gspca_dev->cam; |
707 | 801 | ||
708 | cam->cam_mode = vga_mode; | 802 | if (sd->sensor == SENSOR_OV772X) { |
709 | cam->nmodes = ARRAY_SIZE(vga_mode); | 803 | cam->cam_mode = vga_yuyv_mode; |
804 | cam->nmodes = ARRAY_SIZE(vga_yuyv_mode); | ||
710 | 805 | ||
711 | cam->bulk_size = 16384; | 806 | cam->bulk = 1; |
712 | cam->bulk_nurbs = 2; | 807 | cam->bulk_size = 16384; |
808 | cam->bulk_nurbs = 2; | ||
809 | } else { /* ov965x */ | ||
810 | cam->cam_mode = vga_jpeg_mode; | ||
811 | cam->nmodes = ARRAY_SIZE(vga_jpeg_mode); | ||
812 | } | ||
713 | 813 | ||
714 | return 0; | 814 | return 0; |
715 | } | 815 | } |
@@ -778,6 +878,7 @@ static int sd_init(struct gspca_dev *gspca_dev) | |||
778 | static int sd_start(struct gspca_dev *gspca_dev) | 878 | static int sd_start(struct gspca_dev *gspca_dev) |
779 | { | 879 | { |
780 | struct sd *sd = (struct sd *) gspca_dev; | 880 | struct sd *sd = (struct sd *) gspca_dev; |
881 | int mode; | ||
781 | 882 | ||
782 | switch (sd->sensor) { | 883 | switch (sd->sensor) { |
783 | case SENSOR_OV772X: | 884 | case SENSOR_OV772X: |
@@ -786,13 +887,28 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
786 | break; | 887 | break; |
787 | default: | 888 | default: |
788 | /* case SENSOR_OV965X: */ | 889 | /* case SENSOR_OV965X: */ |
789 | reg_w_array(gspca_dev, bridge_start_ov965x, | 890 | |
790 | ARRAY_SIZE(bridge_start_ov965x)); | ||
791 | sccb_w_array(gspca_dev, sensor_start_ov965x, | 891 | sccb_w_array(gspca_dev, sensor_start_ov965x, |
792 | ARRAY_SIZE(sensor_start_ov965x)); | 892 | ARRAY_SIZE(sensor_start_ov965x)); |
893 | reg_w_array(gspca_dev, bridge_start_ov965x, | ||
894 | ARRAY_SIZE(bridge_start_ov965x)); | ||
895 | mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv; | ||
896 | if (mode != 0) { /* 320x240 */ | ||
897 | reg_w_array(gspca_dev, bridge_start_ov965x_cif, | ||
898 | ARRAY_SIZE(bridge_start_ov965x_cif)); | ||
899 | sccb_w_array(gspca_dev, sensor_start_ov965x_cif, | ||
900 | ARRAY_SIZE(sensor_start_ov965x_cif)); | ||
901 | } else { /* 640x480 */ | ||
902 | reg_w_array(gspca_dev, bridge_start_ov965x_vga, | ||
903 | ARRAY_SIZE(bridge_start_ov965x_vga)); | ||
904 | sccb_w_array(gspca_dev, sensor_start_ov965x_vga, | ||
905 | ARRAY_SIZE(sensor_start_ov965x_vga)); | ||
906 | } | ||
907 | sccb_w_array(gspca_dev, sensor_start_ov965x_2, | ||
908 | ARRAY_SIZE(sensor_start_ov965x_2)); | ||
909 | ov534_reg_write(gspca_dev, 0xe0, 0x00); | ||
793 | ov534_reg_write(gspca_dev, 0xe0, 0x00); | 910 | ov534_reg_write(gspca_dev, 0xe0, 0x00); |
794 | ov534_set_led(gspca_dev, 1); | 911 | ov534_set_led(gspca_dev, 1); |
795 | /*fixme: other sensor start omitted*/ | ||
796 | } | 912 | } |
797 | return 0; | 913 | return 0; |
798 | } | 914 | } |
@@ -832,9 +948,11 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, struct gspca_frame *frame, | |||
832 | __u32 this_pts; | 948 | __u32 this_pts; |
833 | u16 this_fid; | 949 | u16 this_fid; |
834 | int remaining_len = len; | 950 | int remaining_len = len; |
951 | int payload_len; | ||
835 | 952 | ||
953 | payload_len = gspca_dev->cam.bulk ? 2048 : 2040; | ||
836 | do { | 954 | do { |
837 | len = min(remaining_len, 2040); /*fixme: was 2048*/ | 955 | len = min(remaining_len, payload_len); |
838 | 956 | ||
839 | /* Payloads are prefixed with a UVC-style header. We | 957 | /* Payloads are prefixed with a UVC-style header. We |
840 | consider a frame to start when the FID toggles, or the PTS | 958 | consider a frame to start when the FID toggles, or the PTS |
@@ -864,30 +982,27 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, struct gspca_frame *frame, | |||
864 | 982 | ||
865 | /* If PTS or FID has changed, start a new frame. */ | 983 | /* If PTS or FID has changed, start a new frame. */ |
866 | if (this_pts != sd->last_pts || this_fid != sd->last_fid) { | 984 | if (this_pts != sd->last_pts || this_fid != sd->last_fid) { |
867 | gspca_frame_add(gspca_dev, FIRST_PACKET, frame, | 985 | if (gspca_dev->last_packet_type == INTER_PACKET) |
868 | NULL, 0); | 986 | frame = gspca_frame_add(gspca_dev, |
987 | LAST_PACKET, frame, | ||
988 | NULL, 0); | ||
869 | sd->last_pts = this_pts; | 989 | sd->last_pts = this_pts; |
870 | sd->last_fid = this_fid; | 990 | sd->last_fid = this_fid; |
871 | } | 991 | gspca_frame_add(gspca_dev, FIRST_PACKET, frame, |
872 | |||
873 | /* Add the data from this payload */ | ||
874 | gspca_frame_add(gspca_dev, INTER_PACKET, frame, | ||
875 | data + 12, len - 12); | 992 | data + 12, len - 12); |
876 | |||
877 | /* If this packet is marked as EOF, end the frame */ | 993 | /* If this packet is marked as EOF, end the frame */ |
878 | if (data[1] & UVC_STREAM_EOF) { | 994 | } else if (data[1] & UVC_STREAM_EOF) { |
879 | sd->last_pts = 0; | 995 | sd->last_pts = 0; |
880 | |||
881 | if (frame->data_end - frame->data != | ||
882 | gspca_dev->width * gspca_dev->height * 2) { | ||
883 | PDEBUG(D_PACK, "short frame"); | ||
884 | goto discard; | ||
885 | } | ||
886 | |||
887 | frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame, | 996 | frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame, |
888 | NULL, 0); | 997 | data + 12, len - 12); |
998 | } else { | ||
999 | |||
1000 | /* Add the data from this payload */ | ||
1001 | gspca_frame_add(gspca_dev, INTER_PACKET, frame, | ||
1002 | data + 12, len - 12); | ||
889 | } | 1003 | } |
890 | 1004 | ||
1005 | |||
891 | /* Done this payload */ | 1006 | /* Done this payload */ |
892 | goto scan_next; | 1007 | goto scan_next; |
893 | 1008 | ||