Merge branch 'fix/fix_tsens_power_after_modem_wakeup_v5.3' into 'release/v5.3'

fix(esp_hw_support): fix tsensor power enable failed after modem state wakeup (v5.3)

See merge request espressif/esp-idf!36227
This commit is contained in:
Jiang Jiang Jian
2025-01-17 12:02:59 +08:00
4 changed files with 34 additions and 9 deletions

View File

@ -115,8 +115,8 @@ const pmu_hp_system_power_param_t * pmu_hp_system_power_param_default(pmu_hp_mod
} }
#define PMU_HP_MODEM_CLOCK_CONFIG_DEFAULT() { \ #define PMU_HP_MODEM_CLOCK_CONFIG_DEFAULT() { \
.icg_func = 0, \ .icg_func = BIT(PMU_ICG_FUNC_ENA_SARADC), \
.icg_apb = 0, \ .icg_apb = BIT(PMU_ICG_APB_ENA_SARADC), \
.icg_modem = { \ .icg_modem = { \
.code = PMU_HP_ICG_MODEM_CODE_MODEM \ .code = PMU_HP_ICG_MODEM_CODE_MODEM \
}, \ }, \

View File

@ -1,10 +1,11 @@
/* /*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#pragma once #pragma once
#include "sdkconfig.h"
#include "esp_phy_init.h" #include "esp_phy_init.h"
#ifdef __cplusplus #ifdef __cplusplus
@ -218,6 +219,16 @@ void phy_ant_clr_update_flag(void);
void phy_ant_update(void); void phy_ant_update(void);
#if CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP
/**
* @brief On sleep->modem->active wakeup process, since RF has been turned on by hardware in
* modem state, `sleep_modem_wifi_do_phy_retention` and `phy_wakeup_init` will be skipped
* in `esp_phy_enable`, but there are still some configurations that need to be restored
* by software, which are packed in this function.
*/
void phy_wakeup_from_modem_state_extra_init(void);
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -1,11 +1,12 @@
/* /*
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include "sdkconfig.h"
#include "esp_timer.h" #include "esp_timer.h"
#include "esp_log.h" #include "esp_log.h"
#include "esp_private/esp_gpio_reserve.h" #include "esp_private/esp_gpio_reserve.h"
@ -17,6 +18,10 @@
#include "esp_phy.h" #include "esp_phy.h"
#include "esp_attr.h" #include "esp_attr.h"
#if CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP
#include "hal/temperature_sensor_ll.h"
#endif
static const char* TAG = "phy_comm"; static const char* TAG = "phy_comm";
static volatile uint16_t s_phy_modem_flag = 0; static volatile uint16_t s_phy_modem_flag = 0;
@ -294,3 +299,10 @@ esp_err_t esp_phy_get_ant(esp_phy_ant_config_t *config)
memcpy(config, &s_phy_ant_config, sizeof(esp_phy_ant_config_t)); memcpy(config, &s_phy_ant_config, sizeof(esp_phy_ant_config_t));
return ESP_OK; return ESP_OK;
} }
#if CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP
void phy_wakeup_from_modem_state_extra_init(void)
{
temperature_sensor_ll_enable(true);
}
#endif

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -315,6 +315,8 @@ void esp_phy_enable(esp_phy_modem_t modem)
} else { } else {
phy_wakeup_init(); phy_wakeup_init();
} }
} else {
phy_wakeup_from_modem_state_extra_init();
} }
#else #else
phy_wakeup_init(); phy_wakeup_init();
@ -338,10 +340,10 @@ void esp_phy_enable(esp_phy_modem_t modem)
phy_track_pll_init(); phy_track_pll_init();
#endif #endif
if (phy_ant_need_update()) { if (phy_ant_need_update()) {
phy_ant_update(); phy_ant_update();
phy_ant_clr_update_flag(); phy_ant_clr_update_flag();
} }
} }
phy_set_modem_flag(modem); phy_set_modem_flag(modem);