drm/amdgpu: add s0i3 capacity check for s0i3 routine (v2)
authorPrike Liang <Prike.Liang@amd.com>
Wed, 9 Sep 2020 02:55:39 +0000 (10:55 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 13 Nov 2020 22:29:45 +0000 (17:29 -0500)
add amdgpu_acpi_is_s0ix_supported() to check the platform
whether support s0i3.

v2: fix empty function parameters warning (void)

Signed-off-by: Prike Liang <Prike.Liang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c

index 0c469dec3d609656a65342019020529ef5a53891..6e2953233231fa4658ae8a02b112632dc67c1f69 100644 (file)
@@ -1311,9 +1311,11 @@ int amdgpu_acpi_pcie_notify_device_ready(struct amdgpu_device *adev);
 
 void amdgpu_acpi_get_backlight_caps(struct amdgpu_device *adev,
                struct amdgpu_dm_backlight_caps *caps);
+bool amdgpu_acpi_is_s0ix_supported(void);
 #else
 static inline int amdgpu_acpi_init(struct amdgpu_device *adev) { return 0; }
 static inline void amdgpu_acpi_fini(struct amdgpu_device *adev) { }
+static inline bool amdgpu_acpi_is_s0ix_supported(void) { return false; }
 #endif
 
 int amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser,
index 165b02e267b0ce1e859eb6a628a1df768457b7dc..4f4fda53c08a7127871af74bd7237c414837dbeb 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/power_supply.h>
 #include <linux/pm_runtime.h>
 #include <acpi/video.h>
+#include <acpi/actbl.h>
 
 #include <drm/drm_crtc_helper.h>
 #include "amdgpu.h"
@@ -894,3 +895,16 @@ void amdgpu_acpi_fini(struct amdgpu_device *adev)
        unregister_acpi_notifier(&adev->acpi_nb);
        kfree(adev->atif);
 }
+
+/**
+ * amdgpu_acpi_is_s0ix_supported
+ *
+ * returns true if supported, false if not.
+ */
+bool amdgpu_acpi_is_s0ix_supported(void)
+{
+       if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)
+               return true;
+
+       return false;
+}