git: 16822dac32ab - main - acpi_panasonic: Clear wireless RF_KILL on boot and resume

From: Aymeric Wibo <obiwac_at_FreeBSD.org>
Date: Mon, 23 Feb 2026 16:21:43 UTC
The branch main has been updated by obiwac:

URL: https://cgit.FreeBSD.org/src/commit/?id=16822dac32ab8955539ffa4eda05145df8638154

commit 16822dac32ab8955539ffa4eda05145df8638154
Author:     Abdelkader Boudih <guest-seuros@FreeBSD.org>
AuthorDate: 2026-02-23 16:11:10 +0000
Commit:     Aymeric Wibo <obiwac@FreeBSD.org>
CommitDate: 2026-02-23 16:11:23 +0000

    acpi_panasonic: Clear wireless RF_KILL on boot and resume
    
    On Panasonic FZ-Y1 and similar models, the EC latches RF_KILL on
    shutdown and suspend when battery is at certain level, causing wireless
    to boot with hard block.
    
    Call WLSW.SHRF during attach and resume to clear the block.
    
    Tested on Panasonic FZ-Y1 with Intel Wireless 7265.
    
    Reviewed by:    adrian, obiwac
    Approved by:    adrian, obiwac
    Differential Revision:  https://reviews.freebsd.org/D55265
---
 sys/dev/acpi_support/acpi_panasonic.c | 36 +++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/sys/dev/acpi_support/acpi_panasonic.c b/sys/dev/acpi_support/acpi_panasonic.c
index 67d51ea9bc1f..8fea47ee45e8 100644
--- a/sys/dev/acpi_support/acpi_panasonic.c
+++ b/sys/dev/acpi_support/acpi_panasonic.c
@@ -80,6 +80,8 @@ static int	acpi_panasonic_probe(device_t dev);
 static int	acpi_panasonic_attach(device_t dev);
 static int	acpi_panasonic_detach(device_t dev);
 static int	acpi_panasonic_shutdown(device_t dev);
+static int	acpi_panasonic_resume(device_t dev);
+static void	acpi_panasonic_clear_rfkill(device_t dev);
 static int	acpi_panasonic_sysctl(SYSCTL_HANDLER_ARGS);
 static UINT64	acpi_panasonic_sinf(ACPI_HANDLE h, UINT64 index);
 static void	acpi_panasonic_sset(ACPI_HANDLE h, UINT64 index,
@@ -116,6 +118,7 @@ static device_method_t acpi_panasonic_methods[] = {
 	DEVMETHOD(device_attach,	acpi_panasonic_attach),
 	DEVMETHOD(device_detach,	acpi_panasonic_detach),
 	DEVMETHOD(device_shutdown,	acpi_panasonic_shutdown),
+	DEVMETHOD(device_resume,	acpi_panasonic_resume),
 
 	DEVMETHOD_END
 };
@@ -172,6 +175,8 @@ acpi_panasonic_attach(device_t dev)
 		    CTLFLAG_MPSAFE, sc, i, acpi_panasonic_sysctl, "I", "");
 	}
 
+	acpi_panasonic_clear_rfkill(dev);
+
 #if 0
 	/* Activate hotkeys */
 	status = AcpiEvaluateObject(sc->handle, "", NULL, NULL);
@@ -232,6 +237,37 @@ acpi_panasonic_shutdown(device_t dev)
 	return (0);
 }
 
+static int
+acpi_panasonic_resume(device_t dev)
+{
+
+	acpi_panasonic_clear_rfkill(dev);
+	return (0);
+}
+
+static void
+acpi_panasonic_clear_rfkill(device_t dev)
+{
+	ACPI_HANDLE wlsw_handle;
+	ACPI_STATUS status;
+
+	/*
+	 * Call WLSW.SHRF to clear wireless RF_KILL on models that have it.
+	 * On FZ-Y1 and similar models, the EC latches RF_KILL on shutdown
+	 * and suspend, causing the wireless card to boot with hard block
+	 * enabled.  The SHRF method sets the EC state to deassert RF_KILL
+	 * GPIO on mini-PCIe pin 20 via SMI (ASRV call with function
+	 * 0x0F/0x03).
+	 */
+	status = AcpiGetHandle(NULL, "\\_SB.WLSW", &wlsw_handle);
+	if (ACPI_SUCCESS(status)) {
+		status = AcpiEvaluateObject(wlsw_handle, "SHRF", NULL, NULL);
+		if (ACPI_FAILURE(status) && bootverbose)
+			device_printf(dev, "WLSW.SHRF failed: %s\n",
+			    AcpiFormatException(status));
+	}
+}
+
 static int
 acpi_panasonic_sysctl(SYSCTL_HANDLER_ARGS)
 {