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>
This commit is contained in:
@@ -208,3 +208,17 @@ config APM_EMULATION
|
||||
random kernel OOPSes or reboots that don't seem to be related to
|
||||
anything, try disabling/enabling this option (or disabling/enabling
|
||||
APM in your BIOS).
|
||||
|
||||
config PM_RUNTIME
|
||||
bool "Run-time PM core functionality"
|
||||
depends on PM
|
||||
---help---
|
||||
Enable functionality allowing I/O devices to be put into energy-saving
|
||||
(low power) states at run time (or autosuspended) after a specified
|
||||
period of inactivity and woken up in response to a hardware-generated
|
||||
wake-up event or a driver's request.
|
||||
|
||||
Hardware support is generally required for this functionality to work
|
||||
and the bus type drivers of the buses the devices are on are
|
||||
responsible for the actual handling of the autosuspend requests and
|
||||
wake-up events.
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#include <linux/kobject.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/resume-trace.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
#include "power.h"
|
||||
|
||||
@@ -217,8 +218,24 @@ static struct attribute_group attr_group = {
|
||||
.attrs = g,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PM_RUNTIME
|
||||
struct workqueue_struct *pm_wq;
|
||||
|
||||
static int __init pm_start_workqueue(void)
|
||||
{
|
||||
pm_wq = create_freezeable_workqueue("pm");
|
||||
|
||||
return pm_wq ? 0 : -ENOMEM;
|
||||
}
|
||||
#else
|
||||
static inline int pm_start_workqueue(void) { return 0; }
|
||||
#endif
|
||||
|
||||
static int __init pm_init(void)
|
||||
{
|
||||
int error = pm_start_workqueue();
|
||||
if (error)
|
||||
return error;
|
||||
power_kobj = kobject_create_and_add("power", NULL);
|
||||
if (!power_kobj)
|
||||
return -ENOMEM;
|
||||
|
Reference in New Issue
Block a user