linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFT][PATCH 00/12] change drivers power management to use dev_pm_ops
@ 2014-02-10 16:12 Shuah Khan
  2014-02-10 16:12 ` [RFT][PATCH 01/12] arm: change locomo platform and bus " Shuah Khan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Shuah Khan @ 2014-02-10 16:12 UTC (permalink / raw)
  To: linux-arm-kernel

Change drivers to register pm ops using dev_pm_ops instead of legacy pm_ops.
.pm hooks call existing legacy suspend and resume interfaces by passing in
the right pm state. Bus drivers suspend and resume routines call .pm driver
hooks if found.

Shuah Khan (12):
  arm: change locomo platform and bus power management to use
    dev_pm_ops
  arm: change sa1111 platform and bus power management to use
    dev_pm_ops
  arm: change scoop platform power management to use dev_pm_ops
  drivers/macintosh/adb: change platform power managemnet to use
    dev_pm_ops
  mmc: change au1xmmc platform power management to use dev_pm_ops
  mmc: change bfin_sdh platform power management to use dev_pm_ops
  isa: change isa bus power managemnet to use dev_pm_ops
  mmc: change cb710-mmc platform power management to use dev_pm_ops
  mmc: change msm_sdcc platform power management to use dev_pm_ops
  mmc: change tmio_mmc platform power management to use dev_pm_ops
  drivers/pcmcia: change ds driver power management to use dev_pm_ops
  drivers/s390/crypto: change ap_bus driver power management to use
    dev_pm_ops

 arch/arm/common/locomo.c     |   93 +++++++++++++++++++++++++++++++++++-------
 arch/arm/common/sa1111.c     |   88 +++++++++++++++++++++++++++++++--------
 arch/arm/common/scoop.c      |   44 ++++++++++++++++----
 drivers/base/isa.c           |   30 ++++++++++++--
 drivers/macintosh/adb.c      |   41 ++++++++++++++++---
 drivers/mmc/host/au1xmmc.c   |   43 +++++++++++++++----
 drivers/mmc/host/bfin_sdh.c  |   40 +++++++++++++++---
 drivers/mmc/host/cb710-mmc.c |   37 +++++++++++++++--
 drivers/mmc/host/msm_sdcc.c  |   42 +++++++++++++++----
 drivers/mmc/host/tmio_mmc.c  |   42 +++++++++++++++----
 drivers/pcmcia/ds.c          |   36 +++++++++++++---
 drivers/s390/crypto/ap_bus.c |   30 ++++++++++++--
 12 files changed, 481 insertions(+), 85 deletions(-)

-- 
1.7.10.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RFT][PATCH 01/12] arm: change locomo platform and bus power management to use dev_pm_ops
  2014-02-10 16:12 [RFT][PATCH 00/12] change drivers power management to use dev_pm_ops Shuah Khan
@ 2014-02-10 16:12 ` Shuah Khan
  2014-02-10 16:12 ` [RFT][PATCH 02/12] arm: change sa1111 " Shuah Khan
  2014-02-10 16:12 ` [RFT][PATCH 03/12] arm: change scoop platform " Shuah Khan
  2 siblings, 0 replies; 4+ messages in thread
From: Shuah Khan @ 2014-02-10 16:12 UTC (permalink / raw)
  To: linux-arm-kernel

Change locomo platform and bus drivers to register pm ops using dev_pm_ops
instead of legacy pm_ops. .pm hooks call existing legacy suspend and resume
interfaces by passing in the right pm state.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
 arch/arm/common/locomo.c |   93 ++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 78 insertions(+), 15 deletions(-)

diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index b55c362..a48effb 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -272,7 +272,7 @@ struct locomo_save_data {
 	u16	LCM_SPIMD;
 };
 
-static int locomo_suspend(struct platform_device *dev, pm_message_t state)
+static int __locomo_suspend(struct platform_device *dev, pm_message_t state)
 {
 	struct locomo *lchip = platform_get_drvdata(dev);
 	struct locomo_save_data *save;
@@ -316,7 +316,22 @@ static int locomo_suspend(struct platform_device *dev, pm_message_t state)
 	return 0;
 }
 
