mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
soc/soc_caps: update soc caps for chips that support power-down of modem hardware
Closes WIFI-4424
This commit is contained in:
parent
6620411889
commit
cb0f517fe3
@ -30,6 +30,7 @@
|
||||
#include "esp_ipc.h"
|
||||
#include "esp_private/periph_ctrl.h"
|
||||
#include "esp_private/esp_clk.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "soc/rtc.h"
|
||||
#include "soc/rtc_cntl_reg.h"
|
||||
#include "soc/soc_memory_layout.h"
|
||||
@ -405,7 +406,7 @@ static DRAM_ATTR esp_pm_lock_handle_t s_light_sleep_pm_lock;
|
||||
void IRAM_ATTR btdm_hw_mac_power_down_wrapper(void)
|
||||
{
|
||||
#if CONFIG_MAC_BB_PD
|
||||
#if CONFIG_IDF_TARGET_ESP32C3
|
||||
#if SOC_PM_SUPPORT_BT_PD
|
||||
// Bluetooth module power down
|
||||
SET_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_BT_FORCE_ISO);
|
||||
SET_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_BT_FORCE_PD);
|
||||
@ -417,7 +418,7 @@ void IRAM_ATTR btdm_hw_mac_power_down_wrapper(void)
|
||||
void IRAM_ATTR btdm_hw_mac_power_up_wrapper(void)
|
||||
{
|
||||
#if CONFIG_MAC_BB_PD
|
||||
#if CONFIG_IDF_TARGET_ESP32C3
|
||||
#if SOC_PM_SUPPORT_BT_PD
|
||||
// Bluetooth module power up
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_BT_FORCE_PD);
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_BT_FORCE_ISO);
|
||||
@ -436,7 +437,7 @@ void IRAM_ATTR btdm_backup_dma_copy_wrapper(uint32_t reg, uint32_t mem_addr, uin
|
||||
static inline void esp_bt_power_domain_on(void)
|
||||
{
|
||||
// Bluetooth module power up
|
||||
#if CONFIG_IDF_TARGET_ESP32C3
|
||||
#if SOC_PM_SUPPORT_BT_PD
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_BT_FORCE_PD);
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_BT_FORCE_ISO);
|
||||
#endif
|
||||
@ -446,7 +447,7 @@ static inline void esp_bt_power_domain_on(void)
|
||||
static inline void esp_bt_power_domain_off(void)
|
||||
{
|
||||
// Bluetooth module power down
|
||||
#if CONFIG_IDF_TARGET_ESP32C3
|
||||
#if SOC_PM_SUPPORT_BT_PD
|
||||
SET_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_BT_FORCE_ISO);
|
||||
SET_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_BT_FORCE_PD);
|
||||
#endif
|
||||
|
@ -29,6 +29,7 @@ extern "C" {
|
||||
#define RTC_SLEEP_PD_DIG_PERIPH PMU_SLEEP_PD_HP_PERIPH //!< Power down DIG peripherals
|
||||
#define RTC_SLEEP_PD_INT_8M PMU_SLEEP_PD_RC_FAST //!< Power down Internal 20M oscillator
|
||||
#define RTC_SLEEP_PD_XTAL PMU_SLEEP_PD_XTAL //!< Power down main XTAL
|
||||
#define RTC_SLEEP_PD_MODEM PMU_SLEEP_PD_MODEM //!< Power down modem(include wifi, ble and 15.4)
|
||||
|
||||
//These flags are not power domains, but will affect some sleep parameters
|
||||
#define RTC_SLEEP_DIG_USE_8M BIT(16)
|
||||
|
@ -19,6 +19,16 @@
|
||||
|
||||
void rtc_init(rtc_config_t cfg)
|
||||
{
|
||||
/**
|
||||
* When run rtc_init, it maybe deep sleep reset. Since we power down modem in deep sleep, after wakeup
|
||||
* from deep sleep, these fields are changed and not reset. We will access two BB regs(BBPD_CTRL and
|
||||
* NRXPD_CTRL) in rtc_sleep_pu. If PD modem and no iso, CPU will stuck when access these two BB regs
|
||||
* and finally triggle RTC WDT. So need to clear modem Force PD.
|
||||
*
|
||||
* No worry about the power consumption, Because modem Force PD will be set at the end of this function.
|
||||
*/
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_FORCE_PD);
|
||||
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_ANA_CONF_REG, RTC_CNTL_PVTMON_PU | RTC_CNTL_TXRF_I2C_PU |
|
||||
RTC_CNTL_RFRX_PBUS_PU | RTC_CNTL_CKGEN_I2C_PU | RTC_CNTL_PLL_I2C_PU);
|
||||
|
||||
@ -91,7 +101,7 @@ void rtc_init(rtc_config_t cfg)
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_DG_PAD_FORCE_UNHOLD);
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_DG_PAD_FORCE_NOISO);
|
||||
}
|
||||
/* force power down wifi and bt power domain */
|
||||
/* force power down modem(wifi and btdm) power domain */
|
||||
SET_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_WIFI_FORCE_ISO);
|
||||
SET_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_FORCE_PD);
|
||||
|
||||
|
@ -91,7 +91,7 @@ void rtc_sleep_get_default_config(uint32_t sleep_flags, rtc_sleep_config_t *out_
|
||||
.rtc_fastmem_pd_en = ((sleep_flags) & RTC_SLEEP_PD_RTC_FAST_MEM) ? 1 : 0,
|
||||
.rtc_slowmem_pd_en = ((sleep_flags) & RTC_SLEEP_PD_RTC_SLOW_MEM) ? 1 : 0,
|
||||
.rtc_peri_pd_en = ((sleep_flags) & RTC_SLEEP_PD_RTC_PERIPH) ? 1 : 0,
|
||||
.wifi_pd_en = 0,
|
||||
.modem_pd_en = (sleep_flags & RTC_SLEEP_PD_MODEM) ? 1 : 0,
|
||||
.int_8m_pd_en = ((sleep_flags) & RTC_SLEEP_PD_INT_8M) ? 1 : 0,
|
||||
.rom_mem_pd_en = 0,
|
||||
.deep_slp = ((sleep_flags) & RTC_SLEEP_PD_DIG) ? 1 : 0,
|
||||
@ -182,7 +182,9 @@ void rtc_sleep_init(rtc_sleep_config_t cfg)
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_PWC_REG, RTC_CNTL_PD_EN);
|
||||
}
|
||||
|
||||
if (cfg.wifi_pd_en) {
|
||||
if (cfg.modem_pd_en) {
|
||||
REG_CLR_BIT(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_WIFI_FORCE_NOISO | RTC_CNTL_WIFI_FORCE_ISO);
|
||||
REG_CLR_BIT(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_FORCE_PU);
|
||||
SET_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_PD_EN);
|
||||
} else {
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_PD_EN);
|
||||
|
@ -31,6 +31,16 @@ static void set_rtc_dig_dbias(void);
|
||||
|
||||
void rtc_init(rtc_config_t cfg)
|
||||
{
|
||||
/**
|
||||
* When run rtc_init, it maybe deep sleep reset. Since we power down modem in deep sleep, after wakeup
|
||||
* from deep sleep, these fields are changed and not reset. We will access two BB regs(BBPD_CTRL and
|
||||
* NRXPD_CTRL) in rtc_sleep_pu. If PD modem and no iso, CPU will stuck when access these two BB regs
|
||||
* and finally triggle RTC WDT. So need to clear modem Force PD.
|
||||
*
|
||||
* No worry about the power consumption, Because modem Force PD will be set at the end of this function.
|
||||
*/
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_FORCE_PD);
|
||||
|
||||
REGI2C_WRITE_MASK(I2C_DIG_REG, I2C_DIG_REG_XPD_DIG_REG, 0);
|
||||
REGI2C_WRITE_MASK(I2C_DIG_REG, I2C_DIG_REG_XPD_RTC_REG, 0);
|
||||
|
||||
|
@ -116,11 +116,15 @@ void rtc_sleep_init(rtc_sleep_config_t cfg)
|
||||
rtc_sleep_pu(pu_cfg);
|
||||
}
|
||||
if (cfg.wifi_pd_en) {
|
||||
REG_CLR_BIT(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_WIFI_FORCE_NOISO | RTC_CNTL_WIFI_FORCE_ISO);
|
||||
REG_CLR_BIT(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_FORCE_PU);
|
||||
SET_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_PD_EN);
|
||||
} else {
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_PD_EN);
|
||||
}
|
||||
if (cfg.bt_pd_en) {
|
||||
REG_CLR_BIT(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_BT_FORCE_NOISO | RTC_CNTL_BT_FORCE_ISO);
|
||||
REG_CLR_BIT(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_BT_FORCE_PU);
|
||||
SET_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_BT_PD_EN);
|
||||
} else {
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_BT_PD_EN);
|
||||
|
@ -28,6 +28,16 @@ static void calibrate_ocode(void);
|
||||
|
||||
void rtc_init(rtc_config_t cfg)
|
||||
{
|
||||
/**
|
||||
* When run rtc_init, it maybe deep sleep reset. Since we power down modem in deep sleep, after wakeup
|
||||
* from deep sleep, these fields are changed and not reset. We will access two BB regs(BBPD_CTRL and
|
||||
* NRXPD_CTRL) in rtc_sleep_pu. If PD modem and no iso, CPU will stuck when access these two BB regs
|
||||
* and finally triggle RTC WDT. So need to clear modem Force PD.
|
||||
*
|
||||
* No worry about the power consumption, Because modem Force PD will be set at the end of this function.
|
||||
*/
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_FORCE_PD);
|
||||
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_ANA_CONF_REG, RTC_CNTL_PVTMON_PU);
|
||||
REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_PLL_BUF_WAIT, cfg.pll_wait);
|
||||
REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_CK8M_WAIT, cfg.ck8m_wait);
|
||||
|
@ -131,6 +131,8 @@ void rtc_sleep_init(rtc_sleep_config_t cfg)
|
||||
}
|
||||
|
||||
if (cfg.wifi_pd_en) {
|
||||
REG_CLR_BIT(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_WIFI_FORCE_NOISO | RTC_CNTL_WIFI_FORCE_ISO);
|
||||
REG_CLR_BIT(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_FORCE_PU);
|
||||
SET_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_PD_EN);
|
||||
} else {
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_PD_EN);
|
||||
|
@ -45,6 +45,16 @@ uint32_t g_rtc_dbias_pvt_non_240m = 27;
|
||||
|
||||
void rtc_init(rtc_config_t cfg)
|
||||
{
|
||||
/**
|
||||
* When run rtc_init, it maybe deep sleep reset. Since we power down modem in deep sleep, after wakeup
|
||||
* from deep sleep, these fields are changed and not reset. We will access two BB regs(BBPD_CTRL and
|
||||
* NRXPD_CTRL) in rtc_sleep_pu. If PD modem and no iso, CPU will stuck when access these two BB regs
|
||||
* and finally triggle RTC WDT. So need to clear modem Force PD.
|
||||
*
|
||||
* No worry about the power consumption, Because modem Force PD will be set at the end of this function.
|
||||
*/
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_FORCE_PD);
|
||||
|
||||
REGI2C_WRITE_MASK(I2C_DIG_REG, I2C_DIG_REG_XPD_RTC_REG, 0);
|
||||
REGI2C_WRITE_MASK(I2C_DIG_REG, I2C_DIG_REG_XPD_DIG_REG, 0);
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_ANA_CONF_REG, RTC_CNTL_PVTMON_PU);
|
||||
@ -187,7 +197,7 @@ void rtc_init(rtc_config_t cfg)
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_DG_PAD_FORCE_UNHOLD);
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_DG_PAD_FORCE_NOISO);
|
||||
}
|
||||
/* force power down wifi and bt power domain */
|
||||
/* force power down modem(wifi and ble) power domain */
|
||||
SET_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_WIFI_FORCE_ISO);
|
||||
SET_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_FORCE_PD);
|
||||
|
||||
|
@ -59,8 +59,7 @@ void rtc_sleep_get_default_config(uint32_t sleep_flags, rtc_sleep_config_t *out_
|
||||
.rtc_fastmem_pd_en = (sleep_flags & RTC_SLEEP_PD_RTC_FAST_MEM) ? 1 : 0,
|
||||
.rtc_slowmem_pd_en = (sleep_flags & RTC_SLEEP_PD_RTC_SLOW_MEM) ? 1 : 0,
|
||||
.rtc_peri_pd_en = (sleep_flags & RTC_SLEEP_PD_RTC_PERIPH) ? 1 : 0,
|
||||
.wifi_pd_en = (sleep_flags & RTC_SLEEP_PD_WIFI) ? 1 : 0,
|
||||
.bt_pd_en = (sleep_flags & RTC_SLEEP_PD_BT) ? 1 : 0,
|
||||
.modem_pd_en = (sleep_flags & RTC_SLEEP_PD_MODEM) ? 1 : 0,
|
||||
.cpu_pd_en = (sleep_flags & RTC_SLEEP_PD_CPU) ? 1 : 0,
|
||||
.int_8m_pd_en = (sleep_flags & RTC_SLEEP_PD_INT_8M) ? 1 : 0,
|
||||
.dig_peri_pd_en = (sleep_flags & RTC_SLEEP_PD_DIG_PERIPH) ? 1 : 0,
|
||||
@ -157,20 +156,14 @@ void rtc_sleep_init(rtc_sleep_config_t cfg)
|
||||
rtc_sleep_pu(pu_cfg);
|
||||
}
|
||||
|
||||
if (cfg.wifi_pd_en) {
|
||||
if (cfg.modem_pd_en) {
|
||||
REG_CLR_BIT(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_WIFI_FORCE_NOISO | RTC_CNTL_WIFI_FORCE_ISO);
|
||||
REG_CLR_BIT(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_FORCE_PU);
|
||||
SET_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_PD_EN);
|
||||
} else {
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_PD_EN);
|
||||
}
|
||||
if (cfg.bt_pd_en) {
|
||||
REG_CLR_BIT(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_BT_FORCE_NOISO | RTC_CNTL_BT_FORCE_ISO);
|
||||
REG_CLR_BIT(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_BT_FORCE_PU);
|
||||
SET_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_BT_PD_EN);
|
||||
} else {
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_BT_PD_EN);
|
||||
}
|
||||
|
||||
if (cfg.cpu_pd_en) {
|
||||
REG_CLR_BIT(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_CPU_TOP_FORCE_NOISO | RTC_CNTL_CPU_TOP_FORCE_ISO);
|
||||
REG_CLR_BIT(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_CPU_TOP_FORCE_PU);
|
||||
@ -178,6 +171,7 @@ void rtc_sleep_init(rtc_sleep_config_t cfg)
|
||||
} else {
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_CPU_TOP_PD_EN);
|
||||
}
|
||||
|
||||
if (cfg.dig_peri_pd_en) {
|
||||
REG_CLR_BIT(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_DG_PERI_FORCE_NOISO | RTC_CNTL_DG_PERI_FORCE_ISO);
|
||||
REG_CLR_BIT(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_DG_PERI_FORCE_PU);
|
||||
@ -185,6 +179,7 @@ void rtc_sleep_init(rtc_sleep_config_t cfg)
|
||||
} else {
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_DG_PERI_PD_EN);
|
||||
}
|
||||
|
||||
if (cfg.rtc_peri_pd_en) {
|
||||
REG_CLR_BIT(RTC_CNTL_PWC_REG, RTC_CNTL_FORCE_NOISO | RTC_CNTL_FORCE_ISO | RTC_CNTL_FORCE_PU);
|
||||
SET_PERI_REG_MASK(RTC_CNTL_PWC_REG, RTC_CNTL_PD_EN);
|
||||
|
@ -692,18 +692,22 @@ void IRAM_ATTR esp_deep_sleep_start(void)
|
||||
uint32_t force_pd_flags = RTC_SLEEP_PD_DIG | RTC_SLEEP_PD_VDDSDIO | RTC_SLEEP_PD_INT_8M | RTC_SLEEP_PD_XTAL;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* If all wireless modules share one power domain, we name this power domain "modem".
|
||||
* If wireless modules have their own power domain, we give these power domains separate
|
||||
* names.
|
||||
*/
|
||||
#if SOC_PM_SUPPORT_MODEM_PD
|
||||
force_pd_flags |= PMU_SLEEP_PD_MODEM;
|
||||
#else // !SOC_PM_SUPPORT_MODEM_PD
|
||||
force_pd_flags |= RTC_SLEEP_PD_MODEM;
|
||||
#endif
|
||||
|
||||
#if SOC_PM_SUPPORT_WIFI_PD
|
||||
force_pd_flags |= RTC_SLEEP_PD_WIFI;
|
||||
#endif
|
||||
|
||||
#if SOC_PM_SUPPORT_BT_PD
|
||||
force_pd_flags |= RTC_SLEEP_PD_BT;
|
||||
#endif
|
||||
#endif // !SOC_PM_SUPPORT_MODEM_PD
|
||||
|
||||
// Enter sleep
|
||||
esp_sleep_start(force_pd_flags | pd_flags, ESP_SLEEP_MODE_DEEP_SLEEP);
|
||||
@ -1621,7 +1625,7 @@ static uint32_t get_power_down_flags(void)
|
||||
|
||||
#if SOC_PM_SUPPORT_MODEM_PD
|
||||
if (s_config.domain[ESP_PD_DOMAIN_MODEM].pd_option != ESP_PD_OPTION_ON) {
|
||||
pd_flags |= PMU_SLEEP_PD_MODEM;
|
||||
pd_flags |= RTC_SLEEP_PD_MODEM;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -56,12 +56,14 @@ static const char* TAG = "phy_init";
|
||||
|
||||
static _lock_t s_phy_access_lock;
|
||||
|
||||
#if !CONFIG_IDF_TARGET_ESP32C2 && !CONFIG_IDF_TARGET_ESP32C6 // TODO - WIFI-4424
|
||||
#if SOC_PM_SUPPORT_MODEM_PD || SOC_PM_SUPPORT_WIFI_PD
|
||||
#if !SOC_PMU_SUPPORTED
|
||||
static DRAM_ATTR struct {
|
||||
int count; /* power on count of wifi and bt power domain */
|
||||
_lock_t lock;
|
||||
} s_wifi_bt_pd_controller = { .count = 0 };
|
||||
#endif
|
||||
#endif // !SOC_PMU_SUPPORTED
|
||||
#endif // SOC_PM_SUPPORT_MODEM_PD || SOC_PM_SUPPORT_WIFI_PD
|
||||
|
||||
/* Reference count of enabling PHY */
|
||||
static uint8_t s_phy_access_ref = 0;
|
||||
@ -308,30 +310,37 @@ void esp_phy_disable(void)
|
||||
|
||||
void IRAM_ATTR esp_wifi_bt_power_domain_on(void)
|
||||
{
|
||||
#if !CONFIG_IDF_TARGET_ESP32C2 && !CONFIG_IDF_TARGET_ESP32C6 // TODO - WIFI-4424
|
||||
#if SOC_PM_SUPPORT_MODEM_PD || SOC_PM_SUPPORT_WIFI_PD
|
||||
#if !SOC_PMU_SUPPORTED
|
||||
_lock_acquire(&s_wifi_bt_pd_controller.lock);
|
||||
if (s_wifi_bt_pd_controller.count++ == 0) {
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_FORCE_PD);
|
||||
|
||||
#if !CONFIG_IDF_TARGET_ESP32
|
||||
// modem reset when power on
|
||||
SET_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, MODEM_RESET_FIELD_WHEN_PU);
|
||||
CLEAR_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, MODEM_RESET_FIELD_WHEN_PU);
|
||||
#endif
|
||||
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_WIFI_FORCE_ISO);
|
||||
}
|
||||
_lock_release(&s_wifi_bt_pd_controller.lock);
|
||||
#endif
|
||||
#endif // !SOC_PMU_SUPPORTED
|
||||
#endif // SOC_PM_SUPPORT_MODEM_PD || SOC_PM_SUPPORT_WIFI_PD
|
||||
}
|
||||
|
||||
void esp_wifi_bt_power_domain_off(void)
|
||||
{
|
||||
#if !CONFIG_IDF_TARGET_ESP32C2 && !CONFIG_IDF_TARGET_ESP32C6 // TODO - WIFI-4424
|
||||
#if SOC_PM_SUPPORT_MODEM_PD || SOC_PM_SUPPORT_WIFI_PD
|
||||
#if !SOC_PMU_SUPPORTED
|
||||
_lock_acquire(&s_wifi_bt_pd_controller.lock);
|
||||
if (--s_wifi_bt_pd_controller.count == 0) {
|
||||
SET_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_WIFI_FORCE_ISO);
|
||||
SET_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_FORCE_PD);
|
||||
}
|
||||
_lock_release(&s_wifi_bt_pd_controller.lock);
|
||||
#endif
|
||||
#endif // !SOC_PMU_SUPPORTED
|
||||
#endif // SOC_PM_SUPPORT_MODEM_PD || SOC_PM_SUPPORT_WIFI_PD
|
||||
}
|
||||
|
||||
void esp_phy_modem_init(void)
|
||||
|
@ -759,6 +759,10 @@ config SOC_PM_SUPPORT_VDDSDIO_PD
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_PM_SUPPORT_MODEM_PD
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_CONFIGURABLE_VDDSDIO_SUPPORTED
|
||||
bool
|
||||
default y
|
||||
|
@ -493,7 +493,7 @@ typedef struct rtc_sleep_config_s {
|
||||
uint32_t rtc_fastmem_pd_en : 1; //!< power down RTC fast memory
|
||||
uint32_t rtc_slowmem_pd_en : 1; //!< power down RTC slow memory
|
||||
uint32_t rtc_peri_pd_en : 1; //!< power down RTC peripherals
|
||||
uint32_t wifi_pd_en : 1; //!< power down WiFi
|
||||
uint32_t modem_pd_en : 1; //!< power down Modem(wifi and btdm)
|
||||
uint32_t int_8m_pd_en : 1; //!< Power down Internal 8M oscillator
|
||||
uint32_t rom_mem_pd_en : 1; //!< power down main RAM and ROM
|
||||
uint32_t deep_slp : 1; //!< power down digital domain
|
||||
@ -516,8 +516,9 @@ typedef struct rtc_sleep_config_s {
|
||||
#define RTC_SLEEP_PD_RTC_FAST_MEM BIT(3) //!< Power down RTC FAST memory
|
||||
#define RTC_SLEEP_PD_RTC_MEM_FOLLOW_CPU BIT(4) //!< RTC FAST and SLOW memories are automatically powered up and down along with the CPU
|
||||
#define RTC_SLEEP_PD_VDDSDIO BIT(5) //!< Power down VDDSDIO regulator
|
||||
#define RTC_SLEEP_PD_XTAL BIT(6) //!< Power down main XTAL
|
||||
#define RTC_SLEEP_PD_INT_8M BIT(7) //!< Power down Internal 8M oscillator
|
||||
#define RTC_SLEEP_PD_MODEM BIT(6) //!< Power down Modem(wifi and btdm)
|
||||
#define RTC_SLEEP_PD_XTAL BIT(7) //!< Power down main XTAL
|
||||
#define RTC_SLEEP_PD_INT_8M BIT(8) //!< Power down Internal 8M oscillator
|
||||
|
||||
//These flags are not power domains, but will affect some sleep parameters
|
||||
#define RTC_SLEEP_DIG_USE_8M BIT(16)
|
||||
|
@ -376,6 +376,7 @@
|
||||
#define SOC_PM_SUPPORT_RTC_SLOW_MEM_PD (1)
|
||||
#define SOC_PM_SUPPORT_RC_FAST_PD (1)
|
||||
#define SOC_PM_SUPPORT_VDDSDIO_PD (1)
|
||||
#define SOC_PM_SUPPORT_MODEM_PD (1) /*!<Modem here includes wifi and btdm */
|
||||
|
||||
#define SOC_CONFIGURABLE_VDDSDIO_SUPPORTED (1)
|
||||
|
||||
|
@ -607,18 +607,6 @@ config SOC_PM_SUPPORT_BT_WAKEUP
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_PM_SUPPORT_CPU_PD
|
||||
bool
|
||||
default n
|
||||
|
||||
config SOC_PM_SUPPORT_WIFI_PD
|
||||
bool
|
||||
default n
|
||||
|
||||
config SOC_PM_SUPPORT_BT_PD
|
||||
bool
|
||||
default n
|
||||
|
||||
config SOC_PM_SUPPORT_RC_FAST_PD
|
||||
bool
|
||||
default y
|
||||
|
@ -287,9 +287,6 @@
|
||||
/*-------------------------- Power Management CAPS ----------------------------*/
|
||||
#define SOC_PM_SUPPORT_WIFI_WAKEUP (1)
|
||||
#define SOC_PM_SUPPORT_BT_WAKEUP (1)
|
||||
#define SOC_PM_SUPPORT_CPU_PD (0)
|
||||
#define SOC_PM_SUPPORT_WIFI_PD (0)
|
||||
#define SOC_PM_SUPPORT_BT_PD (0)
|
||||
#define SOC_PM_SUPPORT_RC_FAST_PD (1)
|
||||
#define SOC_PM_SUPPORT_VDDSDIO_PD (1)
|
||||
|
||||
|
@ -1011,10 +1011,6 @@ config SOC_PM_SUPPORT_CPU_PD
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_PM_SUPPORT_WIFI_PD
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_PM_SUPPORT_BT_PD
|
||||
bool
|
||||
default y
|
||||
|
@ -443,7 +443,6 @@
|
||||
#define SOC_PM_SUPPORT_WIFI_WAKEUP (1)
|
||||
#define SOC_PM_SUPPORT_BT_WAKEUP (1)
|
||||
#define SOC_PM_SUPPORT_CPU_PD (1)
|
||||
#define SOC_PM_SUPPORT_WIFI_PD (1)
|
||||
#define SOC_PM_SUPPORT_BT_PD (1)
|
||||
#define SOC_PM_SUPPORT_RC_FAST_PD (1)
|
||||
#define SOC_PM_SUPPORT_VDDSDIO_PD (1)
|
||||
|
@ -971,6 +971,10 @@ config SOC_PM_SUPPORT_WIFI_WAKEUP
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_PM_SUPPORT_TOUCH_SENSOR_WAKEUP
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_PM_SUPPORT_WIFI_PD
|
||||
bool
|
||||
default y
|
||||
@ -979,10 +983,6 @@ config SOC_PM_SUPPORT_RTC_PERIPH_PD
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_PM_SUPPORT_TOUCH_SENSOR_WAKEUP
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_PM_SUPPORT_RTC_FAST_MEM_PD
|
||||
bool
|
||||
default y
|
||||
|
@ -418,11 +418,11 @@
|
||||
#define SOC_PM_SUPPORT_EXT0_WAKEUP (1)
|
||||
#define SOC_PM_SUPPORT_EXT1_WAKEUP (1)
|
||||
#define SOC_PM_SUPPORT_EXT_WAKEUP (1) /*!<Compatible to the old version of IDF */
|
||||
|
||||
#define SOC_PM_SUPPORT_WIFI_WAKEUP (1)
|
||||
#define SOC_PM_SUPPORT_TOUCH_SENSOR_WAKEUP (1) /*!<Supports waking up from touch pad trigger */
|
||||
|
||||
#define SOC_PM_SUPPORT_WIFI_PD (1)
|
||||
#define SOC_PM_SUPPORT_RTC_PERIPH_PD (1)
|
||||
#define SOC_PM_SUPPORT_TOUCH_SENSOR_WAKEUP (1) /*!<Supports waking up from touch pad trigger */
|
||||
#define SOC_PM_SUPPORT_RTC_FAST_MEM_PD (1)
|
||||
#define SOC_PM_SUPPORT_RTC_SLOW_MEM_PD (1)
|
||||
#define SOC_PM_SUPPORT_RC_FAST_PD (1)
|
||||
|
@ -1035,6 +1035,10 @@ config SOC_PM_SUPPORT_MAC_BB_PD
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_PM_SUPPORT_MODEM_PD
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_CONFIGURABLE_VDDSDIO_SUPPORTED
|
||||
bool
|
||||
default y
|
||||
|
@ -590,8 +590,7 @@ typedef struct {
|
||||
uint32_t rtc_fastmem_pd_en : 1; //!< power down RTC fast memory
|
||||
uint32_t rtc_slowmem_pd_en : 1; //!< power down RTC slow memory
|
||||
uint32_t rtc_peri_pd_en : 1; //!< power down RTC peripherals
|
||||
uint32_t wifi_pd_en : 1; //!< power down WiFi
|
||||
uint32_t bt_pd_en : 1; //!< power down BT
|
||||
uint32_t modem_pd_en : 1; //!< power down Modem(wifi and ble)
|
||||
uint32_t cpu_pd_en : 1; //!< power down CPU, but not restart when lightsleep.
|
||||
uint32_t int_8m_pd_en : 1; //!< Power down Internal 8M oscillator
|
||||
uint32_t dig_peri_pd_en : 1; //!< power down digital peripherals
|
||||
@ -618,8 +617,7 @@ typedef struct {
|
||||
#define RTC_SLEEP_PD_RTC_FAST_MEM BIT(3) //!< Power down RTC FAST memory
|
||||
#define RTC_SLEEP_PD_RTC_MEM_FOLLOW_CPU BIT(4) //!< RTC FAST and SLOW memories are automatically powered up and down along with the CPU
|
||||
#define RTC_SLEEP_PD_VDDSDIO BIT(5) //!< Power down VDDSDIO regulator
|
||||
#define RTC_SLEEP_PD_WIFI BIT(6) //!< Power down WIFI
|
||||
#define RTC_SLEEP_PD_BT BIT(7) //!< Power down BT
|
||||
#define RTC_SLEEP_PD_MODEM BIT(6) //!< Power down Modem(wifi and ble)
|
||||
#define RTC_SLEEP_PD_CPU BIT(8) //!< Power down CPU when in lightsleep, but not restart
|
||||
#define RTC_SLEEP_PD_DIG_PERIPH BIT(9) //!< Power down DIG peripherals
|
||||
#define RTC_SLEEP_PD_INT_8M BIT(10) //!< Power down Internal 8M oscillator
|
||||
|
@ -1796,12 +1796,6 @@ ork.*/
|
||||
#define RTC_CNTL_DG_PERI_PD_EN_M (BIT(28))
|
||||
#define RTC_CNTL_DG_PERI_PD_EN_V 0x1
|
||||
#define RTC_CNTL_DG_PERI_PD_EN_S 28
|
||||
/* RTC_CNTL_BT_PD_EN : R/W ;bitpos:[27] ;default: 0 ; */
|
||||
/*description: enable power down internal SRAM 2 in sleep.*/
|
||||
#define RTC_CNTL_BT_PD_EN (BIT(27))
|
||||
#define RTC_CNTL_BT_PD_EN_M (BIT(27))
|
||||
#define RTC_CNTL_BT_PD_EN_V 0x1
|
||||
#define RTC_CNTL_BT_PD_EN_S 27
|
||||
/* RTC_CNTL_CPU_TOP_FORCE_PU : R/W ;bitpos:[22] ;default: 1'd1 ; */
|
||||
/*description: digital dcdc force power up.*/
|
||||
#define RTC_CNTL_CPU_TOP_FORCE_PU (BIT(22))
|
||||
|
@ -408,7 +408,6 @@
|
||||
#define SOC_PM_SUPPORT_EXT0_WAKEUP (1)
|
||||
#define SOC_PM_SUPPORT_EXT1_WAKEUP (1)
|
||||
#define SOC_PM_SUPPORT_EXT_WAKEUP (1) /*!<Compatible to the old version of IDF */
|
||||
|
||||
#define SOC_PM_SUPPORT_WIFI_WAKEUP (1)
|
||||
#define SOC_PM_SUPPORT_BT_WAKEUP (1)
|
||||
#define SOC_PM_SUPPORT_TOUCH_SENSOR_WAKEUP (1) /*!<Supports waking up from touch pad trigger */
|
||||
@ -419,6 +418,7 @@
|
||||
#define SOC_PM_SUPPORT_RC_FAST_PD (1)
|
||||
#define SOC_PM_SUPPORT_VDDSDIO_PD (1)
|
||||
#define SOC_PM_SUPPORT_MAC_BB_PD (1)
|
||||
#define SOC_PM_SUPPORT_MODEM_PD (1) /*!<Modem here includes wifi and ble */
|
||||
|
||||
#define SOC_CONFIGURABLE_VDDSDIO_SUPPORTED (1)
|
||||
#define SOC_PM_SUPPORT_DEEPSLEEP_CHECK_STUB_ONLY (1) /*!<Supports CRC only the stub code in RTC memory */
|
||||
|
Loading…
x
Reference in New Issue
Block a user