[PATCHv3 2/2] mtd: m25p80: Add Power Management support
Zhiqiang Hou
Zhiqiang.Hou at freescale.com
Fri Jan 22 01:14:27 PST 2016
From: Hou Zhiqiang <Zhiqiang.Hou at freescale.com>
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou at freescale.com>
---
V3:
- No change.
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 c9c3b7f..016fe94 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -224,6 +224,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:
*
@@ -290,6 +310,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