-static int locomo_resume(struct platform_device *dev)
+static int locomo_suspend(struct device *dev)
+{
+	 return __locomo_suspend(to_platform_device(dev), PMSG_SUSPEND);
+}
+
+static int locomo_freeze(struct device *dev)
+{
+	 return __locomo_suspend(to_platform_device(dev), PMSG_FREEZE);
+}
+
+static int locomo_poweroff(struct device *dev)
+{
+	 return __locomo_suspend(to_platform_device(dev), PMSG_HIBERNATE);
+}
+
+static int __locomo_resume(struct platform_device *dev)
 {
 	struct locomo *lchip = platform_get_drvdata(dev);
 	struct locomo_save_data *save;
@@ -351,6 +366,11 @@ static int locomo_resume(struct platform_device *dev)
 
 	return 0;
 }
+
+static int locomo_resume(struct device *dev)
+{
+	 return __locomo_resume(to_platform_device(dev));
+}
 #endif
 
 
@@ -510,6 +530,18 @@ static int locomo_remove(struct platform_device *dev)
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static const struct dev_pm_ops locomo_dev_pm_ops = {
+	.suspend = locomo_suspend,
+	.resume = locomo_resume,
+	/* Hibernate hooks */
+	.freeze = locomo_freeze,
+	.thaw = locomo_resume,
+	.poweroff = locomo_poweroff,
+	.restore = locomo_resume,
+};
+#endif
+
 /*
  *	Not sure if this should be on the system bus or not yet.
  *	We really want some way to register a system device at
@@ -519,12 +551,11 @@ static int locomo_remove(struct platform_device *dev)
 static struct platform_driver locomo_device_driver = {
 	.probe		= locomo_probe,
 	.remove		= locomo_remove,
-#ifdef CONFIG_PM
-	.suspend	= locomo_suspend,
-	.resume		= locomo_resume,
-#endif
 	.driver		= {
 		.name	= "locomo",
+#ifdef CONFIG_PM
+		.pm	= &locomo_dev_pm_ops,
+#endif
 	},
 };
 
@@ -826,26 +857,45 @@ static int locomo_match(struct device *_dev, struct device_driver *_drv)
 	return dev->devid == drv->devid;
 }
 
-static int locomo_bus_suspend(struct device *dev, pm_message_t state)
+static int __locomo_bus_suspend(struct device *dev, pm_message_t state)
 {
 	struct locomo_dev *ldev = LOCOMO_DEV(dev);
 	struct locomo_driver *drv = LOCOMO_DRV(dev->driver);
-	int ret = 0;
+
+	if (drv && drv->drv.pm && drv->drv.pm->suspend)
+		return  drv->drv.pm->suspend(dev);
 
 	if (drv && drv->suspend)
-		ret = drv->suspend(ldev, state);
-	return ret;
+		return	drv->suspend(ldev, state);
+	return 0;
+}
+
+static int locomo_bus_suspend(struct device *dev)
+{
+	return	__locomo_bus_suspend(dev, PMSG_SUSPEND);
+}
+
+static int locomo_bus_freeze(struct device *dev)
+{
+	return	__locomo_bus_suspend(dev, PMSG_FREEZE);
+}
+
+static int locomo_bus_poweroff(struct device *dev)
+{
+	return	__locomo_bus_suspend(dev, PMSG_HIBERNATE);
 }
 
 static int locomo_bus_resume(struct device *dev)
 {
 	struct locomo_dev *ldev = LOCOMO_DEV(dev);
 	struct locomo_driver *drv = LOCOMO_DRV(dev->driver);
-	int ret = 0;
+
+	if (drv && drv->drv.pm && drv->drv.pm->resume)
+		return	drv->drv.pm->resume(dev);
 
 	if (drv && drv->resume)
-		ret = drv->resume(ldev);
-	return ret;
+		return	drv->resume(ldev);
+	return 0;
 }
 
 static int locomo_bus_probe(struct device *dev)
@@ -870,13 +920,26 @@ static int locomo_bus_remove(struct device *dev)
 	return ret;
 }
 
+#ifdef CONFIG_PM
+static const struct dev_pm_ops locomo_bus_dev_pm_ops = {
+	.suspend = locomo_bus_suspend,
+	.resume = locomo_bus_resume,
+	/* Hibernate hooks */
+	.freeze = locomo_bus_freeze,
+	.thaw = locomo_bus_resume,
+	.poweroff = locomo_bus_poweroff,
+	.restore = locomo_bus_resume,
+};
+#endif
+
 struct bus_type locomo_bus_type = {
 	.name		= "locomo-bus",
 	.match		= locomo_match,
 	.probe		= locomo_bus_probe,
 	.remove		= locomo_bus_remove,
-	.suspend	= locomo_bus_suspend,
-	.resume		= locomo_bus_resume,
+#ifdef CONFIG_PM
+	.pm		= &locomo_bus_dev_pm_ops,
+#endif
 };
 
 int locomo_driver_register(struct locomo_driver *driver)
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [RFT][PATCH 02/12] arm: change sa1111 platform and bus power management to use dev_pm_ops
  2014-02-10 16:12 [RFT][PATCH 00/12] change drivers power management to use dev_pm_ops Shuah Khan
  2014-02-10 16:12 ` [RFT][PATCH 01/12] arm: change locomo platform and bus " Shuah Khan
@ 2014-02-10 16:12 ` Shuah Khan
  2014-02-10 16:12 ` [RFT][PATCH 03/12] arm: change scoop platform " Shuah Khan
  2 siblings, 0 replies; 4+ messages in thread
From: Shuah Khan @ 2014-02-10 16:12 UTC (permalink / raw)
  To: linux-arm-kernel

Change sa1111 platform and bus drivers to register pm ops using dev_pm_ops
instead of legacy pm_ops. .pm hooks call existing legacy suspend and resume
interfaces by passing in the right pm state.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
 arch/arm/common/sa1111.c |   88 +++++++++++++++++++++++++++++++++++++---------
 1 file changed, 72 insertions(+), 16 deletions(-)

diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
index e57d7e5..db017b2 100644
--- a/arch/arm/common/sa1111.c
+++ b/arch/arm/common/sa1111.c
@@ -872,7 +872,7 @@ struct sa1111_save_data {
 
 #ifdef CONFIG_PM
 
-static int sa1111_suspend(struct platform_device *dev, pm_message_t state)
+static int __sa1111_suspend(struct platform_device *dev, pm_message_t state)
 {
 	struct sa1111 *sachip = platform_get_drvdata(dev);
 	struct sa1111_save_data *save;
@@ -928,6 +928,21 @@ static int sa1111_suspend(struct platform_device *dev, pm_message_t state)
 	return 0;
 }
 
+static int sa1111_suspend(struct device *dev)
+{
+	return __sa1111_suspend(to_platform_device(dev), PMSG_SUSPEND);
+}
+
+static int sa1111_freeze(struct device *dev)
+{
+	return __sa1111_suspend(to_platform_device(dev), PMSG_FREEZE);
+}
+
+static int sa1111_poweroff(struct device *dev)
+{
+	return __sa1111_suspend(to_platform_device(dev), PMSG_HIBERNATE);
+}
+
 /*
  *	sa1111_resume - Restore the SA1111 device state.
  *	@dev: device to restore
@@ -937,7 +952,7 @@ static int sa1111_suspend(struct platform_device *dev, pm_message_t state)
  *	restored by their respective drivers, and must be called
  *	via LDM after this function.
  */
-static int sa1111_resume(struct platform_device *dev)
+static int __sa1111_resume(struct platform_device *dev)
 {
 	struct sa1111 *sachip = platform_get_drvdata(dev);
 	struct sa1111_save_data *save;
@@ -1005,9 +1020,10 @@ static int sa1111_resume(struct platform_device *dev)
 	return 0;
 }
 
-#else
-#define sa1111_suspend NULL
-#define sa1111_resume  NULL
+static int sa1111_resume(struct device *dev)
+{
+	return __sa1111_resume(to_platform_device(dev));
+}
 #endif
 
 static int sa1111_probe(struct platform_device *pdev)
@@ -1041,6 +1057,18 @@ static int sa1111_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static const struct dev_pm_ops sa1111_dev_pm_ops = {
+	.suspend = sa1111_suspend,
+	.resume = sa1111_resume,
+	/* Hibernate hooks */
+	.freeze = sa1111_freeze,
+	.thaw = sa1111_resume,
+	.poweroff = sa1111_poweroff,
+	.restore = sa1111_resume,
+};
+#endif
+
 /*
  *	Not sure if this should be on the system bus or not yet.
  *	We really want some way to register a system device at
@@ -1053,11 +1081,12 @@ static int sa1111_remove(struct platform_device *pdev)
 static struct platform_driver sa1111_device_driver = {
 	.probe		= sa1111_probe,
 	.remove		= sa1111_remove,
-	.suspend	= sa1111_suspend,
-	.resume		= sa1111_resume,
 	.driver		= {
 		.name	= "sa1111",
 		.owner	= THIS_MODULE,
+#ifdef CONFIG_PM
+		.pm	= &sa1111_dev_pm_ops,
+#endif
 	},
 };
 
@@ -1297,26 +1326,44 @@ static int sa1111_match(struct device *_dev, struct device_driver *_drv)
 	return dev->devid & drv->devid;
 }
 
-static int sa1111_bus_suspend(struct device *dev, pm_message_t state)
+static int __sa1111_bus_suspend(struct device *dev, pm_message_t state)
 {
 	struct sa1111_dev *sadev = SA1111_DEV(dev);
 	struct sa1111_driver *drv = SA1111_DRV(dev->driver);
-	int ret = 0;
+
+	if (drv && drv->drv.pm && drv->drv.pm->suspend)
+		return  drv->drv.pm->suspend(dev);
 
 	if (drv && drv->suspend)
-		ret = drv->suspend(sadev, state);
-	return ret;
+		return drv->suspend(sadev, state);
+	return 0;
+}
+
+static int sa1111_bus_suspend(struct device *dev)
+{
+	return __sa1111_bus_suspend(dev, PMSG_SUSPEND);
+}
+
+static int sa1111_bus_freeze(struct device *dev)
+{
+	return __sa1111_bus_suspend(dev, PMSG_FREEZE);
+}
+
+static int sa1111_bus_poweroff(struct device *dev)
+{
+	return __sa1111_bus_suspend(dev, PMSG_HIBERNATE);
 }
 
 static int sa1111_bus_resume(struct device *dev)
 {
 	struct sa1111_dev *sadev = SA1111_DEV(dev);
 	struct sa1111_driver *drv = SA1111_DRV(dev->driver);
-	int ret = 0;
 
+	if (drv && drv->drv.pm && drv->drv.pm->resume)
+		return  drv->drv.pm->resume(dev);
 	if (drv && drv->resume)
-		ret = drv->resume(sadev);
-	return ret;
+		return drv->resume(sadev);
+	return 0;
 }
 
 static void sa1111_bus_shutdown(struct device *dev)
@@ -1349,14 +1396,23 @@ static int sa1111_bus_remove(struct device *dev)
 	return ret;
 }
 
+static const struct dev_pm_ops sa1111_bus_dev_pm_ops = {
+	.suspend = sa1111_bus_suspend,
+	.resume = sa1111_bus_resume,
+	/* Hibernate hooks */
+	.freeze = sa1111_bus_freeze,
+	.thaw = sa1111_bus_resume,
+	.poweroff = sa1111_bus_poweroff,
+	.restore = sa1111_bus_resume,
+};
+
 struct bus_type sa1111_bus_type = {
 	.name		= "sa1111-rab",
 	.match		= sa1111_match,
 	.probe		= sa1111_bus_probe,
 	.remove		= sa1111_bus_remove,
-	.suspend	= sa1111_bus_suspend,
-	.resume		= sa1111_bus_resume,
 	.shutdown	= sa1111_bus_shutdown,
+	.pm		= &sa1111_bus_dev_pm_ops,
 };
 EXPORT_SYMBOL(sa1111_bus_type);
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [RFT][PATCH 03/12] arm: change scoop platform power management to use dev_pm_ops
  2014-02-10 16:12 [RFT][PATCH 00/12] change drivers power management to use dev_pm_ops Shuah Khan
  2014-02-10 16:12 ` [RFT][PATCH 01/12] arm: change locomo platform and bus " Shuah Khan
  2014-02-10 16:12 ` [RFT][PATCH 02/12] arm: change sa1111 " Shuah Khan
@ 2014-02-10 16:12 ` Shuah Khan
  2 siblings, 0 replies; 4+ messages in thread
