All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/pm: Move some functions to smu_v13_0.c as generic code
@ 2023-11-03  8:21 Ma Jun
  2023-11-03 13:31 ` Wang, Yang(Kevin)
  0 siblings, 1 reply; 3+ messages in thread
From: Ma Jun @ 2023-11-03  8:21 UTC (permalink / raw)
  To: amd-gfx, Kenneth.Feng, Alexander.Deucher, kevinyang.wang; +Cc: Ma Jun

Use generic functions and remove the duplicate code

Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
---
 .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c    | 38 ++++++++++++++-----
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  | 36 +-----------------
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  | 36 +-----------------
 3 files changed, 32 insertions(+), 78 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 281c3cb707a5..1f42befcc213 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
@@ -2282,22 +2282,40 @@ int smu_v13_0_baco_set_state(struct smu_context *smu,
 
 int smu_v13_0_baco_enter(struct smu_context *smu)
 {
-	int ret = 0;
-
-	ret = smu_v13_0_baco_set_state(smu,
-				       SMU_BACO_STATE_ENTER);
-	if (ret)
-		return ret;
+	struct smu_baco_context *smu_baco = &smu->smu_baco;
+	struct amdgpu_device *adev = smu->adev;
+	int ret;
 
-	msleep(10);
+	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);
+	else {
+		ret = smu_v13_0_baco_set_state(smu, SMU_BACO_STATE_ENTER);
+		if (!ret)
+			msleep(10);
 
-	return ret;
+		return ret;
+	}
 }
 
 int smu_v13_0_baco_exit(struct smu_context *smu)
 {
-	return smu_v13_0_baco_set_state(smu,
-					SMU_BACO_STATE_EXIT);
+	struct amdgpu_device *adev = smu->adev;
+	int ret;
+
+	if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) {
+		/* Wait for PMFW handling for the Dstate change */
+		usleep_range(10000, 11000);
+		ret = smu_v13_0_baco_set_armd3_sequence(smu, BACO_SEQ_ULPS);
+	} else {
+		ret = smu_v13_0_baco_set_state(smu, SMU_BACO_STATE_EXIT);
+	}
+
+	if (!ret)
+		adev->gfx.is_poweron = false;
+
+	return ret;
 }
 
 int smu_v13_0_set_gfx_power_up_by_imu(struct smu_context *smu)
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 4d3076fe37a1..d715ca2ec121 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
@@ -2586,38 +2586,6 @@ static int smu_v13_0_0_set_power_profile_mode(struct smu_context *smu,
 					       NULL);
 }
 
-static int smu_v13_0_0_baco_enter(struct smu_context *smu)
-{
-	struct smu_baco_context *smu_baco = &smu->smu_baco;
-	struct amdgpu_device *adev = smu->adev;
-
-	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);
-	else
-		return smu_v13_0_baco_enter(smu);
-}
-
-static int smu_v13_0_0_baco_exit(struct smu_context *smu)
-{
-	struct amdgpu_device *adev = smu->adev;
-	int ret;
-
-	if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) {
-		/* Wait for PMFW handling for the Dstate change */
-		usleep_range(10000, 11000);
-		ret = smu_v13_0_baco_set_armd3_sequence(smu, BACO_SEQ_ULPS);
-	} else {
-		ret = smu_v13_0_baco_exit(smu);
-	}
-
-	if (!ret)
-		adev->gfx.is_poweron = false;
-
-	return ret;
-}
-
 static bool smu_v13_0_0_is_mode1_reset_supported(struct smu_context *smu)
 {
 	struct amdgpu_device *adev = smu->adev;
@@ -3064,8 +3032,8 @@ static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {
 	.baco_is_support = smu_v13_0_baco_is_support,
 	.baco_get_state = smu_v13_0_baco_get_state,
 	.baco_set_state = smu_v13_0_baco_set_state,
-	.baco_enter = smu_v13_0_0_baco_enter,
-	.baco_exit = smu_v13_0_0_baco_exit,
+	.baco_enter = smu_v13_0_baco_enter,
+	.baco_exit = smu_v13_0_baco_exit,
 	.mode1_reset_is_support = smu_v13_0_0_is_mode1_reset_supported,
 	.mode1_reset = smu_v13_0_0_mode1_reset,
 	.mode2_reset = smu_v13_0_0_mode2_reset,
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 81eafed76045..f5596f031d00 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
@@ -2515,38 +2515,6 @@ static int smu_v13_0_7_set_mp1_state(struct smu_context *smu,
 	return ret;
 }
 
-static int smu_v13_0_7_baco_enter(struct smu_context *smu)
-{
-	struct smu_baco_context *smu_baco = &smu->smu_baco;
-	struct amdgpu_device *adev = smu->adev;
-
-	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);
-	else
-		return smu_v13_0_baco_enter(smu);
-}
-
-static int smu_v13_0_7_baco_exit(struct smu_context *smu)
-{
-	struct amdgpu_device *adev = smu->adev;
-	int ret;
-
-	if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) {
-		/* Wait for PMFW handling for the Dstate change */
-		usleep_range(10000, 11000);
-		ret = smu_v13_0_baco_set_armd3_sequence(smu, BACO_SEQ_ULPS);
-	} else {
-		ret = smu_v13_0_baco_exit(smu);
-	}
-
-	if (!ret)
-		adev->gfx.is_poweron = false;
-
-	return ret;
-}
-
 static bool smu_v13_0_7_is_mode1_reset_supported(struct smu_context *smu)
 {
 	struct amdgpu_device *adev = smu->adev;
@@ -2628,8 +2596,8 @@ static const struct pptable_funcs smu_v13_0_7_ppt_funcs = {
 	.baco_is_support = smu_v13_0_baco_is_support,
 	.baco_get_state = smu_v13_0_baco_get_state,
 	.baco_set_state = smu_v13_0_baco_set_state,
-	.baco_enter = smu_v13_0_7_baco_enter,
-	.baco_exit = smu_v13_0_7_baco_exit,
+	.baco_enter = smu_v13_0_baco_enter,
+	.baco_exit = smu_v13_0_baco_exit,
 	.mode1_reset_is_support = smu_v13_0_7_is_mode1_reset_supported,
 	.mode1_reset = smu_v13_0_mode1_reset,
 	.set_mp1_state = smu_v13_0_7_set_mp1_state,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] drm/amd/pm: Move some functions to smu_v13_0.c as generic code
  2023-11-03  8:21 [PATCH] drm/amd/pm: Move some functions to smu_v13_0.c as generic code Ma Jun
@ 2023-11-03 13:31 ` Wang, Yang(Kevin)
  2023-11-06  0:51   ` Ma, Jun
  0 siblings, 1 reply; 3+ messages in thread
From: Wang, Yang(Kevin) @ 2023-11-03 13:31 UTC (permalink / raw)
  To: Ma, Jun; +Cc: amd-gfx


-----Original Message-----
From: Ma, Jun <Jun.Ma2@amd.com> 
Sent: Friday, November 3, 2023 4:21 PM
To: amd-gfx@lists.freedesktop.org; Feng, Kenneth <Kenneth.Feng@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Wang, Yang(Kevin) <KevinYang.Wang@amd.com>
Cc: Ma, Jun <Jun.Ma2@amd.com>
Subject: [PATCH] drm/amd/pm: Move some functions to smu_v13_0.c as generic code

Use generic functions and remove the duplicate code

Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
---
 .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c    | 38 ++++++++++++++-----
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  | 36 +-----------------  .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  | 36 +-----------------
 3 files changed, 32 insertions(+), 78 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 281c3cb707a5..1f42befcc213 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
@@ -2282,22 +2282,40 @@ int smu_v13_0_baco_set_state(struct smu_context *smu,
 
 int smu_v13_0_baco_enter(struct smu_context *smu)  {
-	int ret = 0;
-
-	ret = smu_v13_0_baco_set_state(smu,
-				       SMU_BACO_STATE_ENTER);
-	if (ret)
-		return ret;
+	struct smu_baco_context *smu_baco = &smu->smu_baco;
+	struct amdgpu_device *adev = smu->adev;
+	int ret;
 
-	msleep(10);
+	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);
[kevin]:

Miss {} here?

Best Regards,
Kevin
+	else {
+		ret = smu_v13_0_baco_set_state(smu, SMU_BACO_STATE_ENTER);
+		if (!ret)
+			msleep(10);
[kevin]:
Please use usleep_range() function instead of msleep() to keep the same coding style.

-	return ret;
+		return ret;
+	}
 }
 
 int smu_v13_0_baco_exit(struct smu_context *smu)  {
-	return smu_v13_0_baco_set_state(smu,
-					SMU_BACO_STATE_EXIT);
+	struct amdgpu_device *adev = smu->adev;
+	int ret;
+
+	if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) {
+		/* Wait for PMFW handling for the Dstate change */
+		usleep_range(10000, 11000);
+		ret = smu_v13_0_baco_set_armd3_sequence(smu, BACO_SEQ_ULPS);
+	} else {
+		ret = smu_v13_0_baco_set_state(smu, SMU_BACO_STATE_EXIT);
+	}
+
+	if (!ret)
+		adev->gfx.is_poweron = false;
+
+	return ret;
 }
 
 int smu_v13_0_set_gfx_power_up_by_imu(struct smu_context *smu) 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 4d3076fe37a1..d715ca2ec121 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
@@ -2586,38 +2586,6 @@ static int smu_v13_0_0_set_power_profile_mode(struct smu_context *smu,
 					       NULL);
 }
 
-static int smu_v13_0_0_baco_enter(struct smu_context *smu) -{
-	struct smu_baco_context *smu_baco = &smu->smu_baco;
-	struct amdgpu_device *adev = smu->adev;
-
-	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);
-	else
-		return smu_v13_0_baco_enter(smu);
-}
-
-static int smu_v13_0_0_baco_exit(struct smu_context *smu) -{
-	struct amdgpu_device *adev = smu->adev;
-	int ret;
-
-	if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) {
-		/* Wait for PMFW handling for the Dstate change */
-		usleep_range(10000, 11000);
-		ret = smu_v13_0_baco_set_armd3_sequence(smu, BACO_SEQ_ULPS);
-	} else {
-		ret = smu_v13_0_baco_exit(smu);
-	}
-
-	if (!ret)
-		adev->gfx.is_poweron = false;
-
-	return ret;
-}
-
 static bool smu_v13_0_0_is_mode1_reset_supported(struct smu_context *smu)  {
 	struct amdgpu_device *adev = smu->adev; @@ -3064,8 +3032,8 @@ static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {
 	.baco_is_support = smu_v13_0_baco_is_support,
 	.baco_get_state = smu_v13_0_baco_get_state,
 	.baco_set_state = smu_v13_0_baco_set_state,
-	.baco_enter = smu_v13_0_0_baco_enter,
-	.baco_exit = smu_v13_0_0_baco_exit,
+	.baco_enter = smu_v13_0_baco_enter,
+	.baco_exit = smu_v13_0_baco_exit,
 	.mode1_reset_is_support = smu_v13_0_0_is_mode1_reset_supported,
 	.mode1_reset = smu_v13_0_0_mode1_reset,
 	.mode2_reset = smu_v13_0_0_mode2_reset, 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 81eafed76045..f5596f031d00 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
@@ -2515,38 +2515,6 @@ static int smu_v13_0_7_set_mp1_state(struct smu_context *smu,
 	return ret;
 }
 
-static int smu_v13_0_7_baco_enter(struct smu_context *smu) -{
-	struct smu_baco_context *smu_baco = &smu->smu_baco;
-	struct amdgpu_device *adev = smu->adev;
-
-	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);
-	else
-		return smu_v13_0_baco_enter(smu);
-}
-
-static int smu_v13_0_7_baco_exit(struct smu_context *smu) -{
-	struct amdgpu_device *adev = smu->adev;
-	int ret;
-
-	if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) {
-		/* Wait for PMFW handling for the Dstate change */
-		usleep_range(10000, 11000);
-		ret = smu_v13_0_baco_set_armd3_sequence(smu, BACO_SEQ_ULPS);
-	} else {
-		ret = smu_v13_0_baco_exit(smu);
-	}
-
-	if (!ret)
-		adev->gfx.is_poweron = false;
-
-	return ret;
-}
-
 static bool smu_v13_0_7_is_mode1_reset_supported(struct smu_context *smu)  {
 	struct amdgpu_device *adev = smu->adev; @@ -2628,8 +2596,8 @@ static const struct pptable_funcs smu_v13_0_7_ppt_funcs = {
 	.baco_is_support = smu_v13_0_baco_is_support,
 	.baco_get_state = smu_v13_0_baco_get_state,
 	.baco_set_state = smu_v13_0_baco_set_state,
-	.baco_enter = smu_v13_0_7_baco_enter,
-	.baco_exit = smu_v13_0_7_baco_exit,
+	.baco_enter = smu_v13_0_baco_enter,
+	.baco_exit = smu_v13_0_baco_exit,
 	.mode1_reset_is_support = smu_v13_0_7_is_mode1_reset_supported,
 	.mode1_reset = smu_v13_0_mode1_reset,
 	.set_mp1_state = smu_v13_0_7_set_mp1_state,
--
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amd/pm: Move some functions to smu_v13_0.c as generic code
  2023-11-03 13:31 ` Wang, Yang(Kevin)
