Skip to content

leds: dynamic: Add Dynamic Lighting class interface and Aura (hid-asus) support - #17

Draft
scardracs wants to merge 6 commits into
OpenGamingCollective:masterfrom
scardracs:leds/dynamic-lighting
Draft

leds: dynamic: Add Dynamic Lighting class interface and Aura (hid-asus) support#17
scardracs wants to merge 6 commits into
OpenGamingCollective:masterfrom
scardracs:leds/dynamic-lighting

Conversation

@scardracs

@scardracs scardracs commented Sep 4, 2026

Copy link
Copy Markdown

Summary

This pull request introduces the Dynamic Lighting LED class to the kernel and adds driver support in hid-asus for ASUS ROG Aura keyboards and chassis lightbars.
It provides a standard sysfs ABI for devices that expose multi-zone effects, palette programming, direct RGB frame streaming, and lighting power-state persistence, without requiring individual drivers to invent ad-hoc sysfs layouts.


Commits Overview

  1. leds: Add LED_DYNAMIC_LIGHTING flag to LED core
    • Defines LED_DYNAMIC_LIGHTING in struct led_classdev to enable runtime identification of Dynamic Lighting class devices, following the pattern of LED_MULTI_COLOR.
  2. leds: dynamic: Add Dynamic Lighting core class interface
    • Implements the new class (drivers/leds/led-class-dynamic.c, include/linux/led-dynamic-lighting.h) extending led_classdev.
    • Exposes common effect, speed, direction, and power-state controls, plus binary direct-buffer and frame write interfaces.
    • Serializes writes using led_access and the class mutex to ensure thread safety alongside LED triggers.
  3. docs: leds: Document the Dynamic Lighting class ABI
    • Documents the user-facing sysfs interface in Documentation/ABI/testing/sysfs-class-leds-dynamic and Documentation/leds/leds-class-dynamic.rst.
    • Updates Documentation/leds/index.rst and registers the subsystem files in MAINTAINERS.
  4. HID: asus: Add Dynamic Lighting support for Aura devices
    • Integrates Dynamic Lighting support into hid-asus.
    • Discovers keyboard layout and chassis lightbar zones via the Aura probe report.
    • Implements zone power unmasking (0xbd), zone activation (0xc0), and hardware effect engine programming (0xb3) with the firmware latch commit sequence (0xb5 SET -> 0xb4 COMMIT -> 0xb5 SET).
    • Supports direct per-key/lightbar packed RGB frame writes through the class direct-buffer streaming interface.
    • Fully preserves backward compatibility with the existing asus::kbd_backlight brightness control.

@scardracs
scardracs force-pushed the leds/dynamic-lighting branch 4 times, most recently from 005fb1f to c6ee973 Compare September 5, 2026 12:09
Comment thread drivers/leds/led-class-dynamic.c Outdated
@scardracs
scardracs force-pushed the leds/dynamic-lighting branch from c6ee973 to 2ce82cc Compare September 5, 2026 14:23
@scardracs

Copy link
Copy Markdown
Author

I've moved the patch to 7.2 in order to have some stability (7.3 is way too bugged as for now). When the situation will be better I'll move it back to 7.3. I leave that draft open for now

Comment thread Documentation/ABI/testing/sysfs-class-leds-dynamic Outdated
@scardracs
scardracs force-pushed the leds/dynamic-lighting branch from 2ce82cc to 45f6a76 Compare September 8, 2026 07:54
Define LED_DYNAMIC_LIGHTING flag in struct led_classdev to enable
runtime type identification for Dynamic Lighting class devices,
matching the established pattern used by LED_MULTI_COLOR.

Signed-off-by: Marco Scardovi <scardracs@disroot.org>
Add a dedicated Dynamic Lighting LED class for devices that expose
multi-LED effects, palette programming, direct frame streaming or
lighting state persistence through sysfs.

The new class extends struct led_classdev with common effect, speed,
direction and power-state controls, plus binary write interfaces for
packed RGB frames and device-specific frame payloads.

Registration validates the exported capabilities, exposes only the
attributes implemented by the driver, and serializes writes under
led_access and the class-private lock so drivers can coexist safely
with LED triggers.

This provides a common kernel ABI for complex lighting devices without
requiring each driver to invent its own sysfs layout.

Signed-off-by: Marco Scardovi <scardracs@disroot.org>
@scardracs
scardracs force-pushed the leds/dynamic-lighting branch from 45f6a76 to 1a38a2e Compare September 8, 2026 14:19
@scardracs scardracs changed the title Leds/dynamic lighting leds: dynamic: Add Dynamic Lighting class interface and Aura (hid-asus) support Sep 8, 2026
Document the Dynamic Lighting LED class ABI and user-facing sysfs
interface.

