Received: from bear.ext.ti.com ([192.94.94.41]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uminx-0002hV-00 for linux-mtd@lists.infradead.org; Wed, 12 Jun 2013 11:01:31 +0000 From: Pekon Gupta To: , , Subject: [PATCH v4 3/3] mtd: devices: elm: Low power transition support Date: Wed, 12 Jun 2013 16:30:58 +0530 Message-ID: <1371034858-19984-4-git-send-email-pekon@ti.com> In-Reply-To: <1371034858-19984-1-git-send-email-pekon@ti.com> References: <1371034858-19984-1-git-send-email-pekon@ti.com> MIME-Version: 1.0 Content-Type: text/plain Cc: Pekon Gupta List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: avinash philip 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 Signed-off-by: Pekon Gupta --- 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 dccef9f..171efcd 100644 --- a/drivers/mtd/devices/elm.c +++ b/drivers/mtd/devices/elm.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -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, -- 1.8.1