Skip to content

Commit a1b4219

Browse files
committed
feat(mcpwm): support mcpwm sleep retention on p4
1 parent ed61b22 commit a1b4219

File tree

6 files changed

+19
-6
lines changed

6 files changed

+19
-6
lines changed

components/esp_driver_mcpwm/test_apps/mcpwm/main/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ if(CONFIG_SOC_ETM_SUPPORTED AND CONFIG_SOC_MCPWM_SUPPORT_ETM)
1717
list(APPEND srcs "test_mcpwm_etm.c")
1818
endif()
1919

20-
# TODO: IDF-9928 support ESP32P4
21-
if(CONFIG_SOC_LIGHT_SLEEP_SUPPORTED AND CONFIG_PM_ENABLE AND NOT CONFIG_IDF_TARGET_ESP32P4)
20+
if(CONFIG_SOC_LIGHT_SLEEP_SUPPORTED AND CONFIG_PM_ENABLE)
2221
list(APPEND srcs "test_mcpwm_sleep.c")
2322
endif()
2423

components/esp_driver_pcnt/test_apps/pulse_cnt/main/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ if(CONFIG_PCNT_ISR_IRAM_SAFE)
66
list(APPEND srcs "test_pulse_cnt_iram.c")
77
endif()
88

9-
# TODO: IDF-9907 support ESP32P4
10-
if(CONFIG_SOC_LIGHT_SLEEP_SUPPORTED AND CONFIG_PM_ENABLE AND NOT CONFIG_IDF_TARGET_ESP32P4)
9+
if(CONFIG_SOC_LIGHT_SLEEP_SUPPORTED AND CONFIG_PM_ENABLE)
1110
list(APPEND srcs "test_pulse_cnt_sleep.c")
1211
endif()
1312

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,6 +1123,10 @@ config SOC_PCNT_SUPPORT_CLEAR_SIGNAL
11231123
bool
11241124
default y
11251125

1126+
config SOC_PCNT_SUPPORT_SLEEP_RETENTION
1127+
bool
1128+
default y
1129+
11261130
config SOC_RMT_GROUPS
11271131
int
11281132
default 1
@@ -1275,6 +1279,10 @@ config SOC_MCPWM_CAPTURE_CLK_FROM_GROUP
12751279
bool
12761280
default y
12771281

1282+
config SOC_MCPWM_SUPPORT_SLEEP_RETENTION
1283+
bool
1284+
default y
1285+
12781286
config SOC_USB_OTG_PERIPH_NUM
12791287
int
12801288
default 2

components/soc/esp32p4/include/soc/retention_periph_defs.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ typedef enum periph_retention_module {
5454
SLEEP_RETENTION_MODULE_GPSPI2 = 29,
5555
SLEEP_RETENTION_MODULE_GPSPI3 = 30,
5656
SLEEP_RETENTION_MODULE_LEDC = 31,
57+
SLEEP_RETENTION_MODULE_MCPWM0 = 32,
58+
SLEEP_RETENTION_MODULE_MCPWM1 = 33,
59+
SLEEP_RETENTION_MODULE_PCNT0 = 34,
5760

5861
SLEEP_RETENTION_MODULE_MAX = SOC_PM_RETENTION_MODULE_NUM - 1
5962
} periph_retention_module_t;
@@ -91,6 +94,9 @@ typedef enum periph_retention_module {
9194
: ((m) == SLEEP_RETENTION_MODULE_GPSPI2) ? true \
9295
: ((m) == SLEEP_RETENTION_MODULE_GPSPI3) ? true \
9396
: ((m) == SLEEP_RETENTION_MODULE_LEDC) ? true \
97+
: ((m) == SLEEP_RETENTION_MODULE_MCPWM0) ? true \
98+
: ((m) == SLEEP_RETENTION_MODULE_MCPWM1) ? true \
99+
: ((m) == SLEEP_RETENTION_MODULE_PCNT0) ? true \
94100
: false)
95101

96102
#ifdef __cplusplus

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@
409409
#define SOC_PCNT_THRES_POINT_PER_UNIT 2
410410
#define SOC_PCNT_SUPPORT_RUNTIME_THRES_UPDATE 1
411411
#define SOC_PCNT_SUPPORT_CLEAR_SIGNAL 1 /*!< Support clear signal input */
412-
// #define SOC_PCNT_SUPPORT_SLEEP_RETENTION 1 // TODO: IDF-9907 Waiting for expansion of module ID /*!< The sleep retention feature can help back up PCNT registers before sleep */
412+
#define SOC_PCNT_SUPPORT_SLEEP_RETENTION 1 /*!< The sleep retention feature can help back up PCNT registers before sleep */
413413

414414
/*--------------------------- RMT CAPS ---------------------------------------*/
415415
#define SOC_RMT_GROUPS 1U /*!< One RMT group */
@@ -455,7 +455,7 @@
455455
#define SOC_MCPWM_SUPPORT_ETM (1) ///< Support ETM (Event Task Matrix)
456456
#define SOC_MCPWM_SUPPORT_EVENT_COMPARATOR (1) ///< Support event comparator (based on ETM)
457457
#define SOC_MCPWM_CAPTURE_CLK_FROM_GROUP (1) ///< Capture timer shares clock with other PWM timers
458-
// #define SOC_MCPWM_SUPPORT_SLEEP_RETENTION (1) // TODO: IDF-9928 Waiting for expansion of module ID ///< Support back up registers before sleep
458+
#define SOC_MCPWM_SUPPORT_SLEEP_RETENTION (1) ///< Support back up registers before sleep
459459

460460
/*-------------------------- USB CAPS ----------------------------------------*/
461461
// USB Serial JTAG Caps

components/soc/esp32p4/mcpwm_periph.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include "soc/soc.h"
88
#include "soc/mcpwm_periph.h"
9+
#include "soc/mcpwm_reg.h"
910
#include "soc/gpio_sig_map.h"
1011

1112
const mcpwm_signal_conn_t mcpwm_periph_signals = {

0 commit comments

Comments
 (0)