For the async operation move from condition variables to events to
reduce the dependency on the mutexes that cannot be used in IRQ
context.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Add a new API used by arch to implement suspend-to-RAM (S2RAM).
The API is composed by a single function to save the CPU context on
suspend.
A CPU context is the arch-specific set of registers that must be
preserved on power-off (in retained RAM) to be able to resume the
execution from the point it was suspended without going through the
whole kernel startup stage.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Sometimes we want to entirely decouple the system PM from the device PM,
leaving the devices to manage its own power states using the runtime PM.
This is currently not possible because the suspend / resume code path is
triggering the device PM hooks even when the runtime PM is enabled.
Introduce a new PM_DEVICE_RUNTIME_EXCLUSIVE symbol to allow the platform
to skip the device PM triggers on suspend / resume.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Add API to add devices to a power domain in runtime. The number of
devices that can be added is defined in build time.
The script gen_handles.py will check the number defined in
`CONFIG_PM_DEVICE_POWER_DOMAIN_DYNAMIC` to resize the handles vector,
adding empty slots in the supported sector to be used later.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Move policy code one level up for simplicity, since there is a single
source file. Source file has been renamed to "policy.c" to make things
clear.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
According to Kconfig guidelines, boolean prompts must not start with
"Enable...". The following command has been used to automate the changes
in this patch:
sed -i "s/bool \"[Ee]nables\? \(\w\)/bool \"\U\1/g" **/Kconfig*
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Add a Kconfig symbol to enable/disable power domain on Zephyr.
Disabling power domain save some memory / space.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
List of improvements:
- The PM logging module was only available if CONFIG_PM=y, however, it
was also used by Device PM (which can be selected without PM). A new
logging module has been created for Device PM.
- Log level is passed to LOG_MODULE_(DECLARE|REGISTER)
- Logger name has been adjusted to `pm` (was `power`)
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
POLL is not a dependency of runtime device PM since it now uses
conditional variables to notify waiting threads.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
SYS_POWER_MANAGEMENT and DEVICE_POWER_MANAGEMENT were deprecated in
2.5.0, remove them now.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Uses the stats subsys to provide simple but useful debugging stats for
power management state changes and timing.
Removes the no longer needed PM_DEBUG config option
Replaces the use of PM_DEBUG for a test clock output pin for mec1501 and
adds in its place an SoC Kconfig option to enable it.
Adds a STATS_SET macro for assigning a value to a stat group field
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
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>