Commit graph

74 commits

Author SHA1 Message Date
Piotr Zięcik
d30c9aeafd drivers: nrf_power_clock: Migrate to DTS.
This commit migrates the nrf_power_clock driver to DTS.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-02-25 17:51:24 +01:00
Piotr Zięcik
4558c5c4f4 power: policy_residency: Update Kconfig options description
This commit adds better description to the Kconfig options
configuring residency-based power policy.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-02-19 13:25:36 -05:00
Piotr Zięcik
99c35602fe power: Do not suspend devices if device PM is not compiled in
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>
2019-02-19 13:25:36 -05:00
Piotr Zięcik
63b0df645e power: Clean up power state names
Some of power states used numerical suffix while otthers not.
This commit adds proper suffix to all power state names.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>

f
2019-02-19 13:25:36 -05:00
Piotr Zięcik
c45961daae 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>
2019-02-19 13:25:36 -05:00
Piotr Zięcik
04cb93a250 power: Add sys_pm_force_power_state() API
At the moment application which chosen policy based power
management does not have an option to override decision
taken by the policy (it could only disable some power
states).

This commit adds the sys_pm_force_power_state() method,
which allow the application to choose power state used
when OS decide to suspend the SoC.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-02-11 07:52:12 -05:00
Piotr Zięcik
d02e3ebd4c power: Eliminate SYS_PM_* power states.
The power management framework used two different abstractions
to describe power states. The SYS_PM_* given coarse information
what kind of power state (low power or deep sleep) was used,
while the SYS_POWER_STATE_* abstraction provided information
about particular power mode.

This commit removes the SYS_PM_* abstraction as the same
information is already carried in SYS_POWER_STATE_*.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-02-08 09:07:00 -05:00
Piotr Zięcik
b6bf56c3fc power: pm_ctrl: Allow fine-grained power state locking
This commit enables fine-grained power state locking.
Now, each power state could be independently enabled or disabled.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-02-06 14:24:01 +01:00
Piotr Zięcik
28576260c3 power: Remove sys_is_valid_power_state() interface
Each platform is now specifying list of supported power states
as a Kconfig options. Some of the specified states could be
disabled in runtime. As result there is no need for the removed
interface.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-02-04 18:08:47 +01:00
Piotr Zięcik
c39bb49e84 power: Implement weak notification functions.
The power subsystems call the sys_pm_notify_lps_entry()
and sys_pm_notify_lps_exit() to notify application that
given power mode has been entered and exited. This commit
adds weak implementation of these functions in order to
not force applications to implement its own empty stubs.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-02-01 15:08:33 +01:00
Piotr Zięcik
daaf02d3f2 power: policy_residency: Fix power level selection
The algorithm used in residency-based power policy should
select the most saving power mode basing on the expected
sleep time. However due to small bug, the most power
efficient mode was never selected.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-02-01 08:17:41 -05:00
Piotr Zięcik
b343665064 samples: nrf52: power_mgr: Enable the demo on the nRF51 SoC series
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>
2019-01-31 17:39:27 +01:00
Anas Nashif
feadb532e3 power: move reboot.c to subsys/power
One of the few last files in misc/. It fits better under subsys/power.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-22 07:45:22 -05:00
Anas Nashif
74a74bb6b8 power: rename api sys_soc -> sys_
sys_soc is just redundant, just call APIs with sys_*.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-12-28 16:16:28 -05:00
Anas Nashif
9151fbebf2 power: rename APIs and removing leading _
Remove leading underscore from PM APIs. _ was used for internal APIs.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-12-28 16:16:28 -05:00
Ramakrishna Pallala
dbf405ab21 power: Move application level API's to public header
Move the API's used by applications to include/power.h file.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-11-26 18:38:40 -08:00
Ramakrishna Pallala
212b2180c9 power: Add API's to enable/disable System PM states
Add API's to enable/disable System PM states so that an
an application can enable/disable system from entering
certain Low Power states.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-11-26 06:55:57 -08:00
Krzysztof Chruscinski
5e346812ac logging: Refactor LOG_MODULE_REGISTER and LOG_MODULE_DECLARE macros
Changed LOG_MODULE_REGISTER and LOG_MODULE_DECLARE macros to take log
level as optional parameter. LOG_MODULE_DECLARE can now also be used
in static inline functions in headers. Added LOG_LEVEL_SET macro
which is used when instance logging API is used to indicate maximal
log level compiled into the file.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-11-10 12:38:29 -05:00
Ramakrishna Pallala
359341203f power: Add OS Power Management debug hooks
Add the necessary PM hooks like Low Power state entry
count and residencies for logging and debugging purposes.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-10-28 11:44:22 -04:00
Ramakrishna Pallala
8b20f9dbab subsys: power: Add an API for force suspending the devices
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>
2018-10-17 22:02:06 -04:00
Andy Ross
393ec71ec3 clock: Remove CONFIG_TICKLESS_KERNEL_TIME_UNIT_IN_MICRO_SECS
This was only used in a few places just to indirect the already
perfectly valid SYS_CLOCK_TICKS_PER_SEC value.  There's no reason for
these to ever have been kconfig units, and in fact the distinction
appears to have introduced a hidden/untested bug in the power
subsystem (the two variables were used interchangably, but they were
defined in reciprocal units!).

Just use "ticks" as our time unit pervasively, and clarify the docs to
explain that.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Ramakrishna Pallala
c511857f57 subsys: power: Add support for pluggable PM policies
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>
2018-09-20 10:20:23 -04:00
Kumar Gala
4fede8dd0b log: make name param explicit
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>
2018-09-11 13:25:55 -05:00
Ramakrishna Pallala
2ad647857c subsys: power: Add OS managed Power Management framework
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>
2018-08-22 08:07:14 -07:00