[PATCH V2 4/7] drm/amd/pm: move SMU13.0.0 related pptable settings to smu_v13_0_0_ppt.c

Evan Quan evan.quan at amd.com
Mon Sep 19 02:02:48 UTC 2022


Separate those ASIC specific settings from common helpers.

Signed-off-by: Evan Quan <evan.quan at amd.com>
Change-Id: Ie3224b8719d48c6e6936b738df379959bd1df4ad
---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c        |  1 -
 .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 16 +++++++++++++---
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index 610f9b68ef73..7adbdd3cc13b 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -1027,7 +1027,6 @@ static void smu_interrupt_work_fn(struct work_struct *work)
 static void smu_pptable_source_init(struct smu_context *smu)
 {
 	switch (smu->adev->ip_versions[MP1_HWIP][0]) {
-	case IP_VERSION(13, 0, 0):
 	case IP_VERSION(13, 0, 7):
 		smu->pptable_source = PPTABLE_SOURCE_PMFW;
 		smu->pptable_id = smu->smu_table.boot_values.pp_table_id;
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
index 1d454485e0d9..fd405e2420cd 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
@@ -377,9 +377,12 @@ static int smu_v13_0_0_setup_pptable(struct smu_context *smu)
 	struct amdgpu_device *adev = smu->adev;
 	int ret = 0;
 
-	ret = smu_v13_0_0_get_pptable_from_pmfw(smu,
-						&smu_table->power_play_table,
-						&smu_table->power_play_table_size);
+	if (smu->pptable_source == PPTABLE_SOURCE_PMFW)
+		ret = smu_v13_0_0_get_pptable_from_pmfw(smu,
+							&smu_table->power_play_table,
+							&smu_table->power_play_table_size);
+	else
+		ret = smu_v13_0_setup_pptable(smu);
 	if (ret)
 		return ret;
 
@@ -1753,6 +1756,12 @@ static int smu_v13_0_0_set_mp1_state(struct smu_context *smu,
 	return ret;
 }
 
+static void smu_v13_0_0_pptable_source_init(struct smu_context *smu)
+{
+	smu->pptable_source = PPTABLE_SOURCE_PMFW;
+	smu->pptable_id = smu->smu_table.boot_values.pp_table_id;
+}
+
 static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {
 	.get_allowed_feature_mask = smu_v13_0_0_get_allowed_feature_mask,
 	.set_default_dpm_table = smu_v13_0_0_set_default_dpm_table,
@@ -1822,6 +1831,7 @@ static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {
 	.mode1_reset_is_support = smu_v13_0_0_is_mode1_reset_supported,
 	.mode1_reset = smu_v13_0_mode1_reset,
 	.set_mp1_state = smu_v13_0_0_set_mp1_state,
+	.pptable_source_init = smu_v13_0_0_pptable_source_init,
 };
 
 void smu_v13_0_0_set_ppt_funcs(struct smu_context *smu)
-- 
2.34.1



More information about the amd-gfx mailing list