[PATCH] drm/amd/pm: Fix DPM level count on aldebaran

Xu, Feifei Feifei.Xu at amd.com
Fri Mar 26 06:51:20 UTC 2021



Reviewed-by: Feifei Xu <Feifei.Xu at amd.com>

From: Lazar, Lijo <Lijo.Lazar at amd.com>
Sent: Friday, March 26, 2021 2:04 PM
To: amd-gfx at lists.freedesktop.org
Cc: Zhang, Hawking <Hawking.Zhang at amd.com>; Xu, Feifei <Feifei.Xu at amd.com>; Feng, Kenneth <Kenneth.Feng at amd.com>; Wang, Kevin(Yang) <Kevin1.Wang at amd.com>
Subject: [PATCH] drm/amd/pm: Fix DPM level count on aldebaran


[AMD Public Use]

Firmware returns zero-based max level, increment by one to get
total levels. This fixes the issue of not showing all levels and current
frequency when frequency is at max DPM level.

Signed-off-by: Lijo Lazar lijo.lazar at amd.com<mailto:lijo.lazar at amd.com>
---
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
index 1f860969ea1c..30c9ac635105 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
@@ -1710,10 +1710,14 @@ int smu_v13_0_get_dpm_level_count(struct smu_context *smu,
                                                                 enum smu_clk_type clk_type,
                                                                 uint32_t *value)
{
-              return smu_v13_0_get_dpm_freq_by_index(smu,
-                                                                                     clk_type,
-                                                                                     0xff,
-                                                                                     value);
+             int ret;
+
+             ret = smu_v13_0_get_dpm_freq_by_index(smu, clk_type, 0xff, value);
+             /* FW returns 0 based max level, increment by one */
+             if (!ret && value)
+                             ++(*value);
+
+             return ret;
}

 int smu_v13_0_set_single_dpm_table(struct smu_context *smu,
--
2.17.1

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20210326/ed535e3e/attachment.htm>


More information about the amd-gfx mailing list