pm: state: PM_STATE_INFO_DT_ITEMS_LIST->PM_STATE_INFO_LIST_FROM_DT_CPU
Rename the PM_STATE_INFO_DT_ITEMS_LIST macro to PM_STATE_INFO_LIST_FROM_DT_CPU to make its purpose more clear. Similar naming scheme is found e.g. in the GPIO API. Associated internal macros and docstrings have been adjusted, too. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
e1ba1e5209
commit
fa96955305
6 changed files with 15 additions and 18 deletions
|
@ -159,16 +159,14 @@ struct pm_state_info {
|
||||||
/** @cond INTERNAL_HIDDEN */
|
/** @cond INTERNAL_HIDDEN */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Macro function to construct enum pm_state item in UTIL_LISTIFY
|
* @brief Helper macro to initialize an entry of a struct pm_state_info array
|
||||||
* extension.
|
* when using UTIL_LISTIFY in PM_STATE_INFO_LIST_FROM_DT_CPU.
|
||||||
*
|
*
|
||||||
* @param child child index in UTIL_LISTIFY extension.
|
* @param i UTIL_LISTIFY entry index.
|
||||||
* @param node_id A node identifier with compatible zephyr,power-state
|
* @param node_id A node identifier with compatible zephyr,power-state
|
||||||
* @return macro function to construct a pm_state_info
|
|
||||||
*/
|
*/
|
||||||
#define Z_PM_STATE_INFO_DT_ITEMS_LISTIFY_FUNC(child, node_id) \
|
#define Z_PM_STATE_INFO_FROM_DT_CPU(i, node_id) \
|
||||||
PM_STATE_INFO_DT_INIT(DT_PHANDLE_BY_IDX(node_id, cpu_power_states, \
|
PM_STATE_INFO_DT_INIT(DT_PHANDLE_BY_IDX(node_id, cpu_power_states, i)),
|
||||||
child)),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Macro function to construct enum pm_state item in UTIL_LISTIFY
|
* @brief Macro function to construct enum pm_state item in UTIL_LISTIFY
|
||||||
|
@ -216,8 +214,8 @@ struct pm_state_info {
|
||||||
DT_PROP_LEN_OR(node_id, cpu_power_states, 0)
|
DT_PROP_LEN_OR(node_id, cpu_power_states, 0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Macro function to construct a list of 'pm_state_info' items by
|
* @brief Initialize an array of struct pm_state_info with information from all
|
||||||
* UTIL_LISTIFY func
|
* the states present in the given CPU node identifier.
|
||||||
*
|
*
|
||||||
* Example devicetree fragment:
|
* Example devicetree fragment:
|
||||||
*
|
*
|
||||||
|
@ -253,16 +251,15 @@ struct pm_state_info {
|
||||||
*
|
*
|
||||||
* @code{.c}
|
* @code{.c}
|
||||||
* const struct pm_state_info states[] =
|
* const struct pm_state_info states[] =
|
||||||
* PM_STATE_INFO_DT_ITEMS_LIST(DT_NODELABEL(cpu0));
|
* PM_STATE_INFO_LIST_FROM_DT_CPU(DT_NODELABEL(cpu0));
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* @param node_id A CPU node identifier.
|
* @param node_id A CPU node identifier.
|
||||||
* @return an array of struct pm_state_info.
|
|
||||||
*/
|
*/
|
||||||
#define PM_STATE_INFO_DT_ITEMS_LIST(node_id) \
|
#define PM_STATE_INFO_LIST_FROM_DT_CPU(node_id) \
|
||||||
{ \
|
{ \
|
||||||
UTIL_LISTIFY(PM_STATE_DT_ITEMS_LEN(node_id), \
|
UTIL_LISTIFY(PM_STATE_DT_ITEMS_LEN(node_id), \
|
||||||
Z_PM_STATE_INFO_DT_ITEMS_LISTIFY_FUNC, node_id) \
|
Z_PM_STATE_INFO_FROM_DT_CPU, node_id) \
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -49,7 +49,7 @@ static bool checks_enabled;
|
||||||
struct pm_counter pm_counters[SLP_STATES_SUPPORTED];
|
struct pm_counter pm_counters[SLP_STATES_SUPPORTED];
|
||||||
|
|
||||||
static const struct pm_state_info residency_info[] =
|
static const struct pm_state_info residency_info[] =
|
||||||
PM_STATE_INFO_DT_ITEMS_LIST(DT_NODELABEL(cpu0));
|
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 = PM_STATE_DT_ITEMS_LEN(DT_NODELABEL(cpu0));
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ LOG_MODULE_DECLARE(pm, CONFIG_PM_LOG_LEVEL);
|
||||||
(struct pm_state_info){PM_STATE_ACTIVE, 0, 0}
|
(struct pm_state_info){PM_STATE_ACTIVE, 0, 0}
|
||||||
|
|
||||||
static const struct pm_state_info pm_dummy_states[] =
|
static const struct pm_state_info pm_dummy_states[] =
|
||||||
PM_STATE_INFO_DT_ITEMS_LIST(DT_NODELABEL(cpu0));
|
PM_STATE_INFO_LIST_FROM_DT_CPU(DT_NODELABEL(cpu0));
|
||||||
|
|
||||||
struct pm_state_info pm_policy_next_state(uint8_t cpu, int32_t ticks)
|
struct pm_state_info pm_policy_next_state(uint8_t cpu, int32_t ticks)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@ LOG_MODULE_DECLARE(pm, CONFIG_PM_LOG_LEVEL);
|
||||||
|
|
||||||
#if DT_NODE_EXISTS(DT_PATH(cpus))
|
#if DT_NODE_EXISTS(DT_PATH(cpus))
|
||||||
|
|
||||||
#define CPU_STATES(n) (struct pm_state_info[])PM_STATE_INFO_DT_ITEMS_LIST(n),
|
#define CPU_STATES(n) (struct pm_state_info[])PM_STATE_INFO_LIST_FROM_DT_CPU(n),
|
||||||
|
|
||||||
static const struct pm_state_info *pm_min_residency[] = {
|
static const struct pm_state_info *pm_min_residency[] = {
|
||||||
DT_FOREACH_CHILD(DT_PATH(cpus), CPU_STATES)
|
DT_FOREACH_CHILD(DT_PATH(cpus), CPU_STATES)
|
||||||
|
|
|
@ -52,7 +52,7 @@ static bool checks_enabled;
|
||||||
struct pm_counter pm_counters[SLP_STATES_SUPPORTED];
|
struct pm_counter pm_counters[SLP_STATES_SUPPORTED];
|
||||||
|
|
||||||
static const struct pm_state_info residency_info[] =
|
static const struct pm_state_info residency_info[] =
|
||||||
PM_STATE_INFO_DT_ITEMS_LIST(DT_NODELABEL(cpu0));
|
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 = PM_STATE_DT_ITEMS_LEN(DT_NODELABEL(cpu0));
|
||||||
|
|
||||||
static void pm_latency_check(void)
|
static void pm_latency_check(void)
|
||||||
|
|
|
@ -23,7 +23,7 @@ void test_power_states(void)
|
||||||
enum pm_state dts_states[] =
|
enum pm_state dts_states[] =
|
||||||
PM_STATE_DT_ITEMS_LIST(DT_NODELABEL(power_states));
|
PM_STATE_DT_ITEMS_LIST(DT_NODELABEL(power_states));
|
||||||
struct pm_state_info dts_infos[] =
|
struct pm_state_info dts_infos[] =
|
||||||
PM_STATE_INFO_DT_ITEMS_LIST(DT_NODELABEL(power_states));
|
PM_STATE_INFO_LIST_FROM_DT_CPU(DT_NODELABEL(power_states));
|
||||||
uint32_t dts_states_len =
|
uint32_t dts_states_len =
|
||||||
PM_STATE_DT_ITEMS_LEN(DT_NODELABEL(power_states));
|
PM_STATE_DT_ITEMS_LEN(DT_NODELABEL(power_states));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue