diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2009-08-18 17:38:32 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2009-08-22 18:04:44 -0400 |
commit | 5e928f77a09a07f9dd595bb8a489965d69a83458 (patch) | |
tree | ef53ec90fa3214fd22e36b07c11c06b09e373d8d /kernel/power | |
parent | 8400146d0dc03590bba051399e4bb7e1cbf1c010 (diff) |
PM: Introduce core framework for run-time PM of I/O devices (rev. 17)
Introduce a core framework for run-time power management of I/O
devices. Add device run-time PM fields to 'struct dev_pm_info'
and device run-time PM callbacks to 'struct dev_pm_ops'. Introduce
a run-time PM workqueue and define some device run-time PM helper
functions at the core level. Document all these things.
Special thanks to Alan Stern for his help with the design and
multiple detailed reviews of the pereceding versions of this patch
and to Magnus Damm for testing feedback.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Magnus Damm <damm@igel.co.jp>
Diffstat (limited to 'kernel/power')
-rw-r--r-- | kernel/power/Kconfig | 14 | ||||
-rw-r--r-- | kernel/power/main.c | 17 |
2 files changed, 31 insertions, 0 deletions
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig index 72067cbdb37f..91e09d3b2eb2 100644 --- a/kernel/power/Kconfig +++ b/kernel/power/Kconfig | |||
@@ -208,3 +208,17 @@ config APM_EMULATION | |||
208 | random kernel OOPSes or reboots that don't seem to be related to | 208 | random kernel OOPSes or reboots that don't seem to be related to |
209 | anything, try disabling/enabling this option (or disabling/enabling | 209 | anything, try disabling/enabling this option (or disabling/enabling |
210 | APM in your BIOS). | 210 | APM in your BIOS). |
211 | |||
212 | config PM_RUNTIME | ||
213 | bool "Run-time PM core functionality" | ||
214 | depends on PM | ||
215 | ---help--- | ||
216 | Enable functionality allowing I/O devices to be put into energy-saving | ||
217 | (low power) states at run time (or autosuspended) after a specified | ||
218 | period of inactivity and woken up in response to a hardware-generated | ||
219 | wake-up event or a driver's request. | ||
220 | |||
221 | Hardware support is generally required for this functionality to work | ||
222 | and the bus type drivers of the buses the devices are on are | ||
223 | responsible for the actual handling of the autosuspend requests and | ||
224 | wake-up events. | ||
diff --git a/kernel/power/main.c b/kernel/power/main.c index f710e36930cc..347d2cc88cd0 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/kobject.h> | 11 | #include <linux/kobject.h> |
12 | #include <linux/string.h> | 12 | #include <linux/string.h> |
13 | #include <linux/resume-trace.h> | 13 | #include <linux/resume-trace.h> |
14 | #include <linux/workqueue.h> | ||
14 | 15 | ||
15 | #include "power.h" | 16 | #include "power.h" |
16 | 17 | ||
@@ -217,8 +218,24 @@ static struct attribute_group attr_group = { | |||
217 | .attrs = g, | 218 | .attrs = g, |
218 | }; | 219 | }; |
219 | 220 | ||
221 | #ifdef CONFIG_PM_RUNTIME | ||
222 | struct workqueue_struct *pm_wq; | ||
223 | |||
224 | static int __init pm_start_workqueue(void) | ||
225 | { | ||
226 | pm_wq = create_freezeable_workqueue("pm"); | ||
227 | |||
228 | return pm_wq ? 0 : -ENOMEM; | ||
229 | } | ||
230 | #else | ||
231 | static inline int pm_start_workqueue(void) { return 0; } | ||
232 | #endif | ||
233 | |||
220 | static int __init pm_init(void) | 234 | static int __init pm_init(void) |
221 | { | 235 | { |
236 | int error = pm_start_workqueue(); | ||
237 | if (error) | ||
238 | return error; | ||
222 | power_kobj = kobject_create_and_add("power", NULL); | 239 | power_kobj = kobject_create_and_add("power", NULL); |
223 | if (!power_kobj) | 240 | if (!power_kobj) |
224 | return -ENOMEM; | 241 | return -ENOMEM; |