power: policy: recover deep sleep states from residency policy.

Commit c248cdf17e remove deep sleep states
from residency policy based on SoC loses context in deep sleep states to
avoid a "forever timeout" power-off the whole system. It's right if deep
sleep means power off whole system only.

One of deep sleep states is that most power domains are shut off, but
except a few that retain just enough logic to allow the CPU to resume
from the same point of execution where it went to sleep. This is well
documented and implementations also have same behavior.

For another deep sleep state, system off, sys_pm_ctrl_disable_state can
prevent system off unexpectedly from being entered on long timeout. And
sys_pm_force_power_state can help power off whole system.

This reverts commit c248cdf17e.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
This commit is contained in:
Wentong Wu 2020-01-22 10:34:57 -05:00 committed by Andrew Boie
parent ab7773dae8
commit ac2b117acd

View file

@ -29,6 +29,20 @@ static const unsigned int pm_min_residency[] = {
CONFIG_SYS_PM_MIN_RESIDENCY_SLEEP_3 * SECS_TO_TICKS / MSEC_PER_SEC,
#endif
#endif /* CONFIG_SYS_POWER_SLEEP_STATES */
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP_STATES
#ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1
CONFIG_SYS_PM_MIN_RESIDENCY_DEEP_SLEEP_1 * SECS_TO_TICKS / MSEC_PER_SEC,
#endif
#ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_2
CONFIG_SYS_PM_MIN_RESIDENCY_DEEP_SLEEP_2 * SECS_TO_TICKS / MSEC_PER_SEC,
#endif
#ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_3
CONFIG_SYS_PM_MIN_RESIDENCY_DEEP_SLEEP_3 * SECS_TO_TICKS / MSEC_PER_SEC,
#endif
#endif /* CONFIG_SYS_POWER_DEEP_SLEEP_STATES */
};
enum power_states sys_pm_policy_next_state(s32_t ticks)