From cef3912ecf19eba44647b9988c1f8e27e786502d Mon Sep 17 00:00:00 2001 From: Mahesh Mahadevan Date: Fri, 26 Mar 2021 12:13:43 -0500 Subject: [PATCH] soc: RT600: Add support for suspend-to-idle power state Call SoC Deep Sleep mode Signed-off-by: Mahesh Mahadevan --- soc/arm/nxp_imx/rt6xx/power.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/soc/arm/nxp_imx/rt6xx/power.c b/soc/arm/nxp_imx/rt6xx/power.c index 805164e2c4a..9e08aaa94a7 100644 --- a/soc/arm/nxp_imx/rt6xx/power.c +++ b/soc/arm/nxp_imx/rt6xx/power.c @@ -10,6 +10,17 @@ #include LOG_MODULE_DECLARE(soc, CONFIG_SOC_LOG_LEVEL); +/*!< Power down all unnecessary blocks and enable RBB during deep sleep. */ +#define APP_DEEPSLEEP_RUNCFG0 (SYSCTL0_PDRUNCFG0_LPOSC_PD_MASK | \ + SYSCTL0_PDSLEEPCFG0_RBB_PD_MASK) +#define APP_DEEPSLEEP_RAM_APD 0xFFFFF8U +#define APP_DEEPSLEEP_RAM_PPD 0x0U +#define APP_EXCLUDE_FROM_DEEPSLEEP \ + (((const uint32_t[]){APP_DEEPSLEEP_RUNCFG0, \ + (SYSCTL0_PDSLEEPCFG1_FLEXSPI_SRAM_APD_MASK | \ + SYSCTL0_PDSLEEPCFG1_FLEXSPI_SRAM_PPD_MASK), \ + APP_DEEPSLEEP_RAM_APD, APP_DEEPSLEEP_RAM_PPD})) + /* Invoke Low Power/System Off specific Tasks */ void pm_power_state_set(struct pm_state_info info) { @@ -29,6 +40,9 @@ void pm_power_state_set(struct pm_state_info info) case PM_STATE_RUNTIME_IDLE: POWER_EnterSleep(); break; + case PM_STATE_SUSPEND_TO_IDLE: + POWER_EnterDeepSleep(APP_EXCLUDE_FROM_DEEPSLEEP); + break; default: LOG_DBG("Unsupported power state %u", info.state); break;