15fc3aeebSyanyang1 /*
25fc3aeebSyanyang1  * Copyright 2015 Advanced Micro Devices, Inc.
35fc3aeebSyanyang1  *
45fc3aeebSyanyang1  * Permission is hereby granted, free of charge, to any person obtaining a
55fc3aeebSyanyang1  * copy of this software and associated documentation files (the "Software"),
65fc3aeebSyanyang1  * to deal in the Software without restriction, including without limitation
75fc3aeebSyanyang1  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
85fc3aeebSyanyang1  * and/or sell copies of the Software, and to permit persons to whom the
95fc3aeebSyanyang1  * Software is furnished to do so, subject to the following conditions:
105fc3aeebSyanyang1  *
115fc3aeebSyanyang1  * The above copyright notice and this permission notice shall be included in
125fc3aeebSyanyang1  * all copies or substantial portions of the Software.
135fc3aeebSyanyang1  *
145fc3aeebSyanyang1  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
155fc3aeebSyanyang1  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
165fc3aeebSyanyang1  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
175fc3aeebSyanyang1  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
185fc3aeebSyanyang1  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
195fc3aeebSyanyang1  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
205fc3aeebSyanyang1  * OTHER DEALINGS IN THE SOFTWARE.
215fc3aeebSyanyang1  */
225fc3aeebSyanyang1 
235fc3aeebSyanyang1 #ifndef __AMD_SHARED_H__
245fc3aeebSyanyang1 #define __AMD_SHARED_H__
255fc3aeebSyanyang1 
26f674bd28SAkshu Agrawal #include <drm/amd_asic_type.h>
270b2daf09SJammy Zhou 
28cfa289fdSRex Zhu 
29617a64dcSEvan Quan #define AMD_MAX_USEC_TIMEOUT		1000000  /* 1000 ms */
302f7d10b3SJammy Zhou 
312f7d10b3SJammy Zhou /*
322f7d10b3SJammy Zhou  * Chip flags
332f7d10b3SJammy Zhou  */
342f7d10b3SJammy Zhou enum amd_chip_flags {
352f7d10b3SJammy Zhou 	AMD_ASIC_MASK = 0x0000ffffUL,
362f7d10b3SJammy Zhou 	AMD_FLAGS_MASK  = 0xffff0000UL,
372f7d10b3SJammy Zhou 	AMD_IS_MOBILITY = 0x00010000UL,
382f7d10b3SJammy Zhou 	AMD_IS_APU      = 0x00020000UL,
392f7d10b3SJammy Zhou 	AMD_IS_PX       = 0x00040000UL,
402f7d10b3SJammy Zhou 	AMD_EXP_HW_SUPPORT = 0x00080000UL,
412f7d10b3SJammy Zhou };
422f7d10b3SJammy Zhou 
4354f78a76SAlex Deucher enum amd_apu_flags {
4454f78a76SAlex Deucher 	AMD_APU_IS_RAVEN = 0x00000001UL,
4554f78a76SAlex Deucher 	AMD_APU_IS_RAVEN2 = 0x00000002UL,
4654f78a76SAlex Deucher 	AMD_APU_IS_PICASSO = 0x00000004UL,
4754f78a76SAlex Deucher 	AMD_APU_IS_RENOIR = 0x00000008UL,
48d205c3ccSAlex Deucher 	AMD_APU_IS_GREEN_SARDINE = 0x00000010UL,
49c345c89bSHuang Rui 	AMD_APU_IS_VANGOGH = 0x00000020UL,
50d0f56dc2STao Zhou 	AMD_APU_IS_CYAN_SKILLFISH2 = 0x00000040UL,
5154f78a76SAlex Deucher };
5254f78a76SAlex Deucher 
5352ef3a1aSRyan Taylor /**
5452ef3a1aSRyan Taylor * DOC: IP Blocks
5552ef3a1aSRyan Taylor *
5652ef3a1aSRyan Taylor * GPUs are composed of IP (intellectual property) blocks. These
5752ef3a1aSRyan Taylor * IP blocks provide various functionalities: display, graphics,
5852ef3a1aSRyan Taylor * video decode, etc. The IP blocks that comprise a particular GPU
5952ef3a1aSRyan Taylor * are listed in the GPU's respective SoC file. amdgpu_device.c
6052ef3a1aSRyan Taylor * acquires the list of IP blocks for the GPU in use on initialization.
6152ef3a1aSRyan Taylor * It can then operate on this list to perform standard driver operations
6252ef3a1aSRyan Taylor * such as: init, fini, suspend, resume, etc.
6352ef3a1aSRyan Taylor *
6452ef3a1aSRyan Taylor *
6552ef3a1aSRyan Taylor * IP block implementations are named using the following convention:
6652ef3a1aSRyan Taylor * <functionality>_v<version> (E.g.: gfx_v6_0).
6752ef3a1aSRyan Taylor */
6852ef3a1aSRyan Taylor 
6952ef3a1aSRyan Taylor /**
7052ef3a1aSRyan Taylor * enum amd_ip_block_type - Used to classify IP blocks by functionality.
7152ef3a1aSRyan Taylor *
7252ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_COMMON: GPU Family
7352ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_GMC: Graphics Memory Controller
7452ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_IH: Interrupt Handler
7552ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_SMC: System Management Controller
7652ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_PSP: Platform Security Processor
7752ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_DCE: Display and Compositing Engine
7852ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_GFX: Graphics and Compute Engine
7952ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_SDMA: System DMA Engine
8052ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_UVD: Unified Video Decoder
8152ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_VCE: Video Compression Engine
8252ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_ACP: Audio Co-Processor
8352ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_VCN: Video Core/Codec Next
8452ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_MES: Micro-Engine Scheduler
8552ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_JPEG: JPEG Engine
8652ef3a1aSRyan Taylor */
875fc3aeebSyanyang1 enum amd_ip_block_type {
885fc3aeebSyanyang1 	AMD_IP_BLOCK_TYPE_COMMON,
895fc3aeebSyanyang1 	AMD_IP_BLOCK_TYPE_GMC,
905fc3aeebSyanyang1 	AMD_IP_BLOCK_TYPE_IH,
915fc3aeebSyanyang1 	AMD_IP_BLOCK_TYPE_SMC,
920e5ca0d1SHuang Rui 	AMD_IP_BLOCK_TYPE_PSP,
935fc3aeebSyanyang1 	AMD_IP_BLOCK_TYPE_DCE,
945fc3aeebSyanyang1 	AMD_IP_BLOCK_TYPE_GFX,
955fc3aeebSyanyang1 	AMD_IP_BLOCK_TYPE_SDMA,
965fc3aeebSyanyang1 	AMD_IP_BLOCK_TYPE_UVD,
975fc3aeebSyanyang1 	AMD_IP_BLOCK_TYPE_VCE,
98a8fe58ceSMaruthi Bayyavarapu 	AMD_IP_BLOCK_TYPE_ACP,
99886f82aaSJack Xiao 	AMD_IP_BLOCK_TYPE_VCN,
1008d1b04a6SLeo Liu 	AMD_IP_BLOCK_TYPE_MES,
1016c08e0efSEvan Quan 	AMD_IP_BLOCK_TYPE_JPEG,
1026c08e0efSEvan Quan 	AMD_IP_BLOCK_TYPE_NUM,
1035fc3aeebSyanyang1 };
1045fc3aeebSyanyang1 
1055fc3aeebSyanyang1 enum amd_clockgating_state {
1065fc3aeebSyanyang1 	AMD_CG_STATE_GATE = 0,
1075fc3aeebSyanyang1 	AMD_CG_STATE_UNGATE,
1085fc3aeebSyanyang1 };
1095fc3aeebSyanyang1 
110e5d03ac2SRex Zhu 
1115fc3aeebSyanyang1 enum amd_powergating_state {
1125fc3aeebSyanyang1 	AMD_PG_STATE_GATE = 0,
1135fc3aeebSyanyang1 	AMD_PG_STATE_UNGATE,
1145fc3aeebSyanyang1 };
1155fc3aeebSyanyang1 
116cfa289fdSRex Zhu 
117e3b04bc7SAlex Deucher /* CG flags */
118e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_GFX_MGCG			(1 << 0)
119e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_GFX_MGLS			(1 << 1)
120e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_GFX_CGCG			(1 << 2)
121e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_GFX_CGLS			(1 << 3)
122e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_GFX_CGTS			(1 << 4)
123e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_GFX_CGTS_LS		(1 << 5)
124e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_GFX_CP_LS		(1 << 6)
125e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_GFX_RLC_LS		(1 << 7)
126e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_MC_LS			(1 << 8)
127e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_MC_MGCG			(1 << 9)
128e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_SDMA_LS			(1 << 10)
129e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_SDMA_MGCG		(1 << 11)
130e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_BIF_LS			(1 << 12)
131e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_UVD_MGCG			(1 << 13)
132e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_VCE_MGCG			(1 << 14)
133e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_HDP_LS			(1 << 15)
134e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_HDP_MGCG			(1 << 16)
1354fae91c5SAlex Deucher #define AMD_CG_SUPPORT_ROM_MGCG			(1 << 17)
136398d82ccSRex Zhu #define AMD_CG_SUPPORT_DRM_LS			(1 << 18)
137398d82ccSRex Zhu #define AMD_CG_SUPPORT_BIF_MGCG			(1 << 19)
138398d82ccSRex Zhu #define AMD_CG_SUPPORT_GFX_3D_CGCG		(1 << 20)
139398d82ccSRex Zhu #define AMD_CG_SUPPORT_GFX_3D_CGLS		(1 << 21)
140e929c98dSHuang Rui #define AMD_CG_SUPPORT_DRM_MGCG			(1 << 22)
141c773a632SHuang Rui #define AMD_CG_SUPPORT_DF_MGCG			(1 << 23)
1428dbb8cdfSRex Zhu #define AMD_CG_SUPPORT_VCN_MGCG			(1 << 24)
143714ff852SHawking Zhang #define AMD_CG_SUPPORT_HDP_DS			(1 << 25)
144714ff852SHawking Zhang #define AMD_CG_SUPPORT_HDP_SD			(1 << 26)
1459faa494eSHawking Zhang #define AMD_CG_SUPPORT_IH_CG			(1 << 27)
146367adb2aSJack Xiao #define AMD_CG_SUPPORT_ATHUB_LS			(1 << 28)
147367adb2aSJack Xiao #define AMD_CG_SUPPORT_ATHUB_MGCG		(1 << 29)
14818e6d414SLeo Liu #define AMD_CG_SUPPORT_JPEG_MGCG		(1 << 30)
149adf16996SJinzhou.Su #define AMD_CG_SUPPORT_GFX_FGCG			(1 << 31)
150e3b04bc7SAlex Deucher /* PG flags */
151e3b04bc7SAlex Deucher #define AMD_PG_SUPPORT_GFX_PG			(1 << 0)
152e3b04bc7SAlex Deucher #define AMD_PG_SUPPORT_GFX_SMG			(1 << 1)
153e3b04bc7SAlex Deucher #define AMD_PG_SUPPORT_GFX_DMG			(1 << 2)
154e3b04bc7SAlex Deucher #define AMD_PG_SUPPORT_UVD			(1 << 3)
155e3b04bc7SAlex Deucher #define AMD_PG_SUPPORT_VCE			(1 << 4)
156e3b04bc7SAlex Deucher #define AMD_PG_SUPPORT_CP			(1 << 5)
157e3b04bc7SAlex Deucher #define AMD_PG_SUPPORT_GDS			(1 << 6)
158e3b04bc7SAlex Deucher #define AMD_PG_SUPPORT_RLC_SMU_HS		(1 << 7)
159e3b04bc7SAlex Deucher #define AMD_PG_SUPPORT_SDMA			(1 << 8)
160e3b04bc7SAlex Deucher #define AMD_PG_SUPPORT_ACP			(1 << 9)
161e3b04bc7SAlex Deucher #define AMD_PG_SUPPORT_SAMU			(1 << 10)
1626b0432b7SAlex Deucher #define AMD_PG_SUPPORT_GFX_QUICK_MG		(1 << 11)
1636b0432b7SAlex Deucher #define AMD_PG_SUPPORT_GFX_PIPELINE		(1 << 12)
164f8386b35SHawking Zhang #define AMD_PG_SUPPORT_MMHUB			(1 << 13)
1658dbb8cdfSRex Zhu #define AMD_PG_SUPPORT_VCN			(1 << 14)
166f28ff062SJames Zhu #define AMD_PG_SUPPORT_VCN_DPG			(1 << 15)
167a201b6acSHuang Rui #define AMD_PG_SUPPORT_ATHUB			(1 << 16)
16818e6d414SLeo Liu #define AMD_PG_SUPPORT_JPEG			(1 << 17)
169e3b04bc7SAlex Deucher 
170549750a3SRyan Taylor /**
171549750a3SRyan Taylor  * enum PP_FEATURE_MASK - Used to mask power play features.
172549750a3SRyan Taylor  *
173549750a3SRyan Taylor  * @PP_SCLK_DPM_MASK: Dynamic adjustment of the system (graphics) clock.
174549750a3SRyan Taylor  * @PP_MCLK_DPM_MASK: Dynamic adjustment of the memory clock.
175549750a3SRyan Taylor  * @PP_PCIE_DPM_MASK: Dynamic adjustment of PCIE clocks and lanes.
176549750a3SRyan Taylor  * @PP_SCLK_DEEP_SLEEP_MASK: System (graphics) clock deep sleep.
177549750a3SRyan Taylor  * @PP_POWER_CONTAINMENT_MASK: Power containment.
178549750a3SRyan Taylor  * @PP_UVD_HANDSHAKE_MASK: Unified video decoder handshake.
179549750a3SRyan Taylor  * @PP_SMC_VOLTAGE_CONTROL_MASK: Dynamic voltage control.
180549750a3SRyan Taylor  * @PP_VBI_TIME_SUPPORT_MASK: Vertical blank interval support.
181549750a3SRyan Taylor  * @PP_ULV_MASK: Ultra low voltage.
182549750a3SRyan Taylor  * @PP_ENABLE_GFX_CG_THRU_SMU: SMU control of GFX engine clockgating.
183549750a3SRyan Taylor  * @PP_CLOCK_STRETCH_MASK: Clock stretching.
184549750a3SRyan Taylor  * @PP_OD_FUZZY_FAN_CONTROL_MASK: Overdrive fuzzy fan control.
185549750a3SRyan Taylor  * @PP_SOCCLK_DPM_MASK: Dynamic adjustment of the SoC clock.
186549750a3SRyan Taylor  * @PP_DCEFCLK_DPM_MASK: Dynamic adjustment of the Display Controller Engine Fabric clock.
187549750a3SRyan Taylor  * @PP_OVERDRIVE_MASK: Over- and under-clocking support.
188549750a3SRyan Taylor  * @PP_GFXOFF_MASK: Dynamic graphics engine power control.
189549750a3SRyan Taylor  * @PP_ACG_MASK: Adaptive clock generator.
190549750a3SRyan Taylor  * @PP_STUTTER_MODE: Stutter mode.
191549750a3SRyan Taylor  * @PP_AVFS_MASK: Adaptive voltage and frequency scaling.
192549750a3SRyan Taylor  *
193549750a3SRyan Taylor  * To override these settings on boot, append amdgpu.ppfeaturemask=<mask> to
194549750a3SRyan Taylor  * the kernel's command line parameters. This is usually done through a system's
195549750a3SRyan Taylor  * boot loader (E.g. GRUB). If manually loading the driver, pass
196549750a3SRyan Taylor  * ppfeaturemask=<mask> as a modprobe parameter.
197549750a3SRyan Taylor  */
198fa7bd27dSHuang Rui enum PP_FEATURE_MASK {
199fa7bd27dSHuang Rui 	PP_SCLK_DPM_MASK = 0x1,
200fa7bd27dSHuang Rui 	PP_MCLK_DPM_MASK = 0x2,
201fa7bd27dSHuang Rui 	PP_PCIE_DPM_MASK = 0x4,
202fa7bd27dSHuang Rui 	PP_SCLK_DEEP_SLEEP_MASK = 0x8,
203fa7bd27dSHuang Rui 	PP_POWER_CONTAINMENT_MASK = 0x10,
204fa7bd27dSHuang Rui 	PP_UVD_HANDSHAKE_MASK = 0x20,
205fa7bd27dSHuang Rui 	PP_SMC_VOLTAGE_CONTROL_MASK = 0x40,
206fa7bd27dSHuang Rui 	PP_VBI_TIME_SUPPORT_MASK = 0x80,
207fa7bd27dSHuang Rui 	PP_ULV_MASK = 0x100,
208fa7bd27dSHuang Rui 	PP_ENABLE_GFX_CG_THRU_SMU = 0x200,
209fa7bd27dSHuang Rui 	PP_CLOCK_STRETCH_MASK = 0x400,
210fa7bd27dSHuang Rui 	PP_OD_FUZZY_FAN_CONTROL_MASK = 0x800,
211fa7bd27dSHuang Rui 	PP_SOCCLK_DPM_MASK = 0x1000,
212fa7bd27dSHuang Rui 	PP_DCEFCLK_DPM_MASK = 0x2000,
213fa7bd27dSHuang Rui 	PP_OVERDRIVE_MASK = 0x4000,
2146f92ad2aSHuang Rui 	PP_GFXOFF_MASK = 0x8000,
215fa7bd27dSHuang Rui 	PP_ACG_MASK = 0x10000,
21622994e16Srex zhu 	PP_STUTTER_MODE = 0x20000,
217a4ead3e5SAlex Deucher 	PP_AVFS_MASK = 0x40000,
218680602d6SKenneth Feng 	PP_GFX_DCS_MASK = 0x80000,
219fa7bd27dSHuang Rui };
220fa7bd27dSHuang Rui 
22183a0b863SLikun GAO enum amd_harvest_ip_mask {
22283a0b863SLikun GAO     AMD_HARVEST_IP_VCN_MASK = 0x1,
22383a0b863SLikun GAO     AMD_HARVEST_IP_JPEG_MASK = 0x2,
22483a0b863SLikun GAO     AMD_HARVEST_IP_DMU_MASK = 0x4,
22583a0b863SLikun GAO };
22683a0b863SLikun GAO 
2277875a226SAlex Deucher enum DC_FEATURE_MASK {
228a5148245SZhan Liu 	//Default value can be found at "uint amdgpu_dc_feature_mask"
229a5148245SZhan Liu 	DC_FBC_MASK = (1 << 0), //0x1, disabled by default
230a5148245SZhan Liu 	DC_MULTI_MON_PP_MCLK_SWITCH_MASK = (1 << 1), //0x2, enabled by default
231a5148245SZhan Liu 	DC_DISABLE_FRACTIONAL_PWM_MASK = (1 << 2), //0x4, disabled by default
2329470620eSNicholas Kazlauskas 	DC_PSR_MASK = (1 << 3), //0x8, disabled by default for dcn < 3.1
233a5148245SZhan Liu 	DC_EDP_NO_POWER_SEQUENCING = (1 << 4), //0x10, disabled by default
234*12320274SAurabindo Pillai 	DC_DISABLE_LTTPR_DP1_4A = (1 << 5), //0x20, disabled by default
235*12320274SAurabindo Pillai 	DC_DISABLE_LTTPR_DP2_0 = (1 << 6), //0x40, disabled by default
2367875a226SAlex Deucher };
2377875a226SAlex Deucher 
2388a791dabSHarry Wentland enum DC_DEBUG_MASK {
2398a791dabSHarry Wentland 	DC_DISABLE_PIPE_SPLIT = 0x1,
2408a791dabSHarry Wentland 	DC_DISABLE_STUTTER = 0x2,
2418a791dabSHarry Wentland 	DC_DISABLE_DSC = 0x4,
2429470620eSNicholas Kazlauskas 	DC_DISABLE_CLOCK_GATING = 0x8,
2439470620eSNicholas Kazlauskas 	DC_DISABLE_PSR = 0x10,
2448a791dabSHarry Wentland };
2458a791dabSHarry Wentland 
24649d27e91SChengming Gui enum amd_dpm_forced_level;
24752ef3a1aSRyan Taylor 
24843911fb6SDarren Powell /**
24943911fb6SDarren Powell  * struct amd_ip_funcs - general hooks for managing amdgpu IP Blocks
25052ef3a1aSRyan Taylor  * @name: Name of IP block
25152ef3a1aSRyan Taylor  * @early_init: sets up early driver state (pre sw_init),
25252ef3a1aSRyan Taylor  *              does not configure hw - Optional
25352ef3a1aSRyan Taylor  * @late_init: sets up late driver/hw state (post hw_init) - Optional
25452ef3a1aSRyan Taylor  * @sw_init: sets up driver state, does not configure hw
25552ef3a1aSRyan Taylor  * @sw_fini: tears down driver state, does not configure hw
256e9669fb7SAndrey Grodzovsky  * @early_fini: tears down stuff before dev detached from driver
25752ef3a1aSRyan Taylor  * @hw_init: sets up the hw state
25852ef3a1aSRyan Taylor  * @hw_fini: tears down the hw state
25952ef3a1aSRyan Taylor  * @late_fini: final cleanup
26052ef3a1aSRyan Taylor  * @suspend: handles IP specific hw/sw changes for suspend
26152ef3a1aSRyan Taylor  * @resume: handles IP specific hw/sw changes for resume
26252ef3a1aSRyan Taylor  * @is_idle: returns current IP block idle status
26352ef3a1aSRyan Taylor  * @wait_for_idle: poll for idle
26452ef3a1aSRyan Taylor  * @check_soft_reset: check soft reset the IP block
26552ef3a1aSRyan Taylor  * @pre_soft_reset: pre soft reset the IP block
26652ef3a1aSRyan Taylor  * @soft_reset: soft reset the IP block
26752ef3a1aSRyan Taylor  * @post_soft_reset: post soft reset the IP block
26852ef3a1aSRyan Taylor  * @set_clockgating_state: enable/disable cg for the IP block
26952ef3a1aSRyan Taylor  * @set_powergating_state: enable/disable pg for the IP block
27052ef3a1aSRyan Taylor  * @get_clockgating_state: get current clockgating status
27152ef3a1aSRyan Taylor  * @enable_umd_pstate: enable UMD powerstate
27252ef3a1aSRyan Taylor  *
27352ef3a1aSRyan Taylor  * These hooks provide an interface for controlling the operational state
27452ef3a1aSRyan Taylor  * of IP blocks. After acquiring a list of IP blocks for the GPU in use,
27552ef3a1aSRyan Taylor  * the driver can make chip-wide state changes by walking this list and
27652ef3a1aSRyan Taylor  * making calls to hooks from each IP block. This list is ordered to ensure
27752ef3a1aSRyan Taylor  * that the driver initializes the IP blocks in a safe sequence.
27843911fb6SDarren Powell  */
2795fc3aeebSyanyang1 struct amd_ip_funcs {
28088a907d6STom St Denis 	char *name;
2815fc3aeebSyanyang1 	int (*early_init)(void *handle);
2825fc3aeebSyanyang1 	int (*late_init)(void *handle);
2835fc3aeebSyanyang1 	int (*sw_init)(void *handle);
2845fc3aeebSyanyang1 	int (*sw_fini)(void *handle);
285e9669fb7SAndrey Grodzovsky 	int (*early_fini)(void *handle);
2865fc3aeebSyanyang1 	int (*hw_init)(void *handle);
2875fc3aeebSyanyang1 	int (*hw_fini)(void *handle);
288212cb3b6SMonk Liu 	void (*late_fini)(void *handle);
2895fc3aeebSyanyang1 	int (*suspend)(void *handle);
2905fc3aeebSyanyang1 	int (*resume)(void *handle);
2915fc3aeebSyanyang1 	bool (*is_idle)(void *handle);
2925fc3aeebSyanyang1 	int (*wait_for_idle)(void *handle);
293da146d3bSAlex Deucher 	bool (*check_soft_reset)(void *handle);
294d31a501eSChunming Zhou 	int (*pre_soft_reset)(void *handle);
2955fc3aeebSyanyang1 	int (*soft_reset)(void *handle);
29635d782feSChunming Zhou 	int (*post_soft_reset)(void *handle);
2975fc3aeebSyanyang1 	int (*set_clockgating_state)(void *handle,
2985fc3aeebSyanyang1 				     enum amd_clockgating_state state);
2995fc3aeebSyanyang1 	int (*set_powergating_state)(void *handle,
3005fc3aeebSyanyang1 				     enum amd_powergating_state state);
3016cb2d4e4SHuang Rui 	void (*get_clockgating_state)(void *handle, u32 *flags);
30249d27e91SChengming Gui 	int (*enable_umd_pstate)(void *handle, enum amd_dpm_forced_level *level);
3035fc3aeebSyanyang1 };
3045fc3aeebSyanyang1 
305f93f0c3aSRex Zhu 
3065fc3aeebSyanyang1 #endif /* __AMD_SHARED_H__ */
307