leds: asus-aura-scsi: Add ASUS Aura RGB LED driver for ROG NVMe enclosures
Subsystems (4)
A message that is not in the archive (sent off-list or not yet received): [email protected]
RFC v10 1/1 leds: asus-aura-scsi: Add ASUS Aura RGB LED driver for ROG NVMe enclosures
ASUS ROG external NVMe enclosures (ROG STRIX Arion, USB 0b05:1932) are plain USB mass-storage devices with no HID interface: the Aura LEDs hang off an ENE controller driven by vendor SCSI commands on the same LUN as the disk. The enclosure has 4 independently addressable LEDs, verified on hardware.
Register a scsi_device_handler matched by INQUIRY (vendor "ROG", model "ESD-S1C"); it does not claim the sdev (sd keeps owning the disk) and exposes each LED as a multicolor LED class device, /sys/class/leds/asus-arion-0-0-0-0::led-0 through led-3. The H:C:T:L part of the sdev name keeps the names unique when more than one enclosure is connected, with its colons flattened to dashes. The color section stays empty, since multicolor LEDs enumerate their palette via multi_intensity, and the four identical zones use the function name with a "-N" ordinal, as the naming section in Documentation/leds/leds-class.rst asks for.
Protocol: a 16-byte vendor CDB (opcode 0xec, 'A' 'S' signature, BE16 register index, argument count in byte 13), modelled by struct ene_cdb. MODE 0x8021 (Static) must be written first in every sequence or the device ignores it; colours go to 0x8160 + 3 * led and 0x8100 + 3 * led (3 bytes, wire order R, B, G; both tables are written because firmware revisions pull from one or the other); APPLY 0x80a0 takes 0x01 to apply; the controller also accepts 0xaa to save the state to its flash, which this driver never sends: the LED class interface is runtime state and does not promise persistence across power cycles, and a save on every update would wear the controller flash. The colour reverts to the stored default on power cycle, like any other runtime-only LED.
The CDB cannot go through scsi_execute_cmd(): it sizes the command via scsi_command_size(opcode), which maps vendor opcode 0xec to 10 bytes, so byte 13 is dropped and the device silently ignores the write (GOOD status, no error). scsi_execute_cmd() also offers no way to override the derived length. The request is therefore built with scsi_alloc_request(), which initializes the scsi_cmnd parts a passthrough needs, with cmd_len set to the CDB size, mirroring what SG_IO does from userspace. A 5 s timeout and a single retry-less quiet submission cover the register writes.
The write payload is copied into a per-device buffer before it is mapped with blk_rq_map_kern(), so no stack memory is ever mapped for DMA (VMAP_STACK).
brightness_set only caches the colour and marks the LED pending under a spinlock; led_mc_calc_color_components() runs under that lock too, because it writes the shared subled_info array and trigger events call led_set_brightness() without the led_access lock that serializes sysfs stores. A single work item per enclosure then snapshots the pending LEDs and runs one ENE sequence for all of them. Funneling every update through one work item keeps the sequences from interleaving between concurrent LED updates and batches multi-LED updates into a single APPLY. A re-queued run with nothing pending returns before touching the device, so it cannot wear the flash with a pointless SAVE, and the lock keeps a colour write from being reordered after its pending flag on weakly ordered architectures.
--- drivers/leds/rgb/Kconfig | 13 + drivers/leds/rgb/Makefile | 1 + drivers/leds/rgb/leds-asus-aura-scsi.c | 404 +++++++++++++++++++++++++ 3 files changed, 418 insertions(+) create mode 100644 drivers/leds/rgb/leds-asus-aura-scsi.c
drivers/leds/rgb/Kconfig +13 -0
@@ -2,6 +2,19 @@ if LEDS_CLASS_MULTICOLOR +config LEDS_ASUS_AURA_SCSI + tristate "ASUS Aura RGB LEDs on ROG external NVMe enclosures" + depends on SCSI + help + Say Y here if you want to control the RGB LEDs of ASUS ROG + external NVMe enclosures such as the ROG STRIX Arion. The LEDs + sit behind an ENE controller on the drive's SCSI LUN and are + programmed with vendor commands; each of the four LED zones is + exposed as a multicolor LED class device. + + To compile this driver as a module, choose M here: the module + will be called leds-asus-aura-scsi. + config LEDS_GROUP_MULTICOLOR tristate "LEDs group multi-color support" depends on OF
drivers/leds/rgb/Makefile +1 -0
@@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_LEDS_ASUS_AURA_SCSI) += leds-asus-aura-scsi.o obj-$(CONFIG_LEDS_GROUP_MULTICOLOR) += leds-group-multicolor.o obj-$(CONFIG_LEDS_KTD202X) += leds-ktd202x.o obj-$(CONFIG_LEDS_LP5812) += leds-lp5812.o
drivers/leds/rgb/leds-asus-aura-scsi.c new file +404 -0
404 lines not on this page · raw message
Signature · 1 line
2.55.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 20 lines
ASUS ROG external NVMe enclosures (ROG STRIX Arion, USB 0b05:1932) are plain USB mass-storage devices with no HID interface: the Aura LEDs hang off an ENE controller driven by vendor SCSI commands on the same LUN as the disk. The enclosure has 4 independently addressable LEDs, verified on hardware.
Register a
scsi_device_handlermatched by INQUIRY (vendor "ROG", model "ESD-S1C"); it does not claim the sdev (sd keeps owning the disk) and exposes each LED as a multicolor LED class device, /sys/class/leds/asus-arion-0-0-0-0::led-0 through led-3. The H:C:T:L part of the sdev name keeps the names unique when more than one enclosure is connected, with its colons flattened to dashes. The color section stays empty, since multicolor LEDs enumerate their palette viamulti_intensity, and the four identical zones use the function name with a "-N" ordinal, as the naming section in [ ... ]
cannot wear the flash with a pointless SAVE, and the lock keeps a colour write from being reordered after its pending flag on weakly ordered architectures.
Quoted 1 line
Signed-off-by Liang Haowen <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
The 0/1 cover letter for this series was blocked by my outgoing mail provider and never reached the lists; resending its content here.
v10, wiring the driver into the tree. A driver source file without Kconfig and Makefile entries is dead code in the tree, so this version adds them: LEDS_ASUS_AURA_SCSI sits inside the LEDS_CLASS_MULTICOLOR block in drivers/leds/rgb/Kconfig with a depends on SCSI, and the Makefile line beside the other rgb drivers.
The only code change is strscpy() passing the buffer size explicitly now. The two-argument form is supported by the current string.h macros, but with the size written out the call builds on any tree.
v10 was verified on hardware again after these changes: built with clang against 7.2.4, the four LEDs set to independent colours and confirmed by eye, 60 sequential and 100 concurrent updates, the sdev deleted mid-write (zero splats, clean detach), rmmod after detach, and a fresh attach through a host scan.
The interface direction is unchanged from v9: the LED side will move onto Marco's Dynamic Lighting class (OpenGamingCollective/linux-unstable#17) once that settles.
Re: (subset) [RFC v10 1/1] leds: asus-aura-scsi: Add ASUS Aura RGB LED driver for ROG NVMe enclosures
In reply to Liang HaowenQuoted 17 lines · Liang Haowen
ASUS ROG external NVMe enclosures (ROG STRIX Arion, USB 0b05:1932) are plain USB mass-storage devices with no HID interface: the Aura LEDs hang off an ENE controller driven by vendor SCSI commands on the same LUN as the disk. The enclosure has 4 independently addressable LEDs, verified on hardware.
Register a
scsi_device_handlermatched by INQUIRY (vendor "ROG", model "ESD-S1C"); it does not claim the sdev (sd keeps owning the disk) and exposes each LED as a multicolor LED class device, /sys/class/leds/asus-arion-0-0-0-0::led-0 through led-3. The H:C:T:L part of the sdev name keeps the names unique when more than one enclosure is connected, with its colons flattened to dashes. The color section stays empty, since multicolor LEDs enumerate their palette viamulti_intensity, and the four identical zones use the function name with a "-N" ordinal, as the naming section inDocumentation/leds/leds-class.rstasks for.
Quoted 1 line
[...]
Applied, thanks!
[1/1] leds: asus-aura-scsi: Add ASUS Aura RGB LED driver for ROG NVMe enclosures
commit: e3ea86f2c378b5ba6355712f09566eec44eb16bf
--
Lee Jones [李琼斯]
Re: (subset) [RFC v10 1/1] leds: asus-aura-scsi: Add ASUS Aura RGB LED driver for ROG NVMe enclosures
Thanks, Lee. Your reviews along the way made the driver much better, and I'm glad to see it land.
Liang
Lee Jones
maintainerRe: (subset) [RFC v10 1/1] leds: asus-aura-scsi: Add ASUS Aura RGB LED driver for ROG NVMe enclosures
Quoted 2 lines · Liang Haowen
Thanks, Lee. Your reviews along the way made the driver much better, and I'm glad to see it land.
You're very welcome.
Signature · 1 line
Lee Jones