aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArvydas Sidorenko <asido4@gmail.com>2011-09-21 09:58:31 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-09-23 22:07:59 -0400
commit7b1c8f58fcdbed75903943705ef41816e9648c1b (patch)
tree454262e19888be58d83e6b9704efd449e1e51a44
parent69967a71ae6ebe7aace94ef15f269b8bf2b5ce1e (diff)
[media] stk-webcam.c: webcam LED bug fix
This is an improved version of the patch I sent a little ago. The problem was: On my DC-1125 webcam chip from Syntek, whenever the webcam turns on, the LED light on it is turned on also and never turns off again unless system is shut downed or restarted. The previous version seemed to break some other laptop webcam work. Thanks to Andrea Anacleto for the bug report and solution. Signed-off-by: Andrea Anacleto <andreaanacleto@libero.it> Signed-off-by: Arvydas Sidorenko <asido4@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/stk-webcam.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/media/video/stk-webcam.c b/drivers/media/video/stk-webcam.c
index 5fc6bbc165fa..cbc105f975de 100644
--- a/drivers/media/video/stk-webcam.c
+++ b/drivers/media/video/stk-webcam.c
@@ -55,6 +55,8 @@ MODULE_AUTHOR("Jaime Velasco Juan <jsagarribay@gmail.com> and Nicolas VIVIEN");
55MODULE_DESCRIPTION("Syntek DC1125 webcam driver"); 55MODULE_DESCRIPTION("Syntek DC1125 webcam driver");
56 56
57 57
58/* bool for webcam LED management */
59int first_init = 1;
58 60
59/* Some cameras have audio interfaces, we aren't interested in those */ 61/* Some cameras have audio interfaces, we aren't interested in those */
60static struct usb_device_id stkwebcam_table[] = { 62static struct usb_device_id stkwebcam_table[] = {
@@ -560,6 +562,12 @@ static int v4l_stk_open(struct file *fp)
560 562
561 if (dev == NULL || !is_present(dev)) 563 if (dev == NULL || !is_present(dev))
562 return -ENXIO; 564 return -ENXIO;
565
566 if (!first_init)
567 stk_camera_write_reg(dev, 0x0, 0x24);
568 else
569 first_init = 0;
570
563 fp->private_data = dev; 571 fp->private_data = dev;
564 usb_autopm_get_interface(dev->interface); 572 usb_autopm_get_interface(dev->interface);
565 573
@@ -573,7 +581,7 @@ static int v4l_stk_release(struct file *fp)
573 if (dev->owner == fp) { 581 if (dev->owner == fp) {
574 stk_stop_stream(dev); 582 stk_stop_stream(dev);
575 stk_free_buffers(dev); 583 stk_free_buffers(dev);
576 stk_camera_write_reg(dev, 0x0, 0x48); /* turn off the LED */ 584 stk_camera_write_reg(dev, 0x0, 0x49); /* turn off the LED */
577 unset_initialised(dev); 585 unset_initialised(dev);
578 dev->owner = NULL; 586 dev->owner = NULL;
579 } 587 }
@@ -1350,6 +1358,7 @@ static int stk_camera_resume(struct usb_interface *intf)
1350 return 0; 1358 return 0;
1351 unset_initialised(dev); 1359 unset_initialised(dev);
1352 stk_initialise(dev); 1360 stk_initialise(dev);
1361 stk_camera_write_reg(dev, 0x0, 0x49);
1353 stk_setup_format(dev); 1362 stk_setup_format(dev);
1354 if (is_streaming(dev)) 1363 if (is_streaming(dev))
1355 stk_start_stream(dev); 1364 stk_start_stream(dev);