diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2020-03-20 12:45:09 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2020-03-25 17:00:11 -0400 |
commit | 75610fdd38d9d158385049c9f80547a2253c65ea (patch) | |
tree | 3c5444fab1865bf558070d305b17561d7b928192 /drivers/gpu | |
parent | 66c2f5db1fbdc987d23149082720bcbe46f41aa2 (diff) |
drm/amdgpu/swSMU: set AC/DC mode based on the current system state (v2)
Check of the pointer exists and we are actually on AC power.
v2: fix error message to reflect AC/DC mode.
Bug: https://gitlab.freedesktop.org/drm/amd/issues/1043
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c index 2cfb911ab370..9a9eb23d8540 100644 --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c @@ -1155,17 +1155,17 @@ static int smu_smc_table_hw_init(struct smu_context *smu, } } - if (adev->asic_type >= CHIP_NAVI10 && - adev->asic_type <= CHIP_NAVI12) { + if (smu->ppt_funcs->set_power_source) { /* * For Navi1X, manually switch it to AC mode as PMFW * may boot it with DC mode. - * TODO: should check whether we are indeed under AC - * mode before doing this. */ - ret = smu_set_power_source(smu, SMU_POWER_SOURCE_AC); + if (adev->pm.ac_power) + ret = smu_set_power_source(smu, SMU_POWER_SOURCE_AC); + else + ret = smu_set_power_source(smu, SMU_POWER_SOURCE_DC); if (ret) { - pr_err("Failed to switch to AC mode!\n"); + pr_err("Failed to switch to %s mode!\n", adev->pm.ac_power ? "AC" : "DC"); return ret; } } |