[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1398938214-17847-13-git-send-email-lee.jones@linaro.org>
Date: Thu, 1 May 2014 10:56:19 +0100
From: Lee Jones <lee.jones@...aro.org>
To: linux-kernel@...r.kernel.org
Cc: computersforpeace@...il.com, linux-mtd@...ts.infradead.org,
kernel@...inux.com, Lee Jones <lee.jones@...aro.org>
Subject: [PATCH 12/47] mtd: nand: stm_nand_bch: add Power Management
Populate the standard PM call-backs for; suspend, resume and restore.
Signed-off-by: Lee Jones <lee.jones@...aro.org>
---
drivers/mtd/nand/stm_nand_bch.c | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/drivers/mtd/nand/stm_nand_bch.c b/drivers/mtd/nand/stm_nand_bch.c
index 0c6aad2..8a63c4a 100644
--- a/drivers/mtd/nand/stm_nand_bch.c
+++ b/drivers/mtd/nand/stm_nand_bch.c
@@ -568,12 +568,51 @@ static int stm_nand_bch_remove(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_PM
+static int stm_nand_bch_suspend(struct device *dev)
+{
+ struct nandi_controller *nandi = dev_get_drvdata(dev);
+
+ nandi_clk_disable(nandi);
+
+ return 0;
+}
+static int stm_nand_bch_resume(struct device *dev)
+{
+ struct nandi_controller *nandi = dev_get_drvdata(dev);
+
+ nandi_clk_enable(nandi);
+
+ return 0;
+}
+
+static int stm_nand_bch_restore(struct device *dev)
+{
+ struct nandi_controller *nandi = dev_get_drvdata(dev);
+ struct stm_plat_nand_bch_data *pdata = dev->platform_data;
+ struct stm_nand_bank_data *bank = pdata->bank;
+
+ nandi_init_controller(nandi, bank->csn);
+
+ return 0;
+}
+
+static const struct dev_pm_ops stm_nand_bch_pm_ops = {
+ .suspend = stm_nand_bch_suspend,
+ .resume = stm_nand_bch_resume,
+ .restore = stm_nand_bch_restore,
+};
+#else
+static const struct dev_pm_ops stm_nand_bch_pm_ops;
+#endif
+
static struct platform_driver stm_nand_bch_driver = {
.probe = stm_nand_bch_probe ,
.remove = stm_nand_bch_remove,
.driver = {
.name = "stm-nand-bch",
.owner = THIS_MODULE,
+ .pm = &stm_nand_bch_pm_ops,
},
};
module_platform_driver(stm_nand_bch_driver);
--
1.8.3.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists