You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/07/21 16:25:08 UTC

[GitHub] [incubator-nuttx] GUIDINGLI opened a new pull request, #6673: power related update

GUIDINGLI opened a new pull request, #6673:
URL: https://github.com/apache/incubator-nuttx/pull/6673

   ## Summary
   
   add wakelock support, add power procfs support
   
   ## Impact
   
   power
   
   ## Testing
   
   VELA
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] GUIDINGLI commented on a diff in pull request #6673: power related update

Posted by GitBox <gi...@apache.org>.
GUIDINGLI commented on code in PR #6673:
URL: https://github.com/apache/incubator-nuttx/pull/6673#discussion_r928892832


##########
drivers/power/pm_activity.c:
##########
@@ -143,21 +182,40 @@ void pm_stay(int domain, enum pm_state_e state)
 
 void pm_relax(int domain, enum pm_state_e state)
 {
-  FAR struct pm_domain_s *pdom;
-  irqstate_t flags;
+  DEBUGASSERT(state < PM_COUNT);
+  DEBUGASSERT(domain >= 0 && domain < CONFIG_PM_NDOMAINS);
 
-  /* Get a convenience pointer to minimize all of the indexing */
+  pm_wakelock_relax(&g_wakelock[domain][state]);
+}
 
-  DEBUGASSERT(domain >= 0 && domain < CONFIG_PM_NDOMAINS);
-  pdom = &g_pmglobals.domain[domain];
+/****************************************************************************
+ * Name: pm_staytimeout
+ *
+ * Description:
+ *   This function is called by a device driver to indicate that it is
+ *   performing meaningful activities (non-idle), needs the power at kept
+ *   last the specified level.
+ *   And this will be timeout after time (ms), menas auto pm_relax
+ *
+ * Input Parameters:
+ *   domain - The domain of the PM activity
+ *   state - The state want to stay.

Review Comment:
   done



##########
drivers/power/pm_activity.c:
##########
@@ -143,21 +182,40 @@ void pm_stay(int domain, enum pm_state_e state)
 
 void pm_relax(int domain, enum pm_state_e state)
 {
-  FAR struct pm_domain_s *pdom;
-  irqstate_t flags;
+  DEBUGASSERT(state < PM_COUNT);
+  DEBUGASSERT(domain >= 0 && domain < CONFIG_PM_NDOMAINS);
 
-  /* Get a convenience pointer to minimize all of the indexing */
+  pm_wakelock_relax(&g_wakelock[domain][state]);
+}
 
-  DEBUGASSERT(domain >= 0 && domain < CONFIG_PM_NDOMAINS);
-  pdom = &g_pmglobals.domain[domain];
+/****************************************************************************
+ * Name: pm_staytimeout
+ *
+ * Description:
+ *   This function is called by a device driver to indicate that it is
+ *   performing meaningful activities (non-idle), needs the power at kept
+ *   last the specified level.
+ *   And this will be timeout after time (ms), menas auto pm_relax
+ *
+ * Input Parameters:
+ *   domain - The domain of the PM activity
+ *   state - The state want to stay.

Review Comment:
   @davids5 please review



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6673: power related update

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6673:
URL: https://github.com/apache/incubator-nuttx/pull/6673#discussion_r927454683


##########
include/nuttx/power/pm.h:
##########
@@ -85,6 +87,14 @@
  * own, custom idle loop to support board-specific IDLE time power management
  */
 
+#define PM_WAKELOCK_INITIALIZER(name, domain, state) {name, domain, state}
+
+#define PM_WAKELOCK_DECLARE(var, name, domain, state) \
+      struct pm_wakelock_s var = PM_WAKELOCK_INITIALIZER(name, domain, state)
+
+#define PM_WAKELOCK_DECLARE_STATIC(var, name, domain, state) \

Review Comment:
   why do we need a special macro for static? I mean why `static PM_WAKELOCK_DECLARE(x, y, z, t);` can't be used?



##########
include/nuttx/power/pm.h:
##########
@@ -631,13 +801,27 @@ void pm_auto_updatestate(int domain);
  * avoid so much conditional compilation in driver code when PM is disabled:
  */
 
+#  define PM_WAKELOCK_INITIALIZER(n,d,s)      {0}

Review Comment:
   is `PM_WAKELOCK_INITIALIZER` going to be used away from `PM_WAKELOCK_DECLARE` or `PM_WAKELOCK_DECLARE_STATIC`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6673: power related update

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6673:
URL: https://github.com/apache/incubator-nuttx/pull/6673#discussion_r927483108


##########
drivers/power/pm_governor.c:
##########
@@ -88,5 +93,19 @@ int pm_set_governor(int domain, FAR const struct pm_governor_s *gov)
       g_pmglobals.domain[domain].governor->initialize();
     }
 
+#if CONFIG_PM_GOVERNOR_EXPLICIT_RELAX
+  for (dom = 0; dom < CONFIG_PM_NDOMAINS; dom++)

Review Comment:
   should we just hold the lock for `domain` instead all possible `dom`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6673: power related update

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6673:
URL: https://github.com/apache/incubator-nuttx/pull/6673#discussion_r927468156


##########
include/nuttx/power/pm.h:
##########
@@ -85,6 +87,14 @@
  * own, custom idle loop to support board-specific IDLE time power management
  */
 
+#define PM_WAKELOCK_INITIALIZER(name, domain, state) {name, domain, state}
+
+#define PM_WAKELOCK_DECLARE(var, name, domain, state) \
+      struct pm_wakelock_s var = PM_WAKELOCK_INITIALIZER(name, domain, state)
+
+#define PM_WAKELOCK_DECLARE_STATIC(var, name, domain, state) \

