Commit 765bbbec authored by Mario Limonciello's avatar Mario Limonciello Committed by Alex Deucher

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: default avatarMario Limonciello <mario.limonciello@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 4c64f2e4
...@@ -2129,7 +2129,7 @@ static int vega20_get_metrics_table(struct pp_hwmgr *hwmgr, ...@@ -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, ...@@ -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 */
switch (idx) {
case AMDGPU_PP_SENSOR_GPU_POWER:
if (hwmgr->smu_version == 0x282e00) if (hwmgr->smu_version == 0x282e00)
*query = metrics_table.AverageSocketPower << 8; *query = metrics_table.AverageSocketPower << 8;
else 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, ...@@ -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) &
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment