summaryrefslogtreecommitdiffstats
path: root/drivers/media/radio/si470x/radio-si470x-usb.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2012-06-14 09:43:11 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-07-30 18:03:14 -0300
commit86ef3f78b8bae808f41f74c506762ac345fdf893 (patch)
tree2cb97408c5e5c4df6250eba529623186e3acab8e /drivers/media/radio/si470x/radio-si470x-usb.c
parent8e2ce73e932b629c3e12546e5fffac7ee54d0093 (diff)
downloadlinux-86ef3f78b8bae808f41f74c506762ac345fdf893.tar.gz
linux-86ef3f78b8bae808f41f74c506762ac345fdf893.tar.bz2
linux-86ef3f78b8bae808f41f74c506762ac345fdf893.zip
[media] radio-si470x: Don't unnecesarily read registers on G_TUNER
Reading registers from the pcear USB dongles with the si470x causes a loud pop (and an alsa buffer overrun). Since most radio apps periodically call G_TUNER to update mono/stereo, signal and afc status this leads to the music . pop . music . pop . music -> not good. On the internet there is an howto for flashing the pcear with a newer firmware from the silabs reference boardto fix this, but: 1) This howto relies on a special version of the driver which allows firmware flashing 2) We should try to avoid the answer to a bug report being upgrade your firmware, if at all possible 3) Windows does not suffer from the pop sounds After a quick look at the driver I found at that the register reads are not necessary at all, as the device gives us the necessary status through usb interrupt packets, and the driver already uses these! Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/radio/si470x/radio-si470x-usb.c')
-rw-r--r--drivers/media/radio/si470x/radio-si470x-usb.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c b/drivers/media/radio/si470x/radio-si470x-usb.c
index f412f7ab270b..0da5c986d3a3 100644
--- a/drivers/media/radio/si470x/radio-si470x-usb.c
+++ b/drivers/media/radio/si470x/radio-si470x-usb.c
@@ -399,12 +399,16 @@ static void si470x_int_in_callback(struct urb *urb)
}
}
- if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) == 0)
+ /* Sometimes the device returns len 0 packets */
+ if (urb->actual_length != RDS_REPORT_SIZE)
goto resubmit;
- if (urb->actual_length > 0) {
+ radio->registers[STATUSRSSI] =
+ get_unaligned_be16(&radio->int_in_buffer[1]);
+
+ if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS)) {
/* Update RDS registers with URB data */
- for (regnr = 0; regnr < RDS_REGISTER_NUM; regnr++)
+ for (regnr = 1; regnr < RDS_REGISTER_NUM; regnr++)
radio->registers[STATUSRSSI + regnr] =
get_unaligned_be16(&radio->int_in_buffer[
regnr * RADIO_REGISTER_SIZE + 1]);
@@ -480,6 +484,7 @@ resubmit:
radio->int_in_running = 0;
}
}
+ radio->status_rssi_auto_update = radio->int_in_running;
}
@@ -560,6 +565,7 @@ static int si470x_start_usb(struct si470x_device *radio)
"submitting int urb failed (%d)\n", retval);
radio->int_in_running = 0;
}
+ radio->status_rssi_auto_update = radio->int_in_running;
return retval;
}