From f1ee8aa14f185f23285a29dc2ae1485a58420823 Mon Sep 17 00:00:00 2001 From: ninh Date: Wed, 21 Apr 2021 15:17:16 +0800 Subject: [PATCH] esp_wifi: fix nolightsleep after wifi init --- components/esp_hw_support/include/esp_sleep.h | 6 ++++++ components/esp_hw_support/sleep_modes.c | 9 +++++++++ components/esp_wifi/lib | 2 +- components/esp_wifi/src/wifi_init.c | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/components/esp_hw_support/include/esp_sleep.h b/components/esp_hw_support/include/esp_sleep.h index 1d81f716a8..000d020aeb 100644 --- a/components/esp_hw_support/include/esp_sleep.h +++ b/components/esp_hw_support/include/esp_sleep.h @@ -303,6 +303,12 @@ esp_err_t esp_sleep_enable_uart_wakeup(int uart_num); */ esp_err_t esp_sleep_enable_wifi_wakeup(void); +/** + * @brief Disable wakeup by WiFi MAC + * @return + * - ESP_OK on success + */ +esp_err_t esp_sleep_disable_wifi_wakeup(void); /** * @brief Get the bit mask of GPIOs which caused wakeup (ext1) diff --git a/components/esp_hw_support/sleep_modes.c b/components/esp_hw_support/sleep_modes.c index 64a8c49d15..64f750b551 100644 --- a/components/esp_hw_support/sleep_modes.c +++ b/components/esp_hw_support/sleep_modes.c @@ -1176,6 +1176,15 @@ esp_err_t esp_sleep_enable_wifi_wakeup(void) #endif } +esp_err_t esp_sleep_disable_wifi_wakeup(void) +{ +#if SOC_PM_SUPPORT_WIFI_WAKEUP + s_config.wakeup_triggers &= (~RTC_WIFI_TRIG_EN); + return ESP_OK; +#else + return ESP_ERR_NOT_SUPPORTED; +#endif +} esp_sleep_wakeup_cause_t esp_sleep_get_wakeup_cause(void) { diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index a5ce0c65ed..e4415c1336 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit a5ce0c65ede0c36332b9cddb98693f436ee0345d +Subproject commit e4415c13367c1dcff2d8e3d7e34052391c71eeff diff --git a/components/esp_wifi/src/wifi_init.c b/components/esp_wifi/src/wifi_init.c index f63527d79b..7fa30b9a83 100644 --- a/components/esp_wifi/src/wifi_init.c +++ b/components/esp_wifi/src/wifi_init.c @@ -150,6 +150,7 @@ esp_err_t esp_wifi_deinit(void) #if SOC_WIFI_HW_TSF esp_pm_unregister_skip_light_sleep_callback(esp_wifi_internal_is_tsf_active); esp_pm_unregister_inform_out_light_sleep_overhead_callback(esp_wifi_internal_update_light_sleep_wake_ahead_time); + esp_sleep_disable_wifi_wakeup(); #endif #if CONFIG_ESP_WIFI_SLP_IRAM_OPT esp_pm_unregister_light_sleep_default_params_config_callback();