mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-08-28 15:15:21 +00:00
git grep -l 'u\(8\|16\|32\|64\)_t' | \ xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g" git grep -l 's\(8\|16\|32\|64\)_t' | \ xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g" Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
46 lines
954 B
C
46 lines
954 B
C
/*
|
|
* Copyright (c) 2018 Intel Corporation.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include <zephyr.h>
|
|
#include <kernel.h>
|
|
#include "pm_policy.h"
|
|
|
|
#include <logging/log.h>
|
|
LOG_MODULE_DECLARE(power, CONFIG_SYS_PM_LOG_LEVEL);
|
|
|
|
enum power_states sys_pm_policy_next_state(int32_t ticks)
|
|
{
|
|
static uint8_t cur_power_state;
|
|
int i = cur_power_state;
|
|
|
|
if (SYS_POWER_STATE_MAX == 0) {
|
|
/* No power states to go through. */
|
|
return SYS_POWER_STATE_ACTIVE;
|
|
}
|
|
|
|
do {
|
|
i = (i + 1) % SYS_POWER_STATE_MAX;
|
|
|
|
#ifdef CONFIG_SYS_PM_STATE_LOCK
|
|
if (!sys_pm_ctrl_is_state_enabled((enum power_states)(i))) {
|
|
continue;
|
|
}
|
|
#endif
|
|
cur_power_state = i;
|
|
|
|
LOG_DBG("Selected power state: %u", i);
|
|
return (enum power_states)(i);
|
|
} while (i != cur_power_state);
|
|
|
|
LOG_DBG("No suitable power state found!");
|
|
return SYS_POWER_STATE_ACTIVE;
|
|
}
|
|
|
|
__weak bool sys_pm_policy_low_power_devices(enum power_states pm_state)
|
|
{
|
|
return sys_pm_is_sleep_state(pm_state);
|
|
}
|