Linux LED subsystem development
 help / color / mirror / Atom feed
* [PATCH] Documentation: leds: improve readibility of multicolor doc
@ 2025-04-21 16:48 Jean-Michel Hautbois
  2025-04-23  3:01 ` Bagas Sanjaya
  2025-05-06 13:15 ` Jonathan Corbet
  0 siblings, 2 replies; 5+ messages in thread
From: Jean-Michel Hautbois @ 2025-04-21 16:48 UTC (permalink / raw)
  To: Lee Jones, Pavel Machek, Jonathan Corbet
  Cc: linux-leds, linux-doc, linux-kernel, Jean-Michel Hautbois

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>
---
 Documentation/leds/leds-class-multicolor.rst | 82 +++++++++++++++++-----------
 1 file changed, 51 insertions(+), 31 deletions(-)

diff --git a/Documentation/leds/leds-class-multicolor.rst b/Documentation/leds/leds-class-multicolor.rst
index c57b98bfd38715b705c555efeb8e5f9076b1b787..c6b47b4093c47360b238b49d3cbfa055a9b484e5 100644
--- a/Documentation/leds/leds-class-multicolor.rst
+++ b/Documentation/leds/leds-class-multicolor.rst
@@ -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
 within this documentation directory.
 
-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
+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
 color name to indexed value.
 
-The multi_index file is an array that contains the string list of the colors as
-they are defined in each multi_* array file.
+The ``multi_index`` file is an array that contains the string list of the colors as
+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
 order for the color LED intensities to be updated.
 
 Directory Layout Example
 ========================
-root:/sys/class/leds/multicolor:status# ls -lR
--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
--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
+.. code-block:: console
+
+    root:/sys/class/leds/multicolor:status# ls -lR
+    -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
+    -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
 ===================================
@@ -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
 the requested brightness.
 
-led_brightness = brightness * multi_intensity/max_brightness
+``led_brightness = brightness * multi_intensity/max_brightness``
 
 Example:
 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
 multicolor LED group.
 
-cat /sys/class/leds/multicolor:status/multi_index
-green blue red
+.. code-block:: console
+
+    # cat /sys/class/leds/multicolor:status/multi_index
+    green blue red
 
-echo 43 226 138 > /sys/class/leds/multicolor:status/multi_intensity
+    # echo 43 226 138 > /sys/class/leds/multicolor:status/multi_intensity
 
-red -
-	intensity = 138
-	max_brightness = 255
-green -
-	intensity = 43
-	max_brightness = 255
-blue -
-	intensity = 226
-	max_brightness = 255
+    red -
+    	intensity = 138
+    	max_brightness = 255
+    green -
+    	intensity = 43
+    	max_brightness = 255
+    blue -
+    	intensity = 226
+    	max_brightness = 255
+
+..
 
 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
@@ -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
 adjusted base on this value.
 
-cat /sys/class/leds/multicolor:status/max_brightness
-255
-echo 128 > /sys/class/leds/multicolor:status/brightness
+.. code-block:: console
+
+    # cat /sys/class/leds/multicolor:status/max_brightness
+    255
+    # echo 128 > /sys/class/leds/multicolor:status/brightness
 
-adjusted_red_value = 128 * 138/255 = 69
-adjusted_green_value = 128 * 43/255 = 21
-adjusted_blue_value = 128 * 226/255 = 113
+..
+
+.. 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
 the color LED group.
 
-cat /sys/class/leds/multicolor:status/brightness
-128
+.. code-block:: console
+
+    # cat /sys/class/leds/multicolor:status/brightness
+    128
+
+..

---
base-commit: 9d7a0577c9db35c4cc52db90bc415ea248446472
change-id: 20250421-leds-doc-dd85db13fda4

Best regards,
-- 
Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Documentation: leds: improve readibility of multicolor doc
  2025-04-21 16:48 [PATCH] Documentation: leds: improve readibility of multicolor doc Jean-Michel Hautbois
