summaryrefslogtreecommitdiff
path: root/linux/drivers/media/radio/radio-si470x.c
diff options
context:
space:
mode:
authorTobias Lorenz <tobias.lorenz@gmx.net>2009-02-12 18:56:19 +0100
committerTobias Lorenz <tobias.lorenz@gmx.net>2009-02-12 18:56:19 +0100
commitc29af88de22ef512cc331c823d9d334f1c4515fc (patch)
treee335ae129e6aa10c9916bdd1e373fb3101383608 /linux/drivers/media/radio/radio-si470x.c
parent30db0e876957f7d463bc717f76c73b9e34aa9e92 (diff)
downloadmediapointer-dvb-s2-c29af88de22ef512cc331c823d9d334f1c4515fc.tar.gz
mediapointer-dvb-s2-c29af88de22ef512cc331c823d9d334f1c4515fc.tar.bz2
LED status output
From: Tobias Lorenz <tobias.lorenz@gmx.net> 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>. Priority: normal Signed-off-by: Tobias Lorenz <tobias.lorenz@gmx.net>
Diffstat (limited to 'linux/drivers/media/radio/radio-si470x.c')
-rw-r--r--linux/drivers/media/radio/radio-si470x.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/linux/drivers/media/radio/radio-si470x.c b/linux/drivers/media/radio/radio-si470x.c
index d211d5176..71c3228d8 100644
--- a/linux/drivers/media/radio/radio-si470x.c
+++ b/linux/drivers/media/radio/radio-si470x.c
@@ -102,11 +102,13 @@
* 2009-01-31 Bob Ross <pigiron@gmx.com>
* - correction of stereo detection/setting
* - correction of signal strength indicator scaling
+ * 2009-01-31 Rick Bronson <rick@efn.org>
+ * Tobias Lorenz <tobias.lorenz@gmx.net>
+ * - add LED status output
*
* ToDo:
* - add firmware download/update support
* - RDS support: interrupt mode, instead of polling
- * - add LED status output (check if that's not already done in firmware)
*/
@@ -901,6 +903,30 @@ static int si470x_get_rds_registers(struct si470x_device *radio)
/**************************************************************************
+ * General Driver Functions - LED_REPORT
+ **************************************************************************/
+
+/*
+ * si470x_set_led_state - sets the led state
+ */
+static int si470x_set_led_state(struct si470x_device *radio,
+ unsigned char led_state)
+{
+ unsigned char buf[LED_REPORT_SIZE];
+ int retval;
+
+ buf[0] = LED_REPORT;
+ buf[1] = LED_COMMAND;
+ buf[2] = led_state;
+
+ retval = si470x_set_report(radio, (void *) &buf, sizeof(buf));
+
+ return (retval < 0) ? -EINVAL : 0;
+}
+
+
+
+/**************************************************************************
* RDS Driver Functions
**************************************************************************/
@@ -1657,6 +1683,9 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,
/* set initial frequency */
si470x_set_freq(radio, 87.5 * FREQ_MUL); /* available in all regions */
+ /* set led to connect state */
+ si470x_set_led_state(radio, BLINK_GREEN_LED);
+
/* rds buffer allocation */
radio->buf_size = rds_buf * 3;
radio->buffer = kmalloc(radio->buf_size, GFP_KERNEL);
@@ -1740,6 +1769,9 @@ static void si470x_usb_driver_disconnect(struct usb_interface *intf)
cancel_delayed_work_sync(&radio->work);
usb_set_intfdata(intf, NULL);
if (radio->users == 0) {
+ /* set led to disconnect state */
+ si470x_set_led_state(radio, BLINK_ORANGE_LED);
+
video_unregister_device(radio->videodev);
kfree(radio->buffer);
kfree(radio);