linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Dan Murphy <dmurphy@ti.com>, pavel@ucw.cz
Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/9] documention: leds: Add multicolor class documentation
Date: Mon, 29 Jul 2019 22:46:50 +0200	[thread overview]
Message-ID: <bdbe95b0-83c8-53a6-1be0-1a8f43a0810c@gmail.com> (raw)
In-Reply-To: <20190725182818.29556-3-dmurphy@ti.com>

Dan,

Now we will need this in rst format. It doesn't involve
much tweaking to the txt, but some details like links
to other documents can be enhanced.

I've also come across an issue of lack of line break after listed quoted
strings but I don't see such occurrence here. There might be still
some other quirks emerging after translating rst to html format.

Please check Documentation/doc-guide/sphinx.rst for starter.

On 7/25/19 8:28 PM, Dan Murphy wrote:
> Add the support documentation on the multicolor LED framework.
> This document defines the directores and file generated by the

s/directores/directories/

> multicolor framework.  It also documents usage.
> 
> Signed-off-by: Dan Murphy <dmurphy@ti.com>
> ---
>  Documentation/leds/leds-class-multicolor.txt | 152 +++++++++++++++++++
>  1 file changed, 152 insertions(+)
>  create mode 100644 Documentation/leds/leds-class-multicolor.txt
> 
> diff --git a/Documentation/leds/leds-class-multicolor.txt b/Documentation/leds/leds-class-multicolor.txt
> new file mode 100644
> index 000000000000..3b354e523660
> --- /dev/null
> +++ b/Documentation/leds/leds-class-multicolor.txt
> @@ -0,0 +1,152 @@
> +
> +Multi Color LED handling under Linux
> +=================================================
> +
> +Author: Dan Murphy <dmurphy@ti.com>
> +
> +Description
> +-----------
> +There are varying monochrome LED colors available for application.  These
> +LEDs can be used as a single use case LED or can be mixed with other color
> +LEDs to produce the full spectrum of color.  Color LEDs that are grouped
> +can be presented under a single LED node with individual color control.
> +The multicolor class groups these LEDs and allows dynamically setting the value
> +of a single LED or setting the intensity values of the LEDs in the group and
> +updating the LEDs virtually simultaneously.
> +
> +Multicolor Class Control
> +-------------------------
> +The multicolor class presents the LED groups under a directory called "colors".
> +This directory is a child under the LED parent node created by the led_class
> +framework.  The led_class framework is documented in led-class.txt within this
> +documentation directory.
> +
> +Each colored LED is given its own directory.  These directories can be, but not
> +limited to red, green, blue, white, amber, yellow and violet.  Under these

Similarly as in 1/9 please refer to the document with available LED
colors and mention that required color should be added if it is
missing.

> +directories the intensity and max_intensity files are presented for each LED.
> +
> +
> +Directory Layout Example
> +------------------------
> +root:/sys/class/leds/rgb:grouped_leds# ls -lR colors/
> +colors/:
> +drwxr-xr-x    2 root     root             0 Jun 28 20:21 blue
> +drwxr-xr-x    2 root     root             0 Jun 28 20:21 green
> +drwxr-xr-x    2 root     root             0 Jun 28 20:21 red
> +-rw-------    1 root     root          4096 Jun 28 20:21 color_mix
> +
> +colors/blue:
> +-rw-------    1 root     root          4096 Jun 28 20:21 intensity
> +-r--------    1 root     root          4096 Jun 28 20:27 max_intensity
> +-r--------    1 root     root          4096 Jun 28 20:21 color_id
> +
> +colors/green:
> +-rw-------    1 root     root          4096 Jun 28 20:22 intensity
> +-r--------    1 root     root          4096 Jun 28 20:27 max_intensity
> +-r--------    1 root     root          4096 Jun 28 20:21 color_id
> +
> +colors/red:
> +-rw-------    1 root     root          4096 Jun 28 20:21 intensity
> +-r--------    1 root     root          4096 Jun 28 20:27 max_intensity
> +-r--------    1 root     root          4096 Jun 28 20:21 color_id
> +
> +Multicolor Color Mixing
> +-----------------------
> +Multicolor monochrome LEDs intensity can be modified and mixed to produce a
> +varying array of colors.  The color_mix file gives the user the ability to write
> +all the monochrome LEDs registered in the directory with a single call.
> +To create a specific color from monochrome LEDs the color_mix file needs to be
> +written with each color's intensity.  The order in which the monochrome LEDs
> +should be written is based on the colors color_id.
> +
> +For example:
> +cat /sys/class/leds/rgb:grouped_leds/red/color_id
> +0
> +cat /sys/class/leds/rgb:grouped_leds/green/color_id
> +1
> +cat /sys/class/leds/rgb:grouped_leds/blue/color_id
> +2
> +
> +red - color_id = 0
> +green - color_id = 1
> +blue - color_id = 2
> +
> +These id's are the order in which to write the color_mix file.
> +
> +echo "<red> <green> <blue>" > color_mix
> +
> +echo "80 00 80" > color_mix
> +
> +The order of the monochrome LEDs are determined during multicolor class
> +registration and will not change unless unregistered and re-registered.
> +
> +Other example with amber monochrome LED:
> +blue - color_id = 0
> +amber - color_id = 1
> +
> +In this exampe blue is at ID 0 and amber ID is 1 so the user would write

