]> Git Repo - J-linux.git/blob - drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h
drm/amdgpu: fix build error without x86 kconfig (v2)
[J-linux.git] / drivers / gpu / drm / amd / pm / inc / amdgpu_smu.h
1 /*
2  * Copyright 2019 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 #ifndef __AMDGPU_SMU_H__
23 #define __AMDGPU_SMU_H__
24
25 #include "amdgpu.h"
26 #include "kgd_pp_interface.h"
27 #include "dm_pp_interface.h"
28 #include "dm_pp_smu.h"
29 #include "smu_types.h"
30
31 #define SMU_THERMAL_MINIMUM_ALERT_TEMP          0
32 #define SMU_THERMAL_MAXIMUM_ALERT_TEMP          255
33 #define SMU_TEMPERATURE_UNITS_PER_CENTIGRADES   1000
34 #define SMU_FW_NAME_LEN                 0x24
35
36 struct smu_hw_power_state {
37         unsigned int magic;
38 };
39
40 struct smu_power_state;
41
42 enum smu_state_ui_label {
43         SMU_STATE_UI_LABEL_NONE,
44         SMU_STATE_UI_LABEL_BATTERY,
45         SMU_STATE_UI_TABEL_MIDDLE_LOW,
46         SMU_STATE_UI_LABEL_BALLANCED,
47         SMU_STATE_UI_LABEL_MIDDLE_HIGHT,
48         SMU_STATE_UI_LABEL_PERFORMANCE,
49         SMU_STATE_UI_LABEL_BACO,
50 };
51
52 enum smu_state_classification_flag {
53         SMU_STATE_CLASSIFICATION_FLAG_BOOT                     = 0x0001,
54         SMU_STATE_CLASSIFICATION_FLAG_THERMAL                  = 0x0002,
55         SMU_STATE_CLASSIFICATIN_FLAG_LIMITED_POWER_SOURCE      = 0x0004,
56         SMU_STATE_CLASSIFICATION_FLAG_RESET                    = 0x0008,
57         SMU_STATE_CLASSIFICATION_FLAG_FORCED                   = 0x0010,
58         SMU_STATE_CLASSIFICATION_FLAG_USER_3D_PERFORMANCE      = 0x0020,
59         SMU_STATE_CLASSIFICATION_FLAG_USER_2D_PERFORMANCE      = 0x0040,
60         SMU_STATE_CLASSIFICATION_FLAG_3D_PERFORMANCE           = 0x0080,
61         SMU_STATE_CLASSIFICATION_FLAG_AC_OVERDIRVER_TEMPLATE   = 0x0100,
62         SMU_STATE_CLASSIFICATION_FLAG_UVD                      = 0x0200,
63         SMU_STATE_CLASSIFICATION_FLAG_3D_PERFORMANCE_LOW       = 0x0400,
64         SMU_STATE_CLASSIFICATION_FLAG_ACPI                     = 0x0800,
65         SMU_STATE_CLASSIFICATION_FLAG_HD2                      = 0x1000,
66         SMU_STATE_CLASSIFICATION_FLAG_UVD_HD                   = 0x2000,
67         SMU_STATE_CLASSIFICATION_FLAG_UVD_SD                   = 0x4000,
68         SMU_STATE_CLASSIFICATION_FLAG_USER_DC_PERFORMANCE      = 0x8000,
69         SMU_STATE_CLASSIFICATION_FLAG_DC_OVERDIRVER_TEMPLATE   = 0x10000,
70         SMU_STATE_CLASSIFICATION_FLAG_BACO                     = 0x20000,
71         SMU_STATE_CLASSIFICATIN_FLAG_LIMITED_POWER_SOURCE2      = 0x40000,
72         SMU_STATE_CLASSIFICATION_FLAG_ULV                      = 0x80000,
73         SMU_STATE_CLASSIFICATION_FLAG_UVD_MVC                  = 0x100000,
74 };
75
76 struct smu_state_classification_block {
77         enum smu_state_ui_label         ui_label;
78         enum smu_state_classification_flag  flags;
79         int                          bios_index;
80         bool                      temporary_state;
81         bool                      to_be_deleted;
82 };
83
84 struct smu_state_pcie_block {
85         unsigned int lanes;
86 };
87
88 enum smu_refreshrate_source {
89         SMU_REFRESHRATE_SOURCE_EDID,
90         SMU_REFRESHRATE_SOURCE_EXPLICIT
91 };
92
93 struct smu_state_display_block {
94         bool              disable_frame_modulation;
95         bool              limit_refreshrate;
96         enum smu_refreshrate_source refreshrate_source;
97         int                  explicit_refreshrate;
98         int                  edid_refreshrate_index;
99         bool              enable_vari_bright;
100 };
101
102 struct smu_state_memory_block {
103         bool              dll_off;
104         uint8_t                 m3arb;
105         uint8_t                 unused[3];
106 };
107
108 struct smu_state_software_algorithm_block {
109         bool disable_load_balancing;
110         bool enable_sleep_for_timestamps;
111 };
112
113 struct smu_temperature_range {
114         int min;
115         int max;
116         int edge_emergency_max;
117         int hotspot_min;
118         int hotspot_crit_max;
119         int hotspot_emergency_max;
120         int mem_min;
121         int mem_crit_max;
122         int mem_emergency_max;
123         int software_shutdown_temp;
124 };
125
126 struct smu_state_validation_block {
127         bool single_display_only;
128         bool disallow_on_dc;
129         uint8_t supported_power_levels;
130 };
131
132 struct smu_uvd_clocks {
133         uint32_t vclk;
134         uint32_t dclk;
135 };
136
137 /**
138 * Structure to hold a SMU Power State.
139 */
140 struct smu_power_state {
141         uint32_t                                      id;
142         struct list_head                              ordered_list;
143         struct list_head                              all_states_list;
144
145         struct smu_state_classification_block         classification;
146         struct smu_state_validation_block             validation;
147         struct smu_state_pcie_block                   pcie;
148         struct smu_state_display_block                display;
149         struct smu_state_memory_block                 memory;
150         struct smu_state_software_algorithm_block     software;
151         struct smu_uvd_clocks                         uvd_clocks;
152         struct smu_hw_power_state                     hardware;
153 };
154
155 enum smu_power_src_type
156 {
157         SMU_POWER_SOURCE_AC,
158         SMU_POWER_SOURCE_DC,
159         SMU_POWER_SOURCE_COUNT,
160 };
161
162 enum smu_memory_pool_size
163 {
164     SMU_MEMORY_POOL_SIZE_ZERO   = 0,
165     SMU_MEMORY_POOL_SIZE_256_MB = 0x10000000,
166     SMU_MEMORY_POOL_SIZE_512_MB = 0x20000000,
167     SMU_MEMORY_POOL_SIZE_1_GB   = 0x40000000,
168     SMU_MEMORY_POOL_SIZE_2_GB   = 0x80000000,
169 };
170
171 #define SMU_TABLE_INIT(tables, table_id, s, a, d)       \
172         do {                                            \
173                 tables[table_id].size = s;              \
174                 tables[table_id].align = a;             \
175                 tables[table_id].domain = d;            \
176         } while (0)
177
178 struct smu_table {
179         uint64_t size;
180         uint32_t align;
181         uint8_t domain;
182         uint64_t mc_address;
183         void *cpu_addr;
184         struct amdgpu_bo *bo;
185 };
186
187 enum smu_perf_level_designation {
188         PERF_LEVEL_ACTIVITY,
189         PERF_LEVEL_POWER_CONTAINMENT,
190 };
191
192 struct smu_performance_level {
193         uint32_t core_clock;
194         uint32_t memory_clock;
195         uint32_t vddc;
196         uint32_t vddci;
197         uint32_t non_local_mem_freq;
198         uint32_t non_local_mem_width;
199 };
200
201 struct smu_clock_info {
202         uint32_t min_mem_clk;
203         uint32_t max_mem_clk;
204         uint32_t min_eng_clk;
205         uint32_t max_eng_clk;
206         uint32_t min_bus_bandwidth;
207         uint32_t max_bus_bandwidth;
208 };
209
210 struct smu_bios_boot_up_values
211 {
212         uint32_t                        revision;
213         uint32_t                        gfxclk;
214         uint32_t                        uclk;
215         uint32_t                        socclk;
216         uint32_t                        dcefclk;
217         uint32_t                        eclk;
218         uint32_t                        vclk;
219         uint32_t                        dclk;
220         uint16_t                        vddc;
221         uint16_t                        vddci;
222         uint16_t                        mvddc;
223         uint16_t                        vdd_gfx;
224         uint8_t                         cooling_id;
225         uint32_t                        pp_table_id;
226         uint32_t                        format_revision;
227         uint32_t                        content_revision;
228         uint32_t                        fclk;
229         uint32_t                        lclk;
230         uint32_t                        firmware_caps;
231 };
232
233 enum smu_table_id
234 {
235         SMU_TABLE_PPTABLE = 0,
236         SMU_TABLE_WATERMARKS,
237         SMU_TABLE_CUSTOM_DPM,
238         SMU_TABLE_DPMCLOCKS,
239         SMU_TABLE_AVFS,
240         SMU_TABLE_AVFS_PSM_DEBUG,
241         SMU_TABLE_AVFS_FUSE_OVERRIDE,
242         SMU_TABLE_PMSTATUSLOG,
243         SMU_TABLE_SMU_METRICS,
244         SMU_TABLE_DRIVER_SMU_CONFIG,
245         SMU_TABLE_ACTIVITY_MONITOR_COEFF,
246         SMU_TABLE_OVERDRIVE,
247         SMU_TABLE_I2C_COMMANDS,
248         SMU_TABLE_PACE,
249         SMU_TABLE_COUNT,
250 };
251
252 struct smu_table_context
253 {
254         void                            *power_play_table;
255         uint32_t                        power_play_table_size;
256         void                            *hardcode_pptable;
257         unsigned long                   metrics_time;
258         void                            *metrics_table;
259         void                            *clocks_table;
260         void                            *watermarks_table;
261
262         void                            *max_sustainable_clocks;
263         struct smu_bios_boot_up_values  boot_values;
264         void                            *driver_pptable;
265         struct smu_table                tables[SMU_TABLE_COUNT];
266         /*
267          * The driver table is just a staging buffer for
268          * uploading/downloading content from the SMU.
269          *
270          * And the table_id for SMU_MSG_TransferTableSmu2Dram/
271          * SMU_MSG_TransferTableDram2Smu instructs SMU
272          * which content driver is interested.
273          */
274         struct smu_table                driver_table;
275         struct smu_table                memory_pool;
276         struct smu_table                dummy_read_1_table;
277         uint8_t                         thermal_controller_type;
278
279         void                            *overdrive_table;
280         void                            *boot_overdrive_table;
281
282         uint32_t                        gpu_metrics_table_size;
283         void                            *gpu_metrics_table;
284 };
285
286 struct smu_dpm_context {
287         uint32_t dpm_context_size;
288         void *dpm_context;
289         void *golden_dpm_context;
290         bool enable_umd_pstate;
291         enum amd_dpm_forced_level dpm_level;
292         enum amd_dpm_forced_level saved_dpm_level;
293         enum amd_dpm_forced_level requested_dpm_level;
294         struct smu_power_state *dpm_request_power_state;
295         struct smu_power_state *dpm_current_power_state;
296         struct mclock_latency_table *mclk_latency_table;
297 };
298
299 struct smu_power_gate {
300         bool uvd_gated;
301         bool vce_gated;
302         atomic_t vcn_gated;
303         atomic_t jpeg_gated;
304         struct mutex vcn_gate_lock;
305         struct mutex jpeg_gate_lock;
306 };
307
308 struct smu_power_context {
309         void *power_context;
310         uint32_t power_context_size;
311         struct smu_power_gate power_gate;
312 };
313
314
315 #define SMU_FEATURE_MAX (64)
316 struct smu_feature
317 {
318         uint32_t feature_num;
319         DECLARE_BITMAP(supported, SMU_FEATURE_MAX);
320         DECLARE_BITMAP(allowed, SMU_FEATURE_MAX);
321         DECLARE_BITMAP(enabled, SMU_FEATURE_MAX);
322         struct mutex mutex;
323 };
324
325 struct smu_clocks {
326         uint32_t engine_clock;
327         uint32_t memory_clock;
328         uint32_t bus_bandwidth;
329         uint32_t engine_clock_in_sr;
330         uint32_t dcef_clock;
331         uint32_t dcef_clock_in_sr;
332 };
333
334 #define MAX_REGULAR_DPM_NUM 16
335 struct mclk_latency_entries {
336         uint32_t  frequency;
337         uint32_t  latency;
338 };
339 struct mclock_latency_table {
340         uint32_t  count;
341         struct mclk_latency_entries  entries[MAX_REGULAR_DPM_NUM];
342 };
343
344 enum smu_reset_mode
345 {
346     SMU_RESET_MODE_0,
347     SMU_RESET_MODE_1,
348     SMU_RESET_MODE_2,
349 };
350
351 enum smu_baco_state
352 {
353         SMU_BACO_STATE_ENTER = 0,
354         SMU_BACO_STATE_EXIT,
355 };
356
357 struct smu_baco_context
358 {
359         struct mutex mutex;
360         uint32_t state;
361         bool platform_support;
362 };
363
364 struct pstates_clk_freq {
365         uint32_t                        min;
366         uint32_t                        standard;
367         uint32_t                        peak;
368 };
369
370 struct smu_umd_pstate_table {
371         struct pstates_clk_freq         gfxclk_pstate;
372         struct pstates_clk_freq         socclk_pstate;
373         struct pstates_clk_freq         uclk_pstate;
374         struct pstates_clk_freq         vclk_pstate;
375         struct pstates_clk_freq         dclk_pstate;
376 };
377
378 struct cmn2asic_msg_mapping {
379         int     valid_mapping;
380         int     map_to;
381         int     valid_in_vf;
382 };
383
384 struct cmn2asic_mapping {
385         int     valid_mapping;
386         int     map_to;
387 };
388
389 #define WORKLOAD_POLICY_MAX 7
390 struct smu_context
391 {
392         struct amdgpu_device            *adev;
393         struct amdgpu_irq_src           irq_source;
394
395         const struct pptable_funcs      *ppt_funcs;
396         const struct cmn2asic_msg_mapping       *message_map;
397         const struct cmn2asic_mapping   *clock_map;
398         const struct cmn2asic_mapping   *feature_map;
399         const struct cmn2asic_mapping   *table_map;
400         const struct cmn2asic_mapping   *pwr_src_map;
401         const struct cmn2asic_mapping   *workload_map;
402         struct mutex                    mutex;
403         struct mutex                    sensor_lock;
404         struct mutex                    metrics_lock;
405         struct mutex                    message_lock;
406         uint64_t pool_size;
407
408         struct smu_table_context        smu_table;
409         struct smu_dpm_context          smu_dpm;
410         struct smu_power_context        smu_power;
411         struct smu_feature              smu_feature;
412         struct amd_pp_display_configuration  *display_config;
413         struct smu_baco_context         smu_baco;
414         struct smu_temperature_range    thermal_range;
415         void *od_settings;
416 #if defined(CONFIG_DEBUG_FS)
417         struct dentry                   *debugfs_sclk;
418 #endif
419
420         struct smu_umd_pstate_table     pstate_table;
421         uint32_t pstate_sclk;
422         uint32_t pstate_mclk;
423
424         bool od_enabled;
425         uint32_t current_power_limit;
426         uint32_t max_power_limit;
427
428         /* soft pptable */
429         uint32_t ppt_offset_bytes;
430         uint32_t ppt_size_bytes;
431         uint8_t  *ppt_start_addr;
432
433         bool support_power_containment;
434         bool disable_watermark;
435
436 #define WATERMARKS_EXIST        (1 << 0)
437 #define WATERMARKS_LOADED       (1 << 1)
438         uint32_t watermarks_bitmap;
439         uint32_t hard_min_uclk_req_from_dal;
440         bool disable_uclk_switch;
441
442         uint32_t workload_mask;
443         uint32_t workload_prority[WORKLOAD_POLICY_MAX];
444         uint32_t workload_setting[WORKLOAD_POLICY_MAX];
445         uint32_t power_profile_mode;
446         uint32_t default_power_profile_mode;
447         bool pm_enabled;
448         bool is_apu;
449
450         uint32_t smc_driver_if_version;
451         uint32_t smc_fw_if_version;
452         uint32_t smc_fw_version;
453
454         bool uploading_custom_pp_table;
455         bool dc_controlled_by_gpio;
456
457         struct work_struct throttling_logging_work;
458         atomic64_t throttle_int_counter;
459         struct work_struct interrupt_work;
460
461         unsigned fan_max_rpm;
462         unsigned manual_fan_speed_rpm;
463
464         uint32_t gfx_default_hard_min_freq;
465         uint32_t gfx_default_soft_max_freq;
466         uint32_t gfx_actual_hard_min_freq;
467         uint32_t gfx_actual_soft_max_freq;
468
469         /* APU only */
470         uint32_t cpu_default_soft_min_freq;
471         uint32_t cpu_default_soft_max_freq;
472         uint32_t cpu_actual_soft_min_freq;
473         uint32_t cpu_actual_soft_max_freq;
474         uint32_t cpu_core_id_select;
475         uint16_t cpu_core_num;
476 };
477
478 struct i2c_adapter;
479
480 /**
481  * struct pptable_funcs - Callbacks used to interact with the SMU.
482  */
483 struct pptable_funcs {
484         /**
485          * @run_btc: Calibrate voltage/frequency curve to fit the system's
486          *           power delivery and voltage margins. Required for adaptive
487          *           voltage frequency scaling (AVFS).
488          */
489         int (*run_btc)(struct smu_context *smu);
490
491         /**
492          * @get_allowed_feature_mask: Get allowed feature mask.
493          * &feature_mask: Array to store feature mask.
494          * &num: Elements in &feature_mask.
495          */
496         int (*get_allowed_feature_mask)(struct smu_context *smu, uint32_t *feature_mask, uint32_t num);
497
498         /**
499          * @get_current_power_state: Get the current power state.
500          *
501          * Return: Current power state on success, negative errno on failure.
502          */
503         enum amd_pm_state_type (*get_current_power_state)(struct smu_context *smu);
504
505         /**
506          * @set_default_dpm_table: Retrieve the default overdrive settings from
507          *                         the SMU.
508          */
509         int (*set_default_dpm_table)(struct smu_context *smu);
510
511         int (*set_power_state)(struct smu_context *smu);
512
513         /**
514          * @populate_umd_state_clk: Populate the UMD power state table with
515          *                          defaults.
516          */
517         int (*populate_umd_state_clk)(struct smu_context *smu);
518
519         /**
520          * @print_clk_levels: Print DPM clock levels for a clock domain
521          *                    to buffer. Star current level.
522          *
523          * Used for sysfs interfaces.
524          */
525         int (*print_clk_levels)(struct smu_context *smu, enum smu_clk_type clk_type, char *buf);
526
527         /**
528          * @force_clk_levels: Set a range of allowed DPM levels for a clock
529          *                    domain.
530          * &clk_type: Clock domain.
531          * &mask: Range of allowed DPM levels.
532          */
533         int (*force_clk_levels)(struct smu_context *smu, enum smu_clk_type clk_type, uint32_t mask);
534
535         /**
536          * @od_edit_dpm_table: Edit the custom overdrive DPM table.
537          * &type: Type of edit.
538          * &input: Edit parameters.
539          * &size: Size of &input.
540          */
541         int (*od_edit_dpm_table)(struct smu_context *smu,
542                                  enum PP_OD_DPM_TABLE_COMMAND type,
543                                  long *input, uint32_t size);
544
545         /**
546          * @get_clock_by_type_with_latency: Get the speed and latency of a clock
547          *                                  domain.
548          */
549         int (*get_clock_by_type_with_latency)(struct smu_context *smu,
550                                               enum smu_clk_type clk_type,
551                                               struct
552                                               pp_clock_levels_with_latency
553                                               *clocks);
554         /**
555          * @get_clock_by_type_with_voltage: Get the speed and voltage of a clock
556          *                                  domain.
557          */
558         int (*get_clock_by_type_with_voltage)(struct smu_context *smu,
559                                               enum amd_pp_clock_type type,
560                                               struct
561                                               pp_clock_levels_with_voltage
562                                               *clocks);
563
564         /**
565          * @get_power_profile_mode: Print all power profile modes to
566          *                          buffer. Star current mode.
567          */
568         int (*get_power_profile_mode)(struct smu_context *smu, char *buf);
569
570         /**
571          * @set_power_profile_mode: Set a power profile mode. Also used to
572          *                          create/set custom power profile modes.
573          * &input: Power profile mode parameters.
574          * &size: Size of &input.
575          */
576         int (*set_power_profile_mode)(struct smu_context *smu, long *input, uint32_t size);
577
578         /**
579          * @dpm_set_vcn_enable: Enable/disable VCN engine dynamic power
580          *                      management.
581          */
582         int (*dpm_set_vcn_enable)(struct smu_context *smu, bool enable);
583
584         /**
585          * @dpm_set_jpeg_enable: Enable/disable JPEG engine dynamic power
586          *                       management.
587          */
588         int (*dpm_set_jpeg_enable)(struct smu_context *smu, bool enable);
589
590         /**
591          * @read_sensor: Read data from a sensor.
592          * &sensor: Sensor to read data from.
593          * &data: Sensor reading.
594          * &size: Size of &data.
595          */
596         int (*read_sensor)(struct smu_context *smu, enum amd_pp_sensors sensor,
597                            void *data, uint32_t *size);
598
599         /**
600          * @pre_display_config_changed: Prepare GPU for a display configuration
601          *                              change.
602          *
603          * Disable display tracking and pin memory clock speed to maximum. Used
604          * in display component synchronization.
605          */
606         int (*pre_display_config_changed)(struct smu_context *smu);
607
608         /**
609          * @display_config_changed: Notify the SMU of the current display
610          *                          configuration.
611          *
612          * Allows SMU to properly track blanking periods for memory clock
613          * adjustment. Used in display component synchronization.
614          */
615         int (*display_config_changed)(struct smu_context *smu);
616
617         int (*apply_clocks_adjust_rules)(struct smu_context *smu);
618
619         /**
620          * @notify_smc_display_config: Applies display requirements to the
621          *                             current power state.
622          *
623          * Optimize deep sleep DCEFclk and mclk for the current display
624          * configuration. Used in display component synchronization.
625          */
626         int (*notify_smc_display_config)(struct smu_context *smu);
627
628         /**
629          * @is_dpm_running: Check if DPM is running.
630          *
631          * Return: True if DPM is running, false otherwise.
632          */
633         bool (*is_dpm_running)(struct smu_context *smu);
634
635         /**
636          * @get_fan_speed_rpm: Get the current fan speed in RPM.
637          */
638         int (*get_fan_speed_rpm)(struct smu_context *smu, uint32_t *speed);
639
640         /**
641          * @set_watermarks_table: Configure and upload the watermarks tables to
642          *                        the SMU.
643          */
644         int (*set_watermarks_table)(struct smu_context *smu,
645                                     struct pp_smu_wm_range_sets *clock_ranges);
646
647         /**
648          * @get_thermal_temperature_range: Get safe thermal limits in Celcius.
649          */
650         int (*get_thermal_temperature_range)(struct smu_context *smu, struct smu_temperature_range *range);
651
652         /**
653          * @get_uclk_dpm_states: Get memory clock DPM levels in kHz.
654          * &clocks_in_khz: Array of DPM levels.
655          * &num_states: Elements in &clocks_in_khz.
656          */
657         int (*get_uclk_dpm_states)(struct smu_context *smu, uint32_t *clocks_in_khz, uint32_t *num_states);
658
659         /**
660          * @set_default_od_settings: Set the overdrive tables to defaults.
661          */
662         int (*set_default_od_settings)(struct smu_context *smu);
663
664         /**
665          * @set_performance_level: Set a performance level.
666          */
667         int (*set_performance_level)(struct smu_context *smu, enum amd_dpm_forced_level level);
668
669         /**
670          * @display_disable_memory_clock_switch: Enable/disable dynamic memory
671          *                                       clock switching.
672          *
673          * Disabling this feature forces memory clock speed to maximum.
674          * Enabling sets the minimum memory clock capable of driving the
675          * current display configuration.
676          */
677         int (*display_disable_memory_clock_switch)(struct smu_context *smu, bool disable_memory_clock_switch);
678
679         /**
680          * @dump_pptable: Print the power play table to the system log.
681          */
682         void (*dump_pptable)(struct smu_context *smu);
683
684         /**
685          * @get_power_limit: Get the device's power limits.
686          */
687         int (*get_power_limit)(struct smu_context *smu);
688
689         /**
690          * @set_df_cstate: Set data fabric cstate.
691          */
692         int (*set_df_cstate)(struct smu_context *smu, enum pp_df_cstate state);
693
694         /**
695          * @allow_xgmi_power_down: Enable/disable external global memory
696          *                         interconnect power down.
697          */
698         int (*allow_xgmi_power_down)(struct smu_context *smu, bool en);
699
700         /**
701          * @update_pcie_parameters: Update and upload the system's PCIe
702          *                          capabilites to the SMU.
703          * &pcie_gen_cap: Maximum allowed PCIe generation.
704          * &pcie_width_cap: Maximum allowed PCIe width.
705          */
706         int (*update_pcie_parameters)(struct smu_context *smu, uint32_t pcie_gen_cap, uint32_t pcie_width_cap);
707
708         /**
709          * @i2c_init: Initialize i2c.
710          *
711          * The i2c bus is used internally by the SMU voltage regulators and
712          * other devices. The i2c's EEPROM also stores bad page tables on boards
713          * with ECC.
714          */
715         int (*i2c_init)(struct smu_context *smu, struct i2c_adapter *control);
716
717         /**
718          * @i2c_fini: Tear down i2c.
719          */
720         void (*i2c_fini)(struct smu_context *smu, struct i2c_adapter *control);
721
722         /**
723          * @get_unique_id: Get the GPU's unique id. Used for asset tracking.
724          */
725         void (*get_unique_id)(struct smu_context *smu);
726
727         /**
728          * @get_dpm_clock_table: Get a copy of the DPM clock table.
729          *
730          * Used by display component in bandwidth and watermark calculations.
731          */
732         int (*get_dpm_clock_table)(struct smu_context *smu, struct dpm_clocks *clock_table);
733
734         /**
735          * @init_microcode: Request the SMU's firmware from the kernel.
736          */
737         int (*init_microcode)(struct smu_context *smu);
738
739         /**
740          * @load_microcode: Load firmware onto the SMU.
741          */
742         int (*load_microcode)(struct smu_context *smu);
743
744         /**
745          * @fini_microcode: Release the SMU's firmware.
746          */
747         void (*fini_microcode)(struct smu_context *smu);
748
749         /**
750          * @init_smc_tables: Initialize the SMU tables.
751          */
752         int (*init_smc_tables)(struct smu_context *smu);
753
754         /**
755          * @fini_smc_tables: Release the SMU tables.
756          */
757         int (*fini_smc_tables)(struct smu_context *smu);
758
759         /**
760          * @init_power: Initialize the power gate table context.
761          */
762         int (*init_power)(struct smu_context *smu);
763
764         /**
765          * @fini_power: Release the power gate table context.
766          */
767         int (*fini_power)(struct smu_context *smu);
768
769         /**
770          * @check_fw_status: Check the SMU's firmware status.
771          *
772          * Return: Zero if check passes, negative errno on failure.
773          */
774         int (*check_fw_status)(struct smu_context *smu);
775
776         /**
777          * @setup_pptable: Initialize the power play table and populate it with
778          *                 default values.
779          */
780         int (*setup_pptable)(struct smu_context *smu);
781
782         /**
783          * @get_vbios_bootup_values: Get default boot values from the VBIOS.
784          */
785         int (*get_vbios_bootup_values)(struct smu_context *smu);
786
787         /**
788          * @check_fw_version: Print driver and SMU interface versions to the
789          *                    system log.
790          *
791          * Interface mismatch is not a critical failure.
792          */
793         int (*check_fw_version)(struct smu_context *smu);
794
795         /**
796          * @powergate_sdma: Power up/down system direct memory access.
797          */
798         int (*powergate_sdma)(struct smu_context *smu, bool gate);
799
800         /**
801          * @set_gfx_cgpg: Enable/disable graphics engine course grain power
802          *                gating.
803          */
804         int (*set_gfx_cgpg)(struct smu_context *smu, bool enable);
805
806         /**
807          * @write_pptable: Write the power play table to the SMU.
808          */
809         int (*write_pptable)(struct smu_context *smu);
810
811         /**
812          * @set_driver_table_location: Send the location of the driver table to
813          *                             the SMU.
814          */
815         int (*set_driver_table_location)(struct smu_context *smu);
816
817         /**
818          * @set_tool_table_location: Send the location of the tool table to the
819          *                           SMU.
820          */
821         int (*set_tool_table_location)(struct smu_context *smu);
822
823         /**
824          * @notify_memory_pool_location: Send the location of the memory pool to
825          *                               the SMU.
826          */
827         int (*notify_memory_pool_location)(struct smu_context *smu);
828
829         /**
830          * @system_features_control: Enable/disable all SMU features.
831          */
832         int (*system_features_control)(struct smu_context *smu, bool en);
833
834         /**
835          * @send_smc_msg_with_param: Send a message with a parameter to the SMU.
836          * &msg: Type of message.
837          * &param: Message parameter.
838          * &read_arg: SMU response (optional).
839          */
840         int (*send_smc_msg_with_param)(struct smu_context *smu,
841                                        enum smu_message_type msg, uint32_t param, uint32_t *read_arg);
842
843         /**
844          * @send_smc_msg: Send a message to the SMU.
845          * &msg: Type of message.
846          * &read_arg: SMU response (optional).
847          */
848         int (*send_smc_msg)(struct smu_context *smu,
849                             enum smu_message_type msg,
850                             uint32_t *read_arg);
851
852         /**
853          * @init_display_count: Notify the SMU of the number of display
854          *                      components in current display configuration.
855          */
856         int (*init_display_count)(struct smu_context *smu, uint32_t count);
857
858         /**
859          * @set_allowed_mask: Notify the SMU of the features currently allowed
860          *                    by the driver.
861          */
862         int (*set_allowed_mask)(struct smu_context *smu);
863
864         /**
865          * @get_enabled_mask: Get a mask of features that are currently enabled
866          *                    on the SMU.
867          * &feature_mask: Array representing enabled feature mask.
868          * &num: Elements in &feature_mask.
869          */
870         int (*get_enabled_mask)(struct smu_context *smu, uint32_t *feature_mask, uint32_t num);
871
872         /**
873          * @feature_is_enabled: Test if a feature is enabled.
874          *
875          * Return: One if enabled, zero if disabled.
876          */
877         int (*feature_is_enabled)(struct smu_context *smu, enum smu_feature_mask mask);
878
879         /**
880          * @disable_all_features_with_exception: Disable all features with
881          *                                       exception to those in &mask.
882          */
883         int (*disable_all_features_with_exception)(struct smu_context *smu, enum smu_feature_mask mask);
884
885         /**
886          * @notify_display_change: Enable fast memory clock switching.
887          *
888          * Allows for fine grained memory clock switching but has more stringent
889          * timing requirements.
890          */
891         int (*notify_display_change)(struct smu_context *smu);
892
893         /**
894          * @set_power_limit: Set power limit in watts.
895          */
896         int (*set_power_limit)(struct smu_context *smu, uint32_t n);
897
898         /**
899          * @init_max_sustainable_clocks: Populate max sustainable clock speed
900          *                               table with values from the SMU.
901          */
902         int (*init_max_sustainable_clocks)(struct smu_context *smu);
903
904         /**
905          * @enable_thermal_alert: Enable thermal alert interrupts.
906          */
907         int (*enable_thermal_alert)(struct smu_context *smu);
908
909         /**
910          * @disable_thermal_alert: Disable thermal alert interrupts.
911          */
912         int (*disable_thermal_alert)(struct smu_context *smu);
913
914         /**
915          * @set_min_dcef_deep_sleep: Set a minimum display fabric deep sleep
916          *                           clock speed in MHz.
917          */
918         int (*set_min_dcef_deep_sleep)(struct smu_context *smu, uint32_t clk);
919
920         /**
921          * @display_clock_voltage_request: Set a hard minimum frequency
922          * for a clock domain.
923          */
924         int (*display_clock_voltage_request)(struct smu_context *smu, struct
925                                              pp_display_clock_request
926                                              *clock_req);
927
928         /**
929          * @get_fan_control_mode: Get the current fan control mode.
930          */
931         uint32_t (*get_fan_control_mode)(struct smu_context *smu);
932
933         /**
934          * @set_fan_control_mode: Set the fan control mode.
935          */
936         int (*set_fan_control_mode)(struct smu_context *smu, uint32_t mode);
937
938         /**
939          * @set_fan_speed_rpm: Set a static fan speed in RPM.
940          */
941         int (*set_fan_speed_rpm)(struct smu_context *smu, uint32_t speed);
942
943         /**
944          * @set_xgmi_pstate: Set inter-chip global memory interconnect pstate.
945          * &pstate: Pstate to set. D0 if Nonzero, D3 otherwise.
946          */
947         int (*set_xgmi_pstate)(struct smu_context *smu, uint32_t pstate);
948
949         /**
950          * @gfx_off_control: Enable/disable graphics engine poweroff.
951          */
952         int (*gfx_off_control)(struct smu_context *smu, bool enable);
953
954
955         /**
956          * @get_gfx_off_status: Get graphics engine poweroff status.
957          *
958          * Return:
959          * 0 - GFXOFF(default).
960          * 1 - Transition out of GFX State.
961          * 2 - Not in GFXOFF.
962          * 3 - Transition into GFXOFF.
963          */
964         uint32_t (*get_gfx_off_status)(struct smu_context *smu);
965
966         /**
967          * @register_irq_handler: Register interupt request handlers.
968          */
969         int (*register_irq_handler)(struct smu_context *smu);
970
971         /**
972          * @set_azalia_d3_pme: Wake the audio decode engine from d3 sleep.
973          */
974         int (*set_azalia_d3_pme)(struct smu_context *smu);
975
976         /**
977          * @get_max_sustainable_clocks_by_dc: Get a copy of the max sustainable
978          *                                    clock speeds table.
979          *
980          * Provides a way for the display component (DC) to get the max
981          * sustainable clocks from the SMU.
982          */
983         int (*get_max_sustainable_clocks_by_dc)(struct smu_context *smu, struct pp_smu_nv_clock_table *max_clocks);
984
985         /**
986          * @baco_is_support: Check if GPU supports BACO (Bus Active, Chip Off).
987          */
988         bool (*baco_is_support)(struct smu_context *smu);
989
990         /**
991          * @baco_get_state: Get the current BACO state.
992          *
993          * Return: Current BACO state.
994          */
995         enum smu_baco_state (*baco_get_state)(struct smu_context *smu);
996
997         /**
998          * @baco_set_state: Enter/exit BACO.
999          */
1000         int (*baco_set_state)(struct smu_context *smu, enum smu_baco_state state);
1001
1002         /**
1003          * @baco_enter: Enter BACO.
1004          */
1005         int (*baco_enter)(struct smu_context *smu);
1006
1007         /**
1008          * @baco_exit: Exit Baco.
1009          */
1010         int (*baco_exit)(struct smu_context *smu);
1011
1012         /**
1013          * @mode1_reset_is_support: Check if GPU supports mode1 reset.
1014          */
1015         bool (*mode1_reset_is_support)(struct smu_context *smu);
1016
1017         /**
1018          * @mode1_reset: Perform mode1 reset.
1019          *
1020          * Complete GPU reset.
1021          */
1022         int (*mode1_reset)(struct smu_context *smu);
1023
1024         /**
1025          * @mode2_reset: Perform mode2 reset.
1026          *
1027          * Mode2 reset generally does not reset as many IPs as mode1 reset. The
1028          * IPs reset varies by asic.
1029          */
1030         int (*mode2_reset)(struct smu_context *smu);
1031
1032         /**
1033          * @get_dpm_ultimate_freq: Get the hard frequency range of a clock
1034          *                         domain in MHz.
1035          */
1036         int (*get_dpm_ultimate_freq)(struct smu_context *smu, enum smu_clk_type clk_type, uint32_t *min, uint32_t *max);
1037
1038         /**
1039          * @set_soft_freq_limited_range: Set the soft frequency range of a clock
1040          *                               domain in MHz.
1041          */
1042         int (*set_soft_freq_limited_range)(struct smu_context *smu, enum smu_clk_type clk_type, uint32_t min, uint32_t max);
1043
1044         /**
1045          * @set_power_source: Notify the SMU of the current power source.
1046          */
1047         int (*set_power_source)(struct smu_context *smu, enum smu_power_src_type power_src);
1048
1049         /**
1050          * @log_thermal_throttling_event: Print a thermal throttling warning to
1051          *                                the system's log.
1052          */
1053         void (*log_thermal_throttling_event)(struct smu_context *smu);
1054
1055         /**
1056          * @get_pp_feature_mask: Print a human readable table of enabled
1057          *                       features to buffer.
1058          */
1059         size_t (*get_pp_feature_mask)(struct smu_context *smu, char *buf);
1060
1061         /**
1062          * @set_pp_feature_mask: Request the SMU enable/disable features to
1063          *                       match those enabled in &new_mask.
1064          */
1065         int (*set_pp_feature_mask)(struct smu_context *smu, uint64_t new_mask);
1066
1067         /**
1068          * @get_gpu_metrics: Get a copy of the GPU metrics table from the SMU.
1069          *
1070          * Return: Size of &table
1071          */
1072         ssize_t (*get_gpu_metrics)(struct smu_context *smu, void **table);
1073
1074         /**
1075          * @enable_mgpu_fan_boost: Enable multi-GPU fan boost.
1076          */
1077         int (*enable_mgpu_fan_boost)(struct smu_context *smu);
1078
1079         /**
1080          * @gfx_ulv_control: Enable/disable ultra low voltage.
1081          */
1082         int (*gfx_ulv_control)(struct smu_context *smu, bool enablement);
1083
1084         /**
1085          * @deep_sleep_control: Enable/disable deep sleep.
1086          */
1087         int (*deep_sleep_control)(struct smu_context *smu, bool enablement);
1088
1089         /**
1090          * @get_fan_parameters: Get fan parameters.
1091          *
1092          * Get maximum fan speed from the power play table.
1093          */
1094         int (*get_fan_parameters)(struct smu_context *smu);
1095
1096         /**
1097          * @post_init: Helper function for asic specific workarounds.
1098          */
1099         int (*post_init)(struct smu_context *smu);
1100
1101         /**
1102          * @interrupt_work: Work task scheduled from SMU interrupt handler.
1103          */
1104         void (*interrupt_work)(struct smu_context *smu);
1105
1106         /**
1107          * @gpo_control: Enable/disable graphics power optimization if supported.
1108          */
1109         int (*gpo_control)(struct smu_context *smu, bool enablement);
1110
1111         /**
1112          * @gfx_state_change_set: Send the current graphics state to the SMU.
1113          */
1114         int (*gfx_state_change_set)(struct smu_context *smu, uint32_t state);
1115
1116         /**
1117          * @set_fine_grain_gfx_freq_parameters: Set fine grain graphics clock
1118          *                                      parameters to defaults.
1119          */
1120         int (*set_fine_grain_gfx_freq_parameters)(struct smu_context *smu);
1121 };
1122
1123 typedef enum {
1124         METRICS_CURR_GFXCLK,
1125         METRICS_CURR_SOCCLK,
1126         METRICS_CURR_UCLK,
1127         METRICS_CURR_VCLK,
1128         METRICS_CURR_VCLK1,
1129         METRICS_CURR_DCLK,
1130         METRICS_CURR_DCLK1,
1131         METRICS_CURR_FCLK,
1132         METRICS_CURR_DCEFCLK,
1133         METRICS_AVERAGE_CPUCLK,
1134         METRICS_AVERAGE_GFXCLK,
1135         METRICS_AVERAGE_SOCCLK,
1136         METRICS_AVERAGE_FCLK,
1137         METRICS_AVERAGE_UCLK,
1138         METRICS_AVERAGE_VCLK,
1139         METRICS_AVERAGE_DCLK,
1140         METRICS_AVERAGE_GFXACTIVITY,
1141         METRICS_AVERAGE_MEMACTIVITY,
1142         METRICS_AVERAGE_VCNACTIVITY,
1143         METRICS_AVERAGE_SOCKETPOWER,
1144         METRICS_TEMPERATURE_EDGE,
1145         METRICS_TEMPERATURE_HOTSPOT,
1146         METRICS_TEMPERATURE_MEM,
1147         METRICS_TEMPERATURE_VRGFX,
1148         METRICS_TEMPERATURE_VRSOC,
1149         METRICS_TEMPERATURE_VRMEM,
1150         METRICS_THROTTLER_STATUS,
1151         METRICS_CURR_FANSPEED,
1152         METRICS_VOLTAGE_VDDSOC,
1153         METRICS_VOLTAGE_VDDGFX,
1154 } MetricsMember_t;
1155
1156 enum smu_cmn2asic_mapping_type {
1157         CMN2ASIC_MAPPING_MSG,
1158         CMN2ASIC_MAPPING_CLK,
1159         CMN2ASIC_MAPPING_FEATURE,
1160         CMN2ASIC_MAPPING_TABLE,
1161         CMN2ASIC_MAPPING_PWR,
1162         CMN2ASIC_MAPPING_WORKLOAD,
1163 };
1164
1165 #define MSG_MAP(msg, index, valid_in_vf) \
1166         [SMU_MSG_##msg] = {1, (index), (valid_in_vf)}
1167
1168 #define CLK_MAP(clk, index) \
1169         [SMU_##clk] = {1, (index)}
1170
1171 #define FEA_MAP(fea) \
1172         [SMU_FEATURE_##fea##_BIT] = {1, FEATURE_##fea##_BIT}
1173
1174 #define FEA_MAP_REVERSE(fea) \
1175         [SMU_FEATURE_DPM_##fea##_BIT] = {1, FEATURE_##fea##_DPM_BIT}
1176
1177 #define FEA_MAP_HALF_REVERSE(fea) \
1178         [SMU_FEATURE_DPM_##fea##CLK_BIT] = {1, FEATURE_##fea##_DPM_BIT}
1179
1180 #define TAB_MAP(tab) \
1181         [SMU_TABLE_##tab] = {1, TABLE_##tab}
1182
1183 #define TAB_MAP_VALID(tab) \
1184         [SMU_TABLE_##tab] = {1, TABLE_##tab}
1185
1186 #define TAB_MAP_INVALID(tab) \
1187         [SMU_TABLE_##tab] = {0, TABLE_##tab}
1188
1189 #define PWR_MAP(tab) \
1190         [SMU_POWER_SOURCE_##tab] = {1, POWER_SOURCE_##tab}
1191
1192 #define WORKLOAD_MAP(profile, workload) \
1193         [profile] = {1, (workload)}
1194
1195 #if !defined(SWSMU_CODE_LAYER_L2) && !defined(SWSMU_CODE_LAYER_L3) && !defined(SWSMU_CODE_LAYER_L4)
1196 int smu_load_microcode(struct smu_context *smu);
1197
1198 int smu_check_fw_status(struct smu_context *smu);
1199
1200 int smu_set_gfx_cgpg(struct smu_context *smu, bool enabled);
1201
1202 int smu_set_fan_speed_rpm(struct smu_context *smu, uint32_t speed);
1203
1204 int smu_get_power_limit(struct smu_context *smu,
1205                         uint32_t *limit,
1206                         bool max_setting);
1207
1208 int smu_set_power_limit(struct smu_context *smu, uint32_t limit);
1209 int smu_print_clk_levels(struct smu_context *smu, enum smu_clk_type clk_type, char *buf);
1210
1211 int smu_od_edit_dpm_table(struct smu_context *smu,
1212                           enum PP_OD_DPM_TABLE_COMMAND type,
1213                           long *input, uint32_t size);
1214
1215 int smu_read_sensor(struct smu_context *smu,
1216                     enum amd_pp_sensors sensor,
1217                     void *data, uint32_t *size);
1218 int smu_get_power_profile_mode(struct smu_context *smu, char *buf);
1219
1220 int smu_set_power_profile_mode(struct smu_context *smu,
1221                                long *param,
1222                                uint32_t param_size,
1223                                bool lock_needed);
1224 int smu_get_fan_control_mode(struct smu_context *smu);
1225 int smu_set_fan_control_mode(struct smu_context *smu, int value);
1226 int smu_get_fan_speed_percent(struct smu_context *smu, uint32_t *speed);
1227 int smu_set_fan_speed_percent(struct smu_context *smu, uint32_t speed);
1228 int smu_get_fan_speed_rpm(struct smu_context *smu, uint32_t *speed);
1229
1230 int smu_set_deep_sleep_dcefclk(struct smu_context *smu, int clk);
1231
1232 int smu_get_clock_by_type_with_latency(struct smu_context *smu,
1233                                        enum smu_clk_type clk_type,
1234                                        struct pp_clock_levels_with_latency *clocks);
1235
1236 int smu_display_clock_voltage_request(struct smu_context *smu,
1237                                       struct pp_display_clock_request *clock_req);
1238 int smu_display_disable_memory_clock_switch(struct smu_context *smu, bool disable_memory_clock_switch);
1239
1240 int smu_set_xgmi_pstate(struct smu_context *smu,
1241                         uint32_t pstate);
1242
1243 int smu_set_azalia_d3_pme(struct smu_context *smu);
1244
1245 bool smu_baco_is_support(struct smu_context *smu);
1246
1247 int smu_baco_get_state(struct smu_context *smu, enum smu_baco_state *state);
1248
1249 int smu_baco_enter(struct smu_context *smu);
1250 int smu_baco_exit(struct smu_context *smu);
1251
1252 bool smu_mode1_reset_is_support(struct smu_context *smu);
1253 int smu_mode1_reset(struct smu_context *smu);
1254 int smu_mode2_reset(struct smu_context *smu);
1255
1256 extern const struct amd_ip_funcs smu_ip_funcs;
1257
1258 extern const struct amdgpu_ip_block_version smu_v11_0_ip_block;
1259 extern const struct amdgpu_ip_block_version smu_v12_0_ip_block;
1260
1261 bool is_support_sw_smu(struct amdgpu_device *adev);
1262 bool is_support_cclk_dpm(struct amdgpu_device *adev);
1263 int smu_reset(struct smu_context *smu);
1264 int smu_sys_get_pp_table(struct smu_context *smu, void **table);
1265 int smu_sys_set_pp_table(struct smu_context *smu,  void *buf, size_t size);
1266 int smu_get_power_num_states(struct smu_context *smu, struct pp_states_info *state_info);
1267 enum amd_pm_state_type smu_get_current_power_state(struct smu_context *smu);
1268 int smu_write_watermarks_table(struct smu_context *smu);
1269 int smu_set_watermarks_for_clock_ranges(
1270                 struct smu_context *smu,
1271                 struct pp_smu_wm_range_sets *clock_ranges);
1272
1273 /* smu to display interface */
1274 extern int smu_display_configuration_change(struct smu_context *smu, const
1275                                             struct amd_pp_display_configuration
1276                                             *display_config);
1277 extern int smu_dpm_set_power_gate(struct smu_context *smu,uint32_t block_type, bool gate);
1278 extern int smu_handle_task(struct smu_context *smu,
1279                            enum amd_dpm_forced_level level,
1280                            enum amd_pp_task task_id,
1281                            bool lock_needed);
1282 int smu_switch_power_profile(struct smu_context *smu,
1283                              enum PP_SMC_POWER_PROFILE type,
1284                              bool en);
1285 int smu_get_dpm_freq_range(struct smu_context *smu, enum smu_clk_type clk_type,
1286                            uint32_t *min, uint32_t *max);
1287 int smu_set_soft_freq_range(struct smu_context *smu, enum smu_clk_type clk_type,
1288                             uint32_t min, uint32_t max);
1289 enum amd_dpm_forced_level smu_get_performance_level(struct smu_context *smu);
1290 int smu_force_performance_level(struct smu_context *smu, enum amd_dpm_forced_level level);
1291 int smu_set_display_count(struct smu_context *smu, uint32_t count);
1292 int smu_set_ac_dc(struct smu_context *smu);
1293 size_t smu_sys_get_pp_feature_mask(struct smu_context *smu, char *buf);
1294 int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t new_mask);
1295 int smu_force_clk_levels(struct smu_context *smu,
1296                          enum smu_clk_type clk_type,
1297                          uint32_t mask);
1298 int smu_set_mp1_state(struct smu_context *smu,
1299                       enum pp_mp1_state mp1_state);
1300 int smu_set_df_cstate(struct smu_context *smu,
1301                       enum pp_df_cstate state);
1302 int smu_allow_xgmi_power_down(struct smu_context *smu, bool en);
1303
1304 int smu_get_max_sustainable_clocks_by_dc(struct smu_context *smu,
1305                                          struct pp_smu_nv_clock_table *max_clocks);
1306
1307 int smu_get_uclk_dpm_states(struct smu_context *smu,
1308                             unsigned int *clock_values_in_khz,
1309                             unsigned int *num_states);
1310
1311 int smu_get_dpm_clock_table(struct smu_context *smu,
1312                             struct dpm_clocks *clock_table);
1313
1314 int smu_get_status_gfxoff(struct amdgpu_device *adev, uint32_t *value);
1315
1316 ssize_t smu_sys_get_gpu_metrics(struct smu_context *smu, void **table);
1317
1318 int smu_enable_mgpu_fan_boost(struct smu_context *smu);
1319 int smu_gfx_state_change_set(struct smu_context *smu, uint32_t state);
1320
1321 #endif
1322 #endif
This page took 0.118954 seconds and 4 git commands to generate.