summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorEvan Quan <evan.quan@amd.com>2020-06-08 17:33:03 +0800
committerAlex Deucher <alexander.deucher@amd.com>2020-07-01 01:59:18 -0400
commite10d1ecf9db13bc1e520596a5b3aee684ddd86a9 (patch)
tree51207bfa3b66cb0d7ca18a2b42ecdfc6589a86a1 /drivers/gpu
parent4cb738ab7853c66ca563246cc8b74ac7e88e02d2 (diff)
drm/amd/powerplay: correct power limit retrieving based on current power source
Instead of hard coding it as SMU_POWER_SOURCE_AC. Signed-off-by: Evan Quan <evan.quan@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/amd/powerplay/smu_v11_0.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
index a15460bdea39..e60b7cb95f37 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;