From b4c907e36de1d61669486383ff9e55d0ea532db6 Mon Sep 17 00:00:00 2001 From: wuzhenghui Date: Mon, 31 Mar 2025 14:58:00 +0800 Subject: [PATCH] fix(esp_hw_support): fix current leakage if ext32k slow clock source not exists --- components/esp_hw_support/port/esp32/rtc_clk.c | 7 ++++++- components/esp_hw_support/port/esp32c2/rtc_clk.c | 8 +++++++- components/esp_hw_support/port/esp32c3/rtc_clk.c | 9 ++++++++- components/esp_hw_support/port/esp32c6/rtc_clk.c | 9 ++++++++- components/esp_hw_support/port/esp32h2/rtc_clk.c | 9 ++++++++- components/esp_hw_support/port/esp32s2/rtc_clk.c | 9 ++++++++- components/esp_hw_support/port/esp32s3/rtc_clk.c | 9 ++++++++- components/esp_system/port/soc/esp32/clk.c | 10 ++++++++-- components/esp_system/port/soc/esp32c2/clk.c | 6 ++++-- components/esp_system/port/soc/esp32c3/clk.c | 10 ++++++++-- components/esp_system/port/soc/esp32c6/clk.c | 8 +++++--- components/esp_system/port/soc/esp32h2/clk.c | 8 +++++--- components/esp_system/port/soc/esp32s2/clk.c | 10 ++++++++-- components/esp_system/port/soc/esp32s3/clk.c | 10 ++++++++-- components/soc/esp32/include/soc/rtc.h | 7 ++++++- components/soc/esp32c2/include/soc/rtc.h | 7 ++++++- components/soc/esp32c3/include/soc/rtc.h | 7 ++++++- components/soc/esp32c6/include/soc/rtc.h | 7 ++++++- components/soc/esp32h2/include/soc/rtc.h | 7 ++++++- components/soc/esp32p4/include/soc/rtc.h | 7 ++++++- components/soc/esp32s2/include/soc/rtc.h | 7 ++++++- components/soc/esp32s3/include/soc/rtc.h | 9 +++++++-- 22 files changed, 148 insertions(+), 32 deletions(-) diff --git a/components/esp_hw_support/port/esp32/rtc_clk.c b/components/esp_hw_support/port/esp32/rtc_clk.c index 210877800dc..79c458ee9c3 100644 --- a/components/esp_hw_support/port/esp32/rtc_clk.c +++ b/components/esp_hw_support/port/esp32/rtc_clk.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -114,6 +114,11 @@ void rtc_clk_32k_enable_external(void) rtc_clk_32k_enable_common(CLK_LL_XTAL32K_ENABLE_MODE_EXTERNAL); } +void rtc_clk_32k_disable_external(void) +{ + clk_ll_xtal32k_disable(); +} + /* Helping external 32kHz crystal to start up. * External crystal connected to outputs GPIO32 GPIO33. * Forms N pulses with a frequency of about 32KHz on the outputs of the crystal. diff --git a/components/esp_hw_support/port/esp32c2/rtc_clk.c b/components/esp_hw_support/port/esp32c2/rtc_clk.c index 4d052444990..5f1d03d04b5 100644 --- a/components/esp_hw_support/port/esp32c2/rtc_clk.c +++ b/components/esp_hw_support/port/esp32c2/rtc_clk.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -36,6 +36,12 @@ void rtc_clk_32k_enable_external(void) REG_SET_BIT(RTC_CNTL_PAD_HOLD_REG, BIT(EXT_OSC_SLOW_GPIO_NUM)); } +void rtc_clk_32k_disable_external(void) +{ + PIN_INPUT_DISABLE(IO_MUX_GPIO0_REG); + REG_CLR_BIT(RTC_CNTL_PAD_HOLD_REG, BIT(EXT_OSC_SLOW_GPIO_NUM)); +} + void rtc_clk_8m_enable(bool clk_8m_en, bool d256_en) { if (clk_8m_en) { diff --git a/components/esp_hw_support/port/esp32c3/rtc_clk.c b/components/esp_hw_support/port/esp32c3/rtc_clk.c index b505f7bf175..d1c26849011 100644 --- a/components/esp_hw_support/port/esp32c3/rtc_clk.c +++ b/components/esp_hw_support/port/esp32c3/rtc_clk.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -55,6 +55,13 @@ void rtc_clk_32k_enable_external(void) clk_ll_xtal32k_enable(CLK_LL_XTAL32K_ENABLE_MODE_EXTERNAL); } +void rtc_clk_32k_disable_external(void) +{ + PIN_INPUT_DISABLE(IO_MUX_GPIO0_REG); + CLEAR_PERI_REG_MASK(RTC_CNTL_PAD_HOLD_REG, RTC_CNTL_GPIO_PIN0_HOLD); + clk_ll_xtal32k_disable(); +} + void rtc_clk_32k_bootstrap(uint32_t cycle) { /* No special bootstrapping needed for ESP32-C3, 'cycle' argument is to keep the signature diff --git a/components/esp_hw_support/port/esp32c6/rtc_clk.c b/components/esp_hw_support/port/esp32c6/rtc_clk.c index 735ca711032..f55d4038035 100644 --- a/components/esp_hw_support/port/esp32c6/rtc_clk.c +++ b/components/esp_hw_support/port/esp32c6/rtc_clk.c @@ -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 */ @@ -61,6 +61,13 @@ void rtc_clk_32k_enable_external(void) clk_ll_xtal32k_enable(CLK_LL_XTAL32K_ENABLE_MODE_EXTERNAL); } +void rtc_clk_32k_disable_external(void) +{ + PIN_INPUT_DISABLE(IO_MUX_GPIO0_REG); + REG_CLR_BIT(LP_AON_GPIO_HOLD0_REG, BIT(EXT_OSC_SLOW_GPIO_NUM)); + clk_ll_xtal32k_disable(); +} + void rtc_clk_32k_bootstrap(uint32_t cycle) { /* No special bootstrapping needed for ESP32-C6, 'cycle' argument is to keep the signature diff --git a/components/esp_hw_support/port/esp32h2/rtc_clk.c b/components/esp_hw_support/port/esp32h2/rtc_clk.c index 8b94a7aeab7..bee509acb24 100644 --- a/components/esp_hw_support/port/esp32h2/rtc_clk.c +++ b/components/esp_hw_support/port/esp32h2/rtc_clk.c @@ -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 */ @@ -62,6 +62,13 @@ void rtc_clk_32k_enable_external(void) clk_ll_xtal32k_enable(CLK_LL_XTAL32K_ENABLE_MODE_EXTERNAL); } +void rtc_clk_32k_disable_external(void) +{ + PIN_INPUT_DISABLE(IO_MUX_GPIO13_REG); + REG_CLR_BIT(LP_AON_GPIO_HOLD0_REG, BIT(EXT_OSC_SLOW_GPIO_NUM)); + clk_ll_xtal32k_disable(); +} + void rtc_clk_32k_bootstrap(uint32_t cycle) { /* No special bootstrapping needed for ESP32-H2, 'cycle' argument is to keep the signature diff --git a/components/esp_hw_support/port/esp32s2/rtc_clk.c b/components/esp_hw_support/port/esp32s2/rtc_clk.c index 75558b8f50a..8fb6c073ebd 100644 --- a/components/esp_hw_support/port/esp32s2/rtc_clk.c +++ b/components/esp_hw_support/port/esp32s2/rtc_clk.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -48,6 +48,13 @@ void rtc_clk_32k_enable_external(void) clk_ll_xtal32k_enable(CLK_LL_XTAL32K_ENABLE_MODE_EXTERNAL); } +void rtc_clk_32k_disable_external(void) +{ + CLEAR_PERI_REG_MASK(RTC_IO_XTAL_32P_PAD_REG, RTC_IO_X32P_MUX_SEL); + CLEAR_PERI_REG_MASK(RTC_IO_XTAL_32N_PAD_REG, RTC_IO_X32N_MUX_SEL); + clk_ll_xtal32k_disable(); +} + void rtc_clk_32k_bootstrap(uint32_t cycle) { /* No special bootstrapping needed for ESP32-S2, 'cycle' argument is to keep the signature diff --git a/components/esp_hw_support/port/esp32s3/rtc_clk.c b/components/esp_hw_support/port/esp32s3/rtc_clk.c index 8cef1c484da..72a6c0c3e77 100644 --- a/components/esp_hw_support/port/esp32s3/rtc_clk.c +++ b/components/esp_hw_support/port/esp32s3/rtc_clk.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -71,6 +71,13 @@ void rtc_clk_32k_enable_external(void) clk_ll_xtal32k_enable(CLK_LL_XTAL32K_ENABLE_MODE_EXTERNAL); } +void rtc_clk_32k_disable_external(void) +{ + PIN_INPUT_DISABLE(IO_MUX_GPIO15_REG); + CLEAR_PERI_REG_MASK(RTC_CNTL_PAD_HOLD_REG, RTC_CNTL_X32P_HOLD); + clk_ll_xtal32k_disable(); +} + void rtc_clk_32k_bootstrap(uint32_t cycle) { /* No special bootstrapping needed for ESP32-S3, 'cycle' argument is to keep the signature diff --git a/components/esp_system/port/soc/esp32/clk.c b/components/esp_system/port/soc/esp32/clk.c index 6255650effd..20382e6fecf 100644 --- a/components/esp_system/port/soc/esp32/clk.c +++ b/components/esp_system/port/soc/esp32/clk.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -91,7 +91,13 @@ static void select_rtc_slow_clk(slow_clk_sel_t slow_clk) rtc_clk_8m_enable(true, true); } rtc_clk_slow_src_set(rtc_slow_clk_src); - + if (rtc_slow_clk_src != SOC_RTC_SLOW_CLK_SRC_XTAL32K) { + if (slow_clk == SLOW_CLK_32K_XTAL) { + rtc_clk_32k_enable(false); + } else if (slow_clk == SLOW_CLK_32K_EXT_OSC) { + rtc_clk_32k_disable_external(); + } + } if (SLOW_CLK_CAL_CYCLES > 0) { /* TODO: 32k XTAL oscillator has some frequency drift at startup. * Improve calibration routine to wait until the frequency is stable. diff --git a/components/esp_system/port/soc/esp32c2/clk.c b/components/esp_system/port/soc/esp32c2/clk.c index a89003e1db2..3ecbd7e9c28 100644 --- a/components/esp_system/port/soc/esp32c2/clk.c +++ b/components/esp_system/port/soc/esp32c2/clk.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -179,7 +179,9 @@ static void select_rtc_slow_clk(slow_clk_sel_t slow_clk) rtc_clk_8m_enable(true, true); } rtc_clk_slow_src_set(rtc_slow_clk_src); - + if (rtc_slow_clk_src != SOC_RTC_SLOW_CLK_SRC_OSC_SLOW) { + rtc_clk_32k_disable_external(); + } if (SLOW_CLK_CAL_CYCLES > 0) { /* TODO: 32k XTAL oscillator has some frequency drift at startup. * Improve calibration routine to wait until the frequency is stable. diff --git a/components/esp_system/port/soc/esp32c3/clk.c b/components/esp_system/port/soc/esp32c3/clk.c index 55df575acd9..58ac5c90d70 100644 --- a/components/esp_system/port/soc/esp32c3/clk.c +++ b/components/esp_system/port/soc/esp32c3/clk.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -174,7 +174,13 @@ static void select_rtc_slow_clk(slow_clk_sel_t slow_clk) rtc_clk_8m_enable(true, true); } rtc_clk_slow_src_set(rtc_slow_clk_src); - + if (rtc_slow_clk_src != SOC_RTC_SLOW_CLK_SRC_XTAL32K) { + if (slow_clk == SLOW_CLK_32K_XTAL) { + rtc_clk_32k_enable(false); + } else if (slow_clk == SLOW_CLK_32K_EXT_OSC) { + rtc_clk_32k_disable_external(); + } + } if (SLOW_CLK_CAL_CYCLES > 0) { /* TODO: 32k XTAL oscillator has some frequency drift at startup. * Improve calibration routine to wait until the frequency is stable. diff --git a/components/esp_system/port/soc/esp32c6/clk.c b/components/esp_system/port/soc/esp32c6/clk.c index 3c04d8b0d18..6a679bce0f5 100644 --- a/components/esp_system/port/soc/esp32c6/clk.c +++ b/components/esp_system/port/soc/esp32c6/clk.c @@ -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 */ @@ -163,12 +163,14 @@ static void select_rtc_slow_clk(soc_rtc_slow_clk_src_t rtc_slow_clk_src) rtc_clk_rc32k_enable(true); } rtc_clk_slow_src_set(rtc_slow_clk_src); - // Disable unused clock sources after clock source switching is complete. // Regardless of the clock source selection, the internal 136K clock source will always keep on. - if (rtc_slow_clk_src != SOC_RTC_SLOW_CLK_SRC_XTAL32K && rtc_slow_clk_src != SOC_RTC_SLOW_CLK_SRC_OSC_SLOW) { + if (rtc_slow_clk_src != SOC_RTC_SLOW_CLK_SRC_XTAL32K) { rtc_clk_32k_enable(false); } + if (rtc_slow_clk_src != SOC_RTC_SLOW_CLK_SRC_OSC_SLOW) { + rtc_clk_32k_disable_external(); + } if (rtc_slow_clk_src != SOC_RTC_SLOW_CLK_SRC_RC32K) { rtc_clk_rc32k_enable(false); } diff --git a/components/esp_system/port/soc/esp32h2/clk.c b/components/esp_system/port/soc/esp32h2/clk.c index 84a248e80e8..bdc1bcb88a7 100644 --- a/components/esp_system/port/soc/esp32h2/clk.c +++ b/components/esp_system/port/soc/esp32h2/clk.c @@ -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 */ @@ -164,12 +164,14 @@ static void select_rtc_slow_clk(soc_rtc_slow_clk_src_t rtc_slow_clk_src) rtc_clk_rc32k_enable(true); } rtc_clk_slow_src_set(rtc_slow_clk_src); - // Disable unused clock sources after clock source switching is complete. // Regardless of the clock source selection, the internal 136K clock source will always keep on. - if (rtc_slow_clk_src != SOC_RTC_SLOW_CLK_SRC_XTAL32K && rtc_slow_clk_src != SOC_RTC_SLOW_CLK_SRC_OSC_SLOW) { + if (rtc_slow_clk_src != SOC_RTC_SLOW_CLK_SRC_XTAL32K) { rtc_clk_32k_enable(false); } + if (rtc_slow_clk_src != SOC_RTC_SLOW_CLK_SRC_OSC_SLOW) { + rtc_clk_32k_disable_external(); + } if (rtc_slow_clk_src != SOC_RTC_SLOW_CLK_SRC_RC32K) { rtc_clk_rc32k_enable(false); } diff --git a/components/esp_system/port/soc/esp32s2/clk.c b/components/esp_system/port/soc/esp32s2/clk.c index 8905210bb37..556c96206c5 100644 --- a/components/esp_system/port/soc/esp32s2/clk.c +++ b/components/esp_system/port/soc/esp32s2/clk.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -180,7 +180,13 @@ static void select_rtc_slow_clk(slow_clk_sel_t slow_clk) rtc_clk_8m_enable(true, true); } rtc_clk_slow_src_set(rtc_slow_clk_src); - + if (rtc_slow_clk_src != SOC_RTC_SLOW_CLK_SRC_XTAL32K) { + if (slow_clk == SLOW_CLK_32K_XTAL) { + rtc_clk_32k_enable(false); + } else if (slow_clk == SLOW_CLK_32K_EXT_OSC) { + rtc_clk_32k_disable_external(); + } + } if (SLOW_CLK_CAL_CYCLES > 0) { /* TODO: 32k XTAL oscillator has some frequency drift at startup. * Improve calibration routine to wait until the frequency is stable. diff --git a/components/esp_system/port/soc/esp32s3/clk.c b/components/esp_system/port/soc/esp32s3/clk.c index d54cea62ee9..b31d2ec6428 100644 --- a/components/esp_system/port/soc/esp32s3/clk.c +++ b/components/esp_system/port/soc/esp32s3/clk.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -176,7 +176,13 @@ static void select_rtc_slow_clk(slow_clk_sel_t slow_clk) rtc_clk_8m_enable(true, true); } rtc_clk_slow_src_set(rtc_slow_clk_src); - + if (rtc_slow_clk_src != SOC_RTC_SLOW_CLK_SRC_XTAL32K) { + if (slow_clk == SLOW_CLK_32K_XTAL) { + rtc_clk_32k_enable(false); + } else if (slow_clk == SLOW_CLK_32K_EXT_OSC) { + rtc_clk_32k_disable_external(); + } + } if (SLOW_CLK_CAL_CYCLES > 0) { /* TODO: 32k XTAL oscillator has some frequency drift at startup. * Improve calibration routine to wait until the frequency is stable. diff --git a/components/soc/esp32/include/soc/rtc.h b/components/soc/esp32/include/soc/rtc.h index f36fb969073..efa692d6fea 100644 --- a/components/soc/esp32/include/soc/rtc.h +++ b/components/soc/esp32/include/soc/rtc.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -179,6 +179,11 @@ void rtc_clk_32k_enable(bool en); */ void rtc_clk_32k_enable_external(void); +/** + * @brief Disable 32 kHz XTAL oscillator input. + */ +void rtc_clk_32k_disable_external(void); + /** * @brief Get the state of 32k XTAL oscillator * @return true if 32k XTAL oscillator has been enabled diff --git a/components/soc/esp32c2/include/soc/rtc.h b/components/soc/esp32c2/include/soc/rtc.h index 93cea4dbd60..d8b3c1897cc 100644 --- a/components/soc/esp32c2/include/soc/rtc.h +++ b/components/soc/esp32c2/include/soc/rtc.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -263,6 +263,11 @@ void rtc_clk_xtal_freq_update(rtc_xtal_freq_t xtal_freq); */ void rtc_clk_32k_enable_external(void); +/** + * @brief Disable 32KHz external oscillator + */ +void rtc_clk_32k_disable_external(void); + /** * @brief Enable or disable 8 MHz internal oscillator * diff --git a/components/soc/esp32c3/include/soc/rtc.h b/components/soc/esp32c3/include/soc/rtc.h index 76b849af096..3e91b64bbfd 100644 --- a/components/soc/esp32c3/include/soc/rtc.h +++ b/components/soc/esp32c3/include/soc/rtc.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -268,6 +268,11 @@ void rtc_clk_32k_enable(bool en); */ void rtc_clk_32k_enable_external(void); +/** + * @brief Disable 32 kHz XTAL oscillator input. + */ +void rtc_clk_32k_disable_external(void); + /** * @brief Get the state of 32k XTAL oscillator * @return true if 32k XTAL oscillator has been enabled diff --git a/components/soc/esp32c6/include/soc/rtc.h b/components/soc/esp32c6/include/soc/rtc.h index 44ed7082170..46fb2c978ae 100644 --- a/components/soc/esp32c6/include/soc/rtc.h +++ b/components/soc/esp32c6/include/soc/rtc.h @@ -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 */ @@ -235,6 +235,11 @@ void rtc_clk_32k_enable(bool en); */ void rtc_clk_32k_enable_external(void); +/** + * @brief Disable 32 kHz XTAL oscillator input. + */ +void rtc_clk_32k_disable_external(void); + /** * @brief Get the state of 32k XTAL oscillator * @return true if 32k XTAL oscillator has been enabled diff --git a/components/soc/esp32h2/include/soc/rtc.h b/components/soc/esp32h2/include/soc/rtc.h index 44a2dd8e0f8..3c6010db029 100644 --- a/components/soc/esp32h2/include/soc/rtc.h +++ b/components/soc/esp32h2/include/soc/rtc.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -237,6 +237,11 @@ void rtc_clk_32k_enable(bool en); */ void rtc_clk_32k_enable_external(void); +/** + * @brief Disable 32 kHz XTAL oscillator input. + */ +void rtc_clk_32k_disable_external(void); + /** * @brief Get the state of 32k XTAL oscillator * @return true if 32k XTAL oscillator has been enabled diff --git a/components/soc/esp32p4/include/soc/rtc.h b/components/soc/esp32p4/include/soc/rtc.h index f81d22c2056..558b033b1d5 100644 --- a/components/soc/esp32p4/include/soc/rtc.h +++ b/components/soc/esp32p4/include/soc/rtc.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -234,6 +234,11 @@ void rtc_clk_32k_enable(bool en); */ void rtc_clk_32k_enable_external(void); +/** + * @brief Disable 32 kHz XTAL oscillator input. + */ +void rtc_clk_32k_disable_external(void); + /** * @brief Get the state of 32k XTAL oscillator * @return true if 32k XTAL oscillator has been enabled diff --git a/components/soc/esp32s2/include/soc/rtc.h b/components/soc/esp32s2/include/soc/rtc.h index 41ecd2faf0a..3a333fa379c 100644 --- a/components/soc/esp32s2/include/soc/rtc.h +++ b/components/soc/esp32s2/include/soc/rtc.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -263,6 +263,11 @@ void rtc_clk_32k_enable(bool en); */ void rtc_clk_32k_enable_external(void); +/** + * @brief Disable 32 kHz XTAL oscillator input. + */ +void rtc_clk_32k_disable_external(void); + /** * @brief Get the state of 32k XTAL oscillator * @return true if 32k XTAL oscillator has been enabled diff --git a/components/soc/esp32s3/include/soc/rtc.h b/components/soc/esp32s3/include/soc/rtc.h index 21f31547085..e1b34178bac 100644 --- a/components/soc/esp32s3/include/soc/rtc.h +++ b/components/soc/esp32s3/include/soc/rtc.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -283,7 +283,12 @@ void rtc_clk_32k_enable(bool en); void rtc_clk_32k_enable_external(void); /** - * @brief Get the state of 32k XTAL oscillator + * @brief Disable 32 kHz XTAL oscillator input. + */ +void rtc_clk_32k_disable_external(void); + +/** + * @brief Get the state of 32k XTAL oscillators * @return true if 32k XTAL oscillator has been enabled */ bool rtc_clk_32k_enabled(void);