PM: Runtime PM v17 - Platform Device Bus Support
PATCH 1/1 PM: Runtime PM v17 - Platform Device Bus Support
From: Magnus Damm <[email protected]>
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.
---
Needed by the SuperH Mobile Runtime PM implementation. Depends on "PM: Introduce core framework for run-time PM of I/O devices (rev. 17)"
Changes since 20090812 (v15 -> v17):
- platform_pm_runtime_idle() now returns int
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 | 46 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 9 deletions(-)
drivers/base/platform.c +37 -9
@@ -17,6 +17,7 @@#include <linux/bootmem.h> #include <linux/err.h> #include <linux/slab.h> +#include <linux/pm_runtime.h> #include "base.h"
@@ -680,6 +681,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)
@@ -922,6 +930,31 @@ 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 ; +}; + +int __weak platform_pm_runtime_idle (struct device *dev) +{ +return -ENOSYS ; +}; + +#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,
@@ -937,22 +970,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);
Quoted 9 lines · Magnus Damm
From: Magnus Damm <[email protected]>
This patch adds default Runtime PM callbacks to the
dev_pm_opsbelonging 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 <[email protected]>
Thanks for the patch.
Greg, is it fine with you?
Rafael
Quoted 100 lines
---
Needed by the SuperH Mobile Runtime PM implementation. Depends on "PM: Introduce core framework for run-time PM of I/O devices (rev. 17)"
Changes since 20090812 (v15 -> v17):
-platform_pm_runtime_idle()now returns intChanges since 20090807:
- removedpm_runtime_enable()Changes since 20090731:
- Based on "Driver Core: Runtime PM callbacks for the Platform Bus V2"
- Reworked to handleCONFIG_PM_SLEEP=ncasedrivers/base/platform.c | 46 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 9 deletions(-)drivers/base/platform.c +37
-9@@ -17,6 +17,7 @@#include <linux/bootmem.h> #include <linux/err.h> #include <linux/slab.h> +#include <linux/pm_runtime.h> #include "base.h" @@ -680,6 +681,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)@@ -922,6 +930,31 @@ 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 ; +}; + +int __weak platform_pm_runtime_idle (struct device *dev) +{ +return -ENOSYS ; +}; + +#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,@@ -937,22 +970,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);
Greg?
Quoted 118 lines · Rafael J. Wysocki
Quoted 9 lines · Magnus Damm
From: Magnus Damm <[email protected]>
This patch adds default Runtime PM callbacks to the
dev_pm_opsbelonging 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 <[email protected]>Thanks for the patch.
Greg, is it fine with you?
Rafael
Quoted 100 lines
---
Needed by the SuperH Mobile Runtime PM implementation. Depends on "PM: Introduce core framework for run-time PM of I/O devices (rev. 17)"
Changes since 20090812 (v15 -> v17):
-platform_pm_runtime_idle()now returns intChanges since 20090807:
- removedpm_runtime_enable()Changes since 20090731:
- Based on "Driver Core: Runtime PM callbacks for the Platform Bus V2"
- Reworked to handleCONFIG_PM_SLEEP=ncasedrivers/base/platform.c | 46 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 9 deletions(-)drivers/base/platform.c +37
-9@@ -17,6 +17,7 @@#include <linux/bootmem.h> #include <linux/err.h> #include <linux/slab.h> +#include <linux/pm_runtime.h> #include "base.h" @@ -680,6 +681,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)@@ -922,6 +930,31 @@ 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 ; +}; + +int __weak platform_pm_runtime_idle (struct device *dev) +{ +return -ENOSYS ; +}; + +#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,@@ -937,22 +970,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);
Greg KH
Acked-byQuoted 1 line · Paul Mundt
Greg?
Odd, I don't see this in my inbox, sorry for the delay.
Quoted 8 lines · Rafael J. Wysocki
Quoted 7 lines · Magnus Damm
Quoted 6 lines
From: Magnus Damm <[email protected]>
This patch adds default Runtime PM callbacks to the
dev_pm_opsbelonging to the platform bus. The callbacks are weak symbols that architecture specific code can override.
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Allows Runtime PM even though
CONFIG_PM_SLEEP=n.Signed-off-by Magnus Damm <[email protected]>Thanks for the patch.
Greg, is it fine with you?
It's fine with me, Rafael, are you taking this through your tree? If so, please add:
thanks,
greg k-h
Quoted 15 lines · Greg KH
Quoted 1 line · Paul Mundt
Greg?
Odd, I don't see this in my inbox, sorry for the delay.
Quoted 10 lines · Rafael J. Wysocki
Quoted 9 lines · Magnus Damm
Quoted 8 lines
From: Magnus Damm <[email protected]>
This patch adds default Runtime PM callbacks to the
dev_pm_opsbelonging to the platform bus. The callbacks are weak symbols that architecture specific code can override.Allows Runtime PM even though
CONFIG_PM_SLEEP=n.
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Magnus Damm <[email protected]>Thanks for the patch.
Greg, is it fine with you?
It's fine with me, Rafael, are you taking this through your tree?
Yup.
Quoted 2 lines
If so, please add:
I will, thanks!
Rafael