<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">Series is:</p>
<p style="margin-top:0;margin-bottom:0">Reviewed-by: <span>Rex Zhu <Rex.Zhu@amd.com></span><span></span></p>
<p style="margin-top:0;margin-bottom:0"><br>
<span></span><span class="li-61 "></span></p>
<p></p>
<p style="margin-top:0;margin-bottom:0">Best Regards</p>
<p style="margin-top:0;margin-bottom:0">Rex<br>
</p>
<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> Wednesday, October 24, 2018 4:09 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Quan, Evan<br>
<b>Subject:</b> [PATCH 2/2] drm/amd/powerplay: commonize the API for retrieving current clocks</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">So that it can be shared between all clocks.<br>
<br>
Change-Id: Ibac99b2aa81c1cb3e988b4eae6c98d32b7f35bed<br>
Signed-off-by: Evan Quan <evan.quan@amd.com><br>
---<br>
.../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 44 +++++++------------<br>
1 file changed, 15 insertions(+), 29 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c<br>
index 8a1ee9ce7386..57143d51e3ee 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c<br>
@@ -1875,38 +1875,20 @@ static int vega20_get_gpu_power(struct pp_hwmgr *hwmgr,<br>
return ret;<br>
}<br>
<br>
-static int vega20_get_current_gfx_clk_freq(struct pp_hwmgr *hwmgr, uint32_t *gfx_freq)<br>
+static int vega20_get_current_clk_freq(struct pp_hwmgr *hwmgr,<br>
+ PPCLK_e clk_id, uint32_t *clk_freq)<br>
{<br>
- uint32_t gfx_clk = 0;<br>
int ret = 0;<br>
<br>
- *gfx_freq = 0;<br>
+ *clk_freq = 0;<br>
<br>
PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,<br>
- PPSMC_MSG_GetDpmClockFreq, (PPCLK_GFXCLK << 16))) == 0,<br>
- "[GetCurrentGfxClkFreq] Attempt to get Current GFXCLK Frequency Failed!",<br>
+ PPSMC_MSG_GetDpmClockFreq, (clk_id << 16))) == 0,<br>
+ "[GetCurrentClkFreq] Attempt to get Current Frequency Failed!",<br>
return ret);<br>
- gfx_clk = smum_get_argument(hwmgr);<br>
+ *clk_freq = smum_get_argument(hwmgr);<br>
<br>
- *gfx_freq = gfx_clk * 100;<br>
-<br>
- return 0;<br>
-}<br>
-<br>
-static int vega20_get_current_mclk_freq(struct pp_hwmgr *hwmgr, uint32_t *mclk_freq)<br>
-{<br>
- uint32_t mem_clk = 0;<br>
- int ret = 0;<br>
-<br>
- *mclk_freq = 0;<br>
-<br>
- PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,<br>
- PPSMC_MSG_GetDpmClockFreq, (PPCLK_UCLK << 16))) == 0,<br>
- "[GetCurrentMClkFreq] Attempt to get Current MCLK Frequency Failed!",<br>
- return ret);<br>
- mem_clk = smum_get_argument(hwmgr);<br>
-<br>
- *mclk_freq = mem_clk * 100;<br>
+ *clk_freq = *clk_freq * 100;<br>
<br>
return 0;<br>
}<br>
@@ -1937,12 +1919,16 @@ static int vega20_read_sensor(struct pp_hwmgr *hwmgr, int idx,<br>
<br>
switch (idx) {<br>
case AMDGPU_PP_SENSOR_GFX_SCLK:<br>
- ret = vega20_get_current_gfx_clk_freq(hwmgr, (uint32_t *)value);<br>
+ ret = vega20_get_current_clk_freq(hwmgr,<br>
+ PPCLK_GFXCLK,<br>
+ (uint32_t *)value);<br>
if (!ret)<br>
*size = 4;<br>
break;<br>
case AMDGPU_PP_SENSOR_GFX_MCLK:<br>
- ret = vega20_get_current_mclk_freq(hwmgr, (uint32_t *)value);<br>
+ ret = vega20_get_current_clk_freq(hwmgr,<br>
+ PPCLK_UCLK,<br>
+ (uint32_t *)value);<br>
if (!ret)<br>
*size = 4;<br>
break;<br>
@@ -2743,7 +2729,7 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr,<br>
<br>
switch (type) {<br>
case PP_SCLK:<br>
- ret = vega20_get_current_gfx_clk_freq(hwmgr, &now);<br>
+ ret = vega20_get_current_clk_freq(hwmgr, PPCLK_GFXCLK, &now);<br>
PP_ASSERT_WITH_CODE(!ret,<br>
"Attempt to get current gfx clk Failed!",<br>
return ret);<br>
@@ -2760,7 +2746,7 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr,<br>
break;<br>
<br>
case PP_MCLK:<br>
- ret = vega20_get_current_mclk_freq(hwmgr, &now);<br>
+ ret = vega20_get_current_clk_freq(hwmgr, PPCLK_UCLK, &now);<br>
PP_ASSERT_WITH_CODE(!ret,<br>
"Attempt to get current mclk freq Failed!",<br>
return ret);<br>
-- <br>
2.19.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" id="LPlnk591263" class="OWAAutoLink" previewremoved="true">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a>
<div id="LPBorder_GT_15403702740060.3029944789547515" style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;">
<table id="LPContainer_15403702740040.3674420542081086" 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);" role="presentation" cellspacing="0">
<tbody>
<tr style="border-spacing: 0px;" valign="top">
<td id="TextCell_15403702740040.7718602022154916" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;" colspan="2">
<div id="LPRemovePreviewContainer_15403702740040.4704212625450027"></div>
<div id="LPTitle_15403702740040.051381412236660484" 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;">
<a id="LPUrlAnchor_15403702740040.8846730316909506" style="text-decoration: none;" href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" target="_blank">amd-gfx Info Page - freedesktop.org</a></div>
<div id="LPMetadata_15403702740060.30198120680135265" 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;">
lists.freedesktop.org</div>
<div id="LPDescription_15403702740060.6995795013409524" 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;">
To see the collection of prior postings to the list, visit the amd-gfx Archives.. Using amd-gfx: To post a message to all the list members, send email to amd-gfx@lists.freedesktop.org. You can subscribe to the list, or change your existing subscription, in
the sections below.</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
</div>
</span></font></div>
</div>
</div>
</body>
</html>