esp32c6: add esp_pm support

This commit is contained in:
wuzhenghui
2022-07-13 14:39:51 +08:00
committed by Song Ruo Jing
parent 62f9ddcb82
commit a7b549acca
4 changed files with 52 additions and 1 deletions

View File

@@ -56,6 +56,9 @@
#elif CONFIG_IDF_TARGET_ESP32C2
#include "esp32c2/pm.h"
#include "driver/gpio.h"
#elif CONFIG_IDF_TARGET_ESP32C6
#include "esp32c6/pm.h"
#include "driver/gpio.h"
#endif
#define MHZ (1000000)
@@ -85,13 +88,15 @@
#define REF_CLK_DIV_MIN 2
#elif CONFIG_IDF_TARGET_ESP32S3
/* Minimal divider at which REF_CLK_FREQ can be obtained */
#define REF_CLK_DIV_MIN 2
#define REF_CLK_DIV_MIN 2 // TODO: IDF-5660
#elif CONFIG_IDF_TARGET_ESP32C3
#define REF_CLK_DIV_MIN 2
#elif CONFIG_IDF_TARGET_ESP32H2
#define REF_CLK_DIV_MIN 2
#elif CONFIG_IDF_TARGET_ESP32C2
#define REF_CLK_DIV_MIN 2
#elif CONFIG_IDF_TARGET_ESP32C6
#define REF_CLK_DIV_MIN 2
#endif
#ifdef CONFIG_PM_PROFILING
@@ -228,6 +233,8 @@ esp_err_t esp_pm_configure(const void* vconfig)
const esp_pm_config_esp32h2_t* config = (const esp_pm_config_esp32h2_t*) vconfig;
#elif CONFIG_IDF_TARGET_ESP32C2
const esp_pm_config_esp32c2_t* config = (const esp_pm_config_esp32c2_t*) vconfig;
#elif CONFIG_IDF_TARGET_ESP32C6
const esp_pm_config_esp32c6_t* config = (const esp_pm_config_esp32c6_t*) vconfig;
#endif
#ifndef CONFIG_FREERTOS_USE_TICKLESS_IDLE
@@ -338,6 +345,8 @@ esp_err_t esp_pm_get_configuration(void* vconfig)
esp_pm_config_esp32h2_t* config = (esp_pm_config_esp32h2_t*) vconfig;
#elif CONFIG_IDF_TARGET_ESP32C2
esp_pm_config_esp32c2_t* config = (esp_pm_config_esp32c2_t*) vconfig;
#elif CONFIG_IDF_TARGET_ESP32C6
esp_pm_config_esp32c6_t* config = (esp_pm_config_esp32c6_t*) vconfig;
#endif
portENTER_CRITICAL(&s_switch_lock);
@@ -782,6 +791,8 @@ void esp_pm_impl_init(void)
esp_pm_config_esp32h2_t cfg = {
#elif CONFIG_IDF_TARGET_ESP32C2
esp_pm_config_esp32c2_t cfg = {
#elif CONFIG_IDF_TARGET_ESP32C6
esp_pm_config_esp32c6_t cfg = {
#endif
.max_freq_mhz = CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ,
.min_freq_mhz = xtal_freq_mhz,