@ 2023-11-06  0:51   ` Ma, Jun
  0 siblings, 0 replies; 3+ messages in thread
From: Ma, Jun @ 2023-11-06  0:51 UTC (permalink / raw)
  To: Wang, Yang(Kevin), Ma, Jun; +Cc: amd-gfx

Thanks, will fix it in the next version.

Regards,
Ma Jun

On 11/3/2023 9:31 PM, Wang, Yang(Kevin) wrote:
> 
> -----Original Message-----
> From: Ma, Jun <Jun.Ma2@amd.com> 
> Sent: Friday, November 3, 2023 4:21 PM
> To: amd-gfx@lists.freedesktop.org; Feng, Kenneth <Kenneth.Feng@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Wang, Yang(Kevin) <KevinYang.Wang@amd.com>
> Cc: Ma, Jun <Jun.Ma2@amd.com>
> Subject: [PATCH] drm/amd/pm: Move some functions to smu_v13_0.c as generic code
> 
> Use generic functions and remove the duplicate code
> 
> Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
> ---
>  .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c    | 38 ++++++++++++++-----
>  .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  | 36 +-----------------  .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  | 36 +-----------------
>  3 files changed, 32 insertions(+), 78 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 281c3cb707a5..1f42befcc213 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
> @@ -2282,22 +2282,40 @@ int smu_v13_0_baco_set_state(struct smu_context *smu,
>  
>  int smu_v13_0_baco_enter(struct smu_context *smu)  {
> -	int ret = 0;
> -
> -	ret = smu_v13_0_baco_set_state(smu,
> -				       SMU_BACO_STATE_ENTER);
> -	if (ret)
> -		return ret;
> +	struct smu_baco_context *smu_baco = &smu->smu_baco;
> +	struct amdgpu_device *adev = smu->adev;
> +	int ret;
>  
> -	msleep(10);
> +	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);
> [kevin]:
> 
> Miss {} here?
> 
> Best Regards,
> Kevin
> +	else {
> +		ret = smu_v13_0_baco_set_state(smu, SMU_BACO_STATE_ENTER);
> +		if (!ret)
> +			msleep(10);
> [kevin]:
> Please use usleep_range() function instead of msleep() to keep the same coding style.
> 
> -	return ret;
> +		return ret;
> +	}
>  }
>  
>  int smu_v13_0_baco_exit(struct smu_context *smu)  {
> -	return smu_v13_0_baco_set_state(smu,
> -					SMU_BACO_STATE_EXIT);
> +	struct amdgpu_device *adev = smu->adev;
> +	int ret;
> +
> +	if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) {
> +		/* Wait for PMFW handling for the Dstate change */
> +		usleep_range(10000, 11000);
> +		ret = smu_v13_0_baco_set_armd3_sequence(smu, BACO_SEQ_ULPS);
> +	} else {
> +		ret = smu_v13_0_baco_set_state(smu, SMU_BACO_STATE_EXIT);
> +	}
> +
> +	if (!ret)
> +		adev->gfx.is_poweron = false;
> +
> +	return ret;
>  }
>  
>  int smu_v13_0_set_gfx_power_up_by_imu(struct smu_context *smu) 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 4d3076fe37a1..d715ca2ec121 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
> @@ -2586,38 +2586,6 @@ static int smu_v13_0_0_set_power_profile_mode(struct smu_context *smu,
>  					       NULL);
>  }
>  
> -static int smu_v13_0_0_baco_enter(struct smu_context *smu) -{
> -	struct smu_baco_context *smu_baco = &smu->smu_baco;
> -	struct amdgpu_device *adev = smu->adev;
> -
> -	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);
> -	else
> -		return smu_v13_0_baco_enter(smu);
> -}
> -
> -static int smu_v13_0_0_baco_exit(struct smu_context *smu) -{
> -	struct amdgpu_device *adev = smu->adev;
> -	int ret;
> -
> -	if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) {
> -		/* Wait for PMFW handling for the Dstate change */
> -		usleep_range(10000, 11000);
> -		ret = smu_v13_0_baco_set_armd3_sequence(smu, BACO_SEQ_ULPS);
> -	} else {
> -		ret = smu_v13_0_baco_exit(smu);
> -	}
> -
> -	if (!ret)
> -		adev->gfx.is_poweron = false;
> -
> -	return ret;
> -}
> -
>  static bool smu_v13_0_0_is_mode1_reset_supported(struct smu_context *smu)  {
>  	struct amdgpu_device *adev = smu->adev; @@ -3064,8 +3032,8 @@ static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {
>  	.baco_is_support = smu_v13_0_baco_is_support,
>  	.baco_get_state = smu_v13_0_baco_get_state,
>  	.baco_set_state = smu_v13_0_baco_set_state,
> -	.baco_enter = smu_v13_0_0_baco_enter,
> -	.baco_exit = smu_v13_0_0_baco_exit,
> +	.baco_enter = smu_v13_0_baco_enter,
> +	.baco_exit = smu_v13_0_baco_exit,
>  	.mode1_reset_is_support = smu_v13_0_0_is_mode1_reset_supported,
>  	.mode1_reset = smu_v13_0_0_mode1_reset,
>  	.mode2_reset = smu_v13_0_0_mode2_reset, 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 81eafed76045..f5596f031d00 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
> @@ -2515,38 +2515,6 @@ static int smu_v13_0_7_set_mp1_state(struct smu_context *smu,
>  	return ret;
>  }
>  
> -static int smu_v13_0_7_baco_enter(struct smu_context *smu) -{
> -	struct smu_baco_context *smu_baco = &smu->smu_baco;
> -	struct amdgpu_device *adev = smu->adev;
> -
> -	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);
> -	else
> -		return smu_v13_0_baco_enter(smu);
> -}
> -
> -static int smu_v13_0_7_baco_exit(struct smu_context *smu) -{
> -	struct amdgpu_device *adev = smu->adev;
> -	int ret;
> -
> -	if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) {
> -		/* Wait for PMFW handling for the Dstate change */
> -		usleep_range(10000, 11000);
> -		ret = smu_v13_0_baco_set_armd3_sequence(smu, BACO_SEQ_ULPS);
> -	} else {
> -		ret = smu_v13_0_baco_exit(smu);
> -	}
> -
> -	if (!ret)
> -		adev->gfx.is_poweron = false;
> -
> -	return ret;
> -}
> -
>  static bool smu_v13_0_7_is_mode1_reset_supported(struct smu_context *smu)  {
>  	struct amdgpu_device *adev = smu->adev; @@ -2628,8 +2596,8 @@ static const struct pptable_funcs smu_v13_0_7_ppt_funcs = {
>  	.baco_is_support = smu_v13_0_baco_is_support,
>  	.baco_get_state = smu_v13_0_baco_get_state,
>  	.baco_set_state = smu_v13_0_baco_set_state,
> -	.baco_enter = smu_v13_0_7_baco_enter,
> -	.baco_exit = smu_v13_0_7_baco_exit,
> +	.baco_enter = smu_v13_0_baco_enter,
> +	.baco_exit = smu_v13_0_baco_exit,
>  	.mode1_reset_is_support = smu_v13_0_7_is_mode1_reset_supported,
>  	.mode1_reset = smu_v13_0_mode1_reset,
>  	.set_mp1_state = smu_v13_0_7_set_mp1_state,
> --
> 2.34.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-06  0:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-03  8:21 [PATCH] drm/amd/pm: Move some functions to smu_v13_0.c as generic code Ma Jun
2023-11-03 13:31 ` Wang, Yang(Kevin)
2023-11-06  0:51   ` Ma, Jun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.