diff options
-rw-r--r-- | zephyr/shim/chip/npcx/power_policy.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/zephyr/shim/chip/npcx/power_policy.c b/zephyr/shim/chip/npcx/power_policy.c index e3f280438f..ff3efaf84a 100644 --- a/zephyr/shim/chip/npcx/power_policy.c +++ b/zephyr/shim/chip/npcx/power_policy.c @@ -4,12 +4,20 @@ */ #include <zephyr.h> -#include <power/power.h> #include <soc.h> #include "console.h" +#include "cros_version.h" #include "system.h" +#if IS_ZEPHYR_VERSION(2, 6) +#include <pm/pm.h> +#elif IS_ZEPHYR_VERSION(2, 5) +#include <power/power.h> +#else +#error "Unsupported Zephyr version" +#endif + static const struct pm_state_info pm_min_residency[] = PM_STATE_INFO_DT_ITEMS_LIST(DT_NODELABEL(cpu0)); @@ -35,5 +43,23 @@ struct pm_state_info pm_policy_next_state(int32_t ticks) /* CROS PM device policy handler */ bool pm_policy_low_power_devices(enum pm_state state) { +#if IS_ZEPHYR_VERSION(2, 6) + bool ret = true; + + switch (state) { + case PM_STATE_RUNTIME_IDLE: + __fallthrough; + case PM_STATE_SUSPEND_TO_IDLE: + __fallthrough; + case PM_STATE_STANDBY: + break; + default: + ret = false; + break; + } + + return ret; +#elif IS_ZEPHYR_VERSION(2, 5) return pm_is_sleep_state(state); +#endif } |