X86 platform drivers
 help / color / mirror / Atom feed
From: bugzilla-daemon@kernel.org
To: platform-driver-x86@vger.kernel.org
Subject: [Bug 222342] New: [BUG] platform/x86: asus-wmi: kbd backlight cannot be set on ZenBook UX431DA (DEVS 0x00050021 is a firmware no-op)
Date: Sat, 28 Nov 2026 18:57:01 +0000	[thread overview]
Message-ID: <bug-222342-215701@https.bugzilla.kernel.org/> (raw)

https://bugzilla.kernel.org/show_bug.cgi?id=222342

            Bug ID: 222342
           Summary: [BUG] platform/x86: asus-wmi: kbd backlight cannot be
                    set on ZenBook UX431DA (DEVS 0x00050021 is a firmware
                    no-op)
           Product: Drivers
           Version: 2.5
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Platform_x86
          Assignee: drivers_platform_x86@kernel-bugs.osdl.org
          Reporter: icar.nin@protonmail.com
        Regression: No

Created attachment 311616
  --> https://bugzilla.kernel.org/attachment.cgi?id=311616&action=edit
Proposed patch

Hi,

On the ASUS ZenBook UX431DA, asus-wmi registers asus::kbd_backlight and
reports the level correctly, but writing a level has no effect. The
firmware's DEVS handler for ASUS_WMI_DEVID_KBD_BACKLIGHT returns success
and does nothing. The backlight hotkey still works because the firmware
changes the level itself, by writing an EC register, before it notifies
the OS. Writing that EC register from the OS sets the backlight, so I
would like to ask whether a quirk for this model would be acceptable.

Hardware / software
-------------------

  Model     ASUSTeK COMPUTER INC. ZenBook UX431DA_UM431DA
  Board     UX431DA
  BIOS      UX431DA.304, 08/15/2020 (EC firmware release 3.4)
  Kernel    7.3.6-arch1-1 (Arch Linux), in-tree asus-wmi / asus-nb-wmi

  asus_wmi: Initialization: 0x1
  asus_wmi: BIOS WMI version: 8.1
  asus_wmi: SFUN value: 0x4a0061
  asus-nb-wmi asus-nb-wmi: Detected ATK, not ASUSWMI, use DSTS

Symptoms
--------

  * /sys/class/leds/asus::kbd_backlight exists, max_brightness is 3.
  * Writing to "brightness" succeeds (as root, and through logind's
    SetBrightness and UPower's KbdBacklight.SetBrightness) but the
    backlight does not change and the value reads back unchanged.
  * The keyboard backlight hotkey cycles 0-3 as expected, and the change
    is reported through brightness_hw_changed.
  * As a result the desktop can display the level but not set it (GNOME
    quick settings slider, idle dimming), and systemd-backlight cannot
    restore the level at boot.

Firmware does not act on DEVS
-----------------------------

Using the asus-nb-wmi debugfs interface, with the backlight at level 1:

  DSTS(0x50021) = 0x58001
  DEVS(0x50021, 0x83) = 0x1
  DSTS(0x50021) = 0x58001        <- unchanged, backlight unchanged

So the driver's write path (kbd_led_set() -> kbd_led_update() ->
asus_wmi_set_devstate(ASUS_WMI_DEVID_KBD_BACKLIGHT, 0x80 | level)) does
reach the firmware, and the firmware reports success.

Root cause in the DSDT
----------------------

The DEVS branch calls SLKB, which calls SLKI, which is an empty stub:

    If ((IIA0 == 0x00050021))
    {
        SLKB (IIA1)
        Return (One)
    }

    Method (SLKB, 1, NotSerialized)
    {
        Return (SLKI (Arg0))
    }

    Method (SLKI, 1, NotSerialized)
    {
        Local0 = Zero
        Return (Local0)
    }

