diff options
author | Wan ZongShun <mcuos.com@gmail.com> | 2009-07-12 23:52:19 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-07-13 01:19:39 -0400 |
commit | b7788c5ff9e7676dc98ca6dce437ae16b79c6726 (patch) | |
tree | bee8a4694f6a14355e7b36d476ee5f57fa057d4e | |
parent | f9c22736940cdc8f5e2db0109fc9493e0cbd895d (diff) |
Input: w90p910_ts - use clk API
Now that clk API is available on ARM we can use it in the driver.
Signed-off-by: Wan ZongShun <mcuos.com@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
-rw-r--r-- | drivers/input/touchscreen/Kconfig | 1 | ||||
-rw-r--r-- | drivers/input/touchscreen/w90p910_ts.c | 26 |
2 files changed, 14 insertions, 13 deletions
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index a66e50aeba11..1c05b3286d65 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig | |||
@@ -498,6 +498,7 @@ config TOUCHSCREEN_TSC2007 | |||
498 | 498 | ||
499 | config TOUCHSCREEN_W90X900 | 499 | config TOUCHSCREEN_W90X900 |
500 | tristate "W90P910 touchscreen driver" | 500 | tristate "W90P910 touchscreen driver" |
501 | depends on HAVE_CLK | ||
501 | help | 502 | help |
502 | Say Y here if you have a W90P910 based touchscreen. | 503 | Say Y here if you have a W90P910 based touchscreen. |
503 | 504 | ||
diff --git a/drivers/input/touchscreen/w90p910_ts.c b/drivers/input/touchscreen/w90p910_ts.c index b3e782fdd2bb..dc4c9d6b67c7 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) |
@@ -253,14 +252,12 @@ static int __devinit w90x900ts_probe(struct platform_device *pdev) | |||
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,18 +280,19 @@ 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, resource_size(res)); | 297 | fail2: release_mem_region(res->start, resource_size(res)); |
300 | fail1: input_free_device(input_dev); | 298 | fail1: input_free_device(input_dev); |
@@ -311,6 +309,8 @@ 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, resource_size(res)); | 315 | release_mem_region(res->start, resource_size(res)); |
316 | 316 | ||