diff --git a/arch/Kconfig b/arch/Kconfig index 9ca81d04a4..2ca6367670 100644 --- a/arch/Kconfig +++ b/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 diff --git a/doc/reference/power_management/index.rst b/doc/reference/power_management/index.rst index 764f316d99..c05d5acbea 100644 --- a/doc/reference/power_management/index.rst +++ b/doc/reference/power_management/index.rst @@ -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` diff --git a/include/power.h b/include/power.h index b0f3f7dd90..9d0387421d 100644 --- a/include/power.h +++ b/include/power.h @@ -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); diff --git a/kernel/Kconfig.power_mgmt b/kernel/Kconfig.power_mgmt index 4fafed4780..4f66685006 100644 --- a/kernel/Kconfig.power_mgmt +++ b/kernel/Kconfig.power_mgmt @@ -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 diff --git a/kernel/idle.c b/kernel/idle.c index 667965f827..26acfc8177 100644 --- a/kernel/idle.c +++ b/kernel/idle.c @@ -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 diff --git a/samples/boards/nrf52/power_mgr/Kconfig b/samples/boards/nrf52/power_mgr/Kconfig index 7ea6d18009..3518d9469a 100644 --- a/samples/boards/nrf52/power_mgr/Kconfig +++ b/samples/boards/nrf52/power_mgr/Kconfig @@ -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. diff --git a/samples/boards/nrf52/power_mgr/README.rst b/samples/boards/nrf52/power_mgr/README.rst index 2fc78c501f..3a908999c4 100644 --- a/samples/boards/nrf52/power_mgr/README.rst +++ b/samples/boards/nrf52/power_mgr/README.rst @@ -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 --> diff --git a/samples/boards/nrf52/power_mgr/prj.conf b/samples/boards/nrf52/power_mgr/prj.conf index 21249c9842..5c40f0c796 100644 --- a/samples/boards/nrf52/power_mgr/prj.conf +++ b/samples/boards/nrf52/power_mgr/prj.conf @@ -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 diff --git a/samples/boards/nrf52/power_mgr/prj_tickless.conf b/samples/boards/nrf52/power_mgr/prj_tickless.conf index bc413eb267..b00d7b3dbf 100644 --- a/samples/boards/nrf52/power_mgr/prj_tickless.conf +++ b/samples/boards/nrf52/power_mgr/prj_tickless.conf @@ -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 diff --git a/samples/boards/nrf52/power_mgr/sample.yaml b/samples/boards/nrf52/power_mgr/sample.yaml index 88df2a7a2b..909b1cc1de 100644 --- a/samples/boards/nrf52/power_mgr/sample.yaml +++ b/samples/boards/nrf52/power_mgr/sample.yaml @@ -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." diff --git a/samples/boards/nrf52/power_mgr/src/main.c b/samples/boards/nrf52/power_mgr/src/main.c index bb9d4efbcb..3de25a4158 100644 --- a/samples/boards/nrf52/power_mgr/src/main.c +++ b/samples/boards/nrf52/power_mgr/src/main.c @@ -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: diff --git a/samples/boards/nrf52/power_mgr/src/power.c b/samples/boards/nrf52/power_mgr/src/power.c index 9c6a7d06c2..dd5a06ce23 100644 --- a/samples/boards/nrf52/power_mgr/src/power.c +++ b/samples/boards/nrf52/power_mgr/src/power.c @@ -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); diff --git a/soc/arc/quark_se_c1000_ss/Kconfig.soc b/soc/arc/quark_se_c1000_ss/Kconfig.soc index 080ca0de1a..5149512854 100644 --- a/soc/arc/quark_se_c1000_ss/Kconfig.soc +++ b/soc/arc/quark_se_c1000_ss/Kconfig.soc @@ -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 diff --git a/soc/arc/quark_se_c1000_ss/power.c b/soc/arc/quark_se_c1000_ss/power.c index 107603e9c1..8efbfb803d 100644 --- a/soc/arc/quark_se_c1000_ss/power.c +++ b/soc/arc/quark_se_c1000_ss/power.c @@ -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 diff --git a/soc/arc/quark_se_c1000_ss/soc_power.h b/soc/arc/quark_se_c1000_ss/soc_power.h index bd02f40902..80fedb4e86 100644 --- a/soc/arc/quark_se_c1000_ss/soc_power.h +++ b/soc/arc/quark_se_c1000_ss/soc_power.h @@ -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 diff --git a/soc/arm/silabs_exx32/common/soc_power.c b/soc/arm/silabs_exx32/common/soc_power.c index d6bef9ea28..b43feba1e8 100644 --- a/soc/arm/silabs_exx32/common/soc_power.c +++ b/soc/arm/silabs_exx32/common/soc_power.c @@ -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; diff --git a/soc/arm/silabs_exx32/efm32pg12b/Kconfig.series b/soc/arm/silabs_exx32/efm32pg12b/Kconfig.series index 3e7bd234e4..8ad0155819 100644 --- a/soc/arm/silabs_exx32/efm32pg12b/Kconfig.series +++ b/soc/arm/silabs_exx32/efm32pg12b/Kconfig.series @@ -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 diff --git a/soc/arm/silabs_exx32/efr32fg1p/Kconfig.series b/soc/arm/silabs_exx32/efr32fg1p/Kconfig.series index 84c2686b31..e4ae3c6da8 100644 --- a/soc/arm/silabs_exx32/efr32fg1p/Kconfig.series +++ b/soc/arm/silabs_exx32/efr32fg1p/Kconfig.series @@ -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 diff --git a/soc/arm/silabs_exx32/efr32mg12p/Kconfig.series b/soc/arm/silabs_exx32/efr32mg12p/Kconfig.series index 2e1051884f..81b2c7e71d 100644 --- a/soc/arm/silabs_exx32/efr32mg12p/Kconfig.series +++ b/soc/arm/silabs_exx32/efr32mg12p/Kconfig.series @@ -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 diff --git a/soc/x86/intel_quark/quark_se/Kconfig.series b/soc/x86/intel_quark/quark_se/Kconfig.series index 73a3b0133a..e5d28fe804 100644 --- a/soc/x86/intel_quark/quark_se/Kconfig.series +++ b/soc/x86/intel_quark/quark_se/Kconfig.series @@ -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 diff --git a/soc/x86/intel_quark/quark_se/power.c b/soc/x86/intel_quark/quark_se/power.c index 0cf56509df..9e0b04c8c5 100644 --- a/soc/x86/intel_quark/quark_se/power.c +++ b/soc/x86/intel_quark/quark_se/power.c @@ -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 diff --git a/soc/x86/intel_quark/quark_se/soc_power.h b/soc/x86/intel_quark/quark_se/soc_power.h index fe16dd2fc4..741c2d7a39 100644 --- a/soc/x86/intel_quark/quark_se/soc_power.h +++ b/soc/x86/intel_quark/quark_se/soc_power.h @@ -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 */ diff --git a/subsys/power/policy/Kconfig b/subsys/power/policy/Kconfig index 3eb3f917ab..aa25a70146 100644 --- a/subsys/power/policy/Kconfig +++ b/subsys/power/policy/Kconfig @@ -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 diff --git a/subsys/power/policy/policy_residency.c b/subsys/power/policy/policy_residency.c index 8eb5669fec..4639bf3c33 100644 --- a/subsys/power/policy/policy_residency.c +++ b/subsys/power/policy/policy_residency.c @@ -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 diff --git a/tests/kernel/profiling/profiling_api/Kconfig b/tests/kernel/profiling/profiling_api/Kconfig index 589df25bb0..1283206f00 100644 --- a/tests/kernel/profiling/profiling_api/Kconfig +++ b/tests/kernel/profiling/profiling_api/Kconfig @@ -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 diff --git a/tests/kernel/profiling/profiling_api/prj.conf b/tests/kernel/profiling/profiling_api/prj.conf index 903d41a334..fae20f61fe 100644 --- a/tests/kernel/profiling/profiling_api/prj.conf +++ b/tests/kernel/profiling/profiling_api/prj.conf @@ -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