s/exampe/example/

> +echo "<blue> <amber>" > color_mix
> +
> +echo "38 80" > color_mix
> +
> +If a single monochrome LED needs to be modified then the user would write the
> +colors/<color>/intensity file.
> +
> +
> +Multicolor Class Brightness Control
> +-----------------------------------
> +The multiclor class framework will calculate each monochrome LEDs intensity.
> +
> +The brightness level for each LED is calculated based on the color LED
> +intensity setting divided by the color LED max intensity setting multiplied by
> +the requested value.
> +
> +led_brightness = requested_value * led_color_intensity/led_color_max_intensity
> +
> +Example:
> +Three LEDs are present in the group as defined in "Directory Layout Example"
> +within this document.
> +
> +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
> +
> +red -
> +	intensity = 138
> +	max_intensity = 255
> +green -
> +	intensity = 43
> +	max_intensity = 255
> +blue -
> +	intensity = 226
> +	max_intensity = 255
> +
> +The user can control the brightness of that RGB group by writing the parent
> +'brightness' control.  Assuming a parent max_brightness of 255 the user may want
> +to dim the LED color group to half.  The user would write a value of 128 to the
> +parent brightness file then the values written to each LED will be adjusted
> +base on this value

s/base/based/

> +
> +cat /sys/class/leds/rgb:grouped_leds/max_brightness
> +255
> +echo 128 > /sys/class/leds/rgb:grouped_leds/brightness
> +
> +adjusted_red_value = 128 * 138/255 = 69
> +adjusted_green_value = 128 * 43/255 = 21
> +adjusted_blue_value = 128 * 226/255 = 113
> +
> +Reading the parent brightness file will return the current brightness value of
> +the color LED group.
> +
> +cat /sys/class/leds/rgb:grouped_leds/max_brightness
> +255
> +
> +echo 128 > /sys/class/leds/rgb:grouped_leds/brightness
> +
> +cat /sys/class/leds/rgb:grouped_leds/max_brightness

s/max_brightness/brightness/

But I'd skip the three above examples - they are trivial and this part
of the interface works identically as the current LED class interface.

> +128
> +
> +
> 

-- 
Best regards,
Jacek Anaszewski



  reply	other threads:[~2019-07-29 20:46 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-25 18:28 [PATCH v4 0/9] Multicolor Framwork Dan Murphy
2019-07-25 18:28 ` [PATCH v4 1/9] leds: multicolor: Add sysfs interface definition Dan Murphy
2019-07-29 20:45   ` Jacek Anaszewski
2019-08-27 16:54     ` Dan Murphy
2019-07-25 18:28 ` [PATCH v4 2/9] documention: leds: Add multicolor class documentation Dan Murphy
2019-07-29 20:46   ` Jacek Anaszewski [this message]
2019-07-25 18:28 ` [PATCH v4 3/9] dt: bindings: Add multicolor class dt bindings documention Dan Murphy
2019-07-29 20:47   ` Jacek Anaszewski
2019-07-25 18:28 ` [PATCH v4 4/9] dt-bindings: leds: Add multicolor ID to the color ID list Dan Murphy
2019-07-25 18:28 ` [PATCH v4 5/9] " Dan Murphy
2019-07-25 18:28 ` [PATCH v4 6/9] leds: multicolor: Introduce a multicolor class definition Dan Murphy
2019-07-29 20:50   ` Jacek Anaszewski
2019-07-31 19:06     ` Dan Murphy
2019-07-31 20:44       ` Jacek Anaszewski
2019-08-02 14:14         ` Dan Murphy
2019-08-02 19:27           ` Jacek Anaszewski
2019-07-25 18:28 ` [PATCH v4 7/9] dt: bindings: lp50xx: Introduce the lp50xx family of RGB drivers Dan Murphy
2019-07-25 18:28 ` [PATCH v4 8/9] leds: lp50xx: Add the LP50XX family of the RGB LED driver Dan Murphy
2019-07-30 21:24   ` Jacek Anaszewski
2019-07-31 18:46     ` Dan Murphy
2019-07-25 18:28 ` [PATCH v4 9/9] leds: Update the lp55xx to use the multi color framework Dan Murphy
2019-07-31 18:45   ` Jacek Anaszewski
2019-07-31 18:55     ` Dan Murphy
2019-07-31 19:45       ` Jacek Anaszewski
2019-07-31 19:49         ` Dan Murphy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bdbe95b0-83c8-53a6-1be0-1a8f43a0810c@gmail.com \
    --to=jacek.anaszewski@gmail.com \
    --cc=dmurphy@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).