drm/amd: Show both power attributes for vega20
Vega20 can offer average power in some versions of the PMFW and current power in others. Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
4c64f2e420
commit
765bbbec16
@@ -2129,7 +2129,7 @@ static int vega20_get_metrics_table(struct pp_hwmgr *hwmgr,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vega20_get_gpu_power(struct pp_hwmgr *hwmgr,
|
static int vega20_get_gpu_power(struct pp_hwmgr *hwmgr, int idx,
|
||||||
uint32_t *query)
|
uint32_t *query)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@@ -2140,10 +2140,17 @@ static int vega20_get_gpu_power(struct pp_hwmgr *hwmgr,
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* For the 40.46 release, they changed the value name */
|
/* For the 40.46 release, they changed the value name */
|
||||||
if (hwmgr->smu_version == 0x282e00)
|
switch (idx) {
|
||||||
*query = metrics_table.AverageSocketPower << 8;
|
case AMDGPU_PP_SENSOR_GPU_POWER:
|
||||||
else
|
if (hwmgr->smu_version == 0x282e00)
|
||||||
|
*query = metrics_table.AverageSocketPower << 8;
|
||||||
|
else
|
||||||
|
ret = -EOPNOTSUPP;
|
||||||
|
break;
|
||||||
|
case AMDGPU_PP_SENSOR_GPU_INPUT_POWER:
|
||||||
*query = metrics_table.CurrSocketPower << 8;
|
*query = metrics_table.CurrSocketPower << 8;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -2253,9 +2260,10 @@ static int vega20_read_sensor(struct pp_hwmgr *hwmgr, int idx,
|
|||||||
*((uint32_t *)value) = data->vce_power_gated ? 0 : 1;
|
*((uint32_t *)value) = data->vce_power_gated ? 0 : 1;
|
||||||
*size = 4;
|
*size = 4;
|
||||||
break;
|
break;
|
||||||
|
case AMDGPU_PP_SENSOR_GPU_POWER:
|
||||||
case AMDGPU_PP_SENSOR_GPU_INPUT_POWER:
|
case AMDGPU_PP_SENSOR_GPU_INPUT_POWER:
|
||||||
*size = 16;
|
*size = 16;
|
||||||
ret = vega20_get_gpu_power(hwmgr, (uint32_t *)value);
|
ret = vega20_get_gpu_power(hwmgr, idx, (uint32_t *)value);
|
||||||
break;
|
break;
|
||||||
case AMDGPU_PP_SENSOR_VDDGFX:
|
case AMDGPU_PP_SENSOR_VDDGFX:
|
||||||
val_vid = (RREG32_SOC15(SMUIO, 0, mmSMUSVI0_TEL_PLANE0) &
|
val_vid = (RREG32_SOC15(SMUIO, 0, mmSMUSVI0_TEL_PLANE0) &
|
||||||
|
|||||||
Reference in New Issue
Block a user