linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] suspend/resume support for OMAP nand driver
@ 2013-02-19 12:50 Philip Avinash
  2013-02-19 12:50 ` [PATCH v3 1/3] arm: gpmc: Converts GPMC driver to pm_runtime capable Philip Avinash
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Philip Avinash @ 2013-02-19 12:50 UTC (permalink / raw)
  To: linux-arm-kernel

This patch series adds low power transition support for OMAP NAND driver.
With recent driver conversion of GPMC to platform_driver, pm_runtime calls
can be used to handle module enable & disable of GPMC. This is taken care
patch #1.

patch #2 is for GPMC suspend/resume support.

This includes low power transition support of
- GPMC module
- ELM module

User initiated suspend/resume sequence tested on am335x-evm with NAND
flash support. Also tested in omap3-evm for user initiated
suspend/resume sequence with NAND flash.
This patch series based on [1] and is present in [2].

1. ARM: OMAP2+: AM33XX: Add suspend-resume support
   http://comments.gmane.org/gmane.linux.ports.arm.omap/91405
2. https://github.com/avinashphilip/am335x_linux/commits/NAND_supend_resume_support

Changes Since v2:
- Remove calll back of nand_suspend from omap2 nand driver, as the same call already
  done from suspend activity mtd class driver.

Philip Avinash (3):
  arm: gpmc: Converts GPMC driver to pm_runtime capable
  arm: gpmc: Low power transition support
  mtd: devices: elm: Low power transition support

 arch/arm/mach-omap2/gpmc.c |   30 +++++++++++++++++++++---
 drivers/mtd/devices/elm.c  |   54 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 81 insertions(+), 3 deletions(-)

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v3 1/3] arm: gpmc: Converts GPMC driver to pm_runtime capable
  2013-02-19 12:50 [PATCH v3 0/3] suspend/resume support for OMAP nand driver Philip Avinash
@ 2013-02-19 12:50 ` Philip Avinash
  2013-02-19 12:50 ` [PATCH v3 2/3] arm: gpmc: Low power transition support Philip Avinash
  2013-02-19 12:50 ` [PATCH v3 3/3] mtd: devices: elm: " Philip Avinash
  2 siblings, 0 replies; 5+ messages in thread
From: Philip Avinash @ 2013-02-19 12:50 UTC (permalink / raw)
  To: linux-arm-kernel

Support for pm_runtime add to GPMC driver.

Signed-off-by: Philip Avinash <avinashphilip@ti.com>
---
 arch/arm/mach-omap2/gpmc.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 2c57f81..b1cd6c1 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -29,6 +29,7 @@
 #include <linux/of_mtd.h>
 #include <linux/of_device.h>
 #include <linux/mtd/nand.h>
+#include <linux/pm_runtime.h>
 
 #include <linux/platform_data/mtd-nand-omap2.h>
 
@@ -1317,7 +1318,8 @@ static int gpmc_probe(struct platform_device *pdev)
 		return PTR_ERR(gpmc_l3_clk);
 	}
 
-	clk_prepare_enable(gpmc_l3_clk);
+	pm_runtime_enable(&pdev->dev);
+	pm_runtime_get_sync(&pdev->dev);
 
 	gpmc_dev = &pdev->dev;
 
