Skip to content

Adding support for controlling the leds found on Intel NUC

Mauro Carvalho Chehab linux-doc linux-leds lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest17 patches 32 repliesIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/17docs: describe the API used to set NUC LEDsDocumentation/leds/index.rst Documentation/leds/leds-nuc.rst+448 -00 replies
2/17leds: add support for NUC WMI LEDsMAINTAINERS drivers/leds/Kconfig drivers/leds/Makefile +1 more+497 -00 replies
3/17leds: leds-nuc: detect WMI API detectiondrivers/leds/leds-nuc.c+30 -30 replies
4/17leds: leds-nuc: add support for changing S0 brightnessdrivers/leds/leds-nuc.c+79 -00 replies
5/17leds: leds-nuc: add all types of brightnessdrivers/leds/leds-nuc.c+249 -1200 replies
6/17leds: leds-nuc: allow changing the LED colorsdrivers/leds/leds-nuc.c+228 -166 replies
7/17leds: leds-nuc: add support for WMI API version 1.0drivers/leds/leds-nuc.c+99 -200 replies
8/17leds: leds-nuc: add basic support for NUC6 WMIdrivers/leds/leds-nuc.c+110 -320 replies
9/17leds: leds-nuc: add brightness and color for NUC6 APIdrivers/leds/leds-nuc.c+191 -70 replies
10/17leds: leds-nuc: Add support to blink behavior for NUC8/10drivers/leds/leds-nuc.c+322 -252 replies
11/17leds: leds-nuc: get rid of an unused variabledrivers/leds/leds-nuc.c+1 -30 replies
12/17leds: leds-nuc: implement blink control for NUC6drivers/leds/leds-nuc.c+267 -20 replies
13/17leds: leds-nuc: better detect NUC6/NUC7 devicesdrivers/leds/leds-nuc.c+15 -00 replies
14/17leds: leds-nuc: add support for HDD activity defaultdrivers/leds/leds-nuc.c+77 -00 replies
15/17leds: leds-nuc: fix software blink behavior logicdrivers/leds/leds-nuc.c+12 -180 replies
16/17leds: leds-nuc: add support for changing the ethernet type indicatordrivers/leds/leds-nuc.c+89 -016 replies
17/17leds: leds-nuc: add support for changing the power limit schemedrivers/leds/leds-nuc.c+93 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 00/17] Adding support for controlling the leds found on Intel NUC

This series add support for the LEDs found at Intel NUCs since NUC version 6.

On several NUC models, the function of the LEDs are controlled by the NUC firmware and are programmable, which allow them to indicate several different hardware events.

They can also be programmed to represent an userspace-driven event.

Some models come with single colored or dual-colored LEDs, but high end models have RGB LEDs.

Programming them can ether be done via BIOS or by the OS, however, BIOS settings are limited. So, the vendor offers a Windows application that allows to fully use the functionality provided by the firmware/hardware.

It should be noticed that there are 3 different API types, and there are already some OOT drivers that were written to support them, using procfs, each one using a different (and IMO confusing) API.

After looking at the existing drivers and not liking the uAPI interfaces there, and needed to ajust the LEDs again after BIOS config reset, as this is a recommended procedure after BIOS upgrades, I opted to write a new driver from scratch, unifying support for all different versions and using sysfs via the leds class.

It should be noticed that those devices use the ACPI Windows Management Interface (WMI). There are actually 3 different implementations for it:

- one for NUC6/NUC7, which has limited support for programming just two LEDs;
- a complely re-written interface for NUC8, which can program up to seven LEDs, named version 0.64;
- an extended version of the NUC8 API, added for NUC10, called version 1.0, with has a few differences from version 0.64.

Such WMI APIs are documented at:
- https://www.intel.com/content/www/us/en/support/articles/000023426/intel-nuc/intel-nuc-kits.html
- https://raw.githubusercontent.com/nomego/intel_nuc_led/master/specs/INTEL_WMI_LED_0.64.pdf
- https://www.intel.com/content/dam/support/us/en/documents/intel-nuc/WMI-Spec-Intel-NUC-NUC10ixFNx.pdf

It should be noticed that, I wrote this driver mainly for my NUC8 (NUC8i7HNK), but I also used a NUC6 in order to double-check if NUC6 support was not crashing. Yet, while the NUC6 model I have accepts the WMI LED API, it doesn't really work, as it seems that the BIOS of my NUC6 doesn't let userspace to program the LEDs.

I don't have any devices using NUC10 API, so the few differences between it and NUC8 API weren't tested.

Due to the lack of full tests on NUC6 and NUC10, and because I wrote a new uAPI that's different than the procfs-based ones found at the OOT drivers, IMO, the better would be to merge this via staging, but as Greg's feedback were to apply it directly under drivers/leds, this version was changed considering such premise.

PS. : after having the series accepted, I'll submit an extra patch for Documentation/ABI, summarizing the ABI documentation found on patch 01.

-

- v2:
- Added an ABI documentation at patch 01 and dropped the TODO;
- Removed the .remove function, as it was just printing a message;
- Add a check for a return code, as suggested by Dan Carpenter;
- Did some code cleanups as also suggested by Dan Carpenter;
- Changed the Kconfig description as suggested by Randy Dunlap.

Mauro Carvalho Chehab (17):
docs: describe the API used to set NUC LEDs
leds: add support for NUC WMI LEDs
leds: leds-nuc: detect WMI API detection
leds: leds-nuc: add support for changing S0 brightness
leds: leds-nuc: add all types of brightness
leds: leds-nuc: allow changing the LED colors
leds: leds-nuc: add support for WMI API version 1.0
leds: leds-nuc: add basic support for NUC6 WMI
leds: leds-nuc: add brightness and color for NUC6 API
leds: leds-nuc: Add support to blink behavior for NUC8/10
leds: leds-nuc: get rid of an unused variable
leds: leds-nuc: implement blink control for NUC6
leds: leds-nuc: better detect NUC6/NUC7 devices
leds: leds-nuc: add support for HDD activity default
leds: leds-nuc: fix software blink behavior logic
leds: leds-nuc: add support for changing the ethernet type indicator
leds: leds-nuc: add support for changing the power limit scheme

 Documentation/leds/index.rst    |    1 +
 Documentation/leds/leds-nuc.rst |  447 +++++++
 MAINTAINERS                     |    7 +
 drivers/leds/Kconfig            |    8 +
 drivers/leds/Makefile           |    1 +
 drivers/leds/leds-nuc.c         | 2097 +++++++++++++++++++++++++++++++
 6 files changed, 2561 insertions(+)
 create mode 100644 Documentation/leds/leds-nuc.rst
 create mode 100644 drivers/leds/leds-nuc.c
Signature · 1 line
2.31.1