aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/mr97310a.c
diff options
context:
space:
mode:
authorTheodore Kilgore <kilgota@banach.math.auburn.edu>2010-01-15 03:54:36 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-02-26 13:11:07 -0500
commitc260fe936de6a52010a3247f9c3e8da47d9726e8 (patch)
treeb357908f7e3f98c1d56e2a6c8a1b8eaebd27c174 /drivers/media/video/gspca/mr97310a.c
parentc1ea5b7424e4d1d3f56de1504a257ec2419259e8 (diff)
V4L/DVB: gspca_mr97310a: Simplify sensor detection
Simplify sensor detection a bit (share more of the code between cif and vga cameras). Also remove an unnecessary write from zero_the_pointer(). Signed-off-by: Theodore Kilgore <kilgota@banach.math.auburn.edu> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/mr97310a.c')
-rw-r--r--drivers/media/video/gspca/mr97310a.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/media/video/gspca/mr97310a.c b/drivers/media/video/gspca/mr97310a.c
index d842e8184426..959ea2a530a4 100644
--- a/drivers/media/video/gspca/mr97310a.c
+++ b/drivers/media/video/gspca/mr97310a.c
@@ -327,7 +327,6 @@ static int zero_the_pointer(struct gspca_dev *gspca_dev)
327 if (err_code < 0) 327 if (err_code < 0)
328 return err_code; 328 return err_code;
329 329
330 err_code = mr_write(gspca_dev, 1);
331 data[0] = 0x19; 330 data[0] = 0x19;
332 data[1] = 0x51; 331 data[1] = 0x51;
333 err_code = mr_write(gspca_dev, 2); 332 err_code = mr_write(gspca_dev, 2);
@@ -460,12 +459,14 @@ static int sd_config(struct gspca_dev *gspca_dev,
460 if (err_code < 0) 459 if (err_code < 0)
461 return err_code; 460 return err_code;
462 461
462 /* Now, the query for sensor type. */
463 err_code = cam_get_response16(gspca_dev, 0x07, 1);
464 if (err_code < 0)
465 return err_code;
466
463 if (id->idProduct == 0x0110 || id->idProduct == 0x010e) { 467 if (id->idProduct == 0x0110 || id->idProduct == 0x010e) {
464 sd->cam_type = CAM_TYPE_CIF; 468 sd->cam_type = CAM_TYPE_CIF;
465 cam->nmodes--; 469 cam->nmodes--;
466 err_code = cam_get_response16(gspca_dev, 0x06, 1);
467 if (err_code < 0)
468 return err_code;
469 /* 470 /*
470 * All but one of the known CIF cameras share the same USB ID, 471 * All but one of the known CIF cameras share the same USB ID,
471 * but two different init routines are in use, and the control 472 * but two different init routines are in use, and the control
@@ -473,7 +474,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
473 * of the two known varieties is connected! 474 * of the two known varieties is connected!
474 * 475 *
475 * A list of known CIF cameras follows. They all report either 476 * A list of known CIF cameras follows. They all report either
476 * 0002 for type 0 or 0003 for type 1. 477 * 0200 for type 0 or 0300 for type 1.
477 * If you have another to report, please do 478 * If you have another to report, please do
478 * 479 *
479 * Name sd->sensor_type reported by 480 * Name sd->sensor_type reported by
@@ -487,7 +488,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
487 * Philips dig. keych. 1 T. Kilgore 488 * Philips dig. keych. 1 T. Kilgore
488 * Trust Spyc@m 100 1 A. Jacobs 489 * Trust Spyc@m 100 1 A. Jacobs
489 */ 490 */
490 switch (gspca_dev->usb_buf[1]) { 491 switch (gspca_dev->usb_buf[0]) {
491 case 2: 492 case 2:
492 sd->sensor_type = 0; 493 sd->sensor_type = 0;
493 break; 494 break;
@@ -504,13 +505,9 @@ static int sd_config(struct gspca_dev *gspca_dev,
504 } else { 505 } else {
505 sd->cam_type = CAM_TYPE_VGA; 506 sd->cam_type = CAM_TYPE_VGA;
506 507
507 err_code = cam_get_response16(gspca_dev, 0x07, 1);
508 if (err_code < 0)
509 return err_code;
510
511 /* 508 /*
512 * Here is a table of the responses to the previous command 509 * Here is a table of the responses to the query for sensor
513 * from the known MR97310A VGA cameras. 510 * type, from the known MR97310A VGA cameras.
514 * 511 *
515 * Name gspca_dev->usb_buf[] sd->sensor_type 512 * Name gspca_dev->usb_buf[] sd->sensor_type
516 * sd->do_lcd_stop 513 * sd->do_lcd_stop
@@ -560,7 +557,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
560 PDEBUG(D_PROBE, "MR97310A VGA camera detected, sensor: %d", 557 PDEBUG(D_PROBE, "MR97310A VGA camera detected, sensor: %d",
561 sd->sensor_type); 558 sd->sensor_type);
562 } 559 }
563 /* Stop streaming as we've started it to probe the sensor type. */ 560 /* Stop streaming as we've started it only to probe the sensor type. */
564 sd_stopN(gspca_dev); 561 sd_stopN(gspca_dev);
565 562
566 if (force_sensor_type != -1) { 563 if (force_sensor_type != -1) {