Commit graph

280 commits

Author SHA1 Message Date
Flavio Ceolin 8beb34237b pm: Allow override constraints implementation
Implement constraint API as weak symbols so applications or platform
can override them. Constraints are a high-level abstraction to inhibit
the power subsystem of using certain power states. Some platforms can
have their own way to set/release constraints in their drivers that
are not part of Zephyr's code base.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-09-13 05:50:54 -04:00
Anas Nashif 4ffb90f202 doc: pm: rework main documentation
Minor edits and remove old terminology of central and distributed.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-09-09 08:06:36 -04:00
Flavio Ceolin d9d5c41294 pm: device: Remove transitional states
PM_DEVICE_STATE_RESUMING and PM_DEVICE_STATE_SUSPENDING
are transitional states and are only used in device runtime. Remove it
and use device flag to keep track of a transition.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-27 17:47:10 -04:00
Flavio Ceolin 2549160d69 pm: device: Remove PM_DEVICE_STATE_FORCE_SUSPEND
This is not a state but an action. Just remove it.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-27 17:47:10 -04:00
Flavio Ceolin 4960a9aa7a pm: device_runtime: Fix possible underflow
The runtime API is referenced count and uses a uint32_t.
Avoid underflow when dealing with put requests.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-25 19:40:17 -04:00
Flavio Ceolin 93ae6e930a pm: device_runtime: Fix return values
Return 0 in cases where the request does not trigger a device state
change, only incremented or to decremented the reference count.

Fixes #37821

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-25 19:40:17 -04:00
Flavio Ceolin 7aa6fe148e pm: system: Suspend devices on STATE_SOFT_OFF
Suspend devices when the system goes to STATE_SOFT_OFF.
This state was not triggering any device power management. This should
at least suspend devices as it is done for SUSPEND_TO_RAM and
SUSPEND_TO_DISK.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-24 22:29:34 -04:00
Flavio Ceolin b91baf46b7 pm: device_runtime: Simplify variable name
Simplify an internal variable name.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-23 17:46:33 -04:00
Flavio Ceolin 83b222d7a6 pm: device_runtime: Do not directly set the state
The state variable is already set in pm_device_state_set. Do not change
it again.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-23 17:46:33 -04:00
Flavio Ceolin 73b9a28b27 pm: device_runtime: Fix power state type
Internal function was still using uint32_t instead of the proper enum.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-23 17:46:33 -04:00
Meng xianglin f039cc44a1 pm: refine defination of pm_dump_debug_info()
Provide dummy implementation of pm_dump_debug_info() as a
static inline function in pm.h.

Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
2021-08-19 10:19:24 -04:00
Flavio Ceolin cfa5715b3d pm: device: Use the right build conditional
_pm_devices, pm_suspend_devices, pm_low_power_devices and
pm_resume_devices are only used if CONFIG_PM_DEVICE is defined and not
CONFIG_PM.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-17 06:03:44 -04:00
Flavio Ceolin 69e57d633f pm: device: Do not suspend wake up sources
Check if a device is being used as a wake up source before suspend it.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-11 19:39:13 -04:00
Flavio Ceolin 8eceeee798 pm: device: Add wakeup source API
Introduce a new API to allow devices capable of wake up the system
register themselves was wake up sources. This permits applications to
select the most appropriate way to wake up the system when it is
suspended.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-11 19:39:13 -04:00
Flavio Ceolin a245ed2a87 pm: device: Change atomic flags type
Just using a simple atomic for flags instead of using an array.

