aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/w90p910_ts.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-09-14 20:56:51 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-14 20:56:51 -0400
commit133309a89e7430f907ebe85e78906ee12c311727 (patch)
treedaa96e6e82b63c0ef1538dcbb455d13595a1c83d /drivers/input/touchscreen/w90p910_ts.c
parent5489375d481c8456c8259b48e107d03b05309d1d (diff)
parentfc8e1ead9314cf0e0f1922e661428b93d3a50d88 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (52 commits) Input: bcm5974 - silence uninitialized variables warnings Input: wistron_btns - add keymap for AOpen 1557 Input: psmouse - use boolean type Input: i8042 - use platform_driver_probe Input: i8042 - use boolean type where it makes sense Input: i8042 - try disabling and re-enabling AUX port at close Input: pxa27x_keypad - allow modifying keymap from userspace Input: sunkbd - fix formatting Input: i8042 - bypass AUX IRQ delivery test on laptops Input: wacom_w8001 - simplify querying logic Input: atkbd - allow setting force-release bitmap via sysfs Input: w90p910_keypad - move a dereference below a NULL test Input: add twl4030_keypad driver Input: matrix-keypad - add function to build device keymap Input: tosakbd - fix cleaning up KEY_STROBEs after error Input: joydev - validate axis/button maps before clobbering current ones Input: xpad - add USB ID for the drumkit controller from Rock Band Input: w90p910_keypad - rename driver name to match platform Input: add new driver for Sentelic Finger Sensing Pad Input: psmouse - allow defining read-only attributes ...
Diffstat (limited to 'drivers/input/touchscreen/w90p910_ts.c')
-rw-r--r--drivers/input/touchscreen/w90p910_ts.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/input/touchscreen/w90p910_ts.c b/drivers/input/touchscreen/w90p910_ts.c
index 937dfe4e9b12..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 {
47struct w90p910_ts { 48struct 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
218static int __devinit w90x900ts_probe(struct platform_device *pdev) 217static 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
297fail4: free_irq(w90p910_ts->irq_num, w90p910_ts); 294fail5: free_irq(w90p910_ts->irq_num, w90p910_ts);
295fail4: clk_put(w90p910_ts->clk);
298fail3: iounmap(w90p910_ts->ts_reg); 296fail3: iounmap(w90p910_ts->ts_reg);
299fail2: release_mem_region(res->start, res->end - res->start + 1); 297fail2: release_mem_region(res->start, resource_size(res));
300fail1: input_free_device(input_dev); 298fail1: 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);