[FROM-ML] platform/x86: asus-wmi: fix FA401 series keyboard sleep strobe - #109
Merged
KyleGospo merged 3 commits intoSep 2, 2026
Conversation
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
approved these changes
Sep 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
decision to disable sleep LEDs.
(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):
Source: applied with
b4 amfrom the mailing list.Link: https://lore.kernel.org/all/20260902174718.16228-1-idotohors@gmail.com/