<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#0078D7;margin:15pt;" align="Left">
[AMD Official Use Only - Internal Distribution Only]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Series are Reviewed-by: Kevin Wang <kevin1.wang@amd.com></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Best Regards,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Kevin</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Xiaomeng Hou <Xiaomeng.Hou@amd.com><br>
<b>Sent:</b> Thursday, December 5, 2019 7:50 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Hou, Xiaomeng (Matthew) <Xiaomeng.Hou@amd.com><br>
<b>Subject:</b> [PATCH 1/4] drm/amd/powerplay: implement interface to retrieve gpu temperature for renoir</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">add sensor interface of get gpu temperature for debugfs.<br>
<br>
Change-Id: I2499b6652fad6d5d776b6ed4cd5157636583ed39<br>
Signed-off-by: Xiaomeng Hou <Xiaomeng.Hou@amd.com><br>
---<br>
 drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 22 ++++++++++++++++++++++<br>
 1 file changed, 22 insertions(+)<br>
<br>
diff --git a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c<br>
index 3788047bd704..3f6f0ebf1fbe 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c<br>
@@ -429,6 +429,24 @@ static int renoir_get_gpu_power(struct smu_context *smu, uint32_t *value)<br>
         return 0;<br>
 }<br>
 <br>
+static int renoir_get_gpu_temperature(struct smu_context *smu, uint32_t *value)<br>
+{<br>
+       int ret = 0;<br>
+       SmuMetrics_t metrics;<br>
+<br>
+       if (!value)<br>
+               return -EINVAL;<br>
+<br>
+       ret = renoir_get_metrics_table(smu, &metrics);<br>
+       if (ret)<br>
+               return ret;<br>
+<br>
+       *value = (metrics.GfxTemperature / 100) *<br>
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;<br>
+<br>
+       return 0;<br>
+}<br>
+<br>
 static int renoir_get_current_activity_percent(struct smu_context *smu,<br>
                                                enum amd_pp_sensors sensor,<br>
                                                uint32_t *value)<br>
@@ -787,6 +805,10 @@ static int renoir_read_sensor(struct smu_context *smu,<br>
                 ret = renoir_get_gpu_power(smu, (uint32_t *)data);<br>
                 *size = 4;<br>
                 break;<br>
+       case AMDGPU_PP_SENSOR_GPU_TEMP:<br>
+               ret = renoir_get_gpu_temperature(smu, (uint32_t *)data);<br>
+               *size = 4;<br>
+               break;<br>
         default:<br>
                 ret = smu_v12_0_read_sensor(smu, sensor, data, size);<br>
         }<br>
-- <br>
2.24.0<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7CKevin1.Wang%40amd.com%7Ce7bc3a8c13f84bcaa6ea08d77979b491%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637111436075244006&amp;sdata=anmGwlHsOZyOTVshYgwg%2BzhAvwg3MYPzRrCiHgSosaI%3D&amp;reserved=0">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7CKevin1.Wang%40amd.com%7Ce7bc3a8c13f84bcaa6ea08d77979b491%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637111436075244006&amp;sdata=anmGwlHsOZyOTVshYgwg%2BzhAvwg3MYPzRrCiHgSosaI%3D&amp;reserved=0</a></div>
</span></font></div>
</div>
</body>
</html>