You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/05/07 07:45:37 UTC

(nuttx) branch master updated: esp32_c3/pm: Fix assert issue in PM mode

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 3a9d163aae esp32_c3/pm: Fix assert issue in PM mode
3a9d163aae is described below

commit 3a9d163aaec605dc67a60b4fb8784c0868b4c48d
Author: chenwen@espressif.com <ch...@espressif.com>
AuthorDate: Wed Apr 10 19:55:58 2024 +0800

    esp32_c3/pm: Fix assert issue in PM mode
    
        1. Adjust code to avoid PM wakelock->count less than or equal to 0.
        2. Fix some document format issues.
    
    Signed-off-by: chenwen@espressif.com <ch...@espressif.com>
---
 .../platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst      | 6 ++++--
 arch/risc-v/src/esp32c3-legacy/esp32c3_idle.c                     | 8 --------
 arch/xtensa/src/esp32/esp32_idle.c                                | 8 --------
 arch/xtensa/src/esp32s3/esp32s3_idle.c                            | 1 -
 boards/xtensa/esp32/esp32-devkitc/configs/pm/defconfig            | 2 ++
 5 files changed, 6 insertions(+), 19 deletions(-)

diff --git a/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst b/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst
index 8da3f10caa..ad5d4dd1de 100644
--- a/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst
+++ b/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst
@@ -329,7 +329,7 @@ pm
 -------
 
 This config demonstrate the use of power management present on the ESP32-S3.
-You can use the pmconfig command to test the power management.
+You can use the ``pmconfig`` command to test the power management.
 Enables PM support. You can define standby mode and sleep mode delay time::
 
     $ make menuconfig
@@ -340,6 +340,7 @@ Enables PM support. You can define standby mode and sleep mode delay time::
            (0)  PM_SLEEP delay (nanoseconds)
 
 Before switching PM status, you need to query the current PM status::
+
     nsh> pmconfig
     Last state 0, Next state 0
 
@@ -369,12 +370,13 @@ System switch to the PM standby mode, you need to enter::
     nsh> pmconfig relax normal
 
 System switch to the PM sleep mode, you need to enter::
+
     nsh> pmconfig relax standby
     nsh> pmconfig relax idle
     nsh> pmconfig relax normal
     nsh> pmconfig relax normal
 
-Note: when normal mode COUNT is 0, it will switch to the next PM state where COUNT is not 0.
+Note: When normal mode COUNT is 0, it will switch to the next PM state where COUNT is not 0.
 
 psram_quad
 ----------
diff --git a/arch/risc-v/src/esp32c3-legacy/esp32c3_idle.c b/arch/risc-v/src/esp32c3-legacy/esp32c3_idle.c
index 5b4e406c30..5a7fa1c3a5 100644
--- a/arch/risc-v/src/esp32c3-legacy/esp32c3_idle.c
+++ b/arch/risc-v/src/esp32c3-legacy/esp32c3_idle.c
@@ -200,7 +200,6 @@ static void up_idlepm(void)
             esp32c3_pmsleep(CONFIG_PM_SLEEP_WAKEUP_SEC * 1000000 +
                                 CONFIG_PM_SLEEP_WAKEUP_NSEC / 1000);
           }
-          break;
 
         default:
           break;
@@ -208,13 +207,6 @@ static void up_idlepm(void)
     }
   else
     {
-      if (oldstate == PM_NORMAL)
-        {
-          /* Relax normal operation */
-
-          pm_relax(PM_IDLE_DOMAIN, PM_NORMAL);
-        }
-
 #ifdef CONFIG_WATCHDOG
       /* Announce the power management state change to feed watchdog */
 
diff --git a/arch/xtensa/src/esp32/esp32_idle.c b/arch/xtensa/src/esp32/esp32_idle.c
index 02cda6119c..d5e85f7f43 100644
--- a/arch/xtensa/src/esp32/esp32_idle.c
+++ b/arch/xtensa/src/esp32/esp32_idle.c
@@ -219,7 +219,6 @@ static void esp32_idlepm(void)
             esp32_pmsleep(CONFIG_PM_SLEEP_WAKEUP_SEC * 1000000 +
                                 CONFIG_PM_SLEEP_WAKEUP_NSEC / 1000);
           }
-          break;
 
         default:
           break;
@@ -227,13 +226,6 @@ static void esp32_idlepm(void)
     }
   else
     {
-      if (oldstate == PM_NORMAL)
-        {
-          /* Relax normal operation */
-
-          pm_relax(PM_IDLE_DOMAIN, PM_NORMAL);
-        }
-
 #ifdef CONFIG_WATCHDOG
       /* Announce the power management state change to feed watchdog */
 
diff --git a/arch/xtensa/src/esp32s3/esp32s3_idle.c b/arch/xtensa/src/esp32s3/esp32s3_idle.c
index 4835891bdb..25fbe6b9ef 100644
--- a/arch/xtensa/src/esp32s3/esp32s3_idle.c
+++ b/arch/xtensa/src/esp32s3/esp32s3_idle.c
@@ -140,7 +140,6 @@ static void up_idlepm(void)
             esp32s3_pmsleep(CONFIG_PM_SLEEP_WAKEUP_SEC * 1000000 +
                             CONFIG_PM_SLEEP_WAKEUP_NSEC / 1000);
           }
-          break;
 
         default:
           break;
diff --git a/boards/xtensa/esp32/esp32-devkitc/configs/pm/defconfig b/boards/xtensa/esp32/esp32-devkitc/configs/pm/defconfig
index 278d927047..7f6c0ca6aa 100644
--- a/boards/xtensa/esp32/esp32-devkitc/configs/pm/defconfig
+++ b/boards/xtensa/esp32/esp32-devkitc/configs/pm/defconfig
@@ -21,6 +21,7 @@ CONFIG_BOARD_LOOPSPERMSEC=16717
 CONFIG_BUILTIN=y
 CONFIG_ESP32_UART0=y
 CONFIG_FS_PROCFS=y
+CONFIG_FS_PROCFS_REGISTER=y
 CONFIG_HAVE_CXX=y
 CONFIG_HAVE_CXXINITIALIZE=y
 CONFIG_IDLETHREAD_STACKSIZE=3072
@@ -36,6 +37,7 @@ CONFIG_NSH_READLINE=y
 CONFIG_PM=y
 CONFIG_PM_GOVERNOR_EXPLICIT_RELAX=-1
 CONFIG_PM_GOVERNOR_GREEDY=y
+CONFIG_PM_PROCFS=y
 CONFIG_PREALLOC_TIMERS=4
 CONFIG_RAM_SIZE=114688
 CONFIG_RAM_START=0x20000000