Skip to contentSkip to conversation

platform/x86: acer-wmi: Add 4-zone RGB keyboard support for Nitro AN515-58

PATCH New Batuhan 1 participant 1 message Nov 26

Subsystems (2)
lore
Share & tools
lore

Batuhan

author
#0 lore raw

PATCH v4 1/1 platform/x86: acer-wmi: Add 4-zone RGB keyboard support for Nitro AN515-58

From: Batuhan Güvener <[email protected]>

Add support for the 4-zone RGB keyboard backlights found on Acer Nitro AN515-58 laptops.

The hardware operates via a dual-control mechanism: global hardware brightness is managed by the EC via RAM offset 0x31 with a range of 0 to 4 (where 0x04 is maximum intensity), while per-zone RGB color control is handled via WMI Method 6.

Exposing max_brightness = 4 to match the EC hardware level causes the led-class-multicolor subsystem to scale color components down, restricting the palette to 5x5x5 (125) total color combinations. Keeping max_brightness at 255 allows fine-grained 8-bit per-channel control from userspace, though it creates a dual-control scenario where hardware EC brightness and userspace multicolor brightness operate concurrently (e.g. EC brightness at 4 while userspace intensity is 0).

Additionally, when the system resumes from a shutdown or power cycle while brightness is set to 0, the hardware initializes with 0 brightness but cannot derive valid multi-intensity values. To ensure consistent state evaluation, it defaults to max intensity (255, 255, 255 - white).

Since the Nitro AN515-58 SKU ships with both 4-zone RGB and single-color red backlight options, add SMBIOS Type 0xAC checks to ensure non-functional LED devices are not registered on single-color models.

This implementation builds upon initial findings and reverse-engineering efforts by Dirga Yuza and open-source community driver implementations.

---
The SMBIOS Type 0xAC parsing logic (type_ac_dmi_decode()) was written with assistance from LLM, and was reviewed and verified against raw DMI dumps from target hardware to ensure accurate capability detection.

Changes since v3:
- Instead of masking wmi_evaluate_method() with a helper, migrated to newer wmidev approach
- Added RGB capability checking on top of DMI checks based on archivesteak's findings
- Fix spacing on newly added #define lines
- Rename led_information struct to be more informative acer_kbd_zone_led
- Switch kbl_four_zone quirk into a boolean and rename it into kbd_bl_four_zone
- Separate AN16-41's quirks to set target hardware cleanly
- Initial zone colors are now read through WMI method 7 and not directly from EC
- Rebased onto next-20261125

Changes since v2:
- Remove redundant comments
- Place new #include headers near alphabetical neighbors
- Replace deprecated wmi_evaluate_method() with WMI_gaming_execute_buf() using __free(kfree)
- Use __packed structs for WMI command payloads
- Switch to guard(mutex), devm_mutex_init(), and FIELD_MAX()
- Use dev_warn() instead of pr_warn()
- Fix indentation and reverse xmas-tree variable ordering

Changes since v1:
- Clear non-English comments
- Rebase onto linux-next

---
 drivers/platform/x86/Kconfig    |   1 +
 drivers/platform/x86/acer-wmi.c | 410 +++++++++++++++++++++++++++++++-
 2 files changed, 410 insertions(+), 1 deletion(-)
drivers/platform/x86/Kconfig +1 -0
index 7daef6ad5dbe..a200fd3d5308 100644
@@ -178,6 +178,7 @@ config ACER_WMI
 	select LEDS_CLASS
 	select NEW_LEDS
 	select PLATFORM_PROFILE
+	select LEDS_CLASS_MULTICOLOR
 	help
 	  This is a driver for newer Acer (and Wistron) laptops. It adds
 	  wireless radio and bluetooth control, and on some laptops,
drivers/platform/x86/acer-wmi.c +409 -1

506 lines not on this page · raw message

Signature · 1 line
2.56.0