aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2010-03-01 02:55:20 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-03-01 02:55:20 -0500
commit35858adbfca13678af99fb31618ef4428d6dedb0 (patch)
tree3336feaa61324486945816cb52c347733e7c0821 /drivers/input/touchscreen
parent197d4db752e67160d79fed09968c2140376a80a3 (diff)
parent4b70858ba8d4537daf782defebe5f2ff80ccef2b (diff)
Merge branch 'next' into for-linus
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r--drivers/input/touchscreen/Kconfig6
-rw-r--r--drivers/input/touchscreen/ads7846.c28
-rw-r--r--drivers/input/touchscreen/elo.c225
-rw-r--r--drivers/input/touchscreen/mainstone-wm97xx.c3
-rw-r--r--drivers/input/touchscreen/pcap_ts.c2
-rw-r--r--drivers/input/touchscreen/s3c2410_ts.c31
-rw-r--r--drivers/input/touchscreen/tsc2007.c2
-rw-r--r--drivers/input/touchscreen/usbtouchscreen.c317
-rw-r--r--drivers/input/touchscreen/zylonite-wm97xx.c3
9 files changed, 476 insertions, 141 deletions
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index dfafc76da4fb..6457e060ae49 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -90,7 +90,6 @@ config TOUCHSCREEN_CORGI
90 tristate "SharpSL (Corgi and Spitz series) touchscreen driver (DEPRECATED)" 90 tristate "SharpSL (Corgi and Spitz series) touchscreen driver (DEPRECATED)"
91 depends on PXA_SHARPSL 91 depends on PXA_SHARPSL
92 select CORGI_SSP_DEPRECATED 92 select CORGI_SSP_DEPRECATED
93 default y
94 help 93 help
95 Say Y here to enable the driver for the touchscreen on the 94 Say Y here to enable the driver for the touchscreen on the
96 Sharp SL-C7xx and SL-Cxx00 series of PDAs. 95 Sharp SL-C7xx and SL-Cxx00 series of PDAs.
@@ -537,6 +536,11 @@ config TOUCHSCREEN_USB_ETT_TC5UH
537 bool "ET&T TC5UH touchscreen controler support" if EMBEDDED 536 bool "ET&T TC5UH touchscreen controler support" if EMBEDDED
538 depends on TOUCHSCREEN_USB_COMPOSITE 537 depends on TOUCHSCREEN_USB_COMPOSITE
539 538
539config TOUCHSCREEN_USB_NEXIO
540 default y
541 bool "NEXIO/iNexio device support" if EMBEDDED
542 depends on TOUCHSCREEN_USB_COMPOSITE
543
540config TOUCHSCREEN_TOUCHIT213 544config TOUCHSCREEN_TOUCHIT213
541 tristate "Sahara TouchIT-213 touchscreen" 545 tristate "Sahara TouchIT-213 touchscreen"
542 select SERIO 546 select SERIO
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 52d2ca147d8f..8b05d8e97543 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -27,6 +27,7 @@
27#include <linux/gpio.h> 27#include <linux/gpio.h>
28#include <linux/spi/spi.h> 28#include <linux/spi/spi.h>
29#include <linux/spi/ads7846.h> 29#include <linux/spi/ads7846.h>
30#include <linux/regulator/consumer.h>
30#include <asm/irq.h> 31#include <asm/irq.h>
31 32
32/* 33/*
@@ -85,6 +86,7 @@ struct ads7846 {
85 char name[32]; 86 char name[32];
86 87
87 struct spi_device *spi; 88 struct spi_device *spi;
89 struct regulator *reg;
88 90
89#if defined(CONFIG_HWMON) || defined(CONFIG_HWMON_MODULE) 91#if defined(CONFIG_HWMON) || defined(CONFIG_HWMON_MODULE)
90 struct attribute_group *attr_group; 92 struct attribute_group *attr_group;
@@ -788,6 +790,8 @@ static void ads7846_disable(struct ads7846 *ts)
788 } 790 }
789 } 791 }
790 792
793 regulator_disable(ts->reg);
794
791 /* we know the chip's in lowpower mode since we always 795 /* we know the chip's in lowpower mode since we always
792 * leave it that way after every request 796 * leave it that way after every request
793 */ 797 */
@@ -799,6 +803,8 @@ static void ads7846_enable(struct ads7846 *ts)
799 if (!ts->disabled) 803 if (!ts->disabled)
800 return; 804 return;
801 805
806 regulator_enable(ts->reg);
807
802 ts->disabled = 0; 808 ts->disabled = 0;
803 ts->irq_disabled = 0; 809 ts->irq_disabled = 0;
804 enable_irq(ts->spi->irq); 810 enable_irq(ts->spi->irq);
@@ -1139,6 +1145,19 @@ static int __devinit ads7846_probe(struct spi_device *spi)
1139 1145
1140 ts->last_msg = m; 1146 ts->last_msg = m;
1141 1147
1148 ts->reg = regulator_get(&spi->dev, "vcc");
1149 if (IS_ERR(ts->reg)) {
1150 dev_err(&spi->dev, "unable to get regulator: %ld\n",
1151 PTR_ERR(ts->reg));
1152 goto err_free_gpio;
1153 }
1154
1155 err = regulator_enable(ts->reg);
1156 if (err) {
1157 dev_err(&spi->dev, "unable to enable regulator: %d\n", err);
1158 goto err_put_regulator;
1159 }
1160
1142 if (request_irq(spi->irq, ads7846_irq, IRQF_TRIGGER_FALLING, 1161 if (request_irq(spi->irq, ads7846_irq, IRQF_TRIGGER_FALLING,
1143 spi->dev.driver->name, ts)) { 1162 spi->dev.driver->name, ts)) {
1144 dev_info(&spi->dev, 1163 dev_info(&spi->dev,
@@ -1148,7 +1167,7 @@ static int __devinit ads7846_probe(struct spi_device *spi)
1148 spi->dev.driver->name, ts); 1167 spi->dev.driver->name, ts);
1149 if (err) { 1168 if (err) {
1150 dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq); 1169 dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq);
1151 goto err_free_gpio; 1170 goto err_disable_regulator;
1152 } 1171 }
1153 } 1172 }
1154 1173
@@ -1180,6 +1199,10 @@ static int __devinit ads7846_probe(struct spi_device *spi)
1180 ads784x_hwmon_unregister(spi, ts); 1199 ads784x_hwmon_unregister(spi, ts);
1181 err_free_irq: 1200 err_free_irq:
1182 free_irq(spi->irq, ts); 1201 free_irq(spi->irq, ts);
1202 err_disable_regulator:
1203 regulator_disable(ts->reg);
1204 err_put_regulator:
1205 regulator_put(ts->reg);
1183 err_free_gpio: 1206 err_free_gpio:
1184 if (ts->gpio_pendown != -1) 1207 if (ts->gpio_pendown != -1)
1185 gpio_free(ts->gpio_pendown); 1208 gpio_free(ts->gpio_pendown);
@@ -1208,6 +1231,9 @@ static int __devexit ads7846_remove(struct spi_device *spi)
1208 /* suspend left the IRQ disabled */ 1231 /* suspend left the IRQ disabled */
1209 enable_irq(ts->spi->irq); 1232 enable_irq(ts->spi->irq);
1210 1233
1234 regulator_disable(ts->reg);
1235 regulator_put(ts->reg);
1236
1211 if (ts->gpio_pendown != -1) 1237 if (ts->gpio_pendown != -1)
1212 gpio_free(ts->gpio_pendown); 1238 gpio_free(ts->gpio_pendown);
1213 1239
diff --git a/drivers/input/touchscreen/elo.c b/drivers/input/touchscreen/elo.c
index 8f38c5e55ce6..486d31ba9c09 100644
--- a/drivers/input/touchscreen/elo.c
+++ b/drivers/input/touchscreen/elo.c
@@ -72,45 +72,49 @@ static void elo_process_data_10(struct elo *elo, unsigned char data)
72 struct input_dev *dev = elo->dev; 72 struct input_dev *dev = elo->dev;
73 73
74 elo->data[elo->idx] = data; 74 elo->data[elo->idx] = data;
75 switch (elo->idx++) {
76 case 0:
77 elo->csum = 0xaa;
78 if (data != ELO10_LEAD_BYTE) {
79 pr_debug("elo: unsynchronized data: 0x%02x\n", data);
80 elo->idx = 0;
81 }
82 break;
83 75
84 case 9: 76 switch (elo->idx++) {
77 case 0:
78 elo->csum = 0xaa;
79 if (data != ELO10_LEAD_BYTE) {
80 dev_dbg(&elo->serio->dev,
81 "unsynchronized data: 0x%02x\n", data);
85 elo->idx = 0; 82 elo->idx = 0;
86 if (data != elo->csum) { 83 }
87 pr_debug("elo: bad checksum: 0x%02x, expected 0x%02x\n", 84 break;
88 data, elo->csum); 85
89 break; 86 case 9:
90 } 87 elo->idx = 0;
91 if (elo->data[1] != elo->expected_packet) { 88 if (data != elo->csum) {
92 if (elo->data[1] != ELO10_TOUCH_PACKET) 89 dev_dbg(&elo->serio->dev,
93 pr_debug("elo: unexpected packet: 0x%02x\n", 90 "bad checksum: 0x%02x, expected 0x%02x\n",
94 elo->data[1]); 91 data, elo->csum);
95 break; 92 break;
96 } 93 }
97 if (likely(elo->data[1] == ELO10_TOUCH_PACKET)) { 94 if (elo->data[1] != elo->expected_packet) {
98 input_report_abs(dev, ABS_X, (elo->data[4] << 8) | elo->data[3]); 95 if (elo->data[1] != ELO10_TOUCH_PACKET)
99 input_report_abs(dev, ABS_Y, (elo->data[6] << 8) | elo->data[5]); 96 dev_dbg(&elo->serio->dev,
100 if (elo->data[2] & ELO10_PRESSURE) 97 "unexpected packet: 0x%02x\n",
101 input_report_abs(dev, ABS_PRESSURE, 98 elo->data[1]);
102 (elo->data[8] << 8) | elo->data[7]);
103 input_report_key(dev, BTN_TOUCH, elo->data[2] & ELO10_TOUCH);
104 input_sync(dev);
105 } else if (elo->data[1] == ELO10_ACK_PACKET) {
106 if (elo->data[2] == '0')
107 elo->expected_packet = ELO10_TOUCH_PACKET;
108 complete(&elo->cmd_done);
109 } else {
110 memcpy(elo->response, &elo->data[1], ELO10_PACKET_LEN);
111 elo->expected_packet = ELO10_ACK_PACKET;
112 }
113 break; 99 break;
100 }
101 if (likely(elo->data[1] == ELO10_TOUCH_PACKET)) {
102 input_report_abs(dev, ABS_X, (elo->data[4] << 8) | elo->data[3]);
103 input_report_abs(dev, ABS_Y, (elo->data[6] << 8) | elo->data[5]);
104 if (elo->data[2] & ELO10_PRESSURE)
105 input_report_abs(dev, ABS_PRESSURE,
106 (elo->data[8] << 8) | elo->data[7]);
107 input_report_key(dev, BTN_TOUCH, elo->data[2] & ELO10_TOUCH);
108 input_sync(dev);
109 } else if (elo->data[1] == ELO10_ACK_PACKET) {
110 if (elo->data[2] == '0')
111 elo->expected_packet = ELO10_TOUCH_PACKET;
112 complete(&elo->cmd_done);
113 } else {
114 memcpy(elo->response, &elo->data[1], ELO10_PACKET_LEN);
115 elo->expected_packet = ELO10_ACK_PACKET;
116 }
117 break;
114 } 118 }
115 elo->csum += data; 119 elo->csum += data;
116} 120}
@@ -123,42 +127,53 @@ static void elo_process_data_6(struct elo *elo, unsigned char data)
123 127
124 switch (elo->idx++) { 128 switch (elo->idx++) {
125 129
126 case 0: if ((data & 0xc0) != 0xc0) elo->idx = 0; break; 130 case 0:
127 case 1: if ((data & 0xc0) != 0x80) elo->idx = 0; break; 131 if ((data & 0xc0) != 0xc0)
128 case 2: if ((data & 0xc0) != 0x40) elo->idx = 0; break; 132 elo->idx = 0;
129 133 break;
130 case 3:
131 if (data & 0xc0) {
132 elo->idx = 0;
133 break;
134 }
135 134
136 input_report_abs(dev, ABS_X, ((elo->data[0] & 0x3f) << 6) | (elo->data[1] & 0x3f)); 135 case 1:
137 input_report_abs(dev, ABS_Y, ((elo->data[2] & 0x3f) << 6) | (elo->data[3] & 0x3f)); 136 if ((data & 0xc0) != 0x80)
137 elo->idx = 0;
138 break;
138 139
139 if (elo->id == 2) { 140 case 2:
140 input_report_key(dev, BTN_TOUCH, 1); 141 if ((data & 0xc0) != 0x40)
141 input_sync(dev); 142 elo->idx = 0;
142 elo->idx = 0; 143 break;
143 }
144 144
145 case 3:
146 if (data & 0xc0) {
147 elo->idx = 0;
145 break; 148 break;
149 }
146 150
147 case 4: 151 input_report_abs(dev, ABS_X, ((elo->data[0] & 0x3f) << 6) | (elo->data[1] & 0x3f));
148 if (data) { 152 input_report_abs(dev, ABS_Y, ((elo->data[2] & 0x3f) << 6) | (elo->data[3] & 0x3f));
149 input_sync(dev);
150 elo->idx = 0;
151 }
152 break;
153 153
154 case 5: 154 if (elo->id == 2) {
155 if ((data & 0xf0) == 0) { 155 input_report_key(dev, BTN_TOUCH, 1);
156 input_report_abs(dev, ABS_PRESSURE, elo->data[5]);
157 input_report_key(dev, BTN_TOUCH, !!elo->data[5]);
158 }
159 input_sync(dev); 156 input_sync(dev);
160 elo->idx = 0; 157 elo->idx = 0;
161 break; 158 }
159
160 break;
161
162 case 4:
163 if (data) {
164 input_sync(dev);
165 elo->idx = 0;
166 }
167 break;
168
169 case 5:
170 if ((data & 0xf0) == 0) {
171 input_report_abs(dev, ABS_PRESSURE, elo->data[5]);
172 input_report_key(dev, BTN_TOUCH, !!elo->data[5]);
173 }
174 input_sync(dev);
175 elo->idx = 0;
176 break;
162 } 177 }
163} 178}
164 179
@@ -170,17 +185,17 @@ static void elo_process_data_3(struct elo *elo, unsigned char data)
170 185
171 switch (elo->idx++) { 186 switch (elo->idx++) {
172 187
173 case 0: 188 case 0:
174 if ((data & 0x7f) != 0x01) 189 if ((data & 0x7f) != 0x01)
175 elo->idx = 0;
176 break;
177 case 2:
178 input_report_key(dev, BTN_TOUCH, !(elo->data[1] & 0x80));
179 input_report_abs(dev, ABS_X, elo->data[1]);
180 input_report_abs(dev, ABS_Y, elo->data[2]);
181 input_sync(dev);
182 elo->idx = 0; 190 elo->idx = 0;
183 break; 191 break;
192 case 2:
193 input_report_key(dev, BTN_TOUCH, !(elo->data[1] & 0x80));
194 input_report_abs(dev, ABS_X, elo->data[1]);
195 input_report_abs(dev, ABS_Y, elo->data[2]);
196 input_sync(dev);
197 elo->idx = 0;
198 break;
184 } 199 }
185} 200}
186 201
@@ -189,19 +204,19 @@ static irqreturn_t elo_interrupt(struct serio *serio,
189{ 204{
190 struct elo *elo = serio_get_drvdata(serio); 205 struct elo *elo = serio_get_drvdata(serio);
191 206
192 switch(elo->id) { 207 switch (elo->id) {
193 case 0: 208 case 0:
194 elo_process_data_10(elo, data); 209 elo_process_data_10(elo, data);
195 break; 210 break;
196 211
197 case 1: 212 case 1:
198 case 2: 213 case 2:
199 elo_process_data_6(elo, data); 214 elo_process_data_6(elo, data);
200 break; 215 break;
201 216
202 case 3: 217 case 3:
203 elo_process_data_3(elo, data); 218 elo_process_data_3(elo, data);
204 break; 219 break;
205 } 220 }
206 221
207 return IRQ_HANDLED; 222 return IRQ_HANDLED;
@@ -261,10 +276,10 @@ static int elo_setup_10(struct elo *elo)
261 if (packet[3] & ELO10_PRESSURE) 276 if (packet[3] & ELO10_PRESSURE)
262 input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0); 277 input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0);
263 278
264 printk(KERN_INFO "elo: %sTouch touchscreen, fw: %02x.%02x, " 279 dev_info(&elo->serio->dev,
265 "features: 0x%02x, controller: 0x%02x\n", 280 "%sTouch touchscreen, fw: %02x.%02x, features: 0x%02x, controller: 0x%02x\n",
266 elo_types[(packet[1] -'0') & 0x03], 281 elo_types[(packet[1] -'0') & 0x03],
267 packet[5], packet[4], packet[3], packet[7]); 282 packet[5], packet[4], packet[3], packet[7]);
268 283
269 return 0; 284 return 0;
270} 285}
@@ -330,24 +345,24 @@ static int elo_connect(struct serio *serio, struct serio_driver *drv)
330 345
331 switch (elo->id) { 346 switch (elo->id) {
332 347
333 case 0: /* 10-byte protocol */ 348 case 0: /* 10-byte protocol */
334 if (elo_setup_10(elo)) 349 if (elo_setup_10(elo))
335 goto fail3; 350 goto fail3;
336 351
337 break; 352 break;
338 353
339 case 1: /* 6-byte protocol */ 354 case 1: /* 6-byte protocol */
340 input_set_abs_params(input_dev, ABS_PRESSURE, 0, 15, 0, 0); 355 input_set_abs_params(input_dev, ABS_PRESSURE, 0, 15, 0, 0);
341 356
342 case 2: /* 4-byte protocol */ 357 case 2: /* 4-byte protocol */
343 input_set_abs_params(input_dev, ABS_X, 96, 4000, 0, 0); 358 input_set_abs_params(input_dev, ABS_X, 96, 4000, 0, 0);
344 input_set_abs_params(input_dev, ABS_Y, 96, 4000, 0, 0); 359 input_set_abs_params(input_dev, ABS_Y, 96, 4000, 0, 0);
345 break; 360 break;
346 361
347 case 3: /* 3-byte protocol */ 362 case 3: /* 3-byte protocol */
348 input_set_abs_params(input_dev, ABS_X, 0, 255, 0, 0); 363 input_set_abs_params(input_dev, ABS_X, 0, 255, 0, 0);
349 input_set_abs_params(input_dev, ABS_Y, 0, 255, 0, 0); 364 input_set_abs_params(input_dev, ABS_Y, 0, 255, 0, 0);
350 break; 365 break;
351 } 366 }
352 367
353 err = input_register_device(elo->dev); 368 err = input_register_device(elo->dev);
diff --git a/drivers/input/touchscreen/mainstone-wm97xx.c b/drivers/input/touchscreen/mainstone-wm97xx.c
index 6cdcf2a6e036..b6b8b1c7ecea 100644
--- a/drivers/input/touchscreen/mainstone-wm97xx.c
+++ b/drivers/input/touchscreen/mainstone-wm97xx.c
@@ -153,6 +153,9 @@ static int wm97xx_acc_pen_down(struct wm97xx *wm)
153 if (pressure) 153 if (pressure)
154 p = MODR; 154 p = MODR;
155 155
156 dev_dbg(wm->dev, "Raw coordinates: x=%x, y=%x, p=%x\n",
157 x, y, p);
158
156 /* are samples valid */ 159 /* are samples valid */
157 if ((x & WM97XX_ADCSRC_MASK) != WM97XX_ADCSEL_X || 160 if ((x & WM97XX_ADCSRC_MASK) != WM97XX_ADCSEL_X ||
158 (y & WM97XX_ADCSRC_MASK) != WM97XX_ADCSEL_Y || 161 (y & WM97XX_ADCSRC_MASK) != WM97XX_ADCSEL_Y ||
diff --git a/drivers/input/touchscreen/pcap_ts.c b/drivers/input/touchscreen/pcap_ts.c
index 67fcd33595de..b79097e3028a 100644
--- a/drivers/input/touchscreen/pcap_ts.c
+++ b/drivers/input/touchscreen/pcap_ts.c
@@ -233,7 +233,7 @@ static int pcap_ts_resume(struct device *dev)
233 return 0; 233 return 0;
234} 234}
235 235
236static struct dev_pm_ops pcap_ts_pm_ops = { 236static const struct dev_pm_ops pcap_ts_pm_ops = {
237 .suspend = pcap_ts_suspend, 237 .suspend = pcap_ts_suspend,
238 .resume = pcap_ts_resume, 238 .resume = pcap_ts_resume,
239}; 239};
diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c
index 6386b441ef85..3755a47d053c 100644
--- a/drivers/input/touchscreen/s3c2410_ts.c
+++ b/drivers/input/touchscreen/s3c2410_ts.c
@@ -128,27 +128,29 @@ static void touch_timer_fire(unsigned long data)
128 128
129 down = get_down(data0, data1); 129 down = get_down(data0, data1);
130 130
131 if (ts.count == (1 << ts.shift)) { 131 if (down) {
132 ts.xp >>= ts.shift; 132 if (ts.count == (1 << ts.shift)) {
133 ts.yp >>= ts.shift; 133 ts.xp >>= ts.shift;
134 ts.yp >>= ts.shift;
134 135
135 dev_dbg(ts.dev, "%s: X=%lu, Y=%lu, count=%d\n", 136 dev_dbg(ts.dev, "%s: X=%lu, Y=%lu, count=%d\n",
136 __func__, ts.xp, ts.yp, ts.count); 137 __func__, ts.xp, ts.yp, ts.count);
137 138
138 input_report_abs(ts.input, ABS_X, ts.xp); 139 input_report_abs(ts.input, ABS_X, ts.xp);
139 input_report_abs(ts.input, ABS_Y, ts.yp); 140 input_report_abs(ts.input, ABS_Y, ts.yp);
140 141
141 input_report_key(ts.input, BTN_TOUCH, 1); 142 input_report_key(ts.input, BTN_TOUCH, 1);
142 input_sync(ts.input); 143 input_sync(ts.input);
143 144
144 ts.xp = 0; 145 ts.xp = 0;
145 ts.yp = 0; 146 ts.yp = 0;
146 ts.count = 0; 147 ts.count = 0;
147 } 148 }
148 149
149 if (down) {
150 s3c_adc_start(ts.client, 0, 1 << ts.shift); 150 s3c_adc_start(ts.client, 0, 1 << ts.shift);
151 } else { 151 } else {
152 ts.xp = 0;
153 ts.yp = 0;
152 ts.count = 0; 154 ts.count = 0;
153 155
154 input_report_key(ts.input, BTN_TOUCH, 0); 156 input_report_key(ts.input, BTN_TOUCH, 0);
@@ -401,6 +403,7 @@ static int s3c2410ts_resume(struct device *dev)
401 struct s3c2410_ts_mach_info *info = pdev->dev.platform_data; 403 struct s3c2410_ts_mach_info *info = pdev->dev.platform_data;
402 404
403 clk_enable(ts.clock); 405 clk_enable(ts.clock);
406 enable_irq(ts.irq_tc);
404 407
405 /* Initialise registers */ 408 /* Initialise registers */
406 if ((info->delay & 0xffff) > 0) 409 if ((info->delay & 0xffff) > 0)
diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c
index 7ef0d1420d3c..be23780e8a3e 100644
--- a/drivers/input/touchscreen/tsc2007.c
+++ b/drivers/input/touchscreen/tsc2007.c
@@ -358,7 +358,7 @@ static int __devexit tsc2007_remove(struct i2c_client *client)
358 return 0; 358 return 0;
359} 359}
360 360
361static struct i2c_device_id tsc2007_idtable[] = { 361static const struct i2c_device_id tsc2007_idtable[] = {
362 { "tsc2007", 0 }, 362 { "tsc2007", 0 },
363 { } 363 { }
364}; 364};
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index 5256123a5228..99330bbdbac7 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -15,6 +15,7 @@
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 * - Zytronic capacitive touchscreen
18 * - NEXIO/iNexio
18 * 19 *
19 * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch> 20 * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch>
20 * Copyright (C) by Todd E. Johnson (mtouchusb.c) 21 * Copyright (C) by Todd E. Johnson (mtouchusb.c)
@@ -95,6 +96,7 @@ struct usbtouch_device_info {
95 96
96 int (*read_data) (struct usbtouch_usb *usbtouch, unsigned char *pkt); 97 int (*read_data) (struct usbtouch_usb *usbtouch, unsigned char *pkt);
97 int (*init) (struct usbtouch_usb *usbtouch); 98 int (*init) (struct usbtouch_usb *usbtouch);
99 void (*exit) (struct usbtouch_usb *usbtouch);
98}; 100};
99 101
100/* a usbtouch device */ 102/* a usbtouch device */
@@ -104,11 +106,12 @@ struct usbtouch_usb {
104 unsigned char *buffer; 106 unsigned char *buffer;
105 int buf_len; 107 int buf_len;
106 struct urb *irq; 108 struct urb *irq;
107 struct usb_device *udev; 109 struct usb_interface *interface;
108 struct input_dev *input; 110 struct input_dev *input;
109 struct usbtouch_device_info *type; 111 struct usbtouch_device_info *type;
110 char name[128]; 112 char name[128];
111 char phys[64]; 113 char phys[64];
114 void *priv;
112 115
113 int x, y; 116 int x, y;
114 int touch, press; 117 int touch, press;
@@ -133,6 +136,7 @@ enum {
133 DEVTYPE_E2I, 136 DEVTYPE_E2I,
134 DEVTYPE_ZYTRONIC, 137 DEVTYPE_ZYTRONIC,
135 DEVTYPE_TC5UH, 138 DEVTYPE_TC5UH,
139 DEVTYPE_NEXIO,
136}; 140};
137 141
138#define USB_DEVICE_HID_CLASS(vend, prod) \ 142#define USB_DEVICE_HID_CLASS(vend, prod) \
@@ -144,7 +148,7 @@ enum {
144 .bInterfaceClass = USB_INTERFACE_CLASS_HID, \ 148 .bInterfaceClass = USB_INTERFACE_CLASS_HID, \
145 .bInterfaceProtocol = USB_INTERFACE_PROTOCOL_MOUSE 149 .bInterfaceProtocol = USB_INTERFACE_PROTOCOL_MOUSE
146 150
147static struct usb_device_id usbtouch_devices[] = { 151static const struct usb_device_id usbtouch_devices[] = {
148#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX 152#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX
149 /* ignore the HID capable devices, handled by usbhid */ 153 /* ignore the HID capable devices, handled by usbhid */
150 {USB_DEVICE_HID_CLASS(0x0eef, 0x0001), .driver_info = DEVTYPE_IGNORE}, 154 {USB_DEVICE_HID_CLASS(0x0eef, 0x0001), .driver_info = DEVTYPE_IGNORE},
@@ -222,6 +226,14 @@ static struct usb_device_id usbtouch_devices[] = {
222 {USB_DEVICE(0x0664, 0x0309), .driver_info = DEVTYPE_TC5UH}, 226 {USB_DEVICE(0x0664, 0x0309), .driver_info = DEVTYPE_TC5UH},
223#endif 227#endif
224 228
229#ifdef CONFIG_TOUCHSCREEN_USB_NEXIO
230 /* data interface only */
231 {USB_DEVICE_AND_INTERFACE_INFO(0x10f0, 0x2002, 0x0a, 0x00, 0x00),
232 .driver_info = DEVTYPE_NEXIO},
233 {USB_DEVICE_AND_INTERFACE_INFO(0x1870, 0x0001, 0x0a, 0x00, 0x00),
234 .driver_info = DEVTYPE_NEXIO},
235#endif
236
225 {} 237 {}
226}; 238};
227 239
@@ -234,8 +246,9 @@ static struct usb_device_id usbtouch_devices[] = {
234static int e2i_init(struct usbtouch_usb *usbtouch) 246static int e2i_init(struct usbtouch_usb *usbtouch)
235{ 247{
236 int ret; 248 int ret;
249 struct usb_device *udev = interface_to_usbdev(usbtouch->interface);
237 250
238 ret = usb_control_msg(usbtouch->udev, usb_rcvctrlpipe(usbtouch->udev, 0), 251 ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
239 0x01, 0x02, 0x0000, 0x0081, 252 0x01, 0x02, 0x0000, 0x0081,
240 NULL, 0, USB_CTRL_SET_TIMEOUT); 253 NULL, 0, USB_CTRL_SET_TIMEOUT);
241 254
@@ -344,8 +357,9 @@ static int mtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
344static int mtouch_init(struct usbtouch_usb *usbtouch) 357static int mtouch_init(struct usbtouch_usb *usbtouch)
345{ 358{
346 int ret, i; 359 int ret, i;
360 struct usb_device *udev = interface_to_usbdev(usbtouch->interface);
347 361
348 ret = usb_control_msg(usbtouch->udev, usb_rcvctrlpipe(usbtouch->udev, 0), 362 ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
349 MTOUCHUSB_RESET, 363 MTOUCHUSB_RESET,
350 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 364 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
351 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); 365 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT);
@@ -356,7 +370,7 @@ static int mtouch_init(struct usbtouch_usb *usbtouch)
356 msleep(150); 370 msleep(150);
357 371
358 for (i = 0; i < 3; i++) { 372 for (i = 0; i < 3; i++) {
359 ret = usb_control_msg(usbtouch->udev, usb_rcvctrlpipe(usbtouch->udev, 0), 373 ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
360 MTOUCHUSB_ASYNC_REPORT, 374 MTOUCHUSB_ASYNC_REPORT,
361 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 375 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
362 1, 1, NULL, 0, USB_CTRL_SET_TIMEOUT); 376 1, 1, NULL, 0, USB_CTRL_SET_TIMEOUT);
@@ -489,7 +503,7 @@ static int gunze_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
489 503
490static int dmc_tsc10_init(struct usbtouch_usb *usbtouch) 504static int dmc_tsc10_init(struct usbtouch_usb *usbtouch)
491{ 505{
492 struct usb_device *dev = usbtouch->udev; 506 struct usb_device *dev = interface_to_usbdev(usbtouch->interface);
493 int ret = -ENOMEM; 507 int ret = -ENOMEM;
494 unsigned char *buf; 508 unsigned char *buf;
495 509
@@ -690,6 +704,229 @@ static int zytronic_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
690#endif 704#endif
691 705
692/***************************************************************************** 706/*****************************************************************************
707 * NEXIO Part
708 */
709#ifdef CONFIG_TOUCHSCREEN_USB_NEXIO
710
711#define NEXIO_TIMEOUT 5000
712#define NEXIO_BUFSIZE 1024
713#define NEXIO_THRESHOLD 50
714
715struct nexio_priv {
716 struct urb *ack;
717 unsigned char *ack_buf;
718};
719
720struct nexio_touch_packet {
721 u8 flags; /* 0xe1 = touch, 0xe1 = release */
722 __be16 data_len; /* total bytes of touch data */
723 __be16 x_len; /* bytes for X axis */
724 __be16 y_len; /* bytes for Y axis */
725 u8 data[];
726} __attribute__ ((packed));
727
728static unsigned char nexio_ack_pkt[2] = { 0xaa, 0x02 };
729static unsigned char nexio_init_pkt[4] = { 0x82, 0x04, 0x0a, 0x0f };
730
731static void nexio_ack_complete(struct urb *urb)
732{
733}
734
735static int nexio_init(struct usbtouch_usb *usbtouch)
736{
737 struct usb_device *dev = interface_to_usbdev(usbtouch->interface);
738 struct usb_host_interface *interface = usbtouch->interface->cur_altsetting;
739 struct nexio_priv *priv;
740 int ret = -ENOMEM;
741 int actual_len, i;
742 unsigned char *buf;
743 char *firmware_ver = NULL, *device_name = NULL;
744 int input_ep = 0, output_ep = 0;
745
746 /* find first input and output endpoint */
747 for (i = 0; i < interface->desc.bNumEndpoints; i++) {
748 if (!input_ep &&
749 usb_endpoint_dir_in(&interface->endpoint[i].desc))
750 input_ep = interface->endpoint[i].desc.bEndpointAddress;
751 if (!output_ep &&
752 usb_endpoint_dir_out(&interface->endpoint[i].desc))
753 output_ep = interface->endpoint[i].desc.bEndpointAddress;
754 }
755 if (!input_ep || !output_ep)
756 return -ENXIO;
757
758 buf = kmalloc(NEXIO_BUFSIZE, GFP_KERNEL);
759 if (!buf)
760 goto out_buf;
761
762 /* two empty reads */
763 for (i = 0; i < 2; i++) {
764 ret = usb_bulk_msg(dev, usb_rcvbulkpipe(dev, input_ep),
765 buf, NEXIO_BUFSIZE, &actual_len,
766 NEXIO_TIMEOUT);
767 if (ret < 0)
768 goto out_buf;
769 }
770
771 /* send init command */
772 memcpy(buf, nexio_init_pkt, sizeof(nexio_init_pkt));
773 ret = usb_bulk_msg(dev, usb_sndbulkpipe(dev, output_ep),
774 buf, sizeof(nexio_init_pkt), &actual_len,
775 NEXIO_TIMEOUT);
776 if (ret < 0)
777 goto out_buf;
778
779 /* read replies */
780 for (i = 0; i < 3; i++) {
781 memset(buf, 0, NEXIO_BUFSIZE);
782 ret = usb_bulk_msg(dev, usb_rcvbulkpipe(dev, input_ep),
783 buf, NEXIO_BUFSIZE, &actual_len,
784 NEXIO_TIMEOUT);
785 if (ret < 0 || actual_len < 1 || buf[1] != actual_len)
786 continue;
787 switch (buf[0]) {
788 case 0x83: /* firmware version */
789 if (!firmware_ver)
790 firmware_ver = kstrdup(&buf[2], GFP_KERNEL);
791 break;
792 case 0x84: /* device name */
793 if (!device_name)
794 device_name = kstrdup(&buf[2], GFP_KERNEL);
795 break;
796 }
797 }
798
799 printk(KERN_INFO "Nexio device: %s, firmware version: %s\n",
800 device_name, firmware_ver);
801
802 kfree(firmware_ver);
803 kfree(device_name);
804
805 /* prepare ACK URB */
806 ret = -ENOMEM;
807
808 usbtouch->priv = kmalloc(sizeof(struct nexio_priv), GFP_KERNEL);
809 if (!usbtouch->priv)
810 goto out_buf;
811
812 priv = usbtouch->priv;
813
814 priv->ack_buf = kmalloc(sizeof(nexio_ack_pkt), GFP_KERNEL);
815 if (!priv->ack_buf)
816 goto err_priv;
817
818 memcpy(priv->ack_buf, nexio_ack_pkt, sizeof(nexio_ack_pkt));
819
820 priv->ack = usb_alloc_urb(0, GFP_KERNEL);
821 if (!priv->ack) {
822 dbg("%s - usb_alloc_urb failed: usbtouch->ack", __func__);
823 goto err_ack_buf;
824 }
825
826 usb_fill_bulk_urb(priv->ack, dev, usb_sndbulkpipe(dev, output_ep),
827 priv->ack_buf, sizeof(nexio_ack_pkt),
828 nexio_ack_complete, usbtouch);
829 ret = 0;
830 goto out_buf;
831
832err_ack_buf:
833 kfree(priv->ack_buf);
834err_priv:
835 kfree(priv);
836out_buf:
837 kfree(buf);
838 return ret;
839}
840
841static void nexio_exit(struct usbtouch_usb *usbtouch)
842{
843 struct nexio_priv *priv = usbtouch->priv;
844
845 usb_kill_urb(priv->ack);
846 usb_free_urb(priv->ack);
847 kfree(priv->ack_buf);
848 kfree(priv);
849}
850
851static int nexio_read_data(struct usbtouch_usb *usbtouch, unsigned char *pkt)
852{
853 int x, y, begin_x, begin_y, end_x, end_y, w, h, ret;
854 struct nexio_touch_packet *packet = (void *) pkt;
855 struct nexio_priv *priv = usbtouch->priv;
856
857 /* got touch data? */
858 if ((pkt[0] & 0xe0) != 0xe0)
859 return 0;
860
861 /* send ACK */
862 ret = usb_submit_urb(priv->ack, GFP_ATOMIC);
863
864 if (!usbtouch->type->max_xc) {
865 usbtouch->type->max_xc = 2 * be16_to_cpu(packet->x_len);
866 input_set_abs_params(usbtouch->input, ABS_X, 0,
867 2 * be16_to_cpu(packet->x_len), 0, 0);
868 usbtouch->type->max_yc = 2 * be16_to_cpu(packet->y_len);
869 input_set_abs_params(usbtouch->input, ABS_Y, 0,
870 2 * be16_to_cpu(packet->y_len), 0, 0);
871 }
872 /*
873 * The device reports state of IR sensors on X and Y axes.
874 * Each byte represents "darkness" percentage (0-100) of one element.
875 * 17" touchscreen reports only 64 x 52 bytes so the resolution is low.
876 * This also means that there's a limited multi-touch capability but
877 * it's disabled (and untested) here as there's no X driver for that.
878 */
879 begin_x = end_x = begin_y = end_y = -1;
880 for (x = 0; x < be16_to_cpu(packet->x_len); x++) {
881 if (begin_x == -1 && packet->data[x] > NEXIO_THRESHOLD) {
882 begin_x = x;
883 continue;
884 }
885 if (end_x == -1 && begin_x != -1 && packet->data[x] < NEXIO_THRESHOLD) {
886 end_x = x - 1;
887 for (y = be16_to_cpu(packet->x_len);
888 y < be16_to_cpu(packet->data_len); y++) {
889 if (begin_y == -1 && packet->data[y] > NEXIO_THRESHOLD) {
890 begin_y = y - be16_to_cpu(packet->x_len);
891 continue;
892 }
893 if (end_y == -1 &&
894 begin_y != -1 && packet->data[y] < NEXIO_THRESHOLD) {
895 end_y = y - 1 - be16_to_cpu(packet->x_len);
896 w = end_x - begin_x;
897 h = end_y - begin_y;
898#if 0
899 /* multi-touch */
900 input_report_abs(usbtouch->input,
901 ABS_MT_TOUCH_MAJOR, max(w,h));
902 input_report_abs(usbtouch->input,
903 ABS_MT_TOUCH_MINOR, min(x,h));
904 input_report_abs(usbtouch->input,
905 ABS_MT_POSITION_X, 2*begin_x+w);
906 input_report_abs(usbtouch->input,
907 ABS_MT_POSITION_Y, 2*begin_y+h);
908 input_report_abs(usbtouch->input,
909 ABS_MT_ORIENTATION, w > h);
910 input_mt_sync(usbtouch->input);
911#endif
912 /* single touch */
913 usbtouch->x = 2 * begin_x + w;
914 usbtouch->y = 2 * begin_y + h;
915 usbtouch->touch = packet->flags & 0x01;
916 begin_y = end_y = -1;
917 return 1;
918 }
919 }
920 begin_x = end_x = -1;
921 }
922
923 }
924 return 0;
925}
926#endif
927
928
929/*****************************************************************************
693 * the different device descriptors 930 * the different device descriptors
694 */ 931 */
695#ifdef MULTI_PACKET 932#ifdef MULTI_PACKET
@@ -873,6 +1110,16 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
873 .read_data = tc5uh_read_data, 1110 .read_data = tc5uh_read_data,
874 }, 1111 },
875#endif 1112#endif
1113
1114#ifdef CONFIG_TOUCHSCREEN_USB_NEXIO
1115 [DEVTYPE_NEXIO] = {
1116 .rept_size = 128,
1117 .irq_always = true,
1118 .read_data = nexio_read_data,
1119 .init = nexio_init,
1120 .exit = nexio_exit,
1121 },
1122#endif
876}; 1123};
877 1124
878 1125
@@ -998,6 +1245,7 @@ static void usbtouch_irq(struct urb *urb)
998 case -ECONNRESET: 1245 case -ECONNRESET:
999 case -ENOENT: 1246 case -ENOENT:
1000 case -ESHUTDOWN: 1247 case -ESHUTDOWN:
1248 case -EPIPE:
1001 /* this urb is terminated, clean up */ 1249 /* this urb is terminated, clean up */
1002 dbg("%s - urb shutting down with status: %d", 1250 dbg("%s - urb shutting down with status: %d",
1003 __func__, urb->status); 1251 __func__, urb->status);
@@ -1021,7 +1269,7 @@ static int usbtouch_open(struct input_dev *input)
1021{ 1269{
1022 struct usbtouch_usb *usbtouch = input_get_drvdata(input); 1270 struct usbtouch_usb *usbtouch = input_get_drvdata(input);
1023 1271
1024 usbtouch->irq->dev = usbtouch->udev; 1272 usbtouch->irq->dev = interface_to_usbdev(usbtouch->interface);
1025 1273
1026 if (!usbtouch->type->irq_always) { 1274 if (!usbtouch->type->irq_always) {
1027 if (usb_submit_urb(usbtouch->irq, GFP_KERNEL)) 1275 if (usb_submit_urb(usbtouch->irq, GFP_KERNEL))
@@ -1048,13 +1296,23 @@ static void usbtouch_free_buffers(struct usb_device *udev,
1048 kfree(usbtouch->buffer); 1296 kfree(usbtouch->buffer);
1049} 1297}
1050 1298
1299static struct usb_endpoint_descriptor *
1300usbtouch_get_input_endpoint(struct usb_host_interface *interface)
1301{
1302 int i;
1303
1304 for (i = 0; i < interface->desc.bNumEndpoints; i++)
1305 if (usb_endpoint_dir_in(&interface->endpoint[i].desc))
1306 return &interface->endpoint[i].desc;
1307
1308 return NULL;
1309}
1051 1310
1052static int usbtouch_probe(struct usb_interface *intf, 1311static int usbtouch_probe(struct usb_interface *intf,
1053 const struct usb_device_id *id) 1312 const struct usb_device_id *id)
1054{ 1313{
1055 struct usbtouch_usb *usbtouch; 1314 struct usbtouch_usb *usbtouch;
1056 struct input_dev *input_dev; 1315 struct input_dev *input_dev;
1057 struct usb_host_interface *interface;
1058 struct usb_endpoint_descriptor *endpoint; 1316 struct usb_endpoint_descriptor *endpoint;
1059 struct usb_device *udev = interface_to_usbdev(intf); 1317 struct usb_device *udev = interface_to_usbdev(intf);
1060 struct usbtouch_device_info *type; 1318 struct usbtouch_device_info *type;
@@ -1064,8 +1322,9 @@ static int usbtouch_probe(struct usb_interface *intf,
1064 if (id->driver_info == DEVTYPE_IGNORE) 1322 if (id->driver_info == DEVTYPE_IGNORE)
1065 return -ENODEV; 1323 return -ENODEV;
1066 1324
1067 interface = intf->cur_altsetting; 1325 endpoint = usbtouch_get_input_endpoint(intf->cur_altsetting);
1068 endpoint = &interface->endpoint[0].desc; 1326 if (!endpoint)
1327 return -ENXIO;
1069 1328
1070 usbtouch = kzalloc(sizeof(struct usbtouch_usb), GFP_KERNEL); 1329 usbtouch = kzalloc(sizeof(struct usbtouch_usb), GFP_KERNEL);
1071 input_dev = input_allocate_device(); 1330 input_dev = input_allocate_device();
@@ -1094,7 +1353,7 @@ static int usbtouch_probe(struct usb_interface *intf,
1094 goto out_free_buffers; 1353 goto out_free_buffers;
1095 } 1354 }
1096 1355
1097 usbtouch->udev = udev; 1356 usbtouch->interface = intf;
1098 usbtouch->input = input_dev; 1357 usbtouch->input = input_dev;
1099 1358
1100 if (udev->manufacturer) 1359 if (udev->manufacturer)
@@ -1133,12 +1392,18 @@ static int usbtouch_probe(struct usb_interface *intf,
1133 input_set_abs_params(input_dev, ABS_PRESSURE, type->min_press, 1392 input_set_abs_params(input_dev, ABS_PRESSURE, type->min_press,
1134 type->max_press, 0, 0); 1393 type->max_press, 0, 0);
1135 1394
1136 usb_fill_int_urb(usbtouch->irq, usbtouch->udev, 1395 if (usb_endpoint_type(endpoint) == USB_ENDPOINT_XFER_INT)
1137 usb_rcvintpipe(usbtouch->udev, endpoint->bEndpointAddress), 1396 usb_fill_int_urb(usbtouch->irq, udev,
1397 usb_rcvintpipe(udev, endpoint->bEndpointAddress),
1138 usbtouch->data, type->rept_size, 1398 usbtouch->data, type->rept_size,
1139 usbtouch_irq, usbtouch, endpoint->bInterval); 1399 usbtouch_irq, usbtouch, endpoint->bInterval);
1400 else
1401 usb_fill_bulk_urb(usbtouch->irq, udev,
1402 usb_rcvbulkpipe(udev, endpoint->bEndpointAddress),
1403 usbtouch->data, type->rept_size,
1404 usbtouch_irq, usbtouch);
1140 1405
1141 usbtouch->irq->dev = usbtouch->udev; 1406 usbtouch->irq->dev = udev;
1142 usbtouch->irq->transfer_dma = usbtouch->data_dma; 1407 usbtouch->irq->transfer_dma = usbtouch->data_dma;
1143 usbtouch->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 1408 usbtouch->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
1144 1409
@@ -1147,23 +1412,37 @@ static int usbtouch_probe(struct usb_interface *intf,
1147 err = type->init(usbtouch); 1412 err = type->init(usbtouch);
1148 if (err) { 1413 if (err) {
1149 dbg("%s - type->init() failed, err: %d", __func__, err); 1414 dbg("%s - type->init() failed, err: %d", __func__, err);
1150 goto out_free_buffers; 1415 goto out_free_urb;
1151 } 1416 }
1152 } 1417 }
1153 1418
1154 err = input_register_device(usbtouch->input); 1419 err = input_register_device(usbtouch->input);
1155 if (err) { 1420 if (err) {
1156 dbg("%s - input_register_device failed, err: %d", __func__, err); 1421 dbg("%s - input_register_device failed, err: %d", __func__, err);
1157 goto out_free_buffers; 1422 goto out_do_exit;
1158 } 1423 }
1159 1424
1160 usb_set_intfdata(intf, usbtouch); 1425 usb_set_intfdata(intf, usbtouch);
1161 1426
1162 if (usbtouch->type->irq_always) 1427 if (usbtouch->type->irq_always) {
1163 usb_submit_urb(usbtouch->irq, GFP_KERNEL); 1428 err = usb_submit_urb(usbtouch->irq, GFP_KERNEL);
1429 if (err) {
1430 err("%s - usb_submit_urb failed with result: %d",
1431 __func__, err);
1432 goto out_unregister_input;
1433 }
1434 }
1164 1435
1165 return 0; 1436 return 0;
1166 1437
1438out_unregister_input:
1439 input_unregister_device(input_dev);
1440 input_dev = NULL;
1441out_do_exit:
1442 if (type->exit)
1443 type->exit(usbtouch);
1444out_free_urb:
1445 usb_free_urb(usbtouch->irq);
1167out_free_buffers: 1446out_free_buffers:
1168 usbtouch_free_buffers(udev, usbtouch); 1447 usbtouch_free_buffers(udev, usbtouch);
1169out_free: 1448out_free:
@@ -1186,6 +1465,8 @@ static void usbtouch_disconnect(struct usb_interface *intf)
1186 /* this will stop IO via close */ 1465 /* this will stop IO via close */
1187 input_unregister_device(usbtouch->input); 1466 input_unregister_device(usbtouch->input);
1188 usb_free_urb(usbtouch->irq); 1467 usb_free_urb(usbtouch->irq);
1468 if (usbtouch->type->exit)
1469 usbtouch->type->exit(usbtouch);
1189 usbtouch_free_buffers(interface_to_usbdev(intf), usbtouch); 1470 usbtouch_free_buffers(interface_to_usbdev(intf), usbtouch);
1190 kfree(usbtouch); 1471 kfree(usbtouch);
1191} 1472}
diff --git a/drivers/input/touchscreen/zylonite-wm97xx.c b/drivers/input/touchscreen/zylonite-wm97xx.c
index eca54dbdf493..048849867643 100644
--- a/drivers/input/touchscreen/zylonite-wm97xx.c
+++ b/drivers/input/touchscreen/zylonite-wm97xx.c
@@ -118,6 +118,9 @@ static int wm97xx_acc_pen_down(struct wm97xx *wm)
118 if (pressure) 118 if (pressure)
119 p = MODR; 119 p = MODR;
120 120
121 dev_dbg(wm->dev, "Raw coordinates: x=%x, y=%x, p=%x\n",
122 x, y, p);
123
121 /* are samples valid */ 124 /* are samples valid */
122 if ((x & WM97XX_ADCSRC_MASK) != WM97XX_ADCSEL_X || 125 if ((x & WM97XX_ADCSRC_MASK) != WM97XX_ADCSEL_X ||
123 (y & WM97XX_ADCSRC_MASK) != WM97XX_ADCSEL_Y || 126 (y & WM97XX_ADCSRC_MASK) != WM97XX_ADCSEL_Y ||