Linux Kernel
3.7.1
|
#include <linux/list.h>
#include <linux/workqueue.h>
#include <linux/spinlock.h>
#include <linux/wait.h>
#include <linux/timer.h>
#include <linux/completion.h>
Go to the source code of this file.
Data Structures | |
struct | pm_message |
struct | dev_pm_ops |
struct | pm_domain_data |
struct | pm_subsys_data |
struct | dev_pm_info |
struct | dev_pm_domain |
Typedefs | |
typedef struct pm_message | pm_message_t |
Enumerations | |
enum | rpm_status { RPM_ACTIVE = 0, RPM_RESUMING, RPM_SUSPENDED, RPM_SUSPENDING } |
enum | rpm_request { RPM_REQ_NONE = 0, RPM_REQ_IDLE, RPM_REQ_SUSPEND, RPM_REQ_AUTOSUSPEND, RPM_REQ_RESUME } |
enum | dpm_order { DPM_ORDER_NONE, DPM_ORDER_DEV_AFTER_PARENT, DPM_ORDER_PARENT_BEFORE_DEV, DPM_ORDER_DEV_LAST } |
Functions | |
void | update_pm_runtime_accounting (struct device *dev) |
int | dev_pm_get_subsys_data (struct device *dev) |
int | dev_pm_put_subsys_data (struct device *dev) |
Variables | |
void(* | pm_idle )(void) |
void(* | pm_power_off )(void) |
void(* | pm_power_off_prepare )(void) |
#define PM_EVENT_AUTO_RESUME (PM_EVENT_AUTO | PM_EVENT_RESUME) |
#define PM_EVENT_AUTO_SUSPEND (PM_EVENT_AUTO | PM_EVENT_SUSPEND) |
#define PM_EVENT_INVALID (-1) |
PM_EVENT_ messages
The following PM_EVENT_ messages are defined for the internal use of the PM core, in order to provide a mechanism allowing the high level suspend and hibernation code to convey the necessary information to the device PM core code:
ON No transition.
FREEZE System is going to hibernate, call ->prepare() and ->freeze() for all devices.
SUSPEND System is going to suspend, call ->prepare() and ->suspend() for all devices.
HIBERNATE Hibernation image has been saved, call ->prepare() and ->poweroff() for all devices.
QUIESCE Contents of main memory are going to be restored from a (loaded) hibernation image, call ->prepare() and ->freeze() for all devices.
RESUME System is resuming, call ->resume() and ->complete() for all devices.
THAW Hibernation image has been created, call ->thaw() and ->complete() for all devices.
RESTORE Contents of main memory have been restored from a hibernation image, call ->restore() and ->complete() for all devices.
RECOVER Creation of a hibernation image or restoration of the main memory contents from a hibernation image has failed, call ->thaw() and ->complete() for all devices.
The following PM_EVENT_ messages are defined for internal use by kernel subsystems. They are never issued by the PM core.
USER_SUSPEND Manual selective suspend was issued by userspace.
USER_RESUME Manual selective resume was issued by userspace.
REMOTE_WAKEUP Remote-wakeup request was received from the device.
AUTO_SUSPEND Automatic (device idle) runtime suspend was initiated by the subsystem.
AUTO_RESUME Automatic (device needed) runtime resume was requested by a driver.
#define PM_EVENT_PRETHAW PM_EVENT_QUIESCE |
#define PM_EVENT_REMOTE_RESUME (PM_EVENT_REMOTE | PM_EVENT_RESUME) |
#define PM_EVENT_SLEEP (PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE) |
#define PM_EVENT_USER_RESUME (PM_EVENT_USER | PM_EVENT_RESUME) |
#define PM_EVENT_USER_SUSPEND (PM_EVENT_USER | PM_EVENT_SUSPEND) |
#define PMSG_AUTO_RESUME |
#define PMSG_AUTO_SUSPEND |
#define PMSG_FREEZE ((struct pm_message){ .event = PM_EVENT_FREEZE, }) |
#define PMSG_HIBERNATE ((struct pm_message){ .event = PM_EVENT_HIBERNATE, }) |
#define PMSG_INVALID ((struct pm_message){ .event = PM_EVENT_INVALID, }) |
#define PMSG_IS_AUTO | ( | msg | ) | (((msg).event & PM_EVENT_AUTO) != 0) |
#define PMSG_ON ((struct pm_message){ .event = PM_EVENT_ON, }) |
#define PMSG_QUIESCE ((struct pm_message){ .event = PM_EVENT_QUIESCE, }) |
#define PMSG_RECOVER ((struct pm_message){ .event = PM_EVENT_RECOVER, }) |
#define PMSG_REMOTE_RESUME |
#define PMSG_RESTORE ((struct pm_message){ .event = PM_EVENT_RESTORE, }) |
#define PMSG_RESUME ((struct pm_message){ .event = PM_EVENT_RESUME, }) |
#define PMSG_SUSPEND ((struct pm_message){ .event = PM_EVENT_SUSPEND, }) |
#define PMSG_THAW ((struct pm_message){ .event = PM_EVENT_THAW, }) |
#define PMSG_USER_RESUME |
#define PMSG_USER_SUSPEND |
#define SIMPLE_DEV_PM_OPS | ( | name, | |
suspend_fn, | |||
resume_fn | |||
) |
#define UNIVERSAL_DEV_PM_OPS | ( | name, | |
suspend_fn, | |||
resume_fn, | |||
idle_fn | |||
) |
typedef struct pm_message pm_message_t |
enum dpm_order |
enum rpm_request |
Device run-time power management request types.
RPM_REQ_NONE Do nothing.
RPM_REQ_IDLE Run the device bus type's ->runtime_idle() callback
RPM_REQ_SUSPEND Run the device bus type's ->runtime_suspend() callback
RPM_REQ_AUTOSUSPEND Same as RPM_REQ_SUSPEND, but not until the device has been inactive for as long as power.autosuspend_delay
RPM_REQ_RESUME Run the device bus type's ->runtime_resume() callback
enum rpm_status |
Device run-time power management status.
These status labels are used internally by the PM core to indicate the current status of a device with respect to the PM core operations. They do not reflect the actual power state of the device or its status as seen by the driver.
RPM_ACTIVE Device is fully operational. Indicates that the device bus type's ->runtime_resume() callback has completed successfully.
RPM_SUSPENDED Device bus type's ->runtime_suspend() callback has completed successfully. The device is regarded as suspended.
RPM_RESUMING Device bus type's ->runtime_resume() callback is being executed.
RPM_SUSPENDING Device bus type's ->runtime_suspend() callback is being executed.
dev_pm_get_subsys_data - Create or refcount power.subsys_data for device. : Device to handle.
If power.subsys_data is NULL, point it to a new object, otherwise increment its reference counter. Return 1 if a new object has been created, otherwise return 0 or error code.
update_pm_runtime_accounting - Update the time accounting of power states : Device to update the accounting for
In order to be able to have time accounting of the various power states (as used by programs such as PowerTOP to show the effectiveness of runtime PM), we need to track the time spent in each state. update_pm_runtime_accounting must be called each time before the runtime_status field is updated, to account the time in the old state correctly.