diff mbox

[v3,2/3] arm: gpmc: Low power transition support

Message ID 1361278219-23108-3-git-send-email-avinashphilip@ti.com
State Not Applicable
Headers show

Commit Message

Philip, Avinash Feb. 19, 2013, 12:50 p.m. UTC
With GPMC converted to platform driver recently, adds low power
transition support in driver itself.

Signed-off-by: Philip Avinash <avinashphilip@ti.com>
---
Changes since v1:
	Module disable & enable added using pm_runtime support.

 arch/arm/mach-omap2/gpmc.c |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Comments

Kevin Hilman Feb. 19, 2013, 3:27 p.m. UTC | #1
Philip Avinash <avinashphilip@ti.com> writes:

> With GPMC converted to platform driver recently, adds low power
> transition support in driver itself.
>
> Signed-off-by: Philip Avinash <avinashphilip@ti.com>
> ---
> Changes since v1:
> 	Module disable & enable added using pm_runtime support.
>
>  arch/arm/mach-omap2/gpmc.c |   20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
>
> diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
> index b1cd6c1..cc57988 100644
> --- a/arch/arm/mach-omap2/gpmc.c
> +++ b/arch/arm/mach-omap2/gpmc.c
> @@ -1361,9 +1361,29 @@ static __devexit int gpmc_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> +#ifdef CONFIG_PM

This should be CONFIG_PM_SLEEP for suspend/resume specific stuff.

> +static int gpmc_suspend(struct platform_device *pdev, pm_message_t state)
> +{
> +	omap3_gpmc_save_context();
> +	pm_runtime_put_sync(&pdev->dev);
> +	return 0;
> +}
> +
> +static int gpmc_resume(struct platform_device *pdev)
> +{
> +	pm_runtime_get_sync(&pdev->dev);
> +	omap3_gpmc_restore_context();
> +	return 0;
> +}
> +#endif
> +
>  static struct platform_driver gpmc_driver = {
>  	.probe		= gpmc_probe,
>  	.remove		= __devexit_p(gpmc_remove),
> +#ifdef CONFIG_PM
> +	.suspend	= gpmc_suspend,
> +	.resume		= gpmc_resume,
> +#endif

These are the legacy PM operations, you need to use the ones in the
drivers struct dev_pm_ops.

>  	.driver		= {
>  		.name	= DEVICE_NAME,
>  		.owner	= THIS_MODULE,

Kevin
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index b1cd6c1..cc57988 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -1361,9 +1361,29 @@  static __devexit int gpmc_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static int gpmc_suspend(struct platform_device *pdev, pm_message_t state)
+{
+	omap3_gpmc_save_context();
+	pm_runtime_put_sync(&pdev->dev);
+	return 0;
+}
+
+static int gpmc_resume(struct platform_device *pdev)
+{
+	pm_runtime_get_sync(&pdev->dev);
+	omap3_gpmc_restore_context();
+	return 0;
+}
+#endif
+
 static struct platform_driver gpmc_driver = {
 	.probe		= gpmc_probe,
 	.remove		= __devexit_p(gpmc_remove),
+#ifdef CONFIG_PM
+	.suspend	= gpmc_suspend,
+	.resume		= gpmc_resume,
+#endif
 	.driver		= {
 		.name	= DEVICE_NAME,
 		.owner	= THIS_MODULE,