Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
Power Management States

Data Structures

struct  pm_state_info
 

Macros

#define PM_STATE_INFO_DT_ITEM_BY_IDX(node_id, i)
 Construct a pm_state_info from 'cpu-power-states' property at index 'i'. More...
 
#define PM_STATE_DT_ITEMS_LEN(node_id)    DT_PROP_LEN_OR(node_id, cpu_power_states, 0)
 Length of 'cpu-power-states' property. More...
 
#define PM_STATE_INFO_DT_ITEMS_LISTIFY_FUNC(child, node_id)    PM_STATE_INFO_DT_ITEM_BY_IDX(node_id, child)
 Macro function to construct enum pm_state item in UTIL_LISTIFY extension. More...
 
#define PM_STATE_INFO_DT_ITEMS_LIST(node_id)
 Macro function to construct a list of 'pm_state_info' items by UTIL_LISTIFY func. More...
 
#define PM_STATE_DT_ITEM_BY_IDX(node_id, i)
 Construct a pm_state enum from 'cpu-power-states' property at index 'i'. More...
 
#define PM_STATE_DT_ITEMS_LISTIFY_FUNC(child, node_id)    PM_STATE_DT_ITEM_BY_IDX(node_id, child)
 Macro function to construct enum pm_state item in UTIL_LISTIFY extension. More...
 
#define PM_STATE_DT_ITEMS_LIST(node_id)
 Macro function to construct a list of enum pm_state items by UTIL_LISTIFY func. More...
 

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
}
 

Detailed Description

Macro Definition Documentation

◆ PM_STATE_DT_ITEM_BY_IDX

#define PM_STATE_DT_ITEM_BY_IDX (   node_id,
 
)

#include <include/pm/state.h>

Value:
cpu_power_states, i), power_state_name),
#define DT_ENUM_IDX(node_id, prop)
Get a property value's index into its enumeration values.
Definition: devicetree.h:688
#define DT_PHANDLE_BY_IDX(node_id, prop, idx)
Get a node identifier for a phandle in a property.
Definition: devicetree.h:1271

Construct a pm_state enum from 'cpu-power-states' property at index 'i'.

Parameters
node_idA node identifier with compatible zephyr,power-state
iindex into cpu-power-states property
Returns
pm_state item from 'cpu-power-states' property at index 'i'

◆ PM_STATE_DT_ITEMS_LEN

#define PM_STATE_DT_ITEMS_LEN (   node_id)     DT_PROP_LEN_OR(node_id, cpu_power_states, 0)

#include <include/pm/state.h>

Length of 'cpu-power-states' property.

Parameters
node_idA node identifier with compatible zephyr,power-state
Returns
length of 'cpu-power-states' property

◆ PM_STATE_DT_ITEMS_LIST

#define PM_STATE_DT_ITEMS_LIST (   node_id)

#include <include/pm/state.h>

Value:
{ \
UTIL_LISTIFY(PM_STATE_DT_ITEMS_LEN(node_id),\
node_id) \
}
#define PM_STATE_DT_ITEMS_LEN(node_id)
Length of 'cpu-power-states' property.
Definition: state.h:179
#define PM_STATE_DT_ITEMS_LISTIFY_FUNC(child, node_id)
Macro function to construct enum pm_state item in UTIL_LISTIFY extension.
Definition: state.h:258

Macro function to construct a list of enum pm_state items by UTIL_LISTIFY func.

Example devicetree fragment: cpus { ... cpu0: cpu@0 { device_type = "cpu"; ... cpu-power-states = <&state0 &state1>; }; };

... state0: state0 { compatible = "zephyr,power-state"; power-state-name = "suspend-to-idle"; min-residency-us = <10000>; exit-latency-us = <100>; };

state1: state1 { compatible = "zephyr,power-state"; power-state-name = "suspend-to-ram"; min-residency-us = <50000>; exit-latency-us = <500>; };

Example usage: * const enum pm_state states[] = PM_STATE_DT_ITEMS_LIST(DT_NODELABEL(cpu0));

Parameters
node_idA node identifier with compatible zephyr,power-state
Returns
an array of enum pm_state items.

◆ PM_STATE_DT_ITEMS_LISTIFY_FUNC

#define PM_STATE_DT_ITEMS_LISTIFY_FUNC (   child,
  node_id 
)     PM_STATE_DT_ITEM_BY_IDX(node_id, child)

#include <include/pm/state.h>

Macro function to construct enum pm_state item in UTIL_LISTIFY extension.

Parameters
childchild index in UTIL_LISTIFY extension.
node_idA node identifier with compatible zephyr,power-state
Returns
macro function to construct a pm_state enum

◆ PM_STATE_INFO_DT_ITEM_BY_IDX

#define PM_STATE_INFO_DT_ITEM_BY_IDX (   node_id,
 
)

#include <include/pm/state.h>

