aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/usbtouchscreen.c
diff options
context:
space:
mode:
authorArmando Visconti <armando.visconti@st.com>2012-03-04 13:41:36 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2012-03-04 13:45:13 -0500
commitaa87512fbc56e107c14f7fa85823eb7e82a2f64c (patch)
tree08962a6d67b9f5278cf9f81d5f8057e8813b4aaa /drivers/input/touchscreen/usbtouchscreen.c
parentf0c5f65bc5729e94c62953eae0712b392f09bec1 (diff)
Input: usbtouchscreen - add support for Data Modul EasyTouch TP 72037
The Data Modul TP 72037 EasyTouch controller is derived from EGALAX controller and is capable of detecting dual contacts. Packets can be 5 bytes or 10 bytes long, depending whether one or two contacts are detected. Format is same as EGALAX touch controller, but with x and y coordinates inverted. Signed-off-by: Armando Visconti <armando.visconti@st.com> Signed-off-by: Viresh Kumar <viresh.kumar@st.com> Signed-off-by: Daniel Ritz <daniel.ritz@gmx.ch> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/touchscreen/usbtouchscreen.c')
-rw-r--r--drivers/input/touchscreen/usbtouchscreen.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index 9dbd8b4d9a6..36fa29266f4 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -17,6 +17,7 @@
17 * - Zytronic capacitive touchscreen 17 * - Zytronic capacitive touchscreen
18 * - NEXIO/iNexio 18 * - NEXIO/iNexio
19 * - Elo TouchSystems 2700 IntelliTouch 19 * - Elo TouchSystems 2700 IntelliTouch
20 * - EasyTouch USB Dual/Multi touch controller from Data Modul
20 * 21 *
21 * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch> 22 * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch>
22 * Copyright (C) by Todd E. Johnson (mtouchusb.c) 23 * Copyright (C) by Todd E. Johnson (mtouchusb.c)
@@ -140,6 +141,7 @@ enum {
140 DEVTYPE_TC45USB, 141 DEVTYPE_TC45USB,
141 DEVTYPE_NEXIO, 142 DEVTYPE_NEXIO,
142 DEVTYPE_ELO, 143 DEVTYPE_ELO,
144 DEVTYPE_ETOUCH,
143}; 145};
144 146
145#define USB_DEVICE_HID_CLASS(vend, prod) \ 147#define USB_DEVICE_HID_CLASS(vend, prod) \
@@ -245,6 +247,10 @@ static const struct usb_device_id usbtouch_devices[] = {
245 {USB_DEVICE(0x04e7, 0x0020), .driver_info = DEVTYPE_ELO}, 247 {USB_DEVICE(0x04e7, 0x0020), .driver_info = DEVTYPE_ELO},
246#endif 248#endif
247 249
250#ifdef CONFIG_TOUCHSCREEN_USB_EASYTOUCH
251 {USB_DEVICE(0x7374, 0x0001), .driver_info = DEVTYPE_ETOUCH},
252#endif
253
248 {} 254 {}
249}; 255};
250 256
@@ -326,6 +332,51 @@ static int egalax_get_pkt_len(unsigned char *buf, int len)
326} 332}
327#endif 333#endif
328 334
335/*****************************************************************************
336 * EasyTouch part
337 */
338
339#ifdef CONFIG_TOUCHSCREEN_USB_EASYTOUCH
340
341#ifndef MULTI_PACKET
342#define MULTI_PACKET
343#endif
344
345#define ETOUCH_PKT_TYPE_MASK 0xFE
346#define ETOUCH_PKT_TYPE_REPT 0x80
347#define ETOUCH_PKT_TYPE_REPT2 0xB0
348#define ETOUCH_PKT_TYPE_DIAG 0x0A
349
350static int etouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
351{
352 if ((pkt[0] & ETOUCH_PKT_TYPE_MASK) != ETOUCH_PKT_TYPE_REPT &&
353 (pkt[0] & ETOUCH_PKT_TYPE_MASK) != ETOUCH_PKT_TYPE_REPT2)
354 return 0;
355
356 dev->x = ((pkt[1] & 0x1F) << 7) | (pkt[2] & 0x7F);
357 dev->y = ((pkt[3] & 0x1F) << 7) | (pkt[4] & 0x7F);
358 dev->touch = pkt[0] & 0x01;
359
360 return 1;
361}
362
363static int etouch_get_pkt_len(unsigned char *buf, int len)
364{
365 switch (buf[0] & ETOUCH_PKT_TYPE_MASK) {
366 case ETOUCH_PKT_TYPE_REPT:
367 case ETOUCH_PKT_TYPE_REPT2:
368 return 5;
369
370 case ETOUCH_PKT_TYPE_DIAG:
371 if (len < 2)
372 return -1;
373
374 return buf[1] + 2;
375 }
376
377 return 0;
378}
379#endif
329 380
330/***************************************************************************** 381/*****************************************************************************
331 * PanJit Part 382 * PanJit Part
@@ -1175,6 +1226,18 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
1175 .exit = nexio_exit, 1226 .exit = nexio_exit,
1176 }, 1227 },
1177#endif 1228#endif
1229#ifdef CONFIG_TOUCHSCREEN_USB_EASYTOUCH
1230 [DEVTYPE_ETOUCH] = {
1231 .min_xc = 0x0,
1232 .max_xc = 0x07ff,
1233 .min_yc = 0x0,
1234 .max_yc = 0x07ff,
1235 .rept_size = 16,
1236 .process_pkt = usbtouch_process_multi,
1237 .get_pkt_len = etouch_get_pkt_len,
1238 .read_data = etouch_read_data,
1239 },
1240#endif
1178}; 1241};
1179 1242
1180 1243