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
This commit is contained in:
Abdelkader Boudih
2026-02-23 17:11:10 +01:00
committed by Aymeric Wibo
parent 477ab96044
commit 16822dac32
+36
View File
@@ -80,6 +80,8 @@ static int acpi_panasonic_probe(device_t dev);
static int acpi_panasonic_attach(device_t dev); static int acpi_panasonic_attach(device_t dev);
static int acpi_panasonic_detach(device_t dev); static int acpi_panasonic_detach(device_t dev);
static int acpi_panasonic_shutdown(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 int acpi_panasonic_sysctl(SYSCTL_HANDLER_ARGS);
static UINT64 acpi_panasonic_sinf(ACPI_HANDLE h, UINT64 index); static UINT64 acpi_panasonic_sinf(ACPI_HANDLE h, UINT64 index);
static void acpi_panasonic_sset(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_attach, acpi_panasonic_attach),
DEVMETHOD(device_detach, acpi_panasonic_detach), DEVMETHOD(device_detach, acpi_panasonic_detach),
DEVMETHOD(device_shutdown, acpi_panasonic_shutdown), DEVMETHOD(device_shutdown, acpi_panasonic_shutdown),
DEVMETHOD(device_resume, acpi_panasonic_resume),
DEVMETHOD_END DEVMETHOD_END
}; };
@@ -172,6 +175,8 @@ acpi_panasonic_attach(device_t dev)
CTLFLAG_MPSAFE, sc, i, acpi_panasonic_sysctl, "I", ""); CTLFLAG_MPSAFE, sc, i, acpi_panasonic_sysctl, "I", "");
} }
acpi_panasonic_clear_rfkill(dev);
#if 0 #if 0
/* Activate hotkeys */ /* Activate hotkeys */
status = AcpiEvaluateObject(sc->handle, "", NULL, NULL); status = AcpiEvaluateObject(sc->handle, "", NULL, NULL);
@@ -232,6 +237,37 @@ acpi_panasonic_shutdown(device_t dev)
return (0); 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 static int
acpi_panasonic_sysctl(SYSCTL_HANDLER_ARGS) acpi_panasonic_sysctl(SYSCTL_HANDLER_ARGS)
{ {