[PATCH 6/8] drm/amd/powerplay: implement interface set_power_profile_mode()
Quan, Evan
Evan.Quan at amd.com
Thu Sep 26 12:03:52 UTC 2019
With the following addressed, the patch is reviewed-by: Evan Quan <evan.quan at amd.com>
-----Original Message-----
From: Liang, Prike <Prike.Liang at amd.com>
Sent: Thursday, September 26, 2019 11:50 AM
To: amd-gfx at lists.freedesktop.org
Cc: Quan, Evan <Evan.Quan at amd.com>; keneth.feng at amd.com; Huang, Ray <Ray.Huang at amd.com>; Liang, Prike <Prike.Liang at amd.com>
Subject: [PATCH 6/8] drm/amd/powerplay: implement interface set_power_profile_mode()
Add set_power_profile_mode() for none manual dpm level case setting power profile mode.
Signed-off-by: Prike Liang <Prike.Liang at amd.com>
---
drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
index 4f2b750..151d78e 100644
--- a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
@@ -482,6 +482,35 @@ static int renoir_force_clk_levels(struct smu_context *smu,
return ret;
}
+static int renoir_set_power_profile_mode(struct smu_context *smu, long
+*input, uint32_t size) {
+ int workload_type, ret;
+
+ smu->power_profile_mode = input[size];
+
[Quan, Evan] move this to place B. That's to update current profile mode only when it's valid.
+ if (smu->power_profile_mode > PP_SMC_POWER_PROFILE_CUSTOM) {
+ pr_err("Invalid power profile mode %d\n", smu->power_profile_mode);
+ return -EINVAL;
+ }
+
[Quan, Evan] place B
+ /* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */
+ workload_type = smu_workload_get_type(smu, smu->power_profile_mode);
+ if (workload_type < 0) {
+ pr_err("Unsupported power profile mode %d on RENOIR\n",smu->power_profile_mode);
+ return -EINVAL;
+ }
+
+ ret = smu_send_smc_msg_with_param(smu, SMU_MSG_SetWorkloadMask,
+ 1 << workload_type);
+ if (ret) {
+ pr_err("Fail to set workload type %d\n", workload_type);
+ return ret;
+ }
+
+ return 0;
+}
+
+
static const struct pptable_funcs renoir_ppt_funcs = {
.get_smu_msg_index = renoir_get_smu_msg_index,
.get_smu_table_index = renoir_get_smu_table_index, @@ -496,6 +525,7 @@ static const struct pptable_funcs renoir_ppt_funcs = {
.get_workload_type = renoir_get_workload_type,
.get_profiling_clk_mask = renoir_get_profiling_clk_mask,
.force_clk_levels = renoir_force_clk_levels,
+ .set_power_profile_mode = renoir_set_power_profile_mode,
};
void renoir_set_ppt_funcs(struct smu_context *smu)
--
2.7.4
More information about the amd-gfx
mailing list