mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
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>
This commit is contained in:
committed by
Jonathan Corbet
parent
8f82b560c5
commit
422f5b78bf
@@ -18,24 +18,28 @@ array. These files are children under the LED parent node created by the
|
|||||||
led_class framework. The led_class framework is documented in led-class.rst
|
led_class framework. The led_class framework is documented in led-class.rst
|
||||||
within this documentation directory.
|
within this documentation directory.
|
||||||
|
|
||||||
Each colored LED will be indexed under the multi_* files. The order of the
|
Each colored LED will be indexed under the ``multi_*`` files. The order of the
|
||||||
colors will be arbitrary. The multi_index file can be read to determine the
|
colors will be arbitrary. The ``multi_index`` file can be read to determine the
|
||||||
color name to indexed value.
|
color name to indexed value.
|
||||||
|
|
||||||
The multi_index file is an array that contains the string list of the colors as
|
The ``multi_index`` file is an array that contains the string list of the colors as
|
||||||
they are defined in each multi_* array file.
|
they are defined in each ``multi_*`` array file.
|
||||||
|
|
||||||
The multi_intensity is an array that can be read or written to for the
|
The ``multi_intensity`` is an array that can be read or written to for the
|
||||||
individual color intensities. All elements within this array must be written in
|
individual color intensities. All elements within this array must be written in
|
||||||
order for the color LED intensities to be updated.
|
order for the color LED intensities to be updated.
|
||||||
|
|
||||||
Directory Layout Example
|
Directory Layout Example
|
||||||
========================
|
========================
|
||||||
root:/sys/class/leds/multicolor:status# ls -lR
|
.. code-block:: console
|
||||||
-rw-r--r-- 1 root root 4096 Oct 19 16:16 brightness
|
|
||||||
-r--r--r-- 1 root root 4096 Oct 19 16:16 max_brightness
|
root:/sys/class/leds/multicolor:status# ls -lR
|
||||||
-r--r--r-- 1 root root 4096 Oct 19 16:16 multi_index
|
-rw-r--r-- 1 root root 4096 Oct 19 16:16 brightness
|
||||||
-rw-r--r-- 1 root root 4096 Oct 19 16:16 multi_intensity
|
-r--r--r-- 1 root root 4096 Oct 19 16:16 max_brightness
|
||||||
|
-r--r--r-- 1 root root 4096 Oct 19 16:16 multi_index
|
||||||
|
-rw-r--r-- 1 root root 4096 Oct 19 16:16 multi_intensity
|
||||||
|
|
||||||
|
..
|
||||||
|
|
||||||
Multicolor Class Brightness Control
|
Multicolor Class Brightness Control
|
||||||
===================================
|
===================================
|
||||||
@@ -43,27 +47,31 @@ The brightness level for each LED is calculated based on the color LED
|
|||||||
intensity setting divided by the global max_brightness setting multiplied by
|
intensity setting divided by the global max_brightness setting multiplied by
|
||||||
the requested brightness.
|
the requested brightness.
|
||||||
|
|
||||||
led_brightness = brightness * multi_intensity/max_brightness
|
``led_brightness = brightness * multi_intensity/max_brightness``
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
A user first writes the multi_intensity file with the brightness levels
|
A user first writes the multi_intensity file with the brightness levels
|
||||||
for each LED that are necessary to achieve a certain color output from a
|
for each LED that are necessary to achieve a certain color output from a
|
||||||
multicolor LED group.
|
multicolor LED group.
|
||||||
|
|
||||||
cat /sys/class/leds/multicolor:status/multi_index
|
.. code-block:: console
|
||||||
green blue red
|
|
||||||
|
|
||||||
echo 43 226 138 > /sys/class/leds/multicolor:status/multi_intensity
|
# cat /sys/class/leds/multicolor:status/multi_index
|
||||||
|
green blue red
|
||||||
|
|
||||||
red -
|
# echo 43 226 138 > /sys/class/leds/multicolor:status/multi_intensity
|
||||||
intensity = 138
|
|
||||||
max_brightness = 255
|
red -
|
||||||
green -
|
intensity = 138
|
||||||
intensity = 43
|
max_brightness = 255
|
||||||
max_brightness = 255
|
green -
|
||||||
blue -
|
intensity = 43
|
||||||
intensity = 226
|
max_brightness = 255
|
||||||
max_brightness = 255
|
blue -
|
||||||
|
intensity = 226
|
||||||
|
max_brightness = 255
|
||||||
|
|
||||||
|
..
|
||||||
|
|
||||||
The user can control the brightness of that multicolor LED group by writing the
|
The user can control the brightness of that multicolor LED group by writing the
|
||||||
global 'brightness' control. Assuming a max_brightness of 255 the user
|
global 'brightness' control. Assuming a max_brightness of 255 the user
|
||||||
@@ -71,16 +79,28 @@ may want to dim the LED color group to half. The user would write a value of
|
|||||||
128 to the global brightness file then the values written to each LED will be
|
128 to the global brightness file then the values written to each LED will be
|
||||||
adjusted base on this value.
|
adjusted base on this value.
|
||||||
|
|
||||||
cat /sys/class/leds/multicolor:status/max_brightness
|
.. code-block:: console
|
||||||
255
|
|
||||||
echo 128 > /sys/class/leds/multicolor:status/brightness
|
|
||||||
|
|
||||||
adjusted_red_value = 128 * 138/255 = 69
|
# cat /sys/class/leds/multicolor:status/max_brightness
|
||||||
adjusted_green_value = 128 * 43/255 = 21
|
255
|
||||||
adjusted_blue_value = 128 * 226/255 = 113
|
# echo 128 > /sys/class/leds/multicolor:status/brightness
|
||||||
|
|
||||||
|
..
|
||||||
|
|
||||||
|
.. code-block:: none
|
||||||
|
|
||||||
|
adjusted_red_value = 128 * 138/255 = 69
|
||||||
|
adjusted_green_value = 128 * 43/255 = 21
|
||||||
|
adjusted_blue_value = 128 * 226/255 = 113
|
||||||
|
|
||||||
|
..
|
||||||
|
|
||||||
Reading the global brightness file will return the current brightness value of
|
Reading the global brightness file will return the current brightness value of
|
||||||
the color LED group.
|
the color LED group.
|
||||||
|
|
||||||
cat /sys/class/leds/multicolor:status/brightness
|
.. code-block:: console
|
||||||
128
|
|
||||||
|
# cat /sys/class/leds/multicolor:status/brightness
|
||||||
|
128
|
||||||
|
|
||||||
|
..
|
||||||
|
|||||||
Reference in New Issue
Block a user