xref: /dflybsd-src/sys/dev/drm/amd/powerplay/inc/smu10_driver_if.h (revision b843c749addef9340ee7d4e250b09fdd492602a1)
1*b843c749SSergey Zigachev /*
2*b843c749SSergey Zigachev  * Copyright 2017 Advanced Micro Devices, Inc.
3*b843c749SSergey Zigachev  *
4*b843c749SSergey Zigachev  * Permission is hereby granted, free of charge, to any person obtaining a
5*b843c749SSergey Zigachev  * copy of this software and associated documentation files (the "Software"),
6*b843c749SSergey Zigachev  * to deal in the Software without restriction, including without limitation
7*b843c749SSergey Zigachev  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*b843c749SSergey Zigachev  * and/or sell copies of the Software, and to permit persons to whom the
9*b843c749SSergey Zigachev  * Software is furnished to do so, subject to the following conditions:
10*b843c749SSergey Zigachev  *
11*b843c749SSergey Zigachev  * The above copyright notice and this permission notice shall be included in
12*b843c749SSergey Zigachev  * all copies or substantial portions of the Software.
13*b843c749SSergey Zigachev  *
14*b843c749SSergey Zigachev  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15*b843c749SSergey Zigachev  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16*b843c749SSergey Zigachev  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17*b843c749SSergey Zigachev  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18*b843c749SSergey Zigachev  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19*b843c749SSergey Zigachev  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20*b843c749SSergey Zigachev  * OTHER DEALINGS IN THE SOFTWARE.
21*b843c749SSergey Zigachev  *
22*b843c749SSergey Zigachev  */
23*b843c749SSergey Zigachev 
24*b843c749SSergey Zigachev #ifndef SMU10_DRIVER_IF_H
25*b843c749SSergey Zigachev #define SMU10_DRIVER_IF_H
26*b843c749SSergey Zigachev 
27*b843c749SSergey Zigachev #define SMU10_DRIVER_IF_VERSION 0x6
28*b843c749SSergey Zigachev 
29*b843c749SSergey Zigachev #define NUM_DSPCLK_LEVELS 8
30*b843c749SSergey Zigachev 
31*b843c749SSergey Zigachev typedef struct {
32*b843c749SSergey Zigachev 	int32_t value;
33*b843c749SSergey Zigachev 	uint32_t numFractionalBits;
34*b843c749SSergey Zigachev } FloatInIntFormat_t;
35*b843c749SSergey Zigachev 
36*b843c749SSergey Zigachev typedef enum {
37*b843c749SSergey Zigachev 	DSPCLK_DCEFCLK = 0,
38*b843c749SSergey Zigachev 	DSPCLK_DISPCLK,
39*b843c749SSergey Zigachev 	DSPCLK_PIXCLK,
40*b843c749SSergey Zigachev 	DSPCLK_PHYCLK,
41*b843c749SSergey Zigachev 	DSPCLK_COUNT,
42*b843c749SSergey Zigachev } DSPCLK_e;
43*b843c749SSergey Zigachev 
44*b843c749SSergey Zigachev typedef struct {
45*b843c749SSergey Zigachev 	uint16_t Freq;
46*b843c749SSergey Zigachev 	uint16_t Vid;
47*b843c749SSergey Zigachev } DisplayClockTable_t;
48*b843c749SSergey Zigachev 
49*b843c749SSergey Zigachev 
50*b843c749SSergey Zigachev typedef struct {
51*b843c749SSergey Zigachev 	uint16_t MinClock; /* This is either DCFCLK or SOCCLK (in MHz) */
52*b843c749SSergey Zigachev 	uint16_t MaxClock; /* This is either DCFCLK or SOCCLK (in MHz) */
53*b843c749SSergey Zigachev 	uint16_t MinMclk;
54*b843c749SSergey Zigachev 	uint16_t MaxMclk;
55*b843c749SSergey Zigachev 
56*b843c749SSergey Zigachev 	uint8_t  WmSetting;
57*b843c749SSergey Zigachev 	uint8_t  Padding[3];
58*b843c749SSergey Zigachev } WatermarkRowGeneric_t;
59*b843c749SSergey Zigachev 
60*b843c749SSergey Zigachev #define NUM_WM_RANGES 4
61*b843c749SSergey Zigachev 
62*b843c749SSergey Zigachev typedef enum {
63*b843c749SSergey Zigachev 	WM_SOCCLK = 0,
64*b843c749SSergey Zigachev 	WM_DCFCLK,
65*b843c749SSergey Zigachev 	WM_COUNT,
66*b843c749SSergey Zigachev } WM_CLOCK_e;
67*b843c749SSergey Zigachev 
68*b843c749SSergey Zigachev typedef struct {
69*b843c749SSergey Zigachev 	WatermarkRowGeneric_t WatermarkRow[WM_COUNT][NUM_WM_RANGES];
70*b843c749SSergey Zigachev 	uint32_t              MmHubPadding[7];
71*b843c749SSergey Zigachev } Watermarks_t;
72*b843c749SSergey Zigachev 
73*b843c749SSergey Zigachev typedef enum {
74*b843c749SSergey Zigachev 	CUSTOM_DPM_SETTING_GFXCLK,
75*b843c749SSergey Zigachev 	CUSTOM_DPM_SETTING_CCLK,
76*b843c749SSergey Zigachev 	CUSTOM_DPM_SETTING_FCLK_CCX,
77*b843c749SSergey Zigachev 	CUSTOM_DPM_SETTING_FCLK_GFX,
78*b843c749SSergey Zigachev 	CUSTOM_DPM_SETTING_FCLK_STALLS,
79*b843c749SSergey Zigachev 	CUSTOM_DPM_SETTING_LCLK,
80*b843c749SSergey Zigachev 	CUSTOM_DPM_SETTING_COUNT,
81*b843c749SSergey Zigachev } CUSTOM_DPM_SETTING_e;
82*b843c749SSergey Zigachev 
83*b843c749SSergey Zigachev typedef struct {
84*b843c749SSergey Zigachev 	uint8_t             ActiveHystLimit;
85*b843c749SSergey Zigachev 	uint8_t             IdleHystLimit;
86*b843c749SSergey Zigachev 	uint8_t             FPS;
87*b843c749SSergey Zigachev 	uint8_t             MinActiveFreqType;
88*b843c749SSergey Zigachev 	FloatInIntFormat_t  MinActiveFreq;
89*b843c749SSergey Zigachev 	FloatInIntFormat_t  PD_Data_limit;
90*b843c749SSergey Zigachev 	FloatInIntFormat_t  PD_Data_time_constant;
91*b843c749SSergey Zigachev 	FloatInIntFormat_t  PD_Data_error_coeff;
92*b843c749SSergey Zigachev 	FloatInIntFormat_t  PD_Data_error_rate_coeff;
93*b843c749SSergey Zigachev } DpmActivityMonitorCoeffExt_t;
94*b843c749SSergey Zigachev 
95*b843c749SSergey Zigachev typedef struct {
96*b843c749SSergey Zigachev 	DpmActivityMonitorCoeffExt_t DpmActivityMonitorCoeff[CUSTOM_DPM_SETTING_COUNT];
97*b843c749SSergey Zigachev } CustomDpmSettings_t;
98*b843c749SSergey Zigachev 
99*b843c749SSergey Zigachev #define NUM_SOCCLK_DPM_LEVELS  8
100*b843c749SSergey Zigachev #define NUM_DCEFCLK_DPM_LEVELS 4
101*b843c749SSergey Zigachev #define NUM_FCLK_DPM_LEVELS    4
102*b843c749SSergey Zigachev #define NUM_MEMCLK_DPM_LEVELS  4
103*b843c749SSergey Zigachev 
104*b843c749SSergey Zigachev typedef struct {
105*b843c749SSergey Zigachev 	uint32_t  Freq; /* In MHz */
106*b843c749SSergey Zigachev 	uint32_t  Vol;  /* Millivolts with 2 fractional bits */
107*b843c749SSergey Zigachev } DpmClock_t;
108*b843c749SSergey Zigachev 
109*b843c749SSergey Zigachev typedef struct {
110*b843c749SSergey Zigachev 	DpmClock_t DcefClocks[NUM_DCEFCLK_DPM_LEVELS];
111*b843c749SSergey Zigachev 	DpmClock_t SocClocks[NUM_SOCCLK_DPM_LEVELS];
112*b843c749SSergey Zigachev 	DpmClock_t FClocks[NUM_FCLK_DPM_LEVELS];
113*b843c749SSergey Zigachev 	DpmClock_t MemClocks[NUM_MEMCLK_DPM_LEVELS];
114*b843c749SSergey Zigachev } DpmClocks_t;
115*b843c749SSergey Zigachev 
116*b843c749SSergey Zigachev #endif
117