Skip to content

Commit

Permalink
Merge branch 'bugfix/wifi_bcn_timeout_m_f_probe_req_l0_v5.1' into 're…
Browse files Browse the repository at this point in the history
…lease/v5.1'

backport v5.1: fix bcn_timeout and disconnect with error code 201, m f probe req l=0 issue

See merge request espressif/esp-idf!24781
  • Loading branch information
jack0c committed Jul 14, 2023
2 parents 320f8eb + 958ae62 commit 7148d82
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
7 changes: 7 additions & 0 deletions components/esp_hw_support/include/esp_private/sleep_modem.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ void sleep_modem_wifi_do_phy_retention(bool restore);
*/
bool sleep_modem_wifi_modem_state_enabled(void);

/**
* @brief Get WiFi modem link done state
*
* @return true or false for WiFi modem link can be used to enable RF by REGDMA or can not be used
*/
bool sleep_modem_wifi_modem_link_done(void);

#endif /* SOC_PM_SUPPORT_PMU_MODEM_STATE */

/**
Expand Down
18 changes: 12 additions & 6 deletions components/esp_hw_support/sleep_modem.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,18 +256,21 @@ static __attribute__((unused)) void sleep_modem_wifi_modem_state_deinit(void)
void IRAM_ATTR sleep_modem_wifi_do_phy_retention(bool restore)
{
if (restore) {
if (s_sleep_modem.wifi.modem_state_phy_done == 1) {
pau_regdma_trigger_modem_link_restore();
}
pau_regdma_trigger_modem_link_restore();
} else {
pau_regdma_trigger_modem_link_backup();
s_sleep_modem.wifi.modem_state_phy_done = 1;
}
}

bool sleep_modem_wifi_modem_state_enabled(void)
inline __attribute__((always_inline)) bool sleep_modem_wifi_modem_state_enabled(void)
{
return (s_sleep_modem.wifi.phy_link != NULL);
}

inline __attribute__((always_inline)) bool sleep_modem_wifi_modem_link_done(void)
{
return (s_sleep_modem.wifi.phy_link != NULL) ? true : false;
return (s_sleep_modem.wifi.modem_state_phy_done == 1);
}

#endif /* SOC_PM_SUPPORT_PMU_MODEM_STATE */
Expand Down Expand Up @@ -303,7 +306,10 @@ static __attribute__((unused)) bool IRAM_ATTR sleep_modem_wifi_modem_state_skip_
{
bool skip = false;
#if SOC_PM_SUPPORT_PMU_MODEM_STATE
skip = (s_sleep_modem.wifi.phy_link != NULL) && (s_sleep_modem.wifi.modem_state_phy_done == 0);
/* To block the system from entering sleep before modem link done. In light
* sleep mode, the system may switch to modem state, which will cause
* hardware to fail to enable RF */
skip = sleep_modem_wifi_modem_state_enabled() && !sleep_modem_wifi_modem_link_done();
#endif
return skip;
}
Expand Down
2 changes: 1 addition & 1 deletion components/esp_phy/src/phy_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ void esp_phy_enable(void)
#if SOC_PM_SUPPORT_PMU_MODEM_STATE && CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP
extern bool pm_mac_modem_rf_already_enabled(void);
if (!pm_mac_modem_rf_already_enabled()) {
if (sleep_modem_wifi_modem_state_enabled()) {
if (sleep_modem_wifi_modem_state_enabled() && sleep_modem_wifi_modem_link_done()) {
sleep_modem_wifi_do_phy_retention(true);
} else {
phy_wakeup_init();
Expand Down

0 comments on commit 7148d82

Please sign in to comment.