diff options
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/gspca/mr97310a.c | 89 |
1 files changed, 34 insertions, 55 deletions
diff --git a/drivers/media/video/gspca/mr97310a.c b/drivers/media/video/gspca/mr97310a.c index f4c83b367900..abc56e37efcb 100644 --- a/drivers/media/video/gspca/mr97310a.c +++ b/drivers/media/video/gspca/mr97310a.c | |||
@@ -431,12 +431,13 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
431 | if (err_code < 0) | 431 | if (err_code < 0) |
432 | return err_code; | 432 | return err_code; |
433 | 433 | ||
434 | err_code = stream_start(gspca_dev); | ||
435 | if (err_code < 0) | ||
436 | return err_code; | ||
437 | |||
434 | if (id->idProduct == 0x010e) { | 438 | if (id->idProduct == 0x010e) { |
435 | sd->cam_type = CAM_TYPE_CIF; | 439 | sd->cam_type = CAM_TYPE_CIF; |
436 | cam->nmodes--; | 440 | cam->nmodes--; |
437 | err_code = stream_start(gspca_dev); | ||
438 | if (err_code < 0) | ||
439 | return err_code; | ||
440 | err_code = cam_get_response16(gspca_dev, 0x06, 1); | 441 | err_code = cam_get_response16(gspca_dev, 0x06, 1); |
441 | if (err_code < 0) | 442 | if (err_code < 0) |
442 | return err_code; | 443 | return err_code; |
@@ -476,74 +477,52 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
476 | } else { | 477 | } else { |
477 | sd->cam_type = CAM_TYPE_VGA; | 478 | sd->cam_type = CAM_TYPE_VGA; |
478 | 479 | ||
479 | /* | 480 | err_code = cam_get_response16(gspca_dev, 0x07, 1); |
480 | * VGA cams also have two different sensor types. Detection | ||
481 | * requires a two-step process. | ||
482 | * | ||
483 | * Here is a report on the result of the first test for the | ||
484 | * known MR97310a VGA cameras. If you have another to report, | ||
485 | * please do. | ||
486 | * | ||
487 | * Name byte just read sd->sensor_type | ||
488 | * sd->do_lcd_stop | ||
489 | * Aiptek Pencam VGA+ 0x31 0 1 | ||
490 | * ION digital 0x31 0 1 | ||
491 | * Sakar Digital 77379 0x31 0 1 | ||
492 | * Argus DC-1620 0x30 1 0 | ||
493 | * Argus QuickClix 0x30 1 1 (see note) | ||
494 | * Note that this test fails to distinguish sd->sensor_type | ||
495 | * for the two cameras which have reported 0x30. | ||
496 | * Another test will be run on them. | ||
497 | * But the sd->do_lcd_stop setting is needed, too. | ||
498 | */ | ||
499 | |||
500 | err_code = cam_get_response16(gspca_dev, 0x20, 1); | ||
501 | if (err_code < 0) | ||
502 | return err_code; | ||
503 | sd->sensor_type = gspca_dev->usb_buf[0] & 1; | ||
504 | sd->do_lcd_stop = (~gspca_dev->usb_buf[0]) & 1; | ||
505 | err_code = stream_start(gspca_dev); | ||
506 | if (err_code < 0) | 481 | if (err_code < 0) |
507 | return err_code; | 482 | return err_code; |
508 | 483 | ||
509 | /* | 484 | /* |
510 | * A second test can now resolve any remaining ambiguity in the | 485 | * Here is a table of the responses to the previous command |
511 | * identification of the camera's sensor type. Specifically, | 486 | * from the known MR97310A VGA cameras. |
512 | * it now gives the correct sensor_type for the Argus DC-1620 | ||
513 | * and the Argus QuickClix. | ||
514 | * | ||
515 | * This second test is only run if needed, | ||
516 | * but additional results from testing some other cameras | ||
517 | * are recorded here, too: | ||
518 | * | 487 | * |
519 | * Name gspca_dev->usb_buf[] sd->sensor_type | 488 | * Name gspca_dev->usb_buf[] sd->sensor_type |
489 | * sd->do_lcd_stop | ||
490 | * Aiptek Pencam VGA+ 0300 0 1 | ||
491 | * ION digital 0350 0 1 | ||
492 | * Argus DC-1620 0450 1 0 | ||
493 | * Argus QuickClix 0420 1 1 | ||
520 | * | 494 | * |
521 | * Aiptek Pencam VGA+ 0300 (test not needed) 1 | 495 | * Based upon these results, we assume default settings |
522 | * ION digital 0350 (test not needed) 1 | 496 | * and then correct as necessary, as follows. |
523 | * Argus DC-1620 0450 (remains as type 0) 0 | ||
524 | * Argus QuickClix 0420 (corrected to type 1) 1 | ||
525 | * | 497 | * |
526 | * This test even seems able to distinguish one VGA cam from | ||
527 | * another which may be useful. However, the CIF type 1 cameras | ||
528 | * do not like it. | ||
529 | */ | 498 | */ |
530 | 499 | ||
531 | if (!sd->sensor_type) { | 500 | sd->sensor_type = 1; |
532 | err_code = cam_get_response16(gspca_dev, 0x07, 1); | 501 | sd->do_lcd_stop = 0; |
533 | if (err_code < 0) | 502 | if ((gspca_dev->usb_buf[0] != 0x03) && |
534 | return err_code; | 503 | (gspca_dev->usb_buf[0] != 0x04)) { |
535 | 504 | PDEBUG(D_ERR, "Unknown VGA Sensor id Byte 0: %02x", | |
505 | gspca_dev->usb_buf[1]); | ||
506 | PDEBUG(D_ERR, "Defaults assumed, may not work"); | ||
507 | PDEBUG(D_ERR, "Please report this"); | ||
508 | } | ||
509 | if (gspca_dev->usb_buf[0] == 0x04) { | ||
510 | sd->do_lcd_stop = 1; | ||
536 | switch (gspca_dev->usb_buf[1]) { | 511 | switch (gspca_dev->usb_buf[1]) { |
537 | case 0x50: | 512 | case 0x50: |
513 | sd->sensor_type = 0; | ||
514 | PDEBUG(D_PROBE, "sensor_type corrected to 0"); | ||
538 | break; | 515 | break; |
539 | case 0x20: | 516 | case 0x20: |
540 | sd->sensor_type = 1; | 517 | /* Nothing to do here. */ |
541 | PDEBUG(D_PROBE, "sensor_type corrected to 1"); | ||
542 | break; | 518 | break; |
543 | default: | 519 | default: |
544 | PDEBUG(D_ERR, "Unknown VGA Sensor id : %02x", | 520 | PDEBUG(D_ERR, |
545 | gspca_dev->usb_buf[1]); | 521 | "Unknown VGA Sensor id Byte 1: %02x", |
546 | return -ENODEV; | 522 | gspca_dev->usb_buf[1]); |
523 | PDEBUG(D_ERR, | ||
524 | "Defaults assumed, may not work"); | ||
525 | PDEBUG(D_ERR, "Please report this"); | ||
547 | } | 526 | } |
548 | } | 527 | } |
549 | PDEBUG(D_PROBE, "MR97310A VGA camera detected, sensor: %d", | 528 | PDEBUG(D_PROBE, "MR97310A VGA camera detected, sensor: %d", |