From: Shuah Khan @ 2014-02-10 16:12 UTC (permalink / raw)
  To: linux-arm-kernel

Change scoop platform driver to register pm ops using dev_pm_ops instead of
legacy pm_ops. .pm hooks call existing legacy suspend and resume interfaces
by passing in the right pm state.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
 arch/arm/common/scoop.c |   44 +++++++++++++++++++++++++++++++++++++-------
 1 file changed, 37 insertions(+), 7 deletions(-)

diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
index a5c3dc3..260a60b 100644
--- a/arch/arm/common/scoop.c
+++ b/arch/arm/common/scoop.c
@@ -151,7 +151,7 @@ static void check_scoop_reg(struct scoop_dev *sdev)
 		iowrite16(0x0101, sdev->base + SCOOP_MCR);
 }
 
-static int scoop_suspend(struct platform_device *dev, pm_message_t state)
+static int __scoop_suspend(struct platform_device *dev, pm_message_t state)
 {
 	struct scoop_dev *sdev = platform_get_drvdata(dev);
 
@@ -162,7 +162,22 @@ static int scoop_suspend(struct platform_device *dev, pm_message_t state)
 	return 0;
 }
 
-static int scoop_resume(struct platform_device *dev)
+static int scoop_suspend(struct device *dev)
+{
+	return __scoop_suspend(to_platform_device(dev), PMSG_SUSPEND);
+}
+
+static int scoop_freeze(struct device *dev)
+{
+	return __scoop_suspend(to_platform_device(dev), PMSG_FREEZE);
+}
+
+static int scoop_poweroff(struct device *dev)
+{
+	return __scoop_suspend(to_platform_device(dev), PMSG_HIBERNATE);
+}
+
+static int __scoop_resume(struct platform_device *dev)
 {
 	struct scoop_dev *sdev = platform_get_drvdata(dev);
 
@@ -171,9 +186,11 @@ static int scoop_resume(struct platform_device *dev)
 
 	return 0;
 }
