Skip to content

Commit bf48232

Browse files
Evan Quanalexdeucher
authored andcommitted
drm/amd/pm: fix possible power mode mismatch between driver and PMFW
PMFW may boots the ASIC with a different power mode from the system's real one. Notify PMFW explicitly the power mode the system in. This is needed only when ACDC switch via gpio is not supported. Signed-off-by: Evan Quan <evan.quan@amd.com> Reviewed-by: Kenneth Feng <kenneth.feng@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org
1 parent c1a322a commit bf48232

File tree

3 files changed

+20
-19
lines changed

3 files changed

+20
-19
lines changed

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,24 @@ static int smu_late_init(void *handle)
733733
return ret;
734734
}
735735

736+
/*
737+
* Explicitly notify PMFW the power mode the system in. Since
738+
* the PMFW may boot the ASIC with a different mode.
739+
* For those supporting ACDC switch via gpio, PMFW will
740+
* handle the switch automatically. Driver involvement
741+
* is unnecessary.
742+
*/
743+
if (!smu->dc_controlled_by_gpio) {
744+
ret = smu_set_power_source(smu,
745+
adev->pm.ac_power ? SMU_POWER_SOURCE_AC :
746+
SMU_POWER_SOURCE_DC);
747+
if (ret) {
748+
dev_err(adev->dev, "Failed to switch to %s mode!\n",
749+
adev->pm.ac_power ? "AC" : "DC");
750+
return ret;
751+
}
752+
}
753+
736754
if ((adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 1)) ||
737755
(adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 3)))
738756
return 0;

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3413,26 +3413,8 @@ static int navi10_post_smu_init(struct smu_context *smu)
34133413
return 0;
34143414

34153415
ret = navi10_run_umc_cdr_workaround(smu);
3416-
if (ret) {
3416+
if (ret)
34173417
dev_err(adev->dev, "Failed to apply umc cdr workaround!\n");
3418-
return ret;
3419-
}
3420-
3421-
if (!smu->dc_controlled_by_gpio) {
3422-
/*
3423-
* For Navi1X, manually switch it to AC mode as PMFW
3424-
* may boot it with DC mode.
3425-
*/
3426-
ret = smu_v11_0_set_power_source(smu,
3427-
adev->pm.ac_power ?
3428-
SMU_POWER_SOURCE_AC :
3429-
SMU_POWER_SOURCE_DC);
3430-
if (ret) {
3431-
dev_err(adev->dev, "Failed to switch to %s mode!\n",
3432-
adev->pm.ac_power ? "AC" : "DC");
3433-
return ret;
3434-
}
3435-
}
34363418

34373419
return ret;
34383420
}

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1770,6 +1770,7 @@ static const struct pptable_funcs smu_v13_0_7_ppt_funcs = {
17701770
.enable_mgpu_fan_boost = smu_v13_0_7_enable_mgpu_fan_boost,
17711771
.get_power_limit = smu_v13_0_7_get_power_limit,
17721772
.set_power_limit = smu_v13_0_set_power_limit,
1773+
.set_power_source = smu_v13_0_set_power_source,
17731774
.get_power_profile_mode = smu_v13_0_7_get_power_profile_mode,
17741775
.set_power_profile_mode = smu_v13_0_7_set_power_profile_mode,
17751776
.set_tool_table_location = smu_v13_0_set_tool_table_location,

0 commit comments

Comments
 (0)