summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2012-06-12 00:47:04 +0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-08-04 14:56:29 +0400
commitef81e9ebbe57236683e6950d0ec82a20f2d350eb (patch)
tree8c5e5952ccc4b34ee3e3f57971c09665e1239cdf /drivers/media
parent5b6a63cc2f11a9b00862d13104d1304e082acfe5 (diff)
downloadlinux-ef81e9ebbe57236683e6950d0ec82a20f2d350eb.tar.xz
[media] dvb_usb_v2: suspend/resume stop/start USB streaming
Stop remote polling and USB streaming before suspend and resume those when back to normal operation. It is far away from complete implementation, but at least it does not hang system anymore on suspend while streaming is ongoing. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/dvb-usb/dvb_usb.h2
-rw-r--r--drivers/media/dvb/dvb-usb/dvb_usb_init.c43
2 files changed, 45 insertions, 0 deletions
diff --git a/drivers/media/dvb/dvb-usb/dvb_usb.h b/drivers/media/dvb/dvb-usb/dvb_usb.h
index d0c628782f76..7e4832664f5d 100644
--- a/drivers/media/dvb/dvb-usb/dvb_usb.h
+++ b/drivers/media/dvb/dvb-usb/dvb_usb.h
@@ -356,6 +356,8 @@ struct dvb_usb_device {
extern int dvb_usbv2_probe(struct usb_interface *,
const struct usb_device_id *);
extern void dvb_usbv2_disconnect(struct usb_interface *);
+extern int dvb_usbv2_suspend(struct usb_interface *, pm_message_t);
+extern int dvb_usbv2_resume(struct usb_interface *);
/* the generic read/write method for device control */
extern int dvb_usbv2_generic_rw(struct dvb_usb_device *, u8 *, u16, u8 *, u16,
diff --git a/drivers/media/dvb/dvb-usb/dvb_usb_init.c b/drivers/media/dvb/dvb-usb/dvb_usb_init.c
index 976a706b4cc7..60011f56cc90 100644
--- a/drivers/media/dvb/dvb-usb/dvb_usb_init.c
+++ b/drivers/media/dvb/dvb-usb/dvb_usb_init.c
@@ -439,6 +439,49 @@ void dvb_usbv2_disconnect(struct usb_interface *intf)
}
EXPORT_SYMBOL(dvb_usbv2_disconnect);
+int dvb_usbv2_suspend(struct usb_interface *intf, pm_message_t msg)
+{
+ struct dvb_usb_device *d = usb_get_intfdata(intf);
+ int i;
+
+ pr_debug("%s:\n", __func__);
+
+ /* stop remote controller poll */
+ if (d->rc.query && !d->rc.bulk_mode)
+ cancel_delayed_work_sync(&d->rc_query_work);
+
+ /* stop streaming */
+ for (i = d->num_adapters_initialized - 1; i >= 0; i--) {
+ if (d->adapter[i].active_fe != -1)
+ usb_urb_killv2(&d->adapter[i].stream);
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL(dvb_usbv2_suspend);
+
+int dvb_usbv2_resume(struct usb_interface *intf)
+{
+ struct dvb_usb_device *d = usb_get_intfdata(intf);
+ int i;
+
+ pr_debug("%s:\n", __func__);
+
+ /* start streaming */
+ for (i = 0; i < d->num_adapters_initialized; i++) {
+ if (d->adapter[i].active_fe != -1)
+ usb_urb_submitv2(&d->adapter[i].stream, NULL);
+ }
+
+ /* start remote controller poll */
+ if (d->rc.query && !d->rc.bulk_mode)
+ schedule_delayed_work(&d->rc_query_work,
+ msecs_to_jiffies(d->rc.interval));
+
+ return 0;
+}
+EXPORT_SYMBOL(dvb_usbv2_resume);
+
MODULE_VERSION("1.0");
MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
MODULE_DESCRIPTION("A library module containing commonly used USB and DVB function USB DVB devices");