This check is totally wrong, min-residency-us and exit-latency-us are
not related to each other at all except that the end of the residency
period occurs when the exit starts, so they are totally orthogonal
values and should not be checking if one is less than the other or
anything like this. Even in the code for the default policy manager,
they are added together, so this check is incompatible / in disagreement
with that code, so it should be removed.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Some pieces of the system may have custom types of constraints that they
define based on different effects and reasons than just the standard
"zephyr,disabling-states". To avoid every single one of these component
reinventing the wheel, make some common APIs to handle these type of
custom constraint lists.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Add two helper functions to convert power management states between
enum and string:
- pm_state_to_string()
- pm_state_from_string()
Signed-off-by: Yongxu Wang <yongxu.wang@nxp.com>
pm_state_get() is used to get a PM state that can be forced.
Disabled states (not included in automatic state selection) can
also be forced thus they should be included in search inside
pm_state_get().
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Use power state pointers instead of copies which improves performance.
Align power_mgmt_multicore test which was creating pm states in
runtime.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
In some platforms it may be desirable to disable certain CPU power
states, for example, because they have extra requirements not available
on all boards/applications. Because `cpu-power-states` are defined at
SoC dts file levels, the only way to achieve that now was by re-defining
`cpu-power-states` property in e.g. a board file. With this patch, one
can now selectively set `status = "disabled";` to any power state and it
will be skipped by the PM subsystem.
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
In order to bring consistency in-tree, migrate all subsystems code to
the new prefix <zephyr/...>. Note that the conversion has been scripted,
refer to zephyrproject-rtos#45388 for more details.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The CPU power states were declared with a typecast array literal,
which is a GNU extension.
Unfortunately some compilers (xt-xcc even in very recent versions,
when used with -fdata-sections) will die with a compiler error when
those rvalues are used in an expression that also takes their address,
e.g.:
/* this all by itself crashes xcc -fdata-sections */
int *foo = (int[]){0};
Declare the array elments in two steps, making the code standard C.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
The PM state code is in practice useless when no cpus are defined in DT,
so require this node to be defined.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>