Commit c7bae4aa authored by jie1zhan's avatar jie1zhan Committed by Alex Deucher

drm/amdgpu: Correct the power calcultion for Renior/Cezanne.

From smu firmware,the value of power is transferred  in units of watts.

Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2321
Fixes: 137aac26 ("drm/amdgpu/smu12: fix power reporting on renoir")
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarJesse Zhang <Jesse.Zhang@amd.com>
Reviewed-by: default avatarAaron Liu <aaron.liu@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
parent 040625ab
...@@ -1171,6 +1171,7 @@ static int renoir_get_smu_metrics_data(struct smu_context *smu, ...@@ -1171,6 +1171,7 @@ static int renoir_get_smu_metrics_data(struct smu_context *smu,
int ret = 0; int ret = 0;
uint32_t apu_percent = 0; uint32_t apu_percent = 0;
uint32_t dgpu_percent = 0; uint32_t dgpu_percent = 0;
struct amdgpu_device *adev = smu->adev;
ret = smu_cmn_get_metrics_table(smu, ret = smu_cmn_get_metrics_table(smu,
...@@ -1196,7 +1197,11 @@ static int renoir_get_smu_metrics_data(struct smu_context *smu, ...@@ -1196,7 +1197,11 @@ static int renoir_get_smu_metrics_data(struct smu_context *smu,
*value = metrics->AverageUvdActivity / 100; *value = metrics->AverageUvdActivity / 100;
break; break;
case METRICS_AVERAGE_SOCKETPOWER: case METRICS_AVERAGE_SOCKETPOWER:
*value = (metrics->CurrentSocketPower << 8) / 1000; if (((adev->ip_versions[MP1_HWIP][0] == IP_VERSION(12, 0, 1)) && (adev->pm.fw_version >= 0x40000f)) ||
((adev->ip_versions[MP1_HWIP][0] == IP_VERSION(12, 0, 0)) && (adev->pm.fw_version >= 0x373200)))
*value = metrics->CurrentSocketPower << 8;
else
*value = (metrics->CurrentSocketPower << 8) / 1000;
break; break;
case METRICS_TEMPERATURE_EDGE: case METRICS_TEMPERATURE_EDGE:
*value = (metrics->GfxTemperature / 100) * *value = (metrics->GfxTemperature / 100) *
......
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