Review Comment:
   Since PM is optional feature, if we reuse PM_WAKELOCK_DECLARE macro, we have to:
   ```
   #ifdef CONFIG_PM
   static PM_WAKELOCK_DECLARE(x, y, z, t);
   #endif
   ```
   On the other hand, we can write more simple code with PM_WAKELOCK_DECLARE_STATIC:
   ```
   PM_WAKELOCK_DECLARE_STATIC(x, y, z, t);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] davids5 commented on a diff in pull request #6673: power related update

Posted by GitBox <gi...@apache.org>.
davids5 commented on code in PR #6673:
URL: https://github.com/apache/incubator-nuttx/pull/6673#discussion_r928710357


##########
drivers/power/pm_activity.c:
##########
@@ -143,21 +182,40 @@ void pm_stay(int domain, enum pm_state_e state)
 
 void pm_relax(int domain, enum pm_state_e state)
 {
-  FAR struct pm_domain_s *pdom;
-  irqstate_t flags;
+  DEBUGASSERT(state < PM_COUNT);
+  DEBUGASSERT(domain >= 0 && domain < CONFIG_PM_NDOMAINS);
 
-  /* Get a convenience pointer to minimize all of the indexing */
+  pm_wakelock_relax(&g_wakelock[domain][state]);
+}
 
-  DEBUGASSERT(domain >= 0 && domain < CONFIG_PM_NDOMAINS);
-  pdom = &g_pmglobals.domain[domain];
+/****************************************************************************
+ * Name: pm_staytimeout
+ *
+ * Description:
+ *   This function is called by a device driver to indicate that it is
+ *   performing meaningful activities (non-idle), needs the power at kept
+ *   last the specified level.

Review Comment:
   ```suggestion
    *   the last specified level.
   ```



##########
drivers/power/pm_activity.c:
##########
@@ -143,21 +182,40 @@ void pm_stay(int domain, enum pm_state_e state)
 
 void pm_relax(int domain, enum pm_state_e state)
 {
-  FAR struct pm_domain_s *pdom;
-  irqstate_t flags;
+  DEBUGASSERT(state < PM_COUNT);
+  DEBUGASSERT(domain >= 0 && domain < CONFIG_PM_NDOMAINS);
 
-  /* Get a convenience pointer to minimize all of the indexing */
+  pm_wakelock_relax(&g_wakelock[domain][state]);
+}
 
-  DEBUGASSERT(domain >= 0 && domain < CONFIG_PM_NDOMAINS);
-  pdom = &g_pmglobals.domain[domain];
+/****************************************************************************
+ * Name: pm_staytimeout
+ *
+ * Description:
+ *   This function is called by a device driver to indicate that it is
+ *   performing meaningful activities (non-idle), needs the power at kept
+ *   last the specified level.
+ *   And this will be timeout after time (ms), menas auto pm_relax
+ *
+ * Input Parameters:
+ *   domain - The domain of the PM activity
+ *   state - The state want to stay.

Review Comment:
   ```suggestion
    *   state   - The state want to stay.
   ```
   Please line this up



##########
drivers/power/pm_activity.c:
##########
@@ -143,21 +182,40 @@ void pm_stay(int domain, enum pm_state_e state)
 
 void pm_relax(int domain, enum pm_state_e state)
 {
-  FAR struct pm_domain_s *pdom;
-  irqstate_t flags;
+  DEBUGASSERT(state < PM_COUNT);
+  DEBUGASSERT(domain >= 0 && domain < CONFIG_PM_NDOMAINS);
 
-  /* Get a convenience pointer to minimize all of the indexing */
+  pm_wakelock_relax(&g_wakelock[domain][state]);
+}
 
-  DEBUGASSERT(domain >= 0 && domain < CONFIG_PM_NDOMAINS);
-  pdom = &g_pmglobals.domain[domain];
+/****************************************************************************
+ * Name: pm_staytimeout
+ *
+ * Description:
+ *   This function is called by a device driver to indicate that it is
+ *   performing meaningful activities (non-idle), needs the power at kept

Review Comment:
   ```suggestion
    *   performing meaningful activities (non-idle), needs the power kept at
   ```



##########
drivers/power/pm_activity.c:
##########
@@ -143,21 +182,40 @@ void pm_stay(int domain, enum pm_state_e state)
 
 void pm_relax(int domain, enum pm_state_e state)
 {
-  FAR struct pm_domain_s *pdom;
-  irqstate_t flags;
+  DEBUGASSERT(state < PM_COUNT);
+  DEBUGASSERT(domain >= 0 && domain < CONFIG_PM_NDOMAINS);
 
-  /* Get a convenience pointer to minimize all of the indexing */
+  pm_wakelock_relax(&g_wakelock[domain][state]);
+}
 
-  DEBUGASSERT(domain >= 0 && domain < CONFIG_PM_NDOMAINS);
-  pdom = &g_pmglobals.domain[domain];
+/****************************************************************************
+ * Name: pm_staytimeout
+ *
+ * Description:
+ *   This function is called by a device driver to indicate that it is
+ *   performing meaningful activities (non-idle), needs the power at kept
+ *   last the specified level.
+ *   And this will be timeout after time (ms), menas auto pm_relax

Review Comment:
   ```suggestion
    *   And this will timeout after time (ms), menas auto pm_relax
   ```
   
   Not sure what menas  was supposed to me.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] GUIDINGLI commented on a diff in pull request #6673: power related update

Posted by GitBox <gi...@apache.org>.
GUIDINGLI commented on code in PR #6673:
URL: https://github.com/apache/incubator-nuttx/pull/6673#discussion_r928776746


##########
drivers/power/pm_activity.c:
##########
@@ -143,21 +182,40 @@ void pm_stay(int domain, enum pm_state_e state)
 
 void pm_relax(int domain, enum pm_state_e state)
 {
-  FAR struct pm_domain_s *pdom;
-  irqstate_t flags;
+  DEBUGASSERT(state < PM_COUNT);
+  DEBUGASSERT(domain >= 0 && domain < CONFIG_PM_NDOMAINS);
 
-  /* Get a convenience pointer to minimize all of the indexing */
+  pm_wakelock_relax(&g_wakelock[domain][state]);
+}
 
-  DEBUGASSERT(domain >= 0 && domain < CONFIG_PM_NDOMAINS);
-  pdom = &g_pmglobals.domain[domain];
+/****************************************************************************
+ * Name: pm_staytimeout
+ *
+ * Description:
+ *   This function is called by a device driver to indicate that it is
+ *   performing meaningful activities (non-idle), needs the power at kept
+ *   last the specified level.
+ *   And this will be timeout after time (ms), menas auto pm_relax
+ *
+ * Input Parameters:
+ *   domain - The domain of the PM activity
+ *   state - The state want to stay.

Review Comment:
   don't need



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6673: power related update

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6673:
URL: https://github.com/apache/incubator-nuttx/pull/6673#discussion_r927486781


##########
drivers/power/activity_governor.c:
##########
@@ -508,7 +508,7 @@ static enum pm_state_e governor_checkstate(int domain)
 
   for (index = 0; index < pdomstate->recommended; index++)
     {
-      if (pdom->stay[index] != 0)
+      if (dq_count(&pdom->wakelock[index]) != 0)

Review Comment:
   let's check empty instead



##########
drivers/power/activity_governor.c:
##########
@@ -567,7 +567,7 @@ static void governor_timer(int domain)
   pdomstate = &g_pm_activity_governor.domain_states[domain];
   state     = pdom->state;
 
-  if (state < PM_SLEEP && !pdom->stay[pdom->state])
+  if (state < PM_SLEEP && !dq_count(&pdom->wakelock[state]))

Review Comment:
   let's check empty instead



##########
drivers/power/greedy_governor.c:
##########
@@ -122,7 +122,7 @@ static enum pm_state_e greedy_governor_checkstate(int domain)
     {
       /* Find the lowest power-level which is not locked. */
 
-      while (!pdom->stay[state] && state < (PM_COUNT - 1))
+      while (!dq_count(&pdom->wakelock[state]) && state < (PM_COUNT - 1))

Review Comment:
   let's check empty instead



##########
include/nuttx/power/pm.h:
##########
@@ -631,13 +801,27 @@ void pm_auto_updatestate(int domain);
  * avoid so much conditional compilation in driver code when PM is disabled:
  */
 
+#  define PM_WAKELOCK_INITIALIZER(n,d,s)      {0}

Review Comment:
   should not, maybe we can directly use `{{NULL, NULL}, name, domain, state, 0}` in PM_WAKELOCK_INITIALIZER.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6673: power related update

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6673:
URL: https://github.com/apache/incubator-nuttx/pull/6673#discussion_r927129228


##########
drivers/power/pm_activity.c:
##########
@@ -35,6 +36,55 @@
 
 #ifdef CONFIG_PM
 
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct pm_wakelock_s g_wakelock[CONFIG_PM_NDOMAINS][PM_COUNT];
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+static void pm_waklock_cb(wdparm_t arg)
+{
+  pm_wakelock_relax((FAR struct pm_wakelock_s *)arg);
+}
+
+#ifdef CONFIG_PM_PROCFS
+static void pm_wakelock_stats_rm(FAR struct pm_wakelock_s *wakelock)
+{
+  FAR struct pm_domain_s *pdom = &g_pmglobals.domain[wakelock->domain];
+
+  dq_rem(&wakelock->fsnode, &pdom->wakelockall);
+}
+
+static void pm_wakelock_stats(FAR struct pm_wakelock_s *wakelock, bool stay)
+{
+  FAR struct pm_domain_s *pdom = &g_pmglobals.domain[wakelock->domain];
+  struct timespec ts;
+
+  if (stay)
+    {
+      if (!wakelock->fsnode.blink && !wakelock->fsnode.flink)
+        {
+          dq_addlast(&wakelock->fsnode, &pdom->wakelockall);
+        }
+
+      clock_systime_timespec(&wakelock->start);
+    }
+  else
+    {
+      clock_systime_timespec(&ts);
+      clock_timespec_subtract(&ts, &wakelock->start, &ts);
+      clock_timespec_add(&ts, &wakelock->elapse, &wakelock->elapse);
+    }
+}
+#else
+#define pm_wakelock_stats_rm(w)
+#define pm_wakelock_stats(w, s)

Review Comment:
   ```suggestion
   #  define pm_wakelock_stats_rm(w)
   #  define pm_wakelock_stats(w, s)
   ```



##########
drivers/power/greedy_governor.c:
##########
@@ -46,52 +46,44 @@
  * Private Types
  ****************************************************************************/
 
+struct pm_domain_state_s
+{
+  struct wdog_s wdog;
+};
+
+struct pm_greedy_governor_s
+{
+  struct pm_domain_state_s domain_states[CONFIG_PM_NDOMAINS];
+};
+
 /****************************************************************************
  * Private Function Prototypes
  ****************************************************************************/
 
 /* PM governor methods */
 
-static void greedy_governor_initialize(void);
-static void greedy_governor_statechanged(int domain,
-                                         enum pm_state_e newstate);
-static enum pm_state_e greedy_governor_checkstate(int domain);
+static void             greedy_governor_statechanged(int domain,
+                                                enum pm_state_e newstate);
+static enum pm_state_e  greedy_governor_checkstate(int domain);
+static void             greedy_governor_activity(int domain, int count);

Review Comment:
   I think better to get previous style without too many spaces



##########
drivers/power/pm_changestate.c:
##########
@@ -168,6 +168,35 @@ static inline void pm_changeall(int domain, enum pm_state_e newstate)
     }
 }
 
+#ifdef CONFIG_PM_PROCFS
+static void pm_stats(FAR struct pm_domain_s *dom, int curstate, int newstate)
+{
+  struct timespec ts;
+
+  clock_systime_timespec(&ts);
+  clock_timespec_subtract(&ts, &dom->start, &ts);
+
+  if (newstate == PM_RESTORE)
+    {
+      /* Wakeup from WFI */
+
+      clock_timespec_add(&ts, &dom->sleep[curstate], &dom->sleep[curstate]);
+    }
+  else
+    {
+      /* Sleep to WFI */
+
+      clock_timespec_add(&ts, &dom->wake[curstate], &dom->wake[curstate]);
+    }
+
+  /* Update start */
+
+  clock_systime_timespec(&dom->start);
+}
+#else
+#define pm_stats(dom, curstate, newstate)

Review Comment:
   ```suggestion
   #  define pm_stats(dom, curstate, newstate)
   ```



##########
drivers/power/pm.h:
##########
@@ -72,6 +78,14 @@ struct pm_domain_s
   /* A pointer to the PM governor instance */
 
   FAR const struct pm_governor_s *governor;
+
+  /* This semaphore manages mutually exclusive access to the domain state.
+   * It must be initialized to the value 1.
+   */
+
+  sem_t sem;
+  pid_t holder;
+  unsigned int count;

Review Comment:
   maybe better to use recursive mutex?



##########
include/nuttx/power/pm.h:
##########
@@ -85,6 +87,14 @@
  * own, custom idle loop to support board-specific IDLE time power management
  */
 
+#define PM_WAKELOCK_INITIALIZER(name, domain, state) {name, domain, state}
+
+#define PM_WAKELOCK_DECLARE(var, name, domain, state) \
+      struct pm_wakelock_s var = PM_WAKELOCK_INITIALIZER(name, domain, state)
+
+#define PM_WAKELOCK_DECLARE_STATIC(var, name, domain, state) \
+static struct pm_wakelock_s var = PM_WAKELOCK_INITIALIZER(name, domain, state)

Review Comment:
   Please move to "Private Data" section



##########
drivers/power/greedy_governor.c:
##########
@@ -46,52 +46,44 @@
  * Private Types
  ****************************************************************************/
 
+struct pm_domain_state_s
+{
+  struct wdog_s wdog;
+};
+
+struct pm_greedy_governor_s
+{
+  struct pm_domain_state_s domain_states[CONFIG_PM_NDOMAINS];
+};
+
 /****************************************************************************
  * Private Function Prototypes
  ****************************************************************************/
 
 /* PM governor methods */
 
-static void greedy_governor_initialize(void);
-static void greedy_governor_statechanged(int domain,
-                                         enum pm_state_e newstate);
-static enum pm_state_e greedy_governor_checkstate(int domain);
+static void             greedy_governor_statechanged(int domain,
+                                                enum pm_state_e newstate);
+static enum pm_state_e  greedy_governor_checkstate(int domain);
+static void             greedy_governor_activity(int domain, int count);
 
 /****************************************************************************
  * Private Data
  ****************************************************************************/
 
 static const struct pm_governor_s g_greedy_governor_ops =
 {
-  greedy_governor_initialize,   /* initialize */
-  NULL,                         /* deinitialize */
-  greedy_governor_statechanged, /* statechanged */
-  greedy_governor_checkstate,   /* checkstate */
-  NULL,                         /* activity */
-  NULL                          /* priv */
+  .statechanged = greedy_governor_statechanged, /* statechanged */
+  .checkstate   = greedy_governor_checkstate,   /* checkstate */
+  .activity     = greedy_governor_activity,     /* activity */
 };

Review Comment:
   please get back C89 init style



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] GUIDINGLI commented on a diff in pull request #6673: power related update

Posted by GitBox <gi...@apache.org>.
GUIDINGLI commented on code in PR #6673:
URL: https://github.com/apache/incubator-nuttx/pull/6673#discussion_r927271939


##########
include/nuttx/power/pm.h:
##########
@@ -85,6 +87,14 @@
  * own, custom idle loop to support board-specific IDLE time power management
  */
 
+#define PM_WAKELOCK_INITIALIZER(name, domain, state) {name, domain, state}
+
+#define PM_WAKELOCK_DECLARE(var, name, domain, state) \
+      struct pm_wakelock_s var = PM_WAKELOCK_INITIALIZER(name, domain, state)
+
+#define PM_WAKELOCK_DECLARE_STATIC(var, name, domain, state) \
+static struct pm_wakelock_s var = PM_WAKELOCK_INITIALIZER(name, domain, state)

Review Comment:
   this is only a define, not a "data"



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] davids5 commented on a diff in pull request #6673: power related update

Posted by GitBox <gi...@apache.org>.
davids5 commented on code in PR #6673:
URL: https://github.com/apache/incubator-nuttx/pull/6673#discussion_r928793632


##########
drivers/power/pm_activity.c:
##########
@@ -143,21 +182,40 @@ void pm_stay(int domain, enum pm_state_e state)
 
 void pm_relax(int domain, enum pm_state_e state)
 {
-  FAR struct pm_domain_s *pdom;
-  irqstate_t flags;
+  DEBUGASSERT(state < PM_COUNT);
+  DEBUGASSERT(domain >= 0 && domain < CONFIG_PM_NDOMAINS);
 
-  /* Get a convenience pointer to minimize all of the indexing */
+  pm_wakelock_relax(&g_wakelock[domain][state]);
+}
 
-  DEBUGASSERT(domain >= 0 && domain < CONFIG_PM_NDOMAINS);
-  pdom = &g_pmglobals.domain[domain];
+/****************************************************************************
+ * Name: pm_staytimeout
+ *
+ * Description:
+ *   This function is called by a device driver to indicate that it is
+ *   performing meaningful activities (non-idle), needs the power at kept
+ *   last the specified level.
+ *   And this will be timeout after time (ms), menas auto pm_relax
+ *
+ * Input Parameters:
+ *   domain - The domain of the PM activity
+ *   state - The state want to stay.

Review Comment:
   see https://github.com/apache/incubator-nuttx/blob/master/sched/sched/sched_get_stackinfo.c#L43-L46



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6673: power related update

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6673:
URL: https://github.com/apache/incubator-nuttx/pull/6673#discussion_r927796695


##########
include/nuttx/power/pm.h:
##########
@@ -631,13 +801,27 @@ void pm_auto_updatestate(int domain);
  * avoid so much conditional compilation in driver code when PM is disabled:
  */
 
+#  define PM_WAKELOCK_INITIALIZER(n,d,s)      {0}

Review Comment:
   If not, then empty initialiser `#  define PM_WAKELOCK_INITIALIZER(n,d,s)      {0}` can be remove 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #6673: power related update

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged PR #6673:
URL: https://github.com/apache/incubator-nuttx/pull/6673


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] power related update [nuttx]

Posted by "tmedicci (via GitHub)" <gi...@apache.org>.
tmedicci commented on PR #6673:
URL: https://github.com/apache/nuttx/pull/6673#issuecomment-1745592742

   Hi @GUIDINGLI , could you please take a look at https://github.com/apache/nuttx/issues/10852?
   
   Please let me know if I can help you somehow to investigate the origin of the issue.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org