diff --git a/components/esp_driver_i2s/CMakeLists.txt b/components/esp_driver_i2s/CMakeLists.txt index a2c99d5c96b..0bb943517d5 100644 --- a/components/esp_driver_i2s/CMakeLists.txt +++ b/components/esp_driver_i2s/CMakeLists.txt @@ -17,6 +17,9 @@ endif() if(CONFIG_SOC_I2S_SUPPORTED) list(APPEND srcs "i2s_common.c" "i2s_std.c") + if(CONFIG_SOC_PAU_SUPPORTED) + list(APPEND srcs "${target}/i2s_retention.c") + endif() if(CONFIG_SOC_I2S_SUPPORTS_PDM) list(APPEND srcs "i2s_pdm.c") endif() @@ -42,6 +45,7 @@ endif() idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${include} + PRIV_INCLUDE_DIRS "." PRIV_REQUIRES ${priv_requires} REQUIRES esp_hal_i2s LDFRAGMENTS linker.lf diff --git a/components/esp_driver_i2s/esp32c5/i2s_retention.c b/components/esp_driver_i2s/esp32c5/i2s_retention.c new file mode 100644 index 00000000000..1ff0d468676 --- /dev/null +++ b/components/esp_driver_i2s/esp32c5/i2s_retention.c @@ -0,0 +1,46 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "i2s_private.h" +#include "hal/i2s_periph.h" + +/** + * I2S Registers to be saved during sleep retention + * - I2S_RX_CONF_REG + * - I2S_TX_CONF_REG + * - I2S_RX_CONF1_REG + * - I2S_TX_CONF1_REG + * - I2S_TX_PCM2PDM_CONF_REG + * - I2S_TX_PCM2PDM_CONF1_REG + * - I2S_RX_TDM_CTRL_REG + * - I2S_TX_TDM_CTRL_REG + * - I2S_RXEOF_NUM_REG + * - I2S_ETM_CONF_REG +*/ +#define I2S_RETENTION_REGS_CNT 10 +#define I2S_RETENTION_REGS_BASE(i) I2S_RX_CONF_REG(i) +static const uint32_t i2s_regs_map[4] = {0x12360f, 0x0, 0x0, 0x0}; +#define I2S_SLEEP_RETENTION_ENTRIES(i2s_port) { \ + /* Save/restore the register values */ \ + [0] = { .config = REGDMA_LINK_ADDR_MAP_INIT( \ + REGDMA_I2S_LINK(0x00), \ + I2S_RETENTION_REGS_BASE(i2s_port), \ + I2S_RETENTION_REGS_BASE(i2s_port), \ + I2S_RETENTION_REGS_CNT, 0, 0, \ + i2s_regs_map[0], i2s_regs_map[1], \ + i2s_regs_map[2], i2s_regs_map[3]), \ + .owner = ENTRY(0) | ENTRY(2)}, \ +}; + +static const regdma_entries_config_t i2s0_regs_retention[] = I2S_SLEEP_RETENTION_ENTRIES(0); + +const i2s_reg_retention_info_t i2s_reg_retention_info[I2S_LL_GET(INST_NUM)] = { + [0] = { + .retention_module = SLEEP_RETENTION_MODULE_I2S0, + .entry_array = i2s0_regs_retention, + .array_size = ARRAY_SIZE(i2s0_regs_retention) + }, +}; diff --git a/components/esp_driver_i2s/esp32c6/i2s_retention.c b/components/esp_driver_i2s/esp32c6/i2s_retention.c new file mode 100644 index 00000000000..0318f2f93a6 --- /dev/null +++ b/components/esp_driver_i2s/esp32c6/i2s_retention.c @@ -0,0 +1,46 @@ +/* + * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "i2s_private.h" +#include "hal/i2s_periph.h" + +/** + * I2S Registers to be saved during sleep retention + * - I2S_RX_CONF_REG + * - I2S_TX_CONF_REG + * - I2S_RX_CONF1_REG + * - I2S_TX_CONF1_REG + * - I2S_TX_PCM2PDM_CONF_REG + * - I2S_TX_PCM2PDM_CONF1_REG + * - I2S_RX_TDM_CTRL_REG + * - I2S_TX_TDM_CTRL_REG + * - I2S_RXEOF_NUM_REG + * - I2S_ETM_CONF_REG +*/ +#define I2S_RETENTION_REGS_CNT 10 +#define I2S_RETENTION_REGS_BASE(i) I2S_RX_CONF_REG(i) +static const uint32_t i2s_regs_map[4] = {0x12330f, 0x0, 0x0, 0x0}; +#define I2S_SLEEP_RETENTION_ENTRIES(i2s_port) { \ + /* Save/restore the register values */ \ + [0] = { .config = REGDMA_LINK_ADDR_MAP_INIT( \ + REGDMA_I2S_LINK(0x00), \ + I2S_RETENTION_REGS_BASE(i2s_port), \ + I2S_RETENTION_REGS_BASE(i2s_port), \ + I2S_RETENTION_REGS_CNT, 0, 0, \ + i2s_regs_map[0], i2s_regs_map[1], \ + i2s_regs_map[2], i2s_regs_map[3]), \ + .owner = ENTRY(0) | ENTRY(2)}, \ +}; + +static const regdma_entries_config_t i2s0_regs_retention[] = I2S_SLEEP_RETENTION_ENTRIES(0); + +const i2s_reg_retention_info_t i2s_reg_retention_info[I2S_LL_GET(INST_NUM)] = { + [0] = { + .retention_module = SLEEP_RETENTION_MODULE_I2S0, + .entry_array = i2s0_regs_retention, + .array_size = ARRAY_SIZE(i2s0_regs_retention) + }, +}; diff --git a/components/esp_driver_i2s/esp32c61/i2s_retention.c b/components/esp_driver_i2s/esp32c61/i2s_retention.c new file mode 100644 index 00000000000..93cc1fcbf16 --- /dev/null +++ b/components/esp_driver_i2s/esp32c61/i2s_retention.c @@ -0,0 +1,43 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "i2s_private.h" +#include "hal/i2s_periph.h" + +/** + * I2S Registers to be saved during sleep retention + * - I2S_RX_CONF_REG + * - I2S_TX_CONF_REG + * - I2S_RX_CONF1_REG + * - I2S_TX_CONF1_REG + * - I2S_TX_PCM2PDM_CONF_REG + * - I2S_TX_PCM2PDM_CONF1_REG + * - I2S_RX_TDM_CTRL_REG + * - I2S_TX_TDM_CTRL_REG + * - I2S_RXEOF_NUM_REG + * - I2S_ETM_CONF_REG +*/ +#define I2S_RETENTION_REGS_CNT 10 +#define I2S_RETENTION_REGS_BASE (DR_REG_I2S_BASE + 0x20) +static const uint32_t i2s_regs_map[4] = {0x12330f, 0x0, 0x0, 0x0}; +static const regdma_entries_config_t i2s_regdma_entries[] = { + [0] = { + .config = REGDMA_LINK_ADDR_MAP_INIT(REGDMA_I2S_LINK(0x00), + I2S_RETENTION_REGS_BASE, I2S_RETENTION_REGS_BASE, + I2S_RETENTION_REGS_CNT, 0, 0, + i2s_regs_map[0], i2s_regs_map[1], + i2s_regs_map[2], i2s_regs_map[3]), + .owner = ENTRY(0) | ENTRY(2), + }, +}; + +const i2s_reg_retention_info_t i2s_reg_retention_info[1] = { + [0] = { + .retention_module = SLEEP_RETENTION_MODULE_I2S0, + .entry_array = i2s_regdma_entries, + .array_size = ARRAY_SIZE(i2s_regdma_entries) + }, +}; diff --git a/components/esp_driver_i2s/esp32h2/i2s_retention.c b/components/esp_driver_i2s/esp32h2/i2s_retention.c new file mode 100644 index 00000000000..a504b4c10ad --- /dev/null +++ b/components/esp_driver_i2s/esp32h2/i2s_retention.c @@ -0,0 +1,46 @@ +/* + * SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "i2s_private.h" +#include "hal/i2s_periph.h" + +/** + * I2S Registers to be saved during sleep retention + * - I2S_RX_CONF_REG + * - I2S_TX_CONF_REG + * - I2S_RX_CONF1_REG + * - I2S_TX_CONF1_REG + * - I2S_TX_PCM2PDM_CONF_REG + * - I2S_TX_PCM2PDM_CONF1_REG + * - I2S_RX_TDM_CTRL_REG + * - I2S_TX_TDM_CTRL_REG + * - I2S_RXEOF_NUM_REG + * - I2S_ETM_CONF_REG +*/ +#define I2S_RETENTION_REGS_CNT 10 +#define I2S_RETENTION_REGS_BASE(i) I2S_RX_CONF_REG +static const uint32_t i2s_regs_map[4] = {0x12330f, 0x0, 0x0, 0x0}; +#define I2S_SLEEP_RETENTION_ENTRIES(i2s_port) { \ + /* Save/restore the register values */ \ + [0] = { .config = REGDMA_LINK_ADDR_MAP_INIT( \ + REGDMA_I2S_LINK(0x00), \ + I2S_RETENTION_REGS_BASE(i2s_port), \ + I2S_RETENTION_REGS_BASE(i2s_port), \ + I2S_RETENTION_REGS_CNT, 0, 0, \ + i2s_regs_map[0], i2s_regs_map[1], \ + i2s_regs_map[2], i2s_regs_map[3]), \ + .owner = ENTRY(0) | ENTRY(2)}, \ +}; + +static const regdma_entries_config_t i2s0_regs_retention[] = I2S_SLEEP_RETENTION_ENTRIES(0); + +const i2s_reg_retention_info_t i2s_reg_retention_info[I2S_LL_GET(INST_NUM)] = { + [0] = { + .retention_module = SLEEP_RETENTION_MODULE_I2S0, + .entry_array = i2s0_regs_retention, + .array_size = ARRAY_SIZE(i2s0_regs_retention) + }, +}; diff --git a/components/esp_driver_i2s/esp32h21/i2s_retention.c b/components/esp_driver_i2s/esp32h21/i2s_retention.c new file mode 100644 index 00000000000..033ec76b123 --- /dev/null +++ b/components/esp_driver_i2s/esp32h21/i2s_retention.c @@ -0,0 +1,46 @@ +/* + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "i2s_private.h" +#include "hal/i2s_periph.h" + +/** + * I2S Registers to be saved during sleep retention + * - I2S_RX_CONF_REG + * - I2S_TX_CONF_REG + * - I2S_RX_CONF1_REG + * - I2S_TX_CONF1_REG + * - I2S_TX_PCM2PDM_CONF_REG + * - I2S_TX_PCM2PDM_CONF1_REG + * - I2S_RX_TDM_CTRL_REG + * - I2S_TX_TDM_CTRL_REG + * - I2S_RXEOF_NUM_REG + * - I2S_ETM_CONF_REG +*/ +#define I2S_RETENTION_REGS_CNT 10 +#define I2S_RETENTION_REGS_BASE(i) I2S_RX_CONF_REG +static const uint32_t i2s_regs_map[4] = {0x12330f, 0x0, 0x0, 0x0}; +#define I2S_SLEEP_RETENTION_ENTRIES(i2s_port) { \ + /* Save/restore the register values */ \ + [0] = { .config = REGDMA_LINK_ADDR_MAP_INIT( \ + REGDMA_I2S_LINK(0x00), \ + I2S_RETENTION_REGS_BASE(i2s_port), \ + I2S_RETENTION_REGS_BASE(i2s_port), \ + I2S_RETENTION_REGS_CNT, 0, 0, \ + i2s_regs_map[0], i2s_regs_map[1], \ + i2s_regs_map[2], i2s_regs_map[3]), \ + .owner = ENTRY(0)}, \ +}; + +static const regdma_entries_config_t i2s0_regs_retention[] = I2S_SLEEP_RETENTION_ENTRIES(0); + +const i2s_reg_retention_info_t i2s_reg_retention_info[I2S_LL_GET(INST_NUM)] = { + [0] = { + .retention_module = SLEEP_RETENTION_MODULE_I2S0, + .entry_array = i2s0_regs_retention, + .array_size = ARRAY_SIZE(i2s0_regs_retention) + }, +}; diff --git a/components/esp_driver_i2s/esp32h4/i2s_retention.c b/components/esp_driver_i2s/esp32h4/i2s_retention.c new file mode 100644 index 00000000000..58042a9d19c --- /dev/null +++ b/components/esp_driver_i2s/esp32h4/i2s_retention.c @@ -0,0 +1,51 @@ +/* + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "i2s_private.h" +#include "hal/i2s_periph.h" + +/** + * I2S Registers to be saved during sleep retention + * - I2S_INT_ENA_REG + * - I2S_RX_CONF_REG + * - I2S_TX_CONF_REG + * - I2S_RX_CONF1_REG + * - I2S_TX_CONF1_REG + * - I2S_TX_PCM2PDM_CONF_REG + * - I2S_TX_PCM2PDM_CONF1_REG + * - I2S_RX_TDM_CTRL_REG + * - I2S_TX_TDM_CTRL_REG + * - I2S_RXEOF_NUM_REG + * - I2S_ETM_CONF_REG + * - I2S_IDEAL_CNT_REG + * - I2S_SYNC_SW_THRES_REG + * - I2S_SYNC_HW_THRES_REG + * - I2S_HW_SYNC_CONF_REG + * - I2S_HW_SYNC_DATA_REG +*/ + +#define I2S_RETENTION_REGS_CNT 16 +#define I2S_RETENTION_REGS_BASE(i) (I2S_INT_ENA_REG(i)) +static const uint32_t i2s_regs_map[4] = {0xf191b079, 0x0, 0x0, 0x0}; +#define I2S_SLEEP_RETENTION_ENTRIES(i2s_port) { \ + [0] = { .config = REGDMA_LINK_ADDR_MAP_INIT( \ + REGDMA_I2S_LINK(0x00), \ + I2S_RETENTION_REGS_BASE(i2s_port), \ + I2S_RETENTION_REGS_BASE(i2s_port), \ + I2S_RETENTION_REGS_CNT, 0, 0, \ + i2s_regs_map[0], i2s_regs_map[1], \ + i2s_regs_map[2], i2s_regs_map[3]), \ + .owner = ENTRY(0) | ENTRY(2) }, \ +}; +static const regdma_entries_config_t i2s0_regs_retention[] = I2S_SLEEP_RETENTION_ENTRIES(0); + +const i2s_reg_retention_info_t i2s_reg_retention_info[I2S_LL_GET(INST_NUM)] = { + [0] = { + .retention_module = SLEEP_RETENTION_MODULE_I2S0, + .entry_array = i2s0_regs_retention, + .array_size = ARRAY_SIZE(i2s0_regs_retention) + }, +}; diff --git a/components/esp_driver_i2s/esp32p4/i2s_retention.c b/components/esp_driver_i2s/esp32p4/i2s_retention.c new file mode 100644 index 00000000000..724ce47763e --- /dev/null +++ b/components/esp_driver_i2s/esp32p4/i2s_retention.c @@ -0,0 +1,59 @@ +/* + * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "i2s_private.h" +#include "hal/i2s_periph.h" + +/** + * I2S Registers to be saved during sleep retention + * - I2S_RX_CONF_REG + * - I2S_TX_CONF_REG + * - I2S_RX_CONF1_REG + * - I2S_TX_CONF1_REG + * - I2S_TX_PCM2PDM_CONF_REG + * - I2S_TX_PCM2PDM_CONF1_REG + * - I2S_RX_PDM2PCM_CONF_REG + * - I2S_RX_TDM_CTRL_REG + * - I2S_TX_TDM_CTRL_REG + * - I2S_RXEOF_NUM_REG + * - I2S_ETM_CONF_REG +*/ +#define I2S_RETENTION_REGS_CNT 11 +#define I2S_RETENTION_REGS_BASE(i) I2S_RX_CONF_REG(i) +static const uint32_t i2s_regs_map[4] = {0x12370f, 0x0, 0x0, 0x0}; +#define I2S_SLEEP_RETENTION_ENTRIES(i2s_port) { \ + /* Save/restore the register values */ \ + [0] = { .config = REGDMA_LINK_ADDR_MAP_INIT( \ + REGDMA_I2S_LINK(0x00), \ + I2S_RETENTION_REGS_BASE(i2s_port), \ + I2S_RETENTION_REGS_BASE(i2s_port), \ + I2S_RETENTION_REGS_CNT, 0, 0, \ + i2s_regs_map[0], i2s_regs_map[1], \ + i2s_regs_map[2], i2s_regs_map[3]), \ + .owner = ENTRY(0)}, \ +}; + +static const regdma_entries_config_t i2s0_regs_retention[] = I2S_SLEEP_RETENTION_ENTRIES(0); +static const regdma_entries_config_t i2s1_regs_retention[] = I2S_SLEEP_RETENTION_ENTRIES(1); +static const regdma_entries_config_t i2s2_regs_retention[] = I2S_SLEEP_RETENTION_ENTRIES(2); + +const i2s_reg_retention_info_t i2s_reg_retention_info[I2S_LL_GET(INST_NUM)] = { + [0] = { + .retention_module = SLEEP_RETENTION_MODULE_I2S0, + .entry_array = i2s0_regs_retention, + .array_size = ARRAY_SIZE(i2s0_regs_retention) + }, + [1] = { + .retention_module = SLEEP_RETENTION_MODULE_I2S1, + .entry_array = i2s1_regs_retention, + .array_size = ARRAY_SIZE(i2s1_regs_retention) + }, + [2] = { + .retention_module = SLEEP_RETENTION_MODULE_I2S2, + .entry_array = i2s2_regs_retention, + .array_size = ARRAY_SIZE(i2s2_regs_retention) + }, +}; diff --git a/components/esp_driver_i2s/esp32s31/i2s_retention.c b/components/esp_driver_i2s/esp32s31/i2s_retention.c new file mode 100644 index 00000000000..7997b9e69a1 --- /dev/null +++ b/components/esp_driver_i2s/esp32s31/i2s_retention.c @@ -0,0 +1,58 @@ +/* + * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "i2s_private.h" +#include "hal/i2s_periph.h" + +/** + * I2S Registers to be saved during sleep retention + * - I2S_RX_CONF_REG + * - I2S_TX_CONF_REG + * - I2S_RX_CONF1_REG + * - I2S_TX_CONF1_REG + * - I2S_RX_RECOMB_CTRL_REG + * - I2S_RX_RECOMB_DMA_CH0_REG + * - I2S_RX_RECOMB_DMA_CH1_REG + * - I2S_RX_RECOMB_DMA_CH2_REG + * - I2S_RX_RECOMB_DMA_CH3_REG + * - I2S_TX_PCM2PDM_CONF_REG + * - I2S_TX_PCM2PDM_CONF1_REG + * - I2S_RX_PDM2PCM_CONF_REG + * - I2S_RX_TDM_CTRL_REG + * - I2S_TX_TDM_CTRL_REG + * - I2S_RXEOF_NUM_REG + * - I2S_ETM_CONF_REG +*/ +#define I2S_RETENTION_REGS_CNT 16 +#define I2S_RETENTION_REGS_BASE(i) I2S_RX_CONF_REG(i) +static const uint32_t i2s_regs_map[4] = {0x123fff, 0x0, 0x0, 0x0}; +#define I2S_SLEEP_RETENTION_ENTRIES(i2s_port) { \ + /* Save/restore the register values */ \ + [0] = { .config = REGDMA_LINK_ADDR_MAP_INIT( \ + REGDMA_I2S_LINK(0x00), \ + I2S_RETENTION_REGS_BASE(i2s_port), \ + I2S_RETENTION_REGS_BASE(i2s_port), \ + I2S_RETENTION_REGS_CNT, 0, 0, \ + i2s_regs_map[0], i2s_regs_map[1], \ + i2s_regs_map[2], i2s_regs_map[3]), \ + .owner = ENTRY(0) | ENTRY(2)}, \ +}; + +static const regdma_entries_config_t i2s0_regs_retention[] = I2S_SLEEP_RETENTION_ENTRIES(0); +static const regdma_entries_config_t i2s1_regs_retention[] = I2S_SLEEP_RETENTION_ENTRIES(1); + +const i2s_reg_retention_info_t i2s_reg_retention_info[I2S_LL_GET(INST_NUM)] = { + [0] = { + .retention_module = SLEEP_RETENTION_MODULE_I2S0, + .entry_array = i2s0_regs_retention, + .array_size = ARRAY_SIZE(i2s0_regs_retention) + }, + [1] = { + .retention_module = SLEEP_RETENTION_MODULE_I2S1, + .entry_array = i2s1_regs_retention, + .array_size = ARRAY_SIZE(i2s1_regs_retention) + }, +}; diff --git a/components/esp_driver_i2s/i2s_private.h b/components/esp_driver_i2s/i2s_private.h index 1bc39580460..aa810c6c2c3 100644 --- a/components/esp_driver_i2s/i2s_private.h +++ b/components/esp_driver_i2s/i2s_private.h @@ -30,6 +30,8 @@ #include "esp_private/periph_ctrl.h" #include "esp_private/esp_gpio_reserve.h" #if SOC_HAS(PAU) +#include "soc/regdma.h" +#include "soc/retention_periph_defs.h" #include "esp_private/sleep_retention.h" #endif #include "esp_pm.h" @@ -146,6 +148,16 @@ typedef struct { #endif } i2s_controller_t; +#if SOC_HAS(PAU) +typedef struct { + const periph_retention_module_t retention_module; + const regdma_entries_config_t *entry_array; + uint32_t array_size; +} i2s_reg_retention_info_t; + +extern const i2s_reg_retention_info_t i2s_reg_retention_info[I2S_LL_GET(INST_NUM)]; +#endif + struct i2s_channel_obj_t { /* Channel basic information */ i2s_controller_t *controller; /*!< Parent pointer to controller object */ diff --git a/components/esp_hal_i2s/esp32c5/i2s_periph.c b/components/esp_hal_i2s/esp32c5/i2s_periph.c index 3a98d21cc1f..dadb749fdeb 100644 --- a/components/esp_hal_i2s/esp32c5/i2s_periph.c +++ b/components/esp_hal_i2s/esp32c5/i2s_periph.c @@ -33,41 +33,3 @@ const i2s_signal_conn_t i2s_periph_signal[I2S_LL_GET(INST_NUM)] = { .irq = ETS_I2S0_INTR_SOURCE, } }; - -/** - * I2S Registers to be saved during sleep retention - * - I2S_RX_CONF_REG - * - I2S_TX_CONF_REG - * - I2S_RX_CONF1_REG - * - I2S_TX_CONF1_REG - * - I2S_TX_PCM2PDM_CONF_REG - * - I2S_TX_PCM2PDM_CONF1_REG - * - I2S_RX_TDM_CTRL_REG - * - I2S_TX_TDM_CTRL_REG - * - I2S_RXEOF_NUM_REG - * - I2S_ETM_CONF_REG -*/ -#define I2S_RETENTION_REGS_CNT 10 -#define I2S_RETENTION_REGS_BASE(i) I2S_RX_CONF_REG(i) -static const uint32_t i2s_regs_map[4] = {0x12360f, 0x0, 0x0, 0x0}; -#define I2S_SLEEP_RETENTION_ENTRIES(i2s_port) { \ - /* Save/restore the register values */ \ - [0] = { .config = REGDMA_LINK_ADDR_MAP_INIT( \ - REGDMA_I2S_LINK(0x00), \ - I2S_RETENTION_REGS_BASE(i2s_port), \ - I2S_RETENTION_REGS_BASE(i2s_port), \ - I2S_RETENTION_REGS_CNT, 0, 0, \ - i2s_regs_map[0], i2s_regs_map[1], \ - i2s_regs_map[2], i2s_regs_map[3]), \ - .owner = ENTRY(0) | ENTRY(2)}, \ -}; - -static const regdma_entries_config_t i2s0_regs_retention[] = I2S_SLEEP_RETENTION_ENTRIES(0); - -const i2s_reg_retention_info_t i2s_reg_retention_info[I2S_LL_GET(INST_NUM)] = { - [0] = { - .retention_module = SLEEP_RETENTION_MODULE_I2S0, - .entry_array = i2s0_regs_retention, - .array_size = ARRAY_SIZE(i2s0_regs_retention) - }, -}; diff --git a/components/esp_hal_i2s/esp32c6/i2s_periph.c b/components/esp_hal_i2s/esp32c6/i2s_periph.c index 7fe405d70ba..3901f977d56 100644 --- a/components/esp_hal_i2s/esp32c6/i2s_periph.c +++ b/components/esp_hal_i2s/esp32c6/i2s_periph.c @@ -5,7 +5,6 @@ */ #include "hal/i2s_periph.h" -#include "soc/i2s_reg.h" #include "soc/gpio_sig_map.h" /* @@ -33,41 +32,3 @@ const i2s_signal_conn_t i2s_periph_signal[I2S_LL_GET(INST_NUM)] = { .irq = ETS_I2S0_INTR_SOURCE, } }; - -/** - * I2S Registers to be saved during sleep retention - * - I2S_RX_CONF_REG - * - I2S_TX_CONF_REG - * - I2S_RX_CONF1_REG - * - I2S_TX_CONF1_REG - * - I2S_TX_PCM2PDM_CONF_REG - * - I2S_TX_PCM2PDM_CONF1_REG - * - I2S_RX_TDM_CTRL_REG - * - I2S_TX_TDM_CTRL_REG - * - I2S_RXEOF_NUM_REG - * - I2S_ETM_CONF_REG -*/ -#define I2S_RETENTION_REGS_CNT 10 -#define I2S_RETENTION_REGS_BASE(i) I2S_RX_CONF_REG(i) -static const uint32_t i2s_regs_map[4] = {0x12330f, 0x0, 0x0, 0x0}; -#define I2S_SLEEP_RETENTION_ENTRIES(i2s_port) { \ - /* Save/restore the register values */ \ - [0] = { .config = REGDMA_LINK_ADDR_MAP_INIT( \ - REGDMA_I2S_LINK(0x00), \ - I2S_RETENTION_REGS_BASE(i2s_port), \ - I2S_RETENTION_REGS_BASE(i2s_port), \ - I2S_RETENTION_REGS_CNT, 0, 0, \ - i2s_regs_map[0], i2s_regs_map[1], \ - i2s_regs_map[2], i2s_regs_map[3]), \ - .owner = ENTRY(0) | ENTRY(2)}, \ -}; - -static const regdma_entries_config_t i2s0_regs_retention[] = I2S_SLEEP_RETENTION_ENTRIES(0); - -const i2s_reg_retention_info_t i2s_reg_retention_info[I2S_LL_GET(INST_NUM)] = { - [0] = { - .retention_module = SLEEP_RETENTION_MODULE_I2S0, - .entry_array = i2s0_regs_retention, - .array_size = ARRAY_SIZE(i2s0_regs_retention) - }, -}; diff --git a/components/esp_hal_i2s/esp32c61/i2s_periph.c b/components/esp_hal_i2s/esp32c61/i2s_periph.c index e0a5b28ba38..43c5ff86b15 100644 --- a/components/esp_hal_i2s/esp32c61/i2s_periph.c +++ b/components/esp_hal_i2s/esp32c61/i2s_periph.c @@ -5,7 +5,6 @@ */ #include "hal/i2s_periph.h" -#include "soc/i2s_reg.h" #include "soc/gpio_sig_map.h" /* @@ -33,41 +32,3 @@ const i2s_signal_conn_t i2s_periph_signal[I2S_LL_GET(INST_NUM)] = { .irq = ETS_I2S0_INTR_SOURCE, } }; - -/** - * I2S Registers to be saved during sleep retention - * - I2S_RX_CONF_REG - * - I2S_TX_CONF_REG - * - I2S_RX_CONF1_REG - * - I2S_TX_CONF1_REG - * - I2S_TX_PCM2PDM_CONF_REG - * - I2S_TX_PCM2PDM_CONF1_REG - * - I2S_RX_TDM_CTRL_REG - * - I2S_TX_TDM_CTRL_REG - * - I2S_RXEOF_NUM_REG - * - I2S_ETM_CONF_REG -*/ -#define I2S_RETENTION_REGS_CNT 10 -#define I2S_RETENTION_REGS_BASE(i) I2S_RX_CONF_REG -static const uint32_t i2s_regs_map[4] = {0x12360f, 0x0, 0x0, 0x0}; -#define I2S_SLEEP_RETENTION_ENTRIES(i2s_port) { \ - /* Save/restore the register values */ \ - [0] = { .config = REGDMA_LINK_ADDR_MAP_INIT( \ - REGDMA_I2S_LINK(0x00), \ - I2S_RETENTION_REGS_BASE(i2s_port), \ - I2S_RETENTION_REGS_BASE(i2s_port), \ - I2S_RETENTION_REGS_CNT, 0, 0, \ - i2s_regs_map[0], i2s_regs_map[1], \ - i2s_regs_map[2], i2s_regs_map[3]), \ - .owner = ENTRY(0) | ENTRY(2)}, \ -}; - -static const regdma_entries_config_t i2s0_regs_retention[] = I2S_SLEEP_RETENTION_ENTRIES(0); - -const i2s_reg_retention_info_t i2s_reg_retention_info[I2S_LL_GET(INST_NUM)] = { - [0] = { - .retention_module = SLEEP_RETENTION_MODULE_I2S0, - .entry_array = i2s0_regs_retention, - .array_size = ARRAY_SIZE(i2s0_regs_retention) - }, -}; diff --git a/components/esp_hal_i2s/esp32h2/i2s_periph.c b/components/esp_hal_i2s/esp32h2/i2s_periph.c index d0c7c5868c4..4bbf394287d 100644 --- a/components/esp_hal_i2s/esp32h2/i2s_periph.c +++ b/components/esp_hal_i2s/esp32h2/i2s_periph.c @@ -5,7 +5,6 @@ */ #include "hal/i2s_periph.h" -#include "soc/i2s_reg.h" #include "soc/gpio_sig_map.h" /* @@ -32,41 +31,3 @@ const i2s_signal_conn_t i2s_periph_signal[I2S_LL_GET(INST_NUM)] = { .irq = ETS_I2S0_INTR_SOURCE, } }; - -/** - * I2S Registers to be saved during sleep retention - * - I2S_RX_CONF_REG - * - I2S_TX_CONF_REG - * - I2S_RX_CONF1_REG - * - I2S_TX_CONF1_REG - * - I2S_TX_PCM2PDM_CONF_REG - * - I2S_TX_PCM2PDM_CONF1_REG - * - I2S_RX_TDM_CTRL_REG - * - I2S_TX_TDM_CTRL_REG - * - I2S_RXEOF_NUM_REG - * - I2S_ETM_CONF_REG -*/ -#define I2S_RETENTION_REGS_CNT 10 -#define I2S_RETENTION_REGS_BASE(i) I2S_RX_CONF_REG -static const uint32_t i2s_regs_map[4] = {0x12330f, 0x0, 0x0, 0x0}; -#define I2S_SLEEP_RETENTION_ENTRIES(i2s_port) { \ - /* Save/restore the register values */ \ - [0] = { .config = REGDMA_LINK_ADDR_MAP_INIT( \ - REGDMA_I2S_LINK(0x00), \ - I2S_RETENTION_REGS_BASE(i2s_port), \ - I2S_RETENTION_REGS_BASE(i2s_port), \ - I2S_RETENTION_REGS_CNT, 0, 0, \ - i2s_regs_map[0], i2s_regs_map[1], \ - i2s_regs_map[2], i2s_regs_map[3]), \ - .owner = ENTRY(0) | ENTRY(2)}, \ -}; - -static const regdma_entries_config_t i2s0_regs_retention[] = I2S_SLEEP_RETENTION_ENTRIES(0); - -const i2s_reg_retention_info_t i2s_reg_retention_info[I2S_LL_GET(INST_NUM)] = { - [0] = { - .retention_module = SLEEP_RETENTION_MODULE_I2S0, - .entry_array = i2s0_regs_retention, - .array_size = ARRAY_SIZE(i2s0_regs_retention) - }, -}; diff --git a/components/esp_hal_i2s/esp32h21/i2s_periph.c b/components/esp_hal_i2s/esp32h21/i2s_periph.c index a85bbaed590..8415fc7b92f 100644 --- a/components/esp_hal_i2s/esp32h21/i2s_periph.c +++ b/components/esp_hal_i2s/esp32h21/i2s_periph.c @@ -5,7 +5,6 @@ */ #include "hal/i2s_periph.h" -#include "soc/i2s_reg.h" #include "soc/gpio_sig_map.h" /* @@ -32,41 +31,3 @@ const i2s_signal_conn_t i2s_periph_signal[I2S_LL_GET(INST_NUM)] = { .irq = ETS_I2S0_INTR_SOURCE, } }; - -/** - * I2S Registers to be saved during sleep retention - * - I2S_RX_CONF_REG - * - I2S_TX_CONF_REG - * - I2S_RX_CONF1_REG - * - I2S_TX_CONF1_REG - * - I2S_TX_PCM2PDM_CONF_REG - * - I2S_TX_PCM2PDM_CONF1_REG - * - I2S_RX_TDM_CTRL_REG - * - I2S_TX_TDM_CTRL_REG - * - I2S_RXEOF_NUM_REG - * - I2S_ETM_CONF_REG -*/ -#define I2S_RETENTION_REGS_CNT 10 -#define I2S_RETENTION_REGS_BASE(i) I2S_RX_CONF_REG -static const uint32_t i2s_regs_map[4] = {0x12330f, 0x0, 0x0, 0x0}; -#define I2S_SLEEP_RETENTION_ENTRIES(i2s_port) { \ - /* Save/restore the register values */ \ - [0] = { .config = REGDMA_LINK_ADDR_MAP_INIT( \ - REGDMA_I2S_LINK(0x00), \ - I2S_RETENTION_REGS_BASE(i2s_port), \ - I2S_RETENTION_REGS_BASE(i2s_port), \ - I2S_RETENTION_REGS_CNT, 0, 0, \ - i2s_regs_map[0], i2s_regs_map[1], \ - i2s_regs_map[2], i2s_regs_map[3]), \ - .owner = ENTRY(0) | ENTRY(2)}, \ -}; - -static const regdma_entries_config_t i2s0_regs_retention[] = I2S_SLEEP_RETENTION_ENTRIES(0); - -const i2s_reg_retention_info_t i2s_reg_retention_info[I2S_LL_GET(INST_NUM)] = { - [0] = { - .retention_module = SLEEP_RETENTION_MODULE_I2S0, - .entry_array = i2s0_regs_retention, - .array_size = ARRAY_SIZE(i2s0_regs_retention) - }, -}; diff --git a/components/esp_hal_i2s/esp32h4/i2s_periph.c b/components/esp_hal_i2s/esp32h4/i2s_periph.c index becab28d34b..242815991a1 100644 --- a/components/esp_hal_i2s/esp32h4/i2s_periph.c +++ b/components/esp_hal_i2s/esp32h4/i2s_periph.c @@ -5,7 +5,6 @@ */ #include "hal/i2s_periph.h" -#include "soc/i2s_reg.h" #include "soc/gpio_sig_map.h" /* @@ -32,46 +31,3 @@ const i2s_signal_conn_t i2s_periph_signal[I2S_LL_GET(INST_NUM)] = { .irq = ETS_I2S_INTR_SOURCE, } }; - -/** - * I2S Registers to be saved during sleep retention - * - I2S_INT_ENA_REG - * - I2S_RX_CONF_REG - * - I2S_TX_CONF_REG - * - I2S_RX_CONF1_REG - * - I2S_TX_CONF1_REG - * - I2S_TX_PCM2PDM_CONF_REG - * - I2S_TX_PCM2PDM_CONF1_REG - * - I2S_RX_TDM_CTRL_REG - * - I2S_TX_TDM_CTRL_REG - * - I2S_RXEOF_NUM_REG - * - I2S_ETM_CONF_REG - * - I2S_IDEAL_CNT_REG - * - I2S_SYNC_SW_THRES_REG - * - I2S_SYNC_HW_THRES_REG - * - I2S_HW_SYNC_CONF_REG - * - I2S_HW_SYNC_DATA_REG -*/ - -#define I2S_RETENTION_REGS_CNT 16 -#define I2S_RETENTION_REGS_BASE(i) (I2S_INT_ENA_REG(i)) -static const uint32_t i2s_regs_map[4] = {0xf191b079, 0x0, 0x0, 0x0}; -#define I2S_SLEEP_RETENTION_ENTRIES(i2s_port) { \ - [0] = { .config = REGDMA_LINK_ADDR_MAP_INIT( \ - REGDMA_I2S_LINK(0x00), \ - I2S_RETENTION_REGS_BASE(i2s_port), \ - I2S_RETENTION_REGS_BASE(i2s_port), \ - I2S_RETENTION_REGS_CNT, 0, 0, \ - i2s_regs_map[0], i2s_regs_map[1], \ - i2s_regs_map[2], i2s_regs_map[3]), \ - .owner = ENTRY(0) | ENTRY(2) }, \ -}; -static const regdma_entries_config_t i2s0_regs_retention[] = I2S_SLEEP_RETENTION_ENTRIES(0); - -const i2s_reg_retention_info_t i2s_reg_retention_info[I2S_LL_GET(INST_NUM)] = { - [0] = { - .retention_module = SLEEP_RETENTION_MODULE_I2S0, - .entry_array = i2s0_regs_retention, - .array_size = ARRAY_SIZE(i2s0_regs_retention) - }, -}; diff --git a/components/esp_hal_i2s/esp32p4/i2s_periph.c b/components/esp_hal_i2s/esp32p4/i2s_periph.c index 44a92cdc174..46e7b68d4ca 100644 --- a/components/esp_hal_i2s/esp32p4/i2s_periph.c +++ b/components/esp_hal_i2s/esp32p4/i2s_periph.c @@ -5,7 +5,6 @@ */ #include "hal/i2s_periph.h" -#include "soc/i2s_reg.h" #include "soc/gpio_sig_map.h" #include "soc/lp_gpio_sig_map.h" @@ -109,54 +108,3 @@ const i2s_signal_conn_t lp_i2s_periph_signal[SOC_LP_I2S_NUM] = { .irq = ETS_LP_I2S_INTR_SOURCE, }, }; - -/** - * I2S Registers to be saved during sleep retention - * - I2S_RX_CONF_REG - * - I2S_TX_CONF_REG - * - I2S_RX_CONF1_REG - * - I2S_TX_CONF1_REG - * - I2S_TX_PCM2PDM_CONF_REG - * - I2S_TX_PCM2PDM_CONF1_REG - * - I2S_RX_PDM2PCM_CONF_REG - * - I2S_RX_TDM_CTRL_REG - * - I2S_TX_TDM_CTRL_REG - * - I2S_RXEOF_NUM_REG - * - I2S_ETM_CONF_REG -*/ -#define I2S_RETENTION_REGS_CNT 11 -#define I2S_RETENTION_REGS_BASE(i) I2S_RX_CONF_REG(i) -static const uint32_t i2s_regs_map[4] = {0x12370f, 0x0, 0x0, 0x0}; -#define I2S_SLEEP_RETENTION_ENTRIES(i2s_port) { \ - /* Save/restore the register values */ \ - [0] = { .config = REGDMA_LINK_ADDR_MAP_INIT( \ - REGDMA_I2S_LINK(0x00), \ - I2S_RETENTION_REGS_BASE(i2s_port), \ - I2S_RETENTION_REGS_BASE(i2s_port), \ - I2S_RETENTION_REGS_CNT, 0, 0, \ - i2s_regs_map[0], i2s_regs_map[1], \ - i2s_regs_map[2], i2s_regs_map[3]), \ - .owner = ENTRY(0)}, \ -}; - -static const regdma_entries_config_t i2s0_regs_retention[] = I2S_SLEEP_RETENTION_ENTRIES(0); -static const regdma_entries_config_t i2s1_regs_retention[] = I2S_SLEEP_RETENTION_ENTRIES(1); -static const regdma_entries_config_t i2s2_regs_retention[] = I2S_SLEEP_RETENTION_ENTRIES(2); - -const i2s_reg_retention_info_t i2s_reg_retention_info[I2S_LL_GET(INST_NUM)] = { - [0] = { - .retention_module = SLEEP_RETENTION_MODULE_I2S0, - .entry_array = i2s0_regs_retention, - .array_size = ARRAY_SIZE(i2s0_regs_retention) - }, - [1] = { - .retention_module = SLEEP_RETENTION_MODULE_I2S1, - .entry_array = i2s1_regs_retention, - .array_size = ARRAY_SIZE(i2s1_regs_retention) - }, - [2] = { - .retention_module = SLEEP_RETENTION_MODULE_I2S2, - .entry_array = i2s2_regs_retention, - .array_size = ARRAY_SIZE(i2s2_regs_retention) - }, -}; diff --git a/components/esp_hal_i2s/esp32s31/i2s_periph.c b/components/esp_hal_i2s/esp32s31/i2s_periph.c index 0fb44c01738..34fee5367ac 100644 --- a/components/esp_hal_i2s/esp32s31/i2s_periph.c +++ b/components/esp_hal_i2s/esp32s31/i2s_periph.c @@ -5,7 +5,6 @@ */ #include "hal/i2s_periph.h" -#include "soc/i2s_reg.h" #include "soc/gpio_sig_map.h" #include "soc/lp_gpio_sig_map.h" @@ -60,53 +59,3 @@ const i2s_signal_conn_t i2s_periph_signal[I2S_LL_GET(INST_NUM)] = { .irq = ETS_I2S1_INTR_SOURCE, }, }; - -/** - * I2S Registers to be saved during sleep retention - * - I2S_RX_CONF_REG - * - I2S_TX_CONF_REG - * - I2S_RX_CONF1_REG - * - I2S_TX_CONF1_REG - * - I2S_RX_RECOMB_CTRL_REG - * - I2S_RX_RECOMB_DMA_CH0_REG - * - I2S_RX_RECOMB_DMA_CH1_REG - * - I2S_RX_RECOMB_DMA_CH2_REG - * - I2S_RX_RECOMB_DMA_CH3_REG - * - I2S_TX_PCM2PDM_CONF_REG - * - I2S_TX_PCM2PDM_CONF1_REG - * - I2S_RX_PDM2PCM_CONF_REG - * - I2S_RX_TDM_CTRL_REG - * - I2S_TX_TDM_CTRL_REG - * - I2S_RXEOF_NUM_REG - * - I2S_ETM_CONF_REG -*/ -#define I2S_RETENTION_REGS_CNT 16 -#define I2S_RETENTION_REGS_BASE(i) I2S_RX_CONF_REG(i) -static const uint32_t i2s_regs_map[4] = {0x123fff, 0x0, 0x0, 0x0}; -#define I2S_SLEEP_RETENTION_ENTRIES(i2s_port) { \ - /* Save/restore the register values */ \ - [0] = { .config = REGDMA_LINK_ADDR_MAP_INIT( \ - REGDMA_I2S_LINK(0x00), \ - I2S_RETENTION_REGS_BASE(i2s_port), \ - I2S_RETENTION_REGS_BASE(i2s_port), \ - I2S_RETENTION_REGS_CNT, 0, 0, \ - i2s_regs_map[0], i2s_regs_map[1], \ - i2s_regs_map[2], i2s_regs_map[3]), \ - .owner = ENTRY(0) | ENTRY(2)}, \ -}; - -static const regdma_entries_config_t i2s0_regs_retention[] = I2S_SLEEP_RETENTION_ENTRIES(0); -static const regdma_entries_config_t i2s1_regs_retention[] = I2S_SLEEP_RETENTION_ENTRIES(1); - -const i2s_reg_retention_info_t i2s_reg_retention_info[I2S_LL_GET(INST_NUM)] = { - [0] = { - .retention_module = SLEEP_RETENTION_MODULE_I2S0, - .entry_array = i2s0_regs_retention, - .array_size = ARRAY_SIZE(i2s0_regs_retention) - }, - [1] = { - .retention_module = SLEEP_RETENTION_MODULE_I2S1, - .entry_array = i2s1_regs_retention, - .array_size = ARRAY_SIZE(i2s1_regs_retention) - }, -}; diff --git a/components/esp_hal_i2s/include/hal/i2s_periph.h b/components/esp_hal_i2s/include/hal/i2s_periph.h index 8b9265735d8..44eea65f4f4 100644 --- a/components/esp_hal_i2s/include/hal/i2s_periph.h +++ b/components/esp_hal_i2s/include/hal/i2s_periph.h @@ -8,10 +8,6 @@ #include "soc/soc.h" #include "soc/interrupts.h" #include "soc/soc_caps.h" -#include "soc/regdma.h" -#if SOC_HAS(PAU) -#include "soc/retention_periph_defs.h" -#endif #if SOC_HAS(I2S) #include "soc/i2s_struct.h" @@ -64,15 +60,6 @@ extern const i2s_signal_conn_t i2s_periph_signal[I2S_LL_GET(INST_NUM)]; extern const i2s_signal_conn_t lp_i2s_periph_signal[SOC_LP_I2S_NUM]; #endif -#if SOC_HAS(PAU) -typedef struct { - const periph_retention_module_t retention_module; - const regdma_entries_config_t *entry_array; - uint32_t array_size; -} i2s_reg_retention_info_t; - -extern const i2s_reg_retention_info_t i2s_reg_retention_info[I2S_LL_GET(INST_NUM)]; -#endif // SOC_HAS(PAU) #endif // SOC_HAS(I2S) #ifdef __cplusplus