<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:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">You can add <span>descriptions like:</span></p>
<p style="margin-top:0;margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0;margin-bottom:0"><span>fix bug read wrong engine clock when in deep sleep.</span></p>
<p style="margin-top:0;margin-bottom:0"><br>
<span></span></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><span>Reviewed-by:</span> <span>Rex Zhu <Rex.Zhu@amd.com></span></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Best Regards</p>
<p style="margin-top:0;margin-bottom:0">Rex<br>
</p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Evan Quan <evan.quan@amd.com><br>
<b>Sent:</b> Tuesday, April 10, 2018 1:08 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Quan, Evan; Zhu, Rex<br>
<b>Subject:</b> [PATCH] drm/amd/powerplay: get real current gfxclk frequency instead of dpm level value</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Change-Id: Ie9a684d018f9ed43e3baadc6ba2c7525da97d659<br>
Signed-off-by: Evan Quan <evan.quan@amd.com><br>
---<br>
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 13 ++++---------<br>
 drivers/gpu/drm/amd/powerplay/inc/vega10_ppsmc.h   |  1 +<br>
 2 files changed, 5 insertions(+), 9 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c<br>
index 5fc2f20..b8102c4 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c<br>
@@ -3799,7 +3799,7 @@ static int vega10_read_sensor(struct pp_hwmgr *hwmgr, int idx,<br>
                               void *value, int *size)<br>
 {<br>
         struct amdgpu_device *adev = hwmgr->adev;<br>
-       uint32_t sclk_idx, mclk_idx, activity_percent = 0;<br>
+       uint32_t sclk_mhz, mclk_idx, activity_percent = 0;<br>
         struct vega10_hwmgr *data = hwmgr->backend;<br>
         struct vega10_dpm_table *dpm_table = &data->dpm_table;<br>
         int ret = 0;<br>
@@ -3807,14 +3807,9 @@ static int vega10_read_sensor(struct pp_hwmgr *hwmgr, int idx,<br>
 <br>
         switch (idx) {<br>
         case AMDGPU_PP_SENSOR_GFX_SCLK:<br>
-               smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetCurrentGfxclkIndex);<br>
-               sclk_idx = smum_get_argument(hwmgr);<br>
-               if (sclk_idx <  dpm_table->gfx_table.count) {<br>
-                       *((uint32_t *)value) = dpm_table->gfx_table.dpm_levels[sclk_idx].value;<br>
-                       *size = 4;<br>
-               } else {<br>
-                       ret = -EINVAL;<br>
-               }<br>
+               smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetAverageGfxclkActualFrequency);<br>
+               sclk_mhz = smum_get_argument(hwmgr);<br>
+               *((uint32_t *)value) = sclk_mhz * 100;<br>
                 break;<br>
         case AMDGPU_PP_SENSOR_GFX_MCLK:<br>
                 smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetCurrentUclkIndex);<br>
diff --git a/drivers/gpu/drm/amd/powerplay/inc/vega10_ppsmc.h b/drivers/gpu/drm/amd/powerplay/inc/vega10_ppsmc.h<br>
index c3ed737..715b5a1 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/inc/vega10_ppsmc.h<br>
+++ b/drivers/gpu/drm/amd/powerplay/inc/vega10_ppsmc.h<br>
@@ -131,6 +131,7 @@ typedef uint16_t PPSMC_Result;<br>
 #define PPSMC_MSG_RunAcgInOpenLoop               0x5E<br>
 #define PPSMC_MSG_InitializeAcg                  0x5F<br>
 #define PPSMC_MSG_GetCurrPkgPwr                  0x61<br>
+#define PPSMC_MSG_GetAverageGfxclkActualFrequency 0x63<br>
 #define PPSMC_MSG_SetPccThrottleLevel            0x67<br>
 #define PPSMC_MSG_UpdatePkgPwrPidAlpha           0x68<br>
 #define PPSMC_Message_Count                      0x69<br>
-- <br>
2.7.4<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a previewremoved="true" id="LPlnk763949" href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a>
<div style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;" id="LPBorder_GT_15233364713540.7310393612879407">
<table role="presentation" style="width: 90%; background-color: rgb(255, 255, 255); position: relative; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top: 1px dotted rgb(200, 200, 200); border-bottom: 1px dotted rgb(200, 200, 200);" id="LPContainer_15233364713520.42625979668606295" cellspacing="0">
<tbody>
<tr style="border-spacing: 0px;" valign="top">
<td colspan="2" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;" id="TextCell_15233364713530.4830316004163536">
<div id="LPRemovePreviewContainer_15233364713530.430401111716639"></div>
<div style="top: 0px; color: rgb(0, 120, 215); font-weight: 400; font-size: 21px; font-family: "wf_segoe-ui_light","Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; line-height: 21px;" id="LPTitle_15233364713530.8953525699777491">
<a target="_blank" href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" style="text-decoration: none;" id="LPUrlAnchor_15233364713530.07407912196749844">amd-gfx Info Page - freedesktop.org</a></div>
<div style="margin: 10px 0px 16px; color: rgb(102, 102, 102); font-weight: 400; font-family: "wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size: 14px; line-height: 14px;" id="LPMetadata_15233364713540.5144975367752683">
lists.freedesktop.org</div>
<div style="display: block; color: rgb(102, 102, 102); font-weight: 400; font-family: "wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size: 14px; line-height: 20px; max-height: 100px; overflow: hidden;" id="LPDescription_15233364713540.5845960638327531">
Subscribing to amd-gfx: Subscribe to amd-gfx by filling out the following form. Use of all freedesktop.org lists is subject to our Code of Conduct.</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
</div>
</span></font></div>
</div>
</div>
</body>
</html>