pm: policy: move constraints to policy API
The pm_constraint_* APIs were effectively used by the policy manager only. This patch renames the API to the policy namespace and makes its naming more explicit: - pm_constraint_set -> pm_policy_state_lock_get() - pm_constraint_release -> pm_policy_state_lock_put() - pm_constraint_get -> pm_policy_state_lock_is_active() The reason for these changes is that constraints can be of many types: allow/disallow states, impose latency requirements, etc. The new naming also makes explicit that the API calls will influence the PM policy behavior. All drivers and documentation have been updated accordingly. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
d158f512ac
commit
5a71eeb35c
23 changed files with 191 additions and 195 deletions
|
@ -18,7 +18,7 @@
|
|||
#include <sys/util.h>
|
||||
#include <errno.h>
|
||||
#include <soc.h>
|
||||
#include <pm/pm.h>
|
||||
#include <pm/policy.h>
|
||||
#include <stm32_ll_bus.h>
|
||||
#include <stm32_ll_rcc.h>
|
||||
#include <stm32_ll_rng.h>
|
||||
|
@ -246,7 +246,7 @@ static uint16_t rng_pool_get(struct rng_pool *rngp, uint8_t *buf, uint16_t len)
|
|||
available = available - len;
|
||||
if ((available <= rngp->threshold)
|
||||
&& !LL_RNG_IsEnabledIT(entropy_stm32_rng_data.rng)) {
|
||||
pm_constraint_set(PM_STATE_SUSPEND_TO_IDLE);
|
||||
pm_policy_state_lock_get(PM_STATE_SUSPEND_TO_IDLE);
|
||||
LL_RNG_EnableIT(entropy_stm32_rng_data.rng);
|
||||
}
|
||||
|
||||
|
@ -300,7 +300,7 @@ static void stm32_rng_isr(const void *arg)
|
|||
byte);
|
||||
if (ret < 0) {
|
||||
LL_RNG_DisableIT(entropy_stm32_rng_data.rng);
|
||||
pm_constraint_release(PM_STATE_SUSPEND_TO_IDLE);
|
||||
pm_policy_state_lock_put(PM_STATE_SUSPEND_TO_IDLE);
|
||||
}
|
||||
|
||||
k_sem_give(&entropy_stm32_rng_data.sem_sync);
|
||||
|
@ -512,7 +512,7 @@ static int entropy_stm32_rng_init(const struct device *dev)
|
|||
* rng pool is being populated. The ISR will release the constraint again
|
||||
* when the rng pool is filled.
|
||||
*/
|
||||
pm_constraint_set(PM_STATE_SUSPEND_TO_IDLE);
|
||||
pm_policy_state_lock_get(PM_STATE_SUSPEND_TO_IDLE);
|
||||
|
||||
LL_RNG_EnableIT(dev_data->rng);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue