2 * Copyright 2014 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.
24 #ifndef __AMDGPU_ATOMBIOS_H__
25 #define __AMDGPU_ATOMBIOS_H__
27 struct atom_clock_dividers
{
33 u32 whole_fb_div
: 12;
37 u32 whole_fb_div
: 12;
53 struct atom_mpll_param
{
77 #define MEM_TYPE_GDDR5 0x50
78 #define MEM_TYPE_GDDR4 0x40
79 #define MEM_TYPE_GDDR3 0x30
80 #define MEM_TYPE_DDR2 0x20
81 #define MEM_TYPE_GDDR1 0x10
82 #define MEM_TYPE_DDR3 0xb0
83 #define MEM_TYPE_MASK 0xf0
85 struct atom_memory_info
{
90 #define MAX_AC_TIMING_ENTRIES 16
92 struct atom_memory_clock_range_table
96 u32 mclk
[MAX_AC_TIMING_ENTRIES
];
99 #define VBIOS_MC_REGISTER_ARRAY_SIZE 32
100 #define VBIOS_MAX_AC_TIMING_ENTRIES 20
102 struct atom_mc_reg_entry
{
104 u32 mc_data
[VBIOS_MC_REGISTER_ARRAY_SIZE
];
107 struct atom_mc_register_address
{
112 struct atom_mc_reg_table
{
115 struct atom_mc_reg_entry mc_reg_table_entry
[VBIOS_MAX_AC_TIMING_ENTRIES
];
116 struct atom_mc_register_address mc_reg_address
[VBIOS_MC_REGISTER_ARRAY_SIZE
];
119 #define MAX_VOLTAGE_ENTRIES 32
121 struct atom_voltage_table_entry
127 struct atom_voltage_table
132 struct atom_voltage_table_entry entries
[MAX_VOLTAGE_ENTRIES
];
135 struct amdgpu_gpio_rec
136 amdgpu_atombios_lookup_gpio(struct amdgpu_device
*adev
,
139 struct amdgpu_i2c_bus_rec
amdgpu_atombios_lookup_i2c_gpio(struct amdgpu_device
*adev
,
141 void amdgpu_atombios_i2c_init(struct amdgpu_device
*adev
);
143 bool amdgpu_atombios_get_connector_info_from_object_table(struct amdgpu_device
*adev
);
145 int amdgpu_atombios_get_clock_info(struct amdgpu_device
*adev
);
147 bool amdgpu_atombios_get_asic_ss_info(struct amdgpu_device
*adev
,
148 struct amdgpu_atom_ss
*ss
,
151 int amdgpu_atombios_get_clock_dividers(struct amdgpu_device
*adev
,
155 struct atom_clock_dividers
*dividers
);
157 int amdgpu_atombios_get_memory_pll_dividers(struct amdgpu_device
*adev
,
160 struct atom_mpll_param
*mpll_param
);
162 uint32_t amdgpu_atombios_get_engine_clock(struct amdgpu_device
*adev
);
163 uint32_t amdgpu_atombios_get_memory_clock(struct amdgpu_device
*adev
);
164 void amdgpu_atombios_set_engine_clock(struct amdgpu_device
*adev
,
166 void amdgpu_atombios_set_memory_clock(struct amdgpu_device
*adev
,
168 void amdgpu_atombios_set_voltage(struct amdgpu_device
*adev
,
172 void amdgpu_atombios_set_engine_dram_timings(struct amdgpu_device
*adev
,
173 u32 eng_clock
, u32 mem_clock
);
175 int amdgpu_atombios_get_leakage_id_from_vbios(struct amdgpu_device
*adev
,
178 int amdgpu_atombios_get_leakage_vddc_based_on_leakage_params(struct amdgpu_device
*adev
,
179 u16
*vddc
, u16
*vddci
,
180 u16 virtual_voltage_id
,
181 u16 vbios_voltage_id
);
183 int amdgpu_atombios_get_voltage_evv(struct amdgpu_device
*adev
,
184 u16 virtual_voltage_id
,
188 amdgpu_atombios_is_voltage_gpio(struct amdgpu_device
*adev
,
189 u8 voltage_type
, u8 voltage_mode
);
191 int amdgpu_atombios_get_voltage_table(struct amdgpu_device
*adev
,
192 u8 voltage_type
, u8 voltage_mode
,
193 struct atom_voltage_table
*voltage_table
);
195 int amdgpu_atombios_init_mc_reg_table(struct amdgpu_device
*adev
,
197 struct atom_mc_reg_table
*reg_table
);
199 void amdgpu_atombios_scratch_regs_lock(struct amdgpu_device
*adev
, bool lock
);
200 void amdgpu_atombios_scratch_regs_init(struct amdgpu_device
*adev
);
201 void amdgpu_atombios_scratch_regs_save(struct amdgpu_device
*adev
);
202 void amdgpu_atombios_scratch_regs_restore(struct amdgpu_device
*adev
);
204 void amdgpu_atombios_copy_swap(u8
*dst
, u8
*src
, u8 num_bytes
, bool to_le
);