While is neat using ATOMIC_DEFINE for future proof. The reality is
that it brings some problem for the wakeup source implementation
that needs to statically initialize it during the device definition.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-11 19:39:13 -04:00
Gerard Marull-Paretas 8b0d3450a0 pm: device: use z_device_get_all_static
Use the internal function z_device_get_all_static helper function
instead of using __device_start and __device_end directly. Some other
minor adjustments have been done (e.g. reduce *dev scope to the for
loop). An issue on the range of the for loop in _pm_devices has also
been fixed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-07 19:59:48 -04:00
Gerard Marull-Paretas 7e7b222d84 pm: device: simplify suspend checks
The shared _pm_devices function used should_suspend check function to
see if a device had to be suspended or not. Some of the logic inside
that function was redundant since the pm_device_state_set function
already performs similar checks, e.g. if the device is already at the
given state or the state transition is not supported it will return
error codes appropriately.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-07 19:59:48 -04:00
Gerard Marull-Paretas f93778f2d2 pm: device: do not allow suspending a turned off device
A device that is turned off should not be suspended. A device that has
been turned off can only be resumed. This action is currently forbidden
by the "should_suspend" function in the device PM code.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-07 19:59:48 -04:00
Gerard Marull-Paretas 9e8e88aee4 pm: device: add compatibility for force suspend and low power
Add support for FORCE_SUSPEND and LOW_POWER actions. Even though these
actions have no clear meaning, they are added for compatibility until
their associated states are discussed. Their usage in new code should be
discouraged until the associated states are clarified.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas 2ccf41a6d9 pm: device: handle devices not supporting requested state
If a device does not support, for example, the suspend action the
subsystem should just ignore the device.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas 7ccc1a41bc pm: use actions for device PM control
Instead of passing target states, use actions for device PM control.
Actions represent better the meaning of the callback argument.
Furthermore, they are more future proof as they can be suitable for
other PM actions that have no direct mapping to a state. If we compare
with Linux, we could have a multi-stage suspend/resume. Such scenario
would not have a good mapping when using target states.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas d41dadc569 pm: rename PM_DEVICE_STATE_SUSPEND to PM_DEVICE_STATE_SUSPENDED
The verb tense for the suspended state was not consistent with other
states. The likely reason: state was being used as a command/action.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas bc2990f82d pm: device: do not call device if already on the given state
If the device is already at the given state, do not call the device PM
control function. This makes sure that devices are only called to change
from one state to another.

Even though asynchronous device PM is completely broken, transitional
states are considered too.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas abbb8b7c91 pm: device: improve docs and arg names for state set
Improve the docstrings of the pm_device_state_set function and change to
shorter argument variable names.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas 11eef4d8c8 pm: device: remove pointer usage for state
Since the state is no longer modified by the device PM callback, just
use the state value.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas 9e7d545bb4 pm: device: remove ctrl_command callback argument
The ctrl_command is not used anymore, so remove it from the callback
signature.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas c2cf1ad203 pm: device: remove usage of local states
The device PM subsystem already holds the device state, so there is no
need to keep duplicates inside the device. The pm_device_state_get has
been refactored to just return the device state. Note that this is still
not safe, but the same applied to the previous implementation. This
problem will be addressed later.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas 6c3beb928e pm: adjust busy check API call return types and naming
Busy check APIs now return boolean type. Due to that change, the
function names have also been adjusted. The common name pattern for
boolean check type APIs is "PREFIX_is_CONDITION". For example,
"pm_device_is_busy".  pm_device_busy_check has been renamed to
pm_device_is_busy and pm_device_any_busy_check to pm_device_is_any_busy.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-07-30 09:28:42 -04:00
Gerard Marull-Paretas 77728e16df pm: device: improve usage of the atomic flags field
- Use an enum for the available flags
- Use ATOMIC_DEFINE macro to declare the flag bit field
- Improve naming

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-07-30 09:28:42 -04:00
Gerard Marull-Paretas 70322853a8 pm: device: move device busy APIs to pm subsystem
The following device busy APIs:

- device_busy_set()
- device_busy_clear()
- device_busy_check()
- device_any_busy_check()

were used for device PM, so they have been moved to the pm subsystem.
This means they are now prefixed with `pm_` and are defined in
`pm/device.h`.