Describe the common attributes, the visibility rules for optional
controls, the discoverability attributes used by programmable devices,
and the current write semantics for the direct and frame binary
interfaces.

Also add the new document to the LED documentation index and register
it in MAINTAINERS.

Signed-off-by: Marco Scardovi <scardracs@disroot.org>
@scardracs
scardracs force-pushed the leds/dynamic-lighting branch from 1a38a2e to 4e550e9 Compare September 8, 2026 18:30
@scardracs

Copy link
Copy Markdown
Author

Added an aura:global that controls both keyboard and lightbar for those devices that don't have the ability to control them separately

Add Dynamic Lighting class support to hid-asus for Aura-capable ROG
keyboards and chassis lightbars.

The driver discovers the keyboard layout and lightbar presence through
the Aura probe report. When independent multi-zone lighting is requested
via the aura_split_zones module parameter, it registers independent
Dynamic Lighting class devices:
- "aura:global": global aggregate node operating directly on
  AURA_ZONE_ALL (0) with zone_type="global"
- "aura:keyboard": independent keyboard controller operating on
  AURA_ZONE_KEY1..4 with zone_type="keyboard" or "keyboard_per_key"
- "aura:lightbar": independent lightbar controller operating on native
  hardware zones AURA_ZONE_BAR_LEFT and AURA_ZONE_BAR_RIGHT with
  zone_type="lightbar"

On laptops where a lightbar is present (such as ROG Strix / SCAR), it
defaults to registering only "aura:global", directing effects to
AURA_ZONE_ALL to synchronize the entire chassis in hardware without
exposing split zone nodes that the hardware firmware does not support
independently. On models without a lightbar, it registers "aura:keyboard".

For controllers with direct streaming support, expose packed RGB frame
writes through the class direct buffer interface. Drive independent
keyboard and chassis lightbar lighting via the hardware effect engine
(0xb3) across zones 1..4 for keyboard and native hardware zones 6..7
for lightbar, followed by the firmware latch commit sequence (0xb5 SET ->
0xb4 COMMIT -> 0xb5 SET), ensuring setting static or animated effects on
one zone does not touch or interrupt the other.

Unmask keyboard and lightbar hardware power states during probe and
resume using report 0xbd without invalid zone commands. Drive hardware
animation and static effects independently on each zone, committing each
update via the firmware latch sequence (0xb5 SET -> 0xb4 COMMIT ->
0xb5 SET).

Probe the run-mode capability report before advertising supported
effects, fall back to a conservative built-in effect set when the
capability query is unavailable, and validate returned report lengths
before parsing them.

This adds a common sysfs ABI for Aura lighting without regressing the
existing asus::kbd_backlight brightness interface.

Signed-off-by: Marco Scardovi <scardracs@disroot.org>
Expose Dynamic Lighting class attributes on asus::kbd_backlight when
TUF RGB control is supported (kbd_rgb_dev).

Register the keyboard backlight via devm_led_classdev_dynamic_register,
providing native sysfs controls for standard effects (static, breathing,
spectrum cycle, rainbow, strobe), speed, palette colors, and power
state persistence via ACPI WMI method calls (0xb3 and 0xb4).

Preserve legacy kbd_rgb_mode and kbd_rgb_state sysfs attributes under
the device groups for backward compatibility with existing tools.

Signed-off-by: Marco Scardovi <scardracs@disroot.org>
@scardracs
scardracs force-pushed the leds/dynamic-lighting branch 2 times, most recently from 87effaa to 3a706b9 Compare September 9, 2026 07:37
…OG NVMe enclosures

ASUS ROG external NVMe enclosures (such as the ROG STRIX Arion,
USB ID 0b05:1932) are USB mass-storage devices with no HID interface.
Their addressable Aura RGB LEDs hang off an onboard ENE microcontroller
driven via 16-byte vendor SCSI commands on the same LUN as the storage.

Add the leds-asus-aura-scsi driver implementing an asus_aura SCSI device
handler. It matches INQUIRY vendor "ROG" and model "ESD-S1C", leaves disk
access completely untouched for the sd driver, and registers an instance
of the Dynamic Lighting class device (led_classdev_dynamic) uniquely named
asus-aura-scsi-<H_C_T_L>:rgb:indicator.

Hardware animation offloads (Off, Static, Breathing, Strobe, Spectrum Cycle,
Rainbow, Direct streaming), speed (0..4), direction (right/left), palette,
and direct RGB frame streaming via direct_buffer are fully integrated.
In addition, add the device to scsi_dh_blist for automatic binding upon plug.
@scardracs
scardracs force-pushed the leds/dynamic-lighting branch from 3a706b9 to a4d18f6 Compare September 9, 2026 07:42
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.

3 participants