On Sat, Nov 20, 2010 at 08:09, Tarun Kanti DebBarma <[email protected]> wrote:
> Add pm_runtime support to dmtimer. Since dmtimer is used during
> early boot before pm_runtime is initialized completely there are
> provisions to enable/disable clocks directly in the code during
> early boot.
>
> Signed-off-by: Tarun Kanti DebBarma <[email protected]>
> [[email protected]: added pm_runtime logic in probe()]
> Signed-off-by: Partha Basak <[email protected]>
> ---
> arch/arm/plat-omap/dmtimer.c | 31 +++++++++++++++++++++++++++++--
> 1 files changed, 29 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
> index f9285b1..83d0b66 100644
> --- a/arch/arm/plat-omap/dmtimer.c
> +++ b/arch/arm/plat-omap/dmtimer.c
> @@ -45,6 +45,7 @@
> #include <linux/module.h>
> #include <linux/slab.h>
> #include <mach/hardware.h>
> +#include <linux/pm_runtime.h>
> #include <plat/dmtimer.h>
> #include <mach/irqs.h>
> #include <linux/err.h>
> @@ -345,10 +346,22 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_free);
>
> void omap_dm_timer_enable(struct omap_dm_timer *timer)
> {
> + struct dmtimer_platform_data *pdata = timer->pdev->dev.platform_data;
> +
> if (timer->enabled)
> return;
>
> - clk_enable(timer->fclk);
> + if (unlikely(pdata->is_early_init)) {
> + clk_enable(timer->fclk);
> + timer->enabled = 1;
> + return;
> + }
If timer->fclk is not going to be used after "pdata->is_early_init" is
made zero,
you may do a clk_put( ) of the timer->fclk because pm_runtime_* APIs are
going to be used after pdata->is_early_init is made zero.
> +
> + if (pm_runtime_get_sync(&timer->pdev->dev)) {
> + dev_dbg(&timer->pdev->dev, "%s:pm_runtime_get_sync()
> FAILED\n",
> + __func__);
> + return;
> + }
>
> timer->enabled = 1;
> }
> @@ -356,10 +369,22 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_enable);
>
> void omap_dm_timer_disable(struct omap_dm_timer *timer)
> {
> + struct dmtimer_platform_data *pdata = timer->pdev->dev.platform_data;
> +
> if (!timer->enabled)
> return;
>
> - clk_disable(timer->fclk);
> + if (unlikely(pdata->is_early_init)) {
> + clk_disable(timer->fclk);
> + timer->enabled = 0;
Ditto
> + return;
> + }
> +
> + if (pm_runtime_put_sync(&timer->pdev->dev)) {
> + dev_dbg(&timer->pdev->dev, "%s:pm_runtime_put_sync()
> FAILED\n",
> + __func__);
> + return;
> + }
>
> timer->enabled = 0;
> }
<<snip>>
--
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