Skip to content

Commit 30ad0ee

Browse files
mmahadevan108cfriedt
authored andcommitted
soc: rw612: Reinitialize the GDET sensor and Voltage rails
Before re-entering Power Mode 3, we should disable the GET sensor and reinitialize the power rails. Signed-off-by: Mahesh Mahadevan <[email protected]>
1 parent aa50860 commit 30ad0ee

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

boards/nxp/frdm_rw612/init.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ void board_early_init_hook(void)
3636
{
3737
frdm_rw612_power_init_config();
3838

39+
/* If this is a wakeup from PM3 then return after configuring
40+
* the power supplies.
41+
*/
42+
if (PMU->PWR_MODE_STATUS == 2U) {
43+
return;
44+
}
45+
3946
#if CONFIG_PM
4047
static struct pm_notifier frdm_rw612_pm_notifier = {
4148
.state_exit = frdm_rw612_pm_state_exit,

boards/nxp/rd_rw612_bga/init.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ void board_early_init_hook(void)
3636
{
3737
rdrw61x_power_init_config();
3838

39+
/* If this is a wakeup from PM3 then return after configuring
40+
* the power supplies.
41+
*/
42+
if (PMU->PWR_MODE_STATUS == 2U) {
43+
return;
44+
}
45+
3946
#if CONFIG_PM
4047
static struct pm_notifier rdrw61x_pm_notifier = {
4148
.state_exit = rdrw61x_pm_state_exit,

soc/nxp/rw/power.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#endif
1818
#include <zephyr/drivers/timer/system_timer.h>
1919
#include <zephyr/drivers/timer/nxp_os_timer.h>
20-
20+
#include <zephyr/platform/hooks.h>
2121
#include "fsl_power.h"
2222

2323
#include <zephyr/logging/log.h>
@@ -228,6 +228,14 @@ __weak void pm_state_set(enum pm_state state, uint8_t substate_id)
228228
NVIC_ClearPendingIRQ(DT_IRQN(DT_NODELABEL(rtc)));
229229
sys_clock_idle_exit();
230230
sys_clock_set_timeout(0, true);
231+
/* GDET got enabled when exiting PM3, disable it
232+
* again before re-entering PM3.
233+
*/
234+
POWER_DisableGDetVSensors();
235+
236+
/* Reinitialize the board specific power rails */
237+
board_early_init_hook();
238+
231239
if (!(POWER_EnterPowerMode(POWER_MODE3, &slp_cfg))) {
232240
break;
233241
}

0 commit comments

Comments
 (0)