[PATCH 6/7] drm/amd/powerplay: correct power limit retrieving based on current power source

Evan Quan evan.quan at amd.com
Mon Jun 8 10:52:33 UTC 2020


Instead of hard coding it as SMU_POWER_SOURCE_AC.

Change-Id: I57066b2c206f8e1e2276f959ff2704dcbe6e5d77
Signed-off-by: Evan Quan <evan.quan at amd.com>
---
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
index 34e9ae813000..06e3799aa923 100644
--- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
@@ -1065,7 +1065,10 @@ int smu_v11_0_get_current_power_limit(struct smu_context *smu,
 	if (!smu_feature_is_enabled(smu, SMU_FEATURE_PPT_BIT))
 		return -EINVAL;
 
-	power_src = smu_power_get_index(smu, SMU_POWER_SOURCE_AC);
+	power_src = smu_power_get_index(smu,
+					smu->adev->pm.ac_power ?
+					SMU_POWER_SOURCE_AC :
+					SMU_POWER_SOURCE_DC);
 	if (power_src < 0)
 		return -EINVAL;
 
-- 
2.27.0



More information about the amd-gfx mailing list