summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2022-02-24 12:42:55 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2022-02-24 12:42:55 +0000
commit1437f48b013e4e624b8b075ebfac96039063ba17 (patch)
tree894211b20337f003aae03754ebf9cc357e90355e /sys/dev
parent3c35ceeaae745d6b655e818cfdfb7b7f3cf40ac0 (diff)
drm/amd: add support to check whether the system is set to s3
From Mario Limonciello 72808bb42c87c4887c553ea8d9f4ecaf15d867d3 in linux 5.15.y/5.15.25 f52a2b8badbd24faf73a13c9c07fdb9d07352944 in mainline linux
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/drm/amd/amdgpu/amdgpu.h2
-rw-r--r--sys/dev/pci/drm/amd/amdgpu/amdgpu_acpi.c13
2 files changed, 15 insertions, 0 deletions
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu.h b/sys/dev/pci/drm/amd/amdgpu/amdgpu.h
index df282ca51b0..b30bfd04a79 100644
--- a/sys/dev/pci/drm/amd/amdgpu/amdgpu.h
+++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu.h
@@ -1441,9 +1441,11 @@ static inline int amdgpu_acpi_smart_shift_update(struct drm_device *dev,
#endif
#if defined(CONFIG_ACPI) && defined(CONFIG_SUSPEND)
+bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev);
bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev);
#else
static inline bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) { return false; }
+static inline bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev) { return false; }
#endif
int amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser,
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_acpi.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_acpi.c
index d33a60e5939..bdedf4f781a 100644
--- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_acpi.c
+++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_acpi.c
@@ -1046,6 +1046,19 @@ 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
*
* @adev: amdgpu_device_pointer