aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Lorenz <tobias.lorenz@gmx.net>2009-02-12 12:56:19 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-02-17 07:43:09 -0500
commit2f94fc465a6504443bb986ba9d36e28e2b422c6e (patch)
tree5734bbf20a83d35d56b411f092062169d547372d
parentd807dec59d3c850b332b5bf95fe33f18def00068 (diff)
V4L/DVB (10533): fix LED status output
This patch closes one of my todos that was since long on my list. Some people reported clicks and glitches in the audio stream, correlated to the LED color changing cycle. Thanks to Rick Bronson <rick@efn.org>. Signed-off-by: Tobias Lorenz <tobias.lorenz@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/radio/radio-si470x.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/drivers/media/radio/radio-si470x.c b/drivers/media/radio/radio-si470x.c
index fd81a97a0fdb..4dfed6aa2dbc 100644
--- a/drivers/media/radio/radio-si470x.c
+++ b/drivers/media/radio/radio-si470x.c
@@ -101,11 +101,13 @@
101 * 2009-01-31 Bob Ross <pigiron@gmx.com> 101 * 2009-01-31 Bob Ross <pigiron@gmx.com>
102 * - correction of stereo detection/setting 102 * - correction of stereo detection/setting
103 * - correction of signal strength indicator scaling 103 * - correction of signal strength indicator scaling
104 * 2009-01-31 Rick Bronson <rick@efn.org>
105 * Tobias Lorenz <tobias.lorenz@gmx.net>
106 * - add LED status output
104 * 107 *
105 * ToDo: 108 * ToDo:
106 * - add firmware download/update support 109 * - add firmware download/update support
107 * - RDS support: interrupt mode, instead of polling 110 * - RDS support: interrupt mode, instead of polling
108 * - add LED status output (check if that's not already done in firmware)
109 */ 111 */
110 112
111 113
@@ -885,6 +887,30 @@ static int si470x_rds_on(struct si470x_device *radio)
885 887
886 888
887/************************************************************************** 889/**************************************************************************
890 * General Driver Functions - LED_REPORT
891 **************************************************************************/
892
893/*
894 * si470x_set_led_state - sets the led state
895 */
896static int si470x_set_led_state(struct si470x_device *radio,
897 unsigned char led_state)
898{
899 unsigned char buf[LED_REPORT_SIZE];
900 int retval;
901
902 buf[0] = LED_REPORT;
903 buf[1] = LED_COMMAND;
904 buf[2] = led_state;
905
906 retval = si470x_set_report(radio, (void *) &buf, sizeof(buf));
907
908 return (retval < 0) ? -EINVAL : 0;
909}
910
911
912
913/**************************************************************************
888 * RDS Driver Functions 914 * RDS Driver Functions
889 **************************************************************************/ 915 **************************************************************************/
890 916
@@ -1637,6 +1663,9 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,
1637 /* set initial frequency */ 1663 /* set initial frequency */
1638 si470x_set_freq(radio, 87.5 * FREQ_MUL); /* available in all regions */ 1664 si470x_set_freq(radio, 87.5 * FREQ_MUL); /* available in all regions */
1639 1665
1666 /* set led to connect state */
1667 si470x_set_led_state(radio, BLINK_GREEN_LED);
1668
1640 /* rds buffer allocation */ 1669 /* rds buffer allocation */
1641 radio->buf_size = rds_buf * 3; 1670 radio->buf_size = rds_buf * 3;
1642 radio->buffer = kmalloc(radio->buf_size, GFP_KERNEL); 1671 radio->buffer = kmalloc(radio->buf_size, GFP_KERNEL);
@@ -1720,6 +1749,9 @@ static void si470x_usb_driver_disconnect(struct usb_interface *intf)
1720 cancel_delayed_work_sync(&radio->work); 1749 cancel_delayed_work_sync(&radio->work);
1721 usb_set_intfdata(intf, NULL); 1750 usb_set_intfdata(intf, NULL);
1722 if (radio->users == 0) { 1751 if (radio->users == 0) {
1752 /* set led to disconnect state */
1753 si470x_set_led_state(radio, BLINK_ORANGE_LED);
1754
1723 video_unregister_device(radio->videodev); 1755 video_unregister_device(radio->videodev);
1724 kfree(radio->buffer); 1756 kfree(radio->buffer);
1725 kfree(radio); 1757 kfree(radio);