All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/amdgpu: Check pmops for desired suspend state
@ 2021-07-23 12:48 Pratik Vishwakarma
  2021-07-23 13:07 ` Lazar, Lijo
  0 siblings, 1 reply; 3+ messages in thread
From: Pratik Vishwakarma @ 2021-07-23 12:48 UTC (permalink / raw
  To: Alexander.Deucher, Lijo.Lazar, amd-gfx

[Why]
User might change the suspend behaviour from OS.

[How]
Check with pm for target suspend state and set s0ix
flag only for s2idle state.

v2: User might change default suspend state, use target state
Suggested-by: Lijo Lazar <Lijo.Lazar@amd.com>
Signed-off-by: Pratik Vishwakarma <Pratik.Vishwakarma@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
index 84a1b4bc9bb4..bf59bb263816 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
@@ -1042,7 +1042,7 @@ bool amdgpu_acpi_is_s0ix_supported(struct amdgpu_device *adev)
 #if defined(CONFIG_AMD_PMC) || defined(CONFIG_AMD_PMC_MODULE)
 	if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
 		if (adev->flags & AMD_IS_APU)
-			return true;
+			return pm_suspend_target_state == PM_SUSPEND_TO_IDLE;
 	}
 #endif
 	return false;
-- 
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH v2] drm/amdgpu: Check pmops for desired suspend state
  2021-07-23 12:48 [PATCH v2] drm/amdgpu: Check pmops for desired suspend state Pratik Vishwakarma
@ 2021-07-23 13:07 ` Lazar, Lijo
  2021-07-23 13:27   ` Alex Deucher
  0 siblings, 1 reply; 3+ messages in thread
From: Lazar, Lijo @ 2021-07-23 13:07 UTC (permalink / raw
  To: Pratik Vishwakarma, Alexander.Deucher, amd-gfx



On 7/23/2021 6:18 PM, Pratik Vishwakarma wrote:
> [Why]
> User might change the suspend behaviour from OS.
> 
> [How]
> Check with pm for target suspend state and set s0ix
> flag only for s2idle state.
> 
> v2: User might change default suspend state, use target state
> Suggested-by: Lijo Lazar <Lijo.Lazar@amd.com>
> Signed-off-by: Pratik Vishwakarma <Pratik.Vishwakarma@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> index 84a1b4bc9bb4..bf59bb263816 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> @@ -1042,7 +1042,7 @@ bool amdgpu_acpi_is_s0ix_supported(struct amdgpu_device *adev)
>   #if defined(CONFIG_AMD_PMC) || defined(CONFIG_AMD_PMC_MODULE)
>   	if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
>   		if (adev->flags & AMD_IS_APU)
> -			return true;
> +			return pm_suspend_target_state == PM_SUSPEND_TO_IDLE;

Not sure if this is the right place, the name _is_s0ix_supported() gives 
the sense of a static check - whether the feature is supported.

pm_suspend_target_state is a dynamic one - actual suspend state to which 
transition happens. Ex: s0ix may be supported, but user may choose 
suspend to RAM.

Maybe rename to is_s0ix_transition? Will let Alex to comment as he added 
this function originally.

Thanks,
Lijo

>   	}
>   #endif
>   	return false;
> 
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH v2] drm/amdgpu: Check pmops for desired suspend state
  2021-07-23 13:07 ` Lazar, Lijo
@ 2021-07-23 13:27   ` Alex Deucher
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2021-07-23 13:27 UTC (permalink / raw
  To: Lazar, Lijo; +Cc: Deucher, Alexander, amd-gfx list

On Fri, Jul 23, 2021 at 9:08 AM Lazar, Lijo <lijo.lazar@amd.com> wrote:
>
>
>
> On 7/23/2021 6:18 PM, Pratik Vishwakarma wrote:
> > [Why]
> > User might change the suspend behaviour from OS.
> >
> > [How]
> > Check with pm for target suspend state and set s0ix
> > flag only for s2idle state.
> >
> > v2: User might change default suspend state, use target state
> > Suggested-by: Lijo Lazar <Lijo.Lazar@amd.com>
> > Signed-off-by: Pratik Vishwakarma <Pratik.Vishwakarma@amd.com>
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> > index 84a1b4bc9bb4..bf59bb263816 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> > @@ -1042,7 +1042,7 @@ bool amdgpu_acpi_is_s0ix_supported(struct amdgpu_device *adev)
> >   #if defined(CONFIG_AMD_PMC) || defined(CONFIG_AMD_PMC_MODULE)
> >       if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
> >               if (adev->flags & AMD_IS_APU)
> > -                     return true;
> > +                     return pm_suspend_target_state == PM_SUSPEND_TO_IDLE;
>
> Not sure if this is the right place, the name _is_s0ix_supported() gives
> the sense of a static check - whether the feature is supported.
>
> pm_suspend_target_state is a dynamic one - actual suspend state to which
> transition happens. Ex: s0ix may be supported, but user may choose
> suspend to RAM.
>
> Maybe rename to is_s0ix_transition? Will let Alex to comment as he added
> this function originally.

Maybe change it to amdgpu_acpi_is_s0ix_active()?  That better reflects
how it's used.  But please do that as a separate follow up patch so
that we can more easily backport this patch to older kernels.  Thanks.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

Alex

>
> Thanks,
> Lijo
>
> >       }
> >   #endif
> >       return false;
> >
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

end of thread, other threads:[~2021-07-23 13:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-23 12:48 [PATCH v2] drm/amdgpu: Check pmops for desired suspend state Pratik Vishwakarma
2021-07-23 13:07 ` Lazar, Lijo
2021-07-23 13:27   ` Alex Deucher

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.