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

Lazar, Lijo lijo.lazar at amd.com
Fri Jul 23 13:07:55 UTC 2021



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 at amd.com>
> Signed-off-by: Pratik Vishwakarma <Pratik.Vishwakarma at 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;
> 


More information about the amd-gfx mailing list