drm/radeon/dpm: move platform caps fetching to a separate function
It's needed by by both the asic specific functions and the extended table parser. Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
b59b733397
commit
82f79cc54b
|
@ -2601,6 +2601,10 @@ int btc_dpm_init(struct radeon_device *rdev)
|
||||||
pi->min_vddc_in_table = 0;
|
pi->min_vddc_in_table = 0;
|
||||||
pi->max_vddc_in_table = 0;
|
pi->max_vddc_in_table = 0;
|
||||||
|
|
||||||
|
ret = r600_get_platform_caps(rdev);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
ret = rv7xx_parse_power_table(rdev);
|
ret = rv7xx_parse_power_table(rdev);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -4959,9 +4959,6 @@ static int ci_parse_power_table(struct radeon_device *rdev)
|
||||||
if (!rdev->pm.dpm.ps)
|
if (!rdev->pm.dpm.ps)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
power_state_offset = (u8 *)state_array->states;
|
power_state_offset = (u8 *)state_array->states;
|
||||||
rdev->pm.dpm.platform_caps = le32_to_cpu(power_info->pplib.ulPlatformCaps);
|
|
||||||
rdev->pm.dpm.backbias_response_time = le16_to_cpu(power_info->pplib.usBackbiasTime);
|
|
||||||
rdev->pm.dpm.voltage_response_time = le16_to_cpu(power_info->pplib.usVoltageTime);
|
|
||||||
for (i = 0; i < state_array->ucNumEntries; i++) {
|
for (i = 0; i < state_array->ucNumEntries; i++) {
|
||||||
u8 *idx;
|
u8 *idx;
|
||||||
power_state = (union pplib_power_state *)power_state_offset;
|
power_state = (union pplib_power_state *)power_state_offset;
|
||||||
|
@ -5077,6 +5074,12 @@ int ci_dpm_init(struct radeon_device *rdev)
|
||||||
ci_dpm_fini(rdev);
|
ci_dpm_fini(rdev);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = r600_get_platform_caps(rdev);
|
||||||
|
if (ret) {
|
||||||
|
ci_dpm_fini(rdev);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
ret = ci_parse_power_table(rdev);
|
ret = ci_parse_power_table(rdev);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
ci_dpm_fini(rdev);
|
ci_dpm_fini(rdev);
|
||||||
|
|
|
@ -2036,6 +2036,10 @@ int cypress_dpm_init(struct radeon_device *rdev)
|
||||||
pi->min_vddc_in_table = 0;
|
pi->min_vddc_in_table = 0;
|
||||||
pi->max_vddc_in_table = 0;
|
pi->max_vddc_in_table = 0;
|
||||||
|
|
||||||
|
ret = r600_get_platform_caps(rdev);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
ret = rv7xx_parse_power_table(rdev);
|
ret = rv7xx_parse_power_table(rdev);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -2538,9 +2538,6 @@ static int kv_parse_power_table(struct radeon_device *rdev)
|
||||||
if (!rdev->pm.dpm.ps)
|
if (!rdev->pm.dpm.ps)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
power_state_offset = (u8 *)state_array->states;
|
power_state_offset = (u8 *)state_array->states;
|
||||||
rdev->pm.dpm.platform_caps = le32_to_cpu(power_info->pplib.ulPlatformCaps);
|
|
||||||
rdev->pm.dpm.backbias_response_time = le16_to_cpu(power_info->pplib.usBackbiasTime);
|
|
||||||
rdev->pm.dpm.voltage_response_time = le16_to_cpu(power_info->pplib.usVoltageTime);
|
|
||||||
for (i = 0; i < state_array->ucNumEntries; i++) {
|
for (i = 0; i < state_array->ucNumEntries; i++) {
|
||||||
u8 *idx;
|
u8 *idx;
|
||||||
power_state = (union pplib_power_state *)power_state_offset;
|
power_state = (union pplib_power_state *)power_state_offset;
|
||||||
|
@ -2590,6 +2587,10 @@ int kv_dpm_init(struct radeon_device *rdev)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
rdev->pm.dpm.priv = pi;
|
rdev->pm.dpm.priv = pi;
|
||||||
|
|
||||||
|
ret = r600_get_platform_caps(rdev);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
ret = r600_parse_extended_power_table(rdev);
|
ret = r600_parse_extended_power_table(rdev);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -4025,9 +4025,6 @@ static int ni_parse_power_table(struct radeon_device *rdev)
|
||||||
power_info->pplib.ucNumStates, GFP_KERNEL);
|
power_info->pplib.ucNumStates, GFP_KERNEL);
|
||||||
if (!rdev->pm.dpm.ps)
|
if (!rdev->pm.dpm.ps)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
rdev->pm.dpm.platform_caps = le32_to_cpu(power_info->pplib.ulPlatformCaps);
|
|
||||||
rdev->pm.dpm.backbias_response_time = le16_to_cpu(power_info->pplib.usBackbiasTime);
|
|
||||||
rdev->pm.dpm.voltage_response_time = le16_to_cpu(power_info->pplib.usVoltageTime);
|
|
||||||
|
|
||||||
for (i = 0; i < power_info->pplib.ucNumStates; i++) {
|
for (i = 0; i < power_info->pplib.ucNumStates; i++) {
|
||||||
power_state = (union pplib_power_state *)
|
power_state = (union pplib_power_state *)
|
||||||
|
@ -4089,6 +4086,10 @@ int ni_dpm_init(struct radeon_device *rdev)
|
||||||
pi->min_vddc_in_table = 0;
|
pi->min_vddc_in_table = 0;
|
||||||
pi->max_vddc_in_table = 0;
|
pi->max_vddc_in_table = 0;
|
||||||
|
|
||||||
|
ret = r600_get_platform_caps(rdev);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
ret = ni_parse_power_table(rdev);
|
ret = ni_parse_power_table(rdev);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -834,6 +834,26 @@ static int r600_parse_clk_voltage_dep_table(struct radeon_clock_voltage_dependen
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int r600_get_platform_caps(struct radeon_device *rdev)
|
||||||
|
{
|
||||||
|
struct radeon_mode_info *mode_info = &rdev->mode_info;
|
||||||
|
union power_info *power_info;
|
||||||
|
int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo);
|
||||||
|
u16 data_offset;
|
||||||
|
u8 frev, crev;
|
||||||
|
|
||||||
|
if (!atom_parse_data_header(mode_info->atom_context, index, NULL,
|
||||||
|
&frev, &crev, &data_offset))
|
||||||
|
return -EINVAL;
|
||||||
|
power_info = (union power_info *)(mode_info->atom_context->bios + data_offset);
|
||||||
|
|
||||||
|
rdev->pm.dpm.platform_caps = le32_to_cpu(power_info->pplib.ulPlatformCaps);
|
||||||
|
rdev->pm.dpm.backbias_response_time = le16_to_cpu(power_info->pplib.usBackbiasTime);
|
||||||
|
rdev->pm.dpm.voltage_response_time = le16_to_cpu(power_info->pplib.usVoltageTime);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* sizeof(ATOM_PPLIB_EXTENDEDHEADER) */
|
/* sizeof(ATOM_PPLIB_EXTENDEDHEADER) */
|
||||||
#define SIZE_OF_ATOM_PPLIB_EXTENDEDHEADER_V2 12
|
#define SIZE_OF_ATOM_PPLIB_EXTENDEDHEADER_V2 12
|
||||||
#define SIZE_OF_ATOM_PPLIB_EXTENDEDHEADER_V3 14
|
#define SIZE_OF_ATOM_PPLIB_EXTENDEDHEADER_V3 14
|
||||||
|
|
|
@ -215,6 +215,8 @@ void r600_stop_dpm(struct radeon_device *rdev);
|
||||||
|
|
||||||
bool r600_is_internal_thermal_sensor(enum radeon_int_thermal_type sensor);
|
bool r600_is_internal_thermal_sensor(enum radeon_int_thermal_type sensor);
|
||||||
|
|
||||||
|
int r600_get_platform_caps(struct radeon_device *rdev);
|
||||||
|
|
||||||
int r600_parse_extended_power_table(struct radeon_device *rdev);
|
int r600_parse_extended_power_table(struct radeon_device *rdev);
|
||||||
void r600_free_extended_power_table(struct radeon_device *rdev);
|
void r600_free_extended_power_table(struct radeon_device *rdev);
|
||||||
|
|
||||||
|
|
|
@ -807,9 +807,6 @@ static int rs780_parse_power_table(struct radeon_device *rdev)
|
||||||
power_info->pplib.ucNumStates, GFP_KERNEL);
|
power_info->pplib.ucNumStates, GFP_KERNEL);
|
||||||
if (!rdev->pm.dpm.ps)
|
if (!rdev->pm.dpm.ps)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
rdev->pm.dpm.platform_caps = le32_to_cpu(power_info->pplib.ulPlatformCaps);
|
|
||||||
rdev->pm.dpm.backbias_response_time = le16_to_cpu(power_info->pplib.usBackbiasTime);
|
|
||||||
rdev->pm.dpm.voltage_response_time = le16_to_cpu(power_info->pplib.usVoltageTime);
|
|
||||||
|
|
||||||
for (i = 0; i < power_info->pplib.ucNumStates; i++) {
|
for (i = 0; i < power_info->pplib.ucNumStates; i++) {
|
||||||
power_state = (union pplib_power_state *)
|
power_state = (union pplib_power_state *)
|
||||||
|
@ -859,6 +856,10 @@ int rs780_dpm_init(struct radeon_device *rdev)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
rdev->pm.dpm.priv = pi;
|
rdev->pm.dpm.priv = pi;
|
||||||
|
|
||||||
|
ret = r600_get_platform_caps(rdev);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
ret = rs780_parse_power_table(rdev);
|
ret = rs780_parse_power_table(rdev);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -1891,9 +1891,6 @@ static int rv6xx_parse_power_table(struct radeon_device *rdev)
|
||||||
power_info->pplib.ucNumStates, GFP_KERNEL);
|
power_info->pplib.ucNumStates, GFP_KERNEL);
|
||||||
if (!rdev->pm.dpm.ps)
|
if (!rdev->pm.dpm.ps)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
rdev->pm.dpm.platform_caps = le32_to_cpu(power_info->pplib.ulPlatformCaps);
|
|
||||||
rdev->pm.dpm.backbias_response_time = le16_to_cpu(power_info->pplib.usBackbiasTime);
|
|
||||||
rdev->pm.dpm.voltage_response_time = le16_to_cpu(power_info->pplib.usVoltageTime);
|
|
||||||
|
|
||||||
for (i = 0; i < power_info->pplib.ucNumStates; i++) {
|
for (i = 0; i < power_info->pplib.ucNumStates; i++) {
|
||||||
power_state = (union pplib_power_state *)
|
power_state = (union pplib_power_state *)
|
||||||
|
@ -1943,6 +1940,10 @@ int rv6xx_dpm_init(struct radeon_device *rdev)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
rdev->pm.dpm.priv = pi;
|
rdev->pm.dpm.priv = pi;
|
||||||
|
|
||||||
|
ret = r600_get_platform_caps(rdev);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
ret = rv6xx_parse_power_table(rdev);
|
ret = rv6xx_parse_power_table(rdev);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -2281,9 +2281,6 @@ int rv7xx_parse_power_table(struct radeon_device *rdev)
|
||||||
power_info->pplib.ucNumStates, GFP_KERNEL);
|
power_info->pplib.ucNumStates, GFP_KERNEL);
|
||||||
if (!rdev->pm.dpm.ps)
|
if (!rdev->pm.dpm.ps)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
rdev->pm.dpm.platform_caps = le32_to_cpu(power_info->pplib.ulPlatformCaps);
|
|
||||||
rdev->pm.dpm.backbias_response_time = le16_to_cpu(power_info->pplib.usBackbiasTime);
|
|
||||||
rdev->pm.dpm.voltage_response_time = le16_to_cpu(power_info->pplib.usVoltageTime);
|
|
||||||
|
|
||||||
for (i = 0; i < power_info->pplib.ucNumStates; i++) {
|
for (i = 0; i < power_info->pplib.ucNumStates; i++) {
|
||||||
power_state = (union pplib_power_state *)
|
power_state = (union pplib_power_state *)
|
||||||
|
@ -2361,6 +2358,10 @@ int rv770_dpm_init(struct radeon_device *rdev)
|
||||||
pi->min_vddc_in_table = 0;
|
pi->min_vddc_in_table = 0;
|
||||||
pi->max_vddc_in_table = 0;
|
pi->max_vddc_in_table = 0;
|
||||||
|
|
||||||
|
ret = r600_get_platform_caps(rdev);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
ret = rv7xx_parse_power_table(rdev);
|
ret = rv7xx_parse_power_table(rdev);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -6271,9 +6271,6 @@ static int si_parse_power_table(struct radeon_device *rdev)
|
||||||
if (!rdev->pm.dpm.ps)
|
if (!rdev->pm.dpm.ps)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
power_state_offset = (u8 *)state_array->states;
|
power_state_offset = (u8 *)state_array->states;
|
||||||
rdev->pm.dpm.platform_caps = le32_to_cpu(power_info->pplib.ulPlatformCaps);
|
|
||||||
rdev->pm.dpm.backbias_response_time = le16_to_cpu(power_info->pplib.usBackbiasTime);
|
|
||||||
rdev->pm.dpm.voltage_response_time = le16_to_cpu(power_info->pplib.usVoltageTime);
|
|
||||||
for (i = 0; i < state_array->ucNumEntries; i++) {
|
for (i = 0; i < state_array->ucNumEntries; i++) {
|
||||||
u8 *idx;
|
u8 *idx;
|
||||||
power_state = (union pplib_power_state *)power_state_offset;
|
power_state = (union pplib_power_state *)power_state_offset;
|
||||||
|
@ -6350,6 +6347,10 @@ int si_dpm_init(struct radeon_device *rdev)
|
||||||
pi->min_vddc_in_table = 0;
|
pi->min_vddc_in_table = 0;
|
||||||
pi->max_vddc_in_table = 0;
|
pi->max_vddc_in_table = 0;
|
||||||
|
|
||||||
|
ret = r600_get_platform_caps(rdev);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
ret = si_parse_power_table(rdev);
|
ret = si_parse_power_table(rdev);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -1484,9 +1484,6 @@ static int sumo_parse_power_table(struct radeon_device *rdev)
|
||||||
if (!rdev->pm.dpm.ps)
|
if (!rdev->pm.dpm.ps)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
power_state_offset = (u8 *)state_array->states;
|
power_state_offset = (u8 *)state_array->states;
|
||||||
rdev->pm.dpm.platform_caps = le32_to_cpu(power_info->pplib.ulPlatformCaps);
|
|
||||||
rdev->pm.dpm.backbias_response_time = le16_to_cpu(power_info->pplib.usBackbiasTime);
|
|
||||||
rdev->pm.dpm.voltage_response_time = le16_to_cpu(power_info->pplib.usVoltageTime);
|
|
||||||
for (i = 0; i < state_array->ucNumEntries; i++) {
|
for (i = 0; i < state_array->ucNumEntries; i++) {
|
||||||
u8 *idx;
|
u8 *idx;
|
||||||
power_state = (union pplib_power_state *)power_state_offset;
|
power_state = (union pplib_power_state *)power_state_offset;
|
||||||
|
@ -1772,6 +1769,10 @@ int sumo_dpm_init(struct radeon_device *rdev)
|
||||||
|
|
||||||
sumo_construct_boot_and_acpi_state(rdev);
|
sumo_construct_boot_and_acpi_state(rdev);
|
||||||
|
|
||||||
|
ret = r600_get_platform_caps(rdev);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
ret = sumo_parse_power_table(rdev);
|
ret = sumo_parse_power_table(rdev);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -1694,9 +1694,6 @@ static int trinity_parse_power_table(struct radeon_device *rdev)
|
||||||
if (!rdev->pm.dpm.ps)
|
if (!rdev->pm.dpm.ps)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
power_state_offset = (u8 *)state_array->states;
|
power_state_offset = (u8 *)state_array->states;
|
||||||
rdev->pm.dpm.platform_caps = le32_to_cpu(power_info->pplib.ulPlatformCaps);
|
|
||||||
rdev->pm.dpm.backbias_response_time = le16_to_cpu(power_info->pplib.usBackbiasTime);
|
|
||||||
rdev->pm.dpm.voltage_response_time = le16_to_cpu(power_info->pplib.usVoltageTime);
|
|
||||||
for (i = 0; i < state_array->ucNumEntries; i++) {
|
for (i = 0; i < state_array->ucNumEntries; i++) {
|
||||||
u8 *idx;
|
u8 *idx;
|
||||||
power_state = (union pplib_power_state *)power_state_offset;
|
power_state = (union pplib_power_state *)power_state_offset;
|
||||||
|
@ -1895,6 +1892,10 @@ int trinity_dpm_init(struct radeon_device *rdev)
|
||||||
|
|
||||||
trinity_construct_boot_state(rdev);
|
trinity_construct_boot_state(rdev);
|
||||||
|
|
||||||
|
ret = r600_get_platform_caps(rdev);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
ret = trinity_parse_power_table(rdev);
|
ret = trinity_parse_power_table(rdev);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue