1 /*
2  * Copyright (c) 2020, MediaTek Inc. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef PLAT_PM_H
8 #define PLAT_PM_H
9 
10 #include <lib/utils_def.h>
11 
12 #define MT_PLAT_PWR_STATE_CPU			U(1)
13 #define MT_PLAT_PWR_STATE_CLUSTER		U(2)
14 #define MT_PLAT_PWR_STATE_MCUSYS		U(3)
15 #define MT_PLAT_PWR_STATE_SUSPEND2IDLE		U(8)
16 #define MT_PLAT_PWR_STATE_SYSTEM_SUSPEND	U(9)
17 
18 #define MTK_LOCAL_STATE_RUN			U(0)
19 #define MTK_LOCAL_STATE_RET			U(1)
20 #define MTK_LOCAL_STATE_OFF			U(2)
21 
22 #define MTK_AFFLVL_CPU				U(0)
23 #define MTK_AFFLVL_CLUSTER			U(1)
24 #define MTK_AFFLVL_MCUSYS			U(2)
25 #define MTK_AFFLVL_SYSTEM			U(3)
26 
27 #define IS_CLUSTER_OFF_STATE(s)		\
28 		is_local_state_off(s->pwr_domain_state[MTK_AFFLVL_CLUSTER])
29 #define IS_MCUSYS_OFF_STATE(s)		\
30 		is_local_state_off(s->pwr_domain_state[MTK_AFFLVL_MCUSYS])
31 #define IS_SYSTEM_SUSPEND_STATE(s)	\
32 		is_local_state_off(s->pwr_domain_state[MTK_AFFLVL_SYSTEM])
33 
34 #define IS_PLAT_SUSPEND_ID(stateid)\
35 		((stateid == MT_PLAT_PWR_STATE_SUSPEND2IDLE)	\
36 		|| (stateid == MT_PLAT_PWR_STATE_SYSTEM_SUSPEND))
37 
38 #endif /* PLAT_PM_H */
39