* [PATCH v3 3/4] leds: core: add documentation for color extension
@ 2016-02-18 21:29 Heiner Kallweit
2016-02-19 13:59 ` Jacek Anaszewski
0 siblings, 1 reply; 2+ messages in thread
From: Heiner Kallweit @ 2016-02-18 21:29 UTC (permalink / raw)
To: Jacek Anaszewski; +Cc: linux-leds
Document the color extension in Documentation/leds/leds-class.txt
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
v2:
- introduced to patch series
v3:
- document extension in more detail
---
Documentation/leds/leds-class.txt | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/Documentation/leds/leds-class.txt b/Documentation/leds/leds-class.txt
index d406d98..d4bf9c1 100644
--- a/Documentation/leds/leds-class.txt
+++ b/Documentation/leds/leds-class.txt
@@ -8,6 +8,19 @@ LED is defined in max_brightness file. The brightness file will set the brightne
of the LED (taking a value 0-max_brightness). Most LEDs don't have hardware
brightness support so will just be turned on for non-zero brightness settings.
+If a driver uses the colour extension of the LED core then the brightness
+file can be used to set hue / saturation / value. The brightness value is
+interpreted as: <0000000F><HHHHHHHH><SSSSSSSS><VVVVVVVV>
+Usage of the least byte is identical to monochrome mode. Saturation can be
+0-255 and hue 0-251 (Colour circle is mapped to 0-252).
+If hue and saturation both are 0 the current colour is not changed and only
+the brightness is set. This ensures backwards compatibility with monochrome
+mode, e.g. in calls like led_set_brightness(LED_FULL).
+This behavior can be overridden with flag F (LED_SET_COLOR). If this flag
+is set then hue and saturation are not checked for being 0 and the color
+components are set unconditionally. Example:
+0x010000ff sets the LED to white color with full brightness.
+
The class also introduces the optional concept of an LED trigger. A trigger
is a kernel based source of led events. Triggers can either be simple or
complex. A simple trigger isn't configurable and is designed to slot into
@@ -45,11 +58,12 @@ Is currently of the form:
"devicename:colour:function"
-There have been calls for LED properties such as colour to be exported as
-individual led class attributes. As a solution which doesn't incur as much
-overhead, I suggest these become part of the device name. The naming scheme
-above leaves scope for further attributes should they be needed. If sections
-of the name don't apply, just leave that section blank.
+If the colour extension is used hsv / rgb can be used instead of a specific
+colour. There have been calls for LED properties such as colour to be
+exported as individual led class attributes. As a solution which doesn't
+incur as much overhead, I suggest these become part of the device name.
+The naming scheme above leaves scope for further attributes should they be
+needed. If sections of the name don't apply, just leave that section blank.
Brightness setting API
--
2.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3 3/4] leds: core: add documentation for color extension
2016-02-18 21:29 [PATCH v3 3/4] leds: core: add documentation for color extension Heiner Kallweit
@ 2016-02-19 13:59 ` Jacek Anaszewski
0 siblings, 0 replies; 2+ messages in thread
From: Jacek Anaszewski @ 2016-02-19 13:59 UTC (permalink / raw)
To: Heiner Kallweit; +Cc: linux-leds
Hi Heiner,
On 02/18/2016 10:29 PM, Heiner Kallweit wrote:
> Document the color extension in Documentation/leds/leds-class.txt
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
> v2:
> - introduced to patch series
> v3:
> - document extension in more detail
> ---
> Documentation/leds/leds-class.txt | 24 +++++++++++++++++++-----
> 1 file changed, 19 insertions(+), 5 deletions(-)
>
> diff --git a/Documentation/leds/leds-class.txt b/Documentation/leds/leds-class.txt
> index d406d98..d4bf9c1 100644
> --- a/Documentation/leds/leds-class.txt
> +++ b/Documentation/leds/leds-class.txt
> @@ -8,6 +8,19 @@ LED is defined in max_brightness file. The brightness file will set the brightne
> of the LED (taking a value 0-max_brightness). Most LEDs don't have hardware
> brightness support so will just be turned on for non-zero brightness settings.
>
> +If a driver uses the colour extension of the LED core then the brightness
> +file can be used to set hue / saturation / value. The brightness value is
> +interpreted as: <0000000F><HHHHHHHH><SSSSSSSS><VVVVVVVV>
> +Usage of the least byte is identical to monochrome mode. Saturation can be
> +0-255 and hue 0-251 (Colour circle is mapped to 0-252).
> +If hue and saturation both are 0 the current colour is not changed and only
> +the brightness is set. This ensures backwards compatibility with monochrome
> +mode, e.g. in calls like led_set_brightness(LED_FULL).
> +This behavior can be overridden with flag F (LED_SET_COLOR). If this flag
> +is set then hue and saturation are not checked for being 0 and the color
> +components are set unconditionally. Example:
> +0x010000ff sets the LED to white color with full brightness.
When asking for justifying the need for the flag, I had on mind an
explanation of why the flag is needed any not only what are the
implications of setting it. My intention was rather to provide a simple
use case example, e.g. temperature monitoring, when brightness is set
through the trigger, with preset hue and saturation - if I understood
properly your idea.
> +
> The class also introduces the optional concept of an LED trigger. A trigger
> is a kernel based source of led events. Triggers can either be simple or
> complex. A simple trigger isn't configurable and is designed to slot into
> @@ -45,11 +58,12 @@ Is currently of the form:
>
> "devicename:colour:function"
>
> -There have been calls for LED properties such as colour to be exported as
> -individual led class attributes. As a solution which doesn't incur as much
> -overhead, I suggest these become part of the device name. The naming scheme
> -above leaves scope for further attributes should they be needed. If sections
> -of the name don't apply, just leave that section blank.
> +If the colour extension is used hsv / rgb can be used instead of a specific
> +colour. There have been calls for LED properties such as colour to be
> +exported as individual led class attributes. As a solution which doesn't
> +incur as much overhead, I suggest these become part of the device name.
> +The naming scheme above leaves scope for further attributes should they be
> +needed. If sections of the name don't apply, just leave that section blank.
>
>
> Brightness setting API
>
--
Best regards,
Jacek Anaszewski
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-02-19 13:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-18 21:29 [PATCH v3 3/4] leds: core: add documentation for color extension Heiner Kallweit
2016-02-19 13:59 ` Jacek Anaszewski
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).