Value:
{ \
.state = DT_ENUM_IDX(DT_PHANDLE_BY_IDX(node_id, \
cpu_power_states, i), power_state_name), \
.substate_id = DT_PROP_BY_PHANDLE_IDX_OR(node_id, \
cpu_power_states, i, substate_id, 0), \
.min_residency_us = DT_PROP_BY_PHANDLE_IDX_OR(node_id, \
cpu_power_states, i, min_residency_us, 0),\
.exit_latency_us = DT_PROP_BY_PHANDLE_IDX_OR(node_id, \
cpu_power_states, i, exit_latency_us, 0),\
},
#define DT_PROP_BY_PHANDLE_IDX_OR(node_id, phs, idx, prop, default_value)
Like DT_PROP_BY_PHANDLE_IDX(), but with a fallback to default_value.
Definition: devicetree.h:1009

Construct a pm_state_info from 'cpu-power-states' property at index 'i'.

Parameters
node_idA node identifier with compatible zephyr,power-state
iindex into cpu-power-states property
Returns
pm_state_info item from 'cpu-power-states' property at index 'i'

◆ PM_STATE_INFO_DT_ITEMS_LIST

#define PM_STATE_INFO_DT_ITEMS_LIST (   node_id)

#include <include/pm/state.h>

Value:
{ \
UTIL_LISTIFY(PM_STATE_DT_ITEMS_LEN(node_id), \
node_id) \
}
#define PM_STATE_INFO_DT_ITEMS_LISTIFY_FUNC(child, node_id)
Macro function to construct enum pm_state item in UTIL_LISTIFY extension.
Definition: state.h:190

Macro function to construct a list of 'pm_state_info' items by UTIL_LISTIFY func.

Example devicetree fragment: cpus { ... cpu0: cpu@0 { device_type = "cpu"; ... cpu-power-states = <&state0 &state1>; }; };

... power-states { state0: state0 { compatible = "zephyr,power-state"; power-state-name = "suspend-to-idle"; min-residency-us = <10000>; exit-latency-us = <100>; };

state1: state1 { compatible = "zephyr,power-state"; power-state-name = "suspend-to-ram"; min-residency-us = <50000>; exit-latency-us = <500>; }; };

Example usage: * const struct pm_state_info states[] = PM_STATE_INFO_DT_ITEMS_LIST(DT_NODELABEL(cpu0));

Parameters
node_idA node identifier with compatible zephyr,power-state
Returns
an array of struct pm_state_info.

◆ PM_STATE_INFO_DT_ITEMS_LISTIFY_FUNC

#define PM_STATE_INFO_DT_ITEMS_LISTIFY_FUNC (   child,
  node_id 
)     PM_STATE_INFO_DT_ITEM_BY_IDX(node_id, child)

#include <include/pm/state.h>

Macro function to construct enum pm_state item in UTIL_LISTIFY extension.

Parameters
childchild index in UTIL_LISTIFY extension.
node_idA node identifier with compatible zephyr,power-state
Returns
macro function to construct a pm_state_info

Enumeration Type Documentation

◆ pm_state

enum pm_state

#include <include/pm/state.h>

Power management state

Enumerator
PM_STATE_ACTIVE 

Runtime active state.

The system is fully powered and active.

Note
This state is correlated with ACPI G0/S0 state
PM_STATE_RUNTIME_IDLE 

Runtime idle state.

Runtime idle is a system sleep state in which all of the cores enter deepest possible idle state and wait for interrupts, no requirements for the devices, leaving them at the states where they are.

Note
This state is correlated with ACPI S0ix state
PM_STATE_SUSPEND_TO_IDLE 

Suspend to idle state.

The system goes through a normal platform suspend where it puts all of the cores in deepest possible idle state and may puts peripherals into low-power states. No operating state is lost (ie. the cpu core does not lose execution context), so the system can go back to where it left off easily enough.

Note
This state is correlated with ACPI S1 state
PM_STATE_STANDBY 

Standby state.

In addition to putting peripherals into low-power states all non-boot CPUs are powered off. It should allow more energy to be saved relative to suspend to idle, but the resume latency will generally be greater than for that state. But it should be the same state with suspend to idle state on uniprocesser system.

Note
This state is correlated with ACPI S2 state
PM_STATE_SUSPEND_TO_RAM 

Suspend to ram state.

This state offers significant energy savings by powering off as much of the system as possible, where memory should be placed into the self-refresh mode to retain its contents. The state of devices and CPUs is saved and held in memory, and it may require some boot- strapping code in ROM to resume the system from it.

Note
This state is correlated with ACPI S3 state
PM_STATE_SUSPEND_TO_DISK 

Suspend to disk state.

This state offers significant energy savings by powering off as much of the system as possible, including the memory. The contents of memory are written to disk or other non-volatile storage, and on resume it's read back into memory with the help of boot-strapping code, restores the system to the same point of execution where it went to suspend to disk.

Note
This state is correlated with ACPI S4 state
PM_STATE_SOFT_OFF 

Soft off state.

This state consumes a minimal amount of power and requires a large latency in order to return to runtime active state. The contents of system(CPU and memory) will not be preserved, so the system will be restarted as if from initial power-up and kernel boot.

Note
This state is correlated with ACPI G2/S5 state