diff options
Diffstat (limited to 'drivers/input/touchscreen/usbtouchscreen.c')
-rw-r--r-- | drivers/input/touchscreen/usbtouchscreen.c | 104 |
1 files changed, 100 insertions, 4 deletions
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index 68ece5801a58..09a5e7341bd5 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c | |||
@@ -14,6 +14,7 @@ | |||
14 | * - General Touch | 14 | * - General Touch |
15 | * - GoTop Super_Q2/GogoPen/PenPower tablets | 15 | * - GoTop Super_Q2/GogoPen/PenPower tablets |
16 | * - JASTEC USB touch controller/DigiTech DTR-02U | 16 | * - JASTEC USB touch controller/DigiTech DTR-02U |
17 | * - Zytronic capacitive touchscreen | ||
17 | * | 18 | * |
18 | * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch> | 19 | * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch> |
19 | * Copyright (C) by Todd E. Johnson (mtouchusb.c) | 20 | * Copyright (C) by Todd E. Johnson (mtouchusb.c) |
@@ -73,6 +74,15 @@ struct usbtouch_device_info { | |||
73 | int min_press, max_press; | 74 | int min_press, max_press; |
74 | int rept_size; | 75 | int rept_size; |
75 | 76 | ||
77 | /* | ||
78 | * Always service the USB devices irq not just when the input device is | ||
79 | * open. This is useful when devices have a watchdog which prevents us | ||
80 | * from periodically polling the device. Leave this unset unless your | ||
81 | * touchscreen device requires it, as it does consume more of the USB | ||
82 | * bandwidth. | ||
83 | */ | ||
84 | bool irq_always; | ||
85 | |||
76 | void (*process_pkt) (struct usbtouch_usb *usbtouch, unsigned char *pkt, int len); | 86 | void (*process_pkt) (struct usbtouch_usb *usbtouch, unsigned char *pkt, int len); |
77 | 87 | ||
78 | /* | 88 | /* |
@@ -121,6 +131,8 @@ enum { | |||
121 | DEVTYPE_GOTOP, | 131 | DEVTYPE_GOTOP, |
122 | DEVTYPE_JASTEC, | 132 | DEVTYPE_JASTEC, |
123 | DEVTYPE_E2I, | 133 | DEVTYPE_E2I, |
134 | DEVTYPE_ZYTRONIC, | ||
135 | DEVTYPE_TC5UH, | ||
124 | }; | 136 | }; |
125 | 137 | ||
126 | #define USB_DEVICE_HID_CLASS(vend, prod) \ | 138 | #define USB_DEVICE_HID_CLASS(vend, prod) \ |
@@ -201,6 +213,15 @@ static struct usb_device_id usbtouch_devices[] = { | |||
201 | #ifdef CONFIG_TOUCHSCREEN_USB_E2I | 213 | #ifdef CONFIG_TOUCHSCREEN_USB_E2I |
202 | {USB_DEVICE(0x1ac7, 0x0001), .driver_info = DEVTYPE_E2I}, | 214 | {USB_DEVICE(0x1ac7, 0x0001), .driver_info = DEVTYPE_E2I}, |
203 | #endif | 215 | #endif |
216 | |||
217 | #ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC | ||
218 | {USB_DEVICE(0x14c8, 0x0003), .driver_info = DEVTYPE_ZYTRONIC}, | ||
219 | #endif | ||
220 | |||
221 | #ifdef CONFIG_TOUCHSCREEN_USB_ETT_TC5UH | ||
222 | {USB_DEVICE(0x0664, 0x0309), .driver_info = DEVTYPE_TC5UH}, | ||
223 | #endif | ||
224 | |||
204 | {} | 225 | {} |
205 | }; | 226 | }; |
206 | 227 | ||
@@ -538,6 +559,19 @@ static int irtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | |||
538 | } | 559 | } |
539 | #endif | 560 | #endif |
540 | 561 | ||
562 | /***************************************************************************** | ||
563 | * ET&T TC5UH part | ||
564 | */ | ||
565 | #ifdef CONFIG_TOUCHSCREEN_USB_ETT_TC5UH | ||
566 | static int tc5uh_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | ||
567 | { | ||
568 | dev->x = ((pkt[2] & 0x0F) << 8) | pkt[1]; | ||
569 | dev->y = ((pkt[4] & 0x0F) << 8) | pkt[3]; | ||
570 | dev->touch = pkt[0] & 0x01; | ||
571 | |||
572 | return 1; | ||
573 | } | ||
574 | #endif | ||
541 | 575 | ||
542 | /***************************************************************************** | 576 | /***************************************************************************** |
543 | * IdealTEK URTC1000 Part | 577 | * IdealTEK URTC1000 Part |
@@ -621,6 +655,39 @@ static int jastec_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | |||
621 | } | 655 | } |
622 | #endif | 656 | #endif |
623 | 657 | ||
658 | /***************************************************************************** | ||
659 | * Zytronic Part | ||
660 | */ | ||
661 | #ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC | ||
662 | static int zytronic_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | ||
663 | { | ||
664 | switch (pkt[0]) { | ||
665 | case 0x3A: /* command response */ | ||
666 | dbg("%s: Command response %d", __func__, pkt[1]); | ||
667 | break; | ||
668 | |||
669 | case 0xC0: /* down */ | ||
670 | dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7); | ||
671 | dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7); | ||
672 | dev->touch = 1; | ||
673 | dbg("%s: down %d,%d", __func__, dev->x, dev->y); | ||
674 | return 1; | ||
675 | |||
676 | case 0x80: /* up */ | ||
677 | dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7); | ||
678 | dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7); | ||
679 | dev->touch = 0; | ||
680 | dbg("%s: up %d,%d", __func__, dev->x, dev->y); | ||
681 | return 1; | ||
682 | |||
683 | default: | ||
684 | dbg("%s: Unknown return %d", __func__, pkt[0]); | ||
685 | break; | ||
686 | } | ||
687 | |||
688 | return 0; | ||
689 | } | ||
690 | #endif | ||
624 | 691 | ||
625 | /***************************************************************************** | 692 | /***************************************************************************** |
626 | * the different device descriptors | 693 | * the different device descriptors |
@@ -783,6 +850,29 @@ static struct usbtouch_device_info usbtouch_dev_info[] = { | |||
783 | .read_data = e2i_read_data, | 850 | .read_data = e2i_read_data, |
784 | }, | 851 | }, |
785 | #endif | 852 | #endif |
853 | |||
854 | #ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC | ||
855 | [DEVTYPE_ZYTRONIC] = { | ||
856 | .min_xc = 0x0, | ||
857 | .max_xc = 0x03ff, | ||
858 | .min_yc = 0x0, | ||
859 | .max_yc = 0x03ff, | ||
860 | .rept_size = 5, | ||
861 | .read_data = zytronic_read_data, | ||
862 | .irq_always = true, | ||
863 | }, | ||
864 | #endif | ||
865 | |||
866 | #ifdef CONFIG_TOUCHSCREEN_USB_ETT_TC5UH | ||
867 | [DEVTYPE_TC5UH] = { | ||
868 | .min_xc = 0x0, | ||
869 | .max_xc = 0x0fff, | ||
870 | .min_yc = 0x0, | ||
871 | .max_yc = 0x0fff, | ||
872 | .rept_size = 5, | ||
873 | .read_data = tc5uh_read_data, | ||
874 | }, | ||
875 | #endif | ||
786 | }; | 876 | }; |
787 | 877 | ||
788 | 878 | ||
@@ -933,8 +1023,10 @@ static int usbtouch_open(struct input_dev *input) | |||
933 | 1023 | ||
934 | usbtouch->irq->dev = usbtouch->udev; | 1024 | usbtouch->irq->dev = usbtouch->udev; |
935 | 1025 | ||
936 | if (usb_submit_urb(usbtouch->irq, GFP_KERNEL)) | 1026 | if (!usbtouch->type->irq_always) { |
937 | return -EIO; | 1027 | if (usb_submit_urb(usbtouch->irq, GFP_KERNEL)) |
1028 | return -EIO; | ||
1029 | } | ||
938 | 1030 | ||
939 | return 0; | 1031 | return 0; |
940 | } | 1032 | } |
@@ -943,7 +1035,8 @@ static void usbtouch_close(struct input_dev *input) | |||
943 | { | 1035 | { |
944 | struct usbtouch_usb *usbtouch = input_get_drvdata(input); | 1036 | struct usbtouch_usb *usbtouch = input_get_drvdata(input); |
945 | 1037 | ||
946 | usb_kill_urb(usbtouch->irq); | 1038 | if (!usbtouch->type->irq_always) |
1039 | usb_kill_urb(usbtouch->irq); | ||
947 | } | 1040 | } |
948 | 1041 | ||
949 | 1042 | ||
@@ -1066,6 +1159,9 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
1066 | 1159 | ||
1067 | usb_set_intfdata(intf, usbtouch); | 1160 | usb_set_intfdata(intf, usbtouch); |
1068 | 1161 | ||
1162 | if (usbtouch->type->irq_always) | ||
1163 | usb_submit_urb(usbtouch->irq, GFP_KERNEL); | ||
1164 | |||
1069 | return 0; | 1165 | return 0; |
1070 | 1166 | ||
1071 | out_free_buffers: | 1167 | out_free_buffers: |
@@ -1087,7 +1183,7 @@ static void usbtouch_disconnect(struct usb_interface *intf) | |||
1087 | 1183 | ||
1088 | dbg("%s - usbtouch is initialized, cleaning up", __func__); | 1184 | dbg("%s - usbtouch is initialized, cleaning up", __func__); |
1089 | usb_set_intfdata(intf, NULL); | 1185 | usb_set_intfdata(intf, NULL); |
1090 | usb_kill_urb(usbtouch->irq); | 1186 | /* this will stop IO via close */ |
1091 | input_unregister_device(usbtouch->input); | 1187 | input_unregister_device(usbtouch->input); |
1092 | usb_free_urb(usbtouch->irq); | 1188 | usb_free_urb(usbtouch->irq); |
1093 | usbtouch_free_buffers(interface_to_usbdev(intf), usbtouch); | 1189 | usbtouch_free_buffers(interface_to_usbdev(intf), usbtouch); |