@@ -1329,7 +1331,7 @@ static int gpmc_probe(struct platform_device *pdev)
 
 	rc = gpmc_mem_init();
 	if (IS_ERR_VALUE(rc)) {
-		clk_disable_unprepare(gpmc_l3_clk);
+		pm_runtime_put_sync(&pdev->dev);
 		clk_put(gpmc_l3_clk);
 		dev_err(gpmc_dev, "failed to reserve memory\n");
 		return rc;
@@ -1340,7 +1342,7 @@ static int gpmc_probe(struct platform_device *pdev)
 
 	rc = gpmc_probe_dt(pdev);
 	if (rc < 0) {
-		clk_disable_unprepare(gpmc_l3_clk);
+		pm_runtime_put_sync(&pdev->dev);
 		clk_put(gpmc_l3_clk);
 		dev_err(gpmc_dev, "failed to probe DT parameters\n");
 		return rc;
@@ -1353,6 +1355,8 @@ static __devexit int gpmc_remove(struct platform_device *pdev)
 {
 	gpmc_free_irq();
 	gpmc_mem_exit();
+	pm_runtime_put_sync(&pdev->dev);
+	pm_runtime_disable(&pdev->dev);
 	gpmc_dev = NULL;
 	return 0;
 }
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 2/3] arm: gpmc: Low power transition support
  2013-02-19 12:50 [PATCH v3 0/3] suspend/resume support for OMAP nand driver Philip Avinash
  2013-02-19 12:50 ` [PATCH v3 1/3] arm: gpmc: Converts GPMC driver to pm_runtime capable Philip Avinash
@ 2013-02-19 12:50 ` Philip Avinash
  2013-02-19 15:27   ` Kevin Hilman
  2013-02-19 12:50 ` [PATCH v3 3/3] mtd: devices: elm: " Philip Avinash
  2 siblings, 1 reply; 5+ messages in thread
From: Philip Avinash @ 2013-02-19 12:50 UTC (permalink / raw)
  To: linux-arm-kernel

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
+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,
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 3/3] mtd: devices: elm: Low power transition support
  2013-02-19 12:50 [PATCH v3 0/3] suspend/resume support for OMAP nand driver Philip Avinash
  2013-02-19 12:50 ` [PATCH v3 1/3] arm: gpmc: Converts GPMC driver to pm_runtime capable Philip Avinash
  2013-02-19 12:50 ` [PATCH v3 2/3] arm: gpmc: Low power transition support Philip Avinash
@ 2013-02-19 12:50 ` Philip Avinash
  2 siblings, 0 replies; 5+ messages in thread
From: Philip Avinash @ 2013-02-19 12:50 UTC (permalink / raw)
  To: linux-arm-kernel

In low power modes of AM335X platforms, peripherals power is cut off.
This patch supports low power sleep transition support for ELM driver.

Signed-off-by: Philip Avinash <avinashphilip@ti.com>
---
Changes Since v2:
	- Removes wait queue mechanism. The order of device creation ensures
	  that nand driver got suspended well before elm module suspend.
	  Hence no need to check elm module state on suspend.

 drivers/mtd/devices/elm.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/mtd/devices/elm.c b/drivers/mtd/devices/elm.c
index f034239..a41c968 100644
--- a/drivers/mtd/devices/elm.c
+++ b/drivers/mtd/devices/elm.c
@@ -20,6 +20,7 @@
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/of.h>
+#include <linux/sched.h>
 #include <linux/pm_runtime.h>
 #include <linux/platform_data/elm.h>
 
@@ -379,6 +380,23 @@ static int elm_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static int elm_suspend(struct device *dev)
+{
+	pm_runtime_put_sync(dev);
+	return 0;
+}
+
+static int elm_resume(struct device *dev)
+{
+	struct elm_info *info = dev_get_drvdata(dev);
+
+	pm_runtime_get_sync(dev);
+	elm_config(dev, info->bch_type);
+	return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(elm_pm_ops, elm_suspend, elm_resume);
+
 #ifdef CONFIG_OF
 static const struct of_device_id elm_of_match[] = {
 	{ .compatible = "ti,am3352-elm" },
@@ -392,6 +410,7 @@ static struct platform_driver elm_driver = {
 		.name	= "elm",
 		.owner	= THIS_MODULE,
 		.of_match_table = of_match_ptr(elm_of_match),
+		.pm	= &elm_pm_ops,
 	},
 	.probe	= elm_probe,
 	.remove	= elm_remove,
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 2/3] arm: gpmc: Low power transition support
  2013-02-19 12:50 ` [PATCH v3 2/3] arm: gpmc: Low power transition support Philip Avinash
@ 2013-02-19 15:27   ` Kevin Hilman
  0 siblings, 0 replies; 5+ messages in thread
From: Kevin Hilman @ 2013-02-19 15:27 UTC (permalink / raw)
  To: linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-02-19 15:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-19 12:50 [PATCH v3 0/3] suspend/resume support for OMAP nand driver Philip Avinash
2013-02-19 12:50 ` [PATCH v3 1/3] arm: gpmc: Converts GPMC driver to pm_runtime capable Philip Avinash
2013-02-19 12:50 ` [PATCH v3 2/3] arm: gpmc: Low power transition support Philip Avinash
2013-02-19 15:27   ` Kevin Hilman
2013-02-19 12:50 ` [PATCH v3 3/3] mtd: devices: elm: " Philip Avinash

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).