Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
runtime.c File Reference
#include <linux/sched.h>
#include <linux/export.h>
#include <linux/pm_runtime.h>
#include <trace/events/rpm.h>
#include "power.h"

Go to the source code of this file.

Functions

void update_pm_runtime_accounting (struct device *dev)
 
unsigned long pm_runtime_autosuspend_expiration (struct device *dev)
 
 EXPORT_SYMBOL_GPL (pm_runtime_autosuspend_expiration)
 
int pm_schedule_suspend (struct device *dev, unsigned int delay)
 
 EXPORT_SYMBOL_GPL (pm_schedule_suspend)
 
int __pm_runtime_idle (struct device *dev, int rpmflags)
 
 EXPORT_SYMBOL_GPL (__pm_runtime_idle)
 
int __pm_runtime_suspend (struct device *dev, int rpmflags)
 
 EXPORT_SYMBOL_GPL (__pm_runtime_suspend)
 
int __pm_runtime_resume (struct device *dev, int rpmflags)
 
 EXPORT_SYMBOL_GPL (__pm_runtime_resume)
 
int __pm_runtime_set_status (struct device *dev, unsigned int status)
 
 EXPORT_SYMBOL_GPL (__pm_runtime_set_status)
 
int pm_runtime_barrier (struct device *dev)
 
 EXPORT_SYMBOL_GPL (pm_runtime_barrier)
 
void __pm_runtime_disable (struct device *dev, bool check_resume)
 
 EXPORT_SYMBOL_GPL (__pm_runtime_disable)
 
void pm_runtime_enable (struct device *dev)
 
 EXPORT_SYMBOL_GPL (pm_runtime_enable)
 
void pm_runtime_forbid (struct device *dev)
 
 EXPORT_SYMBOL_GPL (pm_runtime_forbid)
 
void pm_runtime_allow (struct device *dev)
 
 EXPORT_SYMBOL_GPL (pm_runtime_allow)
 
void pm_runtime_no_callbacks (struct device *dev)
 
 EXPORT_SYMBOL_GPL (pm_runtime_no_callbacks)
 
void pm_runtime_irq_safe (struct device *dev)
 
 EXPORT_SYMBOL_GPL (pm_runtime_irq_safe)
 
void pm_runtime_set_autosuspend_delay (struct device *dev, int delay)
 
 EXPORT_SYMBOL_GPL (pm_runtime_set_autosuspend_delay)
 
void __pm_runtime_use_autosuspend (struct device *dev, bool use)
 
 EXPORT_SYMBOL_GPL (__pm_runtime_use_autosuspend)
 
void pm_runtime_init (struct device *dev)
 
void pm_runtime_remove (struct device *dev)
 

Function Documentation

void __pm_runtime_disable ( struct device dev,
bool  check_resume 
)

__pm_runtime_disable - Disable runtime PM of a device. : Device to handle. : If set, check if there's a resume request for the device.

Increment power.disable_depth for the device and if was zero previously, cancel all pending runtime PM requests for the device and wait for all operations in progress to complete. The device can be either active or suspended after its runtime PM has been disabled.

If is set and there's a resume request pending when __pm_runtime_disable() is called and power.disable_depth is zero, the function will wake up the device before disabling its runtime PM.

Definition at line 1056 of file runtime.c.

int __pm_runtime_idle ( struct device dev,
int  rpmflags 
)

__pm_runtime_idle - Entry point for runtime idle operations. : Device to send idle notification for. : Flag bits.

If the RPM_GET_PUT flag is set, decrement the device's usage count and return immediately if it is larger than zero. Then carry out an idle notification, either synchronous or asynchronous.

This routine may be called in atomic context if the RPM_ASYNC flag is set, or if pm_runtime_irq_safe() has been called.

Definition at line 799 of file runtime.c.

int __pm_runtime_resume ( struct device dev,
int  rpmflags 
)

__pm_runtime_resume - Entry point for runtime resume operations. : Device to resume. : Flag bits.

If the RPM_GET_PUT flag is set, increment the device's usage count. Then carry out a resume, either synchronous or asynchronous.

This routine may be called in atomic context if the RPM_ASYNC flag is set, or if pm_runtime_irq_safe() has been called.

Definition at line 862 of file runtime.c.

int __pm_runtime_set_status ( struct device dev,
unsigned int  status 
)

__pm_runtime_set_status - Set runtime PM status of a device. : Device to handle. : New runtime PM status of the device.

If runtime PM of the device is disabled or its power.runtime_error field is different from zero, the status may be changed either to RPM_ACTIVE, or to RPM_SUSPENDED, as long as that reflects the actual state of the device. However, if the device has a parent and the parent is not active, and the parent's power.ignore_children flag is unset, the device's status cannot be set to RPM_ACTIVE, so -EBUSY is returned in that case.

If successful, __pm_runtime_set_status() clears the power.runtime_error field and the device parent's counter of unsuspended children is modified to reflect the new status. If the new status is RPM_SUSPENDED, an idle notification request for the parent is submitted.

Definition at line 897 of file runtime.c.

int __pm_runtime_suspend ( struct device dev,
int  rpmflags 
)

__pm_runtime_suspend - Entry point for runtime put/suspend operations. : Device to suspend. : Flag bits.

