|
1 | 1 | /* |
2 | | - * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD |
| 2 | + * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD |
3 | 3 | * |
4 | 4 | * SPDX-License-Identifier: Apache-2.0 |
5 | 5 | */ |
@@ -202,6 +202,13 @@ esp_err_t i2s_channel_init_pdm_tx_mode(i2s_chan_handle_t handle, const i2s_pdm_t |
202 | 202 |
|
203 | 203 | #ifdef CONFIG_PM_ENABLE |
204 | 204 | esp_pm_lock_type_t pm_type = ESP_PM_APB_FREQ_MAX; |
| 205 | +#if SOC_I2S_SUPPORTS_APLL && SOC_I2S_HW_VERSION_2 |
| 206 | + if (pdm_tx_cfg->clk_cfg.clk_src == I2S_CLK_SRC_APLL) { |
| 207 | + /* Only I2S HW 2 supports to adjust APB frequency while using APLL clock source |
| 208 | + * HW 1 will have timing issue because the DMA and I2S are under different clock domains */ |
| 209 | + pm_type = ESP_PM_NO_LIGHT_SLEEP; |
| 210 | + } |
| 211 | +#endif // SOC_I2S_SUPPORTS_APLL |
205 | 212 | ESP_RETURN_ON_ERROR(esp_pm_lock_create(pm_type, 0, "i2s_driver", &handle->pm_lock), TAG, "I2S pm lock create failed"); |
206 | 213 | #endif |
207 | 214 |
|
@@ -249,8 +256,10 @@ esp_err_t i2s_channel_reconfig_pdm_tx_clock(i2s_chan_handle_t handle, const i2s_ |
249 | 256 | if (pdm_tx_cfg->clk_cfg.clk_src != clk_cfg->clk_src) { |
250 | 257 | ESP_GOTO_ON_ERROR(esp_pm_lock_delete(handle->pm_lock), err, TAG, "I2S delete old pm lock failed"); |
251 | 258 | esp_pm_lock_type_t pm_type = ESP_PM_APB_FREQ_MAX; |
252 | | -#if SOC_I2S_SUPPORTS_APLL |
| 259 | +#if SOC_I2S_SUPPORTS_APLL && SOC_I2S_HW_VERSION_2 |
253 | 260 | if (clk_cfg->clk_src == I2S_CLK_SRC_APLL) { |
| 261 | + /* Only I2S HW 2 supports to adjust APB frequency while using APLL clock source |
| 262 | + * HW 1 will have timing issue because the DMA and I2S are under different clock domains */ |
254 | 263 | pm_type = ESP_PM_NO_LIGHT_SLEEP; |
255 | 264 | } |
256 | 265 | #endif // SOC_I2S_SUPPORTS_APLL |
@@ -488,8 +497,10 @@ esp_err_t i2s_channel_init_pdm_rx_mode(i2s_chan_handle_t handle, const i2s_pdm_r |
488 | 497 |
|
489 | 498 | #ifdef CONFIG_PM_ENABLE |
490 | 499 | esp_pm_lock_type_t pm_type = ESP_PM_APB_FREQ_MAX; |
491 | | -#if SOC_I2S_SUPPORTS_APLL |
| 500 | +#if SOC_I2S_SUPPORTS_APLL && SOC_I2S_HW_VERSION_2 |
492 | 501 | if (pdm_rx_cfg->clk_cfg.clk_src == I2S_CLK_SRC_APLL) { |
| 502 | + /* Only I2S HW 2 supports to adjust APB frequency while using APLL clock source |
| 503 | + * HW 1 will have timing issue because the DMA and I2S are under different clock domains */ |
493 | 504 | pm_type = ESP_PM_NO_LIGHT_SLEEP; |
494 | 505 | } |
495 | 506 | #endif // SOC_I2S_SUPPORTS_APLL |
@@ -540,8 +551,10 @@ esp_err_t i2s_channel_reconfig_pdm_rx_clock(i2s_chan_handle_t handle, const i2s_ |
540 | 551 | if (pdm_rx_cfg->clk_cfg.clk_src != clk_cfg->clk_src) { |
541 | 552 | ESP_GOTO_ON_ERROR(esp_pm_lock_delete(handle->pm_lock), err, TAG, "I2S delete old pm lock failed"); |
542 | 553 | esp_pm_lock_type_t pm_type = ESP_PM_APB_FREQ_MAX; |
543 | | -#if SOC_I2S_SUPPORTS_APLL |
| 554 | +#if SOC_I2S_SUPPORTS_APLL && SOC_I2S_HW_VERSION_2 |
544 | 555 | if (clk_cfg->clk_src == I2S_CLK_SRC_APLL) { |
| 556 | + /* Only I2S HW 2 supports to adjust APB frequency while using APLL clock source |
| 557 | + * HW 1 will have timing issue because the DMA and I2S are under different clock domains */ |
545 | 558 | pm_type = ESP_PM_NO_LIGHT_SLEEP; |
546 | 559 | } |
547 | 560 | #endif // SOC_I2S_SUPPORTS_APLL |
|
0 commit comments