power: Rework OS <-> Application interface

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 is contained in:
Piotr Zięcik 2019-02-04 15:05:23 +01:00 committed by Anas Nashif
commit c45961daae
26 changed files with 126 additions and 280 deletions

View file

@ -1,25 +1,18 @@
if PM_CONTROL_OS
menu "OS Power Management"
source "subsys/power/policy/Kconfig"
config PM_CONTROL_STATE_LOCK
bool "Enable PM state locking capability"
config SYS_PM_STATE_LOCK
bool "Enable Power State locking capability"
help
Enable OS Power Management state locking capability
Enable Power Management system state locking capability
if any application wants to temporarily disable certain
Power States while doing any critical work or needs quick
response from hardware resources.
config PM_CONTROL_OS_DEBUG
bool "Enable OS Power Management debug hooks"
config SYS_PM_DEBUG
bool "Enable System Power Management debug hooks"
help
Enable OS Power Management debugging hooks.
Enable System Power Management debugging hooks.
module = PM
module-str = Power Management
source "subsys/power/policy/Kconfig"
module = SYS_PM
module-str = System Power Management
source "subsys/logging/Kconfig.template.log_config"
endmenu
endif # PM_CONTROL_OS