If device PM is not enabled dummy functions are now provided that do
nothing or return `-ENOSYS`, meaning that the functionality is not
available.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-07-30 09:28:42 -04:00
Flavio Ceolin dd54a8daed pm: Avoid weak function clash
SoC hooks are defined as weak functions for the case where they are
not implemented by a SoC. The problem that may happen is when an
application define it as weak as well. In this case, no compilation
error is issued but the version that will be used depends on the build
order. Just remove the weak placeholder implementation.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-07-26 04:31:54 -04:00
Flavio Ceolin 65e4add74e soc: cc13x2: Use residency policy
cc13x2_cc26x2 had its own power policy that was implementing the same
logic available in the default residency policy. Also, this policy was
unnecessarily setting up a timeout to wakeup the system. This is not
necessary, the power subsystem takes care of this.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-07-21 17:54:40 +03:00
Gerard Marull-Paretas 26ad8376bd pm: remove callback from control function
The callback is not used anymore, so just delete it from the pm_control
callback signature.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-07-13 09:36:45 -04:00
Gerard Marull-Paretas a4f22b6235 pm: device: remove runtime PM callback
The callback used by the device runtime PM can be easily replaced by a
simple state set after calling the state set/get calls. Broadcast logic
is simplified too, leading to the same previous behavior.

Since this is the only place where this callback was used, it can now be
removed from all devices and so pm_control callback signature
simplified.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-07-13 09:36:45 -04:00
Gerard Marull-Paretas cc2f0e9c08 pm: use enum for device PM states
Move all PM_DEVICE_STATE_* definitions to an enum. The
PM_DEVICE_STATE_SET and PM_DEVICE_STATE_GET definitions have been kept
out of the enum since they do not represent any state. However, their
name has not been changed since they will be removed soon.

All drivers and tests have been adjusted accordingly.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-07-07 14:13:12 -04:00
Flavio Ceolin 4f609886de pm: Fix policy manager header
Policy manager header has to be in the include for applications.
Also it had several function prototypes that are not part of the policy.
These functions were moved from the policy header to a dedicated private
header.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-06-14 21:48:27 -04:00
Gerard Marull-Paretas c708a17b8e pm: device: remove CONFIG_PM_MAX_DEVICES
When a device is defined a new pointer to a device will be created in
the "z_pm_device_slots" region, effectively creating a device array with
the same size as the number of system devices. This array is then used
by the device PM subsystem to keep track of suspended devices during
power transitions.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-29 07:38:06 -04:00
Flavio Ceolin 40780fdbeb pm: device: Get rid of device_idx_t
It was just making the code hard to read. Also it was not following
the code guideline because the type was not telling us the sign
and size.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-27 14:35:27 -04:00
Flavio Ceolin 3dad4a068a pm: device: Get rid of z_pm_core_devices
z_pm_core_devices was hack to set some priority between devices. It
was doing it hardcoding some devices that were the first to bring up
and the last to power down. Remove it and use the same list used to
initialize devices.

Fixes #34214

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-27 14:35:27 -04:00
Flavio Ceolin 3056c5ec30 pm: device_runtime: Remove not necessary check
pm_device_runtime_state_set takes care of the check the reference count
and take the right action. It is not necessary check it in
pm_device_request.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-26 10:56:55 -04:00
Flavio Ceolin 5c03d9643f pm: device_runtime: Simplify mutex usage
Assuming that pm_device_state_set is synchronous it is possible to
simplify the mutex usage. Now there are two places where the lock is
held, one in the worqueue handler and other in pm_device_request to
cover the synchronous path. It is no longer needed held the lock in the
pm_device_state_set callback and not needed to wait on the conditional
variable after set the state in the synchronous path.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-26 10:56:55 -04:00
Flavio Ceolin d67a5786bc pm: device_runtime: Change API behavior s/_sync/_async
Most APIs have the default synchronous and an asynchronous version
with the sufix _async because that is the most common use.

