You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by je...@apache.org on 2021/05/23 18:43:06 UTC

[incubator-nuttx] 01/07: boards: spresense: Fix PMIC setting during boot-up

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

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

commit 8403fe650325a66a41e1cd4f9cc4833d4ed2d4df
Author: SPRESENSE <41...@users.noreply.github.com>
AuthorDate: Wed May 19 17:48:18 2021 +0900

    boards: spresense: Fix PMIC setting during boot-up
    
    When RTC clock is still unstable, the continuous PMIC settings may not
    be reflected. This commit adds a delay time to avoid such problem.
---
 boards/arm/cxd56xx/spresense/src/cxd56_power.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_power.c b/boards/arm/cxd56xx/spresense/src/cxd56_power.c
index 7a02860..b1370c3 100644
--- a/boards/arm/cxd56xx/spresense/src/cxd56_power.c
+++ b/boards/arm/cxd56xx/spresense/src/cxd56_power.c
@@ -205,6 +205,13 @@ int board_power_control(int target, bool en)
   if (pfunc)
     {
       ret = pfunc(PMIC_GET_CH(target), en);
+
+      /* If RTC clock is unstable, delay 1 tick for PMIC setting. */
+
+      if (!g_rtc_enabled)
+        {
+          usleep(1);
+        }
     }
 
   return ret;
@@ -236,6 +243,13 @@ int board_power_control_tristate(int target, int value)
       /* set HiZ to PMIC GPO channel */
 
       ret = cxd56_pmic_set_gpo_hiz(PMIC_GET_CH(target));
+
+      /* If RTC clock is unstable, delay 1 tick for PMIC setting. */
+
+      if (!g_rtc_enabled)
+        {
+          usleep(1);
+        }
     }
   else
     {