Commit ffe07cea authored by Tarun Kanti DebBarma's avatar Tarun Kanti DebBarma Committed by Tony Lindgren

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: default avatarTarun Kanti DebBarma <tarun.kanti@ti.com>
Signed-off-by: default avatarPartha Basak <p-basak2@ti.com>
Reviewed-by: default avatarSantosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: default avatarCousson, Benoit <b-cousson@ti.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 3392cdd3
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/pm_runtime.h>
#include <plat/dmtimer.h> #include <plat/dmtimer.h>
...@@ -202,33 +203,13 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_free); ...@@ -202,33 +203,13 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_free);
void omap_dm_timer_enable(struct omap_dm_timer *timer) void omap_dm_timer_enable(struct omap_dm_timer *timer)
{ {
struct dmtimer_platform_data *pdata = timer->pdev->dev.platform_data; pm_runtime_get_sync(&timer->pdev->dev);
if (timer->enabled)
return;
if (!pdata->needs_manual_reset) {
clk_enable(timer->fclk);
clk_enable(timer->iclk);
}
timer->enabled = 1;
} }
EXPORT_SYMBOL_GPL(omap_dm_timer_enable); EXPORT_SYMBOL_GPL(omap_dm_timer_enable);
void omap_dm_timer_disable(struct omap_dm_timer *timer) void omap_dm_timer_disable(struct omap_dm_timer *timer)
{ {
struct dmtimer_platform_data *pdata = timer->pdev->dev.platform_data; pm_runtime_put(&timer->pdev->dev);
if (!timer->enabled)
return;
if (!pdata->needs_manual_reset) {
clk_disable(timer->iclk);
clk_disable(timer->fclk);
}
timer->enabled = 0;
} }
EXPORT_SYMBOL_GPL(omap_dm_timer_disable); EXPORT_SYMBOL_GPL(omap_dm_timer_disable);
...@@ -460,7 +441,7 @@ int omap_dm_timers_active(void) ...@@ -460,7 +441,7 @@ int omap_dm_timers_active(void)
struct omap_dm_timer *timer; struct omap_dm_timer *timer;
list_for_each_entry(timer, &omap_timer_list, node) { list_for_each_entry(timer, &omap_timer_list, node) {
if (!timer->enabled) if (!timer->reserved)
continue; continue;
if (omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG) & 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,6 +511,12 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
timer->irq = irq->start; timer->irq = irq->start;
timer->pdev = pdev; timer->pdev = pdev;
/* Skip pm_runtime_enable for OMAP1 */
if (!pdata->needs_manual_reset) {
pm_runtime_enable(&pdev->dev);
pm_runtime_irq_safe(&pdev->dev);
}
/* add the timer element to the list */ /* add the timer element to the list */
spin_lock_irqsave(&dm_timer_lock, flags); spin_lock_irqsave(&dm_timer_lock, flags);
list_add_tail(&timer->node, &omap_timer_list); list_add_tail(&timer->node, &omap_timer_list);
......
...@@ -243,7 +243,6 @@ struct omap_dm_timer { ...@@ -243,7 +243,6 @@ struct omap_dm_timer {
unsigned long rate; unsigned long rate;
unsigned reserved:1; unsigned reserved:1;
unsigned enabled:1;
unsigned posted:1; unsigned posted:1;
struct platform_device *pdev; struct platform_device *pdev;
struct list_head node; struct list_head node;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment