public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/01] PM: Runtime PM v15 for Platform Devices 20090812
@ 2009-08-12 10:08 Magnus Damm
  2009-08-12 10:09 ` [PATCH 01/01] PM: Runtime PM v15 - Platform Device Bus Support Magnus Damm
  0 siblings, 1 reply; 2+ messages in thread
From: Magnus Damm @ 2009-08-12 10:08 UTC (permalink / raw)
  To: linux-pm; +Cc: gregkh

PM: Runtime PM v15 for Platform Devices 20090812

[PATCH 01/01] PM: Runtime PM v15 - Platform Device Bus Support

This is the only remaining patch needed to allow architecture code
to implement Runtime PM of platform devices. Should be applied on top of: 
"PM: Introduce core framework for run-time PM of I/O devices (rev. 15)"
by Rafael J. Wysocki.

This patch is needed by the SuperH Mobile Runtime PM implementation.
Please let me know if you want me to rework the patch somehow. Thanks!

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 drivers/base/platform.c |   45 ++++++++++++++++++++++++++++++++++++---------
 1 file changed, 36 insertions(+), 9 deletions(-)

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

* [PATCH 01/01] PM: Runtime PM v15 - Platform Device Bus Support
  2009-08-12 10:08 [PATCH 00/01] PM: Runtime PM v15 for Platform Devices 20090812 Magnus Damm
@ 2009-08-12 10:09 ` Magnus Damm
  0 siblings, 0 replies; 2+ messages in thread
From: Magnus Damm @ 2009-08-12 10:09 UTC (permalink / raw)
  To: linux-pm; +Cc: gregkh

From: Magnus Damm <damm@igel.co.jp>

This patch adds default Runtime PM callbacks to the dev_pm_ops
belonging to the platform bus. The callbacks are weak symbols
that architecture specific code can override.

Allows Runtime PM even though CONFIG_PM_SLEEP=n.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 Needed by the SuperH Mobile Runtime PM implementation. Depends on
 "PM: Introduce core framework for run-time PM of I/O devices (rev. 15)"

 Changes since 20090807:
 - removed pm_runtime_enable()

 Changes since 20090731:
 - Based on "Driver Core: Runtime PM callbacks for the Platform Bus V2"
 - Reworked to handle CONFIG_PM_SLEEP=n case

 drivers/base/platform.c |   45 ++++++++++++++++++++++++++++++++++++---------
 1 file changed, 36 insertions(+), 9 deletions(-)

--- 0001/drivers/base/platform.c
+++ work/drivers/base/platform.c	2009-08-11 14:35:47.000000000 +0900
@@ -17,6 +17,7 @@
 #include <linux/bootmem.h>
 #include <linux/err.h>
 #include <linux/slab.h>
+#include <linux/pm_runtime.h>
 
 #include "base.h"
 
@@ -683,6 +684,13 @@ static void platform_pm_complete(struct 
 		drv->pm->complete(dev);
 }
 
+#else /* !CONFIG_PM_SLEEP */
+
+#define platform_pm_prepare		NULL
+#define platform_pm_complete		NULL
+
+#endif /* !CONFIG_PM_SLEEP */
+
 #ifdef CONFIG_SUSPEND
 
 static int platform_pm_suspend(struct device *dev)
@@ -925,6 +933,30 @@ static int platform_pm_restore_noirq(str
 
 #endif /* !CONFIG_HIBERNATION */
 
+#ifdef CONFIG_PM_RUNTIME
+
+int __weak platform_pm_runtime_suspend(struct device *dev)
+{
+	return -ENOSYS;
+};
+
+int __weak platform_pm_runtime_resume(struct device *dev)
+{
+	return -ENOSYS;
+};
+
+void __weak platform_pm_runtime_idle(struct device *dev)
+{
+};
+
+#else /* !CONFIG_PM_RUNTIME */
+
+#define platform_pm_runtime_suspend NULL
+#define platform_pm_runtime_resume NULL
+#define platform_pm_runtime_idle NULL
+
+#endif /* !CONFIG_PM_RUNTIME */
+
 static struct dev_pm_ops platform_dev_pm_ops = {
 	.prepare = platform_pm_prepare,
 	.complete = platform_pm_complete,
@@ -940,22 +972,17 @@ static struct dev_pm_ops platform_dev_pm
 	.thaw_noirq = platform_pm_thaw_noirq,
 	.poweroff_noirq = platform_pm_poweroff_noirq,
 	.restore_noirq = platform_pm_restore_noirq,
+	.runtime_suspend = platform_pm_runtime_suspend,
+	.runtime_resume = platform_pm_runtime_resume,
+	.runtime_idle = platform_pm_runtime_idle,
 };
 
-#define PLATFORM_PM_OPS_PTR	(&platform_dev_pm_ops)
-
-#else /* !CONFIG_PM_SLEEP */
-
-#define PLATFORM_PM_OPS_PTR	NULL
-
-#endif /* !CONFIG_PM_SLEEP */
-
 struct bus_type platform_bus_type = {
 	.name		= "platform",
 	.dev_attrs	= platform_dev_attrs,
 	.match		= platform_match,
 	.uevent		= platform_uevent,
-	.pm		= PLATFORM_PM_OPS_PTR,
+	.pm		= &platform_dev_pm_ops,
 };
 EXPORT_SYMBOL_GPL(platform_bus_type);
 

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

end of thread, other threads:[~2009-08-12 10:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-12 10:08 [PATCH 00/01] PM: Runtime PM v15 for Platform Devices 20090812 Magnus Damm
2009-08-12 10:09 ` [PATCH 01/01] PM: Runtime PM v15 - Platform Device Bus Support Magnus Damm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox