Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
pm.h File Reference
#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
 

Macros

#define power_group_name   NULL
 
#define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
 
#define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
 
#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn)
 
#define UNIVERSAL_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn)
 
#define PM_EVENT_INVALID   (-1)
 
#define PM_EVENT_ON   0x0000
 
#define PM_EVENT_FREEZE   0x0001
 
#define PM_EVENT_SUSPEND   0x0002
 
#define PM_EVENT_HIBERNATE   0x0004
 
#define PM_EVENT_QUIESCE   0x0008
 
#define PM_EVENT_RESUME   0x0010
 
#define PM_EVENT_THAW   0x0020
 
#define PM_EVENT_RESTORE   0x0040
 
#define PM_EVENT_RECOVER   0x0080
 
#define PM_EVENT_USER   0x0100
 
#define PM_EVENT_REMOTE   0x0200
 
#define PM_EVENT_AUTO   0x0400
 
#define PM_EVENT_SLEEP   (PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE)
 
#define PM_EVENT_USER_SUSPEND   (PM_EVENT_USER | PM_EVENT_SUSPEND)
 
#define PM_EVENT_USER_RESUME   (PM_EVENT_USER | PM_EVENT_RESUME)
 
#define PM_EVENT_REMOTE_RESUME   (PM_EVENT_REMOTE | PM_EVENT_RESUME)
 
#define PM_EVENT_AUTO_SUSPEND   (PM_EVENT_AUTO | PM_EVENT_SUSPEND)
 
#define PM_EVENT_AUTO_RESUME   (PM_EVENT_AUTO | PM_EVENT_RESUME)
 
#define PMSG_INVALID   ((struct pm_message){ .event = PM_EVENT_INVALID, })
 
#define PMSG_ON   ((struct pm_message){ .event = PM_EVENT_ON, })
 
#define PMSG_FREEZE   ((struct pm_message){ .event = PM_EVENT_FREEZE, })
 
#define PMSG_QUIESCE   ((struct pm_message){ .event = PM_EVENT_QUIESCE, })
 
#define PMSG_SUSPEND   ((struct pm_message){ .event = PM_EVENT_SUSPEND, })
 
#define PMSG_HIBERNATE   ((struct pm_message){ .event = PM_EVENT_HIBERNATE, })
 
#define PMSG_RESUME   ((struct pm_message){ .event = PM_EVENT_RESUME, })
 
#define PMSG_THAW   ((struct pm_message){ .event = PM_EVENT_THAW, })
 
#define PMSG_RESTORE   ((struct pm_message){ .event = PM_EVENT_RESTORE, })
 
#define PMSG_RECOVER   ((struct pm_message){ .event = PM_EVENT_RECOVER, })
 
#define PMSG_USER_SUSPEND
 
#define PMSG_USER_RESUME
 
#define PMSG_REMOTE_RESUME
 
#define PMSG_AUTO_SUSPEND
 
#define PMSG_AUTO_RESUME
 
#define PMSG_IS_AUTO(msg)   (((msg).event & PM_EVENT_AUTO) != 0)
 
#define PM_EVENT_PRETHAW   PM_EVENT_QUIESCE
 
#define device_pm_lock()   do {} while (0)
 
#define device_pm_unlock()   do {} while (0)
 
#define suspend_report_result(fn, ret)   do {} while (0)
 
#define pm_generic_prepare   NULL
 
#define pm_generic_suspend   NULL
 
#define pm_generic_resume   NULL
 
#define pm_generic_freeze   NULL
 
#define pm_generic_thaw   NULL
 
#define pm_generic_restore   NULL
 
#define pm_generic_poweroff   NULL
 
#define pm_generic_complete   NULL
 

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)
 

Macro Definition Documentation

#define device_pm_lock (   void)    do {} while (0)

Definition at line 668 of file pm.h.

#define device_pm_unlock (   void)    do {} while (0)

Definition at line 669 of file pm.h.

#define PM_EVENT_AUTO   0x0400

Definition at line 403 of file pm.h.

#define PM_EVENT_AUTO_RESUME   (PM_EVENT_AUTO | PM_EVENT_RESUME)

Definition at line 410 of file pm.h.

#define PM_EVENT_AUTO_SUSPEND   (PM_EVENT_AUTO | PM_EVENT_SUSPEND)

Definition at line 409 of file pm.h.

#define PM_EVENT_FREEZE   0x0001

Definition at line 393 of file pm.h.

#define PM_EVENT_HIBERNATE   0x0004

Definition at line 395 of file pm.h.

#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.

Definition at line 391 of file pm.h.

#define PM_EVENT_ON   0x0000

Definition at line 392 of file pm.h.

#define PM_EVENT_PRETHAW   PM_EVENT_QUIESCE

Definition at line 575 of file pm.h.

#define PM_EVENT_QUIESCE   0x0008

Definition at line 396 of file pm.h.

#define PM_EVENT_RECOVER   0x0080

Definition at line 400 of file pm.h.

#define PM_EVENT_REMOTE   0x0200

Definition at line 402 of file pm.h.

#define PM_EVENT_REMOTE_RESUME   (PM_EVENT_REMOTE | PM_EVENT_RESUME)

Definition at line 408 of file pm.h.

#define PM_EVENT_RESTORE   0x0040

Definition at line 399 of file pm.h.

#define PM_EVENT_RESUME   0x0010

Definition at line 397 of file pm.h.

#define PM_EVENT_SLEEP   (PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE)

Definition at line 405 of file pm.h.

#define PM_EVENT_SUSPEND   0x0002

Definition at line 394 of file pm.h.

#define PM_EVENT_THAW   0x0020

Definition at line 398 of file pm.h.

#define PM_EVENT_USER   0x0100

Definition at line 401 of file pm.h.

#define PM_EVENT_USER_RESUME   (PM_EVENT_USER | PM_EVENT_RESUME)

Definition at line 407 of file pm.h.

#define PM_EVENT_USER_SUSPEND   (PM_EVENT_USER | PM_EVENT_SUSPEND)

Definition at line 406 of file pm.h.

#define pm_generic_complete   NULL

Definition at line 694 of file pm.h.

#define pm_generic_freeze   NULL

Definition at line 690 of file pm.h.

#define pm_generic_poweroff   NULL

Definition at line 693 of file pm.h.

#define pm_generic_prepare   NULL

Definition at line 687 of file pm.h.

#define pm_generic_restore   NULL

Definition at line 692 of file pm.h.

#define pm_generic_resume   NULL

Definition at line 689 of file pm.h.

#define pm_generic_suspend   NULL

Definition at line 688 of file pm.h.

#define pm_generic_thaw   NULL

Definition at line 691 of file pm.h.

#define PMSG_AUTO_RESUME
Value:
((struct pm_message) \
{ .event = PM_EVENT_AUTO_RESUME, })

Definition at line 430 of file pm.h.

#define PMSG_AUTO_SUSPEND
Value:
((struct pm_message) \
{ .event = PM_EVENT_AUTO_SUSPEND, })

Definition at line 428 of file pm.h.

#define PMSG_FREEZE   ((struct pm_message){ .event = PM_EVENT_FREEZE, })

Definition at line 414 of file pm.h.

#define PMSG_HIBERNATE   ((struct pm_message){ .event = PM_EVENT_HIBERNATE, })

Definition at line 417 of file pm.h.

#define PMSG_INVALID   ((struct pm_message){ .event = PM_EVENT_INVALID, })

Definition at line 412 of file pm.h.

#define PMSG_IS_AUTO (   msg)    (((msg).event & PM_EVENT_AUTO) != 0)

Definition at line 433 of file pm.h.

#define PMSG_ON   ((struct pm_message){ .event = PM_EVENT_ON, })

Definition at line 413 of file pm.h.

