2 * Copyright 2013 Advanced Micro Devices, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
26 #include "radeon_asic.h"
31 #include <linux/math64.h>
32 #include <linux/seq_file.h>
34 #define MC_CG_ARB_FREQ_F0 0x0a
35 #define MC_CG_ARB_FREQ_F1 0x0b
36 #define MC_CG_ARB_FREQ_F2 0x0c
37 #define MC_CG_ARB_FREQ_F3 0x0d
39 #define SMC_RAM_END 0x20000
41 #define SCLK_MIN_DEEPSLEEP_FREQ 1350
43 static const struct si_cac_config_reg cac_weights_tahiti
[] =
45 { 0x0, 0x0000ffff, 0, 0xc, SISLANDS_CACCONFIG_CGIND
},
46 { 0x0, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
47 { 0x1, 0x0000ffff, 0, 0x101, SISLANDS_CACCONFIG_CGIND
},
48 { 0x1, 0xffff0000, 16, 0xc, SISLANDS_CACCONFIG_CGIND
},
49 { 0x2, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
50 { 0x3, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
51 { 0x3, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
52 { 0x4, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
53 { 0x4, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
54 { 0x5, 0x0000ffff, 0, 0x8fc, SISLANDS_CACCONFIG_CGIND
},
55 { 0x5, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
56 { 0x6, 0x0000ffff, 0, 0x95, SISLANDS_CACCONFIG_CGIND
},
57 { 0x6, 0xffff0000, 16, 0x34e, SISLANDS_CACCONFIG_CGIND
},
58 { 0x18f, 0x0000ffff, 0, 0x1a1, SISLANDS_CACCONFIG_CGIND
},
59 { 0x7, 0x0000ffff, 0, 0xda, SISLANDS_CACCONFIG_CGIND
},
60 { 0x7, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
61 { 0x8, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
62 { 0x8, 0xffff0000, 16, 0x46, SISLANDS_CACCONFIG_CGIND
},
63 { 0x9, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
64 { 0xa, 0x0000ffff, 0, 0x208, SISLANDS_CACCONFIG_CGIND
},
65 { 0xb, 0x0000ffff, 0, 0xe7, SISLANDS_CACCONFIG_CGIND
},
66 { 0xb, 0xffff0000, 16, 0x948, SISLANDS_CACCONFIG_CGIND
},
67 { 0xc, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
68 { 0xd, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
69 { 0xd, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
70 { 0xe, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
71 { 0xf, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
72 { 0xf, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
73 { 0x10, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
74 { 0x10, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
75 { 0x11, 0x0000ffff, 0, 0x167, SISLANDS_CACCONFIG_CGIND
},
76 { 0x11, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
77 { 0x12, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
78 { 0x13, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
79 { 0x13, 0xffff0000, 16, 0x35, SISLANDS_CACCONFIG_CGIND
},
80 { 0x14, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
81 { 0x15, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
82 { 0x15, 0xffff0000, 16, 0x2, SISLANDS_CACCONFIG_CGIND
},
83 { 0x4e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
84 { 0x16, 0x0000ffff, 0, 0x31, SISLANDS_CACCONFIG_CGIND
},
85 { 0x16, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
86 { 0x17, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
87 { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
88 { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
89 { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
90 { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
91 { 0x1a, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
92 { 0x1a, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
93 { 0x1b, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
94 { 0x1b, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
95 { 0x1c, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
96 { 0x1c, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
97 { 0x1d, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
98 { 0x1d, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
99 { 0x1e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
100 { 0x1e, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
101 { 0x1f, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
102 { 0x1f, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
103 { 0x20, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
104 { 0x6d, 0x0000ffff, 0, 0x18e, SISLANDS_CACCONFIG_CGIND
},
108 static const struct si_cac_config_reg lcac_tahiti
[] =
110 { 0x143, 0x0001fffe, 1, 0x3, SISLANDS_CACCONFIG_CGIND
},
111 { 0x143, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
112 { 0x146, 0x0001fffe, 1, 0x3, SISLANDS_CACCONFIG_CGIND
},
113 { 0x146, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
114 { 0x149, 0x0001fffe, 1, 0x3, SISLANDS_CACCONFIG_CGIND
},
115 { 0x149, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
116 { 0x14c, 0x0001fffe, 1, 0x3, SISLANDS_CACCONFIG_CGIND
},
117 { 0x14c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
118 { 0x98, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
119 { 0x98, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
120 { 0x9b, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
121 { 0x9b, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
122 { 0x9e, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
123 { 0x9e, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
124 { 0x101, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
125 { 0x101, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
126 { 0x104, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
127 { 0x104, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
128 { 0x107, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
129 { 0x107, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
130 { 0x10a, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
131 { 0x10a, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
132 { 0x10d, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
133 { 0x10d, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
134 { 0x8c, 0x0001fffe, 1, 0x8, SISLANDS_CACCONFIG_CGIND
},
135 { 0x8c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
136 { 0x8f, 0x0001fffe, 1, 0x8, SISLANDS_CACCONFIG_CGIND
},
137 { 0x8f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
138 { 0x92, 0x0001fffe, 1, 0x8, SISLANDS_CACCONFIG_CGIND
},
139 { 0x92, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
140 { 0x95, 0x0001fffe, 1, 0x8, SISLANDS_CACCONFIG_CGIND
},
141 { 0x95, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
142 { 0x14f, 0x0001fffe, 1, 0x8, SISLANDS_CACCONFIG_CGIND
},
143 { 0x14f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
144 { 0x152, 0x0001fffe, 1, 0x8, SISLANDS_CACCONFIG_CGIND
},
145 { 0x152, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
146 { 0x155, 0x0001fffe, 1, 0x8, SISLANDS_CACCONFIG_CGIND
},
147 { 0x155, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
148 { 0x158, 0x0001fffe, 1, 0x8, SISLANDS_CACCONFIG_CGIND
},
149 { 0x158, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
150 { 0x110, 0x0001fffe, 1, 0x8, SISLANDS_CACCONFIG_CGIND
},
151 { 0x110, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
152 { 0x113, 0x0001fffe, 1, 0x8, SISLANDS_CACCONFIG_CGIND
},
153 { 0x113, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
154 { 0x116, 0x0001fffe, 1, 0x8, SISLANDS_CACCONFIG_CGIND
},
155 { 0x116, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
156 { 0x119, 0x0001fffe, 1, 0x8, SISLANDS_CACCONFIG_CGIND
},
157 { 0x119, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
158 { 0x11c, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
159 { 0x11c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
160 { 0x11f, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
161 { 0x11f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
162 { 0x122, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
163 { 0x122, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
164 { 0x125, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
165 { 0x125, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
166 { 0x128, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
167 { 0x128, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
168 { 0x12b, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
169 { 0x12b, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
170 { 0x15b, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND
},
171 { 0x15b, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
172 { 0x15e, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND
},
173 { 0x15e, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
174 { 0x161, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND
},
175 { 0x161, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
176 { 0x164, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND
},
177 { 0x164, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
178 { 0x167, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND
},
179 { 0x167, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
180 { 0x16a, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND
},
181 { 0x16a, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
182 { 0x16d, 0x0001fffe, 1, 0x6, SISLANDS_CACCONFIG_CGIND
},
183 { 0x16d, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
184 { 0x170, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
185 { 0x170, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
186 { 0x173, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
187 { 0x173, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
188 { 0x176, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
189 { 0x176, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
190 { 0x179, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
191 { 0x179, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
192 { 0x17c, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
193 { 0x17c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
194 { 0x17f, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
195 { 0x17f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
200 static const struct si_cac_config_reg cac_override_tahiti
[] =
205 static const struct si_powertune_data powertune_data_tahiti
=
236 static const struct si_dte_data dte_data_tahiti
=
238 { 1159409, 0, 0, 0, 0 },
247 { 27, 31, 35, 39, 43, 47, 54, 61, 67, 74, 81, 88, 95, 0, 0, 0 },
248 { 240888759, 221057860, 235370597, 162287531, 158510299, 131423027, 116673180, 103067515, 87941937, 76209048, 68209175, 64090048, 58301890, 0, 0, 0 },
249 { 12024, 11189, 11451, 8411, 7939, 6666, 5681, 4905, 4241, 3720, 3354, 3122, 2890, 0, 0, 0 },
254 static const struct si_dte_data dte_data_tahiti_le
=
256 { 0x1E8480, 0x7A1200, 0x2160EC0, 0x3938700, 0 },
257 { 0x7D, 0x7D, 0x4E4, 0xB00, 0 },
265 { 0x78, 0x7C, 0x82, 0x88, 0x8E, 0x94, 0x9A, 0xA0, 0xA6, 0xAC, 0xB0, 0xB4, 0xB8, 0xBC, 0xC0, 0xC4 },
266 { 0x3938700, 0x3938700, 0x3938700, 0x3938700, 0x3938700, 0x3938700, 0x3938700, 0x3938700, 0x3938700, 0x3938700, 0x3938700, 0x3938700, 0x3938700, 0x3938700, 0x3938700, 0x3938700 },
267 { 0x2AF8, 0x2AF8, 0x29BB, 0x27F9, 0x2637, 0x2475, 0x22B3, 0x20F1, 0x1F2F, 0x1D6D, 0x1734, 0x1414, 0x10F4, 0xDD4, 0xAB4, 0x794 },
272 static const struct si_dte_data dte_data_tahiti_pro
=
274 { 0x1E8480, 0x3D0900, 0x989680, 0x2625A00, 0x0 },
275 { 0x0, 0x0, 0x0, 0x0, 0x0 },
283 { 0x96, 0xB4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
284 { 0x895440, 0x3D0900, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680 },
285 { 0x7D0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
290 static const struct si_dte_data dte_data_new_zealand
=
292 { 0x1E8480, 0x3D0900, 0x989680, 0x2625A00, 0 },
293 { 0x29B, 0x3E9, 0x537, 0x7D2, 0 },
301 { 0x82, 0xA0, 0xB4, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE },
302 { 0x895440, 0x3D0900, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680 },
303 { 0xDAC, 0x1388, 0x685, 0x685, 0x685, 0x685, 0x685, 0x685, 0x685, 0x685, 0x685, 0x685, 0x685, 0x685, 0x685, 0x685 },
308 static const struct si_dte_data dte_data_aruba_pro
=
310 { 0x1E8480, 0x3D0900, 0x989680, 0x2625A00, 0x0 },
311 { 0x0, 0x0, 0x0, 0x0, 0x0 },
319 { 0x96, 0xB4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
320 { 0x895440, 0x3D0900, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680 },
321 { 0x1000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
326 static const struct si_dte_data dte_data_malta
=
328 { 0x1E8480, 0x3D0900, 0x989680, 0x2625A00, 0x0 },
329 { 0x0, 0x0, 0x0, 0x0, 0x0 },
337 { 0x96, 0xB4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
338 { 0x895440, 0x3D0900, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680 },
339 { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
344 struct si_cac_config_reg cac_weights_pitcairn
[] =
346 { 0x0, 0x0000ffff, 0, 0x8a, SISLANDS_CACCONFIG_CGIND
},
347 { 0x0, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
348 { 0x1, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
349 { 0x1, 0xffff0000, 16, 0x24d, SISLANDS_CACCONFIG_CGIND
},
350 { 0x2, 0x0000ffff, 0, 0x19, SISLANDS_CACCONFIG_CGIND
},
351 { 0x3, 0x0000ffff, 0, 0x118, SISLANDS_CACCONFIG_CGIND
},
352 { 0x3, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
353 { 0x4, 0x0000ffff, 0, 0x76, SISLANDS_CACCONFIG_CGIND
},
354 { 0x4, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
355 { 0x5, 0x0000ffff, 0, 0xc11, SISLANDS_CACCONFIG_CGIND
},
356 { 0x5, 0xffff0000, 16, 0x7f3, SISLANDS_CACCONFIG_CGIND
},
357 { 0x6, 0x0000ffff, 0, 0x403, SISLANDS_CACCONFIG_CGIND
},
358 { 0x6, 0xffff0000, 16, 0x367, SISLANDS_CACCONFIG_CGIND
},
359 { 0x18f, 0x0000ffff, 0, 0x4c9, SISLANDS_CACCONFIG_CGIND
},
360 { 0x7, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
361 { 0x7, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
362 { 0x8, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
363 { 0x8, 0xffff0000, 16, 0x45d, SISLANDS_CACCONFIG_CGIND
},
364 { 0x9, 0x0000ffff, 0, 0x36d, SISLANDS_CACCONFIG_CGIND
},
365 { 0xa, 0x0000ffff, 0, 0x534, SISLANDS_CACCONFIG_CGIND
},
366 { 0xb, 0x0000ffff, 0, 0x5da, SISLANDS_CACCONFIG_CGIND
},
367 { 0xb, 0xffff0000, 16, 0x880, SISLANDS_CACCONFIG_CGIND
},
368 { 0xc, 0x0000ffff, 0, 0x201, SISLANDS_CACCONFIG_CGIND
},
369 { 0xd, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
370 { 0xd, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
371 { 0xe, 0x0000ffff, 0, 0x9f, SISLANDS_CACCONFIG_CGIND
},
372 { 0xf, 0x0000ffff, 0, 0x1f, SISLANDS_CACCONFIG_CGIND
},
373 { 0xf, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
374 { 0x10, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
375 { 0x10, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
376 { 0x11, 0x0000ffff, 0, 0x5de, SISLANDS_CACCONFIG_CGIND
},
377 { 0x11, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
378 { 0x12, 0x0000ffff, 0, 0x7b, SISLANDS_CACCONFIG_CGIND
},
379 { 0x13, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
380 { 0x13, 0xffff0000, 16, 0x13, SISLANDS_CACCONFIG_CGIND
},
381 { 0x14, 0x0000ffff, 0, 0xf9, SISLANDS_CACCONFIG_CGIND
},
382 { 0x15, 0x0000ffff, 0, 0x66, SISLANDS_CACCONFIG_CGIND
},
383 { 0x15, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
384 { 0x4e, 0x0000ffff, 0, 0x13, SISLANDS_CACCONFIG_CGIND
},
385 { 0x16, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
386 { 0x16, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
387 { 0x17, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
388 { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
389 { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
390 { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
391 { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
392 { 0x1a, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
393 { 0x1a, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
394 { 0x1b, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
395 { 0x1b, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
396 { 0x1c, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
397 { 0x1c, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
398 { 0x1d, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
399 { 0x1d, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
400 { 0x1e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
401 { 0x1e, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
402 { 0x1f, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
403 { 0x1f, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
404 { 0x20, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
405 { 0x6d, 0x0000ffff, 0, 0x186, SISLANDS_CACCONFIG_CGIND
},
409 static const struct si_cac_config_reg lcac_pitcairn
[] =
411 { 0x98, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
412 { 0x98, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
413 { 0x104, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
414 { 0x104, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
415 { 0x110, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND
},
416 { 0x110, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
417 { 0x14f, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND
},
418 { 0x14f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
419 { 0x8c, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND
},
420 { 0x8c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
421 { 0x143, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
422 { 0x143, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
423 { 0x9b, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
424 { 0x9b, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
425 { 0x107, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
426 { 0x107, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
427 { 0x113, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND
},
428 { 0x113, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
429 { 0x152, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND
},
430 { 0x152, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
431 { 0x8f, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND
},
432 { 0x8f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
433 { 0x146, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
434 { 0x146, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
435 { 0x9e, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
436 { 0x9e, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
437 { 0x10a, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
438 { 0x10a, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
439 { 0x116, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND
},
440 { 0x116, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
441 { 0x155, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND
},
442 { 0x155, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
443 { 0x92, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND
},
444 { 0x92, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
445 { 0x149, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
446 { 0x149, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
447 { 0x101, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
448 { 0x101, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
449 { 0x10d, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
450 { 0x10d, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
451 { 0x119, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND
},
452 { 0x119, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
453 { 0x158, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND
},
454 { 0x158, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
455 { 0x95, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND
},
456 { 0x95, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
457 { 0x14c, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
458 { 0x14c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
459 { 0x11c, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
460 { 0x11c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
461 { 0x11f, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
462 { 0x11f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
463 { 0x122, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
464 { 0x122, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
465 { 0x125, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
466 { 0x125, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
467 { 0x128, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
468 { 0x128, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
469 { 0x12b, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
470 { 0x12b, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
471 { 0x164, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND
},
472 { 0x164, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
473 { 0x167, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND
},
474 { 0x167, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
475 { 0x16a, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND
},
476 { 0x16a, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
477 { 0x15e, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND
},
478 { 0x15e, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
479 { 0x161, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND
},
480 { 0x161, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
481 { 0x15b, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND
},
482 { 0x15b, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
483 { 0x16d, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND
},
484 { 0x16d, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
485 { 0x170, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
486 { 0x170, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
487 { 0x173, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
488 { 0x173, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
489 { 0x176, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
490 { 0x176, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
491 { 0x179, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
492 { 0x179, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
493 { 0x17c, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
494 { 0x17c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
495 { 0x17f, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
496 { 0x17f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
500 static const struct si_cac_config_reg cac_override_pitcairn
[] =
505 static const struct si_powertune_data powertune_data_pitcairn
=
536 static const struct si_dte_data dte_data_pitcairn
=
547 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
548 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
549 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
554 static const struct si_dte_data dte_data_curacao_xt
=
556 { 0x1E8480, 0x3D0900, 0x989680, 0x2625A00, 0x0 },
557 { 0x0, 0x0, 0x0, 0x0, 0x0 },
565 { 0x96, 0xB4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
566 { 0x895440, 0x3D0900, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680 },
567 { 0x1D17, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
572 static const struct si_dte_data dte_data_curacao_pro
=
574 { 0x1E8480, 0x3D0900, 0x989680, 0x2625A00, 0x0 },
575 { 0x0, 0x0, 0x0, 0x0, 0x0 },
583 { 0x96, 0xB4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
584 { 0x895440, 0x3D0900, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680 },
585 { 0x1D17, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
590 static const struct si_dte_data dte_data_neptune_xt
=
592 { 0x1E8480, 0x3D0900, 0x989680, 0x2625A00, 0x0 },
593 { 0x0, 0x0, 0x0, 0x0, 0x0 },
601 { 0x96, 0xB4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
602 { 0x895440, 0x3D0900, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680 },
603 { 0x3A2F, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
608 static const struct si_cac_config_reg cac_weights_chelsea_pro
[] =
610 { 0x0, 0x0000ffff, 0, 0x82, SISLANDS_CACCONFIG_CGIND
},
611 { 0x0, 0xffff0000, 16, 0x4F, SISLANDS_CACCONFIG_CGIND
},
612 { 0x1, 0x0000ffff, 0, 0x153, SISLANDS_CACCONFIG_CGIND
},
613 { 0x1, 0xffff0000, 16, 0x52, SISLANDS_CACCONFIG_CGIND
},
614 { 0x2, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
615 { 0x3, 0x0000ffff, 0, 0x135, SISLANDS_CACCONFIG_CGIND
},
616 { 0x3, 0xffff0000, 16, 0x4F, SISLANDS_CACCONFIG_CGIND
},
617 { 0x4, 0x0000ffff, 0, 0x135, SISLANDS_CACCONFIG_CGIND
},
618 { 0x4, 0xffff0000, 16, 0xAC, SISLANDS_CACCONFIG_CGIND
},
619 { 0x5, 0x0000ffff, 0, 0x118, SISLANDS_CACCONFIG_CGIND
},
620 { 0x5, 0xffff0000, 16, 0xBE, SISLANDS_CACCONFIG_CGIND
},
621 { 0x6, 0x0000ffff, 0, 0x110, SISLANDS_CACCONFIG_CGIND
},
622 { 0x6, 0xffff0000, 16, 0x4CD, SISLANDS_CACCONFIG_CGIND
},
623 { 0x18f, 0x0000ffff, 0, 0x30, SISLANDS_CACCONFIG_CGIND
},
624 { 0x7, 0x0000ffff, 0, 0x37, SISLANDS_CACCONFIG_CGIND
},
625 { 0x7, 0xffff0000, 16, 0x27, SISLANDS_CACCONFIG_CGIND
},
626 { 0x8, 0x0000ffff, 0, 0xC3, SISLANDS_CACCONFIG_CGIND
},
627 { 0x8, 0xffff0000, 16, 0x35, SISLANDS_CACCONFIG_CGIND
},
628 { 0x9, 0x0000ffff, 0, 0x28, SISLANDS_CACCONFIG_CGIND
},
629 { 0xa, 0x0000ffff, 0, 0x26C, SISLANDS_CACCONFIG_CGIND
},
630 { 0xb, 0x0000ffff, 0, 0x3B2, SISLANDS_CACCONFIG_CGIND
},
631 { 0xb, 0xffff0000, 16, 0x99D, SISLANDS_CACCONFIG_CGIND
},
632 { 0xc, 0x0000ffff, 0, 0xA3F, SISLANDS_CACCONFIG_CGIND
},
633 { 0xd, 0x0000ffff, 0, 0xA, SISLANDS_CACCONFIG_CGIND
},
634 { 0xd, 0xffff0000, 16, 0xA, SISLANDS_CACCONFIG_CGIND
},
635 { 0xe, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND
},
636 { 0xf, 0x0000ffff, 0, 0x3, SISLANDS_CACCONFIG_CGIND
},
637 { 0xf, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
638 { 0x10, 0x0000ffff, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
639 { 0x10, 0xffff0000, 16, 0x1, SISLANDS_CACCONFIG_CGIND
},
640 { 0x11, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND
},
641 { 0x11, 0xffff0000, 16, 0x15, SISLANDS_CACCONFIG_CGIND
},
642 { 0x12, 0x0000ffff, 0, 0x34, SISLANDS_CACCONFIG_CGIND
},
643 { 0x13, 0x0000ffff, 0, 0x4, SISLANDS_CACCONFIG_CGIND
},
644 { 0x13, 0xffff0000, 16, 0x4, SISLANDS_CACCONFIG_CGIND
},
645 { 0x14, 0x0000ffff, 0, 0x2BD, SISLANDS_CACCONFIG_CGIND
},
646 { 0x15, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
647 { 0x15, 0xffff0000, 16, 0x6, SISLANDS_CACCONFIG_CGIND
},
648 { 0x4e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
649 { 0x16, 0x0000ffff, 0, 0x30, SISLANDS_CACCONFIG_CGIND
},
650 { 0x16, 0xffff0000, 16, 0x7A, SISLANDS_CACCONFIG_CGIND
},
651 { 0x17, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
652 { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
653 { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
654 { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
655 { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
656 { 0x1a, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
657 { 0x1a, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
658 { 0x1b, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
659 { 0x1b, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
660 { 0x1c, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
661 { 0x1c, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
662 { 0x1d, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
663 { 0x1d, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
664 { 0x1e, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
665 { 0x1e, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
666 { 0x1f, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
667 { 0x1f, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
668 { 0x20, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
669 { 0x6d, 0x0000ffff, 0, 0x100, SISLANDS_CACCONFIG_CGIND
},
673 static const struct si_cac_config_reg cac_weights_chelsea_xt
[] =
675 { 0x0, 0x0000ffff, 0, 0x82, SISLANDS_CACCONFIG_CGIND
},
676 { 0x0, 0xffff0000, 16, 0x4F, SISLANDS_CACCONFIG_CGIND
},
677 { 0x1, 0x0000ffff, 0, 0x153, SISLANDS_CACCONFIG_CGIND
},
678 { 0x1, 0xffff0000, 16, 0x52, SISLANDS_CACCONFIG_CGIND
},
679 { 0x2, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
680 { 0x3, 0x0000ffff, 0, 0x135, SISLANDS_CACCONFIG_CGIND
},
681 { 0x3, 0xffff0000, 16, 0x4F, SISLANDS_CACCONFIG_CGIND
},
682 { 0x4, 0x0000ffff, 0, 0x135, SISLANDS_CACCONFIG_CGIND
},
683 { 0x4, 0xffff0000, 16, 0xAC, SISLANDS_CACCONFIG_CGIND
},
684 { 0x5, 0x0000ffff, 0, 0x118, SISLANDS_CACCONFIG_CGIND
},
685 { 0x5, 0xffff0000, 16, 0xBE, SISLANDS_CACCONFIG_CGIND
},
686 { 0x6, 0x0000ffff, 0, 0x110, SISLANDS_CACCONFIG_CGIND
},
687 { 0x6, 0xffff0000, 16, 0x4CD, SISLANDS_CACCONFIG_CGIND
},
688 { 0x18f, 0x0000ffff, 0, 0x30, SISLANDS_CACCONFIG_CGIND
},
689 { 0x7, 0x0000ffff, 0, 0x37, SISLANDS_CACCONFIG_CGIND
},
690 { 0x7, 0xffff0000, 16, 0x27, SISLANDS_CACCONFIG_CGIND
},
691 { 0x8, 0x0000ffff, 0, 0xC3, SISLANDS_CACCONFIG_CGIND
},
692 { 0x8, 0xffff0000, 16, 0x35, SISLANDS_CACCONFIG_CGIND
},
693 { 0x9, 0x0000ffff, 0, 0x28, SISLANDS_CACCONFIG_CGIND
},
694 { 0xa, 0x0000ffff, 0, 0x26C, SISLANDS_CACCONFIG_CGIND
},
695 { 0xb, 0x0000ffff, 0, 0x3B2, SISLANDS_CACCONFIG_CGIND
},
696 { 0xb, 0xffff0000, 16, 0x99D, SISLANDS_CACCONFIG_CGIND
},
697 { 0xc, 0x0000ffff, 0, 0xA3F, SISLANDS_CACCONFIG_CGIND
},
698 { 0xd, 0x0000ffff, 0, 0xA, SISLANDS_CACCONFIG_CGIND
},
699 { 0xd, 0xffff0000, 16, 0xA, SISLANDS_CACCONFIG_CGIND
},
700 { 0xe, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND
},
701 { 0xf, 0x0000ffff, 0, 0x3, SISLANDS_CACCONFIG_CGIND
},
702 { 0xf, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
703 { 0x10, 0x0000ffff, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
704 { 0x10, 0xffff0000, 16, 0x1, SISLANDS_CACCONFIG_CGIND
},
705 { 0x11, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND
},
706 { 0x11, 0xffff0000, 16, 0x15, SISLANDS_CACCONFIG_CGIND
},
707 { 0x12, 0x0000ffff, 0, 0x34, SISLANDS_CACCONFIG_CGIND
},
708 { 0x13, 0x0000ffff, 0, 0x4, SISLANDS_CACCONFIG_CGIND
},
709 { 0x13, 0xffff0000, 16, 0x4, SISLANDS_CACCONFIG_CGIND
},
710 { 0x14, 0x0000ffff, 0, 0x30A, SISLANDS_CACCONFIG_CGIND
},
711 { 0x15, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
712 { 0x15, 0xffff0000, 16, 0x6, SISLANDS_CACCONFIG_CGIND
},
713 { 0x4e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
714 { 0x16, 0x0000ffff, 0, 0x30, SISLANDS_CACCONFIG_CGIND
},
715 { 0x16, 0xffff0000, 16, 0x7A, SISLANDS_CACCONFIG_CGIND
},
716 { 0x17, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
717 { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
718 { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
719 { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
720 { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
721 { 0x1a, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
722 { 0x1a, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
723 { 0x1b, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
724 { 0x1b, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
725 { 0x1c, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
726 { 0x1c, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
727 { 0x1d, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
728 { 0x1d, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
729 { 0x1e, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
730 { 0x1e, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
731 { 0x1f, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
732 { 0x1f, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
733 { 0x20, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
734 { 0x6d, 0x0000ffff, 0, 0x100, SISLANDS_CACCONFIG_CGIND
},
738 static const struct si_cac_config_reg cac_weights_heathrow
[] =
740 { 0x0, 0x0000ffff, 0, 0x82, SISLANDS_CACCONFIG_CGIND
},
741 { 0x0, 0xffff0000, 16, 0x4F, SISLANDS_CACCONFIG_CGIND
},
742 { 0x1, 0x0000ffff, 0, 0x153, SISLANDS_CACCONFIG_CGIND
},
743 { 0x1, 0xffff0000, 16, 0x52, SISLANDS_CACCONFIG_CGIND
},
744 { 0x2, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
745 { 0x3, 0x0000ffff, 0, 0x135, SISLANDS_CACCONFIG_CGIND
},
746 { 0x3, 0xffff0000, 16, 0x4F, SISLANDS_CACCONFIG_CGIND
},
747 { 0x4, 0x0000ffff, 0, 0x135, SISLANDS_CACCONFIG_CGIND
},
748 { 0x4, 0xffff0000, 16, 0xAC, SISLANDS_CACCONFIG_CGIND
},
749 { 0x5, 0x0000ffff, 0, 0x118, SISLANDS_CACCONFIG_CGIND
},
750 { 0x5, 0xffff0000, 16, 0xBE, SISLANDS_CACCONFIG_CGIND
},
751 { 0x6, 0x0000ffff, 0, 0x110, SISLANDS_CACCONFIG_CGIND
},
752 { 0x6, 0xffff0000, 16, 0x4CD, SISLANDS_CACCONFIG_CGIND
},
753 { 0x18f, 0x0000ffff, 0, 0x30, SISLANDS_CACCONFIG_CGIND
},
754 { 0x7, 0x0000ffff, 0, 0x37, SISLANDS_CACCONFIG_CGIND
},
755 { 0x7, 0xffff0000, 16, 0x27, SISLANDS_CACCONFIG_CGIND
},
756 { 0x8, 0x0000ffff, 0, 0xC3, SISLANDS_CACCONFIG_CGIND
},
757 { 0x8, 0xffff0000, 16, 0x35, SISLANDS_CACCONFIG_CGIND
},
758 { 0x9, 0x0000ffff, 0, 0x28, SISLANDS_CACCONFIG_CGIND
},
759 { 0xa, 0x0000ffff, 0, 0x26C, SISLANDS_CACCONFIG_CGIND
},
760 { 0xb, 0x0000ffff, 0, 0x3B2, SISLANDS_CACCONFIG_CGIND
},
761 { 0xb, 0xffff0000, 16, 0x99D, SISLANDS_CACCONFIG_CGIND
},
762 { 0xc, 0x0000ffff, 0, 0xA3F, SISLANDS_CACCONFIG_CGIND
},
763 { 0xd, 0x0000ffff, 0, 0xA, SISLANDS_CACCONFIG_CGIND
},
764 { 0xd, 0xffff0000, 16, 0xA, SISLANDS_CACCONFIG_CGIND
},
765 { 0xe, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND
},
766 { 0xf, 0x0000ffff, 0, 0x3, SISLANDS_CACCONFIG_CGIND
},
767 { 0xf, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
768 { 0x10, 0x0000ffff, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
769 { 0x10, 0xffff0000, 16, 0x1, SISLANDS_CACCONFIG_CGIND
},
770 { 0x11, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND
},
771 { 0x11, 0xffff0000, 16, 0x15, SISLANDS_CACCONFIG_CGIND
},
772 { 0x12, 0x0000ffff, 0, 0x34, SISLANDS_CACCONFIG_CGIND
},
773 { 0x13, 0x0000ffff, 0, 0x4, SISLANDS_CACCONFIG_CGIND
},
774 { 0x13, 0xffff0000, 16, 0x4, SISLANDS_CACCONFIG_CGIND
},
775 { 0x14, 0x0000ffff, 0, 0x362, SISLANDS_CACCONFIG_CGIND
},
776 { 0x15, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
777 { 0x15, 0xffff0000, 16, 0x6, SISLANDS_CACCONFIG_CGIND
},
778 { 0x4e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
779 { 0x16, 0x0000ffff, 0, 0x30, SISLANDS_CACCONFIG_CGIND
},
780 { 0x16, 0xffff0000, 16, 0x7A, SISLANDS_CACCONFIG_CGIND
},
781 { 0x17, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
782 { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
783 { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
784 { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
785 { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
786 { 0x1a, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
787 { 0x1a, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
788 { 0x1b, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
789 { 0x1b, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
790 { 0x1c, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
791 { 0x1c, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
792 { 0x1d, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
793 { 0x1d, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
794 { 0x1e, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
795 { 0x1e, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
796 { 0x1f, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
797 { 0x1f, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
798 { 0x20, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
799 { 0x6d, 0x0000ffff, 0, 0x100, SISLANDS_CACCONFIG_CGIND
},
803 static const struct si_cac_config_reg cac_weights_cape_verde_pro
[] =
805 { 0x0, 0x0000ffff, 0, 0x82, SISLANDS_CACCONFIG_CGIND
},
806 { 0x0, 0xffff0000, 16, 0x4F, SISLANDS_CACCONFIG_CGIND
},
807 { 0x1, 0x0000ffff, 0, 0x153, SISLANDS_CACCONFIG_CGIND
},
808 { 0x1, 0xffff0000, 16, 0x52, SISLANDS_CACCONFIG_CGIND
},
809 { 0x2, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
810 { 0x3, 0x0000ffff, 0, 0x135, SISLANDS_CACCONFIG_CGIND
},
811 { 0x3, 0xffff0000, 16, 0x4F, SISLANDS_CACCONFIG_CGIND
},
812 { 0x4, 0x0000ffff, 0, 0x135, SISLANDS_CACCONFIG_CGIND
},
813 { 0x4, 0xffff0000, 16, 0xAC, SISLANDS_CACCONFIG_CGIND
},
814 { 0x5, 0x0000ffff, 0, 0x118, SISLANDS_CACCONFIG_CGIND
},
815 { 0x5, 0xffff0000, 16, 0xBE, SISLANDS_CACCONFIG_CGIND
},
816 { 0x6, 0x0000ffff, 0, 0x110, SISLANDS_CACCONFIG_CGIND
},
817 { 0x6, 0xffff0000, 16, 0x4CD, SISLANDS_CACCONFIG_CGIND
},
818 { 0x18f, 0x0000ffff, 0, 0x30, SISLANDS_CACCONFIG_CGIND
},
819 { 0x7, 0x0000ffff, 0, 0x37, SISLANDS_CACCONFIG_CGIND
},
820 { 0x7, 0xffff0000, 16, 0x27, SISLANDS_CACCONFIG_CGIND
},
821 { 0x8, 0x0000ffff, 0, 0xC3, SISLANDS_CACCONFIG_CGIND
},
822 { 0x8, 0xffff0000, 16, 0x35, SISLANDS_CACCONFIG_CGIND
},
823 { 0x9, 0x0000ffff, 0, 0x28, SISLANDS_CACCONFIG_CGIND
},
824 { 0xa, 0x0000ffff, 0, 0x26C, SISLANDS_CACCONFIG_CGIND
},
825 { 0xb, 0x0000ffff, 0, 0x3B2, SISLANDS_CACCONFIG_CGIND
},
826 { 0xb, 0xffff0000, 16, 0x99D, SISLANDS_CACCONFIG_CGIND
},
827 { 0xc, 0x0000ffff, 0, 0xA3F, SISLANDS_CACCONFIG_CGIND
},
828 { 0xd, 0x0000ffff, 0, 0xA, SISLANDS_CACCONFIG_CGIND
},
829 { 0xd, 0xffff0000, 16, 0xA, SISLANDS_CACCONFIG_CGIND
},
830 { 0xe, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND
},
831 { 0xf, 0x0000ffff, 0, 0x3, SISLANDS_CACCONFIG_CGIND
},
832 { 0xf, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
833 { 0x10, 0x0000ffff, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
834 { 0x10, 0xffff0000, 16, 0x1, SISLANDS_CACCONFIG_CGIND
},
835 { 0x11, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND
},
836 { 0x11, 0xffff0000, 16, 0x15, SISLANDS_CACCONFIG_CGIND
},
837 { 0x12, 0x0000ffff, 0, 0x34, SISLANDS_CACCONFIG_CGIND
},
838 { 0x13, 0x0000ffff, 0, 0x4, SISLANDS_CACCONFIG_CGIND
},
839 { 0x13, 0xffff0000, 16, 0x4, SISLANDS_CACCONFIG_CGIND
},
840 { 0x14, 0x0000ffff, 0, 0x315, SISLANDS_CACCONFIG_CGIND
},
841 { 0x15, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
842 { 0x15, 0xffff0000, 16, 0x6, SISLANDS_CACCONFIG_CGIND
},
843 { 0x4e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
844 { 0x16, 0x0000ffff, 0, 0x30, SISLANDS_CACCONFIG_CGIND
},
845 { 0x16, 0xffff0000, 16, 0x7A, SISLANDS_CACCONFIG_CGIND
},
846 { 0x17, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
847 { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
848 { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
849 { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
850 { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
851 { 0x1a, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
852 { 0x1a, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
853 { 0x1b, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
854 { 0x1b, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
855 { 0x1c, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
856 { 0x1c, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
857 { 0x1d, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
858 { 0x1d, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
859 { 0x1e, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
860 { 0x1e, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
861 { 0x1f, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
862 { 0x1f, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
863 { 0x20, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
864 { 0x6d, 0x0000ffff, 0, 0x100, SISLANDS_CACCONFIG_CGIND
},
868 static const struct si_cac_config_reg cac_weights_cape_verde
[] =
870 { 0x0, 0x0000ffff, 0, 0x82, SISLANDS_CACCONFIG_CGIND
},
871 { 0x0, 0xffff0000, 16, 0x4F, SISLANDS_CACCONFIG_CGIND
},
872 { 0x1, 0x0000ffff, 0, 0x153, SISLANDS_CACCONFIG_CGIND
},
873 { 0x1, 0xffff0000, 16, 0x52, SISLANDS_CACCONFIG_CGIND
},
874 { 0x2, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
875 { 0x3, 0x0000ffff, 0, 0x135, SISLANDS_CACCONFIG_CGIND
},
876 { 0x3, 0xffff0000, 16, 0x4F, SISLANDS_CACCONFIG_CGIND
},
877 { 0x4, 0x0000ffff, 0, 0x135, SISLANDS_CACCONFIG_CGIND
},
878 { 0x4, 0xffff0000, 16, 0xAC, SISLANDS_CACCONFIG_CGIND
},
879 { 0x5, 0x0000ffff, 0, 0x118, SISLANDS_CACCONFIG_CGIND
},
880 { 0x5, 0xffff0000, 16, 0xBE, SISLANDS_CACCONFIG_CGIND
},
881 { 0x6, 0x0000ffff, 0, 0x110, SISLANDS_CACCONFIG_CGIND
},
882 { 0x6, 0xffff0000, 16, 0x4CD, SISLANDS_CACCONFIG_CGIND
},
883 { 0x18f, 0x0000ffff, 0, 0x30, SISLANDS_CACCONFIG_CGIND
},
884 { 0x7, 0x0000ffff, 0, 0x37, SISLANDS_CACCONFIG_CGIND
},
885 { 0x7, 0xffff0000, 16, 0x27, SISLANDS_CACCONFIG_CGIND
},
886 { 0x8, 0x0000ffff, 0, 0xC3, SISLANDS_CACCONFIG_CGIND
},
887 { 0x8, 0xffff0000, 16, 0x35, SISLANDS_CACCONFIG_CGIND
},
888 { 0x9, 0x0000ffff, 0, 0x28, SISLANDS_CACCONFIG_CGIND
},
889 { 0xa, 0x0000ffff, 0, 0x26C, SISLANDS_CACCONFIG_CGIND
},
890 { 0xb, 0x0000ffff, 0, 0x3B2, SISLANDS_CACCONFIG_CGIND
},
891 { 0xb, 0xffff0000, 16, 0x99D, SISLANDS_CACCONFIG_CGIND
},
892 { 0xc, 0x0000ffff, 0, 0xA3F, SISLANDS_CACCONFIG_CGIND
},
893 { 0xd, 0x0000ffff, 0, 0xA, SISLANDS_CACCONFIG_CGIND
},
894 { 0xd, 0xffff0000, 16, 0xA, SISLANDS_CACCONFIG_CGIND
},
895 { 0xe, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND
},
896 { 0xf, 0x0000ffff, 0, 0x3, SISLANDS_CACCONFIG_CGIND
},
897 { 0xf, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
898 { 0x10, 0x0000ffff, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
899 { 0x10, 0xffff0000, 16, 0x1, SISLANDS_CACCONFIG_CGIND
},
900 { 0x11, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND
},
901 { 0x11, 0xffff0000, 16, 0x15, SISLANDS_CACCONFIG_CGIND
},
902 { 0x12, 0x0000ffff, 0, 0x34, SISLANDS_CACCONFIG_CGIND
},
903 { 0x13, 0x0000ffff, 0, 0x4, SISLANDS_CACCONFIG_CGIND
},
904 { 0x13, 0xffff0000, 16, 0x4, SISLANDS_CACCONFIG_CGIND
},
905 { 0x14, 0x0000ffff, 0, 0x3BA, SISLANDS_CACCONFIG_CGIND
},
906 { 0x15, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
907 { 0x15, 0xffff0000, 16, 0x6, SISLANDS_CACCONFIG_CGIND
},
908 { 0x4e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
909 { 0x16, 0x0000ffff, 0, 0x30, SISLANDS_CACCONFIG_CGIND
},
910 { 0x16, 0xffff0000, 16, 0x7A, SISLANDS_CACCONFIG_CGIND
},
911 { 0x17, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
912 { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
913 { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
914 { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
915 { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
916 { 0x1a, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
917 { 0x1a, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
918 { 0x1b, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
919 { 0x1b, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
920 { 0x1c, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
921 { 0x1c, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
922 { 0x1d, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
923 { 0x1d, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
924 { 0x1e, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
925 { 0x1e, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
926 { 0x1f, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
927 { 0x1f, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
928 { 0x20, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
929 { 0x6d, 0x0000ffff, 0, 0x100, SISLANDS_CACCONFIG_CGIND
},
933 static const struct si_cac_config_reg lcac_cape_verde
[] =
935 { 0x98, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
936 { 0x98, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
937 { 0x104, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
938 { 0x104, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
939 { 0x110, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND
},
940 { 0x110, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
941 { 0x14f, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND
},
942 { 0x14f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
943 { 0x8c, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND
},
944 { 0x8c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
945 { 0x143, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
946 { 0x143, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
947 { 0x9b, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
948 { 0x9b, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
949 { 0x107, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
950 { 0x107, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
951 { 0x113, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND
},
952 { 0x113, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
953 { 0x152, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND
},
954 { 0x152, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
955 { 0x8f, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
956 { 0x8f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
957 { 0x146, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
958 { 0x146, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
959 { 0x11c, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
960 { 0x11c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
961 { 0x11f, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
962 { 0x11f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
963 { 0x164, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
964 { 0x164, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
965 { 0x167, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
966 { 0x167, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
967 { 0x16a, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
968 { 0x16a, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
969 { 0x15e, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
970 { 0x15e, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
971 { 0x161, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
972 { 0x161, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
973 { 0x15b, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
974 { 0x15b, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
975 { 0x16d, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
976 { 0x16d, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
977 { 0x170, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
978 { 0x170, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
979 { 0x173, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
980 { 0x173, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
981 { 0x176, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
982 { 0x176, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
983 { 0x179, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
984 { 0x179, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
985 { 0x17c, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
986 { 0x17c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
987 { 0x17f, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
988 { 0x17f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
992 static const struct si_cac_config_reg cac_override_cape_verde
[] =
997 static const struct si_powertune_data powertune_data_cape_verde
=
999 ((1 << 16) | 0x6993),
1028 static const struct si_dte_data dte_data_cape_verde
=
1039 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
1040 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
1041 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
1046 static const struct si_dte_data dte_data_venus_xtx
=
1048 { 0x1E8480, 0x3D0900, 0x989680, 0x2625A00, 0x0 },
1049 { 0x71C, 0xAAB, 0xE39, 0x11C7, 0x0 },
1057 { 0x96, 0xB4, 0xFF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
1058 { 0x895440, 0x3D0900, 0x989680, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
1059 { 0xD6D8, 0x88B8, 0x1555, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
1064 static const struct si_dte_data dte_data_venus_xt
=
1066 { 0x1E8480, 0x3D0900, 0x989680, 0x2625A00, 0x0 },
1067 { 0xBDA, 0x11C7, 0x17B4, 0x1DA1, 0x0 },
1075 { 0x96, 0xB4, 0xFF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
1076 { 0x895440, 0x3D0900, 0x989680, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
1077 { 0xAFC8, 0x88B8, 0x238E, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
1082 static const struct si_dte_data dte_data_venus_pro
=
1084 { 0x1E8480, 0x3D0900, 0x989680, 0x2625A00, 0x0 },
1085 { 0x11C7, 0x1AAB, 0x238E, 0x2C72, 0x0 },
1093 { 0x96, 0xB4, 0xFF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
1094 { 0x895440, 0x3D0900, 0x989680, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
1095 { 0x88B8, 0x88B8, 0x3555, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
1100 struct si_cac_config_reg cac_weights_oland
[] =
1102 { 0x0, 0x0000ffff, 0, 0x82, SISLANDS_CACCONFIG_CGIND
},
1103 { 0x0, 0xffff0000, 16, 0x4F, SISLANDS_CACCONFIG_CGIND
},
1104 { 0x1, 0x0000ffff, 0, 0x153, SISLANDS_CACCONFIG_CGIND
},
1105 { 0x1, 0xffff0000, 16, 0x52, SISLANDS_CACCONFIG_CGIND
},
1106 { 0x2, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1107 { 0x3, 0x0000ffff, 0, 0x135, SISLANDS_CACCONFIG_CGIND
},
1108 { 0x3, 0xffff0000, 16, 0x4F, SISLANDS_CACCONFIG_CGIND
},
1109 { 0x4, 0x0000ffff, 0, 0x135, SISLANDS_CACCONFIG_CGIND
},
1110 { 0x4, 0xffff0000, 16, 0xAC, SISLANDS_CACCONFIG_CGIND
},
1111 { 0x5, 0x0000ffff, 0, 0x118, SISLANDS_CACCONFIG_CGIND
},
1112 { 0x5, 0xffff0000, 16, 0xBE, SISLANDS_CACCONFIG_CGIND
},
1113 { 0x6, 0x0000ffff, 0, 0x110, SISLANDS_CACCONFIG_CGIND
},
1114 { 0x6, 0xffff0000, 16, 0x4CD, SISLANDS_CACCONFIG_CGIND
},
1115 { 0x18f, 0x0000ffff, 0, 0x30, SISLANDS_CACCONFIG_CGIND
},
1116 { 0x7, 0x0000ffff, 0, 0x37, SISLANDS_CACCONFIG_CGIND
},
1117 { 0x7, 0xffff0000, 16, 0x27, SISLANDS_CACCONFIG_CGIND
},
1118 { 0x8, 0x0000ffff, 0, 0xC3, SISLANDS_CACCONFIG_CGIND
},
1119 { 0x8, 0xffff0000, 16, 0x35, SISLANDS_CACCONFIG_CGIND
},
1120 { 0x9, 0x0000ffff, 0, 0x28, SISLANDS_CACCONFIG_CGIND
},
1121 { 0xa, 0x0000ffff, 0, 0x26C, SISLANDS_CACCONFIG_CGIND
},
1122 { 0xb, 0x0000ffff, 0, 0x3B2, SISLANDS_CACCONFIG_CGIND
},
1123 { 0xb, 0xffff0000, 16, 0x99D, SISLANDS_CACCONFIG_CGIND
},
1124 { 0xc, 0x0000ffff, 0, 0xA3F, SISLANDS_CACCONFIG_CGIND
},
1125 { 0xd, 0x0000ffff, 0, 0xA, SISLANDS_CACCONFIG_CGIND
},
1126 { 0xd, 0xffff0000, 16, 0xA, SISLANDS_CACCONFIG_CGIND
},
1127 { 0xe, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND
},
1128 { 0xf, 0x0000ffff, 0, 0x3, SISLANDS_CACCONFIG_CGIND
},
1129 { 0xf, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1130 { 0x10, 0x0000ffff, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1131 { 0x10, 0xffff0000, 16, 0x1, SISLANDS_CACCONFIG_CGIND
},
1132 { 0x11, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND
},
1133 { 0x11, 0xffff0000, 16, 0x15, SISLANDS_CACCONFIG_CGIND
},
1134 { 0x12, 0x0000ffff, 0, 0x34, SISLANDS_CACCONFIG_CGIND
},
1135 { 0x13, 0x0000ffff, 0, 0x4, SISLANDS_CACCONFIG_CGIND
},
1136 { 0x13, 0xffff0000, 16, 0x4, SISLANDS_CACCONFIG_CGIND
},
1137 { 0x14, 0x0000ffff, 0, 0x3BA, SISLANDS_CACCONFIG_CGIND
},
1138 { 0x15, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1139 { 0x15, 0xffff0000, 16, 0x6, SISLANDS_CACCONFIG_CGIND
},
1140 { 0x4e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1141 { 0x16, 0x0000ffff, 0, 0x30, SISLANDS_CACCONFIG_CGIND
},
1142 { 0x16, 0xffff0000, 16, 0x7A, SISLANDS_CACCONFIG_CGIND
},
1143 { 0x17, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1144 { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1145 { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1146 { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1147 { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1148 { 0x1a, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1149 { 0x1a, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
1150 { 0x1b, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1151 { 0x1b, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
1152 { 0x1c, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1153 { 0x1c, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
1154 { 0x1d, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1155 { 0x1d, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
1156 { 0x1e, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1157 { 0x1e, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
1158 { 0x1f, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1159 { 0x1f, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
1160 { 0x20, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1161 { 0x6d, 0x0000ffff, 0, 0x100, SISLANDS_CACCONFIG_CGIND
},
1165 static const struct si_cac_config_reg cac_weights_mars_pro
[] =
1167 { 0x0, 0x0000ffff, 0, 0x43, SISLANDS_CACCONFIG_CGIND
},
1168 { 0x0, 0xffff0000, 16, 0x29, SISLANDS_CACCONFIG_CGIND
},
1169 { 0x1, 0x0000ffff, 0, 0xAF, SISLANDS_CACCONFIG_CGIND
},
1170 { 0x1, 0xffff0000, 16, 0x2A, SISLANDS_CACCONFIG_CGIND
},
1171 { 0x2, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1172 { 0x3, 0x0000ffff, 0, 0xA0, SISLANDS_CACCONFIG_CGIND
},
1173 { 0x3, 0xffff0000, 16, 0x29, SISLANDS_CACCONFIG_CGIND
},
1174 { 0x4, 0x0000ffff, 0, 0xA0, SISLANDS_CACCONFIG_CGIND
},
1175 { 0x4, 0xffff0000, 16, 0x59, SISLANDS_CACCONFIG_CGIND
},
1176 { 0x5, 0x0000ffff, 0, 0x1A5, SISLANDS_CACCONFIG_CGIND
},
1177 { 0x5, 0xffff0000, 16, 0x1D6, SISLANDS_CACCONFIG_CGIND
},
1178 { 0x6, 0x0000ffff, 0, 0x2A3, SISLANDS_CACCONFIG_CGIND
},
1179 { 0x6, 0xffff0000, 16, 0x8FD, SISLANDS_CACCONFIG_CGIND
},
1180 { 0x18f, 0x0000ffff, 0, 0x76, SISLANDS_CACCONFIG_CGIND
},
1181 { 0x7, 0x0000ffff, 0, 0x8A, SISLANDS_CACCONFIG_CGIND
},
1182 { 0x7, 0xffff0000, 16, 0xA3, SISLANDS_CACCONFIG_CGIND
},
1183 { 0x8, 0x0000ffff, 0, 0x71, SISLANDS_CACCONFIG_CGIND
},
1184 { 0x8, 0xffff0000, 16, 0x36, SISLANDS_CACCONFIG_CGIND
},
1185 { 0x9, 0x0000ffff, 0, 0xA6, SISLANDS_CACCONFIG_CGIND
},
1186 { 0xa, 0x0000ffff, 0, 0x81, SISLANDS_CACCONFIG_CGIND
},
1187 { 0xb, 0x0000ffff, 0, 0x3D2, SISLANDS_CACCONFIG_CGIND
},
1188 { 0xb, 0xffff0000, 16, 0x27C, SISLANDS_CACCONFIG_CGIND
},
1189 { 0xc, 0x0000ffff, 0, 0xA96, SISLANDS_CACCONFIG_CGIND
},
1190 { 0xd, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND
},
1191 { 0xd, 0xffff0000, 16, 0x5, SISLANDS_CACCONFIG_CGIND
},
1192 { 0xe, 0x0000ffff, 0, 0xB, SISLANDS_CACCONFIG_CGIND
},
1193 { 0xf, 0x0000ffff, 0, 0x3, SISLANDS_CACCONFIG_CGIND
},
1194 { 0xf, 0xffff0000, 16, 0x2, SISLANDS_CACCONFIG_CGIND
},
1195 { 0x10, 0x0000ffff, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1196 { 0x10, 0xffff0000, 16, 0x4, SISLANDS_CACCONFIG_CGIND
},
1197 { 0x11, 0x0000ffff, 0, 0x15, SISLANDS_CACCONFIG_CGIND
},
1198 { 0x11, 0xffff0000, 16, 0x7, SISLANDS_CACCONFIG_CGIND
},
1199 { 0x12, 0x0000ffff, 0, 0x36, SISLANDS_CACCONFIG_CGIND
},
1200 { 0x13, 0x0000ffff, 0, 0x10, SISLANDS_CACCONFIG_CGIND
},
1201 { 0x13, 0xffff0000, 16, 0x10, SISLANDS_CACCONFIG_CGIND
},
1202 { 0x14, 0x0000ffff, 0, 0x2, SISLANDS_CACCONFIG_CGIND
},
1203 { 0x15, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1204 { 0x15, 0xffff0000, 16, 0x6, SISLANDS_CACCONFIG_CGIND
},
1205 { 0x4e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1206 { 0x16, 0x0000ffff, 0, 0x32, SISLANDS_CACCONFIG_CGIND
},
1207 { 0x16, 0xffff0000, 16, 0x7E, SISLANDS_CACCONFIG_CGIND
},
1208 { 0x17, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1209 { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1210 { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1211 { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1212 { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1213 { 0x1a, 0x0000ffff, 0, 0x280, SISLANDS_CACCONFIG_CGIND
},
1214 { 0x1a, 0xffff0000, 16, 0x7, SISLANDS_CACCONFIG_CGIND
},
1215 { 0x1b, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1216 { 0x1b, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1217 { 0x1c, 0x0000ffff, 0, 0x3C, SISLANDS_CACCONFIG_CGIND
},
1218 { 0x1c, 0xffff0000, 16, 0x203, SISLANDS_CACCONFIG_CGIND
},
1219 { 0x1d, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1220 { 0x1d, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1221 { 0x1e, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1222 { 0x1e, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
1223 { 0x1f, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1224 { 0x1f, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
1225 { 0x20, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1226 { 0x6d, 0x0000ffff, 0, 0xB4, SISLANDS_CACCONFIG_CGIND
},
1230 static const struct si_cac_config_reg cac_weights_mars_xt
[] =
1232 { 0x0, 0x0000ffff, 0, 0x43, SISLANDS_CACCONFIG_CGIND
},
1233 { 0x0, 0xffff0000, 16, 0x29, SISLANDS_CACCONFIG_CGIND
},
1234 { 0x1, 0x0000ffff, 0, 0xAF, SISLANDS_CACCONFIG_CGIND
},
1235 { 0x1, 0xffff0000, 16, 0x2A, SISLANDS_CACCONFIG_CGIND
},
1236 { 0x2, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1237 { 0x3, 0x0000ffff, 0, 0xA0, SISLANDS_CACCONFIG_CGIND
},
1238 { 0x3, 0xffff0000, 16, 0x29, SISLANDS_CACCONFIG_CGIND
},
1239 { 0x4, 0x0000ffff, 0, 0xA0, SISLANDS_CACCONFIG_CGIND
},
1240 { 0x4, 0xffff0000, 16, 0x59, SISLANDS_CACCONFIG_CGIND
},
1241 { 0x5, 0x0000ffff, 0, 0x1A5, SISLANDS_CACCONFIG_CGIND
},
1242 { 0x5, 0xffff0000, 16, 0x1D6, SISLANDS_CACCONFIG_CGIND
},
1243 { 0x6, 0x0000ffff, 0, 0x2A3, SISLANDS_CACCONFIG_CGIND
},
1244 { 0x6, 0xffff0000, 16, 0x8FD, SISLANDS_CACCONFIG_CGIND
},
1245 { 0x18f, 0x0000ffff, 0, 0x76, SISLANDS_CACCONFIG_CGIND
},
1246 { 0x7, 0x0000ffff, 0, 0x8A, SISLANDS_CACCONFIG_CGIND
},
1247 { 0x7, 0xffff0000, 16, 0xA3, SISLANDS_CACCONFIG_CGIND
},
1248 { 0x8, 0x0000ffff, 0, 0x71, SISLANDS_CACCONFIG_CGIND
},
1249 { 0x8, 0xffff0000, 16, 0x36, SISLANDS_CACCONFIG_CGIND
},
1250 { 0x9, 0x0000ffff, 0, 0xA6, SISLANDS_CACCONFIG_CGIND
},
1251 { 0xa, 0x0000ffff, 0, 0x81, SISLANDS_CACCONFIG_CGIND
},
1252 { 0xb, 0x0000ffff, 0, 0x3D2, SISLANDS_CACCONFIG_CGIND
},
1253 { 0xb, 0xffff0000, 16, 0x27C, SISLANDS_CACCONFIG_CGIND
},
1254 { 0xc, 0x0000ffff, 0, 0xA96, SISLANDS_CACCONFIG_CGIND
},
1255 { 0xd, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND
},
1256 { 0xd, 0xffff0000, 16, 0x5, SISLANDS_CACCONFIG_CGIND
},
1257 { 0xe, 0x0000ffff, 0, 0xB, SISLANDS_CACCONFIG_CGIND
},
1258 { 0xf, 0x0000ffff, 0, 0x3, SISLANDS_CACCONFIG_CGIND
},
1259 { 0xf, 0xffff0000, 16, 0x2, SISLANDS_CACCONFIG_CGIND
},
1260 { 0x10, 0x0000ffff, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1261 { 0x10, 0xffff0000, 16, 0x4, SISLANDS_CACCONFIG_CGIND
},
1262 { 0x11, 0x0000ffff, 0, 0x15, SISLANDS_CACCONFIG_CGIND
},
1263 { 0x11, 0xffff0000, 16, 0x7, SISLANDS_CACCONFIG_CGIND
},
1264 { 0x12, 0x0000ffff, 0, 0x36, SISLANDS_CACCONFIG_CGIND
},
1265 { 0x13, 0x0000ffff, 0, 0x10, SISLANDS_CACCONFIG_CGIND
},
1266 { 0x13, 0xffff0000, 16, 0x10, SISLANDS_CACCONFIG_CGIND
},
1267 { 0x14, 0x0000ffff, 0, 0x60, SISLANDS_CACCONFIG_CGIND
},
1268 { 0x15, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1269 { 0x15, 0xffff0000, 16, 0x6, SISLANDS_CACCONFIG_CGIND
},
1270 { 0x4e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1271 { 0x16, 0x0000ffff, 0, 0x32, SISLANDS_CACCONFIG_CGIND
},
1272 { 0x16, 0xffff0000, 16, 0x7E, SISLANDS_CACCONFIG_CGIND
},
1273 { 0x17, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1274 { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1275 { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1276 { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1277 { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1278 { 0x1a, 0x0000ffff, 0, 0x280, SISLANDS_CACCONFIG_CGIND
},
1279 { 0x1a, 0xffff0000, 16, 0x7, SISLANDS_CACCONFIG_CGIND
},
1280 { 0x1b, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1281 { 0x1b, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1282 { 0x1c, 0x0000ffff, 0, 0x3C, SISLANDS_CACCONFIG_CGIND
},
1283 { 0x1c, 0xffff0000, 16, 0x203, SISLANDS_CACCONFIG_CGIND
},
1284 { 0x1d, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1285 { 0x1d, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1286 { 0x1e, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1287 { 0x1e, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
1288 { 0x1f, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1289 { 0x1f, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
1290 { 0x20, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1291 { 0x6d, 0x0000ffff, 0, 0xB4, SISLANDS_CACCONFIG_CGIND
},
1295 static const struct si_cac_config_reg cac_weights_oland_pro
[] =
1297 { 0x0, 0x0000ffff, 0, 0x43, SISLANDS_CACCONFIG_CGIND
},
1298 { 0x0, 0xffff0000, 16, 0x29, SISLANDS_CACCONFIG_CGIND
},
1299 { 0x1, 0x0000ffff, 0, 0xAF, SISLANDS_CACCONFIG_CGIND
},
1300 { 0x1, 0xffff0000, 16, 0x2A, SISLANDS_CACCONFIG_CGIND
},
1301 { 0x2, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1302 { 0x3, 0x0000ffff, 0, 0xA0, SISLANDS_CACCONFIG_CGIND
},
1303 { 0x3, 0xffff0000, 16, 0x29, SISLANDS_CACCONFIG_CGIND
},
1304 { 0x4, 0x0000ffff, 0, 0xA0, SISLANDS_CACCONFIG_CGIND
},
1305 { 0x4, 0xffff0000, 16, 0x59, SISLANDS_CACCONFIG_CGIND
},
1306 { 0x5, 0x0000ffff, 0, 0x1A5, SISLANDS_CACCONFIG_CGIND
},
1307 { 0x5, 0xffff0000, 16, 0x1D6, SISLANDS_CACCONFIG_CGIND
},
1308 { 0x6, 0x0000ffff, 0, 0x2A3, SISLANDS_CACCONFIG_CGIND
},
1309 { 0x6, 0xffff0000, 16, 0x8FD, SISLANDS_CACCONFIG_CGIND
},
1310 { 0x18f, 0x0000ffff, 0, 0x76, SISLANDS_CACCONFIG_CGIND
},
1311 { 0x7, 0x0000ffff, 0, 0x8A, SISLANDS_CACCONFIG_CGIND
},
1312 { 0x7, 0xffff0000, 16, 0xA3, SISLANDS_CACCONFIG_CGIND
},
1313 { 0x8, 0x0000ffff, 0, 0x71, SISLANDS_CACCONFIG_CGIND
},
1314 { 0x8, 0xffff0000, 16, 0x36, SISLANDS_CACCONFIG_CGIND
},
1315 { 0x9, 0x0000ffff, 0, 0xA6, SISLANDS_CACCONFIG_CGIND
},
1316 { 0xa, 0x0000ffff, 0, 0x81, SISLANDS_CACCONFIG_CGIND
},
1317 { 0xb, 0x0000ffff, 0, 0x3D2, SISLANDS_CACCONFIG_CGIND
},
1318 { 0xb, 0xffff0000, 16, 0x27C, SISLANDS_CACCONFIG_CGIND
},
1319 { 0xc, 0x0000ffff, 0, 0xA96, SISLANDS_CACCONFIG_CGIND
},
1320 { 0xd, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND
},
1321 { 0xd, 0xffff0000, 16, 0x5, SISLANDS_CACCONFIG_CGIND
},
1322 { 0xe, 0x0000ffff, 0, 0xB, SISLANDS_CACCONFIG_CGIND
},
1323 { 0xf, 0x0000ffff, 0, 0x3, SISLANDS_CACCONFIG_CGIND
},
1324 { 0xf, 0xffff0000, 16, 0x2, SISLANDS_CACCONFIG_CGIND
},
1325 { 0x10, 0x0000ffff, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1326 { 0x10, 0xffff0000, 16, 0x4, SISLANDS_CACCONFIG_CGIND
},
1327 { 0x11, 0x0000ffff, 0, 0x15, SISLANDS_CACCONFIG_CGIND
},
1328 { 0x11, 0xffff0000, 16, 0x7, SISLANDS_CACCONFIG_CGIND
},
1329 { 0x12, 0x0000ffff, 0, 0x36, SISLANDS_CACCONFIG_CGIND
},
1330 { 0x13, 0x0000ffff, 0, 0x10, SISLANDS_CACCONFIG_CGIND
},
1331 { 0x13, 0xffff0000, 16, 0x10, SISLANDS_CACCONFIG_CGIND
},
1332 { 0x14, 0x0000ffff, 0, 0x90, SISLANDS_CACCONFIG_CGIND
},
1333 { 0x15, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1334 { 0x15, 0xffff0000, 16, 0x6, SISLANDS_CACCONFIG_CGIND
},
1335 { 0x4e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1336 { 0x16, 0x0000ffff, 0, 0x32, SISLANDS_CACCONFIG_CGIND
},
1337 { 0x16, 0xffff0000, 16, 0x7E, SISLANDS_CACCONFIG_CGIND
},
1338 { 0x17, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1339 { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1340 { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1341 { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1342 { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1343 { 0x1a, 0x0000ffff, 0, 0x280, SISLANDS_CACCONFIG_CGIND
},
1344 { 0x1a, 0xffff0000, 16, 0x7, SISLANDS_CACCONFIG_CGIND
},
1345 { 0x1b, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1346 { 0x1b, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1347 { 0x1c, 0x0000ffff, 0, 0x3C, SISLANDS_CACCONFIG_CGIND
},
1348 { 0x1c, 0xffff0000, 16, 0x203, SISLANDS_CACCONFIG_CGIND
},
1349 { 0x1d, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1350 { 0x1d, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1351 { 0x1e, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1352 { 0x1e, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
1353 { 0x1f, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1354 { 0x1f, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
1355 { 0x20, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1356 { 0x6d, 0x0000ffff, 0, 0xB4, SISLANDS_CACCONFIG_CGIND
},
1360 static const struct si_cac_config_reg cac_weights_oland_xt
[] =
1362 { 0x0, 0x0000ffff, 0, 0x43, SISLANDS_CACCONFIG_CGIND
},
1363 { 0x0, 0xffff0000, 16, 0x29, SISLANDS_CACCONFIG_CGIND
},
1364 { 0x1, 0x0000ffff, 0, 0xAF, SISLANDS_CACCONFIG_CGIND
},
1365 { 0x1, 0xffff0000, 16, 0x2A, SISLANDS_CACCONFIG_CGIND
},
1366 { 0x2, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1367 { 0x3, 0x0000ffff, 0, 0xA0, SISLANDS_CACCONFIG_CGIND
},
1368 { 0x3, 0xffff0000, 16, 0x29, SISLANDS_CACCONFIG_CGIND
},
1369 { 0x4, 0x0000ffff, 0, 0xA0, SISLANDS_CACCONFIG_CGIND
},
1370 { 0x4, 0xffff0000, 16, 0x59, SISLANDS_CACCONFIG_CGIND
},
1371 { 0x5, 0x0000ffff, 0, 0x1A5, SISLANDS_CACCONFIG_CGIND
},
1372 { 0x5, 0xffff0000, 16, 0x1D6, SISLANDS_CACCONFIG_CGIND
},
1373 { 0x6, 0x0000ffff, 0, 0x2A3, SISLANDS_CACCONFIG_CGIND
},
1374 { 0x6, 0xffff0000, 16, 0x8FD, SISLANDS_CACCONFIG_CGIND
},
1375 { 0x18f, 0x0000ffff, 0, 0x76, SISLANDS_CACCONFIG_CGIND
},
1376 { 0x7, 0x0000ffff, 0, 0x8A, SISLANDS_CACCONFIG_CGIND
},
1377 { 0x7, 0xffff0000, 16, 0xA3, SISLANDS_CACCONFIG_CGIND
},
1378 { 0x8, 0x0000ffff, 0, 0x71, SISLANDS_CACCONFIG_CGIND
},
1379 { 0x8, 0xffff0000, 16, 0x36, SISLANDS_CACCONFIG_CGIND
},
1380 { 0x9, 0x0000ffff, 0, 0xA6, SISLANDS_CACCONFIG_CGIND
},
1381 { 0xa, 0x0000ffff, 0, 0x81, SISLANDS_CACCONFIG_CGIND
},
1382 { 0xb, 0x0000ffff, 0, 0x3D2, SISLANDS_CACCONFIG_CGIND
},
1383 { 0xb, 0xffff0000, 16, 0x27C, SISLANDS_CACCONFIG_CGIND
},
1384 { 0xc, 0x0000ffff, 0, 0xA96, SISLANDS_CACCONFIG_CGIND
},
1385 { 0xd, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND
},
1386 { 0xd, 0xffff0000, 16, 0x5, SISLANDS_CACCONFIG_CGIND
},
1387 { 0xe, 0x0000ffff, 0, 0xB, SISLANDS_CACCONFIG_CGIND
},
1388 { 0xf, 0x0000ffff, 0, 0x3, SISLANDS_CACCONFIG_CGIND
},
1389 { 0xf, 0xffff0000, 16, 0x2, SISLANDS_CACCONFIG_CGIND
},
1390 { 0x10, 0x0000ffff, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1391 { 0x10, 0xffff0000, 16, 0x4, SISLANDS_CACCONFIG_CGIND
},
1392 { 0x11, 0x0000ffff, 0, 0x15, SISLANDS_CACCONFIG_CGIND
},
1393 { 0x11, 0xffff0000, 16, 0x7, SISLANDS_CACCONFIG_CGIND
},
1394 { 0x12, 0x0000ffff, 0, 0x36, SISLANDS_CACCONFIG_CGIND
},
1395 { 0x13, 0x0000ffff, 0, 0x10, SISLANDS_CACCONFIG_CGIND
},
1396 { 0x13, 0xffff0000, 16, 0x10, SISLANDS_CACCONFIG_CGIND
},
1397 { 0x14, 0x0000ffff, 0, 0x120, SISLANDS_CACCONFIG_CGIND
},
1398 { 0x15, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1399 { 0x15, 0xffff0000, 16, 0x6, SISLANDS_CACCONFIG_CGIND
},
1400 { 0x4e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1401 { 0x16, 0x0000ffff, 0, 0x32, SISLANDS_CACCONFIG_CGIND
},
1402 { 0x16, 0xffff0000, 16, 0x7E, SISLANDS_CACCONFIG_CGIND
},
1403 { 0x17, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1404 { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1405 { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1406 { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1407 { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1408 { 0x1a, 0x0000ffff, 0, 0x280, SISLANDS_CACCONFIG_CGIND
},
1409 { 0x1a, 0xffff0000, 16, 0x7, SISLANDS_CACCONFIG_CGIND
},
1410 { 0x1b, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1411 { 0x1b, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1412 { 0x1c, 0x0000ffff, 0, 0x3C, SISLANDS_CACCONFIG_CGIND
},
1413 { 0x1c, 0xffff0000, 16, 0x203, SISLANDS_CACCONFIG_CGIND
},
1414 { 0x1d, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1415 { 0x1d, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1416 { 0x1e, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1417 { 0x1e, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
1418 { 0x1f, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1419 { 0x1f, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
1420 { 0x20, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1421 { 0x6d, 0x0000ffff, 0, 0xB4, SISLANDS_CACCONFIG_CGIND
},
1425 static const struct si_cac_config_reg lcac_oland
[] =
1427 { 0x98, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
1428 { 0x98, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1429 { 0x104, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
1430 { 0x104, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1431 { 0x110, 0x0001fffe, 1, 0x6, SISLANDS_CACCONFIG_CGIND
},
1432 { 0x110, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1433 { 0x14f, 0x0001fffe, 1, 0x6, SISLANDS_CACCONFIG_CGIND
},
1434 { 0x14f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1435 { 0x8c, 0x0001fffe, 1, 0x6, SISLANDS_CACCONFIG_CGIND
},
1436 { 0x8c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1437 { 0x143, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND
},
1438 { 0x143, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1439 { 0x11c, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
1440 { 0x11c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1441 { 0x11f, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
1442 { 0x11f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1443 { 0x164, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
1444 { 0x164, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1445 { 0x167, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
1446 { 0x167, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1447 { 0x16a, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
1448 { 0x16a, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1449 { 0x15e, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
1450 { 0x15e, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1451 { 0x161, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
1452 { 0x161, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1453 { 0x15b, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
1454 { 0x15b, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1455 { 0x16d, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
1456 { 0x16d, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1457 { 0x170, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
1458 { 0x170, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1459 { 0x173, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
1460 { 0x173, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1461 { 0x176, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
1462 { 0x176, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1463 { 0x179, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
1464 { 0x179, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1465 { 0x17c, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
1466 { 0x17c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1467 { 0x17f, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
1468 { 0x17f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1472 static const struct si_cac_config_reg lcac_mars_pro
[] =
1474 { 0x98, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
1475 { 0x98, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1476 { 0x104, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
1477 { 0x104, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1478 { 0x110, 0x0001fffe, 1, 0x6, SISLANDS_CACCONFIG_CGIND
},
1479 { 0x110, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1480 { 0x14f, 0x0001fffe, 1, 0x6, SISLANDS_CACCONFIG_CGIND
},
1481 { 0x14f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1482 { 0x8c, 0x0001fffe, 1, 0x6, SISLANDS_CACCONFIG_CGIND
},
1483 { 0x8c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1484 { 0x143, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
1485 { 0x143, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1486 { 0x11c, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
1487 { 0x11c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1488 { 0x11f, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
1489 { 0x11f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1490 { 0x164, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
1491 { 0x164, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1492 { 0x167, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
1493 { 0x167, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1494 { 0x16a, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
1495 { 0x16a, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1496 { 0x15e, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
1497 { 0x15e, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1498 { 0x161, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
1499 { 0x161, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1500 { 0x15b, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
1501 { 0x15b, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1502 { 0x16d, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND
},
1503 { 0x16d, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1504 { 0x170, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
1505 { 0x170, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1506 { 0x173, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
1507 { 0x173, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1508 { 0x176, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
1509 { 0x176, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1510 { 0x179, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
1511 { 0x179, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1512 { 0x17c, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
1513 { 0x17c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1514 { 0x17f, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND
},
1515 { 0x17f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND
},
1519 static const struct si_cac_config_reg cac_override_oland
[] =
1524 static const struct si_powertune_data powertune_data_oland
=
1526 ((1 << 16) | 0x6993),
1555 static const struct si_powertune_data powertune_data_mars_pro
=
1557 ((1 << 16) | 0x6993),
1586 static const struct si_dte_data dte_data_oland
=
1597 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
1598 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
1599 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
1604 static const struct si_dte_data dte_data_mars_pro
=
1606 { 0x1E8480, 0x3D0900, 0x989680, 0x2625A00, 0x0 },
1607 { 0x0, 0x0, 0x0, 0x0, 0x0 },
1615 { 0x96, 0xB4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
1616 { 0x895440, 0x3D0900, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680 },
1617 { 0xF627, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
1622 static const struct si_dte_data dte_data_sun_xt
=
1624 { 0x1E8480, 0x3D0900, 0x989680, 0x2625A00, 0x0 },
1625 { 0x0, 0x0, 0x0, 0x0, 0x0 },
1633 { 0x96, 0xB4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
1634 { 0x895440, 0x3D0900, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680 },
1635 { 0xD555, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
1641 static const struct si_cac_config_reg cac_weights_hainan
[] =
1643 { 0x0, 0x0000ffff, 0, 0x2d9, SISLANDS_CACCONFIG_CGIND
},
1644 { 0x0, 0xffff0000, 16, 0x22b, SISLANDS_CACCONFIG_CGIND
},
1645 { 0x1, 0x0000ffff, 0, 0x21c, SISLANDS_CACCONFIG_CGIND
},
1646 { 0x1, 0xffff0000, 16, 0x1dc, SISLANDS_CACCONFIG_CGIND
},
1647 { 0x2, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1648 { 0x3, 0x0000ffff, 0, 0x24e, SISLANDS_CACCONFIG_CGIND
},
1649 { 0x3, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1650 { 0x4, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1651 { 0x4, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1652 { 0x5, 0x0000ffff, 0, 0x35e, SISLANDS_CACCONFIG_CGIND
},
1653 { 0x5, 0xffff0000, 16, 0x1143, SISLANDS_CACCONFIG_CGIND
},
1654 { 0x6, 0x0000ffff, 0, 0xe17, SISLANDS_CACCONFIG_CGIND
},
1655 { 0x6, 0xffff0000, 16, 0x441, SISLANDS_CACCONFIG_CGIND
},
1656 { 0x18f, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1657 { 0x7, 0x0000ffff, 0, 0x28b, SISLANDS_CACCONFIG_CGIND
},
1658 { 0x7, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1659 { 0x8, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1660 { 0x8, 0xffff0000, 16, 0xabe, SISLANDS_CACCONFIG_CGIND
},
1661 { 0x9, 0x0000ffff, 0, 0xf11, SISLANDS_CACCONFIG_CGIND
},
1662 { 0xa, 0x0000ffff, 0, 0x907, SISLANDS_CACCONFIG_CGIND
},
1663 { 0xb, 0x0000ffff, 0, 0xb45, SISLANDS_CACCONFIG_CGIND
},
1664 { 0xb, 0xffff0000, 16, 0xd1e, SISLANDS_CACCONFIG_CGIND
},
1665 { 0xc, 0x0000ffff, 0, 0xa2c, SISLANDS_CACCONFIG_CGIND
},
1666 { 0xd, 0x0000ffff, 0, 0x62, SISLANDS_CACCONFIG_CGIND
},
1667 { 0xd, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1668 { 0xe, 0x0000ffff, 0, 0x1f3, SISLANDS_CACCONFIG_CGIND
},
1669 { 0xf, 0x0000ffff, 0, 0x42, SISLANDS_CACCONFIG_CGIND
},
1670 { 0xf, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1671 { 0x10, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1672 { 0x10, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1673 { 0x11, 0x0000ffff, 0, 0x709, SISLANDS_CACCONFIG_CGIND
},
1674 { 0x11, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1675 { 0x12, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1676 { 0x13, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1677 { 0x13, 0xffff0000, 16, 0x3a, SISLANDS_CACCONFIG_CGIND
},
1678 { 0x14, 0x0000ffff, 0, 0x357, SISLANDS_CACCONFIG_CGIND
},
1679 { 0x15, 0x0000ffff, 0, 0x9f, SISLANDS_CACCONFIG_CGIND
},
1680 { 0x15, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1681 { 0x4e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1682 { 0x16, 0x0000ffff, 0, 0x314, SISLANDS_CACCONFIG_CGIND
},
1683 { 0x16, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1684 { 0x17, 0x0000ffff, 0, 0x6d, SISLANDS_CACCONFIG_CGIND
},
1685 { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1686 { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1687 { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND
},
1688 { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND
},
1689 { 0x1a, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1690 { 0x1a, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
1691 { 0x1b, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1692 { 0x1b, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
1693 { 0x1c, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1694 { 0x1c, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
1695 { 0x1d, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1696 { 0x1d, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
1697 { 0x1e, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1698 { 0x1e, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
1699 { 0x1f, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1700 { 0x1f, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND
},
1701 { 0x20, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND
},
1702 { 0x6d, 0x0000ffff, 0, 0x1b9, SISLANDS_CACCONFIG_CGIND
},
1706 static const struct si_powertune_data powertune_data_hainan
=
1708 ((1 << 16) | 0x6993),
1737 struct rv7xx_power_info
*rv770_get_pi(struct radeon_device
*rdev
);
1738 struct evergreen_power_info
*evergreen_get_pi(struct radeon_device
*rdev
);
1739 struct ni_power_info
*ni_get_pi(struct radeon_device
*rdev
);
1740 struct ni_ps
*ni_get_ps(struct radeon_ps
*rps
);
1742 extern int si_mc_load_microcode(struct radeon_device
*rdev
);
1743 extern void vce_v1_0_enable_mgcg(struct radeon_device
*rdev
, bool enable
);
1745 static int si_populate_voltage_value(struct radeon_device
*rdev
,
1746 const struct atom_voltage_table
*table
,
1747 u16 value
, SISLANDS_SMC_VOLTAGE_VALUE
*voltage
);
1748 static int si_get_std_voltage_value(struct radeon_device
*rdev
,
1749 SISLANDS_SMC_VOLTAGE_VALUE
*voltage
,
1751 static int si_write_smc_soft_register(struct radeon_device
*rdev
,
1752 u16 reg_offset
, u32 value
);
1753 static int si_convert_power_level_to_smc(struct radeon_device
*rdev
,
1754 struct rv7xx_pl
*pl
,
1755 SISLANDS_SMC_HW_PERFORMANCE_LEVEL
*level
);
1756 static int si_calculate_sclk_params(struct radeon_device
*rdev
,
1758 SISLANDS_SMC_SCLK_VALUE
*sclk
);
1760 static void si_thermal_start_smc_fan_control(struct radeon_device
*rdev
);
1761 static void si_fan_ctrl_set_default_mode(struct radeon_device
*rdev
);
1763 static struct si_power_info
*si_get_pi(struct radeon_device
*rdev
)
1765 struct si_power_info
*pi
= rdev
->pm
.dpm
.priv
;
1770 static void si_calculate_leakage_for_v_and_t_formula(const struct ni_leakage_coeffients
*coeff
,
1771 u16 v
, s32 t
, u32 ileakage
, u32
*leakage
)
1773 s64 kt
, kv
, leakage_w
, i_leakage
, vddc
;
1774 s64 temperature
, t_slope
, t_intercept
, av
, bv
, t_ref
;
1777 i_leakage
= div64_s64(drm_int2fixp(ileakage
), 100);
1778 vddc
= div64_s64(drm_int2fixp(v
), 1000);
1779 temperature
= div64_s64(drm_int2fixp(t
), 1000);
1781 t_slope
= div64_s64(drm_int2fixp(coeff
->t_slope
), 100000000);
1782 t_intercept
= div64_s64(drm_int2fixp(coeff
->t_intercept
), 100000000);
1783 av
= div64_s64(drm_int2fixp(coeff
->av
), 100000000);
1784 bv
= div64_s64(drm_int2fixp(coeff
->bv
), 100000000);
1785 t_ref
= drm_int2fixp(coeff
->t_ref
);
1787 tmp
= drm_fixp_mul(t_slope
, vddc
) + t_intercept
;
1788 kt
= drm_fixp_exp(drm_fixp_mul(tmp
, temperature
));
1789 kt
= drm_fixp_div(kt
, drm_fixp_exp(drm_fixp_mul(tmp
, t_ref
)));
1790 kv
= drm_fixp_mul(av
, drm_fixp_exp(drm_fixp_mul(bv
, vddc
)));
1792 leakage_w
= drm_fixp_mul(drm_fixp_mul(drm_fixp_mul(i_leakage
, kt
), kv
), vddc
);
1794 *leakage
= drm_fixp2int(leakage_w
* 1000);
1797 static void si_calculate_leakage_for_v_and_t(struct radeon_device
*rdev
,
1798 const struct ni_leakage_coeffients
*coeff
,
1804 si_calculate_leakage_for_v_and_t_formula(coeff
, v
, t
, i_leakage
, leakage
);
1807 static void si_calculate_leakage_for_v_formula(const struct ni_leakage_coeffients
*coeff
,
1808 const u32 fixed_kt
, u16 v
,
1809 u32 ileakage
, u32
*leakage
)
1811 s64 kt
, kv
, leakage_w
, i_leakage
, vddc
;
1813 i_leakage
= div64_s64(drm_int2fixp(ileakage
), 100);
1814 vddc
= div64_s64(drm_int2fixp(v
), 1000);
1816 kt
= div64_s64(drm_int2fixp(fixed_kt
), 100000000);
1817 kv
= drm_fixp_mul(div64_s64(drm_int2fixp(coeff
->av
), 100000000),
1818 drm_fixp_exp(drm_fixp_mul(div64_s64(drm_int2fixp(coeff
->bv
), 100000000), vddc
)));
1820 leakage_w
= drm_fixp_mul(drm_fixp_mul(drm_fixp_mul(i_leakage
, kt
), kv
), vddc
);
1822 *leakage
= drm_fixp2int(leakage_w
* 1000);
1825 static void si_calculate_leakage_for_v(struct radeon_device
*rdev
,
1826 const struct ni_leakage_coeffients
*coeff
,
1832 si_calculate_leakage_for_v_formula(coeff
, fixed_kt
, v
, i_leakage
, leakage
);
1836 static void si_update_dte_from_pl2(struct radeon_device
*rdev
,
1837 struct si_dte_data
*dte_data
)
1839 u32 p_limit1
= rdev
->pm
.dpm
.tdp_limit
;
1840 u32 p_limit2
= rdev
->pm
.dpm
.near_tdp_limit
;
1841 u32 k
= dte_data
->k
;
1842 u32 t_max
= dte_data
->max_t
;
1843 u32 t_split
[5] = { 10, 15, 20, 25, 30 };
1844 u32 t_0
= dte_data
->t0
;
1847 if (p_limit2
!= 0 && p_limit2
<= p_limit1
) {
1848 dte_data
->tdep_count
= 3;
1850 for (i
= 0; i
< k
; i
++) {
1852 (t_split
[i
] * (t_max
- t_0
/(u32
)1000) * (1 << 14)) /
1853 (p_limit2
* (u32
)100);
1856 dte_data
->tdep_r
[1] = dte_data
->r
[4] * 2;
1858 for (i
= 2; i
< SMC_SISLANDS_DTE_MAX_TEMPERATURE_DEPENDENT_ARRAY_SIZE
; i
++) {
1859 dte_data
->tdep_r
[i
] = dte_data
->r
[4];
1862 DRM_ERROR("Invalid PL2! DTE will not be updated.\n");
1866 static void si_initialize_powertune_defaults(struct radeon_device
*rdev
)
1868 struct ni_power_info
*ni_pi
= ni_get_pi(rdev
);
1869 struct si_power_info
*si_pi
= si_get_pi(rdev
);
1870 bool update_dte_from_pl2
= false;
1872 if (rdev
->family
== CHIP_TAHITI
) {
1873 si_pi
->cac_weights
= cac_weights_tahiti
;
1874 si_pi
->lcac_config
= lcac_tahiti
;
1875 si_pi
->cac_override
= cac_override_tahiti
;
1876 si_pi
->powertune_data
= &powertune_data_tahiti
;
1877 si_pi
->dte_data
= dte_data_tahiti
;
1879 switch (rdev
->pdev
->device
) {
1881 si_pi
->dte_data
.enable_dte_by_default
= true;
1884 si_pi
->dte_data
= dte_data_new_zealand
;
1890 si_pi
->dte_data
= dte_data_aruba_pro
;
1891 update_dte_from_pl2
= true;
1894 si_pi
->dte_data
= dte_data_malta
;
1895 update_dte_from_pl2
= true;
1898 si_pi
->dte_data
= dte_data_tahiti_pro
;
1899 update_dte_from_pl2
= true;
1902 if (si_pi
->dte_data
.enable_dte_by_default
== true)
1903 DRM_ERROR("DTE is not enabled!\n");
1906 } else if (rdev
->family
== CHIP_PITCAIRN
) {
1907 switch (rdev
->pdev
->device
) {
1910 si_pi
->cac_weights
= cac_weights_pitcairn
;
1911 si_pi
->lcac_config
= lcac_pitcairn
;
1912 si_pi
->cac_override
= cac_override_pitcairn
;
1913 si_pi
->powertune_data
= &powertune_data_pitcairn
;
1914 si_pi
->dte_data
= dte_data_curacao_xt
;
1915 update_dte_from_pl2
= true;
1919 si_pi
->cac_weights
= cac_weights_pitcairn
;
1920 si_pi
->lcac_config
= lcac_pitcairn
;
1921 si_pi
->cac_override
= cac_override_pitcairn
;
1922 si_pi
->powertune_data
= &powertune_data_pitcairn
;
1923 si_pi
->dte_data
= dte_data_curacao_pro
;
1924 update_dte_from_pl2
= true;
1928 si_pi
->cac_weights
= cac_weights_pitcairn
;
1929 si_pi
->lcac_config
= lcac_pitcairn
;
1930 si_pi
->cac_override
= cac_override_pitcairn
;
1931 si_pi
->powertune_data
= &powertune_data_pitcairn
;
1932 si_pi
->dte_data
= dte_data_neptune_xt
;
1933 update_dte_from_pl2
= true;
1936 si_pi
->cac_weights
= cac_weights_pitcairn
;
1937 si_pi
->lcac_config
= lcac_pitcairn
;
1938 si_pi
->cac_override
= cac_override_pitcairn
;
1939 si_pi
->powertune_data
= &powertune_data_pitcairn
;
1940 si_pi
->dte_data
= dte_data_pitcairn
;
1943 } else if (rdev
->family
== CHIP_VERDE
) {
1944 si_pi
->lcac_config
= lcac_cape_verde
;
1945 si_pi
->cac_override
= cac_override_cape_verde
;
1946 si_pi
->powertune_data
= &powertune_data_cape_verde
;
1948 switch (rdev
->pdev
->device
) {
1953 si_pi
->cac_weights
= cac_weights_cape_verde_pro
;
1954 si_pi
->dte_data
= dte_data_cape_verde
;
1957 si_pi
->cac_weights
= cac_weights_cape_verde_pro
;
1958 si_pi
->dte_data
= dte_data_sun_xt
;
1962 si_pi
->cac_weights
= cac_weights_heathrow
;
1963 si_pi
->dte_data
= dte_data_cape_verde
;
1967 si_pi
->cac_weights
= cac_weights_chelsea_xt
;
1968 si_pi
->dte_data
= dte_data_cape_verde
;
1971 si_pi
->cac_weights
= cac_weights_chelsea_pro
;
1972 si_pi
->dte_data
= dte_data_cape_verde
;
1975 si_pi
->cac_weights
= cac_weights_heathrow
;
1976 si_pi
->dte_data
= dte_data_venus_xtx
;
1979 si_pi
->cac_weights
= cac_weights_heathrow
;
1980 si_pi
->dte_data
= dte_data_venus_xt
;
1986 si_pi
->cac_weights
= cac_weights_chelsea_pro
;
1987 si_pi
->dte_data
= dte_data_venus_pro
;
1990 si_pi
->cac_weights
= cac_weights_cape_verde
;
1991 si_pi
->dte_data
= dte_data_cape_verde
;
1994 } else if (rdev
->family
== CHIP_OLAND
) {
1995 switch (rdev
->pdev
->device
) {
2000 si_pi
->cac_weights
= cac_weights_mars_pro
;
2001 si_pi
->lcac_config
= lcac_mars_pro
;
2002 si_pi
->cac_override
= cac_override_oland
;
2003 si_pi
->powertune_data
= &powertune_data_mars_pro
;
2004 si_pi
->dte_data
= dte_data_mars_pro
;
2005 update_dte_from_pl2
= true;
2011 si_pi
->cac_weights
= cac_weights_mars_xt
;
2012 si_pi
->lcac_config
= lcac_mars_pro
;
2013 si_pi
->cac_override
= cac_override_oland
;
2014 si_pi
->powertune_data
= &powertune_data_mars_pro
;
2015 si_pi
->dte_data
= dte_data_mars_pro
;
2016 update_dte_from_pl2
= true;
2021 si_pi
->cac_weights
= cac_weights_oland_pro
;
2022 si_pi
->lcac_config
= lcac_mars_pro
;
2023 si_pi
->cac_override
= cac_override_oland
;
2024 si_pi
->powertune_data
= &powertune_data_mars_pro
;
2025 si_pi
->dte_data
= dte_data_mars_pro
;
2026 update_dte_from_pl2
= true;
2029 si_pi
->cac_weights
= cac_weights_oland_xt
;
2030 si_pi
->lcac_config
= lcac_mars_pro
;
2031 si_pi
->cac_override
= cac_override_oland
;
2032 si_pi
->powertune_data
= &powertune_data_mars_pro
;
2033 si_pi
->dte_data
= dte_data_mars_pro
;
2034 update_dte_from_pl2
= true;
2037 si_pi
->cac_weights
= cac_weights_oland
;
2038 si_pi
->lcac_config
= lcac_oland
;
2039 si_pi
->cac_override
= cac_override_oland
;
2040 si_pi
->powertune_data
= &powertune_data_oland
;
2041 si_pi
->dte_data
= dte_data_oland
;
2044 } else if (rdev
->family
== CHIP_HAINAN
) {
2045 si_pi
->cac_weights
= cac_weights_hainan
;
2046 si_pi
->lcac_config
= lcac_oland
;
2047 si_pi
->cac_override
= cac_override_oland
;
2048 si_pi
->powertune_data
= &powertune_data_hainan
;
2049 si_pi
->dte_data
= dte_data_sun_xt
;
2050 update_dte_from_pl2
= true;
2052 DRM_ERROR("Unknown SI asic revision, failed to initialize PowerTune!\n");
2056 ni_pi
->enable_power_containment
= false;
2057 ni_pi
->enable_cac
= false;
2058 ni_pi
->enable_sq_ramping
= false;
2059 si_pi
->enable_dte
= false;
2061 if (si_pi
->powertune_data
->enable_powertune_by_default
) {
2062 ni_pi
->enable_power_containment
= true;
2063 ni_pi
->enable_cac
= true;
2064 if (si_pi
->dte_data
.enable_dte_by_default
) {
2065 si_pi
->enable_dte
= true;
2066 if (update_dte_from_pl2
)
2067 si_update_dte_from_pl2(rdev
, &si_pi
->dte_data
);
2070 ni_pi
->enable_sq_ramping
= true;
2073 ni_pi
->driver_calculate_cac_leakage
= true;
2074 ni_pi
->cac_configuration_required
= true;
2076 if (ni_pi
->cac_configuration_required
) {
2077 ni_pi
->support_cac_long_term_average
= true;
2078 si_pi
->dyn_powertune_data
.l2_lta_window_size
=
2079 si_pi
->powertune_data
->l2_lta_window_size_default
;
2080 si_pi
->dyn_powertune_data
.lts_truncate
=
2081 si_pi
->powertune_data
->lts_truncate_default
;
2083 ni_pi
->support_cac_long_term_average
= false;
2084 si_pi
->dyn_powertune_data
.l2_lta_window_size
= 0;
2085 si_pi
->dyn_powertune_data
.lts_truncate
= 0;
2088 si_pi
->dyn_powertune_data
.disable_uvd_powertune
= false;
2091 static u32
si_get_smc_power_scaling_factor(struct radeon_device
*rdev
)
2096 static u32
si_calculate_cac_wintime(struct radeon_device
*rdev
)
2101 u32 cac_window_size
;
2103 xclk
= radeon_get_xclk(rdev
);
2108 cac_window
= RREG32(CG_CAC_CTRL
) & CAC_WINDOW_MASK
;
2109 cac_window_size
= ((cac_window
& 0xFFFF0000) >> 16) * (cac_window
& 0x0000FFFF);
2111 wintime
= (cac_window_size
* 100) / xclk
;
2116 static u32
si_scale_power_for_smc(u32 power_in_watts
, u32 scaling_factor
)
2118 return power_in_watts
;
2121 static int si_calculate_adjusted_tdp_limits(struct radeon_device
*rdev
,
2122 bool adjust_polarity
,
2125 u32
*near_tdp_limit
)
2127 u32 adjustment_delta
, max_tdp_limit
;
2129 if (tdp_adjustment
> (u32
)rdev
->pm
.dpm
.tdp_od_limit
)
2132 max_tdp_limit
= ((100 + 100) * rdev
->pm
.dpm
.tdp_limit
) / 100;
2134 if (adjust_polarity
) {
2135 *tdp_limit
= ((100 + tdp_adjustment
) * rdev
->pm
.dpm
.tdp_limit
) / 100;
2136 *near_tdp_limit
= rdev
->pm
.dpm
.near_tdp_limit_adjusted
+ (*tdp_limit
- rdev
->pm
.dpm
.tdp_limit
);
2138 *tdp_limit
= ((100 - tdp_adjustment
) * rdev
->pm
.dpm
.tdp_limit
) / 100;
2139 adjustment_delta
= rdev
->pm
.dpm
.tdp_limit
- *tdp_limit
;
2140 if (adjustment_delta
< rdev
->pm
.dpm
.near_tdp_limit_adjusted
)
2141 *near_tdp_limit
= rdev
->pm
.dpm
.near_tdp_limit_adjusted
- adjustment_delta
;
2143 *near_tdp_limit
= 0;
2146 if ((*tdp_limit
<= 0) || (*tdp_limit
> max_tdp_limit
))
2148 if ((*near_tdp_limit
<= 0) || (*near_tdp_limit
> *tdp_limit
))
2154 static int si_populate_smc_tdp_limits(struct radeon_device
*rdev
,
2155 struct radeon_ps
*radeon_state
)
2157 struct ni_power_info
*ni_pi
= ni_get_pi(rdev
);
2158 struct si_power_info
*si_pi
= si_get_pi(rdev
);
2160 if (ni_pi
->enable_power_containment
) {
2161 SISLANDS_SMC_STATETABLE
*smc_table
= &si_pi
->smc_statetable
;
2162 PP_SIslands_PAPMParameters
*papm_parm
;
2163 struct radeon_ppm_table
*ppm
= rdev
->pm
.dpm
.dyn_state
.ppm_table
;
2164 u32 scaling_factor
= si_get_smc_power_scaling_factor(rdev
);
2169 if (scaling_factor
== 0)
2172 memset(smc_table
, 0, sizeof(SISLANDS_SMC_STATETABLE
));
2174 ret
= si_calculate_adjusted_tdp_limits(rdev
,
2176 rdev
->pm
.dpm
.tdp_adjustment
,
2182 smc_table
->dpm2Params
.TDPLimit
=
2183 cpu_to_be32(si_scale_power_for_smc(tdp_limit
, scaling_factor
) * 1000);
2184 smc_table
->dpm2Params
.NearTDPLimit
=
2185 cpu_to_be32(si_scale_power_for_smc(near_tdp_limit
, scaling_factor
) * 1000);
2186 smc_table
->dpm2Params
.SafePowerLimit
=
2187 cpu_to_be32(si_scale_power_for_smc((near_tdp_limit
* SISLANDS_DPM2_TDP_SAFE_LIMIT_PERCENT
) / 100, scaling_factor
) * 1000);
2189 ret
= si_copy_bytes_to_smc(rdev
,
2190 (si_pi
->state_table_start
+ offsetof(SISLANDS_SMC_STATETABLE
, dpm2Params
) +
2191 offsetof(PP_SIslands_DPM2Parameters
, TDPLimit
)),
2192 (u8
*)(&(smc_table
->dpm2Params
.TDPLimit
)),
2198 if (si_pi
->enable_ppm
) {
2199 papm_parm
= &si_pi
->papm_parm
;
2200 memset(papm_parm
, 0, sizeof(PP_SIslands_PAPMParameters
));
2201 papm_parm
->NearTDPLimitTherm
= cpu_to_be32(ppm
->dgpu_tdp
);
2202 papm_parm
->dGPU_T_Limit
= cpu_to_be32(ppm
->tj_max
);
2203 papm_parm
->dGPU_T_Warning
= cpu_to_be32(95);
2204 papm_parm
->dGPU_T_Hysteresis
= cpu_to_be32(5);
2205 papm_parm
->PlatformPowerLimit
= 0xffffffff;
2206 papm_parm
->NearTDPLimitPAPM
= 0xffffffff;
2208 ret
= si_copy_bytes_to_smc(rdev
, si_pi
->papm_cfg_table_start
,
2210 sizeof(PP_SIslands_PAPMParameters
),
2219 static int si_populate_smc_tdp_limits_2(struct radeon_device
*rdev
,
2220 struct radeon_ps
*radeon_state
)
2222 struct ni_power_info
*ni_pi
= ni_get_pi(rdev
);
2223 struct si_power_info
*si_pi
= si_get_pi(rdev
);
2225 if (ni_pi
->enable_power_containment
) {
2226 SISLANDS_SMC_STATETABLE
*smc_table
= &si_pi
->smc_statetable
;
2227 u32 scaling_factor
= si_get_smc_power_scaling_factor(rdev
);
2230 memset(smc_table
, 0, sizeof(SISLANDS_SMC_STATETABLE
));
2232 smc_table
->dpm2Params
.NearTDPLimit
=
2233 cpu_to_be32(si_scale_power_for_smc(rdev
->pm
.dpm
.near_tdp_limit_adjusted
, scaling_factor
) * 1000);
2234 smc_table
->dpm2Params
.SafePowerLimit
=
2235 cpu_to_be32(si_scale_power_for_smc((rdev
->pm
.dpm
.near_tdp_limit_adjusted
* SISLANDS_DPM2_TDP_SAFE_LIMIT_PERCENT
) / 100, scaling_factor
) * 1000);
2237 ret
= si_copy_bytes_to_smc(rdev
,
2238 (si_pi
->state_table_start
+
2239 offsetof(SISLANDS_SMC_STATETABLE
, dpm2Params
) +
2240 offsetof(PP_SIslands_DPM2Parameters
, NearTDPLimit
)),
2241 (u8
*)(&(smc_table
->dpm2Params
.NearTDPLimit
)),
2251 static u16
si_calculate_power_efficiency_ratio(struct radeon_device
*rdev
,
2252 const u16 prev_std_vddc
,
2253 const u16 curr_std_vddc
)
2255 u64 margin
= (u64
)SISLANDS_DPM2_PWREFFICIENCYRATIO_MARGIN
;
2256 u64 prev_vddc
= (u64
)prev_std_vddc
;
2257 u64 curr_vddc
= (u64
)curr_std_vddc
;
2258 u64 pwr_efficiency_ratio
, n
, d
;
2260 if ((prev_vddc
== 0) || (curr_vddc
== 0))
2263 n
= div64_u64((u64
)1024 * curr_vddc
* curr_vddc
* ((u64
)1000 + margin
), (u64
)1000);
2264 d
= prev_vddc
* prev_vddc
;
2265 pwr_efficiency_ratio
= div64_u64(n
, d
);
2267 if (pwr_efficiency_ratio
> (u64
)0xFFFF)
2270 return (u16
)pwr_efficiency_ratio
;
2273 static bool si_should_disable_uvd_powertune(struct radeon_device
*rdev
,
2274 struct radeon_ps
*radeon_state
)
2276 struct si_power_info
*si_pi
= si_get_pi(rdev
);
2278 if (si_pi
->dyn_powertune_data
.disable_uvd_powertune
&&
2279 radeon_state
->vclk
&& radeon_state
->dclk
)
2285 static int si_populate_power_containment_values(struct radeon_device
*rdev
,
2286 struct radeon_ps
*radeon_state
,
2287 SISLANDS_SMC_SWSTATE
*smc_state
)
2289 struct evergreen_power_info
*eg_pi
= evergreen_get_pi(rdev
);
2290 struct ni_power_info
*ni_pi
= ni_get_pi(rdev
);
2291 struct ni_ps
*state
= ni_get_ps(radeon_state
);
2292 SISLANDS_SMC_VOLTAGE_VALUE vddc
;
2299 u16 pwr_efficiency_ratio
;
2301 bool disable_uvd_power_tune
;
2304 if (ni_pi
->enable_power_containment
== false)
2307 if (state
->performance_level_count
== 0)
2310 if (smc_state
->levelCount
!= state
->performance_level_count
)
2313 disable_uvd_power_tune
= si_should_disable_uvd_powertune(rdev
, radeon_state
);
2315 smc_state
->levels
[0].dpm2
.MaxPS
= 0;
2316 smc_state
->levels
[0].dpm2
.NearTDPDec
= 0;
2317 smc_state
->levels
[0].dpm2
.AboveSafeInc
= 0;
2318 smc_state
->levels
[0].dpm2
.BelowSafeInc
= 0;
2319 smc_state
->levels
[0].dpm2
.PwrEfficiencyRatio
= 0;
2321 for (i
= 1; i
< state
->performance_level_count
; i
++) {
2322 prev_sclk
= state
->performance_levels
[i
-1].sclk
;
2323 max_sclk
= state
->performance_levels
[i
].sclk
;
2325 max_ps_percent
= SISLANDS_DPM2_MAXPS_PERCENT_M
;
2327 max_ps_percent
= SISLANDS_DPM2_MAXPS_PERCENT_H
;
2329 if (prev_sclk
> max_sclk
)
2332 if ((max_ps_percent
== 0) ||
2333 (prev_sclk
== max_sclk
) ||
2334 disable_uvd_power_tune
) {
2335 min_sclk
= max_sclk
;
2336 } else if (i
== 1) {
2337 min_sclk
= prev_sclk
;
2339 min_sclk
= (prev_sclk
* (u32
)max_ps_percent
) / 100;
2342 if (min_sclk
< state
->performance_levels
[0].sclk
)
2343 min_sclk
= state
->performance_levels
[0].sclk
;
2348 ret
= si_populate_voltage_value(rdev
, &eg_pi
->vddc_voltage_table
,
2349 state
->performance_levels
[i
-1].vddc
, &vddc
);
2353 ret
= si_get_std_voltage_value(rdev
, &vddc
, &prev_std_vddc
);
2357 ret
= si_populate_voltage_value(rdev
, &eg_pi
->vddc_voltage_table
,
2358 state
->performance_levels
[i
].vddc
, &vddc
);
2362 ret
= si_get_std_voltage_value(rdev
, &vddc
, &curr_std_vddc
);
2366 pwr_efficiency_ratio
= si_calculate_power_efficiency_ratio(rdev
,
2367 prev_std_vddc
, curr_std_vddc
);
2369 smc_state
->levels
[i
].dpm2
.MaxPS
= (u8
)((SISLANDS_DPM2_MAX_PULSE_SKIP
* (max_sclk
- min_sclk
)) / max_sclk
);
2370 smc_state
->levels
[i
].dpm2
.NearTDPDec
= SISLANDS_DPM2_NEAR_TDP_DEC
;
2371 smc_state
->levels
[i
].dpm2
.AboveSafeInc
= SISLANDS_DPM2_ABOVE_SAFE_INC
;
2372 smc_state
->levels
[i
].dpm2
.BelowSafeInc
= SISLANDS_DPM2_BELOW_SAFE_INC
;
2373 smc_state
->levels
[i
].dpm2
.PwrEfficiencyRatio
= cpu_to_be16(pwr_efficiency_ratio
);
2379 static int si_populate_sq_ramping_values(struct radeon_device
*rdev
,
2380 struct radeon_ps
*radeon_state
,
2381 SISLANDS_SMC_SWSTATE
*smc_state
)
2383 struct ni_power_info
*ni_pi
= ni_get_pi(rdev
);
2384 struct ni_ps
*state
= ni_get_ps(radeon_state
);
2385 u32 sq_power_throttle
, sq_power_throttle2
;
2386 bool enable_sq_ramping
= ni_pi
->enable_sq_ramping
;
2389 if (state
->performance_level_count
== 0)
2392 if (smc_state
->levelCount
!= state
->performance_level_count
)
2395 if (rdev
->pm
.dpm
.sq_ramping_threshold
== 0)
2398 if (SISLANDS_DPM2_SQ_RAMP_MAX_POWER
> (MAX_POWER_MASK
>> MAX_POWER_SHIFT
))
2399 enable_sq_ramping
= false;
2401 if (SISLANDS_DPM2_SQ_RAMP_MIN_POWER
> (MIN_POWER_MASK
>> MIN_POWER_SHIFT
))
2402 enable_sq_ramping
= false;
2404 if (SISLANDS_DPM2_SQ_RAMP_MAX_POWER_DELTA
> (MAX_POWER_DELTA_MASK
>> MAX_POWER_DELTA_SHIFT
))
2405 enable_sq_ramping
= false;
2407 if (SISLANDS_DPM2_SQ_RAMP_STI_SIZE
> (STI_SIZE_MASK
>> STI_SIZE_SHIFT
))
2408 enable_sq_ramping
= false;
2410 if (SISLANDS_DPM2_SQ_RAMP_LTI_RATIO
> (LTI_RATIO_MASK
>> LTI_RATIO_SHIFT
))
2411 enable_sq_ramping
= false;
2413 for (i
= 0; i
< state
->performance_level_count
; i
++) {
2414 sq_power_throttle
= 0;
2415 sq_power_throttle2
= 0;
2417 if ((state
->performance_levels
[i
].sclk
>= rdev
->pm
.dpm
.sq_ramping_threshold
) &&
2418 enable_sq_ramping
) {
2419 sq_power_throttle
|= MAX_POWER(SISLANDS_DPM2_SQ_RAMP_MAX_POWER
);
2420 sq_power_throttle
|= MIN_POWER(SISLANDS_DPM2_SQ_RAMP_MIN_POWER
);
2421 sq_power_throttle2
|= MAX_POWER_DELTA(SISLANDS_DPM2_SQ_RAMP_MAX_POWER_DELTA
);
2422 sq_power_throttle2
|= STI_SIZE(SISLANDS_DPM2_SQ_RAMP_STI_SIZE
);
2423 sq_power_throttle2
|= LTI_RATIO(SISLANDS_DPM2_SQ_RAMP_LTI_RATIO
);
2425 sq_power_throttle
|= MAX_POWER_MASK
| MIN_POWER_MASK
;
2426 sq_power_throttle2
|= MAX_POWER_DELTA_MASK
| STI_SIZE_MASK
| LTI_RATIO_MASK
;
2429 smc_state
->levels
[i
].SQPowerThrottle
= cpu_to_be32(sq_power_throttle
);
2430 smc_state
->levels
[i
].SQPowerThrottle_2
= cpu_to_be32(sq_power_throttle2
);
2436 static int si_enable_power_containment(struct radeon_device
*rdev
,
2437 struct radeon_ps
*radeon_new_state
,
2440 struct ni_power_info
*ni_pi
= ni_get_pi(rdev
);
2441 PPSMC_Result smc_result
;
2444 if (ni_pi
->enable_power_containment
) {
2446 if (!si_should_disable_uvd_powertune(rdev
, radeon_new_state
)) {
2447 smc_result
= si_send_msg_to_smc(rdev
, PPSMC_TDPClampingActive
);
2448 if (smc_result
!= PPSMC_Result_OK
) {
2450 ni_pi
->pc_enabled
= false;
2452 ni_pi
->pc_enabled
= true;
2456 smc_result
= si_send_msg_to_smc(rdev
, PPSMC_TDPClampingInactive
);
2457 if (smc_result
!= PPSMC_Result_OK
)
2459 ni_pi
->pc_enabled
= false;
2466 static int si_initialize_smc_dte_tables(struct radeon_device
*rdev
)
2468 struct si_power_info
*si_pi
= si_get_pi(rdev
);
2470 struct si_dte_data
*dte_data
= &si_pi
->dte_data
;
2471 Smc_SIslands_DTE_Configuration
*dte_tables
= NULL
;
2476 if (dte_data
== NULL
)
2477 si_pi
->enable_dte
= false;
2479 if (si_pi
->enable_dte
== false)
2482 if (dte_data
->k
<= 0)
2485 dte_tables
= kzalloc(sizeof(Smc_SIslands_DTE_Configuration
), GFP_KERNEL
);
2486 if (dte_tables
== NULL
) {
2487 si_pi
->enable_dte
= false;
2491 table_size
= dte_data
->k
;
2493 if (table_size
> SMC_SISLANDS_DTE_MAX_FILTER_STAGES
)
2494 table_size
= SMC_SISLANDS_DTE_MAX_FILTER_STAGES
;
2496 tdep_count
= dte_data
->tdep_count
;
2497 if (tdep_count
> SMC_SISLANDS_DTE_MAX_TEMPERATURE_DEPENDENT_ARRAY_SIZE
)
2498 tdep_count
= SMC_SISLANDS_DTE_MAX_TEMPERATURE_DEPENDENT_ARRAY_SIZE
;
2500 dte_tables
->K
= cpu_to_be32(table_size
);
2501 dte_tables
->T0
= cpu_to_be32(dte_data
->t0
);
2502 dte_tables
->MaxT
= cpu_to_be32(dte_data
->max_t
);
2503 dte_tables
->WindowSize
= dte_data
->window_size
;
2504 dte_tables
->temp_select
= dte_data
->temp_select
;
2505 dte_tables
->DTE_mode
= dte_data
->dte_mode
;
2506 dte_tables
->Tthreshold
= cpu_to_be32(dte_data
->t_threshold
);
2511 for (i
= 0; i
< table_size
; i
++) {
2512 dte_tables
->tau
[i
] = cpu_to_be32(dte_data
->tau
[i
]);
2513 dte_tables
->R
[i
] = cpu_to_be32(dte_data
->r
[i
]);
2516 dte_tables
->Tdep_count
= tdep_count
;
2518 for (i
= 0; i
< (u32
)tdep_count
; i
++) {
2519 dte_tables
->T_limits
[i
] = dte_data
->t_limits
[i
];
2520 dte_tables
->Tdep_tau
[i
] = cpu_to_be32(dte_data
->tdep_tau
[i
]);
2521 dte_tables
->Tdep_R
[i
] = cpu_to_be32(dte_data
->tdep_r
[i
]);
2524 ret
= si_copy_bytes_to_smc(rdev
, si_pi
->dte_table_start
, (u8
*)dte_tables
,
2525 sizeof(Smc_SIslands_DTE_Configuration
), si_pi
->sram_end
);
2531 static int si_get_cac_std_voltage_max_min(struct radeon_device
*rdev
,
2534 struct si_power_info
*si_pi
= si_get_pi(rdev
);
2535 struct radeon_cac_leakage_table
*table
=
2536 &rdev
->pm
.dpm
.dyn_state
.cac_leakage_table
;
2547 for (i
= 0; i
< table
->count
; i
++) {
2548 if (table
->entries
[i
].vddc
> *max
)
2549 *max
= table
->entries
[i
].vddc
;
2550 if (table
->entries
[i
].vddc
< *min
)
2551 *min
= table
->entries
[i
].vddc
;
2554 if (si_pi
->powertune_data
->lkge_lut_v0_percent
> 100)
2557 v0_loadline
= (*min
) * (100 - si_pi
->powertune_data
->lkge_lut_v0_percent
) / 100;
2559 if (v0_loadline
> 0xFFFFUL
)
2562 *min
= (u16
)v0_loadline
;
2564 if ((*min
> *max
) || (*max
== 0) || (*min
== 0))
2570 static u16
si_get_cac_std_voltage_step(u16 max
, u16 min
)
2572 return ((max
- min
) + (SMC_SISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES
- 1)) /
2573 SMC_SISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES
;
2576 static int si_init_dte_leakage_table(struct radeon_device
*rdev
,
2577 PP_SIslands_CacConfig
*cac_tables
,
2578 u16 vddc_max
, u16 vddc_min
, u16 vddc_step
,
2581 struct si_power_info
*si_pi
= si_get_pi(rdev
);
2589 scaling_factor
= si_get_smc_power_scaling_factor(rdev
);
2591 for (i
= 0; i
< SMC_SISLANDS_LKGE_LUT_NUM_OF_TEMP_ENTRIES
; i
++) {
2592 t
= (1000 * (i
* t_step
+ t0
));
2594 for (j
= 0; j
< SMC_SISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES
; j
++) {
2595 voltage
= vddc_max
- (vddc_step
* j
);
2597 si_calculate_leakage_for_v_and_t(rdev
,
2598 &si_pi
->powertune_data
->leakage_coefficients
,
2601 si_pi
->dyn_powertune_data
.cac_leakage
,
2604 smc_leakage
= si_scale_power_for_smc(leakage
, scaling_factor
) / 4;
2606 if (smc_leakage
> 0xFFFF)
2607 smc_leakage
= 0xFFFF;
2609 cac_tables
->cac_lkge_lut
[i
][SMC_SISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES
-1-j
] =
2610 cpu_to_be16((u16
)smc_leakage
);
2616 static int si_init_simplified_leakage_table(struct radeon_device
*rdev
,
2617 PP_SIslands_CacConfig
*cac_tables
,
2618 u16 vddc_max
, u16 vddc_min
, u16 vddc_step
)
2620 struct si_power_info
*si_pi
= si_get_pi(rdev
);
2627 scaling_factor
= si_get_smc_power_scaling_factor(rdev
);
2629 for (j
= 0; j
< SMC_SISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES
; j
++) {
2630 voltage
= vddc_max
- (vddc_step
* j
);
2632 si_calculate_leakage_for_v(rdev
,
2633 &si_pi
->powertune_data
->leakage_coefficients
,
2634 si_pi
->powertune_data
->fixed_kt
,
2636 si_pi
->dyn_powertune_data
.cac_leakage
,
2639 smc_leakage
= si_scale_power_for_smc(leakage
, scaling_factor
) / 4;
2641 if (smc_leakage
> 0xFFFF)
2642 smc_leakage
= 0xFFFF;
2644 for (i
= 0; i
< SMC_SISLANDS_LKGE_LUT_NUM_OF_TEMP_ENTRIES
; i
++)
2645 cac_tables
->cac_lkge_lut
[i
][SMC_SISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES
-1-j
] =
2646 cpu_to_be16((u16
)smc_leakage
);
2651 static int si_initialize_smc_cac_tables(struct radeon_device
*rdev
)
2653 struct ni_power_info
*ni_pi
= ni_get_pi(rdev
);
2654 struct si_power_info
*si_pi
= si_get_pi(rdev
);
2655 PP_SIslands_CacConfig
*cac_tables
= NULL
;
2656 u16 vddc_max
, vddc_min
, vddc_step
;
2658 u32 load_line_slope
, reg
;
2660 u32 ticks_per_us
= radeon_get_xclk(rdev
) / 100;
2662 if (ni_pi
->enable_cac
== false)
2665 cac_tables
= kzalloc(sizeof(PP_SIslands_CacConfig
), GFP_KERNEL
);
2669 reg
= RREG32(CG_CAC_CTRL
) & ~CAC_WINDOW_MASK
;
2670 reg
|= CAC_WINDOW(si_pi
->powertune_data
->cac_window
);
2671 WREG32(CG_CAC_CTRL
, reg
);
2673 si_pi
->dyn_powertune_data
.cac_leakage
= rdev
->pm
.dpm
.cac_leakage
;
2674 si_pi
->dyn_powertune_data
.dc_pwr_value
=
2675 si_pi
->powertune_data
->dc_cac
[NISLANDS_DCCAC_LEVEL_0
];
2676 si_pi
->dyn_powertune_data
.wintime
= si_calculate_cac_wintime(rdev
);
2677 si_pi
->dyn_powertune_data
.shift_n
= si_pi
->powertune_data
->shift_n_default
;
2679 si_pi
->dyn_powertune_data
.leakage_minimum_temperature
= 80 * 1000;
2681 ret
= si_get_cac_std_voltage_max_min(rdev
, &vddc_max
, &vddc_min
);
2685 vddc_step
= si_get_cac_std_voltage_step(vddc_max
, vddc_min
);
2686 vddc_min
= vddc_max
- (vddc_step
* (SMC_SISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES
- 1));
2690 if (si_pi
->enable_dte
|| ni_pi
->driver_calculate_cac_leakage
)
2691 ret
= si_init_dte_leakage_table(rdev
, cac_tables
,
2692 vddc_max
, vddc_min
, vddc_step
,
2695 ret
= si_init_simplified_leakage_table(rdev
, cac_tables
,
2696 vddc_max
, vddc_min
, vddc_step
);
2700 load_line_slope
= ((u32
)rdev
->pm
.dpm
.load_line_slope
<< SMC_SISLANDS_SCALE_R
) / 100;
2702 cac_tables
->l2numWin_TDP
= cpu_to_be32(si_pi
->dyn_powertune_data
.l2_lta_window_size
);
2703 cac_tables
->lts_truncate_n
= si_pi
->dyn_powertune_data
.lts_truncate
;
2704 cac_tables
->SHIFT_N
= si_pi
->dyn_powertune_data
.shift_n
;
2705 cac_tables
->lkge_lut_V0
= cpu_to_be32((u32
)vddc_min
);
2706 cac_tables
->lkge_lut_Vstep
= cpu_to_be32((u32
)vddc_step
);
2707 cac_tables
->R_LL
= cpu_to_be32(load_line_slope
);
2708 cac_tables
->WinTime
= cpu_to_be32(si_pi
->dyn_powertune_data
.wintime
);
2709 cac_tables
->calculation_repeats
= cpu_to_be32(2);
2710 cac_tables
->dc_cac
= cpu_to_be32(0);
2711 cac_tables
->log2_PG_LKG_SCALE
= 12;
2712 cac_tables
->cac_temp
= si_pi
->powertune_data
->operating_temp
;
2713 cac_tables
->lkge_lut_T0
= cpu_to_be32((u32
)t0
);
2714 cac_tables
->lkge_lut_Tstep
= cpu_to_be32((u32
)t_step
);
2716 ret
= si_copy_bytes_to_smc(rdev
, si_pi
->cac_table_start
, (u8
*)cac_tables
,
2717 sizeof(PP_SIslands_CacConfig
), si_pi
->sram_end
);
2722 ret
= si_write_smc_soft_register(rdev
, SI_SMC_SOFT_REGISTER_ticks_per_us
, ticks_per_us
);
2726 ni_pi
->enable_cac
= false;
2727 ni_pi
->enable_power_containment
= false;
2735 static int si_program_cac_config_registers(struct radeon_device
*rdev
,
2736 const struct si_cac_config_reg
*cac_config_regs
)
2738 const struct si_cac_config_reg
*config_regs
= cac_config_regs
;
2739 u32 data
= 0, offset
;
2744 while (config_regs
->offset
!= 0xFFFFFFFF) {
2745 switch (config_regs
->type
) {
2746 case SISLANDS_CACCONFIG_CGIND
:
2747 offset
= SMC_CG_IND_START
+ config_regs
->offset
;
2748 if (offset
< SMC_CG_IND_END
)
2749 data
= RREG32_SMC(offset
);
2752 data
= RREG32(config_regs
->offset
<< 2);
2756 data
&= ~config_regs
->mask
;
2757 data
|= ((config_regs
->value
<< config_regs
->shift
) & config_regs
->mask
);
2759 switch (config_regs
->type
) {
2760 case SISLANDS_CACCONFIG_CGIND
:
2761 offset
= SMC_CG_IND_START
+ config_regs
->offset
;
2762 if (offset
< SMC_CG_IND_END
)
2763 WREG32_SMC(offset
, data
);
2766 WREG32(config_regs
->offset
<< 2, data
);
2774 static int si_initialize_hardware_cac_manager(struct radeon_device
*rdev
)
2776 struct ni_power_info
*ni_pi
= ni_get_pi(rdev
);
2777 struct si_power_info
*si_pi
= si_get_pi(rdev
);
2780 if ((ni_pi
->enable_cac
== false) ||
2781 (ni_pi
->cac_configuration_required
== false))
2784 ret
= si_program_cac_config_registers(rdev
, si_pi
->lcac_config
);
2787 ret
= si_program_cac_config_registers(rdev
, si_pi
->cac_override
);
2790 ret
= si_program_cac_config_registers(rdev
, si_pi
->cac_weights
);
2797 static int si_enable_smc_cac(struct radeon_device
*rdev
,
2798 struct radeon_ps
*radeon_new_state
,
2801 struct ni_power_info
*ni_pi
= ni_get_pi(rdev
);
2802 struct si_power_info
*si_pi
= si_get_pi(rdev
);
2803 PPSMC_Result smc_result
;
2806 if (ni_pi
->enable_cac
) {
2808 if (!si_should_disable_uvd_powertune(rdev
, radeon_new_state
)) {
2809 if (ni_pi
->support_cac_long_term_average
) {
2810 smc_result
= si_send_msg_to_smc(rdev
, PPSMC_CACLongTermAvgEnable
);
2811 if (smc_result
!= PPSMC_Result_OK
)
2812 ni_pi
->support_cac_long_term_average
= false;
2815 smc_result
= si_send_msg_to_smc(rdev
, PPSMC_MSG_EnableCac
);
2816 if (smc_result
!= PPSMC_Result_OK
) {
2818 ni_pi
->cac_enabled
= false;
2820 ni_pi
->cac_enabled
= true;
2823 if (si_pi
->enable_dte
) {
2824 smc_result
= si_send_msg_to_smc(rdev
, PPSMC_MSG_EnableDTE
);
2825 if (smc_result
!= PPSMC_Result_OK
)
2829 } else if (ni_pi
->cac_enabled
) {
2830 if (si_pi
->enable_dte
)
2831 smc_result
= si_send_msg_to_smc(rdev
, PPSMC_MSG_DisableDTE
);
2833 smc_result
= si_send_msg_to_smc(rdev
, PPSMC_MSG_DisableCac
);
2835 ni_pi
->cac_enabled
= false;
2837 if (ni_pi
->support_cac_long_term_average
)
2838 smc_result
= si_send_msg_to_smc(rdev
, PPSMC_CACLongTermAvgDisable
);
2844 static int si_init_smc_spll_table(struct radeon_device
*rdev
)
2846 struct ni_power_info
*ni_pi
= ni_get_pi(rdev
);
2847 struct si_power_info
*si_pi
= si_get_pi(rdev
);
2848 SMC_SISLANDS_SPLL_DIV_TABLE
*spll_table
;
2849 SISLANDS_SMC_SCLK_VALUE sclk_params
;
2857 if (si_pi
->spll_table_start
== 0)
2860 spll_table
= kzalloc(sizeof(SMC_SISLANDS_SPLL_DIV_TABLE
), GFP_KERNEL
);
2861 if (spll_table
== NULL
)
2864 for (i
= 0; i
< 256; i
++) {
2865 ret
= si_calculate_sclk_params(rdev
, sclk
, &sclk_params
);
2869 p_div
= (sclk_params
.vCG_SPLL_FUNC_CNTL
& SPLL_PDIV_A_MASK
) >> SPLL_PDIV_A_SHIFT
;
2870 fb_div
= (sclk_params
.vCG_SPLL_FUNC_CNTL_3
& SPLL_FB_DIV_MASK
) >> SPLL_FB_DIV_SHIFT
;
2871 clk_s
= (sclk_params
.vCG_SPLL_SPREAD_SPECTRUM
& CLK_S_MASK
) >> CLK_S_SHIFT
;
2872 clk_v
= (sclk_params
.vCG_SPLL_SPREAD_SPECTRUM_2
& CLK_V_MASK
) >> CLK_V_SHIFT
;
2874 fb_div
&= ~0x00001FFF;
2878 if (p_div
& ~(SMC_SISLANDS_SPLL_DIV_TABLE_PDIV_MASK
>> SMC_SISLANDS_SPLL_DIV_TABLE_PDIV_SHIFT
))
2880 if (fb_div
& ~(SMC_SISLANDS_SPLL_DIV_TABLE_FBDIV_MASK
>> SMC_SISLANDS_SPLL_DIV_TABLE_FBDIV_SHIFT
))
2882 if (clk_s
& ~(SMC_SISLANDS_SPLL_DIV_TABLE_CLKS_MASK
>> SMC_SISLANDS_SPLL_DIV_TABLE_CLKS_SHIFT
))
2884 if (clk_v
& ~(SMC_SISLANDS_SPLL_DIV_TABLE_CLKV_MASK
>> SMC_SISLANDS_SPLL_DIV_TABLE_CLKV_SHIFT
))
2890 tmp
= ((fb_div
<< SMC_SISLANDS_SPLL_DIV_TABLE_FBDIV_SHIFT
) & SMC_SISLANDS_SPLL_DIV_TABLE_FBDIV_MASK
) |
2891 ((p_div
<< SMC_SISLANDS_SPLL_DIV_TABLE_PDIV_SHIFT
) & SMC_SISLANDS_SPLL_DIV_TABLE_PDIV_MASK
);
2892 spll_table
->freq
[i
] = cpu_to_be32(tmp
);
2894 tmp
= ((clk_v
<< SMC_SISLANDS_SPLL_DIV_TABLE_CLKV_SHIFT
) & SMC_SISLANDS_SPLL_DIV_TABLE_CLKV_MASK
) |
2895 ((clk_s
<< SMC_SISLANDS_SPLL_DIV_TABLE_CLKS_SHIFT
) & SMC_SISLANDS_SPLL_DIV_TABLE_CLKS_MASK
);
2896 spll_table
->ss
[i
] = cpu_to_be32(tmp
);
2903 ret
= si_copy_bytes_to_smc(rdev
, si_pi
->spll_table_start
,
2904 (u8
*)spll_table
, sizeof(SMC_SISLANDS_SPLL_DIV_TABLE
),
2908 ni_pi
->enable_power_containment
= false;
2915 static u16
si_get_lower_of_leakage_and_vce_voltage(struct radeon_device
*rdev
,
2918 u16 highest_leakage
= 0;
2919 struct si_power_info
*si_pi
= si_get_pi(rdev
);
2922 for (i
= 0; i
< si_pi
->leakage_voltage
.count
; i
++){
2923 if (highest_leakage
< si_pi
->leakage_voltage
.entries
[i
].voltage
)
2924 highest_leakage
= si_pi
->leakage_voltage
.entries
[i
].voltage
;
2927 if (si_pi
->leakage_voltage
.count
&& (highest_leakage
< vce_voltage
))
2928 return highest_leakage
;
2933 static int si_get_vce_clock_voltage(struct radeon_device
*rdev
,
2934 u32 evclk
, u32 ecclk
, u16
*voltage
)
2938 struct radeon_vce_clock_voltage_dependency_table
*table
=
2939 &rdev
->pm
.dpm
.dyn_state
.vce_clock_voltage_dependency_table
;
2941 if (((evclk
== 0) && (ecclk
== 0)) ||
2942 (table
&& (table
->count
== 0))) {
2947 for (i
= 0; i
< table
->count
; i
++) {
2948 if ((evclk
<= table
->entries
[i
].evclk
) &&
2949 (ecclk
<= table
->entries
[i
].ecclk
)) {
2950 *voltage
= table
->entries
[i
].v
;
2956 /* if no match return the highest voltage */
2958 *voltage
= table
->entries
[table
->count
- 1].v
;
2960 *voltage
= si_get_lower_of_leakage_and_vce_voltage(rdev
, *voltage
);
2965 static void si_apply_state_adjust_rules(struct radeon_device
*rdev
,
2966 struct radeon_ps
*rps
)
2968 struct ni_ps
*ps
= ni_get_ps(rps
);
2969 struct radeon_clock_and_voltage_limits
*max_limits
;
2970 bool disable_mclk_switching
= false;
2971 bool disable_sclk_switching
= false;
2973 u16 vddc
, vddci
, min_vce_voltage
= 0;
2974 u32 max_sclk_vddc
, max_mclk_vddci
, max_mclk_vddc
;
2975 u32 max_sclk
= 0, max_mclk
= 0;
2978 if (rdev
->family
== CHIP_HAINAN
) {
2979 if ((rdev
->pdev
->revision
== 0x81) ||
2980 (rdev
->pdev
->revision
== 0x83) ||
2981 (rdev
->pdev
->revision
== 0xC3) ||
2982 (rdev
->pdev
->device
== 0x6664) ||
2983 (rdev
->pdev
->device
== 0x6665) ||
2984 (rdev
->pdev
->device
== 0x6667)) {
2987 } else if (rdev
->family
== CHIP_OLAND
) {
2988 if ((rdev
->pdev
->revision
== 0xC7) ||
2989 (rdev
->pdev
->revision
== 0x80) ||
2990 (rdev
->pdev
->revision
== 0x81) ||
2991 (rdev
->pdev
->revision
== 0x83) ||
2992 (rdev
->pdev
->revision
== 0x87) ||
2993 (rdev
->pdev
->device
== 0x6604) ||
2994 (rdev
->pdev
->device
== 0x6605)) {
2999 if (rps
->vce_active
) {
3000 rps
->evclk
= rdev
->pm
.dpm
.vce_states
[rdev
->pm
.dpm
.vce_level
].evclk
;
3001 rps
->ecclk
= rdev
->pm
.dpm
.vce_states
[rdev
->pm
.dpm
.vce_level
].ecclk
;
3002 si_get_vce_clock_voltage(rdev
, rps
->evclk
, rps
->ecclk
,
3009 if ((rdev
->pm
.dpm
.new_active_crtc_count
> 1) ||
3010 ni_dpm_vblank_too_short(rdev
))
3011 disable_mclk_switching
= true;
3013 if (rps
->vclk
|| rps
->dclk
) {
3014 disable_mclk_switching
= true;
3015 disable_sclk_switching
= true;
3018 if (rdev
->pm
.dpm
.ac_power
)
3019 max_limits
= &rdev
->pm
.dpm
.dyn_state
.max_clock_voltage_on_ac
;
3021 max_limits
= &rdev
->pm
.dpm
.dyn_state
.max_clock_voltage_on_dc
;
3023 for (i
= ps
->performance_level_count
- 2; i
>= 0; i
--) {
3024 if (ps
->performance_levels
[i
].vddc
> ps
->performance_levels
[i
+1].vddc
)
3025 ps
->performance_levels
[i
].vddc
= ps
->performance_levels
[i
+1].vddc
;
3027 if (rdev
->pm
.dpm
.ac_power
== false) {
3028 for (i
= 0; i
< ps
->performance_level_count
; i
++) {
3029 if (ps
->performance_levels
[i
].mclk
> max_limits
->mclk
)
3030 ps
->performance_levels
[i
].mclk
= max_limits
->mclk
;
3031 if (ps
->performance_levels
[i
].sclk
> max_limits
->sclk
)
3032 ps
->performance_levels
[i
].sclk
= max_limits
->sclk
;
3033 if (ps
->performance_levels
[i
].vddc
> max_limits
->vddc
)
3034 ps
->performance_levels
[i
].vddc
= max_limits
->vddc
;
3035 if (ps
->performance_levels
[i
].vddci
> max_limits
->vddci
)
3036 ps
->performance_levels
[i
].vddci
= max_limits
->vddci
;
3040 /* limit clocks to max supported clocks based on voltage dependency tables */
3041 btc_get_max_clock_from_voltage_dependency_table(&rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_sclk
,
3043 btc_get_max_clock_from_voltage_dependency_table(&rdev
->pm
.dpm
.dyn_state
.vddci_dependency_on_mclk
,
3045 btc_get_max_clock_from_voltage_dependency_table(&rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_mclk
,
3048 for (i
= 0; i
< ps
->performance_level_count
; i
++) {
3049 if (max_sclk_vddc
) {
3050 if (ps
->performance_levels
[i
].sclk
> max_sclk_vddc
)
3051 ps
->performance_levels
[i
].sclk
= max_sclk_vddc
;
3053 if (max_mclk_vddci
) {
3054 if (ps
->performance_levels
[i
].mclk
> max_mclk_vddci
)
3055 ps
->performance_levels
[i
].mclk
= max_mclk_vddci
;
3057 if (max_mclk_vddc
) {
3058 if (ps
->performance_levels
[i
].mclk
> max_mclk_vddc
)
3059 ps
->performance_levels
[i
].mclk
= max_mclk_vddc
;
3062 if (ps
->performance_levels
[i
].mclk
> max_mclk
)
3063 ps
->performance_levels
[i
].mclk
= max_mclk
;
3066 if (ps
->performance_levels
[i
].sclk
> max_sclk
)
3067 ps
->performance_levels
[i
].sclk
= max_sclk
;
3071 /* XXX validate the min clocks required for display */
3073 if (disable_mclk_switching
) {
3074 mclk
= ps
->performance_levels
[ps
->performance_level_count
- 1].mclk
;
3075 vddci
= ps
->performance_levels
[ps
->performance_level_count
- 1].vddci
;
3077 mclk
= ps
->performance_levels
[0].mclk
;
3078 vddci
= ps
->performance_levels
[0].vddci
;
3081 if (disable_sclk_switching
) {
3082 sclk
= ps
->performance_levels
[ps
->performance_level_count
- 1].sclk
;
3083 vddc
= ps
->performance_levels
[ps
->performance_level_count
- 1].vddc
;
3085 sclk
= ps
->performance_levels
[0].sclk
;
3086 vddc
= ps
->performance_levels
[0].vddc
;
3089 if (rps
->vce_active
) {
3090 if (sclk
< rdev
->pm
.dpm
.vce_states
[rdev
->pm
.dpm
.vce_level
].sclk
)
3091 sclk
= rdev
->pm
.dpm
.vce_states
[rdev
->pm
.dpm
.vce_level
].sclk
;
3092 if (mclk
< rdev
->pm
.dpm
.vce_states
[rdev
->pm
.dpm
.vce_level
].mclk
)
3093 mclk
= rdev
->pm
.dpm
.vce_states
[rdev
->pm
.dpm
.vce_level
].mclk
;
3096 /* adjusted low state */
3097 ps
->performance_levels
[0].sclk
= sclk
;
3098 ps
->performance_levels
[0].mclk
= mclk
;
3099 ps
->performance_levels
[0].vddc
= vddc
;
3100 ps
->performance_levels
[0].vddci
= vddci
;
3102 if (disable_sclk_switching
) {
3103 sclk
= ps
->performance_levels
[0].sclk
;
3104 for (i
= 1; i
< ps
->performance_level_count
; i
++) {
3105 if (sclk
< ps
->performance_levels
[i
].sclk
)
3106 sclk
= ps
->performance_levels
[i
].sclk
;
3108 for (i
= 0; i
< ps
->performance_level_count
; i
++) {
3109 ps
->performance_levels
[i
].sclk
= sclk
;
3110 ps
->performance_levels
[i
].vddc
= vddc
;
3113 for (i
= 1; i
< ps
->performance_level_count
; i
++) {
3114 if (ps
->performance_levels
[i
].sclk
< ps
->performance_levels
[i
- 1].sclk
)
3115 ps
->performance_levels
[i
].sclk
= ps
->performance_levels
[i
- 1].sclk
;
3116 if (ps
->performance_levels
[i
].vddc
< ps
->performance_levels
[i
- 1].vddc
)
3117 ps
->performance_levels
[i
].vddc
= ps
->performance_levels
[i
- 1].vddc
;
3121 if (disable_mclk_switching
) {
3122 mclk
= ps
->performance_levels
[0].mclk
;
3123 for (i
= 1; i
< ps
->performance_level_count
; i
++) {
3124 if (mclk
< ps
->performance_levels
[i
].mclk
)
3125 mclk
= ps
->performance_levels
[i
].mclk
;
3127 for (i
= 0; i
< ps
->performance_level_count
; i
++) {
3128 ps
->performance_levels
[i
].mclk
= mclk
;
3129 ps
->performance_levels
[i
].vddci
= vddci
;
3132 for (i
= 1; i
< ps
->performance_level_count
; i
++) {
3133 if (ps
->performance_levels
[i
].mclk
< ps
->performance_levels
[i
- 1].mclk
)
3134 ps
->performance_levels
[i
].mclk
= ps
->performance_levels
[i
- 1].mclk
;
3135 if (ps
->performance_levels
[i
].vddci
< ps
->performance_levels
[i
- 1].vddci
)
3136 ps
->performance_levels
[i
].vddci
= ps
->performance_levels
[i
- 1].vddci
;
3140 for (i
= 0; i
< ps
->performance_level_count
; i
++)
3141 btc_adjust_clock_combinations(rdev
, max_limits
,
3142 &ps
->performance_levels
[i
]);
3144 for (i
= 0; i
< ps
->performance_level_count
; i
++) {
3145 if (ps
->performance_levels
[i
].vddc
< min_vce_voltage
)
3146 ps
->performance_levels
[i
].vddc
= min_vce_voltage
;
3147 btc_apply_voltage_dependency_rules(&rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_sclk
,
3148 ps
->performance_levels
[i
].sclk
,
3149 max_limits
->vddc
, &ps
->performance_levels
[i
].vddc
);
3150 btc_apply_voltage_dependency_rules(&rdev
->pm
.dpm
.dyn_state
.vddci_dependency_on_mclk
,
3151 ps
->performance_levels
[i
].mclk
,
3152 max_limits
->vddci
, &ps
->performance_levels
[i
].vddci
);
3153 btc_apply_voltage_dependency_rules(&rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_mclk
,
3154 ps
->performance_levels
[i
].mclk
,
3155 max_limits
->vddc
, &ps
->performance_levels
[i
].vddc
);
3156 btc_apply_voltage_dependency_rules(&rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_dispclk
,
3157 rdev
->clock
.current_dispclk
,
3158 max_limits
->vddc
, &ps
->performance_levels
[i
].vddc
);
3161 for (i
= 0; i
< ps
->performance_level_count
; i
++) {
3162 btc_apply_voltage_delta_rules(rdev
,
3163 max_limits
->vddc
, max_limits
->vddci
,
3164 &ps
->performance_levels
[i
].vddc
,
3165 &ps
->performance_levels
[i
].vddci
);
3168 ps
->dc_compatible
= true;
3169 for (i
= 0; i
< ps
->performance_level_count
; i
++) {
3170 if (ps
->performance_levels
[i
].vddc
> rdev
->pm
.dpm
.dyn_state
.max_clock_voltage_on_dc
.vddc
)
3171 ps
->dc_compatible
= false;
3176 static int si_read_smc_soft_register(struct radeon_device
*rdev
,
3177 u16 reg_offset
, u32
*value
)
3179 struct si_power_info
*si_pi
= si_get_pi(rdev
);
3181 return si_read_smc_sram_dword(rdev
,
3182 si_pi
->soft_regs_start
+ reg_offset
, value
,
3187 static int si_write_smc_soft_register(struct radeon_device
*rdev
,
3188 u16 reg_offset
, u32 value
)
3190 struct si_power_info
*si_pi
= si_get_pi(rdev
);
3192 return si_write_smc_sram_dword(rdev
,
3193 si_pi
->soft_regs_start
+ reg_offset
,
3194 value
, si_pi
->sram_end
);
3197 static bool si_is_special_1gb_platform(struct radeon_device
*rdev
)
3200 u32 tmp
, width
, row
, column
, bank
, density
;
3201 bool is_memory_gddr5
, is_special
;
3203 tmp
= RREG32(MC_SEQ_MISC0
);
3204 is_memory_gddr5
= (MC_SEQ_MISC0_GDDR5_VALUE
== ((tmp
& MC_SEQ_MISC0_GDDR5_MASK
) >> MC_SEQ_MISC0_GDDR5_SHIFT
));
3205 is_special
= (MC_SEQ_MISC0_REV_ID_VALUE
== ((tmp
& MC_SEQ_MISC0_REV_ID_MASK
) >> MC_SEQ_MISC0_REV_ID_SHIFT
))
3206 & (MC_SEQ_MISC0_VEN_ID_VALUE
== ((tmp
& MC_SEQ_MISC0_VEN_ID_MASK
) >> MC_SEQ_MISC0_VEN_ID_SHIFT
));
3208 WREG32(MC_SEQ_IO_DEBUG_INDEX
, 0xb);
3209 width
= ((RREG32(MC_SEQ_IO_DEBUG_DATA
) >> 1) & 1) ? 16 : 32;
3211 tmp
= RREG32(MC_ARB_RAMCFG
);
3212 row
= ((tmp
& NOOFROWS_MASK
) >> NOOFROWS_SHIFT
) + 10;
3213 column
= ((tmp
& NOOFCOLS_MASK
) >> NOOFCOLS_SHIFT
) + 8;
3214 bank
= ((tmp
& NOOFBANK_MASK
) >> NOOFBANK_SHIFT
) + 2;
3216 density
= (1 << (row
+ column
- 20 + bank
)) * width
;
3218 if ((rdev
->pdev
->device
== 0x6819) &&
3219 is_memory_gddr5
&& is_special
&& (density
== 0x400))
3225 static void si_get_leakage_vddc(struct radeon_device
*rdev
)
3227 struct si_power_info
*si_pi
= si_get_pi(rdev
);
3228 u16 vddc
, count
= 0;
3231 for (i
= 0; i
< SISLANDS_MAX_LEAKAGE_COUNT
; i
++) {
3232 ret
= radeon_atom_get_leakage_vddc_based_on_leakage_idx(rdev
, &vddc
, SISLANDS_LEAKAGE_INDEX0
+ i
);
3234 if (!ret
&& (vddc
> 0) && (vddc
!= (SISLANDS_LEAKAGE_INDEX0
+ i
))) {
3235 si_pi
->leakage_voltage
.entries
[count
].voltage
= vddc
;
3236 si_pi
->leakage_voltage
.entries
[count
].leakage_index
=
3237 SISLANDS_LEAKAGE_INDEX0
+ i
;
3241 si_pi
->leakage_voltage
.count
= count
;
3244 static int si_get_leakage_voltage_from_leakage_index(struct radeon_device
*rdev
,
3245 u32 index
, u16
*leakage_voltage
)
3247 struct si_power_info
*si_pi
= si_get_pi(rdev
);
3250 if (leakage_voltage
== NULL
)
3253 if ((index
& 0xff00) != 0xff00)
3256 if ((index
& 0xff) > SISLANDS_MAX_LEAKAGE_COUNT
+ 1)
3259 if (index
< SISLANDS_LEAKAGE_INDEX0
)
3262 for (i
= 0; i
< si_pi
->leakage_voltage
.count
; i
++) {
3263 if (si_pi
->leakage_voltage
.entries
[i
].leakage_index
== index
) {
3264 *leakage_voltage
= si_pi
->leakage_voltage
.entries
[i
].voltage
;
3271 static void si_set_dpm_event_sources(struct radeon_device
*rdev
, u32 sources
)
3273 struct rv7xx_power_info
*pi
= rv770_get_pi(rdev
);
3274 bool want_thermal_protection
;
3275 enum radeon_dpm_event_src dpm_event_src
;
3280 want_thermal_protection
= false;
3282 case (1 << RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL
):
3283 want_thermal_protection
= true;
3284 dpm_event_src
= RADEON_DPM_EVENT_SRC_DIGITAL
;
3286 case (1 << RADEON_DPM_AUTO_THROTTLE_SRC_EXTERNAL
):
3287 want_thermal_protection
= true;
3288 dpm_event_src
= RADEON_DPM_EVENT_SRC_EXTERNAL
;
3290 case ((1 << RADEON_DPM_AUTO_THROTTLE_SRC_EXTERNAL
) |
3291 (1 << RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL
)):
3292 want_thermal_protection
= true;
3293 dpm_event_src
= RADEON_DPM_EVENT_SRC_DIGIAL_OR_EXTERNAL
;
3297 if (want_thermal_protection
) {
3298 WREG32_P(CG_THERMAL_CTRL
, DPM_EVENT_SRC(dpm_event_src
), ~DPM_EVENT_SRC_MASK
);
3299 if (pi
->thermal_protection
)
3300 WREG32_P(GENERAL_PWRMGT
, 0, ~THERMAL_PROTECTION_DIS
);
3302 WREG32_P(GENERAL_PWRMGT
, THERMAL_PROTECTION_DIS
, ~THERMAL_PROTECTION_DIS
);
3306 static void si_enable_auto_throttle_source(struct radeon_device
*rdev
,
3307 enum radeon_dpm_auto_throttle_src source
,
3310 struct rv7xx_power_info
*pi
= rv770_get_pi(rdev
);
3313 if (!(pi
->active_auto_throttle_sources
& (1 << source
))) {
3314 pi
->active_auto_throttle_sources
|= 1 << source
;
3315 si_set_dpm_event_sources(rdev
, pi
->active_auto_throttle_sources
);
3318 if (pi
->active_auto_throttle_sources
& (1 << source
)) {
3319 pi
->active_auto_throttle_sources
&= ~(1 << source
);
3320 si_set_dpm_event_sources(rdev
, pi
->active_auto_throttle_sources
);
3325 static void si_start_dpm(struct radeon_device
*rdev
)
3327 WREG32_P(GENERAL_PWRMGT
, GLOBAL_PWRMGT_EN
, ~GLOBAL_PWRMGT_EN
);
3330 static void si_stop_dpm(struct radeon_device
*rdev
)
3332 WREG32_P(GENERAL_PWRMGT
, 0, ~GLOBAL_PWRMGT_EN
);
3335 static void si_enable_sclk_control(struct radeon_device
*rdev
, bool enable
)
3338 WREG32_P(SCLK_PWRMGT_CNTL
, 0, ~SCLK_PWRMGT_OFF
);
3340 WREG32_P(SCLK_PWRMGT_CNTL
, SCLK_PWRMGT_OFF
, ~SCLK_PWRMGT_OFF
);
3345 static int si_notify_hardware_of_thermal_state(struct radeon_device
*rdev
,
3350 if (thermal_level
== 0) {
3351 ret
= si_send_msg_to_smc(rdev
, PPSMC_MSG_EnableThermalInterrupt
);
3352 if (ret
== PPSMC_Result_OK
)
3360 static void si_notify_hardware_vpu_recovery_event(struct radeon_device
*rdev
)
3362 si_write_smc_soft_register(rdev
, SI_SMC_SOFT_REGISTER_tdr_is_about_to_happen
, true);
3367 static int si_notify_hw_of_powersource(struct radeon_device
*rdev
, bool ac_power
)
3370 return (si_send_msg_to_smc(rdev
, PPSMC_MSG_RunningOnAC
) == PPSMC_Result_OK
) ?
3377 static PPSMC_Result
si_send_msg_to_smc_with_parameter(struct radeon_device
*rdev
,
3378 PPSMC_Msg msg
, u32 parameter
)
3380 WREG32(SMC_SCRATCH0
, parameter
);
3381 return si_send_msg_to_smc(rdev
, msg
);
3384 static int si_restrict_performance_levels_before_switch(struct radeon_device
*rdev
)
3386 if (si_send_msg_to_smc(rdev
, PPSMC_MSG_NoForcedLevel
) != PPSMC_Result_OK
)
3389 return (si_send_msg_to_smc_with_parameter(rdev
, PPSMC_MSG_SetEnabledLevels
, 1) == PPSMC_Result_OK
) ?
3393 int si_dpm_force_performance_level(struct radeon_device
*rdev
,
3394 enum radeon_dpm_forced_level level
)
3396 struct radeon_ps
*rps
= rdev
->pm
.dpm
.current_ps
;
3397 struct ni_ps
*ps
= ni_get_ps(rps
);
3398 u32 levels
= ps
->performance_level_count
;
3400 if (level
== RADEON_DPM_FORCED_LEVEL_HIGH
) {
3401 if (si_send_msg_to_smc_with_parameter(rdev
, PPSMC_MSG_SetEnabledLevels
, levels
) != PPSMC_Result_OK
)
3404 if (si_send_msg_to_smc_with_parameter(rdev
, PPSMC_MSG_SetForcedLevels
, 1) != PPSMC_Result_OK
)
3406 } else if (level
== RADEON_DPM_FORCED_LEVEL_LOW
) {
3407 if (si_send_msg_to_smc_with_parameter(rdev
, PPSMC_MSG_SetForcedLevels
, 0) != PPSMC_Result_OK
)
3410 if (si_send_msg_to_smc_with_parameter(rdev
, PPSMC_MSG_SetEnabledLevels
, 1) != PPSMC_Result_OK
)
3412 } else if (level
== RADEON_DPM_FORCED_LEVEL_AUTO
) {
3413 if (si_send_msg_to_smc_with_parameter(rdev
, PPSMC_MSG_SetForcedLevels
, 0) != PPSMC_Result_OK
)
3416 if (si_send_msg_to_smc_with_parameter(rdev
, PPSMC_MSG_SetEnabledLevels
, levels
) != PPSMC_Result_OK
)
3420 rdev
->pm
.dpm
.forced_level
= level
;
3426 static int si_set_boot_state(struct radeon_device
*rdev
)
3428 return (si_send_msg_to_smc(rdev
, PPSMC_MSG_SwitchToInitialState
) == PPSMC_Result_OK
) ?
3433 static int si_set_sw_state(struct radeon_device
*rdev
)
3435 return (si_send_msg_to_smc(rdev
, PPSMC_MSG_SwitchToSwState
) == PPSMC_Result_OK
) ?
3439 static int si_halt_smc(struct radeon_device
*rdev
)
3441 if (si_send_msg_to_smc(rdev
, PPSMC_MSG_Halt
) != PPSMC_Result_OK
)
3444 return (si_wait_for_smc_inactive(rdev
) == PPSMC_Result_OK
) ?
3448 static int si_resume_smc(struct radeon_device
*rdev
)
3450 if (si_send_msg_to_smc(rdev
, PPSMC_FlushDataCache
) != PPSMC_Result_OK
)
3453 return (si_send_msg_to_smc(rdev
, PPSMC_MSG_Resume
) == PPSMC_Result_OK
) ?
3457 static void si_dpm_start_smc(struct radeon_device
*rdev
)
3459 si_program_jump_on_start(rdev
);
3461 si_start_smc_clock(rdev
);
3464 static void si_dpm_stop_smc(struct radeon_device
*rdev
)
3467 si_stop_smc_clock(rdev
);
3470 static int si_process_firmware_header(struct radeon_device
*rdev
)
3472 struct si_power_info
*si_pi
= si_get_pi(rdev
);
3476 ret
= si_read_smc_sram_dword(rdev
,
3477 SISLANDS_SMC_FIRMWARE_HEADER_LOCATION
+
3478 SISLANDS_SMC_FIRMWARE_HEADER_stateTable
,
3479 &tmp
, si_pi
->sram_end
);
3483 si_pi
->state_table_start
= tmp
;
3485 ret
= si_read_smc_sram_dword(rdev
,
3486 SISLANDS_SMC_FIRMWARE_HEADER_LOCATION
+
3487 SISLANDS_SMC_FIRMWARE_HEADER_softRegisters
,
3488 &tmp
, si_pi
->sram_end
);
3492 si_pi
->soft_regs_start
= tmp
;
3494 ret
= si_read_smc_sram_dword(rdev
,
3495 SISLANDS_SMC_FIRMWARE_HEADER_LOCATION
+
3496 SISLANDS_SMC_FIRMWARE_HEADER_mcRegisterTable
,
3497 &tmp
, si_pi
->sram_end
);
3501 si_pi
->mc_reg_table_start
= tmp
;
3503 ret
= si_read_smc_sram_dword(rdev
,
3504 SISLANDS_SMC_FIRMWARE_HEADER_LOCATION
+
3505 SISLANDS_SMC_FIRMWARE_HEADER_fanTable
,
3506 &tmp
, si_pi
->sram_end
);
3510 si_pi
->fan_table_start
= tmp
;
3512 ret
= si_read_smc_sram_dword(rdev
,
3513 SISLANDS_SMC_FIRMWARE_HEADER_LOCATION
+
3514 SISLANDS_SMC_FIRMWARE_HEADER_mcArbDramAutoRefreshTable
,
3515 &tmp
, si_pi
->sram_end
);
3519 si_pi
->arb_table_start
= tmp
;
3521 ret
= si_read_smc_sram_dword(rdev
,
3522 SISLANDS_SMC_FIRMWARE_HEADER_LOCATION
+
3523 SISLANDS_SMC_FIRMWARE_HEADER_CacConfigTable
,
3524 &tmp
, si_pi
->sram_end
);
3528 si_pi
->cac_table_start
= tmp
;
3530 ret
= si_read_smc_sram_dword(rdev
,
3531 SISLANDS_SMC_FIRMWARE_HEADER_LOCATION
+
3532 SISLANDS_SMC_FIRMWARE_HEADER_DteConfiguration
,
3533 &tmp
, si_pi
->sram_end
);
3537 si_pi
->dte_table_start
= tmp
;
3539 ret
= si_read_smc_sram_dword(rdev
,
3540 SISLANDS_SMC_FIRMWARE_HEADER_LOCATION
+
3541 SISLANDS_SMC_FIRMWARE_HEADER_spllTable
,
3542 &tmp
, si_pi
->sram_end
);
3546 si_pi
->spll_table_start
= tmp
;
3548 ret
= si_read_smc_sram_dword(rdev
,
3549 SISLANDS_SMC_FIRMWARE_HEADER_LOCATION
+
3550 SISLANDS_SMC_FIRMWARE_HEADER_PAPMParameters
,
3551 &tmp
, si_pi
->sram_end
);
3555 si_pi
->papm_cfg_table_start
= tmp
;
3560 static void si_read_clock_registers(struct radeon_device
*rdev
)
3562 struct si_power_info
*si_pi
= si_get_pi(rdev
);
3564 si_pi
->clock_registers
.cg_spll_func_cntl
= RREG32(CG_SPLL_FUNC_CNTL
);
3565 si_pi
->clock_registers
.cg_spll_func_cntl_2
= RREG32(CG_SPLL_FUNC_CNTL_2
);
3566 si_pi
->clock_registers
.cg_spll_func_cntl_3
= RREG32(CG_SPLL_FUNC_CNTL_3
);
3567 si_pi
->clock_registers
.cg_spll_func_cntl_4
= RREG32(CG_SPLL_FUNC_CNTL_4
);
3568 si_pi
->clock_registers
.cg_spll_spread_spectrum
= RREG32(CG_SPLL_SPREAD_SPECTRUM
);
3569 si_pi
->clock_registers
.cg_spll_spread_spectrum_2
= RREG32(CG_SPLL_SPREAD_SPECTRUM_2
);
3570 si_pi
->clock_registers
.dll_cntl
= RREG32(DLL_CNTL
);
3571 si_pi
->clock_registers
.mclk_pwrmgt_cntl
= RREG32(MCLK_PWRMGT_CNTL
);
3572 si_pi
->clock_registers
.mpll_ad_func_cntl
= RREG32(MPLL_AD_FUNC_CNTL
);
3573 si_pi
->clock_registers
.mpll_dq_func_cntl
= RREG32(MPLL_DQ_FUNC_CNTL
);
3574 si_pi
->clock_registers
.mpll_func_cntl
= RREG32(MPLL_FUNC_CNTL
);
3575 si_pi
->clock_registers
.mpll_func_cntl_1
= RREG32(MPLL_FUNC_CNTL_1
);
3576 si_pi
->clock_registers
.mpll_func_cntl_2
= RREG32(MPLL_FUNC_CNTL_2
);
3577 si_pi
->clock_registers
.mpll_ss1
= RREG32(MPLL_SS1
);
3578 si_pi
->clock_registers
.mpll_ss2
= RREG32(MPLL_SS2
);
3581 static void si_enable_thermal_protection(struct radeon_device
*rdev
,
3585 WREG32_P(GENERAL_PWRMGT
, 0, ~THERMAL_PROTECTION_DIS
);
3587 WREG32_P(GENERAL_PWRMGT
, THERMAL_PROTECTION_DIS
, ~THERMAL_PROTECTION_DIS
);
3590 static void si_enable_acpi_power_management(struct radeon_device
*rdev
)
3592 WREG32_P(GENERAL_PWRMGT
, STATIC_PM_EN
, ~STATIC_PM_EN
);
3596 static int si_enter_ulp_state(struct radeon_device
*rdev
)
3598 WREG32(SMC_MESSAGE_0
, PPSMC_MSG_SwitchToMinimumPower
);
3605 static int si_exit_ulp_state(struct radeon_device
*rdev
)
3609 WREG32(SMC_MESSAGE_0
, PPSMC_MSG_ResumeFromMinimumPower
);
3613 for (i
= 0; i
< rdev
->usec_timeout
; i
++) {
3614 if (RREG32(SMC_RESP_0
) == 1)
3623 static int si_notify_smc_display_change(struct radeon_device
*rdev
,
3626 PPSMC_Msg msg
= has_display
?
3627 PPSMC_MSG_HasDisplay
: PPSMC_MSG_NoDisplay
;
3629 return (si_send_msg_to_smc(rdev
, msg
) == PPSMC_Result_OK
) ?
3633 static void si_program_response_times(struct radeon_device
*rdev
)
3635 u32 voltage_response_time
, backbias_response_time
, acpi_delay_time
, vbi_time_out
;
3636 u32 vddc_dly
, acpi_dly
, vbi_dly
;
3637 u32 reference_clock
;
3639 si_write_smc_soft_register(rdev
, SI_SMC_SOFT_REGISTER_mvdd_chg_time
, 1);
3641 voltage_response_time
= (u32
)rdev
->pm
.dpm
.voltage_response_time
;
3642 backbias_response_time
= (u32
)rdev
->pm
.dpm
.backbias_response_time
;
3644 if (voltage_response_time
== 0)
3645 voltage_response_time
= 1000;
3647 acpi_delay_time
= 15000;
3648 vbi_time_out
= 100000;
3650 reference_clock
= radeon_get_xclk(rdev
);
3652 vddc_dly
= (voltage_response_time
* reference_clock
) / 100;
3653 acpi_dly
= (acpi_delay_time
* reference_clock
) / 100;
3654 vbi_dly
= (vbi_time_out
* reference_clock
) / 100;
3656 si_write_smc_soft_register(rdev
, SI_SMC_SOFT_REGISTER_delay_vreg
, vddc_dly
);
3657 si_write_smc_soft_register(rdev
, SI_SMC_SOFT_REGISTER_delay_acpi
, acpi_dly
);
3658 si_write_smc_soft_register(rdev
, SI_SMC_SOFT_REGISTER_mclk_chg_timeout
, vbi_dly
);
3659 si_write_smc_soft_register(rdev
, SI_SMC_SOFT_REGISTER_mc_block_delay
, 0xAA);
3662 static void si_program_ds_registers(struct radeon_device
*rdev
)
3664 struct evergreen_power_info
*eg_pi
= evergreen_get_pi(rdev
);
3665 u32 tmp
= 1; /* XXX: 0x10 on tahiti A0 */
3667 if (eg_pi
->sclk_deep_sleep
) {
3668 WREG32_P(MISC_CLK_CNTL
, DEEP_SLEEP_CLK_SEL(tmp
), ~DEEP_SLEEP_CLK_SEL_MASK
);
3669 WREG32_P(CG_SPLL_AUTOSCALE_CNTL
, AUTOSCALE_ON_SS_CLEAR
,
3670 ~AUTOSCALE_ON_SS_CLEAR
);
3674 static void si_program_display_gap(struct radeon_device
*rdev
)
3679 tmp
= RREG32(CG_DISPLAY_GAP_CNTL
) & ~(DISP1_GAP_MASK
| DISP2_GAP_MASK
);
3680 if (rdev
->pm
.dpm
.new_active_crtc_count
> 0)
3681 tmp
|= DISP1_GAP(R600_PM_DISPLAY_GAP_VBLANK_OR_WM
);
3683 tmp
|= DISP1_GAP(R600_PM_DISPLAY_GAP_IGNORE
);
3685 if (rdev
->pm
.dpm
.new_active_crtc_count
> 1)
3686 tmp
|= DISP2_GAP(R600_PM_DISPLAY_GAP_VBLANK_OR_WM
);
3688 tmp
|= DISP2_GAP(R600_PM_DISPLAY_GAP_IGNORE
);
3690 WREG32(CG_DISPLAY_GAP_CNTL
, tmp
);
3692 tmp
= RREG32(DCCG_DISP_SLOW_SELECT_REG
);
3693 pipe
= (tmp
& DCCG_DISP1_SLOW_SELECT_MASK
) >> DCCG_DISP1_SLOW_SELECT_SHIFT
;
3695 if ((rdev
->pm
.dpm
.new_active_crtc_count
> 0) &&
3696 (!(rdev
->pm
.dpm
.new_active_crtcs
& (1 << pipe
)))) {
3697 /* find the first active crtc */
3698 for (i
= 0; i
< rdev
->num_crtc
; i
++) {
3699 if (rdev
->pm
.dpm
.new_active_crtcs
& (1 << i
))
3702 if (i
== rdev
->num_crtc
)
3707 tmp
&= ~DCCG_DISP1_SLOW_SELECT_MASK
;
3708 tmp
|= DCCG_DISP1_SLOW_SELECT(pipe
);
3709 WREG32(DCCG_DISP_SLOW_SELECT_REG
, tmp
);
3712 /* Setting this to false forces the performance state to low if the crtcs are disabled.
3713 * This can be a problem on PowerXpress systems or if you want to use the card
3714 * for offscreen rendering or compute if there are no crtcs enabled.
3716 si_notify_smc_display_change(rdev
, rdev
->pm
.dpm
.new_active_crtc_count
> 0);
3719 static void si_enable_spread_spectrum(struct radeon_device
*rdev
, bool enable
)
3721 struct rv7xx_power_info
*pi
= rv770_get_pi(rdev
);
3725 WREG32_P(GENERAL_PWRMGT
, DYN_SPREAD_SPECTRUM_EN
, ~DYN_SPREAD_SPECTRUM_EN
);
3727 WREG32_P(CG_SPLL_SPREAD_SPECTRUM
, 0, ~SSEN
);
3728 WREG32_P(GENERAL_PWRMGT
, 0, ~DYN_SPREAD_SPECTRUM_EN
);
3732 static void si_setup_bsp(struct radeon_device
*rdev
)
3734 struct rv7xx_power_info
*pi
= rv770_get_pi(rdev
);
3735 u32 xclk
= radeon_get_xclk(rdev
);
3737 r600_calculate_u_and_p(pi
->asi
,
3743 r600_calculate_u_and_p(pi
->pasi
,
3750 pi
->dsp
= BSP(pi
->bsp
) | BSU(pi
->bsu
);
3751 pi
->psp
= BSP(pi
->pbsp
) | BSU(pi
->pbsu
);
3753 WREG32(CG_BSP
, pi
->dsp
);
3756 static void si_program_git(struct radeon_device
*rdev
)
3758 WREG32_P(CG_GIT
, CG_GICST(R600_GICST_DFLT
), ~CG_GICST_MASK
);
3761 static void si_program_tp(struct radeon_device
*rdev
)
3764 enum r600_td td
= R600_TD_DFLT
;
3766 for (i
= 0; i
< R600_PM_NUMBER_OF_TC
; i
++)
3767 WREG32(CG_FFCT_0
+ (i
* 4), (UTC_0(r600_utc
[i
]) | DTC_0(r600_dtc
[i
])));
3769 if (td
== R600_TD_AUTO
)
3770 WREG32_P(SCLK_PWRMGT_CNTL
, 0, ~FIR_FORCE_TREND_SEL
);
3772 WREG32_P(SCLK_PWRMGT_CNTL
, FIR_FORCE_TREND_SEL
, ~FIR_FORCE_TREND_SEL
);
3774 if (td
== R600_TD_UP
)
3775 WREG32_P(SCLK_PWRMGT_CNTL
, 0, ~FIR_TREND_MODE
);
3777 if (td
== R600_TD_DOWN
)
3778 WREG32_P(SCLK_PWRMGT_CNTL
, FIR_TREND_MODE
, ~FIR_TREND_MODE
);
3781 static void si_program_tpp(struct radeon_device
*rdev
)
3783 WREG32(CG_TPC
, R600_TPC_DFLT
);
3786 static void si_program_sstp(struct radeon_device
*rdev
)
3788 WREG32(CG_SSP
, (SSTU(R600_SSTU_DFLT
) | SST(R600_SST_DFLT
)));
3791 static void si_enable_display_gap(struct radeon_device
*rdev
)
3793 u32 tmp
= RREG32(CG_DISPLAY_GAP_CNTL
);
3795 tmp
&= ~(DISP1_GAP_MASK
| DISP2_GAP_MASK
);
3796 tmp
|= (DISP1_GAP(R600_PM_DISPLAY_GAP_IGNORE
) |
3797 DISP2_GAP(R600_PM_DISPLAY_GAP_IGNORE
));
3799 tmp
&= ~(DISP1_GAP_MCHG_MASK
| DISP2_GAP_MCHG_MASK
);
3800 tmp
|= (DISP1_GAP_MCHG(R600_PM_DISPLAY_GAP_VBLANK
) |
3801 DISP2_GAP_MCHG(R600_PM_DISPLAY_GAP_IGNORE
));
3802 WREG32(CG_DISPLAY_GAP_CNTL
, tmp
);
3805 static void si_program_vc(struct radeon_device
*rdev
)
3807 struct rv7xx_power_info
*pi
= rv770_get_pi(rdev
);
3809 WREG32(CG_FTV
, pi
->vrc
);
3812 static void si_clear_vc(struct radeon_device
*rdev
)
3817 u8
si_get_ddr3_mclk_frequency_ratio(u32 memory_clock
)
3821 if (memory_clock
< 10000)
3823 else if (memory_clock
>= 80000)
3824 mc_para_index
= 0x0f;
3826 mc_para_index
= (u8
)((memory_clock
- 10000) / 5000 + 1);
3827 return mc_para_index
;
3830 u8
si_get_mclk_frequency_ratio(u32 memory_clock
, bool strobe_mode
)
3835 if (memory_clock
< 12500)
3836 mc_para_index
= 0x00;
3837 else if (memory_clock
> 47500)
3838 mc_para_index
= 0x0f;
3840 mc_para_index
= (u8
)((memory_clock
- 10000) / 2500);
3842 if (memory_clock
< 65000)
3843 mc_para_index
= 0x00;
3844 else if (memory_clock
> 135000)
3845 mc_para_index
= 0x0f;
3847 mc_para_index
= (u8
)((memory_clock
- 60000) / 5000);
3849 return mc_para_index
;
3852 static u8
si_get_strobe_mode_settings(struct radeon_device
*rdev
, u32 mclk
)
3854 struct rv7xx_power_info
*pi
= rv770_get_pi(rdev
);
3855 bool strobe_mode
= false;
3858 if (mclk
<= pi
->mclk_strobe_mode_threshold
)
3862 result
= si_get_mclk_frequency_ratio(mclk
, strobe_mode
);
3864 result
= si_get_ddr3_mclk_frequency_ratio(mclk
);
3867 result
|= SISLANDS_SMC_STROBE_ENABLE
;
3872 static int si_upload_firmware(struct radeon_device
*rdev
)
3874 struct si_power_info
*si_pi
= si_get_pi(rdev
);
3878 si_stop_smc_clock(rdev
);
3880 ret
= si_load_smc_ucode(rdev
, si_pi
->sram_end
);
3885 static bool si_validate_phase_shedding_tables(struct radeon_device
*rdev
,
3886 const struct atom_voltage_table
*table
,
3887 const struct radeon_phase_shedding_limits_table
*limits
)
3889 u32 data
, num_bits
, num_levels
;
3891 if ((table
== NULL
) || (limits
== NULL
))
3894 data
= table
->mask_low
;
3896 num_bits
= hweight32(data
);
3901 num_levels
= (1 << num_bits
);
3903 if (table
->count
!= num_levels
)
3906 if (limits
->count
!= (num_levels
- 1))
3912 void si_trim_voltage_table_to_fit_state_table(struct radeon_device
*rdev
,
3913 u32 max_voltage_steps
,
3914 struct atom_voltage_table
*voltage_table
)
3916 unsigned int i
, diff
;
3918 if (voltage_table
->count
<= max_voltage_steps
)
3921 diff
= voltage_table
->count
- max_voltage_steps
;
3923 for (i
= 0; i
< max_voltage_steps
; i
++)
3924 voltage_table
->entries
[i
] = voltage_table
->entries
[i
+ diff
];
3926 voltage_table
->count
= max_voltage_steps
;
3929 static int si_get_svi2_voltage_table(struct radeon_device
*rdev
,
3930 struct radeon_clock_voltage_dependency_table
*voltage_dependency_table
,
3931 struct atom_voltage_table
*voltage_table
)
3935 if (voltage_dependency_table
== NULL
)
3938 voltage_table
->mask_low
= 0;
3939 voltage_table
->phase_delay
= 0;
3941 voltage_table
->count
= voltage_dependency_table
->count
;
3942 for (i
= 0; i
< voltage_table
->count
; i
++) {
3943 voltage_table
->entries
[i
].value
= voltage_dependency_table
->entries
[i
].v
;
3944 voltage_table
->entries
[i
].smio_low
= 0;
3950 static int si_construct_voltage_tables(struct radeon_device
*rdev
)
3952 struct rv7xx_power_info
*pi
= rv770_get_pi(rdev
);
3953 struct evergreen_power_info
*eg_pi
= evergreen_get_pi(rdev
);
3954 struct si_power_info
*si_pi
= si_get_pi(rdev
);
3957 if (pi
->voltage_control
) {
3958 ret
= radeon_atom_get_voltage_table(rdev
, VOLTAGE_TYPE_VDDC
,
3959 VOLTAGE_OBJ_GPIO_LUT
, &eg_pi
->vddc_voltage_table
);
3963 if (eg_pi
->vddc_voltage_table
.count
> SISLANDS_MAX_NO_VREG_STEPS
)
3964 si_trim_voltage_table_to_fit_state_table(rdev
,
3965 SISLANDS_MAX_NO_VREG_STEPS
,
3966 &eg_pi
->vddc_voltage_table
);
3967 } else if (si_pi
->voltage_control_svi2
) {
3968 ret
= si_get_svi2_voltage_table(rdev
,
3969 &rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_mclk
,
3970 &eg_pi
->vddc_voltage_table
);
3977 if (eg_pi
->vddci_control
) {
3978 ret
= radeon_atom_get_voltage_table(rdev
, VOLTAGE_TYPE_VDDCI
,
3979 VOLTAGE_OBJ_GPIO_LUT
, &eg_pi
->vddci_voltage_table
);
3983 if (eg_pi
->vddci_voltage_table
.count
> SISLANDS_MAX_NO_VREG_STEPS
)
3984 si_trim_voltage_table_to_fit_state_table(rdev
,
3985 SISLANDS_MAX_NO_VREG_STEPS
,
3986 &eg_pi
->vddci_voltage_table
);
3988 if (si_pi
->vddci_control_svi2
) {
3989 ret
= si_get_svi2_voltage_table(rdev
,
3990 &rdev
->pm
.dpm
.dyn_state
.vddci_dependency_on_mclk
,
3991 &eg_pi
->vddci_voltage_table
);
3996 if (pi
->mvdd_control
) {
3997 ret
= radeon_atom_get_voltage_table(rdev
, VOLTAGE_TYPE_MVDDC
,
3998 VOLTAGE_OBJ_GPIO_LUT
, &si_pi
->mvdd_voltage_table
);
4001 pi
->mvdd_control
= false;
4005 if (si_pi
->mvdd_voltage_table
.count
== 0) {
4006 pi
->mvdd_control
= false;
4010 if (si_pi
->mvdd_voltage_table
.count
> SISLANDS_MAX_NO_VREG_STEPS
)
4011 si_trim_voltage_table_to_fit_state_table(rdev
,
4012 SISLANDS_MAX_NO_VREG_STEPS
,
4013 &si_pi
->mvdd_voltage_table
);
4016 if (si_pi
->vddc_phase_shed_control
) {
4017 ret
= radeon_atom_get_voltage_table(rdev
, VOLTAGE_TYPE_VDDC
,
4018 VOLTAGE_OBJ_PHASE_LUT
, &si_pi
->vddc_phase_shed_table
);
4020 si_pi
->vddc_phase_shed_control
= false;
4022 if ((si_pi
->vddc_phase_shed_table
.count
== 0) ||
4023 (si_pi
->vddc_phase_shed_table
.count
> SISLANDS_MAX_NO_VREG_STEPS
))
4024 si_pi
->vddc_phase_shed_control
= false;
4030 static void si_populate_smc_voltage_table(struct radeon_device
*rdev
,
4031 const struct atom_voltage_table
*voltage_table
,
4032 SISLANDS_SMC_STATETABLE
*table
)
4036 for (i
= 0; i
< voltage_table
->count
; i
++)
4037 table
->lowSMIO
[i
] |= cpu_to_be32(voltage_table
->entries
[i
].smio_low
);
4040 static int si_populate_smc_voltage_tables(struct radeon_device
*rdev
,
4041 SISLANDS_SMC_STATETABLE
*table
)
4043 struct rv7xx_power_info
*pi
= rv770_get_pi(rdev
);
4044 struct evergreen_power_info
*eg_pi
= evergreen_get_pi(rdev
);
4045 struct si_power_info
*si_pi
= si_get_pi(rdev
);
4048 if (si_pi
->voltage_control_svi2
) {
4049 si_write_smc_soft_register(rdev
, SI_SMC_SOFT_REGISTER_svi_rework_gpio_id_svc
,
4050 si_pi
->svc_gpio_id
);
4051 si_write_smc_soft_register(rdev
, SI_SMC_SOFT_REGISTER_svi_rework_gpio_id_svd
,
4052 si_pi
->svd_gpio_id
);
4053 si_write_smc_soft_register(rdev
, SI_SMC_SOFT_REGISTER_svi_rework_plat_type
,
4056 if (eg_pi
->vddc_voltage_table
.count
) {
4057 si_populate_smc_voltage_table(rdev
, &eg_pi
->vddc_voltage_table
, table
);
4058 table
->voltageMaskTable
.lowMask
[SISLANDS_SMC_VOLTAGEMASK_VDDC
] =
4059 cpu_to_be32(eg_pi
->vddc_voltage_table
.mask_low
);
4061 for (i
= 0; i
< eg_pi
->vddc_voltage_table
.count
; i
++) {
4062 if (pi
->max_vddc_in_table
<= eg_pi
->vddc_voltage_table
.entries
[i
].value
) {
4063 table
->maxVDDCIndexInPPTable
= i
;
4069 if (eg_pi
->vddci_voltage_table
.count
) {
4070 si_populate_smc_voltage_table(rdev
, &eg_pi
->vddci_voltage_table
, table
);
4072 table
->voltageMaskTable
.lowMask
[SISLANDS_SMC_VOLTAGEMASK_VDDCI
] =
4073 cpu_to_be32(eg_pi
->vddci_voltage_table
.mask_low
);
4077 if (si_pi
->mvdd_voltage_table
.count
) {
4078 si_populate_smc_voltage_table(rdev
, &si_pi
->mvdd_voltage_table
, table
);
4080 table
->voltageMaskTable
.lowMask
[SISLANDS_SMC_VOLTAGEMASK_MVDD
] =
4081 cpu_to_be32(si_pi
->mvdd_voltage_table
.mask_low
);
4084 if (si_pi
->vddc_phase_shed_control
) {
4085 if (si_validate_phase_shedding_tables(rdev
, &si_pi
->vddc_phase_shed_table
,
4086 &rdev
->pm
.dpm
.dyn_state
.phase_shedding_limits_table
)) {
4087 si_populate_smc_voltage_table(rdev
, &si_pi
->vddc_phase_shed_table
, table
);
4089 table
->phaseMaskTable
.lowMask
[SISLANDS_SMC_VOLTAGEMASK_VDDC_PHASE_SHEDDING
] =
4090 cpu_to_be32(si_pi
->vddc_phase_shed_table
.mask_low
);
4092 si_write_smc_soft_register(rdev
, SI_SMC_SOFT_REGISTER_phase_shedding_delay
,
4093 (u32
)si_pi
->vddc_phase_shed_table
.phase_delay
);
4095 si_pi
->vddc_phase_shed_control
= false;
4103 static int si_populate_voltage_value(struct radeon_device
*rdev
,
4104 const struct atom_voltage_table
*table
,
4105 u16 value
, SISLANDS_SMC_VOLTAGE_VALUE
*voltage
)
4109 for (i
= 0; i
< table
->count
; i
++) {
4110 if (value
<= table
->entries
[i
].value
) {
4111 voltage
->index
= (u8
)i
;
4112 voltage
->value
= cpu_to_be16(table
->entries
[i
].value
);
4117 if (i
>= table
->count
)
4123 static int si_populate_mvdd_value(struct radeon_device
*rdev
, u32 mclk
,
4124 SISLANDS_SMC_VOLTAGE_VALUE
*voltage
)
4126 struct rv7xx_power_info
*pi
= rv770_get_pi(rdev
);
4127 struct si_power_info
*si_pi
= si_get_pi(rdev
);
4129 if (pi
->mvdd_control
) {
4130 if (mclk
<= pi
->mvdd_split_frequency
)
4133 voltage
->index
= (u8
)(si_pi
->mvdd_voltage_table
.count
) - 1;
4135 voltage
->value
= cpu_to_be16(si_pi
->mvdd_voltage_table
.entries
[voltage
->index
].value
);
4140 static int si_get_std_voltage_value(struct radeon_device
*rdev
,
4141 SISLANDS_SMC_VOLTAGE_VALUE
*voltage
,
4145 bool voltage_found
= false;
4146 *std_voltage
= be16_to_cpu(voltage
->value
);
4148 if (rdev
->pm
.dpm
.dyn_state
.cac_leakage_table
.entries
) {
4149 if (rdev
->pm
.dpm
.platform_caps
& ATOM_PP_PLATFORM_CAP_NEW_CAC_VOLTAGE
) {
4150 if (rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_sclk
.entries
== NULL
)
4153 for (v_index
= 0; (u32
)v_index
< rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_sclk
.count
; v_index
++) {
4154 if (be16_to_cpu(voltage
->value
) ==
4155 (u16
)rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_sclk
.entries
[v_index
].v
) {
4156 voltage_found
= true;
4157 if ((u32
)v_index
< rdev
->pm
.dpm
.dyn_state
.cac_leakage_table
.count
)
4159 rdev
->pm
.dpm
.dyn_state
.cac_leakage_table
.entries
[v_index
].vddc
;
4162 rdev
->pm
.dpm
.dyn_state
.cac_leakage_table
.entries
[rdev
->pm
.dpm
.dyn_state
.cac_leakage_table
.count
-1].vddc
;
4167 if (!voltage_found
) {
4168 for (v_index
= 0; (u32
)v_index
< rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_sclk
.count
; v_index
++) {
4169 if (be16_to_cpu(voltage
->value
) <=
4170 (u16
)rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_sclk
.entries
[v_index
].v
) {
4171 voltage_found
= true;
4172 if ((u32
)v_index
< rdev
->pm
.dpm
.dyn_state
.cac_leakage_table
.count
)
4174 rdev
->pm
.dpm
.dyn_state
.cac_leakage_table
.entries
[v_index
].vddc
;
4177 rdev
->pm
.dpm
.dyn_state
.cac_leakage_table
.entries
[rdev
->pm
.dpm
.dyn_state
.cac_leakage_table
.count
-1].vddc
;
4183 if ((u32
)voltage
->index
< rdev
->pm
.dpm
.dyn_state
.cac_leakage_table
.count
)
4184 *std_voltage
= rdev
->pm
.dpm
.dyn_state
.cac_leakage_table
.entries
[voltage
->index
].vddc
;
4191 static int si_populate_std_voltage_value(struct radeon_device
*rdev
,
4192 u16 value
, u8 index
,
4193 SISLANDS_SMC_VOLTAGE_VALUE
*voltage
)
4195 voltage
->index
= index
;
4196 voltage
->value
= cpu_to_be16(value
);
4201 static int si_populate_phase_shedding_value(struct radeon_device
*rdev
,
4202 const struct radeon_phase_shedding_limits_table
*limits
,
4203 u16 voltage
, u32 sclk
, u32 mclk
,
4204 SISLANDS_SMC_VOLTAGE_VALUE
*smc_voltage
)
4208 for (i
= 0; i
< limits
->count
; i
++) {
4209 if ((voltage
<= limits
->entries
[i
].voltage
) &&
4210 (sclk
<= limits
->entries
[i
].sclk
) &&
4211 (mclk
<= limits
->entries
[i
].mclk
))
4215 smc_voltage
->phase_settings
= (u8
)i
;
4220 static int si_init_arb_table_index(struct radeon_device
*rdev
)
4222 struct si_power_info
*si_pi
= si_get_pi(rdev
);
4226 ret
= si_read_smc_sram_dword(rdev
, si_pi
->arb_table_start
, &tmp
, si_pi
->sram_end
);
4231 tmp
|= MC_CG_ARB_FREQ_F1
<< 24;
4233 return si_write_smc_sram_dword(rdev
, si_pi
->arb_table_start
, tmp
, si_pi
->sram_end
);
4236 static int si_initial_switch_from_arb_f0_to_f1(struct radeon_device
*rdev
)
4238 return ni_copy_and_switch_arb_sets(rdev
, MC_CG_ARB_FREQ_F0
, MC_CG_ARB_FREQ_F1
);
4241 static int si_reset_to_default(struct radeon_device
*rdev
)
4243 return (si_send_msg_to_smc(rdev
, PPSMC_MSG_ResetToDefaults
) == PPSMC_Result_OK
) ?
4247 static int si_force_switch_to_arb_f0(struct radeon_device
*rdev
)
4249 struct si_power_info
*si_pi
= si_get_pi(rdev
);
4253 ret
= si_read_smc_sram_dword(rdev
, si_pi
->arb_table_start
,
4254 &tmp
, si_pi
->sram_end
);
4258 tmp
= (tmp
>> 24) & 0xff;
4260 if (tmp
== MC_CG_ARB_FREQ_F0
)
4263 return ni_copy_and_switch_arb_sets(rdev
, tmp
, MC_CG_ARB_FREQ_F0
);
4266 static u32
si_calculate_memory_refresh_rate(struct radeon_device
*rdev
,
4270 u32 dram_refresh_rate
;
4271 u32 mc_arb_rfsh_rate
;
4272 u32 tmp
= (RREG32(MC_ARB_RAMCFG
) & NOOFROWS_MASK
) >> NOOFROWS_SHIFT
;
4277 dram_rows
= 1 << (tmp
+ 10);
4279 dram_refresh_rate
= 1 << ((RREG32(MC_SEQ_MISC0
) & 0x3) + 3);
4280 mc_arb_rfsh_rate
= ((engine_clock
* 10) * dram_refresh_rate
/ dram_rows
- 32) / 64;
4282 return mc_arb_rfsh_rate
;
4285 static int si_populate_memory_timing_parameters(struct radeon_device
*rdev
,
4286 struct rv7xx_pl
*pl
,
4287 SMC_SIslands_MCArbDramTimingRegisterSet
*arb_regs
)
4293 arb_regs
->mc_arb_rfsh_rate
=
4294 (u8
)si_calculate_memory_refresh_rate(rdev
, pl
->sclk
);
4296 radeon_atom_set_engine_dram_timings(rdev
,
4300 dram_timing
= RREG32(MC_ARB_DRAM_TIMING
);
4301 dram_timing2
= RREG32(MC_ARB_DRAM_TIMING2
);
4302 burst_time
= RREG32(MC_ARB_BURST_TIME
) & STATE0_MASK
;
4304 arb_regs
->mc_arb_dram_timing
= cpu_to_be32(dram_timing
);
4305 arb_regs
->mc_arb_dram_timing2
= cpu_to_be32(dram_timing2
);
4306 arb_regs
->mc_arb_burst_time
= (u8
)burst_time
;
4311 static int si_do_program_memory_timing_parameters(struct radeon_device
*rdev
,
4312 struct radeon_ps
*radeon_state
,
4313 unsigned int first_arb_set
)
4315 struct si_power_info
*si_pi
= si_get_pi(rdev
);
4316 struct ni_ps
*state
= ni_get_ps(radeon_state
);
4317 SMC_SIslands_MCArbDramTimingRegisterSet arb_regs
= { 0 };
4320 for (i
= 0; i
< state
->performance_level_count
; i
++) {
4321 ret
= si_populate_memory_timing_parameters(rdev
, &state
->performance_levels
[i
], &arb_regs
);
4324 ret
= si_copy_bytes_to_smc(rdev
,
4325 si_pi
->arb_table_start
+
4326 offsetof(SMC_SIslands_MCArbDramTimingRegisters
, data
) +
4327 sizeof(SMC_SIslands_MCArbDramTimingRegisterSet
) * (first_arb_set
+ i
),
4329 sizeof(SMC_SIslands_MCArbDramTimingRegisterSet
),
4338 static int si_program_memory_timing_parameters(struct radeon_device
*rdev
,
4339 struct radeon_ps
*radeon_new_state
)
4341 return si_do_program_memory_timing_parameters(rdev
, radeon_new_state
,
4342 SISLANDS_DRIVER_STATE_ARB_INDEX
);
4345 static int si_populate_initial_mvdd_value(struct radeon_device
*rdev
,
4346 struct SISLANDS_SMC_VOLTAGE_VALUE
*voltage
)
4348 struct rv7xx_power_info
*pi
= rv770_get_pi(rdev
);
4349 struct si_power_info
*si_pi
= si_get_pi(rdev
);
4351 if (pi
->mvdd_control
)
4352 return si_populate_voltage_value(rdev
, &si_pi
->mvdd_voltage_table
,
4353 si_pi
->mvdd_bootup_value
, voltage
);
4358 static int si_populate_smc_initial_state(struct radeon_device
*rdev
,
4359 struct radeon_ps
*radeon_initial_state
,
4360 SISLANDS_SMC_STATETABLE
*table
)
4362 struct ni_ps
*initial_state
= ni_get_ps(radeon_initial_state
);
4363 struct rv7xx_power_info
*pi
= rv770_get_pi(rdev
);
4364 struct evergreen_power_info
*eg_pi
= evergreen_get_pi(rdev
);
4365 struct si_power_info
*si_pi
= si_get_pi(rdev
);
4369 table
->initialState
.levels
[0].mclk
.vDLL_CNTL
=
4370 cpu_to_be32(si_pi
->clock_registers
.dll_cntl
);
4371 table
->initialState
.levels
[0].mclk
.vMCLK_PWRMGT_CNTL
=
4372 cpu_to_be32(si_pi
->clock_registers
.mclk_pwrmgt_cntl
);
4373 table
->initialState
.levels
[0].mclk
.vMPLL_AD_FUNC_CNTL
=
4374 cpu_to_be32(si_pi
->clock_registers
.mpll_ad_func_cntl
);
4375 table
->initialState
.levels
[0].mclk
.vMPLL_DQ_FUNC_CNTL
=
4376 cpu_to_be32(si_pi
->clock_registers
.mpll_dq_func_cntl
);
4377 table
->initialState
.levels
[0].mclk
.vMPLL_FUNC_CNTL
=
4378 cpu_to_be32(si_pi
->clock_registers
.mpll_func_cntl
);
4379 table
->initialState
.levels
[0].mclk
.vMPLL_FUNC_CNTL_1
=
4380 cpu_to_be32(si_pi
->clock_registers
.mpll_func_cntl_1
);
4381 table
->initialState
.levels
[0].mclk
.vMPLL_FUNC_CNTL_2
=
4382 cpu_to_be32(si_pi
->clock_registers
.mpll_func_cntl_2
);
4383 table
->initialState
.levels
[0].mclk
.vMPLL_SS
=
4384 cpu_to_be32(si_pi
->clock_registers
.mpll_ss1
);
4385 table
->initialState
.levels
[0].mclk
.vMPLL_SS2
=
4386 cpu_to_be32(si_pi
->clock_registers
.mpll_ss2
);
4388 table
->initialState
.levels
[0].mclk
.mclk_value
=
4389 cpu_to_be32(initial_state
->performance_levels
[0].mclk
);
4391 table
->initialState
.levels
[0].sclk
.vCG_SPLL_FUNC_CNTL
=
4392 cpu_to_be32(si_pi
->clock_registers
.cg_spll_func_cntl
);
4393 table
->initialState
.levels
[0].sclk
.vCG_SPLL_FUNC_CNTL_2
=
4394 cpu_to_be32(si_pi
->clock_registers
.cg_spll_func_cntl_2
);
4395 table
->initialState
.levels
[0].sclk
.vCG_SPLL_FUNC_CNTL_3
=
4396 cpu_to_be32(si_pi
->clock_registers
.cg_spll_func_cntl_3
);
4397 table
->initialState
.levels
[0].sclk
.vCG_SPLL_FUNC_CNTL_4
=
4398 cpu_to_be32(si_pi
->clock_registers
.cg_spll_func_cntl_4
);
4399 table
->initialState
.levels
[0].sclk
.vCG_SPLL_SPREAD_SPECTRUM
=
4400 cpu_to_be32(si_pi
->clock_registers
.cg_spll_spread_spectrum
);
4401 table
->initialState
.levels
[0].sclk
.vCG_SPLL_SPREAD_SPECTRUM_2
=
4402 cpu_to_be32(si_pi
->clock_registers
.cg_spll_spread_spectrum_2
);
4404 table
->initialState
.levels
[0].sclk
.sclk_value
=
4405 cpu_to_be32(initial_state
->performance_levels
[0].sclk
);
4407 table
->initialState
.levels
[0].arbRefreshState
=
4408 SISLANDS_INITIAL_STATE_ARB_INDEX
;
4410 table
->initialState
.levels
[0].ACIndex
= 0;
4412 ret
= si_populate_voltage_value(rdev
, &eg_pi
->vddc_voltage_table
,
4413 initial_state
->performance_levels
[0].vddc
,
4414 &table
->initialState
.levels
[0].vddc
);
4419 ret
= si_get_std_voltage_value(rdev
,
4420 &table
->initialState
.levels
[0].vddc
,
4423 si_populate_std_voltage_value(rdev
, std_vddc
,
4424 table
->initialState
.levels
[0].vddc
.index
,
4425 &table
->initialState
.levels
[0].std_vddc
);
4428 if (eg_pi
->vddci_control
)
4429 si_populate_voltage_value(rdev
,
4430 &eg_pi
->vddci_voltage_table
,
4431 initial_state
->performance_levels
[0].vddci
,
4432 &table
->initialState
.levels
[0].vddci
);
4434 if (si_pi
->vddc_phase_shed_control
)
4435 si_populate_phase_shedding_value(rdev
,
4436 &rdev
->pm
.dpm
.dyn_state
.phase_shedding_limits_table
,
4437 initial_state
->performance_levels
[0].vddc
,
4438 initial_state
->performance_levels
[0].sclk
,
4439 initial_state
->performance_levels
[0].mclk
,
4440 &table
->initialState
.levels
[0].vddc
);
4442 si_populate_initial_mvdd_value(rdev
, &table
->initialState
.levels
[0].mvdd
);
4444 reg
= CG_R(0xffff) | CG_L(0);
4445 table
->initialState
.levels
[0].aT
= cpu_to_be32(reg
);
4447 table
->initialState
.levels
[0].bSP
= cpu_to_be32(pi
->dsp
);
4449 table
->initialState
.levels
[0].gen2PCIE
= (u8
)si_pi
->boot_pcie_gen
;
4451 if (pi
->mem_gddr5
) {
4452 table
->initialState
.levels
[0].strobeMode
=
4453 si_get_strobe_mode_settings(rdev
,
4454 initial_state
->performance_levels
[0].mclk
);
4456 if (initial_state
->performance_levels
[0].mclk
> pi
->mclk_edc_enable_threshold
)
4457 table
->initialState
.levels
[0].mcFlags
= SISLANDS_SMC_MC_EDC_RD_FLAG
| SISLANDS_SMC_MC_EDC_WR_FLAG
;
4459 table
->initialState
.levels
[0].mcFlags
= 0;
4462 table
->initialState
.levelCount
= 1;
4464 table
->initialState
.flags
|= PPSMC_SWSTATE_FLAG_DC
;
4466 table
->initialState
.levels
[0].dpm2
.MaxPS
= 0;
4467 table
->initialState
.levels
[0].dpm2
.NearTDPDec
= 0;
4468 table
->initialState
.levels
[0].dpm2
.AboveSafeInc
= 0;
4469 table
->initialState
.levels
[0].dpm2
.BelowSafeInc
= 0;
4470 table
->initialState
.levels
[0].dpm2
.PwrEfficiencyRatio
= 0;
4472 reg
= MIN_POWER_MASK
| MAX_POWER_MASK
;
4473 table
->initialState
.levels
[0].SQPowerThrottle
= cpu_to_be32(reg
);
4475 reg
= MAX_POWER_DELTA_MASK
| STI_SIZE_MASK
| LTI_RATIO_MASK
;
4476 table
->initialState
.levels
[0].SQPowerThrottle_2
= cpu_to_be32(reg
);
4481 static int si_populate_smc_acpi_state(struct radeon_device
*rdev
,
4482 SISLANDS_SMC_STATETABLE
*table
)
4484 struct rv7xx_power_info
*pi
= rv770_get_pi(rdev
);
4485 struct evergreen_power_info
*eg_pi
= evergreen_get_pi(rdev
);
4486 struct si_power_info
*si_pi
= si_get_pi(rdev
);
4487 u32 spll_func_cntl
= si_pi
->clock_registers
.cg_spll_func_cntl
;
4488 u32 spll_func_cntl_2
= si_pi
->clock_registers
.cg_spll_func_cntl_2
;
4489 u32 spll_func_cntl_3
= si_pi
->clock_registers
.cg_spll_func_cntl_3
;
4490 u32 spll_func_cntl_4
= si_pi
->clock_registers
.cg_spll_func_cntl_4
;
4491 u32 dll_cntl
= si_pi
->clock_registers
.dll_cntl
;
4492 u32 mclk_pwrmgt_cntl
= si_pi
->clock_registers
.mclk_pwrmgt_cntl
;
4493 u32 mpll_ad_func_cntl
= si_pi
->clock_registers
.mpll_ad_func_cntl
;
4494 u32 mpll_dq_func_cntl
= si_pi
->clock_registers
.mpll_dq_func_cntl
;
4495 u32 mpll_func_cntl
= si_pi
->clock_registers
.mpll_func_cntl
;
4496 u32 mpll_func_cntl_1
= si_pi
->clock_registers
.mpll_func_cntl_1
;
4497 u32 mpll_func_cntl_2
= si_pi
->clock_registers
.mpll_func_cntl_2
;
4501 table
->ACPIState
= table
->initialState
;
4503 table
->ACPIState
.flags
&= ~PPSMC_SWSTATE_FLAG_DC
;
4505 if (pi
->acpi_vddc
) {
4506 ret
= si_populate_voltage_value(rdev
, &eg_pi
->vddc_voltage_table
,
4507 pi
->acpi_vddc
, &table
->ACPIState
.levels
[0].vddc
);
4511 ret
= si_get_std_voltage_value(rdev
,
4512 &table
->ACPIState
.levels
[0].vddc
, &std_vddc
);
4514 si_populate_std_voltage_value(rdev
, std_vddc
,
4515 table
->ACPIState
.levels
[0].vddc
.index
,
4516 &table
->ACPIState
.levels
[0].std_vddc
);
4518 table
->ACPIState
.levels
[0].gen2PCIE
= si_pi
->acpi_pcie_gen
;
4520 if (si_pi
->vddc_phase_shed_control
) {
4521 si_populate_phase_shedding_value(rdev
,
4522 &rdev
->pm
.dpm
.dyn_state
.phase_shedding_limits_table
,
4526 &table
->ACPIState
.levels
[0].vddc
);
4529 ret
= si_populate_voltage_value(rdev
, &eg_pi
->vddc_voltage_table
,
4530 pi
->min_vddc_in_table
, &table
->ACPIState
.levels
[0].vddc
);
4534 ret
= si_get_std_voltage_value(rdev
,
4535 &table
->ACPIState
.levels
[0].vddc
, &std_vddc
);
4538 si_populate_std_voltage_value(rdev
, std_vddc
,
4539 table
->ACPIState
.levels
[0].vddc
.index
,
4540 &table
->ACPIState
.levels
[0].std_vddc
);
4542 table
->ACPIState
.levels
[0].gen2PCIE
= (u8
)r600_get_pcie_gen_support(rdev
,
4543 si_pi
->sys_pcie_mask
,
4544 si_pi
->boot_pcie_gen
,
4547 if (si_pi
->vddc_phase_shed_control
)
4548 si_populate_phase_shedding_value(rdev
,
4549 &rdev
->pm
.dpm
.dyn_state
.phase_shedding_limits_table
,
4550 pi
->min_vddc_in_table
,
4553 &table
->ACPIState
.levels
[0].vddc
);
4556 if (pi
->acpi_vddc
) {
4557 if (eg_pi
->acpi_vddci
)
4558 si_populate_voltage_value(rdev
, &eg_pi
->vddci_voltage_table
,
4560 &table
->ACPIState
.levels
[0].vddci
);
4563 mclk_pwrmgt_cntl
|= MRDCK0_RESET
| MRDCK1_RESET
;
4564 mclk_pwrmgt_cntl
&= ~(MRDCK0_PDNB
| MRDCK1_PDNB
);
4566 dll_cntl
&= ~(MRDCK0_BYPASS
| MRDCK1_BYPASS
);
4568 spll_func_cntl_2
&= ~SCLK_MUX_SEL_MASK
;
4569 spll_func_cntl_2
|= SCLK_MUX_SEL(4);
4571 table
->ACPIState
.levels
[0].mclk
.vDLL_CNTL
=
4572 cpu_to_be32(dll_cntl
);
4573 table
->ACPIState
.levels
[0].mclk
.vMCLK_PWRMGT_CNTL
=
4574 cpu_to_be32(mclk_pwrmgt_cntl
);
4575 table
->ACPIState
.levels
[0].mclk
.vMPLL_AD_FUNC_CNTL
=
4576 cpu_to_be32(mpll_ad_func_cntl
);
4577 table
->ACPIState
.levels
[0].mclk
.vMPLL_DQ_FUNC_CNTL
=
4578 cpu_to_be32(mpll_dq_func_cntl
);
4579 table
->ACPIState
.levels
[0].mclk
.vMPLL_FUNC_CNTL
=
4580 cpu_to_be32(mpll_func_cntl
);
4581 table
->ACPIState
.levels
[0].mclk
.vMPLL_FUNC_CNTL_1
=
4582 cpu_to_be32(mpll_func_cntl_1
);
4583 table
->ACPIState
.levels
[0].mclk
.vMPLL_FUNC_CNTL_2
=
4584 cpu_to_be32(mpll_func_cntl_2
);
4585 table
->ACPIState
.levels
[0].mclk
.vMPLL_SS
=
4586 cpu_to_be32(si_pi
->clock_registers
.mpll_ss1
);
4587 table
->ACPIState
.levels
[0].mclk
.vMPLL_SS2
=
4588 cpu_to_be32(si_pi
->clock_registers
.mpll_ss2
);
4590 table
->ACPIState
.levels
[0].sclk
.vCG_SPLL_FUNC_CNTL
=
4591 cpu_to_be32(spll_func_cntl
);
4592 table
->ACPIState
.levels
[0].sclk
.vCG_SPLL_FUNC_CNTL_2
=
4593 cpu_to_be32(spll_func_cntl_2
);
4594 table
->ACPIState
.levels
[0].sclk
.vCG_SPLL_FUNC_CNTL_3
=
4595 cpu_to_be32(spll_func_cntl_3
);
4596 table
->ACPIState
.levels
[0].sclk
.vCG_SPLL_FUNC_CNTL_4
=
4597 cpu_to_be32(spll_func_cntl_4
);
4599 table
->ACPIState
.levels
[0].mclk
.mclk_value
= 0;
4600 table
->ACPIState
.levels
[0].sclk
.sclk_value
= 0;
4602 si_populate_mvdd_value(rdev
, 0, &table
->ACPIState
.levels
[0].mvdd
);
4604 if (eg_pi
->dynamic_ac_timing
)
4605 table
->ACPIState
.levels
[0].ACIndex
= 0;
4607 table
->ACPIState
.levels
[0].dpm2
.MaxPS
= 0;
4608 table
->ACPIState
.levels
[0].dpm2
.NearTDPDec
= 0;
4609 table
->ACPIState
.levels
[0].dpm2
.AboveSafeInc
= 0;
4610 table
->ACPIState
.levels
[0].dpm2
.BelowSafeInc
= 0;
4611 table
->ACPIState
.levels
[0].dpm2
.PwrEfficiencyRatio
= 0;
4613 reg
= MIN_POWER_MASK
| MAX_POWER_MASK
;
4614 table
->ACPIState
.levels
[0].SQPowerThrottle
= cpu_to_be32(reg
);
4616 reg
= MAX_POWER_DELTA_MASK
| STI_SIZE_MASK
| LTI_RATIO_MASK
;
4617 table
->ACPIState
.levels
[0].SQPowerThrottle_2
= cpu_to_be32(reg
);
4622 static int si_populate_ulv_state(struct radeon_device
*rdev
,
4623 SISLANDS_SMC_SWSTATE
*state
)
4625 struct evergreen_power_info
*eg_pi
= evergreen_get_pi(rdev
);
4626 struct si_power_info
*si_pi
= si_get_pi(rdev
);
4627 struct si_ulv_param
*ulv
= &si_pi
->ulv
;
4628 u32 sclk_in_sr
= 1350; /* ??? */
4631 ret
= si_convert_power_level_to_smc(rdev
, &ulv
->pl
,
4634 if (eg_pi
->sclk_deep_sleep
) {
4635 if (sclk_in_sr
<= SCLK_MIN_DEEPSLEEP_FREQ
)
4636 state
->levels
[0].stateFlags
|= PPSMC_STATEFLAG_DEEPSLEEP_BYPASS
;
4638 state
->levels
[0].stateFlags
|= PPSMC_STATEFLAG_DEEPSLEEP_THROTTLE
;
4640 if (ulv
->one_pcie_lane_in_ulv
)
4641 state
->flags
|= PPSMC_SWSTATE_FLAG_PCIE_X1
;
4642 state
->levels
[0].arbRefreshState
= (u8
)(SISLANDS_ULV_STATE_ARB_INDEX
);
4643 state
->levels
[0].ACIndex
= 1;
4644 state
->levels
[0].std_vddc
= state
->levels
[0].vddc
;
4645 state
->levelCount
= 1;
4647 state
->flags
|= PPSMC_SWSTATE_FLAG_DC
;
4653 static int si_program_ulv_memory_timing_parameters(struct radeon_device
*rdev
)
4655 struct si_power_info
*si_pi
= si_get_pi(rdev
);
4656 struct si_ulv_param
*ulv
= &si_pi
->ulv
;
4657 SMC_SIslands_MCArbDramTimingRegisterSet arb_regs
= { 0 };
4660 ret
= si_populate_memory_timing_parameters(rdev
, &ulv
->pl
,
4665 si_write_smc_soft_register(rdev
, SI_SMC_SOFT_REGISTER_ulv_volt_change_delay
,
4666 ulv
->volt_change_delay
);
4668 ret
= si_copy_bytes_to_smc(rdev
,
4669 si_pi
->arb_table_start
+
4670 offsetof(SMC_SIslands_MCArbDramTimingRegisters
, data
) +
4671 sizeof(SMC_SIslands_MCArbDramTimingRegisterSet
) * SISLANDS_ULV_STATE_ARB_INDEX
,
4673 sizeof(SMC_SIslands_MCArbDramTimingRegisterSet
),
4679 static void si_get_mvdd_configuration(struct radeon_device
*rdev
)
4681 struct rv7xx_power_info
*pi
= rv770_get_pi(rdev
);
4683 pi
->mvdd_split_frequency
= 30000;
4686 static int si_init_smc_table(struct radeon_device
*rdev
)
4688 struct rv7xx_power_info
*pi
= rv770_get_pi(rdev
);
4689 struct si_power_info
*si_pi
= si_get_pi(rdev
);
4690 struct radeon_ps
*radeon_boot_state
= rdev
->pm
.dpm
.boot_ps
;
4691 const struct si_ulv_param
*ulv
= &si_pi
->ulv
;
4692 SISLANDS_SMC_STATETABLE
*table
= &si_pi
->smc_statetable
;
4697 si_populate_smc_voltage_tables(rdev
, table
);
4699 switch (rdev
->pm
.int_thermal_type
) {
4700 case THERMAL_TYPE_SI
:
4701 case THERMAL_TYPE_EMC2103_WITH_INTERNAL
:
4702 table
->thermalProtectType
= PPSMC_THERMAL_PROTECT_TYPE_INTERNAL
;
4704 case THERMAL_TYPE_NONE
:
4705 table
->thermalProtectType
= PPSMC_THERMAL_PROTECT_TYPE_NONE
;
4708 table
->thermalProtectType
= PPSMC_THERMAL_PROTECT_TYPE_EXTERNAL
;
4712 if (rdev
->pm
.dpm
.platform_caps
& ATOM_PP_PLATFORM_CAP_HARDWAREDC
)
4713 table
->systemFlags
|= PPSMC_SYSTEMFLAG_GPIO_DC
;
4715 if (rdev
->pm
.dpm
.platform_caps
& ATOM_PP_PLATFORM_CAP_REGULATOR_HOT
) {
4716 if ((rdev
->pdev
->device
!= 0x6818) && (rdev
->pdev
->device
!= 0x6819))
4717 table
->systemFlags
|= PPSMC_SYSTEMFLAG_REGULATOR_HOT
;
4720 if (rdev
->pm
.dpm
.platform_caps
& ATOM_PP_PLATFORM_CAP_STEPVDDC
)
4721 table
->systemFlags
|= PPSMC_SYSTEMFLAG_STEPVDDC
;
4724 table
->systemFlags
|= PPSMC_SYSTEMFLAG_GDDR5
;
4726 if (rdev
->pm
.dpm
.platform_caps
& ATOM_PP_PLATFORM_CAP_REVERT_GPIO5_POLARITY
)
4727 table
->extraFlags
|= PPSMC_EXTRAFLAGS_AC2DC_GPIO5_POLARITY_HIGH
;
4729 if (rdev
->pm
.dpm
.platform_caps
& ATOM_PP_PLATFORM_CAP_VRHOT_GPIO_CONFIGURABLE
) {
4730 table
->systemFlags
|= PPSMC_SYSTEMFLAG_REGULATOR_HOT_PROG_GPIO
;
4731 vr_hot_gpio
= rdev
->pm
.dpm
.backbias_response_time
;
4732 si_write_smc_soft_register(rdev
, SI_SMC_SOFT_REGISTER_vr_hot_gpio
,
4736 ret
= si_populate_smc_initial_state(rdev
, radeon_boot_state
, table
);
4740 ret
= si_populate_smc_acpi_state(rdev
, table
);
4744 table
->driverState
= table
->initialState
;
4746 ret
= si_do_program_memory_timing_parameters(rdev
, radeon_boot_state
,
4747 SISLANDS_INITIAL_STATE_ARB_INDEX
);
4751 if (ulv
->supported
&& ulv
->pl
.vddc
) {
4752 ret
= si_populate_ulv_state(rdev
, &table
->ULVState
);
4756 ret
= si_program_ulv_memory_timing_parameters(rdev
);
4760 WREG32(CG_ULV_CONTROL
, ulv
->cg_ulv_control
);
4761 WREG32(CG_ULV_PARAMETER
, ulv
->cg_ulv_parameter
);
4763 lane_width
= radeon_get_pcie_lanes(rdev
);
4764 si_write_smc_soft_register(rdev
, SI_SMC_SOFT_REGISTER_non_ulv_pcie_link_width
, lane_width
);
4766 table
->ULVState
= table
->initialState
;
4769 return si_copy_bytes_to_smc(rdev
, si_pi
->state_table_start
,
4770 (u8
*)table
, sizeof(SISLANDS_SMC_STATETABLE
),
4774 static int si_calculate_sclk_params(struct radeon_device
*rdev
,
4776 SISLANDS_SMC_SCLK_VALUE
*sclk
)
4778 struct rv7xx_power_info
*pi
= rv770_get_pi(rdev
);
4779 struct si_power_info
*si_pi
= si_get_pi(rdev
);
4780 struct atom_clock_dividers dividers
;
4781 u32 spll_func_cntl
= si_pi
->clock_registers
.cg_spll_func_cntl
;
4782 u32 spll_func_cntl_2
= si_pi
->clock_registers
.cg_spll_func_cntl_2
;
4783 u32 spll_func_cntl_3
= si_pi
->clock_registers
.cg_spll_func_cntl_3
;
4784 u32 spll_func_cntl_4
= si_pi
->clock_registers
.cg_spll_func_cntl_4
;
4785 u32 cg_spll_spread_spectrum
= si_pi
->clock_registers
.cg_spll_spread_spectrum
;
4786 u32 cg_spll_spread_spectrum_2
= si_pi
->clock_registers
.cg_spll_spread_spectrum_2
;
4788 u32 reference_clock
= rdev
->clock
.spll
.reference_freq
;
4789 u32 reference_divider
;
4793 ret
= radeon_atom_get_clock_dividers(rdev
, COMPUTE_ENGINE_PLL_PARAM
,
4794 engine_clock
, false, ÷rs
);
4798 reference_divider
= 1 + dividers
.ref_div
;
4800 tmp
= (u64
) engine_clock
* reference_divider
* dividers
.post_div
* 16384;
4801 do_div(tmp
, reference_clock
);
4804 spll_func_cntl
&= ~(SPLL_PDIV_A_MASK
| SPLL_REF_DIV_MASK
);
4805 spll_func_cntl
|= SPLL_REF_DIV(dividers
.ref_div
);
4806 spll_func_cntl
|= SPLL_PDIV_A(dividers
.post_div
);
4808 spll_func_cntl_2
&= ~SCLK_MUX_SEL_MASK
;
4809 spll_func_cntl_2
|= SCLK_MUX_SEL(2);
4811 spll_func_cntl_3
&= ~SPLL_FB_DIV_MASK
;
4812 spll_func_cntl_3
|= SPLL_FB_DIV(fbdiv
);
4813 spll_func_cntl_3
|= SPLL_DITHEN
;
4816 struct radeon_atom_ss ss
;
4817 u32 vco_freq
= engine_clock
* dividers
.post_div
;
4819 if (radeon_atombios_get_asic_ss_info(rdev
, &ss
,
4820 ASIC_INTERNAL_ENGINE_SS
, vco_freq
)) {
4821 u32 clk_s
= reference_clock
* 5 / (reference_divider
* ss
.rate
);
4822 u32 clk_v
= 4 * ss
.percentage
* fbdiv
/ (clk_s
* 10000);
4824 cg_spll_spread_spectrum
&= ~CLK_S_MASK
;
4825 cg_spll_spread_spectrum
|= CLK_S(clk_s
);
4826 cg_spll_spread_spectrum
|= SSEN
;
4828 cg_spll_spread_spectrum_2
&= ~CLK_V_MASK
;
4829 cg_spll_spread_spectrum_2
|= CLK_V(clk_v
);
4833 sclk
->sclk_value
= engine_clock
;
4834 sclk
->vCG_SPLL_FUNC_CNTL
= spll_func_cntl
;
4835 sclk
->vCG_SPLL_FUNC_CNTL_2
= spll_func_cntl_2
;
4836 sclk
->vCG_SPLL_FUNC_CNTL_3
= spll_func_cntl_3
;
4837 sclk
->vCG_SPLL_FUNC_CNTL_4
= spll_func_cntl_4
;
4838 sclk
->vCG_SPLL_SPREAD_SPECTRUM
= cg_spll_spread_spectrum
;
4839 sclk
->vCG_SPLL_SPREAD_SPECTRUM_2
= cg_spll_spread_spectrum_2
;
4844 static int si_populate_sclk_value(struct radeon_device
*rdev
,
4846 SISLANDS_SMC_SCLK_VALUE
*sclk
)
4848 SISLANDS_SMC_SCLK_VALUE sclk_tmp
;
4851 ret
= si_calculate_sclk_params(rdev
, engine_clock
, &sclk_tmp
);
4853 sclk
->sclk_value
= cpu_to_be32(sclk_tmp
.sclk_value
);
4854 sclk
->vCG_SPLL_FUNC_CNTL
= cpu_to_be32(sclk_tmp
.vCG_SPLL_FUNC_CNTL
);
4855 sclk
->vCG_SPLL_FUNC_CNTL_2
= cpu_to_be32(sclk_tmp
.vCG_SPLL_FUNC_CNTL_2
);
4856 sclk
->vCG_SPLL_FUNC_CNTL_3
= cpu_to_be32(sclk_tmp
.vCG_SPLL_FUNC_CNTL_3
);
4857 sclk
->vCG_SPLL_FUNC_CNTL_4
= cpu_to_be32(sclk_tmp
.vCG_SPLL_FUNC_CNTL_4
);
4858 sclk
->vCG_SPLL_SPREAD_SPECTRUM
= cpu_to_be32(sclk_tmp
.vCG_SPLL_SPREAD_SPECTRUM
);
4859 sclk
->vCG_SPLL_SPREAD_SPECTRUM_2
= cpu_to_be32(sclk_tmp
.vCG_SPLL_SPREAD_SPECTRUM_2
);
4865 static int si_populate_mclk_value(struct radeon_device
*rdev
,
4868 SISLANDS_SMC_MCLK_VALUE
*mclk
,
4872 struct rv7xx_power_info
*pi
= rv770_get_pi(rdev
);
4873 struct si_power_info
*si_pi
= si_get_pi(rdev
);
4874 u32 dll_cntl
= si_pi
->clock_registers
.dll_cntl
;
4875 u32 mclk_pwrmgt_cntl
= si_pi
->clock_registers
.mclk_pwrmgt_cntl
;
4876 u32 mpll_ad_func_cntl
= si_pi
->clock_registers
.mpll_ad_func_cntl
;
4877 u32 mpll_dq_func_cntl
= si_pi
->clock_registers
.mpll_dq_func_cntl
;
4878 u32 mpll_func_cntl
= si_pi
->clock_registers
.mpll_func_cntl
;
4879 u32 mpll_func_cntl_1
= si_pi
->clock_registers
.mpll_func_cntl_1
;
4880 u32 mpll_func_cntl_2
= si_pi
->clock_registers
.mpll_func_cntl_2
;
4881 u32 mpll_ss1
= si_pi
->clock_registers
.mpll_ss1
;
4882 u32 mpll_ss2
= si_pi
->clock_registers
.mpll_ss2
;
4883 struct atom_mpll_param mpll_param
;
4886 ret
= radeon_atom_get_memory_pll_dividers(rdev
, memory_clock
, strobe_mode
, &mpll_param
);
4890 mpll_func_cntl
&= ~BWCTRL_MASK
;
4891 mpll_func_cntl
|= BWCTRL(mpll_param
.bwcntl
);
4893 mpll_func_cntl_1
&= ~(CLKF_MASK
| CLKFRAC_MASK
| VCO_MODE_MASK
);
4894 mpll_func_cntl_1
|= CLKF(mpll_param
.clkf
) |
4895 CLKFRAC(mpll_param
.clkfrac
) | VCO_MODE(mpll_param
.vco_mode
);
4897 mpll_ad_func_cntl
&= ~YCLK_POST_DIV_MASK
;
4898 mpll_ad_func_cntl
|= YCLK_POST_DIV(mpll_param
.post_div
);
4900 if (pi
->mem_gddr5
) {
4901 mpll_dq_func_cntl
&= ~(YCLK_SEL_MASK
| YCLK_POST_DIV_MASK
);
4902 mpll_dq_func_cntl
|= YCLK_SEL(mpll_param
.yclk_sel
) |
4903 YCLK_POST_DIV(mpll_param
.post_div
);
4907 struct radeon_atom_ss ss
;
4910 u32 reference_clock
= rdev
->clock
.mpll
.reference_freq
;
4913 freq_nom
= memory_clock
* 4;
4915 freq_nom
= memory_clock
* 2;
4917 tmp
= freq_nom
/ reference_clock
;
4919 if (radeon_atombios_get_asic_ss_info(rdev
, &ss
,
4920 ASIC_INTERNAL_MEMORY_SS
, freq_nom
)) {
4921 u32 clks
= reference_clock
* 5 / ss
.rate
;
4922 u32 clkv
= (u32
)((((131 * ss
.percentage
* ss
.rate
) / 100) * tmp
) / freq_nom
);
4924 mpll_ss1
&= ~CLKV_MASK
;
4925 mpll_ss1
|= CLKV(clkv
);
4927 mpll_ss2
&= ~CLKS_MASK
;
4928 mpll_ss2
|= CLKS(clks
);
4932 mclk_pwrmgt_cntl
&= ~DLL_SPEED_MASK
;
4933 mclk_pwrmgt_cntl
|= DLL_SPEED(mpll_param
.dll_speed
);
4936 mclk_pwrmgt_cntl
|= MRDCK0_PDNB
| MRDCK1_PDNB
;
4938 mclk_pwrmgt_cntl
&= ~(MRDCK0_PDNB
| MRDCK1_PDNB
);
4940 mclk
->mclk_value
= cpu_to_be32(memory_clock
);
4941 mclk
->vMPLL_FUNC_CNTL
= cpu_to_be32(mpll_func_cntl
);
4942 mclk
->vMPLL_FUNC_CNTL_1
= cpu_to_be32(mpll_func_cntl_1
);
4943 mclk
->vMPLL_FUNC_CNTL_2
= cpu_to_be32(mpll_func_cntl_2
);
4944 mclk
->vMPLL_AD_FUNC_CNTL
= cpu_to_be32(mpll_ad_func_cntl
);
4945 mclk
->vMPLL_DQ_FUNC_CNTL
= cpu_to_be32(mpll_dq_func_cntl
);
4946 mclk
->vMCLK_PWRMGT_CNTL
= cpu_to_be32(mclk_pwrmgt_cntl
);
4947 mclk
->vDLL_CNTL
= cpu_to_be32(dll_cntl
);
4948 mclk
->vMPLL_SS
= cpu_to_be32(mpll_ss1
);
4949 mclk
->vMPLL_SS2
= cpu_to_be32(mpll_ss2
);
4954 static void si_populate_smc_sp(struct radeon_device
*rdev
,
4955 struct radeon_ps
*radeon_state
,
4956 SISLANDS_SMC_SWSTATE
*smc_state
)
4958 struct ni_ps
*ps
= ni_get_ps(radeon_state
);
4959 struct rv7xx_power_info
*pi
= rv770_get_pi(rdev
);
4962 for (i
= 0; i
< ps
->performance_level_count
- 1; i
++)
4963 smc_state
->levels
[i
].bSP
= cpu_to_be32(pi
->dsp
);
4965 smc_state
->levels
[ps
->performance_level_count
- 1].bSP
=
4966 cpu_to_be32(pi
->psp
);
4969 static int si_convert_power_level_to_smc(struct radeon_device
*rdev
,
4970 struct rv7xx_pl
*pl
,
4971 SISLANDS_SMC_HW_PERFORMANCE_LEVEL
*level
)
4973 struct rv7xx_power_info
*pi
= rv770_get_pi(rdev
);
4974 struct evergreen_power_info
*eg_pi
= evergreen_get_pi(rdev
);
4975 struct si_power_info
*si_pi
= si_get_pi(rdev
);
4979 bool gmc_pg
= false;
4981 if (eg_pi
->pcie_performance_request
&&
4982 (si_pi
->force_pcie_gen
!= RADEON_PCIE_GEN_INVALID
))
4983 level
->gen2PCIE
= (u8
)si_pi
->force_pcie_gen
;
4985 level
->gen2PCIE
= (u8
)pl
->pcie_gen
;
4987 ret
= si_populate_sclk_value(rdev
, pl
->sclk
, &level
->sclk
);
4993 if (pi
->mclk_stutter_mode_threshold
&&
4994 (pl
->mclk
<= pi
->mclk_stutter_mode_threshold
) &&
4995 !eg_pi
->uvd_enabled
&&
4996 (RREG32(DPG_PIPE_STUTTER_CONTROL
) & STUTTER_ENABLE
) &&
4997 (rdev
->pm
.dpm
.new_active_crtc_count
<= 2)) {
4998 level
->mcFlags
|= SISLANDS_SMC_MC_STUTTER_EN
;
5001 level
->mcFlags
|= SISLANDS_SMC_MC_PG_EN
;
5004 if (pi
->mem_gddr5
) {
5005 if (pl
->mclk
> pi
->mclk_edc_enable_threshold
)
5006 level
->mcFlags
|= SISLANDS_SMC_MC_EDC_RD_FLAG
;
5008 if (pl
->mclk
> eg_pi
->mclk_edc_wr_enable_threshold
)
5009 level
->mcFlags
|= SISLANDS_SMC_MC_EDC_WR_FLAG
;
5011 level
->strobeMode
= si_get_strobe_mode_settings(rdev
, pl
->mclk
);
5013 if (level
->strobeMode
& SISLANDS_SMC_STROBE_ENABLE
) {
5014 if (si_get_mclk_frequency_ratio(pl
->mclk
, true) >=
5015 ((RREG32(MC_SEQ_MISC7
) >> 16) & 0xf))
5016 dll_state_on
= ((RREG32(MC_SEQ_MISC5
) >> 1) & 0x1) ? true : false;
5018 dll_state_on
= ((RREG32(MC_SEQ_MISC6
) >> 1) & 0x1) ? true : false;
5020 dll_state_on
= false;
5023 level
->strobeMode
= si_get_strobe_mode_settings(rdev
,
5026 dll_state_on
= ((RREG32(MC_SEQ_MISC5
) >> 1) & 0x1) ? true : false;
5029 ret
= si_populate_mclk_value(rdev
,
5033 (level
->strobeMode
& SISLANDS_SMC_STROBE_ENABLE
) != 0, dll_state_on
);
5037 ret
= si_populate_voltage_value(rdev
,
5038 &eg_pi
->vddc_voltage_table
,
5039 pl
->vddc
, &level
->vddc
);
5044 ret
= si_get_std_voltage_value(rdev
, &level
->vddc
, &std_vddc
);
5048 ret
= si_populate_std_voltage_value(rdev
, std_vddc
,
5049 level
->vddc
.index
, &level
->std_vddc
);
5053 if (eg_pi
->vddci_control
) {
5054 ret
= si_populate_voltage_value(rdev
, &eg_pi
->vddci_voltage_table
,
5055 pl
->vddci
, &level
->vddci
);
5060 if (si_pi
->vddc_phase_shed_control
) {
5061 ret
= si_populate_phase_shedding_value(rdev
,
5062 &rdev
->pm
.dpm
.dyn_state
.phase_shedding_limits_table
,
5071 level
->MaxPoweredUpCU
= si_pi
->max_cu
;
5073 ret
= si_populate_mvdd_value(rdev
, pl
->mclk
, &level
->mvdd
);
5078 static int si_populate_smc_t(struct radeon_device
*rdev
,
5079 struct radeon_ps
*radeon_state
,
5080 SISLANDS_SMC_SWSTATE
*smc_state
)
5082 struct rv7xx_power_info
*pi
= rv770_get_pi(rdev
);
5083 struct ni_ps
*state
= ni_get_ps(radeon_state
);
5089 if (state
->performance_level_count
>= 9)
5092 if (state
->performance_level_count
< 2) {
5093 a_t
= CG_R(0xffff) | CG_L(0);
5094 smc_state
->levels
[0].aT
= cpu_to_be32(a_t
);
5098 smc_state
->levels
[0].aT
= cpu_to_be32(0);
5100 for (i
= 0; i
<= state
->performance_level_count
- 2; i
++) {
5101 ret
= r600_calculate_at(
5102 (50 / SISLANDS_MAX_HARDWARE_POWERLEVELS
) * 100 * (i
+ 1),
5104 state
->performance_levels
[i
+ 1].sclk
,
5105 state
->performance_levels
[i
].sclk
,
5110 t_h
= (i
+ 1) * 1000 - 50 * R600_AH_DFLT
;
5111 t_l
= (i
+ 1) * 1000 + 50 * R600_AH_DFLT
;
5114 a_t
= be32_to_cpu(smc_state
->levels
[i
].aT
) & ~CG_R_MASK
;
5115 a_t
|= CG_R(t_l
* pi
->bsp
/ 20000);
5116 smc_state
->levels
[i
].aT
= cpu_to_be32(a_t
);
5118 high_bsp
= (i
== state
->performance_level_count
- 2) ?
5120 a_t
= CG_R(0xffff) | CG_L(t_h
* high_bsp
/ 20000);
5121 smc_state
->levels
[i
+ 1].aT
= cpu_to_be32(a_t
);
5127 static int si_disable_ulv(struct radeon_device
*rdev
)
5129 struct si_power_info
*si_pi
= si_get_pi(rdev
);
5130 struct si_ulv_param
*ulv
= &si_pi
->ulv
;
5133 return (si_send_msg_to_smc(rdev
, PPSMC_MSG_DisableULV
) == PPSMC_Result_OK
) ?
5139 static bool si_is_state_ulv_compatible(struct radeon_device
*rdev
,
5140 struct radeon_ps
*radeon_state
)
5142 const struct si_power_info
*si_pi
= si_get_pi(rdev
);
5143 const struct si_ulv_param
*ulv
= &si_pi
->ulv
;
5144 const struct ni_ps
*state
= ni_get_ps(radeon_state
);
5147 if (state
->performance_levels
[0].mclk
!= ulv
->pl
.mclk
)
5150 /* XXX validate against display requirements! */
5152 for (i
= 0; i
< rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_dispclk
.count
; i
++) {
5153 if (rdev
->clock
.current_dispclk
<=
5154 rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_dispclk
.entries
[i
].clk
) {
5156 rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_dispclk
.entries
[i
].v
)
5161 if ((radeon_state
->vclk
!= 0) || (radeon_state
->dclk
!= 0))
5167 static int si_set_power_state_conditionally_enable_ulv(struct radeon_device
*rdev
,
5168 struct radeon_ps
*radeon_new_state
)
5170 const struct si_power_info
*si_pi
= si_get_pi(rdev
);
5171 const struct si_ulv_param
*ulv
= &si_pi
->ulv
;
5173 if (ulv
->supported
) {
5174 if (si_is_state_ulv_compatible(rdev
, radeon_new_state
))
5175 return (si_send_msg_to_smc(rdev
, PPSMC_MSG_EnableULV
) == PPSMC_Result_OK
) ?
5181 static int si_convert_power_state_to_smc(struct radeon_device
*rdev
,
5182 struct radeon_ps
*radeon_state
,
5183 SISLANDS_SMC_SWSTATE
*smc_state
)
5185 struct evergreen_power_info
*eg_pi
= evergreen_get_pi(rdev
);
5186 struct ni_power_info
*ni_pi
= ni_get_pi(rdev
);
5187 struct si_power_info
*si_pi
= si_get_pi(rdev
);
5188 struct ni_ps
*state
= ni_get_ps(radeon_state
);
5191 u32 sclk_in_sr
= 1350; /* ??? */
5193 if (state
->performance_level_count
> SISLANDS_MAX_HARDWARE_POWERLEVELS
)
5196 threshold
= state
->performance_levels
[state
->performance_level_count
-1].sclk
* 100 / 100;
5198 if (radeon_state
->vclk
&& radeon_state
->dclk
) {
5199 eg_pi
->uvd_enabled
= true;
5200 if (eg_pi
->smu_uvd_hs
)
5201 smc_state
->flags
|= PPSMC_SWSTATE_FLAG_UVD
;
5203 eg_pi
->uvd_enabled
= false;
5206 if (state
->dc_compatible
)
5207 smc_state
->flags
|= PPSMC_SWSTATE_FLAG_DC
;
5209 smc_state
->levelCount
= 0;
5210 for (i
= 0; i
< state
->performance_level_count
; i
++) {
5211 if (eg_pi
->sclk_deep_sleep
) {
5212 if ((i
== 0) || si_pi
->sclk_deep_sleep_above_low
) {
5213 if (sclk_in_sr
<= SCLK_MIN_DEEPSLEEP_FREQ
)
5214 smc_state
->levels
[i
].stateFlags
|= PPSMC_STATEFLAG_DEEPSLEEP_BYPASS
;
5216 smc_state
->levels
[i
].stateFlags
|= PPSMC_STATEFLAG_DEEPSLEEP_THROTTLE
;
5220 ret
= si_convert_power_level_to_smc(rdev
, &state
->performance_levels
[i
],
5221 &smc_state
->levels
[i
]);
5222 smc_state
->levels
[i
].arbRefreshState
=
5223 (u8
)(SISLANDS_DRIVER_STATE_ARB_INDEX
+ i
);
5228 if (ni_pi
->enable_power_containment
)
5229 smc_state
->levels
[i
].displayWatermark
=
5230 (state
->performance_levels
[i
].sclk
< threshold
) ?
5231 PPSMC_DISPLAY_WATERMARK_LOW
: PPSMC_DISPLAY_WATERMARK_HIGH
;
5233 smc_state
->levels
[i
].displayWatermark
= (i
< 2) ?
5234 PPSMC_DISPLAY_WATERMARK_LOW
: PPSMC_DISPLAY_WATERMARK_HIGH
;
5236 if (eg_pi
->dynamic_ac_timing
)
5237 smc_state
->levels
[i
].ACIndex
= SISLANDS_MCREGISTERTABLE_FIRST_DRIVERSTATE_SLOT
+ i
;
5239 smc_state
->levels
[i
].ACIndex
= 0;
5241 smc_state
->levelCount
++;
5244 si_write_smc_soft_register(rdev
,
5245 SI_SMC_SOFT_REGISTER_watermark_threshold
,
5248 si_populate_smc_sp(rdev
, radeon_state
, smc_state
);
5250 ret
= si_populate_power_containment_values(rdev
, radeon_state
, smc_state
);
5252 ni_pi
->enable_power_containment
= false;
5254 ret
= si_populate_sq_ramping_values(rdev
, radeon_state
, smc_state
);
5256 ni_pi
->enable_sq_ramping
= false;
5258 return si_populate_smc_t(rdev
, radeon_state
, smc_state
);
5261 static int si_upload_sw_state(struct radeon_device
*rdev
,
5262 struct radeon_ps
*radeon_new_state
)
5264 struct si_power_info
*si_pi
= si_get_pi(rdev
);
5265 struct ni_ps
*new_state
= ni_get_ps(radeon_new_state
);
5267 u32 address
= si_pi
->state_table_start
+
5268 offsetof(SISLANDS_SMC_STATETABLE
, driverState
);
5269 u32 state_size
= sizeof(SISLANDS_SMC_SWSTATE
) +
5270 ((new_state
->performance_level_count
- 1) *
5271 sizeof(SISLANDS_SMC_HW_PERFORMANCE_LEVEL
));
5272 SISLANDS_SMC_SWSTATE
*smc_state
= &si_pi
->smc_statetable
.driverState
;
5274 memset(smc_state
, 0, state_size
);
5276 ret
= si_convert_power_state_to_smc(rdev
, radeon_new_state
, smc_state
);
5280 ret
= si_copy_bytes_to_smc(rdev
, address
, (u8
*)smc_state
,
5281 state_size
, si_pi
->sram_end
);
5286 static int si_upload_ulv_state(struct radeon_device
*rdev
)
5288 struct si_power_info
*si_pi
= si_get_pi(rdev
);
5289 struct si_ulv_param
*ulv
= &si_pi
->ulv
;
5292 if (ulv
->supported
&& ulv
->pl
.vddc
) {
5293 u32 address
= si_pi
->state_table_start
+
5294 offsetof(SISLANDS_SMC_STATETABLE
, ULVState
);
5295 SISLANDS_SMC_SWSTATE
*smc_state
= &si_pi
->smc_statetable
.ULVState
;
5296 u32 state_size
= sizeof(SISLANDS_SMC_SWSTATE
);
5298 memset(smc_state
, 0, state_size
);
5300 ret
= si_populate_ulv_state(rdev
, smc_state
);
5302 ret
= si_copy_bytes_to_smc(rdev
, address
, (u8
*)smc_state
,
5303 state_size
, si_pi
->sram_end
);
5309 static int si_upload_smc_data(struct radeon_device
*rdev
)
5311 struct radeon_crtc
*radeon_crtc
= NULL
;
5314 if (rdev
->pm
.dpm
.new_active_crtc_count
== 0)
5317 for (i
= 0; i
< rdev
->num_crtc
; i
++) {
5318 if (rdev
->pm
.dpm
.new_active_crtcs
& (1 << i
)) {
5319 radeon_crtc
= rdev
->mode_info
.crtcs
[i
];
5324 if (radeon_crtc
== NULL
)
5327 if (radeon_crtc
->line_time
<= 0)
5330 if (si_write_smc_soft_register(rdev
,
5331 SI_SMC_SOFT_REGISTER_crtc_index
,
5332 radeon_crtc
->crtc_id
) != PPSMC_Result_OK
)
5335 if (si_write_smc_soft_register(rdev
,
5336 SI_SMC_SOFT_REGISTER_mclk_change_block_cp_min
,
5337 radeon_crtc
->wm_high
/ radeon_crtc
->line_time
) != PPSMC_Result_OK
)
5340 if (si_write_smc_soft_register(rdev
,
5341 SI_SMC_SOFT_REGISTER_mclk_change_block_cp_max
,
5342 radeon_crtc
->wm_low
/ radeon_crtc
->line_time
) != PPSMC_Result_OK
)
5348 static int si_set_mc_special_registers(struct radeon_device
*rdev
,
5349 struct si_mc_reg_table
*table
)
5351 struct rv7xx_power_info
*pi
= rv770_get_pi(rdev
);
5355 for (i
= 0, j
= table
->last
; i
< table
->last
; i
++) {
5356 if (j
>= SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE
)
5358 switch (table
->mc_reg_address
[i
].s1
<< 2) {
5360 temp_reg
= RREG32(MC_PMG_CMD_EMRS
);
5361 table
->mc_reg_address
[j
].s1
= MC_PMG_CMD_EMRS
>> 2;
5362 table
->mc_reg_address
[j
].s0
= MC_SEQ_PMG_CMD_EMRS_LP
>> 2;
5363 for (k
= 0; k
< table
->num_entries
; k
++)
5364 table
->mc_reg_table_entry
[k
].mc_data
[j
] =
5365 ((temp_reg
& 0xffff0000)) |
5366 ((table
->mc_reg_table_entry
[k
].mc_data
[i
] & 0xffff0000) >> 16);
5368 if (j
>= SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE
)
5371 temp_reg
= RREG32(MC_PMG_CMD_MRS
);
5372 table
->mc_reg_address
[j
].s1
= MC_PMG_CMD_MRS
>> 2;
5373 table
->mc_reg_address
[j
].s0
= MC_SEQ_PMG_CMD_MRS_LP
>> 2;
5374 for (k
= 0; k
< table
->num_entries
; k
++) {
5375 table
->mc_reg_table_entry
[k
].mc_data
[j
] =
5376 (temp_reg
& 0xffff0000) |
5377 (table
->mc_reg_table_entry
[k
].mc_data
[i
] & 0x0000ffff);
5379 table
->mc_reg_table_entry
[k
].mc_data
[j
] |= 0x100;
5382 if (j
>= SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE
)
5385 if (!pi
->mem_gddr5
) {
5386 table
->mc_reg_address
[j
].s1
= MC_PMG_AUTO_CMD
>> 2;
5387 table
->mc_reg_address
[j
].s0
= MC_PMG_AUTO_CMD
>> 2;
5388 for (k
= 0; k
< table
->num_entries
; k
++)
5389 table
->mc_reg_table_entry
[k
].mc_data
[j
] =
5390 (table
->mc_reg_table_entry
[k
].mc_data
[i
] & 0xffff0000) >> 16;
5392 if (j
>= SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE
)
5396 case MC_SEQ_RESERVE_M
:
5397 temp_reg
= RREG32(MC_PMG_CMD_MRS1
);
5398 table
->mc_reg_address
[j
].s1
= MC_PMG_CMD_MRS1
>> 2;
5399 table
->mc_reg_address
[j
].s0
= MC_SEQ_PMG_CMD_MRS1_LP
>> 2;
5400 for(k
= 0; k
< table
->num_entries
; k
++)
5401 table
->mc_reg_table_entry
[k
].mc_data
[j
] =
5402 (temp_reg
& 0xffff0000) |
5403 (table
->mc_reg_table_entry
[k
].mc_data
[i
] & 0x0000ffff);
5405 if (j
>= SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE
)
5418 static bool si_check_s0_mc_reg_index(u16 in_reg
, u16
*out_reg
)
5423 case MC_SEQ_RAS_TIMING
>> 2:
5424 *out_reg
= MC_SEQ_RAS_TIMING_LP
>> 2;
5426 case MC_SEQ_CAS_TIMING
>> 2:
5427 *out_reg
= MC_SEQ_CAS_TIMING_LP
>> 2;
5429 case MC_SEQ_MISC_TIMING
>> 2:
5430 *out_reg
= MC_SEQ_MISC_TIMING_LP
>> 2;
5432 case MC_SEQ_MISC_TIMING2
>> 2:
5433 *out_reg
= MC_SEQ_MISC_TIMING2_LP
>> 2;
5435 case MC_SEQ_RD_CTL_D0
>> 2:
5436 *out_reg
= MC_SEQ_RD_CTL_D0_LP
>> 2;
5438 case MC_SEQ_RD_CTL_D1
>> 2:
5439 *out_reg
= MC_SEQ_RD_CTL_D1_LP
>> 2;
5441 case MC_SEQ_WR_CTL_D0
>> 2:
5442 *out_reg
= MC_SEQ_WR_CTL_D0_LP
>> 2;
5444 case MC_SEQ_WR_CTL_D1
>> 2:
5445 *out_reg
= MC_SEQ_WR_CTL_D1_LP
>> 2;
5447 case MC_PMG_CMD_EMRS
>> 2:
5448 *out_reg
= MC_SEQ_PMG_CMD_EMRS_LP
>> 2;
5450 case MC_PMG_CMD_MRS
>> 2:
5451 *out_reg
= MC_SEQ_PMG_CMD_MRS_LP
>> 2;
5453 case MC_PMG_CMD_MRS1
>> 2:
5454 *out_reg
= MC_SEQ_PMG_CMD_MRS1_LP
>> 2;
5456 case MC_SEQ_PMG_TIMING
>> 2:
5457 *out_reg
= MC_SEQ_PMG_TIMING_LP
>> 2;
5459 case MC_PMG_CMD_MRS2
>> 2:
5460 *out_reg
= MC_SEQ_PMG_CMD_MRS2_LP
>> 2;
5462 case MC_SEQ_WR_CTL_2
>> 2:
5463 *out_reg
= MC_SEQ_WR_CTL_2_LP
>> 2;
5473 static void si_set_valid_flag(struct si_mc_reg_table
*table
)
5477 for (i
= 0; i
< table
->last
; i
++) {
5478 for (j
= 1; j
< table
->num_entries
; j
++) {
5479 if (table
->mc_reg_table_entry
[j
-1].mc_data
[i
] != table
->mc_reg_table_entry
[j
].mc_data
[i
]) {
5480 table
->valid_flag
|= 1 << i
;
5487 static void si_set_s0_mc_reg_index(struct si_mc_reg_table
*table
)
5492 for (i
= 0; i
< table
->last
; i
++)
5493 table
->mc_reg_address
[i
].s0
= si_check_s0_mc_reg_index(table
->mc_reg_address
[i
].s1
, &address
) ?
5494 address
: table
->mc_reg_address
[i
].s1
;
5498 static int si_copy_vbios_mc_reg_table(struct atom_mc_reg_table
*table
,
5499 struct si_mc_reg_table
*si_table
)
5503 if (table
->last
> SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE
)
5505 if (table
->num_entries
> MAX_AC_TIMING_ENTRIES
)
5508 for (i
= 0; i
< table
->last
; i
++)
5509 si_table
->mc_reg_address
[i
].s1
= table
->mc_reg_address
[i
].s1
;
5510 si_table
->last
= table
->last
;
5512 for (i
= 0; i
< table
->num_entries
; i
++) {
5513 si_table
->mc_reg_table_entry
[i
].mclk_max
=
5514 table
->mc_reg_table_entry
[i
].mclk_max
;
5515 for (j
= 0; j
< table
->last
; j
++) {
5516 si_table
->mc_reg_table_entry
[i
].mc_data
[j
] =
5517 table
->mc_reg_table_entry
[i
].mc_data
[j
];
5520 si_table
->num_entries
= table
->num_entries
;
5525 static int si_initialize_mc_reg_table(struct radeon_device
*rdev
)
5527 struct si_power_info
*si_pi
= si_get_pi(rdev
);
5528 struct atom_mc_reg_table
*table
;
5529 struct si_mc_reg_table
*si_table
= &si_pi
->mc_reg_table
;
5530 u8 module_index
= rv770_get_memory_module_index(rdev
);
5533 table
= kzalloc(sizeof(struct atom_mc_reg_table
), GFP_KERNEL
);
5537 WREG32(MC_SEQ_RAS_TIMING_LP
, RREG32(MC_SEQ_RAS_TIMING
));
5538 WREG32(MC_SEQ_CAS_TIMING_LP
, RREG32(MC_SEQ_CAS_TIMING
));
5539 WREG32(MC_SEQ_MISC_TIMING_LP
, RREG32(MC_SEQ_MISC_TIMING
));
5540 WREG32(MC_SEQ_MISC_TIMING2_LP
, RREG32(MC_SEQ_MISC_TIMING2
));
5541 WREG32(MC_SEQ_PMG_CMD_EMRS_LP
, RREG32(MC_PMG_CMD_EMRS
));
5542 WREG32(MC_SEQ_PMG_CMD_MRS_LP
, RREG32(MC_PMG_CMD_MRS
));
5543 WREG32(MC_SEQ_PMG_CMD_MRS1_LP
, RREG32(MC_PMG_CMD_MRS1
));
5544 WREG32(MC_SEQ_WR_CTL_D0_LP
, RREG32(MC_SEQ_WR_CTL_D0
));
5545 WREG32(MC_SEQ_WR_CTL_D1_LP
, RREG32(MC_SEQ_WR_CTL_D1
));
5546 WREG32(MC_SEQ_RD_CTL_D0_LP
, RREG32(MC_SEQ_RD_CTL_D0
));
5547 WREG32(MC_SEQ_RD_CTL_D1_LP
, RREG32(MC_SEQ_RD_CTL_D1
));
5548 WREG32(MC_SEQ_PMG_TIMING_LP
, RREG32(MC_SEQ_PMG_TIMING
));
5549 WREG32(MC_SEQ_PMG_CMD_MRS2_LP
, RREG32(MC_PMG_CMD_MRS2
));
5550 WREG32(MC_SEQ_WR_CTL_2_LP
, RREG32(MC_SEQ_WR_CTL_2
));
5552 ret
= radeon_atom_init_mc_reg_table(rdev
, module_index
, table
);
5556 ret
= si_copy_vbios_mc_reg_table(table
, si_table
);
5560 si_set_s0_mc_reg_index(si_table
);
5562 ret
= si_set_mc_special_registers(rdev
, si_table
);
5566 si_set_valid_flag(si_table
);
5575 static void si_populate_mc_reg_addresses(struct radeon_device
*rdev
,
5576 SMC_SIslands_MCRegisters
*mc_reg_table
)
5578 struct si_power_info
*si_pi
= si_get_pi(rdev
);
5581 for (i
= 0, j
= 0; j
< si_pi
->mc_reg_table
.last
; j
++) {
5582 if (si_pi
->mc_reg_table
.valid_flag
& (1 << j
)) {
5583 if (i
>= SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE
)
5585 mc_reg_table
->address
[i
].s0
=
5586 cpu_to_be16(si_pi
->mc_reg_table
.mc_reg_address
[j
].s0
);
5587 mc_reg_table
->address
[i
].s1
=
5588 cpu_to_be16(si_pi
->mc_reg_table
.mc_reg_address
[j
].s1
);
5592 mc_reg_table
->last
= (u8
)i
;
5595 static void si_convert_mc_registers(const struct si_mc_reg_entry
*entry
,
5596 SMC_SIslands_MCRegisterSet
*data
,
5597 u32 num_entries
, u32 valid_flag
)
5601 for(i
= 0, j
= 0; j
< num_entries
; j
++) {
5602 if (valid_flag
& (1 << j
)) {
5603 data
->value
[i
] = cpu_to_be32(entry
->mc_data
[j
]);
5609 static void si_convert_mc_reg_table_entry_to_smc(struct radeon_device
*rdev
,
5610 struct rv7xx_pl
*pl
,
5611 SMC_SIslands_MCRegisterSet
*mc_reg_table_data
)
5613 struct si_power_info
*si_pi
= si_get_pi(rdev
);
5616 for (i
= 0; i
< si_pi
->mc_reg_table
.num_entries
; i
++) {
5617 if (pl
->mclk
<= si_pi
->mc_reg_table
.mc_reg_table_entry
[i
].mclk_max
)
5621 if ((i
== si_pi
->mc_reg_table
.num_entries
) && (i
> 0))
5624 si_convert_mc_registers(&si_pi
->mc_reg_table
.mc_reg_table_entry
[i
],
5625 mc_reg_table_data
, si_pi
->mc_reg_table
.last
,
5626 si_pi
->mc_reg_table
.valid_flag
);
5629 static void si_convert_mc_reg_table_to_smc(struct radeon_device
*rdev
,
5630 struct radeon_ps
*radeon_state
,
5631 SMC_SIslands_MCRegisters
*mc_reg_table
)
5633 struct ni_ps
*state
= ni_get_ps(radeon_state
);
5636 for (i
= 0; i
< state
->performance_level_count
; i
++) {
5637 si_convert_mc_reg_table_entry_to_smc(rdev
,
5638 &state
->performance_levels
[i
],
5639 &mc_reg_table
->data
[SISLANDS_MCREGISTERTABLE_FIRST_DRIVERSTATE_SLOT
+ i
]);
5643 static int si_populate_mc_reg_table(struct radeon_device
*rdev
,
5644 struct radeon_ps
*radeon_boot_state
)
5646 struct ni_ps
*boot_state
= ni_get_ps(radeon_boot_state
);
5647 struct si_power_info
*si_pi
= si_get_pi(rdev
);
5648 struct si_ulv_param
*ulv
= &si_pi
->ulv
;
5649 SMC_SIslands_MCRegisters
*smc_mc_reg_table
= &si_pi
->smc_mc_reg_table
;
5651 memset(smc_mc_reg_table
, 0, sizeof(SMC_SIslands_MCRegisters
));
5653 si_write_smc_soft_register(rdev
, SI_SMC_SOFT_REGISTER_seq_index
, 1);
5655 si_populate_mc_reg_addresses(rdev
, smc_mc_reg_table
);
5657 si_convert_mc_reg_table_entry_to_smc(rdev
, &boot_state
->performance_levels
[0],
5658 &smc_mc_reg_table
->data
[SISLANDS_MCREGISTERTABLE_INITIAL_SLOT
]);
5660 si_convert_mc_registers(&si_pi
->mc_reg_table
.mc_reg_table_entry
[0],
5661 &smc_mc_reg_table
->data
[SISLANDS_MCREGISTERTABLE_ACPI_SLOT
],
5662 si_pi
->mc_reg_table
.last
,
5663 si_pi
->mc_reg_table
.valid_flag
);
5665 if (ulv
->supported
&& ulv
->pl
.vddc
!= 0)
5666 si_convert_mc_reg_table_entry_to_smc(rdev
, &ulv
->pl
,
5667 &smc_mc_reg_table
->data
[SISLANDS_MCREGISTERTABLE_ULV_SLOT
]);
5669 si_convert_mc_registers(&si_pi
->mc_reg_table
.mc_reg_table_entry
[0],
5670 &smc_mc_reg_table
->data
[SISLANDS_MCREGISTERTABLE_ULV_SLOT
],
5671 si_pi
->mc_reg_table
.last
,
5672 si_pi
->mc_reg_table
.valid_flag
);
5674 si_convert_mc_reg_table_to_smc(rdev
, radeon_boot_state
, smc_mc_reg_table
);
5676 return si_copy_bytes_to_smc(rdev
, si_pi
->mc_reg_table_start
,
5677 (u8
*)smc_mc_reg_table
,
5678 sizeof(SMC_SIslands_MCRegisters
), si_pi
->sram_end
);
5681 static int si_upload_mc_reg_table(struct radeon_device
*rdev
,
5682 struct radeon_ps
*radeon_new_state
)
5684 struct ni_ps
*new_state
= ni_get_ps(radeon_new_state
);
5685 struct si_power_info
*si_pi
= si_get_pi(rdev
);
5686 u32 address
= si_pi
->mc_reg_table_start
+
5687 offsetof(SMC_SIslands_MCRegisters
,
5688 data
[SISLANDS_MCREGISTERTABLE_FIRST_DRIVERSTATE_SLOT
]);
5689 SMC_SIslands_MCRegisters
*smc_mc_reg_table
= &si_pi
->smc_mc_reg_table
;
5691 memset(smc_mc_reg_table
, 0, sizeof(SMC_SIslands_MCRegisters
));
5693 si_convert_mc_reg_table_to_smc(rdev
, radeon_new_state
, smc_mc_reg_table
);
5696 return si_copy_bytes_to_smc(rdev
, address
,
5697 (u8
*)&smc_mc_reg_table
->data
[SISLANDS_MCREGISTERTABLE_FIRST_DRIVERSTATE_SLOT
],
5698 sizeof(SMC_SIslands_MCRegisterSet
) * new_state
->performance_level_count
,
5703 static void si_enable_voltage_control(struct radeon_device
*rdev
, bool enable
)
5706 WREG32_P(GENERAL_PWRMGT
, VOLT_PWRMGT_EN
, ~VOLT_PWRMGT_EN
);
5708 WREG32_P(GENERAL_PWRMGT
, 0, ~VOLT_PWRMGT_EN
);
5711 static enum radeon_pcie_gen
si_get_maximum_link_speed(struct radeon_device
*rdev
,
5712 struct radeon_ps
*radeon_state
)
5714 struct ni_ps
*state
= ni_get_ps(radeon_state
);
5716 u16 pcie_speed
, max_speed
= 0;
5718 for (i
= 0; i
< state
->performance_level_count
; i
++) {
5719 pcie_speed
= state
->performance_levels
[i
].pcie_gen
;
5720 if (max_speed
< pcie_speed
)
5721 max_speed
= pcie_speed
;
5726 static u16
si_get_current_pcie_speed(struct radeon_device
*rdev
)
5730 speed_cntl
= RREG32_PCIE_PORT(PCIE_LC_SPEED_CNTL
) & LC_CURRENT_DATA_RATE_MASK
;
5731 speed_cntl
>>= LC_CURRENT_DATA_RATE_SHIFT
;
5733 return (u16
)speed_cntl
;
5736 static void si_request_link_speed_change_before_state_change(struct radeon_device
*rdev
,
5737 struct radeon_ps
*radeon_new_state
,
5738 struct radeon_ps
*radeon_current_state
)
5740 struct si_power_info
*si_pi
= si_get_pi(rdev
);
5741 enum radeon_pcie_gen target_link_speed
= si_get_maximum_link_speed(rdev
, radeon_new_state
);
5742 enum radeon_pcie_gen current_link_speed
;
5744 if (si_pi
->force_pcie_gen
== RADEON_PCIE_GEN_INVALID
)
5745 current_link_speed
= si_get_maximum_link_speed(rdev
, radeon_current_state
);
5747 current_link_speed
= si_pi
->force_pcie_gen
;
5749 si_pi
->force_pcie_gen
= RADEON_PCIE_GEN_INVALID
;
5750 si_pi
->pspp_notify_required
= false;
5751 if (target_link_speed
> current_link_speed
) {
5752 switch (target_link_speed
) {
5753 #if defined(CONFIG_ACPI)
5754 case RADEON_PCIE_GEN3
:
5755 if (radeon_acpi_pcie_performance_request(rdev
, PCIE_PERF_REQ_PECI_GEN3
, false) == 0)
5757 si_pi
->force_pcie_gen
= RADEON_PCIE_GEN2
;
5758 if (current_link_speed
== RADEON_PCIE_GEN2
)
5760 case RADEON_PCIE_GEN2
:
5761 if (radeon_acpi_pcie_performance_request(rdev
, PCIE_PERF_REQ_PECI_GEN2
, false) == 0)
5765 si_pi
->force_pcie_gen
= si_get_current_pcie_speed(rdev
);
5769 if (target_link_speed
< current_link_speed
)
5770 si_pi
->pspp_notify_required
= true;
5774 static void si_notify_link_speed_change_after_state_change(struct radeon_device
*rdev
,
5775 struct radeon_ps
*radeon_new_state
,
5776 struct radeon_ps
*radeon_current_state
)
5778 struct si_power_info
*si_pi
= si_get_pi(rdev
);
5779 enum radeon_pcie_gen target_link_speed
= si_get_maximum_link_speed(rdev
, radeon_new_state
);
5782 if (si_pi
->pspp_notify_required
) {
5783 if (target_link_speed
== RADEON_PCIE_GEN3
)
5784 request
= PCIE_PERF_REQ_PECI_GEN3
;
5785 else if (target_link_speed
== RADEON_PCIE_GEN2
)
5786 request
= PCIE_PERF_REQ_PECI_GEN2
;
5788 request
= PCIE_PERF_REQ_PECI_GEN1
;
5790 if ((request
== PCIE_PERF_REQ_PECI_GEN1
) &&
5791 (si_get_current_pcie_speed(rdev
) > 0))
5794 #if defined(CONFIG_ACPI)
5795 radeon_acpi_pcie_performance_request(rdev
, request
, false);
5801 static int si_ds_request(struct radeon_device
*rdev
,
5802 bool ds_status_on
, u32 count_write
)
5804 struct evergreen_power_info
*eg_pi
= evergreen_get_pi(rdev
);
5806 if (eg_pi
->sclk_deep_sleep
) {
5808 return (si_send_msg_to_smc(rdev
, PPSMC_MSG_CancelThrottleOVRDSCLKDS
) ==
5812 return (si_send_msg_to_smc(rdev
, PPSMC_MSG_ThrottleOVRDSCLKDS
) ==
5813 PPSMC_Result_OK
) ? 0 : -EINVAL
;
5819 static void si_set_max_cu_value(struct radeon_device
*rdev
)
5821 struct si_power_info
*si_pi
= si_get_pi(rdev
);
5823 if (rdev
->family
== CHIP_VERDE
) {
5824 switch (rdev
->pdev
->device
) {
5860 static int si_patch_single_dependency_table_based_on_leakage(struct radeon_device
*rdev
,
5861 struct radeon_clock_voltage_dependency_table
*table
)
5865 u16 leakage_voltage
;
5868 for (i
= 0; i
< table
->count
; i
++) {
5869 switch (si_get_leakage_voltage_from_leakage_index(rdev
,
5870 table
->entries
[i
].v
,
5871 &leakage_voltage
)) {
5873 table
->entries
[i
].v
= leakage_voltage
;
5883 for (j
= (table
->count
- 2); j
>= 0; j
--) {
5884 table
->entries
[j
].v
= (table
->entries
[j
].v
<= table
->entries
[j
+ 1].v
) ?
5885 table
->entries
[j
].v
: table
->entries
[j
+ 1].v
;
5891 static int si_patch_dependency_tables_based_on_leakage(struct radeon_device
*rdev
)
5895 ret
= si_patch_single_dependency_table_based_on_leakage(rdev
,
5896 &rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_sclk
);
5897 ret
= si_patch_single_dependency_table_based_on_leakage(rdev
,
5898 &rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_mclk
);
5899 ret
= si_patch_single_dependency_table_based_on_leakage(rdev
,
5900 &rdev
->pm
.dpm
.dyn_state
.vddci_dependency_on_mclk
);
5904 static void si_set_pcie_lane_width_in_smc(struct radeon_device
*rdev
,
5905 struct radeon_ps
*radeon_new_state
,
5906 struct radeon_ps
*radeon_current_state
)
5909 u32 new_lane_width
=
5910 (radeon_new_state
->caps
& ATOM_PPLIB_PCIE_LINK_WIDTH_MASK
) >> ATOM_PPLIB_PCIE_LINK_WIDTH_SHIFT
;
5911 u32 current_lane_width
=
5912 (radeon_current_state
->caps
& ATOM_PPLIB_PCIE_LINK_WIDTH_MASK
) >> ATOM_PPLIB_PCIE_LINK_WIDTH_SHIFT
;
5914 if (new_lane_width
!= current_lane_width
) {
5915 radeon_set_pcie_lanes(rdev
, new_lane_width
);
5916 lane_width
= radeon_get_pcie_lanes(rdev
);
5917 si_write_smc_soft_register(rdev
, SI_SMC_SOFT_REGISTER_non_ulv_pcie_link_width
, lane_width
);
5921 static void si_set_vce_clock(struct radeon_device
*rdev
,
5922 struct radeon_ps
*new_rps
,
5923 struct radeon_ps
*old_rps
)
5925 if ((old_rps
->evclk
!= new_rps
->evclk
) ||
5926 (old_rps
->ecclk
!= new_rps
->ecclk
)) {
5927 /* turn the clocks on when encoding, off otherwise */
5928 if (new_rps
->evclk
|| new_rps
->ecclk
)
5929 vce_v1_0_enable_mgcg(rdev
, false);
5931 vce_v1_0_enable_mgcg(rdev
, true);
5932 radeon_set_vce_clocks(rdev
, new_rps
->evclk
, new_rps
->ecclk
);
5936 void si_dpm_setup_asic(struct radeon_device
*rdev
)
5940 r
= si_mc_load_microcode(rdev
);
5942 DRM_ERROR("Failed to load MC firmware!\n");
5943 rv770_get_memory_type(rdev
);
5944 si_read_clock_registers(rdev
);
5945 si_enable_acpi_power_management(rdev
);
5948 static int si_thermal_enable_alert(struct radeon_device
*rdev
,
5951 u32 thermal_int
= RREG32(CG_THERMAL_INT
);
5954 PPSMC_Result result
;
5956 thermal_int
&= ~(THERM_INT_MASK_HIGH
| THERM_INT_MASK_LOW
);
5957 WREG32(CG_THERMAL_INT
, thermal_int
);
5958 rdev
->irq
.dpm_thermal
= false;
5959 result
= si_send_msg_to_smc(rdev
, PPSMC_MSG_EnableThermalInterrupt
);
5960 if (result
!= PPSMC_Result_OK
) {
5961 DRM_DEBUG_KMS("Could not enable thermal interrupts.\n");
5965 thermal_int
|= THERM_INT_MASK_HIGH
| THERM_INT_MASK_LOW
;
5966 WREG32(CG_THERMAL_INT
, thermal_int
);
5967 rdev
->irq
.dpm_thermal
= true;
5973 static int si_thermal_set_temperature_range(struct radeon_device
*rdev
,
5974 int min_temp
, int max_temp
)
5976 int low_temp
= 0 * 1000;
5977 int high_temp
= 255 * 1000;
5979 if (low_temp
< min_temp
)
5980 low_temp
= min_temp
;
5981 if (high_temp
> max_temp
)
5982 high_temp
= max_temp
;
5983 if (high_temp
< low_temp
) {
5984 DRM_ERROR("invalid thermal range: %d - %d\n", low_temp
, high_temp
);
5988 WREG32_P(CG_THERMAL_INT
, DIG_THERM_INTH(high_temp
/ 1000), ~DIG_THERM_INTH_MASK
);
5989 WREG32_P(CG_THERMAL_INT
, DIG_THERM_INTL(low_temp
/ 1000), ~DIG_THERM_INTL_MASK
);
5990 WREG32_P(CG_THERMAL_CTRL
, DIG_THERM_DPM(high_temp
/ 1000), ~DIG_THERM_DPM_MASK
);
5992 rdev
->pm
.dpm
.thermal
.min_temp
= low_temp
;
5993 rdev
->pm
.dpm
.thermal
.max_temp
= high_temp
;
5998 static void si_fan_ctrl_set_static_mode(struct radeon_device
*rdev
, u32 mode
)
6000 struct si_power_info
*si_pi
= si_get_pi(rdev
);
6003 if (si_pi
->fan_ctrl_is_in_default_mode
) {
6004 tmp
= (RREG32(CG_FDO_CTRL2
) & FDO_PWM_MODE_MASK
) >> FDO_PWM_MODE_SHIFT
;
6005 si_pi
->fan_ctrl_default_mode
= tmp
;
6006 tmp
= (RREG32(CG_FDO_CTRL2
) & TMIN_MASK
) >> TMIN_SHIFT
;
6008 si_pi
->fan_ctrl_is_in_default_mode
= false;
6011 tmp
= RREG32(CG_FDO_CTRL2
) & ~TMIN_MASK
;
6013 WREG32(CG_FDO_CTRL2
, tmp
);
6015 tmp
= RREG32(CG_FDO_CTRL2
) & ~FDO_PWM_MODE_MASK
;
6016 tmp
|= FDO_PWM_MODE(mode
);
6017 WREG32(CG_FDO_CTRL2
, tmp
);
6020 static int si_thermal_setup_fan_table(struct radeon_device
*rdev
)
6022 struct si_power_info
*si_pi
= si_get_pi(rdev
);
6023 PP_SIslands_FanTable fan_table
= { FDO_MODE_HARDWARE
};
6025 u32 t_diff1
, t_diff2
, pwm_diff1
, pwm_diff2
;
6026 u16 fdo_min
, slope1
, slope2
;
6027 u32 reference_clock
, tmp
;
6031 if (!si_pi
->fan_table_start
) {
6032 rdev
->pm
.dpm
.fan
.ucode_fan_control
= false;
6036 duty100
= (RREG32(CG_FDO_CTRL1
) & FMAX_DUTY100_MASK
) >> FMAX_DUTY100_SHIFT
;
6039 rdev
->pm
.dpm
.fan
.ucode_fan_control
= false;
6043 tmp64
= (u64
)rdev
->pm
.dpm
.fan
.pwm_min
* duty100
;
6044 do_div(tmp64
, 10000);
6045 fdo_min
= (u16
)tmp64
;
6047 t_diff1
= rdev
->pm
.dpm
.fan
.t_med
- rdev
->pm
.dpm
.fan
.t_min
;
6048 t_diff2
= rdev
->pm
.dpm
.fan
.t_high
- rdev
->pm
.dpm
.fan
.t_med
;
6050 pwm_diff1
= rdev
->pm
.dpm
.fan
.pwm_med
- rdev
->pm
.dpm
.fan
.pwm_min
;
6051 pwm_diff2
= rdev
->pm
.dpm
.fan
.pwm_high
- rdev
->pm
.dpm
.fan
.pwm_med
;
6053 slope1
= (u16
)((50 + ((16 * duty100
* pwm_diff1
) / t_diff1
)) / 100);
6054 slope2
= (u16
)((50 + ((16 * duty100
* pwm_diff2
) / t_diff2
)) / 100);
6056 fan_table
.temp_min
= cpu_to_be16((50 + rdev
->pm
.dpm
.fan
.t_min
) / 100);
6057 fan_table
.temp_med
= cpu_to_be16((50 + rdev
->pm
.dpm
.fan
.t_med
) / 100);
6058 fan_table
.temp_max
= cpu_to_be16((50 + rdev
->pm
.dpm
.fan
.t_max
) / 100);
6060 fan_table
.slope1
= cpu_to_be16(slope1
);
6061 fan_table
.slope2
= cpu_to_be16(slope2
);
6063 fan_table
.fdo_min
= cpu_to_be16(fdo_min
);
6065 fan_table
.hys_down
= cpu_to_be16(rdev
->pm
.dpm
.fan
.t_hyst
);
6067 fan_table
.hys_up
= cpu_to_be16(1);
6069 fan_table
.hys_slope
= cpu_to_be16(1);
6071 fan_table
.temp_resp_lim
= cpu_to_be16(5);
6073 reference_clock
= radeon_get_xclk(rdev
);
6075 fan_table
.refresh_period
= cpu_to_be32((rdev
->pm
.dpm
.fan
.cycle_delay
*
6076 reference_clock
) / 1600);
6078 fan_table
.fdo_max
= cpu_to_be16((u16
)duty100
);
6080 tmp
= (RREG32(CG_MULT_THERMAL_CTRL
) & TEMP_SEL_MASK
) >> TEMP_SEL_SHIFT
;
6081 fan_table
.temp_src
= (uint8_t)tmp
;
6083 ret
= si_copy_bytes_to_smc(rdev
,
6084 si_pi
->fan_table_start
,
6090 DRM_ERROR("Failed to load fan table to the SMC.");
6091 rdev
->pm
.dpm
.fan
.ucode_fan_control
= false;
6097 static int si_fan_ctrl_start_smc_fan_control(struct radeon_device
*rdev
)
6099 struct si_power_info
*si_pi
= si_get_pi(rdev
);
6102 ret
= si_send_msg_to_smc(rdev
, PPSMC_StartFanControl
);
6103 if (ret
== PPSMC_Result_OK
) {
6104 si_pi
->fan_is_controlled_by_smc
= true;
6111 static int si_fan_ctrl_stop_smc_fan_control(struct radeon_device
*rdev
)
6113 struct si_power_info
*si_pi
= si_get_pi(rdev
);
6116 ret
= si_send_msg_to_smc(rdev
, PPSMC_StopFanControl
);
6118 if (ret
== PPSMC_Result_OK
) {
6119 si_pi
->fan_is_controlled_by_smc
= false;
6126 int si_fan_ctrl_get_fan_speed_percent(struct radeon_device
*rdev
,
6132 if (rdev
->pm
.no_fan
)
6135 duty100
= (RREG32(CG_FDO_CTRL1
) & FMAX_DUTY100_MASK
) >> FMAX_DUTY100_SHIFT
;
6136 duty
= (RREG32(CG_THERMAL_STATUS
) & FDO_PWM_DUTY_MASK
) >> FDO_PWM_DUTY_SHIFT
;
6141 tmp64
= (u64
)duty
* 100;
6142 do_div(tmp64
, duty100
);
6143 *speed
= (u32
)tmp64
;
6151 int si_fan_ctrl_set_fan_speed_percent(struct radeon_device
*rdev
,
6154 struct si_power_info
*si_pi
= si_get_pi(rdev
);
6159 if (rdev
->pm
.no_fan
)
6162 if (si_pi
->fan_is_controlled_by_smc
)
6168 duty100
= (RREG32(CG_FDO_CTRL1
) & FMAX_DUTY100_MASK
) >> FMAX_DUTY100_SHIFT
;
6173 tmp64
= (u64
)speed
* duty100
;
6177 tmp
= RREG32(CG_FDO_CTRL0
) & ~FDO_STATIC_DUTY_MASK
;
6178 tmp
|= FDO_STATIC_DUTY(duty
);
6179 WREG32(CG_FDO_CTRL0
, tmp
);
6184 void si_fan_ctrl_set_mode(struct radeon_device
*rdev
, u32 mode
)
6187 /* stop auto-manage */
6188 if (rdev
->pm
.dpm
.fan
.ucode_fan_control
)
6189 si_fan_ctrl_stop_smc_fan_control(rdev
);
6190 si_fan_ctrl_set_static_mode(rdev
, mode
);
6192 /* restart auto-manage */
6193 if (rdev
->pm
.dpm
.fan
.ucode_fan_control
)
6194 si_thermal_start_smc_fan_control(rdev
);
6196 si_fan_ctrl_set_default_mode(rdev
);
6200 u32
si_fan_ctrl_get_mode(struct radeon_device
*rdev
)
6202 struct si_power_info
*si_pi
= si_get_pi(rdev
);
6205 if (si_pi
->fan_is_controlled_by_smc
)
6208 tmp
= RREG32(CG_FDO_CTRL2
) & FDO_PWM_MODE_MASK
;
6209 return (tmp
>> FDO_PWM_MODE_SHIFT
);
6213 static int si_fan_ctrl_get_fan_speed_rpm(struct radeon_device
*rdev
,
6217 u32 xclk
= radeon_get_xclk(rdev
);
6219 if (rdev
->pm
.no_fan
)
6222 if (rdev
->pm
.fan_pulses_per_revolution
== 0)
6225 tach_period
= (RREG32(CG_TACH_STATUS
) & TACH_PERIOD_MASK
) >> TACH_PERIOD_SHIFT
;
6226 if (tach_period
== 0)
6229 *speed
= 60 * xclk
* 10000 / tach_period
;
6234 static int si_fan_ctrl_set_fan_speed_rpm(struct radeon_device
*rdev
,
6237 u32 tach_period
, tmp
;
6238 u32 xclk
= radeon_get_xclk(rdev
);
6240 if (rdev
->pm
.no_fan
)
6243 if (rdev
->pm
.fan_pulses_per_revolution
== 0)
6246 if ((speed
< rdev
->pm
.fan_min_rpm
) ||
6247 (speed
> rdev
->pm
.fan_max_rpm
))
6250 if (rdev
->pm
.dpm
.fan
.ucode_fan_control
)
6251 si_fan_ctrl_stop_smc_fan_control(rdev
);
6253 tach_period
= 60 * xclk
* 10000 / (8 * speed
);
6254 tmp
= RREG32(CG_TACH_CTRL
) & ~TARGET_PERIOD_MASK
;
6255 tmp
|= TARGET_PERIOD(tach_period
);
6256 WREG32(CG_TACH_CTRL
, tmp
);
6258 si_fan_ctrl_set_static_mode(rdev
, FDO_PWM_MODE_STATIC_RPM
);
6264 static void si_fan_ctrl_set_default_mode(struct radeon_device
*rdev
)
6266 struct si_power_info
*si_pi
= si_get_pi(rdev
);
6269 if (!si_pi
->fan_ctrl_is_in_default_mode
) {
6270 tmp
= RREG32(CG_FDO_CTRL2
) & ~FDO_PWM_MODE_MASK
;
6271 tmp
|= FDO_PWM_MODE(si_pi
->fan_ctrl_default_mode
);
6272 WREG32(CG_FDO_CTRL2
, tmp
);
6274 tmp
= RREG32(CG_FDO_CTRL2
) & ~TMIN_MASK
;
6275 tmp
|= TMIN(si_pi
->t_min
);
6276 WREG32(CG_FDO_CTRL2
, tmp
);
6277 si_pi
->fan_ctrl_is_in_default_mode
= true;
6281 static void si_thermal_start_smc_fan_control(struct radeon_device
*rdev
)
6283 if (rdev
->pm
.dpm
.fan
.ucode_fan_control
) {
6284 si_fan_ctrl_start_smc_fan_control(rdev
);
6285 si_fan_ctrl_set_static_mode(rdev
, FDO_PWM_MODE_STATIC
);
6289 static void si_thermal_initialize(struct radeon_device
*rdev
)
6293 if (rdev
->pm
.fan_pulses_per_revolution
) {
6294 tmp
= RREG32(CG_TACH_CTRL
) & ~EDGE_PER_REV_MASK
;
6295 tmp
|= EDGE_PER_REV(rdev
->pm
.fan_pulses_per_revolution
-1);
6296 WREG32(CG_TACH_CTRL
, tmp
);
6299 tmp
= RREG32(CG_FDO_CTRL2
) & ~TACH_PWM_RESP_RATE_MASK
;
6300 tmp
|= TACH_PWM_RESP_RATE(0x28);
6301 WREG32(CG_FDO_CTRL2
, tmp
);
6304 static int si_thermal_start_thermal_controller(struct radeon_device
*rdev
)
6308 si_thermal_initialize(rdev
);
6309 ret
= si_thermal_set_temperature_range(rdev
, R600_TEMP_RANGE_MIN
, R600_TEMP_RANGE_MAX
);
6312 ret
= si_thermal_enable_alert(rdev
, true);
6315 if (rdev
->pm
.dpm
.fan
.ucode_fan_control
) {
6316 ret
= si_halt_smc(rdev
);
6319 ret
= si_thermal_setup_fan_table(rdev
);
6322 ret
= si_resume_smc(rdev
);
6325 si_thermal_start_smc_fan_control(rdev
);
6331 static void si_thermal_stop_thermal_controller(struct radeon_device
*rdev
)
6333 if (!rdev
->pm
.no_fan
) {
6334 si_fan_ctrl_set_default_mode(rdev
);
6335 si_fan_ctrl_stop_smc_fan_control(rdev
);
6339 int si_dpm_enable(struct radeon_device
*rdev
)
6341 struct rv7xx_power_info
*pi
= rv770_get_pi(rdev
);
6342 struct evergreen_power_info
*eg_pi
= evergreen_get_pi(rdev
);
6343 struct si_power_info
*si_pi
= si_get_pi(rdev
);
6344 struct radeon_ps
*boot_ps
= rdev
->pm
.dpm
.boot_ps
;
6347 if (si_is_smc_running(rdev
))
6349 if (pi
->voltage_control
|| si_pi
->voltage_control_svi2
)
6350 si_enable_voltage_control(rdev
, true);
6351 if (pi
->mvdd_control
)
6352 si_get_mvdd_configuration(rdev
);
6353 if (pi
->voltage_control
|| si_pi
->voltage_control_svi2
) {
6354 ret
= si_construct_voltage_tables(rdev
);
6356 DRM_ERROR("si_construct_voltage_tables failed\n");
6360 if (eg_pi
->dynamic_ac_timing
) {
6361 ret
= si_initialize_mc_reg_table(rdev
);
6363 eg_pi
->dynamic_ac_timing
= false;
6366 si_enable_spread_spectrum(rdev
, true);
6367 if (pi
->thermal_protection
)
6368 si_enable_thermal_protection(rdev
, true);
6370 si_program_git(rdev
);
6371 si_program_tp(rdev
);
6372 si_program_tpp(rdev
);
6373 si_program_sstp(rdev
);
6374 si_enable_display_gap(rdev
);
6375 si_program_vc(rdev
);
6376 ret
= si_upload_firmware(rdev
);
6378 DRM_ERROR("si_upload_firmware failed\n");
6381 ret
= si_process_firmware_header(rdev
);
6383 DRM_ERROR("si_process_firmware_header failed\n");
6386 ret
= si_initial_switch_from_arb_f0_to_f1(rdev
);
6388 DRM_ERROR("si_initial_switch_from_arb_f0_to_f1 failed\n");
6391 ret
= si_init_smc_table(rdev
);
6393 DRM_ERROR("si_init_smc_table failed\n");
6396 ret
= si_init_smc_spll_table(rdev
);
6398 DRM_ERROR("si_init_smc_spll_table failed\n");
6401 ret
= si_init_arb_table_index(rdev
);
6403 DRM_ERROR("si_init_arb_table_index failed\n");
6406 if (eg_pi
->dynamic_ac_timing
) {
6407 ret
= si_populate_mc_reg_table(rdev
, boot_ps
);
6409 DRM_ERROR("si_populate_mc_reg_table failed\n");
6413 ret
= si_initialize_smc_cac_tables(rdev
);
6415 DRM_ERROR("si_initialize_smc_cac_tables failed\n");
6418 ret
= si_initialize_hardware_cac_manager(rdev
);
6420 DRM_ERROR("si_initialize_hardware_cac_manager failed\n");
6423 ret
= si_initialize_smc_dte_tables(rdev
);
6425 DRM_ERROR("si_initialize_smc_dte_tables failed\n");
6428 ret
= si_populate_smc_tdp_limits(rdev
, boot_ps
);
6430 DRM_ERROR("si_populate_smc_tdp_limits failed\n");
6433 ret
= si_populate_smc_tdp_limits_2(rdev
, boot_ps
);
6435 DRM_ERROR("si_populate_smc_tdp_limits_2 failed\n");
6438 si_program_response_times(rdev
);
6439 si_program_ds_registers(rdev
);
6440 si_dpm_start_smc(rdev
);
6441 ret
= si_notify_smc_display_change(rdev
, false);
6443 DRM_ERROR("si_notify_smc_display_change failed\n");
6446 si_enable_sclk_control(rdev
, true);
6449 si_enable_auto_throttle_source(rdev
, RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL
, true);
6451 si_thermal_start_thermal_controller(rdev
);
6453 ni_update_current_ps(rdev
, boot_ps
);
6458 static int si_set_temperature_range(struct radeon_device
*rdev
)
6462 ret
= si_thermal_enable_alert(rdev
, false);
6465 ret
= si_thermal_set_temperature_range(rdev
, R600_TEMP_RANGE_MIN
, R600_TEMP_RANGE_MAX
);
6468 ret
= si_thermal_enable_alert(rdev
, true);
6475 int si_dpm_late_enable(struct radeon_device
*rdev
)
6479 ret
= si_set_temperature_range(rdev
);
6486 void si_dpm_disable(struct radeon_device
*rdev
)
6488 struct rv7xx_power_info
*pi
= rv770_get_pi(rdev
);
6489 struct radeon_ps
*boot_ps
= rdev
->pm
.dpm
.boot_ps
;
6491 if (!si_is_smc_running(rdev
))
6493 si_thermal_stop_thermal_controller(rdev
);
6494 si_disable_ulv(rdev
);
6496 if (pi
->thermal_protection
)
6497 si_enable_thermal_protection(rdev
, false);
6498 si_enable_power_containment(rdev
, boot_ps
, false);
6499 si_enable_smc_cac(rdev
, boot_ps
, false);
6500 si_enable_spread_spectrum(rdev
, false);
6501 si_enable_auto_throttle_source(rdev
, RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL
, false);
6503 si_reset_to_default(rdev
);
6504 si_dpm_stop_smc(rdev
);
6505 si_force_switch_to_arb_f0(rdev
);
6507 ni_update_current_ps(rdev
, boot_ps
);
6510 int si_dpm_pre_set_power_state(struct radeon_device
*rdev
)
6512 struct evergreen_power_info
*eg_pi
= evergreen_get_pi(rdev
);
6513 struct radeon_ps requested_ps
= *rdev
->pm
.dpm
.requested_ps
;
6514 struct radeon_ps
*new_ps
= &requested_ps
;
6516 ni_update_requested_ps(rdev
, new_ps
);
6518 si_apply_state_adjust_rules(rdev
, &eg_pi
->requested_rps
);
6523 static int si_power_control_set_level(struct radeon_device
*rdev
)
6525 struct radeon_ps
*new_ps
= rdev
->pm
.dpm
.requested_ps
;
6528 ret
= si_restrict_performance_levels_before_switch(rdev
);
6531 ret
= si_halt_smc(rdev
);
6534 ret
= si_populate_smc_tdp_limits(rdev
, new_ps
);
6537 ret
= si_populate_smc_tdp_limits_2(rdev
, new_ps
);
6540 ret
= si_resume_smc(rdev
);
6543 ret
= si_set_sw_state(rdev
);
6549 int si_dpm_set_power_state(struct radeon_device
*rdev
)
6551 struct evergreen_power_info
*eg_pi
= evergreen_get_pi(rdev
);
6552 struct radeon_ps
*new_ps
= &eg_pi
->requested_rps
;
6553 struct radeon_ps
*old_ps
= &eg_pi
->current_rps
;
6556 ret
= si_disable_ulv(rdev
);
6558 DRM_ERROR("si_disable_ulv failed\n");
6561 ret
= si_restrict_performance_levels_before_switch(rdev
);
6563 DRM_ERROR("si_restrict_performance_levels_before_switch failed\n");
6566 if (eg_pi
->pcie_performance_request
)
6567 si_request_link_speed_change_before_state_change(rdev
, new_ps
, old_ps
);
6568 ni_set_uvd_clock_before_set_eng_clock(rdev
, new_ps
, old_ps
);
6569 ret
= si_enable_power_containment(rdev
, new_ps
, false);
6571 DRM_ERROR("si_enable_power_containment failed\n");
6574 ret
= si_enable_smc_cac(rdev
, new_ps
, false);
6576 DRM_ERROR("si_enable_smc_cac failed\n");
6579 ret
= si_halt_smc(rdev
);
6581 DRM_ERROR("si_halt_smc failed\n");
6584 ret
= si_upload_sw_state(rdev
, new_ps
);
6586 DRM_ERROR("si_upload_sw_state failed\n");
6589 ret
= si_upload_smc_data(rdev
);
6591 DRM_ERROR("si_upload_smc_data failed\n");
6594 ret
= si_upload_ulv_state(rdev
);
6596 DRM_ERROR("si_upload_ulv_state failed\n");
6599 if (eg_pi
->dynamic_ac_timing
) {
6600 ret
= si_upload_mc_reg_table(rdev
, new_ps
);
6602 DRM_ERROR("si_upload_mc_reg_table failed\n");
6606 ret
= si_program_memory_timing_parameters(rdev
, new_ps
);
6608 DRM_ERROR("si_program_memory_timing_parameters failed\n");
6611 si_set_pcie_lane_width_in_smc(rdev
, new_ps
, old_ps
);
6613 ret
= si_resume_smc(rdev
);
6615 DRM_ERROR("si_resume_smc failed\n");
6618 ret
= si_set_sw_state(rdev
);
6620 DRM_ERROR("si_set_sw_state failed\n");
6623 ni_set_uvd_clock_after_set_eng_clock(rdev
, new_ps
, old_ps
);
6624 si_set_vce_clock(rdev
, new_ps
, old_ps
);
6625 if (eg_pi
->pcie_performance_request
)
6626 si_notify_link_speed_change_after_state_change(rdev
, new_ps
, old_ps
);
6627 ret
= si_set_power_state_conditionally_enable_ulv(rdev
, new_ps
);
6629 DRM_ERROR("si_set_power_state_conditionally_enable_ulv failed\n");
6632 ret
= si_enable_smc_cac(rdev
, new_ps
, true);
6634 DRM_ERROR("si_enable_smc_cac failed\n");
6637 ret
= si_enable_power_containment(rdev
, new_ps
, true);
6639 DRM_ERROR("si_enable_power_containment failed\n");
6643 ret
= si_power_control_set_level(rdev
);
6645 DRM_ERROR("si_power_control_set_level failed\n");
6652 void si_dpm_post_set_power_state(struct radeon_device
*rdev
)
6654 struct evergreen_power_info
*eg_pi
= evergreen_get_pi(rdev
);
6655 struct radeon_ps
*new_ps
= &eg_pi
->requested_rps
;
6657 ni_update_current_ps(rdev
, new_ps
);
6661 void si_dpm_reset_asic(struct radeon_device
*rdev
)
6663 si_restrict_performance_levels_before_switch(rdev
);
6664 si_disable_ulv(rdev
);
6665 si_set_boot_state(rdev
);
6669 void si_dpm_display_configuration_changed(struct radeon_device
*rdev
)
6671 si_program_display_gap(rdev
);
6675 struct _ATOM_POWERPLAY_INFO info
;
6676 struct _ATOM_POWERPLAY_INFO_V2 info_2
;
6677 struct _ATOM_POWERPLAY_INFO_V3 info_3
;
6678 struct _ATOM_PPLIB_POWERPLAYTABLE pplib
;
6679 struct _ATOM_PPLIB_POWERPLAYTABLE2 pplib2
;
6680 struct _ATOM_PPLIB_POWERPLAYTABLE3 pplib3
;
6683 union pplib_clock_info
{
6684 struct _ATOM_PPLIB_R600_CLOCK_INFO r600
;
6685 struct _ATOM_PPLIB_RS780_CLOCK_INFO rs780
;
6686 struct _ATOM_PPLIB_EVERGREEN_CLOCK_INFO evergreen
;
6687 struct _ATOM_PPLIB_SUMO_CLOCK_INFO sumo
;
6688 struct _ATOM_PPLIB_SI_CLOCK_INFO si
;
6691 union pplib_power_state
{
6692 struct _ATOM_PPLIB_STATE v1
;
6693 struct _ATOM_PPLIB_STATE_V2 v2
;
6696 static void si_parse_pplib_non_clock_info(struct radeon_device
*rdev
,
6697 struct radeon_ps
*rps
,
6698 struct _ATOM_PPLIB_NONCLOCK_INFO
*non_clock_info
,
6701 rps
->caps
= le32_to_cpu(non_clock_info
->ulCapsAndSettings
);
6702 rps
->class = le16_to_cpu(non_clock_info
->usClassification
);
6703 rps
->class2
= le16_to_cpu(non_clock_info
->usClassification2
);
6705 if (ATOM_PPLIB_NONCLOCKINFO_VER1
< table_rev
) {
6706 rps
->vclk
= le32_to_cpu(non_clock_info
->ulVCLK
);
6707 rps
->dclk
= le32_to_cpu(non_clock_info
->ulDCLK
);
6708 } else if (r600_is_uvd_state(rps
->class, rps
->class2
)) {
6709 rps
->vclk
= RV770_DEFAULT_VCLK_FREQ
;
6710 rps
->dclk
= RV770_DEFAULT_DCLK_FREQ
;
6716 if (rps
->class & ATOM_PPLIB_CLASSIFICATION_BOOT
)
6717 rdev
->pm
.dpm
.boot_ps
= rps
;
6718 if (rps
->class & ATOM_PPLIB_CLASSIFICATION_UVDSTATE
)
6719 rdev
->pm
.dpm
.uvd_ps
= rps
;
6722 static void si_parse_pplib_clock_info(struct radeon_device
*rdev
,
6723 struct radeon_ps
*rps
, int index
,
6724 union pplib_clock_info
*clock_info
)
6726 struct rv7xx_power_info
*pi
= rv770_get_pi(rdev
);
6727 struct evergreen_power_info
*eg_pi
= evergreen_get_pi(rdev
);
6728 struct si_power_info
*si_pi
= si_get_pi(rdev
);
6729 struct ni_ps
*ps
= ni_get_ps(rps
);
6730 u16 leakage_voltage
;
6731 struct rv7xx_pl
*pl
= &ps
->performance_levels
[index
];
6734 ps
->performance_level_count
= index
+ 1;
6736 pl
->sclk
= le16_to_cpu(clock_info
->si
.usEngineClockLow
);
6737 pl
->sclk
|= clock_info
->si
.ucEngineClockHigh
<< 16;
6738 pl
->mclk
= le16_to_cpu(clock_info
->si
.usMemoryClockLow
);
6739 pl
->mclk
|= clock_info
->si
.ucMemoryClockHigh
<< 16;
6741 pl
->vddc
= le16_to_cpu(clock_info
->si
.usVDDC
);
6742 pl
->vddci
= le16_to_cpu(clock_info
->si
.usVDDCI
);
6743 pl
->flags
= le32_to_cpu(clock_info
->si
.ulFlags
);
6744 pl
->pcie_gen
= r600_get_pcie_gen_support(rdev
,
6745 si_pi
->sys_pcie_mask
,
6746 si_pi
->boot_pcie_gen
,
6747 clock_info
->si
.ucPCIEGen
);
6749 /* patch up vddc if necessary */
6750 ret
= si_get_leakage_voltage_from_leakage_index(rdev
, pl
->vddc
,
6753 pl
->vddc
= leakage_voltage
;
6755 if (rps
->class & ATOM_PPLIB_CLASSIFICATION_ACPI
) {
6756 pi
->acpi_vddc
= pl
->vddc
;
6757 eg_pi
->acpi_vddci
= pl
->vddci
;
6758 si_pi
->acpi_pcie_gen
= pl
->pcie_gen
;
6761 if ((rps
->class2
& ATOM_PPLIB_CLASSIFICATION2_ULV
) &&
6763 /* XXX disable for A0 tahiti */
6764 si_pi
->ulv
.supported
= false;
6765 si_pi
->ulv
.pl
= *pl
;
6766 si_pi
->ulv
.one_pcie_lane_in_ulv
= false;
6767 si_pi
->ulv
.volt_change_delay
= SISLANDS_ULVVOLTAGECHANGEDELAY_DFLT
;
6768 si_pi
->ulv
.cg_ulv_parameter
= SISLANDS_CGULVPARAMETER_DFLT
;
6769 si_pi
->ulv
.cg_ulv_control
= SISLANDS_CGULVCONTROL_DFLT
;
6772 if (pi
->min_vddc_in_table
> pl
->vddc
)
6773 pi
->min_vddc_in_table
= pl
->vddc
;
6775 if (pi
->max_vddc_in_table
< pl
->vddc
)
6776 pi
->max_vddc_in_table
= pl
->vddc
;
6778 /* patch up boot state */
6779 if (rps
->class & ATOM_PPLIB_CLASSIFICATION_BOOT
) {
6780 u16 vddc
, vddci
, mvdd
;
6781 radeon_atombios_get_default_voltages(rdev
, &vddc
, &vddci
, &mvdd
);
6782 pl
->mclk
= rdev
->clock
.default_mclk
;
6783 pl
->sclk
= rdev
->clock
.default_sclk
;
6786 si_pi
->mvdd_bootup_value
= mvdd
;
6789 if ((rps
->class & ATOM_PPLIB_CLASSIFICATION_UI_MASK
) ==
6790 ATOM_PPLIB_CLASSIFICATION_UI_PERFORMANCE
) {
6791 rdev
->pm
.dpm
.dyn_state
.max_clock_voltage_on_ac
.sclk
= pl
->sclk
;
6792 rdev
->pm
.dpm
.dyn_state
.max_clock_voltage_on_ac
.mclk
= pl
->mclk
;
6793 rdev
->pm
.dpm
.dyn_state
.max_clock_voltage_on_ac
.vddc
= pl
->vddc
;
6794 rdev
->pm
.dpm
.dyn_state
.max_clock_voltage_on_ac
.vddci
= pl
->vddci
;
6798 static int si_parse_power_table(struct radeon_device
*rdev
)
6800 struct radeon_mode_info
*mode_info
= &rdev
->mode_info
;
6801 struct _ATOM_PPLIB_NONCLOCK_INFO
*non_clock_info
;
6802 union pplib_power_state
*power_state
;
6803 int i
, j
, k
, non_clock_array_index
, clock_array_index
;
6804 union pplib_clock_info
*clock_info
;
6805 struct _StateArray
*state_array
;
6806 struct _ClockInfoArray
*clock_info_array
;
6807 struct _NonClockInfoArray
*non_clock_info_array
;
6808 union power_info
*power_info
;
6809 int index
= GetIndexIntoMasterTable(DATA
, PowerPlayInfo
);
6812 u8
*power_state_offset
;
6815 if (!atom_parse_data_header(mode_info
->atom_context
, index
, NULL
,
6816 &frev
, &crev
, &data_offset
))
6818 power_info
= (union power_info
*)(mode_info
->atom_context
->bios
+ data_offset
);
6820 state_array
= (struct _StateArray
*)
6821 (mode_info
->atom_context
->bios
+ data_offset
+
6822 le16_to_cpu(power_info
->pplib
.usStateArrayOffset
));
6823 clock_info_array
= (struct _ClockInfoArray
*)
6824 (mode_info
->atom_context
->bios
+ data_offset
+
6825 le16_to_cpu(power_info
->pplib
.usClockInfoArrayOffset
));
6826 non_clock_info_array
= (struct _NonClockInfoArray
*)
6827 (mode_info
->atom_context
->bios
+ data_offset
+
6828 le16_to_cpu(power_info
->pplib
.usNonClockInfoArrayOffset
));
6830 rdev
->pm
.dpm
.ps
= kzalloc(sizeof(struct radeon_ps
) *
6831 state_array
->ucNumEntries
, GFP_KERNEL
);
6832 if (!rdev
->pm
.dpm
.ps
)
6834 power_state_offset
= (u8
*)state_array
->states
;
6835 for (i
= 0; i
< state_array
->ucNumEntries
; i
++) {
6837 power_state
= (union pplib_power_state
*)power_state_offset
;
6838 non_clock_array_index
= power_state
->v2
.nonClockInfoIndex
;
6839 non_clock_info
= (struct _ATOM_PPLIB_NONCLOCK_INFO
*)
6840 &non_clock_info_array
->nonClockInfo
[non_clock_array_index
];
6841 if (!rdev
->pm
.power_state
[i
].clock_info
)
6843 ps
= kzalloc(sizeof(struct ni_ps
), GFP_KERNEL
);
6845 kfree(rdev
->pm
.dpm
.ps
);
6848 rdev
->pm
.dpm
.ps
[i
].ps_priv
= ps
;
6849 si_parse_pplib_non_clock_info(rdev
, &rdev
->pm
.dpm
.ps
[i
],
6851 non_clock_info_array
->ucEntrySize
);
6853 idx
= (u8
*)&power_state
->v2
.clockInfoIndex
[0];
6854 for (j
= 0; j
< power_state
->v2
.ucNumDPMLevels
; j
++) {
6855 clock_array_index
= idx
[j
];
6856 if (clock_array_index
>= clock_info_array
->ucNumEntries
)
6858 if (k
>= SISLANDS_MAX_HARDWARE_POWERLEVELS
)
6860 clock_info
= (union pplib_clock_info
*)
6861 ((u8
*)&clock_info_array
->clockInfo
[0] +
6862 (clock_array_index
* clock_info_array
->ucEntrySize
));
6863 si_parse_pplib_clock_info(rdev
,
6864 &rdev
->pm
.dpm
.ps
[i
], k
,
6868 power_state_offset
+= 2 + power_state
->v2
.ucNumDPMLevels
;
6870 rdev
->pm
.dpm
.num_ps
= state_array
->ucNumEntries
;
6872 /* fill in the vce power states */
6873 for (i
= 0; i
< RADEON_MAX_VCE_LEVELS
; i
++) {
6875 clock_array_index
= rdev
->pm
.dpm
.vce_states
[i
].clk_idx
;
6876 clock_info
= (union pplib_clock_info
*)
6877 &clock_info_array
->clockInfo
[clock_array_index
* clock_info_array
->ucEntrySize
];
6878 sclk
= le16_to_cpu(clock_info
->si
.usEngineClockLow
);
6879 sclk
|= clock_info
->si
.ucEngineClockHigh
<< 16;
6880 mclk
= le16_to_cpu(clock_info
->si
.usMemoryClockLow
);
6881 mclk
|= clock_info
->si
.ucMemoryClockHigh
<< 16;
6882 rdev
->pm
.dpm
.vce_states
[i
].sclk
= sclk
;
6883 rdev
->pm
.dpm
.vce_states
[i
].mclk
= mclk
;
6889 int si_dpm_init(struct radeon_device
*rdev
)
6891 struct rv7xx_power_info
*pi
;
6892 struct evergreen_power_info
*eg_pi
;
6893 struct ni_power_info
*ni_pi
;
6894 struct si_power_info
*si_pi
;
6895 struct atom_clock_dividers dividers
;
6899 si_pi
= kzalloc(sizeof(struct si_power_info
), GFP_KERNEL
);
6902 rdev
->pm
.dpm
.priv
= si_pi
;
6907 ret
= drm_pcie_get_speed_cap_mask(rdev
->ddev
, &mask
);
6909 si_pi
->sys_pcie_mask
= 0;
6911 si_pi
->sys_pcie_mask
= mask
;
6912 si_pi
->force_pcie_gen
= RADEON_PCIE_GEN_INVALID
;
6913 si_pi
->boot_pcie_gen
= si_get_current_pcie_speed(rdev
);
6915 si_set_max_cu_value(rdev
);
6917 rv770_get_max_vddc(rdev
);
6918 si_get_leakage_vddc(rdev
);
6919 si_patch_dependency_tables_based_on_leakage(rdev
);
6922 eg_pi
->acpi_vddci
= 0;
6923 pi
->min_vddc_in_table
= 0;
6924 pi
->max_vddc_in_table
= 0;
6926 ret
= r600_get_platform_caps(rdev
);
6930 ret
= r600_parse_extended_power_table(rdev
);
6934 ret
= si_parse_power_table(rdev
);
6938 rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_dispclk
.entries
=
6939 kzalloc(4 * sizeof(struct radeon_clock_voltage_dependency_entry
), GFP_KERNEL
);
6940 if (!rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_dispclk
.entries
) {
6941 r600_free_extended_power_table(rdev
);
6944 rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_dispclk
.count
= 4;
6945 rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_dispclk
.entries
[0].clk
= 0;
6946 rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_dispclk
.entries
[0].v
= 0;
6947 rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_dispclk
.entries
[1].clk
= 36000;
6948 rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_dispclk
.entries
[1].v
= 720;
6949 rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_dispclk
.entries
[2].clk
= 54000;
6950 rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_dispclk
.entries
[2].v
= 810;
6951 rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_dispclk
.entries
[3].clk
= 72000;
6952 rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_dispclk
.entries
[3].v
= 900;
6954 if (rdev
->pm
.dpm
.voltage_response_time
== 0)
6955 rdev
->pm
.dpm
.voltage_response_time
= R600_VOLTAGERESPONSETIME_DFLT
;
6956 if (rdev
->pm
.dpm
.backbias_response_time
== 0)
6957 rdev
->pm
.dpm
.backbias_response_time
= R600_BACKBIASRESPONSETIME_DFLT
;
6959 ret
= radeon_atom_get_clock_dividers(rdev
, COMPUTE_ENGINE_PLL_PARAM
,
6960 0, false, ÷rs
);
6962 pi
->ref_div
= dividers
.ref_div
+ 1;
6964 pi
->ref_div
= R600_REFERENCEDIVIDER_DFLT
;
6966 eg_pi
->smu_uvd_hs
= false;
6968 pi
->mclk_strobe_mode_threshold
= 40000;
6969 if (si_is_special_1gb_platform(rdev
))
6970 pi
->mclk_stutter_mode_threshold
= 0;
6972 pi
->mclk_stutter_mode_threshold
= pi
->mclk_strobe_mode_threshold
;
6973 pi
->mclk_edc_enable_threshold
= 40000;
6974 eg_pi
->mclk_edc_wr_enable_threshold
= 40000;
6976 ni_pi
->mclk_rtt_mode_threshold
= eg_pi
->mclk_edc_wr_enable_threshold
;
6978 pi
->voltage_control
=
6979 radeon_atom_is_voltage_gpio(rdev
, SET_VOLTAGE_TYPE_ASIC_VDDC
,
6980 VOLTAGE_OBJ_GPIO_LUT
);
6981 if (!pi
->voltage_control
) {
6982 si_pi
->voltage_control_svi2
=
6983 radeon_atom_is_voltage_gpio(rdev
, SET_VOLTAGE_TYPE_ASIC_VDDC
,
6985 if (si_pi
->voltage_control_svi2
)
6986 radeon_atom_get_svi2_info(rdev
, SET_VOLTAGE_TYPE_ASIC_VDDC
,
6987 &si_pi
->svd_gpio_id
, &si_pi
->svc_gpio_id
);
6991 radeon_atom_is_voltage_gpio(rdev
, SET_VOLTAGE_TYPE_ASIC_MVDDC
,
6992 VOLTAGE_OBJ_GPIO_LUT
);
6994 eg_pi
->vddci_control
=
6995 radeon_atom_is_voltage_gpio(rdev
, SET_VOLTAGE_TYPE_ASIC_VDDCI
,
6996 VOLTAGE_OBJ_GPIO_LUT
);
6997 if (!eg_pi
->vddci_control
)
6998 si_pi
->vddci_control_svi2
=
6999 radeon_atom_is_voltage_gpio(rdev
, SET_VOLTAGE_TYPE_ASIC_VDDCI
,
7002 si_pi
->vddc_phase_shed_control
=
7003 radeon_atom_is_voltage_gpio(rdev
, SET_VOLTAGE_TYPE_ASIC_VDDC
,
7004 VOLTAGE_OBJ_PHASE_LUT
);
7006 rv770_get_engine_memory_ss(rdev
);
7008 pi
->asi
= RV770_ASI_DFLT
;
7009 pi
->pasi
= CYPRESS_HASI_DFLT
;
7010 pi
->vrc
= SISLANDS_VRC_DFLT
;
7012 pi
->gfx_clock_gating
= true;
7014 eg_pi
->sclk_deep_sleep
= true;
7015 si_pi
->sclk_deep_sleep_above_low
= false;
7017 if (rdev
->pm
.int_thermal_type
!= THERMAL_TYPE_NONE
)
7018 pi
->thermal_protection
= true;
7020 pi
->thermal_protection
= false;
7022 eg_pi
->dynamic_ac_timing
= true;
7024 eg_pi
->light_sleep
= true;
7025 #if defined(CONFIG_ACPI)
7026 eg_pi
->pcie_performance_request
=
7027 radeon_acpi_is_pcie_performance_request_supported(rdev
);
7029 eg_pi
->pcie_performance_request
= false;
7032 si_pi
->sram_end
= SMC_RAM_END
;
7034 rdev
->pm
.dpm
.dyn_state
.mclk_sclk_ratio
= 4;
7035 rdev
->pm
.dpm
.dyn_state
.sclk_mclk_delta
= 15000;
7036 rdev
->pm
.dpm
.dyn_state
.vddc_vddci_delta
= 200;
7037 rdev
->pm
.dpm
.dyn_state
.valid_sclk_values
.count
= 0;
7038 rdev
->pm
.dpm
.dyn_state
.valid_sclk_values
.values
= NULL
;
7039 rdev
->pm
.dpm
.dyn_state
.valid_mclk_values
.count
= 0;
7040 rdev
->pm
.dpm
.dyn_state
.valid_mclk_values
.values
= NULL
;
7042 si_initialize_powertune_defaults(rdev
);
7044 /* make sure dc limits are valid */
7045 if ((rdev
->pm
.dpm
.dyn_state
.max_clock_voltage_on_dc
.sclk
== 0) ||
7046 (rdev
->pm
.dpm
.dyn_state
.max_clock_voltage_on_dc
.mclk
== 0))
7047 rdev
->pm
.dpm
.dyn_state
.max_clock_voltage_on_dc
=
7048 rdev
->pm
.dpm
.dyn_state
.max_clock_voltage_on_ac
;
7050 si_pi
->fan_ctrl_is_in_default_mode
= true;
7055 void si_dpm_fini(struct radeon_device
*rdev
)
7059 for (i
= 0; i
< rdev
->pm
.dpm
.num_ps
; i
++) {
7060 kfree(rdev
->pm
.dpm
.ps
[i
].ps_priv
);
7062 kfree(rdev
->pm
.dpm
.ps
);
7063 kfree(rdev
->pm
.dpm
.priv
);
7064 kfree(rdev
->pm
.dpm
.dyn_state
.vddc_dependency_on_dispclk
.entries
);
7065 r600_free_extended_power_table(rdev
);
7068 void si_dpm_debugfs_print_current_performance_level(struct radeon_device
*rdev
,
7071 struct evergreen_power_info
*eg_pi
= evergreen_get_pi(rdev
);
7072 struct radeon_ps
*rps
= &eg_pi
->current_rps
;
7073 struct ni_ps
*ps
= ni_get_ps(rps
);
7074 struct rv7xx_pl
*pl
;
7076 (RREG32(TARGET_AND_CURRENT_PROFILE_INDEX
) & CURRENT_STATE_INDEX_MASK
) >>
7077 CURRENT_STATE_INDEX_SHIFT
;
7079 if (current_index
>= ps
->performance_level_count
) {
7080 seq_printf(m
, "invalid dpm profile %d\n", current_index
);
7082 pl
= &ps
->performance_levels
[current_index
];
7083 seq_printf(m
, "uvd vclk: %d dclk: %d\n", rps
->vclk
, rps
->dclk
);
7084 seq_printf(m
, "power level %d sclk: %u mclk: %u vddc: %u vddci: %u pcie gen: %u\n",
7085 current_index
, pl
->sclk
, pl
->mclk
, pl
->vddc
, pl
->vddci
, pl
->pcie_gen
+ 1);
7089 u32
si_dpm_get_current_sclk(struct radeon_device
*rdev
)
7091 struct evergreen_power_info
*eg_pi
= evergreen_get_pi(rdev
);
7092 struct radeon_ps
*rps
= &eg_pi
->current_rps
;
7093 struct ni_ps
*ps
= ni_get_ps(rps
);
7094 struct rv7xx_pl
*pl
;
7096 (RREG32(TARGET_AND_CURRENT_PROFILE_INDEX
) & CURRENT_STATE_INDEX_MASK
) >>
7097 CURRENT_STATE_INDEX_SHIFT
;
7099 if (current_index
>= ps
->performance_level_count
) {
7102 pl
= &ps
->performance_levels
[current_index
];
7107 u32
si_dpm_get_current_mclk(struct radeon_device
*rdev
)
7109 struct evergreen_power_info
*eg_pi
= evergreen_get_pi(rdev
);
7110 struct radeon_ps
*rps
= &eg_pi
->current_rps
;
7111 struct ni_ps
*ps
= ni_get_ps(rps
);
7112 struct rv7xx_pl
*pl
;
7114 (RREG32(TARGET_AND_CURRENT_PROFILE_INDEX
) & CURRENT_STATE_INDEX_MASK
) >>
7115 CURRENT_STATE_INDEX_SHIFT
;
7117 if (current_index
>= ps
->performance_level_count
) {
7120 pl
= &ps
->performance_levels
[current_index
];