Re: [PATCH v2] drm/amdgpu: Check pmops for desired suspend state

2021-07-23 Thread Lazar, Lijo




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 
Signed-off-by: Pratik Vishwakarma 
---
  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


Re: [PATCH v2] drm/amdgpu: Check pmops for desired suspend state

2021-07-23 Thread Alex Deucher
On Fri, Jul 23, 2021 at 9:08 AM Lazar, Lijo  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 
> > Signed-off-by: Pratik Vishwakarma 
> > ---
> >   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 

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