diff options
author | Hans de Goede <hdegoede@redhat.com> | 2009-08-14 09:40:26 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-09-12 11:19:57 -0400 |
commit | 5f5e26b1e6c23f23e9b116a4439437e752e56eb7 (patch) | |
tree | 7477c10f3f95027196921ca1b7e7a4bffd9b1cd7 /drivers/media/video/gspca | |
parent | 9ac6978a10a22499f6333d55364809f4ddb32b0c (diff) |
V4L/DVB (12621): gspca_mr97310a: Move detection of CIF sensor type to probe() function
gspca_mr97310a: Move detection of CIF sensor type to probe() function,
so that the right controls are set to disabled from the start, rather then
having them disappear all of a sudden when the stream is started.
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')
-rw-r--r-- | drivers/media/video/gspca/mr97310a.c | 59 |
1 files changed, 34 insertions, 25 deletions
diff --git a/drivers/media/video/gspca/mr97310a.c b/drivers/media/video/gspca/mr97310a.c index 3bdf064699e9..1a6532fa8548 100644 --- a/drivers/media/video/gspca/mr97310a.c +++ b/drivers/media/video/gspca/mr97310a.c | |||
@@ -360,6 +360,8 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
360 | { | 360 | { |
361 | struct sd *sd = (struct sd *) gspca_dev; | 361 | struct sd *sd = (struct sd *) gspca_dev; |
362 | struct cam *cam; | 362 | struct cam *cam; |
363 | __u8 *data = gspca_dev->usb_buf; | ||
364 | int err_code; | ||
363 | 365 | ||
364 | cam = &gspca_dev->cam; | 366 | cam = &gspca_dev->cam; |
365 | cam->cam_mode = vga_mode; | 367 | cam->cam_mode = vga_mode; |
@@ -372,6 +374,38 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
372 | if (id->idProduct == 0x010e) { | 374 | if (id->idProduct == 0x010e) { |
373 | sd->cam_type = CAM_TYPE_CIF; | 375 | sd->cam_type = CAM_TYPE_CIF; |
374 | cam->nmodes--; | 376 | cam->nmodes--; |
377 | |||
378 | data[0] = 0x01; | ||
379 | data[1] = 0x01; | ||
380 | err_code = mr_write(gspca_dev, 2); | ||
381 | if (err_code < 0) | ||
382 | return err_code; | ||
383 | |||
384 | msleep(200); | ||
385 | data[0] = get_sensor_id(gspca_dev); | ||
386 | /* | ||
387 | * Known CIF cameras. If you have another to report, please do | ||
388 | * | ||
389 | * Name byte just read sd->sensor_type | ||
390 | * reported by | ||
391 | * Sakar Spy-shot 0x28 T. Kilgore 0 | ||
392 | * Innovage 0xf5 (unstable) T. Kilgore 0 | ||
393 | * Vivitar Mini 0x53 H. De Goede 0 | ||
394 | * Vivitar Mini 0x08 T. Kilgore 1 | ||
395 | * Elta-Media 8212dc 0x23 T. Kaiser 1 | ||
396 | * Philips dig. keych. 0x37 T. Kilgore 1 | ||
397 | */ | ||
398 | if ((data[0] & 0x78) == 8 || | ||
399 | ((data[0] & 0x2) == 0x2 && data[0] != 0x53)) | ||
400 | sd->sensor_type = 1; | ||
401 | else | ||
402 | sd->sensor_type = 0; | ||
403 | |||
404 | PDEBUG(D_ERR, "Sensor type is %01x", sd->sensor_type); | ||
405 | |||
406 | if (sd->sensor_type == 0) | ||
407 | gspca_dev->ctrl_dis = (1 << BRIGHTNESS_IDX) | | ||
408 | (1 << EXPOSURE_IDX) | (1 << GAIN_IDX); | ||
375 | } else { | 409 | } else { |
376 | sd->cam_type = CAM_TYPE_VGA; | 410 | sd->cam_type = CAM_TYPE_VGA; |
377 | gspca_dev->ctrl_dis = (1 << BRIGHTNESS_IDX) | | 411 | gspca_dev->ctrl_dis = (1 << BRIGHTNESS_IDX) | |
@@ -411,37 +445,12 @@ static int start_cif_cam(struct gspca_dev *gspca_dev) | |||
411 | }; | 445 | }; |
412 | 446 | ||
413 | /* Note: Some of the above descriptions guessed from MR97113A driver */ | 447 | /* Note: Some of the above descriptions guessed from MR97113A driver */ |
414 | sd->sensor_type = 0; | ||
415 | data[0] = 0x01; | 448 | data[0] = 0x01; |
416 | data[1] = 0x01; | 449 | data[1] = 0x01; |
417 | err_code = mr_write(gspca_dev, 2); | 450 | err_code = mr_write(gspca_dev, 2); |
418 | if (err_code < 0) | 451 | if (err_code < 0) |
419 | return err_code; | 452 | return err_code; |
420 | 453 | ||
421 | msleep(200); | ||
422 | data[0] = get_sensor_id(gspca_dev); | ||
423 | /* | ||
424 | * Known CIF cameras. If you have another to report, please do | ||
425 | * | ||
426 | * Name byte just read sd->sensor_type | ||
427 | * reported by | ||
428 | * Sakar Spy-shot 0x28 T. Kilgore 0 | ||
429 | * Innovage 0xf5 (unstable) T. Kilgore 0 | ||
430 | * Vivitar Mini 0x53 H. De Goede 0 | ||
431 | * Vivitar Mini 0x08 T. Kilgore 1 | ||
432 | * Elta-Media 8212dc 0x23 T. Kaiser 1 | ||
433 | * Philips dig. keych. 0x37 T. Kilgore 1 | ||
434 | */ | ||
435 | if ((data[0] & 0x78) == 8 || | ||
436 | ((data[0] & 0x2) == 0x2 && data[0] != 0x53)) | ||
437 | sd->sensor_type = 1; | ||
438 | |||
439 | PDEBUG(D_ERR, "Sensor type is %01x", sd->sensor_type); | ||
440 | |||
441 | if (sd->sensor_type == 0) | ||
442 | gspca_dev->ctrl_dis = (1 << BRIGHTNESS_IDX) | | ||
443 | (1 << EXPOSURE_IDX) | (1 << GAIN_IDX); | ||
444 | |||
445 | memcpy(data, startup_string, 11); | 454 | memcpy(data, startup_string, 11); |
446 | if (sd->sensor_type) | 455 | if (sd->sensor_type) |
447 | data[5] = 0xbb; | 456 | data[5] = 0xbb; |