[PATCH 4/8] drm/amd/powerplay: add interface for getting workload type

Wang, Kevin(Yang) Kevin1.Wang at amd.com
Thu Sep 26 05:25:39 UTC 2019


this patch, i think the smu driver should be unify the driver code format,
it is very useful for optimize and maintain smu driver code in the furture.

you can reference the navi10_ppt.c and arcuturs_ppt.c
funciton: arcturus_get_workload_type

Best Regards,
Kevin
________________________________
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> on behalf of Liang, Prike <Prike.Liang at amd.com>
Sent: Thursday, September 26, 2019 11:50 AM
To: amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>
Cc: Liang, Prike <Prike.Liang at amd.com>; Quan, Evan <Evan.Quan at amd.com>; Huang, Ray <Ray.Huang at amd.com>; keneth.feng at amd.com <keneth.feng at amd.com>
Subject: [PATCH 4/8] drm/amd/powerplay: add interface for getting workload type

The workload type was got from the input of power profile mode.

Signed-off-by: Prike Liang <Prike.Liang at amd.com>
Reviewed-by: Kevin Wang <kevin1.wang at amd.com>
Reviewed-by: Evan Quan <evan.quan at amd.com>
---
 drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
index 8ec3663..dc945b8 100644
--- a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
@@ -365,6 +365,34 @@ static int renoir_unforce_dpm_levels(struct smu_context *smu) {
         return ret;
 }

+static int renoir_get_workload_type(struct smu_context *smu, uint32_t profile)
+{
+
+       uint32_t  pplib_workload = 0;
+
+       switch (profile) {
+       case PP_SMC_POWER_PROFILE_FULLSCREEN3D:
+               pplib_workload = WORKLOAD_PPLIB_FULL_SCREEN_3D_BIT;
+               break;
+       case PP_SMC_POWER_PROFILE_CUSTOM:
+               pplib_workload = WORKLOAD_PPLIB_COUNT;
+               break;
+       case PP_SMC_POWER_PROFILE_VIDEO:
+               pplib_workload = WORKLOAD_PPLIB_VIDEO_BIT;
+               break;
+       case PP_SMC_POWER_PROFILE_VR:
+               pplib_workload = WORKLOAD_PPLIB_VR_BIT;
+               break;
+       case PP_SMC_POWER_PROFILE_COMPUTE:
+               pplib_workload = WORKLOAD_PPLIB_COMPUTE_BIT;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       return pplib_workload;
+}
+
 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,
@@ -376,6 +404,7 @@ static const struct pptable_funcs renoir_ppt_funcs = {
         .dpm_set_uvd_enable = renoir_dpm_set_uvd_enable,
         .force_dpm_limit_value = renoir_force_dpm_limit_value,
         .unforce_dpm_levels = renoir_unforce_dpm_levels,
+       .get_workload_type = renoir_get_workload_type,
 };

 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/20190926/33bee6dc/attachment.html>


More information about the amd-gfx mailing list