-
Notifications
You must be signed in to change notification settings - Fork 8.4k
soc: nxp: ke1xz: Enhance power management with STOP modes #101458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
soc: nxp: ke1xz: Enhance power management with STOP modes #101458
Conversation
|
The run log: |
Implement proper STOP mode support with partial stop options, add power state timing characteristics, and enable LPTMR-based wake-up for KE1xZ SoC family. - Fix STOP mode entry with correct SLEEPDEEP and PSTOPO configuration - Add min-residency-us/exit-latency-us to all power states - Use LPTMR as cortex-m-idle-timer for low-power operation - Add power_mgmt_soc test support for FRDM-KE17Z Signed-off-by: Holt Sun <[email protected]>
0c07f90 to
6d98c26
Compare
|
|
@Albort12138 @ZhaoxiangJin , please help review. |
bjarki-andreasen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but I'm suspicious of the __enable_irq()
|
|
||
| void pm_state_set(enum pm_state state, uint8_t substate_id) | ||
| { | ||
| __enable_irq(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| __enable_irq(); | |
| __disable_irq(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| } | ||
|
|
||
| /* Ensure STOPM is set to normal STOP (not VLPS/VLLS families), if present. */ | ||
| SMC->PMCTRL = (SMC->PMCTRL & ~SMC_PMCTRL_STOPM_MASK) | SMC_PMCTRL_STOPM(0U); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| SMC->PMCTRL = (SMC->PMCTRL & ~SMC_PMCTRL_STOPM_MASK) | SMC_PMCTRL_STOPM(0U); | |
| SMC->PMCTRL &= ~SMC_PMCTRL_STOPM_MASK; | |
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * Copyright 2024 NXP | |||
| * Copyright 2024, 2025 NXP | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2024-2025, also other files.
|
|
||
| # Keep LPTMR as wake/idle timer via counter API | ||
| CONFIG_COUNTER=y | ||
| CONFIG_COUNTER_MCUX_LPTMR=y |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CONFIG_COUNTER_MCUX_LPTMR not needed manually set to y here guess.
| config MCUX_LPTMR_TIMER | ||
| default y if PM | ||
|
|
||
| config CORTEX_M_SYSTICK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can change it to configdefault CORTEX_M_SYSTICK at the same time?
dts/arm/nxp/nxp_ke1xz.dtsi
Outdated
| idle: idle { | ||
| compatible = "zephyr,power-state"; | ||
| power-state-name = "runtime-idle"; | ||
| min-residency-us = <10>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the clock frequency of the LPTMR? I think the min-residency-us value needs careful consideration, as 10us may not be sufficient for even one hardware cycle of the LPTMR.
| compatible = "arm,cortex-m0+"; | ||
| clock-frequency = <DT_FREQ_M(48)>; | ||
| reg = <0>; | ||
| cpu-power-states = <&idle &stop &pstop1 &pstop2>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| cpu-power-states = <&idle &pstop2 &pstop1 &stop>; |
Based on this order, to find the appropriate mode more efficiently
| compatible = "zephyr,power-state"; | ||
| power-state-name = "suspend-to-idle"; | ||
| substate-id = <1>; | ||
| min-residency-us = <60>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where residency come from?
| power-state-name = "runtime-idle"; | ||
| min-residency-us = <10>; | ||
| /* 0.7 µs rounded */ | ||
| exit-latency-us = <1>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The exit-latency-us value should be incremented across different power modes.
|
To be honest, I'm not sure if your MCU has actually gone to low power mode. Look here: LPTMR can only be correctly configured as the wake-up source when |




Implement proper STOP mode support with partial stop options, add power state timing characteristics, and enable LPTMR-based wake-up for KE1xZ SoC family.