drivers/pm: PM: Add PM_RESTORE to notify driver that device exit WFI so the driver could restore state. For example, WDT may stop counting before enter low power state and restore the counting agian in PM_RESTORE notification

This commit is contained in:
zhuguangqing 2018-08-27 13:26:33 -06:00 committed by Gregory Nutt
parent ef5b781061
commit 1bbe9baa29
2 changed files with 8 additions and 1 deletions
drivers/power
include/nuttx/power

@ -247,7 +247,10 @@ int pm_changestate(int domain, enum pm_state_e newstate)
*/
pm_changeall(domain, newstate);
g_pmglobals.domain[domain].state = newstate;
if (newstate != PM_RESTORE)
{
g_pmglobals.domain[domain].state = newstate;
}
/* Restore the interrupt state */

@ -236,6 +236,10 @@
enum pm_state_e
{
PM_RESTORE = -1, /* PM_RESTORE is not a low power state.
*
* PM_RESTORE is used to notify for restore from low power state.
*/
PM_NORMAL = 0, /* Normal full power operating mode. If the driver is in
* a reduced power usage mode, it should immediately re-
* initialize for normal operatin.