aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/usbtouchscreen.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/touchscreen/usbtouchscreen.c')
-rw-r--r--drivers/input/touchscreen/usbtouchscreen.c93
1 files changed, 91 insertions, 2 deletions
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index 741f6c6f1e50..9fb3d5c30999 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -10,6 +10,7 @@
10 * - Gunze AHL61 10 * - Gunze AHL61
11 * - DMC TSC-10/25 11 * - DMC TSC-10/25
12 * - IRTOUCHSYSTEMS/UNITOP 12 * - IRTOUCHSYSTEMS/UNITOP
13 * - IdealTEK URTC1000
13 * 14 *
14 * Copyright (C) 2004-2006 by Daniel Ritz <daniel.ritz@gmx.ch> 15 * Copyright (C) 2004-2006 by Daniel Ritz <daniel.ritz@gmx.ch>
15 * Copyright (C) by Todd E. Johnson (mtouchusb.c) 16 * Copyright (C) by Todd E. Johnson (mtouchusb.c)
@@ -92,7 +93,7 @@ struct usbtouch_usb {
92}; 93};
93 94
94 95
95#if defined(CONFIG_TOUCHSCREEN_USB_EGALAX) || defined(CONFIG_TOUCHSCREEN_USB_ETURBO) 96#if defined(CONFIG_TOUCHSCREEN_USB_EGALAX) || defined(CONFIG_TOUCHSCREEN_USB_ETURBO) || defined(CONFIG_TOUCHSCREEN_USB_IDEALTEK)
96#define MULTI_PACKET 97#define MULTI_PACKET
97#endif 98#endif
98 99
@@ -112,6 +113,8 @@ enum {
112 DEVTYPE_GUNZE, 113 DEVTYPE_GUNZE,
113 DEVTYPE_DMC_TSC10, 114 DEVTYPE_DMC_TSC10,
114 DEVTYPE_IRTOUCH, 115 DEVTYPE_IRTOUCH,
116 DEVTYPE_IDEALTEK,
117 DEVTYPE_GENERAL_TOUCH,
115}; 118};
116 119
117static struct usb_device_id usbtouch_devices[] = { 120static struct usb_device_id usbtouch_devices[] = {
@@ -157,6 +160,14 @@ static struct usb_device_id usbtouch_devices[] = {
157 {USB_DEVICE(0x6615, 0x0001), .driver_info = DEVTYPE_IRTOUCH}, 160 {USB_DEVICE(0x6615, 0x0001), .driver_info = DEVTYPE_IRTOUCH},
158#endif 161#endif
159 162
163#ifdef CONFIG_TOUCHSCREEN_USB_IDEALTEK
164 {USB_DEVICE(0x1391, 0x1000), .driver_info = DEVTYPE_IDEALTEK},
165#endif
166
167#ifdef CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH
168 {USB_DEVICE(0x0dfc, 0x0001), .driver_info = DEVTYPE_GENERAL_TOUCH},
169#endif
170
160 {} 171 {}
161}; 172};
162 173
@@ -396,7 +407,8 @@ static int dmc_tsc10_init(struct usbtouch_usb *usbtouch)
396 TSC10_RATE_150, 0, buf, 2, USB_CTRL_SET_TIMEOUT); 407 TSC10_RATE_150, 0, buf, 2, USB_CTRL_SET_TIMEOUT);
397 if (ret < 0) 408 if (ret < 0)
398 return ret; 409 return ret;
399 if (buf[0] != 0x06 || buf[1] != 0x00) 410 if ((buf[0] != 0x06 || buf[1] != 0x00) &&
411 (buf[0] != 0x15 || buf[1] != 0x01))
400 return -ENODEV; 412 return -ENODEV;
401 413
402 /* start sending data */ 414 /* start sending data */
@@ -438,6 +450,57 @@ static int irtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
438 450
439 451
440/***************************************************************************** 452/*****************************************************************************
453 * IdealTEK URTC1000 Part
454 */
455#ifdef CONFIG_TOUCHSCREEN_USB_IDEALTEK
456static int idealtek_get_pkt_len(unsigned char *buf, int len)
457{
458 if (buf[0] & 0x80)
459 return 5;
460 if (buf[0] == 0x01)
461 return len;
462 return 0;
463}
464
465static int idealtek_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
466{
467 switch (pkt[0] & 0x98) {
468 case 0x88:
469 /* touch data in IdealTEK mode */
470 dev->x = (pkt[1] << 5) | (pkt[2] >> 2);
471 dev->y = (pkt[3] << 5) | (pkt[4] >> 2);
472 dev->touch = (pkt[0] & 0x40) ? 1 : 0;
473 return 1;
474
475 case 0x98:
476 /* touch data in MT emulation mode */
477 dev->x = (pkt[2] << 5) | (pkt[1] >> 2);
478 dev->y = (pkt[4] << 5) | (pkt[3] >> 2);
479 dev->touch = (pkt[0] & 0x40) ? 1 : 0;
480 return 1;
481
482 default:
483 return 0;
484 }
485}
486#endif
487
488/*****************************************************************************
489 * General Touch Part
490 */
491#ifdef CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH
492static int general_touch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
493{
494 dev->x = ((pkt[2] & 0x0F) << 8) | pkt[1] ;
495 dev->y = ((pkt[4] & 0x0F) << 8) | pkt[3] ;
496 dev->press = pkt[5] & 0xff;
497 dev->touch = pkt[0] & 0x01;
498
499 return 1;
500}
501#endif
502
503/*****************************************************************************
441 * the different device descriptors 504 * the different device descriptors
442 */ 505 */
443static struct usbtouch_device_info usbtouch_dev_info[] = { 506static struct usbtouch_device_info usbtouch_dev_info[] = {
@@ -537,6 +600,32 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
537 .read_data = irtouch_read_data, 600 .read_data = irtouch_read_data,
538 }, 601 },
539#endif 602#endif
603
604#ifdef CONFIG_TOUCHSCREEN_USB_IDEALTEK
605 [DEVTYPE_IDEALTEK] = {
606 .min_xc = 0x0,
607 .max_xc = 0x0fff,
608 .min_yc = 0x0,
609 .max_yc = 0x0fff,
610 .rept_size = 8,
611 .flags = USBTOUCH_FLG_BUFFER,
612 .process_pkt = usbtouch_process_multi,
613 .get_pkt_len = idealtek_get_pkt_len,
614 .read_data = idealtek_read_data,
615 },
616#endif
617
618#ifdef CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH
619 [DEVTYPE_GENERAL_TOUCH] = {
620 .min_xc = 0x0,
621 .max_xc = 0x0500,
622 .min_yc = 0x0,
623 .max_yc = 0x0500,
624 .rept_size = 7,
625 .read_data = general_touch_read_data,
626 }
627#endif
628
540}; 629};
541 630
542 631