[PATCH v2 2/2] mtd: m25p80: Add Power Management support
Zhiqiang Hou
Zhiqiang.Hou at freescale.com
Fri Dec 25 00:55:07 PST 2015
From: Hou Zhiqiang <Zhiqiang.Hou at freescale.com>
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou at freescale.com>
---
V2:
- Call spi_nor_suspend/resume instead of spi_nor_scan.
drivers/mtd/devices/m25p80.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index fe9ceb7..9f07f94 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -243,6 +243,26 @@ static int m25p_remove(struct spi_device *spi)
return mtd_device_unregister(&flash->spi_nor.mtd);
}
+#ifdef CONFIG_PM_SLEEP
+static int m25p_suspend(struct device *dev)
+{
+ struct m25p *flash = dev_get_drvdata(dev);
+ struct spi_nor *nor = &flash->spi_nor;
+
+ return spi_nor_suspend(nor);
+}
+
+static int m25p_resume(struct device *dev)
+{
+ struct m25p *flash = dev_get_drvdata(dev);
+ struct spi_nor *nor = &flash->spi_nor;
+
+ return spi_nor_resume(nor);
+}
+#endif /* CONFIG_PM_SLEEP */
+
+static SIMPLE_DEV_PM_OPS(m25p_pm_ops, m25p_suspend, m25p_resume);
+
/*
* Do NOT add to this array without reading the following:
*
@@ -302,6 +322,7 @@ static struct spi_driver m25p80_driver = {
.driver = {
.name = "m25p80",
.of_match_table = m25p_of_table,
+ .pm = &m25p_pm_ops,
},
.id_table = m25p_ids,
.probe = m25p_probe,
--
2.1.0.27.g96db324
More information about the linux-mtd
mailing list