Skip to content

Commit 074035a

Browse files
committed
feat(esp_hw_support): support esp32p4 gpio wakeup deepsleep
1 parent 02e19c4 commit 074035a

File tree

10 files changed

+32
-3
lines changed

10 files changed

+32
-3
lines changed

components/esp_hw_support/include/esp_private/esp_pmu.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ typedef enum {
6262
#define RTC_EXT1_TRIG_EN 0
6363
#endif
6464

65-
#define RTC_GPIO_TRIG_EN PMU_GPIO_WAKEUP_EN //!< GPIO wakeup
65+
#if SOC_LP_IO_HAS_INDEPENDENT_WAKEUP_SOURCE
66+
#define RTC_GPIO_TRIG_EN (PMU_GPIO_WAKEUP_EN | PMU_LP_GPIO_WAKEUP_EN) //!< GPIO & LP_GPIO wakeup
67+
#else
68+
#define RTC_GPIO_TRIG_EN (PMU_GPIO_WAKEUP_EN)
69+
#endif
6670

6771
#if SOC_LP_TIMER_SUPPORTED
6872
#define RTC_TIMER_TRIG_EN PMU_LP_TIMER_WAKEUP_EN //!< Timer wakeup

components/esp_hw_support/sleep_modes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@ typedef struct {
217217
uint32_t ext0_rtc_gpio_num : 5;
218218
#endif
219219
#if SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP
220-
uint32_t gpio_wakeup_mask : 8; // 8 is the maximum RTCIO number in all chips that support GPIO wakeup
221-
uint32_t gpio_trigger_mode : 8;
220+
uint32_t gpio_wakeup_mask : SOC_GPIO_DEEP_SLEEP_WAKE_SUPPORTED_PIN_CNT; // Only RTC_GPIO supports wakeup deepsleep
221+
uint32_t gpio_trigger_mode : SOC_GPIO_DEEP_SLEEP_WAKE_SUPPORTED_PIN_CNT;
222222
#endif
223223
uint32_t sleep_time_adjustment;
224224
uint32_t ccount_ticks_record;

components/soc/esp32c2/include/soc/Kconfig.soc_caps.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@ config SOC_GPIO_DEEP_SLEEP_WAKE_VALID_GPIO_MASK
311311
int
312312
default 0
313313

314+
config SOC_GPIO_DEEP_SLEEP_WAKE_SUPPORTED_PIN_CNT
315+
int
316+
default 6
317+
314318
config SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK
315319
hex
316320
default 0x00000000001FFFC0

components/soc/esp32c2/include/soc/soc_caps.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
#define SOC_GPIO_OUT_RANGE_MAX 20
136136

137137
#define SOC_GPIO_DEEP_SLEEP_WAKE_VALID_GPIO_MASK (0ULL | BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | BIT5)
138+
#define SOC_GPIO_DEEP_SLEEP_WAKE_SUPPORTED_PIN_CNT (6)
138139

139140
// digital I/O pad powered by VDD3P3_CPU or VDD_SPI(GPIO_NUM_6~GPIO_NUM_20)
140141
#define SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK 0x00000000001FFFC0ULL

components/soc/esp32c3/include/soc/Kconfig.soc_caps.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,10 @@ config SOC_GPIO_DEEP_SLEEP_WAKE_VALID_GPIO_MASK
403403
int
404404
default 0
405405

406+
config SOC_GPIO_DEEP_SLEEP_WAKE_SUPPORTED_PIN_CNT
407+
int
408+
default 6
409+
406410
config SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK
407411
hex
408412
default 0x00000000003FFFC0

components/soc/esp32c3/include/soc/soc_caps.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@
173173
#define SOC_GPIO_OUT_RANGE_MAX 21
174174

175175
#define SOC_GPIO_DEEP_SLEEP_WAKE_VALID_GPIO_MASK (0ULL | BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | BIT5)
176+
#define SOC_GPIO_DEEP_SLEEP_WAKE_SUPPORTED_PIN_CNT (6)
176177

177178
// digital I/O pad powered by VDD3P3_CPU or VDD_SPI(GPIO_NUM_6~GPIO_NUM_21)
178179
#define SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK 0x00000000003FFFC0ULL

components/soc/esp32c6/include/soc/Kconfig.soc_caps.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,10 @@ config SOC_GPIO_DEEP_SLEEP_WAKE_VALID_GPIO_MASK
499499
int
500500
default 0
501501

502+
config SOC_GPIO_DEEP_SLEEP_WAKE_SUPPORTED_PIN_CNT
503+
int
504+
default 8
505+
502506
config SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK
503507
hex
504508
default 0x000000007FFFFF00

components/soc/esp32c6/include/soc/soc_caps.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@
203203
#define SOC_GPIO_OUT_RANGE_MAX 30
204204

205205
#define SOC_GPIO_DEEP_SLEEP_WAKE_VALID_GPIO_MASK (0ULL | BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | BIT5 | BIT6 | BIT7)
206+
#define SOC_GPIO_DEEP_SLEEP_WAKE_SUPPORTED_PIN_CNT (8)
206207

207208
// digital I/O pad powered by VDD3P3_CPU or VDD_SPI(GPIO_NUM_8~GPIO_NUM_30)
208209
#define SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK 0x000000007FFFFF00ULL

components/soc/esp32p4/include/soc/Kconfig.soc_caps.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,10 @@ config SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP
587587
bool
588588
default y
589589

590+
config SOC_LP_IO_HAS_INDEPENDENT_WAKEUP_SOURCE
591+
bool
592+
default y
593+
590594
config SOC_GPIO_VALID_GPIO_MASK
591595
hex
592596
default 0x007FFFFFFFFFFFFF
@@ -603,6 +607,10 @@ config SOC_GPIO_DEEP_SLEEP_WAKE_VALID_GPIO_MASK
603607
int
604608
default 0
605609

610+
config SOC_GPIO_DEEP_SLEEP_WAKE_SUPPORTED_PIN_CNT
611+
int
612+
default 16
613+
606614
config SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK
607615
hex
608616
default 0x007FFFFFFFFF0000

components/soc/esp32p4/include/soc/soc_caps.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@
232232
#define SOC_GPIO_SUPPORT_RTC_INDEPENDENT (1)
233233
// GPIO0~15 on ESP32P4 can support chip deep sleep wakeup
234234
#define SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP (1)
235+
#define SOC_LP_IO_HAS_INDEPENDENT_WAKEUP_SOURCE (1)
235236

236237
#define SOC_GPIO_VALID_GPIO_MASK (0x007FFFFFFFFFFFFF)
237238
#define SOC_GPIO_VALID_OUTPUT_GPIO_MASK SOC_GPIO_VALID_GPIO_MASK
@@ -240,6 +241,7 @@
240241
#define SOC_GPIO_OUT_RANGE_MAX 54
241242

242243
#define SOC_GPIO_DEEP_SLEEP_WAKE_VALID_GPIO_MASK (0ULL | 0xFFFF)
244+
#define SOC_GPIO_DEEP_SLEEP_WAKE_SUPPORTED_PIN_CNT (16)
243245

244246
// digital I/O pad powered by VDD3P3_CPU or VDD_SPI(GPIO_NUM_16~GPIO_NUM_54)
245247
#define SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK 0x007FFFFFFFFF0000ULL

0 commit comments

Comments
 (0)