<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 style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
comment inline.</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Liang, Prike <Prike.Liang@amd.com><br>
<b>Sent:</b> Monday, September 23, 2019 4:43 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> arron.liu@amd.com <arron.liu@amd.com>; Huang, Ray <Ray.Huang@amd.com>; Liang, Prike <Prike.Liang@amd.com>; Quan, Evan <Evan.Quan@amd.com>; Feng, Kenneth <Kenneth.Feng@amd.com><br>
<b>Subject:</b> [PATCH 5/5] drm/amd/powerplay: implement interface set_power_profile_mode()</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">Add set_power_profile_mode() for none manual dpm level case setting power profile mode.<br>
<br>
Signed-off-by: Prike Liang <Prike.Liang@amd.com><br>
---<br>
drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 25 +++++++++++++++++++++++++<br>
1 file changed, 25 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 c6aae1c..6819514 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c<br>
@@ -473,6 +473,30 @@ static int renoir_force_clk_levels(struct smu_context *smu,<br>
return ret;<br>
}<br>
<br>
+static int renoir_set_power_profile_mode(struct smu_context *smu, long *input, uint32_t size)<br>
+{<br>
+ int workload_type;<br>
+<br>
+ smu->power_profile_mode = input[size];<br>
+<br>
+ if (smu->power_profile_mode > PP_SMC_POWER_PROFILE_CUSTOM) {<br>
+ pr_err("Invalid power profile mode %d\n", smu->power_profile_mode);<br>
+ return -EINVAL;<br>
+ }<br>
+<br>
+ if (smu->power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {<br>
+ if (size < 0)<br>
+ return -EINVAL;<br>
+<br>
+ /* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */<br>
+ workload_type = smu_workload_get_type(smu, smu->power_profile_mode);</div>
<div class="PlainText">[kevin]:</div>
<div class="PlainText">you'd better check the return value, when this workload is unmapped, it will return -EINVAL.</div>
<div class="PlainText">+ smu_send_smc_msg_with_param(smu, SMU_MSG_SetWorkloadMask,<br>
+ 1 << workload_type);</div>
<div class="PlainText">[kevin]:</div>
<div class="PlainText">please check return value in smu driver every time.</div>
<div class="PlainText">after fixed:</div>
<div class="PlainText">Reviewed-by: Kevin Wang <kevin1.wang@amd.com><br>
+ }<br>
+ return 0;<br>
+}<br>
+<br>
+<br>
static const struct pptable_funcs renoir_ppt_funcs = {<br>
.get_smu_msg_index = renoir_get_smu_msg_index,<br>
.get_smu_table_index = renoir_get_smu_table_index,<br>
@@ -487,6 +511,7 @@ static const struct pptable_funcs renoir_ppt_funcs = {<br>
.get_workload_type = renoir_get_workload_type,<br>
.get_profiling_clk_mask = renoir_get_profiling_clk_mask,<br>
.force_clk_levels = renoir_force_clk_levels,<br>
+ .set_power_profile_mode = renoir_set_power_profile_mode,<br>
};<br>
<br>
void renoir_set_ppt_funcs(struct smu_context *smu)<br>
-- <br>
2.7.4<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></div>
</span></font></div>
</body>
</html>