<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">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Ah, I missed that they were already handled in smu_v11_0.c.  In that case, I think I can drop these patches.</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);">
Alex<br>
</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> Quan, Evan<br>
<b>Sent:</b> Wednesday, July 17, 2019 8:58 PM<br>
<b>To:</b> Alex Deucher; amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Deucher, Alexander<br>
<b>Subject:</b> RE: [PATCH 2/2] drm/amdgpu: add sclk/uclk sensor support for vega20</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">I think the AMDGPU_PP_SENSOR_GFX_SCLK and AMDGPU_PP_SENSOR_GFX_MCLK requests are handled in smu_v11_0_read_sensor.<br>
It means it cannot reach navi10_ppt.c and vega20_ppt.c.<br>
Maybe this should be fixed in smu_v11_0_read_sensor.<br>
<br>
Regards,<br>
Evan<br>
> -----Original Message-----<br>
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Alex<br>
> Deucher<br>
> Sent: Wednesday, July 17, 2019 10:36 PM<br>
> To: amd-gfx@lists.freedesktop.org<br>
> Cc: Deucher, Alexander <Alexander.Deucher@amd.com><br>
> Subject: [PATCH 2/2] drm/amdgpu: add sclk/uclk sensor support for vega20<br>
> <br>
> Query the metrics table to get the average sclk and uclk.<br>
> <br>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com><br>
> ---<br>
>  drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 35<br>
> ++++++++++++++++++++++<br>
>  1 file changed, 35 insertions(+)<br>
> <br>
> diff --git a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c<br>
> b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c<br>
> index 9204e4e50d09..763d73af6cd1 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c<br>
> @@ -3117,6 +3117,36 @@ static int vega20_thermal_get_temperature(struct<br>
> smu_context *smu,<br>
> <br>
>        return 0;<br>
>  }<br>
> +<br>
> +static int vega20_get_avg_clocks(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<br>
> *)&metrics, false);<br>
> +     if (ret)<br>
> +             return ret;<br>
> +<br>
> +     switch (sensor) {<br>
> +     case AMDGPU_PP_SENSOR_GFX_SCLK:<br>
> +             *value = metrics.AverageGfxclkFrequency * 100;<br>
> +             break;<br>
> +     case AMDGPU_PP_SENSOR_GFX_MCLK:<br>
> +             *value = metrics.AverageUclkFrequency * 100;<br>
> +             break;<br>
> +     default:<br>
> +             pr_err("Invalid sensor for retrieving avg clock\n");<br>
> +             return -EINVAL;<br>
> +     }<br>
> +<br>
> +     return 0;<br>
> +}<br>
> +<br>
>  static int vega20_read_sensor(struct smu_context *smu,<br>
>                                 enum amd_pp_sensors sensor,<br>
>                                 void *data, uint32_t *size)<br>
> @@ -3147,6 +3177,11 @@ static int vega20_read_sensor(struct smu_context<br>
> *smu,<br>
>                ret = vega20_thermal_get_temperature(smu, sensor,<br>
> (uint32_t *)data);<br>
>                *size = 4;<br>
>                break;<br>
> +     case AMDGPU_PP_SENSOR_GFX_SCLK:<br>
> +     case AMDGPU_PP_SENSOR_GFX_MCLK:<br>
> +             ret = vega20_get_avg_clocks(smu, sensor, (uint32_t *)data);<br>
> +             *size = 4;<br>
> +             break;<br>
>        default:<br>
>                return -EINVAL;<br>
>        }<br>
> --<br>
> 2.20.1<br>
> <br>
> _______________________________________________<br>
> amd-gfx mailing list<br>
> amd-gfx@lists.freedesktop.org<br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</body>
</html>