Skip to content

Commit 90d95ef

Browse files
Oliver Neukumdtor
authored andcommitted
Input: appletouch - implement reset-resume logic
On some boxes the touchpad needs to be reinitialized after resume to make it function again. This fixes bugzilla #10825. Signed-off-by: Oliver Neukum <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 2f6a77d commit 90d95ef

File tree

2 files changed

+44
-8
lines changed

2 files changed

+44
-8
lines changed

drivers/input/mouse/appletouch.c

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,21 @@ static void atp_close(struct input_dev *input)
589589
dev->open = 0;
590590
}
591591

592+
static int atp_handle_geyser(struct atp *dev)
593+
{
594+
struct usb_device *udev = dev->udev;
595+
596+
if (!atp_is_fountain(dev)) {
597+
/* switch to raw sensor mode */
598+
if (atp_geyser_init(udev))
599+
return -EIO;
600+
601+
printk(KERN_INFO "appletouch: Geyser mode initialized.\n");
602+
}
603+
604+
return 0;
605+
}
606+
592607
static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id)
593608
{
594609
struct atp *dev;
@@ -633,14 +648,6 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
633648
else
634649
dev->datalen = 81;
635650

636-
if (!atp_is_fountain(dev)) {
637-
/* switch to raw sensor mode */
638-
if (atp_geyser_init(udev))
639-
goto err_free_devs;
640-
641-
printk(KERN_INFO "appletouch: Geyser mode initialized.\n");
642-
}
643-
644651
dev->urb = usb_alloc_urb(0, GFP_KERNEL);
645652
if (!dev->urb)
646653
goto err_free_devs;
@@ -654,6 +661,10 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
654661
usb_rcvintpipe(udev, int_in_endpointAddr),
655662
dev->data, dev->datalen, atp_complete, dev, 1);
656663

664+
error = atp_handle_geyser(dev);
665+
if (error)
666+
goto err_free_buffer;
667+
657668
usb_make_path(udev, dev->phys, sizeof(dev->phys));
658669
strlcat(dev->phys, "/input0", sizeof(dev->phys));
659670

@@ -744,6 +755,20 @@ static void atp_disconnect(struct usb_interface *iface)
744755
printk(KERN_INFO "input: appletouch disconnected\n");
745756
}
746757

758+
static int atp_recover(struct atp *dev)
759+
{
760+
int error;
761+
762+
error = atp_handle_geyser(dev);
763+
if (error)
764+
return error;
765+
766+
if (dev->open && usb_submit_urb(dev->urb, GFP_ATOMIC))
767+
return -EIO;
768+
769+
return 0;
770+
}
771+
747772
static int atp_suspend(struct usb_interface *iface, pm_message_t message)
748773
{
749774
struct atp *dev = usb_get_intfdata(iface);
@@ -764,12 +789,20 @@ static int atp_resume(struct usb_interface *iface)
764789
return 0;
765790
}
766791

792+
static int atp_reset_resume(struct usb_interface *iface)
793+
{
794+
struct atp *dev = usb_get_intfdata(iface);
795+
796+
return atp_recover(dev);
797+
}
798+
767799
static struct usb_driver atp_driver = {
768800
.name = "appletouch",
769801
.probe = atp_probe,
770802
.disconnect = atp_disconnect,
771803
.suspend = atp_suspend,
772804
.resume = atp_resume,
805+
.reset_resume = atp_reset_resume,
773806
.id_table = atp_table,
774807
};
775808

drivers/usb/core/quirks.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ static const struct usb_device_id usb_quirk_list[] = {
4747
/* Edirol SD-20 */
4848
{ USB_DEVICE(0x0582, 0x0027), .driver_info = USB_QUIRK_RESET_RESUME },
4949

50+
/* appletouch */
51+
{ USB_DEVICE(0x05ac, 0x021a), .driver_info = USB_QUIRK_RESET_RESUME },
52+
5053
/* M-Systems Flash Disk Pioneers */
5154
{ USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME },
5255

0 commit comments

Comments
 (0)