Re: [PATCH v4 1/2] platform/x86: asus-wmi: add TUF keyboard RGB readback support

From
bartu alev <hidden>
Date
2026-11-16 22:00:26
Also in
lkml, platform-driver-x86
Reply to
Ilpo Järvinen, 2026-11-09
On 11/9/26 9:02 PM, Ilpo Järvinen wrote:
What do you (or Denis) think on sashiko's mention about 
asus_wmi_evaluate_method_buf() casting integer.value to int which might 
end up aliasing high-bit on return values with errnos?

The other caller seems to also return that value directly out of _store 
function().
Hi Ilpo and Denis,

I checked the DSDTs across 102 ASUS models we have dumped as well as the
UEFI/SMM path on my FA507NV (BIOS 318) to see what firmware actually
returns on the DSTS path:

1. Across the 102 DSDTs, no static DSTS branch returns 0xFFFFFFFF or
   Ones. Models without 0x0010005B either hit a DSTS tail of
   0xFFFFFFFE (15), fall through to WMNB's trailing 0xFFFFFFFE (45),
   or return Zero (3 older models: GL553VD, GL553VE, FX505DT).

2. On modern models (including FA507NV, FX517, GA403, GA605WI), DSTS
   delegates unlisted DEVIDs via WCHK/W15H (SW SMI 0xAA, cmd 0x9603).
   Disassembling the FA507NV modules (AsusSmmService ->
   AsusWmiToProtocol -> QuantaDxeWrapperPkg) shows that this dynamic
   chain also returns 0 (unmatched consumer / missing table entry), 1,
   capability/presence bits (e.g. 0x00010000 for 0x00100056/57), MMIO
   reads, or 0xFFFFFFFE -- never 0xFFFFFFFF.

   (Note: on FA507NV, 0x0010005B itself is static in AML and calls
   EC0.KBLS(), while 0x00100056/57 go through WCHK/W15H and return
   0x00010000 on DSTS.)

However, checking those tables did uncover one real mismatch and a clean
reason to still harden asus_wmi_evaluate_method_buf():

- On models like FX505DT, DSTS(0x00100056/57) returns 0x00010000 (so
  kbd_rgb_mode/kbd_rgb_state are registered), while 0x0010005B hits the
  DSTS tail Return (Zero).  asus_wmi_evaluate_method_buf() turns 0 into
  -ENODATA, so v4's `err < 0 ? err : -ENODEV` would return -ENODATA
  instead of -ENODEV as documented in the ABI patch.  The same happens
  if W15H hits an unmatched consumer/table miss in SMM (returns 0).

- Even though 0xFFFFFFFF didn't show up in this set, an unseen BIOS or
  SMM branch returning 0xFFFFFFFF or any bit-31-set integer would still
  alias a negative errno in asus_wmi_evaluate_method_buf().

To avoid disturbing older devices, would a minimal approach like this be
acceptable for v5?

1. Add a small prep patch to asus_wmi_evaluate_method_buf() using a u32
   retval: keep 0xFFFFFFFE -> -ENODEV and 0 -> -ENODATA as today, also
   map (u32)~0 (0xFFFFFFFF) -> -ENODEV (matching asus_wmi_get_devstate()),
   and return -ENODATA for any other unexpected integer (matching the
   `default:` case; the only existing caller fan_curve_get_factory_default()
   already treats any non-zero return as failure).

2. In kbd_rgb_read_status(), translate -ENODATA to -ENODEV so FX505DT /
   0-returning firmware matches the ABI while preserving -EIO / -ENOSPC.

Thanks,
Bartu
Thread (10 messages) 10 messages, 3 authors, last reply 1d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help