Commit 7b1c8f58 authored by Arvydas Sidorenko's avatar Arvydas Sidorenko Committed by Mauro Carvalho Chehab

[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: default avatarAndrea Anacleto <andreaanacleto@libero.it>
Signed-off-by: default avatarArvydas Sidorenko <asido4@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 69967a71
...@@ -55,6 +55,8 @@ MODULE_AUTHOR("Jaime Velasco Juan <jsagarribay@gmail.com> and Nicolas VIVIEN"); ...@@ -55,6 +55,8 @@ MODULE_AUTHOR("Jaime Velasco Juan <jsagarribay@gmail.com> and Nicolas VIVIEN");
MODULE_DESCRIPTION("Syntek DC1125 webcam driver"); MODULE_DESCRIPTION("Syntek DC1125 webcam driver");
/* bool for webcam LED management */
int first_init = 1;
/* Some cameras have audio interfaces, we aren't interested in those */ /* Some cameras have audio interfaces, we aren't interested in those */
static struct usb_device_id stkwebcam_table[] = { static struct usb_device_id stkwebcam_table[] = {
...@@ -560,6 +562,12 @@ static int v4l_stk_open(struct file *fp) ...@@ -560,6 +562,12 @@ static int v4l_stk_open(struct file *fp)
if (dev == NULL || !is_present(dev)) if (dev == NULL || !is_present(dev))
return -ENXIO; return -ENXIO;
if (!first_init)
stk_camera_write_reg(dev, 0x0, 0x24);
else
first_init = 0;
fp->private_data = dev; fp->private_data = dev;
usb_autopm_get_interface(dev->interface); usb_autopm_get_interface(dev->interface);
...@@ -573,7 +581,7 @@ static int v4l_stk_release(struct file *fp) ...@@ -573,7 +581,7 @@ static int v4l_stk_release(struct file *fp)
if (dev->owner == fp) { if (dev->owner == fp) {
stk_stop_stream(dev); stk_stop_stream(dev);
stk_free_buffers(dev); stk_free_buffers(dev);
stk_camera_write_reg(dev, 0x0, 0x48); /* turn off the LED */ stk_camera_write_reg(dev, 0x0, 0x49); /* turn off the LED */
unset_initialised(dev); unset_initialised(dev);
dev->owner = NULL; dev->owner = NULL;
} }
...@@ -1350,6 +1358,7 @@ static int stk_camera_resume(struct usb_interface *intf) ...@@ -1350,6 +1358,7 @@ static int stk_camera_resume(struct usb_interface *intf)
return 0; return 0;
unset_initialised(dev); unset_initialised(dev);
stk_initialise(dev); stk_initialise(dev);
stk_camera_write_reg(dev, 0x0, 0x49);
stk_setup_format(dev); stk_setup_format(dev);
if (is_streaming(dev)) if (is_streaming(dev))
stk_start_stream(dev); stk_start_stream(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment