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:
Gerard Marull-Paretas 2022-01-20 16:06:28 +01:00 committed by Carles Cufí
commit 5a71eeb35c
23 changed files with 191 additions and 195 deletions

View file

@ -33,7 +33,7 @@
#include <toolchain.h>
#include <linker/sections.h>
#include <drivers/uart.h>
#include <pm/pm.h>
#include <pm/policy.h>
#include <sys/sys_io.h>
#include <spinlock.h>
@ -681,7 +681,7 @@ static void uart_ns16550_irq_tx_enable(const struct device *dev)
* different states.
*/
for (uint8_t i = 0U; i < num_cpu_states; i++) {
pm_constraint_set(cpu_states[i].state);
pm_policy_state_lock_get(cpu_states[i].state);
}
}
#endif
@ -718,7 +718,7 @@ static void uart_ns16550_irq_tx_disable(const struct device *dev)
* to different states.
*/
for (uint8_t i = 0U; i < num_cpu_states; i++) {
pm_constraint_release(cpu_states[i].state);
pm_policy_state_lock_put(cpu_states[i].state);
}
}
#endif