All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/06] Driver Core: Runtime PM callbacks for the Platform Bus
@ 2009-07-09 15:19 Magnus Damm
  0 siblings, 0 replies; 2+ messages in thread
From: Magnus Damm @ 2009-07-09 15:19 UTC (permalink / raw)
  To: linux-sh

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 may override. Also, call
pm_runtime_enable() for the platform bus struct device.

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

 drivers/base/platform.c |   31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

--- 0001/drivers/base/platform.c
+++ work/drivers/base/platform.c	2009-06-25 18:58:56.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"
 
@@ -925,6 +926,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 -EINVAL;
+};
+
+int __weak platform_pm_runtime_resume(struct device *dev)
+{
+	return -EINVAL;
+};
+
+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,6 +965,9 @@ 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)
@@ -968,6 +996,9 @@ int __init platform_bus_init(void)
 	error = device_register(&platform_bus);
 	if (error)
 		return error;
+
+	pm_runtime_enable(&platform_bus);
+
 	error =  bus_register(&platform_bus_type);
 	if (error)
 		device_unregister(&platform_bus);

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

* [PATCH 01/06] Driver Core: Runtime PM callbacks for the Platform Bus
  2009-07-09 15:19 [PATCH 00/06][RFC] sh: Runtime PM Prototype for SuperH Mobile Magnus Damm
@ 2009-07-09 15:19 ` Magnus Damm
  0 siblings, 0 replies; 2+ messages in thread
From: Magnus Damm @ 2009-07-09 15:19 UTC (permalink / raw)
  To: linux-pm; +Cc: linux-sh, 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 may override. Also, call
pm_runtime_enable() for the platform bus struct device.

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

 drivers/base/platform.c |   31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

--- 0001/drivers/base/platform.c
+++ work/drivers/base/platform.c	2009-06-25 18:58:56.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"
 
@@ -925,6 +926,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 -EINVAL;
+};
+
+int __weak platform_pm_runtime_resume(struct device *dev)
+{
+	return -EINVAL;
+};
+
+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,6 +965,9 @@ 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)
@@ -968,6 +996,9 @@ int __init platform_bus_init(void)
 	error = device_register(&platform_bus);
 	if (error)
 		return error;
+
+	pm_runtime_enable(&platform_bus);
+
 	error =  bus_register(&platform_bus_type);
 	if (error)
 		device_unregister(&platform_bus);

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

end of thread, other threads:[~2009-07-09 15:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-09 15:19 [PATCH 01/06] Driver Core: Runtime PM callbacks for the Platform Bus Magnus Damm
  -- strict thread matches above, loose matches on Subject: below --
2009-07-09 15:19 [PATCH 00/06][RFC] sh: Runtime PM Prototype for SuperH Mobile Magnus Damm
2009-07-09 15:19 ` [PATCH 01/06] Driver Core: Runtime PM callbacks for the Platform Bus Magnus Damm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.