feat(esp_hw_support): support esp32h21 retention link software trigger

This commit is contained in:
wuzhenghui 2025-02-19 10:10:57 +08:00
parent 727d0a687f
commit 93cdad7a3b
No known key found for this signature in database
GPG Key ID: 3EFEDECDEBA39BB9
9 changed files with 124 additions and 17 deletions

View File

@ -28,12 +28,6 @@ if(NOT non_os_build)
"periph_ctrl.c"
"revision.c"
"rtc_module.c"
"sleep_modem.c"
"sleep_modes.c"
"sleep_console.c"
"sleep_usb.c"
"sleep_gpio.c"
"sleep_event.c"
"regi2c_ctrl.c"
"esp_gpio_reserve.c"
"sar_periph_ctrl_common.c"
@ -49,14 +43,23 @@ if(NOT non_os_build)
if(CONFIG_SOC_ADC_SUPPORTED)
list(APPEND srcs "adc_share_hw_ctrl.c")
endif()
if(CONFIG_SOC_ISP_SHARE_CSI_BRG)
list(APPEND srcs "mipi_csi_share_hw_ctrl.c")
endif()
if(CONFIG_SOC_PAU_SUPPORTED)
list(APPEND srcs "sleep_retention.c"
"sleep_system_peripheral.c"
)
list(APPEND srcs "sleep_retention.c")
endif()
if(CONFIG_SOC_LIGHT_SLEEP_SUPPORTED)
list(APPEND srcs "sleep_modem.c"
"sleep_modes.c"
"sleep_console.c"
"sleep_usb.c"
"sleep_gpio.c"
"sleep_event.c"
)
if(CONFIG_SOC_PAU_SUPPORTED)
list(APPEND srcs "sleep_system_peripheral.c")
endif()
endif()
# [refactor-todo]

View File

@ -1,6 +1,6 @@
idf_build_get_property(non_os_build NON_OS_BUILD)
if(non_os_build)
if(non_os_build OR NOT CONFIG_SOC_LIGHT_SLEEP_SUPPORTED)
return()
endif()

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -514,7 +514,9 @@ static void sleep_retention_entries_destroy(sleep_retention_module_t module)
}
if (created_modules == 0) {
sleep_retention_entries_check_and_distroy_final_default();
#if SOC_LIGHT_SLEEP_SUPPORTED
pmu_sleep_disable_regdma_backup();
#endif
memset((void *)s_retention.lists, 0, sizeof(s_retention.lists));
s_retention.highpri = (uint8_t)-1;
}
@ -641,8 +643,12 @@ esp_err_t sleep_retention_entries_create(const sleep_retention_entries_config_t
if (err) goto error;
err = sleep_retention_entries_create_wrapper(retent, num, priority, module);
if (err) goto error;
#if SOC_LIGHT_SLEEP_SUPPORTED
pmu_sleep_enable_regdma_backup();
#endif
#if SOC_LIGHT_SLEEP_SUPPORTED && SOC_DEEP_SLEEP_SUPPORTED
ESP_ERROR_CHECK(esp_deep_sleep_register_hook(&pmu_sleep_disable_regdma_backup));
#endif
error:
return err;

View File

@ -44,8 +44,8 @@ components/esp_hw_support/test_apps/rtc_power_modes:
components/esp_hw_support/test_apps/sleep_retention:
enable:
- if: SOC_PAU_SUPPORTED == 1 and CONFIG_NAME != "xip_psram"
- if: SOC_PAU_SUPPORTED == 1 and (SOC_SPIRAM_XIP_SUPPORTED == 1 and CONFIG_NAME == "xip_psram")
- if: SOC_PAU_SUPPORTED == 1 and SOC_LIGHT_SLEEP_SUPPORTED == 1 and CONFIG_NAME != "xip_psram"
- if: SOC_PAU_SUPPORTED == 1 and SOC_LIGHT_SLEEP_SUPPORTED == 1 and (SOC_SPIRAM_XIP_SUPPORTED == 1 and CONFIG_NAME == "xip_psram")
components/esp_hw_support/test_apps/vad_wakeup:
disable:

View File

@ -165,7 +165,7 @@ if(CONFIG_SOC_SDIO_SLAVE_SUPPORTED)
list(APPEND srcs "${target_folder}/sdio_slave_periph.c")
endif()
if(CONFIG_SOC_PAU_SUPPORTED)
if(CONFIG_SOC_PAU_SUPPORTED AND CONFIG_SOC_LIGHT_SLEEP_SUPPORTED)
list(APPEND srcs "${target_folder}/system_retention_periph.c")
endif()

View File

@ -43,6 +43,10 @@ config SOC_SPI_FLASH_SUPPORTED
bool
default y
config SOC_PAU_SUPPORTED
bool
default y
config SOC_XTAL_SUPPORT_32M
bool
default y
@ -671,6 +675,10 @@ config SOC_PM_PAU_LINK_NUM
int
default 5
config SOC_PM_RETENTION_MODULE_NUM
int
default 32
config SOC_PM_PAU_REGDMA_LINK_CONFIGURABLE
bool
default y

View File

@ -0,0 +1,89 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stdint.h>
#include "soc_caps.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum periph_retention_module {
SLEEP_RETENTION_MODULE_MIN = 0,
SLEEP_RETENTION_MODULE_NULL = SLEEP_RETENTION_MODULE_MIN, /* This module is for all peripherals that can't survive from PD_TOP to call init only. Shouldn't have any dependency. */
/* clock module, which includes system and modem */
SLEEP_RETENTION_MODULE_CLOCK_SYSTEM = 1,
SLEEP_RETENTION_MODULE_CLOCK_MODEM = 2,
/* digital peripheral module, which includes Interrupt Matrix, HP_SYSTEM,
* TEE, APM, UART, IOMUX, SPIMEM, SysTimer, etc.. */
SLEEP_RETENTION_MODULE_SYS_PERIPH = 3,
/* Timer Group by target*/
SLEEP_RETENTION_MODULE_TG0_WDT = 4,
SLEEP_RETENTION_MODULE_TG1_WDT = 5,
SLEEP_RETENTION_MODULE_TG0_TIMER0 = 6,
SLEEP_RETENTION_MODULE_TG1_TIMER0 = 7,
/* GDMA by channel */
SLEEP_RETENTION_MODULE_GDMA_CH0 = 8,
SLEEP_RETENTION_MODULE_GDMA_CH1 = 9,
SLEEP_RETENTION_MODULE_GDMA_CH2 = 10,
/* MISC Peripherals */
SLEEP_RETENTION_MODULE_ADC = 11,
SLEEP_RETENTION_MODULE_I2C0 = 12,
SLEEP_RETENTION_MODULE_I2C1 = 13,
SLEEP_RETENTION_MODULE_RMT0 = 14,
SLEEP_RETENTION_MODULE_UART0 = 15,
SLEEP_RETENTION_MODULE_UART1 = 16,
SLEEP_RETENTION_MODULE_I2S0 = 17,
SLEEP_RETENTION_MODULE_ETM0 = 18,
SLEEP_RETENTION_MODULE_TEMP_SENSOR = 19,
SLEEP_RETENTION_MODULE_TWAI0 = 20,
SLEEP_RETENTION_MODULE_PARLIO0 = 21,
SLEEP_RETENTION_MODULE_GPSPI2 = 22,
SLEEP_RETENTION_MODULE_LEDC = 23,
SLEEP_RETENTION_MODULE_PCNT0 = 24,
SLEEP_RETENTION_MODULE_MCPWM0 = 25,
/* Modem module, which includes BLE and 802.15.4 */
SLEEP_RETENTION_MODULE_BLE_MAC = 28,
SLEEP_RETENTION_MODULE_BT_BB = 29,
SLEEP_RETENTION_MODULE_802154_MAC = 30,
SLEEP_RETENTION_MODULE_MAX = SOC_PM_RETENTION_MODULE_NUM - 1
} periph_retention_module_t;
#define is_top_domain_module(m) \
( ((m) == SLEEP_RETENTION_MODULE_NULL) ? true \
: ((m) == SLEEP_RETENTION_MODULE_CLOCK_SYSTEM) ? true \
: ((m) == SLEEP_RETENTION_MODULE_SYS_PERIPH) ? true \
: ((m) == SLEEP_RETENTION_MODULE_TG0_WDT) ? true \
: ((m) == SLEEP_RETENTION_MODULE_TG1_WDT) ? true \
: ((m) == SLEEP_RETENTION_MODULE_TG0_TIMER0) ? true \
: ((m) == SLEEP_RETENTION_MODULE_TG1_TIMER0) ? true \
: ((m) == SLEEP_RETENTION_MODULE_GDMA_CH0) ? true \
: ((m) == SLEEP_RETENTION_MODULE_GDMA_CH1) ? true \
: ((m) == SLEEP_RETENTION_MODULE_GDMA_CH2) ? true \
: ((m) == SLEEP_RETENTION_MODULE_ADC) ? true \
: ((m) == SLEEP_RETENTION_MODULE_I2C0) ? true \
: ((m) == SLEEP_RETENTION_MODULE_I2C1) ? true \
: ((m) == SLEEP_RETENTION_MODULE_RMT0) ? true \
: ((m) == SLEEP_RETENTION_MODULE_UART0) ? true \
: ((m) == SLEEP_RETENTION_MODULE_UART1) ? true \
: ((m) == SLEEP_RETENTION_MODULE_I2S0) ? true \
: ((m) == SLEEP_RETENTION_MODULE_ETM0) ? true \
: ((m) == SLEEP_RETENTION_MODULE_TEMP_SENSOR) ? true \
: ((m) == SLEEP_RETENTION_MODULE_TWAI0) ? true \
: ((m) == SLEEP_RETENTION_MODULE_PARLIO0) ? true \
: ((m) == SLEEP_RETENTION_MODULE_GPSPI2) ? true \
: ((m) == SLEEP_RETENTION_MODULE_LEDC) ? true \
: ((m) == SLEEP_RETENTION_MODULE_PCNT0) ? true \
: ((m) == SLEEP_RETENTION_MODULE_MCPWM0) ? true \
: false)
#ifdef __cplusplus
}
#endif

