feat(openthread): use apb_freq_max mode for esp_openthread_sleep pm lock

This commit is contained in:
Tan Yan Quan
2025-06-11 16:00:14 +08:00
parent 943f32bd5a
commit 8c1458345e
2 changed files with 6 additions and 3 deletions

View File

@ -19,10 +19,12 @@ esp_err_t esp_openthread_sleep_init(void)
{
esp_err_t err = ESP_OK;
err = esp_pm_lock_create(ESP_PM_CPU_FREQ_MAX, 0, "ieee802154", &s_pm_lock);
// Here we use APB_MAX because modem requires MODEM_REQUIRED_MIN_APB_CLK_FREQ.
// No need for CPU_MAX to reduce current consumption during Rx window.
err = esp_pm_lock_create(ESP_PM_APB_FREQ_MAX, 0, "ot_sleep", &s_pm_lock);
if (err == ESP_OK) {
esp_pm_lock_acquire(s_pm_lock);
ESP_LOGI(TAG, "Enable ieee802154 light sleep, the wake up source is ESP timer");
ESP_LOGI(TAG, "Enable OpenThread light sleep, the wake up source is ESP timer");
} else {
if (s_pm_lock != NULL) {
esp_pm_lock_delete(s_pm_lock);

View File

@ -25,6 +25,7 @@
#include "esp_openthread_netif_glue.h"
#include "esp_ot_sleepy_device_config.h"
#include "esp_vfs_eventfd.h"
#include "esp_private/esp_clk.h"
#include "driver/uart.h"
#include "nvs_flash.h"
#include "openthread/logging.h"
@ -192,7 +193,7 @@ static esp_err_t ot_power_save_init(void)
esp_pm_config_t pm_config = {
.max_freq_mhz = cur_cpu_freq_mhz,
.min_freq_mhz = cur_cpu_freq_mhz,
.min_freq_mhz = esp_clk_xtal_freq() / MHZ,
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
.light_sleep_enable = true
#endif