Commit 32e40ffb authored by Kent Russell's avatar Kent Russell Committed by Alex Deucher

drm/powerplay: Fix Vega20 Average Power value v4

The SMU changed reading from CurrSocketPower to AverageSocketPower, so
reflect this accordingly. This fixes the issue where Average Power
Consumption was being reported as 0 from SMU 40.46-onward

v2: Fixed headline prefix
v3: Add check for SMU version for proper compatibility
v4: Style fix
Signed-off-by: default avatarKent Russell <kent.russell@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ea207b29
...@@ -2101,7 +2101,10 @@ static int vega20_get_gpu_power(struct pp_hwmgr *hwmgr, ...@@ -2101,7 +2101,10 @@ static int vega20_get_gpu_power(struct pp_hwmgr *hwmgr,
if (ret) if (ret)
return ret; return ret;
if (hwmgr->smu_version < 0x282e00)
*query = metrics_table.CurrSocketPower << 8; *query = metrics_table.CurrSocketPower << 8;
else
*query = metrics_table.AverageSocketPower << 8;
return ret; return ret;
} }
......
...@@ -2917,6 +2917,7 @@ static int vega20_get_fan_speed_percent(struct smu_context *smu, ...@@ -2917,6 +2917,7 @@ static int vega20_get_fan_speed_percent(struct smu_context *smu,
static int vega20_get_gpu_power(struct smu_context *smu, uint32_t *value) static int vega20_get_gpu_power(struct smu_context *smu, uint32_t *value)
{ {
uint32_t smu_version;
int ret = 0; int ret = 0;
SmuMetrics_t metrics; SmuMetrics_t metrics;
...@@ -2927,7 +2928,14 @@ static int vega20_get_gpu_power(struct smu_context *smu, uint32_t *value) ...@@ -2927,7 +2928,14 @@ static int vega20_get_gpu_power(struct smu_context *smu, uint32_t *value)
if (ret) if (ret)
return ret; return ret;
ret = smu_get_smc_version(smu, NULL, &smu_version);
if (ret)
return ret;
if (smu_version < 0x282e00)
*value = metrics.CurrSocketPower << 8; *value = metrics.CurrSocketPower << 8;
else
*value = metrics.AverageSocketPower << 8;
return 0; return 0;
} }
......
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