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