AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/amd/pm: restore fan_mode AMD_FAN_CTRL_NONE on resume (v2)
@ 2021-08-10 19:15 Ryan Taylor
  2021-08-10 19:15 ` [PATCH 2/2] drm/amd/pm: graceful exit on restore fan mode failure (v2) Ryan Taylor
  0 siblings, 1 reply; 3+ messages in thread
From: Ryan Taylor @ 2021-08-10 19:15 UTC (permalink / raw)
  To: amd-gfx; +Cc: Ryan Taylor, Lijo Lazar

Adds missing edge case to smu_restore_dpm_user_profile.

v2: Don't restore fan mode auto (Lijo)

Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Ryan Taylor <Ryan.Taylor@amd.com>
---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index 71afc2d20b12..b4b4d615bcbc 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -403,7 +403,8 @@ static void smu_restore_dpm_user_profile(struct smu_context *smu)
 	}
 
 	/* set the user dpm fan configurations */
-	if (smu->user_dpm_profile.fan_mode == AMD_FAN_CTRL_MANUAL) {
+	if (smu->user_dpm_profile.fan_mode == AMD_FAN_CTRL_MANUAL ||
+	    smu->user_dpm_profile.fan_mode == AMD_FAN_CTRL_NONE) {
 		ret = smu_set_fan_control_mode(smu, smu->user_dpm_profile.fan_mode);
 		if (ret) {
 			dev_err(smu->adev->dev, "Failed to set manual fan control mode\n");
@@ -620,6 +621,7 @@ static int smu_early_init(void *handle)
 	mutex_init(&smu->smu_baco.mutex);
 	smu->smu_baco.state = SMU_BACO_STATE_EXIT;
 	smu->smu_baco.platform_support = false;
+	smu->user_dpm_profile.fan_mode = -1;
 
 	adev->powerplay.pp_handle = smu;
 	adev->powerplay.pp_funcs = &swsmu_pm_funcs;
-- 
2.32.0


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

* [PATCH 2/2] drm/amd/pm: graceful exit on restore fan mode failure (v2)
  2021-08-10 19:15 [PATCH 1/2] drm/amd/pm: restore fan_mode AMD_FAN_CTRL_NONE on resume (v2) Ryan Taylor
@ 2021-08-10 19:15 ` Ryan Taylor
  2021-08-10 19:20   ` Alex Deucher
  0 siblings, 1 reply; 3+ messages in thread
From: Ryan Taylor @ 2021-08-10 19:15 UTC (permalink / raw)
  To: amd-gfx; +Cc: Ryan Taylor, Lijo Lazar

Attempt od settings restore and disable restore flag on restore fan mode
failure.

v2: Update fan mode to auto and fan speed to zero (Lijo)

Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Ryan Taylor <Ryan.Taylor@amd.com>
---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index b4b4d615bcbc..00d594e6dd85 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -407,11 +407,12 @@ static void smu_restore_dpm_user_profile(struct smu_context *smu)
 	    smu->user_dpm_profile.fan_mode == AMD_FAN_CTRL_NONE) {
 		ret = smu_set_fan_control_mode(smu, smu->user_dpm_profile.fan_mode);
 		if (ret) {
+			smu->user_dpm_profile.fan_speed_percent = 0;
+			smu->user_dpm_profile.fan_mode = AMD_FAN_CTRL_AUTO;
 			dev_err(smu->adev->dev, "Failed to set manual fan control mode\n");
-			return;
 		}
 
-		if (!ret && smu->user_dpm_profile.fan_speed_percent) {
+		if (smu->user_dpm_profile.fan_speed_percent) {
 			ret = smu_set_fan_speed_percent(smu, smu->user_dpm_profile.fan_speed_percent);
 			if (ret)
 				dev_err(smu->adev->dev, "Failed to set manual fan speed\n");
-- 
2.32.0


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

* Re: [PATCH 2/2] drm/amd/pm: graceful exit on restore fan mode failure (v2)
  2021-08-10 19:15 ` [PATCH 2/2] drm/amd/pm: graceful exit on restore fan mode failure (v2) Ryan Taylor
@ 2021-08-10 19:20   ` Alex Deucher
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2021-08-10 19:20 UTC (permalink / raw)
  To: Ryan Taylor; +Cc: amd-gfx list, Lijo Lazar

Series is:
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

On Tue, Aug 10, 2021 at 3:15 PM Ryan Taylor <Ryan.Taylor@amd.com> wrote:
>
> Attempt od settings restore and disable restore flag on restore fan mode
> failure.
>
> v2: Update fan mode to auto and fan speed to zero (Lijo)
>
> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
> Signed-off-by: Ryan Taylor <Ryan.Taylor@amd.com>
> ---
>  drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> index b4b4d615bcbc..00d594e6dd85 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> @@ -407,11 +407,12 @@ static void smu_restore_dpm_user_profile(struct smu_context *smu)
>             smu->user_dpm_profile.fan_mode == AMD_FAN_CTRL_NONE) {
>                 ret = smu_set_fan_control_mode(smu, smu->user_dpm_profile.fan_mode);
>                 if (ret) {
> +                       smu->user_dpm_profile.fan_speed_percent = 0;
> +                       smu->user_dpm_profile.fan_mode = AMD_FAN_CTRL_AUTO;
>                         dev_err(smu->adev->dev, "Failed to set manual fan control mode\n");
> -                       return;
>                 }
>
> -               if (!ret && smu->user_dpm_profile.fan_speed_percent) {
> +               if (smu->user_dpm_profile.fan_speed_percent) {
>                         ret = smu_set_fan_speed_percent(smu, smu->user_dpm_profile.fan_speed_percent);
>                         if (ret)
>                                 dev_err(smu->adev->dev, "Failed to set manual fan speed\n");
> --
> 2.32.0
>

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

end of thread, other threads:[~2021-08-10 19:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-10 19:15 [PATCH 1/2] drm/amd/pm: restore fan_mode AMD_FAN_CTRL_NONE on resume (v2) Ryan Taylor
2021-08-10 19:15 ` [PATCH 2/2] drm/amd/pm: graceful exit on restore fan mode failure (v2) Ryan Taylor
2021-08-10 19:20   ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox