power: Rename constraint API

Replace pm_ctrl_* with pm_constraint.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2021-01-25 18:03:08 -08:00 committed by Anas Nashif
parent ea4bc728f4
commit 3f87c5a0f4
13 changed files with 29 additions and 29 deletions

View file

@ -216,9 +216,9 @@ disable sleep state 2 while polling:
.. code-block:: c
pm_ctrl_disable_state(PM_STATE_STANDBY);
pm_constraint_set(PM_STATE_STANDBY);
<code that calls uart_poll_in() and expects input at any point in time>
pm_ctrl_enable_state(PM_STATE_STANDBY);
pm_constraint_release(PM_STATE_STANDBY);
References

View file

@ -242,9 +242,9 @@ disable sleep state 2 while polling:
.. code-block:: c
pm_ctrl_disable_state(PM_STATE_STANDBY);
pm_constraint_set(PM_STATE_STANDBY);
<code that calls uart_poll_in() and expects input at any point in time>
pm_ctrl_enable_state(PM_STATE_STANDBY);
pm_constraint_release(PM_STATE_STANDBY);
References

View file

@ -222,9 +222,9 @@ disable sleep state 2 while polling:
.. code-block:: c
pm_ctrl_disable_state(PM_STATE_STANDBY);
pm_constraint_set(PM_STATE_STANDBY);
<code that calls uart_poll_in() and expects input at any point in time>
pm_ctrl_enable_state(PM_STATE_STANDBY);
pm_constraint_release(PM_STATE_STANDBY);
References

View file

@ -109,7 +109,7 @@ static int entropy_cc13xx_cc26xx_get_entropy(const struct device *dev,
unsigned int key = irq_lock();
if (!data->constrained) {
pm_ctrl_disable_state(PM_STATE_STANDBY);
pm_constraint_set(PM_STATE_STANDBY);
data->constrained = true;
}
irq_unlock(key);
@ -154,7 +154,7 @@ static void entropy_cc13xx_cc26xx_isr(const void *arg)
if (cnt != sizeof(num)) {
#ifdef CONFIG_PM
if (data->constrained) {
pm_ctrl_enable_state(
pm_constraint_release(
PM_STATE_STANDBY);
data->constrained = false;
}
@ -333,7 +333,7 @@ static int entropy_cc13xx_cc26xx_init(const struct device *dev)
#if defined(CONFIG_PM)
Power_setDependency(PowerCC26XX_PERIPH_TRNG);
/* Stay out of standby until buffer is filled with entropy */
pm_ctrl_disable_state(PM_STATE_STANDBY);
pm_constraint_set(PM_STATE_STANDBY);
data->constrained = true;
/* Register notification function */
Power_registerNotify(&data->post_notify,

View file

@ -208,7 +208,7 @@ static int i2c_cc13xx_cc26xx_transfer(const struct device *dev,
k_sem_take(&get_dev_data(dev)->lock, K_FOREVER);
#ifdef CONFIG_PM
pm_ctrl_disable_state(PM_STATE_STANDBY);
pm_constraint_set(PM_STATE_STANDBY);
#endif
for (int i = 0; i < num_msgs; i++) {
@ -232,7 +232,7 @@ static int i2c_cc13xx_cc26xx_transfer(const struct device *dev,
}
#ifdef CONFIG_PM
pm_ctrl_enable_state(PM_STATE_STANDBY);
pm_constraint_release(PM_STATE_STANDBY);
#endif
k_sem_give(&get_dev_data(dev)->lock);

View file

@ -243,7 +243,7 @@ static void uart_cc13xx_cc26xx_irq_tx_enable(const struct device *dev)
* standby mode instead, since it is the power state that
* would interfere with a transfer.
*/
pm_ctrl_disable_state(PM_STATE_STANDBY);
pm_constraint_set(PM_STATE_STANDBY);
get_dev_data(dev)->tx_constrained = true;
}
#endif
@ -257,7 +257,7 @@ static void uart_cc13xx_cc26xx_irq_tx_disable(const struct device *dev)
#ifdef CONFIG_PM
if (get_dev_data(dev)->tx_constrained) {
pm_ctrl_enable_state(PM_STATE_STANDBY);
pm_constraint_release(PM_STATE_STANDBY);
get_dev_data(dev)->tx_constrained = false;
}
#endif
@ -277,7 +277,7 @@ static void uart_cc13xx_cc26xx_irq_rx_enable(const struct device *dev)
* standby.
*/
if (!get_dev_data(dev)->rx_constrained) {
pm_ctrl_disable_state(PM_STATE_STANDBY);
pm_constraint_set(PM_STATE_STANDBY);
get_dev_data(dev)->rx_constrained = true;
}
#endif
@ -289,7 +289,7 @@ static void uart_cc13xx_cc26xx_irq_rx_disable(const struct device *dev)
{
#ifdef CONFIG_PM
if (get_dev_data(dev)->rx_constrained) {
pm_ctrl_enable_state(PM_STATE_STANDBY);
pm_constraint_release(PM_STATE_STANDBY);
get_dev_data(dev)->rx_constrained = false;
}
#endif

View file

@ -149,7 +149,7 @@ static int spi_cc13xx_cc26xx_transceive(const struct device *dev,
spi_context_lock(ctx, false, NULL, config);
#ifdef CONFIG_PM
pm_ctrl_disable_state(PM_STATE_STANDBY);
pm_constraint_set(PM_STATE_STANDBY);
#endif
err = spi_cc13xx_cc26xx_configure(dev, config);
@ -185,7 +185,7 @@ static int spi_cc13xx_cc26xx_transceive(const struct device *dev,
done:
#ifdef CONFIG_PM
pm_ctrl_enable_state(PM_STATE_STANDBY);
pm_constraint_release(PM_STATE_STANDBY);
#endif
spi_context_release(ctx, err);
return err;

View file

@ -166,25 +166,25 @@ void pm_dump_debug_info(void);
*
* @details Disabled state cannot be selected by the Zephyr power
* management policies. Application defined policy should
* use the @ref pm_ctrl_is_state_enabled function to
* use the @ref pm_constraint_get function to
* check if given state is enabled and could be used.
*
* @param [in] state Power state to be disabled.
*/
void pm_ctrl_disable_state(enum pm_state state);
void pm_constraint_set(enum pm_state state);
/**
* @brief Enable particular power state
*
* @details Enabled state can be selected by the Zephyr power
* management policies. Application defined policy should
* use the @ref pm_ctrl_is_state_enabled function to
* use the @ref pm_constraint_get function to
* check if given state is enabled and could be used.
* By default all power states are enabled.
*
* @param [in] state Power state to be enabled.
*/
void pm_ctrl_enable_state(enum pm_state state);
void pm_constraint_release(enum pm_state state);
/**
* @brief Check if particular power state is enabled
@ -193,7 +193,7 @@ void pm_ctrl_enable_state(enum pm_state state);
*
* @param [in] state Power state.
*/
bool pm_ctrl_is_state_enabled(enum pm_state state);
bool pm_constraint_get(enum pm_state state);
#endif /* CONFIG_PM_STATE_LOCK */

View file

@ -27,7 +27,7 @@ static int disable_ds_1(const struct device *dev)
{
ARG_UNUSED(dev);
pm_ctrl_disable_state(PM_STATE_SOFT_OFF);
pm_constraint_set(PM_STATE_SOFT_OFF);
return 0;
}

View file

@ -19,7 +19,7 @@ LOG_MODULE_DECLARE(power);
static atomic_t power_state_disable_count[PM_STATES_LEN];
void pm_ctrl_disable_state(enum pm_state state)
void pm_constraint_set(enum pm_state state)
{
atomic_val_t v;
@ -31,7 +31,7 @@ void pm_ctrl_disable_state(enum pm_state state)
(void)(v);
}
void pm_ctrl_enable_state(enum pm_state state)
void pm_constraint_release(enum pm_state state)
{
atomic_val_t v;
@ -43,7 +43,7 @@ void pm_ctrl_enable_state(enum pm_state state)
(void)(v);
}
bool pm_ctrl_is_state_enabled(enum pm_state state)
bool pm_constraint_get(enum pm_state state)
{
__ASSERT(state < PM_STATES_LEN, "Invalid power state!");

View file

@ -33,7 +33,7 @@ struct pm_state_info pm_policy_next_state(int32_t ticks)
i = (i + 1) % states_len;
#ifdef CONFIG_PM_STATE_LOCK
if (!pm_ctrl_is_state_enabled(
if (!pm_constraint_get(
pm_dummy_states[i].state)) {
continue;
}

View file

@ -21,7 +21,7 @@ struct pm_state_info pm_policy_next_state(int32_t ticks)
for (i = ARRAY_SIZE(pm_min_residency) - 1; i >= 0; i--) {
#ifdef CONFIG_PM_STATE_LOCK
if (!pm_ctrl_is_state_enabled(pm_min_residency[i].state)) {
if (!pm_constraint_get(pm_min_residency[i].state)) {
continue;
}
#endif

View file

@ -55,7 +55,7 @@ struct pm_state_info pm_policy_next_state(int32_t ticks)
for (i = ARRAY_SIZE(residency_info) - 1; i >= 0; i--) {
#ifdef CONFIG_PM_STATE_LOCK
if (!pm_ctrl_is_state_enabled(residency_info[i].state)) {
if (!pm_constraint_get(residency_info[i].state)) {
continue;
}
#endif