blob: dd6203a0a6b77cd4d1f0e3bdb0b093fb1ccfdbd3 [file] [log] [blame]
Alex Deucherd38ceaf2015-04-20 16:55:21 -04001/*
2 * Copyright 2014 Advanced Micro Devices, Inc.
3 *
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:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
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.
21 *
22 */
23#ifndef __AMDGPU_DPM_H__
24#define __AMDGPU_DPM_H__
25
Alex Deuchercf0978812016-10-07 11:40:09 -040026enum amdgpu_int_thermal_type {
27 THERMAL_TYPE_NONE,
28 THERMAL_TYPE_EXTERNAL,
29 THERMAL_TYPE_EXTERNAL_GPIO,
30 THERMAL_TYPE_RV6XX,
31 THERMAL_TYPE_RV770,
32 THERMAL_TYPE_ADT7473_WITH_INTERNAL,
33 THERMAL_TYPE_EVERGREEN,
34 THERMAL_TYPE_SUMO,
35 THERMAL_TYPE_NI,
36 THERMAL_TYPE_SI,
37 THERMAL_TYPE_EMC2103_WITH_INTERNAL,
38 THERMAL_TYPE_CI,
39 THERMAL_TYPE_KV,
40};
41
42enum amdgpu_dpm_auto_throttle_src {
43 AMDGPU_DPM_AUTO_THROTTLE_SRC_THERMAL,
44 AMDGPU_DPM_AUTO_THROTTLE_SRC_EXTERNAL
45};
46
47enum amdgpu_dpm_event_src {
48 AMDGPU_DPM_EVENT_SRC_ANALOG = 0,
49 AMDGPU_DPM_EVENT_SRC_EXTERNAL = 1,
50 AMDGPU_DPM_EVENT_SRC_DIGITAL = 2,
51 AMDGPU_DPM_EVENT_SRC_ANALOG_OR_EXTERNAL = 3,
52 AMDGPU_DPM_EVENT_SRC_DIGIAL_OR_EXTERNAL = 4
53};
54
Alex Deuchercf0978812016-10-07 11:40:09 -040055struct amdgpu_ps {
56 u32 caps; /* vbios flags */
57 u32 class; /* vbios flags */
58 u32 class2; /* vbios flags */
59 /* UVD clocks */
60 u32 vclk;
61 u32 dclk;
62 /* VCE clocks */
63 u32 evclk;
64 u32 ecclk;
65 bool vce_active;
Rex Zhu0d8de7c2016-10-12 15:13:29 +080066 enum amd_vce_level vce_level;
Alex Deuchercf0978812016-10-07 11:40:09 -040067 /* asic priv */
68 void *ps_priv;
69};
70
71struct amdgpu_dpm_thermal {
72 /* thermal interrupt work */
73 struct work_struct work;
74 /* low temperature threshold */
75 int min_temp;
76 /* high temperature threshold */
77 int max_temp;
78 /* was last interrupt low to high or high to low */
79 bool high_to_low;
80 /* interrupt source */
81 struct amdgpu_irq_src irq;
82};
83
84enum amdgpu_clk_action
85{
86 AMDGPU_SCLK_UP = 1,
87 AMDGPU_SCLK_DOWN
88};
89
90struct amdgpu_blacklist_clocks
91{
92 u32 sclk;
93 u32 mclk;
94 enum amdgpu_clk_action action;
95};
96
97struct amdgpu_clock_and_voltage_limits {
98 u32 sclk;
99 u32 mclk;
100 u16 vddc;
101 u16 vddci;
102};
103
104struct amdgpu_clock_array {
105 u32 count;
106 u32 *values;
107};
108
109struct amdgpu_clock_voltage_dependency_entry {
110 u32 clk;
111 u16 v;
112};
113
114struct amdgpu_clock_voltage_dependency_table {
115 u32 count;
116 struct amdgpu_clock_voltage_dependency_entry *entries;
117};
118
119union amdgpu_cac_leakage_entry {
120 struct {
121 u16 vddc;
122 u32 leakage;
123 };
124 struct {
125 u16 vddc1;
126 u16 vddc2;
127 u16 vddc3;
128 };
129};
130
131struct amdgpu_cac_leakage_table {
132 u32 count;
133 union amdgpu_cac_leakage_entry *entries;
134};
135
136struct amdgpu_phase_shedding_limits_entry {
137 u16 voltage;
138 u32 sclk;
139 u32 mclk;
140};
141
142struct amdgpu_phase_shedding_limits_table {
143 u32 count;
144 struct amdgpu_phase_shedding_limits_entry *entries;
145};
146
147struct amdgpu_uvd_clock_voltage_dependency_entry {
148 u32 vclk;
149 u32 dclk;
150 u16 v;
151};
152
153struct amdgpu_uvd_clock_voltage_dependency_table {
154 u8 count;
155 struct amdgpu_uvd_clock_voltage_dependency_entry *entries;
156};
157
158struct amdgpu_vce_clock_voltage_dependency_entry {
159 u32 ecclk;
160 u32 evclk;
161 u16 v;
162};
163
164struct amdgpu_vce_clock_voltage_dependency_table {
165 u8 count;
166 struct amdgpu_vce_clock_voltage_dependency_entry *entries;
167};
168
169struct amdgpu_ppm_table {
170 u8 ppm_design;
171 u16 cpu_core_number;
172 u32 platform_tdp;
173 u32 small_ac_platform_tdp;
174 u32 platform_tdc;
175 u32 small_ac_platform_tdc;
176 u32 apu_tdp;
177 u32 dgpu_tdp;
178 u32 dgpu_ulv_power;
179 u32 tj_max;
180};
181
182struct amdgpu_cac_tdp_table {
183 u16 tdp;
184 u16 configurable_tdp;
185 u16 tdc;
186 u16 battery_power_limit;
187 u16 small_power_limit;
188 u16 low_cac_leakage;
189 u16 high_cac_leakage;
190 u16 maximum_power_delivery_limit;
191};
192
193struct amdgpu_dpm_dynamic_state {
194 struct amdgpu_clock_voltage_dependency_table vddc_dependency_on_sclk;
195 struct amdgpu_clock_voltage_dependency_table vddci_dependency_on_mclk;
196 struct amdgpu_clock_voltage_dependency_table vddc_dependency_on_mclk;
197 struct amdgpu_clock_voltage_dependency_table mvdd_dependency_on_mclk;
198 struct amdgpu_clock_voltage_dependency_table vddc_dependency_on_dispclk;
199 struct amdgpu_uvd_clock_voltage_dependency_table uvd_clock_voltage_dependency_table;
200 struct amdgpu_vce_clock_voltage_dependency_table vce_clock_voltage_dependency_table;
201 struct amdgpu_clock_voltage_dependency_table samu_clock_voltage_dependency_table;
202 struct amdgpu_clock_voltage_dependency_table acp_clock_voltage_dependency_table;
203 struct amdgpu_clock_voltage_dependency_table vddgfx_dependency_on_sclk;
204 struct amdgpu_clock_array valid_sclk_values;
205 struct amdgpu_clock_array valid_mclk_values;
206 struct amdgpu_clock_and_voltage_limits max_clock_voltage_on_dc;
207 struct amdgpu_clock_and_voltage_limits max_clock_voltage_on_ac;
208 u32 mclk_sclk_ratio;
209 u32 sclk_mclk_delta;
210 u16 vddc_vddci_delta;
211 u16 min_vddc_for_pcie_gen2;
212 struct amdgpu_cac_leakage_table cac_leakage_table;
213 struct amdgpu_phase_shedding_limits_table phase_shedding_limits_table;
214 struct amdgpu_ppm_table *ppm_table;
215 struct amdgpu_cac_tdp_table *cac_tdp_table;
216};
217
218struct amdgpu_dpm_fan {
219 u16 t_min;
220 u16 t_med;
221 u16 t_high;
222 u16 pwm_min;
223 u16 pwm_med;
224 u16 pwm_high;
225 u8 t_hyst;
226 u32 cycle_delay;
227 u16 t_max;
228 u8 control_mode;
229 u16 default_max_fan_pwm;
230 u16 default_fan_output_sensitivity;
231 u16 fan_output_sensitivity;
232 bool ucode_fan_control;
233};
234
235enum amdgpu_pcie_gen {
236 AMDGPU_PCIE_GEN1 = 0,
237 AMDGPU_PCIE_GEN2 = 1,
238 AMDGPU_PCIE_GEN3 = 2,
239 AMDGPU_PCIE_GEN_INVALID = 0xffff
240};
241
Rex Zhucd4d7462017-09-06 18:43:52 +0800242#define amdgpu_dpm_pre_set_power_state(adev) \
243 ((adev)->powerplay.pp_funcs->pre_set_power_state((adev)->powerplay.pp_handle))
244
245#define amdgpu_dpm_set_power_state(adev) \
246 ((adev)->powerplay.pp_funcs->set_power_state((adev)->powerplay.pp_handle))
247
248#define amdgpu_dpm_post_set_power_state(adev) \
249 ((adev)->powerplay.pp_funcs->post_set_power_state((adev)->powerplay.pp_handle))
250
251#define amdgpu_dpm_display_configuration_changed(adev) \
252 ((adev)->powerplay.pp_funcs->display_configuration_changed((adev)->powerplay.pp_handle))
253
254#define amdgpu_dpm_print_power_state(adev, ps) \
255 ((adev)->powerplay.pp_funcs->print_power_state((adev)->powerplay.pp_handle, (ps)))
256
257#define amdgpu_dpm_vblank_too_short(adev) \
258 ((adev)->powerplay.pp_funcs->vblank_too_short((adev)->powerplay.pp_handle))
259
260#define amdgpu_dpm_enable_bapm(adev, e) \
261 ((adev)->powerplay.pp_funcs->enable_bapm((adev)->powerplay.pp_handle, (e)))
Alex Deuchercf0978812016-10-07 11:40:09 -0400262
Tom St Denis9f8df7d2017-02-09 14:29:01 -0500263#define amdgpu_dpm_read_sensor(adev, idx, value, size) \
Rex Zhucd4d7462017-09-06 18:43:52 +0800264 ((adev)->powerplay.pp_funcs->read_sensor((adev)->powerplay.pp_handle, (idx), (value), (size)))
Alex Deuchercf0978812016-10-07 11:40:09 -0400265
Alex Deuchercf0978812016-10-07 11:40:09 -0400266#define amdgpu_dpm_set_fan_control_mode(adev, m) \
Rex Zhucd4d7462017-09-06 18:43:52 +0800267 ((adev)->powerplay.pp_funcs->set_fan_control_mode((adev)->powerplay.pp_handle, (m)))
Alex Deuchercf0978812016-10-07 11:40:09 -0400268
269#define amdgpu_dpm_get_fan_control_mode(adev) \
Rex Zhucd4d7462017-09-06 18:43:52 +0800270 ((adev)->powerplay.pp_funcs->get_fan_control_mode((adev)->powerplay.pp_handle))
Alex Deuchercf0978812016-10-07 11:40:09 -0400271
272#define amdgpu_dpm_set_fan_speed_percent(adev, s) \
Rex Zhucd4d7462017-09-06 18:43:52 +0800273 ((adev)->powerplay.pp_funcs->set_fan_speed_percent((adev)->powerplay.pp_handle, (s)))
Alex Deuchercf0978812016-10-07 11:40:09 -0400274
275#define amdgpu_dpm_get_fan_speed_percent(adev, s) \
Rex Zhucd4d7462017-09-06 18:43:52 +0800276 ((adev)->powerplay.pp_funcs->get_fan_speed_percent((adev)->powerplay.pp_handle, (s)))
Alex Deuchercf0978812016-10-07 11:40:09 -0400277
Grazvydas Ignotas81c15142016-10-29 23:28:59 +0300278#define amdgpu_dpm_get_fan_speed_rpm(adev, s) \
Rex Zhucd4d7462017-09-06 18:43:52 +0800279 ((adev)->powerplay.pp_funcs->get_fan_speed_rpm)((adev)->powerplay.pp_handle, (s))
Grazvydas Ignotas81c15142016-10-29 23:28:59 +0300280
Alex Deuchercf0978812016-10-07 11:40:09 -0400281#define amdgpu_dpm_get_sclk(adev, l) \
Rex Zhucd4d7462017-09-06 18:43:52 +0800282 ((adev)->powerplay.pp_funcs->get_sclk((adev)->powerplay.pp_handle, (l)))
Alex Deuchercf0978812016-10-07 11:40:09 -0400283
284#define amdgpu_dpm_get_mclk(adev, l) \
Rex Zhucd4d7462017-09-06 18:43:52 +0800285 ((adev)->powerplay.pp_funcs->get_mclk((adev)->powerplay.pp_handle, (l)))
Alex Deuchercf0978812016-10-07 11:40:09 -0400286
287#define amdgpu_dpm_force_performance_level(adev, l) \
Rex Zhucd4d7462017-09-06 18:43:52 +0800288 ((adev)->powerplay.pp_funcs->force_performance_level((adev)->powerplay.pp_handle, (l)))
Alex Deuchercf0978812016-10-07 11:40:09 -0400289
290#define amdgpu_dpm_powergate_uvd(adev, g) \
Rex Zhucd4d7462017-09-06 18:43:52 +0800291 ((adev)->powerplay.pp_funcs->powergate_uvd((adev)->powerplay.pp_handle, (g)))
Alex Deuchercf0978812016-10-07 11:40:09 -0400292
293#define amdgpu_dpm_powergate_vce(adev, g) \
Rex Zhucd4d7462017-09-06 18:43:52 +0800294 ((adev)->powerplay.pp_funcs->powergate_vce((adev)->powerplay.pp_handle, (g)))
Alex Deuchercf0978812016-10-07 11:40:09 -0400295
296#define amdgpu_dpm_get_current_power_state(adev) \
Rex Zhucd4d7462017-09-06 18:43:52 +0800297 ((adev)->powerplay.pp_funcs->get_current_power_state((adev)->powerplay.pp_handle))
Alex Deuchercf0978812016-10-07 11:40:09 -0400298
Alex Deuchercf0978812016-10-07 11:40:09 -0400299#define amdgpu_dpm_get_pp_num_states(adev, data) \
Rex Zhucd4d7462017-09-06 18:43:52 +0800300 ((adev)->powerplay.pp_funcs->get_pp_num_states((adev)->powerplay.pp_handle, data))
Alex Deuchercf0978812016-10-07 11:40:09 -0400301
302#define amdgpu_dpm_get_pp_table(adev, table) \
Rex Zhucd4d7462017-09-06 18:43:52 +0800303 ((adev)->powerplay.pp_funcs->get_pp_table((adev)->powerplay.pp_handle, table))
Alex Deuchercf0978812016-10-07 11:40:09 -0400304
305#define amdgpu_dpm_set_pp_table(adev, buf, size) \
Rex Zhucd4d7462017-09-06 18:43:52 +0800306 ((adev)->powerplay.pp_funcs->set_pp_table((adev)->powerplay.pp_handle, buf, size))
Alex Deuchercf0978812016-10-07 11:40:09 -0400307
308#define amdgpu_dpm_print_clock_levels(adev, type, buf) \
Rex Zhucd4d7462017-09-06 18:43:52 +0800309 ((adev)->powerplay.pp_funcs->print_clock_levels((adev)->powerplay.pp_handle, type, buf))
Alex Deuchercf0978812016-10-07 11:40:09 -0400310
311#define amdgpu_dpm_force_clock_level(adev, type, level) \
Rex Zhucd4d7462017-09-06 18:43:52 +0800312 ((adev)->powerplay.pp_funcs->force_clock_level((adev)->powerplay.pp_handle, type, level))
Alex Deuchercf0978812016-10-07 11:40:09 -0400313
314#define amdgpu_dpm_get_sclk_od(adev) \
Rex Zhucd4d7462017-09-06 18:43:52 +0800315 ((adev)->powerplay.pp_funcs->get_sclk_od((adev)->powerplay.pp_handle))
Alex Deuchercf0978812016-10-07 11:40:09 -0400316
317#define amdgpu_dpm_set_sclk_od(adev, value) \
Rex Zhucd4d7462017-09-06 18:43:52 +0800318 ((adev)->powerplay.pp_funcs->set_sclk_od((adev)->powerplay.pp_handle, value))
Alex Deuchercf0978812016-10-07 11:40:09 -0400319
320#define amdgpu_dpm_get_mclk_od(adev) \
Rex Zhucd4d7462017-09-06 18:43:52 +0800321 ((adev)->powerplay.pp_funcs->get_mclk_od((adev)->powerplay.pp_handle))
Alex Deuchercf0978812016-10-07 11:40:09 -0400322
323#define amdgpu_dpm_set_mclk_od(adev, value) \
Rex Zhucd4d7462017-09-06 18:43:52 +0800324 ((adev)->powerplay.pp_funcs->set_mclk_od((adev)->powerplay.pp_handle, value))
Alex Deuchercf0978812016-10-07 11:40:09 -0400325
Evan Quan39199b82017-12-29 14:46:13 +0800326#define amdgpu_dpm_dispatch_task(adev, task_id, user_state) \
327 ((adev)->powerplay.pp_funcs->dispatch_tasks)((adev)->powerplay.pp_handle, (task_id), (user_state))
Alex Deuchercf0978812016-10-07 11:40:09 -0400328
Rex Zhucd4d7462017-09-06 18:43:52 +0800329#define amdgpu_dpm_check_state_equal(adev, cps, rps, equal) \
330 ((adev)->powerplay.pp_funcs->check_state_equal((adev)->powerplay.pp_handle, (cps), (rps), (equal)))
Rex Zhufbebf2c2016-10-17 13:49:27 +0800331
Alex Deucher230cf1b2016-10-07 14:10:15 -0400332#define amdgpu_dpm_get_vce_clock_state(adev, i) \
Rex Zhucd4d7462017-09-06 18:43:52 +0800333 ((adev)->powerplay.pp_funcs->get_vce_clock_state((adev)->powerplay.pp_handle, (i)))
Alex Deuchercf0978812016-10-07 11:40:09 -0400334
Rex Zhucd4d7462017-09-06 18:43:52 +0800335#define amdgpu_dpm_get_performance_level(adev) \
336 ((adev)->powerplay.pp_funcs->get_performance_level((adev)->powerplay.pp_handle))
Rex Zhue5d03ac2016-12-23 14:39:41 +0800337
Eric Huang34bb2732016-09-12 16:17:44 -0400338#define amdgpu_dpm_reset_power_profile_state(adev, request) \
Rex Zhucd4d7462017-09-06 18:43:52 +0800339 ((adev)->powerplay.pp_funcs->reset_power_profile_state(\
Eric Huang34bb2732016-09-12 16:17:44 -0400340 (adev)->powerplay.pp_handle, request))
341
Rex Zhu052fe962018-03-02 20:09:11 +0800342#define amdgpu_dpm_switch_power_profile(adev, type, en) \
Rex Zhucd4d7462017-09-06 18:43:52 +0800343 ((adev)->powerplay.pp_funcs->switch_power_profile(\
Rex Zhu052fe962018-03-02 20:09:11 +0800344 (adev)->powerplay.pp_handle, type, en))
Eric Huang34bb2732016-09-12 16:17:44 -0400345
Rex Zhu3811f8f2017-09-26 13:39:38 +0800346#define amdgpu_dpm_set_clockgating_by_smu(adev, msg_id) \
347 ((adev)->powerplay.pp_funcs->set_clockgating_by_smu(\
348 (adev)->powerplay.pp_handle, msg_id))
349
Rex Zhu37c5c4d2018-01-10 18:42:36 +0800350#define amdgpu_dpm_get_power_profile_mode(adev, buf) \
351 ((adev)->powerplay.pp_funcs->get_power_profile_mode(\
352 (adev)->powerplay.pp_handle, buf))
353
354#define amdgpu_dpm_set_power_profile_mode(adev, parameter, size) \
355 ((adev)->powerplay.pp_funcs->set_power_profile_mode(\
356 (adev)->powerplay.pp_handle, parameter, size))
357
Rex Zhue3933f22018-01-16 18:35:15 +0800358#define amdgpu_dpm_odn_edit_dpm_table(adev, type, parameter, size) \
359 ((adev)->powerplay.pp_funcs->odn_edit_dpm_table(\
360 (adev)->powerplay.pp_handle, type, parameter, size))
361
Eric Huang913fa7a2018-02-06 16:19:24 -0500362#define amdgpu_dpm_set_mmhub_powergating_by_smu(adev) \
363 ((adev)->powerplay.pp_funcs->set_mmhub_powergating_by_smu( \
364 (adev)->powerplay.pp_handle))
365
Alex Deuchercf0978812016-10-07 11:40:09 -0400366struct amdgpu_dpm {
367 struct amdgpu_ps *ps;
368 /* number of valid power states */
369 int num_ps;
370 /* current power state that is active */
371 struct amdgpu_ps *current_ps;
372 /* requested power state */
373 struct amdgpu_ps *requested_ps;
374 /* boot up power state */
375 struct amdgpu_ps *boot_ps;
376 /* default uvd power state */
377 struct amdgpu_ps *uvd_ps;
378 /* vce requirements */
Rex Zhu66ba1af2016-10-12 15:38:56 +0800379 u32 num_of_vce_states;
Rex Zhu0d8de7c2016-10-12 15:13:29 +0800380 struct amd_vce_state vce_states[AMD_MAX_VCE_LEVELS];
381 enum amd_vce_level vce_level;
Alex Deuchercf0978812016-10-07 11:40:09 -0400382 enum amd_pm_state_type state;
383 enum amd_pm_state_type user_state;
Rex Zhu86f8c592016-10-03 20:46:36 +0800384 enum amd_pm_state_type last_state;
385 enum amd_pm_state_type last_user_state;
Alex Deuchercf0978812016-10-07 11:40:09 -0400386 u32 platform_caps;
387 u32 voltage_response_time;
388 u32 backbias_response_time;
389 void *priv;
390 u32 new_active_crtcs;
391 int new_active_crtc_count;
392 u32 current_active_crtcs;
393 int current_active_crtc_count;
394 struct amdgpu_dpm_dynamic_state dyn_state;
395 struct amdgpu_dpm_fan fan;
396 u32 tdp_limit;
397 u32 near_tdp_limit;
398 u32 near_tdp_limit_adjusted;
399 u32 sq_ramping_threshold;
400 u32 cac_leakage;
401 u16 tdp_od_limit;
402 u32 tdp_adjustment;
403 u16 load_line_slope;
404 bool power_control;
405 bool ac_power;
406 /* special states active */
407 bool thermal_active;
408 bool uvd_active;
409 bool vce_active;
410 /* thermal handling */
411 struct amdgpu_dpm_thermal thermal;
412 /* forced levels */
Rex Zhue5d03ac2016-12-23 14:39:41 +0800413 enum amd_dpm_forced_level forced_level;
Alex Deuchercf0978812016-10-07 11:40:09 -0400414};
415
416struct amdgpu_pm {
417 struct mutex mutex;
418 u32 current_sclk;
419 u32 current_mclk;
420 u32 default_sclk;
421 u32 default_mclk;
422 struct amdgpu_i2c_chan *i2c_bus;
423 /* internal thermal controller on rv6xx+ */
424 enum amdgpu_int_thermal_type int_thermal_type;
425 struct device *int_hwmon_dev;
426 /* fan control parameters */
427 bool no_fan;
428 u8 fan_pulses_per_revolution;
429 u8 fan_min_rpm;
430 u8 fan_max_rpm;
431 /* dpm */
432 bool dpm_enabled;
433 bool sysfs_initialized;
434 struct amdgpu_dpm dpm;
435 const struct firmware *fw; /* SMC firmware */
436 uint32_t fw_version;
Alex Deuchercf0978812016-10-07 11:40:09 -0400437 uint32_t pcie_gen_mask;
438 uint32_t pcie_mlw_mask;
Harry Wentland45622362017-09-12 15:58:20 -0400439 struct amd_pp_display_configuration pm_display_cfg;/* set by dc */
Rex Zhu7951e372018-04-13 16:13:41 +0800440 uint32_t smu_prv_buffer_size;
441 struct amdgpu_bo *smu_prv_buffer;
Alex Deuchercf0978812016-10-07 11:40:09 -0400442};
443
Alex Deucherd38ceaf2015-04-20 16:55:21 -0400444#define R600_SSTU_DFLT 0
445#define R600_SST_DFLT 0x00C8
446
447/* XXX are these ok? */
448#define R600_TEMP_RANGE_MIN (90 * 1000)
449#define R600_TEMP_RANGE_MAX (120 * 1000)
450
451#define FDO_PWM_MODE_STATIC 1
452#define FDO_PWM_MODE_STATIC_RPM 5
453
454enum amdgpu_td {
455 AMDGPU_TD_AUTO,
456 AMDGPU_TD_UP,
457 AMDGPU_TD_DOWN,
458};
459
460enum amdgpu_display_watermark {
461 AMDGPU_DISPLAY_WATERMARK_LOW = 0,
462 AMDGPU_DISPLAY_WATERMARK_HIGH = 1,
463};
464
465enum amdgpu_display_gap
466{
467 AMDGPU_PM_DISPLAY_GAP_VBLANK_OR_WM = 0,
468 AMDGPU_PM_DISPLAY_GAP_VBLANK = 1,
469 AMDGPU_PM_DISPLAY_GAP_WATERMARK = 2,
470 AMDGPU_PM_DISPLAY_GAP_IGNORE = 3,
471};
472
473void amdgpu_dpm_print_class_info(u32 class, u32 class2);
474void amdgpu_dpm_print_cap_info(u32 caps);
475void amdgpu_dpm_print_ps_status(struct amdgpu_device *adev,
476 struct amdgpu_ps *rps);
477u32 amdgpu_dpm_get_vblank_time(struct amdgpu_device *adev);
478u32 amdgpu_dpm_get_vrefresh(struct amdgpu_device *adev);
Rex Zhud91ea492018-03-26 22:08:29 +0800479void amdgpu_dpm_get_active_displays(struct amdgpu_device *adev);
Alex Deucherd38ceaf2015-04-20 16:55:21 -0400480bool amdgpu_is_uvd_state(u32 class, u32 class2);
481void amdgpu_calculate_u_and_p(u32 i, u32 r_c, u32 p_b,
482 u32 *p, u32 *u);
483int amdgpu_calculate_at(u32 t, u32 h, u32 fh, u32 fl, u32 *tl, u32 *th);
484
485bool amdgpu_is_internal_thermal_sensor(enum amdgpu_int_thermal_type sensor);
486
487int amdgpu_get_platform_caps(struct amdgpu_device *adev);
488
489int amdgpu_parse_extended_power_table(struct amdgpu_device *adev);
490void amdgpu_free_extended_power_table(struct amdgpu_device *adev);
491
492void amdgpu_add_thermal_controller(struct amdgpu_device *adev);
493
494enum amdgpu_pcie_gen amdgpu_get_pcie_gen_support(struct amdgpu_device *adev,
495 u32 sys_mask,
496 enum amdgpu_pcie_gen asic_gen,
497 enum amdgpu_pcie_gen default_gen);
498
499u16 amdgpu_get_pcie_lane_support(struct amdgpu_device *adev,
500 u16 asic_lanes,
501 u16 default_lanes);
502u8 amdgpu_encode_pci_lane_width(u32 lanes);
503
Alex Deucher825cc992016-10-07 12:38:04 -0400504struct amd_vce_state*
Rex Zhucfa289f2017-09-06 15:27:59 +0800505amdgpu_get_vce_clock_state(void *handle, u32 idx);
Alex Deucher825cc992016-10-07 12:38:04 -0400506
Alex Deucherd38ceaf2015-04-20 16:55:21 -0400507#endif