If the RPM_GET_PUT flag is set, decrement the device's usage count and return immediately if it is larger than zero. Then carry out a suspend, either synchronous or asynchronous.

This routine may be called in atomic context if the RPM_ASYNC flag is set, or if pm_runtime_irq_safe() has been called.

Definition at line 831 of file runtime.c.

void __pm_runtime_use_autosuspend ( struct device dev,
bool  use 
)

__pm_runtime_use_autosuspend - Set a device's use_autosuspend flag. : Device to handle. : New value for use_autosuspend.

Set the device's power.use_autosuspend flag, and allow or prevent runtime suspends as needed.

Definition at line 1260 of file runtime.c.

EXPORT_SYMBOL_GPL ( pm_runtime_autosuspend_expiration  )
EXPORT_SYMBOL_GPL ( pm_schedule_suspend  )
EXPORT_SYMBOL_GPL ( __pm_runtime_idle  )
EXPORT_SYMBOL_GPL ( __pm_runtime_suspend  )
EXPORT_SYMBOL_GPL ( __pm_runtime_resume  )
EXPORT_SYMBOL_GPL ( __pm_runtime_set_status  )
EXPORT_SYMBOL_GPL ( pm_runtime_barrier  )
EXPORT_SYMBOL_GPL ( __pm_runtime_disable  )
EXPORT_SYMBOL_GPL ( pm_runtime_enable  )
EXPORT_SYMBOL_GPL ( pm_runtime_forbid  )
EXPORT_SYMBOL_GPL ( pm_runtime_allow  )
EXPORT_SYMBOL_GPL ( pm_runtime_no_callbacks  )
EXPORT_SYMBOL_GPL ( pm_runtime_irq_safe  )
EXPORT_SYMBOL_GPL ( pm_runtime_set_autosuspend_delay  )
EXPORT_SYMBOL_GPL ( __pm_runtime_use_autosuspend  )
void pm_runtime_allow ( struct device dev)

pm_runtime_allow - Unblock runtime PM of a device. : Device to handle.

Decrease the device's usage count and set its power.runtime_auto flag.

Definition at line 1139 of file runtime.c.

unsigned long pm_runtime_autosuspend_expiration ( struct device dev)

Definition at line 92 of file runtime.c.

int pm_runtime_barrier ( struct device dev)

pm_runtime_barrier - Flush pending requests and wait for completions. : Device to handle.

Prevent the device from being suspended by incrementing its usage counter and if there's a pending resume request for the device, wake the device up. Next, make sure that all pending requests for the device have been flushed from pm_wq and wait for all runtime PM operations involving the device in progress to complete.

Return value: 1, if there was a resume request pending and the device had to be woken up, 0, otherwise

Definition at line 1020 of file runtime.c.

void pm_runtime_enable ( struct device dev)

pm_runtime_enable - Enable runtime PM of a device. : Device to handle.

Definition at line 1095 of file runtime.c.

void pm_runtime_forbid ( struct device dev)

pm_runtime_forbid - Block runtime PM of a device. : Device to handle.

Increase the device's usage count and clear its power.runtime_auto flag, so that it cannot be suspended at run time until pm_runtime_allow() is called for it.

Definition at line 1118 of file runtime.c.

void pm_runtime_init ( struct device dev)

pm_runtime_init - Initialize runtime PM fields in given device object. : Device object to initialize.

Definition at line 1277 of file runtime.c.

void pm_runtime_irq_safe ( struct device dev)

pm_runtime_irq_safe - Leave interrupts disabled during callbacks. : Device to handle

Set the power.irq_safe flag, which tells the PM core that the ->runtime_suspend() and ->runtime_resume() callbacks for this device should always be invoked with the spinlock held and interrupts disabled. It also causes the parent's usage counter to be permanently incremented, preventing the parent from runtime suspending – otherwise an irq-safe child might have to wait for a non-irq-safe parent.

Definition at line 1183 of file runtime.c.

void pm_runtime_no_callbacks ( struct device dev)

pm_runtime_no_callbacks - Ignore runtime PM callbacks for a device. : Device to handle.

Set the power.no_callbacks flag, which tells the PM core that this device is power-managed through its parent and has no runtime PM callbacks of its own. The runtime sysfs attributes will be removed.

Definition at line 1162 of file runtime.c.

void pm_runtime_remove ( struct device dev)

pm_runtime_remove - Prepare for removing a device from device hierarchy. : Device object being removed from device hierarchy.

Definition at line 1308 of file runtime.c.

void pm_runtime_set_autosuspend_delay ( struct device dev,
int  delay 
)

pm_runtime_set_autosuspend_delay - Set a device's autosuspend_delay value. : Device to handle. : Value of the new delay in milliseconds.

Set the device's power.autosuspend_delay value. If it changes to negative and the power.use_autosuspend flag is set, prevent runtime suspends. If it changes the other way, allow runtime suspends.

Definition at line 1239 of file runtime.c.

int pm_schedule_suspend ( struct device dev,
unsigned int  delay 
)

pm_schedule_suspend - Set up a timer to submit a suspend request in future. : Device to suspend. : Time to wait before submitting a suspend request, in milliseconds.

Definition at line 756 of file runtime.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.