aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/appletouch.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2008-06-17 12:02:44 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2008-06-17 12:02:44 -0400
commit15439dd37f92f930ac7fc65a4f261834e4215bb0 (patch)
treeec8e4a7cffd1cbb55ae4970c3172fa9a6fb0c0f7 /drivers/input/mouse/appletouch.c
parent39ab9ddeb3e9573a1ea9a17a1431ea5c81681964 (diff)
parent90d95ef617a535a8832bdcb8dee07bf591e5dd82 (diff)
Merge branch 'for-linus' into next
Conflicts: drivers/input/mouse/appletouch.c
Diffstat (limited to 'drivers/input/mouse/appletouch.c')
-rw-r--r--drivers/input/mouse/appletouch.c49
1 files changed, 41 insertions, 8 deletions
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
index 6867c914b024..1f41ae94f26b 100644
--- a/drivers/input/mouse/appletouch.c
+++ b/drivers/input/mouse/appletouch.c
@@ -564,6 +564,21 @@ static void atp_close(struct input_dev *input)
564 dev->open = 0; 564 dev->open = 0;
565} 565}
566 566
567static int atp_handle_geyser(struct atp *dev)
568{
569 struct usb_device *udev = dev->udev;
570
571 if (dev->type != ATP_FOUNTAIN) {
572 /* switch to raw sensor mode */
573 if (atp_geyser_init(udev))
574 return -EIO;
575
576 printk(KERN_INFO "appletouch: Geyser mode initialized.\n");
577 }
578
579 return 0;
580}
581
567static int atp_probe(struct usb_interface *iface, 582static int atp_probe(struct usb_interface *iface,
568 const struct usb_device_id *id) 583 const struct usb_device_id *id)
569{ 584{
@@ -608,14 +623,6 @@ static int atp_probe(struct usb_interface *iface,
608 else 623 else
609 dev->datalen = 64; 624 dev->datalen = 64;
610 625
611 if (dev->type != ATP_FOUNTAIN) {
612 /* switch to raw sensor mode */
613 if (atp_geyser_init(udev))
614 goto err_free_devs;
615
616 printk(KERN_INFO "appletouch: Geyser mode initialized.\n");
617 }
618
619 dev->urb = usb_alloc_urb(0, GFP_KERNEL); 626 dev->urb = usb_alloc_urb(0, GFP_KERNEL);
620 if (!dev->urb) 627 if (!dev->urb)
621 goto err_free_devs; 628 goto err_free_devs;
@@ -629,6 +636,10 @@ static int atp_probe(struct usb_interface *iface,
629 usb_rcvintpipe(udev, int_in_endpointAddr), 636 usb_rcvintpipe(udev, int_in_endpointAddr),
630 dev->data, dev->datalen, atp_complete, dev, 1); 637 dev->data, dev->datalen, atp_complete, dev, 1);
631 638
639 error = atp_handle_geyser(dev);
640 if (error)
641 goto err_free_buffer;
642
632 usb_make_path(udev, dev->phys, sizeof(dev->phys)); 643 usb_make_path(udev, dev->phys, sizeof(dev->phys));
633 strlcat(dev->phys, "/input0", sizeof(dev->phys)); 644 strlcat(dev->phys, "/input0", sizeof(dev->phys));
634 645
@@ -721,6 +732,20 @@ static void atp_disconnect(struct usb_interface *iface)
721 printk(KERN_INFO "input: appletouch disconnected\n"); 732 printk(KERN_INFO "input: appletouch disconnected\n");
722} 733}
723 734
735static int atp_recover(struct atp *dev)
736{
737 int error;
738
739 error = atp_handle_geyser(dev);
740 if (error)
741 return error;
742
743 if (dev->open && usb_submit_urb(dev->urb, GFP_ATOMIC))
744 return -EIO;
745
746 return 0;
747}
748
724static int atp_suspend(struct usb_interface *iface, pm_message_t message) 749static int atp_suspend(struct usb_interface *iface, pm_message_t message)
725{ 750{
726 struct atp *dev = usb_get_intfdata(iface); 751 struct atp *dev = usb_get_intfdata(iface);
@@ -741,12 +766,20 @@ static int atp_resume(struct usb_interface *iface)
741 return 0; 766 return 0;
742} 767}
743 768
769static int atp_reset_resume(struct usb_interface *iface)
770{
771 struct atp *dev = usb_get_intfdata(iface);
772
773 return atp_recover(dev);
774}
775
744static struct usb_driver atp_driver = { 776static struct usb_driver atp_driver = {
745 .name = "appletouch", 777 .name = "appletouch",
746 .probe = atp_probe, 778 .probe = atp_probe,
747 .disconnect = atp_disconnect, 779 .disconnect = atp_disconnect,
748 .suspend = atp_suspend, 780 .suspend = atp_suspend,
749 .resume = atp_resume, 781 .resume = atp_resume,
782 .reset_resume = atp_reset_resume,
750 .id_table = atp_table, 783 .id_table = atp_table,
751}; 784};
752 785