Add pm_runtime feature to dmtimer whereby _get_sync() is called within
omap_dm_timer_enable(), _put_sync() is called in omap_dm_timer_disable().
As part of this, I am getting rid of the 'enabled' flag since this is
no longer needed. This has been replaced by pm_runtime_suspended() check.

Signed-off-by: Tarun Kanti DebBarma <[email protected]>
[[email protected]: added pm_runtime logic in probe()]
Signed-off-by: Partha Basak <[email protected]>
Reviewed-by: Varadarajan, Charulatha <[email protected]>
Acked-by: Cousson, Benoit <[email protected]>
---
 arch/arm/plat-omap/dmtimer.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 6ac6ce7..29d675e 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -39,6 +39,7 @@
 #include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/slab.h>
+#include <linux/pm_runtime.h>
 #include <linux/err.h>
 #include <linux/platform_device.h>
 
@@ -335,7 +336,7 @@ void omap_dm_timer_enable(struct omap_dm_timer *timer)
        if (timer->enabled)
                return;
 
-       clk_enable(timer->fclk);
+       pm_runtime_get_sync(&timer->pdev->dev);
 
        timer->enabled = 1;
 }
@@ -346,7 +347,7 @@ void omap_dm_timer_disable(struct omap_dm_timer *timer)
        if (!timer->enabled)
                return;
 
-       clk_disable(timer->fclk);
+       pm_runtime_put_sync(&timer->pdev->dev);
 
        timer->enabled = 0;
 }
@@ -690,6 +691,10 @@ static int __devinit omap_dm_timer_probe(struct 
platform_device *pdev)
        timer->pdev = pdev;
        timer->reserved = 0;
 
+        /* Skip pm_runtime_enable during early boot and for OMAP1 */
+       if (!pdata->is_early_init && !pdata->needs_manual_reset)
+               pm_runtime_enable(&pdev->dev);
+
        /* add the timer element to the list */
        spin_lock_irqsave(&dm_timer_lock, flags);
        list_add_tail(&timer->node, &omap_timer_list);
-- 
1.6.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to