[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130114071034.GB21994@avionic-0098.adnet.avionic-design.de>
Date: Mon, 14 Jan 2013 08:10:34 +0100
From: Thierry Reding <thierry.reding@...onic-design.de>
To: Philip Avinash <avinashphilip@...com>
Cc: linux-kernel@...r.kernel.org, linux-omap@...r.kernel.org,
nsekhar@...com, gururaja.hebbar@...com
Subject: Re: [PATCH 2/2] pwm: pwm-tiecap: Low power sleep support
On Thu, Jan 10, 2013 at 06:33:44PM +0530, Philip Avinash wrote:
> In low power modes of AM33XX platforms, peripherals power is cut off.
> This patch supports low power sleep transition support for ECAP driver.
>
> Signed-off-by: Philip Avinash <avinashphilip@...com>
> ---
> drivers/pwm/pwm-tiecap.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 44 insertions(+)
>
> diff --git a/drivers/pwm/pwm-tiecap.c b/drivers/pwm/pwm-tiecap.c
> index 5cf016d..9dde1fe 100644
> --- a/drivers/pwm/pwm-tiecap.c
> +++ b/drivers/pwm/pwm-tiecap.c
> @@ -41,10 +41,17 @@
> #define ECCTL2_SYNC_SEL_DISA (BIT(7) | BIT(6))
> #define ECCTL2_TSCTR_FREERUN BIT(4)
>
> +struct ecap_regs {
> + u32 cap3;
> + u32 cap4;
> + u16 ecctl2;
> +};
Perhaps name this ecap_context for consistency with the EHRPWM driver?
> +void ecap_pwm_save_reg(struct ecap_pwm_chip *pc)
> +{
> + pm_runtime_get_sync(pc->chip.dev);
> + pc->ctx.ecctl2 = readw(pc->mmio_base + ECCTL2);
> + pc->ctx.cap4 = readl(pc->mmio_base + CAP4);
> + pc->ctx.cap3 = readl(pc->mmio_base + CAP3);
> + pm_runtime_put_sync(pc->chip.dev);
> +}
> +
> +void ecap_pwm_restore_reg(struct ecap_pwm_chip *pc)
> +{
> + writel(pc->ctx.cap3, pc->mmio_base + CAP3);
> + writel(pc->ctx.cap4, pc->mmio_base + CAP4);
> + writew(pc->ctx.ecctl2, pc->mmio_base + ECCTL2);
> +}
Then rename these ecap_pwm_{save,restore}_context()?
> +static int ecap_pwm_suspend(struct device *dev)
> +{
> + struct ecap_pwm_chip *pc = dev_get_drvdata(dev);
> +
> + ecap_pwm_save_reg(pc);
> + pm_runtime_put_sync(dev);
> + return 0;
> +}
> +
> +static int ecap_pwm_resume(struct device *dev)
> +{
> + struct ecap_pwm_chip *pc = dev_get_drvdata(dev);
> +
> + pm_runtime_get_sync(dev);
> + ecap_pwm_restore_reg(pc);
> + return 0;
> +}
Same comment as for the EHRPWM driver applies here.
Thierry
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists