Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
|
Device Power Management API. More...
Data Structures | |
struct | pm_device |
Device PM info. More... | |
Macros | |
#define | device_pm_control_nop __DEPRECATED_MACRO NULL |
Typedefs | |
typedef int(* | pm_device_control_callback_t) (const struct device *dev, enum pm_device_action action) |
Device power management control function callback. More... | |
Enumerations | |
enum | pm_device_state { PM_DEVICE_STATE_ACTIVE , PM_DEVICE_STATE_LOW_POWER , PM_DEVICE_STATE_SUSPENDED , PM_DEVICE_STATE_OFF } |
Device power states. More... | |
enum | pm_device_flag { PM_DEVICE_FLAG_BUSY , PM_DEVICE_FLAGS_WS_CAPABLE , PM_DEVICE_FLAGS_WS_ENABLED , PM_DEVICE_FLAG_TRANSITIONING , PM_DEVICE_FLAG_COUNT } |
Device PM flags. More... | |
enum | pm_device_action { PM_DEVICE_ACTION_SUSPEND , PM_DEVICE_ACTION_RESUME , PM_DEVICE_ACTION_TURN_OFF , PM_DEVICE_ACTION_FORCE_SUSPEND , PM_DEVICE_ACTION_LOW_POWER } |
Device PM actions. More... | |
Functions | |
const char * | pm_device_state_str (enum pm_device_state state) |
Get name of device PM state. More... | |
int | pm_device_state_set (const struct device *dev, enum pm_device_state state) |
Set the power state of a device. More... | |
int | pm_device_state_get (const struct device *dev, enum pm_device_state *state) |
Obtain the power state of a device. More... | |
static void | pm_device_busy_set (const struct device *dev) |
static void | pm_device_busy_clear (const struct device *dev) |
static bool | pm_device_is_any_busy (void) |
static bool | pm_device_is_busy (const struct device *dev) |
static void | device_busy_set (const struct device *dev) |
static void | device_busy_clear (const struct device *dev) |
static int | device_any_busy_check (void) |
static int | device_busy_check (const struct device *dev) |
bool | pm_device_wakeup_enable (struct device *dev, bool enable) |
Enable a power management wakeup source. More... | |
bool | pm_device_wakeup_is_enabled (const struct device *dev) |
Check if a power management wakeup source is enabled. More... | |
bool | pm_device_wakeup_is_capable (const struct device *dev) |
Check if a device is wake up capable. More... | |
Device Power Management API.
#define device_pm_control_nop __DEPRECATED_MACRO NULL |
#include <include/pm/device.h>
Alias for legacy use of device_pm_control_nop
typedef int(* pm_device_control_callback_t) (const struct device *dev, enum pm_device_action action) |
#include <include/pm/device.h>
Device power management control function callback.
dev | Device instance. |
action | Requested action. |
0 | If successful. |
-ENOTSUP | If the requested action is not supported. |
Errno | Other negative errno on failure. |
enum pm_device_action |
#include <include/pm/device.h>
Device PM actions.
Enumerator | |
---|---|
PM_DEVICE_ACTION_SUSPEND | Suspend. |
PM_DEVICE_ACTION_RESUME | Resume. |
PM_DEVICE_ACTION_TURN_OFF | Turn off. |
PM_DEVICE_ACTION_FORCE_SUSPEND | Force suspend. |
PM_DEVICE_ACTION_LOW_POWER | Low power. |
enum pm_device_flag |
#include <include/pm/device.h>
Device PM flags.
enum pm_device_state |
#include <include/pm/device.h>
Device power states.
|
inlinestatic |
#include <include/pm/device.h>
|
inlinestatic |
#include <include/pm/device.h>
#include <include/pm/device.h>
#include <include/pm/device.h>
#include <include/pm/device.h>
#include <include/pm/device.h>
#include <include/pm/device.h>
#include <include/pm/device.h>
int pm_device_state_get | ( | const struct device * | dev, |
enum pm_device_state * | state | ||
) |
#include <include/pm/device.h>
Obtain the power state of a device.
dev | Device instance. |
state | Pointer where device power state will be stored. |
0 | If successful. |
-ENOSYS | If device does not implement power management. |
int pm_device_state_set | ( | const struct device * | dev, |
enum pm_device_state | state | ||
) |
#include <include/pm/device.h>
Set the power state of a device.
This function calls the device PM control callback so that the device does the necessary operations to put the device into the given state.
dev | Device instance. |
state | Device power state to be set. |
0 | If successful. |
-ENOTSUP | If requested state is not supported. |
-EALREADY | If device is already at the requested state. |
-EBUSY | If device is changing its state. |
Errno | Other negative errno on failure. |
const char * pm_device_state_str | ( | enum pm_device_state | state | ) |
#include <include/pm/device.h>
Get name of device PM state.
state | State id which name should be returned |
#include <include/pm/device.h>
Enable a power management wakeup source.
Enable a wakeup source. This will keep the current device active when the system is suspended, allowing it to be used to wake up the system.
dev | device object to enable. |
enable | true to enable or false to disable |
true | if the wakeup source was successfully enabled. |
false | if the wakeup source was not successfully enabled. |
#include <include/pm/device.h>
Check if a device is wake up capable.
dev | device object to check. |
true | if the device is wake up capable. |
false | if the device is not wake up capable. |
#include <include/pm/device.h>
Check if a power management wakeup source is enabled.
Checks if a wake up source is enabled.
dev | device object to check. |
true | if the wakeup source is enabled. |
false | if the wakeup source is not enabled. |