@ 2025-04-23  3:01 ` Bagas Sanjaya
  2025-04-23  5:30   ` Jean-Michel Hautbois
  2025-05-06 13:15 ` Jonathan Corbet
  1 sibling, 1 reply; 5+ messages in thread
From: Bagas Sanjaya @ 2025-04-23  3:01 UTC (permalink / raw)
  To: Jean-Michel Hautbois, Lee Jones, Pavel Machek, Jonathan Corbet
  Cc: linux-leds, linux-doc, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1682 bytes --]

On Mon, Apr 21, 2025 at 06:48:10PM +0200, Jean-Michel Hautbois wrote:
> +.. code-block:: console
> +
> +    root:/sys/class/leds/multicolor:status# ls -lR

The equivalent is ``ls -lR /sys/class/leds/multicolor``.

> +    -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
> +    -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
> +
> +..
>  
> <snipped>...
>
> @@ -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
>  adjusted base on this value.
>  
> -cat /sys/class/leds/multicolor:status/max_brightness
> -255
> -echo 128 > /sys/class/leds/multicolor:status/brightness
> +.. code-block:: console
> +
> +    # cat /sys/class/leds/multicolor:status/max_brightness
> +    255
> +    # echo 128 > /sys/class/leds/multicolor:status/brightness
>  
> -adjusted_red_value = 128 * 138/255 = 69
> -adjusted_green_value = 128 * 43/255 = 21
> -adjusted_blue_value = 128 * 226/255 = 113
> +..
> +
> +.. code-block:: none
> +
> +    adjusted_red_value = 128 * 138/255 = 69
> +    adjusted_green_value = 128 * 43/255 = 21
> +    adjusted_blue_value = 128 * 226/255 = 113
> +
> +..

Are these adjusted values intended to be part of previous block on brightness
status? If not, I'd like to interleave these two blocks with "The adjusted
values are now::".

Thanks.

-- 
An old man doll... just what I always wanted! - Clara

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Documentation: leds: improve readibility of multicolor doc
  2025-04-23  3:01 ` Bagas Sanjaya
@ 2025-04-23  5:30   ` Jean-Michel Hautbois
  2025-04-24  1:44     ` Bagas Sanjaya
  0 siblings, 1 reply; 5+ messages in thread
From: Jean-Michel Hautbois @ 2025-04-23  5:30 UTC (permalink / raw)
  To: Bagas Sanjaya, Lee Jones, Pavel Machek, Jonathan Corbet
  Cc: linux-leds, linux-doc, linux-kernel

Hi Bagas,

On 23/04/2025 05:01, Bagas Sanjaya wrote:
> On Mon, Apr 21, 2025 at 06:48:10PM +0200, Jean-Michel Hautbois wrote:
>> +.. code-block:: console
>> +
>> +    root:/sys/class/leds/multicolor:status# ls -lR
> 
> The equivalent is ``ls -lR /sys/class/leds/multicolor``.
> 

This patch was only to add markups, I did not want to change the content 
more than that. The result of ls -lR must also be in the same 
code-block, so I am not certain your proposal is equivalent ?

>> +    -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
>> +    -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
>> +
>> +..
>>   
>> <snipped>...
>>
>> @@ -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
>>   adjusted base on this value.
>>   
>> -cat /sys/class/leds/multicolor:status/max_brightness
>> -255
>> -echo 128 > /sys/class/leds/multicolor:status/brightness
>> +.. code-block:: console
>> +
>> +    # cat /sys/class/leds/multicolor:status/max_brightness
>> +    255
>> +    # echo 128 > /sys/class/leds/multicolor:status/brightness
>>   
>> -adjusted_red_value = 128 * 138/255 = 69
>> -adjusted_green_value = 128 * 43/255 = 21
>> -adjusted_blue_value = 128 * 226/255 = 113
>> +..
>> +
>> +.. code-block:: none
>> +
>> +    adjusted_red_value = 128 * 138/255 = 69
>> +    adjusted_green_value = 128 * 43/255 = 21
>> +    adjusted_blue_value = 128 * 226/255 = 113
>> +
>> +..
> 
> Are these adjusted values intended to be part of previous block on brightness
> status? If not, I'd like to interleave these two blocks with "The adjusted
> values are now::".