#define PMSG_QUIESCE   ((struct pm_message){ .event = PM_EVENT_QUIESCE, })

Definition at line 415 of file pm.h.

#define PMSG_RECOVER   ((struct pm_message){ .event = PM_EVENT_RECOVER, })

Definition at line 421 of file pm.h.

#define PMSG_REMOTE_RESUME
Value:
((struct pm_message) \
{ .event = PM_EVENT_REMOTE_RESUME, })

Definition at line 426 of file pm.h.

#define PMSG_RESTORE   ((struct pm_message){ .event = PM_EVENT_RESTORE, })

Definition at line 420 of file pm.h.

#define PMSG_RESUME   ((struct pm_message){ .event = PM_EVENT_RESUME, })

Definition at line 418 of file pm.h.

#define PMSG_SUSPEND   ((struct pm_message){ .event = PM_EVENT_SUSPEND, })

Definition at line 416 of file pm.h.

#define PMSG_THAW   ((struct pm_message){ .event = PM_EVENT_THAW, })

Definition at line 419 of file pm.h.

#define PMSG_USER_RESUME
Value:
((struct pm_message) \
{ .event = PM_EVENT_USER_RESUME, })

Definition at line 424 of file pm.h.

#define PMSG_USER_SUSPEND
Value:
((struct pm_message) \
{ .event = PM_EVENT_USER_SUSPEND, })

Definition at line 422 of file pm.h.

#define power_group_name   NULL

Definition at line 47 of file pm.h.

#define SET_RUNTIME_PM_OPS (   suspend_fn,
  resume_fn,
  idle_fn 
)

Definition at line 308 of file pm.h.

#define SET_SYSTEM_SLEEP_PM_OPS (   suspend_fn,
  resume_fn 
)

Definition at line 299 of file pm.h.

#define SIMPLE_DEV_PM_OPS (   name,
  suspend_fn,
  resume_fn 
)
Value:
const struct dev_pm_ops name = { \
SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
}

Definition at line 315 of file pm.h.

#define suspend_report_result (   fn,
  ret 
)    do {} while (0)

Definition at line 676 of file pm.h.

#define UNIVERSAL_DEV_PM_OPS (   name,
  suspend_fn,
  resume_fn,
  idle_fn 
)
Value:
const struct dev_pm_ops name = { \
SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
}

Definition at line 333 of file pm.h.

Typedef Documentation

Enumeration Type Documentation

enum dpm_order
Enumerator:
DPM_ORDER_NONE 
DPM_ORDER_DEV_AFTER_PARENT 
DPM_ORDER_PARENT_BEFORE_DEV 
DPM_ORDER_DEV_LAST 

Definition at line 698 of file pm.h.

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

Enumerator:
RPM_REQ_NONE 
RPM_REQ_IDLE 
RPM_REQ_SUSPEND 
RPM_REQ_AUTOSUSPEND 
RPM_REQ_RESUME 

Definition at line 480 of file pm.h.

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.

Enumerator:
RPM_ACTIVE 
RPM_RESUMING 
RPM_SUSPENDED 
RPM_SUSPENDING 

Definition at line 458 of file pm.h.

Function Documentation

int dev_pm_get_subsys_data ( struct device dev)

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.

Definition at line 24 of file common.c.

int dev_pm_put_subsys_data ( struct device dev)

dev_pm_put_subsys_data - Drop reference to power.subsys_data. : Device to handle.

If the reference counter of power.subsys_data is zero after dropping the reference, power.subsys_data is removed. Return 1 if that happens or 0 otherwise.

Definition at line 61 of file common.c.

void update_pm_runtime_accounting ( struct device dev)

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.

Definition at line 30 of file runtime.c.

Variable Documentation

void(* pm_idle)(void)
default

Definition at line 175 of file process.c.

void(* pm_power_off)(void)

Definition at line 46 of file process.c.

void(* pm_power_off_prepare)(void)

Definition at line 124 of file sys.c.