From dd931f93a2f13e2514db837f4eb3ac655c06c82b Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 1 Sep 2020 18:31:40 -0400 Subject: [PATCH] power: standarize PM Kconfigs and cleanup - Remove SYS_ prefix - shorten POWER_MANAGEMENT to just PM - DEVICE_POWER_MANAGEMENT -> PM_DEVICE and use PM_ as the prefix for all PM related Kconfigs Signed-off-by: Anas Nashif --- Kconfig.zephyr | 2 +- arch/Kconfig | 12 ++--- arch/arc/core/isr_wrapper.S | 4 +- arch/arc/core/reset.S | 2 +- arch/arm/core/aarch32/irq_manage.c | 2 +- arch/arm/core/aarch32/isr_wrapper.S | 4 +- arch/posix/core/swap.c | 2 +- arch/x86/core/ia32/crt0.S | 4 +- arch/x86/core/ia32/intstub.S | 10 ++-- .../arm/cc1352r1_launchxl/Kconfig.defconfig | 8 +-- boards/arm/cc1352r1_launchxl/doc/index.rst | 8 +-- .../arm/cc1352r_sensortag/Kconfig.defconfig | 8 +-- boards/arm/cc1352r_sensortag/doc/index.rst | 8 +-- .../arm/cc26x2r1_launchxl/Kconfig.defconfig | 8 +-- boards/arm/cc26x2r1_launchxl/doc/index.rst | 8 +-- .../mec1501modular_assy6885/Kconfig.defconfig | 8 +-- boards/arm/mec1501modular_assy6885/pinmux.c | 2 +- .../arm/mec15xxevb_assy6853/Kconfig.defconfig | 8 +-- boards/arm/mec15xxevb_assy6853/pinmux.c | 2 +- boards/posix/native_posix/board_irq.h | 2 +- boards/posix/native_posix/irq_handler.c | 2 +- boards/posix/nrf52_bsim/board_irq.h | 2 +- boards/posix/nrf52_bsim/irq_handler.c | 2 +- doc/reference/power_management/index.rst | 12 ++--- doc/zephyr.doxyfile.in | 6 +-- drivers/display/display_st7789v.c | 8 +-- drivers/entropy/entropy_cc13xx_cc26xx.c | 26 ++++----- drivers/ethernet/Kconfig.mcux | 2 +- drivers/flash/spi_flash_at45.c | 8 +-- drivers/gpio/gpio_cc13xx_cc26xx.c | 2 +- drivers/gpio/gpio_dw.c | 4 +- drivers/gpio/gpio_dw.h | 2 +- drivers/i2c/i2c_cc13xx_cc26xx.c | 24 ++++----- drivers/i2c/i2c_nrfx_twi.c | 8 +-- drivers/i2c/i2c_nrfx_twim.c | 8 +-- .../intc_arcv2_irq_unit.c | 6 +-- drivers/interrupt_controller/intc_ioapic.c | 8 +-- drivers/interrupt_controller/intc_loapic.c | 6 +-- drivers/modem/hl7800.c | 4 +- drivers/pwm/pwm_nrfx.c | 4 +- drivers/sensor/apds9960/apds9960.c | 2 +- drivers/sensor/lis2mdl/lis2mdl.c | 6 +-- drivers/sensor/lis2mdl/lis2mdl.h | 2 +- drivers/sensor/qdec_nrfx/qdec_nrfx.c | 8 +-- drivers/sensor/vcnl4040/vcnl4040.c | 2 +- drivers/serial/Kconfig.nrfx | 8 +-- drivers/serial/uart_cc13xx_cc26xx.c | 42 +++++++++------ drivers/serial/uart_npcx.c | 2 +- drivers/serial/uart_nrfx_uart.c | 4 +- drivers/serial/uart_nrfx_uarte.c | 11 ++-- drivers/spi/spi_cc13xx_cc26xx.c | 18 +++---- drivers/spi/spi_dw.c | 4 +- drivers/spi/spi_nrfx_spi.c | 8 +-- drivers/spi/spi_nrfx_spim.c | 9 ++-- drivers/timer/Kconfig.stm32_lptim | 2 +- drivers/timer/loapic_timer.c | 6 +-- include/arch/arm/aarch32/irq.h | 2 +- include/arch/x86/ia32/arch.h | 2 +- include/device.h | 12 ++--- include/kernel_structs.h | 2 +- include/linker/common-ram.ld | 2 +- include/power/power.h | 54 +++++++++---------- kernel/Kconfig | 2 +- kernel/device.c | 8 +-- kernel/idle.c | 16 +++--- kernel/include/kernel_offsets.h | 2 +- samples/basic/minimal/common.conf | 2 +- .../power_management/prj.conf | 4 +- .../power_management/src/power_mgmt.c | 10 ++-- .../power_management/src/power_mgmt.h | 4 +- samples/boards/nrf/system_off/prj.conf | 8 +-- .../ti/cc13x2_cc26x2/system_off/prj.conf | 8 +-- .../drivers/spi_flash_at45/overlay-pm.conf | 2 +- samples/drivers/spi_flash_at45/prj.conf | 1 + samples/drivers/spi_flash_at45/src/main.c | 2 +- .../sockets/echo_server/boards/frdm_k64f.conf | 4 +- samples/philosophers/prj_tickless.conf | 2 +- samples/sensor/apds9960/prj.conf | 2 +- samples/sensor/apds9960/src/main.c | 2 +- samples/subsys/power/device_pm/prj.conf | 6 +-- soc/arm/microchip_mec/mec1501/CMakeLists.txt | 2 +- .../mec1501/Kconfig.defconfig.mec1501hsz | 12 ++--- soc/arm/microchip_mec/mec1501/device_power.c | 4 +- soc/arm/microchip_mec/mec1501/device_power.h | 2 +- soc/arm/microchip_mec/mec1501/power.c | 12 ++--- soc/arm/nordic_nrf/Kconfig.defconfig | 2 +- soc/arm/nordic_nrf/nrf51/CMakeLists.txt | 2 +- soc/arm/nordic_nrf/nrf51/Kconfig.series | 2 +- soc/arm/nordic_nrf/nrf51/power.c | 8 +-- soc/arm/nordic_nrf/nrf52/CMakeLists.txt | 2 +- soc/arm/nordic_nrf/nrf52/Kconfig.series | 2 +- soc/arm/nordic_nrf/nrf52/power.c | 8 +-- soc/arm/nordic_nrf/nrf53/CMakeLists.txt | 2 +- soc/arm/nordic_nrf/nrf53/Kconfig.soc | 2 +- soc/arm/nordic_nrf/nrf53/power.c | 10 ++-- soc/arm/nordic_nrf/nrf91/CMakeLists.txt | 2 +- soc/arm/nordic_nrf/nrf91/Kconfig.series | 2 +- soc/arm/nordic_nrf/nrf91/power.c | 8 +-- soc/arm/silabs_exx32/Kconfig.defconfig | 2 +- soc/arm/silabs_exx32/common/CMakeLists.txt | 2 +- soc/arm/silabs_exx32/common/soc_power.c | 16 +++--- .../silabs_exx32/efm32gg11b/Kconfig.series | 6 +-- .../silabs_exx32/efm32jg12b/Kconfig.series | 6 +-- .../silabs_exx32/efm32pg12b/Kconfig.series | 6 +-- .../silabs_exx32/efr32bg13p/Kconfig.series | 6 +-- soc/arm/silabs_exx32/efr32fg1p/Kconfig.series | 6 +-- .../silabs_exx32/efr32mg12p/Kconfig.series | 6 +-- soc/arm/silabs_exx32/efr32mg21/Kconfig.series | 6 +-- soc/arm/st_stm32/stm32l4/CMakeLists.txt | 2 +- .../st_stm32/stm32l4/Kconfig.defconfig.series | 2 +- soc/arm/st_stm32/stm32l4/Kconfig.series | 6 +-- soc/arm/st_stm32/stm32l4/power.c | 32 +++++------ soc/arm/st_stm32/stm32wb/CMakeLists.txt | 2 +- .../st_stm32/stm32wb/Kconfig.defconfig.series | 2 +- soc/arm/st_stm32/stm32wb/Kconfig.series | 6 +-- soc/arm/st_stm32/stm32wb/power.c | 32 +++++------ .../cc13x2_cc26x2/CMakeLists.txt | 4 +- .../cc13x2_cc26x2/Kconfig.defconfig.series | 4 +- .../cc13x2_cc26x2/Kconfig.series | 8 +-- soc/arm/ti_simplelink/cc13x2_cc26x2/power.c | 6 +-- subsys/net/Kconfig | 2 +- subsys/power/CMakeLists.txt | 8 +-- subsys/power/Kconfig | 50 ++++++++++------- subsys/power/device.c | 6 +-- subsys/power/device_pm.c | 2 +- subsys/power/pm_ctrl.c | 2 +- subsys/power/policy/CMakeLists.txt | 6 +-- subsys/power/policy/Kconfig | 42 +++++++-------- subsys/power/policy/policy_dummy.c | 4 +- subsys/power/policy/policy_residency.c | 36 ++++++------- .../policy/policy_residency_cc13x2_cc26x2.c | 20 +++---- subsys/power/power.c | 20 +++---- subsys/shell/modules/device_service.c | 4 +- tests/benchmarks/latency_measure/prj.conf | 2 +- .../edtt_ble_test_app/hci_test_app/prj.conf | 2 +- tests/kernel/device/src/main.c | 2 +- tests/kernel/device/testcase.yaml | 2 +- tests/kernel/profiling/profiling_api/Kconfig | 2 +- tests/kernel/profiling/profiling_api/prj.conf | 6 +-- tests/kernel/tickless/tickless/prj.conf | 4 +- .../kernel/tickless/tickless_concept/prj.conf | 2 +- .../kernel/timer/timer_api/prj_tickless.conf | 2 +- tests/net/pm/Kconfig | 2 +- tests/net/pm/prj.conf | 4 +- tests/subsys/power/power_mgmt/Kconfig | 2 +- tests/subsys/power/power_mgmt/prj.conf | 10 ++-- tests/subsys/power/power_mgmt_soc/prj.conf | 12 ++--- .../power/power_mgmt_soc/src/power_mgmt.c | 14 ++--- .../power/power_mgmt_soc/src/power_mgmt.h | 4 +- .../subsys/power/power_mgmt_soc/testcase.yaml | 2 +- 150 files changed, 551 insertions(+), 526 deletions(-) diff --git a/Kconfig.zephyr b/Kconfig.zephyr index bc4aeede12b..8f646446be0 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -498,7 +498,7 @@ endchoice config BOOTLOADER_CONTEXT_RESTORE bool "Boot loader has context restore support" default y - depends on SYS_POWER_DEEP_SLEEP_STATES && BOOTLOADER_CONTEXT_RESTORE_SUPPORTED + depends on PM_DEEP_SLEEP_STATES && BOOTLOADER_CONTEXT_RESTORE_SUPPORTED help This option signifies that the target has a bootloader that restores CPU context upon resuming from deep sleep diff --git a/arch/Kconfig b/arch/Kconfig index 456e1ac68b1..707f02ec07e 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -482,37 +482,37 @@ config ARCH_HAS_THREAD_ABORT # individual SoC. # -config HAS_SYS_POWER_STATE_SLEEP_1 +config HAS_POWER_STATE_SLEEP_1 bool help This option signifies that the target supports the SYS_POWER_STATE_SLEEP_1 configuration option. -config HAS_SYS_POWER_STATE_SLEEP_2 +config HAS_POWER_STATE_SLEEP_2 bool help This option signifies that the target supports the SYS_POWER_STATE_SLEEP_2 configuration option. -config HAS_SYS_POWER_STATE_SLEEP_3 +config HAS_POWER_STATE_SLEEP_3 bool help This option signifies that the target supports the SYS_POWER_STATE_SLEEP_3 configuration option. -config HAS_SYS_POWER_STATE_DEEP_SLEEP_1 +config HAS_POWER_STATE_DEEP_SLEEP_1 bool help This option signifies that the target supports the SYS_POWER_STATE_DEEP_SLEEP_1 configuration option. -config HAS_SYS_POWER_STATE_DEEP_SLEEP_2 +config HAS_POWER_STATE_DEEP_SLEEP_2 bool help This option signifies that the target supports the SYS_POWER_STATE_DEEP_SLEEP_2 configuration option. -config HAS_SYS_POWER_STATE_DEEP_SLEEP_3 +config HAS_POWER_STATE_DEEP_SLEEP_3 bool help This option signifies that the target supports the SYS_POWER_STATE_DEEP_SLEEP_3 diff --git a/arch/arc/core/isr_wrapper.S b/arch/arc/core/isr_wrapper.S index d5e621d9fe6..b1641b66ab7 100644 --- a/arch/arc/core/isr_wrapper.S +++ b/arch/arc/core/isr_wrapper.S @@ -24,7 +24,7 @@ GTEXT(_isr_wrapper) GTEXT(_isr_demux) -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#if defined(CONFIG_PM) GTEXT(z_sys_power_save_idle_exit) #endif @@ -245,7 +245,7 @@ rirq_path: /* r0, r1, and r3 will be used in exit_tickless_idle macro */ .macro exit_tickless_idle -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#if defined(CONFIG_PM) clri r0 /* do not interrupt exiting tickless idle operations */ mov_s r1, _kernel ld_s r3, [r1, _kernel_offset_to_idle] /* requested idle duration */ diff --git a/arch/arc/core/reset.S b/arch/arc/core/reset.S index d76529f1c5e..45a96ef9346 100644 --- a/arch/arc/core/reset.S +++ b/arch/arc/core/reset.S @@ -154,7 +154,7 @@ done_mpu_regions_reset: #endif #endif -#if defined(CONFIG_SYS_POWER_DEEP_SLEEP_STATES) && \ +#if defined(CONFIG_PM_DEEP_SLEEP_STATES) && \ !defined(CONFIG_BOOTLOADER_CONTEXT_RESTORE) jl @_sys_resume_from_deep_sleep #endif diff --git a/arch/arm/core/aarch32/irq_manage.c b/arch/arm/core/aarch32/irq_manage.c index 4a4a21c9a7c..afb9cb2ec86 100644 --- a/arch/arm/core/aarch32/irq_manage.c +++ b/arch/arm/core/aarch32/irq_manage.c @@ -161,7 +161,7 @@ void z_irq_spurious(const void *unused) z_arm_fatal_error(K_ERR_SPURIOUS_IRQ, NULL); } -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM void _arch_isr_direct_pm(void) { #if defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE) \ diff --git a/arch/arm/core/aarch32/isr_wrapper.S b/arch/arm/core/aarch32/isr_wrapper.S index 6fd8845e368..348c676e40e 100644 --- a/arch/arm/core/aarch32/isr_wrapper.S +++ b/arch/arm/core/aarch32/isr_wrapper.S @@ -84,7 +84,7 @@ SECTION_FUNC(TEXT, _isr_wrapper) bl sys_trace_isr_enter #endif -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM /* * All interrupts are disabled when handling idle wakeup. For tickless * idle, this ensures that the calculation and programming of the @@ -139,7 +139,7 @@ _idle_state_cleared: cpsie i /* re-enable interrupts (PRIMASK = 0) */ #endif -#endif /* CONFIG_SYS_POWER_MANAGEMENT */ +#endif /* CONFIG_PM */ #if defined(CONFIG_CPU_CORTEX_M) mrs r0, IPSR /* get exception number */ diff --git a/arch/posix/core/swap.c b/arch/posix/core/swap.c index 64be028f3c8..e56796f8218 100644 --- a/arch/posix/core/swap.c +++ b/arch/posix/core/swap.c @@ -103,7 +103,7 @@ void arch_switch_to_main_thread(struct k_thread *main_thread, char *stack_ptr, } /* LCOV_EXCL_LINE */ #endif -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM /** * If the kernel is in idle mode, take it out */ diff --git a/arch/x86/core/ia32/crt0.S b/arch/x86/core/ia32/crt0.S index a1c8119dae1..2b5f9142cdd 100644 --- a/arch/x86/core/ia32/crt0.S +++ b/arch/x86/core/ia32/crt0.S @@ -37,7 +37,7 @@ GDATA(_sse_mxcsr_default_value) #endif -#ifdef CONFIG_SYS_POWER_DEEP_SLEEP_STATES +#ifdef CONFIG_PM_DEEP_SLEEP_STATES GTEXT(_sys_resume_from_deep_sleep) #endif @@ -163,7 +163,7 @@ __csSet: #else addl $CONFIG_ISR_STACK_SIZE, %esp #endif -#if defined(CONFIG_SYS_POWER_DEEP_SLEEP_STATES) && \ +#if defined(CONFIG_PM_DEEP_SLEEP_STATES) && \ !defined(CONFIG_BOOTLOADER_CONTEXT_RESTORE) /* * Invoke _sys_resume_from_deep_sleep() hook to handle resume from diff --git a/arch/x86/core/ia32/intstub.S b/arch/x86/core/ia32/intstub.S index 22886564fb5..b2e6f0830dd 100644 --- a/arch/x86/core/ia32/intstub.S +++ b/arch/x86/core/ia32/intstub.S @@ -31,7 +31,7 @@ GTEXT(arch_swap) -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM GTEXT(z_sys_power_save_idle_exit) #endif @@ -144,11 +144,11 @@ SECTION_FUNC(TEXT, _interrupt_enter) pushl %edi /* Save stack pointer */ -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM cmpl $0, _kernel_offset_to_idle(%ecx) jne handle_idle /* fast path is !idle, in the pipeline */ -#endif /* CONFIG_SYS_POWER_MANAGEMENT */ +#endif /* CONFIG_PM */ /* fall through to nested case */ @@ -297,7 +297,7 @@ nestedInterrupt: KPTI_IRET -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM handle_idle: pushl %eax pushl %edx @@ -319,7 +319,7 @@ handle_idle: popl %edx popl %eax jmp alreadyOnIntStack -#endif /* CONFIG_SYS_POWER_MANAGEMENT */ +#endif /* CONFIG_PM */ /** * diff --git a/boards/arm/cc1352r1_launchxl/Kconfig.defconfig b/boards/arm/cc1352r1_launchxl/Kconfig.defconfig index 875d975fa8c..25a8e7ea1a2 100644 --- a/boards/arm/cc1352r1_launchxl/Kconfig.defconfig +++ b/boards/arm/cc1352r1_launchxl/Kconfig.defconfig @@ -8,12 +8,12 @@ if BOARD_CC1352R1_LAUNCHXL config BOARD default "cc1352r1_launchxl" -if SYS_POWER_MANAGEMENT +if PM # Ideally this value could be made to less than 1 ms, as there is # essentially no delay to come out of IDLE mode. However Zephyr only # supports millisecond precision here, so 1 ms is the best approximation. -config SYS_PM_MIN_RESIDENCY_SLEEP_1 +config PM_MIN_RESIDENCY_SLEEP_1 default 1 # The default here is deliberately made higher to be less agressive, to @@ -25,8 +25,8 @@ config SYS_PM_MIN_RESIDENCY_SLEEP_1 # given application, weighing tradeoffs between a lower value that leads to # higher power savings vs. a higher value that would accommodate for a higher # wakeup latency. -config SYS_PM_MIN_RESIDENCY_SLEEP_2 +config PM_MIN_RESIDENCY_SLEEP_2 default 5 -endif # SYS_POWER_MANAGEMENT +endif # PM endif # BOARD_CC1352R1_LAUNCHXL diff --git a/boards/arm/cc1352r1_launchxl/doc/index.rst b/boards/arm/cc1352r1_launchxl/doc/index.rst index 9a1913efa86..a109f02e393 100644 --- a/boards/arm/cc1352r1_launchxl/doc/index.rst +++ b/boards/arm/cc1352r1_launchxl/doc/index.rst @@ -205,11 +205,11 @@ Power Management and UART System and device power management are supported on this platform, and can be enabled via the standard Kconfig options in Zephyr, such as -:option:`CONFIG_SYS_POWER_MANAGEMENT`, :option:`CONFIG_DEVICE_POWER_MANAGEMENT`, -:option:`CONFIG_SYS_POWER_SLEEP_STATES`, and -:option:`CONFIG_SYS_POWER_DEEP_SLEEP_STATES`. +:option:`CONFIG_PM`, :option:`CONFIG_PM_DEVICE`, +:option:`CONFIG_PM_SLEEP_STATES`, and +:option:`CONFIG_PM_DEEP_SLEEP_STATES`. -When system power management is turned on (CONFIG_SYS_POWER_MANAGEMENT=y), +When system power management is turned on (CONFIG_PM=y), sleep state 2 (standby mode) is allowed, and polling is used to retrieve input by calling uart_poll_in(), it is possible for characters to be missed if the system enters standby mode between calls to uart_poll_in(). This is because diff --git a/boards/arm/cc1352r_sensortag/Kconfig.defconfig b/boards/arm/cc1352r_sensortag/Kconfig.defconfig index 6572c4106f3..1a3ecaf0d09 100644 --- a/boards/arm/cc1352r_sensortag/Kconfig.defconfig +++ b/boards/arm/cc1352r_sensortag/Kconfig.defconfig @@ -9,12 +9,12 @@ if BOARD_CC1352R_SENSORTAG config BOARD default "cc1352r_sensortag" -if SYS_POWER_MANAGEMENT +if PM # Ideally this value could be made to less than 1 ms, as there is # essentially no delay to come out of IDLE mode. However Zephyr only # supports millisecond precision here, so 1 ms is the best approximation. -config SYS_PM_MIN_RESIDENCY_SLEEP_1 +config PM_MIN_RESIDENCY_SLEEP_1 default 1 # The default here is deliberately made higher to be less agressive, to @@ -26,8 +26,8 @@ config SYS_PM_MIN_RESIDENCY_SLEEP_1 # given application, weighing tradeoffs between a lower value that leads to # higher power savings vs. a higher value that would accommodate for a higher # wakeup latency. -config SYS_PM_MIN_RESIDENCY_SLEEP_2 +config PM_MIN_RESIDENCY_SLEEP_2 default 5 -endif # SYS_POWER_MANAGEMENT +endif # PM endif # BOARD_CC1352R_SENSORTAG diff --git a/boards/arm/cc1352r_sensortag/doc/index.rst b/boards/arm/cc1352r_sensortag/doc/index.rst index 0ec0c8b1551..c2209ec5498 100644 --- a/boards/arm/cc1352r_sensortag/doc/index.rst +++ b/boards/arm/cc1352r_sensortag/doc/index.rst @@ -231,11 +231,11 @@ Power Management and UART System and device power management are supported on this platform, and can be enabled via the standard Kconfig options in Zephyr, such as -:option:`CONFIG_SYS_POWER_MANAGEMENT`, :option:`CONFIG_DEVICE_POWER_MANAGEMENT`, -:option:`CONFIG_SYS_POWER_SLEEP_STATES`, and -:option:`CONFIG_SYS_POWER_DEEP_SLEEP_STATES`. +:option:`CONFIG_PM`, :option:`CONFIG_PM_DEVICE`, +:option:`CONFIG_PM_SLEEP_STATES`, and +:option:`CONFIG_PM_DEEP_SLEEP_STATES`. -When system power management is turned on (CONFIG_SYS_POWER_MANAGEMENT=y), +When system power management is turned on (CONFIG_PM=y), sleep state 2 (standby mode) is allowed, and polling is used to retrieve input by calling uart_poll_in(), it is possible for characters to be missed if the system enters standby mode between calls to uart_poll_in(). This is because diff --git a/boards/arm/cc26x2r1_launchxl/Kconfig.defconfig b/boards/arm/cc26x2r1_launchxl/Kconfig.defconfig index c3e675f865e..3e7e738f0ff 100644 --- a/boards/arm/cc26x2r1_launchxl/Kconfig.defconfig +++ b/boards/arm/cc26x2r1_launchxl/Kconfig.defconfig @@ -8,12 +8,12 @@ if BOARD_CC26X2R1_LAUNCHXL config BOARD default "cc26x2r1_launchxl" -if SYS_POWER_MANAGEMENT +if PM # Ideally this value could be made to less than 1 ms, as there is # essentially no delay to come out of IDLE mode. However Zephyr only # supports millisecond precision here, so 1 ms is the best approximation. -config SYS_PM_MIN_RESIDENCY_SLEEP_1 +config PM_MIN_RESIDENCY_SLEEP_1 default 1 # The default here is deliberately made higher to be less agressive, to @@ -25,8 +25,8 @@ config SYS_PM_MIN_RESIDENCY_SLEEP_1 # given application, weighing tradeoffs between a lower value that leads to # higher power savings vs. a higher value that would accommodate for a higher # wakeup latency. -config SYS_PM_MIN_RESIDENCY_SLEEP_2 +config PM_MIN_RESIDENCY_SLEEP_2 default 5 -endif # SYS_POWER_MANAGEMENT +endif # PM endif # BOARD_CC26X2R1_LAUNCHXL diff --git a/boards/arm/cc26x2r1_launchxl/doc/index.rst b/boards/arm/cc26x2r1_launchxl/doc/index.rst index 75b55f6a245..59f1692b77b 100644 --- a/boards/arm/cc26x2r1_launchxl/doc/index.rst +++ b/boards/arm/cc26x2r1_launchxl/doc/index.rst @@ -211,11 +211,11 @@ Power Management and UART System and device power management are supported on this platform, and can be enabled via the standard Kconfig options in Zephyr, such as -:option:`CONFIG_SYS_POWER_MANAGEMENT`, :option:`CONFIG_DEVICE_POWER_MANAGEMENT`, -:option:`CONFIG_SYS_POWER_SLEEP_STATES`, and -:option:`CONFIG_SYS_POWER_DEEP_SLEEP_STATES`. +:option:`CONFIG_PM`, :option:`CONFIG_PM_DEVICE`, +:option:`CONFIG_PM_SLEEP_STATES`, and +:option:`CONFIG_PM_DEEP_SLEEP_STATES`. -When system power management is turned on (CONFIG_SYS_POWER_MANAGEMENT=y), +When system power management is turned on (CONFIG_PM=y), sleep state 2 (standby mode) is allowed, and polling is used to retrieve input by calling uart_poll_in(), it is possible for characters to be missed if the system enters standby mode between calls to uart_poll_in(). This is because diff --git a/boards/arm/mec1501modular_assy6885/Kconfig.defconfig b/boards/arm/mec1501modular_assy6885/Kconfig.defconfig index f82829b78ba..8585e09f172 100644 --- a/boards/arm/mec1501modular_assy6885/Kconfig.defconfig +++ b/boards/arm/mec1501modular_assy6885/Kconfig.defconfig @@ -54,13 +54,13 @@ config TACH_XEC depends on SENSOR # power management stuff -if SYS_POWER_MANAGEMENT +if PM -config SYS_PM_MIN_RESIDENCY_SLEEP_1 +config PM_MIN_RESIDENCY_SLEEP_1 default 1000 -config SYS_PM_MIN_RESIDENCY_DEEP_SLEEP_1 +config PM_MIN_RESIDENCY_DEEP_SLEEP_1 default 2000 -endif # SYS_POWER_MANAGEMENT +endif # PM endif # BOARD_MEC1501MODULAR_ASSY6885 diff --git a/boards/arm/mec1501modular_assy6885/pinmux.c b/boards/arm/mec1501modular_assy6885/pinmux.c index a5a4f9fa0ed..cedc8448845 100644 --- a/boards/arm/mec1501modular_assy6885/pinmux.c +++ b/boards/arm/mec1501modular_assy6885/pinmux.c @@ -448,7 +448,7 @@ static int board_pinmux_init(const struct device *dev) #endif /* DT_NODE_HAS_STATUS(DT_INST(0, microchip_xec_qmspi), okay) */ #endif /* CONFIG_SPI_XEC_QMSPI */ -#ifdef CONFIG_SYS_PM_DEBUG +#ifdef CONFIG_PM_DEBUG /* * Deep sleep testing: Enable TEST_CLK_OUT on GPIO_060 function 2. * TEST_CLK_OUT is the PLL 48MHz conditioned output. diff --git a/boards/arm/mec15xxevb_assy6853/Kconfig.defconfig b/boards/arm/mec15xxevb_assy6853/Kconfig.defconfig index 786a4083c55..5de03d90be6 100644 --- a/boards/arm/mec15xxevb_assy6853/Kconfig.defconfig +++ b/boards/arm/mec15xxevb_assy6853/Kconfig.defconfig @@ -71,14 +71,14 @@ config TACH_XEC depends on SENSOR # power management stuff -if SYS_POWER_MANAGEMENT +if PM -config SYS_PM_MIN_RESIDENCY_SLEEP_1 +config PM_MIN_RESIDENCY_SLEEP_1 default 1000 -config SYS_PM_MIN_RESIDENCY_DEEP_SLEEP_1 +config PM_MIN_RESIDENCY_DEEP_SLEEP_1 default 2000 -endif # SYS_POWER_MANAGEMENT +endif # PM endif # BOARD_MEC15XXEVB_ASSY6853 diff --git a/boards/arm/mec15xxevb_assy6853/pinmux.c b/boards/arm/mec15xxevb_assy6853/pinmux.c index dd54c7640a0..e56ca77a3a1 100644 --- a/boards/arm/mec15xxevb_assy6853/pinmux.c +++ b/boards/arm/mec15xxevb_assy6853/pinmux.c @@ -438,7 +438,7 @@ static int board_pinmux_init(const struct device *dev) #endif /* DT_NODE_HAS_STATUS(DT_INST(0, microchip_xec_qmspi), okay) */ #endif /* CONFIG_SPI_XEC_QMSPI */ -#ifdef CONFIG_SYS_PM_DEBUG +#ifdef CONFIG_PM_DEBUG /* * Deep sleep testing: Enable TEST_CLK_OUT on GPIO_060 function 2. * TEST_CLK_OUT is the PLL 48MHz conditioned output. diff --git a/boards/posix/native_posix/board_irq.h b/boards/posix/native_posix/board_irq.h index 5c62999a697..705694d29b8 100644 --- a/boards/posix/native_posix/board_irq.h +++ b/boards/posix/native_posix/board_irq.h @@ -73,7 +73,7 @@ void posix_irq_priority_set(unsigned int irq, unsigned int prio, #define ARCH_ISR_DIRECT_HEADER() do { } while (0) #define ARCH_ISR_DIRECT_FOOTER(a) do { } while (0) -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM extern void posix_irq_check_idle_exit(void); #define ARCH_ISR_DIRECT_PM() posix_irq_check_idle_exit() #else diff --git a/boards/posix/native_posix/irq_handler.c b/boards/posix/native_posix/irq_handler.c index 41811fdab86..adde7346b5f 100644 --- a/boards/posix/native_posix/irq_handler.c +++ b/boards/posix/native_posix/irq_handler.c @@ -43,7 +43,7 @@ static inline void vector_to_irq(int irq_nbr, int *may_swap) *may_swap |= ((direct_irq_f_ptr) irq_vector_table[irq_nbr].func)(); } else { -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM posix_irq_check_idle_exit(); #endif ((normal_irq_f_ptr)irq_vector_table[irq_nbr].func) diff --git a/boards/posix/nrf52_bsim/board_irq.h b/boards/posix/nrf52_bsim/board_irq.h index 009399bfcc2..80b3008de68 100644 --- a/boards/posix/nrf52_bsim/board_irq.h +++ b/boards/posix/nrf52_bsim/board_irq.h @@ -73,7 +73,7 @@ void posix_irq_priority_set(unsigned int irq, unsigned int prio, #define ARCH_ISR_DIRECT_HEADER() do { } while (0) #define ARCH_ISR_DIRECT_FOOTER(a) do { } while (0) -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM extern void posix_irq_check_idle_exit(void); #define ARCH_ISR_DIRECT_PM() posix_irq_check_idle_exit() #else diff --git a/boards/posix/nrf52_bsim/irq_handler.c b/boards/posix/nrf52_bsim/irq_handler.c index 4f43e547afb..d8b83cdc8e2 100644 --- a/boards/posix/nrf52_bsim/irq_handler.c +++ b/boards/posix/nrf52_bsim/irq_handler.c @@ -98,7 +98,7 @@ static inline void vector_to_irq(int irq_nbr, int *may_swap) *may_swap |= ((direct_irq_f_ptr) irq_vector_table[irq_nbr].func)(); } else { -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM posix_irq_check_idle_exit(); #endif ((normal_irq_f_ptr)irq_vector_table[irq_nbr].func) diff --git a/doc/reference/power_management/index.rst b/doc/reference/power_management/index.rst index 705a51a9b65..c461cf0e65b 100644 --- a/doc/reference/power_management/index.rst +++ b/doc/reference/power_management/index.rst @@ -90,7 +90,7 @@ System Power Management *********************** The kernel enters the idle state when it has nothing to schedule. If enabled via -the :option:`CONFIG_SYS_POWER_MANAGEMENT` Kconfig option, the Power Management +the :option:`CONFIG_PM` Kconfig option, the Power Management Subsystem can put an idle system in one of the supported power states, based on the selected power management policy and the duration of the idle time allotted by the kernel. @@ -491,7 +491,7 @@ Power Management Configuration Flags The Power Management features can be individually enabled and disabled using the following configuration flags. -:option:`CONFIG_SYS_POWER_MANAGEMENT` +:option:`CONFIG_PM` This flag enables the power management subsystem. @@ -499,20 +499,20 @@ the following configuration flags. This flag enables the tickless idle power saving feature. -:option:`CONFIG_SYS_POWER_SLEEP_STATES` +:option:`CONFIG_PM_SLEEP_STATES` This flag enables support for the Sleep states. -:option:`CONFIG_SYS_POWER_DEEP_SLEEP_STATES` +:option:`CONFIG_PM_DEEP_SLEEP_STATES` This flag enables support for the Deep Sleep states. -:option:`CONFIG_DEVICE_POWER_MANAGEMENT` +:option:`CONFIG_PM_DEVICE` This flag is enabled if the SOC interface and the devices support device power management. -:code:`CONFIG_DEVICE_IDLE_PM` +:code:`CONFIG_PM_DEVICE_IDLE` This flag enables the Device Idle Power Management. diff --git a/doc/zephyr.doxyfile.in b/doc/zephyr.doxyfile.in index 3b5b20db2f2..b9b86cbfeb4 100644 --- a/doc/zephyr.doxyfile.in +++ b/doc/zephyr.doxyfile.in @@ -1966,8 +1966,8 @@ PREDEFINED = "CONFIG_ARCH_HAS_CUSTOM_BUSY_WAIT" \ "CONFIG_BT_USER_PHY_UPDATE" \ "CONFIG_BT_SMP" \ "CONFIG_BT_SMP_APP_PAIRING_ACCEPT" \ - "CONFIG_DEVICE_POWER_MANAGEMENT" \ - "CONFIG_DEVICE_IDLE_PM" \ + "CONFIG_PM_DEVICE" \ + "CONFIG_PM_DEVICE_IDLE" \ "CONFIG_ERRNO" \ "CONFIG_FLASH_JESD216_API" \ "CONFIG_FLASH_PAGE_LAYOUT" \ @@ -1985,7 +1985,7 @@ PREDEFINED = "CONFIG_ARCH_HAS_CUSTOM_BUSY_WAIT" \ "CONFIG_SMP" \ "CONFIG_SPI_ASYNC" \ "CONFIG_SYS_CLOCK_EXISTS" \ - "CONFIG_SYS_POWER_MANAGEMENT" \ + "CONFIG_PM" \ "CONFIG_THREAD_CUSTOM_DATA" \ "CONFIG_THREAD_MONITOR" \ "CONFIG_THREAD_STACK_INFO" \ diff --git a/drivers/display/display_st7789v.c b/drivers/display/display_st7789v.c index fe7b759a9ed..6d200713940 100644 --- a/drivers/display/display_st7789v.c +++ b/drivers/display/display_st7789v.c @@ -52,7 +52,7 @@ struct st7789v_data { uint16_t width; uint16_t x_offset; uint16_t y_offset; -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE uint32_t pm_state; #endif }; @@ -375,7 +375,7 @@ static int st7789v_init(const struct device *dev) } #endif -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE data->pm_state = DEVICE_PM_ACTIVE_STATE; #endif @@ -402,7 +402,7 @@ static int st7789v_init(const struct device *dev) return 0; } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE static void st7789v_enter_sleep(struct st7789v_data *data) { st7789v_transmit(data, ST7789V_CMD_SLEEP_IN, NULL, 0); @@ -438,7 +438,7 @@ static int st7789v_pm_control(const struct device *dev, uint32_t ctrl_command, } return ret; } -#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */ +#endif /* CONFIG_PM_DEVICE */ static const struct display_driver_api st7789v_api = { .blanking_on = st7789v_blanking_on, diff --git a/drivers/entropy/entropy_cc13xx_cc26xx.c b/drivers/entropy/entropy_cc13xx_cc26xx.c index 09dd81c7947..a5d17d74891 100644 --- a/drivers/entropy/entropy_cc13xx_cc26xx.c +++ b/drivers/entropy/entropy_cc13xx_cc26xx.c @@ -31,11 +31,11 @@ struct entropy_cc13xx_cc26xx_data { struct k_sem sync; struct ring_buf pool; uint8_t data[CONFIG_ENTROPY_CC13XX_CC26XX_POOL_SIZE]; -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM Power_NotifyObj post_notify; bool constrained; #endif -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE uint32_t pm_state; #endif }; @@ -73,7 +73,7 @@ static void start_trng(struct entropy_cc13xx_cc26xx_data *data) TRNGIntEnable(TRNG_NUMBER_READY | TRNG_FRO_SHUTDOWN); } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE static void stop_trng(struct entropy_cc13xx_cc26xx_data *data) { TRNGDisable(); @@ -107,8 +107,8 @@ static int entropy_cc13xx_cc26xx_get_entropy(const struct device *dev, struct entropy_cc13xx_cc26xx_data *data = get_dev_data(dev); uint32_t cnt; -#if defined(CONFIG_SYS_POWER_MANAGEMENT) && \ - defined(CONFIG_SYS_POWER_SLEEP_STATES) +#if defined(CONFIG_PM) && \ + defined(CONFIG_PM_SLEEP_STATES) unsigned int key = irq_lock(); if (!data->constrained) { @@ -155,8 +155,8 @@ static void entropy_cc13xx_cc26xx_isr(const void *arg) /* When pool is full disable interrupt and stop reading numbers */ if (cnt != sizeof(num)) { -#if defined(CONFIG_SYS_POWER_MANAGEMENT) && \ - defined(CONFIG_SYS_POWER_SLEEP_STATES) +#if defined(CONFIG_PM) && \ + defined(CONFIG_PM_SLEEP_STATES) if (data->constrained) { sys_pm_ctrl_enable_state( SYS_POWER_STATE_SLEEP_2); @@ -241,7 +241,7 @@ static int entropy_cc13xx_cc26xx_get_entropy_isr(const struct device *dev, return read; } -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM /* * ======== post_notify_fxn ======== * Called by Power module when waking up the CPU from Standby. The TRNG needs @@ -269,7 +269,7 @@ static int post_notify_fxn(unsigned int eventType, uintptr_t eventArg, } #endif -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE static int entropy_cc13xx_cc26xx_set_power_state(const struct device *dev, uint32_t new_state) { @@ -321,22 +321,22 @@ static int entropy_cc13xx_cc26xx_pm_control(const struct device *dev, return ret; } -#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */ +#endif /* CONFIG_PM_DEVICE */ static int entropy_cc13xx_cc26xx_init(const struct device *dev) { struct entropy_cc13xx_cc26xx_data *data = get_dev_data(dev); -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE get_dev_data(dev)->pm_state = DEVICE_PM_ACTIVE_STATE; #endif /* Initialize driver data */ ring_buf_init(&data->pool, sizeof(data->data), data->data); -#if defined(CONFIG_SYS_POWER_MANAGEMENT) +#if defined(CONFIG_PM) Power_setDependency(PowerCC26XX_PERIPH_TRNG); -#if defined(CONFIG_SYS_POWER_SLEEP_STATES) +#if defined(CONFIG_PM_SLEEP_STATES) /* Stay out of standby until buffer is filled with entropy */ sys_pm_ctrl_disable_state(SYS_POWER_STATE_SLEEP_2); data->constrained = true; diff --git a/drivers/ethernet/Kconfig.mcux b/drivers/ethernet/Kconfig.mcux index 49bd0d8527f..63f165e7aaa 100644 --- a/drivers/ethernet/Kconfig.mcux +++ b/drivers/ethernet/Kconfig.mcux @@ -8,7 +8,7 @@ menuconfig ETH_MCUX depends on HAS_MCUX_ENET select NOCACHE_MEMORY if HAS_MCUX_CACHE select ARM_MPU if CPU_CORTEX_M7 - select NET_POWER_MANAGEMENT if DEVICE_POWER_MANAGEMENT + select NET_POWER_MANAGEMENT if PM_DEVICE help Enable MCUX Ethernet driver. Note, this driver performs one shot PHY setup. There is no support for PHY disconnect, reconnect or diff --git a/drivers/flash/spi_flash_at45.c b/drivers/flash/spi_flash_at45.c index f0d03ea8b83..ddbd666e5a8 100644 --- a/drivers/flash/spi_flash_at45.c +++ b/drivers/flash/spi_flash_at45.c @@ -53,7 +53,7 @@ struct spi_flash_at45_data { const struct device *spi; struct spi_cs_control spi_cs; struct k_sem lock; -#if IS_ENABLED(CONFIG_DEVICE_POWER_MANAGEMENT) +#if IS_ENABLED(CONFIG_PM_DEVICE) uint32_t pm_state; #endif }; @@ -585,7 +585,7 @@ static int spi_flash_at45_init(const struct device *dev) return err; } -#if IS_ENABLED(CONFIG_DEVICE_POWER_MANAGEMENT) +#if IS_ENABLED(CONFIG_PM_DEVICE) static int spi_flash_at45_pm_control(const struct device *dev, uint32_t ctrl_command, void *context, device_pm_cb cb, void *arg) @@ -634,7 +634,7 @@ static int spi_flash_at45_pm_control(const struct device *dev, return err; } -#endif /* IS_ENABLED(CONFIG_DEVICE_POWER_MANAGEMENT) */ +#endif /* IS_ENABLED(CONFIG_PM_DEVICE) */ static const struct flash_parameters * flash_at45_get_parameters(const struct device *dev) @@ -665,7 +665,7 @@ static const struct flash_driver_api spi_flash_at45_api = { }; \ static struct spi_flash_at45_data inst_##idx##_data = { \ .lock = Z_SEM_INITIALIZER(inst_##idx##_data.lock, 1, 1), \ - IF_ENABLED(CONFIG_DEVICE_POWER_MANAGEMENT, ( \ + IF_ENABLED(CONFIG_PM_DEVICE, ( \ .pm_state = DEVICE_PM_ACTIVE_STATE)) \ }; \ static const struct spi_flash_at45_config inst_##idx##_config = { \ diff --git a/drivers/gpio/gpio_cc13xx_cc26xx.c b/drivers/gpio/gpio_cc13xx_cc26xx.c index 75989ba3e85..9cced9705f8 100644 --- a/drivers/gpio/gpio_cc13xx_cc26xx.c +++ b/drivers/gpio/gpio_cc13xx_cc26xx.c @@ -232,7 +232,7 @@ static void gpio_cc13xx_cc26xx_isr(const struct device *dev) static int gpio_cc13xx_cc26xx_init(const struct device *dev) { -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM /* Set dependency on gpio resource to turn on power domains */ Power_setDependency(PowerCC26XX_PERIPH_GPIO); #else diff --git a/drivers/gpio/gpio_dw.c b/drivers/gpio/gpio_dw.c index bbca71447fd..011a526e844 100644 --- a/drivers/gpio/gpio_dw.c +++ b/drivers/gpio/gpio_dw.c @@ -28,7 +28,7 @@ #include #endif -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE #include #endif @@ -424,7 +424,7 @@ static inline int gpio_dw_manage_callback(const struct device *port, return gpio_manage_callback(&context->callbacks, callback, set); } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE static void gpio_dw_set_power_state(const struct device *port, uint32_t power_state) { diff --git a/drivers/gpio/gpio_dw.h b/drivers/gpio/gpio_dw.h index d3219f295e9..8c32a1cc2db 100644 --- a/drivers/gpio/gpio_dw.h +++ b/drivers/gpio/gpio_dw.h @@ -41,7 +41,7 @@ struct gpio_dw_runtime { const struct device *clock; #endif sys_slist_t callbacks; -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE uint32_t device_power_state; #endif }; diff --git a/drivers/i2c/i2c_cc13xx_cc26xx.c b/drivers/i2c/i2c_cc13xx_cc26xx.c index 81963d43103..65702e05e6a 100644 --- a/drivers/i2c/i2c_cc13xx_cc26xx.c +++ b/drivers/i2c/i2c_cc13xx_cc26xx.c @@ -29,11 +29,11 @@ struct i2c_cc13xx_cc26xx_data { struct k_sem lock; struct k_sem complete; volatile uint32_t error; -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM Power_NotifyObj postNotify; uint32_t dev_config; #endif -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE uint32_t pm_state; #endif }; @@ -209,8 +209,8 @@ static int i2c_cc13xx_cc26xx_transfer(const struct device *dev, k_sem_take(&get_dev_data(dev)->lock, K_FOREVER); -#if defined(CONFIG_SYS_POWER_MANAGEMENT) && \ - defined(CONFIG_SYS_POWER_SLEEP_STATES) +#if defined(CONFIG_PM) && \ + defined(CONFIG_PM_SLEEP_STATES) sys_pm_ctrl_disable_state(SYS_POWER_STATE_SLEEP_2); #endif @@ -234,8 +234,8 @@ static int i2c_cc13xx_cc26xx_transfer(const struct device *dev, } } -#if defined(CONFIG_SYS_POWER_MANAGEMENT) && \ - defined(CONFIG_SYS_POWER_SLEEP_STATES) +#if defined(CONFIG_PM) && \ + defined(CONFIG_PM_SLEEP_STATES) sys_pm_ctrl_enable_state(SYS_POWER_STATE_SLEEP_2); #endif @@ -277,7 +277,7 @@ static int i2c_cc13xx_cc26xx_configure(const struct device *dev, /* Enables and configures I2C master */ I2CMasterInitExpClk(get_dev_config(dev)->base, CPU_FREQ, fast); -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM get_dev_data(dev)->dev_config = dev_config; #endif @@ -298,7 +298,7 @@ static void i2c_cc13xx_cc26xx_isr(const void *arg) } } -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM /* * ======== postNotifyFxn ======== * Called by Power module when waking up the CPU from Standby. The i2c needs @@ -331,7 +331,7 @@ static int postNotifyFxn(unsigned int eventType, uintptr_t eventArg, } #endif -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE static int i2c_cc13xx_cc26xx_set_power_state(const struct device *dev, uint32_t new_state) { @@ -395,18 +395,18 @@ static int i2c_cc13xx_cc26xx_pm_control(const struct device *dev, return ret; } -#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */ +#endif /* CONFIG_PM_DEVICE */ static int i2c_cc13xx_cc26xx_init(const struct device *dev) { uint32_t cfg; int err; -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE get_dev_data(dev)->pm_state = DEVICE_PM_ACTIVE_STATE; #endif -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM /* Set Power dependencies & constraints */ Power_setDependency(PowerCC26XX_PERIPH_I2C0); diff --git a/drivers/i2c/i2c_nrfx_twi.c b/drivers/i2c/i2c_nrfx_twi.c index ad0e84becdb..6fc8c519375 100644 --- a/drivers/i2c/i2c_nrfx_twi.c +++ b/drivers/i2c/i2c_nrfx_twi.c @@ -19,7 +19,7 @@ struct i2c_nrfx_twi_data { struct k_sem completion_sync; volatile nrfx_err_t res; uint32_t dev_config; -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE uint32_t pm_state; #endif }; @@ -205,14 +205,14 @@ static int init_twi(const struct device *dev) dev->name); return -EBUSY; } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE get_dev_data(dev)->pm_state = DEVICE_PM_ACTIVE_STATE; #endif return 0; } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE static int twi_nrfx_pm_control(const struct device *dev, uint32_t ctrl_command, void *context, device_pm_cb cb, void *arg) @@ -260,7 +260,7 @@ static int twi_nrfx_pm_control(const struct device *dev, return ret; } -#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */ +#endif /* CONFIG_PM_DEVICE */ #define I2C_NRFX_TWI_INVALID_FREQUENCY ((nrf_twi_frequency_t)-1) #define I2C_NRFX_TWI_FREQUENCY(bitrate) \ diff --git a/drivers/i2c/i2c_nrfx_twim.c b/drivers/i2c/i2c_nrfx_twim.c index 308d58637d4..29aee106b88 100644 --- a/drivers/i2c/i2c_nrfx_twim.c +++ b/drivers/i2c/i2c_nrfx_twim.c @@ -22,7 +22,7 @@ struct i2c_nrfx_twim_data { uint32_t dev_config; uint16_t concat_buf_size; uint8_t *concat_buf; -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE uint32_t pm_state; #endif }; @@ -244,14 +244,14 @@ static int init_twim(const struct device *dev) return -EBUSY; } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE get_dev_data(dev)->pm_state = DEVICE_PM_ACTIVE_STATE; #endif return 0; } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE static int twim_nrfx_pm_control(const struct device *dev, uint32_t ctrl_command, void *context, device_pm_cb cb, void *arg) @@ -300,7 +300,7 @@ static int twim_nrfx_pm_control(const struct device *dev, return ret; } -#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */ +#endif /* CONFIG_PM_DEVICE */ #define I2C_NRFX_TWIM_INVALID_FREQUENCY ((nrf_twim_frequency_t)-1) #define I2C_NRFX_TWIM_FREQUENCY(bitrate) \ diff --git a/drivers/interrupt_controller/intc_arcv2_irq_unit.c b/drivers/interrupt_controller/intc_arcv2_irq_unit.c index 3d8a58e1251..126ba4020f1 100644 --- a/drivers/interrupt_controller/intc_arcv2_irq_unit.c +++ b/drivers/interrupt_controller/intc_arcv2_irq_unit.c @@ -23,7 +23,7 @@ extern void *_VectorTable; -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE #include #include @@ -87,7 +87,7 @@ static int arc_v2_irq_unit_init(const struct device *unused) return 0; } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE /* * @brief Suspend the interrupt unit device driver @@ -223,4 +223,4 @@ SYS_DEVICE_DEFINE("arc_v2_irq_unit", arc_v2_irq_unit_init, #else SYS_INIT(arc_v2_irq_unit_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); -#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */ +#endif /* CONFIG_PM_DEVICE */ diff --git a/drivers/interrupt_controller/intc_ioapic.c b/drivers/interrupt_controller/intc_ioapic.c index 88e6c2009a3..1269ba3bc4c 100644 --- a/drivers/interrupt_controller/intc_ioapic.c +++ b/drivers/interrupt_controller/intc_ioapic.c @@ -92,7 +92,7 @@ DEVICE_MMIO_TOPLEVEL_STATIC(ioapic_regs, DT_DRV_INST(0)); */ #define DEFAULT_RTE_DEST (0xFF << 24) -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE #include uint32_t ioapic_suspend_buf[SUSPEND_BITS_REQD / 32] = {0}; static uint32_t ioapic_device_power_state = DEVICE_PM_ACTIVE_STATE; @@ -179,7 +179,7 @@ void z_ioapic_irq_disable(unsigned int irq) } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE void store_flags(unsigned int irq, uint32_t flags) { @@ -317,7 +317,7 @@ static int ioapic_device_ctrl(const struct device *device, } -#endif /*CONFIG_DEVICE_POWER_MANAGEMENT*/ +#endif /*CONFIG_PM_DEVICE*/ /** * @@ -477,7 +477,7 @@ static void IoApicRedUpdateLo(unsigned int irq, } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE SYS_DEVICE_DEFINE("ioapic", ioapic_init, ioapic_device_ctrl, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); #else diff --git a/drivers/interrupt_controller/intc_loapic.c b/drivers/interrupt_controller/intc_loapic.c index ce1bce5cbc5..527c7bf109d 100644 --- a/drivers/interrupt_controller/intc_loapic.c +++ b/drivers/interrupt_controller/intc_loapic.c @@ -59,7 +59,7 @@ #define LOPIC_SSPND_BITS_PER_IRQ 1 /* Just the one for enable disable*/ #define LOPIC_SUSPEND_BITS_REQD (ROUND_UP((LOAPIC_IRQ_COUNT * LOPIC_SSPND_BITS_PER_IRQ), 32)) -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE #include uint32_t loapic_suspend_buf[LOPIC_SUSPEND_BITS_REQD / 32] = {0}; static uint32_t loapic_device_power_state = DEVICE_PM_ACTIVE_STATE; @@ -332,7 +332,7 @@ int z_irq_controller_isr_vector_get(void) return -1; } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE static int loapic_suspend(const struct device *port) { volatile uint32_t lvt; /* local vector table entry value */ @@ -421,7 +421,7 @@ SYS_DEVICE_DEFINE("loapic", loapic_init, loapic_device_ctrl, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); #else SYS_INIT(loapic_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); -#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */ +#endif /* CONFIG_PM_DEVICE */ #if CONFIG_LOAPIC_SPURIOUS_VECTOR diff --git a/drivers/modem/hl7800.c b/drivers/modem/hl7800.c index 910b70fc74c..8281eddb3e2 100644 --- a/drivers/modem/hl7800.c +++ b/drivers/modem/hl7800.c @@ -3472,7 +3472,7 @@ static void hl7800_rx(void) static void shutdown_uart(void) { -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE int rc; if (ictx.uart_on) { @@ -3490,7 +3490,7 @@ static void shutdown_uart(void) static void power_on_uart(void) { -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE int rc; if (!ictx.uart_on) { diff --git a/drivers/pwm/pwm_nrfx.c b/drivers/pwm/pwm_nrfx.c index aced0016140..736af6c10b5 100644 --- a/drivers/pwm/pwm_nrfx.c +++ b/drivers/pwm/pwm_nrfx.c @@ -281,7 +281,7 @@ static int pwm_nrfx_init(const struct device *dev) return 0; } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE static void pwm_nrfx_uninit(const struct device *dev) { @@ -361,7 +361,7 @@ static int pwm_nrfx_pm_control(const struct device *dev, #define PWM_NRFX_PM_CONTROL(idx) -#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */ +#endif /* CONFIG_PM_DEVICE */ #define PWM(dev_idx) DT_NODELABEL(pwm##dev_idx) #define PWM_PROP(dev_idx, prop) DT_PROP(PWM(dev_idx), prop) diff --git a/drivers/sensor/apds9960/apds9960.c b/drivers/sensor/apds9960/apds9960.c index 9998663dcf5..803467e0654 100644 --- a/drivers/sensor/apds9960/apds9960.c +++ b/drivers/sensor/apds9960/apds9960.c @@ -407,7 +407,7 @@ static int apds9960_init_interrupt(const struct device *dev) return 0; } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE static int apds9960_device_ctrl(const struct device *dev, uint32_t ctrl_command, void *context, device_pm_cb cb, void *arg) diff --git a/drivers/sensor/lis2mdl/lis2mdl.c b/drivers/sensor/lis2mdl/lis2mdl.c index 26b25f280e7..c81f46f1d1b 100644 --- a/drivers/sensor/lis2mdl/lis2mdl.c +++ b/drivers/sensor/lis2mdl/lis2mdl.c @@ -357,7 +357,7 @@ static int lis2mdl_init(const struct device *dev) return -EIO; } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE lis2mdl->power_state = DEVICE_PM_ACTIVE_STATE; #endif @@ -371,7 +371,7 @@ static int lis2mdl_init(const struct device *dev) return 0; } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE static int lis2mdl_set_power_state(struct lis2mdl_data *lis2mdl, uint32_t new_state) { @@ -430,7 +430,7 @@ static int lis2mdl_pm_control(const struct device *dev, uint32_t ctrl_command, return status; } -#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */ +#endif /* CONFIG_PM_DEVICE */ DEVICE_DEFINE(lis2mdl, DT_INST_LABEL(0), lis2mdl_init, lis2mdl_pm_control, &lis2mdl_data, &lis2mdl_dev_config, diff --git a/drivers/sensor/lis2mdl/lis2mdl.h b/drivers/sensor/lis2mdl/lis2mdl.h index e395dd8b780..efcfdd029da 100644 --- a/drivers/sensor/lis2mdl/lis2mdl.h +++ b/drivers/sensor/lis2mdl/lis2mdl.h @@ -57,7 +57,7 @@ struct lis2mdl_data { stmdev_ctx_t *ctx; -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE uint32_t power_state; #endif diff --git a/drivers/sensor/qdec_nrfx/qdec_nrfx.c b/drivers/sensor/qdec_nrfx/qdec_nrfx.c index 0518318cbd8..5a734792b0a 100644 --- a/drivers/sensor/qdec_nrfx/qdec_nrfx.c +++ b/drivers/sensor/qdec_nrfx/qdec_nrfx.c @@ -24,7 +24,7 @@ LOG_MODULE_REGISTER(qdec_nrfx, CONFIG_SENSOR_LOG_LEVEL); struct qdec_nrfx_data { int32_t acc; sensor_trigger_handler_t data_ready_handler; -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE uint32_t pm_state; #endif }; @@ -209,7 +209,7 @@ static int qdec_nrfx_init(const struct device *dev) qdec_nrfx_gpio_ctrl(true); nrfx_qdec_enable(); -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE struct qdec_nrfx_data *data = &qdec_nrfx_data; data->pm_state = DEVICE_PM_ACTIVE_STATE; @@ -218,7 +218,7 @@ static int qdec_nrfx_init(const struct device *dev) return 0; } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE static int qdec_nrfx_pm_get_state(struct qdec_nrfx_data *data, uint32_t *state) @@ -299,7 +299,7 @@ static int qdec_nrfx_pm_control(const struct device *dev, return err; } -#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */ +#endif /* CONFIG_PM_DEVICE */ static const struct sensor_driver_api qdec_nrfx_driver_api = { diff --git a/drivers/sensor/vcnl4040/vcnl4040.c b/drivers/sensor/vcnl4040/vcnl4040.c index 536789d1904..a9dfeed795f 100644 --- a/drivers/sensor/vcnl4040/vcnl4040.c +++ b/drivers/sensor/vcnl4040/vcnl4040.c @@ -217,7 +217,7 @@ static int vcnl4040_ambient_setup(const struct device *dev) } #endif -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE static int vcnl4040_device_ctrl(const struct device *dev, uint32_t ctrl_command, void *context, device_pm_cb cb, void *arg) diff --git a/drivers/serial/Kconfig.nrfx b/drivers/serial/Kconfig.nrfx index 3e0940a0b11..18626f87bfb 100644 --- a/drivers/serial/Kconfig.nrfx +++ b/drivers/serial/Kconfig.nrfx @@ -91,7 +91,7 @@ config UART_0_NRF_HW_ASYNC_TIMER config UART_0_GPIO_MANAGEMENT bool "Enable GPIO management on port 0" - depends on DEVICE_POWER_MANAGEMENT + depends on PM_DEVICE default y help If enabled, the driver will configure the GPIOs used by the uart to @@ -162,7 +162,7 @@ config UART_1_NRF_HW_ASYNC_TIMER config UART_1_GPIO_MANAGEMENT bool "Enable GPIO management on port 1" - depends on DEVICE_POWER_MANAGEMENT + depends on PM_DEVICE default y help If enabled, the driver will configure the GPIOs used by the uart to @@ -232,7 +232,7 @@ config UART_2_NRF_HW_ASYNC_TIMER config UART_2_GPIO_MANAGEMENT bool "Enable GPIO management on port 2" - depends on DEVICE_POWER_MANAGEMENT + depends on PM_DEVICE default y help If enabled, the driver will configure the GPIOs used by the uart to @@ -302,7 +302,7 @@ config UART_3_NRF_HW_ASYNC_TIMER config UART_3_GPIO_MANAGEMENT bool "Enable GPIO management on port 3" - depends on DEVICE_POWER_MANAGEMENT + depends on PM_DEVICE default y help If enabled, the driver will configure the GPIOs used by the uart to diff --git a/drivers/serial/uart_cc13xx_cc26xx.c b/drivers/serial/uart_cc13xx_cc26xx.c index 9f4acc27f22..fe99698a2ee 100644 --- a/drivers/serial/uart_cc13xx_cc26xx.c +++ b/drivers/serial/uart_cc13xx_cc26xx.c @@ -30,12 +30,12 @@ struct uart_cc13xx_cc26xx_data { uart_irq_callback_user_data_t callback; void *user_data; #endif /* CONFIG_UART_INTERRUPT_DRIVEN */ -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM Power_NotifyObj postNotify; bool tx_constrained; bool rx_constrained; #endif -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE uint32_t pm_state; #endif }; @@ -231,8 +231,8 @@ static int uart_cc13xx_cc26xx_fifo_read(const struct device *dev, static void uart_cc13xx_cc26xx_irq_tx_enable(const struct device *dev) { -#if defined(CONFIG_SYS_POWER_MANAGEMENT) && \ - defined(CONFIG_SYS_POWER_SLEEP_STATES) +#if defined(CONFIG_PM) && \ + defined(CONFIG_PM_SLEEP_STATES) if (!get_dev_data(dev)->tx_constrained) { /* * When tx irq is enabled, it is implicit that we are expecting @@ -256,8 +256,8 @@ static void uart_cc13xx_cc26xx_irq_tx_disable(const struct device *dev) { UARTIntDisable(get_dev_conf(dev)->regs, UART_INT_TX); -#if defined(CONFIG_SYS_POWER_MANAGEMENT) && \ - defined(CONFIG_SYS_POWER_SLEEP_STATES) +#if defined(CONFIG_PM) && \ + defined(CONFIG_PM_SLEEP_STATES) if (get_dev_data(dev)->tx_constrained) { sys_pm_ctrl_enable_state(SYS_POWER_STATE_SLEEP_2); get_dev_data(dev)->tx_constrained = false; @@ -272,8 +272,8 @@ static int uart_cc13xx_cc26xx_irq_tx_ready(const struct device *dev) static void uart_cc13xx_cc26xx_irq_rx_enable(const struct device *dev) { -#if defined(CONFIG_SYS_POWER_MANAGEMENT) && \ - defined(CONFIG_SYS_POWER_SLEEP_STATES) +#if defined(CONFIG_PM) && \ + defined(CONFIG_PM_SLEEP_STATES) /* * When rx is enabled, it is implicit that we are expecting * to receive from the uart, hence we can no longer go into @@ -290,8 +290,8 @@ static void uart_cc13xx_cc26xx_irq_rx_enable(const struct device *dev) static void uart_cc13xx_cc26xx_irq_rx_disable(const struct device *dev) { -#if defined(CONFIG_SYS_POWER_MANAGEMENT) && \ - defined(CONFIG_SYS_POWER_SLEEP_STATES) +#if defined(CONFIG_PM) && \ + defined(CONFIG_PM_SLEEP_STATES) if (get_dev_data(dev)->rx_constrained) { sys_pm_ctrl_enable_state(SYS_POWER_STATE_SLEEP_2); get_dev_data(dev)->rx_constrained = false; @@ -359,11 +359,11 @@ static void uart_cc13xx_cc26xx_isr(const struct device *dev) #endif /* CONFIG_UART_INTERRUPT_DRIVEN */ -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM /* * ======== postNotifyFxn ======== * Called by Power module when waking up the CPU from Standby, to support - * the case when SYS_POWER_MANAGEMENT is set but DEVICE_POWER_MANAGEMENT is + * the case when PM is set but PM_DEVICE is * not. The uart needs to be reconfigured afterwards unless Zephyr's device * PM turned it off, in which case it'd be responsible for turning it back * on and reconfiguring it. @@ -400,7 +400,7 @@ static int postNotifyFxn(unsigned int eventType, uintptr_t eventArg, } #endif -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE static int uart_cc13xx_cc26xx_set_power_state(const struct device *dev, uint32_t new_state) { @@ -471,7 +471,7 @@ static int uart_cc13xx_cc26xx_pm_control(const struct device *dev, return ret; } -#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */ +#endif /* CONFIG_PM_DEVICE */ static const struct uart_driver_api uart_cc13xx_cc26xx_driver_api = { .poll_in = uart_cc13xx_cc26xx_poll_in, @@ -497,7 +497,7 @@ static const struct uart_driver_api uart_cc13xx_cc26xx_driver_api = { #endif /* CONFIG_UART_INTERRUPT_DRIVEN */ }; -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM #define UART_CC13XX_CC26XX_POWER_UART(n) \ do { \ get_dev_data(dev)->rx_constrained = false; \ @@ -579,7 +579,17 @@ static const struct uart_driver_api uart_cc13xx_cc26xx_driver_api = { PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ &uart_cc13xx_cc26xx_driver_api) -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#define UART_CC13XX_CC26XX_DEVICE_API_INIT(n) \ + DEVICE_AND_API_INIT(uart_cc13xx_cc26xx_##n, DT_INST_LABEL(n), \ + uart_cc13xx_cc26xx_init_##n, &uart_cc13xx_cc26xx_data_##n, \ + &uart_cc13xx_cc26xx_config_##n, PRE_KERNEL_1, \ + CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ + &uart_cc13xx_cc26xx_driver_api) + +#ifdef CONFIG_PM_DEVICE +#define UART_CC13XX_CC26XX_DEVICE_INIT(n) \ + UART_CC13XX_CC26XX_DEVICE_DEFINE(n) + #define UART_CC13XX_CC26XX_INIT_PM_STATE \ do { \ get_dev_data(dev)->pm_state = DEVICE_PM_ACTIVE_STATE; \ diff --git a/drivers/serial/uart_npcx.c b/drivers/serial/uart_npcx.c index 514d35b3c84..af4d538a73d 100644 --- a/drivers/serial/uart_npcx.c +++ b/drivers/serial/uart_npcx.c @@ -344,7 +344,7 @@ static int uart_npcx_init(const struct device *dev) config->uconf.irq_config_func(dev); #endif -#if defined(CONFIG_SYS_POWER_DEEP_SLEEP_STATES) +#if defined(CONFIG_PM_DEEP_SLEEP_STATES) /* * Configure the UART wake-up event triggered from a falling edge * on CR_SIN pin. No need for callback function. diff --git a/drivers/serial/uart_nrfx_uart.c b/drivers/serial/uart_nrfx_uart.c index af298216266..057d766bfdf 100644 --- a/drivers/serial/uart_nrfx_uart.c +++ b/drivers/serial/uart_nrfx_uart.c @@ -1091,7 +1091,7 @@ static const struct uart_driver_api uart_nrfx_uart_driver_api = { #endif /* CONFIG_UART_0_INTERRUPT_DRIVEN */ }; -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE static void uart_nrfx_pins_enable(const struct device *dev, bool enable) { @@ -1178,7 +1178,7 @@ static int uart_nrfx_pm_control(const struct device *dev, return 0; } -#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */ +#endif /* CONFIG_PM_DEVICE */ static struct uart_nrfx_data uart_nrfx_uart0_data = { .uart_config = { diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 37f12f7709e..2ece149abe2 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -113,7 +113,8 @@ struct uarte_nrfx_data { #ifdef CONFIG_UART_ASYNC_API struct uarte_async_cb *async; #endif -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT + atomic_val_t poll_out_lock; +#ifdef CONFIG_PM_DEVICE uint32_t pm_state; #endif uint8_t char_out; @@ -1122,7 +1123,7 @@ static void uarte_nrfx_poll_out(const struct device *dev, unsigned char c) NRF_UARTE_Type *uarte = get_uarte_instance(dev); int key; -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE if (data->pm_state != DEVICE_PM_ACTIVE_STATE) { return; } @@ -1430,7 +1431,7 @@ static int uarte_instance_init(const struct device *dev, return err; } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE data->pm_state = DEVICE_PM_ACTIVE_STATE; #endif @@ -1479,7 +1480,7 @@ static int uarte_instance_init(const struct device *dev, return 0; } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE static void uarte_nrfx_pins_enable(const struct device *dev, bool enable) { @@ -1615,7 +1616,7 @@ static int uarte_nrfx_pm_control(const struct device *dev, return 0; } -#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */ +#endif /* CONFIG_PM_DEVICE */ #define UARTE(idx) DT_NODELABEL(uart##idx) #define UARTE_HAS_PROP(idx, prop) DT_NODE_HAS_PROP(UARTE(idx), prop) diff --git a/drivers/spi/spi_cc13xx_cc26xx.c b/drivers/spi/spi_cc13xx_cc26xx.c index 10e0fed2c67..bc763fc65cc 100644 --- a/drivers/spi/spi_cc13xx_cc26xx.c +++ b/drivers/spi/spi_cc13xx_cc26xx.c @@ -32,7 +32,7 @@ struct spi_cc13xx_cc26xx_config { struct spi_cc13xx_cc26xx_data { struct spi_context ctx; -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE uint32_t pm_state; #endif }; @@ -148,8 +148,8 @@ static int spi_cc13xx_cc26xx_transceive(const struct device *dev, spi_context_lock(ctx, false, NULL, config); -#if defined(CONFIG_SYS_POWER_MANAGEMENT) && \ - defined(CONFIG_SYS_POWER_SLEEP_STATES) +#if defined(CONFIG_PM) && \ + defined(CONFIG_PM_SLEEP_STATES) sys_pm_ctrl_disable_state(SYS_POWER_STATE_SLEEP_2); #endif @@ -185,8 +185,8 @@ static int spi_cc13xx_cc26xx_transceive(const struct device *dev, spi_context_cs_control(ctx, false); done: -#if defined(CONFIG_SYS_POWER_MANAGEMENT) && \ - defined(CONFIG_SYS_POWER_SLEEP_STATES) +#if defined(CONFIG_PM) && \ + defined(CONFIG_PM_SLEEP_STATES) sys_pm_ctrl_enable_state(SYS_POWER_STATE_SLEEP_2); #endif spi_context_release(ctx, err); @@ -211,7 +211,7 @@ static int spi_cc13xx_cc26xx_release(const struct device *dev, return 0; } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE static int spi_cc13xx_cc26xx_set_power_state(const struct device *dev, uint32_t new_state) { @@ -276,7 +276,7 @@ static int spi_cc13xx_cc26xx_pm_control(const struct device *dev, return ret; } -#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */ +#endif /* CONFIG_PM_DEVICE */ static const struct spi_driver_api spi_cc13xx_cc26xx_driver_api = { @@ -284,7 +284,7 @@ static const struct spi_driver_api spi_cc13xx_cc26xx_driver_api = { .release = spi_cc13xx_cc26xx_release, }; -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM #define SPI_CC13XX_CC26XX_POWER_SPI(n) \ do { \ /* Set Power dependencies & constraints */ \ @@ -337,7 +337,7 @@ static const struct spi_driver_api spi_cc13xx_cc26xx_driver_api = { POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ &spi_cc13xx_cc26xx_driver_api) -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE #define SPI_CC13XX_CC26XX_INIT_PM_STATE \ do { \ get_dev_data(dev)->pm_state = DEVICE_PM_ACTIVE_STATE; \ diff --git a/drivers/spi/spi_dw.c b/drivers/spi/spi_dw.c index 4fdb1e0f4e8..3e5a7016c62 100644 --- a/drivers/spi/spi_dw.c +++ b/drivers/spi/spi_dw.c @@ -344,11 +344,11 @@ static int transceive(const struct device *dev, spi_context_lock(&spi->ctx, asynchronous, signal, config); -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE if (device_busy_check(dev) != (-EBUSY)) { device_busy_set(dev); } -#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */ +#endif /* CONFIG_PM_DEVICE */ /* Configure */ ret = spi_dw_configure(info, spi, config); diff --git a/drivers/spi/spi_nrfx_spi.c b/drivers/spi/spi_nrfx_spi.c index a1182a45d8f..1e6c77090bc 100644 --- a/drivers/spi/spi_nrfx_spi.c +++ b/drivers/spi/spi_nrfx_spi.c @@ -19,7 +19,7 @@ struct spi_nrfx_data { const struct device *dev; size_t chunk_len; bool busy; -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE uint32_t pm_state; #endif }; @@ -276,14 +276,14 @@ static int init_spi(const struct device *dev) return -EBUSY; } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE dev_data->pm_state = DEVICE_PM_ACTIVE_STATE; #endif return 0; } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE static int spi_nrfx_pm_control(const struct device *dev, uint32_t ctrl_command, void *context, device_pm_cb cb, void *arg) @@ -329,7 +329,7 @@ static int spi_nrfx_pm_control(const struct device *dev, return ret; } -#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */ +#endif /* CONFIG_PM_DEVICE */ /* * Current factors requiring use of DT_NODELABEL: diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index 392a3e3b72a..eae913df3de 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -20,7 +20,7 @@ struct spi_nrfx_data { const struct device *dev; size_t chunk_len; bool busy; -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE uint32_t pm_state; #endif #if (CONFIG_SPI_NRFX_RAM_BUFFER_SIZE > 0) @@ -318,14 +318,15 @@ static int init_spim(const struct device *dev) return -EBUSY; } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE data->pm_state = DEVICE_PM_ACTIVE_STATE; + get_dev_data(dev)->pm_state = DEVICE_PM_ACTIVE_STATE; #endif return 0; } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE static int spim_nrfx_pm_control(const struct device *dev, uint32_t ctrl_command, void *context, device_pm_cb cb, void *arg) @@ -371,7 +372,7 @@ static int spim_nrfx_pm_control(const struct device *dev, return ret; } -#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */ +#endif /* CONFIG_PM_DEVICE */ /* * We use NODELABEL here because the nrfx API requires us to call diff --git a/drivers/timer/Kconfig.stm32_lptim b/drivers/timer/Kconfig.stm32_lptim index 2d20ba8c9db..206fa4e45fd 100644 --- a/drivers/timer/Kconfig.stm32_lptim +++ b/drivers/timer/Kconfig.stm32_lptim @@ -6,7 +6,7 @@ menuconfig STM32_LPTIM_TIMER bool "STM32 Low Power Timer [EXPERIMENTAL]" depends on (SOC_SERIES_STM32L4X || SOC_SERIES_STM32WBX) - depends on CLOCK_CONTROL && SYS_POWER_MANAGEMENT + depends on CLOCK_CONTROL && PM select TICKLESS_CAPABLE help This module implements a kernel device driver for the LowPower Timer diff --git a/drivers/timer/loapic_timer.c b/drivers/timer/loapic_timer.c index 594e8a562b5..10d69d35578 100644 --- a/drivers/timer/loapic_timer.c +++ b/drivers/timer/loapic_timer.c @@ -106,7 +106,7 @@ static unsigned char timer_mode = TIMER_MODE_PERIODIC; #endif #endif /* CONFIG_TICKLESS_IDLE */ -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE static uint32_t loapic_timer_device_power_state; static uint32_t reg_timer_save; static uint32_t reg_timer_cfg_save; @@ -568,7 +568,7 @@ int z_clock_driver_init(const struct device *device) periodic_mode_set(); #endif initial_count_register_set(cycles_per_tick - 1); -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE loapic_timer_device_power_state = DEVICE_PM_ACTIVE_STATE; #endif @@ -579,7 +579,7 @@ int z_clock_driver_init(const struct device *device) return 0; } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE static int sys_clock_suspend(const struct device *dev) { ARG_UNUSED(dev); diff --git a/include/arch/arm/aarch32/irq.h b/include/arch/arm/aarch32/irq.h index 346236c42a0..84880b965fd 100644 --- a/include/arch/arm/aarch32/irq.h +++ b/include/arch/arm/aarch32/irq.h @@ -117,7 +117,7 @@ extern void z_arm_interrupt_init(void); z_arm_irq_priority_set(irq_p, priority_p, flags_p); \ } -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM extern void _arch_isr_direct_pm(void); #define ARCH_ISR_DIRECT_PM() _arch_isr_direct_pm() #else diff --git a/include/arch/x86/ia32/arch.h b/include/arch/x86/ia32/arch.h index b79589fd2f9..8a7ea05ca5b 100644 --- a/include/arch/x86/ia32/arch.h +++ b/include/arch/x86/ia32/arch.h @@ -233,7 +233,7 @@ typedef struct s_isrList { (flags_p)); \ } -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM /* * FIXME: z_sys_power_save_idle_exit is defined in kernel.h, which cannot be * included here due to circular dependency diff --git a/include/device.h b/include/device.h index fd03d3ed200..4dac5b31d39 100644 --- a/include/device.h +++ b/include/device.h @@ -335,7 +335,7 @@ struct device { const void *api; /** Address of the device instance private data */ void * const data; -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE /** Power Management function */ int (*device_pm_control)(const struct device *dev, uint32_t command, void *context, device_pm_cb cb, void *arg); @@ -409,7 +409,7 @@ static inline bool z_impl_device_is_ready(const struct device *dev) * @{ */ -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE /** @def DEVICE_PM_ACTIVE_STATE * @@ -464,7 +464,7 @@ static inline bool z_impl_device_is_ready(const struct device *dev) #define DEVICE_PM_SET_POWER_STATE 1 #define DEVICE_PM_GET_POWER_STATE 2 -#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */ +#endif /* CONFIG_PM_DEVICE */ /** * @brief Get name of device PM state @@ -492,7 +492,7 @@ void device_busy_set(const struct device *busy_dev); */ void device_busy_clear(const struct device *busy_dev); -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE /* * Device PM functions */ @@ -615,7 +615,7 @@ int device_any_busy_check(void); */ int device_busy_check(const struct device *chk_dev); -#ifdef CONFIG_DEVICE_IDLE_PM +#ifdef CONFIG_PM_DEVICE_IDLE /* Device PM FSM states */ enum device_pm_fsm_state { @@ -741,7 +741,7 @@ static inline int device_pm_put_sync(const struct device *dev) { return -ENOTSUP Z_INIT_ENTRY_DEFINE(_CONCAT(__device_, dev_name), init_fn, \ (&_CONCAT(__device_, dev_name)), level, prio) -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE #define Z_DEVICE_DEFINE_PM(dev_name) \ static struct device_pm _CONCAT(__pm_, dev_name) __used = { \ .usage = ATOMIC_INIT(0), \ diff --git a/include/kernel_structs.h b/include/kernel_structs.h index 7b7b748cd7e..b2f209b9827 100644 --- a/include/kernel_structs.h +++ b/include/kernel_structs.h @@ -140,7 +140,7 @@ struct z_kernel { sys_dlist_t timeout_q; #endif -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM int32_t idle; /* Number of ticks for kernel idling */ #endif diff --git a/include/linker/common-ram.ld b/include/linker/common-ram.ld index 5bf12dc4e39..005e4f4861d 100644 --- a/include/linker/common-ram.ld +++ b/include/linker/common-ram.ld @@ -30,7 +30,7 @@ . = . + DEVICE_BITFIELD_SIZE; \ __device_init_status_end = .; -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE #define DEVICE_BUSY_BITFIELD() \ FILL(0x00); \ __device_busy_start = .; \ diff --git a/include/power/power.h b/include/power/power.h index ed3484df53b..25fc13a0309 100644 --- a/include/power/power.h +++ b/include/power/power.h @@ -27,33 +27,33 @@ extern "C" { enum power_states { SYS_POWER_STATE_AUTO = (-2), SYS_POWER_STATE_ACTIVE = (-1), -#ifdef CONFIG_SYS_POWER_SLEEP_STATES -# ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_1 +#ifdef CONFIG_PM_SLEEP_STATES +# ifdef CONFIG_HAS_POWER_STATE_SLEEP_1 SYS_POWER_STATE_SLEEP_1, # endif -# ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_2 +# ifdef CONFIG_HAS_POWER_STATE_SLEEP_2 SYS_POWER_STATE_SLEEP_2, # endif -# ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_3 +# ifdef CONFIG_HAS_POWER_STATE_SLEEP_3 SYS_POWER_STATE_SLEEP_3, # endif -#endif /* CONFIG_SYS_POWER_SLEEP_STATES */ +#endif /* CONFIG_PM_SLEEP_STATES */ -#ifdef CONFIG_SYS_POWER_DEEP_SLEEP_STATES -# ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1 +#ifdef CONFIG_PM_DEEP_SLEEP_STATES +# ifdef CONFIG_HAS_POWER_STATE_DEEP_SLEEP_1 SYS_POWER_STATE_DEEP_SLEEP_1, # endif -# ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_2 +# ifdef CONFIG_HAS_POWER_STATE_DEEP_SLEEP_2 SYS_POWER_STATE_DEEP_SLEEP_2, # endif -# ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_3 +# ifdef CONFIG_HAS_POWER_STATE_DEEP_SLEEP_3 SYS_POWER_STATE_DEEP_SLEEP_3, # endif -#endif /* CONFIG_SYS_POWER_DEEP_SLEEP_STATES */ +#endif /* CONFIG_PM_DEEP_SLEEP_STATES */ SYS_POWER_STATE_MAX }; -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM extern unsigned char sys_pm_idle_exit_notify; @@ -75,20 +75,20 @@ static inline bool sys_pm_is_sleep_state(enum power_states state) bool ret = true; switch (state) { -#ifdef CONFIG_SYS_POWER_SLEEP_STATES -# ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_1 +#ifdef CONFIG_PM_SLEEP_STATES +# ifdef CONFIG_HAS_POWER_STATE_SLEEP_1 case SYS_POWER_STATE_SLEEP_1: break; # endif -# ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_2 +# ifdef CONFIG_HAS_POWER_STATE_SLEEP_2 case SYS_POWER_STATE_SLEEP_2: break; # endif -# ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_3 +# ifdef CONFIG_HAS_POWER_STATE_SLEEP_3 case SYS_POWER_STATE_SLEEP_3: break; # endif -#endif /* CONFIG_SYS_POWER_SLEEP_STATES */ +#endif /* CONFIG_PM_SLEEP_STATES */ default: ret = false; break; @@ -107,20 +107,20 @@ static inline bool sys_pm_is_deep_sleep_state(enum power_states state) bool ret = true; switch (state) { -#ifdef CONFIG_SYS_POWER_DEEP_SLEEP_STATES -# ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1 +#ifdef CONFIG_PM_DEEP_SLEEP_STATES +# ifdef CONFIG_HAS_POWER_STATE_DEEP_SLEEP_1 case SYS_POWER_STATE_DEEP_SLEEP_1: break; # endif -# ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_2 +# ifdef CONFIG_HAS_POWER_STATE_DEEP_SLEEP_2 case SYS_POWER_STATE_DEEP_SLEEP_2: break; # endif -# ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_3 +# ifdef CONFIG_HAS_POWER_STATE_DEEP_SLEEP_3 case SYS_POWER_STATE_DEEP_SLEEP_3: break; # endif -#endif /* CONFIG_SYS_POWER_DEEP_SLEEP_STATES */ +#endif /* CONFIG_PM_DEEP_SLEEP_STATES */ default: ret = false; @@ -152,7 +152,7 @@ static inline void _sys_pm_idle_exit_notification_disable(void) * And before the end of suspend, the state of forced_pm_state * is cleared with interrupt disabled. * - * If enabled SYS_PM_DIRECT_FORCE_MODE, this function can only + * If enabled PM_DIRECT_FORCE_MODE, this function can only * run in thread context. * * @param state Power state which should be used in the ongoing @@ -168,7 +168,7 @@ void sys_pm_force_power_state(enum power_states state); */ void sys_set_power_state(enum power_states state); -#ifdef CONFIG_SYS_PM_DEBUG +#ifdef CONFIG_PM_DEBUG /** * @brief Dump Low Power states related debug info * @@ -176,9 +176,9 @@ void sys_set_power_state(enum power_states state); */ void sys_pm_dump_debug_info(void); -#endif /* CONFIG_SYS_PM_DEBUG */ +#endif /* CONFIG_PM_DEBUG */ -#ifdef CONFIG_SYS_PM_STATE_LOCK +#ifdef CONFIG_PM_STATE_LOCK /** * @brief Disable particular power state * @@ -213,7 +213,7 @@ void sys_pm_ctrl_enable_state(enum power_states state); */ bool sys_pm_ctrl_is_state_enabled(enum power_states state); -#endif /* CONFIG_SYS_PM_STATE_LOCK */ +#endif /* CONFIG_PM_STATE_LOCK */ /** * @} @@ -318,7 +318,7 @@ void sys_pm_notify_power_state_exit(enum power_states state); * @} */ -#endif /* CONFIG_SYS_POWER_MANAGEMENT */ +#endif /* CONFIG_PM */ #ifdef __cplusplus } diff --git a/kernel/Kconfig b/kernel/Kconfig index 414d71517a3..63995961b14 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -854,7 +854,7 @@ config TICKLESS_IDLE # NB: This option is deprecated, see TICKLESS_KERNEL and # https://github.com/zephyrproject-rtos/zephyr/pull/12234 bool "Tickless idle" - default y if SYS_POWER_MANAGEMENT || TICKLESS_CAPABLE + default y if PM || TICKLESS_CAPABLE help This option suppresses periodic system clock interrupts whenever the kernel becomes idle. This permits the system to remain in a power diff --git a/kernel/device.c b/kernel/device.c index 5e71542909e..013669df7a1 100644 --- a/kernel/device.c +++ b/kernel/device.c @@ -25,7 +25,7 @@ extern const struct device __device_end[]; extern uint32_t __device_init_status_start[]; -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE extern uint32_t __device_busy_start[]; extern uint32_t __device_busy_end[]; #define DEVICE_BUSY_SIZE (__device_busy_end - __device_busy_start) @@ -127,7 +127,7 @@ bool z_device_ready(const struct device *dev) (dev - __device_start))); } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE int device_pm_control_nop(const struct device *unused_device, uint32_t unused_ctrl_command, void *unused_context, @@ -162,7 +162,7 @@ int device_busy_check(const struct device *chk_dev) void device_busy_set(const struct device *busy_dev) { -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE atomic_set_bit((atomic_t *) __device_busy_start, (busy_dev - __device_start)); #else @@ -172,7 +172,7 @@ void device_busy_set(const struct device *busy_dev) void device_busy_clear(const struct device *busy_dev) { -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE atomic_clear_bit((atomic_t *) __device_busy_start, (busy_dev - __device_start)); #else diff --git a/kernel/idle.c b/kernel/idle.c index 0d7aea7ec95..185c4477fc8 100644 --- a/kernel/idle.c +++ b/kernel/idle.c @@ -29,7 +29,7 @@ LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); #define SMP_FALLBACK 0 #endif -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM /* * Used to allow _sys_suspend() implementation to control notification * of the event that caused exit from kernel idling after pm operations. @@ -40,20 +40,20 @@ unsigned char sys_pm_idle_exit_notify; /* LCOV_EXCL_START * These are almost certainly overidden and in any event do nothing */ -#if defined(CONFIG_SYS_POWER_SLEEP_STATES) +#if defined(CONFIG_PM_SLEEP_STATES) void __attribute__((weak)) _sys_resume(void) { } #endif -#if defined(CONFIG_SYS_POWER_DEEP_SLEEP_STATES) +#if defined(CONFIG_PM_DEEP_SLEEP_STATES) void __attribute__((weak)) _sys_resume_from_deep_sleep(void) { } #endif /* LCOV_EXCL_STOP */ -#endif /* CONFIG_SYS_POWER_MANAGEMENT */ +#endif /* CONFIG_PM */ /** * @@ -69,7 +69,7 @@ void __attribute__((weak)) _sys_resume_from_deep_sleep(void) #if !SMP_FALLBACK static void set_kernel_idle_time_in_ticks(int32_t ticks) { -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM _kernel.idle = ticks; #endif } @@ -89,8 +89,8 @@ static void sys_power_save_idle(void) #endif set_kernel_idle_time_in_ticks(ticks); -#if (defined(CONFIG_SYS_POWER_SLEEP_STATES) || \ - defined(CONFIG_SYS_POWER_DEEP_SLEEP_STATES)) +#if (defined(CONFIG_PM_SLEEP_STATES) || \ + defined(CONFIG_PM_DEEP_SLEEP_STATES)) sys_pm_idle_exit_notify = 1U; @@ -119,7 +119,7 @@ static void sys_power_save_idle(void) void z_sys_power_save_idle_exit(int32_t ticks) { -#if defined(CONFIG_SYS_POWER_SLEEP_STATES) +#if defined(CONFIG_PM_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/kernel/include/kernel_offsets.h b/kernel/include/kernel_offsets.h index aa07eb2650d..466aa20ca19 100644 --- a/kernel/include/kernel_offsets.h +++ b/kernel/include/kernel_offsets.h @@ -31,7 +31,7 @@ GEN_OFFSET_SYM(_cpu_t, irq_stack); GEN_OFFSET_SYM(_kernel_t, threads); #endif -#ifdef CONFIG_SYS_POWER_MANAGEMENT +#ifdef CONFIG_PM GEN_OFFSET_SYM(_kernel_t, idle); #endif diff --git a/samples/basic/minimal/common.conf b/samples/basic/minimal/common.conf index 6d8cdf4bfc7..e9ed81a84ca 100644 --- a/samples/basic/minimal/common.conf +++ b/samples/basic/minimal/common.conf @@ -8,7 +8,7 @@ CONFIG_SERIAL=n CONFIG_FLASH=n # Power management -CONFIG_SYS_POWER_MANAGEMENT=n +CONFIG_PM=n # Interrupts CONFIG_DYNAMIC_INTERRUPTS=n diff --git a/samples/boards/mec15xxevb_assy6853/power_management/prj.conf b/samples/boards/mec15xxevb_assy6853/power_management/prj.conf index 53e3f521025..2939cd869d2 100644 --- a/samples/boards/mec15xxevb_assy6853/power_management/prj.conf +++ b/samples/boards/mec15xxevb_assy6853/power_management/prj.conf @@ -1,9 +1,9 @@ # Enable config log CONFIG_LOG=y -# Logging thread frequency higher than CONFIG_SYS_PM_MIN_RESIDENCY_DEEP_SLEEP_1 +# Logging thread frequency higher than CONFIG_PM_MIN_RESIDENCY_DEEP_SLEEP_1 CONFIG_LOG_PROCESS_THREAD_SLEEP_MS=2100 CONFIG_THREAD_NAME=y # Enable PM debug in MEC1501 this will give indication in MCHP_060 -CONFIG_SYS_PM_DEBUG=y +CONFIG_PM_DEBUG=y diff --git a/samples/boards/mec15xxevb_assy6853/power_management/src/power_mgmt.c b/samples/boards/mec15xxevb_assy6853/power_management/src/power_mgmt.c index 42b9a58a55c..ed69cd7650b 100644 --- a/samples/boards/mec15xxevb_assy6853/power_management/src/power_mgmt.c +++ b/samples/boards/mec15xxevb_assy6853/power_management/src/power_mgmt.c @@ -18,7 +18,7 @@ LOG_MODULE_REGISTER(pwrmgmt_test); /* Thread properties */ #define TASK_STACK_SIZE 1024ul #define PRIORITY K_PRIO_COOP(5) -/* Sleep time should be lower than CONFIG_SYS_PM_MIN_RESIDENCY_SLEEP_1 */ +/* Sleep time should be lower than CONFIG_PM_MIN_RESIDENCY_SLEEP_1 */ #define THREAD_A_SLEEP_TIME 100ul #define THREAD_B_SLEEP_TIME 1000ul @@ -272,7 +272,7 @@ int test_pwr_mgmt_multithread(bool use_logging, uint8_t cycles) LOG_INF("Suspend..."); suspend_all_tasks(); LOG_INF("About to enter light sleep"); - k_msleep(CONFIG_SYS_PM_MIN_RESIDENCY_SLEEP_1 + + k_msleep(CONFIG_PM_MIN_RESIDENCY_SLEEP_1 + LT_EXTRA_SLP_TIME); k_busy_wait(100); @@ -292,7 +292,7 @@ int test_pwr_mgmt_multithread(bool use_logging, uint8_t cycles) /* GPIO toggle to measure latency for deep sleep */ pm_trigger_marker(); - k_msleep(CONFIG_SYS_PM_MIN_RESIDENCY_DEEP_SLEEP_1 + + k_msleep(CONFIG_PM_MIN_RESIDENCY_DEEP_SLEEP_1 + DP_EXTRA_SLP_TIME); k_busy_wait(100); @@ -328,7 +328,7 @@ int test_pwr_mgmt_singlethread(bool use_logging, uint8_t cycles) /* Trigger Light Sleep 1 state. 48MHz PLL stays on */ LOG_INF("About to enter light sleep"); - k_msleep(CONFIG_SYS_PM_MIN_RESIDENCY_SLEEP_1 + + k_msleep(CONFIG_PM_MIN_RESIDENCY_SLEEP_1 + LT_EXTRA_SLP_TIME); k_busy_wait(100); @@ -343,7 +343,7 @@ int test_pwr_mgmt_singlethread(bool use_logging, uint8_t cycles) /* GPIO toggle to measure latency */ pm_trigger_marker(); - k_msleep(CONFIG_SYS_PM_MIN_RESIDENCY_DEEP_SLEEP_1 + + k_msleep(CONFIG_PM_MIN_RESIDENCY_DEEP_SLEEP_1 + DP_EXTRA_SLP_TIME); k_busy_wait(100); diff --git a/samples/boards/mec15xxevb_assy6853/power_management/src/power_mgmt.h b/samples/boards/mec15xxevb_assy6853/power_management/src/power_mgmt.h index 6cc0bcd539f..142fbd3d0c8 100644 --- a/samples/boards/mec15xxevb_assy6853/power_management/src/power_mgmt.h +++ b/samples/boards/mec15xxevb_assy6853/power_management/src/power_mgmt.h @@ -11,10 +11,10 @@ /** @brief Alternates between light and deep sleep cycles. * * For light sleep, the test sleeps in main thread for 500 ms longer than - * CONFIG_SYS_PM_MIN_RESIDENCY_SLEEP_1. + * CONFIG_PM_MIN_RESIDENCY_SLEEP_1. * * Similarly for deep sleep, the test sleeps in the main thread for 500 ms - * longer than CONFIG_SYS_PM_MIN_RESIDENCY_DEEP_SLEEP_1. + * longer than CONFIG_PM_MIN_RESIDENCY_DEEP_SLEEP_1. * * @param use_logging test progress will be reported using logging, * otherwise printk. diff --git a/samples/boards/nrf/system_off/prj.conf b/samples/boards/nrf/system_off/prj.conf index 7ef8db4fa5d..6c6a0d0b046 100644 --- a/samples/boards/nrf/system_off/prj.conf +++ b/samples/boards/nrf/system_off/prj.conf @@ -1,6 +1,6 @@ -CONFIG_SYS_POWER_MANAGEMENT=y -CONFIG_SYS_POWER_DEEP_SLEEP_STATES=y +CONFIG_PM=y +CONFIG_PM_DEEP_SLEEP_STATES=y # Required to disable default behavior of deep sleep on timeout -CONFIG_SYS_PM_STATE_LOCK=y -CONFIG_DEVICE_POWER_MANAGEMENT=y +CONFIG_PM_STATE_LOCK=y +CONFIG_PM_DEVICE=y CONFIG_GPIO=y diff --git a/samples/boards/ti/cc13x2_cc26x2/system_off/prj.conf b/samples/boards/ti/cc13x2_cc26x2/system_off/prj.conf index 0756c646b47..149e1d2388d 100644 --- a/samples/boards/ti/cc13x2_cc26x2/system_off/prj.conf +++ b/samples/boards/ti/cc13x2_cc26x2/system_off/prj.conf @@ -1,7 +1,7 @@ CONFIG_GPIO=y -CONFIG_SYS_POWER_MANAGEMENT=y -CONFIG_SYS_POWER_SLEEP_STATES=y -CONFIG_SYS_POWER_DEEP_SLEEP_STATES=y +CONFIG_PM=y +CONFIG_PM_SLEEP_STATES=y +CONFIG_PM_DEEP_SLEEP_STATES=y -CONFIG_DEVICE_POWER_MANAGEMENT=y +CONFIG_PM_DEVICE=y diff --git a/samples/drivers/spi_flash_at45/overlay-pm.conf b/samples/drivers/spi_flash_at45/overlay-pm.conf index a757ae49f7c..f05219556a6 100644 --- a/samples/drivers/spi_flash_at45/overlay-pm.conf +++ b/samples/drivers/spi_flash_at45/overlay-pm.conf @@ -1,4 +1,4 @@ # Copyright (c) 2020 Gerson Fernando Budke # SPDX-License-Identifier: Apache-2.0 -CONFIG_DEVICE_POWER_MANAGEMENT=y +CONFIG_PM_DEVICE=y diff --git a/samples/drivers/spi_flash_at45/prj.conf b/samples/drivers/spi_flash_at45/prj.conf index cb434c4dd21..ceaedba62cc 100644 --- a/samples/drivers/spi_flash_at45/prj.conf +++ b/samples/drivers/spi_flash_at45/prj.conf @@ -5,3 +5,4 @@ CONFIG_LOG_IMMEDIATE=y CONFIG_SPI=y CONFIG_SPI_FLASH_AT45=y CONFIG_FLASH=y +CONFIG_PM_DEVICE=y diff --git a/samples/drivers/spi_flash_at45/src/main.c b/samples/drivers/spi_flash_at45/src/main.c index 5b406e28f80..750b16f5cfa 100644 --- a/samples/drivers/spi_flash_at45/src/main.c +++ b/samples/drivers/spi_flash_at45/src/main.c @@ -149,7 +149,7 @@ void main(void) printk("OK\n"); -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#if IS_ENABLED(CONFIG_PM_DEVICE) printk("Putting the flash device into low power state... "); err = device_set_power_state(flash_dev, DEVICE_PM_LOW_POWER_STATE, NULL, NULL); diff --git a/samples/net/sockets/echo_server/boards/frdm_k64f.conf b/samples/net/sockets/echo_server/boards/frdm_k64f.conf index 9f277e599b6..08cd9732945 100644 --- a/samples/net/sockets/echo_server/boards/frdm_k64f.conf +++ b/samples/net/sockets/echo_server/boards/frdm_k64f.conf @@ -1,3 +1,3 @@ -CONFIG_SYS_POWER_MANAGEMENT=y -CONFIG_DEVICE_POWER_MANAGEMENT=y +CONFIG_PM=y +CONFIG_PM_DEVICE=y CONFIG_NET_STATISTICS_POWER_MANAGEMENT=y diff --git a/samples/philosophers/prj_tickless.conf b/samples/philosophers/prj_tickless.conf index 0b448a8d9f6..8fdf2e3a0fb 100644 --- a/samples/philosophers/prj_tickless.conf +++ b/samples/philosophers/prj_tickless.conf @@ -3,7 +3,7 @@ CONFIG_ASSERT=y CONFIG_ASSERT_LEVEL=2 CONFIG_NUM_COOP_PRIORITIES=29 CONFIG_NUM_PREEMPT_PRIORITIES=40 -CONFIG_SYS_POWER_MANAGEMENT=y +CONFIG_PM=y CONFIG_TICKLESS_KERNEL=y CONFIG_MP_NUM_CPUS=1 diff --git a/samples/sensor/apds9960/prj.conf b/samples/sensor/apds9960/prj.conf index 0ad1f8c3588..d2673953753 100644 --- a/samples/sensor/apds9960/prj.conf +++ b/samples/sensor/apds9960/prj.conf @@ -9,4 +9,4 @@ CONFIG_I2C_LOG_LEVEL_INF=y CONFIG_APDS9960=y CONFIG_APDS9960_TRIGGER_GLOBAL_THREAD=n -CONFIG_DEVICE_POWER_MANAGEMENT=n +CONFIG_PM_DEVICE=n diff --git a/samples/sensor/apds9960/src/main.c b/samples/sensor/apds9960/src/main.c index 55af544650b..6223826e811 100644 --- a/samples/sensor/apds9960/src/main.c +++ b/samples/sensor/apds9960/src/main.c @@ -76,7 +76,7 @@ void main(void) printk("ambient light intensity %d, proximity %d\n", intensity.val1, pdata.val1); -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE uint32_t p_state; p_state = DEVICE_PM_LOW_POWER_STATE; diff --git a/samples/subsys/power/device_pm/prj.conf b/samples/subsys/power/device_pm/prj.conf index 98088b4d50d..0d337662acb 100644 --- a/samples/subsys/power/device_pm/prj.conf +++ b/samples/subsys/power/device_pm/prj.conf @@ -1,3 +1,3 @@ -CONFIG_SYS_POWER_MANAGEMENT=y -CONFIG_DEVICE_POWER_MANAGEMENT=y -CONFIG_DEVICE_IDLE_PM=y +CONFIG_PM=y +CONFIG_PM_DEVICE=y +CONFIG_PM_DEVICE_IDLE=y diff --git a/soc/arm/microchip_mec/mec1501/CMakeLists.txt b/soc/arm/microchip_mec/mec1501/CMakeLists.txt index 52717fa55bb..70889bc982b 100644 --- a/soc/arm/microchip_mec/mec1501/CMakeLists.txt +++ b/soc/arm/microchip_mec/mec1501/CMakeLists.txt @@ -8,7 +8,7 @@ zephyr_sources( soc.c ) -zephyr_sources_ifdef(CONFIG_SYS_POWER_MANAGEMENT +zephyr_sources_ifdef(CONFIG_PM device_power.c power.c ) diff --git a/soc/arm/microchip_mec/mec1501/Kconfig.defconfig.mec1501hsz b/soc/arm/microchip_mec/mec1501/Kconfig.defconfig.mec1501hsz index a3278268396..bbca0fded45 100644 --- a/soc/arm/microchip_mec/mec1501/Kconfig.defconfig.mec1501hsz +++ b/soc/arm/microchip_mec/mec1501/Kconfig.defconfig.mec1501hsz @@ -61,22 +61,22 @@ config SPI_XEC_QMSPI if SOC_POWER_MANAGEMENT -config SYS_POWER_MANAGEMENT +config PM default y -config SYS_POWER_SLEEP_STATES +config PM_SLEEP_STATES default y -config HAS_SYS_POWER_STATE_SLEEP_1 +config HAS_POWER_STATE_SLEEP_1 default y -config SYS_POWER_DEEP_SLEEP_STATES +config PM_DEEP_SLEEP_STATES default y -config HAS_SYS_POWER_STATE_DEEP_SLEEP_1 +config HAS_POWER_STATE_DEEP_SLEEP_1 default y -config DEVICE_POWER_MANAGEMENT +config PM_DEVICE default n endif # SOC_POWER_MANAGEMENT diff --git a/soc/arm/microchip_mec/mec1501/device_power.c b/soc/arm/microchip_mec/mec1501/device_power.c index cbf66869d24..c791f707b23 100644 --- a/soc/arm/microchip_mec/mec1501/device_power.c +++ b/soc/arm/microchip_mec/mec1501/device_power.c @@ -48,7 +48,7 @@ void soc_lite_sleep_enable(void) * will be ramping up from ~16 to 24 MHz. */ -#if defined(CONFIG_SYS_POWER_DEEP_SLEEP_STATES) +#if defined(CONFIG_PM_DEEP_SLEEP_STATES) void soc_deep_sleep_enable(void) { @@ -228,4 +228,4 @@ void soc_deep_sleep_periph_restore(void) #endif /* DEEP_SLEEP_PERIPH_SAVE_RESTORE */ -#endif /* CONFIG_SYS_POWER_DEEP_SLEEP_STATES */ +#endif /* CONFIG_PM_DEEP_SLEEP_STATES */ diff --git a/soc/arm/microchip_mec/mec1501/device_power.h b/soc/arm/microchip_mec/mec1501/device_power.h index 3755f5df164..26b9ea92437 100644 --- a/soc/arm/microchip_mec/mec1501/device_power.h +++ b/soc/arm/microchip_mec/mec1501/device_power.h @@ -11,7 +11,7 @@ void soc_lite_sleep_enable(void); -#if defined(CONFIG_SYS_POWER_DEEP_SLEEP_STATES) +#if defined(CONFIG_PM_DEEP_SLEEP_STATES) void soc_deep_sleep_enable(void); void soc_deep_sleep_disable(void); void soc_deep_sleep_periph_save(void); diff --git a/soc/arm/microchip_mec/mec1501/power.c b/soc/arm/microchip_mec/mec1501/power.c index ad2e48bb1db..6405c2d8096 100644 --- a/soc/arm/microchip_mec/mec1501/power.c +++ b/soc/arm/microchip_mec/mec1501/power.c @@ -12,7 +12,7 @@ #include #include "device_power.h" -#if defined(CONFIG_SYS_POWER_DEEP_SLEEP_STATES) +#if defined(CONFIG_PM_DEEP_SLEEP_STATES) /* * Deep Sleep @@ -79,7 +79,7 @@ static void z_power_soc_deep_sleep(void) } #endif -#ifdef CONFIG_SYS_POWER_SLEEP_STATES +#ifdef CONFIG_PM_SLEEP_STATES /* * Light Sleep @@ -110,12 +110,12 @@ static void z_power_soc_sleep(void) void sys_set_power_state(enum power_states state) { switch (state) { -#if (defined(CONFIG_SYS_POWER_SLEEP_STATES)) +#if (defined(CONFIG_PM_SLEEP_STATES)) case SYS_POWER_STATE_SLEEP_1: z_power_soc_sleep(); break; #endif -#if (defined(CONFIG_SYS_POWER_DEEP_SLEEP_STATES)) +#if (defined(CONFIG_PM_DEEP_SLEEP_STATES)) case SYS_POWER_STATE_DEEP_SLEEP_1: z_power_soc_deep_sleep(); break; @@ -128,12 +128,12 @@ void sys_set_power_state(enum power_states state) void _sys_pm_power_state_exit_post_ops(enum power_states state) { switch (state) { -#if (defined(CONFIG_SYS_POWER_SLEEP_STATES)) +#if (defined(CONFIG_PM_SLEEP_STATES)) case SYS_POWER_STATE_SLEEP_1: __enable_irq(); break; #endif -#if (defined(CONFIG_SYS_POWER_DEEP_SLEEP_STATES)) +#if (defined(CONFIG_PM_DEEP_SLEEP_STATES)) case SYS_POWER_STATE_DEEP_SLEEP_1: __enable_irq(); break; diff --git a/soc/arm/nordic_nrf/Kconfig.defconfig b/soc/arm/nordic_nrf/Kconfig.defconfig index 3cf69684c5a..3f186c7e237 100644 --- a/soc/arm/nordic_nrf/Kconfig.defconfig +++ b/soc/arm/nordic_nrf/Kconfig.defconfig @@ -27,7 +27,7 @@ config SYS_CLOCK_TICKS_PER_SEC config ARCH_HAS_CUSTOM_BUSY_WAIT default y -config SYS_POWER_MANAGEMENT +config PM default y config BUILD_OUTPUT_HEX diff --git a/soc/arm/nordic_nrf/nrf51/CMakeLists.txt b/soc/arm/nordic_nrf/nrf51/CMakeLists.txt index a657548eef5..0f11eefca2e 100644 --- a/soc/arm/nordic_nrf/nrf51/CMakeLists.txt +++ b/soc/arm/nordic_nrf/nrf51/CMakeLists.txt @@ -6,7 +6,7 @@ zephyr_library_sources( soc.c ) -zephyr_library_sources_ifdef(CONFIG_SYS_POWER_MANAGEMENT +zephyr_library_sources_ifdef(CONFIG_PM power.c ) diff --git a/soc/arm/nordic_nrf/nrf51/Kconfig.series b/soc/arm/nordic_nrf/nrf51/Kconfig.series index 0133e748048..2cd3de123c2 100644 --- a/soc/arm/nordic_nrf/nrf51/Kconfig.series +++ b/soc/arm/nordic_nrf/nrf51/Kconfig.series @@ -9,7 +9,7 @@ config SOC_SERIES_NRF51X select ARM select CPU_CORTEX_M0 select SOC_FAMILY_NRF - select HAS_SYS_POWER_STATE_DEEP_SLEEP_1 + select HAS_POWER_STATE_DEEP_SLEEP_1 select XIP select HAS_NRFX select HAS_SEGGER_RTT diff --git a/soc/arm/nordic_nrf/nrf51/power.c b/soc/arm/nordic_nrf/nrf51/power.c index c8ac2b3865d..c1451314a1e 100644 --- a/soc/arm/nordic_nrf/nrf51/power.c +++ b/soc/arm/nordic_nrf/nrf51/power.c @@ -14,8 +14,8 @@ LOG_MODULE_DECLARE(soc, CONFIG_SOC_LOG_LEVEL); void sys_set_power_state(enum power_states state) { switch (state) { -#ifdef CONFIG_SYS_POWER_DEEP_SLEEP_STATES - #ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1 +#ifdef CONFIG_PM_DEEP_SLEEP_STATES + #ifdef CONFIG_HAS_POWER_STATE_DEEP_SLEEP_1 case SYS_POWER_STATE_DEEP_SLEEP_1: nrf_power_system_off(NRF_POWER); break; @@ -31,8 +31,8 @@ void sys_set_power_state(enum power_states state) void _sys_pm_power_state_exit_post_ops(enum power_states state) { switch (state) { -#ifdef CONFIG_SYS_POWER_DEEP_SLEEP_STATES - #ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1 +#ifdef CONFIG_PM_DEEP_SLEEP_STATES + #ifdef CONFIG_HAS_POWER_STATE_DEEP_SLEEP_1 case SYS_POWER_STATE_DEEP_SLEEP_1: /* Nothing to do. */ break; diff --git a/soc/arm/nordic_nrf/nrf52/CMakeLists.txt b/soc/arm/nordic_nrf/nrf52/CMakeLists.txt index f66c9a0be34..c795df3947b 100644 --- a/soc/arm/nordic_nrf/nrf52/CMakeLists.txt +++ b/soc/arm/nordic_nrf/nrf52/CMakeLists.txt @@ -6,7 +6,7 @@ zephyr_library_sources( soc.c ) -zephyr_library_sources_ifdef(CONFIG_SYS_POWER_MANAGEMENT +zephyr_library_sources_ifdef(CONFIG_PM power.c ) diff --git a/soc/arm/nordic_nrf/nrf52/Kconfig.series b/soc/arm/nordic_nrf/nrf52/Kconfig.series index aaaf2901d0a..e12b916a53e 100644 --- a/soc/arm/nordic_nrf/nrf52/Kconfig.series +++ b/soc/arm/nordic_nrf/nrf52/Kconfig.series @@ -10,7 +10,7 @@ config SOC_SERIES_NRF52X select CPU_CORTEX_M4 select CPU_HAS_ARM_MPU select SOC_FAMILY_NRF - select HAS_SYS_POWER_STATE_DEEP_SLEEP_1 + select HAS_POWER_STATE_DEEP_SLEEP_1 select XIP select HAS_NRFX select HAS_NORDIC_DRIVERS diff --git a/soc/arm/nordic_nrf/nrf52/power.c b/soc/arm/nordic_nrf/nrf52/power.c index c8ac2b3865d..c1451314a1e 100644 --- a/soc/arm/nordic_nrf/nrf52/power.c +++ b/soc/arm/nordic_nrf/nrf52/power.c @@ -14,8 +14,8 @@ LOG_MODULE_DECLARE(soc, CONFIG_SOC_LOG_LEVEL); void sys_set_power_state(enum power_states state) { switch (state) { -#ifdef CONFIG_SYS_POWER_DEEP_SLEEP_STATES - #ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1 +#ifdef CONFIG_PM_DEEP_SLEEP_STATES + #ifdef CONFIG_HAS_POWER_STATE_DEEP_SLEEP_1 case SYS_POWER_STATE_DEEP_SLEEP_1: nrf_power_system_off(NRF_POWER); break; @@ -31,8 +31,8 @@ void sys_set_power_state(enum power_states state) void _sys_pm_power_state_exit_post_ops(enum power_states state) { switch (state) { -#ifdef CONFIG_SYS_POWER_DEEP_SLEEP_STATES - #ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1 +#ifdef CONFIG_PM_DEEP_SLEEP_STATES + #ifdef CONFIG_HAS_POWER_STATE_DEEP_SLEEP_1 case SYS_POWER_STATE_DEEP_SLEEP_1: /* Nothing to do. */ break; diff --git a/soc/arm/nordic_nrf/nrf53/CMakeLists.txt b/soc/arm/nordic_nrf/nrf53/CMakeLists.txt index e2cdaf798b7..c9799cf9ae6 100644 --- a/soc/arm/nordic_nrf/nrf53/CMakeLists.txt +++ b/soc/arm/nordic_nrf/nrf53/CMakeLists.txt @@ -4,6 +4,6 @@ zephyr_sources( soc.c ) -zephyr_library_sources_ifdef(CONFIG_SYS_POWER_MANAGEMENT +zephyr_library_sources_ifdef(CONFIG_PM power.c ) diff --git a/soc/arm/nordic_nrf/nrf53/Kconfig.soc b/soc/arm/nordic_nrf/nrf53/Kconfig.soc index d4df0eec28b..2a73f164abc 100644 --- a/soc/arm/nordic_nrf/nrf53/Kconfig.soc +++ b/soc/arm/nordic_nrf/nrf53/Kconfig.soc @@ -9,7 +9,7 @@ config SOC_NRF5340_CPUAPP select CPU_HAS_NRF_IDAU select CPU_HAS_FPU select ARMV8_M_DSP - select HAS_SYS_POWER_STATE_DEEP_SLEEP_1 + select HAS_POWER_STATE_DEEP_SLEEP_1 select HAS_HW_NRF_CC312 select HAS_HW_NRF_CLOCK select HAS_HW_NRF_DPPIC diff --git a/soc/arm/nordic_nrf/nrf53/power.c b/soc/arm/nordic_nrf/nrf53/power.c index c02dcd144b0..aededba32ee 100644 --- a/soc/arm/nordic_nrf/nrf53/power.c +++ b/soc/arm/nordic_nrf/nrf53/power.c @@ -7,7 +7,7 @@ #include #include -#ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1 +#ifdef CONFIG_HAS_POWER_STATE_DEEP_SLEEP_1 #include #endif @@ -18,8 +18,8 @@ LOG_MODULE_DECLARE(soc, CONFIG_SOC_LOG_LEVEL); void sys_set_power_state(enum power_states state) { switch (state) { -#ifdef CONFIG_SYS_POWER_DEEP_SLEEP_STATES - #ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1 +#ifdef CONFIG_PM_DEEP_SLEEP_STATES + #ifdef CONFIG_HAS_POWER_STATE_DEEP_SLEEP_1 case SYS_POWER_STATE_DEEP_SLEEP_1: nrf_regulators_system_off(NRF_REGULATORS); break; @@ -35,8 +35,8 @@ void sys_set_power_state(enum power_states state) void _sys_pm_power_state_exit_post_ops(enum power_states state) { switch (state) { -#ifdef CONFIG_SYS_POWER_DEEP_SLEEP_STATES - #ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1 +#ifdef CONFIG_PM_DEEP_SLEEP_STATES + #ifdef CONFIG_HAS_POWER_STATE_DEEP_SLEEP_1 case SYS_POWER_STATE_DEEP_SLEEP_1: /* Nothing to do. */ break; diff --git a/soc/arm/nordic_nrf/nrf91/CMakeLists.txt b/soc/arm/nordic_nrf/nrf91/CMakeLists.txt index e2cdaf798b7..c9799cf9ae6 100644 --- a/soc/arm/nordic_nrf/nrf91/CMakeLists.txt +++ b/soc/arm/nordic_nrf/nrf91/CMakeLists.txt @@ -4,6 +4,6 @@ zephyr_sources( soc.c ) -zephyr_library_sources_ifdef(CONFIG_SYS_POWER_MANAGEMENT +zephyr_library_sources_ifdef(CONFIG_PM power.c ) diff --git a/soc/arm/nordic_nrf/nrf91/Kconfig.series b/soc/arm/nordic_nrf/nrf91/Kconfig.series index ba493f2af25..a99c67431ac 100644 --- a/soc/arm/nordic_nrf/nrf91/Kconfig.series +++ b/soc/arm/nordic_nrf/nrf91/Kconfig.series @@ -13,7 +13,7 @@ config SOC_SERIES_NRF91X select CPU_HAS_FPU select ARMV8_M_DSP select SOC_FAMILY_NRF - select HAS_SYS_POWER_STATE_DEEP_SLEEP_1 + select HAS_POWER_STATE_DEEP_SLEEP_1 select XIP select HAS_NRFX select HAS_SEGGER_RTT diff --git a/soc/arm/nordic_nrf/nrf91/power.c b/soc/arm/nordic_nrf/nrf91/power.c index 8ba393350d1..c16af2640ed 100644 --- a/soc/arm/nordic_nrf/nrf91/power.c +++ b/soc/arm/nordic_nrf/nrf91/power.c @@ -15,8 +15,8 @@ LOG_MODULE_DECLARE(soc, CONFIG_SOC_LOG_LEVEL); void sys_set_power_state(enum power_states state) { switch (state) { -#ifdef CONFIG_SYS_POWER_DEEP_SLEEP_STATES - #ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1 +#ifdef CONFIG_PM_DEEP_SLEEP_STATES + #ifdef CONFIG_HAS_POWER_STATE_DEEP_SLEEP_1 case SYS_POWER_STATE_DEEP_SLEEP_1: nrf_regulators_system_off(NRF_REGULATORS); break; @@ -32,8 +32,8 @@ void sys_set_power_state(enum power_states state) void _sys_pm_power_state_exit_post_ops(enum power_states state) { switch (state) { -#ifdef CONFIG_SYS_POWER_DEEP_SLEEP_STATES - #ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1 +#ifdef CONFIG_PM_DEEP_SLEEP_STATES + #ifdef CONFIG_HAS_POWER_STATE_DEEP_SLEEP_1 case SYS_POWER_STATE_DEEP_SLEEP_1: /* Nothing to do. */ break; diff --git a/soc/arm/silabs_exx32/Kconfig.defconfig b/soc/arm/silabs_exx32/Kconfig.defconfig index 2421de66fce..b9606498ed8 100644 --- a/soc/arm/silabs_exx32/Kconfig.defconfig +++ b/soc/arm/silabs_exx32/Kconfig.defconfig @@ -6,6 +6,6 @@ source "soc/arm/silabs_exx32/*/Kconfig.defconfig.series" config SOC_GECKO_EMU default y - depends on SYS_POWER_MANAGEMENT + depends on PM endif diff --git a/soc/arm/silabs_exx32/common/CMakeLists.txt b/soc/arm/silabs_exx32/common/CMakeLists.txt index 0436151c4cb..27ad42591cc 100644 --- a/soc/arm/silabs_exx32/common/CMakeLists.txt +++ b/soc/arm/silabs_exx32/common/CMakeLists.txt @@ -2,4 +2,4 @@ zephyr_sources(soc.c soc_gpio.c) -zephyr_sources_ifdef(CONFIG_SYS_POWER_MANAGEMENT soc_power.c) +zephyr_sources_ifdef(CONFIG_PM soc_power.c) diff --git a/soc/arm/silabs_exx32/common/soc_power.c b/soc/arm/silabs_exx32/common/soc_power.c index 609e8dbb482..d8b52187a6e 100644 --- a/soc/arm/silabs_exx32/common/soc_power.c +++ b/soc/arm/silabs_exx32/common/soc_power.c @@ -35,23 +35,23 @@ void sys_set_power_state(enum power_states state) irq_unlock(0); switch (state) { -#ifdef CONFIG_SYS_POWER_SLEEP_STATES -#ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_1 +#ifdef CONFIG_PM_SLEEP_STATES +#ifdef CONFIG_HAS_POWER_STATE_SLEEP_1 case SYS_POWER_STATE_SLEEP_1: EMU_EnterEM1(); break; -#endif /* CONFIG_HAS_SYS_POWER_STATE_SLEEP_1 */ -#ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_2 +#endif /* CONFIG_HAS_POWER_STATE_SLEEP_1 */ +#ifdef CONFIG_HAS_POWER_STATE_SLEEP_2 case SYS_POWER_STATE_SLEEP_2: EMU_EnterEM2(true); break; -#endif /* CONFIG_HAS_SYS_POWER_STATE_SLEEP_2 */ -#ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_3 +#endif /* CONFIG_HAS_POWER_STATE_SLEEP_2 */ +#ifdef CONFIG_HAS_POWER_STATE_SLEEP_3 case SYS_POWER_STATE_SLEEP_3: EMU_EnterEM3(true); break; -#endif /* CONFIG_HAS_SYS_POWER_STATE_SLEEP_3 */ -#endif /* CONFIG_SYS_POWER_SLEEP_STATES */ +#endif /* CONFIG_HAS_POWER_STATE_SLEEP_3 */ +#endif /* CONFIG_PM_SLEEP_STATES */ default: LOG_DBG("Unsupported power state %u", state); break; diff --git a/soc/arm/silabs_exx32/efm32gg11b/Kconfig.series b/soc/arm/silabs_exx32/efm32gg11b/Kconfig.series index c561c9717f7..a65f72ba40c 100644 --- a/soc/arm/silabs_exx32/efm32gg11b/Kconfig.series +++ b/soc/arm/silabs_exx32/efm32gg11b/Kconfig.series @@ -12,9 +12,9 @@ config SOC_SERIES_EFM32GG11B select CPU_HAS_FPU select CPU_HAS_ARM_MPU select SOC_FAMILY_EXX32 - select HAS_SYS_POWER_STATE_SLEEP_1 - select HAS_SYS_POWER_STATE_SLEEP_2 - select HAS_SYS_POWER_STATE_SLEEP_3 + select HAS_POWER_STATE_SLEEP_1 + select HAS_POWER_STATE_SLEEP_2 + select HAS_POWER_STATE_SLEEP_3 select SOC_GECKO_HAS_INDIVIDUAL_PIN_LOCATION select SOC_GECKO_HAS_HFRCO_FREQRANGE select SOC_GECKO_CMU diff --git a/soc/arm/silabs_exx32/efm32jg12b/Kconfig.series b/soc/arm/silabs_exx32/efm32jg12b/Kconfig.series index 305c44c0ad8..6607e18312b 100644 --- a/soc/arm/silabs_exx32/efm32jg12b/Kconfig.series +++ b/soc/arm/silabs_exx32/efm32jg12b/Kconfig.series @@ -11,9 +11,9 @@ config SOC_SERIES_EFM32JG12B select CPU_CORTEX_M3 select CPU_HAS_ARM_MPU select SOC_FAMILY_EXX32 - select HAS_SYS_POWER_STATE_SLEEP_1 - select HAS_SYS_POWER_STATE_SLEEP_2 - select HAS_SYS_POWER_STATE_SLEEP_3 + select HAS_POWER_STATE_SLEEP_1 + select HAS_POWER_STATE_SLEEP_2 + select HAS_POWER_STATE_SLEEP_3 select SOC_GECKO_HAS_INDIVIDUAL_PIN_LOCATION select SOC_GECKO_HAS_HFRCO_FREQRANGE select SOC_GECKO_CMU diff --git a/soc/arm/silabs_exx32/efm32pg12b/Kconfig.series b/soc/arm/silabs_exx32/efm32pg12b/Kconfig.series index a45ca9f6c43..1fe2778d491 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 CPU_HAS_ARM_MPU select SOC_FAMILY_EXX32 - select HAS_SYS_POWER_STATE_SLEEP_1 - select HAS_SYS_POWER_STATE_SLEEP_2 - select HAS_SYS_POWER_STATE_SLEEP_3 + select HAS_POWER_STATE_SLEEP_1 + select HAS_POWER_STATE_SLEEP_2 + select HAS_POWER_STATE_SLEEP_3 select SOC_GECKO_HAS_INDIVIDUAL_PIN_LOCATION select SOC_GECKO_HAS_HFRCO_FREQRANGE select SOC_GECKO_CMU diff --git a/soc/arm/silabs_exx32/efr32bg13p/Kconfig.series b/soc/arm/silabs_exx32/efr32bg13p/Kconfig.series index 5d078c5406c..d385c7dfba9 100644 --- a/soc/arm/silabs_exx32/efr32bg13p/Kconfig.series +++ b/soc/arm/silabs_exx32/efr32bg13p/Kconfig.series @@ -13,9 +13,9 @@ config SOC_SERIES_EFR32BG13P select SOC_FAMILY_EXX32 select HAS_SILABS_GECKO select HAS_SWO - select HAS_SYS_POWER_STATE_SLEEP_1 - select HAS_SYS_POWER_STATE_SLEEP_2 - select HAS_SYS_POWER_STATE_SLEEP_3 + select HAS_POWER_STATE_SLEEP_1 + select HAS_POWER_STATE_SLEEP_2 + select HAS_POWER_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 5d183fde74b..b7a7c988544 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 CPU_HAS_ARM_MPU select SOC_FAMILY_EXX32 - select HAS_SYS_POWER_STATE_SLEEP_1 - select HAS_SYS_POWER_STATE_SLEEP_2 - select HAS_SYS_POWER_STATE_SLEEP_3 + select HAS_POWER_STATE_SLEEP_1 + select HAS_POWER_STATE_SLEEP_2 + select HAS_POWER_STATE_SLEEP_3 select SOC_GECKO_HAS_INDIVIDUAL_PIN_LOCATION select SOC_GECKO_HAS_HFRCO_FREQRANGE select SOC_GECKO_CMU diff --git a/soc/arm/silabs_exx32/efr32mg12p/Kconfig.series b/soc/arm/silabs_exx32/efr32mg12p/Kconfig.series index be9aab29f74..98217827a66 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 SOC_FAMILY_EXX32 select HAS_SILABS_GECKO select HAS_SWO - select HAS_SYS_POWER_STATE_SLEEP_1 - select HAS_SYS_POWER_STATE_SLEEP_2 - select HAS_SYS_POWER_STATE_SLEEP_3 + select HAS_POWER_STATE_SLEEP_1 + select HAS_POWER_STATE_SLEEP_2 + select HAS_POWER_STATE_SLEEP_3 select SOC_GECKO_HAS_INDIVIDUAL_PIN_LOCATION select SOC_GECKO_HAS_HFRCO_FREQRANGE select SOC_GECKO_CMU diff --git a/soc/arm/silabs_exx32/efr32mg21/Kconfig.series b/soc/arm/silabs_exx32/efr32mg21/Kconfig.series index 4519332e6e9..54b70947256 100644 --- a/soc/arm/silabs_exx32/efr32mg21/Kconfig.series +++ b/soc/arm/silabs_exx32/efr32mg21/Kconfig.series @@ -14,9 +14,9 @@ config SOC_SERIES_EFR32MG21 select SOC_FAMILY_EXX32 select HAS_SILABS_GECKO select HAS_SWO - select HAS_SYS_POWER_STATE_SLEEP_1 - select HAS_SYS_POWER_STATE_SLEEP_2 - select HAS_SYS_POWER_STATE_SLEEP_3 + select HAS_POWER_STATE_SLEEP_1 + select HAS_POWER_STATE_SLEEP_2 + select HAS_POWER_STATE_SLEEP_3 select SOC_GECKO_CORE select SOC_GECKO_CMU select SOC_GECKO_EMU diff --git a/soc/arm/st_stm32/stm32l4/CMakeLists.txt b/soc/arm/st_stm32/stm32l4/CMakeLists.txt index 8442013afdc..59be7817eab 100644 --- a/soc/arm/st_stm32/stm32l4/CMakeLists.txt +++ b/soc/arm/st_stm32/stm32l4/CMakeLists.txt @@ -5,6 +5,6 @@ zephyr_sources( soc.c ) -zephyr_sources_ifdef(CONFIG_SYS_POWER_MANAGEMENT +zephyr_sources_ifdef(CONFIG_PM power.c ) diff --git a/soc/arm/st_stm32/stm32l4/Kconfig.defconfig.series b/soc/arm/st_stm32/stm32l4/Kconfig.defconfig.series index 1d09907dc2b..7810bfdf6d9 100644 --- a/soc/arm/st_stm32/stm32l4/Kconfig.defconfig.series +++ b/soc/arm/st_stm32/stm32l4/Kconfig.defconfig.series @@ -16,7 +16,7 @@ config SOC_SERIES config STM32_LPTIM_TIMER bool default y - depends on SYS_POWER_MANAGEMENT + depends on PM config DMA_STM32_V2 default y diff --git a/soc/arm/st_stm32/stm32l4/Kconfig.series b/soc/arm/st_stm32/stm32l4/Kconfig.series index 65dc3fad998..327e86eec3c 100644 --- a/soc/arm/st_stm32/stm32l4/Kconfig.series +++ b/soc/arm/st_stm32/stm32l4/Kconfig.series @@ -14,8 +14,8 @@ config SOC_SERIES_STM32L4X select HAS_STM32CUBE select CPU_HAS_ARM_MPU select HAS_SWO - select HAS_SYS_POWER_STATE_SLEEP_1 - select HAS_SYS_POWER_STATE_SLEEP_2 - select HAS_SYS_POWER_STATE_SLEEP_3 + select HAS_POWER_STATE_SLEEP_1 + select HAS_POWER_STATE_SLEEP_2 + select HAS_POWER_STATE_SLEEP_3 help Enable support for STM32L4 MCU series diff --git a/soc/arm/st_stm32/stm32l4/power.c b/soc/arm/st_stm32/stm32l4/power.c index 9321c1d5053..9aa07d3e021 100644 --- a/soc/arm/st_stm32/stm32l4/power.c +++ b/soc/arm/st_stm32/stm32l4/power.c @@ -20,8 +20,8 @@ LOG_MODULE_DECLARE(soc, CONFIG_SOC_LOG_LEVEL); void sys_set_power_state(enum power_states state) { switch (state) { -#ifdef CONFIG_SYS_POWER_SLEEP_STATES -#ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_1 +#ifdef CONFIG_PM_SLEEP_STATES +#ifdef CONFIG_HAS_POWER_STATE_SLEEP_1 case SYS_POWER_STATE_SLEEP_1: /* this corresponds to the STOP0 mode: */ @@ -37,8 +37,8 @@ void sys_set_power_state(enum power_states state) /* enter SLEEP mode : WFE or WFI */ k_cpu_idle(); break; -#endif /* CONFIG_HAS_SYS_POWER_STATE_SLEEP_1 */ -#ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_2 +#endif /* CONFIG_HAS_POWER_STATE_SLEEP_1 */ +#ifdef CONFIG_HAS_POWER_STATE_SLEEP_2 case SYS_POWER_STATE_SLEEP_2: /* this corresponds to the STOP1 mode: */ #ifdef CONFIG_DEBUG @@ -52,8 +52,8 @@ void sys_set_power_state(enum power_states state) LL_LPM_EnableDeepSleep(); k_cpu_idle(); break; -#endif /* CONFIG_HAS_SYS_POWER_STATE_SLEEP_2 */ -#ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_3 +#endif /* CONFIG_HAS_POWER_STATE_SLEEP_2 */ +#ifdef CONFIG_HAS_POWER_STATE_SLEEP_3 case SYS_POWER_STATE_SLEEP_3: /* this corresponds to the STOP2 mode: */ #ifdef CONFIG_DEBUG @@ -70,8 +70,8 @@ void sys_set_power_state(enum power_states state) LL_LPM_EnableDeepSleep(); k_cpu_idle(); break; -#endif /* CONFIG_HAS_SYS_POWER_STATE_SLEEP_3 */ -#endif /* CONFIG_SYS_POWER_SLEEP_STATES */ +#endif /* CONFIG_HAS_POWER_STATE_SLEEP_3 */ +#endif /* CONFIG_PM_SLEEP_STATES */ default: LOG_DBG("Unsupported power state %u", state); break; @@ -82,20 +82,20 @@ void sys_set_power_state(enum power_states state) void _sys_pm_power_state_exit_post_ops(enum power_states state) { switch (state) { -#ifdef CONFIG_SYS_POWER_SLEEP_STATES -#ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_1 +#ifdef CONFIG_PM_SLEEP_STATES +#ifdef CONFIG_HAS_POWER_STATE_SLEEP_1 case SYS_POWER_STATE_SLEEP_1: -#endif /* CONFIG_HAS_SYS_POWER_STATE_SLEEP_1 */ -#ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_2 +#endif /* CONFIG_HAS_POWER_STATE_SLEEP_1 */ +#ifdef CONFIG_HAS_POWER_STATE_SLEEP_2 case SYS_POWER_STATE_SLEEP_2: -#endif /* CONFIG_HAS_SYS_POWER_STATE_SLEEP_2 */ -#ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_3 +#endif /* CONFIG_HAS_POWER_STATE_SLEEP_2 */ +#ifdef CONFIG_HAS_POWER_STATE_SLEEP_3 case SYS_POWER_STATE_SLEEP_3: -#endif /* CONFIG_HAS_SYS_POWER_STATE_SLEEP_3 */ +#endif /* CONFIG_HAS_POWER_STATE_SLEEP_3 */ LL_LPM_DisableSleepOnExit(); LL_LPM_EnableSleep(); break; -#endif /* CONFIG_SYS_POWER_SLEEP_STATES */ +#endif /* CONFIG_PM_SLEEP_STATES */ default: LOG_DBG("Unsupported power state %u", state); break; diff --git a/soc/arm/st_stm32/stm32wb/CMakeLists.txt b/soc/arm/st_stm32/stm32wb/CMakeLists.txt index 861b4d4155f..5ae42f3a1d2 100644 --- a/soc/arm/st_stm32/stm32wb/CMakeLists.txt +++ b/soc/arm/st_stm32/stm32wb/CMakeLists.txt @@ -8,6 +8,6 @@ zephyr_linker_sources_ifdef(CONFIG_BT_STM32_IPM ipm.ld ) -zephyr_sources_ifdef(CONFIG_SYS_POWER_MANAGEMENT +zephyr_sources_ifdef(CONFIG_PM power.c ) diff --git a/soc/arm/st_stm32/stm32wb/Kconfig.defconfig.series b/soc/arm/st_stm32/stm32wb/Kconfig.defconfig.series index 28d7778dd06..1004252d133 100644 --- a/soc/arm/st_stm32/stm32wb/Kconfig.defconfig.series +++ b/soc/arm/st_stm32/stm32wb/Kconfig.defconfig.series @@ -13,7 +13,7 @@ config SOC_SERIES config STM32_LPTIM_TIMER bool default y - depends on SYS_POWER_MANAGEMENT + depends on PM config DMA_STM32_V2 default y diff --git a/soc/arm/st_stm32/stm32wb/Kconfig.series b/soc/arm/st_stm32/stm32wb/Kconfig.series index 7960eb07a0f..8d15fe985b0 100644 --- a/soc/arm/st_stm32/stm32wb/Kconfig.series +++ b/soc/arm/st_stm32/stm32wb/Kconfig.series @@ -13,8 +13,8 @@ config SOC_SERIES_STM32WBX select HAS_STM32CUBE select CPU_HAS_ARM_MPU select HAS_SWO - select HAS_SYS_POWER_STATE_SLEEP_1 - select HAS_SYS_POWER_STATE_SLEEP_2 - select HAS_SYS_POWER_STATE_SLEEP_3 + select HAS_POWER_STATE_SLEEP_1 + select HAS_POWER_STATE_SLEEP_2 + select HAS_POWER_STATE_SLEEP_3 help Enable support for STM32WB MCU series diff --git a/soc/arm/st_stm32/stm32wb/power.c b/soc/arm/st_stm32/stm32wb/power.c index e30364ba7ba..36a402e8fe8 100644 --- a/soc/arm/st_stm32/stm32wb/power.c +++ b/soc/arm/st_stm32/stm32wb/power.c @@ -20,8 +20,8 @@ LOG_MODULE_DECLARE(soc, CONFIG_SOC_LOG_LEVEL); void sys_set_power_state(enum power_states state) { switch (state) { -#ifdef CONFIG_SYS_POWER_SLEEP_STATES -#ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_1 +#ifdef CONFIG_PM_SLEEP_STATES +#ifdef CONFIG_HAS_POWER_STATE_SLEEP_1 case SYS_POWER_STATE_SLEEP_1: /* this corresponds to the STOP0 mode: */ @@ -37,8 +37,8 @@ void sys_set_power_state(enum power_states state) /* enter SLEEP mode : WFE or WFI */ k_cpu_idle(); break; -#endif /* CONFIG_HAS_SYS_POWER_STATE_SLEEP_1 */ -#ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_2 +#endif /* CONFIG_HAS_POWER_STATE_SLEEP_1 */ +#ifdef CONFIG_HAS_POWER_STATE_SLEEP_2 case SYS_POWER_STATE_SLEEP_2: /* this corresponds to the STOP1 mode: */ #ifdef CONFIG_DEBUG @@ -52,8 +52,8 @@ void sys_set_power_state(enum power_states state) LL_LPM_EnableDeepSleep(); k_cpu_idle(); break; -#endif /* CONFIG_HAS_SYS_POWER_STATE_SLEEP_2 */ -#ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_3 +#endif /* CONFIG_HAS_POWER_STATE_SLEEP_2 */ +#ifdef CONFIG_HAS_POWER_STATE_SLEEP_3 case SYS_POWER_STATE_SLEEP_3: /* this corresponds to the STOP2 mode: */ #ifdef CONFIG_DEBUG @@ -70,8 +70,8 @@ void sys_set_power_state(enum power_states state) LL_LPM_EnableDeepSleep(); k_cpu_idle(); break; -#endif /* CONFIG_HAS_SYS_POWER_STATE_SLEEP_3 */ -#endif /* CONFIG_SYS_POWER_SLEEP_STATES */ +#endif /* CONFIG_HAS_POWER_STATE_SLEEP_3 */ +#endif /* CONFIG_PM_SLEEP_STATES */ default: LOG_DBG("Unsupported power state %u", state); break; @@ -82,20 +82,20 @@ void sys_set_power_state(enum power_states state) void _sys_pm_power_state_exit_post_ops(enum power_states state) { switch (state) { -#ifdef CONFIG_SYS_POWER_SLEEP_STATES -#ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_1 +#ifdef CONFIG_PM_SLEEP_STATES +#ifdef CONFIG_HAS_POWER_STATE_SLEEP_1 case SYS_POWER_STATE_SLEEP_1: -#endif /* CONFIG_HAS_SYS_POWER_STATE_SLEEP_1 */ -#ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_2 +#endif /* CONFIG_HAS_POWER_STATE_SLEEP_1 */ +#ifdef CONFIG_HAS_POWER_STATE_SLEEP_2 case SYS_POWER_STATE_SLEEP_2: -#endif /* CONFIG_HAS_SYS_POWER_STATE_SLEEP_2 */ -#ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_3 +#endif /* CONFIG_HAS_POWER_STATE_SLEEP_2 */ +#ifdef CONFIG_HAS_POWER_STATE_SLEEP_3 case SYS_POWER_STATE_SLEEP_3: -#endif /* CONFIG_HAS_SYS_POWER_STATE_SLEEP_3 */ +#endif /* CONFIG_HAS_POWER_STATE_SLEEP_3 */ LL_LPM_DisableSleepOnExit(); LL_LPM_EnableSleep(); break; -#endif /* CONFIG_SYS_POWER_SLEEP_STATES */ +#endif /* CONFIG_PM_SLEEP_STATES */ default: LOG_DBG("Unsupported power state %u", state); break; diff --git a/soc/arm/ti_simplelink/cc13x2_cc26x2/CMakeLists.txt b/soc/arm/ti_simplelink/cc13x2_cc26x2/CMakeLists.txt index d486dcfab8d..e3dbcde504d 100644 --- a/soc/arm/ti_simplelink/cc13x2_cc26x2/CMakeLists.txt +++ b/soc/arm/ti_simplelink/cc13x2_cc26x2/CMakeLists.txt @@ -5,5 +5,5 @@ zephyr_sources(soc.c) zephyr_sources(ccfg.c) -zephyr_library_sources_ifdef(CONFIG_SYS_POWER_MANAGEMENT power.c) -zephyr_library_sources_ifdef(CONFIG_DEVICE_POWER_MANAGEMENT power.c) +zephyr_library_sources_ifdef(CONFIG_PM power.c) +zephyr_library_sources_ifdef(CONFIG_PM_DEVICE power.c) diff --git a/soc/arm/ti_simplelink/cc13x2_cc26x2/Kconfig.defconfig.series b/soc/arm/ti_simplelink/cc13x2_cc26x2/Kconfig.defconfig.series index b7ccba7d6ad..dd359899431 100644 --- a/soc/arm/ti_simplelink/cc13x2_cc26x2/Kconfig.defconfig.series +++ b/soc/arm/ti_simplelink/cc13x2_cc26x2/Kconfig.defconfig.series @@ -55,13 +55,13 @@ config IEEE802154_CC13XX_CC26XX default y # required for linking with PowerCC26X2_config in # soc/arm/ti_simplelink/cc13x2_cc26x2/power.c - select SYS_POWER_MANAGEMENT + select PM config IEEE802154_CC13XX_CC26XX_SUB_GHZ default y # required for linking with PowerCC26X2_config in # soc/arm/ti_simplelink/cc13x2_cc26x2/power.c - select SYS_POWER_MANAGEMENT + select PM config NET_CONFIG_IEEE802154_DEV_NAME default IEEE802154_CC13XX_CC26XX_DRV_NAME diff --git a/soc/arm/ti_simplelink/cc13x2_cc26x2/Kconfig.series b/soc/arm/ti_simplelink/cc13x2_cc26x2/Kconfig.series index 6a918b4c648..3ad5e161ec3 100644 --- a/soc/arm/ti_simplelink/cc13x2_cc26x2/Kconfig.series +++ b/soc/arm/ti_simplelink/cc13x2_cc26x2/Kconfig.series @@ -12,9 +12,9 @@ config SOC_SERIES_CC13X2_CC26X2 select SOC_FAMILY_TISIMPLELINK select HAS_CC13X2_CC26X2_SDK select HAS_TI_CCFG - select HAS_SYS_POWER_STATE_SLEEP_1 - select HAS_SYS_POWER_STATE_SLEEP_2 - select HAS_SYS_POWER_STATE_DEEP_SLEEP_1 - select SYS_PM_STATE_LOCK if SYS_POWER_MANAGEMENT + select HAS_POWER_STATE_SLEEP_1 + select HAS_POWER_STATE_SLEEP_2 + select HAS_POWER_STATE_DEEP_SLEEP_1 + select PM_STATE_LOCK if PM help Enable support for TI SimpleLink CC13x2 / CC26x2 SoCs diff --git a/soc/arm/ti_simplelink/cc13x2_cc26x2/power.c b/soc/arm/ti_simplelink/cc13x2_cc26x2/power.c index 326c6c261b5..d4d526bba44 100644 --- a/soc/arm/ti_simplelink/cc13x2_cc26x2/power.c +++ b/soc/arm/ti_simplelink/cc13x2_cc26x2/power.c @@ -58,7 +58,7 @@ extern PowerCC26X2_ModuleState PowerCC26X2_module; /* Invoke Low Power/System Off specific Tasks */ void sys_set_power_state(enum power_states state) { -#ifdef CONFIG_SYS_POWER_SLEEP_STATES +#ifdef CONFIG_PM_SLEEP_STATES uint32_t modeVIMS; uint32_t constraints; #endif @@ -74,7 +74,7 @@ void sys_set_power_state(enum power_states state) irq_unlock(0); switch (state) { -#ifdef CONFIG_SYS_POWER_SLEEP_STATES +#ifdef CONFIG_PM_SLEEP_STATES case SYS_POWER_STATE_SLEEP_1: /* query the declared constraints */ constraints = Power_getConstraintMask(); @@ -113,7 +113,7 @@ void sys_set_power_state(enum power_states state) break; #endif -#ifdef CONFIG_SYS_POWER_DEEP_SLEEP_STATES +#ifdef CONFIG_PM_DEEP_SLEEP_STATES case SYS_POWER_STATE_DEEP_SLEEP_1: Power_shutdown(0, 0); break; diff --git a/subsys/net/Kconfig b/subsys/net/Kconfig index e0fde627eca..2a5f6a98937 100644 --- a/subsys/net/Kconfig +++ b/subsys/net/Kconfig @@ -78,7 +78,7 @@ if NETWORKING config NET_POWER_MANAGEMENT bool default n - depends on DEVICE_POWER_MANAGEMENT + depends on PM_DEVICE source "subsys/net/Kconfig.hostname" diff --git a/subsys/power/CMakeLists.txt b/subsys/power/CMakeLists.txt index 7a3ea948d88..a4a17025f5b 100644 --- a/subsys/power/CMakeLists.txt +++ b/subsys/power/CMakeLists.txt @@ -1,8 +1,8 @@ # SPDX-License-Identifier: Apache-2.0 -zephyr_sources_ifdef(CONFIG_SYS_POWER_MANAGEMENT power.c) -zephyr_sources_ifdef(CONFIG_DEVICE_POWER_MANAGEMENT device.c) -zephyr_sources_ifdef(CONFIG_SYS_PM_STATE_LOCK pm_ctrl.c) -zephyr_sources_ifdef(CONFIG_DEVICE_IDLE_PM device_pm.c) +zephyr_sources_ifdef(CONFIG_PM power.c) +zephyr_sources_ifdef(CONFIG_PM_DEVICE device.c) +zephyr_sources_ifdef(CONFIG_PM_STATE_LOCK pm_ctrl.c) +zephyr_sources_ifdef(CONFIG_PM_DEVICE_IDLE device_pm.c) zephyr_sources_ifdef(CONFIG_REBOOT reboot.c) add_subdirectory(policy) diff --git a/subsys/power/Kconfig b/subsys/power/Kconfig index e1172564c05..c40ae175e8d 100644 --- a/subsys/power/Kconfig +++ b/subsys/power/Kconfig @@ -4,7 +4,13 @@ menu "Power Management" -menuconfig SYS_POWER_MANAGEMENT +config SYS_POWER_MANAGEMENT + bool "System Power management" + select PM + help + This option is deprecated. Please use CONFIG_PM instead. + +menuconfig PM bool "System Power management" select TICKLESS_IDLE help @@ -13,12 +19,12 @@ menuconfig SYS_POWER_MANAGEMENT power management subsystem of the number of ticks until the next kernel timer is due to expire. -if SYS_POWER_MANAGEMENT -config SYS_POWER_SLEEP_STATES +if PM +config PM_SLEEP_STATES bool "Low Power states" - depends on HAS_SYS_POWER_STATE_SLEEP_1 || \ - HAS_SYS_POWER_STATE_SLEEP_2 || \ - HAS_SYS_POWER_STATE_SLEEP_3 + depends on HAS_POWER_STATE_SLEEP_1 || \ + HAS_POWER_STATE_SLEEP_2 || \ + HAS_POWER_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,11 +32,11 @@ config SYS_POWER_SLEEP_STATES the CPU low power states supported by the processor. Generally the one saving most power. -config SYS_POWER_DEEP_SLEEP_STATES +config PM_DEEP_SLEEP_STATES bool "Deep Sleep states" - depends on HAS_SYS_POWER_STATE_DEEP_SLEEP_1 || \ - HAS_SYS_POWER_STATE_DEEP_SLEEP_2 || \ - HAS_SYS_POWER_STATE_DEEP_SLEEP_3 + depends on HAS_POWER_STATE_DEEP_SLEEP_1 || \ + HAS_POWER_STATE_DEEP_SLEEP_2 || \ + HAS_POWER_STATE_DEEP_SLEEP_3 help This option enables the kernel to interface with a power manager application. This permits the system to enter a Deep sleep state @@ -41,7 +47,7 @@ config SYS_POWER_DEEP_SLEEP_STATES restoration of states that were saved at the time of suspend. -config SYS_PM_STATE_LOCK +config PM_STATE_LOCK bool "Enable Power State locking capability" help Enable Power Management system state locking capability @@ -49,7 +55,7 @@ config SYS_PM_STATE_LOCK Power States while doing any critical work or needs quick response from hardware resources. -config SYS_PM_DIRECT_FORCE_MODE +config PM_DIRECT_FORCE_MODE bool "Enable system power management direct force trigger mode" help Enable system power management direct force trigger mode. In @@ -57,14 +63,14 @@ config SYS_PM_DIRECT_FORCE_MODE or deep sleep mode instead of waiting for idle thread to do it, so that it can reduce latency to enter low power mode. -config SYS_PM_DEBUG +config PM_DEBUG bool "Enable System Power Management debug hooks" help Enable System Power Management debugging hooks. -config DEVICE_IDLE_PM +config PM_DEVICE_IDLE bool "Enable device Idle Power Management" - depends on DEVICE_POWER_MANAGEMENT + depends on PM_DEVICE select POLL help Enable device Idle Power Management to save power. @@ -74,14 +80,14 @@ config DEVICE_IDLE_PM source "subsys/power/policy/Kconfig" -module = SYS_PM +module = PM module-str = System Power Management source "subsys/logging/Kconfig.template.log_config" -endif # SYS_POWER_MANAGEMENT +endif # PM -config DEVICE_POWER_MANAGEMENT +config PM_DEVICE bool "Device power management" help This option enables the device power management interface. The @@ -92,9 +98,15 @@ config DEVICE_POWER_MANAGEMENT like turning off device clocks and peripherals. The device drivers may also save and restore states in these hook functions. +config DEVICE_POWER_MANAGEMENT + bool "Device Power Management" + select PM_DEVICE + help + This option is deprecated, please use CONFIG_PM_DEVICE instead. + config PM_MAX_DEVICES int "Max number of devices support power management" - depends on DEVICE_POWER_MANAGEMENT + depends on PM_DEVICE default 15 endmenu diff --git a/subsys/power/device.c b/subsys/power/device.c index 41f0c420405..f2f5453ef1d 100644 --- a/subsys/power/device.c +++ b/subsys/power/device.c @@ -10,8 +10,8 @@ #include #include "policy/pm_policy.h" -#if defined(CONFIG_SYS_POWER_MANAGEMENT) -#define LOG_LEVEL CONFIG_SYS_PM_LOG_LEVEL /* From power module Kconfig */ +#if defined(CONFIG_PM) +#define LOG_LEVEL CONFIG_PM_LOG_LEVEL /* From power module Kconfig */ #include LOG_MODULE_DECLARE(power); @@ -182,4 +182,4 @@ void sys_pm_create_device_list(void) } } } -#endif /* defined(CONFIG_SYS_POWER_MANAGEMENT) */ +#endif /* defined(CONFIG_PM) */ diff --git a/subsys/power/device_pm.c b/subsys/power/device_pm.c index 7658406edb7..70a8c3058d1 100644 --- a/subsys/power/device_pm.c +++ b/subsys/power/device_pm.c @@ -9,7 +9,7 @@ #include #include -#define LOG_LEVEL CONFIG_SYS_PM_LOG_LEVEL /* From power module Kconfig */ +#define LOG_LEVEL CONFIG_PM_LOG_LEVEL /* From power module Kconfig */ #include LOG_MODULE_DECLARE(power); diff --git a/subsys/power/pm_ctrl.c b/subsys/power/pm_ctrl.c index 1f81f026428..95b8f9275e2 100644 --- a/subsys/power/pm_ctrl.c +++ b/subsys/power/pm_ctrl.c @@ -10,7 +10,7 @@ #include #include "policy/pm_policy.h" -#define LOG_LEVEL CONFIG_SYS_PM_LOG_LEVEL /* From power module Kconfig */ +#define LOG_LEVEL CONFIG_PM_LOG_LEVEL /* From power module Kconfig */ #include LOG_MODULE_DECLARE(power); diff --git a/subsys/power/policy/CMakeLists.txt b/subsys/power/policy/CMakeLists.txt index a8c8f1daadf..7594f7e734f 100644 --- a/subsys/power/policy/CMakeLists.txt +++ b/subsys/power/policy/CMakeLists.txt @@ -1,5 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -zephyr_sources_ifdef(CONFIG_SYS_PM_POLICY_DUMMY policy_dummy.c) -zephyr_sources_ifdef(CONFIG_SYS_PM_POLICY_RESIDENCY_DEFAULT policy_residency.c) -zephyr_sources_ifdef(CONFIG_SYS_PM_POLICY_RESIDENCY_CC13X2_CC26X2 policy_residency_cc13x2_cc26x2.c) +zephyr_sources_ifdef(CONFIG_PM_POLICY_DUMMY policy_dummy.c) +zephyr_sources_ifdef(CONFIG_PM_POLICY_RESIDENCY_DEFAULT policy_residency.c) +zephyr_sources_ifdef(CONFIG_PM_POLICY_RESIDENCY_CC13X2_CC26X2 policy_residency_cc13x2_cc26x2.c) diff --git a/subsys/power/policy/Kconfig b/subsys/power/policy/Kconfig index 83ebecca6a5..3db5971d279 100644 --- a/subsys/power/policy/Kconfig +++ b/subsys/power/policy/Kconfig @@ -5,83 +5,83 @@ choice help Select the idle state power management policy. -config SYS_PM_POLICY_RESIDENCY +config PM_POLICY_RESIDENCY bool "PM Policy based on CPU residency" - select SYS_PM_POLICY_RESIDENCY_DEFAULT if !SOC_SERIES_CC13X2_CC26X2 - select SYS_PM_POLICY_RESIDENCY_CC13X2_CC26X2 if SOC_SERIES_CC13X2_CC26X2 + select PM_POLICY_RESIDENCY_DEFAULT if !SOC_SERIES_CC13X2_CC26X2 + select PM_POLICY_RESIDENCY_CC13X2_CC26X2 if SOC_SERIES_CC13X2_CC26X2 help Select this option for PM policy based on CPU residencies. -config SYS_PM_POLICY_DUMMY +config PM_POLICY_DUMMY bool "Dummy PM Policy" help Dummy PM Policy which simply returns next PM state in a loop. -config SYS_PM_POLICY_APP +config PM_POLICY_APP bool "Application PM Policy" help When this option is selected, the application must provide PM policy. endchoice -config SYS_PM_POLICY_RESIDENCY_DEFAULT +config PM_POLICY_RESIDENCY_DEFAULT bool help Use the default residency policy implementation -config SYS_PM_POLICY_RESIDENCY_CC13X2_CC26X2 +config PM_POLICY_RESIDENCY_CC13X2_CC26X2 bool help Use the residency policy implementation for TI CC13x2/CC26x2 -if SYS_PM_POLICY_RESIDENCY +if PM_POLICY_RESIDENCY -config SYS_PM_MIN_RESIDENCY_SLEEP_1 +config PM_MIN_RESIDENCY_SLEEP_1 int "Sleep State 1 minimum residency" - depends on HAS_SYS_POWER_STATE_SLEEP_1 + depends on HAS_POWER_STATE_SLEEP_1 default 5000 help Minimum residency in milliseconds to enter SYS_POWER_STATE_SLEEP_1 state. -config SYS_PM_MIN_RESIDENCY_SLEEP_2 +config PM_MIN_RESIDENCY_SLEEP_2 int "Sleep State 2 minimum residency" - depends on HAS_SYS_POWER_STATE_SLEEP_2 + depends on HAS_POWER_STATE_SLEEP_2 default 10000 help Minimum residency in milliseconds to enter SYS_POWER_STATE_SLEEP_2 state. -config SYS_PM_MIN_RESIDENCY_SLEEP_3 +config PM_MIN_RESIDENCY_SLEEP_3 int "Sleep State 3 minimum residency" - depends on HAS_SYS_POWER_STATE_SLEEP_3 + depends on HAS_POWER_STATE_SLEEP_3 default 30000 help Minimum residency in milliseconds to enter SYS_POWER_STATE_SLEEP_3 state. -config SYS_PM_MIN_RESIDENCY_DEEP_SLEEP_1 +config PM_MIN_RESIDENCY_DEEP_SLEEP_1 int "Deep Sleep State 1 minimum residency" - depends on HAS_SYS_POWER_STATE_DEEP_SLEEP_1 + depends on HAS_POWER_STATE_DEEP_SLEEP_1 default 60000 help Minimum residency in milliseconds to enter SYS_POWER_STATE_DEEP_SLEEP_1 state. -config SYS_PM_MIN_RESIDENCY_DEEP_SLEEP_2 +config PM_MIN_RESIDENCY_DEEP_SLEEP_2 int "Deep Sleep State 2 minimum residency" - depends on HAS_SYS_POWER_STATE_DEEP_SLEEP_2 + depends on HAS_POWER_STATE_DEEP_SLEEP_2 default 90000 help Minimum residency in milliseconds to enter SYS_POWER_STATE_DEEP_SLEEP_2 state. -config SYS_PM_MIN_RESIDENCY_DEEP_SLEEP_3 +config PM_MIN_RESIDENCY_DEEP_SLEEP_3 int "Deep Sleep State 3 minimum residency" - depends on HAS_SYS_POWER_STATE_DEEP_SLEEP_3 + depends on HAS_POWER_STATE_DEEP_SLEEP_3 default 120000 help Minimum residency in milliseconds to enter SYS_POWER_STATE_DEEP_SLEEP_3 state. -endif # SYS_PM_POLICY_RESIDENCY +endif # PM_POLICY_RESIDENCY diff --git a/subsys/power/policy/policy_dummy.c b/subsys/power/policy/policy_dummy.c index c629da7d598..9d346c5da73 100644 --- a/subsys/power/policy/policy_dummy.c +++ b/subsys/power/policy/policy_dummy.c @@ -9,7 +9,7 @@ #include "pm_policy.h" #include -LOG_MODULE_DECLARE(power, CONFIG_SYS_PM_LOG_LEVEL); +LOG_MODULE_DECLARE(power, CONFIG_PM_LOG_LEVEL); enum power_states sys_pm_policy_next_state(int32_t ticks) { @@ -24,7 +24,7 @@ enum power_states sys_pm_policy_next_state(int32_t ticks) do { i = (i + 1) % SYS_POWER_STATE_MAX; -#ifdef CONFIG_SYS_PM_STATE_LOCK +#ifdef CONFIG_PM_STATE_LOCK if (!sys_pm_ctrl_is_state_enabled((enum power_states)(i))) { continue; } diff --git a/subsys/power/policy/policy_residency.c b/subsys/power/policy/policy_residency.c index 32de138dc9e..c769f429f2a 100644 --- a/subsys/power/policy/policy_residency.c +++ b/subsys/power/policy/policy_residency.c @@ -8,7 +8,7 @@ #include #include "pm_policy.h" -#define LOG_LEVEL CONFIG_SYS_PM_LOG_LEVEL /* From power module Kconfig */ +#define LOG_LEVEL CONFIG_PM_LOG_LEVEL /* From power module Kconfig */ #include LOG_MODULE_DECLARE(power); @@ -16,33 +16,33 @@ LOG_MODULE_DECLARE(power); /* PM Policy based on SoC/Platform residency requirements */ static const unsigned int pm_min_residency[] = { -#ifdef CONFIG_SYS_POWER_SLEEP_STATES -#ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_1 - CONFIG_SYS_PM_MIN_RESIDENCY_SLEEP_1 * SECS_TO_TICKS / MSEC_PER_SEC, +#ifdef CONFIG_PM_SLEEP_STATES +#ifdef CONFIG_HAS_POWER_STATE_SLEEP_1 + CONFIG_PM_MIN_RESIDENCY_SLEEP_1 * SECS_TO_TICKS / MSEC_PER_SEC, #endif -#ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_2 - CONFIG_SYS_PM_MIN_RESIDENCY_SLEEP_2 * SECS_TO_TICKS / MSEC_PER_SEC, +#ifdef CONFIG_HAS_POWER_STATE_SLEEP_2 + CONFIG_PM_MIN_RESIDENCY_SLEEP_2 * SECS_TO_TICKS / MSEC_PER_SEC, #endif -#ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_3 - CONFIG_SYS_PM_MIN_RESIDENCY_SLEEP_3 * SECS_TO_TICKS / MSEC_PER_SEC, +#ifdef CONFIG_HAS_POWER_STATE_SLEEP_3 + CONFIG_PM_MIN_RESIDENCY_SLEEP_3 * SECS_TO_TICKS / MSEC_PER_SEC, #endif -#endif /* CONFIG_SYS_POWER_SLEEP_STATES */ +#endif /* CONFIG_PM_SLEEP_STATES */ -#ifdef CONFIG_SYS_POWER_DEEP_SLEEP_STATES -#ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1 - CONFIG_SYS_PM_MIN_RESIDENCY_DEEP_SLEEP_1 * SECS_TO_TICKS / MSEC_PER_SEC, +#ifdef CONFIG_PM_DEEP_SLEEP_STATES +#ifdef CONFIG_HAS_POWER_STATE_DEEP_SLEEP_1 + CONFIG_PM_MIN_RESIDENCY_DEEP_SLEEP_1 * SECS_TO_TICKS / MSEC_PER_SEC, #endif -#ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_2 - CONFIG_SYS_PM_MIN_RESIDENCY_DEEP_SLEEP_2 * SECS_TO_TICKS / MSEC_PER_SEC, +#ifdef CONFIG_HAS_POWER_STATE_DEEP_SLEEP_2 + CONFIG_PM_MIN_RESIDENCY_DEEP_SLEEP_2 * SECS_TO_TICKS / MSEC_PER_SEC, #endif -#ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_3 - CONFIG_SYS_PM_MIN_RESIDENCY_DEEP_SLEEP_3 * SECS_TO_TICKS / MSEC_PER_SEC, +#ifdef CONFIG_HAS_POWER_STATE_DEEP_SLEEP_3 + CONFIG_PM_MIN_RESIDENCY_DEEP_SLEEP_3 * SECS_TO_TICKS / MSEC_PER_SEC, #endif -#endif /* CONFIG_SYS_POWER_DEEP_SLEEP_STATES */ +#endif /* CONFIG_PM_DEEP_SLEEP_STATES */ }; enum power_states sys_pm_policy_next_state(int32_t ticks) @@ -55,7 +55,7 @@ enum power_states sys_pm_policy_next_state(int32_t ticks) } for (i = ARRAY_SIZE(pm_min_residency) - 1; i >= 0; i--) { -#ifdef CONFIG_SYS_PM_STATE_LOCK +#ifdef CONFIG_PM_STATE_LOCK if (!sys_pm_ctrl_is_state_enabled((enum power_states)(i))) { continue; } diff --git a/subsys/power/policy/policy_residency_cc13x2_cc26x2.c b/subsys/power/policy/policy_residency_cc13x2_cc26x2.c index abd186eedf0..4eef83e780b 100644 --- a/subsys/power/policy/policy_residency_cc13x2_cc26x2.c +++ b/subsys/power/policy/policy_residency_cc13x2_cc26x2.c @@ -18,7 +18,7 @@ #include #include -#define LOG_LEVEL CONFIG_SYS_PM_LOG_LEVEL +#define LOG_LEVEL CONFIG_PM_LOG_LEVEL #include LOG_MODULE_DECLARE(power); @@ -31,10 +31,10 @@ extern PowerCC26X2_ModuleState PowerCC26X2_module; /* PM Policy based on SoC/Platform residency requirements */ static const unsigned int pm_min_residency[] = { -#ifdef CONFIG_SYS_POWER_SLEEP_STATES - CONFIG_SYS_PM_MIN_RESIDENCY_SLEEP_1 * SECS_TO_TICKS / MSEC_PER_SEC, - CONFIG_SYS_PM_MIN_RESIDENCY_SLEEP_2 * SECS_TO_TICKS / MSEC_PER_SEC, -#endif /* CONFIG_SYS_POWER_SLEEP_STATES */ +#ifdef CONFIG_PM_SLEEP_STATES + CONFIG_PM_MIN_RESIDENCY_SLEEP_1 * SECS_TO_TICKS / MSEC_PER_SEC, + CONFIG_PM_MIN_RESIDENCY_SLEEP_2 * SECS_TO_TICKS / MSEC_PER_SEC, +#endif /* CONFIG_PM_SLEEP_STATES */ }; enum power_states sys_pm_policy_next_state(int32_t ticks) @@ -55,7 +55,7 @@ enum power_states sys_pm_policy_next_state(int32_t ticks) } for (i = ARRAY_SIZE(pm_min_residency) - 1; i >= 0; i--) { -#ifdef CONFIG_SYS_PM_STATE_LOCK +#ifdef CONFIG_PM_STATE_LOCK if (!sys_pm_ctrl_is_state_enabled((enum power_states)(i))) { continue; } @@ -79,8 +79,8 @@ enum power_states sys_pm_policy_next_state(int32_t ticks) } /* Set timeout for wakeup event */ __ASSERT( - CONFIG_SYS_PM_MIN_RESIDENCY_SLEEP_2 > 1, - "CONFIG_SYS_PM_MIN_RESIDENCY_SLEEP_2 must " + CONFIG_PM_MIN_RESIDENCY_SLEEP_2 > 1, + "CONFIG_PM_MIN_RESIDENCY_SLEEP_2 must " "be greater than 1."); if (ticks != K_TICKS_FOREVER) { /* NOTE: Ideally we'd like to set a @@ -94,7 +94,7 @@ enum power_states sys_pm_policy_next_state(int32_t ticks) * would be at up to (WAKEDELAYSTANDBY * + 1 ms) ahead of the next timeout. * This also has the implication that - * SYS_PM_MIN_RESIDENCY_SLEEP_2 + * PM_MIN_RESIDENCY_SLEEP_2 * must be greater than 1. */ ticks -= (WAKEDELAYSTANDBY * @@ -137,7 +137,7 @@ enum power_states sys_pm_policy_next_state(int32_t ticks) __weak bool sys_pm_policy_low_power_devices(enum power_states pm_state) { -#ifdef CONFIG_SYS_POWER_SLEEP_STATES +#ifdef CONFIG_PM_SLEEP_STATES return (pm_state == SYS_POWER_STATE_SLEEP_2); #else return false; diff --git a/subsys/power/power.c b/subsys/power/power.c index 4ff7cdb5d80..d74600d3979 100644 --- a/subsys/power/power.c +++ b/subsys/power/power.c @@ -11,7 +11,7 @@ #include #include "policy/pm_policy.h" -#define LOG_LEVEL CONFIG_SYS_PM_LOG_LEVEL +#define LOG_LEVEL CONFIG_PM_LOG_LEVEL #include LOG_MODULE_REGISTER(power); @@ -19,7 +19,7 @@ static int post_ops_done = 1; static enum power_states forced_pm_state = SYS_POWER_STATE_AUTO; static enum power_states pm_state; -#ifdef CONFIG_SYS_PM_DEBUG +#ifdef CONFIG_PM_DEBUG struct pm_debug_info { uint32_t count; @@ -80,7 +80,7 @@ void sys_pm_force_power_state(enum power_states state) state < SYS_POWER_STATE_MAX, "Invalid power state %d!", state); -#ifdef CONFIG_SYS_PM_DIRECT_FORCE_MODE +#ifdef CONFIG_PM_DIRECT_FORCE_MODE (void)arch_irq_lock(); forced_pm_state = state; _sys_suspend(K_TICKS_FOREVER); @@ -92,7 +92,7 @@ void sys_pm_force_power_state(enum power_states state) enum power_states _sys_suspend(int32_t ticks) { bool deep_sleep; -#if CONFIG_DEVICE_POWER_MANAGEMENT +#if CONFIG_PM_DEVICE bool low_power = false; #endif @@ -104,14 +104,14 @@ enum power_states _sys_suspend(int32_t ticks) return pm_state; } - deep_sleep = IS_ENABLED(CONFIG_SYS_POWER_DEEP_SLEEP_STATES) ? + deep_sleep = IS_ENABLED(CONFIG_PM_DEEP_SLEEP_STATES) ? sys_pm_is_deep_sleep_state(pm_state) : 0; post_ops_done = 0; sys_pm_notify_power_state_entry(pm_state); if (deep_sleep) { -#if CONFIG_DEVICE_POWER_MANAGEMENT +#if CONFIG_PM_DEVICE /* Suspend peripherals. */ if (sys_pm_suspend_devices()) { LOG_DBG("Some devices didn't enter suspend state!"); @@ -126,7 +126,7 @@ enum power_states _sys_suspend(int32_t ticks) * in deep sleep mode. */ _sys_pm_idle_exit_notification_disable(); -#if CONFIG_DEVICE_POWER_MANAGEMENT +#if CONFIG_PM_DEVICE } else { if (sys_pm_policy_low_power_devices(pm_state)) { /* low power peripherals. */ @@ -148,7 +148,7 @@ enum power_states _sys_suspend(int32_t ticks) sys_set_power_state(pm_state); sys_pm_debug_stop_timer(); -#if CONFIG_DEVICE_POWER_MANAGEMENT +#if CONFIG_PM_DEVICE if (deep_sleep || low_power) { /* Turn on peripherals and restore device states as necessary */ sys_pm_resume_devices(); @@ -191,7 +191,7 @@ void _sys_resume(void) } } -#if CONFIG_DEVICE_POWER_MANAGEMENT +#if CONFIG_PM_DEVICE static int sys_pm_init(const struct device *dev) { ARG_UNUSED(dev); @@ -201,4 +201,4 @@ static int sys_pm_init(const struct device *dev) } SYS_INIT(sys_pm_init, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); -#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */ +#endif /* CONFIG_PM_DEVICE */ diff --git a/subsys/shell/modules/device_service.c b/subsys/shell/modules/device_service.c index 21169c1141a..3db6a0c7018 100644 --- a/subsys/shell/modules/device_service.c +++ b/subsys/shell/modules/device_service.c @@ -98,7 +98,7 @@ static int cmd_device_list(const struct shell *shell, shell_fprintf(shell, SHELL_NORMAL, "- %s", dev->name); -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE uint32_t state = DEVICE_PM_ACTIVE_STATE; int err; @@ -107,7 +107,7 @@ static int cmd_device_list(const struct shell *shell, shell_fprintf(shell, SHELL_NORMAL, " (%s)", device_pm_state_str(state)); } -#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */ +#endif /* CONFIG_PM_DEVICE */ shell_fprintf(shell, SHELL_NORMAL, "\n"); } diff --git a/tests/benchmarks/latency_measure/prj.conf b/tests/benchmarks/latency_measure/prj.conf index ceec1f2abca..67b633e89cb 100644 --- a/tests/benchmarks/latency_measure/prj.conf +++ b/tests/benchmarks/latency_measure/prj.conf @@ -17,7 +17,7 @@ CONFIG_HW_STACK_PROTECTION=n CONFIG_COVERAGE=n # Disable system power management -CONFIG_SYS_POWER_MANAGEMENT=n +CONFIG_PM=n # Can only run under 1 CPU CONFIG_MP_NUM_CPUS=1 diff --git a/tests/bluetooth/bsim_bt/edtt_ble_test_app/hci_test_app/prj.conf b/tests/bluetooth/bsim_bt/edtt_ble_test_app/hci_test_app/prj.conf index cfd2c3bedee..740d566ae00 100644 --- a/tests/bluetooth/bsim_bt/edtt_ble_test_app/hci_test_app/prj.conf +++ b/tests/bluetooth/bsim_bt/edtt_ble_test_app/hci_test_app/prj.conf @@ -22,6 +22,6 @@ CONFIG_BT_CTLR_DTM_HCI=y CONFIG_BT_CTLR_TX_BUFFER_SIZE=60 CONFIG_BT_CTLR_DATA_LENGTH_MAX=60 -CONFIG_SYS_POWER_MANAGEMENT=y +CONFIG_PM=y CONFIG_TICKLESS_IDLE=y CONFIG_TICKLESS_KERNEL=y diff --git a/tests/kernel/device/src/main.c b/tests/kernel/device/src/main.c index de006da89c0..f26eab0f92d 100644 --- a/tests/kernel/device/src/main.c +++ b/tests/kernel/device/src/main.c @@ -185,7 +185,7 @@ void test_pre_kernel_detection(void) } } -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +#ifdef CONFIG_PM_DEVICE /** * @brief Test system device list query API with PM enabled. * diff --git a/tests/kernel/device/testcase.yaml b/tests/kernel/device/testcase.yaml index 241307e4c7f..d065ec894b3 100644 --- a/tests/kernel/device/testcase.yaml +++ b/tests/kernel/device/testcase.yaml @@ -9,4 +9,4 @@ tests: tags: device platform_exclude: mec15xxevb_assy6853 extra_configs: - - CONFIG_DEVICE_POWER_MANAGEMENT=y + - CONFIG_PM_DEVICE=y diff --git a/tests/kernel/profiling/profiling_api/Kconfig b/tests/kernel/profiling/profiling_api/Kconfig index b444be14cfe..49b2c58dc0d 100644 --- a/tests/kernel/profiling/profiling_api/Kconfig +++ b/tests/kernel/profiling/profiling_api/Kconfig @@ -3,7 +3,7 @@ config KERNEL_PROFILING_API_TEST bool default y - select HAS_SYS_POWER_STATE_SLEEP_1 + select HAS_POWER_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 ae40304071d..a8abe3eeb63 100644 --- a/tests/kernel/profiling/profiling_api/prj.conf +++ b/tests/kernel/profiling/profiling_api/prj.conf @@ -7,9 +7,9 @@ CONFIG_TEST_HW_STACK_PROTECTION=n # Disable HW Stack Protection (see #28664) CONFIG_HW_STACK_PROTECTION=n # to check idle thread -CONFIG_SYS_POWER_MANAGEMENT=y -CONFIG_SYS_POWER_SLEEP_STATES=y -CONFIG_SYS_PM_POLICY_APP=y +CONFIG_PM=y +CONFIG_PM_POLICY_APP=y +CONFIG_PM_SLEEP_STATES=y CONFIG_IDLE_STACK_SIZE=2048 # to check isr CONFIG_IRQ_OFFLOAD=y diff --git a/tests/kernel/tickless/tickless/prj.conf b/tests/kernel/tickless/tickless/prj.conf index 221188ede02..3107c3cb7f0 100644 --- a/tests/kernel/tickless/tickless/prj.conf +++ b/tests/kernel/tickless/tickless/prj.conf @@ -1,5 +1,5 @@ -CONFIG_SYS_POWER_MANAGEMENT=y +CONFIG_PM=y CONFIG_ZTEST=y # The code is written to assume a slow tick rate -CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 \ No newline at end of file +CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 diff --git a/tests/kernel/tickless/tickless_concept/prj.conf b/tests/kernel/tickless/tickless_concept/prj.conf index 736f2d1fea2..71b24dc4e2d 100644 --- a/tests/kernel/tickless/tickless_concept/prj.conf +++ b/tests/kernel/tickless/tickless_concept/prj.conf @@ -1,5 +1,5 @@ CONFIG_ZTEST=y -CONFIG_SYS_POWER_MANAGEMENT=y +CONFIG_PM=y CONFIG_TICKLESS_IDLE_THRESH=20 CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 CONFIG_MP_NUM_CPUS=1 diff --git a/tests/kernel/timer/timer_api/prj_tickless.conf b/tests/kernel/timer/timer_api/prj_tickless.conf index a07b4957685..d7712636086 100644 --- a/tests/kernel/timer/timer_api/prj_tickless.conf +++ b/tests/kernel/timer/timer_api/prj_tickless.conf @@ -1,5 +1,5 @@ CONFIG_ZTEST=y -CONFIG_SYS_POWER_MANAGEMENT=y +CONFIG_PM=y CONFIG_TICKLESS_KERNEL=y CONFIG_MP_NUM_CPUS=1 CONFIG_TEST_RANDOM_GENERATOR=y diff --git a/tests/net/pm/Kconfig b/tests/net/pm/Kconfig index f89890a04fd..bed639e1210 100644 --- a/tests/net/pm/Kconfig +++ b/tests/net/pm/Kconfig @@ -7,6 +7,6 @@ mainmenu "Network Power-Management test" config FAKE_DEV def_bool y - select NET_POWER_MANAGEMENT if DEVICE_POWER_MANAGEMENT + select NET_POWER_MANAGEMENT if PM_DEVICE source "Kconfig.zephyr" diff --git a/tests/net/pm/prj.conf b/tests/net/pm/prj.conf index 997295572cf..ac7223dc412 100644 --- a/tests/net/pm/prj.conf +++ b/tests/net/pm/prj.conf @@ -1,5 +1,5 @@ -CONFIG_SYS_POWER_MANAGEMENT=y -CONFIG_DEVICE_POWER_MANAGEMENT=y +CONFIG_PM=y +CONFIG_PM_DEVICE=y CONFIG_NETWORKING=y CONFIG_NET_TEST=y CONFIG_NET_L2_DUMMY=y diff --git a/tests/subsys/power/power_mgmt/Kconfig b/tests/subsys/power/power_mgmt/Kconfig index 591c4963daa..2ed8cb963e7 100644 --- a/tests/subsys/power/power_mgmt/Kconfig +++ b/tests/subsys/power/power_mgmt/Kconfig @@ -4,7 +4,7 @@ config SUBSYS_POWER_TEST bool default y - select HAS_SYS_POWER_STATE_SLEEP_1 + select HAS_POWER_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/subsys/power/power_mgmt/prj.conf b/tests/subsys/power/power_mgmt/prj.conf index 48ef006bf5c..b673ecb972f 100644 --- a/tests/subsys/power/power_mgmt/prj.conf +++ b/tests/subsys/power/power_mgmt/prj.conf @@ -1,7 +1,7 @@ CONFIG_ZTEST=y -CONFIG_SYS_POWER_MANAGEMENT=y -CONFIG_DEVICE_POWER_MANAGEMENT=y -CONFIG_DEVICE_IDLE_PM=y -CONFIG_SYS_PM_POLICY_APP=y -CONFIG_SYS_POWER_SLEEP_STATES=y +CONFIG_PM=y +CONFIG_PM_DEVICE=y +CONFIG_PM_DEVICE_IDLE=y +CONFIG_PM_POLICY_APP=y +CONFIG_PM_SLEEP_STATES=y CONFIG_MP_NUM_CPUS=1 diff --git a/tests/subsys/power/power_mgmt_soc/prj.conf b/tests/subsys/power/power_mgmt_soc/prj.conf index 655c0150e43..b9a2a455baf 100644 --- a/tests/subsys/power/power_mgmt_soc/prj.conf +++ b/tests/subsys/power/power_mgmt_soc/prj.conf @@ -1,9 +1,9 @@ CONFIG_LOG=y CONFIG_ZTEST=y -CONFIG_SYS_POWER_MANAGEMENT=y -CONFIG_SYS_POWER_SLEEP_STATES=y -CONFIG_SYS_POWER_DEEP_SLEEP_STATES=y -CONFIG_SYS_PM_MIN_RESIDENCY_SLEEP_1=1000 -CONFIG_SYS_PM_MIN_RESIDENCY_DEEP_SLEEP_1=2000 +CONFIG_PM=y +CONFIG_PM_SLEEP_STATES=y +CONFIG_PM_DEEP_SLEEP_STATES=y +CONFIG_PM_MIN_RESIDENCY_SLEEP_1=1000 +CONFIG_PM_MIN_RESIDENCY_DEEP_SLEEP_1=2000 CONFIG_THREAD_NAME=y -CONFIG_SYS_PM_DEBUG=y +CONFIG_PM_DEBUG=y diff --git a/tests/subsys/power/power_mgmt_soc/src/power_mgmt.c b/tests/subsys/power/power_mgmt_soc/src/power_mgmt.c index bd0dd5c39cf..1439b35808f 100644 --- a/tests/subsys/power/power_mgmt_soc/src/power_mgmt.c +++ b/tests/subsys/power/power_mgmt_soc/src/power_mgmt.c @@ -21,7 +21,7 @@ LOG_MODULE_REGISTER(pwrmgmt_test); #define TASK_STACK_SIZE 1024ul #define PRIORITY K_PRIO_COOP(5) -/* Sleep time should be lower than CONFIG_SYS_PM_MIN_RESIDENCY_SLEEP_1 */ +/* Sleep time should be lower than CONFIG_PM_MIN_RESIDENCY_SLEEP_1 */ #define THREAD_A_SLEEP_TIME 100ul #define THREAD_B_SLEEP_TIME 1000ul @@ -230,7 +230,7 @@ int test_pwr_mgmt_multithread(uint8_t cycles) suspend_all_tasks(); LOG_INF("About to enter light sleep"); pm_trigger_marker(); - k_msleep(CONFIG_SYS_PM_MIN_RESIDENCY_SLEEP_1 + + k_msleep(CONFIG_PM_MIN_RESIDENCY_SLEEP_1 + LT_EXTRA_SLP_TIME); LOG_INF("Wake from Light Sleep"); @@ -247,7 +247,7 @@ int test_pwr_mgmt_multithread(uint8_t cycles) LOG_INF("About to enter deep sleep"); pm_trigger_marker(); - k_msleep(CONFIG_SYS_PM_MIN_RESIDENCY_DEEP_SLEEP_1 + + k_msleep(CONFIG_PM_MIN_RESIDENCY_DEEP_SLEEP_1 + DP_EXTRA_SLP_TIME); LOG_INF("Wake from Deep Sleep"); @@ -277,7 +277,7 @@ int test_pwr_mgmt_singlethread(uint8_t cycles) /* Trigger Light Sleep 1 state. 48MHz PLL stays on */ LOG_INF("About to enter light sleep"); pm_trigger_marker(); - k_msleep(CONFIG_SYS_PM_MIN_RESIDENCY_SLEEP_1 + + k_msleep(CONFIG_PM_MIN_RESIDENCY_SLEEP_1 + LT_EXTRA_SLP_TIME); LOG_INF("Wake from Light Sleep"); pm_exit_marker(); @@ -289,7 +289,7 @@ int test_pwr_mgmt_singlethread(uint8_t cycles) LOG_INF("About to enter deep Sleep"); pm_trigger_marker(); - k_msleep(CONFIG_SYS_PM_MIN_RESIDENCY_DEEP_SLEEP_1 + + k_msleep(CONFIG_PM_MIN_RESIDENCY_DEEP_SLEEP_1 + DP_EXTRA_SLP_TIME); LOG_INF("Wake from Deep Sleep"); @@ -313,14 +313,14 @@ int test_dummy_init(void) while (iterations-- > 0) { LOG_INF("About to enter light sleep"); pm_trigger_marker(); - k_msleep(CONFIG_SYS_PM_MIN_RESIDENCY_SLEEP_1 + + k_msleep(CONFIG_PM_MIN_RESIDENCY_SLEEP_1 + LT_EXTRA_SLP_TIME); LOG_INF("Wake from Light Sleep"); pm_exit_marker(); LOG_INF("About to enter deep Sleep"); pm_trigger_marker(); - k_msleep(CONFIG_SYS_PM_MIN_RESIDENCY_DEEP_SLEEP_1 + + k_msleep(CONFIG_PM_MIN_RESIDENCY_DEEP_SLEEP_1 + DP_EXTRA_SLP_TIME); LOG_INF("Wake from Deep Sleep"); pm_exit_marker(); diff --git a/tests/subsys/power/power_mgmt_soc/src/power_mgmt.h b/tests/subsys/power/power_mgmt_soc/src/power_mgmt.h index 991d327a3a4..faafa424b73 100644 --- a/tests/subsys/power/power_mgmt_soc/src/power_mgmt.h +++ b/tests/subsys/power/power_mgmt_soc/src/power_mgmt.h @@ -11,10 +11,10 @@ /** @brief Alternates between light and deep sleep cycles. * * For light sleep, the test sleeps in main thread for 500 ms longer than - * CONFIG_SYS_PM_MIN_RESIDENCY_SLEEP_1. + * CONFIG_PM_MIN_RESIDENCY_SLEEP_1. * * Similarly for deep sleep, the test sleeps in the main thread for 500 ms - * longer than CONFIG_SYS_PM_MIN_RESIDENCY_DEEP_SLEEP_1. + * longer than CONFIG_PM_MIN_RESIDENCY_DEEP_SLEEP_1. * * @param cycles to repeat the cycle described above. * @retval 0 if successful, errno otherwise. diff --git a/tests/subsys/power/power_mgmt_soc/testcase.yaml b/tests/subsys/power/power_mgmt_soc/testcase.yaml index 0913d25928c..79ecc81765a 100644 --- a/tests/subsys/power/power_mgmt_soc/testcase.yaml +++ b/tests/subsys/power/power_mgmt_soc/testcase.yaml @@ -1,5 +1,5 @@ tests: subsys.power.pm_soc: platform_allow: cc26x2r1_launchxl cc1352r1_launchxl mec15xxevb_assy6853 mec1501modular_assy6885 - filter: CONFIG_SYS_PM_MIN_RESIDENCY_SLEEP_1 + filter: CONFIG_PM_MIN_RESIDENCY_SLEEP_1 tags: power