pm: state: PM_STATE_DT_ITEMS_LEN->DT_NUM_CPU_POWER_STATES
Rename PM_STATE_DT_ITEMS_LEN to DT_NUM_CPU_POWER_STATES to make its purpose more clear. This macro could be made part of a Devicetree API for PM in the future. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
5ab7d35e7c
commit
7bfd0976aa
|
@ -204,12 +204,13 @@ struct pm_state_info {
|
|||
DT_ENUM_IDX(node_id, power_state_name)
|
||||
|
||||
/**
|
||||
* @brief Length of 'cpu-power-states' property
|
||||
* @brief Obtain number of CPU power states supported by the given CPU node
|
||||
* identifier.
|
||||
*
|
||||
* @param node_id A node identifier with compatible zephyr,power-state
|
||||
* @return length of 'cpu-power-states' property
|
||||
* @param node_id A CPU node identifier.
|
||||
* @return Number of supported CPU power states.
|
||||
*/
|
||||
#define PM_STATE_DT_ITEMS_LEN(node_id) \
|
||||
#define DT_NUM_CPU_POWER_STATES(node_id) \
|
||||
DT_PROP_LEN_OR(node_id, cpu_power_states, 0)
|
||||
|
||||
/**
|
||||
|
@ -257,7 +258,7 @@ struct pm_state_info {
|
|||
*/
|
||||
#define PM_STATE_INFO_LIST_FROM_DT_CPU(node_id) \
|
||||
{ \
|
||||
UTIL_LISTIFY(PM_STATE_DT_ITEMS_LEN(node_id), \
|
||||
UTIL_LISTIFY(DT_NUM_CPU_POWER_STATES(node_id), \
|
||||
Z_PM_STATE_INFO_FROM_DT_CPU, node_id) \
|
||||
}
|
||||
|
||||
|
@ -305,7 +306,7 @@ struct pm_state_info {
|
|||
*/
|
||||
#define PM_STATE_LIST_FROM_DT_CPU(node_id) \
|
||||
{ \
|
||||
UTIL_LISTIFY(PM_STATE_DT_ITEMS_LEN(node_id), \
|
||||
UTIL_LISTIFY(DT_NUM_CPU_POWER_STATES(node_id), \
|
||||
Z_PM_STATE_FROM_DT_CPU, node_id) \
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ struct pm_counter pm_counters[SLP_STATES_SUPPORTED];
|
|||
|
||||
static const struct pm_state_info residency_info[] =
|
||||
PM_STATE_INFO_LIST_FROM_DT_CPU(DT_NODELABEL(cpu0));
|
||||
static size_t residency_info_len = PM_STATE_DT_ITEMS_LEN(DT_NODELABEL(cpu0));
|
||||
static size_t residency_info_len = DT_NUM_CPU_POWER_STATES(DT_NODELABEL(cpu0));
|
||||
|
||||
|
||||
/* Instrumentation to measure latency and track entry exit via gpios
|
||||
|
|
|
@ -22,7 +22,7 @@ static const struct pm_state_info *pm_min_residency[] = {
|
|||
DT_FOREACH_CHILD(DT_PATH(cpus), CPU_STATES)
|
||||
};
|
||||
|
||||
#define CPU_STATES_SIZE(n) PM_STATE_DT_ITEMS_LEN(n),
|
||||
#define CPU_STATES_SIZE(n) DT_NUM_CPU_POWER_STATES(n),
|
||||
|
||||
static int pm_min_residency_sizes[] = {
|
||||
DT_FOREACH_CHILD(DT_PATH(cpus), CPU_STATES_SIZE)
|
||||
|
|
|
@ -53,7 +53,7 @@ struct pm_counter pm_counters[SLP_STATES_SUPPORTED];
|
|||
|
||||
static const struct pm_state_info residency_info[] =
|
||||
PM_STATE_INFO_LIST_FROM_DT_CPU(DT_NODELABEL(cpu0));
|
||||
static size_t residency_info_len = PM_STATE_DT_ITEMS_LEN(DT_NODELABEL(cpu0));
|
||||
static size_t residency_info_len = DT_NUM_CPU_POWER_STATES(DT_NODELABEL(cpu0));
|
||||
|
||||
static void pm_latency_check(void)
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@ void test_power_states(void)
|
|||
struct pm_state_info dts_infos[] =
|
||||
PM_STATE_INFO_LIST_FROM_DT_CPU(DT_NODELABEL(power_states));
|
||||
uint32_t dts_states_len =
|
||||
PM_STATE_DT_ITEMS_LEN(DT_NODELABEL(power_states));
|
||||
DT_NUM_CPU_POWER_STATES(DT_NODELABEL(power_states));
|
||||
|
||||
zassert_true(ARRAY_SIZE(states) == dts_states_len,
|
||||
"Invalid number of pm states");
|
||||
|
|
Loading…
Reference in a new issue