Skip to content

[FROM-ML] platform/x86: asus-wmi: fix FA401 series keyboard sleep strobe - #109

Merged
KyleGospo merged 3 commits into
OpenGamingCollective:features/asusfrom
idobutidont:lore/fix-fa401-series-keyboard-sleep-strobe
Sep 2, 2026
Merged

[FROM-ML] platform/x86: asus-wmi: fix FA401 series keyboard sleep strobe#109
KyleGospo merged 3 commits into
OpenGamingCollective:features/asusfrom
idobutidont:lore/fix-fa401-series-keyboard-sleep-strobe

Conversation

@idobutidont

Copy link
Copy Markdown

This series fixes the keyboard sleep strobe effect on ASUS TUF Gaming
FA401 (A14) series laptops and refactors the TUF RGB state/mode
interface.

The FA401 does not report the TUF RGB state WMI device (0x00100057) via
standard DSTS probing, yet the EC supports the state flags required for
the sleep strobe animation. In addition, Modern Standby (S0ix/s2idle)
entry requires re-asserting the keyboard backlight and power state at
LPS0 prepare time because display servers and DRM drivers blank the
backlight to 0 prior to sleep.

Changes in v3:

  • Split the series into 3 patches: preparatory bitmask cleanup, FA401

  • DMI quirk, and S0ix sleep re-assertion (per Ilpo Järvinen).

  • Use FIELD_PREP() and named GENMASK() definitions consistently

  • (per Ilpo Järvinen).

  • Address Denis Benato's feedback regarding userspace policy:

    • Check the TUF_RGB_STATE_SLEEP flag so the kernel honors any user
      decision to disable sleep LEDs.
    • Dynamically track the user's active brightness level
      (kbd_led_last_level) so the sleep strobe preserves dim/bright
      preferences rather than forcing max brightness.
  • Hook into ACPI LPS0 s2idle dev ops (.prepare): ensures brightness and

  • state are re-asserted after the display server and DRM drivers blank

  • the screen, immediately prior to S0ix entry.
    Link: https://lore.kernel.org/platform-driver-x86/20260902032353.16106-1-idotohors@gmail.com/ # v2

Idotoho Reimon Simanjuntak (3):

  • platform/x86: asus-wmi: use named masks for TUF RGB commands
  • platform/x86: asus-wmi: enable TUF RGB state for FA401 via DMI quirk
  • platform/x86: asus-wmi: re-assert FA401 keyboard state before S0ix

Source: applied with b4 am from the mailing list.
Link: https://lore.kernel.org/all/20260902174718.16228-1-idotohors@gmail.com/

Idotoho Reimon Simanjuntak added 3 commits September 3, 2026 01:47
Replace open-coded bit shifts and magic numbers in kbd_rgb_mode_store()
and kbd_rgb_state_store() with FIELD_PREP() and named GENMASK() masks.

Define ASUS_WMI_TUF_RGB_STATE_CMD_ID (0xbd) as a named constant instead
of an inline literal, making the required arg0 command ID self-documenting.

In kbd_rgb_state_store(), remove the unused intermediate "flags" variable
entirely. The old BIT(1)/BIT(3)/BIT(5)/BIT(7) construction is replaced by
FIELD_PREP with per-flag named masks (TUF_RGB_STATE_BOOT, _AWAKE, _SLEEP,
_KEYBOARD), building arg0 directly. This preserves the exact sysfs input
format ("cmd boot awake sleep keyboard") and the resulting WMI argument
bit layout — no behavioral change.

In kbd_rgb_mode_store(), replace the positional shift expressions for
arg1 and arg2 with FIELD_PREP using TUF_RGB_MODE_{CMD,MODE,RED,GREEN}
and TUF_RGB_MODE_{BLUE,SPEED} masks respectively.

This is a preparatory cleanup to improve readability before adding
model-specific quirks that depend on these definitions.

Signed-off-by: Idotoho Reimon Simanjuntak <idotohors@gmail.com>
Reviewed-by: Denis Benato <denis.benato@linux.dev>
Link: https://lore.kernel.org/r/20260902174718.16228-2-idotohors@gmail.com
Signed-off-by: ido <106871003+idobutidont@users.noreply.github.com>
…DMI quirk

The FA401 (TUF Gaming A14) series does not expose the TUF RGB state
WMI device (0x00100057) through the standard DSTS probe, yet the EC
does support the keyboard backlight power-state flags needed for sleep
strobe functionality.

Add a DMI-based quirk in asus-nb-wmi.c that matches on DMI_SYS_VENDOR
"ASUSTeK COMPUTER INC." and DMI_BOARD_NAME "FA401", setting
kbd_rgb_state_available = true in struct quirk_entry.

In asus_wmi_add(), change the kbd_rgb_state_available assignment to
also consider driver->quirks->kbd_rgb_state_available, so models with
this quirk get the RGB state sysfs attributes even when DSTS probing
fails.

No PM/sleep/backlight changes are included in this commit; those will
be addressed separately once the RGB state interface is available.

Signed-off-by: Idotoho Reimon Simanjuntak <idotohors@gmail.com>
Reviewed-by: Denis Benato <denis.benato@linux.dev>
Link: https://lore.kernel.org/r/20260902174718.16228-3-idotohors@gmail.com
Signed-off-by: ido <106871003+idobutidont@users.noreply.github.com>
…re S0ix

On ASUS TUF Gaming FA401 laptops, the display server or graphics driver
blanks the keyboard backlight (brightness=0) during suspend. When the EC
enters S0ix with brightness=0, it disables the sleep-strobe effect.

Track the last user-configured non-zero keyboard backlight level in
asus->kbd_led_last_level, and re-assert it with the light-on bit (0x80)
along with the configured TUF RGB power state in both .prepare and the
LPS0 s2idle .prepare hook. Hooking LPS0 ensures the re-assertion happens
after all devices (including DRM and display managers) have suspended,
immediately prior to low-power S0 idle entry.

Only re-assert if the TUF sleep flag is active in kbd_rgb_state_flags,
respecting any user decision to disable sleep LEDs. Initialize default
flags at probe so the strobe functions out of the box.

Signed-off-by: Idotoho Reimon Simanjuntak <idotohors@gmail.com>
Link: https://lore.kernel.org/r/20260902174718.16228-4-idotohors@gmail.com
Signed-off-by: ido <106871003+idobutidont@users.noreply.github.com>
@KyleGospo
KyleGospo merged commit a00daa3 into OpenGamingCollective:features/asus Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants