aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/radio
diff options
context:
space:
mode:
authorAlexey Klimov <klimov.linux@gmail.com>2008-11-07 22:40:46 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-29 14:53:30 -0500
commit04e0ffbbdd297fac1d8a5696b5d27887d6ff3dc2 (patch)
tree4941dc70ad82cd68487955b90c6ca4ebe0d6bed0 /drivers/media/radio
parentf34253dfe66ff365a794eeddbe240b4bfd8e32eb (diff)
V4L/DVB (9539): dsbr100: add suspend and resume
This patch adds support for suspend and resume methods in driver. Without this kradio and gnomeradio crashes during resume. Also .supports_autosuspend in usb_driver struct set equal to 0 to avoid suspending of module if usb_autosuspend enabled. Signed-off-by: Alexey Klimov <klimov.linux@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/radio')
-rw-r--r--drivers/media/radio/dsbr100.c45
1 files changed, 41 insertions, 4 deletions
diff --git a/drivers/media/radio/dsbr100.c b/drivers/media/radio/dsbr100.c
index a5ca176a7b08..e6485cfe1218 100644
--- a/drivers/media/radio/dsbr100.c
+++ b/drivers/media/radio/dsbr100.c
@@ -131,6 +131,9 @@ static int usb_dsbr100_probe(struct usb_interface *intf,
131static void usb_dsbr100_disconnect(struct usb_interface *intf); 131static void usb_dsbr100_disconnect(struct usb_interface *intf);
132static int usb_dsbr100_open(struct inode *inode, struct file *file); 132static int usb_dsbr100_open(struct inode *inode, struct file *file);
133static int usb_dsbr100_close(struct inode *inode, struct file *file); 133static int usb_dsbr100_close(struct inode *inode, struct file *file);
134static int usb_dsbr100_suspend(struct usb_interface *intf,
135 pm_message_t message);
136static int usb_dsbr100_resume(struct usb_interface *intf);
134 137
135static int radio_nr = -1; 138static int radio_nr = -1;
136module_param(radio_nr, int, 0); 139module_param(radio_nr, int, 0);
@@ -157,10 +160,14 @@ MODULE_DEVICE_TABLE (usb, usb_dsbr100_device_table);
157 160
158/* USB subsystem interface */ 161/* USB subsystem interface */
159static struct usb_driver usb_dsbr100_driver = { 162static struct usb_driver usb_dsbr100_driver = {
160 .name = "dsbr100", 163 .name = "dsbr100",
161 .probe = usb_dsbr100_probe, 164 .probe = usb_dsbr100_probe,
162 .disconnect = usb_dsbr100_disconnect, 165 .disconnect = usb_dsbr100_disconnect,
163 .id_table = usb_dsbr100_device_table, 166 .id_table = usb_dsbr100_device_table,
167 .suspend = usb_dsbr100_suspend,
168 .resume = usb_dsbr100_resume,
169 .reset_resume = usb_dsbr100_resume,
170 .supports_autosuspend = 0,
164}; 171};
165 172
166/* Low-level device interface begins here */ 173/* Low-level device interface begins here */
@@ -448,6 +455,36 @@ static int usb_dsbr100_close(struct inode *inode, struct file *file)
448 return 0; 455 return 0;
449} 456}
450 457
458/* Suspend device - stop device. */
459static int usb_dsbr100_suspend(struct usb_interface *intf, pm_message_t message)
460{
461 struct dsbr100_device *radio = usb_get_intfdata(intf);
462 int retval;
463
464 retval = dsbr100_stop(radio);
465 if (retval == -1)
466 dev_warn(&intf->dev, "dsbr100_stop failed\n");
467
468 dev_info(&intf->dev, "going into suspend..\n");
469
470 return 0;
471}
472
473/* Resume device - start device. */
474static int usb_dsbr100_resume(struct usb_interface *intf)
475{
476 struct dsbr100_device *radio = usb_get_intfdata(intf);
477 int retval;
478
479 retval = dsbr100_start(radio);
480 if (retval == -1)
481 dev_warn(&intf->dev, "dsbr100_start failed\n");
482
483 dev_info(&intf->dev, "coming out of suspend..\n");
484
485 return 0;
486}
487
451/* File system interface */ 488/* File system interface */
452static const struct file_operations usb_dsbr100_fops = { 489static const struct file_operations usb_dsbr100_fops = {
453 .owner = THIS_MODULE, 490 .owner = THIS_MODULE,