All devices in tree right now are using the synchronous version, so
just change it to be consistent with the rest of the system.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-26 10:56:55 -04:00
Flavio Ceolin 29d3246ba5 pm: device_runtime: Don't use k_work on synchronous calls
Do not use worqueue on put/get synchronous calls.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-26 10:56:55 -04:00
Flavio Ceolin d325642892 pm: device_runtime: Get rid of atomic for state
Since we are using mutex to protect critical sections and mutexes are
reentrant, it is possible to get rid of atomic for the state because
we can lock the mutex in device_pm_callback.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-26 10:56:55 -04:00
Flavio Ceolin 97281b3862 pm: device_runtime: get rid of the spinlock
Protect critical sections using the mutex.
The mutex is required to use the conditional variable and since we
need to atomically check the pm state and the workqueue before wait
the condition, it is necessary to protect them using the same mutex.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-26 10:56:55 -04:00
Flavio Ceolin 366c6ad47b pm: device_runtime: Fix sync path
Properly wait on conditional variable using the new API.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-26 10:56:55 -04:00
Flavio Ceolin ce989e33e6 pm: device_runtime: Fix atomic usage
Protect critical sessions using the spinlock available. The atomic
usage was not properly protecting the critical section and was
possible to have a race condition between the usage check and state
set.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-26 10:56:55 -04:00
Flavio Ceolin 98fd9c3e65 pm: device_runtime: Fix enable / disable runtime pm
Device pm runtime should only be enabled if device supports pm.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-26 10:56:55 -04:00
Flavio Ceolin 378a19d2a8 pm: device_runtime: Add helper to wait on async ops
Add a function that properly uses a mutex to check a condition before
wait on the conditional variable.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-26 10:56:55 -04:00
Anas Nashif 3b82c388f6 pm: trace pm_device_enable/disable
Trace both pm_device_enable and pm_device_disable.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-05-17 18:45:57 -04:00
Anas Nashif 2642f4d62c pm: remove mention of FSM
FSM terminology was removed, clean some remaining occurances.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-05-17 18:45:57 -04:00
Anas Nashif eccda68418 power: trace power events
Trace PM transition sequence and events.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-05-17 18:45:57 -04:00
Gerard Marull-Paretas 9b846351d9 pm: device: check for ENOSYS
If feature is not available -ENOSYS is used instead of -ENOTSUP.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-13 07:16:02 -05:00
Flavio Ceolin 929c573d31 pm: policy: Fix residency policy math
The time necessary to resume from a power state has to be added to the
minimal residency time to check if there is enough time to go to a
particular state.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-11 17:14:48 -05:00
Flavio Ceolin 0c607adb63 pm: device: Align state names with system states
Change device pm states to the same pattern used by system power
management.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-07 18:35:12 -04:00
Flavio Ceolin 86a8ab5c2c pm: device_runtime: Just fix a comment
Fixing the comment about powering a device on in pre-kernel.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-07 18:35:12 -04:00
Flavio Ceolin 1bd781e7b5 power: device_pm: Remove device idle pm states
Avoid confusion with device runtime idle pm states and just use device
pm states.