-#else
-#define scoop_suspend	NULL
-#define scoop_resume	NULL
+
+static int scoop_resume(struct device *dev)
+{
+	return __scoop_resume(to_platform_device(dev));
+}
 #endif
 
 static int scoop_probe(struct platform_device *pdev)
@@ -266,13 +283,26 @@ static int scoop_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static const struct dev_pm_ops scoop_dev_pm_ops = {
+	.suspend = scoop_suspend,
+	.resume = scoop_resume,
+	/* Hibernate hooks */
+	.freeze = scoop_freeze,
+	.thaw = scoop_resume,
+	.poweroff = scoop_poweroff,
+	.restore = scoop_resume,
+};
+#endif
+
 static struct platform_driver scoop_driver = {
 	.probe		= scoop_probe,
 	.remove		= scoop_remove,
-	.suspend	= scoop_suspend,
-	.resume		= scoop_resume,
 	.driver		= {
 		.name	= "sharp-scoop",
+#ifdef CONFIG_PM
+		.pm	= &scoop_dev_pm_ops,
+#endif
 	},
 };
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-02-10 16:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-10 16:12 [RFT][PATCH 00/12] change drivers power management to use dev_pm_ops Shuah Khan
2014-02-10 16:12 ` [RFT][PATCH 01/12] arm: change locomo platform and bus " Shuah Khan
2014-02-10 16:12 ` [RFT][PATCH 02/12] arm: change sa1111 " Shuah Khan
2014-02-10 16:12 ` [RFT][PATCH 03/12] arm: change scoop platform " Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).