1 /* 2 * Copyright (c) 2022 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <zephyr/logging/log.h> 8 #include <zephyr/kernel.h> 9 #include <zephyr/pm/pm.h> 10 11 LOG_MODULE_REGISTER(soc_pm, CONFIG_APP_LOG_LEVEL); 12 state2str(enum pm_state state)13static const char *state2str(enum pm_state state) 14 { 15 switch (state) { 16 case PM_STATE_RUNTIME_IDLE: 17 return "RUNTIME_IDLE"; 18 case PM_STATE_SUSPEND_TO_IDLE: 19 return "SUSPEND_TO_IDLE"; 20 case PM_STATE_STANDBY: 21 return "STANDBY"; 22 case PM_STATE_SUSPEND_TO_RAM: 23 return "SUSPEND_TO_RAM"; 24 case PM_STATE_SUSPEND_TO_DISK: 25 return "SUSPEND_TO_DISK"; 26 case PM_STATE_SOFT_OFF: 27 return "SOFT_OFF"; 28 default: 29 return "UNKNOWN"; 30 } 31 } 32 33 /* 34 * PM callbacks are typically implemented at SoC level and run the actual 35 * code to enter the given PM state. 36 */ 37 pm_state_set(enum pm_state state,uint8_t substate_id)38void pm_state_set(enum pm_state state, uint8_t substate_id) 39 { 40 LOG_INF("Entering %s{%u}", state2str(state), substate_id); 41 k_cpu_idle(); 42 } 43 pm_state_exit_post_ops(enum pm_state state,uint8_t substate_id)44void pm_state_exit_post_ops(enum pm_state state, uint8_t substate_id) 45 { 46 ARG_UNUSED(state); 47 ARG_UNUSED(substate_id); 48 } 49