jerpelea opened a new pull request, #20341: URL: https://github.com/apache/nuttx/pull/20341
## Summary /proc/pm/state0 reported a flat 0 s in its SLEEP column on a board that was demonstrably light-sleeping, because this port never told the PM core it had slept. pm_stats() (drivers/power/pm/pm_changestate.c) splits the time since the last transition into dom->wake[state] or dom->sleep[state] depending on whether the state it's handed is PM_RESTORE. up_idlepm() called esp_pmstandby() and carried straight on, so every second — including the ones spent in light sleep — was billed to wake[]. The statistics CONFIG_PM_PROCFS advertises were simply never true on this port. Fix: issue pm_changestate(PM_IDLE_DOMAIN, PM_RESTORE) right after esp_pmstandby() returns. This is the documented way to record the statistic — it skips the driver prepare/veto phase, notifies drivers of the restore, and deliberately does not overwrite the domain's state, so the domain correctly stays in PM_STANDBY. Only PM_STANDBY needs this: PM_SLEEP is deep sleep and does not return at all (the chip resets), so there is nothing to attribute on a return path that doesn't exist. Depends on https://github.com/apache/nuttx/pull/20223 ("esp32s3/esp32s3_idle.c: unwedge the PM state machine after the first wakeup") — that commit is included here too since it has not merged yet, so the diff currently shows both. Once https://github.com/apache/nuttx/pull/20223 merges, this branch will be rebased onto master and only its own commit will remain. ## Impact RELEASE ## Testing CI -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
