aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/mainstone-wm97xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/touchscreen/mainstone-wm97xx.c')
-rw-r--r--drivers/input/touchscreen/mainstone-wm97xx.c53
1 files changed, 36 insertions, 17 deletions
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
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,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; 248out:
249 return ret;
224} 250}
225 251
226static void wm97xx_acc_shutdown(struct wm97xx *wm) 252static 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