diff options
Diffstat (limited to 'drivers/input/touchscreen/w90p910_ts.c')
-rw-r--r-- | drivers/input/touchscreen/w90p910_ts.c | 38 |
1 files changed, 19 insertions, 19 deletions
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"); |