Skip to content

Commit 75610fd

Browse files
committed
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 <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 66c2f5d commit 75610fd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,17 +1155,17 @@ static int smu_smc_table_hw_init(struct smu_context *smu,
11551155
}
11561156
}
11571157

1158-
if (adev->asic_type >= CHIP_NAVI10 &&
1159-
adev->asic_type <= CHIP_NAVI12) {
1158+
if (smu->ppt_funcs->set_power_source) {
11601159
/*
11611160
* For Navi1X, manually switch it to AC mode as PMFW
11621161
* may boot it with DC mode.
1163-
* TODO: should check whether we are indeed under AC
1164-
* mode before doing this.
11651162
*/
1166-
ret = smu_set_power_source(smu, SMU_POWER_SOURCE_AC);
1163+
if (adev->pm.ac_power)
1164+
ret = smu_set_power_source(smu, SMU_POWER_SOURCE_AC);
1165+
else
1166+
ret = smu_set_power_source(smu, SMU_POWER_SOURCE_DC);
11671167
if (ret) {
1168-
pr_err("Failed to switch to AC mode!\n");
1168+
pr_err("Failed to switch to %s mode!\n", adev->pm.ac_power ? "AC" : "DC");
11691169
return ret;
11701170
}
11711171
}

0 commit comments

Comments
 (0)