Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Documentation: leds: improve readibility of multicolor doc

When reading the documentation of multicolor leds, the HTML output is
not easy to read. Improve it by adding a few markups, splitting the
console in a dedicated block.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Message-ID: <20250421-leds-doc-v1-1-9a32df7fc6f4@yoseli.org>

authored by

Jean-Michel Hautbois and committed by
Jonathan Corbet
422f5b78 8f82b560

+51 -31
+51 -31
Documentation/leds/leds-class-multicolor.rst
··· 18 18 led_class framework. The led_class framework is documented in led-class.rst 19 19 within this documentation directory. 20 20 21 - Each colored LED will be indexed under the multi_* files. The order of the 22 - colors will be arbitrary. The multi_index file can be read to determine the 21 + Each colored LED will be indexed under the ``multi_*`` files. The order of the 22 + colors will be arbitrary. The ``multi_index`` file can be read to determine the 23 23 color name to indexed value. 24 24 25 - The multi_index file is an array that contains the string list of the colors as 26 - they are defined in each multi_* array file. 25 + The ``multi_index`` file is an array that contains the string list of the colors as 26 + they are defined in each ``multi_*`` array file. 27 27 28 - The multi_intensity is an array that can be read or written to for the 28 + The ``multi_intensity`` is an array that can be read or written to for the 29 29 individual color intensities. All elements within this array must be written in 30 30 order for the color LED intensities to be updated. 31 31 32 32 Directory Layout Example 33 33 ======================== 34 - root:/sys/class/leds/multicolor:status# ls -lR 35 - -rw-r--r-- 1 root root 4096 Oct 19 16:16 brightness 36 - -r--r--r-- 1 root root 4096 Oct 19 16:16 max_brightness 37 - -r--r--r-- 1 root root 4096 Oct 19 16:16 multi_index 38 - -rw-r--r-- 1 root root 4096 Oct 19 16:16 multi_intensity 34 + .. code-block:: console 35 + 36 + root:/sys/class/leds/multicolor:status# ls -lR 37 + -rw-r--r-- 1 root root 4096 Oct 19 16:16 brightness 38 + -r--r--r-- 1 root root 4096 Oct 19 16:16 max_brightness 39 + -r--r--r-- 1 root root 4096 Oct 19 16:16 multi_index 40 + -rw-r--r-- 1 root root 4096 Oct 19 16:16 multi_intensity 41 + 42 + .. 39 43 40 44 Multicolor Class Brightness Control 41 45 =================================== ··· 47 43 intensity setting divided by the global max_brightness setting multiplied by 48 44 the requested brightness. 49 45 50 - led_brightness = brightness * multi_intensity/max_brightness 46 + ``led_brightness = brightness * multi_intensity/max_brightness`` 51 47 52 48 Example: 53 49 A user first writes the multi_intensity file with the brightness levels 54 50 for each LED that are necessary to achieve a certain color output from a 55 51 multicolor LED group. 56 52 57 - cat /sys/class/leds/multicolor:status/multi_index 58 - green blue red 53 + .. code-block:: console 59 54 60 - echo 43 226 138 > /sys/class/leds/multicolor:status/multi_intensity 55 + # cat /sys/class/leds/multicolor:status/multi_index 56 + green blue red 61 57 62 - red - 63 - intensity = 138 64 - max_brightness = 255 65 - green - 66 - intensity = 43 67 - max_brightness = 255 68 - blue - 69 - intensity = 226 70 - max_brightness = 255 58 + # echo 43 226 138 > /sys/class/leds/multicolor:status/multi_intensity 59 + 60 + red - 61 + intensity = 138 62 + max_brightness = 255 63 + green - 64 + intensity = 43 65 + max_brightness = 255 66 + blue - 67 + intensity = 226 68 + max_brightness = 255 69 + 70 + .. 71 71 72 72 The user can control the brightness of that multicolor LED group by writing the 73 73 global 'brightness' control. Assuming a max_brightness of 255 the user ··· 79 71 128 to the global brightness file then the values written to each LED will be 80 72 adjusted base on this value. 81 73 82 - cat /sys/class/leds/multicolor:status/max_brightness 83 - 255 84 - echo 128 > /sys/class/leds/multicolor:status/brightness 74 + .. code-block:: console 85 75 86 - adjusted_red_value = 128 * 138/255 = 69 87 - adjusted_green_value = 128 * 43/255 = 21 88 - adjusted_blue_value = 128 * 226/255 = 113 76 + # cat /sys/class/leds/multicolor:status/max_brightness 77 + 255 78 + # echo 128 > /sys/class/leds/multicolor:status/brightness 79 + 80 + .. 81 + 82 + .. code-block:: none 83 + 84 + adjusted_red_value = 128 * 138/255 = 69 85 + adjusted_green_value = 128 * 43/255 = 21 86 + adjusted_blue_value = 128 * 226/255 = 113 87 + 88 + .. 89 89 90 90 Reading the global brightness file will return the current brightness value of 91 91 the color LED group. 92 92 93 - cat /sys/class/leds/multicolor:status/brightness 94 - 128 93 + .. code-block:: console 94 + 95 + # cat /sys/class/leds/multicolor:status/brightness 96 + 128 97 + 98 + ..