diff options
author | Corentin Labbe <clabbe.montjoie@gmail.com> | 2018-01-19 12:29:28 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2018-01-19 12:35:24 -0500 |
commit | 082dc4dcc35f9e1695f0050ea6475f9a56df2c0a (patch) | |
tree | 915a69c7dd1de2a74202fcf112da9b2d4fd5c951 | |
parent | a3f061bc26e07fecc4e3c2ed12d5d6947d996036 (diff) |
Input: remove atmel-wm97xx touchscreen driver
Since AVR32 arch is gone, atmel-wm97xx driver is useless. In theory it
could have been rewritten to work with AT91 devices, but the driver is from
the platform data era, and a bit hard coded to work on AVR32 hardware
variant of the AC97C peripheral, so let's remove it.
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Acked-by: Hans-Christian Noren Egtvedt <egtvedt@samfundet.no>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r-- | drivers/input/touchscreen/Kconfig | 15 | ||||
-rw-r--r-- | drivers/input/touchscreen/Makefile | 1 | ||||
-rw-r--r-- | drivers/input/touchscreen/atmel-wm97xx.c | 436 |
3 files changed, 0 insertions, 452 deletions
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 0cfdb7cb610e..5fac4ef3ae7b 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig | |||
@@ -795,21 +795,6 @@ config TOUCHSCREEN_WM9713 | |||
795 | Say Y here to enable support for the Wolfson Microelectronics | 795 | Say Y here to enable support for the Wolfson Microelectronics |
796 | WM9713 touchscreen controller. | 796 | WM9713 touchscreen controller. |
797 | 797 | ||
798 | config TOUCHSCREEN_WM97XX_ATMEL | ||
799 | tristate "WM97xx Atmel accelerated touch" | ||
800 | depends on TOUCHSCREEN_WM97XX && AVR32 | ||
801 | help | ||
802 | Say Y here for support for streaming mode with WM97xx touchscreens | ||
803 | on Atmel AT91 or AVR32 systems with an AC97C module. | ||
804 | |||
805 | Be aware that this will use channel B in the controller for | ||
806 | streaming data, this must not conflict with other AC97C drivers. | ||
807 | |||
808 | If unsure, say N. | ||
809 | |||
810 | To compile this driver as a module, choose M here: the module will | ||
811 | be called atmel-wm97xx. | ||
812 | |||
813 | config TOUCHSCREEN_WM97XX_MAINSTONE | 798 | config TOUCHSCREEN_WM97XX_MAINSTONE |
814 | tristate "WM97xx Mainstone/Palm accelerated touch" | 799 | tristate "WM97xx Mainstone/Palm accelerated touch" |
815 | depends on TOUCHSCREEN_WM97XX && ARCH_PXA | 800 | depends on TOUCHSCREEN_WM97XX && ARCH_PXA |
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index d2a2b3b7af27..dddae7973436 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile | |||
@@ -97,7 +97,6 @@ obj-$(CONFIG_TOUCHSCREEN_WM97XX) += wm97xx-ts.o | |||
97 | wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9705) += wm9705.o | 97 | wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9705) += wm9705.o |
98 | wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9712) += wm9712.o | 98 | wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9712) += wm9712.o |
99 | wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9713) += wm9713.o | 99 | wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9713) += wm9713.o |
100 | obj-$(CONFIG_TOUCHSCREEN_WM97XX_ATMEL) += atmel-wm97xx.o | ||
101 | obj-$(CONFIG_TOUCHSCREEN_WM97XX_MAINSTONE) += mainstone-wm97xx.o | 100 | obj-$(CONFIG_TOUCHSCREEN_WM97XX_MAINSTONE) += mainstone-wm97xx.o |
102 | obj-$(CONFIG_TOUCHSCREEN_WM97XX_ZYLONITE) += zylonite-wm97xx.o | 101 | obj-$(CONFIG_TOUCHSCREEN_WM97XX_ZYLONITE) += zylonite-wm97xx.o |
103 | obj-$(CONFIG_TOUCHSCREEN_W90X900) += w90p910_ts.o | 102 | obj-$(CONFIG_TOUCHSCREEN_W90X900) += w90p910_ts.o |
diff --git a/drivers/input/touchscreen/atmel-wm97xx.c b/drivers/input/touchscreen/atmel-wm97xx.c deleted file mode 100644 index 9140a43cfe20..000000000000 --- a/drivers/input/touchscreen/atmel-wm97xx.c +++ /dev/null | |||
@@ -1,436 +0,0 @@ | |||
1 | /* | ||
2 | * Atmel AT91 and AVR32 continuous touch screen driver for Wolfson WM97xx AC97 | ||
3 | * codecs. | ||
4 | * | ||
5 | * Copyright (C) 2008 - 2009 Atmel Corporation | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License version 2 as published by | ||
9 | * the Free Software Foundation. | ||
10 | */ | ||
11 | #include <linux/module.h> | ||
12 | #include <linux/moduleparam.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/delay.h> | ||
16 | #include <linux/irq.h> | ||
17 | #include <linux/interrupt.h> | ||
18 | #include <linux/wm97xx.h> | ||
19 | #include <linux/timer.h> | ||
20 | #include <linux/gpio.h> | ||
21 | #include <linux/io.h> | ||
22 | #include <linux/slab.h> | ||
23 | |||
24 | #define AC97C_ICA 0x10 | ||
25 | #define AC97C_CBRHR 0x30 | ||
26 | #define AC97C_CBSR 0x38 | ||
27 | #define AC97C_CBMR 0x3c | ||
28 | #define AC97C_IER 0x54 | ||
29 | #define AC97C_IDR 0x58 | ||
30 | |||
31 | #define AC97C_RXRDY (1 << 4) | ||
32 | #define AC97C_OVRUN (1 << 5) | ||
33 | |||
34 | #define AC97C_CMR_SIZE_20 (0 << 16) | ||
35 | #define AC97C_CMR_SIZE_18 (1 << 16) | ||
36 | #define AC97C_CMR_SIZE_16 (2 << 16) | ||
37 | #define AC97C_CMR_SIZE_10 (3 << 16) | ||
38 | #define AC97C_CMR_CEM_LITTLE (1 << 18) | ||
39 | #define AC97C_CMR_CEM_BIG (0 << 18) | ||
40 | #define AC97C_CMR_CENA (1 << 21) | ||
41 | |||
42 | #define AC97C_INT_CBEVT (1 << 4) | ||
43 | |||
44 | #define AC97C_SR_CAEVT (1 << 3) | ||
45 | |||
46 | #define AC97C_CH_MASK(slot) \ | ||
47 | (0x7 << (3 * (slot - 3))) | ||
48 | #define AC97C_CH_ASSIGN(slot, channel) \ | ||
49 | (AC97C_CHANNEL_##channel << (3 * (slot - 3))) | ||
50 | #define AC97C_CHANNEL_NONE 0x0 | ||
51 | #define AC97C_CHANNEL_B 0x2 | ||
52 | |||
53 | #define ac97c_writel(chip, reg, val) \ | ||
54 | __raw_writel((val), (chip)->regs + AC97C_##reg) | ||
55 | #define ac97c_readl(chip, reg) \ | ||
56 | __raw_readl((chip)->regs + AC97C_##reg) | ||
57 | |||
58 | #ifdef CONFIG_CPU_AT32AP700X | ||
59 | #define ATMEL_WM97XX_AC97C_IOMEM (0xfff02800) | ||
60 | #define ATMEL_WM97XX_AC97C_IRQ (29) | ||
61 | #define ATMEL_WM97XX_GPIO_DEFAULT (32+16) /* Pin 16 on port B. */ | ||
62 | #else | ||
63 | #error Unknown CPU, this driver only supports AT32AP700X CPUs. | ||
64 | #endif | ||
65 | |||
66 | struct continuous { | ||
67 | u16 id; /* codec id */ | ||
68 | u8 code; /* continuous code */ | ||
69 | u8 reads; /* number of coord reads per read cycle */ | ||
70 | u32 speed; /* number of coords per second */ | ||
71 | }; | ||
72 | |||
73 | #define WM_READS(sp) ((sp / HZ) + 1) | ||
74 | |||
75 | static const struct continuous cinfo[] = { | ||
76 | {WM9705_ID2, 0, WM_READS(94), 94}, | ||
77 | {WM9705_ID2, 1, WM_READS(188), 188}, | ||
78 | {WM9705_ID2, 2, WM_READS(375), 375}, | ||
79 | {WM9705_ID2, 3, WM_READS(750), 750}, | ||
80 | {WM9712_ID2, 0, WM_READS(94), 94}, | ||
81 | {WM9712_ID2, 1, WM_READS(188), 188}, | ||
82 | {WM9712_ID2, 2, WM_READS(375), 375}, | ||
83 | {WM9712_ID2, 3, WM_READS(750), 750}, | ||
84 | {WM9713_ID2, 0, WM_READS(94), 94}, | ||
85 | {WM9713_ID2, 1, WM_READS(120), 120}, | ||
86 | {WM9713_ID2, 2, WM_READS(154), 154}, | ||
87 | {WM9713_ID2, 3, WM_READS(188), 188}, | ||
88 | }; | ||
89 | |||
90 | /* Continuous speed index. */ | ||
91 | static int sp_idx; | ||
92 | |||
93 | /* | ||
94 | * Pen sampling frequency (Hz) in continuous mode. | ||
95 | */ | ||
96 | static int cont_rate = 188; | ||
97 | module_param(cont_rate, int, 0); | ||
98 | MODULE_PARM_DESC(cont_rate, "Sampling rate in continuous mode (Hz)"); | ||
99 | |||
100 | /* | ||
101 | * Pen down detection. | ||
102 | * | ||
103 | * This driver can either poll or use an interrupt to indicate a pen down | ||
104 | * event. If the irq request fails then it will fall back to polling mode. | ||
105 | */ | ||
106 | static int pen_int = 1; | ||
107 | module_param(pen_int, int, 0); | ||
108 | MODULE_PARM_DESC(pen_int, "Pen down detection (1 = interrupt, 0 = polling)"); | ||
109 | |||
110 | /* | ||
111 | * Pressure readback. | ||
112 | * | ||
113 | * Set to 1 to read back pen down pressure. | ||
114 | */ | ||
115 | static int pressure; | ||
116 | module_param(pressure, int, 0); | ||
117 | MODULE_PARM_DESC(pressure, "Pressure readback (1 = pressure, 0 = no pressure)"); | ||
118 | |||
119 | /* | ||
120 | * AC97 touch data slot. | ||
121 | * | ||
122 | * Touch screen readback data ac97 slot. | ||
123 | */ | ||
124 | static int ac97_touch_slot = 5; | ||
125 | module_param(ac97_touch_slot, int, 0); | ||
126 | MODULE_PARM_DESC(ac97_touch_slot, "Touch screen data slot AC97 number"); | ||
127 | |||
128 | /* | ||
129 | * GPIO line number. | ||
130 | * | ||
131 | * Set to GPIO number where the signal from the WM97xx device is hooked up. | ||
132 | */ | ||
133 | static int atmel_gpio_line = ATMEL_WM97XX_GPIO_DEFAULT; | ||
134 | module_param(atmel_gpio_line, int, 0); | ||
135 | MODULE_PARM_DESC(atmel_gpio_line, "GPIO line number connected to WM97xx"); | ||
136 | |||
137 | struct atmel_wm97xx { | ||
138 | struct wm97xx *wm; | ||
139 | struct timer_list pen_timer; | ||
140 | void __iomem *regs; | ||
141 | unsigned long ac97c_irq; | ||
142 | unsigned long gpio_pen; | ||
143 | unsigned long gpio_irq; | ||
144 | unsigned short x; | ||
145 | unsigned short y; | ||
146 | }; | ||
147 | |||
148 | static irqreturn_t atmel_wm97xx_channel_b_interrupt(int irq, void *dev_id) | ||
149 | { | ||
150 | struct atmel_wm97xx *atmel_wm97xx = dev_id; | ||
151 | struct wm97xx *wm = atmel_wm97xx->wm; | ||
152 | int status = ac97c_readl(atmel_wm97xx, CBSR); | ||
153 | irqreturn_t retval = IRQ_NONE; | ||
154 | |||
155 | if (status & AC97C_OVRUN) { | ||
156 | dev_dbg(&wm->touch_dev->dev, "AC97C overrun\n"); | ||
157 | ac97c_readl(atmel_wm97xx, CBRHR); | ||
158 | retval = IRQ_HANDLED; | ||
159 | } else if (status & AC97C_RXRDY) { | ||
160 | u16 data; | ||
161 | u16 value; | ||
162 | u16 source; | ||
163 | u16 pen_down; | ||
164 | |||
165 | data = ac97c_readl(atmel_wm97xx, CBRHR); | ||
166 | value = data & 0x0fff; | ||
167 | source = data & WM97XX_ADCSEL_MASK; | ||
168 | pen_down = (data & WM97XX_PEN_DOWN) >> 8; | ||
169 | |||
170 | if (source == WM97XX_ADCSEL_X) | ||
171 | atmel_wm97xx->x = value; | ||
172 | if (source == WM97XX_ADCSEL_Y) | ||
173 | atmel_wm97xx->y = value; | ||
174 | |||
175 | if (!pressure && source == WM97XX_ADCSEL_Y) { | ||
176 | input_report_abs(wm->input_dev, ABS_X, atmel_wm97xx->x); | ||
177 | input_report_abs(wm->input_dev, ABS_Y, atmel_wm97xx->y); | ||
178 | input_report_key(wm->input_dev, BTN_TOUCH, pen_down); | ||
179 | input_sync(wm->input_dev); | ||
180 | } else if (pressure && source == WM97XX_ADCSEL_PRES) { | ||
181 | input_report_abs(wm->input_dev, ABS_X, atmel_wm97xx->x); | ||
182 | input_report_abs(wm->input_dev, ABS_Y, atmel_wm97xx->y); | ||
183 | input_report_abs(wm->input_dev, ABS_PRESSURE, value); | ||
184 | input_report_key(wm->input_dev, BTN_TOUCH, value); | ||
185 | input_sync(wm->input_dev); | ||
186 | } | ||
187 | |||
188 | retval = IRQ_HANDLED; | ||
189 | } | ||
190 | |||
191 | return retval; | ||
192 | } | ||
193 | |||
194 | static void atmel_wm97xx_acc_pen_up(struct wm97xx *wm) | ||
195 | { | ||
196 | struct atmel_wm97xx *atmel_wm97xx = platform_get_drvdata(wm->touch_dev); | ||
197 | struct input_dev *input_dev = wm->input_dev; | ||
198 | int pen_down = gpio_get_value(atmel_wm97xx->gpio_pen); | ||
199 | |||
200 | if (pen_down != 0) { | ||
201 | mod_timer(&atmel_wm97xx->pen_timer, | ||
202 | jiffies + msecs_to_jiffies(1)); | ||
203 | } else { | ||
204 | if (pressure) | ||
205 | input_report_abs(input_dev, ABS_PRESSURE, 0); | ||
206 | input_report_key(input_dev, BTN_TOUCH, 0); | ||
207 | input_sync(input_dev); | ||
208 | } | ||
209 | } | ||
210 | |||
211 | static void atmel_wm97xx_pen_timer(struct timer_list *t) | ||
212 | { | ||
213 | struct atmel_wm97xx *atmel_wm97xx = from_timer(atmel_wm97xx, t, | ||
214 | pen_timer); | ||
215 | |||
216 | atmel_wm97xx_acc_pen_up(atmel_wm97xx->wm); | ||
217 | } | ||
218 | |||
219 | static int atmel_wm97xx_acc_startup(struct wm97xx *wm) | ||
220 | { | ||
221 | struct atmel_wm97xx *atmel_wm97xx = platform_get_drvdata(wm->touch_dev); | ||
222 | int idx = 0; | ||
223 | |||
224 | if (wm->ac97 == NULL) | ||
225 | return -ENODEV; | ||
226 | |||
227 | for (idx = 0; idx < ARRAY_SIZE(cinfo); idx++) { | ||
228 | if (wm->id != cinfo[idx].id) | ||
229 | continue; | ||
230 | |||
231 | sp_idx = idx; | ||
232 | |||
233 | if (cont_rate <= cinfo[idx].speed) | ||
234 | break; | ||
235 | } | ||
236 | |||
237 | wm->acc_rate = cinfo[sp_idx].code; | ||
238 | wm->acc_slot = ac97_touch_slot; | ||
239 | dev_info(&wm->touch_dev->dev, "atmel accelerated touchscreen driver, " | ||
240 | "%d samples/sec\n", cinfo[sp_idx].speed); | ||
241 | |||
242 | if (pen_int) { | ||
243 | unsigned long reg; | ||
244 | |||
245 | wm->pen_irq = atmel_wm97xx->gpio_irq; | ||
246 | |||
247 | switch (wm->id) { | ||
248 | case WM9712_ID2: /* Fall through. */ | ||
249 | case WM9713_ID2: | ||
250 | /* | ||
251 | * Use GPIO 13 (PEN_DOWN) to assert GPIO line 3 | ||
252 | * (PENDOWN). | ||
253 | */ | ||
254 | wm97xx_config_gpio(wm, WM97XX_GPIO_13, WM97XX_GPIO_IN, | ||
255 | WM97XX_GPIO_POL_HIGH, | ||
256 | WM97XX_GPIO_STICKY, | ||
257 | WM97XX_GPIO_WAKE); | ||
258 | wm97xx_config_gpio(wm, WM97XX_GPIO_3, WM97XX_GPIO_OUT, | ||
259 | WM97XX_GPIO_POL_HIGH, | ||
260 | WM97XX_GPIO_NOTSTICKY, | ||
261 | WM97XX_GPIO_NOWAKE); | ||
262 | case WM9705_ID2: /* Fall through. */ | ||
263 | /* | ||
264 | * Enable touch data slot in AC97 controller channel B. | ||
265 | */ | ||
266 | reg = ac97c_readl(atmel_wm97xx, ICA); | ||
267 | reg &= ~AC97C_CH_MASK(wm->acc_slot); | ||
268 | reg |= AC97C_CH_ASSIGN(wm->acc_slot, B); | ||
269 | ac97c_writel(atmel_wm97xx, ICA, reg); | ||
270 | |||
271 | /* | ||
272 | * Enable channel and interrupt for RXRDY and OVERRUN. | ||
273 | */ | ||
274 | ac97c_writel(atmel_wm97xx, CBMR, AC97C_CMR_CENA | ||
275 | | AC97C_CMR_CEM_BIG | ||
276 | | AC97C_CMR_SIZE_16 | ||
277 | | AC97C_OVRUN | ||
278 | | AC97C_RXRDY); | ||
279 | /* Dummy read to empty RXRHR. */ | ||
280 | ac97c_readl(atmel_wm97xx, CBRHR); | ||
281 | /* | ||
282 | * Enable interrupt for channel B in the AC97 | ||
283 | * controller. | ||
284 | */ | ||
285 | ac97c_writel(atmel_wm97xx, IER, AC97C_INT_CBEVT); | ||
286 | break; | ||
287 | default: | ||
288 | dev_err(&wm->touch_dev->dev, "pen down irq not " | ||
289 | "supported on this device\n"); | ||
290 | pen_int = 0; | ||
291 | break; | ||
292 | } | ||
293 | } | ||
294 | |||
295 | return 0; | ||
296 | } | ||
297 | |||
298 | static void atmel_wm97xx_acc_shutdown(struct wm97xx *wm) | ||
299 | { | ||
300 | if (pen_int) { | ||
301 | struct atmel_wm97xx *atmel_wm97xx = | ||
302 | platform_get_drvdata(wm->touch_dev); | ||
303 | unsigned long ica; | ||
304 | |||
305 | switch (wm->id & 0xffff) { | ||
306 | case WM9705_ID2: /* Fall through. */ | ||
307 | case WM9712_ID2: /* Fall through. */ | ||
308 | case WM9713_ID2: | ||
309 | /* Disable slot and turn off channel B interrupts. */ | ||
310 | ica = ac97c_readl(atmel_wm97xx, ICA); | ||
311 | ica &= ~AC97C_CH_MASK(wm->acc_slot); | ||
312 | ac97c_writel(atmel_wm97xx, ICA, ica); | ||
313 | ac97c_writel(atmel_wm97xx, IDR, AC97C_INT_CBEVT); | ||
314 | ac97c_writel(atmel_wm97xx, CBMR, 0); | ||
315 | wm->pen_irq = 0; | ||
316 | break; | ||
317 | default: | ||
318 | dev_err(&wm->touch_dev->dev, "unknown codec\n"); | ||
319 | break; | ||
320 | } | ||
321 | } | ||
322 | } | ||
323 | |||
324 | static void atmel_wm97xx_irq_enable(struct wm97xx *wm, int enable) | ||
325 | { | ||
326 | /* Intentionally left empty. */ | ||
327 | } | ||
328 | |||
329 | static struct wm97xx_mach_ops atmel_mach_ops = { | ||
330 | .acc_enabled = 1, | ||
331 | .acc_pen_up = atmel_wm97xx_acc_pen_up, | ||
332 | .acc_startup = atmel_wm97xx_acc_startup, | ||
333 | .acc_shutdown = atmel_wm97xx_acc_shutdown, | ||
334 | .irq_enable = atmel_wm97xx_irq_enable, | ||
335 | .irq_gpio = WM97XX_GPIO_3, | ||
336 | }; | ||
337 | |||
338 | static int __init atmel_wm97xx_probe(struct platform_device *pdev) | ||
339 | { | ||
340 | struct wm97xx *wm = platform_get_drvdata(pdev); | ||
341 | struct atmel_wm97xx *atmel_wm97xx; | ||
342 | int ret; | ||
343 | |||
344 | atmel_wm97xx = kzalloc(sizeof(struct atmel_wm97xx), GFP_KERNEL); | ||
345 | if (!atmel_wm97xx) | ||
346 | return -ENOMEM; | ||
347 | |||
348 | atmel_wm97xx->wm = wm; | ||
349 | atmel_wm97xx->regs = (void *)ATMEL_WM97XX_AC97C_IOMEM; | ||
350 | atmel_wm97xx->ac97c_irq = ATMEL_WM97XX_AC97C_IRQ; | ||
351 | atmel_wm97xx->gpio_pen = atmel_gpio_line; | ||
352 | atmel_wm97xx->gpio_irq = gpio_to_irq(atmel_wm97xx->gpio_pen); | ||
353 | |||
354 | timer_setup(&atmel_wm97xx->pen_timer, atmel_wm97xx_pen_timer, 0); | ||
355 | |||
356 | ret = request_irq(atmel_wm97xx->ac97c_irq, | ||
357 | atmel_wm97xx_channel_b_interrupt, | ||
358 | IRQF_SHARED, "atmel-wm97xx-ch-b", atmel_wm97xx); | ||
359 | if (ret) { | ||
360 | dev_dbg(&pdev->dev, "could not request ac97c irq\n"); | ||
361 | goto err; | ||
362 | } | ||
363 | |||
364 | platform_set_drvdata(pdev, atmel_wm97xx); | ||
365 | |||
366 | ret = wm97xx_register_mach_ops(wm, &atmel_mach_ops); | ||
367 | if (ret) | ||
368 | goto err_irq; | ||
369 | |||
370 | return ret; | ||
371 | |||
372 | err_irq: | ||
373 | free_irq(atmel_wm97xx->ac97c_irq, atmel_wm97xx); | ||
374 | err: | ||
375 | kfree(atmel_wm97xx); | ||
376 | return ret; | ||
377 | } | ||
378 | |||
379 | static int __exit atmel_wm97xx_remove(struct platform_device *pdev) | ||
380 | { | ||
381 | struct atmel_wm97xx *atmel_wm97xx = platform_get_drvdata(pdev); | ||
382 | struct wm97xx *wm = atmel_wm97xx->wm; | ||
383 | |||
384 | ac97c_writel(atmel_wm97xx, IDR, AC97C_INT_CBEVT); | ||
385 | free_irq(atmel_wm97xx->ac97c_irq, atmel_wm97xx); | ||
386 | del_timer_sync(&atmel_wm97xx->pen_timer); | ||
387 | wm97xx_unregister_mach_ops(wm); | ||
388 | kfree(atmel_wm97xx); | ||
389 | |||
390 | return 0; | ||
391 | } | ||
392 | |||
393 | #ifdef CONFIG_PM_SLEEP | ||
394 | static int atmel_wm97xx_suspend(struct device *dev) | ||
395 | { | ||
396 | struct platform_device *pdev = to_platform_device(dev); | ||
397 | struct atmel_wm97xx *atmel_wm97xx = platform_get_drvdata(pdev); | ||
398 | |||
399 | ac97c_writel(atmel_wm97xx, IDR, AC97C_INT_CBEVT); | ||
400 | disable_irq(atmel_wm97xx->gpio_irq); | ||
401 | del_timer_sync(&atmel_wm97xx->pen_timer); | ||
402 | |||
403 | return 0; | ||
404 | } | ||
405 | |||
406 | static int atmel_wm97xx_resume(struct device *dev) | ||
407 | { | ||
408 | struct platform_device *pdev = to_platform_device(dev); | ||
409 | struct atmel_wm97xx *atmel_wm97xx = platform_get_drvdata(pdev); | ||
410 | struct wm97xx *wm = atmel_wm97xx->wm; | ||
411 | |||
412 | if (wm->input_dev->users) { | ||
413 | enable_irq(atmel_wm97xx->gpio_irq); | ||
414 | ac97c_writel(atmel_wm97xx, IER, AC97C_INT_CBEVT); | ||
415 | } | ||
416 | |||
417 | return 0; | ||
418 | } | ||
419 | #endif | ||
420 | |||
421 | static SIMPLE_DEV_PM_OPS(atmel_wm97xx_pm_ops, | ||
422 | atmel_wm97xx_suspend, atmel_wm97xx_resume); | ||
423 | |||
424 | static struct platform_driver atmel_wm97xx_driver = { | ||
425 | .remove = __exit_p(atmel_wm97xx_remove), | ||
426 | .driver = { | ||
427 | .name = "wm97xx-touch", | ||
428 | .pm = &atmel_wm97xx_pm_ops, | ||
429 | }, | ||
430 | }; | ||
431 | |||
432 | module_platform_driver_probe(atmel_wm97xx_driver, atmel_wm97xx_probe); | ||
433 | |||
434 | MODULE_AUTHOR("Hans-Christian Egtvedt <egtvedt@samfundet.no>"); | ||
435 | MODULE_DESCRIPTION("wm97xx continuous touch driver for Atmel AT91 and AVR32"); | ||
436 | MODULE_LICENSE("GPL"); | ||