Skip to content

Commit

Permalink
Merge branch 'bugfix/fix_deepsleep_saradc_leakage_by_sar_v4.4' into '…
Browse files Browse the repository at this point in the history
…release/v4.4'

bugfix: fix adc current leakage by sar_adc on v4.4

See merge request espressif/esp-idf!24349
  • Loading branch information
jack0c committed Jun 28, 2023
2 parents a7c4610 + 9600767 commit 4daeccc
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions components/esp_hw_support/sleep_modes.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,19 +339,31 @@ static void IRAM_ATTR resume_uarts(uint32_t uarts_resume_bmap)
*/
inline static void IRAM_ATTR misc_modules_sleep_prepare(bool deep_sleep)
{
if (deep_sleep) {
extern bool esp_phy_is_initialized(void);
if (esp_phy_is_initialized()){
extern void phy_close_rf(void);
phy_close_rf();
#if !CONFIG_IDF_TARGET_ESP32
extern void phy_xpd_tsens(void);
phy_xpd_tsens();
#endif
}
} else {
#if CONFIG_MAC_BB_PD
mac_bb_power_down_cb_execute();
mac_bb_power_down_cb_execute();
#endif
#if CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL
gpio_sleep_mode_config_apply();
gpio_sleep_mode_config_apply();
#endif
#if SOC_PM_SUPPORT_CPU_PD || SOC_PM_SUPPORT_TAGMEM_PD
sleep_enable_memory_retention();
sleep_enable_memory_retention();
#endif
#if REGI2C_ANA_CALI_PD_WORKAROUND
regi2c_analog_cali_reg_read();
regi2c_analog_cali_reg_read();
#endif
if (!(deep_sleep && s_adc_tsen_enabled)){
}
if (!(deep_sleep && s_adc_tsen_enabled)) {
sar_periph_ctrl_power_disable();
}
}
Expand Down Expand Up @@ -443,19 +455,7 @@ static uint32_t IRAM_ATTR esp_sleep_start(uint32_t pd_flags)
}
#endif

if (deep_sleep) {
extern bool esp_phy_is_initialized(void);
if (esp_phy_is_initialized()){
extern void phy_close_rf(void);
phy_close_rf();
#if !CONFIG_IDF_TARGET_ESP32
extern void phy_xpd_tsens(void);
phy_xpd_tsens();
#endif
}
} else {
misc_modules_sleep_prepare(deep_sleep);
}
misc_modules_sleep_prepare(deep_sleep);

#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
if (deep_sleep) {
Expand Down

0 comments on commit 4daeccc

Please sign in to comment.