power: rename Low Power States to Sleep States
There exists SoCs, e.g. STM32L4, where one of the low power modes reduces CPU frequency and supply voltage but does not stop the CPU. Such power modes are currently not supported by Zephyr. To facilitate adding support for such class of power modes in the future and to ensure the naming convention makes it clear that the currently supported power modes stop the CPU this commit renames Low Power States to Slep States and updates the documentation. Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
This commit is contained in:
parent
f5c4e369ea
commit
204311d004
12
arch/Kconfig
12
arch/Kconfig
|
@ -351,25 +351,25 @@ config ARCH_HAS_THREAD_ABORT
|
|||
# Hidden PM feature configs which are to be selected by
|
||||
# individual SoC.
|
||||
#
|
||||
config HAS_STATE_LOW_POWER_1
|
||||
config HAS_STATE_SLEEP_1
|
||||
# Hidden
|
||||
bool
|
||||
help
|
||||
This option signifies that the target supports the SYS_POWER_STATE_LOW_POWER_1
|
||||
This option signifies that the target supports the SYS_POWER_STATE_SLEEP_1
|
||||
configuration option.
|
||||
|
||||
config HAS_STATE_LOW_POWER_2
|
||||
config HAS_STATE_SLEEP_2
|
||||
# Hidden
|
||||
bool
|
||||
help
|
||||
This option signifies that the target supports the SYS_POWER_STATE_LOW_POWER_2
|
||||
This option signifies that the target supports the SYS_POWER_STATE_SLEEP_2
|
||||
configuration option.
|
||||
|
||||
config HAS_STATE_LOW_POWER_3
|
||||
config HAS_STATE_SLEEP_3
|
||||
# Hidden
|
||||
bool
|
||||
help
|
||||
This option signifies that the target supports the SYS_POWER_STATE_LOW_POWER_3
|
||||
This option signifies that the target supports the SYS_POWER_STATE_SLEEP_3
|
||||
configuration option.
|
||||
|
||||
config HAS_STATE_DEEP_SLEEP_1
|
||||
|
|
|
@ -24,9 +24,9 @@ Terminology
|
|||
The CPU and clocks are powered on. This is the normal operating state when
|
||||
the system is running.
|
||||
|
||||
:dfn:`Low Power State`
|
||||
Refers to any one of the low power states supported by the SoC. The SoC is
|
||||
usually powered on while the clocks are power gated.
|
||||
:dfn:`Sleep State`
|
||||
Some of the SoC clocks are gated. The CPU is stopped but does not lose
|
||||
execution context. Configuration of the peripherals is preserved.
|
||||
|
||||
:dfn:`Deep Sleep State`
|
||||
The SoC is power gated and loses context. Most peripherals would also be
|
||||
|
@ -172,15 +172,16 @@ The power management subsystem classifies power management schemes
|
|||
into two categories based on whether the CPU loses execution context during the
|
||||
power state transition.
|
||||
|
||||
* Low Power State
|
||||
* Sleep State
|
||||
* Deep Sleep State
|
||||
|
||||
Low Power State
|
||||
===============
|
||||
Sleep State
|
||||
===========
|
||||
|
||||
CPU does not lose execution context. Devices also do not lose power while
|
||||
entering power states in this category. The wake latencies of power states
|
||||
in this category are relatively low.
|
||||
CPU is stopped but does not lose execution context. Some of the SoC clocks are
|
||||
gated. Configuration of the peripherals is preserved but some of them may be no
|
||||
longer functional. Execution will resume at the place it stopped. The wake
|
||||
latencies of power states in this category are relatively low.
|
||||
|
||||
Deep Sleep State
|
||||
================
|
||||
|
@ -190,7 +191,7 @@ OS startup code or at a resume point determined by a bootloader that supports
|
|||
deep sleep resume. Depending on the SOC's implementation of the power saving
|
||||
feature, it may turn off power to most devices. RAM may be retained by some
|
||||
implementations, while others may remove power from RAM saving considerable
|
||||
power. Power states in this category save more power than Low Power states
|
||||
power. Power states in this category save more power than Sleep states
|
||||
and would have higher wake latencies.
|
||||
|
||||
Device Power Management Infrastructure
|
||||
|
@ -523,9 +524,9 @@ the following configuration flags.
|
|||
|
||||
This flag enables the tickless idle power saving feature.
|
||||
|
||||
:option:`CONFIG_SYS_POWER_LOW_POWER_STATES`
|
||||
:option:`CONFIG_SYS_POWER_SLEEP_STATES`
|
||||
|
||||
This flag enables support for the Low Power states.
|
||||
This flag enables support for the Sleep states.
|
||||
|
||||
:option:`CONFIG_SYS_POWER_DEEP_SLEEP_STATES`
|
||||
|
||||
|
|
|
@ -26,17 +26,17 @@ extern "C" {
|
|||
enum power_states {
|
||||
SYS_POWER_STATE_AUTO = (-2),
|
||||
SYS_POWER_STATE_ACTIVE = (-1),
|
||||
#ifdef CONFIG_SYS_POWER_LOW_POWER_STATES
|
||||
# ifdef CONFIG_HAS_STATE_LOW_POWER_1
|
||||
SYS_POWER_STATE_LOW_POWER_1,
|
||||
#ifdef CONFIG_SYS_POWER_SLEEP_STATES
|
||||
# ifdef CONFIG_HAS_STATE_SLEEP_1
|
||||
SYS_POWER_STATE_SLEEP_1,
|
||||
# endif
|
||||
# ifdef CONFIG_HAS_STATE_LOW_POWER_2
|
||||
SYS_POWER_STATE_LOW_POWER_2,
|
||||
# ifdef CONFIG_HAS_STATE_SLEEP_2
|
||||
SYS_POWER_STATE_SLEEP_2,
|
||||
# endif
|
||||
# ifdef CONFIG_HAS_STATE_LOW_POWER_3
|
||||
SYS_POWER_STATE_LOW_POWER_3,
|
||||
# ifdef CONFIG_HAS_STATE_SLEEP_3
|
||||
SYS_POWER_STATE_SLEEP_3,
|
||||
# endif
|
||||
#endif /* CONFIG_SYS_POWER_LOW_POWER_STATES */
|
||||
#endif /* CONFIG_SYS_POWER_SLEEP_STATES */
|
||||
|
||||
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP_STATES
|
||||
# ifdef CONFIG_HAS_STATE_DEEP_SLEEP_1
|
||||
|
@ -65,29 +65,29 @@ extern unsigned char sys_pm_idle_exit_notify;
|
|||
*/
|
||||
|
||||
/**
|
||||
* @brief Check if particular power state is a low power state.
|
||||
* @brief Check if particular power state is a sleep state.
|
||||
*
|
||||
* This function returns true if given power state is a low power state.
|
||||
* This function returns true if given power state is a sleep state.
|
||||
*/
|
||||
static inline bool sys_pm_is_low_power_state(enum power_states state)
|
||||
static inline bool sys_pm_is_sleep_state(enum power_states state)
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
switch (state) {
|
||||
#ifdef CONFIG_SYS_POWER_LOW_POWER_STATES
|
||||
# ifdef CONFIG_HAS_STATE_LOW_POWER_1
|
||||
case SYS_POWER_STATE_LOW_POWER_1:
|
||||
#ifdef CONFIG_SYS_POWER_SLEEP_STATES
|
||||
# ifdef CONFIG_HAS_STATE_SLEEP_1
|
||||
case SYS_POWER_STATE_SLEEP_1:
|
||||
break;
|
||||
# endif
|
||||
# ifdef CONFIG_HAS_STATE_LOW_POWER_2
|
||||
case SYS_POWER_STATE_LOW_POWER_2:
|
||||
# ifdef CONFIG_HAS_STATE_SLEEP_2
|
||||
case SYS_POWER_STATE_SLEEP_2:
|
||||
break;
|
||||
# endif
|
||||
# ifdef CONFIG_HAS_STATE_LOW_POWER_3
|
||||
case SYS_POWER_STATE_LOW_POWER_3:
|
||||
# ifdef CONFIG_HAS_STATE_SLEEP_3
|
||||
case SYS_POWER_STATE_SLEEP_3:
|
||||
break;
|
||||
# endif
|
||||
#endif /* CONFIG_SYS_POWER_LOW_POWER_STATES */
|
||||
#endif /* CONFIG_SYS_POWER_SLEEP_STATES */
|
||||
default:
|
||||
ret = false;
|
||||
break;
|
||||
|
@ -290,11 +290,11 @@ extern enum power_states sys_suspend(s32_t ticks);
|
|||
extern void sys_set_power_state(enum power_states state);
|
||||
|
||||
/**
|
||||
* @brief Do any SoC or architecture specific post ops after low power states.
|
||||
* @brief Do any SoC or architecture specific post ops after sleep state exits.
|
||||
*
|
||||
* This function is a place holder to do any operations that may
|
||||
* be needed to be done after low power exits. Currently it enables
|
||||
* interrupts after resuming from low power state. In future, the enabling
|
||||
* be needed to be done after sleep state exits. Currently it enables
|
||||
* interrupts after resuming from sleep state. In future, the enabling
|
||||
* of interrupts may be moved into the kernel.
|
||||
*/
|
||||
extern void sys_power_state_post_ops(enum power_states state);
|
||||
|
@ -308,10 +308,10 @@ extern void sys_power_state_post_ops(enum power_states state);
|
|||
extern void sys_pm_notify_lps_entry(enum power_states state);
|
||||
|
||||
/**
|
||||
* @brief Application defined function for low power state exit
|
||||
* @brief Application defined function for sleep state exit
|
||||
*
|
||||
* Application defined function for doing any target specific operations
|
||||
* for low power state exit.
|
||||
* for sleep state exit.
|
||||
*/
|
||||
extern void sys_pm_notify_lps_exit(enum power_states state);
|
||||
|
||||
|
|
|
@ -15,10 +15,9 @@ menuconfig SYS_POWER_MANAGEMENT
|
|||
timer is due to expire.
|
||||
|
||||
if SYS_POWER_MANAGEMENT
|
||||
config SYS_POWER_LOW_POWER_STATES
|
||||
config SYS_POWER_SLEEP_STATES
|
||||
bool "Low Power states"
|
||||
depends on HAS_STATE_LOW_POWER_1 || HAS_STATE_LOW_POWER_2 || \
|
||||
HAS_STATE_LOW_POWER_3
|
||||
depends on HAS_STATE_SLEEP_1 || HAS_STATE_SLEEP_2 || HAS_STATE_SLEEP_3
|
||||
help
|
||||
This option enables the kernel to interface with a power manager
|
||||
application. This permits the system to enter a custom CPU low power
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
*/
|
||||
unsigned char sys_pm_idle_exit_notify;
|
||||
|
||||
#if defined(CONFIG_SYS_POWER_LOW_POWER_STATES)
|
||||
#if defined(CONFIG_SYS_POWER_SLEEP_STATES)
|
||||
void __attribute__((weak)) sys_resume(void)
|
||||
{
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ static void sys_power_save_idle(void)
|
|||
#endif
|
||||
|
||||
set_kernel_idle_time_in_ticks(ticks);
|
||||
#if (defined(CONFIG_SYS_POWER_LOW_POWER_STATES) || \
|
||||
#if (defined(CONFIG_SYS_POWER_SLEEP_STATES) || \
|
||||
defined(CONFIG_SYS_POWER_DEEP_SLEEP_STATES))
|
||||
|
||||
sys_pm_idle_exit_notify = 1U;
|
||||
|
@ -104,7 +104,7 @@ static void sys_power_save_idle(void)
|
|||
|
||||
void z_sys_power_save_idle_exit(s32_t ticks)
|
||||
{
|
||||
#if defined(CONFIG_SYS_POWER_LOW_POWER_STATES)
|
||||
#if defined(CONFIG_SYS_POWER_SLEEP_STATES)
|
||||
/* Some CPU low power states require notification at the ISR
|
||||
* to allow any operations that needs to be done before kernel
|
||||
* switches task or processes nested interrupts. This can be
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
config NRF5_POWER_MGMT_EXAMPLE
|
||||
bool
|
||||
default y
|
||||
select HAS_STATE_LOW_POWER_2
|
||||
select HAS_STATE_LOW_POWER_3
|
||||
select HAS_STATE_SLEEP_2
|
||||
select HAS_STATE_SLEEP_3
|
||||
help
|
||||
Hidden option enabling LPS_1 and LPS_2 low power states.
|
||||
This is needed, as these states are implemented by this example.
|
||||
|
|
|
@ -18,9 +18,9 @@ enters idle state:
|
|||
states, which are signaled using LEDs on the development kit:
|
||||
|
||||
A. LED1: [X], LED2: [X]: System is active, no low power state is selected.
|
||||
B. LED1: [X], LED2: [ ]: System is idle, and the SYS_POWER_STATE_LOW_POWER_2
|
||||
B. LED1: [X], LED2: [ ]: System is idle, and the SYS_POWER_STATE_SLEEP_2
|
||||
state is selected.
|
||||
C. LED1: [ ], LED2: [ ]: System is idle, and the SYS_POWER_STATE_LOW_POWER_3
|
||||
C. LED1: [ ], LED2: [ ]: System is idle, and the SYS_POWER_STATE_SLEEP_3
|
||||
state is selected.
|
||||
|
||||
2. Deep Sleep: This Power State is mapped to SYSTEM OFF state. In this mode
|
||||
|
@ -68,31 +68,31 @@ nRF52 core output
|
|||
<-- App doing busy wait for 10 Sec -->
|
||||
|
||||
<-- App going to sleep for 10 Sec -->
|
||||
--> Entering to SYS_POWER_STATE_LOW_POWER_2 state.
|
||||
--> Exited from SYS_POWER_STATE_LOW_POWER_2 state.
|
||||
--> Entering to SYS_POWER_STATE_SLEEP_2 state.
|
||||
--> Exited from SYS_POWER_STATE_SLEEP_2 state.
|
||||
|
||||
<-- App doing busy wait for 10 Sec -->
|
||||
|
||||
<-- App going to sleep for 30 Sec -->
|
||||
--> Entering to SYS_POWER_STATE_LOW_POWER_3 state.
|
||||
--> Exited from SYS_POWER_STATE_LOW_POWER_3 state.
|
||||
--> Entering to SYS_POWER_STATE_SLEEP_3 state.
|
||||
--> Exited from SYS_POWER_STATE_SLEEP_3 state.
|
||||
|
||||
<-- Disabling SYS_POWER_STATE_LOW_POWER_3 state --->
|
||||
<-- Disabling SYS_POWER_STATE_SLEEP_3 state --->
|
||||
|
||||
<-- App doing busy wait for 10 Sec -->
|
||||
|
||||
<-- App going to sleep for 10 Sec -->
|
||||
--> Entering to SYS_POWER_STATE_LOW_POWER_2 state.
|
||||
--> Exited from SYS_POWER_STATE_LOW_POWER_2 state.
|
||||
--> Entering to SYS_POWER_STATE_SLEEP_2 state.
|
||||
--> Exited from SYS_POWER_STATE_SLEEP_2 state.
|
||||
|
||||
<-- App doing busy wait for 10 Sec -->
|
||||
|
||||
<-- App going to sleep for 30 Sec -->
|
||||
--> Entering to SYS_POWER_STATE_LOW_POWER_2 state.
|
||||
--> Exited from SYS_POWER_STATE_LOW_POWER_2 state.
|
||||
--> Entering to SYS_POWER_STATE_SLEEP_2 state.
|
||||
--> Exited from SYS_POWER_STATE_SLEEP_2 state.
|
||||
|
||||
<-- Enabling SYS_POWER_STATE_LOW_POWER_3 state --->
|
||||
<-- Disabling SYS_POWER_STATE_LOW_POWER_2 state --->
|
||||
<-- Enabling SYS_POWER_STATE_SLEEP_3 state --->
|
||||
<-- Disabling SYS_POWER_STATE_SLEEP_2 state --->
|
||||
|
||||
<-- App doing busy wait for 10 Sec -->
|
||||
|
||||
|
@ -101,11 +101,11 @@ nRF52 core output
|
|||
<-- App doing busy wait for 10 Sec -->
|
||||
|
||||
<-- App going to sleep for 30 Sec -->
|
||||
--> Entering to SYS_POWER_STATE_LOW_POWER_3 state.
|
||||
--> Exited from SYS_POWER_STATE_LOW_POWER_3 state.
|
||||
--> Entering to SYS_POWER_STATE_SLEEP_3 state.
|
||||
--> Exited from SYS_POWER_STATE_SLEEP_3 state.
|
||||
|
||||
<-- Enabling SYS_POWER_STATE_LOW_POWER_2 state --->
|
||||
<-- Forcing SYS_POWER_STATE_LOW_POWER_3 state --->
|
||||
<-- Enabling SYS_POWER_STATE_SLEEP_2 state --->
|
||||
<-- Forcing SYS_POWER_STATE_SLEEP_3 state --->
|
||||
|
||||
<-- App doing busy wait for 10 Sec -->
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
CONFIG_BT=n
|
||||
CONFIG_TIMESLICING=n
|
||||
CONFIG_SYS_POWER_MANAGEMENT=y
|
||||
CONFIG_SYS_POWER_LOW_POWER_STATES=y
|
||||
CONFIG_SYS_POWER_SLEEP_STATES=y
|
||||
CONFIG_SYS_POWER_DEEP_SLEEP_STATES=y
|
||||
CONFIG_DEVICE_POWER_MANAGEMENT=y
|
||||
CONFIG_SYS_PM_STATE_LOCK=y
|
||||
CONFIG_SYS_PM_LPS_1_MIN_RES=5000
|
||||
CONFIG_SYS_PM_LPS_2_MIN_RES=15000
|
||||
CONFIG_SYS_PM_SLEEP_1_MIN_RES=5000
|
||||
CONFIG_SYS_PM_SLEEP_2_MIN_RES=15000
|
||||
CONFIG_GPIO=y
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
CONFIG_NUM_COOP_PRIORITIES=29
|
||||
CONFIG_NUM_PREEMPT_PRIORITIES=40
|
||||
CONFIG_SYS_POWER_MANAGEMENT=y
|
||||
CONFIG_SYS_POWER_LOW_POWER_STATES=y
|
||||
CONFIG_SYS_POWER_SLEEP_STATES=y
|
||||
CONFIG_SYS_POWER_DEEP_SLEEP_STATES=y
|
||||
CONFIG_DEVICE_POWER_MANAGEMENT=y
|
||||
CONFIG_TICKLESS_KERNEL=y
|
||||
|
|
|
@ -8,7 +8,7 @@ tests:
|
|||
harness_config:
|
||||
type: multi_line
|
||||
regex:
|
||||
- "--> Entering to SYS_POWER_STATE_LOW_POWER_2 state."
|
||||
- "--> Exited from SYS_POWER_STATE_LOW_POWER_2 state."
|
||||
- "--> Entering to SYS_POWER_STATE_LOW_POWER_3 state."
|
||||
- "--> Exited from SYS_POWER_STATE_LOW_POWER_3 state."
|
||||
- "--> Entering to SYS_POWER_STATE_SLEEP_2 state."
|
||||
- "--> Exited from SYS_POWER_STATE_SLEEP_2 state."
|
||||
- "--> Entering to SYS_POWER_STATE_SLEEP_3 state."
|
||||
- "--> Exited from SYS_POWER_STATE_SLEEP_3 state."
|
||||
|
|
|
@ -57,28 +57,28 @@ void main(void)
|
|||
switch (i) {
|
||||
case 3:
|
||||
printk("\n<-- Disabling %s state --->\n",
|
||||
STRINGIFY(SYS_POWER_STATE_LOW_POWER_3));
|
||||
sys_pm_ctrl_disable_state(SYS_POWER_STATE_LOW_POWER_3);
|
||||
STRINGIFY(SYS_POWER_STATE_SLEEP_3));
|
||||
sys_pm_ctrl_disable_state(SYS_POWER_STATE_SLEEP_3);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
printk("\n<-- Enabling %s state --->\n",
|
||||
STRINGIFY(SYS_POWER_STATE_LOW_POWER_3));
|
||||
sys_pm_ctrl_enable_state(SYS_POWER_STATE_LOW_POWER_3);
|
||||
STRINGIFY(SYS_POWER_STATE_SLEEP_3));
|
||||
sys_pm_ctrl_enable_state(SYS_POWER_STATE_SLEEP_3);
|
||||
|
||||
printk("<-- Disabling %s state --->\n",
|
||||
STRINGIFY(SYS_POWER_STATE_LOW_POWER_2));
|
||||
sys_pm_ctrl_disable_state(SYS_POWER_STATE_LOW_POWER_2);
|
||||
STRINGIFY(SYS_POWER_STATE_SLEEP_2));
|
||||
sys_pm_ctrl_disable_state(SYS_POWER_STATE_SLEEP_2);
|
||||
break;
|
||||
|
||||
case 7:
|
||||
printk("\n<-- Enabling %s state --->\n",
|
||||
STRINGIFY(SYS_POWER_STATE_LOW_POWER_2));
|
||||
sys_pm_ctrl_enable_state(SYS_POWER_STATE_LOW_POWER_2);
|
||||
STRINGIFY(SYS_POWER_STATE_SLEEP_2));
|
||||
sys_pm_ctrl_enable_state(SYS_POWER_STATE_SLEEP_2);
|
||||
|
||||
printk("<-- Forcing %s state --->\n",
|
||||
STRINGIFY(SYS_POWER_STATE_LOW_POWER_3));
|
||||
sys_pm_force_power_state(SYS_POWER_STATE_LOW_POWER_3);
|
||||
STRINGIFY(SYS_POWER_STATE_SLEEP_3));
|
||||
sys_pm_force_power_state(SYS_POWER_STATE_SLEEP_3);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
void sys_pm_notify_lps_entry(enum power_states state)
|
||||
{
|
||||
switch (state) {
|
||||
case SYS_POWER_STATE_LOW_POWER_2:
|
||||
printk("--> Entering to SYS_POWER_STATE_LOW_POWER_2 state.\n");
|
||||
case SYS_POWER_STATE_SLEEP_2:
|
||||
printk("--> Entering to SYS_POWER_STATE_SLEEP_2 state.\n");
|
||||
|
||||
/*
|
||||
* This power state is implemented by this sample.
|
||||
|
@ -25,8 +25,8 @@ void sys_pm_notify_lps_entry(enum power_states state)
|
|||
k_cpu_idle();
|
||||
break;
|
||||
|
||||
case SYS_POWER_STATE_LOW_POWER_3:
|
||||
printk("--> Entering to SYS_POWER_STATE_LOW_POWER_3 state.\n");
|
||||
case SYS_POWER_STATE_SLEEP_3:
|
||||
printk("--> Entering to SYS_POWER_STATE_SLEEP_3 state.\n");
|
||||
|
||||
/*
|
||||
* This power state is implemented by this sample.
|
||||
|
@ -64,16 +64,16 @@ void sys_pm_notify_lps_entry(enum power_states state)
|
|||
void sys_pm_notify_lps_exit(enum power_states state)
|
||||
{
|
||||
switch (state) {
|
||||
case SYS_POWER_STATE_LOW_POWER_2:
|
||||
printk("--> Exited from SYS_POWER_STATE_LOW_POWER_2 state.\n");
|
||||
case SYS_POWER_STATE_SLEEP_2:
|
||||
printk("--> Exited from SYS_POWER_STATE_SLEEP_2 state.\n");
|
||||
|
||||
/* Perform exit from the low power state by turning on LEDs */
|
||||
gpio_pin_write(gpio_port, LED_1, LED_ON);
|
||||
gpio_pin_write(gpio_port, LED_2, LED_ON);
|
||||
break;
|
||||
|
||||
case SYS_POWER_STATE_LOW_POWER_3:
|
||||
printk("--> Exited from SYS_POWER_STATE_LOW_POWER_3 state.\n");
|
||||
case SYS_POWER_STATE_SLEEP_3:
|
||||
printk("--> Exited from SYS_POWER_STATE_SLEEP_3 state.\n");
|
||||
|
||||
/* Perform exit from the low power state by turning on LEDs */
|
||||
gpio_pin_write(gpio_port, LED_1, LED_ON);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
config SOC_QUARK_SE_C1000_SS
|
||||
bool "Intel Quark SE C1000- Sensor Sub System"
|
||||
select HAS_STATE_LOW_POWER_1
|
||||
select HAS_STATE_LOW_POWER_2
|
||||
select HAS_STATE_SLEEP_1
|
||||
select HAS_STATE_SLEEP_2
|
||||
select HAS_STATE_DEEP_SLEEP_1
|
||||
select HAS_STATE_DEEP_SLEEP_2
|
||||
select HAS_STATE_DEEP_SLEEP_3
|
||||
|
|
|
@ -42,11 +42,11 @@ static void _deep_sleep(enum power_states state)
|
|||
void sys_set_power_state(enum power_states state)
|
||||
{
|
||||
switch (state) {
|
||||
#if (defined(CONFIG_SYS_POWER_LOW_POWER_STATES))
|
||||
case SYS_POWER_STATE_LOW_POWER_1:
|
||||
#if (defined(CONFIG_SYS_POWER_SLEEP_STATES))
|
||||
case SYS_POWER_STATE_SLEEP_1:
|
||||
qm_ss_power_cpu_ss1(QM_SS_POWER_CPU_SS1_TIMER_ON);
|
||||
break;
|
||||
case SYS_POWER_STATE_LOW_POWER_2:
|
||||
case SYS_POWER_STATE_SLEEP_2:
|
||||
qm_ss_power_cpu_ss2();
|
||||
break;
|
||||
#endif
|
||||
|
@ -69,14 +69,14 @@ void sys_set_power_state(enum power_states state)
|
|||
void sys_power_state_post_ops(enum power_states state)
|
||||
{
|
||||
switch (state) {
|
||||
#if (defined(CONFIG_SYS_POWER_LOW_POWER_STATES))
|
||||
case SYS_POWER_STATE_LOW_POWER_2:
|
||||
#if (defined(CONFIG_SYS_POWER_SLEEP_STATES))
|
||||
case SYS_POWER_STATE_SLEEP_2:
|
||||
{
|
||||
/* Expire the timer as it is disabled in SS2. */
|
||||
u32_t limit = z_arc_v2_aux_reg_read(_ARC_V2_TMR0_LIMIT);
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_TMR0_COUNT, limit - 1);
|
||||
}
|
||||
case SYS_POWER_STATE_LOW_POWER_1:
|
||||
case SYS_POWER_STATE_SLEEP_1:
|
||||
__builtin_arc_seti(0);
|
||||
break;
|
||||
#endif
|
||||
|
|
|
@ -23,8 +23,8 @@ extern "C" {
|
|||
|
||||
/*
|
||||
* Power state map:
|
||||
* SYS_POWER_STATE_LOW_POWER_1: SS1 state with Timer ON
|
||||
* SYS_POWER_STATE_LOW_POWER_2: SS1 state with Timer ON
|
||||
* SYS_POWER_STATE_SLEEP_1: SS1 state with Timer ON
|
||||
* SYS_POWER_STATE_SLEEP_2: SS1 state with Timer ON
|
||||
* SYS_POWER_STATE_DEEP_SLEEP_1: SS2 with LPSS enabled state
|
||||
* SYS_POWER_STATE_DEEP_SLEEP_2: SLEEP state
|
||||
* SYS_POWER_STATE_DEEP_SLEEP_3: SLEEP state with LPMODE enabled
|
||||
|
|
|
@ -12,9 +12,9 @@ LOG_MODULE_DECLARE(soc, CONFIG_SOC_LOG_LEVEL);
|
|||
|
||||
/*
|
||||
* Power state map:
|
||||
* SYS_POWER_STATE_LOW_POWER_1: EM1 Sleep
|
||||
* SYS_POWER_STATE_LOW_POWER_2: EM2 Deep Sleep
|
||||
* SYS_POWER_STATE_LOW_POWER_3: EM3 Stop
|
||||
* SYS_POWER_STATE_SLEEP_1: EM1 Sleep
|
||||
* SYS_POWER_STATE_SLEEP_2: EM2 Deep Sleep
|
||||
* SYS_POWER_STATE_SLEEP_3: EM3 Stop
|
||||
*/
|
||||
|
||||
/* Invoke Low Power/System Off specific Tasks */
|
||||
|
@ -35,23 +35,23 @@ void sys_set_power_state(enum power_states state)
|
|||
irq_unlock(0);
|
||||
|
||||
switch (state) {
|
||||
#ifdef CONFIG_SYS_POWER_LOW_POWER_STATES
|
||||
#ifdef CONFIG_HAS_STATE_LOW_POWER_1
|
||||
case SYS_POWER_STATE_LOW_POWER_1:
|
||||
#ifdef CONFIG_SYS_POWER_SLEEP_STATES
|
||||
#ifdef CONFIG_HAS_STATE_SLEEP_1
|
||||
case SYS_POWER_STATE_SLEEP_1:
|
||||
EMU_EnterEM1();
|
||||
break;
|
||||
#endif /* CONFIG_HAS_STATE_LOW_POWER_1 */
|
||||
#ifdef CONFIG_HAS_STATE_LOW_POWER_2
|
||||
case SYS_POWER_STATE_LOW_POWER_2:
|
||||
#endif /* CONFIG_HAS_STATE_SLEEP_1 */
|
||||
#ifdef CONFIG_HAS_STATE_SLEEP_2
|
||||
case SYS_POWER_STATE_SLEEP_2:
|
||||
EMU_EnterEM2(true);
|
||||
break;
|
||||
#endif /* CONFIG_HAS_STATE_LOW_POWER_2 */
|
||||
#ifdef CONFIG_HAS_STATE_LOW_POWER_3
|
||||
case SYS_POWER_STATE_LOW_POWER_3:
|
||||
#endif /* CONFIG_HAS_STATE_SLEEP_2 */
|
||||
#ifdef CONFIG_HAS_STATE_SLEEP_3
|
||||
case SYS_POWER_STATE_SLEEP_3:
|
||||
EMU_EnterEM3(true);
|
||||
break;
|
||||
#endif /* CONFIG_HAS_STATE_LOW_POWER_3 */
|
||||
#endif /* CONFIG_SYS_POWER_LOW_POWER_STATES */
|
||||
#endif /* CONFIG_HAS_STATE_SLEEP_3 */
|
||||
#endif /* CONFIG_SYS_POWER_SLEEP_STATES */
|
||||
default:
|
||||
LOG_ERR("Unsupported power state %u", state);
|
||||
break;
|
||||
|
|
|
@ -13,9 +13,9 @@ config SOC_SERIES_EFM32PG12B
|
|||
select CPU_HAS_FPU
|
||||
select SOC_FAMILY_EXX32
|
||||
select CPU_HAS_SYSTICK
|
||||
select HAS_STATE_LOW_POWER_1
|
||||
select HAS_STATE_LOW_POWER_2
|
||||
select HAS_STATE_LOW_POWER_3
|
||||
select HAS_STATE_SLEEP_1
|
||||
select HAS_STATE_SLEEP_2
|
||||
select HAS_STATE_SLEEP_3
|
||||
select SOC_GECKO_HAS_INDIVIDUAL_PIN_LOCATION
|
||||
select SOC_GECKO_CMU
|
||||
select SOC_GECKO_EMU
|
||||
|
|
|
@ -13,9 +13,9 @@ config SOC_SERIES_EFR32FG1P
|
|||
select CPU_HAS_FPU
|
||||
select SOC_FAMILY_EXX32
|
||||
select CPU_HAS_SYSTICK
|
||||
select HAS_STATE_LOW_POWER_1
|
||||
select HAS_STATE_LOW_POWER_2
|
||||
select HAS_STATE_LOW_POWER_3
|
||||
select HAS_STATE_SLEEP_1
|
||||
select HAS_STATE_SLEEP_2
|
||||
select HAS_STATE_SLEEP_3
|
||||
select SOC_GECKO_HAS_INDIVIDUAL_PIN_LOCATION
|
||||
select SOC_GECKO_CMU
|
||||
select SOC_GECKO_GPIO
|
||||
|
|
|
@ -13,9 +13,9 @@ config SOC_SERIES_EFR32MG12P
|
|||
select CPU_HAS_SYSTICK
|
||||
select HAS_SILABS_GECKO
|
||||
select HAS_SWO
|
||||
select HAS_STATE_LOW_POWER_1
|
||||
select HAS_STATE_LOW_POWER_2
|
||||
select HAS_STATE_LOW_POWER_3
|
||||
select HAS_STATE_SLEEP_1
|
||||
select HAS_STATE_SLEEP_2
|
||||
select HAS_STATE_SLEEP_3
|
||||
select SOC_GECKO_HAS_INDIVIDUAL_PIN_LOCATION
|
||||
select SOC_GECKO_CMU
|
||||
select SOC_GECKO_EMU
|
||||
|
|
|
@ -11,9 +11,9 @@ config SOC_SERIES_QUARK_SE
|
|||
select LOAPIC
|
||||
select LOAPIC_TIMER
|
||||
select XIP
|
||||
select HAS_STATE_LOW_POWER_1
|
||||
select HAS_STATE_LOW_POWER_2
|
||||
select HAS_STATE_LOW_POWER_3
|
||||
select HAS_STATE_SLEEP_1
|
||||
select HAS_STATE_SLEEP_2
|
||||
select HAS_STATE_SLEEP_3
|
||||
select HAS_STATE_DEEP_SLEEP_1
|
||||
select HAS_STATE_DEEP_SLEEP_2
|
||||
select BOOTLOADER_CONTEXT_RESTORE_SUPPORTED
|
||||
|
|
|
@ -60,14 +60,14 @@ static void _deep_sleep(enum power_states state)
|
|||
void sys_set_power_state(enum power_states state)
|
||||
{
|
||||
switch (state) {
|
||||
#if (defined(CONFIG_SYS_POWER_LOW_POWER_STATES))
|
||||
case SYS_POWER_STATE_LOW_POWER_1:
|
||||
#if (defined(CONFIG_SYS_POWER_SLEEP_STATES))
|
||||
case SYS_POWER_STATE_SLEEP_1:
|
||||
qm_power_cpu_c1();
|
||||
break;
|
||||
case SYS_POWER_STATE_LOW_POWER_2:
|
||||
case SYS_POWER_STATE_SLEEP_2:
|
||||
qm_power_cpu_c2();
|
||||
break;
|
||||
case SYS_POWER_STATE_LOW_POWER_3:
|
||||
case SYS_POWER_STATE_SLEEP_3:
|
||||
qm_power_cpu_c2lp();
|
||||
break;
|
||||
#endif
|
||||
|
@ -85,11 +85,11 @@ void sys_set_power_state(enum power_states state)
|
|||
void sys_power_state_post_ops(enum power_states state)
|
||||
{
|
||||
switch (state) {
|
||||
#if (defined(CONFIG_SYS_POWER_LOW_POWER_STATES))
|
||||
case SYS_POWER_STATE_LOW_POWER_3:
|
||||
#if (defined(CONFIG_SYS_POWER_SLEEP_STATES))
|
||||
case SYS_POWER_STATE_SLEEP_3:
|
||||
*_REG_TIMER_ICR = 1U;
|
||||
case SYS_POWER_STATE_LOW_POWER_2:
|
||||
case SYS_POWER_STATE_LOW_POWER_1:
|
||||
case SYS_POWER_STATE_SLEEP_2:
|
||||
case SYS_POWER_STATE_SLEEP_1:
|
||||
__asm__ volatile("sti");
|
||||
break;
|
||||
#endif
|
||||
|
|
|
@ -23,9 +23,9 @@ extern "C" {
|
|||
|
||||
/*
|
||||
* Power state map:
|
||||
* SYS_POWER_STATE_LOW_POWER_1: C1 state
|
||||
* SYS_POWER_STATE_LOW_POWER_2: C2 state
|
||||
* SYS_POWER_STATE_LOW_POWER_3: C2LP state
|
||||
* SYS_POWER_STATE_SLEEP_1: C1 state
|
||||
* SYS_POWER_STATE_SLEEP_2: C2 state
|
||||
* SYS_POWER_STATE_SLEEP_3: C2LP state
|
||||
* SYS_POWER_STATE_DEEP_SLEEP_1: SLEEP state
|
||||
* SYS_POWER_STATE_DEEP_SLEEP_2: SLEEP state with LPMODE enabled
|
||||
*/
|
||||
|
|
|
@ -22,28 +22,28 @@ endchoice
|
|||
|
||||
if SYS_PM_POLICY_RESIDENCY
|
||||
|
||||
config SYS_PM_LPS_1_MIN_RES
|
||||
int "Low Power State 1 minimum residency"
|
||||
depends on HAS_STATE_LOW_POWER_1
|
||||
config SYS_PM_SLEEP_1_MIN_RES
|
||||
int "Sleep State 1 minimum residency"
|
||||
depends on HAS_STATE_SLEEP_1
|
||||
default 5000
|
||||
help
|
||||
Minimum residency in milliseconds to enter SYS_POWER_STATE_LOW_POWER_1
|
||||
Minimum residency in milliseconds to enter SYS_POWER_STATE_SLEEP_1
|
||||
state.
|
||||
|
||||
config SYS_PM_LPS_2_MIN_RES
|
||||
int "Low Power State 2 minimum residency"
|
||||
depends on HAS_STATE_LOW_POWER_2
|
||||
config SYS_PM_SLEEP_2_MIN_RES
|
||||
int "Sleep State 2 minimum residency"
|
||||
depends on HAS_STATE_SLEEP_2
|
||||
default 10000
|
||||
help
|
||||
Minimum residency in milliseconds to enter SYS_POWER_STATE_LOW_POWER_2
|
||||
Minimum residency in milliseconds to enter SYS_POWER_STATE_SLEEP_2
|
||||
state.
|
||||
|
||||
config SYS_PM_LPS_3_MIN_RES
|
||||
int "Low Power State 3 minimum residency"
|
||||
depends on HAS_STATE_LOW_POWER_3
|
||||
config SYS_PM_SLEEP_3_MIN_RES
|
||||
int "Sleep State 3 minimum residency"
|
||||
depends on HAS_STATE_SLEEP_3
|
||||
default 30000
|
||||
help
|
||||
Minimum residency in milliseconds to enter SYS_POWER_STATE_LOW_POWER_3
|
||||
Minimum residency in milliseconds to enter SYS_POWER_STATE_SLEEP_3
|
||||
state.
|
||||
|
||||
config SYS_PM_DEEP_SLEEP_1_MIN_RES
|
||||
|
|
|
@ -16,19 +16,19 @@ LOG_MODULE_DECLARE(power);
|
|||
|
||||
/* PM Policy based on SoC/Platform residency requirements */
|
||||
static const unsigned int pm_min_residency[] = {
|
||||
#ifdef CONFIG_SYS_POWER_LOW_POWER_STATES
|
||||
#ifdef CONFIG_HAS_STATE_LOW_POWER_1
|
||||
CONFIG_SYS_PM_LPS_1_MIN_RES * SECS_TO_TICKS / MSEC_PER_SEC,
|
||||
#ifdef CONFIG_SYS_POWER_SLEEP_STATES
|
||||
#ifdef CONFIG_HAS_STATE_SLEEP_1
|
||||
CONFIG_SYS_PM_SLEEP_1_MIN_RES * SECS_TO_TICKS / MSEC_PER_SEC,
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HAS_STATE_LOW_POWER_2
|
||||
CONFIG_SYS_PM_LPS_2_MIN_RES * SECS_TO_TICKS / MSEC_PER_SEC,
|
||||
#ifdef CONFIG_HAS_STATE_SLEEP_2
|
||||
CONFIG_SYS_PM_SLEEP_2_MIN_RES * SECS_TO_TICKS / MSEC_PER_SEC,
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HAS_STATE_LOW_POWER_3
|
||||
CONFIG_SYS_PM_LPS_3_MIN_RES * SECS_TO_TICKS / MSEC_PER_SEC,
|
||||
#ifdef CONFIG_HAS_STATE_SLEEP_3
|
||||
CONFIG_SYS_PM_SLEEP_3_MIN_RES * SECS_TO_TICKS / MSEC_PER_SEC,
|
||||
#endif
|
||||
#endif /* CONFIG_SYS_POWER_LOW_POWER_STATES */
|
||||
#endif /* CONFIG_SYS_POWER_SLEEP_STATES */
|
||||
|
||||
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP_STATES
|
||||
#ifdef CONFIG_HAS_STATE_DEEP_SLEEP_1
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
config KERNEL_PROFILING_API_TEST
|
||||
bool
|
||||
default y
|
||||
select HAS_STATE_LOW_POWER_1
|
||||
select HAS_STATE_SLEEP_1
|
||||
help
|
||||
Hidden option enabling LPS_0 power state regardless of hardware
|
||||
support. This ensures that power management hooks used in this
|
||||
|
|
|
@ -7,7 +7,7 @@ CONFIG_TEST_HW_STACK_PROTECTION=n
|
|||
|
||||
# to check idle thread
|
||||
CONFIG_SYS_POWER_MANAGEMENT=y
|
||||
CONFIG_SYS_POWER_LOW_POWER_STATES=y
|
||||
CONFIG_SYS_POWER_SLEEP_STATES=y
|
||||
CONFIG_SYS_PM_POLICY_APP=y
|
||||
CONFIG_IDLE_STACK_SIZE=768
|
||||
|
||||
|
|
Loading…
Reference in a new issue