diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 37 | 
1 files changed, 32 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c index 4811b0faafd9..0e12315fa0cb 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c @@ -1031,6 +1031,20 @@ void amdgpu_acpi_detect(void)  	}  } +#if IS_ENABLED(CONFIG_SUSPEND) +/** + * amdgpu_acpi_is_s3_active + * + * @adev: amdgpu_device_pointer + * + * returns true if supported, false if not. + */ +bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev) +{ +	return !(adev->flags & AMD_IS_APU) || +		(pm_suspend_target_state == PM_SUSPEND_MEM); +} +  /**   * amdgpu_acpi_is_s0ix_active   * @@ -1040,11 +1054,24 @@ void amdgpu_acpi_detect(void)   */  bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)  { -#if IS_ENABLED(CONFIG_AMD_PMC) && IS_ENABLED(CONFIG_SUSPEND) -	if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) { -		if (adev->flags & AMD_IS_APU) -			return pm_suspend_target_state == PM_SUSPEND_TO_IDLE; +	if (!(adev->flags & AMD_IS_APU) || +	    (pm_suspend_target_state != PM_SUSPEND_TO_IDLE)) +		return false; + +	if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) { +		dev_warn_once(adev->dev, +			      "Power consumption will be higher as BIOS has not been configured for suspend-to-idle.\n" +			      "To use suspend-to-idle change the sleep mode in BIOS setup.\n"); +		return false;  	} -#endif + +#if !IS_ENABLED(CONFIG_AMD_PMC) +	dev_warn_once(adev->dev, +		      "Power consumption will be higher as the kernel has not been compiled with CONFIG_AMD_PMC.\n");  	return false; +#else +	return true; +#endif /* CONFIG_AMD_PMC */  } + +#endif /* CONFIG_SUSPEND */  | 
