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/10/03 06:25:00 UTC

(nuttx) branch master updated: boards: cxd56xx: Fix an issue not to enter cold sleep

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 cc6306a559 boards: cxd56xx: Fix an issue not to enter cold sleep
cc6306a559 is described below

commit cc6306a559a52003504230ee3aa193f947ce1872
Author: SPRESENSE <41...@users.noreply.github.com>
AuthorDate: Thu Oct 3 11:29:52 2024 +0900

    boards: cxd56xx: Fix an issue not to enter cold sleep
    
    Fix an issue not to enter cold sleep by SD Card detection interrupt.
---
 arch/arm/include/cxd56xx/pm.h                   |  4 ++++
 boards/arm/cxd56xx/spresense/src/cxd56_sdcard.c | 14 ++++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/cxd56xx/pm.h b/arch/arm/include/cxd56xx/pm.h
index 133ade841f..56e0aab591 100644
--- a/arch/arm/include/cxd56xx/pm.h
+++ b/arch/arm/include/cxd56xx/pm.h
@@ -55,6 +55,10 @@
 #define PM_BOOT_COLD_USB_DETACH (0x40000000ul) /* In ColdSleep state, USB Disconnected */
 #define PM_BOOT_COLD_USB_ATTACH (0x80000000ul) /* In ColdSleep state, USB Connected */
 
+/* Get bootmask from GPIO IRQ number */
+
+#define PM_BOOT_GPIO_MASK(irq) (1 << ((irq) - CXD56_IRQ_EXDEVICE_0 + 16))
+
 /* SRAM power status definitions */
 
 #define PMCMD_RAM_OFF 0  /* Power off */
diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_sdcard.c b/boards/arm/cxd56xx/spresense/src/cxd56_sdcard.c
index 53057a499f..832c0ac3f0 100644
--- a/boards/arm/cxd56xx/spresense/src/cxd56_sdcard.c
+++ b/boards/arm/cxd56xx/spresense/src/cxd56_sdcard.c
@@ -277,6 +277,9 @@ static int board_sdcard_detect_int(int irq, void *context, void *arg)
 int board_sdcard_initialize(void)
 {
   int ret = OK;
+#ifdef CONFIG_MMCSD_HAVE_CARDDETECT
+  int irq;
+#endif
 
 #ifdef CONFIG_SDCARD_TXS02612_PORT0
   /* Select port0 for SD-Card (default) */
@@ -296,8 +299,15 @@ int board_sdcard_initialize(void)
   /* Configure Interrupt pin with internal pull-up */
 
   cxd56_pin_config(PINCONF_SDIO_CD_GPIO);
-  cxd56_gpioint_config(PIN_SDIO_CD, GPIOINT_PSEUDO_EDGE_BOTH,
-                       board_sdcard_detect_int, NULL);
+  irq = cxd56_gpioint_config(PIN_SDIO_CD, GPIOINT_PSEUDO_EDGE_BOTH,
+                             board_sdcard_detect_int, NULL);
+
+  /* Disable wakeup from SD Card detect interrupt */
+
+  if ((CXD56_IRQ_EXDEVICE_0 <= irq) && (irq <= CXD56_IRQ_EXDEVICE_11))
+    {
+      up_pm_clr_bootmask(PM_BOOT_GPIO_MASK(irq));
+    }
 
   /* Handle the case when SD card is already inserted */