Skip to contentSkip to conversation

drm/amd/pm: apply no power source workaround if dc reported by gpio

PATCH In review Evan Quan 1 participant 2 messages Sep 4, 2020

Subsystems (3)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

PATCH 2/3 drm/amd/pm: apply no power source workaround if dc reported by gpio

If dc reported by gpio is supported, the power source switching will be performed by pmfw automatically. Thus the power source setting workaround for Navi1x will be not needed.

Change-Id Idd6231ce1e33a4e292e7eff3b0f8b779911944f1
---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +12 -10
index 489a84792002..35258f980de5 100644
@@ -1013,16 +1013,18 @@ static int smu_smc_hw_setup(struct smu_context *smu)
 		return ret;
 	}
 
-	/*
-	 * For Navi1X, manually switch it to AC mode as PMFW
-	 * may boot it with DC mode.
-	 */
-	ret = smu_set_power_source(smu,
-				   adev->pm.ac_power ? SMU_POWER_SOURCE_AC :
-				   SMU_POWER_SOURCE_DC);
-	if (ret) {
-		dev_err(adev->dev, "Failed to switch to %s mode!\n", adev->pm.ac_power ? "AC" : "DC");
-		return ret;
+	if (!smu->dc_controlled_by_gpio) {
+		/*
+		 * For Navi1X, manually switch it to AC mode as PMFW
+		 * may boot it with DC mode.
+		 */
+		ret = smu_set_power_source(smu,
+					   adev->pm.ac_power ? SMU_POWER_SOURCE_AC :
+					   SMU_POWER_SOURCE_DC);
+		if (ret) {
+			dev_err(adev->dev, "Failed to switch to %s mode!\n", adev->pm.ac_power ? "AC" : "DC");
+			return ret;
+		}
 	}
 
 	ret = smu_notify_display_change(smu);
Signature · 6 lines
2.28.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#1 lore raw

PATCH 3/3 drm/amd/pm: move NAVI1X power mode switching workaround to post_init

Since that should be the correct place to put ASIC specific workarounds.

Change-Id Ia7cf4bfabf85a4409e57542926238c7e196af719
---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     | 14 -------------
 .../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c   | 20 ++++++++++++++++++-
 2 files changed, 19 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -14
index 35258f980de5..5fa80f8e6b44 100644
@@ -1013,20 +1013,6 @@ static int smu_smc_hw_setup(struct smu_context *smu)
 		return ret;
 	}
 
-	if (!smu->dc_controlled_by_gpio) {
-		/*
-		 * For Navi1X, manually switch it to AC mode as PMFW
-		 * may boot it with DC mode.
-		 */
-		ret = smu_set_power_source(smu,
-					   adev->pm.ac_power ? SMU_POWER_SOURCE_AC :
-					   SMU_POWER_SOURCE_DC);
-		if (ret) {
-			dev_err(adev->dev, "Failed to switch to %s mode!\n", adev->pm.ac_power ? "AC" : "DC");
-			return ret;
-		}
-	}
-
 	ret = smu_notify_display_change(smu);
 	if (ret)
 		return ret;
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +19 -1
index e82e20f85ef0..42645e2f5419 100644
@@ -2701,8 +2701,26 @@ static int navi10_post_smu_init(struct smu_context *smu)
 	}
 
 	ret = navi10_run_umc_cdr_workaround(smu);
-	if (ret)
+	if (ret) {
 		dev_err(adev->dev, "Failed to apply umc cdr workaround!\n");
+		return ret;
+	}
+
+	if (!smu->dc_controlled_by_gpio) {
+		/*
+		 * For Navi1X, manually switch it to AC mode as PMFW
+		 * may boot it with DC mode.
+		 */
+		ret = smu_v11_0_set_power_source(smu,
+						 adev->pm.ac_power ?
+						 SMU_POWER_SOURCE_AC :
+						 SMU_POWER_SOURCE_DC);
+		if (ret) {
+			dev_err(adev->dev, "Failed to switch to %s mode!\n",
+					adev->pm.ac_power ? "AC" : "DC");
+			return ret;
+		}
+	}
 
 	return ret;
 }
Signature · 6 lines
2.28.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx