Branch data Line data Source code
1 : : /* 2 : : * Copyright (c) 2017 Intel Corporation. 3 : : * Copyright (c) 2019 Nordic Semiconductor ASA 4 : : * 5 : : * SPDX-License-Identifier: Apache-2.0 6 : : */ 7 : : #include <zephyr.h> 8 : : #include <pm/pm.h> 9 : : 10 : : #include <hal/nrf_regulators.h> 11 : : 12 : : #include <logging/log.h> 13 : : LOG_MODULE_DECLARE(soc, CONFIG_SOC_LOG_LEVEL); 14 : : 15 : : /* Invoke Low Power/System Off specific Tasks */ 16 : 0 : __weak void pm_state_set(enum pm_state state, uint8_t substate_id) 17 : : { 18 : : ARG_UNUSED(substate_id); 19 : : 20 [ # # ]: 0 : switch (state) { 21 : 0 : case PM_STATE_SOFT_OFF: 22 : 0 : nrf_regulators_system_off(NRF_REGULATORS); 23 : 0 : break; 24 : 0 : default: 25 [ # # ]: 0 : LOG_DBG("Unsupported power state %u", state); 26 : 0 : break; 27 : : } 28 : 0 : } 29 : : 30 : : /* Handle SOC specific activity after Low Power Mode Exit */ 31 : 0 : __weak void pm_state_exit_post_ops(enum pm_state state, uint8_t substate_id) 32 : : { 33 : : ARG_UNUSED(substate_id); 34 : : 35 [ # # ]: 0 : switch (state) { 36 : 0 : case PM_STATE_SOFT_OFF: 37 : : /* Nothing to do. */ 38 : 0 : break; 39 : 0 : default: 40 [ # # ]: 0 : LOG_DBG("Unsupported power state %u", state); 41 : 0 : break; 42 : : } 43 : : 44 : : /* 45 : : * System is now in active mode. Reenable interrupts which were disabled 46 : : * when OS started idling code. 47 : : */ 48 : 0 : irq_unlock(0); 49 : 0 : }