This simplify the code a little bit and prepare the ground for having
a better definition of device pm states. Right now this code needed to
hijack two transitional states to not break the current code logic but
the goal is avoid it and have everything in one single place.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-07 18:35:12 -04:00
Flavio Ceolin e89d9d65cc pm: device_runtime: Power device on/off in pre-kernel
Devices may be initialized but started powered down for this reason
is necessary to power a device on if requested even if in pre-kernel
state.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-07 16:55:31 -04:00
Flavio Ceolin c7f5270a01 pm: device: fsm_state -> state
Rename state variable.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-07 16:55:31 -04:00
Flavio Ceolin 4ce32edb76 power: device: Do not suspend a busy device
Check if a device is busy before suspend it.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-07 16:55:31 -04:00
Flavio Ceolin 54324fd08e power: device_pm: Use spin lock instead of semaphore
Device pm runtime was using semaphore to protect critical section but
enable / disable functions were waiting on the semaphore. So, just
replace it with a spin lock.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-07 16:55:31 -04:00
Flavio Ceolin 39ec8c1cb9 power: device_pm: Add missing fallthrough
Add an explicit fallthrough in a case label.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-07 16:55:31 -04:00
Flavio Ceolin 8705c688e2 power: device_pm: Fix concurrence issues
The sync API was using k_poll_signal and in certain conditions is
possible multiple threads waiting on a signal leading to an undefined
behavior.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-07 16:55:31 -04:00
Flavio Ceolin 66b0483cce power: device_pm: Use BIT macro for code compliance
BIT macro properly handle bit shift operations.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-07 16:55:31 -04:00
Flavio Ceolin 6d67bb1b7d power: device_pm: Check if is running in pre-kernel
Don't use kernel services before in pre-kernel state.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-07 16:55:31 -04:00
Flavio Ceolin 7eba310220 power: device: void *context -> uint32_t *state
The context parameter used across device power management is
actually the power state. Just use it and avoid a lot of
unnecessary casts.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-07 16:55:31 -04:00
Flavio Ceolin 9ac646f277 power: device: Don't wake up devices unnecessarily
Currently when the system goes to sleep it asks *all* devices that
support PM to suspend or go to a low power state, and the system wakes
up it put *all* suspended devices in active state, even if a device
was already suspended and not being used.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-07 16:55:31 -04:00
Gerard Marull-Paretas 56f1a8ce98 pm: rename PM_DEVICE_GET/SET_POWER_STATE to PM_DEVICE_STATE_GET/SET
Adjust name to be consistent with device PM naming conventions.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-05 18:35:49 -04:00
Gerard Marull-Paretas 6633b05530 pm: move device_pm.c to device_runtime.c
File name should reflect what it contains.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-05 18:35:49 -04:00
Gerard Marull-Paretas 7988ab4a26 pm: rename device_set/get_power_state to pm_device_set/get
Make name consistent with other device PM APIs.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-05 18:35:49 -04:00
Gerard Marull-Paretas 1e50e08bca pm: move device_set/get_power_state to pm/device.h
These are device PM APIs, so move them to the device PM API header.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-05 18:35:49 -04:00
Gerard Marull-Paretas 7bfd3a11f3 device: rename device_pm_control to pm_control
Remove device_ prefix since it is redundant.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-05 18:35:49 -04:00
Gerard Marull-Paretas 570b43a70e pm: rename device_pm_state_str to pm_device_state_str
Prefix all device PM functions/data structures with pm.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-05 18:35:49 -04:00
Gerard Marull-Paretas d31a9be27c pm: device: rename device_pm struct to pm_device
Prefix all PM related functions/structures with pm.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-05 18:35:49 -04:00
Gerard Marull-Paretas 2c7b763e47 pm: replace DEVICE_PM_* states with PM_DEVICE_*
Prefix device PM states with PM.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-05 18:35:49 -04:00
Gerard Marull-Paretas ddfd27dbfb pm: replace power/power.h with pm/pm.h
Replace old header with the new one.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-05 18:35:49 -04:00
Gerard Marull-Paretas c524075780 pm: runtime: rename API with pm_device prefix
Use `pm_device_*` prefix for the device runtime PM API. This adds the
API to the `pm` namespace, making it clear part of the PM subsystem.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-05 18:35:49 -04:00
Gerard Marull-Paretas f69759d34a pm: rename CONFIG_PM_DEVICE_IDLE to CONFIG_PM_DEVICE_RUNTIME
Make naming clear on the purpose of this option.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-05 18:35:49 -04:00
Gerard Marull-Paretas 0aa3df06c2 pm: move private enum to source using it
`enum device_pm_state` is not used publicly, so move it to the source
using it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-05 18:35:49 -04:00
Gerard Marull-Paretas 99cbee3f16 pm: move power subsystem to pm
Adjust naming to make things consistent.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-05 18:35:49 -04:00