Zephyr API Documentation 4.2.99
A Scalable Open Source RTOS
|
System Power Management States. More...
Data Structures | |
struct | pm_state_info |
Information about a power management state. More... | |
struct | pm_state_constraint |
Information needed to be able to reference a power state as a constraint on some device or system functions. More... | |
struct | pm_state_constraints |
Collection of multiple power state constraints. More... |
Macros | |
#define | PM_STATE_INFO_DT_INIT(node_id) |
Initializer for struct pm_state_info given a DT node identifier with zephyr,power-state compatible. | |
#define | PM_STATE_DT_INIT(node_id) |
Initializer for enum pm_state given a DT node identifier with zephyr,power-state compatible. | |
#define | DT_NUM_CPU_POWER_STATES(node_id) |
Obtain number of CPU power states supported and enabled by the given CPU node identifier. | |
#define | PM_STATE_INFO_LIST_FROM_DT_CPU(node_id) |
Initialize an array of struct pm_state_info with information from all the states present and enabled in the given CPU node identifier. | |
#define | PM_STATE_LIST_FROM_DT_CPU(node_id) |
Initialize an array of struct pm_state with information from all the states present and enabled in the given CPU node identifier. | |
#define | PM_STATE_CONSTRAINT_INIT(node_id) |
initialize a device pm constraint with information from devicetree. | |
#define | PM_STATE_CONSTRAINTS_LIST_DEFINE(node_id, prop) |
Define a list of power state constraints from devicetree. | |
#define | PM_STATE_CONSTRAINTS_GET(node_id, prop) |
Get power state constraints structure from devicetree. |
Enumerations | |
enum | pm_state { PM_STATE_ACTIVE , PM_STATE_RUNTIME_IDLE , PM_STATE_SUSPEND_TO_IDLE , PM_STATE_STANDBY , PM_STATE_SUSPEND_TO_RAM , PM_STATE_SUSPEND_TO_DISK , PM_STATE_SOFT_OFF , PM_STATE_COUNT } |
Power management state. More... |
Functions | |
uint8_t | pm_state_cpu_get_all (uint8_t cpu, const struct pm_state_info **states) |
Obtain information about all supported states by a CPU. | |
const struct pm_state_info * | pm_state_get (uint8_t cpu, enum pm_state state, uint8_t substate_id) |
Get power state structure. | |
const char * | pm_state_to_str (enum pm_state state) |
Convert a pm_state enum value to its string representation. | |
int | pm_state_from_str (const char *name, enum pm_state *out) |
Parse a string and convert it to a pm_state enum value. | |
bool | pm_state_in_constraints (const struct pm_state_constraints *constraints, const struct pm_state_constraint match) |
Check if a power management constraint matches any in a set of constraints. |
System Power Management States.
#define DT_NUM_CPU_POWER_STATES | ( | node_id | ) |
#include <zephyr/pm/state.h>
Obtain number of CPU power states supported and enabled by the given CPU node identifier.
node_id | A CPU node identifier. |
#define PM_STATE_CONSTRAINT_INIT | ( | node_id | ) |
#include <zephyr/pm/state.h>
initialize a device pm constraint with information from devicetree.
node_id | Node identifier. |
#define PM_STATE_CONSTRAINTS_GET | ( | node_id, | |
prop ) |
#include <zephyr/pm/state.h>
Get power state constraints structure from devicetree.
This macro creates a structure containing a pointer to the constraints list and the count of constraints, suitable for initializing a pm_state_constraints structure. Must be used after the PM_STATE_CONSTRAINTS_LIST_DEFINE call for the same
prop | to refer to the array of constraints. |
node_id | Devicetree node identifier. |
prop | Property name containing the list of power state phandles. |
#define PM_STATE_CONSTRAINTS_LIST_DEFINE | ( | node_id, | |
prop ) |
#include <zephyr/pm/state.h>
Define a list of power state constraints from devicetree.
This macro creates an array of pm_state_constraint structures initialized with power state information from the specified devicetree property.
node_id | Devicetree node identifier. |
prop | Property name containing the list of power state phandles. |
#define PM_STATE_DT_INIT | ( | node_id | ) |
#include <zephyr/pm/state.h>
Initializer for enum pm_state given a DT node identifier with zephyr,power-state compatible.
node_id | A node identifier with compatible zephyr,power-state |
#define PM_STATE_INFO_DT_INIT | ( | node_id | ) |
#include <zephyr/pm/state.h>
Initializer for struct pm_state_info given a DT node identifier with zephyr,power-state compatible.
node_id | A node identifier with compatible zephyr,power-state |
#define PM_STATE_INFO_LIST_FROM_DT_CPU | ( | node_id | ) |
#include <zephyr/pm/state.h>
Initialize an array of struct pm_state_info with information from all the states present and enabled in the given CPU node identifier.
Example devicetree fragment:
Example usage:
node_id | A CPU node identifier. |
#define PM_STATE_LIST_FROM_DT_CPU | ( | node_id | ) |
#include <zephyr/pm/state.h>
Initialize an array of struct pm_state with information from all the states present and enabled in the given CPU node identifier.
Example devicetree fragment:
Example usage:
node_id | A CPU node identifier. |
enum pm_state |
#include <zephyr/pm/state.h>
Power management state.
uint8_t pm_state_cpu_get_all | ( | uint8_t | cpu, |
const struct pm_state_info ** | states ) |
#include <zephyr/pm/state.h>
Obtain information about all supported states by a CPU.
cpu | CPU index. |
states | Where to store the list of supported states. |
int pm_state_from_str | ( | const char * | name, |
enum pm_state * | out ) |
#include <zephyr/pm/state.h>
Parse a string and convert it to a pm_state enum value.
name | Input string (e.g., "suspend-to-ram"). |
out | Pointer to store the parsed pm_state value. |
const struct pm_state_info * pm_state_get | ( | uint8_t | cpu, |
enum pm_state | state, | ||
uint8_t | substate_id ) |
#include <zephyr/pm/state.h>
Get power state structure.
Function searches in all states assigned to the CPU and in disabled states.
cpu | CPU index. |
state | Power state. |
substate_id | Substate. |
bool pm_state_in_constraints | ( | const struct pm_state_constraints * | constraints, |
const struct pm_state_constraint | match ) |
#include <zephyr/pm/state.h>
Check if a power management constraint matches any in a set of constraints.
constraints | Pointer to the power state constraints structure. |
match | The constraint to match against. |
const char * pm_state_to_str | ( | enum pm_state | state | ) |
#include <zephyr/pm/state.h>
Convert a pm_state enum value to its string representation.
state | Power state. |