[PATCH 1/4] drm/amd/powerplay: implement interface to retrieve gpu temperature for renoir

Wang, Kevin(Yang) Kevin1.Wang at amd.com
Thu Dec 5 12:55:58 UTC 2019


[AMD Official Use Only - Internal Distribution Only]

Series are Reviewed-by: Kevin Wang <kevin1.wang at amd.com>

Best Regards,
Kevin
________________________________
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> on behalf of Xiaomeng Hou <Xiaomeng.Hou at amd.com>
Sent: Thursday, December 5, 2019 7:50 PM
To: amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>
Cc: Hou, Xiaomeng (Matthew) <Xiaomeng.Hou at amd.com>
Subject: [PATCH 1/4] drm/amd/powerplay: implement interface to retrieve gpu temperature for renoir

add sensor interface of get gpu temperature for debugfs.

Change-Id: I2499b6652fad6d5d776b6ed4cd5157636583ed39
Signed-off-by: Xiaomeng Hou <Xiaomeng.Hou at amd.com>
---
 drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
index 3788047bd704..3f6f0ebf1fbe 100644
--- a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
@@ -429,6 +429,24 @@ static int renoir_get_gpu_power(struct smu_context *smu, uint32_t *value)
         return 0;
 }

+static int renoir_get_gpu_temperature(struct smu_context *smu, uint32_t *value)
+{
+       int ret = 0;
+       SmuMetrics_t metrics;
+
+       if (!value)
+               return -EINVAL;
+
+       ret = renoir_get_metrics_table(smu, &metrics);
+       if (ret)
+               return ret;
+
+       *value = (metrics.GfxTemperature / 100) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+
+       return 0;
+}
+
 static int renoir_get_current_activity_percent(struct smu_context *smu,
                                                enum amd_pp_sensors sensor,
                                                uint32_t *value)
@@ -787,6 +805,10 @@ static int renoir_read_sensor(struct smu_context *smu,
                 ret = renoir_get_gpu_power(smu, (uint32_t *)data);
                 *size = 4;
                 break;
+       case AMDGPU_PP_SENSOR_GPU_TEMP:
+               ret = renoir_get_gpu_temperature(smu, (uint32_t *)data);
+               *size = 4;
+               break;
         default:
                 ret = smu_v12_0_read_sensor(smu, sensor, data, size);
         }
--
2.24.0

_______________________________________________
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=02%7C01%7CKevin1.Wang%40amd.com%7Ce7bc3a8c13f84bcaa6ea08d77979b491%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637111436075244006&sdata=anmGwlHsOZyOTVshYgwg%2BzhAvwg3MYPzRrCiHgSosaI%3D&reserved=0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20191205/b90420a5/attachment-0001.html>


More information about the amd-gfx mailing list