[PATCH 5/5] drm/amd/powerplay: implement interface set_power_profile_mode()
Wang, Kevin(Yang)
Kevin1.Wang at amd.com
Mon Sep 23 09:34:36 UTC 2019
comment inline.
________________________________
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> on behalf of Liang, Prike <Prike.Liang at amd.com>
Sent: Monday, September 23, 2019 4:43 PM
To: amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>
Cc: arron.liu at amd.com <arron.liu at amd.com>; Huang, Ray <Ray.Huang at amd.com>; Liang, Prike <Prike.Liang at amd.com>; Quan, Evan <Evan.Quan at amd.com>; Feng, Kenneth <Kenneth.Feng at amd.com>
Subject: [PATCH 5/5] 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 | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
index c6aae1c..6819514 100644
--- a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
@@ -473,6 +473,30 @@ 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;
+
+ smu->power_profile_mode = input[size];
+
+ if (smu->power_profile_mode > PP_SMC_POWER_PROFILE_CUSTOM) {
+ pr_err("Invalid power profile mode %d\n", smu->power_profile_mode);
+ return -EINVAL;
+ }
+
+ if (smu->power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
+ if (size < 0)
+ return -EINVAL;
+
+ /* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */
+ workload_type = smu_workload_get_type(smu, smu->power_profile_mode);
[kevin]:
you'd better check the return value, when this workload is unmapped, it will return -EINVAL.
+ smu_send_smc_msg_with_param(smu, SMU_MSG_SetWorkloadMask,
+ 1 << workload_type);
[kevin]:
please check return value in smu driver every time.
after fixed:
Reviewed-by: Kevin Wang <kevin1.wang at amd.com>
+ }
+ 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,
@@ -487,6 +511,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
_______________________________________________
amd-gfx mailing list
amd-gfx at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20190923/9fc18f2a/attachment.html>
More information about the amd-gfx
mailing list