Date: Wed, 13 May 2026 00:54:18 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 295251] Power button does not work on HP Laptop 15s (new module to poll GPIO and raise ACPI event) Message-ID: <bug-295251-227@https.bugs.freebsd.org/bugzilla/>
index | next in thread | raw e-mail
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=295251 Bug ID: 295251 Summary: Power button does not work on HP Laptop 15s (new module to poll GPIO and raise ACPI event) Product: Base System Version: 15.0-RELEASE Hardware: amd64 OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: rz@fabmicro.ru Created attachment 270664 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=270664&action=edit FreeBSD Kernel Module for monitoring state of Power Button connected to AMD GPIO Hi all. Recently I convinced a friend of mine to install FreeBSD 15.0 on his not so old HP Laptop Model 15s-eq1337ur based on AMD Ryzen 3 4300 CPU. Things went more or less fine, WiFi and GPU graphics worked out of the box. But, soon we discovered that system does not react to Power Button presses. I tried to fast-fix that with hw.acpi.power_button_state=S4, but that did not work. I noticed, that it was possible to shutdown the system with sending ACPI event via "acpiconf -s 4". I looked through dmesg for ACPI errors, but did not find anything suspicious. Frustrated, yet engaged I borrowed this laptop from my friend for a couple of weeks and began to dive deep into ACPI rabit hole in a hope to find a simple solution. Fortunately solution has been found, but it's not as simple as I hoped. After dumping and disassembling AML tables using acpidump and iasl and spending two weeks analyzing ASL code and tracing ACPI events I came to the following: 1. Power Button on this HP laptop is connected to AMD GPIO pin 0. 2. ACPI firmware heavily relies on \_SB.GPIO._EVT method being called by system GPIO driver to process button events (power, sleep and some others). This event never comes, nobody in the system calls _EVT. 3. FreeBSD supports AMD GPIO since 2018 by amdgpio module. 4. amdgpio module does not support interrupts because interrupts are also not supported in upstream gpiobus module which relies on INTRNG framework that was never implemented for PC (amd64) platform. And it seems it won't be implemented any time soon. I also analyzed how ACPI works on my own Lenovo Ideapad laptop. The power button there also connected to GPIO pin 0 and it works fine. After disassembling and analyzing AML firmware I figured out that it works way different: it relies on EC0 controller that triggers hardware IRQ9 which is then processed by fixed button driver (sys/dev/acpica/acpi_button.c). My initial idea for repairing button on HP laptop was to rewrite and recompile ASL code in a way similar to what I have on Lenovo. Unfortunately, this task appeared to be too complex for my two-weeks study of ACPI. So I dropped that idea and took some other approach: to "prosthetize" missing interrupt from GPIO pin by polling it. So, here's my simple Power Button driver/module named gpiopwrb. It binds to gpiobus, acquires GPIO pin provided by hint and runs a kthread to constantly poll pin state once in a 1/4 of a second. As pin state changes, it calls to ACPI method provided by another hint (default is \_SB.GPIO._EVT). This driver works both on HP and Lenovo laptops on FreeBSD 13.5, 14.3 and 15.0. Hope this can be of help to other owners of contemporary HP laptops with Hardware-Reduced ACPI firmware. This driver becomes obsolete soon as interrupt support is added to gpiobus and amdgpio drivers. HP Laptop Model 15s-eq1337ur (ProductID 461U9EA#ACB) with the following firmware: [000h 0000 004h] Signature : "FACP" [Fixed ACPI Description Table (FADT)] [004h 0004 004h] Table Length : 00000114 [008h 0008 001h] Revision : 06 [009h 0009 001h] Checksum : FF [00Ah 0010 006h] Oem ID : "HPQOEM" [010h 0016 008h] Oem Table ID : "SLIC-MPC" [018h 0024 004h] Oem Revision : 01072009 [01Ch 0028 004h] Asl Compiler ID : "HP " [020h 0032 004h] Asl Compiler Revision : 00010013 Link to repository: https://github.com/pointcheck/gpiopwrb.git PS: This is my first touch on writing a FreeBSD driver inspired by recent book by Edson Brandi. ;-) -- You are receiving this mail because: You are the assignee for the bug.home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-295251-227>