The DSTS branch reads the level from KBLV, a field in a SystemMemory
region:

    If ((IIA0 == 0x00050021))
    {
        If (GLKB (One))
        {
            Local0 = GLKB (0x03)        // GALL (), always 0x80
            Local0 <<= 0x08
            Local0 += GLKB (0x02)       // KBLV
            Local0 |= 0x00050000
            Return (Local0)
        }

        Return (0x8000)
    }

The hotkey is handled by EC query _Q66, which is the only place in the
DSDT that writes KBLV or the EC field KBLL:

    Method (_Q66, 0, NotSerialized)
    {
        P80H = 0x66
        If (ATKP)
        {
            Local1 = (KBLC & 0x80)
            If (Local1)
            {
                Local0 = KBLV
                Local0 += One
                If ((Local0 >= 0x04))
                {
                    Local0 = Zero
                }

                KBLV = Local0
                KBLL = KBLV
                ^^^^ATKD.MWGF (0x000200FF, KBLV, 0x4647574D)
                ^^^^ATKD.IANE (0xC7)
            }
        }
    }

KBLL is at offset 0x24 of the EC:

    OperationRegion (ECF2, EmbeddedControl, Zero, 0xFF)
    Field (ECF2, ByteAcc, Lock, Preserve)
    {
        XXX0,   8,
        XXX1,   8,
        XXX2,   8,
        STAS,   8,
        Offset (0x0F),
            ,   7,
        EOBF,   1,
        Offset (0x20),
        RCMD,   8,
            ,   7,
        EGC6,   1,
        TESR,   8,
        HBDA,   8,
        KBLL,   8,
        ...
    }

So on this machine the firmware has already applied the new level when
the driver receives NOTIFY_KBD_BRTTOGGLE (0xc7). The driver then computes
kbd_led_wk + 1 and issues a DEVS call that does nothing. The two only
agree because both count the same way.

Writing the EC register works
-----------------------------

With ec_sys loaded with write_support=1, writing a level to EC offset
0x24 sets the backlight immediately, for example full brightness:

  printf '\x03' | dd of=/sys/kernel/debug/ec/ec0/io bs=1 seek=36 conv=notrunc

I stepped through 0, 1, 2, 3 and back down to 0 this way, and the
backlight matched the written level every time (0 is off). The register
read back the written value each time, while sysfs "brightness" stayed
at 0, the level the firmware had before the test.

KBLV is not updated by this, so DSTS and the sysfs "brightness" file
keep returning the previous level afterwards, and no
brightness_hw_changed event is generated. Userspace therefore does not
notice the change.

Not fixed by a BIOS update
--------------------------

I extracted the DSDT from all four BIOS images ASUS has published for
this model (300, 301, 304 and 306). SLKI, SLKB, the DEVS branch and _Q66
are byte-identical in all of them, and the 306 DSDT is identical to the
304 one. I am therefore not reporting this as a kernel regression.

Possible fix
------------

A DMI quirk (DMI_BOARD_NAME "UX431DA") that makes the driver set the
level with ec_write(0x24, level) instead of, or in addition to, the DEVS
call. Two details would need handling:

  * DSTS cannot be used for read-back after an OS-initiated change,
    because KBLV is only updated by _Q66. The driver would have to
    return its cached kbd_led_wk on this model.
  * After a hotkey press the firmware sets KBLL from its own KBLV + 1,
    which can differ from the driver's value if the OS changed the level
    in between. The existing 0xc7 handling (kbd_led_wk + 1, then set)
    would then overwrite KBLL with the driver's value, which seems like
    the right result.

The UM431DA shares the product name string and, according to the ASUS
support site, the same BIOS files, so it is presumably affected too. I
have not tested one.

I can test patches and provide a full acpidump or any other output on
request.

Thanks,
Ícar N.S.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

                 reply	other threads:[~2026-11-28 18:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-222342-215701@https.bugzilla.kernel.org/ \
    --to=bugzilla-daemon@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox