Commit graph

4 commits

Author SHA1 Message Date
Declan Snyder
6bd6e50838 pm: Add API to check if a state disables a device
Add an API function that can be used by client code to check if a state
disables a device.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-05-30 19:40:11 +02:00
Declan Snyder
65ebecbf78 pm: refactor policy_device_ get/put
Refactor this code so it has less nesting and is able to share some code
between functions, by making a function to find the device constraints
object which can be called before doing operations using it.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-05-30 19:40:11 +02:00
Flavio Ceolin
b8ce176109 pm: policy: Fix possible undefined reference
When PM_POLICY_DEVICE_CONSTRAINTS is enabled, we create a list of
devices with the property “zephyr,disabling-power-states” and their
respective states to lock. However, if a device is declared but not
built (e.g., due to a Kconfig option), we have an undefined reference.

This PR changes the code to use the device name instead of the
reference. This increases lookup time (which could be cached at
runtime), and we still have an entry for a non-existent device.

Signed-off-by: Flavio Ceolin <flavio@hubblenetwork.com>
2025-02-08 04:06:29 +01:00
Gerard Marull-Paretas
6f4bb118a8 pm: policy: split policy APIs implementations
policy.c has grown organically, it contained many independent pieces of
code. This patch splits each logical unit into its own C file, making it
easier to browse the code.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-10-24 17:50:44 +02:00