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().

Signed-off-by: Tarun Kanti DebBarma <tarun.ka...@ti.com>
[p-bas...@ti.com: added pm_runtime logic in probe()]
Signed-off-by: Partha Basak <p-bas...@ti.com>
Reviewed-by: Varadarajan, Charulatha <ch...@ti.com>
Acked-by: Cousson, Benoit <b-cous...@ti.com>
---
 arch/arm/plat-omap/dmtimer.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 8cd5cf6..b61edc2 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -38,6 +38,7 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/slab.h>
+#include <linux/pm_runtime.h>
 #include <linux/err.h>
 
 #include <plat/dmtimer.h>
@@ -218,8 +219,7 @@ void omap_dm_timer_enable(struct omap_dm_timer *timer)
        if (timer->enabled)
                return;
 
-       clk_enable(timer->fclk);
-       clk_enable(timer->iclk);
+       pm_runtime_get_sync(&timer->pdev->dev);
 
        timer->enabled = 1;
 }
@@ -230,8 +230,7 @@ void omap_dm_timer_disable(struct omap_dm_timer *timer)
        if (!timer->enabled)
                return;
 
-       clk_disable(timer->fclk);
-       clk_disable(timer->iclk);
+       pm_runtime_put_sync(&timer->pdev->dev);
 
        timer->enabled = 0;
 }
@@ -561,6 +560,10 @@ static int __devinit omap_dm_timer_probe(struct 
platform_device *pdev)
        timer->pdev = pdev;
        timer->reserved = 0;
 
+        /* Skip pm_runtime_enable for OMAP1 */
+       if (!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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to