[PATCH 4/5] drm/amdgpu/swsmu/vangogh: use metrics table for voltages

Quan, Evan Evan.Quan at amd.com
Wed Dec 2 02:13:07 UTC 2020


[AMD Official Use Only - Internal Distribution Only]

-----Original Message-----
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Alex Deucher
Sent: Wednesday, December 2, 2020 1:44 AM
To: amd-gfx at lists.freedesktop.org
Cc: Deucher, Alexander <Alexander.Deucher at amd.com>
Subject: [PATCH 4/5] drm/amdgpu/swsmu/vangogh: use metrics table for voltages

Fixes voltage reading for vddgfx and adds support for vddsoc.

Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
 .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 20 ++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
index 1645509cdab8..3bc7395c5fb7 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
@@ -265,6 +265,12 @@ static int vangogh_get_smu_metrics_data(struct smu_context *smu,
 case METRICS_THROTTLER_STATUS:
 *value = metrics->ThrottlerStatus;
 break;
+case METRICS_TEMPERATURE_VRGFX:
[Quan, Evan] "METRICS_TEMPERATURE_VRGFX" is not proper to use here. A new macro like "METRICS_VDDGFX" is recommended.
+*value = metrics->Voltage[2];
+break;
+case METRICS_TEMPERATURE_VRSOC:
[Quan, Evan] A new macro like "METRICS_VDDNB" or "METRICS_VDDSOC" is recommended.
+*value = metrics->Voltage[1];
+break;
 default:
 *value = UINT_MAX;
 break;
@@ -469,13 +475,21 @@ static int vangogh_read_sensor(struct smu_context *smu,
 break;
 case AMDGPU_PP_SENSOR_GFX_SCLK:
 ret = vangogh_get_smu_metrics_data(smu,
-    METRICS_AVERAGE_GFXCLK,
-    (uint32_t *)data);
+   METRICS_AVERAGE_GFXCLK,
+   (uint32_t *)data);
 *(uint32_t *)data *= 100;
 *size = 4;
 break;
 case AMDGPU_PP_SENSOR_VDDGFX:
-ret = smu_v11_0_get_gfx_vdd(smu, (uint32_t *)data);
+ret = vangogh_get_smu_metrics_data(smu,
+   METRICS_TEMPERATURE_VRGFX,
+   (uint32_t *)data);
+*size = 4;
+break;
+case AMDGPU_PP_SENSOR_VDDNB:
+ret = vangogh_get_smu_metrics_data(smu,
+   METRICS_TEMPERATURE_VRSOC,
+   (uint32_t *)data);
 *size = 4;
 break;
 default:
--
2.25.4

_______________________________________________
amd-gfx mailing list
amd-gfx at lists.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Cevan.quan%40amd.com%7C3084bf7338b747344a0e08d89620c0d8%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637424414710951019%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2af8UhjkqHLS3gSRl0HEb87RGLPPHfwSoqKdO%2Bu2xHU%3D&reserved=0


More information about the amd-gfx mailing list