From nobody Mon Feb 2 23:51:36 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4f4k0m5n0Jz6QkfJ for ; Mon, 02 Feb 2026 23:51:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4f4k0m4dCTz3HX2 for ; Mon, 02 Feb 2026 23:51:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1770076296; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jK2HlBBUrOgTtQu7gjwAdyhWcBXd5QG29Kg+DRSY8bc=; b=RRGZ+dN969zLzhM5hxnMHy3RmlAf00zh8mg/SzShj0x//DgqaHyVkRq/s3KwEBdq+eeGHl HEYJ/seBX3Z5nuEBkQSCnNJAxR/MKDZmY0IwpwtUn5jibcWzmOuQ6fc6YyyDWncIh+9NpU kH2B/F2OKtD6MhHu9lwTXkL39qJXruedBkYYn41n7JvTM3gCd6yWXnlxjRH+cVwEvGhluG fzmlJ6qPICRkMN8kv9QMxRjgsxeiWDY+9LGpNObcndfWXnYfPpelPZE+w1CUUt8Db1hK81 dgTw0NJu0TLyXUJgqTJPydSAyWryDZHcO5BKu78K9VTTEYP+M3upJSxrtDPyPA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1770076296; a=rsa-sha256; cv=none; b=E0ZfHArQJ3RHg2SGl7S/gHpYD9OG+uCbDeJgj0CoaR3D7ALOfWuLLgPUw5YXFyjokea+gv XEF2F5FAC4/chYiTis0Wv4bi2kaDXUBaLLvWjL+DcmKJ+N+kH4NokLdZ7HRrE8lCkXmUmL RqF3tiFmI5caHypsnD+yGeoGLPzK4cw49UMBDip7dN5/OoLby1dPG51GX2EJp4om1rieuf Z9XJ2kh91LlVTjRO3oIbkaxi5IQPIYr3q99iBsJRTIWn5Npib0cvBCj4vL56wlMRQfG1P0 yVCDhdhSSxH2wcgzX8EMbNHT3RZnBIdLZfapmDDM8qe9YDARagIgW9JCOk/dJw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1770076296; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jK2HlBBUrOgTtQu7gjwAdyhWcBXd5QG29Kg+DRSY8bc=; b=CwNMn2//X8qxlqoE5wuhR/e9L+2B8MYqK+fcr8IAFiGANhB3T8Vt4CrRakmtWqP+n2sFVf 7KSMh4O+aOrD7WC4xPRpeN3wnYmnGjvpAv2uCYsYS6p6gjkqQVToMeQ7xRvYtYsm918xDj hq6Ba/YOtD7AJq4bwI4iDCOBwjBzs+Ta2h9u2UvIf7MnxNxzbzRjRpmu1ay0cBH/89s/Xp j1r3YqmJcIsZFnI6bwzGxG01fZ4cAnnYSg6OLS5AqSXfaYy2o27CPOlMxbeiSKEXeHmp9a 0fMe4pQ+h2Eb/PZaVr78JcPVwCPUXYR16cGSivA0CB3AfPVU75MTmsrA/KNsDQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4f4k0m47YjznbX for ; Mon, 02 Feb 2026 23:51:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 22020 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 02 Feb 2026 23:51:36 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Aymeric Wibo Subject: git: fedc9746bd37 - main - acpi_spmc: Register SPMC suspend/resume routines List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: obiwac X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fedc9746bd37340a06dfcafea28904cf401127cf Auto-Submitted: auto-generated Date: Mon, 02 Feb 2026 23:51:36 +0000 Message-Id: <69813888.22020.13207046@gitrepo.freebsd.org> The branch main has been updated by obiwac: URL: https://cgit.FreeBSD.org/src/commit/?id=fedc9746bd37340a06dfcafea28904cf401127cf commit fedc9746bd37340a06dfcafea28904cf401127cf Author: Aymeric Wibo AuthorDate: 2026-02-02 23:49:23 +0000 Commit: Aymeric Wibo CommitDate: 2026-02-02 23:51:17 +0000 acpi_spmc: Register SPMC suspend/resume routines SPMC suspend runs after the device tree is suspended using the acpi_post_dev_suspend eventhandler, and SPMC resume runs before the device tree is resumed using the acpi_pre_dev_suspend eventhandler. Reviewed by: olce Approved by: olce Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48735 --- sys/dev/acpica/acpi_spmc.c | 45 +++++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/sys/dev/acpica/acpi_spmc.c b/sys/dev/acpica/acpi_spmc.c index d8d28d59340d..e8ed14fdcb1b 100644 --- a/sys/dev/acpica/acpi_spmc.c +++ b/sys/dev/acpica/acpi_spmc.c @@ -8,12 +8,12 @@ */ #include -#include -#include #include +#include +#include #include +#include #include -#include #include @@ -158,6 +158,9 @@ struct acpi_spmc_softc { ACPI_OBJECT *obj; enum dsm_set_flags dsm_sets; + struct eventhandler_entry *eh_suspend; + struct eventhandler_entry *eh_resume; + bool constraints_populated; size_t constraint_count; struct acpi_spmc_constraint *constraints; @@ -168,6 +171,9 @@ static void acpi_spmc_check_dsm_set(struct acpi_spmc_softc *sc, static int acpi_spmc_get_constraints(device_t dev); static void acpi_spmc_free_constraints(struct acpi_spmc_softc *sc); +static void acpi_spmc_suspend(device_t dev, enum power_stype stype); +static void acpi_spmc_resume(device_t dev, enum power_stype stype); + static int acpi_spmc_probe(device_t dev) { @@ -207,9 +213,8 @@ acpi_spmc_probe(device_t dev) static int acpi_spmc_attach(device_t dev) { - struct acpi_spmc_softc *sc; + struct acpi_spmc_softc *sc = device_get_softc(dev); - sc = device_get_softc(dev); sc->dev = dev; sc->handle = acpi_get_handle(dev); @@ -221,7 +226,12 @@ acpi_spmc_attach(device_t dev) sc->constraints = NULL; /* Get device constraints. We can only call this once so do this now. */ - acpi_spmc_get_constraints(sc->dev); + acpi_spmc_get_constraints(dev); + + sc->eh_suspend = EVENTHANDLER_REGISTER(acpi_post_dev_suspend, + acpi_spmc_suspend, dev, 0); + sc->eh_resume = EVENTHANDLER_REGISTER(acpi_pre_dev_resume, + acpi_spmc_resume, dev, 0); return (0); } @@ -229,6 +239,11 @@ acpi_spmc_attach(device_t dev) static int acpi_spmc_detach(device_t dev) { + struct acpi_spmc_softc *sc = device_get_softc(dev); + + EVENTHANDLER_DEREGISTER(acpi_post_dev_suspend, sc->eh_suspend); + EVENTHANDLER_DEREGISTER(acpi_pre_dev_resume, sc->eh_resume); + acpi_spmc_free_constraints(device_get_softc(dev)); return (0); } @@ -586,22 +601,24 @@ acpi_spmc_exit_notif(device_t dev) } } -static int -acpi_spmc_suspend(device_t dev) +static void +acpi_spmc_suspend(device_t dev, enum power_stype stype) { + if (stype != POWER_STYPE_SUSPEND_TO_IDLE) + return; + acpi_spmc_display_off_notif(dev); acpi_spmc_entry_notif(dev); - - return (0); } -static int -acpi_spmc_resume(device_t dev) +static void +acpi_spmc_resume(device_t dev, enum power_stype stype) { + if (stype != POWER_STYPE_SUSPEND_TO_IDLE) + return; + acpi_spmc_exit_notif(dev); acpi_spmc_display_on_notif(dev); - - return (0); } static device_method_t acpi_spmc_methods[] = {