pm: policy: add check for device busy in policy

Add check for device busy when CONFIG_PM_NEED_ALL_DEVICES_IDLE is
set to y because one or more devices may still in busy and causes
problem when system go into low power in Intel ISH platform.

Signed-off-by: Leifu Zhao <leifu.zhao@intel.com>
This commit is contained in:
Leifu Zhao 2023-08-22 16:42:51 +08:00 committed by Anas Nashif
commit 61ab3a844c
3 changed files with 17 additions and 0 deletions

View file

@ -18,4 +18,7 @@ config GDT_RESERVED_NUM_ENTRIES
config REBOOT
default y
config PM_NEED_ALL_DEVICES_IDLE
default y
endif

View file

@ -37,6 +37,13 @@ config PM_S2RAM
help
This option enables suspend-to-RAM (S2RAM).
config PM_NEED_ALL_DEVICES_IDLE
bool "System Low Power Mode Needs All Devices Idle"
depends on PM_DEVICE && !SMP
help
When this option is enabled, check that no devices are busy before
entering into system low power mode.
choice PM_POLICY
prompt "Idle State Power Management Policy"
default PM_POLICY_DEFAULT

View file

@ -14,6 +14,7 @@
#include <zephyr/sys/time_units.h>
#include <zephyr/sys/atomic.h>
#include <zephyr/toolchain.h>
#include <zephyr/pm/device.h>
#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_power_state)
@ -136,6 +137,12 @@ const struct pm_state_info *pm_policy_next_state(uint8_t cpu, int32_t ticks)
uint8_t num_cpu_states;
const struct pm_state_info *cpu_states;
#ifdef CONFIG_PM_NEED_ALL_DEVICES_IDLE
if (pm_device_is_any_busy()) {
return NULL;
}
#endif
if (ticks != K_TICKS_FOREVER) {
cyc = k_ticks_to_cyc_ceil32(ticks);
}