Re: [PATCH v9 01/15] leds: multicolor: Add sysfs interface definition

From: Dan Murphy
Date: Thu Sep 26 2019 - 08:03:33 EST


Pavel

On 9/26/19 6:10 AM, Pavel Machek wrote:
Hi!

diff --git a/Documentation/leds/leds-class-multicolor.rst b/Documentation/leds/leds-class-multicolor.rst
new file mode 100644
index 000000000000..87a1588d7619
--- /dev/null
+++ b/Documentation/leds/leds-class-multicolor.rst
@@ -0,0 +1,96 @@
+====================================
+Multi Color LED handling under Linux
+====================================
+
+Description
+===========
+The multi color class groups monochrome LEDs and allows controlling two
+aspects of the final combined color: hue and lightness. The former is
+controlled via <color>_intensity files and the latter is controlled
+via brightness file.
+
+For more details on hue and lightness notions please refer to
+https://en.wikipedia.org/wiki/CIECAM02.
+
+Note that intensity files only cache the written value and the actual
+change of hardware state occurs upon writing brightness file. This
+allows for changing many factors of the perceived color in a virtually
+unnoticeable way for the human observer.
So unlike previous versions, userspace will need to write 4 files
instead of one in the common case.

Request was made here in v5 of the patchset

https://lore.kernel.org/patchwork/patch/1126685/



+Directory Layout Example
+========================
+root:/sys/class/leds/rgb:grouped_leds# ls -lR colors/
+-rw-rwxr-- 1 root root 4096 Jul 7 03:10 red_max_intensity
+--w--wx-w- 1 root root 4096 Jul 7 03:10 red_intensity
+-rw-rwxr-- 1 root root 4096 Jul 7 03:10 green_max_intensity
+--w--wx-w- 1 root root 4096 Jul 7 03:10 green_intensity
+-rw-rwxr-- 1 root root 4096 Jul 7 03:10 blue_max_intensity
+--w--wx-w- 1 root root 4096 Jul 7 03:10 blue_intensity
Permissions are way off here.
Yes Jacek made a comment in the code about octals.

+A user first writes the color LED brightness file with the brightness level that
+is necessary to achieve a blueish violet output from the RGB LED group.
+
+echo 138 > /sys/class/leds/rgb:grouped_leds/red_intensity
+echo 43 > /sys/class/leds/rgb:grouped_leds/green_intensity
+echo 226 > /sys/class/leds/rgb:grouped_leds/blue_intensity
No, you can't tell what kind of color this will result in.

I tested this combination on two devices (LP5523 and LP50xx) and it was a blueish violet.

Will you be on ELCE/OSS in Lyon?

Unfortunately no.

Dan


Best regards,
Pavel