Skip to content

Commit

Permalink
power: standarize PM Kconfigs and cleanup
Browse files Browse the repository at this point in the history
- 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 <[email protected]>
  • Loading branch information
nashif committed Dec 9, 2020
1 parent 06a5946 commit dd931f9
Show file tree
Hide file tree
Showing 150 changed files with 551 additions and 526 deletions.
2 changes: 1 addition & 1 deletion Kconfig.zephyr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions arch/arc/core/isr_wrapper.S
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion arch/arc/core/reset.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/core/aarch32/irq_manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/core/aarch32/isr_wrapper.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion arch/posix/core/swap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
4 changes: 2 additions & 2 deletions arch/x86/core/ia32/crt0.S
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions arch/x86/core/ia32/intstub.S
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

GTEXT(arch_swap)

#ifdef CONFIG_SYS_POWER_MANAGEMENT
#ifdef CONFIG_PM
GTEXT(z_sys_power_save_idle_exit)
#endif

Expand Down Expand Up @@ -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 */

Expand Down Expand Up @@ -297,7 +297,7 @@ nestedInterrupt:
KPTI_IRET


#ifdef CONFIG_SYS_POWER_MANAGEMENT
#ifdef CONFIG_PM
handle_idle:
pushl %eax
pushl %edx
Expand All @@ -319,7 +319,7 @@ handle_idle:
popl %edx
popl %eax
jmp alreadyOnIntStack
#endif /* CONFIG_SYS_POWER_MANAGEMENT */
#endif /* CONFIG_PM */

/**
*
Expand Down
8 changes: 4 additions & 4 deletions boards/arm/cc1352r1_launchxl/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
8 changes: 4 additions & 4 deletions boards/arm/cc1352r1_launchxl/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions boards/arm/cc1352r_sensortag/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
8 changes: 4 additions & 4 deletions boards/arm/cc1352r_sensortag/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions boards/arm/cc26x2r1_launchxl/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
8 changes: 4 additions & 4 deletions boards/arm/cc26x2r1_launchxl/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions boards/arm/mec1501modular_assy6885/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion boards/arm/mec1501modular_assy6885/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions boards/arm/mec15xxevb_assy6853/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion boards/arm/mec15xxevb_assy6853/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion boards/posix/native_posix/board_irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion boards/posix/native_posix/irq_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion boards/posix/nrf52_bsim/board_irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion boards/posix/nrf52_bsim/irq_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading

0 comments on commit dd931f9

Please sign in to comment.