suspend/resume support for OMAP nand driver
Subsystems (6)
v4 cover suspend/resume support for OMAP nand driver
This patch series adds low power transition support for OMAP NAND driver. [Patch 1/3]: Adds pm_runtime calls to handle GPMC module probe and remove [Patch 2/3]: Adds GPMC suspend/resume support.
[Patch 3/3]: Adds ELM suspend/resume support.
Tested on am335x-evm with NAND flash support, using following:
echo devices > /sys/power/pm_test
echo mem > /sys/power/state
echo core > /sys/power/pm_test
echo mem > /sys/power/state
Changes Since v3:
- CONFIG_PM -> CONFIG_PM_SLEEP
- using struct dev_pm_ops via driver->pm, instead of struct platform_driver
- rebased to 3.10-rc5
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.
[1] http://comments.gmane.org/gmane.linux.ports.arm.omap/91405
avinash philip (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 | 27 +++++++++++++++++++++++++-- drivers/mtd/devices/elm.c | 19 +++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-)
Signature · 1 line
1.8.1
PATCH v4 1/3 arm: gpmc: Converts GPMC driver to pm_runtime capable
From: avinash philip <[email protected]>
Support for pm_runtime add to GPMC driver.
--- arch/arm/mach-omap2/gpmc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/gpmc.c +6 -2
@@ -30,6 +30,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>
@@ -1594,7 +1595,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;
@@ -1634,7 +1636,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;
@@ -1647,6 +1649,8 @@ static 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 ; }
Signature · 1 line
1.8.1
PATCH v4 2/3 arm: gpmc: Low power transition support
In reply to Pekon GuptaFrom: avinash philip <[email protected]>
With GPMC converted to platform driver recently, adds low power transition support in driver itself.
--- arch/arm/mach-omap2/gpmc.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
arch/arm/mach-omap2/gpmc.c +19 -0
@@ -1655,6 +1655,24 @@ static int gpmc_remove(struct platform_device *pdev)return 0 ; } +#ifdef CONFIG_PM_SLEEP +static int gpmc_suspend (struct device *dev) +{ +omap3_gpmc_save_context (); +pm_runtime_put_sync (dev); +return 0 ; +} + +static int gpmc_resume (struct device *dev) +{ +pm_runtime_get_sync (dev); +omap3_gpmc_restore_context (); +return 0 ; +} +#endif + +static SIMPLE_DEV_PM_OPS(gpmc_pm_ops, gpmc_suspend, gpmc_resume); +static struct platform_driver gpmc_driver = { .probe = gpmc_probe, .remove = gpmc_remove,
@@ -1662,6 +1680,7 @@ static struct platform_driver gpmc_driver = { .name = DEVICE_NAME, .owner = THIS_MODULE, .of_match_table = of_match_ptr(gpmc_dt_ids), + .pm = &gpmc_pm_ops, }, };
Signature · 1 line
1.8.1
PATCH v4 3/3 mtd: devices: elm: Low power transition support
In reply to Pekon GuptaFrom: avinash philip <[email protected]>
In low power modes of AM335X platforms, peripherals power is cut off. This patch supports low power sleep transition support for ELM driver.
--- drivers/mtd/devices/elm.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/mtd/devices/elm.c +19 -0
@@ -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>
@@ -385,6 +386,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" },
@@ -398,6 +416,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,
Signature · 1 line
1.8.1
Re: [v4 2/3] arm: gpmc: Low power transition support
In reply to Pekon GuptaQuoted 4 lines · Pekon Gupta
From: avinash philip <[email protected]>
With GPMC converted to platform driver recently, adds low power transition support in driver itself.
The subject/changelog should be clear that this is support for suspend/resume.
Kevin
Re: [v4 3/3] mtd: devices: elm: Low power transition support
In reply to Pekon GuptaQuoted 4 lines · Pekon Gupta
From: avinash philip <[email protected]>
In low power modes of AM335X platforms, peripherals power is cut off. This patch supports low power sleep transition support for ELM driver.
This series needs a bit more description about what "low power sleep transition" is, and how adding runtime PM calls makes this transition happen.
Kevin
Quoted 50 lines
Signed-off-by Philip Avinash <[email protected]>Signed-off-by Pekon Gupta <[email protected]>--- drivers/mtd/devices/elm.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)drivers/mtd/devices/elm.c +19
-0@@ -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> @@ -385,6 +386,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" },@@ -398,6 +416,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,