Skip to content

Commit

Permalink
Input: usbtouchscreen - implement basic suspend/resume
Browse files Browse the repository at this point in the history
This implements basic support for suspend & resume.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Tested-by: Petr Štetiar <ynezz@true.cz>
Tested-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
Oliver Neukum authored and Dmitry Torokhov committed Jul 15, 2010
1 parent 4cf51c3 commit ed4299e
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions drivers/input/touchscreen/usbtouchscreen.c
Original file line number Diff line number Diff line change
Expand Up @@ -1296,6 +1296,29 @@ static void usbtouch_close(struct input_dev *input)
usb_kill_urb(usbtouch->irq);
}

static int usbtouch_suspend
(struct usb_interface *intf, pm_message_t message)
{
struct usbtouch_usb *usbtouch = usb_get_intfdata(intf);

usb_kill_urb(usbtouch->irq);

return 0;
}

static int usbtouch_resume(struct usb_interface *intf)
{
struct usbtouch_usb *usbtouch = usb_get_intfdata(intf);
struct input_dev *input = usbtouch->input;
int result = 0;

mutex_lock(&input->mutex);
if (input->users || usbtouch->type->irq_always)
result = usb_submit_urb(usbtouch->irq, GFP_NOIO);
mutex_unlock(&input->mutex);

return result;
}

static void usbtouch_free_buffers(struct usb_device *udev,
struct usbtouch_usb *usbtouch)
Expand Down Expand Up @@ -1486,6 +1509,8 @@ static struct usb_driver usbtouch_driver = {
.name = "usbtouchscreen",
.probe = usbtouch_probe,
.disconnect = usbtouch_disconnect,
.suspend = usbtouch_suspend,
.resume = usbtouch_resume,
.id_table = usbtouch_devices,
};

Expand Down

0 comments on commit ed4299e

Please sign in to comment.