Interesting, yes, it could be added.

Thanks !
JM

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Documentation: leds: improve readibility of multicolor doc
  2025-04-23  5:30   ` Jean-Michel Hautbois
@ 2025-04-24  1:44     ` Bagas Sanjaya
  0 siblings, 0 replies; 5+ messages in thread
From: Bagas Sanjaya @ 2025-04-24  1:44 UTC (permalink / raw)
  To: Jean-Michel Hautbois, Lee Jones, Pavel Machek, Jonathan Corbet
  Cc: linux-leds, linux-doc, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2317 bytes --]

On Wed, Apr 23, 2025 at 07:30:08AM +0200, Jean-Michel Hautbois wrote:
> Hi Bagas,
> 
> On 23/04/2025 05:01, Bagas Sanjaya wrote:
> > On Mon, Apr 21, 2025 at 06:48:10PM +0200, Jean-Michel Hautbois wrote:
> > > +.. code-block:: console
> > > +
> > > +    root:/sys/class/leds/multicolor:status# ls -lR
> > 
> > The equivalent is ``ls -lR /sys/class/leds/multicolor``.
> > 
> 
> This patch was only to add markups, I did not want to change the content
> more than that. The result of ls -lR must also be in the same code-block, so
> I am not certain your proposal is equivalent ?

I mean the output is same. But, I agree with your approach to only add markup.

> 
> > > +    -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
> > > +    -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
> > > +
> > > +..
> > > <snipped>...
> > > 
> > > @@ -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
> > >   adjusted base on this value.
> > > -cat /sys/class/leds/multicolor:status/max_brightness
> > > -255
> > > -echo 128 > /sys/class/leds/multicolor:status/brightness
> > > +.. code-block:: console
> > > +
> > > +    # cat /sys/class/leds/multicolor:status/max_brightness
> > > +    255
> > > +    # echo 128 > /sys/class/leds/multicolor:status/brightness
> > > -adjusted_red_value = 128 * 138/255 = 69
> > > -adjusted_green_value = 128 * 43/255 = 21
> > > -adjusted_blue_value = 128 * 226/255 = 113
> > > +..
> > > +
> > > +.. code-block:: none
> > > +
> > > +    adjusted_red_value = 128 * 138/255 = 69
> > > +    adjusted_green_value = 128 * 43/255 = 21
> > > +    adjusted_blue_value = 128 * 226/255 = 113
> > > +
> > > +..
> > 
> > Are these adjusted values intended to be part of previous block on brightness
> > status? If not, I'd like to interleave these two blocks with "The adjusted
> > values are now::".
> 
> Interesting, yes, it could be added.

OK, thanks!

-- 
An old man doll... just what I always wanted! - Clara

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Documentation: leds: improve readibility of multicolor doc
  2025-04-21 16:48 [PATCH] Documentation: leds: improve readibility of multicolor doc Jean-Michel Hautbois
  2025-04-23  3:01 ` Bagas Sanjaya
@ 2025-05-06 13:15 ` Jonathan Corbet
  1 sibling, 0 replies; 5+ messages in thread
From: Jonathan Corbet @ 2025-05-06 13:15 UTC (permalink / raw)
  To: Jean-Michel Hautbois, Lee Jones, Pavel Machek
  Cc: linux-leds, linux-doc, linux-kernel, Jean-Michel Hautbois

Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org> writes:

> 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>
> ---
>  Documentation/leds/leds-class-multicolor.rst | 82 +++++++++++++++++-----------
>  1 file changed, 51 insertions(+), 31 deletions(-)

Applied, thanks.

jon

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-05-06 13:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-21 16:48 [PATCH] Documentation: leds: improve readibility of multicolor doc Jean-Michel Hautbois
2025-04-23  3:01 ` Bagas Sanjaya
2025-04-23  5:30   ` Jean-Michel Hautbois
2025-04-24  1:44     ` Bagas Sanjaya
2025-05-06 13:15 ` Jonathan Corbet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox