Date: Mon, 6 Oct 2025 21:50:13 GMT From: Aymeric Wibo <obiwac@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: a25cfcab9a9d - main - linuxkpi: Support s2idle in `pm_suspend_target_state` Message-ID: <202510062150.596LoDYv072197@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by obiwac: URL: https://cgit.FreeBSD.org/src/commit/?id=a25cfcab9a9d2c7d733b85bf04b504369623de1c commit a25cfcab9a9d2c7d733b85bf04b504369623de1c Author: Aymeric Wibo <obiwac@FreeBSD.org> AuthorDate: 2025-10-06 21:38:58 +0000 Commit: Aymeric Wibo <obiwac@FreeBSD.org> CommitDate: 2025-10-06 21:49:54 +0000 linuxkpi: Support s2idle in `pm_suspend_target_state` When going to s2idle, set Linux' pm_suspend_target_state to PM_SUSPEND_TO_IDLE instead of setting PM_SUSPEND_MEM (for S3) in all cases. This is necessary because more recent versions of the amdgpu DRM drivers have different paths for when entering s2idle & S0ix is supported than S3. Reviewed by: bz Approved by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51591 --- sys/compat/linuxkpi/common/src/linux_acpi.c | 30 +++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_acpi.c b/sys/compat/linuxkpi/common/src/linux_acpi.c index 60e14cfc98c5..c7d62c745c7e 100644 --- a/sys/compat/linuxkpi/common/src/linux_acpi.c +++ b/sys/compat/linuxkpi/common/src/linux_acpi.c @@ -119,17 +119,27 @@ acpi_evaluate_dsm(ACPI_HANDLE ObjHandle, const guid_t *guid, } static void -linux_handle_power_suspend_event(void *arg __unused, - enum power_stype stype __unused) +linux_handle_power_suspend_event(void *arg __unused, enum power_stype stype) { - /* - * Only support S3 for now. - * acpi_sleep_event isn't always called so we use power_suspend_early - * instead which means we don't know what state we're switching to. - * TODO: Make acpi_sleep_event consistent - */ - linux_acpi_target_sleep_state = ACPI_STATE_S3; - pm_suspend_target_state = PM_SUSPEND_MEM; + switch (stype) { + case POWER_STYPE_SUSPEND_TO_IDLE: + /* + * XXX: obiwac Not 100% sure this is correct, but + * acpi_target_sleep_state does seem to be set to + * ACPI_STATE_S3 during s2idle on Linux. + */ + linux_acpi_target_sleep_state = ACPI_STATE_S3; + pm_suspend_target_state = PM_SUSPEND_TO_IDLE; + break; + case POWER_STYPE_SUSPEND_TO_MEM: + linux_acpi_target_sleep_state = ACPI_STATE_S3; + pm_suspend_target_state = PM_SUSPEND_MEM; + break; + default: + printf("%s: sleep type %d not yet supported\n", + __func__, stype); + break; + } } static void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202510062150.596LoDYv072197>