diff options
author | Antti Palosaari <crope@iki.fi> | 2012-08-14 21:21:07 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-08-15 18:19:11 -0400 |
commit | 15d0883663edccea29eeb9790052a11dd9977157 (patch) | |
tree | 6c1947a4d474a1d4e7d8b9165676307b6f49d4f5 | |
parent | 06bae1227aadf51d047f7a75834ed446e56ebae2 (diff) |
[media] dvb_usb_v2: .reset_resume() support
Add .reset_resume() support.
Also some other small changes for suspend / resume.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/dvb_usb.h | 2 | ||||
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | 42 |
2 files changed, 35 insertions, 9 deletions
diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb.h b/drivers/media/usb/dvb-usb-v2/dvb_usb.h index 63fc275c6497..5a53c6231fc2 100644 --- a/drivers/media/usb/dvb-usb-v2/dvb_usb.h +++ b/drivers/media/usb/dvb-usb-v2/dvb_usb.h | |||
@@ -383,7 +383,7 @@ extern int dvb_usbv2_probe(struct usb_interface *, | |||
383 | extern void dvb_usbv2_disconnect(struct usb_interface *); | 383 | extern void dvb_usbv2_disconnect(struct usb_interface *); |
384 | extern int dvb_usbv2_suspend(struct usb_interface *, pm_message_t); | 384 | extern int dvb_usbv2_suspend(struct usb_interface *, pm_message_t); |
385 | extern int dvb_usbv2_resume(struct usb_interface *); | 385 | extern int dvb_usbv2_resume(struct usb_interface *); |
386 | #define dvb_usbv2_reset_resume dvb_usbv2_resume | 386 | extern int dvb_usbv2_reset_resume(struct usb_interface *); |
387 | 387 | ||
388 | /* the generic read/write method for device control */ | 388 | /* the generic read/write method for device control */ |
389 | extern int dvb_usbv2_generic_rw(struct dvb_usb_device *, u8 *, u16, u8 *, u16); | 389 | extern int dvb_usbv2_generic_rw(struct dvb_usb_device *, u8 *, u16, u8 *, u16); |
diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c index a0e70e91834a..e2d73e1a7ae0 100644 --- a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c +++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | |||
@@ -952,7 +952,7 @@ EXPORT_SYMBOL(dvb_usbv2_disconnect); | |||
952 | int dvb_usbv2_suspend(struct usb_interface *intf, pm_message_t msg) | 952 | int dvb_usbv2_suspend(struct usb_interface *intf, pm_message_t msg) |
953 | { | 953 | { |
954 | struct dvb_usb_device *d = usb_get_intfdata(intf); | 954 | struct dvb_usb_device *d = usb_get_intfdata(intf); |
955 | int i, active_fe; | 955 | int ret = 0, i, active_fe; |
956 | struct dvb_frontend *fe; | 956 | struct dvb_frontend *fe; |
957 | dev_dbg(&d->udev->dev, "%s:\n", __func__); | 957 | dev_dbg(&d->udev->dev, "%s:\n", __func__); |
958 | 958 | ||
@@ -972,18 +972,17 @@ int dvb_usbv2_suspend(struct usb_interface *intf, pm_message_t msg) | |||
972 | /* stop usb streaming */ | 972 | /* stop usb streaming */ |
973 | usb_urb_killv2(&d->adapter[i].stream); | 973 | usb_urb_killv2(&d->adapter[i].stream); |
974 | 974 | ||
975 | dvb_frontend_suspend(fe); | 975 | ret = dvb_frontend_suspend(fe); |
976 | } | 976 | } |
977 | } | 977 | } |
978 | 978 | ||
979 | return 0; | 979 | return ret; |
980 | } | 980 | } |
981 | EXPORT_SYMBOL(dvb_usbv2_suspend); | 981 | EXPORT_SYMBOL(dvb_usbv2_suspend); |
982 | 982 | ||
983 | int dvb_usbv2_resume(struct usb_interface *intf) | 983 | static int dvb_usbv2_resume_common(struct dvb_usb_device *d) |
984 | { | 984 | { |
985 | struct dvb_usb_device *d = usb_get_intfdata(intf); | 985 | int ret = 0, i, active_fe; |
986 | int i, active_fe; | ||
987 | struct dvb_frontend *fe; | 986 | struct dvb_frontend *fe; |
988 | dev_dbg(&d->udev->dev, "%s:\n", __func__); | 987 | dev_dbg(&d->udev->dev, "%s:\n", __func__); |
989 | 988 | ||
@@ -992,7 +991,7 @@ int dvb_usbv2_resume(struct usb_interface *intf) | |||
992 | if (d->adapter[i].dvb_adap.priv && active_fe != -1) { | 991 | if (d->adapter[i].dvb_adap.priv && active_fe != -1) { |
993 | fe = d->adapter[i].fe[active_fe]; | 992 | fe = d->adapter[i].fe[active_fe]; |
994 | 993 | ||
995 | dvb_frontend_resume(fe); | 994 | ret = dvb_frontend_resume(fe); |
996 | 995 | ||
997 | /* resume usb streaming */ | 996 | /* resume usb streaming */ |
998 | usb_urb_submitv2(&d->adapter[i].stream, NULL); | 997 | usb_urb_submitv2(&d->adapter[i].stream, NULL); |
@@ -1009,10 +1008,37 @@ int dvb_usbv2_resume(struct usb_interface *intf) | |||
1009 | schedule_delayed_work(&d->rc_query_work, | 1008 | schedule_delayed_work(&d->rc_query_work, |
1010 | msecs_to_jiffies(d->rc.interval)); | 1009 | msecs_to_jiffies(d->rc.interval)); |
1011 | 1010 | ||
1012 | return 0; | 1011 | return ret; |
1012 | } | ||
1013 | |||
1014 | int dvb_usbv2_resume(struct usb_interface *intf) | ||
1015 | { | ||
1016 | struct dvb_usb_device *d = usb_get_intfdata(intf); | ||
1017 | dev_dbg(&d->udev->dev, "%s:\n", __func__); | ||
1018 | |||
1019 | return dvb_usbv2_resume_common(d); | ||
1013 | } | 1020 | } |
1014 | EXPORT_SYMBOL(dvb_usbv2_resume); | 1021 | EXPORT_SYMBOL(dvb_usbv2_resume); |
1015 | 1022 | ||
1023 | int dvb_usbv2_reset_resume(struct usb_interface *intf) | ||
1024 | { | ||
1025 | struct dvb_usb_device *d = usb_get_intfdata(intf); | ||
1026 | int ret; | ||
1027 | dev_dbg(&d->udev->dev, "%s:\n", __func__); | ||
1028 | |||
1029 | dvb_usbv2_device_power_ctrl(d, 1); | ||
1030 | |||
1031 | if (d->props->init) | ||
1032 | d->props->init(d); | ||
1033 | |||
1034 | ret = dvb_usbv2_resume_common(d); | ||
1035 | |||
1036 | dvb_usbv2_device_power_ctrl(d, 0); | ||
1037 | |||
1038 | return ret; | ||
1039 | } | ||
1040 | EXPORT_SYMBOL(dvb_usbv2_reset_resume); | ||
1041 | |||
1016 | MODULE_VERSION("2.0"); | 1042 | MODULE_VERSION("2.0"); |
1017 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); | 1043 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); |
1018 | MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>"); | 1044 | MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>"); |