This patch introduces the support of low power modes
for the STM32WBxx from STMicroelectronics based on the lptim
Here, the power modes are sleep modes have lptimer as wakeup source.
The sleep modes are configured by the SYS_POWER_MANAGEMENT.
Signed-off-by: Francois Ramu <francois.ramu@st.com>
Device objects in Zephyr are currently placed into an array by linker
scripts, making it easy to iterate over all devices if the array
address and size can be obtained. This has applications in device
power management, but the existing API for this was available only
when that feature was enabled. It also uses a signed type to hold the
device count.
Provide a new API that is generally available, but marked as internal
since normally applications should not iterate over all devices. Mark
the PM API approach deprecated.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This patch introduces the support of low power modes
for the STM32L4xx from STMicroelectronics based on the lptim
Here, the power modes are sleep modes with lptimer as wakeup.
Depending on the SYS_POWER_MANAGEMENT configuration.
Signed-off-by: Francois Ramu <francois.ramu@st.com>
This will be useful to test network stack's power management support.
There is no other way to do it, so far, but to hardcode such config
option test there.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
For backwards compatibility ignore not-supported errors for devices
that don't support power management.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Use a smaller ordinal type than int to hold the global index
identifying devices that support power management.
Use an upper bound instead of an array of flags to identify the
devices that were successfully suspended.
Only attempt pm on devices that provide a non-default pm control
function.
Use shorter more descriptive names for state variables.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Convert driver to use instance macro's instead of dts_fixup.h based
macros. This moves us closer to removing both dts_fixup.h and per
instance Kconfig symbols.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The device power management infrastructure maintains a hard-coded list
of critical devices to ensure suspend and resume are performed in the
proper order. PR #21298 combined the 32 KiHz and 16 MHz clock devices
into a single driver, changing the name so the clock driver is not
handled at the correct time, but rather at whatever point it appears
in the general device list.
Update the list to the current clock driver name. Also store the
device names as standard strings rather than padding them to a fixed
length.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Function to put devices in lower power mode were all implemented in the
same way. Deduplicate code there by implementing single function to
handle all cases.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
There is no point to specify number of core devices explicitly, as it
can be done by compiler with ARRAY_SIZE() macro.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
When system going to sleep state, make peripherals go to state
DEVICE_PM_LOW_POWER_STATE which needs less time than state
DEVICE_PM_SUSPEND_STATE to save more power.
Signed-off-by: Wentong Wu <wentong.wu@intel.com>
Current PM policy allow devices make the decision if going to
sleep/deep sleep state, so it's not error message if some
devices don't enter suspend state, change it to debug level.
Signed-off-by: Wentong Wu <wentong.wu@intel.com>
The existing device_set_power_state() API works only in synchronous
mode and this is not desirable for devices(ex: Gyro) which take
longer time (few 100 mSec) to suspend/resume.
To support async mode, a new callback argument is added to the API.
The device drivers can asynchronously suspend/resume and call the
callback function upon completion of the async request.
This commit adds the missing callback parameter to all the drivers
to make it compliant with the new API.
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
This commit fixes compilation of System Power Management module
when Device Power Management is disabled.
Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
This commit simplifies OS <-> Application interface controlling power
management. In the previous approach application-based PM required
overriding sys_suspend() and sys_resume() functions. As these functions
actually implemented power state change, in such case application
basically had to provide own implementation of all PM-related stuff,
which was not portable and hard to maintain.
This commit changes this scheme: The sys_suspend() and sys_resume()
are now system functions while the application could either use
built-in power management policies or provide its own. All details
of power mode switching are now handled by the OS.
Also, this commit cleans up the Kconfig options related to system-level
power management grouping them under common CONFIG_SYS_PM_ prefix.
Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
This commit updates the README and sample.yaml in order to signal
that this demo works flawlessly on the nRF51 platform.
Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
Add an API for force suspending the devices. This API can be
called during unexpected system shutdown/poweroff scenarios
to safely turnoff the devices.
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Add support for adding and selecting pluggable PM policies
which can be enabled based on the application needs.
Also added a dummy policy for demonstration purpose which
simply loops over the supported PM states.
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Rather than having some implied name for the logging name, explicitly
pass it in the macros LOG_MODULE_REGISTER & LOG_MODULE_DECLARE.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Add support for OS managed Power Management framework for Zephyr
under 'subsys/power'. This framework takes care of implementing
the _sys_soc_suspend/_sys_soc_resume API's, a PM policy based on
SoC Low Power residencies and also provides necessary API's to
do devices suspend and resume.
Also add necessary changes to support the existing Application
managed Power Management framework.
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>