summaryrefslogtreecommitdiff
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:12 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-07-30 18:11:28 -0300
commit779471110c6f0f7f7c223fc696170ec750ac3531 (patch)
tree3c969ef4c615a52f305d55f18405e7f9d1542cea /drivers/media/radio/si470x/radio-si470x-usb.c
parent86ef3f78b8bae808f41f74c506762ac345fdf893 (diff)
[media] radio-si470x: Always use interrupt to wait for tune/seek completion
Since USB receives STATUS_RSSI updates through the interrupt endpoint, there is no need to poll with USB, so get rid of the polling. Note this also changes the order in which the probing of USB devices is done, to avoid si470x_set_chan getting called before the interrupt endpoint is being monitored. 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.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c b/drivers/media/radio/si470x/radio-si470x-usb.c
index 0da5c986d3a3..66b1ba8c4aaf 100644
--- a/drivers/media/radio/si470x/radio-si470x-usb.c
+++ b/drivers/media/radio/si470x/radio-si470x-usb.c
@@ -406,6 +406,9 @@ static void si470x_int_in_callback(struct urb *urb)
radio->registers[STATUSRSSI] =
get_unaligned_be16(&radio->int_in_buffer[1]);
+ if (radio->registers[STATUSRSSI] & STATUSRSSI_STC)
+ complete(&radio->completion);
+
if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS)) {
/* Update RDS registers with URB data */
for (regnr = 1; regnr < RDS_REGISTER_NUM; regnr++)
@@ -539,13 +542,6 @@ static int si470x_start_usb(struct si470x_device *radio)
{
int retval;
- /* start radio */
- retval = si470x_start(radio);
- if (retval < 0)
- return retval;
-
- v4l2_ctrl_handler_setup(&radio->hdl);
-
/* initialize interrupt urb */
usb_fill_int_urb(radio->int_in_urb, radio->usbdev,
usb_rcvintpipe(radio->usbdev,
@@ -566,6 +562,14 @@ static int si470x_start_usb(struct si470x_device *radio)
radio->int_in_running = 0;
}
radio->status_rssi_auto_update = radio->int_in_running;
+
+ /* start radio */
+ retval = si470x_start(radio);
+ if (retval < 0)
+ return retval;
+
+ v4l2_ctrl_handler_setup(&radio->hdl);
+
return retval;
}
@@ -594,6 +598,7 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,
radio->usbdev = interface_to_usbdev(intf);
radio->intf = intf;
mutex_init(&radio->lock);
+ init_completion(&radio->completion);
iface_desc = intf->cur_altsetting;
@@ -704,9 +709,6 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,
"linux-media@vger.kernel.org\n");
}
- /* 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);
@@ -729,6 +731,9 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,
if (retval < 0)
goto err_all;
+ /* set initial frequency */
+ si470x_set_freq(radio, 87.5 * FREQ_MUL); /* available in all regions */
+
/* register video device */
retval = video_register_device(&radio->videodev, VFL_TYPE_RADIO,
radio_nr);