The metrics interface exposes the socket power in W, but
apparently RN systems exposed the power as mW.  See
commit 137aac26a2ed ("drm/amdgpu/smu12: fix power reporting on renoir").
So leave RN as mW and use W for CZN/BCL.

Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2321
Fixes: 137aac26a2ed ("drm/amdgpu/smu12: fix power reporting on renoir")
Cc: jesse.zh...@amd.com
Signed-off-by: Alex Deucher <alexander.deuc...@amd.com>
---
 drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c 
b/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
index 85e22210963f..77308d481c54 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
@@ -1196,7 +1196,10 @@ static int renoir_get_smu_metrics_data(struct 
smu_context *smu,
                *value = metrics->AverageUvdActivity / 100;
                break;
        case METRICS_AVERAGE_SOCKETPOWER:
-               *value = (metrics->CurrentSocketPower << 8) / 1000;
+               if (smu->adev->ip_versions[MP1_HWIP][0] == IP_VERSION(12, 0, 0))
+                       *value = (metrics->CurrentSocketPower << 8) / 1000; /* 
mW */
+               else
+                       *value = metrics->CurrentSocketPower << 8; /* W */
                break;
        case METRICS_TEMPERATURE_EDGE:
                *value = (metrics->GfxTemperature / 100) *
-- 
2.39.0

Reply via email to