aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn
diff options
context:
space:
mode:
authorTilman Schmidt <tilman@imap.cc>2008-02-06 04:38:27 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-06 13:41:12 -0500
commit1ff0a5296ff4157e7c46861bccc8d61e168c4e2b (patch)
treea05de8e2731d97c191dc5a5798bc2750f1a002a7 /drivers/isdn
parent024fd299ba6e933055fccf1bb1cc2e7bdc58bde6 (diff)
usb_gigaset: suspend support
Add basic suspend/resume support to the usb_gigaset driver for the Siemens Gigaset M105 USB DECT adapter. Only the USB aspects are handled so far; the ISDN subsystem is not notified in any way, for lack of information about how to do that. The driver does not check for active connections before suspending. They will be dropped when the device loses USB power. Signed-off-by: Tilman Schmidt <tilman@imap.cc> Cc: Greg KH <gregkh@suse.de> Cc: Hansjoerg Lipp <hjlipp@web.de> Cc: Karsten Keil <kkeil@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/isdn')
-rw-r--r--drivers/isdn/gigaset/usb-gigaset.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c
index d81c0e3f7702..7028911d91ed 100644
--- a/drivers/isdn/gigaset/usb-gigaset.c
+++ b/drivers/isdn/gigaset/usb-gigaset.c
@@ -109,6 +109,11 @@ static int gigaset_probe(struct usb_interface *interface,
109 const struct usb_device_id *id); 109 const struct usb_device_id *id);
110static void gigaset_disconnect(struct usb_interface *interface); 110static void gigaset_disconnect(struct usb_interface *interface);
111 111
112/* functions called before/after suspend */
113static int gigaset_suspend(struct usb_interface *intf, pm_message_t message);
114static int gigaset_resume(struct usb_interface *intf);
115static int gigaset_pre_reset(struct usb_interface *intf);
116
112static struct gigaset_driver *driver = NULL; 117static struct gigaset_driver *driver = NULL;
113static struct cardstate *cardstate = NULL; 118static struct cardstate *cardstate = NULL;
114 119
@@ -118,6 +123,11 @@ static struct usb_driver gigaset_usb_driver = {
118 .probe = gigaset_probe, 123 .probe = gigaset_probe,
119 .disconnect = gigaset_disconnect, 124 .disconnect = gigaset_disconnect,
120 .id_table = gigaset_table, 125 .id_table = gigaset_table,
126 .suspend = gigaset_suspend,
127 .resume = gigaset_resume,
128 .reset_resume = gigaset_resume,
129 .pre_reset = gigaset_pre_reset,
130 .post_reset = gigaset_resume,
121}; 131};
122 132
123struct usb_cardstate { 133struct usb_cardstate {
@@ -845,6 +855,52 @@ static void gigaset_disconnect(struct usb_interface *interface)
845 gigaset_unassign(cs); 855 gigaset_unassign(cs);
846} 856}
847 857
858/* gigaset_suspend
859 * This function is called before the USB connection is suspended or reset.
860 */
861static int gigaset_suspend(struct usb_interface *intf, pm_message_t message)
862{
863 struct cardstate *cs = usb_get_intfdata(intf);
864
865 /* stop activity */
866 cs->connected = 0; /* prevent rescheduling */
867 usb_kill_urb(cs->hw.usb->read_urb);
868 tasklet_kill(&cs->write_tasklet);
869 usb_kill_urb(cs->hw.usb->bulk_out_urb);
870
871 gig_dbg(DEBUG_SUSPEND, "suspend complete");
872 return 0;
873}
874
875/* gigaset_resume
876 * This function is called after the USB connection has been resumed or reset.
877 */
878static int gigaset_resume(struct usb_interface *intf)
879{
880 struct cardstate *cs = usb_get_intfdata(intf);
881 int rc;
882
883 /* resubmit interrupt URB */
884 cs->connected = 1;
885 rc = usb_submit_urb(cs->hw.usb->read_urb, GFP_KERNEL);
886 if (rc) {
887 dev_err(cs->dev, "Could not submit read URB (error %d)\n", -rc);
888 return rc;
889 }
890
891 gig_dbg(DEBUG_SUSPEND, "resume complete");
892 return 0;
893}
894
895/* gigaset_pre_reset
896 * This function is called before the USB connection is reset.
897 */
898static int gigaset_pre_reset(struct usb_interface *intf)
899{
900 /* same as suspend */
901 return gigaset_suspend(intf, PMSG_ON);
902}
903
848static const struct gigaset_ops ops = { 904static const struct gigaset_ops ops = {
849 gigaset_write_cmd, 905 gigaset_write_cmd,
850 gigaset_write_room, 906 gigaset_write_room,