diff options
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r-- | drivers/input/touchscreen/Kconfig | 46 | ||||
-rw-r--r-- | drivers/input/touchscreen/Makefile | 4 | ||||
-rw-r--r-- | drivers/input/touchscreen/gunze.c | 2 | ||||
-rw-r--r-- | drivers/input/touchscreen/h3600_ts_input.c | 2 | ||||
-rw-r--r-- | drivers/input/touchscreen/htcpen.c | 255 | ||||
-rw-r--r-- | drivers/input/touchscreen/inexio.c | 207 | ||||
-rw-r--r-- | drivers/input/touchscreen/migor_ts.c | 250 | ||||
-rw-r--r-- | drivers/input/touchscreen/touchit213.c | 234 | ||||
-rw-r--r-- | drivers/input/touchscreen/usbtouchscreen.c | 42 | ||||
-rw-r--r-- | drivers/input/touchscreen/wm9712.c | 18 |
10 files changed, 1038 insertions, 22 deletions
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 565ec711c2ee..e57366521572 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig | |||
@@ -103,6 +103,18 @@ config TOUCHSCREEN_MTOUCH | |||
103 | To compile this driver as a module, choose M here: the | 103 | To compile this driver as a module, choose M here: the |
104 | module will be called mtouch. | 104 | module will be called mtouch. |
105 | 105 | ||
106 | config TOUCHSCREEN_INEXIO | ||
107 | tristate "iNexio serial touchscreens" | ||
108 | select SERIO | ||
109 | help | ||
110 | Say Y here if you have an iNexio serial touchscreen connected to | ||
111 | your system. | ||
112 | |||
113 | If unsure, say N. | ||
114 | |||
115 | To compile this driver as a module, choose M here: the | ||
116 | module will be called inexio. | ||
117 | |||
106 | config TOUCHSCREEN_MK712 | 118 | config TOUCHSCREEN_MK712 |
107 | tristate "ICS MicroClock MK712 touchscreen" | 119 | tristate "ICS MicroClock MK712 touchscreen" |
108 | help | 120 | help |
@@ -134,6 +146,18 @@ config TOUCHSCREEN_HP7XX | |||
134 | To compile this driver as a module, choose M here: the | 146 | To compile this driver as a module, choose M here: the |
135 | module will be called jornada720_ts. | 147 | module will be called jornada720_ts. |
136 | 148 | ||
149 | config TOUCHSCREEN_HTCPEN | ||
150 | tristate "HTC Shift X9500 touchscreen" | ||
151 | depends on ISA | ||
152 | help | ||
153 | Say Y here if you have an HTC Shift UMPC also known as HTC X9500 | ||
154 | Clio / Shangrila and want to support the built-in touchscreen. | ||
155 | |||
156 | If unsure, say N. | ||
157 | |||
158 | To compile this driver as a module, choose M here: the | ||
159 | module will be called htcpen. | ||
160 | |||
137 | config TOUCHSCREEN_PENMOUNT | 161 | config TOUCHSCREEN_PENMOUNT |
138 | tristate "Penmount serial touchscreen" | 162 | tristate "Penmount serial touchscreen" |
139 | select SERIO | 163 | select SERIO |
@@ -146,6 +170,17 @@ config TOUCHSCREEN_PENMOUNT | |||
146 | To compile this driver as a module, choose M here: the | 170 | To compile this driver as a module, choose M here: the |
147 | module will be called penmount. | 171 | module will be called penmount. |
148 | 172 | ||
173 | config TOUCHSCREEN_MIGOR | ||
174 | tristate "Renesas MIGO-R touchscreen" | ||
175 | depends on SH_MIGOR && I2C | ||
176 | help | ||
177 | Say Y here to enable MIGO-R touchscreen support. | ||
178 | |||
179 | If unsure, say N. | ||
180 | |||
181 | To compile this driver as a module, choose M here: the | ||
182 | module will be called migor_ts. | ||
183 | |||
149 | config TOUCHSCREEN_TOUCHRIGHT | 184 | config TOUCHSCREEN_TOUCHRIGHT |
150 | tristate "Touchright serial touchscreen" | 185 | tristate "Touchright serial touchscreen" |
151 | select SERIO | 186 | select SERIO |
@@ -316,4 +351,15 @@ config TOUCHSCREEN_USB_GOTOP | |||
316 | bool "GoTop Super_Q2/GogoPen/PenPower tablet device support" if EMBEDDED | 351 | bool "GoTop Super_Q2/GogoPen/PenPower tablet device support" if EMBEDDED |
317 | depends on TOUCHSCREEN_USB_COMPOSITE | 352 | depends on TOUCHSCREEN_USB_COMPOSITE |
318 | 353 | ||
354 | config TOUCHSCREEN_TOUCHIT213 | ||
355 | tristate "Sahara TouchIT-213 touchscreen" | ||
356 | select SERIO | ||
357 | help | ||
358 | Say Y here if you have a Sahara TouchIT-213 Tablet PC. | ||
359 | |||
360 | If unsure, say N. | ||
361 | |||
362 | To compile this driver as a module, choose M here: the | ||
363 | module will be called touchit213. | ||
364 | |||
319 | endif | 365 | endif |
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 3c096d75651d..39a804cd80f1 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile | |||
@@ -12,12 +12,16 @@ obj-$(CONFIG_TOUCHSCREEN_CORGI) += corgi_ts.o | |||
12 | obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o | 12 | obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o |
13 | obj-$(CONFIG_TOUCHSCREEN_ELO) += elo.o | 13 | obj-$(CONFIG_TOUCHSCREEN_ELO) += elo.o |
14 | obj-$(CONFIG_TOUCHSCREEN_FUJITSU) += fujitsu_ts.o | 14 | obj-$(CONFIG_TOUCHSCREEN_FUJITSU) += fujitsu_ts.o |
15 | obj-$(CONFIG_TOUCHSCREEN_INEXIO) += inexio.o | ||
16 | obj-$(CONFIG_TOUCHSCREEN_MIGOR) += migor_ts.o | ||
15 | obj-$(CONFIG_TOUCHSCREEN_MTOUCH) += mtouch.o | 17 | obj-$(CONFIG_TOUCHSCREEN_MTOUCH) += mtouch.o |
16 | obj-$(CONFIG_TOUCHSCREEN_MK712) += mk712.o | 18 | obj-$(CONFIG_TOUCHSCREEN_MK712) += mk712.o |
17 | obj-$(CONFIG_TOUCHSCREEN_HP600) += hp680_ts_input.o | 19 | obj-$(CONFIG_TOUCHSCREEN_HP600) += hp680_ts_input.o |
18 | obj-$(CONFIG_TOUCHSCREEN_HP7XX) += jornada720_ts.o | 20 | obj-$(CONFIG_TOUCHSCREEN_HP7XX) += jornada720_ts.o |
21 | obj-$(CONFIG_TOUCHSCREEN_HTCPEN) += htcpen.o | ||
19 | obj-$(CONFIG_TOUCHSCREEN_USB_COMPOSITE) += usbtouchscreen.o | 22 | obj-$(CONFIG_TOUCHSCREEN_USB_COMPOSITE) += usbtouchscreen.o |
20 | obj-$(CONFIG_TOUCHSCREEN_PENMOUNT) += penmount.o | 23 | obj-$(CONFIG_TOUCHSCREEN_PENMOUNT) += penmount.o |
24 | obj-$(CONFIG_TOUCHSCREEN_TOUCHIT213) += touchit213.o | ||
21 | obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT) += touchright.o | 25 | obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT) += touchright.o |
22 | obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN) += touchwin.o | 26 | obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN) += touchwin.o |
23 | obj-$(CONFIG_TOUCHSCREEN_UCB1400) += ucb1400_ts.o | 27 | obj-$(CONFIG_TOUCHSCREEN_UCB1400) += ucb1400_ts.o |
diff --git a/drivers/input/touchscreen/gunze.c b/drivers/input/touchscreen/gunze.c index a48a15868c4a..a54f90e02ab6 100644 --- a/drivers/input/touchscreen/gunze.c +++ b/drivers/input/touchscreen/gunze.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: gunze.c,v 1.12 2001/09/25 10:12:07 vojtech Exp $ | ||
3 | * | ||
4 | * Copyright (c) 2000-2001 Vojtech Pavlik | 2 | * Copyright (c) 2000-2001 Vojtech Pavlik |
5 | */ | 3 | */ |
6 | 4 | ||
diff --git a/drivers/input/touchscreen/h3600_ts_input.c b/drivers/input/touchscreen/h3600_ts_input.c index 28ae15ed12c5..4f86081dc7fc 100644 --- a/drivers/input/touchscreen/h3600_ts_input.c +++ b/drivers/input/touchscreen/h3600_ts_input.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: h3600_ts_input.c,v 1.4 2002/01/23 06:39:37 jsimmons Exp $ | ||
3 | * | ||
4 | * Copyright (c) 2001 "Crazy" James Simmons jsimmons@transvirtual.com | 2 | * Copyright (c) 2001 "Crazy" James Simmons jsimmons@transvirtual.com |
5 | * | 3 | * |
6 | * Sponsored by Transvirtual Technology. | 4 | * Sponsored by Transvirtual Technology. |
diff --git a/drivers/input/touchscreen/htcpen.c b/drivers/input/touchscreen/htcpen.c new file mode 100644 index 000000000000..62811de6f18f --- /dev/null +++ b/drivers/input/touchscreen/htcpen.c | |||
@@ -0,0 +1,255 @@ | |||
1 | /* | ||
2 | * HTC Shift touchscreen driver | ||
3 | * | ||
4 | * Copyright (C) 2008 Pau Oliva Fora <pof@eslack.org> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License version 2 as published | ||
8 | * by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/errno.h> | ||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/module.h> | ||
14 | #include <linux/input.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/irq.h> | ||
19 | #include <linux/isa.h> | ||
20 | #include <linux/ioport.h> | ||
21 | #include <linux/dmi.h> | ||
22 | |||
23 | MODULE_AUTHOR("Pau Oliva Fora <pau@eslack.org>"); | ||
24 | MODULE_DESCRIPTION("HTC Shift touchscreen driver"); | ||
25 | MODULE_LICENSE("GPL"); | ||
26 | |||
27 | #define HTCPEN_PORT_IRQ_CLEAR 0x068 | ||
28 | #define HTCPEN_PORT_INIT 0x06c | ||
29 | #define HTCPEN_PORT_INDEX 0x0250 | ||
30 | #define HTCPEN_PORT_DATA 0x0251 | ||
31 | #define HTCPEN_IRQ 3 | ||
32 | |||
33 | #define DEVICE_ENABLE 0xa2 | ||
34 | #define DEVICE_DISABLE 0xa3 | ||
35 | |||
36 | #define X_INDEX 3 | ||
37 | #define Y_INDEX 5 | ||
38 | #define TOUCH_INDEX 0xb | ||
39 | #define LSB_XY_INDEX 0xc | ||
40 | #define X_AXIS_MAX 2040 | ||
41 | #define Y_AXIS_MAX 2040 | ||
42 | |||
43 | static int invert_x; | ||
44 | module_param(invert_x, bool, 0644); | ||
45 | MODULE_PARM_DESC(invert_x, "If set, X axis is inverted"); | ||
46 | static int invert_y; | ||
47 | module_param(invert_y, bool, 0644); | ||
48 | MODULE_PARM_DESC(invert_y, "If set, Y axis is inverted"); | ||
49 | |||
50 | static struct pnp_device_id pnp_ids[] = { | ||
51 | { .id = "PNP0cc0" }, | ||
52 | { .id = "" } | ||
53 | }; | ||
54 | MODULE_DEVICE_TABLE(pnp, pnp_ids); | ||
55 | |||
56 | static irqreturn_t htcpen_interrupt(int irq, void *handle) | ||
57 | { | ||
58 | struct input_dev *htcpen_dev = handle; | ||
59 | unsigned short x, y, xy; | ||
60 | |||
61 | /* 0 = press; 1 = release */ | ||
62 | outb_p(TOUCH_INDEX, HTCPEN_PORT_INDEX); | ||
63 | |||
64 | if (inb_p(HTCPEN_PORT_DATA)) { | ||
65 | input_report_key(htcpen_dev, BTN_TOUCH, 0); | ||
66 | } else { | ||
67 | outb_p(X_INDEX, HTCPEN_PORT_INDEX); | ||
68 | x = inb_p(HTCPEN_PORT_DATA); | ||
69 | |||
70 | outb_p(Y_INDEX, HTCPEN_PORT_INDEX); | ||
71 | y = inb_p(HTCPEN_PORT_DATA); | ||
72 | |||
73 | outb_p(LSB_XY_INDEX, HTCPEN_PORT_INDEX); | ||
74 | xy = inb_p(HTCPEN_PORT_DATA); | ||
75 | |||
76 | /* get high resolution value of X and Y using LSB */ | ||
77 | x = X_AXIS_MAX - ((x * 8) + ((xy >> 4) & 0xf)); | ||
78 | y = (y * 8) + (xy & 0xf); | ||
79 | if (invert_x) | ||
80 | x = X_AXIS_MAX - x; | ||
81 | if (invert_y) | ||
82 | y = Y_AXIS_MAX - y; | ||
83 | |||
84 | if (x != X_AXIS_MAX && x != 0) { | ||
85 | input_report_key(htcpen_dev, BTN_TOUCH, 1); | ||
86 | input_report_abs(htcpen_dev, ABS_X, x); | ||
87 | input_report_abs(htcpen_dev, ABS_Y, y); | ||
88 | } | ||
89 | } | ||
90 | |||
91 | input_sync(htcpen_dev); | ||
92 | |||
93 | inb_p(HTCPEN_PORT_IRQ_CLEAR); | ||
94 | |||
95 | return IRQ_HANDLED; | ||
96 | } | ||
97 | |||
98 | static int htcpen_open(struct input_dev *dev) | ||
99 | { | ||
100 | outb_p(DEVICE_ENABLE, HTCPEN_PORT_INIT); | ||
101 | |||
102 | return 0; | ||
103 | } | ||
104 | |||
105 | static void htcpen_close(struct input_dev *dev) | ||
106 | { | ||
107 | outb_p(DEVICE_DISABLE, HTCPEN_PORT_INIT); | ||
108 | synchronize_irq(HTCPEN_IRQ); | ||
109 | } | ||
110 | |||
111 | static int __devinit htcpen_isa_probe(struct device *dev, unsigned int id) | ||
112 | { | ||
113 | struct input_dev *htcpen_dev; | ||
114 | int err = -EBUSY; | ||
115 | |||
116 | if (!request_region(HTCPEN_PORT_IRQ_CLEAR, 1, "htcpen")) { | ||
117 | printk(KERN_ERR "htcpen: unable to get IO region 0x%x\n", | ||
118 | HTCPEN_PORT_IRQ_CLEAR); | ||
119 | goto request_region1_failed; | ||
120 | } | ||
121 | |||
122 | if (!request_region(HTCPEN_PORT_INIT, 1, "htcpen")) { | ||
123 | printk(KERN_ERR "htcpen: unable to get IO region 0x%x\n", | ||
124 | HTCPEN_PORT_INIT); | ||
125 | goto request_region2_failed; | ||
126 | } | ||
127 | |||
128 | if (!request_region(HTCPEN_PORT_INDEX, 2, "htcpen")) { | ||
129 | printk(KERN_ERR "htcpen: unable to get IO region 0x%x\n", | ||
130 | HTCPEN_PORT_INDEX); | ||
131 | goto request_region3_failed; | ||
132 | } | ||
133 | |||
134 | htcpen_dev = input_allocate_device(); | ||
135 | if (!htcpen_dev) { | ||
136 | printk(KERN_ERR "htcpen: can't allocate device\n"); | ||
137 | err = -ENOMEM; | ||
138 | goto input_alloc_failed; | ||
139 | } | ||
140 | |||
141 | htcpen_dev->name = "HTC Shift EC TouchScreen"; | ||
142 | htcpen_dev->id.bustype = BUS_ISA; | ||
143 | |||
144 | htcpen_dev->evbit[0] = BIT_MASK(EV_ABS) | BIT_MASK(EV_KEY); | ||
145 | htcpen_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); | ||
146 | input_set_abs_params(htcpen_dev, ABS_X, 0, X_AXIS_MAX, 0, 0); | ||
147 | input_set_abs_params(htcpen_dev, ABS_Y, 0, Y_AXIS_MAX, 0, 0); | ||
148 | |||
149 | htcpen_dev->open = htcpen_open; | ||
150 | htcpen_dev->close = htcpen_close; | ||
151 | |||
152 | err = request_irq(HTCPEN_IRQ, htcpen_interrupt, 0, "htcpen", | ||
153 | htcpen_dev); | ||
154 | if (err) { | ||
155 | printk(KERN_ERR "htcpen: irq busy\n"); | ||
156 | goto request_irq_failed; | ||
157 | } | ||
158 | |||
159 | inb_p(HTCPEN_PORT_IRQ_CLEAR); | ||
160 | |||
161 | err = input_register_device(htcpen_dev); | ||
162 | if (err) | ||
163 | goto input_register_failed; | ||
164 | |||
165 | dev_set_drvdata(dev, htcpen_dev); | ||
166 | |||
167 | return 0; | ||
168 | |||
169 | input_register_failed: | ||
170 | free_irq(HTCPEN_IRQ, htcpen_dev); | ||
171 | request_irq_failed: | ||
172 | input_free_device(htcpen_dev); | ||
173 | input_alloc_failed: | ||
174 | release_region(HTCPEN_PORT_INDEX, 2); | ||
175 | request_region3_failed: | ||
176 | release_region(HTCPEN_PORT_INIT, 1); | ||
177 | request_region2_failed: | ||
178 | release_region(HTCPEN_PORT_IRQ_CLEAR, 1); | ||
179 | request_region1_failed: | ||
180 | return err; | ||
181 | } | ||
182 | |||
183 | static int __devexit htcpen_isa_remove(struct device *dev, unsigned int id) | ||
184 | { | ||
185 | struct input_dev *htcpen_dev = dev_get_drvdata(dev); | ||
186 | |||
187 | input_unregister_device(htcpen_dev); | ||
188 | |||
189 | free_irq(HTCPEN_IRQ, htcpen_dev); | ||
190 | |||
191 | release_region(HTCPEN_PORT_INDEX, 2); | ||
192 | release_region(HTCPEN_PORT_INIT, 1); | ||
193 | release_region(HTCPEN_PORT_IRQ_CLEAR, 1); | ||
194 | |||
195 | dev_set_drvdata(dev, NULL); | ||
196 | |||
197 | return 0; | ||
198 | } | ||
199 | |||
200 | #ifdef CONFIG_PM | ||
201 | static int htcpen_isa_suspend(struct device *dev, unsigned int n, | ||
202 | pm_message_t state) | ||
203 | { | ||
204 | outb_p(DEVICE_DISABLE, HTCPEN_PORT_INIT); | ||
205 | |||
206 | return 0; | ||
207 | } | ||
208 | |||
209 | static int htcpen_isa_resume(struct device *dev, unsigned int n) | ||
210 | { | ||
211 | outb_p(DEVICE_ENABLE, HTCPEN_PORT_INIT); | ||
212 | |||
213 | return 0; | ||
214 | } | ||
215 | #endif | ||
216 | |||
217 | static struct isa_driver htcpen_isa_driver = { | ||
218 | .probe = htcpen_isa_probe, | ||
219 | .remove = __devexit_p(htcpen_isa_remove), | ||
220 | #ifdef CONFIG_PM | ||
221 | .suspend = htcpen_isa_suspend, | ||
222 | .resume = htcpen_isa_resume, | ||
223 | #endif | ||
224 | .driver = { | ||
225 | .owner = THIS_MODULE, | ||
226 | .name = "htcpen", | ||
227 | } | ||
228 | }; | ||
229 | |||
230 | static struct dmi_system_id __initdata htcshift_dmi_table[] = { | ||
231 | { | ||
232 | .ident = "Shift", | ||
233 | .matches = { | ||
234 | DMI_MATCH(DMI_SYS_VENDOR, "High Tech Computer Corp"), | ||
235 | DMI_MATCH(DMI_PRODUCT_NAME, "Shift"), | ||
236 | }, | ||
237 | }, | ||
238 | { } | ||
239 | }; | ||
240 | |||
241 | static int __init htcpen_isa_init(void) | ||
242 | { | ||
243 | if (!dmi_check_system(htcshift_dmi_table)) | ||
244 | return -ENODEV; | ||
245 | |||
246 | return isa_register_driver(&htcpen_isa_driver, 1); | ||
247 | } | ||
248 | |||
249 | static void __exit htcpen_isa_exit(void) | ||
250 | { | ||
251 | isa_unregister_driver(&htcpen_isa_driver); | ||
252 | } | ||
253 | |||
254 | module_init(htcpen_isa_init); | ||
255 | module_exit(htcpen_isa_exit); | ||
diff --git a/drivers/input/touchscreen/inexio.c b/drivers/input/touchscreen/inexio.c new file mode 100644 index 000000000000..192ade0a0fb9 --- /dev/null +++ b/drivers/input/touchscreen/inexio.c | |||
@@ -0,0 +1,207 @@ | |||
1 | /* | ||
2 | * iNexio serial touchscreen driver | ||
3 | * | ||
4 | * Copyright (c) 2008 Richard Lemon | ||
5 | * Based on the mtouch driver (c) Vojtech Pavlik and Dan Streetman | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | /* | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of the GNU General Public License version 2 as published by | ||
12 | * the Free Software Foundation. | ||
13 | */ | ||
14 | |||
15 | /* | ||
16 | * 2008/06/19 Richard Lemon <richard@codelemon.com> | ||
17 | * Copied mtouch.c and edited for iNexio protocol | ||
18 | */ | ||
19 | |||
20 | #include <linux/errno.h> | ||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/module.h> | ||
23 | #include <linux/slab.h> | ||
24 | #include <linux/input.h> | ||
25 | #include <linux/serio.h> | ||
26 | #include <linux/init.h> | ||
27 | |||
28 | #define DRIVER_DESC "iNexio serial touchscreen driver" | ||
29 | |||
30 | MODULE_AUTHOR("Richard Lemon <richard@codelemon.com>"); | ||
31 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
32 | MODULE_LICENSE("GPL"); | ||
33 | |||
34 | /* | ||
35 | * Definitions & global arrays. | ||
36 | */ | ||
37 | |||
38 | #define INEXIO_FORMAT_TOUCH_BIT 0x01 | ||
39 | #define INEXIO_FORMAT_LENGTH 5 | ||
40 | #define INEXIO_RESPONSE_BEGIN_BYTE 0x80 | ||
41 | |||
42 | /* todo: check specs for max length of all responses */ | ||
43 | #define INEXIO_MAX_LENGTH 16 | ||
44 | |||
45 | #define INEXIO_MIN_XC 0 | ||
46 | #define INEXIO_MAX_XC 0x3fff | ||
47 | #define INEXIO_MIN_YC 0 | ||
48 | #define INEXIO_MAX_YC 0x3fff | ||
49 | |||
50 | #define INEXIO_GET_XC(data) (((data[1])<<7) | data[2]) | ||
51 | #define INEXIO_GET_YC(data) (((data[3])<<7) | data[4]) | ||
52 | #define INEXIO_GET_TOUCHED(data) (INEXIO_FORMAT_TOUCH_BIT & data[0]) | ||
53 | |||
54 | /* | ||
55 | * Per-touchscreen data. | ||
56 | */ | ||
57 | |||
58 | struct inexio { | ||
59 | struct input_dev *dev; | ||
60 | struct serio *serio; | ||
61 | int idx; | ||
62 | unsigned char data[INEXIO_MAX_LENGTH]; | ||
63 | char phys[32]; | ||
64 | }; | ||
65 | |||
66 | static void inexio_process_data(struct inexio *pinexio) | ||
67 | { | ||
68 | struct input_dev *dev = pinexio->dev; | ||
69 | |||
70 | if (INEXIO_FORMAT_LENGTH == ++pinexio->idx) { | ||
71 | input_report_abs(dev, ABS_X, INEXIO_GET_XC(pinexio->data)); | ||
72 | input_report_abs(dev, ABS_Y, INEXIO_GET_YC(pinexio->data)); | ||
73 | input_report_key(dev, BTN_TOUCH, INEXIO_GET_TOUCHED(pinexio->data)); | ||
74 | input_sync(dev); | ||
75 | |||
76 | pinexio->idx = 0; | ||
77 | } | ||
78 | } | ||
79 | |||
80 | static irqreturn_t inexio_interrupt(struct serio *serio, | ||
81 | unsigned char data, unsigned int flags) | ||
82 | { | ||
83 | struct inexio* pinexio = serio_get_drvdata(serio); | ||
84 | |||
85 | pinexio->data[pinexio->idx] = data; | ||
86 | |||
87 | if (INEXIO_RESPONSE_BEGIN_BYTE&pinexio->data[0]) | ||
88 | inexio_process_data(pinexio); | ||
89 | else | ||
90 | printk(KERN_DEBUG "inexio.c: unknown/unsynchronized data from device, byte %x\n",pinexio->data[0]); | ||
91 | |||
92 | return IRQ_HANDLED; | ||
93 | } | ||
94 | |||
95 | /* | ||
96 | * inexio_disconnect() is the opposite of inexio_connect() | ||
97 | */ | ||
98 | |||
99 | static void inexio_disconnect(struct serio *serio) | ||
100 | { | ||
101 | struct inexio* pinexio = serio_get_drvdata(serio); | ||
102 | |||
103 | input_get_device(pinexio->dev); | ||
104 | input_unregister_device(pinexio->dev); | ||
105 | serio_close(serio); | ||
106 | serio_set_drvdata(serio, NULL); | ||
107 | input_put_device(pinexio->dev); | ||
108 | kfree(pinexio); | ||
109 | } | ||
110 | |||
111 | /* | ||
112 | * inexio_connect() is the routine that is called when someone adds a | ||
113 | * new serio device that supports iNexio protocol and registers it as | ||
114 | * an input device. This is usually accomplished using inputattach. | ||
115 | */ | ||
116 | |||
117 | static int inexio_connect(struct serio *serio, struct serio_driver *drv) | ||
118 | { | ||
119 | struct inexio *pinexio; | ||
120 | struct input_dev *input_dev; | ||
121 | int err; | ||
122 | |||
123 | pinexio = kzalloc(sizeof(struct inexio), GFP_KERNEL); | ||
124 | input_dev = input_allocate_device(); | ||
125 | if (!pinexio || !input_dev) { | ||
126 | err = -ENOMEM; | ||
127 | goto fail1; | ||
128 | } | ||
129 | |||
130 | pinexio->serio = serio; | ||
131 | pinexio->dev = input_dev; | ||
132 | snprintf(pinexio->phys, sizeof(pinexio->phys), "%s/input0", serio->phys); | ||
133 | |||
134 | input_dev->name = "iNexio Serial TouchScreen"; | ||
135 | input_dev->phys = pinexio->phys; | ||
136 | input_dev->id.bustype = BUS_RS232; | ||
137 | input_dev->id.vendor = SERIO_INEXIO; | ||
138 | input_dev->id.product = 0; | ||
139 | input_dev->id.version = 0x0001; | ||
140 | input_dev->dev.parent = &serio->dev; | ||
141 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | ||
142 | input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); | ||
143 | input_set_abs_params(pinexio->dev, ABS_X, INEXIO_MIN_XC, INEXIO_MAX_XC, 0, 0); | ||
144 | input_set_abs_params(pinexio->dev, ABS_Y, INEXIO_MIN_YC, INEXIO_MAX_YC, 0, 0); | ||
145 | |||
146 | serio_set_drvdata(serio, pinexio); | ||
147 | |||
148 | err = serio_open(serio, drv); | ||
149 | if (err) | ||
150 | goto fail2; | ||
151 | |||
152 | err = input_register_device(pinexio->dev); | ||
153 | if (err) | ||
154 | goto fail3; | ||
155 | |||
156 | return 0; | ||
157 | |||
158 | fail3: serio_close(serio); | ||
159 | fail2: serio_set_drvdata(serio, NULL); | ||
160 | fail1: input_free_device(input_dev); | ||
161 | kfree(pinexio); | ||
162 | return err; | ||
163 | } | ||
164 | |||
165 | /* | ||
166 | * The serio driver structure. | ||
167 | */ | ||
168 | |||
169 | static struct serio_device_id inexio_serio_ids[] = { | ||
170 | { | ||
171 | .type = SERIO_RS232, | ||
172 | .proto = SERIO_INEXIO, | ||
173 | .id = SERIO_ANY, | ||
174 | .extra = SERIO_ANY, | ||
175 | }, | ||
176 | { 0 } | ||
177 | }; | ||
178 | |||
179 | MODULE_DEVICE_TABLE(serio, inexio_serio_ids); | ||
180 | |||
181 | static struct serio_driver inexio_drv = { | ||
182 | .driver = { | ||
183 | .name = "inexio", | ||
184 | }, | ||
185 | .description = DRIVER_DESC, | ||
186 | .id_table = inexio_serio_ids, | ||
187 | .interrupt = inexio_interrupt, | ||
188 | .connect = inexio_connect, | ||
189 | .disconnect = inexio_disconnect, | ||
190 | }; | ||
191 | |||
192 | /* | ||
193 | * The functions for inserting/removing us as a module. | ||
194 | */ | ||
195 | |||
196 | static int __init inexio_init(void) | ||
197 | { | ||
198 | return serio_register_driver(&inexio_drv); | ||
199 | } | ||
200 | |||
201 | static void __exit inexio_exit(void) | ||
202 | { | ||
203 | serio_unregister_driver(&inexio_drv); | ||
204 | } | ||
205 | |||
206 | module_init(inexio_init); | ||
207 | module_exit(inexio_exit); | ||
diff --git a/drivers/input/touchscreen/migor_ts.c b/drivers/input/touchscreen/migor_ts.c new file mode 100644 index 000000000000..c1cd99d58981 --- /dev/null +++ b/drivers/input/touchscreen/migor_ts.c | |||
@@ -0,0 +1,250 @@ | |||
1 | /* | ||
2 | * Touch Screen driver for Renesas MIGO-R Platform | ||
3 | * | ||
4 | * Copyright (c) 2008 Magnus Damm | ||
5 | * Copyright (c) 2007 Ujjwal Pande <ujjwal@kenati.com>, | ||
6 | * Kenati Technologies Pvt Ltd. | ||
7 | * | ||
8 | * This file is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public | ||
10 | * License as published by the Free Software Foundation; either | ||
11 | * version 2 of the License, or (at your option) any later version. | ||
12 | * | ||
13 | * This file is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public | ||
19 | * License along with this library; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | #include <linux/module.h> | ||
23 | #include <linux/kernel.h> | ||
24 | #include <linux/input.h> | ||
25 | #include <linux/interrupt.h> | ||
26 | #include <asm/io.h> | ||
27 | #include <linux/i2c.h> | ||
28 | #include <linux/timer.h> | ||
29 | |||
30 | #define EVENT_PENDOWN 1 | ||
31 | #define EVENT_REPEAT 2 | ||
32 | #define EVENT_PENUP 3 | ||
33 | |||
34 | struct migor_ts_priv { | ||
35 | struct i2c_client *client; | ||
36 | struct input_dev *input; | ||
37 | struct delayed_work work; | ||
38 | int irq; | ||
39 | }; | ||
40 | |||
41 | static const u_int8_t migor_ts_ena_seq[17] = { 0x33, 0x22, 0x11, | ||
42 | 0x01, 0x06, 0x07, }; | ||
43 | static const u_int8_t migor_ts_dis_seq[17] = { }; | ||
44 | |||
45 | static void migor_ts_poscheck(struct work_struct *work) | ||
46 | { | ||
47 | struct migor_ts_priv *priv = container_of(work, | ||
48 | struct migor_ts_priv, | ||
49 | work.work); | ||
50 | unsigned short xpos, ypos; | ||
51 | unsigned char event; | ||
52 | u_int8_t buf[16]; | ||
53 | |||
54 | memset(buf, 0, sizeof(buf)); | ||
55 | |||
56 | /* Set Index 0 */ | ||
57 | buf[0] = 0; | ||
58 | if (i2c_master_send(priv->client, buf, 1) != 1) { | ||
59 | dev_err(&priv->client->dev, "Unable to write i2c index\n"); | ||
60 | goto out; | ||
61 | } | ||
62 | |||
63 | /* Now do Page Read */ | ||
64 | if (i2c_master_recv(priv->client, buf, sizeof(buf)) != sizeof(buf)) { | ||
65 | dev_err(&priv->client->dev, "Unable to read i2c page\n"); | ||
66 | goto out; | ||
67 | } | ||
68 | |||
69 | ypos = ((buf[9] & 0x03) << 8 | buf[8]); | ||
70 | xpos = ((buf[11] & 0x03) << 8 | buf[10]); | ||
71 | event = buf[12]; | ||
72 | |||
73 | if (event == EVENT_PENDOWN || event == EVENT_REPEAT) { | ||
74 | input_report_key(priv->input, BTN_TOUCH, 1); | ||
75 | input_report_abs(priv->input, ABS_X, ypos); /*X-Y swap*/ | ||
76 | input_report_abs(priv->input, ABS_Y, xpos); | ||
77 | input_sync(priv->input); | ||
78 | } else if (event == EVENT_PENUP) { | ||
79 | input_report_key(priv->input, BTN_TOUCH, 0); | ||
80 | input_sync(priv->input); | ||
81 | } | ||
82 | out: | ||
83 | enable_irq(priv->irq); | ||
84 | } | ||
85 | |||
86 | static irqreturn_t migor_ts_isr(int irq, void *dev_id) | ||
87 | { | ||
88 | struct migor_ts_priv *priv = dev_id; | ||
89 | |||
90 | /* the touch screen controller chip is hooked up to the cpu | ||
91 | * using i2c and a single interrupt line. the interrupt line | ||
92 | * is pulled low whenever someone taps the screen. to deassert | ||
93 | * the interrupt line we need to acknowledge the interrupt by | ||
94 | * communicating with the controller over the slow i2c bus. | ||
95 | * | ||
96 | * we can't acknowledge from interrupt context since the i2c | ||
97 | * bus controller may sleep, so we just disable the interrupt | ||
98 | * here and handle the acknowledge using delayed work. | ||
99 | */ | ||
100 | |||
101 | disable_irq_nosync(irq); | ||
102 | schedule_delayed_work(&priv->work, HZ / 20); | ||
103 | |||
104 | return IRQ_HANDLED; | ||
105 | } | ||
106 | |||
107 | |||
108 | static int migor_ts_open(struct input_dev *dev) | ||
109 | { | ||
110 | struct migor_ts_priv *priv = input_get_drvdata(dev); | ||
111 | struct i2c_client *client = priv->client; | ||
112 | int count; | ||
113 | |||
114 | /* enable controller */ | ||
115 | count = i2c_master_send(client, migor_ts_ena_seq, | ||
116 | sizeof(migor_ts_ena_seq)); | ||
117 | if (count != sizeof(migor_ts_ena_seq)) { | ||
118 | dev_err(&client->dev, "Unable to enable touchscreen.\n"); | ||
119 | return -ENXIO; | ||
120 | } | ||
121 | |||
122 | return 0; | ||
123 | } | ||
124 | |||
125 | static void migor_ts_close(struct input_dev *dev) | ||
126 | { | ||
127 | struct migor_ts_priv *priv = input_get_drvdata(dev); | ||
128 | struct i2c_client *client = priv->client; | ||
129 | |||
130 | disable_irq(priv->irq); | ||
131 | |||
132 | /* cancel pending work and wait for migor_ts_poscheck() to finish */ | ||
133 | if (cancel_delayed_work_sync(&priv->work)) { | ||
134 | /* | ||
135 | * if migor_ts_poscheck was canceled we need to enable IRQ | ||
136 | * here to balance disable done in migor_ts_isr. | ||
137 | */ | ||
138 | enable_irq(priv->irq); | ||
139 | } | ||
140 | |||
141 | /* disable controller */ | ||
142 | i2c_master_send(client, migor_ts_dis_seq, sizeof(migor_ts_dis_seq)); | ||
143 | |||
144 | enable_irq(priv->irq); | ||
145 | } | ||
146 | |||
147 | static int migor_ts_probe(struct i2c_client *client, | ||
148 | const struct i2c_device_id *idp) | ||
149 | { | ||
150 | struct migor_ts_priv *priv; | ||
151 | struct input_dev *input; | ||
152 | int error; | ||
153 | |||
154 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | ||
155 | if (!priv) { | ||
156 | dev_err(&client->dev, "failed to allocate driver data\n"); | ||
157 | error = -ENOMEM; | ||
158 | goto err0; | ||
159 | } | ||
160 | |||
161 | dev_set_drvdata(&client->dev, priv); | ||
162 | |||
163 | input = input_allocate_device(); | ||
164 | if (!input) { | ||
165 | dev_err(&client->dev, "Failed to allocate input device.\n"); | ||
166 | error = -ENOMEM; | ||
167 | goto err1; | ||
168 | } | ||
169 | |||
170 | input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | ||
171 | input->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); | ||
172 | |||
173 | input_set_abs_params(input, ABS_X, 95, 955, 0, 0); | ||
174 | input_set_abs_params(input, ABS_Y, 85, 935, 0, 0); | ||
175 | |||
176 | input->name = client->driver_name; | ||
177 | input->id.bustype = BUS_I2C; | ||
178 | input->dev.parent = &client->dev; | ||
179 | |||
180 | input->open = migor_ts_open; | ||
181 | input->close = migor_ts_close; | ||
182 | |||
183 | input_set_drvdata(input, priv); | ||
184 | |||
185 | priv->client = client; | ||
186 | priv->input = input; | ||
187 | INIT_DELAYED_WORK(&priv->work, migor_ts_poscheck); | ||
188 | priv->irq = client->irq; | ||
189 | |||
190 | error = input_register_device(input); | ||
191 | if (error) | ||
192 | goto err1; | ||
193 | |||
194 | error = request_irq(priv->irq, migor_ts_isr, IRQF_TRIGGER_LOW, | ||
195 | client->driver_name, priv); | ||
196 | if (error) { | ||
197 | dev_err(&client->dev, "Unable to request touchscreen IRQ.\n"); | ||
198 | goto err2; | ||
199 | } | ||
200 | |||
201 | return 0; | ||
202 | |||
203 | err2: | ||
204 | input_unregister_device(input); | ||
205 | input = NULL; /* so we dont try to free it below */ | ||
206 | err1: | ||
207 | input_free_device(input); | ||
208 | kfree(priv); | ||
209 | err0: | ||
210 | dev_set_drvdata(&client->dev, NULL); | ||
211 | return error; | ||
212 | } | ||
213 | |||
214 | static int migor_ts_remove(struct i2c_client *client) | ||
215 | { | ||
216 | struct migor_ts_priv *priv = dev_get_drvdata(&client->dev); | ||
217 | |||
218 | free_irq(priv->irq, priv); | ||
219 | input_unregister_device(priv->input); | ||
220 | kfree(priv); | ||
221 | |||
222 | dev_set_drvdata(&client->dev, NULL); | ||
223 | |||
224 | return 0; | ||
225 | } | ||
226 | |||
227 | static struct i2c_driver migor_ts_driver = { | ||
228 | .driver = { | ||
229 | .name = "migor_ts", | ||
230 | }, | ||
231 | .probe = migor_ts_probe, | ||
232 | .remove = migor_ts_remove, | ||
233 | }; | ||
234 | |||
235 | static int __init migor_ts_init(void) | ||
236 | { | ||
237 | return i2c_add_driver(&migor_ts_driver); | ||
238 | } | ||
239 | |||
240 | static void __exit migor_ts_exit(void) | ||
241 | { | ||
242 | i2c_del_driver(&migor_ts_driver); | ||
243 | } | ||
244 | |||
245 | MODULE_DESCRIPTION("MigoR Touchscreen driver"); | ||
246 | MODULE_AUTHOR("Magnus Damm <damm@opensource.se>"); | ||
247 | MODULE_LICENSE("GPL"); | ||
248 | |||
249 | module_init(migor_ts_init); | ||
250 | module_exit(migor_ts_exit); | ||
diff --git a/drivers/input/touchscreen/touchit213.c b/drivers/input/touchscreen/touchit213.c new file mode 100644 index 000000000000..d1297ba19daf --- /dev/null +++ b/drivers/input/touchscreen/touchit213.c | |||
@@ -0,0 +1,234 @@ | |||
1 | /* | ||
2 | * Sahara TouchIT-213 serial touchscreen driver | ||
3 | * | ||
4 | * Copyright (c) 2007-2008 Claudio Nieder <private@claudio.ch> | ||
5 | * | ||
6 | * Based on Touchright driver (drivers/input/touchscreen/touchright.c) | ||
7 | * Copyright (c) 2006 Rick Koch <n1gp@hotmail.com> | ||
8 | * Copyright (c) 2004 Vojtech Pavlik | ||
9 | * and Dan Streetman <ddstreet@ieee.org> | ||
10 | */ | ||
11 | |||
12 | /* | ||
13 | * This program is free software; you can redistribute it and/or modify it | ||
14 | * under the terms of the GNU General Public License version 2 as published | ||
15 | * by the Free Software Foundation. | ||
16 | */ | ||
17 | |||
18 | #include <linux/errno.h> | ||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/module.h> | ||
21 | #include <linux/slab.h> | ||
22 | #include <linux/input.h> | ||
23 | #include <linux/serio.h> | ||
24 | #include <linux/init.h> | ||
25 | |||
26 | #define DRIVER_DESC "Sahara TouchIT-213 serial touchscreen driver" | ||
27 | |||
28 | MODULE_AUTHOR("Claudio Nieder <private@claudio.ch>"); | ||
29 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
30 | MODULE_LICENSE("GPL"); | ||
31 | |||
32 | /* | ||
33 | * Definitions & global arrays. | ||
34 | */ | ||
35 | |||
36 | /* | ||
37 | * Data is received through COM1 at 9600bit/s,8bit,no parity in packets | ||
38 | * of 5 byte each. | ||
39 | * | ||
40 | * +--------+ +--------+ +--------+ +--------+ +--------+ | ||
41 | * |1000000p| |0xxxxxxx| |0xxxxxxx| |0yyyyyyy| |0yyyyyyy| | ||
42 | * +--------+ +--------+ +--------+ +--------+ +--------+ | ||
43 | * MSB LSB MSB LSB | ||
44 | * | ||
45 | * The value of p is 1 as long as the screen is touched and 0 when | ||
46 | * reporting the location where touching stopped, e.g. where the pen was | ||
47 | * lifted from the screen. | ||
48 | * | ||
49 | * When holding the screen in landscape mode as the BIOS text output is | ||
50 | * presented, x is the horizontal axis with values growing from left to | ||
51 | * right and y is the vertical axis with values growing from top to | ||
52 | * bottom. | ||
53 | * | ||
54 | * When holding the screen in portrait mode with the Sahara logo in its | ||
55 | * correct position, x ist the vertical axis with values growing from | ||
56 | * top to bottom and y is the horizontal axis with values growing from | ||
57 | * right to left. | ||
58 | */ | ||
59 | |||
60 | #define T213_FORMAT_TOUCH_BIT 0x01 | ||
61 | #define T213_FORMAT_STATUS_BYTE 0x80 | ||
62 | #define T213_FORMAT_STATUS_MASK ~T213_FORMAT_TOUCH_BIT | ||
63 | |||
64 | /* | ||
65 | * On my Sahara Touch-IT 213 I have observed x values from 0 to 0x7f0 | ||
66 | * and y values from 0x1d to 0x7e9, so the actual measurement is | ||
67 | * probably done with an 11 bit precision. | ||
68 | */ | ||
69 | #define T213_MIN_XC 0 | ||
70 | #define T213_MAX_XC 0x07ff | ||
71 | #define T213_MIN_YC 0 | ||
72 | #define T213_MAX_YC 0x07ff | ||
73 | |||
74 | /* | ||
75 | * Per-touchscreen data. | ||
76 | */ | ||
77 | |||
78 | struct touchit213 { | ||
79 | struct input_dev *dev; | ||
80 | struct serio *serio; | ||
81 | int idx; | ||
82 | unsigned char csum; | ||
83 | unsigned char data[5]; | ||
84 | char phys[32]; | ||
85 | }; | ||
86 | |||
87 | static irqreturn_t touchit213_interrupt(struct serio *serio, | ||
88 | unsigned char data, unsigned int flags) | ||
89 | { | ||
90 | struct touchit213 *touchit213 = serio_get_drvdata(serio); | ||
91 | struct input_dev *dev = touchit213->dev; | ||
92 | |||
93 | touchit213->data[touchit213->idx] = data; | ||
94 | |||
95 | switch (touchit213->idx++) { | ||
96 | case 0: | ||
97 | if ((touchit213->data[0] & T213_FORMAT_STATUS_MASK) != | ||
98 | T213_FORMAT_STATUS_BYTE) { | ||
99 | pr_debug("unsynchronized data: 0x%02x\n", data); | ||
100 | touchit213->idx = 0; | ||
101 | } | ||
102 | break; | ||
103 | |||
104 | case 4: | ||
105 | touchit213->idx = 0; | ||
106 | input_report_abs(dev, ABS_X, | ||
107 | (touchit213->data[1] << 7) | touchit213->data[2]); | ||
108 | input_report_abs(dev, ABS_Y, | ||
109 | (touchit213->data[3] << 7) | touchit213->data[4]); | ||
110 | input_report_key(dev, BTN_TOUCH, | ||
111 | touchit213->data[0] & T213_FORMAT_TOUCH_BIT); | ||
112 | input_sync(dev); | ||
113 | break; | ||
114 | } | ||
115 | |||
116 | return IRQ_HANDLED; | ||
117 | } | ||
118 | |||
119 | /* | ||
120 | * touchit213_disconnect() is the opposite of touchit213_connect() | ||
121 | */ | ||
122 | |||
123 | static void touchit213_disconnect(struct serio *serio) | ||
124 | { | ||
125 | struct touchit213 *touchit213 = serio_get_drvdata(serio); | ||
126 | |||
127 | input_get_device(touchit213->dev); | ||
128 | input_unregister_device(touchit213->dev); | ||
129 | serio_close(serio); | ||
130 | serio_set_drvdata(serio, NULL); | ||
131 | input_put_device(touchit213->dev); | ||
132 | kfree(touchit213); | ||
133 | } | ||
134 | |||
135 | /* | ||
136 | * touchit213_connect() is the routine that is called when someone adds a | ||
137 | * new serio device that supports the Touchright protocol and registers it as | ||
138 | * an input device. | ||
139 | */ | ||
140 | |||
141 | static int touchit213_connect(struct serio *serio, struct serio_driver *drv) | ||
142 | { | ||
143 | struct touchit213 *touchit213; | ||
144 | struct input_dev *input_dev; | ||
145 | int err; | ||
146 | |||
147 | touchit213 = kzalloc(sizeof(struct touchit213), GFP_KERNEL); | ||
148 | input_dev = input_allocate_device(); | ||
149 | if (!touchit213 || !input_dev) { | ||
150 | err = -ENOMEM; | ||
151 | goto fail1; | ||
152 | } | ||
153 | |||
154 | touchit213->serio = serio; | ||
155 | touchit213->dev = input_dev; | ||
156 | snprintf(touchit213->phys, sizeof(touchit213->phys), | ||
157 | "%s/input0", serio->phys); | ||
158 | |||
159 | input_dev->name = "Sahara Touch-iT213 Serial TouchScreen"; | ||
160 | input_dev->phys = touchit213->phys; | ||
161 | input_dev->id.bustype = BUS_RS232; | ||
162 | input_dev->id.vendor = SERIO_TOUCHIT213; | ||
163 | input_dev->id.product = 0; | ||
164 | input_dev->id.version = 0x0100; | ||
165 | input_dev->dev.parent = &serio->dev; | ||
166 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | ||
167 | input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); | ||
168 | input_set_abs_params(touchit213->dev, ABS_X, | ||
169 | T213_MIN_XC, T213_MAX_XC, 0, 0); | ||
170 | input_set_abs_params(touchit213->dev, ABS_Y, | ||
171 | T213_MIN_YC, T213_MAX_YC, 0, 0); | ||
172 | |||
173 | serio_set_drvdata(serio, touchit213); | ||
174 | |||
175 | err = serio_open(serio, drv); | ||
176 | if (err) | ||
177 | goto fail2; | ||
178 | |||
179 | err = input_register_device(touchit213->dev); | ||
180 | if (err) | ||
181 | goto fail3; | ||
182 | |||
183 | return 0; | ||
184 | |||
185 | fail3: serio_close(serio); | ||
186 | fail2: serio_set_drvdata(serio, NULL); | ||
187 | fail1: input_free_device(input_dev); | ||
188 | kfree(touchit213); | ||
189 | return err; | ||
190 | } | ||
191 | |||
192 | /* | ||
193 | * The serio driver structure. | ||
194 | */ | ||
195 | |||
196 | static struct serio_device_id touchit213_serio_ids[] = { | ||
197 | { | ||
198 | .type = SERIO_RS232, | ||
199 | .proto = SERIO_TOUCHIT213, | ||
200 | .id = SERIO_ANY, | ||
201 | .extra = SERIO_ANY, | ||
202 | }, | ||
203 | { 0 } | ||
204 | }; | ||
205 | |||
206 | MODULE_DEVICE_TABLE(serio, touchit213_serio_ids); | ||
207 | |||
208 | static struct serio_driver touchit213_drv = { | ||
209 | .driver = { | ||
210 | .name = "touchit213", | ||
211 | }, | ||
212 | .description = DRIVER_DESC, | ||
213 | .id_table = touchit213_serio_ids, | ||
214 | .interrupt = touchit213_interrupt, | ||
215 | .connect = touchit213_connect, | ||
216 | .disconnect = touchit213_disconnect, | ||
217 | }; | ||
218 | |||
219 | /* | ||
220 | * The functions for inserting/removing us as a module. | ||
221 | */ | ||
222 | |||
223 | static int __init touchit213_init(void) | ||
224 | { | ||
225 | return serio_register_driver(&touchit213_drv); | ||
226 | } | ||
227 | |||
228 | static void __exit touchit213_exit(void) | ||
229 | { | ||
230 | serio_unregister_driver(&touchit213_drv); | ||
231 | } | ||
232 | |||
233 | module_init(touchit213_init); | ||
234 | module_exit(touchit213_exit); | ||
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index 3a0a8ca57076..fdd645c214a2 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/init.h> | 49 | #include <linux/init.h> |
50 | #include <linux/usb.h> | 50 | #include <linux/usb.h> |
51 | #include <linux/usb/input.h> | 51 | #include <linux/usb/input.h> |
52 | #include <linux/hid.h> | ||
52 | 53 | ||
53 | 54 | ||
54 | #define DRIVER_VERSION "v0.6" | 55 | #define DRIVER_VERSION "v0.6" |
@@ -101,7 +102,7 @@ struct usbtouch_usb { | |||
101 | 102 | ||
102 | /* device types */ | 103 | /* device types */ |
103 | enum { | 104 | enum { |
104 | DEVTPYE_DUMMY = -1, | 105 | DEVTYPE_IGNORE = -1, |
105 | DEVTYPE_EGALAX, | 106 | DEVTYPE_EGALAX, |
106 | DEVTYPE_PANJIT, | 107 | DEVTYPE_PANJIT, |
107 | DEVTYPE_3M, | 108 | DEVTYPE_3M, |
@@ -115,8 +116,21 @@ enum { | |||
115 | DEVTYPE_GOTOP, | 116 | DEVTYPE_GOTOP, |
116 | }; | 117 | }; |
117 | 118 | ||
119 | #define USB_DEVICE_HID_CLASS(vend, prod) \ | ||
120 | .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS \ | ||
121 | | USB_DEVICE_ID_MATCH_DEVICE, \ | ||
122 | .idVendor = (vend), \ | ||
123 | .idProduct = (prod), \ | ||
124 | .bInterfaceClass = USB_INTERFACE_CLASS_HID, \ | ||
125 | .bInterfaceProtocol = USB_INTERFACE_PROTOCOL_MOUSE | ||
126 | |||
118 | static struct usb_device_id usbtouch_devices[] = { | 127 | static struct usb_device_id usbtouch_devices[] = { |
119 | #ifdef CONFIG_TOUCHSCREEN_USB_EGALAX | 128 | #ifdef CONFIG_TOUCHSCREEN_USB_EGALAX |
129 | /* ignore the HID capable devices, handled by usbhid */ | ||
130 | {USB_DEVICE_HID_CLASS(0x0eef, 0x0001), .driver_info = DEVTYPE_IGNORE}, | ||
131 | {USB_DEVICE_HID_CLASS(0x0eef, 0x0002), .driver_info = DEVTYPE_IGNORE}, | ||
132 | |||
133 | /* normal device IDs */ | ||
120 | {USB_DEVICE(0x3823, 0x0001), .driver_info = DEVTYPE_EGALAX}, | 134 | {USB_DEVICE(0x3823, 0x0001), .driver_info = DEVTYPE_EGALAX}, |
121 | {USB_DEVICE(0x3823, 0x0002), .driver_info = DEVTYPE_EGALAX}, | 135 | {USB_DEVICE(0x3823, 0x0002), .driver_info = DEVTYPE_EGALAX}, |
122 | {USB_DEVICE(0x0123, 0x0001), .driver_info = DEVTYPE_EGALAX}, | 136 | {USB_DEVICE(0x0123, 0x0001), .driver_info = DEVTYPE_EGALAX}, |
@@ -262,7 +276,7 @@ static int mtouch_init(struct usbtouch_usb *usbtouch) | |||
262 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 276 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
263 | 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); | 277 | 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); |
264 | dbg("%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d", | 278 | dbg("%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d", |
265 | __FUNCTION__, ret); | 279 | __func__, ret); |
266 | if (ret < 0) | 280 | if (ret < 0) |
267 | return ret; | 281 | return ret; |
268 | msleep(150); | 282 | msleep(150); |
@@ -273,7 +287,7 @@ static int mtouch_init(struct usbtouch_usb *usbtouch) | |||
273 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 287 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
274 | 1, 1, NULL, 0, USB_CTRL_SET_TIMEOUT); | 288 | 1, 1, NULL, 0, USB_CTRL_SET_TIMEOUT); |
275 | dbg("%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d", | 289 | dbg("%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d", |
276 | __FUNCTION__, ret); | 290 | __func__, ret); |
277 | if (ret >= 0) | 291 | if (ret >= 0) |
278 | break; | 292 | break; |
279 | if (ret != -EPIPE) | 293 | if (ret != -EPIPE) |
@@ -793,18 +807,18 @@ static void usbtouch_irq(struct urb *urb) | |||
793 | case -ETIME: | 807 | case -ETIME: |
794 | /* this urb is timing out */ | 808 | /* this urb is timing out */ |
795 | dbg("%s - urb timed out - was the device unplugged?", | 809 | dbg("%s - urb timed out - was the device unplugged?", |
796 | __FUNCTION__); | 810 | __func__); |
797 | return; | 811 | return; |
798 | case -ECONNRESET: | 812 | case -ECONNRESET: |
799 | case -ENOENT: | 813 | case -ENOENT: |
800 | case -ESHUTDOWN: | 814 | case -ESHUTDOWN: |
801 | /* this urb is terminated, clean up */ | 815 | /* this urb is terminated, clean up */ |
802 | dbg("%s - urb shutting down with status: %d", | 816 | dbg("%s - urb shutting down with status: %d", |
803 | __FUNCTION__, urb->status); | 817 | __func__, urb->status); |
804 | return; | 818 | return; |
805 | default: | 819 | default: |
806 | dbg("%s - nonzero urb status received: %d", | 820 | dbg("%s - nonzero urb status received: %d", |
807 | __FUNCTION__, urb->status); | 821 | __func__, urb->status); |
808 | goto exit; | 822 | goto exit; |
809 | } | 823 | } |
810 | 824 | ||
@@ -814,7 +828,7 @@ exit: | |||
814 | retval = usb_submit_urb(urb, GFP_ATOMIC); | 828 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
815 | if (retval) | 829 | if (retval) |
816 | err("%s - usb_submit_urb failed with result: %d", | 830 | err("%s - usb_submit_urb failed with result: %d", |
817 | __FUNCTION__, retval); | 831 | __func__, retval); |
818 | } | 832 | } |
819 | 833 | ||
820 | static int usbtouch_open(struct input_dev *input) | 834 | static int usbtouch_open(struct input_dev *input) |
@@ -857,6 +871,10 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
857 | struct usbtouch_device_info *type; | 871 | struct usbtouch_device_info *type; |
858 | int err = -ENOMEM; | 872 | int err = -ENOMEM; |
859 | 873 | ||
874 | /* some devices are ignored */ | ||
875 | if (id->driver_info == DEVTYPE_IGNORE) | ||
876 | return -ENODEV; | ||
877 | |||
860 | interface = intf->cur_altsetting; | 878 | interface = intf->cur_altsetting; |
861 | endpoint = &interface->endpoint[0].desc; | 879 | endpoint = &interface->endpoint[0].desc; |
862 | 880 | ||
@@ -883,7 +901,7 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
883 | 901 | ||
884 | usbtouch->irq = usb_alloc_urb(0, GFP_KERNEL); | 902 | usbtouch->irq = usb_alloc_urb(0, GFP_KERNEL); |
885 | if (!usbtouch->irq) { | 903 | if (!usbtouch->irq) { |
886 | dbg("%s - usb_alloc_urb failed: usbtouch->irq", __FUNCTION__); | 904 | dbg("%s - usb_alloc_urb failed: usbtouch->irq", __func__); |
887 | goto out_free_buffers; | 905 | goto out_free_buffers; |
888 | } | 906 | } |
889 | 907 | ||
@@ -939,14 +957,14 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
939 | if (type->init) { | 957 | if (type->init) { |
940 | err = type->init(usbtouch); | 958 | err = type->init(usbtouch); |
941 | if (err) { | 959 | if (err) { |
942 | dbg("%s - type->init() failed, err: %d", __FUNCTION__, err); | 960 | dbg("%s - type->init() failed, err: %d", __func__, err); |
943 | goto out_free_buffers; | 961 | goto out_free_buffers; |
944 | } | 962 | } |
945 | } | 963 | } |
946 | 964 | ||
947 | err = input_register_device(usbtouch->input); | 965 | err = input_register_device(usbtouch->input); |
948 | if (err) { | 966 | if (err) { |
949 | dbg("%s - input_register_device failed, err: %d", __FUNCTION__, err); | 967 | dbg("%s - input_register_device failed, err: %d", __func__, err); |
950 | goto out_free_buffers; | 968 | goto out_free_buffers; |
951 | } | 969 | } |
952 | 970 | ||
@@ -966,12 +984,12 @@ static void usbtouch_disconnect(struct usb_interface *intf) | |||
966 | { | 984 | { |
967 | struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); | 985 | struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); |
968 | 986 | ||
969 | dbg("%s - called", __FUNCTION__); | 987 | dbg("%s - called", __func__); |
970 | 988 | ||
971 | if (!usbtouch) | 989 | if (!usbtouch) |
972 | return; | 990 | return; |
973 | 991 | ||
974 | dbg("%s - usbtouch is initialized, cleaning up", __FUNCTION__); | 992 | dbg("%s - usbtouch is initialized, cleaning up", __func__); |
975 | usb_set_intfdata(intf, NULL); | 993 | usb_set_intfdata(intf, NULL); |
976 | usb_kill_urb(usbtouch->irq); | 994 | usb_kill_urb(usbtouch->irq); |
977 | input_unregister_device(usbtouch->input); | 995 | input_unregister_device(usbtouch->input); |
diff --git a/drivers/input/touchscreen/wm9712.c b/drivers/input/touchscreen/wm9712.c index 0b6e4cfa6a21..4c5d85a249ae 100644 --- a/drivers/input/touchscreen/wm9712.c +++ b/drivers/input/touchscreen/wm9712.c | |||
@@ -168,6 +168,18 @@ static void wm9712_phy_init(struct wm97xx *wm) | |||
168 | 64000 / rpu); | 168 | 64000 / rpu); |
169 | } | 169 | } |
170 | 170 | ||
171 | /* WM9712 five wire */ | ||
172 | if (five_wire) { | ||
173 | dig2 |= WM9712_45W; | ||
174 | dev_dbg(wm->dev, "setting 5-wire touchscreen mode."); | ||
175 | |||
176 | if (pil) { | ||
177 | dev_warn(wm->dev, "pressure measurement is not " | ||
178 | "supported in 5-wire mode\n"); | ||
179 | pil = 0; | ||
180 | } | ||
181 | } | ||
182 | |||
171 | /* touchpanel pressure current*/ | 183 | /* touchpanel pressure current*/ |
172 | if (pil == 2) { | 184 | if (pil == 2) { |
173 | dig2 |= WM9712_PIL; | 185 | dig2 |= WM9712_PIL; |
@@ -179,12 +191,6 @@ static void wm9712_phy_init(struct wm97xx *wm) | |||
179 | if (!pil) | 191 | if (!pil) |
180 | pressure = 0; | 192 | pressure = 0; |
181 | 193 | ||
182 | /* WM9712 five wire */ | ||
183 | if (five_wire) { | ||
184 | dig2 |= WM9712_45W; | ||
185 | dev_dbg(wm->dev, "setting 5-wire touchscreen mode."); | ||
186 | } | ||
187 | |||
188 | /* polling mode sample settling delay */ | 194 | /* polling mode sample settling delay */ |
189 | if (delay < 0 || delay > 15) { | 195 | if (delay < 0 || delay > 15) { |
190 | dev_dbg(wm->dev, "supplied delay out of range."); | 196 | dev_dbg(wm->dev, "supplied delay out of range."); |