[PATCH] drm/amd/pm: Check amdgpu_runtime_pm when setting maco_support flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Check amdgpu_runtime_pm when setting maco_support flag so that we
only check maco_support flag when use it later instead of checking
amdgpu_runtime_pm every time.

Signed-off-by: Ma Jun <Jun.Ma2@xxxxxxx>
---
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c    | 15 +++++----------
 .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  |  7 +++++--
 .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  |  7 +++++--
 3 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
index fdcfbe5a0789..891c3fddd7b9 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
@@ -2238,15 +2238,11 @@ static int smu_v13_0_baco_set_state(struct smu_context *smu,
 		return 0;
 
 	if (state == SMU_BACO_STATE_ENTER) {
-		ret = smu_cmn_send_smc_msg_with_param(smu,
-						      SMU_MSG_EnterBaco,
-						      (smu_baco->maco_support && amdgpu_runtime_pm != 1) ?
-						      BACO_SEQ_BAMACO : BACO_SEQ_BACO,
-						      NULL);
+		ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_EnterBaco,
+					smu_baco->maco_support ? BACO_SEQ_BAMACO : BACO_SEQ_BACO,
+					NULL);
 	} else {
-		ret = smu_cmn_send_smc_msg(smu,
-					   SMU_MSG_ExitBaco,
-					   NULL);
+		ret = smu_cmn_send_smc_msg(smu, SMU_MSG_ExitBaco, NULL);
 		if (ret)
 			return ret;
 
@@ -2287,8 +2283,7 @@ int smu_v13_0_baco_enter(struct smu_context *smu)
 
 	if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) {
 		return smu_v13_0_baco_set_armd3_sequence(smu,
-				(smu_baco->maco_support && amdgpu_runtime_pm != 1) ?
-					BACO_SEQ_BAMACO : BACO_SEQ_BACO);
+				smu_baco->maco_support ? BACO_SEQ_BAMACO : BACO_SEQ_BACO);
 	} else {
 		ret = smu_v13_0_baco_set_state(smu, SMU_BACO_STATE_ENTER);
 		if (!ret)
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 cd7dc18bc71c..dff69713cb5f 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
@@ -357,8 +357,11 @@ static int smu_v13_0_0_check_powerplay_table(struct smu_context *smu)
 	if (powerplay_table->platform_caps & SMU_13_0_0_PP_PLATFORM_CAP_BACO) {
 		smu_baco->platform_support = true;
 
-		if (powerplay_table->platform_caps & SMU_13_0_0_PP_PLATFORM_CAP_MACO)
-			smu_baco->maco_support = true;
+		/* allow user to force baco */
+		if (amdgpu_runtime_pm != 1) {
+			if (powerplay_table->platform_caps & SMU_13_0_0_PP_PLATFORM_CAP_MACO)
+				smu_baco->maco_support = true;
+		}
 	}
 
 	if (!overdrive_lowerlimits->FeatureCtrlMask ||
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
index 2909ec06b1cb..0a403091b5f4 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
@@ -349,9 +349,12 @@ static int smu_v13_0_7_check_powerplay_table(struct smu_context *smu)
 	if (powerplay_table->platform_caps & SMU_13_0_7_PP_PLATFORM_CAP_BACO) {
 		smu_baco->platform_support = true;
 
-		if ((powerplay_table->platform_caps & SMU_13_0_7_PP_PLATFORM_CAP_MACO)
+		/* allow user to force baco */
+		if (amdgpu_runtime_pm != 1) {
+			if ((powerplay_table->platform_caps & SMU_13_0_7_PP_PLATFORM_CAP_MACO)
 					&& (BoardTable->HsrEnabled || BoardTable->VddqOffEnabled))
-			smu_baco->maco_support = true;
+				smu_baco->maco_support = true;
+		}
 	}
 
 	if (!overdrive_lowerlimits->FeatureCtrlMask ||
-- 
2.34.1




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux