diff options
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r-- | drivers/input/touchscreen/Kconfig | 16 | ||||
-rw-r--r-- | drivers/input/touchscreen/atmel_tsadcc.c | 8 | ||||
-rw-r--r-- | drivers/input/touchscreen/eeti_ts.c | 22 | ||||
-rw-r--r-- | drivers/input/touchscreen/h3600_ts_input.c | 9 | ||||
-rw-r--r-- | drivers/input/touchscreen/mainstone-wm97xx.c | 53 | ||||
-rw-r--r-- | drivers/input/touchscreen/tsc2007.c | 264 | ||||
-rw-r--r-- | drivers/input/touchscreen/ucb1400_ts.c | 5 | ||||
-rw-r--r-- | drivers/input/touchscreen/usbtouchscreen.c | 81 | ||||
-rw-r--r-- | drivers/input/touchscreen/w90p910_ts.c | 38 | ||||
-rw-r--r-- | drivers/input/touchscreen/wacom_w8001.c | 121 | ||||
-rw-r--r-- | drivers/input/touchscreen/wm97xx-core.c | 6 |
11 files changed, 362 insertions, 261 deletions
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 72e2712c7e2a..87a1ae63bcc4 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig | |||
@@ -366,11 +366,11 @@ config TOUCHSCREEN_WM97XX_ATMEL | |||
366 | be called atmel-wm97xx. | 366 | be called atmel-wm97xx. |
367 | 367 | ||
368 | config TOUCHSCREEN_WM97XX_MAINSTONE | 368 | config TOUCHSCREEN_WM97XX_MAINSTONE |
369 | tristate "WM97xx Mainstone accelerated touch" | 369 | tristate "WM97xx Mainstone/Palm accelerated touch" |
370 | depends on TOUCHSCREEN_WM97XX && ARCH_PXA | 370 | depends on TOUCHSCREEN_WM97XX && ARCH_PXA |
371 | help | 371 | help |
372 | Say Y here for support for streaming mode with WM97xx touchscreens | 372 | Say Y here for support for streaming mode with WM97xx touchscreens |
373 | on Mainstone systems. | 373 | on Mainstone, Palm Tungsten T5, TX and LifeDrive systems. |
374 | 374 | ||
375 | If unsure, say N. | 375 | If unsure, say N. |
376 | 376 | ||
@@ -406,6 +406,7 @@ config TOUCHSCREEN_USB_COMPOSITE | |||
406 | - IRTOUCHSYSTEMS/UNITOP | 406 | - IRTOUCHSYSTEMS/UNITOP |
407 | - IdealTEK URTC1000 | 407 | - IdealTEK URTC1000 |
408 | - GoTop Super_Q2/GogoPen/PenPower tablets | 408 | - GoTop Super_Q2/GogoPen/PenPower tablets |
409 | - JASTEC USB Touch Controller/DigiTech DTR-02U | ||
409 | 410 | ||
410 | Have a look at <http://linux.chapter7.ch/touchkit/> for | 411 | Have a look at <http://linux.chapter7.ch/touchkit/> for |
411 | a usage description and the required user-space stuff. | 412 | a usage description and the required user-space stuff. |
@@ -468,6 +469,16 @@ config TOUCHSCREEN_USB_GOTOP | |||
468 | bool "GoTop Super_Q2/GogoPen/PenPower tablet device support" if EMBEDDED | 469 | bool "GoTop Super_Q2/GogoPen/PenPower tablet device support" if EMBEDDED |
469 | depends on TOUCHSCREEN_USB_COMPOSITE | 470 | depends on TOUCHSCREEN_USB_COMPOSITE |
470 | 471 | ||
472 | config TOUCHSCREEN_USB_JASTEC | ||
473 | default y | ||
474 | bool "JASTEC/DigiTech DTR-02U USB touch controller device support" if EMBEDDED | ||
475 | depends on TOUCHSCREEN_USB_COMPOSITE | ||
476 | |||
477 | config TOUCHSCREEN_USB_E2I | ||
478 | default y | ||
479 | bool "e2i Touchscreen controller (e.g. from Mimo 740)" | ||
480 | depends on TOUCHSCREEN_USB_COMPOSITE | ||
481 | |||
471 | config TOUCHSCREEN_TOUCHIT213 | 482 | config TOUCHSCREEN_TOUCHIT213 |
472 | tristate "Sahara TouchIT-213 touchscreen" | 483 | tristate "Sahara TouchIT-213 touchscreen" |
473 | select SERIO | 484 | select SERIO |
@@ -492,6 +503,7 @@ config TOUCHSCREEN_TSC2007 | |||
492 | 503 | ||
493 | config TOUCHSCREEN_W90X900 | 504 | config TOUCHSCREEN_W90X900 |
494 | tristate "W90P910 touchscreen driver" | 505 | tristate "W90P910 touchscreen driver" |
506 | depends on HAVE_CLK | ||
495 | help | 507 | help |
496 | Say Y here if you have a W90P910 based touchscreen. | 508 | Say Y here if you have a W90P910 based touchscreen. |
497 | 509 | ||
diff --git a/drivers/input/touchscreen/atmel_tsadcc.c b/drivers/input/touchscreen/atmel_tsadcc.c index 055969e8be13..9c7fce4d74d0 100644 --- a/drivers/input/touchscreen/atmel_tsadcc.c +++ b/drivers/input/touchscreen/atmel_tsadcc.c | |||
@@ -204,14 +204,14 @@ static int __devinit atmel_tsadcc_probe(struct platform_device *pdev) | |||
204 | goto err_free_dev; | 204 | goto err_free_dev; |
205 | } | 205 | } |
206 | 206 | ||
207 | if (!request_mem_region(res->start, res->end - res->start + 1, | 207 | if (!request_mem_region(res->start, resource_size(res), |
208 | "atmel tsadcc regs")) { | 208 | "atmel tsadcc regs")) { |
209 | dev_err(&pdev->dev, "resources is unavailable.\n"); | 209 | dev_err(&pdev->dev, "resources is unavailable.\n"); |
210 | err = -EBUSY; | 210 | err = -EBUSY; |
211 | goto err_free_dev; | 211 | goto err_free_dev; |
212 | } | 212 | } |
213 | 213 | ||
214 | tsc_base = ioremap(res->start, res->end - res->start + 1); | 214 | tsc_base = ioremap(res->start, resource_size(res)); |
215 | if (!tsc_base) { | 215 | if (!tsc_base) { |
216 | dev_err(&pdev->dev, "failed to map registers.\n"); | 216 | dev_err(&pdev->dev, "failed to map registers.\n"); |
217 | err = -ENOMEM; | 217 | err = -ENOMEM; |
@@ -286,7 +286,7 @@ err_free_irq: | |||
286 | err_unmap_regs: | 286 | err_unmap_regs: |
287 | iounmap(tsc_base); | 287 | iounmap(tsc_base); |
288 | err_release_mem: | 288 | err_release_mem: |
289 | release_mem_region(res->start, res->end - res->start + 1); | 289 | release_mem_region(res->start, resource_size(res)); |
290 | err_free_dev: | 290 | err_free_dev: |
291 | input_free_device(ts_dev->input); | 291 | input_free_device(ts_dev->input); |
292 | err_free_mem: | 292 | err_free_mem: |
@@ -305,7 +305,7 @@ static int __devexit atmel_tsadcc_remove(struct platform_device *pdev) | |||
305 | 305 | ||
306 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 306 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
307 | iounmap(tsc_base); | 307 | iounmap(tsc_base); |
308 | release_mem_region(res->start, res->end - res->start + 1); | 308 | release_mem_region(res->start, resource_size(res)); |
309 | 309 | ||
310 | clk_disable(ts_dev->clk); | 310 | clk_disable(ts_dev->clk); |
311 | clk_put(ts_dev->clk); | 311 | clk_put(ts_dev->clk); |
diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c index 3ab92222a525..9029bd3f34e5 100644 --- a/drivers/input/touchscreen/eeti_ts.c +++ b/drivers/input/touchscreen/eeti_ts.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/i2c.h> | 32 | #include <linux/i2c.h> |
33 | #include <linux/timer.h> | 33 | #include <linux/timer.h> |
34 | #include <linux/gpio.h> | 34 | #include <linux/gpio.h> |
35 | #include <linux/input/eeti_ts.h> | ||
35 | 36 | ||
36 | static int flip_x; | 37 | static int flip_x; |
37 | module_param(flip_x, bool, 0644); | 38 | module_param(flip_x, bool, 0644); |
@@ -46,7 +47,7 @@ struct eeti_ts_priv { | |||
46 | struct input_dev *input; | 47 | struct input_dev *input; |
47 | struct work_struct work; | 48 | struct work_struct work; |
48 | struct mutex mutex; | 49 | struct mutex mutex; |
49 | int irq; | 50 | int irq, irq_active_high; |
50 | }; | 51 | }; |
51 | 52 | ||
52 | #define EETI_TS_BITDEPTH (11) | 53 | #define EETI_TS_BITDEPTH (11) |
@@ -58,6 +59,11 @@ struct eeti_ts_priv { | |||
58 | #define REPORT_BIT_HAS_PRESSURE (1 << 6) | 59 | #define REPORT_BIT_HAS_PRESSURE (1 << 6) |
59 | #define REPORT_RES_BITS(v) (((v) >> 1) + EETI_TS_BITDEPTH) | 60 | #define REPORT_RES_BITS(v) (((v) >> 1) + EETI_TS_BITDEPTH) |
60 | 61 | ||
62 | static inline int eeti_ts_irq_active(struct eeti_ts_priv *priv) | ||
63 | { | ||
64 | return gpio_get_value(irq_to_gpio(priv->irq)) == priv->irq_active_high; | ||
65 | } | ||
66 | |||
61 | static void eeti_ts_read(struct work_struct *work) | 67 | static void eeti_ts_read(struct work_struct *work) |
62 | { | 68 | { |
63 | char buf[6]; | 69 | char buf[6]; |
@@ -67,7 +73,7 @@ static void eeti_ts_read(struct work_struct *work) | |||
67 | 73 | ||
68 | mutex_lock(&priv->mutex); | 74 | mutex_lock(&priv->mutex); |
69 | 75 | ||
70 | while (!gpio_get_value(irq_to_gpio(priv->irq)) && --to) | 76 | while (eeti_ts_irq_active(priv) && --to) |
71 | i2c_master_recv(priv->client, buf, sizeof(buf)); | 77 | i2c_master_recv(priv->client, buf, sizeof(buf)); |
72 | 78 | ||
73 | if (!to) { | 79 | if (!to) { |
@@ -140,8 +146,10 @@ static void eeti_ts_close(struct input_dev *dev) | |||
140 | static int __devinit eeti_ts_probe(struct i2c_client *client, | 146 | static int __devinit eeti_ts_probe(struct i2c_client *client, |
141 | const struct i2c_device_id *idp) | 147 | const struct i2c_device_id *idp) |
142 | { | 148 | { |
149 | struct eeti_ts_platform_data *pdata; | ||
143 | struct eeti_ts_priv *priv; | 150 | struct eeti_ts_priv *priv; |
144 | struct input_dev *input; | 151 | struct input_dev *input; |
152 | unsigned int irq_flags; | ||
145 | int err = -ENOMEM; | 153 | int err = -ENOMEM; |
146 | 154 | ||
147 | /* In contrast to what's described in the datasheet, there seems | 155 | /* In contrast to what's described in the datasheet, there seems |
@@ -180,6 +188,14 @@ static int __devinit eeti_ts_probe(struct i2c_client *client, | |||
180 | priv->input = input; | 188 | priv->input = input; |
181 | priv->irq = client->irq; | 189 | priv->irq = client->irq; |
182 | 190 | ||
191 | pdata = client->dev.platform_data; | ||
192 | |||
193 | if (pdata) | ||
194 | priv->irq_active_high = pdata->irq_active_high; | ||
195 | |||
196 | irq_flags = priv->irq_active_high ? | ||
197 | IRQF_TRIGGER_RISING : IRQF_TRIGGER_FALLING; | ||
198 | |||
183 | INIT_WORK(&priv->work, eeti_ts_read); | 199 | INIT_WORK(&priv->work, eeti_ts_read); |
184 | i2c_set_clientdata(client, priv); | 200 | i2c_set_clientdata(client, priv); |
185 | input_set_drvdata(input, priv); | 201 | input_set_drvdata(input, priv); |
@@ -188,7 +204,7 @@ static int __devinit eeti_ts_probe(struct i2c_client *client, | |||
188 | if (err) | 204 | if (err) |
189 | goto err1; | 205 | goto err1; |
190 | 206 | ||
191 | err = request_irq(priv->irq, eeti_ts_isr, IRQF_TRIGGER_FALLING, | 207 | err = request_irq(priv->irq, eeti_ts_isr, irq_flags, |
192 | client->name, priv); | 208 | client->name, priv); |
193 | if (err) { | 209 | if (err) { |
194 | dev_err(&client->dev, "Unable to request touchscreen IRQ.\n"); | 210 | dev_err(&client->dev, "Unable to request touchscreen IRQ.\n"); |
diff --git a/drivers/input/touchscreen/h3600_ts_input.c b/drivers/input/touchscreen/h3600_ts_input.c index 4d3139e2099d..b4d7f63deff1 100644 --- a/drivers/input/touchscreen/h3600_ts_input.c +++ b/drivers/input/touchscreen/h3600_ts_input.c | |||
@@ -148,9 +148,10 @@ unsigned int h3600_flite_power(struct input_dev *dev, enum flite_pwr pwr) | |||
148 | struct h3600_dev *ts = input_get_drvdata(dev); | 148 | struct h3600_dev *ts = input_get_drvdata(dev); |
149 | 149 | ||
150 | /* Must be in this order */ | 150 | /* Must be in this order */ |
151 | ts->serio->write(ts->serio, 1); | 151 | serio_write(ts->serio, 1); |
152 | ts->serio->write(ts->serio, pwr); | 152 | serio_write(ts->serio, pwr); |
153 | ts->serio->write(ts->serio, brightness); | 153 | serio_write(ts->serio, brightness); |
154 | |||
154 | return 0; | 155 | return 0; |
155 | } | 156 | } |
156 | 157 | ||
@@ -262,7 +263,7 @@ static int h3600ts_event(struct input_dev *dev, unsigned int type, | |||
262 | 263 | ||
263 | switch (type) { | 264 | switch (type) { |
264 | case EV_LED: { | 265 | case EV_LED: { |
265 | // ts->serio->write(ts->serio, SOME_CMD); | 266 | // serio_write(ts->serio, SOME_CMD); |
266 | return 0; | 267 | return 0; |
267 | } | 268 | } |
268 | } | 269 | } |
diff --git a/drivers/input/touchscreen/mainstone-wm97xx.c b/drivers/input/touchscreen/mainstone-wm97xx.c index 4cc047a5116e..8fc3b08deb3b 100644 --- a/drivers/input/touchscreen/mainstone-wm97xx.c +++ b/drivers/input/touchscreen/mainstone-wm97xx.c | |||
@@ -31,9 +31,11 @@ | |||
31 | #include <linux/interrupt.h> | 31 | #include <linux/interrupt.h> |
32 | #include <linux/wm97xx.h> | 32 | #include <linux/wm97xx.h> |
33 | #include <linux/io.h> | 33 | #include <linux/io.h> |
34 | #include <linux/gpio.h> | ||
35 | |||
34 | #include <mach/regs-ac97.h> | 36 | #include <mach/regs-ac97.h> |
35 | 37 | ||
36 | #define VERSION "0.13" | 38 | #include <asm/mach-types.h> |
37 | 39 | ||
38 | struct continuous { | 40 | struct continuous { |
39 | u16 id; /* codec id */ | 41 | u16 id; /* codec id */ |
@@ -62,6 +64,7 @@ static const struct continuous cinfo[] = { | |||
62 | /* continuous speed index */ | 64 | /* continuous speed index */ |
63 | static int sp_idx; | 65 | static int sp_idx; |
64 | static u16 last, tries; | 66 | static u16 last, tries; |
67 | static int irq; | ||
65 | 68 | ||
66 | /* | 69 | /* |
67 | * Pen sampling frequency (Hz) in continuous mode. | 70 | * Pen sampling frequency (Hz) in continuous mode. |
@@ -171,7 +174,7 @@ up: | |||
171 | 174 | ||
172 | static int wm97xx_acc_startup(struct wm97xx *wm) | 175 | static int wm97xx_acc_startup(struct wm97xx *wm) |
173 | { | 176 | { |
174 | int idx = 0; | 177 | int idx = 0, ret = 0; |
175 | 178 | ||
176 | /* check we have a codec */ | 179 | /* check we have a codec */ |
177 | if (wm->ac97 == NULL) | 180 | if (wm->ac97 == NULL) |
@@ -191,18 +194,40 @@ static int wm97xx_acc_startup(struct wm97xx *wm) | |||
191 | "mainstone accelerated touchscreen driver, %d samples/sec\n", | 194 | "mainstone accelerated touchscreen driver, %d samples/sec\n", |
192 | cinfo[sp_idx].speed); | 195 | cinfo[sp_idx].speed); |
193 | 196 | ||
197 | /* IRQ driven touchscreen is used on Palm hardware */ | ||
198 | if (machine_is_palmt5() || machine_is_palmtx() || machine_is_palmld()) { | ||
199 | pen_int = 1; | ||
200 | irq = 27; | ||
201 | /* There is some obscure mutant of WM9712 interbred with WM9713 | ||
202 | * used on Palm HW */ | ||
203 | wm->variant = WM97xx_WM1613; | ||
204 | } else if (machine_is_mainstone() && pen_int) | ||
205 | irq = 4; | ||
206 | |||
207 | if (irq) { | ||
208 | ret = gpio_request(irq, "Touchscreen IRQ"); | ||
209 | if (ret) | ||
210 | goto out; | ||
211 | |||
212 | ret = gpio_direction_input(irq); | ||
213 | if (ret) { | ||
214 | gpio_free(irq); | ||
215 | goto out; | ||
216 | } | ||
217 | |||
218 | wm->pen_irq = gpio_to_irq(irq); | ||
219 | set_irq_type(wm->pen_irq, IRQ_TYPE_EDGE_BOTH); | ||
220 | } else /* pen irq not supported */ | ||
221 | pen_int = 0; | ||
222 | |||
194 | /* codec specific irq config */ | 223 | /* codec specific irq config */ |
195 | if (pen_int) { | 224 | if (pen_int) { |
196 | switch (wm->id) { | 225 | switch (wm->id) { |
197 | case WM9705_ID2: | 226 | case WM9705_ID2: |
198 | wm->pen_irq = IRQ_GPIO(4); | ||
199 | set_irq_type(IRQ_GPIO(4), IRQ_TYPE_EDGE_BOTH); | ||
200 | break; | 227 | break; |
201 | case WM9712_ID2: | 228 | case WM9712_ID2: |
202 | case WM9713_ID2: | 229 | case WM9713_ID2: |
203 | /* enable pen down interrupt */ | ||
204 | /* use PEN_DOWN GPIO 13 to assert IRQ on GPIO line 2 */ | 230 | /* use PEN_DOWN GPIO 13 to assert IRQ on GPIO line 2 */ |
205 | wm->pen_irq = MAINSTONE_AC97_IRQ; | ||
206 | wm97xx_config_gpio(wm, WM97XX_GPIO_13, WM97XX_GPIO_IN, | 231 | wm97xx_config_gpio(wm, WM97XX_GPIO_13, WM97XX_GPIO_IN, |
207 | WM97XX_GPIO_POL_HIGH, | 232 | WM97XX_GPIO_POL_HIGH, |
208 | WM97XX_GPIO_STICKY, | 233 | WM97XX_GPIO_STICKY, |
@@ -220,23 +245,17 @@ static int wm97xx_acc_startup(struct wm97xx *wm) | |||
220 | } | 245 | } |
221 | } | 246 | } |
222 | 247 | ||
223 | return 0; | 248 | out: |
249 | return ret; | ||
224 | } | 250 | } |
225 | 251 | ||
226 | static void wm97xx_acc_shutdown(struct wm97xx *wm) | 252 | static void wm97xx_acc_shutdown(struct wm97xx *wm) |
227 | { | 253 | { |
228 | /* codec specific deconfig */ | 254 | /* codec specific deconfig */ |
229 | if (pen_int) { | 255 | if (pen_int) { |
230 | switch (wm->id & 0xffff) { | 256 | if (irq) |
231 | case WM9705_ID2: | 257 | gpio_free(irq); |
232 | wm->pen_irq = 0; | 258 | wm->pen_irq = 0; |
233 | break; | ||
234 | case WM9712_ID2: | ||
235 | case WM9713_ID2: | ||
236 | /* disable interrupt */ | ||
237 | wm->pen_irq = 0; | ||
238 | break; | ||
239 | } | ||
240 | } | 259 | } |
241 | } | 260 | } |
242 | 261 | ||
diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c index 880f58c6a7c4..7ef0d1420d3c 100644 --- a/drivers/input/touchscreen/tsc2007.c +++ b/drivers/input/touchscreen/tsc2007.c | |||
@@ -21,15 +21,14 @@ | |||
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/hrtimer.h> | ||
25 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
26 | #include <linux/input.h> | 25 | #include <linux/input.h> |
27 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
28 | #include <linux/i2c.h> | 27 | #include <linux/i2c.h> |
29 | #include <linux/i2c/tsc2007.h> | 28 | #include <linux/i2c/tsc2007.h> |
30 | 29 | ||
31 | #define TS_POLL_DELAY (10 * 1000) /* ns delay before the first sample */ | 30 | #define TS_POLL_DELAY 1 /* ms delay between samples */ |
32 | #define TS_POLL_PERIOD (5 * 1000) /* ns delay between samples */ | 31 | #define TS_POLL_PERIOD 1 /* ms delay between samples */ |
33 | 32 | ||
34 | #define TSC2007_MEASURE_TEMP0 (0x0 << 4) | 33 | #define TSC2007_MEASURE_TEMP0 (0x0 << 4) |
35 | #define TSC2007_MEASURE_AUX (0x2 << 4) | 34 | #define TSC2007_MEASURE_AUX (0x2 << 4) |
@@ -70,17 +69,14 @@ struct ts_event { | |||
70 | struct tsc2007 { | 69 | struct tsc2007 { |
71 | struct input_dev *input; | 70 | struct input_dev *input; |
72 | char phys[32]; | 71 | char phys[32]; |
73 | struct hrtimer timer; | 72 | struct delayed_work work; |
74 | struct ts_event tc; | ||
75 | 73 | ||
76 | struct i2c_client *client; | 74 | struct i2c_client *client; |
77 | 75 | ||
78 | spinlock_t lock; | ||
79 | |||
80 | u16 model; | 76 | u16 model; |
81 | u16 x_plate_ohms; | 77 | u16 x_plate_ohms; |
82 | 78 | ||
83 | unsigned pendown; | 79 | bool pendown; |
84 | int irq; | 80 | int irq; |
85 | 81 | ||
86 | int (*get_pendown_state)(void); | 82 | int (*get_pendown_state)(void); |
@@ -109,52 +105,96 @@ static inline int tsc2007_xfer(struct tsc2007 *tsc, u8 cmd) | |||
109 | return val; | 105 | return val; |
110 | } | 106 | } |
111 | 107 | ||
112 | static void tsc2007_send_event(void *tsc) | 108 | static void tsc2007_read_values(struct tsc2007 *tsc, struct ts_event *tc) |
113 | { | 109 | { |
114 | struct tsc2007 *ts = tsc; | 110 | /* y- still on; turn on only y+ (and ADC) */ |
115 | u32 rt; | 111 | tc->y = tsc2007_xfer(tsc, READ_Y); |
116 | u16 x, y, z1, z2; | 112 | |
113 | /* turn y- off, x+ on, then leave in lowpower */ | ||
114 | tc->x = tsc2007_xfer(tsc, READ_X); | ||
115 | |||
116 | /* turn y+ off, x- on; we'll use formula #1 */ | ||
117 | tc->z1 = tsc2007_xfer(tsc, READ_Z1); | ||
118 | tc->z2 = tsc2007_xfer(tsc, READ_Z2); | ||
117 | 119 | ||
118 | x = ts->tc.x; | 120 | /* Prepare for next touch reading - power down ADC, enable PENIRQ */ |
119 | y = ts->tc.y; | 121 | tsc2007_xfer(tsc, PWRDOWN); |
120 | z1 = ts->tc.z1; | 122 | } |
121 | z2 = ts->tc.z2; | 123 | |
124 | static u32 tsc2007_calculate_pressure(struct tsc2007 *tsc, struct ts_event *tc) | ||
125 | { | ||
126 | u32 rt = 0; | ||
122 | 127 | ||
123 | /* range filtering */ | 128 | /* range filtering */ |
124 | if (x == MAX_12BIT) | 129 | if (tc->x == MAX_12BIT) |
125 | x = 0; | 130 | tc->x = 0; |
126 | 131 | ||
127 | if (likely(x && z1)) { | 132 | if (likely(tc->x && tc->z1)) { |
128 | /* compute touch pressure resistance using equation #1 */ | 133 | /* compute touch pressure resistance using equation #1 */ |
129 | rt = z2; | 134 | rt = tc->z2 - tc->z1; |
130 | rt -= z1; | 135 | rt *= tc->x; |
131 | rt *= x; | 136 | rt *= tsc->x_plate_ohms; |
132 | rt *= ts->x_plate_ohms; | 137 | rt /= tc->z1; |
133 | rt /= z1; | ||
134 | rt = (rt + 2047) >> 12; | 138 | rt = (rt + 2047) >> 12; |
135 | } else | 139 | } |
136 | rt = 0; | 140 | |
141 | return rt; | ||
142 | } | ||
143 | |||
144 | static void tsc2007_send_up_event(struct tsc2007 *tsc) | ||
145 | { | ||
146 | struct input_dev *input = tsc->input; | ||
137 | 147 | ||
138 | /* Sample found inconsistent by debouncing or pressure is beyond | 148 | dev_dbg(&tsc->client->dev, "UP\n"); |
139 | * the maximum. Don't report it to user space, repeat at least | 149 | |
140 | * once more the measurement | 150 | input_report_key(input, BTN_TOUCH, 0); |
151 | input_report_abs(input, ABS_PRESSURE, 0); | ||
152 | input_sync(input); | ||
153 | } | ||
154 | |||
155 | static void tsc2007_work(struct work_struct *work) | ||
156 | { | ||
157 | struct tsc2007 *ts = | ||
158 | container_of(to_delayed_work(work), struct tsc2007, work); | ||
159 | struct ts_event tc; | ||
160 | u32 rt; | ||
161 | |||
162 | /* | ||
163 | * NOTE: We can't rely on the pressure to determine the pen down | ||
164 | * state, even though this controller has a pressure sensor. | ||
165 | * The pressure value can fluctuate for quite a while after | ||
166 | * lifting the pen and in some cases may not even settle at the | ||
167 | * expected value. | ||
168 | * | ||
169 | * The only safe way to check for the pen up condition is in the | ||
170 | * work function by reading the pen signal state (it's a GPIO | ||
171 | * and IRQ). Unfortunately such callback is not always available, | ||
172 | * in that case we have rely on the pressure anyway. | ||
141 | */ | 173 | */ |
174 | if (ts->get_pendown_state) { | ||
175 | if (unlikely(!ts->get_pendown_state())) { | ||
176 | tsc2007_send_up_event(ts); | ||
177 | ts->pendown = false; | ||
178 | goto out; | ||
179 | } | ||
180 | |||
181 | dev_dbg(&ts->client->dev, "pen is still down\n"); | ||
182 | } | ||
183 | |||
184 | tsc2007_read_values(ts, &tc); | ||
185 | |||
186 | rt = tsc2007_calculate_pressure(ts, &tc); | ||
142 | if (rt > MAX_12BIT) { | 187 | if (rt > MAX_12BIT) { |
188 | /* | ||
189 | * Sample found inconsistent by debouncing or pressure is | ||
190 | * beyond the maximum. Don't report it to user space, | ||
191 | * repeat at least once more the measurement. | ||
192 | */ | ||
143 | dev_dbg(&ts->client->dev, "ignored pressure %d\n", rt); | 193 | dev_dbg(&ts->client->dev, "ignored pressure %d\n", rt); |
194 | goto out; | ||
144 | 195 | ||
145 | hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_PERIOD), | ||
146 | HRTIMER_MODE_REL); | ||
147 | return; | ||
148 | } | 196 | } |
149 | 197 | ||
150 | /* NOTE: We can't rely on the pressure to determine the pen down | ||
151 | * state, even this controller has a pressure sensor. The pressure | ||
152 | * value can fluctuate for quite a while after lifting the pen and | ||
153 | * in some cases may not even settle at the expected value. | ||
154 | * | ||
155 | * The only safe way to check for the pen up condition is in the | ||
156 | * timer by reading the pen signal state (it's a GPIO _and_ IRQ). | ||
157 | */ | ||
158 | if (rt) { | 198 | if (rt) { |
159 | struct input_dev *input = ts->input; | 199 | struct input_dev *input = ts->input; |
160 | 200 | ||
@@ -162,102 +202,74 @@ static void tsc2007_send_event(void *tsc) | |||
162 | dev_dbg(&ts->client->dev, "DOWN\n"); | 202 | dev_dbg(&ts->client->dev, "DOWN\n"); |
163 | 203 | ||
164 | input_report_key(input, BTN_TOUCH, 1); | 204 | input_report_key(input, BTN_TOUCH, 1); |
165 | ts->pendown = 1; | 205 | ts->pendown = true; |
166 | } | 206 | } |
167 | 207 | ||
168 | input_report_abs(input, ABS_X, x); | 208 | input_report_abs(input, ABS_X, tc.x); |
169 | input_report_abs(input, ABS_Y, y); | 209 | input_report_abs(input, ABS_Y, tc.y); |
170 | input_report_abs(input, ABS_PRESSURE, rt); | 210 | input_report_abs(input, ABS_PRESSURE, rt); |
171 | 211 | ||
172 | input_sync(input); | 212 | input_sync(input); |
173 | 213 | ||
174 | dev_dbg(&ts->client->dev, "point(%4d,%4d), pressure (%4u)\n", | 214 | dev_dbg(&ts->client->dev, "point(%4d,%4d), pressure (%4u)\n", |
175 | x, y, rt); | 215 | tc.x, tc.y, rt); |
216 | |||
217 | } else if (!ts->get_pendown_state && ts->pendown) { | ||
218 | /* | ||
219 | * We don't have callback to check pendown state, so we | ||
220 | * have to assume that since pressure reported is 0 the | ||
221 | * pen was lifted up. | ||
222 | */ | ||
223 | tsc2007_send_up_event(ts); | ||
224 | ts->pendown = false; | ||
176 | } | 225 | } |
177 | 226 | ||
178 | hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_PERIOD), | 227 | out: |
179 | HRTIMER_MODE_REL); | 228 | if (ts->pendown) |
180 | } | 229 | schedule_delayed_work(&ts->work, |
181 | 230 | msecs_to_jiffies(TS_POLL_PERIOD)); | |
182 | static int tsc2007_read_values(struct tsc2007 *tsc) | 231 | else |
183 | { | ||
184 | /* y- still on; turn on only y+ (and ADC) */ | ||
185 | tsc->tc.y = tsc2007_xfer(tsc, READ_Y); | ||
186 | |||
187 | /* turn y- off, x+ on, then leave in lowpower */ | ||
188 | tsc->tc.x = tsc2007_xfer(tsc, READ_X); | ||
189 | |||
190 | /* turn y+ off, x- on; we'll use formula #1 */ | ||
191 | tsc->tc.z1 = tsc2007_xfer(tsc, READ_Z1); | ||
192 | tsc->tc.z2 = tsc2007_xfer(tsc, READ_Z2); | ||
193 | |||
194 | /* power down */ | ||
195 | tsc2007_xfer(tsc, PWRDOWN); | ||
196 | |||
197 | return 0; | ||
198 | } | ||
199 | |||
200 | static enum hrtimer_restart tsc2007_timer(struct hrtimer *handle) | ||
201 | { | ||
202 | struct tsc2007 *ts = container_of(handle, struct tsc2007, timer); | ||
203 | unsigned long flags; | ||
204 | |||
205 | spin_lock_irqsave(&ts->lock, flags); | ||
206 | |||
207 | if (unlikely(!ts->get_pendown_state() && ts->pendown)) { | ||
208 | struct input_dev *input = ts->input; | ||
209 | |||
210 | dev_dbg(&ts->client->dev, "UP\n"); | ||
211 | |||
212 | input_report_key(input, BTN_TOUCH, 0); | ||
213 | input_report_abs(input, ABS_PRESSURE, 0); | ||
214 | input_sync(input); | ||
215 | |||
216 | ts->pendown = 0; | ||
217 | enable_irq(ts->irq); | 232 | enable_irq(ts->irq); |
218 | } else { | ||
219 | /* pen is still down, continue with the measurement */ | ||
220 | dev_dbg(&ts->client->dev, "pen is still down\n"); | ||
221 | |||
222 | tsc2007_read_values(ts); | ||
223 | tsc2007_send_event(ts); | ||
224 | } | ||
225 | |||
226 | spin_unlock_irqrestore(&ts->lock, flags); | ||
227 | |||
228 | return HRTIMER_NORESTART; | ||
229 | } | 233 | } |
230 | 234 | ||
231 | static irqreturn_t tsc2007_irq(int irq, void *handle) | 235 | static irqreturn_t tsc2007_irq(int irq, void *handle) |
232 | { | 236 | { |
233 | struct tsc2007 *ts = handle; | 237 | struct tsc2007 *ts = handle; |
234 | unsigned long flags; | ||
235 | |||
236 | spin_lock_irqsave(&ts->lock, flags); | ||
237 | 238 | ||
238 | if (likely(ts->get_pendown_state())) { | 239 | if (!ts->get_pendown_state || likely(ts->get_pendown_state())) { |
239 | disable_irq_nosync(ts->irq); | 240 | disable_irq_nosync(ts->irq); |
240 | hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_DELAY), | 241 | schedule_delayed_work(&ts->work, |
241 | HRTIMER_MODE_REL); | 242 | msecs_to_jiffies(TS_POLL_DELAY)); |
242 | } | 243 | } |
243 | 244 | ||
244 | if (ts->clear_penirq) | 245 | if (ts->clear_penirq) |
245 | ts->clear_penirq(); | 246 | ts->clear_penirq(); |
246 | 247 | ||
247 | spin_unlock_irqrestore(&ts->lock, flags); | ||
248 | |||
249 | return IRQ_HANDLED; | 248 | return IRQ_HANDLED; |
250 | } | 249 | } |
251 | 250 | ||
252 | static int tsc2007_probe(struct i2c_client *client, | 251 | static void tsc2007_free_irq(struct tsc2007 *ts) |
253 | const struct i2c_device_id *id) | 252 | { |
253 | free_irq(ts->irq, ts); | ||
254 | if (cancel_delayed_work_sync(&ts->work)) { | ||
255 | /* | ||
256 | * Work was pending, therefore we need to enable | ||
257 | * IRQ here to balance the disable_irq() done in the | ||
258 | * interrupt handler. | ||
259 | */ | ||
260 | enable_irq(ts->irq); | ||
261 | } | ||
262 | } | ||
263 | |||
264 | static int __devinit tsc2007_probe(struct i2c_client *client, | ||
265 | const struct i2c_device_id *id) | ||
254 | { | 266 | { |
255 | struct tsc2007 *ts; | 267 | struct tsc2007 *ts; |
256 | struct tsc2007_platform_data *pdata = pdata = client->dev.platform_data; | 268 | struct tsc2007_platform_data *pdata = pdata = client->dev.platform_data; |
257 | struct input_dev *input_dev; | 269 | struct input_dev *input_dev; |
258 | int err; | 270 | int err; |
259 | 271 | ||
260 | if (!pdata || !pdata->get_pendown_state) { | 272 | if (!pdata) { |
261 | dev_err(&client->dev, "platform data is required!\n"); | 273 | dev_err(&client->dev, "platform data is required!\n"); |
262 | return -EINVAL; | 274 | return -EINVAL; |
263 | } | 275 | } |
@@ -274,22 +286,15 @@ static int tsc2007_probe(struct i2c_client *client, | |||
274 | } | 286 | } |
275 | 287 | ||
276 | ts->client = client; | 288 | ts->client = client; |
277 | i2c_set_clientdata(client, ts); | 289 | ts->irq = client->irq; |
278 | |||
279 | ts->input = input_dev; | 290 | ts->input = input_dev; |
280 | 291 | INIT_DELAYED_WORK(&ts->work, tsc2007_work); | |
281 | hrtimer_init(&ts->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | ||
282 | ts->timer.function = tsc2007_timer; | ||
283 | |||
284 | spin_lock_init(&ts->lock); | ||
285 | 292 | ||
286 | ts->model = pdata->model; | 293 | ts->model = pdata->model; |
287 | ts->x_plate_ohms = pdata->x_plate_ohms; | 294 | ts->x_plate_ohms = pdata->x_plate_ohms; |
288 | ts->get_pendown_state = pdata->get_pendown_state; | 295 | ts->get_pendown_state = pdata->get_pendown_state; |
289 | ts->clear_penirq = pdata->clear_penirq; | 296 | ts->clear_penirq = pdata->clear_penirq; |
290 | 297 | ||
291 | pdata->init_platform_hw(); | ||
292 | |||
293 | snprintf(ts->phys, sizeof(ts->phys), | 298 | snprintf(ts->phys, sizeof(ts->phys), |
294 | "%s/input0", dev_name(&client->dev)); | 299 | "%s/input0", dev_name(&client->dev)); |
295 | 300 | ||
@@ -304,9 +309,8 @@ static int tsc2007_probe(struct i2c_client *client, | |||
304 | input_set_abs_params(input_dev, ABS_Y, 0, MAX_12BIT, 0, 0); | 309 | input_set_abs_params(input_dev, ABS_Y, 0, MAX_12BIT, 0, 0); |
305 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, MAX_12BIT, 0, 0); | 310 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, MAX_12BIT, 0, 0); |
306 | 311 | ||
307 | tsc2007_read_values(ts); | 312 | if (pdata->init_platform_hw) |
308 | 313 | pdata->init_platform_hw(); | |
309 | ts->irq = client->irq; | ||
310 | 314 | ||
311 | err = request_irq(ts->irq, tsc2007_irq, 0, | 315 | err = request_irq(ts->irq, tsc2007_irq, 0, |
312 | client->dev.driver->name, ts); | 316 | client->dev.driver->name, ts); |
@@ -315,33 +319,39 @@ static int tsc2007_probe(struct i2c_client *client, | |||
315 | goto err_free_mem; | 319 | goto err_free_mem; |
316 | } | 320 | } |
317 | 321 | ||
322 | /* Prepare for touch readings - power down ADC and enable PENIRQ */ | ||
323 | err = tsc2007_xfer(ts, PWRDOWN); | ||
324 | if (err < 0) | ||
325 | goto err_free_irq; | ||
326 | |||
318 | err = input_register_device(input_dev); | 327 | err = input_register_device(input_dev); |
319 | if (err) | 328 | if (err) |
320 | goto err_free_irq; | 329 | goto err_free_irq; |
321 | 330 | ||
322 | dev_info(&client->dev, "registered with irq (%d)\n", ts->irq); | 331 | i2c_set_clientdata(client, ts); |
323 | 332 | ||
324 | return 0; | 333 | return 0; |
325 | 334 | ||
326 | err_free_irq: | 335 | err_free_irq: |
327 | free_irq(ts->irq, ts); | 336 | tsc2007_free_irq(ts); |
328 | hrtimer_cancel(&ts->timer); | 337 | if (pdata->exit_platform_hw) |
338 | pdata->exit_platform_hw(); | ||
329 | err_free_mem: | 339 | err_free_mem: |
330 | input_free_device(input_dev); | 340 | input_free_device(input_dev); |
331 | kfree(ts); | 341 | kfree(ts); |
332 | return err; | 342 | return err; |
333 | } | 343 | } |
334 | 344 | ||
335 | static int tsc2007_remove(struct i2c_client *client) | 345 | static int __devexit tsc2007_remove(struct i2c_client *client) |
336 | { | 346 | { |
337 | struct tsc2007 *ts = i2c_get_clientdata(client); | 347 | struct tsc2007 *ts = i2c_get_clientdata(client); |
338 | struct tsc2007_platform_data *pdata; | 348 | struct tsc2007_platform_data *pdata = client->dev.platform_data; |
339 | 349 | ||
340 | pdata = client->dev.platform_data; | 350 | tsc2007_free_irq(ts); |
341 | pdata->exit_platform_hw(); | 351 | |
352 | if (pdata->exit_platform_hw) | ||
353 | pdata->exit_platform_hw(); | ||
342 | 354 | ||
343 | free_irq(ts->irq, ts); | ||
344 | hrtimer_cancel(&ts->timer); | ||
345 | input_unregister_device(ts->input); | 355 | input_unregister_device(ts->input); |
346 | kfree(ts); | 356 | kfree(ts); |
347 | 357 | ||
@@ -362,7 +372,7 @@ static struct i2c_driver tsc2007_driver = { | |||
362 | }, | 372 | }, |
363 | .id_table = tsc2007_idtable, | 373 | .id_table = tsc2007_idtable, |
364 | .probe = tsc2007_probe, | 374 | .probe = tsc2007_probe, |
365 | .remove = tsc2007_remove, | 375 | .remove = __devexit_p(tsc2007_remove), |
366 | }; | 376 | }; |
367 | 377 | ||
368 | static int __init tsc2007_init(void) | 378 | static int __init tsc2007_init(void) |
diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c index 3a7a58222f83..095f84b1f56e 100644 --- a/drivers/input/touchscreen/ucb1400_ts.c +++ b/drivers/input/touchscreen/ucb1400_ts.c | |||
@@ -128,9 +128,10 @@ static inline unsigned int ucb1400_ts_read_yres(struct ucb1400_ts *ucb) | |||
128 | return ucb1400_adc_read(ucb->ac97, 0, adcsync); | 128 | return ucb1400_adc_read(ucb->ac97, 0, adcsync); |
129 | } | 129 | } |
130 | 130 | ||
131 | static inline int ucb1400_ts_pen_down(struct snd_ac97 *ac97) | 131 | static inline int ucb1400_ts_pen_up(struct snd_ac97 *ac97) |
132 | { | 132 | { |
133 | unsigned short val = ucb1400_reg_read(ac97, UCB_TS_CR); | 133 | unsigned short val = ucb1400_reg_read(ac97, UCB_TS_CR); |
134 | |||
134 | return val & (UCB_TS_CR_TSPX_LOW | UCB_TS_CR_TSMX_LOW); | 135 | return val & (UCB_TS_CR_TSPX_LOW | UCB_TS_CR_TSMX_LOW); |
135 | } | 136 | } |
136 | 137 | ||
@@ -209,7 +210,7 @@ static int ucb1400_ts_thread(void *_ucb) | |||
209 | 210 | ||
210 | msleep(10); | 211 | msleep(10); |
211 | 212 | ||
212 | if (ucb1400_ts_pen_down(ucb->ac97)) { | 213 | if (ucb1400_ts_pen_up(ucb->ac97)) { |
213 | ucb1400_ts_irq_enable(ucb->ac97); | 214 | ucb1400_ts_irq_enable(ucb->ac97); |
214 | 215 | ||
215 | /* | 216 | /* |
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index fb7cb9bdfbd5..68ece5801a58 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c | |||
@@ -13,6 +13,7 @@ | |||
13 | * - IdealTEK URTC1000 | 13 | * - IdealTEK URTC1000 |
14 | * - General Touch | 14 | * - General Touch |
15 | * - GoTop Super_Q2/GogoPen/PenPower tablets | 15 | * - GoTop Super_Q2/GogoPen/PenPower tablets |
16 | * - JASTEC USB touch controller/DigiTech DTR-02U | ||
16 | * | 17 | * |
17 | * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch> | 18 | * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch> |
18 | * Copyright (C) by Todd E. Johnson (mtouchusb.c) | 19 | * Copyright (C) by Todd E. Johnson (mtouchusb.c) |
@@ -118,6 +119,8 @@ enum { | |||
118 | DEVTYPE_IDEALTEK, | 119 | DEVTYPE_IDEALTEK, |
119 | DEVTYPE_GENERAL_TOUCH, | 120 | DEVTYPE_GENERAL_TOUCH, |
120 | DEVTYPE_GOTOP, | 121 | DEVTYPE_GOTOP, |
122 | DEVTYPE_JASTEC, | ||
123 | DEVTYPE_E2I, | ||
121 | }; | 124 | }; |
122 | 125 | ||
123 | #define USB_DEVICE_HID_CLASS(vend, prod) \ | 126 | #define USB_DEVICE_HID_CLASS(vend, prod) \ |
@@ -191,11 +194,51 @@ static struct usb_device_id usbtouch_devices[] = { | |||
191 | {USB_DEVICE(0x08f2, 0x00f4), .driver_info = DEVTYPE_GOTOP}, | 194 | {USB_DEVICE(0x08f2, 0x00f4), .driver_info = DEVTYPE_GOTOP}, |
192 | #endif | 195 | #endif |
193 | 196 | ||
197 | #ifdef CONFIG_TOUCHSCREEN_USB_JASTEC | ||
198 | {USB_DEVICE(0x0f92, 0x0001), .driver_info = DEVTYPE_JASTEC}, | ||
199 | #endif | ||
200 | |||
201 | #ifdef CONFIG_TOUCHSCREEN_USB_E2I | ||
202 | {USB_DEVICE(0x1ac7, 0x0001), .driver_info = DEVTYPE_E2I}, | ||
203 | #endif | ||
194 | {} | 204 | {} |
195 | }; | 205 | }; |
196 | 206 | ||
197 | 207 | ||
198 | /***************************************************************************** | 208 | /***************************************************************************** |
209 | * e2i Part | ||
210 | */ | ||
211 | |||
212 | #ifdef CONFIG_TOUCHSCREEN_USB_E2I | ||
213 | static int e2i_init(struct usbtouch_usb *usbtouch) | ||
214 | { | ||
215 | int ret; | ||
216 | |||
217 | ret = usb_control_msg(usbtouch->udev, usb_rcvctrlpipe(usbtouch->udev, 0), | ||
218 | 0x01, 0x02, 0x0000, 0x0081, | ||
219 | NULL, 0, USB_CTRL_SET_TIMEOUT); | ||
220 | |||
221 | dbg("%s - usb_control_msg - E2I_RESET - bytes|err: %d", | ||
222 | __func__, ret); | ||
223 | return ret; | ||
224 | } | ||
225 | |||
226 | static int e2i_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | ||
227 | { | ||
228 | int tmp = (pkt[0] << 8) | pkt[1]; | ||
229 | dev->x = (pkt[2] << 8) | pkt[3]; | ||
230 | dev->y = (pkt[4] << 8) | pkt[5]; | ||
231 | |||
232 | tmp = tmp - 0xA000; | ||
233 | dev->touch = (tmp > 0); | ||
234 | dev->press = (tmp > 0 ? tmp : 0); | ||
235 | |||
236 | return 1; | ||
237 | } | ||
238 | #endif | ||
239 | |||
240 | |||
241 | /***************************************************************************** | ||
199 | * eGalax part | 242 | * eGalax part |
200 | */ | 243 | */ |
201 | 244 | ||
@@ -559,6 +602,21 @@ static int gotop_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | |||
559 | dev->x = ((pkt[1] & 0x38) << 4) | pkt[2]; | 602 | dev->x = ((pkt[1] & 0x38) << 4) | pkt[2]; |
560 | dev->y = ((pkt[1] & 0x07) << 7) | pkt[3]; | 603 | dev->y = ((pkt[1] & 0x07) << 7) | pkt[3]; |
561 | dev->touch = pkt[0] & 0x01; | 604 | dev->touch = pkt[0] & 0x01; |
605 | |||
606 | return 1; | ||
607 | } | ||
608 | #endif | ||
609 | |||
610 | /***************************************************************************** | ||
611 | * JASTEC Part | ||
612 | */ | ||
613 | #ifdef CONFIG_TOUCHSCREEN_USB_JASTEC | ||
614 | static int jastec_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | ||
615 | { | ||
616 | dev->x = ((pkt[0] & 0x3f) << 6) | (pkt[2] & 0x3f); | ||
617 | dev->y = ((pkt[1] & 0x3f) << 6) | (pkt[3] & 0x3f); | ||
618 | dev->touch = (pkt[0] & 0x40) >> 6; | ||
619 | |||
562 | return 1; | 620 | return 1; |
563 | } | 621 | } |
564 | #endif | 622 | #endif |
@@ -702,6 +760,29 @@ static struct usbtouch_device_info usbtouch_dev_info[] = { | |||
702 | .read_data = gotop_read_data, | 760 | .read_data = gotop_read_data, |
703 | }, | 761 | }, |
704 | #endif | 762 | #endif |
763 | |||
764 | #ifdef CONFIG_TOUCHSCREEN_USB_JASTEC | ||
765 | [DEVTYPE_JASTEC] = { | ||
766 | .min_xc = 0x0, | ||
767 | .max_xc = 0x0fff, | ||
768 | .min_yc = 0x0, | ||
769 | .max_yc = 0x0fff, | ||
770 | .rept_size = 4, | ||
771 | .read_data = jastec_read_data, | ||
772 | }, | ||
773 | #endif | ||
774 | |||
775 | #ifdef CONFIG_TOUCHSCREEN_USB_E2I | ||
776 | [DEVTYPE_E2I] = { | ||
777 | .min_xc = 0x0, | ||
778 | .max_xc = 0x7fff, | ||
779 | .min_yc = 0x0, | ||
780 | .max_yc = 0x7fff, | ||
781 | .rept_size = 6, | ||
782 | .init = e2i_init, | ||
783 | .read_data = e2i_read_data, | ||
784 | }, | ||
785 | #endif | ||
705 | }; | 786 | }; |
706 | 787 | ||
707 | 788 | ||
diff --git a/drivers/input/touchscreen/w90p910_ts.c b/drivers/input/touchscreen/w90p910_ts.c index 6071f5882572..6ccbdbbf33fe 100644 --- a/drivers/input/touchscreen/w90p910_ts.c +++ b/drivers/input/touchscreen/w90p910_ts.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | #include <linux/io.h> | 15 | #include <linux/io.h> |
16 | #include <linux/clk.h> | ||
16 | #include <linux/input.h> | 17 | #include <linux/input.h> |
17 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
18 | 19 | ||
@@ -47,8 +48,8 @@ enum ts_state { | |||
47 | struct w90p910_ts { | 48 | struct w90p910_ts { |
48 | struct input_dev *input; | 49 | struct input_dev *input; |
49 | struct timer_list timer; | 50 | struct timer_list timer; |
51 | struct clk *clk; | ||
50 | int irq_num; | 52 | int irq_num; |
51 | void __iomem *clocken; | ||
52 | void __iomem *ts_reg; | 53 | void __iomem *ts_reg; |
53 | spinlock_t lock; | 54 | spinlock_t lock; |
54 | enum ts_state state; | 55 | enum ts_state state; |
@@ -166,8 +167,7 @@ static int w90p910_open(struct input_dev *dev) | |||
166 | unsigned long val; | 167 | unsigned long val; |
167 | 168 | ||
168 | /* enable the ADC clock */ | 169 | /* enable the ADC clock */ |
169 | val = __raw_readl(w90p910_ts->clocken); | 170 | clk_enable(w90p910_ts->clk); |
170 | __raw_writel(val | ADC_CLK_EN, w90p910_ts->clocken); | ||
171 | 171 | ||
172 | __raw_writel(ADC_RST1, w90p910_ts->ts_reg); | 172 | __raw_writel(ADC_RST1, w90p910_ts->ts_reg); |
173 | msleep(1); | 173 | msleep(1); |
@@ -211,8 +211,7 @@ static void w90p910_close(struct input_dev *dev) | |||
211 | del_timer_sync(&w90p910_ts->timer); | 211 | del_timer_sync(&w90p910_ts->timer); |
212 | 212 | ||
213 | /* stop the ADC clock */ | 213 | /* stop the ADC clock */ |
214 | val = __raw_readl(w90p910_ts->clocken); | 214 | clk_disable(w90p910_ts->clk); |
215 | __raw_writel(val & ~ADC_CLK_EN, w90p910_ts->clocken); | ||
216 | } | 215 | } |
217 | 216 | ||
218 | static int __devinit w90x900ts_probe(struct platform_device *pdev) | 217 | static int __devinit w90x900ts_probe(struct platform_device *pdev) |
@@ -241,26 +240,24 @@ static int __devinit w90x900ts_probe(struct platform_device *pdev) | |||
241 | goto fail1; | 240 | goto fail1; |
242 | } | 241 | } |
243 | 242 | ||
244 | if (!request_mem_region(res->start, res->end - res->start + 1, | 243 | if (!request_mem_region(res->start, resource_size(res), |
245 | pdev->name)) { | 244 | pdev->name)) { |
246 | err = -EBUSY; | 245 | err = -EBUSY; |
247 | goto fail1; | 246 | goto fail1; |
248 | } | 247 | } |
249 | 248 | ||
250 | w90p910_ts->ts_reg = ioremap(res->start, res->end - res->start + 1); | 249 | w90p910_ts->ts_reg = ioremap(res->start, resource_size(res)); |
251 | if (!w90p910_ts->ts_reg) { | 250 | if (!w90p910_ts->ts_reg) { |
252 | err = -ENOMEM; | 251 | err = -ENOMEM; |
253 | goto fail2; | 252 | goto fail2; |
254 | } | 253 | } |
255 | 254 | ||
256 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 255 | w90p910_ts->clk = clk_get(&pdev->dev, NULL); |
257 | if (!res) { | 256 | if (IS_ERR(w90p910_ts->clk)) { |
258 | err = -ENXIO; | 257 | err = PTR_ERR(w90p910_ts->clk); |
259 | goto fail3; | 258 | goto fail3; |
260 | } | 259 | } |
261 | 260 | ||
262 | w90p910_ts->clocken = (void __iomem *)res->start; | ||
263 | |||
264 | input_dev->name = "W90P910 TouchScreen"; | 261 | input_dev->name = "W90P910 TouchScreen"; |
265 | input_dev->phys = "w90p910ts/event0"; | 262 | input_dev->phys = "w90p910ts/event0"; |
266 | input_dev->id.bustype = BUS_HOST; | 263 | input_dev->id.bustype = BUS_HOST; |
@@ -283,20 +280,21 @@ static int __devinit w90x900ts_probe(struct platform_device *pdev) | |||
283 | if (request_irq(w90p910_ts->irq_num, w90p910_ts_interrupt, | 280 | if (request_irq(w90p910_ts->irq_num, w90p910_ts_interrupt, |
284 | IRQF_DISABLED, "w90p910ts", w90p910_ts)) { | 281 | IRQF_DISABLED, "w90p910ts", w90p910_ts)) { |
285 | err = -EBUSY; | 282 | err = -EBUSY; |
286 | goto fail3; | 283 | goto fail4; |
287 | } | 284 | } |
288 | 285 | ||
289 | err = input_register_device(w90p910_ts->input); | 286 | err = input_register_device(w90p910_ts->input); |
290 | if (err) | 287 | if (err) |
291 | goto fail4; | 288 | goto fail5; |
292 | 289 | ||
293 | platform_set_drvdata(pdev, w90p910_ts); | 290 | platform_set_drvdata(pdev, w90p910_ts); |
294 | 291 | ||
295 | return 0; | 292 | return 0; |
296 | 293 | ||
297 | fail4: free_irq(w90p910_ts->irq_num, w90p910_ts); | 294 | fail5: free_irq(w90p910_ts->irq_num, w90p910_ts); |
295 | fail4: clk_put(w90p910_ts->clk); | ||
298 | fail3: iounmap(w90p910_ts->ts_reg); | 296 | fail3: iounmap(w90p910_ts->ts_reg); |
299 | fail2: release_mem_region(res->start, res->end - res->start + 1); | 297 | fail2: release_mem_region(res->start, resource_size(res)); |
300 | fail1: input_free_device(input_dev); | 298 | fail1: input_free_device(input_dev); |
301 | kfree(w90p910_ts); | 299 | kfree(w90p910_ts); |
302 | return err; | 300 | return err; |
@@ -311,8 +309,10 @@ static int __devexit w90x900ts_remove(struct platform_device *pdev) | |||
311 | del_timer_sync(&w90p910_ts->timer); | 309 | del_timer_sync(&w90p910_ts->timer); |
312 | iounmap(w90p910_ts->ts_reg); | 310 | iounmap(w90p910_ts->ts_reg); |
313 | 311 | ||
312 | clk_put(w90p910_ts->clk); | ||
313 | |||
314 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 314 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
315 | release_mem_region(res->start, res->end - res->start + 1); | 315 | release_mem_region(res->start, resource_size(res)); |
316 | 316 | ||
317 | input_unregister_device(w90p910_ts->input); | 317 | input_unregister_device(w90p910_ts->input); |
318 | kfree(w90p910_ts); | 318 | kfree(w90p910_ts); |
@@ -326,7 +326,7 @@ static struct platform_driver w90x900ts_driver = { | |||
326 | .probe = w90x900ts_probe, | 326 | .probe = w90x900ts_probe, |
327 | .remove = __devexit_p(w90x900ts_remove), | 327 | .remove = __devexit_p(w90x900ts_remove), |
328 | .driver = { | 328 | .driver = { |
329 | .name = "w90x900-ts", | 329 | .name = "nuc900-ts", |
330 | .owner = THIS_MODULE, | 330 | .owner = THIS_MODULE, |
331 | }, | 331 | }, |
332 | }; | 332 | }; |
@@ -347,4 +347,4 @@ module_exit(w90x900ts_exit); | |||
347 | MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>"); | 347 | MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>"); |
348 | MODULE_DESCRIPTION("w90p910 touch screen driver!"); | 348 | MODULE_DESCRIPTION("w90p910 touch screen driver!"); |
349 | MODULE_LICENSE("GPL"); | 349 | MODULE_LICENSE("GPL"); |
350 | MODULE_ALIAS("platform:w90p910-ts"); | 350 | MODULE_ALIAS("platform:nuc900-ts"); |
diff --git a/drivers/input/touchscreen/wacom_w8001.c b/drivers/input/touchscreen/wacom_w8001.c index 2f33a0167644..56dc35c94bb1 100644 --- a/drivers/input/touchscreen/wacom_w8001.c +++ b/drivers/input/touchscreen/wacom_w8001.c | |||
@@ -25,18 +25,16 @@ MODULE_AUTHOR("Jaya Kumar <jayakumar.lkml@gmail.com>"); | |||
25 | MODULE_DESCRIPTION(DRIVER_DESC); | 25 | MODULE_DESCRIPTION(DRIVER_DESC); |
26 | MODULE_LICENSE("GPL"); | 26 | MODULE_LICENSE("GPL"); |
27 | 27 | ||
28 | /* | ||
29 | * Definitions & global arrays. | ||
30 | */ | ||
31 | |||
32 | #define W8001_MAX_LENGTH 11 | 28 | #define W8001_MAX_LENGTH 11 |
33 | #define W8001_PACKET_LEN 11 | 29 | #define W8001_LEAD_MASK 0x80 |
34 | #define W8001_LEAD_MASK 0x80 | 30 | #define W8001_LEAD_BYTE 0x80 |
35 | #define W8001_LEAD_BYTE 0x80 | 31 | #define W8001_TAB_MASK 0x40 |
36 | #define W8001_TAB_MASK 0x40 | 32 | #define W8001_TAB_BYTE 0x40 |
37 | #define W8001_TAB_BYTE 0x40 | ||
38 | 33 | ||
39 | #define W8001_QUERY_PACKET 0x20 | 34 | #define W8001_QUERY_PACKET 0x20 |
35 | |||
36 | #define W8001_CMD_START '1' | ||
37 | #define W8001_CMD_QUERY '*' | ||
40 | 38 | ||
41 | struct w8001_coord { | 39 | struct w8001_coord { |
42 | u8 rdy; | 40 | u8 rdy; |
@@ -57,18 +55,19 @@ struct w8001_coord { | |||
57 | struct w8001 { | 55 | struct w8001 { |
58 | struct input_dev *dev; | 56 | struct input_dev *dev; |
59 | struct serio *serio; | 57 | struct serio *serio; |
60 | struct mutex cmd_mutex; | ||
61 | struct completion cmd_done; | 58 | struct completion cmd_done; |
62 | int id; | 59 | int id; |
63 | int idx; | 60 | int idx; |
64 | unsigned char expected_packet; | 61 | unsigned char response_type; |
62 | unsigned char response[W8001_MAX_LENGTH]; | ||
65 | unsigned char data[W8001_MAX_LENGTH]; | 63 | unsigned char data[W8001_MAX_LENGTH]; |
66 | unsigned char response[W8001_PACKET_LEN]; | ||
67 | char phys[32]; | 64 | char phys[32]; |
68 | }; | 65 | }; |
69 | 66 | ||
70 | static int parse_data(u8 *data, struct w8001_coord *coord) | 67 | static void parse_data(u8 *data, struct w8001_coord *coord) |
71 | { | 68 | { |
69 | memset(coord, 0, sizeof(*coord)); | ||
70 | |||
72 | coord->rdy = data[0] & 0x20; | 71 | coord->rdy = data[0] & 0x20; |
73 | coord->tsw = data[0] & 0x01; | 72 | coord->tsw = data[0] & 0x01; |
74 | coord->f1 = data[0] & 0x02; | 73 | coord->f1 = data[0] & 0x02; |
@@ -87,15 +86,15 @@ static int parse_data(u8 *data, struct w8001_coord *coord) | |||
87 | 86 | ||
88 | coord->tilt_x = data[7] & 0x7F; | 87 | coord->tilt_x = data[7] & 0x7F; |
89 | coord->tilt_y = data[8] & 0x7F; | 88 | coord->tilt_y = data[8] & 0x7F; |
90 | |||
91 | return 0; | ||
92 | } | 89 | } |
93 | 90 | ||
94 | static void w8001_process_data(struct w8001 *w8001, unsigned char data) | 91 | static irqreturn_t w8001_interrupt(struct serio *serio, |
92 | unsigned char data, unsigned int flags) | ||
95 | { | 93 | { |
94 | struct w8001 *w8001 = serio_get_drvdata(serio); | ||
96 | struct input_dev *dev = w8001->dev; | 95 | struct input_dev *dev = w8001->dev; |
97 | u8 tmp; | ||
98 | struct w8001_coord coord; | 96 | struct w8001_coord coord; |
97 | unsigned char tmp; | ||
99 | 98 | ||
100 | w8001->data[w8001->idx] = data; | 99 | w8001->data[w8001->idx] = data; |
101 | switch (w8001->idx++) { | 100 | switch (w8001->idx++) { |
@@ -105,12 +104,13 @@ static void w8001_process_data(struct w8001 *w8001, unsigned char data) | |||
105 | w8001->idx = 0; | 104 | w8001->idx = 0; |
106 | } | 105 | } |
107 | break; | 106 | break; |
107 | |||
108 | case 8: | 108 | case 8: |
109 | tmp = w8001->data[0] & W8001_TAB_MASK; | 109 | tmp = w8001->data[0] & W8001_TAB_MASK; |
110 | if (unlikely(tmp == W8001_TAB_BYTE)) | 110 | if (unlikely(tmp == W8001_TAB_BYTE)) |
111 | break; | 111 | break; |
112 | |||
112 | w8001->idx = 0; | 113 | w8001->idx = 0; |
113 | memset(&coord, 0, sizeof(coord)); | ||
114 | parse_data(w8001->data, &coord); | 114 | parse_data(w8001->data, &coord); |
115 | input_report_abs(dev, ABS_X, coord.x); | 115 | input_report_abs(dev, ABS_X, coord.x); |
116 | input_report_abs(dev, ABS_Y, coord.y); | 116 | input_report_abs(dev, ABS_Y, coord.y); |
@@ -118,86 +118,48 @@ static void w8001_process_data(struct w8001 *w8001, unsigned char data) | |||
118 | input_report_key(dev, BTN_TOUCH, coord.tsw); | 118 | input_report_key(dev, BTN_TOUCH, coord.tsw); |
119 | input_sync(dev); | 119 | input_sync(dev); |
120 | break; | 120 | break; |
121 | |||
121 | case 10: | 122 | case 10: |
122 | w8001->idx = 0; | 123 | w8001->idx = 0; |
123 | memcpy(w8001->response, &w8001->data, W8001_PACKET_LEN); | 124 | memcpy(w8001->response, w8001->data, W8001_MAX_LENGTH); |
124 | w8001->expected_packet = W8001_QUERY_PACKET; | 125 | w8001->response_type = W8001_QUERY_PACKET; |
125 | complete(&w8001->cmd_done); | 126 | complete(&w8001->cmd_done); |
126 | break; | 127 | break; |
127 | } | 128 | } |
128 | } | ||
129 | |||
130 | |||
131 | static irqreturn_t w8001_interrupt(struct serio *serio, | ||
132 | unsigned char data, unsigned int flags) | ||
133 | { | ||
134 | struct w8001 *w8001 = serio_get_drvdata(serio); | ||
135 | |||
136 | w8001_process_data(w8001, data); | ||
137 | 129 | ||
138 | return IRQ_HANDLED; | 130 | return IRQ_HANDLED; |
139 | } | 131 | } |
140 | 132 | ||
141 | static int w8001_async_command(struct w8001 *w8001, unsigned char *packet, | 133 | static int w8001_command(struct w8001 *w8001, unsigned char command, |
142 | int len) | 134 | bool wait_response) |
143 | { | ||
144 | int rc = -1; | ||
145 | int i; | ||
146 | |||
147 | mutex_lock(&w8001->cmd_mutex); | ||
148 | |||
149 | for (i = 0; i < len; i++) { | ||
150 | if (serio_write(w8001->serio, packet[i])) | ||
151 | goto out; | ||
152 | } | ||
153 | rc = 0; | ||
154 | |||
155 | out: | ||
156 | mutex_unlock(&w8001->cmd_mutex); | ||
157 | return rc; | ||
158 | } | ||
159 | |||
160 | static int w8001_command(struct w8001 *w8001, unsigned char *packet, int len) | ||
161 | { | 135 | { |
162 | int rc = -1; | 136 | int rc; |
163 | int i; | ||
164 | 137 | ||
165 | mutex_lock(&w8001->cmd_mutex); | 138 | w8001->response_type = 0; |
166 | |||
167 | serio_pause_rx(w8001->serio); | ||
168 | init_completion(&w8001->cmd_done); | 139 | init_completion(&w8001->cmd_done); |
169 | serio_continue_rx(w8001->serio); | ||
170 | |||
171 | for (i = 0; i < len; i++) { | ||
172 | if (serio_write(w8001->serio, packet[i])) | ||
173 | goto out; | ||
174 | } | ||
175 | 140 | ||
176 | wait_for_completion_timeout(&w8001->cmd_done, HZ); | 141 | rc = serio_write(w8001->serio, command); |
142 | if (rc == 0 && wait_response) { | ||
177 | 143 | ||
178 | if (w8001->expected_packet == W8001_QUERY_PACKET) { | 144 | wait_for_completion_timeout(&w8001->cmd_done, HZ); |
179 | /* We are back in reporting mode, the query was ACKed */ | 145 | if (w8001->response_type != W8001_QUERY_PACKET) |
180 | memcpy(packet, w8001->response, W8001_PACKET_LEN); | 146 | rc = -EIO; |
181 | rc = 0; | ||
182 | } | 147 | } |
183 | 148 | ||
184 | out: | ||
185 | mutex_unlock(&w8001->cmd_mutex); | ||
186 | return rc; | 149 | return rc; |
187 | } | 150 | } |
188 | 151 | ||
189 | static int w8001_setup(struct w8001 *w8001) | 152 | static int w8001_setup(struct w8001 *w8001) |
190 | { | 153 | { |
191 | struct w8001_coord coord; | ||
192 | struct input_dev *dev = w8001->dev; | 154 | struct input_dev *dev = w8001->dev; |
193 | unsigned char start[1] = { '1' }; | 155 | struct w8001_coord coord; |
194 | unsigned char query[11] = { '*' }; | 156 | int error; |
195 | 157 | ||
196 | if (w8001_command(w8001, query, 1)) | 158 | error = w8001_command(w8001, W8001_CMD_QUERY, true); |
197 | return -1; | 159 | if (error) |
160 | return error; | ||
198 | 161 | ||
199 | memset(&coord, 0, sizeof(coord)); | 162 | parse_data(w8001->response, &coord); |
200 | parse_data(query, &coord); | ||
201 | 163 | ||
202 | input_set_abs_params(dev, ABS_X, 0, coord.x, 0, 0); | 164 | input_set_abs_params(dev, ABS_X, 0, coord.x, 0, 0); |
203 | input_set_abs_params(dev, ABS_Y, 0, coord.y, 0, 0); | 165 | input_set_abs_params(dev, ABS_Y, 0, coord.y, 0, 0); |
@@ -205,10 +167,7 @@ static int w8001_setup(struct w8001 *w8001) | |||
205 | input_set_abs_params(dev, ABS_TILT_X, 0, coord.tilt_x, 0, 0); | 167 | input_set_abs_params(dev, ABS_TILT_X, 0, coord.tilt_x, 0, 0); |
206 | input_set_abs_params(dev, ABS_TILT_Y, 0, coord.tilt_y, 0, 0); | 168 | input_set_abs_params(dev, ABS_TILT_Y, 0, coord.tilt_y, 0, 0); |
207 | 169 | ||
208 | if (w8001_async_command(w8001, start, 1)) | 170 | return w8001_command(w8001, W8001_CMD_START, false); |
209 | return -1; | ||
210 | |||
211 | return 0; | ||
212 | } | 171 | } |
213 | 172 | ||
214 | /* | 173 | /* |
@@ -249,7 +208,6 @@ static int w8001_connect(struct serio *serio, struct serio_driver *drv) | |||
249 | w8001->serio = serio; | 208 | w8001->serio = serio; |
250 | w8001->id = serio->id.id; | 209 | w8001->id = serio->id.id; |
251 | w8001->dev = input_dev; | 210 | w8001->dev = input_dev; |
252 | mutex_init(&w8001->cmd_mutex); | ||
253 | init_completion(&w8001->cmd_done); | 211 | init_completion(&w8001->cmd_done); |
254 | snprintf(w8001->phys, sizeof(w8001->phys), "%s/input0", serio->phys); | 212 | snprintf(w8001->phys, sizeof(w8001->phys), "%s/input0", serio->phys); |
255 | 213 | ||
@@ -269,7 +227,8 @@ static int w8001_connect(struct serio *serio, struct serio_driver *drv) | |||
269 | if (err) | 227 | if (err) |
270 | goto fail2; | 228 | goto fail2; |
271 | 229 | ||
272 | if (w8001_setup(w8001)) | 230 | err = w8001_setup(w8001); |
231 | if (err) | ||
273 | goto fail3; | 232 | goto fail3; |
274 | 233 | ||
275 | err = input_register_device(w8001->dev); | 234 | err = input_register_device(w8001->dev); |
diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c index 2957d48e0045..252eb11fe9db 100644 --- a/drivers/input/touchscreen/wm97xx-core.c +++ b/drivers/input/touchscreen/wm97xx-core.c | |||
@@ -204,7 +204,7 @@ void wm97xx_set_gpio(struct wm97xx *wm, u32 gpio, | |||
204 | else | 204 | else |
205 | reg &= ~gpio; | 205 | reg &= ~gpio; |
206 | 206 | ||
207 | if (wm->id == WM9712_ID2) | 207 | if (wm->id == WM9712_ID2 && wm->variant != WM97xx_WM1613) |
208 | wm97xx_reg_write(wm, AC97_GPIO_STATUS, reg << 1); | 208 | wm97xx_reg_write(wm, AC97_GPIO_STATUS, reg << 1); |
209 | else | 209 | else |
210 | wm97xx_reg_write(wm, AC97_GPIO_STATUS, reg); | 210 | wm97xx_reg_write(wm, AC97_GPIO_STATUS, reg); |
@@ -307,7 +307,7 @@ static void wm97xx_pen_irq_worker(struct work_struct *work) | |||
307 | WM97XX_GPIO_13); | 307 | WM97XX_GPIO_13); |
308 | } | 308 | } |
309 | 309 | ||
310 | if (wm->id == WM9712_ID2) | 310 | if (wm->id == WM9712_ID2 && wm->variant != WM97xx_WM1613) |
311 | wm97xx_reg_write(wm, AC97_GPIO_STATUS, (status & | 311 | wm97xx_reg_write(wm, AC97_GPIO_STATUS, (status & |
312 | ~WM97XX_GPIO_13) << 1); | 312 | ~WM97XX_GPIO_13) << 1); |
313 | else | 313 | else |
@@ -582,6 +582,8 @@ static int wm97xx_probe(struct device *dev) | |||
582 | 582 | ||
583 | wm->id = wm97xx_reg_read(wm, AC97_VENDOR_ID2); | 583 | wm->id = wm97xx_reg_read(wm, AC97_VENDOR_ID2); |
584 | 584 | ||
585 | wm->variant = WM97xx_GENERIC; | ||
586 | |||
585 | dev_info(wm->dev, "detected a wm97%02x codec\n", wm->id & 0xff); | 587 | dev_info(wm->dev, "detected a wm97%02x codec\n", wm->id & 0xff); |
586 | 588 | ||
587 | switch (wm->id & 0xff) { | 589 | switch (wm->id & 0xff) { |