From 4fb37541a06fffef9e2d5580fa6e5db996d18e0d Mon Sep 17 00:00:00 2001 From: zwx Date: Mon, 9 Mar 2026 14:31:27 +0800 Subject: [PATCH] fix(esp_phy): check hw freq hop done before disabling common clock --- components/esp_phy/include/esp_private/phy.h | 7 +++++++ components/esp_phy/lib | 2 +- components/esp_phy/src/phy_common.c | 6 ++++++ components/esp_phy/src/phy_init.c | 1 + components/esp_phy/src/phy_init_esp32hxx.c | 1 + 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/components/esp_phy/include/esp_private/phy.h b/components/esp_phy/include/esp_private/phy.h index 2dd75b3de8d..c5f93b7a12d 100644 --- a/components/esp_phy/include/esp_private/phy.h +++ b/components/esp_phy/include/esp_private/phy.h @@ -240,6 +240,13 @@ void phy_wakeup_from_modem_state_extra_init(void); void esp_phy_modem_rf_flag_update(void); #endif + +/** + * @brief Wait for frequency hardware hop to complete + * + */ +void phy_wait_freq_hw_hop_done(void); + #ifdef __cplusplus } #endif diff --git a/components/esp_phy/lib b/components/esp_phy/lib index ac744ff2c5c..59c1234e929 160000 --- a/components/esp_phy/lib +++ b/components/esp_phy/lib @@ -1 +1 @@ -Subproject commit ac744ff2c5c39c63f8cdd503d4074905647fdbb6 +Subproject commit 59c1234e929212aec0fdda75769b759951235536 diff --git a/components/esp_phy/src/phy_common.c b/components/esp_phy/src/phy_common.c index 012fb02634d..c1ffd0cab97 100644 --- a/components/esp_phy/src/phy_common.c +++ b/components/esp_phy/src/phy_common.c @@ -323,3 +323,9 @@ void phy_wakeup_from_modem_state_extra_init(void) temperature_sensor_ll_enable(true); } #endif + +__attribute__((weak)) void phy_wait_freq_hw_hop_done(void) +{ + ESP_LOGD(TAG, "phy_wait_freq_hw_hop_done is not implemented"); + return; +} diff --git a/components/esp_phy/src/phy_init.c b/components/esp_phy/src/phy_init.c index 3aa8a9bf1fa..b737a1e25bf 100644 --- a/components/esp_phy/src/phy_init.c +++ b/components/esp_phy/src/phy_init.c @@ -420,6 +420,7 @@ void esp_phy_disable(esp_phy_modem_t modem) // Update WiFi MAC time before disable WiFi/BT common peripheral clock phy_update_wifi_mac_time(true, esp_timer_get_time()); #endif + phy_wait_freq_hw_hop_done(); // Disable WiFi/BT common peripheral clock. Do not disable clock for hardware RNG esp_phy_common_clock_disable(); } diff --git a/components/esp_phy/src/phy_init_esp32hxx.c b/components/esp_phy/src/phy_init_esp32hxx.c index 12243c1c340..5781ceac871 100644 --- a/components/esp_phy/src/phy_init_esp32hxx.c +++ b/components/esp_phy/src/phy_init_esp32hxx.c @@ -153,6 +153,7 @@ void esp_phy_disable(esp_phy_modem_t modem) #endif phy_close_rf(); phy_xpd_tsens(); + phy_wait_freq_hw_hop_done(); #if SOC_MODEM_CLOCK_IS_INDEPENDENT modem_clock_module_disable(PERIPH_PHY_MODULE); #endif