aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTarun Kanti DebBarma <tarun.kanti@ti.com>2011-09-20 07:30:21 -0400
committerTony Lindgren <tony@atomide.com>2011-09-21 18:50:31 -0400
commitffe07ceae1ae4b00b776c59694eddd9dd615dcea (patch)
treeea5192202119ce30d24b6dbc06ab734ca41fe98f
parent3392cdd33a0419e3226910a08b8bdc43b56c95d0 (diff)
ARM: OMAP: dmtimer: pm_runtime support
Add pm_runtime feature to dmtimer whereby *_runtime_get_sync() is called within omap_dm_timer_enable(), pm_runtime_put() is called in omap_dm_timer_disable(). In addition to calling pm_runtime_enable, we are calling pm_runtime_irq_safe so that they can be called from interrupt context. Signed-off-by: Tarun Kanti DebBarma <tarun.kanti@ti.com> Signed-off-by: Partha Basak <p-basak2@ti.com> Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Acked-by: Cousson, Benoit <b-cousson@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r--arch/arm/plat-omap/dmtimer.c33
-rw-r--r--arch/arm/plat-omap/include/plat/dmtimer.h1
2 files changed, 10 insertions, 24 deletions
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 601920860597..ac904c2ea058 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -38,6 +38,7 @@
38#include <linux/io.h> 38#include <linux/io.h>
39#include <linux/slab.h> 39#include <linux/slab.h>
40#include <linux/err.h> 40#include <linux/err.h>
41#include <linux/pm_runtime.h>
41 42
42#include <plat/dmtimer.h> 43#include <plat/dmtimer.h>
43 44
@@ -202,33 +203,13 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_free);
202 203
203void omap_dm_timer_enable(struct omap_dm_timer *timer) 204void omap_dm_timer_enable(struct omap_dm_timer *timer)
204{ 205{
205 struct dmtimer_platform_data *pdata = timer->pdev->dev.platform_data; 206 pm_runtime_get_sync(&timer->pdev->dev);
206
207 if (timer->enabled)
208 return;
209
210 if (!pdata->needs_manual_reset) {
211 clk_enable(timer->fclk);
212 clk_enable(timer->iclk);
213 }
214
215 timer->enabled = 1;
216} 207}
217EXPORT_SYMBOL_GPL(omap_dm_timer_enable); 208EXPORT_SYMBOL_GPL(omap_dm_timer_enable);
218 209
219void omap_dm_timer_disable(struct omap_dm_timer *timer) 210void omap_dm_timer_disable(struct omap_dm_timer *timer)
220{ 211{
221 struct dmtimer_platform_data *pdata = timer->pdev->dev.platform_data; 212 pm_runtime_put(&timer->pdev->dev);
222
223 if (!timer->enabled)
224 return;
225
226 if (!pdata->needs_manual_reset) {
227 clk_disable(timer->iclk);
228 clk_disable(timer->fclk);
229 }
230
231 timer->enabled = 0;
232} 213}
233EXPORT_SYMBOL_GPL(omap_dm_timer_disable); 214EXPORT_SYMBOL_GPL(omap_dm_timer_disable);
234 215
@@ -460,7 +441,7 @@ int omap_dm_timers_active(void)
460 struct omap_dm_timer *timer; 441 struct omap_dm_timer *timer;
461 442
462 list_for_each_entry(timer, &omap_timer_list, node) { 443 list_for_each_entry(timer, &omap_timer_list, node) {
463 if (!timer->enabled) 444 if (!timer->reserved)
464 continue; 445 continue;
465 446
466 if (omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG) & 447 if (omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG) &
@@ -530,6 +511,12 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
530 timer->irq = irq->start; 511 timer->irq = irq->start;
531 timer->pdev = pdev; 512 timer->pdev = pdev;
532 513
514 /* Skip pm_runtime_enable for OMAP1 */
515 if (!pdata->needs_manual_reset) {
516 pm_runtime_enable(&pdev->dev);
517 pm_runtime_irq_safe(&pdev->dev);
518 }
519
533 /* add the timer element to the list */ 520 /* add the timer element to the list */
534 spin_lock_irqsave(&dm_timer_lock, flags); 521 spin_lock_irqsave(&dm_timer_lock, flags);
535 list_add_tail(&timer->node, &omap_timer_list); 522 list_add_tail(&timer->node, &omap_timer_list);
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
index 2ac7538541b2..4e3a32609abf 100644
--- a/arch/arm/plat-omap/include/plat/dmtimer.h
+++ b/arch/arm/plat-omap/include/plat/dmtimer.h
@@ -243,7 +243,6 @@ struct omap_dm_timer {
243 243
244 unsigned long rate; 244 unsigned long rate;
245 unsigned reserved:1; 245 unsigned reserved:1;
246 unsigned enabled:1;
247 unsigned posted:1; 246 unsigned posted:1;
248 struct platform_device *pdev; 247 struct platform_device *pdev;
249 struct list_head node; 248 struct list_head node;