aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/mainstone-wm97xx.c
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut@gmail.com>2009-07-21 01:26:37 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2009-07-21 01:30:23 -0400
commitb833306febc7d9b805a89aff29f1e410a64981c4 (patch)
treecd900bd57b3dca44da24b760a982d23c3819078d /drivers/input/touchscreen/mainstone-wm97xx.c
parentb7788c5ff9e7676dc98ca6dce437ae16b79c6726 (diff)
Input: wm97xx - add Palm support to Mainstone accelerated touch
This patch refactors the Mainstone accelerated touch code a little and adds support for interrupt driven touchscreen on Palm LifeDrive, TX and Tungsten T5. Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/touchscreen/mainstone-wm97xx.c')
-rw-r--r--drivers/input/touchscreen/mainstone-wm97xx.c50
1 files changed, 33 insertions, 17 deletions
diff --git a/drivers/input/touchscreen/mainstone-wm97xx.c b/drivers/input/touchscreen/mainstone-wm97xx.c
index 4cc047a5116e..c797bc04ee83 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
38struct continuous { 40struct 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 */
63static int sp_idx; 65static int sp_idx;
64static u16 last, tries; 66static u16 last, tries;
67static 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
172static int wm97xx_acc_startup(struct wm97xx *wm) 175static 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,37 @@ 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 } else if (machine_is_mainstone() && pen_int)
202 irq = 4;
203
204 if (irq) {
205 ret = gpio_request(irq, "Touchscreen IRQ");
206 if (ret)
207 goto out;
208
209 ret = gpio_direction_input(irq);
210 if (ret) {
211 gpio_free(irq);
212 goto out;
213 }
214
215 wm->pen_irq = gpio_to_irq(irq);
216 set_irq_type(wm->pen_irq, IRQ_TYPE_EDGE_BOTH);
217 } else /* pen irq not supported */
218 pen_int = 0;
219
194 /* codec specific irq config */ 220 /* codec specific irq config */
195 if (pen_int) { 221 if (pen_int) {
196 switch (wm->id) { 222 switch (wm->id) {
197 case WM9705_ID2: 223 case WM9705_ID2:
198 wm->pen_irq = IRQ_GPIO(4);
199 set_irq_type(IRQ_GPIO(4), IRQ_TYPE_EDGE_BOTH);
200 break; 224 break;
201 case WM9712_ID2: 225 case WM9712_ID2:
202 case WM9713_ID2: 226 case WM9713_ID2:
203 /* enable pen down interrupt */
204 /* use PEN_DOWN GPIO 13 to assert IRQ on GPIO line 2 */ 227 /* 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, 228 wm97xx_config_gpio(wm, WM97XX_GPIO_13, WM97XX_GPIO_IN,
207 WM97XX_GPIO_POL_HIGH, 229 WM97XX_GPIO_POL_HIGH,
208 WM97XX_GPIO_STICKY, 230 WM97XX_GPIO_STICKY,
@@ -220,23 +242,17 @@ static int wm97xx_acc_startup(struct wm97xx *wm)
220 } 242 }
221 } 243 }
222 244
223 return 0; 245out:
246 return ret;
224} 247}
225 248
226static void wm97xx_acc_shutdown(struct wm97xx *wm) 249static void wm97xx_acc_shutdown(struct wm97xx *wm)
227{ 250{
228 /* codec specific deconfig */ 251 /* codec specific deconfig */
229 if (pen_int) { 252 if (pen_int) {
230 switch (wm->id & 0xffff) { 253 if (irq)
231 case WM9705_ID2: 254 gpio_free(irq);
232 wm->pen_irq = 0; 255 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 } 256 }
241} 257}
242 258