View File

@ -74,7 +74,7 @@
// #define SOC_RMT_SUPPORTED 1 //TODO: [ESP32H21] IDF-11622
// #define SOC_AES_SUPPORTED 1 //TODO: [ESP32H21] IDF-11504
// #define SOC_SDIO_SLAVE_SUPPORTED 1
// #define SOC_PAU_SUPPORTED 1
#define SOC_PAU_SUPPORTED 1
// #define SOC_LIGHT_SLEEP_SUPPORTED 1 //TODO: [ESP32H21] IDF-11517, IDF-11520
// #define SOC_DEEP_SLEEP_SUPPORTED 1 //TODO: [ESP32H21] IDF-11515
// #define SOC_MODEM_CLOCK_SUPPORTED 1
@ -529,6 +529,7 @@
#define SOC_PM_SUPPORT_VDDSDIO_PD (1)
#define SOC_PM_SUPPORT_TOP_PD (1)
#define SOC_PM_PAU_LINK_NUM (5)
#define SOC_PM_RETENTION_MODULE_NUM (32)
#define SOC_PM_PAU_REGDMA_LINK_CONFIGURABLE (1)
#define SOC_PM_CPU_RETENTION_BY_SW (1)
#define SOC_PM_MODEM_RETENTION_BY_REGDMA (1)

View File

@ -31,7 +31,7 @@ extern const ledc_signal_conn_t ledc_periph_signal[2];
extern const ledc_signal_conn_t ledc_periph_signal[1];
#endif
#if SOC_PAU_SUPPORTED
#if SOC_PAU_SUPPORTED && SOC_LEDC_SUPPORT_SLEEP_RETENTION
#if SOC_LIGHT_SLEEP_SUPPORTED
#if SOC_PHY_SUPPORTED