<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;" dir="ltr">
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<div style="color: rgb(0, 0, 0);">
<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> Alex Deucher <alexdeucher@gmail.com><br>
<b>Sent:</b> Saturday, July 6, 2019 5:06 AM<br>
<b>To:</b> Wang, Kevin(Yang)<br>
<b>Cc:</b> amd-gfx@lists.freedesktop.org; Xiao, Jack; Kenenth.Feng@amd.com; Zhang, Hawking<br>
<b>Subject:</b> Re: [PATCH] drm/amd/powerplay: add temperature sensor support for navi10</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">On Wed, Jul 3, 2019 at 11:02 PM Wang, Kevin(Yang) <Kevin1.Wang@amd.com> wrote:<br>
><br>
> the hwmon interface need temperature sensor type support.<br>
> 1. SENSOR_HOTSPOT_TEMP<br>
> 2. SENSOR_EDGE_TEMP(SENSOR_GPU_TEMP)<br>
> 3. SENSOR_MEM_TEMP<br>
><br>
> Change-Id: I3db762e4032072fae67c95b7ba6d62e20ae5bead<br>
> Signed-off-by: Kevin Wang <kevin1.wang@amd.com><br>
> ---<br>
> drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 42 ++++++++++++++++++++++<br>
> 1 file changed, 42 insertions(+)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c<br>
> index 7574a02350c6..d5876c2393e7 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c<br>
> @@ -1255,6 +1255,42 @@ static int navi10_set_watermarks_table(struct smu_context *smu,<br>
> return 0;<br>
> }<br>
><br>
> +static int navi10_thermal_get_temperature(struct smu_context *smu,<br>
> + enum amd_pp_sensors sensor,<br>
> + uint32_t *value)<br>
> +{<br>
> + SmuMetrics_t metrics;<br>
> + int ret = 0;<br>
> +<br>
> + if (!value)<br>
> + return -EINVAL;<br>
> +<br>
> + ret = smu_update_table(smu, SMU_TABLE_SMU_METRICS, (void *)&metrics, false);<br>
> + if (ret)<br>
> + return ret;<br>
> +<br>
> + switch (sensor) {<br>
> + case AMDGPU_PP_SENSOR_HOTSPOT_TEMP:<br>
> + *value = metrics.TemperatureHotspot *<br>
> + SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;<br>
> + break;<br>
> + case AMDGPU_PP_SENSOR_GPU_TEMP:<br>
> + case AMDGPU_PP_SENSOR_EDGE_TEMP:<br>
> + *value = metrics.TemperatureEdge *<br>
> + SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;<br>
> + break;<br>
> + case AMDGPU_PP_SENSOR_MEM_TEMP:<br>
> + *value = metrics.TemperatureVrMem0 *<br>
<br>
We should check with the SMU team. this might be the memory voltage<br>
regulator rather than the memory itself.<br>
<br>
Alex</div>
<div class="PlainText"><br>
</div>
<div class="PlainText">[kevin]:</div>
<div class="PlainText"><span style="font-size: 11pt;">sure, you are right, we should use TemperatureMem, the TemperatureVrMem0 is memory voltage regular temperature.</span><br>
</div>
<div class="PlainText">thanks.</div>
<div class="PlainText"><br>
> + SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;<br>
> + break;<br>
> + default:<br>
> + pr_err("Invalid sensor for retrieving temp\n");<br>
> + return -EINVAL;<br>
> + }<br>
> +<br>
> + return 0;<br>
> +}<br>
> +<br>
> static int navi10_read_sensor(struct smu_context *smu,<br>
> enum amd_pp_sensors sensor,<br>
> void *data, uint32_t *size)<br>
> @@ -1276,6 +1312,12 @@ static int navi10_read_sensor(struct smu_context *smu,<br>
> ret = navi10_get_gpu_power(smu, (uint32_t *)data);<br>
> *size = 4;<br>
> break;<br>
> + case AMDGPU_PP_SENSOR_HOTSPOT_TEMP:<br>
> + case AMDGPU_PP_SENSOR_EDGE_TEMP:<br>
> + case AMDGPU_PP_SENSOR_MEM_TEMP:<br>
> + ret = navi10_thermal_get_temperature(smu, sensor, (uint32_t *)data);<br>
> + *size = 4;<br>
> + break;<br>
> default:<br>
> return -EINVAL;<br>
> }<br>
> --<br>
> 2.22.0<br>
><br>
> _______________________________________________<br>
> amd-gfx mailing list<br>
> amd-gfx@lists.freedesktop.org<br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" id="LPlnk244494" class="OWAAutoLink" previewremoved="true">
https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</div>
</div>
</body>
</html>