Commit graph

9 commits

Author SHA1 Message Date
Krzysztof Chruściński
8ad44471b9 pm: Include disabled states in search inside pm_state_get
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>
2025-05-05 21:56:55 +02:00
Krzysztof Chruściński
ecabcf5db5 pm: Use pointers for current and forced power states
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>
2025-04-17 21:17:18 +02:00
Gerard Marull-Paretas
a05371d353 pm: state: allow disabling certain power states
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>
2023-07-26 16:49:00 +02:00
Gerard Marull-Paretas
2e0899e8ca pm: state: use DT_FOREACH_CHILD_SEP
Avoid usage of auxiliary macros by using DT_FOREACH_CHILD_SEP.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-30 16:19:57 +02:00
Gerard Marull-Paretas
5113c1418d subsystems: migrate includes to <zephyr/...>
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>
2022-05-09 12:07:35 +02:00
Krzysztof Chruscinski
47ae656cc1 all: Deprecate UTIL_LISTIFY and replace with LISTIFY
UTIL_LISTIFY is deprecated. Replacing it with LISTIFY.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-08 11:03:30 +01:00
Andy Ross
0c30db1ec5 subsys/pm: C99-legalize declaration of CPU power states
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>
2022-01-27 16:26:27 -05:00
Gerard Marull-Paretas
7eb50bebe4 pm: state: require cpus node
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>
2022-01-11 10:46:20 +01:00
Gerard Marull-Paretas
8385d1bce5 pm: state: add pm_state_cpu_get_all
Add a new API to obtain the list of power states available for a given
CPU.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-11 10:46:20 +01:00