diff --git a/components/esp_driver_gpio/src/gpio.c b/components/esp_driver_gpio/src/gpio.c index c1ced24ac9..63e106e94f 100644 --- a/components/esp_driver_gpio/src/gpio.c +++ b/components/esp_driver_gpio/src/gpio.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -1017,11 +1017,11 @@ esp_err_t gpio_sleep_sel_dis(gpio_num_t gpio_num) return ESP_OK; } -#if SOC_GPIO_SUPPORT_HP_PERIPH_PD_SLEEP_WAKEUP && SOC_DEEP_SLEEP_SUPPORTED +#if SOC_GPIO_SUPPORT_HP_PERIPH_PD_SLEEP_WAKEUP esp_err_t gpio_wakeup_enable_on_hp_periph_powerdown_sleep(gpio_num_t gpio_num, gpio_int_type_t intr_type) { if (!GPIO_IS_HP_PERIPH_PD_WAKEUP_VALID_IO(gpio_num)) { - ESP_LOGE(GPIO_TAG, "GPIO %d does not support deep sleep wakeup", gpio_num); + ESP_LOGE(GPIO_TAG, "GPIO %d does not support wakeup on peripheral powerdown sleep", gpio_num); return ESP_ERR_INVALID_ARG; } if ((intr_type != GPIO_INTR_LOW_LEVEL) && (intr_type != GPIO_INTR_HIGH_LEVEL)) { @@ -1032,7 +1032,7 @@ esp_err_t gpio_wakeup_enable_on_hp_periph_powerdown_sleep(gpio_num_t gpio_num, g #if SOC_LP_IO_CLOCK_IS_INDEPENDENT io_mux_enable_lp_io_clock(gpio_num, true); #endif - gpio_hal_deepsleep_wakeup_enable(gpio_context.gpio_hal, gpio_num, intr_type); + gpio_hal_wakeup_enable_on_hp_periph_powerdown_sleep(gpio_context.gpio_hal, gpio_num, intr_type); #if CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND || CONFIG_PM_SLP_DISABLE_GPIO gpio_hal_sleep_sel_dis(gpio_context.gpio_hal, gpio_num); #endif @@ -1043,11 +1043,11 @@ esp_err_t gpio_wakeup_enable_on_hp_periph_powerdown_sleep(gpio_num_t gpio_num, g esp_err_t gpio_wakeup_disable_on_hp_periph_powerdown_sleep(gpio_num_t gpio_num) { if (!GPIO_IS_HP_PERIPH_PD_WAKEUP_VALID_IO(gpio_num)) { - ESP_LOGE(GPIO_TAG, "GPIO %d does not support deep sleep wakeup", gpio_num); + ESP_LOGE(GPIO_TAG, "GPIO %d does not support wakeup on peripheral powerdown sleep", gpio_num); return ESP_ERR_INVALID_ARG; } portENTER_CRITICAL(&gpio_context.gpio_spinlock); - gpio_hal_deepsleep_wakeup_disable(gpio_context.gpio_hal, gpio_num); + gpio_hal_wakeup_disable_on_hp_periph_powerdown_sleep(gpio_context.gpio_hal, gpio_num); #if CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND || CONFIG_PM_SLP_DISABLE_GPIO gpio_hal_sleep_sel_en(gpio_context.gpio_hal, gpio_num); #endif diff --git a/components/esp_hal_gpio/esp32c2/include/hal/gpio_ll.h b/components/esp_hal_gpio/esp32c2/include/hal/gpio_ll.h index d7d6f5691f..33efd2cd6e 100644 --- a/components/esp_hal_gpio/esp32c2/include/hal/gpio_ll.h +++ b/components/esp_hal_gpio/esp32c2/include/hal/gpio_ll.h @@ -687,13 +687,13 @@ static inline void gpio_ll_sleep_output_enable(gpio_dev_t *hw, uint32_t gpio_num } /** - * @brief Enable GPIO deep-sleep wake-up function. + * @brief Enable GPIO wake-up on HP periph powerdown sleep function. * * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number. * @param intr_type GPIO wake-up type. Only GPIO_INTR_LOW_LEVEL or GPIO_INTR_HIGH_LEVEL can be used. */ -static inline void gpio_ll_deepsleep_wakeup_enable(gpio_dev_t *hw, uint32_t gpio_num, gpio_int_type_t intr_type) +static inline void gpio_ll_wakeup_enable_on_hp_periph_powerdown_sleep(gpio_dev_t *hw, uint32_t gpio_num, gpio_int_type_t intr_type) { HAL_ASSERT(gpio_num <= GPIO_NUM_5 && "gpio larger than 5 does not support deep sleep wake-up function"); @@ -707,12 +707,12 @@ static inline void gpio_ll_deepsleep_wakeup_enable(gpio_dev_t *hw, uint32_t gpio } /** - * @brief Disable GPIO deep-sleep wake-up function. + * @brief Disable GPIO wake-up on HP periph powerdown sleep function. * * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number */ -static inline void gpio_ll_deepsleep_wakeup_disable(gpio_dev_t *hw, uint32_t gpio_num) +static inline void gpio_ll_wakeup_disable_on_hp_periph_powerdown_sleep(gpio_dev_t *hw, uint32_t gpio_num) { HAL_ASSERT(gpio_num <= GPIO_NUM_5 && "gpio larger than 5 does not support deep sleep wake-up function"); @@ -721,13 +721,13 @@ static inline void gpio_ll_deepsleep_wakeup_disable(gpio_dev_t *hw, uint32_t gpi } /** - * @brief Get the status of whether an IO is used for deep-sleep wake-up. + * @brief Get the status of whether an IO is used for HP periph powerdown sleep wake-up. * * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number - * @return True if the pin is enabled to wake up from deep-sleep + * @return True if the pin is enabled to wake up from HP periph powerdown sleep. */ -static inline bool gpio_ll_deepsleep_wakeup_is_enabled(gpio_dev_t *hw, uint32_t gpio_num) +static inline bool gpio_ll_hp_periph_powerdown_sleep_wakeup_is_enabled(gpio_dev_t *hw, uint32_t gpio_num) { HAL_ASSERT(gpio_num <= GPIO_NUM_5 && "gpio larger than 5 does not support deep sleep wake-up function"); diff --git a/components/esp_hal_gpio/esp32c3/include/hal/gpio_ll.h b/components/esp_hal_gpio/esp32c3/include/hal/gpio_ll.h index 9171e5c2f1..ee017567c6 100644 --- a/components/esp_hal_gpio/esp32c3/include/hal/gpio_ll.h +++ b/components/esp_hal_gpio/esp32c3/include/hal/gpio_ll.h @@ -684,13 +684,13 @@ static inline void gpio_ll_sleep_output_enable(gpio_dev_t *hw, uint32_t gpio_num } /** - * @brief Enable GPIO deep-sleep wake-up function. + * @brief Enable GPIO wake-up on HP periph powerdown sleep function. * * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number. * @param intr_type GPIO wake-up type. Only GPIO_INTR_LOW_LEVEL or GPIO_INTR_HIGH_LEVEL can be used. */ -static inline void gpio_ll_deepsleep_wakeup_enable(gpio_dev_t *hw, uint32_t gpio_num, gpio_int_type_t intr_type) +static inline void gpio_ll_wakeup_enable_on_hp_periph_powerdown_sleep(gpio_dev_t *hw, uint32_t gpio_num, gpio_int_type_t intr_type) { HAL_ASSERT(gpio_num <= GPIO_NUM_5 && "gpio larger than 5 does not support deep sleep wake-up function"); @@ -704,12 +704,12 @@ static inline void gpio_ll_deepsleep_wakeup_enable(gpio_dev_t *hw, uint32_t gpio } /** - * @brief Disable GPIO deep-sleep wake-up function. + * @brief Disable GPIO wake-up on HP periph powerdown sleep function. * * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number */ -static inline void gpio_ll_deepsleep_wakeup_disable(gpio_dev_t *hw, uint32_t gpio_num) +static inline void gpio_ll_wakeup_disable_on_hp_periph_powerdown_sleep(gpio_dev_t *hw, uint32_t gpio_num) { HAL_ASSERT(gpio_num <= GPIO_NUM_5 && "gpio larger than 5 does not support deep sleep wake-up function"); @@ -718,13 +718,13 @@ static inline void gpio_ll_deepsleep_wakeup_disable(gpio_dev_t *hw, uint32_t gpi } /** - * @brief Get the status of whether an IO is used for deep-sleep wake-up. + * @brief Get the status of whether an IO is used for HP periph powerdown sleep wake-up. * * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number - * @return True if the pin is enabled to wake up from deep-sleep + * @return True if the pin is enabled to wake up from HP periph powerdown sleep. */ -static inline bool gpio_ll_deepsleep_wakeup_is_enabled(gpio_dev_t *hw, uint32_t gpio_num) +static inline bool gpio_ll_hp_periph_powerdown_sleep_wakeup_is_enabled(gpio_dev_t *hw, uint32_t gpio_num) { HAL_ASSERT(gpio_num <= GPIO_NUM_5 && "gpio larger than 5 does not support deep sleep wake-up function"); diff --git a/components/esp_hal_gpio/esp32h2/include/hal/gpio_ll.h b/components/esp_hal_gpio/esp32h2/include/hal/gpio_ll.h index 91ae29b5ad..72a9d23d34 100644 --- a/components/esp_hal_gpio/esp32h2/include/hal/gpio_ll.h +++ b/components/esp_hal_gpio/esp32h2/include/hal/gpio_ll.h @@ -728,13 +728,13 @@ static inline void gpio_ll_sleep_output_enable(gpio_dev_t *hw, uint32_t gpio_num } /** - * @brief Enable GPIO deep-sleep wake-up function. + * @brief Enable GPIO wake-up on HP periph powerdown sleep function. * * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number. * @param intr_type GPIO wake-up type. Only GPIO_INTR_LOW_LEVEL or GPIO_INTR_HIGH_LEVEL can be used. */ -static inline void gpio_ll_deepsleep_wakeup_enable(gpio_dev_t *hw, uint32_t gpio_num, gpio_int_type_t intr_type) +static inline void gpio_ll_wakeup_enable_on_hp_periph_powerdown_sleep(gpio_dev_t *hw, uint32_t gpio_num, gpio_int_type_t intr_type) { HAL_ASSERT((gpio_num >= GPIO_NUM_7 && gpio_num <= GPIO_NUM_14) && "only gpio7~14 support deep sleep wake-up function"); @@ -756,12 +756,12 @@ static inline void gpio_ll_deepsleep_wakeup_enable(gpio_dev_t *hw, uint32_t gpio } /** - * @brief Disable GPIO deep-sleep wake-up function. + * @brief Disable GPIO wake-up on HP periph powerdown sleep function. * * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number */ -static inline void gpio_ll_deepsleep_wakeup_disable(gpio_dev_t *hw, uint32_t gpio_num) +static inline void gpio_ll_wakeup_disable_on_hp_periph_powerdown_sleep(gpio_dev_t *hw, uint32_t gpio_num) { HAL_ASSERT((gpio_num >= GPIO_NUM_7 && gpio_num <= GPIO_NUM_14) && "only gpio7~14 support deep sleep wake-up function"); @@ -772,13 +772,13 @@ static inline void gpio_ll_deepsleep_wakeup_disable(gpio_dev_t *hw, uint32_t gpi } /** - * @brief Get the status of whether an IO is used for deep-sleep wake-up. + * @brief Get the status of whether an IO is used for HP periph powerdown sleep wake-up. * * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number - * @return True if the pin is enabled to wake up from deep-sleep + * @return True if the pin is enabled to wake up from HP periph powerdown sleep. */ -static inline bool gpio_ll_deepsleep_wakeup_is_enabled(gpio_dev_t *hw, uint32_t gpio_num) +static inline bool gpio_ll_hp_periph_powerdown_sleep_wakeup_is_enabled(gpio_dev_t *hw, uint32_t gpio_num) { HAL_ASSERT((gpio_num >= GPIO_NUM_7 && gpio_num <= GPIO_NUM_14) && "only gpio7~14 support deep sleep wake-up function"); diff --git a/components/esp_hal_gpio/esp32h21/include/hal/gpio_ll.h b/components/esp_hal_gpio/esp32h21/include/hal/gpio_ll.h index 32d7a2a541..82d98b5343 100644 --- a/components/esp_hal_gpio/esp32h21/include/hal/gpio_ll.h +++ b/components/esp_hal_gpio/esp32h21/include/hal/gpio_ll.h @@ -712,13 +712,13 @@ static inline void gpio_ll_sleep_output_enable(gpio_dev_t *hw, uint32_t gpio_num } /** - * @brief Enable GPIO deep-sleep wake-up function. + * @brief Enable GPIO wake-up on HP periph powerdown sleep function. * * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number. * @param intr_type GPIO wake-up type. Only GPIO_INTR_LOW_LEVEL or GPIO_INTR_HIGH_LEVEL can be used. */ -static inline void gpio_ll_deepsleep_wakeup_enable(gpio_dev_t *hw, uint32_t gpio_num, gpio_int_type_t intr_type) +static inline void gpio_ll_wakeup_enable_on_hp_periph_powerdown_sleep(gpio_dev_t *hw, uint32_t gpio_num, gpio_int_type_t intr_type) { HAL_ASSERT((gpio_num >= GPIO_NUM_5 && gpio_num <= GPIO_NUM_11) && "only gpio5~11 support deep sleep wake-up function"); @@ -740,12 +740,12 @@ static inline void gpio_ll_deepsleep_wakeup_enable(gpio_dev_t *hw, uint32_t gpio } /** - * @brief Disable GPIO deep-sleep wake-up function. + * @brief Disable GPIO wake-up on HP periph powerdown sleep function. * * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number */ -static inline void gpio_ll_deepsleep_wakeup_disable(gpio_dev_t *hw, uint32_t gpio_num) +static inline void gpio_ll_wakeup_disable_on_hp_periph_powerdown_sleep(gpio_dev_t *hw, uint32_t gpio_num) { HAL_ASSERT((gpio_num >= GPIO_NUM_5 && gpio_num <= GPIO_NUM_11) && "only gpio5~11 support deep sleep wake-up function"); @@ -756,13 +756,13 @@ static inline void gpio_ll_deepsleep_wakeup_disable(gpio_dev_t *hw, uint32_t gpi } /** - * @brief Get the status of whether an IO is used for deep-sleep wake-up. + * @brief Get the status of whether an IO is used for HP periph powerdown sleep wake-up. * * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number - * @return True if the pin is enabled to wake up from deep-sleep + * @return True if the pin is enabled to wake up from HP periph powerdown sleep. */ -static inline bool gpio_ll_deepsleep_wakeup_is_enabled(gpio_dev_t *hw, uint32_t gpio_num) +static inline bool gpio_ll_hp_periph_powerdown_sleep_wakeup_is_enabled(gpio_dev_t *hw, uint32_t gpio_num) { HAL_ASSERT((gpio_num >= GPIO_NUM_5 && gpio_num <= GPIO_NUM_11) && "only gpio5~11 support deep sleep wake-up function"); diff --git a/components/esp_hal_gpio/include/hal/gpio_hal.h b/components/esp_hal_gpio/include/hal/gpio_hal.h index 80fe43a33a..4613cbb77d 100644 --- a/components/esp_hal_gpio/include/hal/gpio_hal.h +++ b/components/esp_hal_gpio/include/hal/gpio_hal.h @@ -497,33 +497,33 @@ void gpio_hal_matrix_out(gpio_hal_context_t *hal, uint32_t gpio_num, uint32_t si */ #define gpio_hal_sleep_output_enable(hal, gpio_num) gpio_ll_sleep_output_enable((hal)->dev, gpio_num) -#if SOC_GPIO_SUPPORT_HP_PERIPH_PD_SLEEP_WAKEUP && (SOC_RTCIO_PIN_COUNT == 0) && SOC_DEEP_SLEEP_SUPPORTED +#if SOC_GPIO_SUPPORT_HP_PERIPH_PD_SLEEP_WAKEUP && (SOC_RTCIO_PIN_COUNT == 0) /** - * @brief Enable GPIO deep-sleep wake-up function. + * @brief Enable GPIO HP periph powerdown sleep wake-up function. * * @param hal Context of the HAL layer * @param gpio_num GPIO number. * @param intr_type GPIO wake-up type. Only GPIO_INTR_LOW_LEVEL or GPIO_INTR_HIGH_LEVEL can be used. */ -#define gpio_hal_deepsleep_wakeup_enable(hal, gpio_num, intr_type) gpio_ll_deepsleep_wakeup_enable((hal)->dev, gpio_num, intr_type) +#define gpio_hal_wakeup_enable_on_hp_periph_powerdown_sleep(hal, gpio_num, intr_type) gpio_ll_wakeup_enable_on_hp_periph_powerdown_sleep((hal)->dev, gpio_num, intr_type) /** - * @brief Disable GPIO deep-sleep wake-up function. + * @brief Disable GPIO HP periph powerdown sleep wake-up function. * * @param hal Context of the HAL layer * @param gpio_num GPIO number */ -#define gpio_hal_deepsleep_wakeup_disable(hal, gpio_num) gpio_ll_deepsleep_wakeup_disable((hal)->dev, gpio_num) +#define gpio_hal_wakeup_disable_on_hp_periph_powerdown_sleep(hal, gpio_num) gpio_ll_wakeup_disable_on_hp_periph_powerdown_sleep((hal)->dev, gpio_num) /** - * @brief Get the status of whether an IO is used for deep-sleep wake-up. + * @brief Get the status of whether an IO is used for HP periph powerdown sleep wake-up. * * @param hal Context of the HAL layer * @param gpio_num GPIO number * - * @return True if the pin is enabled to wake up from deep-sleep + * @return True if the pin is enabled to wake up from HP periph powerdown sleep */ -#define gpio_hal_deepsleep_wakeup_is_enabled(hal, gpio_num) gpio_ll_deepsleep_wakeup_is_enabled((hal)->dev, gpio_num) +#define gpio_hal_wakeup_is_enabled_on_hp_periph_powerdown_sleep(hal, gpio_num) gpio_ll_hp_periph_powerdown_sleep_wakeup_is_enabled((hal)->dev, gpio_num) #endif //SOC_GPIO_SUPPORT_HP_PERIPH_PD_SLEEP_WAKEUP && (SOC_RTCIO_PIN_COUNT == 0) #if SOC_GPIO_SUPPORT_PIN_HYS_FILTER diff --git a/components/esp_hal_gpio/include/hal/rtc_io_hal.h b/components/esp_hal_gpio/include/hal/rtc_io_hal.h index bdfa4600f2..ada68f6ab5 100644 --- a/components/esp_hal_gpio/include/hal/rtc_io_hal.h +++ b/components/esp_hal_gpio/include/hal/rtc_io_hal.h @@ -314,9 +314,9 @@ void rtcio_hal_isolate(int rtc_num); #if SOC_GPIO_SUPPORT_HP_PERIPH_PD_SLEEP_WAKEUP && (SOC_RTCIO_PIN_COUNT > 0) -#define gpio_hal_deepsleep_wakeup_enable(hal, gpio_num, intr_type) rtcio_hal_wakeup_enable(rtc_io_num_map[gpio_num], intr_type) -#define gpio_hal_deepsleep_wakeup_disable(hal, gpio_num) rtcio_hal_wakeup_disable(rtc_io_num_map[gpio_num]) -#define gpio_hal_deepsleep_wakeup_is_enabled(hal, gpio_num) rtcio_hal_wakeup_is_enabled(rtc_io_num_map[gpio_num]) +#define gpio_hal_wakeup_enable_on_hp_periph_powerdown_sleep(hal, gpio_num, intr_type) rtcio_hal_wakeup_enable(rtc_io_num_map[gpio_num], intr_type) +#define gpio_hal_wakeup_disable_on_hp_periph_powerdown_sleep(hal, gpio_num) rtcio_hal_wakeup_disable(rtc_io_num_map[gpio_num]) +#define gpio_hal_wakeup_is_enabled_on_hp_periph_powerdown_sleep(hal, gpio_num) rtcio_hal_wakeup_is_enabled(rtc_io_num_map[gpio_num]) #define rtc_hal_gpio_get_wakeup_status() rtcio_hal_get_interrupt_status() #define rtc_hal_gpio_clear_wakeup_status() rtcio_hal_clear_interrupt_status() diff --git a/components/esp_hw_support/sleep_gpio.c b/components/esp_hw_support/sleep_gpio.c index cfd9229970..4e50ddc087 100644 --- a/components/esp_hw_support/sleep_gpio.c +++ b/components/esp_hw_support/sleep_gpio.c @@ -251,10 +251,10 @@ void esp_deep_sleep_wakeup_io_reset(void) }; while (dl_io_mask) { int gpio_num = __builtin_ffs(dl_io_mask) - 1; - bool wakeup_io_enabled = gpio_hal_deepsleep_wakeup_is_enabled(&gpio_hal, gpio_num); + bool wakeup_io_enabled = gpio_hal_wakeup_is_enabled_on_hp_periph_powerdown_sleep(&gpio_hal, gpio_num); if (wakeup_io_enabled) { // Disable the wakeup before releasing hold, such that wakeup status can reflect the correct wakeup pin - gpio_hal_deepsleep_wakeup_disable(&gpio_hal, gpio_num); + gpio_hal_wakeup_disable_on_hp_periph_powerdown_sleep(&gpio_hal, gpio_num); gpio_hal_hold_dis(&gpio_hal, gpio_num); } dl_io_mask &= ~BIT(gpio_num);