aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3988-drm-amd-powerplay-implement-interface-set_power_prof.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3988-drm-amd-powerplay-implement-interface-set_power_prof.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3988-drm-amd-powerplay-implement-interface-set_power_prof.patch70
1 files changed, 70 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3988-drm-amd-powerplay-implement-interface-set_power_prof.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3988-drm-amd-powerplay-implement-interface-set_power_prof.patch
new file mode 100644
index 00000000..7db4573a
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3988-drm-amd-powerplay-implement-interface-set_power_prof.patch
@@ -0,0 +1,70 @@
+From 11f1b9201791dc93e3655c2e97fe1eb43459149d Mon Sep 17 00:00:00 2001
+From: Prike Liang <Prike.Liang@amd.com>
+Date: Mon, 23 Sep 2019 15:52:12 +0800
+Subject: [PATCH 3988/4256] drm/amd/powerplay: implement interface
+ set_power_profile_mode() (v2)
+
+v1:
+Add set_power_profile_mode() for none manual dpm level case setting power profile mode.
+
+v2:
+After input power profile update successfully need can update the smu profile mode.
+
+Signed-off-by: Prike Liang <Prike.Liang@amd.com>
+Reviewed-by: Evan Quan <evan.quan@amd.com>
+---
+ drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 31 ++++++++++++++++++++++
+ 1 file changed, 31 insertions(+)
+
+diff --git a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
+index 18ebeaba8d30..3785b7fd3d66 100644
+--- a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
++++ b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
+@@ -481,6 +481,36 @@ 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;
++ uint32_t profile_mode = input[size];
++
++ if (profile_mode > PP_SMC_POWER_PROFILE_CUSTOM) {
++ pr_err("Invalid power profile mode %d\n", smu->power_profile_mode);
++ return -EINVAL;
++ }
++
++ /* 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;
++ }
++
++ smu->power_profile_mode = profile_mode;
++
++ 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,
+@@ -495,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.17.1
+