aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-15 16:41:39 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-15 16:41:39 -0400
commitf2e1d89f9b349b3cd914b7c6ec6368632f4ad048 (patch)
tree5b0042924a9f9c8b3309c0be880f51795916fc28 /drivers/input/touchscreen
parent85ffdd28be04c324349dfc7c9de3d4342c885c3f (diff)
parent82ba56c273911f7eda79849cfa0fc2d2e5a3b75b (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (40 commits) Input: use full RCU API Input: remove tsdev interface Input: add support for Blackfin BF54x Keypad controller Input: appletouch - another fix for idle reset logic HWMON: hdaps - switch to using input-polldev Input: add support for SEGA Dreamcast keyboard Input: omap-keyboard - don't pretend we support changing keymap Input: lifebook - fix X and Y axis range Input: usbtouchscreen - add support for GeneralTouch devices Input: fix open count handling in input interfaces Input: keyboard - add CapsShift lock Input: adbhid - produce all CapsLock key events Input: ALPS - add signature for ThinkPad R61 Input: jornada720_kbd - send MSC_SCAN events Input: add support for the HP Jornada 7xx (710/720/728) touchscreen Input: add support for HP Jornada 7xx onboard keyboard Input: add support for HP Jornada onboard keyboard (HP6XX) Input: ucb1400_ts - use schedule_timeout_uninterruptible Input: xpad - fix dependancy on LEDS class Input: auto-select INPUT for MAC_EMUMOUSEBTN option ... Resolved conflicts manually in drivers/hwmon/applesmc.c: converting from a class device to a device and converting to use input-polldev created a few apparently trivial clashes..
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r--drivers/input/touchscreen/Kconfig21
-rw-r--r--drivers/input/touchscreen/Makefile1
-rw-r--r--drivers/input/touchscreen/jornada720_ts.c182
-rw-r--r--drivers/input/touchscreen/ucb1400_ts.c3
-rw-r--r--drivers/input/touchscreen/usbtouchscreen.c93
5 files changed, 296 insertions, 4 deletions
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index f929fcdbae2e..e3e0baa1a158 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -126,6 +126,16 @@ config TOUCHSCREEN_HP600
126 To compile this driver as a module, choose M here: the 126 To compile this driver as a module, choose M here: the
127 module will be called hp680_ts_input. 127 module will be called hp680_ts_input.
128 128
129config TOUCHSCREEN_HP7XX
130 tristate "HP Jornada 710/720/728 touchscreen"
131 depends on SA1100_JORNADA720_SSP
132 help
133 Say Y here if you have a HP Jornada 710/720/728 and want
134 to support the built-in touchscreen.
135
136 To compile this driver as a module, choose M here: the
137 module will be called jornada720_ts.
138
129config TOUCHSCREEN_PENMOUNT 139config TOUCHSCREEN_PENMOUNT
130 tristate "Penmount serial touchscreen" 140 tristate "Penmount serial touchscreen"
131 select SERIO 141 select SERIO
@@ -191,6 +201,7 @@ config TOUCHSCREEN_USB_COMPOSITE
191 - Gunze AHL61 201 - Gunze AHL61
192 - DMC TSC-10/25 202 - DMC TSC-10/25
193 - IRTOUCHSYSTEMS/UNITOP 203 - IRTOUCHSYSTEMS/UNITOP
204 - IdealTEK URTC1000
194 205
195 Have a look at <http://linux.chapter7.ch/touchkit/> for 206 Have a look at <http://linux.chapter7.ch/touchkit/> for
196 a usage description and the required user-space stuff. 207 a usage description and the required user-space stuff.
@@ -238,4 +249,14 @@ config TOUCHSCREEN_USB_IRTOUCH
238 bool "IRTOUCHSYSTEMS/UNITOP device support" if EMBEDDED 249 bool "IRTOUCHSYSTEMS/UNITOP device support" if EMBEDDED
239 depends on TOUCHSCREEN_USB_COMPOSITE 250 depends on TOUCHSCREEN_USB_COMPOSITE
240 251
252config TOUCHSCREEN_USB_IDEALTEK
253 default y
254 bool "IdealTEK URTC1000 device support" if EMBEDDED
255 depends on TOUCHSCREEN_USB_COMPOSITE
256
257config TOUCHSCREEN_USB_GENERAL_TOUCH
258 default y
259 bool "GeneralTouch Touchscreen device support" if EMBEDDED
260 depends on TOUCHSCREEN_USB_COMPOSITE
261
241endif 262endif
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index 5de8933c4993..35d4097df35a 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_TOUCHSCREEN_FUJITSU) += fujitsu_ts.o
13obj-$(CONFIG_TOUCHSCREEN_MTOUCH) += mtouch.o 13obj-$(CONFIG_TOUCHSCREEN_MTOUCH) += mtouch.o
14obj-$(CONFIG_TOUCHSCREEN_MK712) += mk712.o 14obj-$(CONFIG_TOUCHSCREEN_MK712) += mk712.o
15obj-$(CONFIG_TOUCHSCREEN_HP600) += hp680_ts_input.o 15obj-$(CONFIG_TOUCHSCREEN_HP600) += hp680_ts_input.o
16obj-$(CONFIG_TOUCHSCREEN_HP7XX) += jornada720_ts.o
16obj-$(CONFIG_TOUCHSCREEN_USB_COMPOSITE) += usbtouchscreen.o 17obj-$(CONFIG_TOUCHSCREEN_USB_COMPOSITE) += usbtouchscreen.o
17obj-$(CONFIG_TOUCHSCREEN_PENMOUNT) += penmount.o 18obj-$(CONFIG_TOUCHSCREEN_PENMOUNT) += penmount.o
18obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT) += touchright.o 19obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT) += touchright.o
diff --git a/drivers/input/touchscreen/jornada720_ts.c b/drivers/input/touchscreen/jornada720_ts.c
new file mode 100644
index 000000000000..42a1c9a1940e
--- /dev/null
+++ b/drivers/input/touchscreen/jornada720_ts.c
@@ -0,0 +1,182 @@
1/*
2 * drivers/input/touchscreen/jornada720_ts.c
3 *
4 * Copyright (C) 2007 Kristoffer Ericson <Kristoffer.Ericson@gmail.com>
5 *
6 * Copyright (C) 2006 Filip Zyzniewski <filip.zyzniewski@tefnet.pl>
7 * based on HP Jornada 56x touchscreen driver by Alex Lange <chicken@handhelds.org>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * HP Jornada 710/720/729 Touchscreen Driver
14 */
15
16#include <linux/platform_device.h>
17#include <linux/init.h>
18#include <linux/input.h>
19#include <linux/interrupt.h>
20#include <linux/module.h>
21
22#include <asm/hardware.h>
23#include <asm/arch/jornada720.h>
24
25MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson@gmail.com>");
26MODULE_DESCRIPTION("HP Jornada 710/720/728 touchscreen driver");
27MODULE_LICENSE("GPLv2");
28
29struct jornada_ts {
30 struct input_dev *dev;
31 int x_data[4]; /* X sample values */
32 int y_data[4]; /* Y sample values */
33};
34
35static void jornada720_ts_collect_data(struct jornada_ts *jornada_ts)
36{
37
38 /* 3 low word X samples */
39 jornada_ts->x_data[0] = jornada_ssp_byte(TXDUMMY);
40 jornada_ts->x_data[1] = jornada_ssp_byte(TXDUMMY);
41 jornada_ts->x_data[2] = jornada_ssp_byte(TXDUMMY);
42
43 /* 3 low word Y samples */
44 jornada_ts->y_data[0] = jornada_ssp_byte(TXDUMMY);
45 jornada_ts->y_data[1] = jornada_ssp_byte(TXDUMMY);
46 jornada_ts->y_data[2] = jornada_ssp_byte(TXDUMMY);
47
48 /* combined x samples bits */
49 jornada_ts->x_data[3] = jornada_ssp_byte(TXDUMMY);
50
51 /* combined y samples bits */
52 jornada_ts->y_data[3] = jornada_ssp_byte(TXDUMMY);
53}
54
55static int jornada720_ts_average(int coords[4])
56{
57 int coord, high_bits = coords[3];
58
59 coord = coords[0] | ((high_bits & 0x03) << 8);
60 coord += coords[1] | ((high_bits & 0x0c) << 6);
61 coord += coords[2] | ((high_bits & 0x30) << 4);
62
63 return coord / 3;
64}
65
66static irqreturn_t jornada720_ts_interrupt(int irq, void *dev_id)
67{
68 struct platform_device *pdev = dev_id;
69 struct jornada_ts *jornada_ts = platform_get_drvdata(pdev);
70 struct input_dev *input = jornada_ts->dev;
71 int x, y;
72
73 /* If GPIO_GPIO9 is set to high then report pen up */
74 if (GPLR & GPIO_GPIO(9)) {
75 input_report_key(input, BTN_TOUCH, 0);
76 input_sync(input);
77 } else {
78 jornada_ssp_start();
79
80 /* proper reply to request is always TXDUMMY */
81 if (jornada_ssp_inout(GETTOUCHSAMPLES) == TXDUMMY) {
82 jornada720_ts_collect_data(jornada_ts);
83
84 x = jornada720_ts_average(jornada_ts->x_data);
85 y = jornada720_ts_average(jornada_ts->y_data);
86
87 input_report_key(input, BTN_TOUCH, 1);
88 input_report_abs(input, ABS_X, x);
89 input_report_abs(input, ABS_Y, y);
90 input_sync(input);
91 }
92
93 jornada_ssp_end();
94 }
95
96 return IRQ_HANDLED;
97}
98
99static int __devinit jornada720_ts_probe(struct platform_device *pdev)
100{
101 struct jornada_ts *jornada_ts;
102 struct input_dev *input_dev;
103 int error;
104
105 jornada_ts = kzalloc(sizeof(struct jornada_ts), GFP_KERNEL);
106 input_dev = input_allocate_device();
107
108 if (!jornada_ts || !input_dev) {
109 error = -ENOMEM;
110 goto fail1;
111 }
112
113 platform_set_drvdata(pdev, jornada_ts);
114
115 jornada_ts->dev = input_dev;
116
117 input_dev->name = "HP Jornada 7xx Touchscreen";
118 input_dev->phys = "jornadats/input0";
119 input_dev->id.bustype = BUS_HOST;
120 input_dev->dev.parent = &pdev->dev;
121
122 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
123 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
124 input_set_abs_params(input_dev, ABS_X, 270, 3900, 0, 0);
125 input_set_abs_params(input_dev, ABS_Y, 180, 3700, 0, 0);
126
127 error = request_irq(IRQ_GPIO9,
128 jornada720_ts_interrupt,
129 IRQF_DISABLED | IRQF_TRIGGER_RISING,
130 "HP7XX Touchscreen driver", pdev);
131 if (error) {
132 printk(KERN_INFO "HP7XX TS : Unable to acquire irq!\n");
133 goto fail1;
134 }
135
136 error = input_register_device(jornada_ts->dev);
137 if (error)
138 goto fail2;
139
140 return 0;
141
142 fail2:
143 free_irq(IRQ_GPIO9, pdev);
144 fail1:
145 platform_set_drvdata(pdev, NULL);
146 input_free_device(input_dev);
147 kfree(jornada_ts);
148 return error;
149}
150
151static int __devexit jornada720_ts_remove(struct platform_device *pdev)
152{
153 struct jornada_ts *jornada_ts = platform_get_drvdata(pdev);
154
155 free_irq(IRQ_GPIO9, pdev);
156 platform_set_drvdata(pdev, NULL);
157 input_unregister_device(jornada_ts->dev);
158 kfree(jornada_ts);
159
160 return 0;
161}
162
163static struct platform_driver jornada720_ts_driver = {
164 .probe = jornada720_ts_probe,
165 .remove = __devexit_p(jornada720_ts_remove),
166 .driver = {
167 .name = "jornada_ts",
168 },
169};
170
171static int __init jornada720_ts_init(void)
172{
173 return platform_driver_register(&jornada720_ts_driver);
174}
175
176static void __exit jornada720_ts_exit(void)
177{
178 platform_driver_unregister(&jornada720_ts_driver);
179}
180
181module_init(jornada720_ts_init);
182module_exit(jornada720_ts_exit);
diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c
index 36f944019158..86aed64ec0fb 100644
--- a/drivers/input/touchscreen/ucb1400_ts.c
+++ b/drivers/input/touchscreen/ucb1400_ts.c
@@ -130,8 +130,7 @@ static unsigned int ucb1400_adc_read(struct ucb1400 *ucb, u16 adc_channel)
130 if (val & UCB_ADC_DAT_VALID) 130 if (val & UCB_ADC_DAT_VALID)
131 break; 131 break;
132 /* yield to other processes */ 132 /* yield to other processes */
133 set_current_state(TASK_INTERRUPTIBLE); 133 schedule_timeout_uninterruptible(1);
134 schedule_timeout(1);
135 } 134 }
136 135
137 return UCB_ADC_DAT_VALUE(val); 136 return UCB_ADC_DAT_VALUE(val);
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