achieve RC6 and save a significant amount of power for S0i.
ok jsg@
#include <linux/pseudo_fs.h>
#include <linux/slab.h>
#include <linux/srcu.h>
+#include <linux/suspend.h>
#include <drm/drm_accel.h>
#include <drm/drm_cache.h>
switch (act) {
case DVACT_QUIESCE:
+#ifdef CONFIG_ACPI
+ if (acpi_softc && acpi_softc->sc_state == ACPI_STATE_S3)
+ pm_suspend_target_state = PM_SUSPEND_MEM;
+ else
+ pm_suspend_target_state = PM_SUSPEND_TO_IDLE;
+#else
+ pm_suspend_target_state = PM_SUSPEND_TO_IDLE;
+#endif
drm_quiesce(dev);
break;
case DVACT_WAKEUP:
drm_wakeup(dev);
+ pm_suspend_target_state = PM_SUSPEND_ON;
break;
}
-/* $OpenBSD: drm_linux.c,v 1.114 2024/06/13 18:05:54 kettenis Exp $ */
+/* $OpenBSD: drm_linux.c,v 1.115 2024/07/13 15:38:21 kettenis Exp $ */
/*
* Copyright (c) 2013 Jonathan Gray <jsg@openbsd.org>
* Copyright (c) 2015, 2016 Mark Kettenis <kettenis@openbsd.org>
#include <linux/kthread.h>
#include <linux/processor.h>
#include <linux/sync_file.h>
+#include <linux/suspend.h>
#include <drm/drm_device.h>
#include <drm/drm_connector.h>
#endif
+suspend_state_t pm_suspend_target_state;
+
/*
* ACPI types and interfaces.
*/
#include <dev/acpi/amltypes.h>
#include <dev/acpi/dsdt.h>
+struct acpi_fadt acpi_gbl_FADT;
+
acpi_status
acpi_get_table(const char *sig, int instance,
struct acpi_table_header **hdr)
kmap_atomic_va =
(vaddr_t)km_alloc(PAGE_SIZE, &kv_any, &kp_none, &kd_waitok);
+
+#if NACPI > 0
+ if (acpi_softc) {
+ memcpy(&acpi_gbl_FADT, acpi_softc->sc_fadt,
+ sizeof(acpi_gbl_FADT));
+ }
+#endif
}
void
wait_for_suspend(gt);
}
-#ifdef notyet
static suspend_state_t pm_suspend_target(void)
{
#if IS_ENABLED(CONFIG_SUSPEND) && IS_ENABLED(CONFIG_PM_SLEEP)
return PM_SUSPEND_TO_IDLE;
#endif
}
-#endif
void intel_gt_suspend_late(struct intel_gt *gt)
{
* powermanagement enabled, but we also retain system state and so
* it remains safe to keep on using our allocated memory.
*/
-#ifdef notyet
if (pm_suspend_target() == PM_SUSPEND_TO_IDLE)
return;
-#endif
with_intel_runtime_pm(gt->uncore->rpm, wakeref) {
intel_rps_disable(>->rps);
#endif
#if defined(SUSPEND) || defined(HIBERNATE)
+#define CONFIG_SUSPEND 1
#define CONFIG_PM_SLEEP 1
#endif
int acpi_target_system_state(void);
+extern struct acpi_fadt acpi_gbl_FADT;
+#define ACPI_FADT_LOW_POWER_S0 (1 << 21)
+
#endif
+/* Public domain. */
+
+#ifndef _LINUX_SUSPEND_H
+#define _LINUX_SUSPEND_H
+
+typedef int suspend_state_t;
+
+#define PM_SUSPEND_ON 0
+#define PM_SUSPEND_MEM 1
+#define PM_SUSPEND_TO_IDLE 2
+
+extern suspend_state_t pm_suspend_target_state;
+
+#endif