diff options
author | Daniel Silverstone <dsilvers@simtec.co.uk> | 2009-11-23 11:38:16 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-11-23 11:52:08 -0500 |
commit | 2330ed18b27a8f4f10e48e0a1c65ede56e03825c (patch) | |
tree | bd328f187a10d6cb9470f2a622fdfb185ff7fdb6 | |
parent | 721a730eceb009ba61f8eeee31360c02ed8f6aba (diff) |
Input: usbtouchscreen - add support for Zytronic capacitive touchscreen
Zytronic USB-attached capacitive touchscreen support within the generic
USB touchscreen driver.
Signed-off-by: Daniel Silverstone <dsilvers@simtec.co.uk>
Signed-off-by: Vincent Sanders <vince@simtec.co.uk>
Signed-off-by: Simtec Linux Team <linux@simtec.co.uk>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
-rw-r--r-- | drivers/input/touchscreen/Kconfig | 6 | ||||
-rw-r--r-- | drivers/input/touchscreen/usbtouchscreen.c | 73 |
2 files changed, 76 insertions, 3 deletions
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index aebea71ff02a..c04fb531d63d 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig | |||
@@ -430,6 +430,7 @@ config TOUCHSCREEN_USB_COMPOSITE | |||
430 | - IdealTEK URTC1000 | 430 | - IdealTEK URTC1000 |
431 | - GoTop Super_Q2/GogoPen/PenPower tablets | 431 | - GoTop Super_Q2/GogoPen/PenPower tablets |
432 | - JASTEC USB Touch Controller/DigiTech DTR-02U | 432 | - JASTEC USB Touch Controller/DigiTech DTR-02U |
433 | - Zytronic controllers | ||
433 | 434 | ||
434 | Have a look at <http://linux.chapter7.ch/touchkit/> for | 435 | Have a look at <http://linux.chapter7.ch/touchkit/> for |
435 | a usage description and the required user-space stuff. | 436 | a usage description and the required user-space stuff. |
@@ -502,6 +503,11 @@ config TOUCHSCREEN_USB_E2I | |||
502 | bool "e2i Touchscreen controller (e.g. from Mimo 740)" | 503 | bool "e2i Touchscreen controller (e.g. from Mimo 740)" |
503 | depends on TOUCHSCREEN_USB_COMPOSITE | 504 | depends on TOUCHSCREEN_USB_COMPOSITE |
504 | 505 | ||
506 | config TOUCHSCREEN_USB_ZYTRONIC | ||
507 | default y | ||
508 | bool "Zytronic controller" if EMBEDDED | ||
509 | depends on TOUCHSCREEN_USB_COMPOSITE | ||
510 | |||
505 | config TOUCHSCREEN_TOUCHIT213 | 511 | config TOUCHSCREEN_TOUCHIT213 |
506 | tristate "Sahara TouchIT-213 touchscreen" | 512 | tristate "Sahara TouchIT-213 touchscreen" |
507 | select SERIO | 513 | select SERIO |
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index eddb628c5459..4474e2339f47 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,7 @@ enum { | |||
121 | DEVTYPE_GOTOP, | 131 | DEVTYPE_GOTOP, |
122 | DEVTYPE_JASTEC, | 132 | DEVTYPE_JASTEC, |
123 | DEVTYPE_E2I, | 133 | DEVTYPE_E2I, |
134 | DEVTYPE_ZYTRONIC, | ||
124 | }; | 135 | }; |
125 | 136 | ||
126 | #define USB_DEVICE_HID_CLASS(vend, prod) \ | 137 | #define USB_DEVICE_HID_CLASS(vend, prod) \ |
@@ -201,6 +212,11 @@ static struct usb_device_id usbtouch_devices[] = { | |||
201 | #ifdef CONFIG_TOUCHSCREEN_USB_E2I | 212 | #ifdef CONFIG_TOUCHSCREEN_USB_E2I |
202 | {USB_DEVICE(0x1ac7, 0x0001), .driver_info = DEVTYPE_E2I}, | 213 | {USB_DEVICE(0x1ac7, 0x0001), .driver_info = DEVTYPE_E2I}, |
203 | #endif | 214 | #endif |
215 | |||
216 | #ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC | ||
217 | {USB_DEVICE(0x14c8, 0x0003), .driver_info = DEVTYPE_ZYTRONIC}, | ||
218 | #endif | ||
219 | |||
204 | {} | 220 | {} |
205 | }; | 221 | }; |
206 | 222 | ||
@@ -621,6 +637,39 @@ static int jastec_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | |||
621 | } | 637 | } |
622 | #endif | 638 | #endif |
623 | 639 | ||
640 | /***************************************************************************** | ||
641 | * Zytronic Part | ||
642 | */ | ||
643 | #ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC | ||
644 | static int zytronic_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | ||
645 | { | ||
646 | switch (pkt[0]) { | ||
647 | case 0x3A: /* command response */ | ||
648 | dbg("%s: Command response %d", __func__, pkt[1]); | ||
649 | break; | ||
650 | |||
651 | case 0xC0: /* down */ | ||
652 | dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7); | ||
653 | dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7); | ||
654 | dev->touch = 1; | ||
655 | dbg("%s: down %d,%d", __func__, dev->x, dev->y); | ||
656 | return 1; | ||
657 | |||
658 | case 0x80: /* up */ | ||
659 | dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7); | ||
660 | dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7); | ||
661 | dev->touch = 0; | ||
662 | dbg("%s: up %d,%d", __func__, dev->x, dev->y); | ||
663 | return 1; | ||
664 | |||
665 | default: | ||
666 | dbg("%s: Unknown return %d", __func__, pkt[0]); | ||
667 | break; | ||
668 | } | ||
669 | |||
670 | return 0; | ||
671 | } | ||
672 | #endif | ||
624 | 673 | ||
625 | /***************************************************************************** | 674 | /***************************************************************************** |
626 | * the different device descriptors | 675 | * the different device descriptors |
@@ -783,6 +832,18 @@ static struct usbtouch_device_info usbtouch_dev_info[] = { | |||
783 | .read_data = e2i_read_data, | 832 | .read_data = e2i_read_data, |
784 | }, | 833 | }, |
785 | #endif | 834 | #endif |
835 | |||
836 | #ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC | ||
837 | [DEVTYPE_ZYTRONIC] = { | ||
838 | .min_xc = 0x0, | ||
839 | .max_xc = 0x03ff, | ||
840 | .min_yc = 0x0, | ||
841 | .max_yc = 0x03ff, | ||
842 | .rept_size = 5, | ||
843 | .read_data = zytronic_read_data, | ||
844 | .irq_always = true, | ||
845 | }, | ||
846 | #endif | ||
786 | }; | 847 | }; |
787 | 848 | ||
788 | 849 | ||
@@ -933,8 +994,10 @@ static int usbtouch_open(struct input_dev *input) | |||
933 | 994 | ||
934 | usbtouch->irq->dev = usbtouch->udev; | 995 | usbtouch->irq->dev = usbtouch->udev; |
935 | 996 | ||
936 | if (usb_submit_urb(usbtouch->irq, GFP_KERNEL)) | 997 | if (!usbtouch->type->irq_always) { |
937 | return -EIO; | 998 | if (usb_submit_urb(usbtouch->irq, GFP_KERNEL)) |
999 | return -EIO; | ||
1000 | } | ||
938 | 1001 | ||
939 | return 0; | 1002 | return 0; |
940 | } | 1003 | } |
@@ -943,7 +1006,8 @@ static void usbtouch_close(struct input_dev *input) | |||
943 | { | 1006 | { |
944 | struct usbtouch_usb *usbtouch = input_get_drvdata(input); | 1007 | struct usbtouch_usb *usbtouch = input_get_drvdata(input); |
945 | 1008 | ||
946 | usb_kill_urb(usbtouch->irq); | 1009 | if (!usbtouch->type->irq_always) |
1010 | usb_kill_urb(usbtouch->irq); | ||
947 | } | 1011 | } |
948 | 1012 | ||
949 | 1013 | ||
@@ -1066,6 +1130,9 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
1066 | 1130 | ||
1067 | usb_set_intfdata(intf, usbtouch); | 1131 | usb_set_intfdata(intf, usbtouch); |
1068 | 1132 | ||
1133 | if (usbtouch->type->irq_always) | ||
1134 | usb_submit_urb(usbtouch->irq, GFP_KERNEL); | ||
1135 | |||
1069 | return 0; | 1136 | return 0; |
1070 | 1137 | ||
1071 | out_free_buffers: | 1138 | out_free_buffers: |