xref: /linux/drivers/gpu/drm/amd/pm/legacy-dpm/ppsmc.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1*837d542aSEvan Quan /*
2*837d542aSEvan Quan  * Copyright 2011 Advanced Micro Devices, Inc.
3*837d542aSEvan Quan  *
4*837d542aSEvan Quan  * Permission is hereby granted, free of charge, to any person obtaining a
5*837d542aSEvan Quan  * copy of this software and associated documentation files (the "Software"),
6*837d542aSEvan Quan  * to deal in the Software without restriction, including without limitation
7*837d542aSEvan Quan  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*837d542aSEvan Quan  * and/or sell copies of the Software, and to permit persons to whom the
9*837d542aSEvan Quan  * Software is furnished to do so, subject to the following conditions:
10*837d542aSEvan Quan  *
11*837d542aSEvan Quan  * The above copyright notice and this permission notice shall be included in
12*837d542aSEvan Quan  * all copies or substantial portions of the Software.
13*837d542aSEvan Quan  *
14*837d542aSEvan Quan  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15*837d542aSEvan Quan  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16*837d542aSEvan Quan  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17*837d542aSEvan Quan  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18*837d542aSEvan Quan  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19*837d542aSEvan Quan  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20*837d542aSEvan Quan  * OTHER DEALINGS IN THE SOFTWARE.
21*837d542aSEvan Quan  *
22*837d542aSEvan Quan  */
23*837d542aSEvan Quan #ifndef PP_SMC_H
24*837d542aSEvan Quan #define PP_SMC_H
25*837d542aSEvan Quan 
26*837d542aSEvan Quan #pragma pack(push, 1)
27*837d542aSEvan Quan 
28*837d542aSEvan Quan #define PPSMC_SWSTATE_FLAG_DC                           0x01
29*837d542aSEvan Quan #define PPSMC_SWSTATE_FLAG_UVD                          0x02
30*837d542aSEvan Quan #define PPSMC_SWSTATE_FLAG_VCE                          0x04
31*837d542aSEvan Quan #define PPSMC_SWSTATE_FLAG_PCIE_X1                      0x08
32*837d542aSEvan Quan 
33*837d542aSEvan Quan #define PPSMC_THERMAL_PROTECT_TYPE_INTERNAL             0x00
34*837d542aSEvan Quan #define PPSMC_THERMAL_PROTECT_TYPE_EXTERNAL             0x01
35*837d542aSEvan Quan #define PPSMC_THERMAL_PROTECT_TYPE_NONE                 0xff
36*837d542aSEvan Quan 
37*837d542aSEvan Quan #define PPSMC_SYSTEMFLAG_GPIO_DC                        0x01
38*837d542aSEvan Quan #define PPSMC_SYSTEMFLAG_STEPVDDC                       0x02
39*837d542aSEvan Quan #define PPSMC_SYSTEMFLAG_GDDR5                          0x04
40*837d542aSEvan Quan #define PPSMC_SYSTEMFLAG_DISABLE_BABYSTEP               0x08
41*837d542aSEvan Quan #define PPSMC_SYSTEMFLAG_REGULATOR_HOT                  0x10
42*837d542aSEvan Quan #define PPSMC_SYSTEMFLAG_REGULATOR_HOT_ANALOG           0x20
43*837d542aSEvan Quan #define PPSMC_SYSTEMFLAG_REGULATOR_HOT_PROG_GPIO        0x40
44*837d542aSEvan Quan 
45*837d542aSEvan Quan #define PPSMC_EXTRAFLAGS_AC2DC_ACTION_MASK              0x07
46*837d542aSEvan Quan #define PPSMC_EXTRAFLAGS_AC2DC_DONT_WAIT_FOR_VBLANK     0x08
47*837d542aSEvan Quan #define PPSMC_EXTRAFLAGS_AC2DC_ACTION_GOTODPMLOWSTATE   0x00
48*837d542aSEvan Quan #define PPSMC_EXTRAFLAGS_AC2DC_ACTION_GOTOINITIALSTATE  0x01
49*837d542aSEvan Quan #define PPSMC_EXTRAFLAGS_AC2DC_GPIO5_POLARITY_HIGH      0x02
50*837d542aSEvan Quan 
51*837d542aSEvan Quan #define PPSMC_DISPLAY_WATERMARK_LOW                     0
52*837d542aSEvan Quan #define PPSMC_DISPLAY_WATERMARK_HIGH                    1
53*837d542aSEvan Quan 
54*837d542aSEvan Quan #define PPSMC_STATEFLAG_AUTO_PULSE_SKIP    0x01
55*837d542aSEvan Quan #define PPSMC_STATEFLAG_POWERBOOST         0x02
56*837d542aSEvan Quan #define PPSMC_STATEFLAG_DEEPSLEEP_THROTTLE 0x20
57*837d542aSEvan Quan #define PPSMC_STATEFLAG_DEEPSLEEP_BYPASS   0x40
58*837d542aSEvan Quan 
59*837d542aSEvan Quan #define FDO_MODE_HARDWARE 0
60*837d542aSEvan Quan #define FDO_MODE_PIECE_WISE_LINEAR 1
61*837d542aSEvan Quan 
62*837d542aSEvan Quan enum FAN_CONTROL {
63*837d542aSEvan Quan 	FAN_CONTROL_FUZZY,
64*837d542aSEvan Quan 	FAN_CONTROL_TABLE
65*837d542aSEvan Quan };
66*837d542aSEvan Quan 
67*837d542aSEvan Quan #define PPSMC_Result_OK             ((uint8_t)0x01)
68*837d542aSEvan Quan #define PPSMC_Result_Failed         ((uint8_t)0xFF)
69*837d542aSEvan Quan 
70*837d542aSEvan Quan typedef uint8_t PPSMC_Result;
71*837d542aSEvan Quan 
72*837d542aSEvan Quan #define PPSMC_MSG_Halt                      ((uint8_t)0x10)
73*837d542aSEvan Quan #define PPSMC_MSG_Resume                    ((uint8_t)0x11)
74*837d542aSEvan Quan #define PPSMC_MSG_ZeroLevelsDisabled        ((uint8_t)0x13)
75*837d542aSEvan Quan #define PPSMC_MSG_OneLevelsDisabled         ((uint8_t)0x14)
76*837d542aSEvan Quan #define PPSMC_MSG_TwoLevelsDisabled         ((uint8_t)0x15)
77*837d542aSEvan Quan #define PPSMC_MSG_EnableThermalInterrupt    ((uint8_t)0x16)
78*837d542aSEvan Quan #define PPSMC_MSG_RunningOnAC               ((uint8_t)0x17)
79*837d542aSEvan Quan #define PPSMC_MSG_SwitchToSwState           ((uint8_t)0x20)
80*837d542aSEvan Quan #define PPSMC_MSG_SwitchToInitialState      ((uint8_t)0x40)
81*837d542aSEvan Quan #define PPSMC_MSG_NoForcedLevel             ((uint8_t)0x41)
82*837d542aSEvan Quan #define PPSMC_MSG_ForceHigh                 ((uint8_t)0x42)
83*837d542aSEvan Quan #define PPSMC_MSG_ForceMediumOrHigh         ((uint8_t)0x43)
84*837d542aSEvan Quan #define PPSMC_MSG_SwitchToMinimumPower      ((uint8_t)0x51)
85*837d542aSEvan Quan #define PPSMC_MSG_ResumeFromMinimumPower    ((uint8_t)0x52)
86*837d542aSEvan Quan #define PPSMC_MSG_EnableCac                 ((uint8_t)0x53)
87*837d542aSEvan Quan #define PPSMC_MSG_DisableCac                ((uint8_t)0x54)
88*837d542aSEvan Quan #define PPSMC_TDPClampingActive             ((uint8_t)0x59)
89*837d542aSEvan Quan #define PPSMC_TDPClampingInactive           ((uint8_t)0x5A)
90*837d542aSEvan Quan #define PPSMC_StartFanControl               ((uint8_t)0x5B)
91*837d542aSEvan Quan #define PPSMC_StopFanControl                ((uint8_t)0x5C)
92*837d542aSEvan Quan #define PPSMC_MSG_NoDisplay                 ((uint8_t)0x5D)
93*837d542aSEvan Quan #define PPSMC_NoDisplay                     ((uint8_t)0x5D)
94*837d542aSEvan Quan #define PPSMC_MSG_HasDisplay                ((uint8_t)0x5E)
95*837d542aSEvan Quan #define PPSMC_HasDisplay                    ((uint8_t)0x5E)
96*837d542aSEvan Quan #define PPSMC_MSG_UVDPowerOFF               ((uint8_t)0x60)
97*837d542aSEvan Quan #define PPSMC_MSG_UVDPowerON                ((uint8_t)0x61)
98*837d542aSEvan Quan #define PPSMC_MSG_EnableULV                 ((uint8_t)0x62)
99*837d542aSEvan Quan #define PPSMC_MSG_DisableULV                ((uint8_t)0x63)
100*837d542aSEvan Quan #define PPSMC_MSG_EnterULV                  ((uint8_t)0x64)
101*837d542aSEvan Quan #define PPSMC_MSG_ExitULV                   ((uint8_t)0x65)
102*837d542aSEvan Quan #define PPSMC_CACLongTermAvgEnable          ((uint8_t)0x6E)
103*837d542aSEvan Quan #define PPSMC_CACLongTermAvgDisable         ((uint8_t)0x6F)
104*837d542aSEvan Quan #define PPSMC_MSG_CollectCAC_PowerCorreln   ((uint8_t)0x7A)
105*837d542aSEvan Quan #define PPSMC_FlushDataCache                ((uint8_t)0x80)
106*837d542aSEvan Quan #define PPSMC_MSG_SetEnabledLevels          ((uint8_t)0x82)
107*837d542aSEvan Quan #define PPSMC_MSG_SetForcedLevels           ((uint8_t)0x83)
108*837d542aSEvan Quan #define PPSMC_MSG_ResetToDefaults           ((uint8_t)0x84)
109*837d542aSEvan Quan #define PPSMC_MSG_EnableDTE                 ((uint8_t)0x87)
110*837d542aSEvan Quan #define PPSMC_MSG_DisableDTE                ((uint8_t)0x88)
111*837d542aSEvan Quan #define PPSMC_MSG_ThrottleOVRDSCLKDS        ((uint8_t)0x96)
112*837d542aSEvan Quan #define PPSMC_MSG_CancelThrottleOVRDSCLKDS  ((uint8_t)0x97)
113*837d542aSEvan Quan #define PPSMC_MSG_EnableACDCGPIOInterrupt   ((uint16_t) 0x149)
114*837d542aSEvan Quan 
115*837d542aSEvan Quan /* CI/KV/KB */
116*837d542aSEvan Quan #define PPSMC_MSG_UVDDPM_SetEnabledMask       ((uint16_t) 0x12D)
117*837d542aSEvan Quan #define PPSMC_MSG_VCEDPM_SetEnabledMask       ((uint16_t) 0x12E)
118*837d542aSEvan Quan #define PPSMC_MSG_ACPDPM_SetEnabledMask       ((uint16_t) 0x12F)
119*837d542aSEvan Quan #define PPSMC_MSG_SAMUDPM_SetEnabledMask      ((uint16_t) 0x130)
120*837d542aSEvan Quan #define PPSMC_MSG_MCLKDPM_ForceState          ((uint16_t) 0x131)
121*837d542aSEvan Quan #define PPSMC_MSG_MCLKDPM_NoForcedLevel       ((uint16_t) 0x132)
122*837d542aSEvan Quan #define PPSMC_MSG_Thermal_Cntl_Disable        ((uint16_t) 0x133)
123*837d542aSEvan Quan #define PPSMC_MSG_Voltage_Cntl_Disable        ((uint16_t) 0x135)
124*837d542aSEvan Quan #define PPSMC_MSG_PCIeDPM_Enable              ((uint16_t) 0x136)
125*837d542aSEvan Quan #define PPSMC_MSG_PCIeDPM_Disable             ((uint16_t) 0x13d)
126*837d542aSEvan Quan #define PPSMC_MSG_ACPPowerOFF                 ((uint16_t) 0x137)
127*837d542aSEvan Quan #define PPSMC_MSG_ACPPowerON                  ((uint16_t) 0x138)
128*837d542aSEvan Quan #define PPSMC_MSG_SAMPowerOFF                 ((uint16_t) 0x139)
129*837d542aSEvan Quan #define PPSMC_MSG_SAMPowerON                  ((uint16_t) 0x13a)
130*837d542aSEvan Quan #define PPSMC_MSG_PCIeDPM_Disable             ((uint16_t) 0x13d)
131*837d542aSEvan Quan #define PPSMC_MSG_NBDPM_Enable                ((uint16_t) 0x140)
132*837d542aSEvan Quan #define PPSMC_MSG_NBDPM_Disable               ((uint16_t) 0x141)
133*837d542aSEvan Quan #define PPSMC_MSG_SCLKDPM_SetEnabledMask      ((uint16_t) 0x145)
134*837d542aSEvan Quan #define PPSMC_MSG_MCLKDPM_SetEnabledMask      ((uint16_t) 0x146)
135*837d542aSEvan Quan #define PPSMC_MSG_PCIeDPM_ForceLevel          ((uint16_t) 0x147)
136*837d542aSEvan Quan #define PPSMC_MSG_PCIeDPM_UnForceLevel        ((uint16_t) 0x148)
137*837d542aSEvan Quan #define PPSMC_MSG_EnableVRHotGPIOInterrupt    ((uint16_t) 0x14a)
138*837d542aSEvan Quan #define PPSMC_MSG_DPM_Enable                  ((uint16_t) 0x14e)
139*837d542aSEvan Quan #define PPSMC_MSG_DPM_Disable                 ((uint16_t) 0x14f)
140*837d542aSEvan Quan #define PPSMC_MSG_MCLKDPM_Enable              ((uint16_t) 0x150)
141*837d542aSEvan Quan #define PPSMC_MSG_MCLKDPM_Disable             ((uint16_t) 0x151)
142*837d542aSEvan Quan #define PPSMC_MSG_UVDDPM_Enable               ((uint16_t) 0x154)
143*837d542aSEvan Quan #define PPSMC_MSG_UVDDPM_Disable              ((uint16_t) 0x155)
144*837d542aSEvan Quan #define PPSMC_MSG_SAMUDPM_Enable              ((uint16_t) 0x156)
145*837d542aSEvan Quan #define PPSMC_MSG_SAMUDPM_Disable             ((uint16_t) 0x157)
146*837d542aSEvan Quan #define PPSMC_MSG_ACPDPM_Enable               ((uint16_t) 0x158)
147*837d542aSEvan Quan #define PPSMC_MSG_ACPDPM_Disable              ((uint16_t) 0x159)
148*837d542aSEvan Quan #define PPSMC_MSG_VCEDPM_Enable               ((uint16_t) 0x15a)
149*837d542aSEvan Quan #define PPSMC_MSG_VCEDPM_Disable              ((uint16_t) 0x15b)
150*837d542aSEvan Quan #define PPSMC_MSG_VddC_Request                ((uint16_t) 0x15f)
151*837d542aSEvan Quan #define PPSMC_MSG_SCLKDPM_GetEnabledMask      ((uint16_t) 0x162)
152*837d542aSEvan Quan #define PPSMC_MSG_PCIeDPM_SetEnabledMask      ((uint16_t) 0x167)
153*837d542aSEvan Quan #define PPSMC_MSG_TDCLimitEnable              ((uint16_t) 0x169)
154*837d542aSEvan Quan #define PPSMC_MSG_TDCLimitDisable             ((uint16_t) 0x16a)
155*837d542aSEvan Quan #define PPSMC_MSG_PkgPwrLimitEnable           ((uint16_t) 0x185)
156*837d542aSEvan Quan #define PPSMC_MSG_PkgPwrLimitDisable          ((uint16_t) 0x186)
157*837d542aSEvan Quan #define PPSMC_MSG_PkgPwrSetLimit              ((uint16_t) 0x187)
158*837d542aSEvan Quan #define PPSMC_MSG_OverDriveSetTargetTdp       ((uint16_t) 0x188)
159*837d542aSEvan Quan #define PPSMC_MSG_SCLKDPM_FreezeLevel         ((uint16_t) 0x189)
160*837d542aSEvan Quan #define PPSMC_MSG_SCLKDPM_UnfreezeLevel       ((uint16_t) 0x18A)
161*837d542aSEvan Quan #define PPSMC_MSG_MCLKDPM_FreezeLevel         ((uint16_t) 0x18B)
162*837d542aSEvan Quan #define PPSMC_MSG_MCLKDPM_UnfreezeLevel       ((uint16_t) 0x18C)
163*837d542aSEvan Quan #define PPSMC_MSG_MASTER_DeepSleep_ON         ((uint16_t) 0x18F)
164*837d542aSEvan Quan #define PPSMC_MSG_MASTER_DeepSleep_OFF        ((uint16_t) 0x190)
165*837d542aSEvan Quan #define PPSMC_MSG_Remove_DC_Clamp             ((uint16_t) 0x191)
166*837d542aSEvan Quan #define PPSMC_MSG_SetFanPwmMax                ((uint16_t) 0x19A)
167*837d542aSEvan Quan #define PPSMC_MSG_SetFanRpmMax                ((uint16_t) 0x205)
168*837d542aSEvan Quan 
169*837d542aSEvan Quan #define PPSMC_MSG_ENABLE_THERMAL_DPM          ((uint16_t) 0x19C)
170*837d542aSEvan Quan #define PPSMC_MSG_DISABLE_THERMAL_DPM         ((uint16_t) 0x19D)
171*837d542aSEvan Quan 
172*837d542aSEvan Quan #define PPSMC_MSG_API_GetSclkFrequency        ((uint16_t) 0x200)
173*837d542aSEvan Quan #define PPSMC_MSG_API_GetMclkFrequency        ((uint16_t) 0x201)
174*837d542aSEvan Quan 
175*837d542aSEvan Quan /* TN */
176*837d542aSEvan Quan #define PPSMC_MSG_DPM_Config                ((uint32_t) 0x102)
177*837d542aSEvan Quan #define PPSMC_MSG_DPM_ForceState            ((uint32_t) 0x104)
178*837d542aSEvan Quan #define PPSMC_MSG_PG_SIMD_Config            ((uint32_t) 0x108)
179*837d542aSEvan Quan #define PPSMC_MSG_Voltage_Cntl_Enable       ((uint32_t) 0x109)
180*837d542aSEvan Quan #define PPSMC_MSG_Thermal_Cntl_Enable       ((uint32_t) 0x10a)
181*837d542aSEvan Quan #define PPSMC_MSG_VCEPowerOFF               ((uint32_t) 0x10e)
182*837d542aSEvan Quan #define PPSMC_MSG_VCEPowerON                ((uint32_t) 0x10f)
183*837d542aSEvan Quan #define PPSMC_MSG_DPM_N_LevelsDisabled      ((uint32_t) 0x112)
184*837d542aSEvan Quan #define PPSMC_MSG_DCE_RemoveVoltageAdjustment   ((uint32_t) 0x11d)
185*837d542aSEvan Quan #define PPSMC_MSG_DCE_AllowVoltageAdjustment    ((uint32_t) 0x11e)
186*837d542aSEvan Quan #define PPSMC_MSG_EnableBAPM                ((uint32_t) 0x120)
187*837d542aSEvan Quan #define PPSMC_MSG_DisableBAPM               ((uint32_t) 0x121)
188*837d542aSEvan Quan #define PPSMC_MSG_UVD_DPM_Config            ((uint32_t) 0x124)
189*837d542aSEvan Quan 
190*837d542aSEvan Quan #define PPSMC_MSG_DRV_DRAM_ADDR_HI            ((uint16_t) 0x250)
191*837d542aSEvan Quan #define PPSMC_MSG_DRV_DRAM_ADDR_LO            ((uint16_t) 0x251)
192*837d542aSEvan Quan #define PPSMC_MSG_SMU_DRAM_ADDR_HI            ((uint16_t) 0x252)
193*837d542aSEvan Quan #define PPSMC_MSG_SMU_DRAM_ADDR_LO            ((uint16_t) 0x253)
194*837d542aSEvan Quan #define PPSMC_MSG_LoadUcodes                  ((uint16_t) 0x254)
195*837d542aSEvan Quan 
196*837d542aSEvan Quan typedef uint16_t PPSMC_Msg;
197*837d542aSEvan Quan 
198*837d542aSEvan Quan #pragma pack(pop)
199*837d542aSEvan Quan 
200*837d542aSEvan Quan #endif
201