2019-09-11 21:03:39

by Dan Murphy

[permalink] [raw]
Subject: [PATCH v5 0/9] Multicolor FW update

Hello

Lots of changes went into this update. The main change was that when writing to
the colors/intensity or colors/color_mix file for a specific color the LED
intensity will not change until the brightness file is written.

Added the LP5012/9 LED devices to the LP50xx code.
Converted the class doc to rst format.

Dan

Dan Murphy (9):
leds: multicolor: Add sysfs interface definition
documention: leds: Add multicolor class documentation
dt: bindings: Add multicolor class dt bindings documention
dt-bindings: leds: Add multicolor ID to the color ID list
leds: Add multicolor ID to the color ID list
leds: multicolor: Introduce a multicolor class definition
dt: bindings: lp50xx: Introduce the lp50xx family of RGB drivers
leds: lp50xx: Add the LP50XX family of the RGB LED driver
leds: Update the lp55xx to use the multi color framework

.../ABI/testing/sysfs-class-led-multicolor | 73 ++
.../bindings/leds/leds-class-multicolor.txt | 96 +++
.../devicetree/bindings/leds/leds-lp50xx.txt | 148 ++++
Documentation/leds/index.rst | 1 +
Documentation/leds/leds-class-multicolor.rst | 149 ++++
drivers/leds/Kconfig | 17 +
drivers/leds/Makefile | 2 +
drivers/leds/led-class-multicolor.c | 387 +++++++++
drivers/leds/led-core.c | 1 +
drivers/leds/leds-lp50xx.c | 807 ++++++++++++++++++
drivers/leds/leds-lp5523.c | 13 +
drivers/leds/leds-lp55xx-common.c | 131 ++-
drivers/leds/leds-lp55xx-common.h | 9 +
include/dt-bindings/leds/common.h | 3 +-
include/linux/led-class-multicolor.h | 96 +++
include/linux/platform_data/leds-lp55xx.h | 6 +
modules.builtin.modinfo | Bin 0 -> 43550 bytes
17 files changed, 1916 insertions(+), 23 deletions(-)
create mode 100644 Documentation/ABI/testing/sysfs-class-led-multicolor
create mode 100644 Documentation/devicetree/bindings/leds/leds-class-multicolor.txt
create mode 100644 Documentation/devicetree/bindings/leds/leds-lp50xx.txt
create mode 100644 Documentation/leds/leds-class-multicolor.rst
create mode 100644 drivers/leds/led-class-multicolor.c
create mode 100644 drivers/leds/leds-lp50xx.c
create mode 100644 include/linux/led-class-multicolor.h
create mode 100644 modules.builtin.modinfo

--
2.22.0.214.g8dca754b1e


2019-09-11 21:19:06

by Dan Murphy

[permalink] [raw]
Subject: [PATCH v5 1/9] leds: multicolor: Add sysfs interface definition

Add a documentation of LED Multicolor LED class specific
sysfs attributes.

Signed-off-by: Dan Murphy <[email protected]>
---
.../ABI/testing/sysfs-class-led-multicolor | 73 +++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 Documentation/ABI/testing/sysfs-class-led-multicolor

diff --git a/Documentation/ABI/testing/sysfs-class-led-multicolor b/Documentation/ABI/testing/sysfs-class-led-multicolor
new file mode 100644
index 000000000000..4ea54c2ad4c8
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-class-led-multicolor
@@ -0,0 +1,73 @@
+What: /sys/class/leds/<led>/brightness
+Date: Sept 2019
+KernelVersion: 5.5
+Contact: Dan Murphy <[email protected]>
+Description: read/write
+ The multicolor class will redirect the device drivers call back
+ function for brightness control to the multicolor class
+ brightness control function.
+
+ Writing to this file will update all LEDs within the group to a
+ calculated percentage of what each color LED in the group is set
+ to. The percentage is calculated via the equation below:
+
+ led_brightness = requested_value * led_color_intensity/led_color_max_intensity
+
+ For additional details please refer to
+ Documentation/leds/leds-class-multicolor.rst.
+
+ The value of the color is from 0 to
+ /sys/class/leds/<led>/max_brightness.
+
+What: /sys/class/leds/<led>/colors/color_mix
+Date: Sept 2019
+KernelVersion: 5.5
+Contact: Dan Murphy <[email protected]>
+Description: read/write
+ The values written to this file should contain the intensity
+ values of each multicolor LED within the colors directory. The
+ index of given color is reported by the color_id file present in
+ colors/<color> directory. The index determines the position in
+ the sequence of intensities on which the related intensity
+ should be passed to this file.
+
+ For additional details please refer to
+ Documentation/leds/leds-class-multicolor.rst.
+
+What: /sys/class/leds/<led>/colors/<led_color>/color_id
+Date: Sept 2019
+KernelVersion: 5.5
+Contact: Dan Murphy <[email protected]>
+Description: read only
+ This file when read will return the index of the color in the
+ color_mix.
+
+ For additional details please refer to
+ Documentation/leds/leds-class-multicolor.rst.
+
+What: /sys/class/leds/<led>/colors/<led_color>/intensity
+Date: Sept 2019
+KernelVersion: 5.5
+Contact: Dan Murphy <[email protected]>
+Description: read/write
+ The led_color directory is dynamically created based on the
+ colors defined by the registrar of the class.
+ The led_color can be but not limited to red, green, blue,
+ white, amber, yellow and violet. There is one directory per color
+ presented. The brightness file is created under each
+ led_color directory and controls the individual LED color
+ setting.
+
+ The value of the color is from 0 to
+ /sys/class/leds/<led>/colors/<led_color>/max_intensity.
+
+What: /sys/class/leds/<led>/colors/<led_color>/max_intensity
+Date: Sept 2019
+KernelVersion: 5.5
+Contact: Dan Murphy <[email protected]>
+Description: read only
+ Maximum intensity level for the LED color, default is
+ 255 (LED_FULL).
+
+ If the LED does not support different intensity levels, this
+ should be 1.
--
2.22.0.214.g8dca754b1e

2019-09-15 16:46:13

by Jacek Anaszewski

[permalink] [raw]
Subject: Re: [PATCH v5 1/9] leds: multicolor: Add sysfs interface definition

Hi Dan,

On 9/11/19 8:01 PM, Dan Murphy wrote:
> Add a documentation of LED Multicolor LED class specific
> sysfs attributes.
>
> Signed-off-by: Dan Murphy <[email protected]>
> ---
> .../ABI/testing/sysfs-class-led-multicolor | 73 +++++++++++++++++++
> 1 file changed, 73 insertions(+)
> create mode 100644 Documentation/ABI/testing/sysfs-class-led-multicolor
>
> diff --git a/Documentation/ABI/testing/sysfs-class-led-multicolor b/Documentation/ABI/testing/sysfs-class-led-multicolor
> new file mode 100644
> index 000000000000..4ea54c2ad4c8
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-class-led-multicolor
> @@ -0,0 +1,73 @@
> +What: /sys/class/leds/<led>/brightness
> +Date: Sept 2019
> +KernelVersion: 5.5
> +Contact: Dan Murphy <[email protected]>
> +Description: read/write
> + The multicolor class will redirect the device drivers call back
> + function for brightness control to the multicolor class
> + brightness control function.
> +
> + Writing to this file will update all LEDs within the group to a
> + calculated percentage of what each color LED in the group is set
> + to. The percentage is calculated via the equation below:
> +
> + led_brightness = requested_value * led_color_intensity/led_color_max_intensity
> +
> + For additional details please refer to
> + Documentation/leds/leds-class-multicolor.rst.
> +
> + The value of the color is from 0 to
> + /sys/class/leds/<led>/max_brightness.
> +
> +What: /sys/class/leds/<led>/colors/color_mix
> +Date: Sept 2019
> +KernelVersion: 5.5
> +Contact: Dan Murphy <[email protected]>
> +Description: read/write
> + The values written to this file should contain the intensity
> + values of each multicolor LED within the colors directory. The
> + index of given color is reported by the color_id file present in
> + colors/<color> directory. The index determines the position in
> + the sequence of intensities on which the related intensity
> + should be passed to this file.
> +
> + For additional details please refer to
> + Documentation/leds/leds-class-multicolor.rst.

As already mentioned in the reply to Pavel - let's avoid the
introduction of another sysfs file with multiple values.

Color intensity files will only cache the value and actual
write will be performed upon writing brightness file.

> +
> +What: /sys/class/leds/<led>/colors/<led_color>/color_id
> +Date: Sept 2019
> +KernelVersion: 5.5
> +Contact: Dan Murphy <[email protected]>
> +Description: read only
> + This file when read will return the index of the color in the
> + color_mix.
> +
> + For additional details please refer to
> + Documentation/leds/leds-class-multicolor.rst.
> +
> +What: /sys/class/leds/<led>/colors/<led_color>/intensity
> +Date: Sept 2019
> +KernelVersion: 5.5
> +Contact: Dan Murphy <[email protected]>
> +Description: read/write
> + The led_color directory is dynamically created based on the
> + colors defined by the registrar of the class.
> + The led_color can be but not limited to red, green, blue,
> + white, amber, yellow and violet. There is one directory per color
> + presented. The brightness file is created under each
> + led_color directory and controls the individual LED color
> + setting.
> +
> + The value of the color is from 0 to
> + /sys/class/leds/<led>/colors/<led_color>/max_intensity.
> +
> +What: /sys/class/leds/<led>/colors/<led_color>/max_intensity
> +Date: Sept 2019
> +KernelVersion: 5.5
> +Contact: Dan Murphy <[email protected]>
> +Description: read only
> + Maximum intensity level for the LED color, default is
> + 255 (LED_FULL).
> +
> + If the LED does not support different intensity levels, this
> + should be 1.
>

--
Best regards,
Jacek Anaszewski

2019-09-16 20:45:44

by Dan Murphy

[permalink] [raw]
Subject: Re: [PATCH v5 1/9] leds: multicolor: Add sysfs interface definition

Hello

On 9/15/19 8:57 AM, Jacek Anaszewski wrote:
> Hi Dan,
>
> On 9/11/19 8:01 PM, Dan Murphy wrote:
>> Add a documentation of LED Multicolor LED class specific
>> sysfs attributes.
>>
>> Signed-off-by: Dan Murphy <[email protected]>
>> ---
>> .../ABI/testing/sysfs-class-led-multicolor | 73 +++++++++++++++++++
>> 1 file changed, 73 insertions(+)
>> create mode 100644 Documentation/ABI/testing/sysfs-class-led-multicolor
>>
>> diff --git a/Documentation/ABI/testing/sysfs-class-led-multicolor b/Documentation/ABI/testing/sysfs-class-led-multicolor
>> new file mode 100644
>> index 000000000000..4ea54c2ad4c8
>> --- /dev/null
>> +++ b/Documentation/ABI/testing/sysfs-class-led-multicolor
>> @@ -0,0 +1,73 @@
>> +What: /sys/class/leds/<led>/brightness
>> +Date: Sept 2019
>> +KernelVersion: 5.5
>> +Contact: Dan Murphy <[email protected]>
>> +Description: read/write
>> + The multicolor class will redirect the device drivers call back
>> + function for brightness control to the multicolor class
>> + brightness control function.
>> +
>> + Writing to this file will update all LEDs within the group to a
>> + calculated percentage of what each color LED in the group is set
>> + to. The percentage is calculated via the equation below:
>> +
>> + led_brightness = requested_value * led_color_intensity/led_color_max_intensity
>> +
>> + For additional details please refer to
>> + Documentation/leds/leds-class-multicolor.rst.
>> +
>> + The value of the color is from 0 to
>> + /sys/class/leds/<led>/max_brightness.
>> +
>> +What: /sys/class/leds/<led>/colors/color_mix
>> +Date: Sept 2019
>> +KernelVersion: 5.5
>> +Contact: Dan Murphy <[email protected]>
>> +Description: read/write
>> + The values written to this file should contain the intensity
>> + values of each multicolor LED within the colors directory. The
>> + index of given color is reported by the color_id file present in
>> + colors/<color> directory. The index determines the position in
>> + the sequence of intensities on which the related intensity
>> + should be passed to this file.
>> +
>> + For additional details please refer to
>> + Documentation/leds/leds-class-multicolor.rst.
> As already mentioned in the reply to Pavel - let's avoid the
> introduction of another sysfs file with multiple values.

OK for clarification remove the color_mix and color_id files and keep
the intensity files?

Dan

2019-09-17 03:14:49

by Jacek Anaszewski

[permalink] [raw]
Subject: Re: [PATCH v5 1/9] leds: multicolor: Add sysfs interface definition

Dan,

On 9/16/19 3:56 PM, Dan Murphy wrote:
> Hello
>
> On 9/15/19 8:57 AM, Jacek Anaszewski wrote:
>> Hi Dan,
>>
>> On 9/11/19 8:01 PM, Dan Murphy wrote:
>>> Add a documentation of LED Multicolor LED class specific
>>> sysfs attributes.
>>>
>>> Signed-off-by: Dan Murphy <[email protected]>
>>> ---
>>>   .../ABI/testing/sysfs-class-led-multicolor    | 73 +++++++++++++++++++
>>>   1 file changed, 73 insertions(+)
>>>   create mode 100644
>>> Documentation/ABI/testing/sysfs-class-led-multicolor
>>>
>>> diff --git a/Documentation/ABI/testing/sysfs-class-led-multicolor
>>> b/Documentation/ABI/testing/sysfs-class-led-multicolor
>>> new file mode 100644
>>> index 000000000000..4ea54c2ad4c8
>>> --- /dev/null
>>> +++ b/Documentation/ABI/testing/sysfs-class-led-multicolor
>>> @@ -0,0 +1,73 @@
>>> +What:        /sys/class/leds/<led>/brightness
>>> +Date:        Sept 2019
>>> +KernelVersion:    5.5
>>> +Contact:    Dan Murphy <[email protected]>
>>> +Description:    read/write
>>> +        The multicolor class will redirect the device drivers call back
>>> +        function for brightness control to the multicolor class
>>> +        brightness control function.
>>> +
>>> +        Writing to this file will update all LEDs within the group to a
>>> +        calculated percentage of what each color LED in the group is
>>> set
>>> +        to.  The percentage is calculated via the equation below:
>>> +
>>> +        led_brightness = requested_value *
>>> led_color_intensity/led_color_max_intensity
>>> +
>>> +        For additional details please refer to
>>> +        Documentation/leds/leds-class-multicolor.rst.
>>> +
>>> +        The value of the color is from 0 to
>>> +        /sys/class/leds/<led>/max_brightness.
>>> +
>>> +What:        /sys/class/leds/<led>/colors/color_mix
>>> +Date:        Sept 2019
>>> +KernelVersion:    5.5
>>> +Contact:    Dan Murphy <[email protected]>
>>> +Description:    read/write
>>> +        The values written to this file should contain the intensity
>>> +        values of each multicolor LED within the colors directory. The
>>> +        index of given color is reported by the color_id file
>>> present in
>>> +        colors/<color> directory. The index determines the position in
>>> +        the sequence of    intensities on which the related intensity
>>> +        should be passed to this file.
>>> +
>>> +        For additional details please refer to
>>> +        Documentation/leds/leds-class-multicolor.rst.
>> As already mentioned in the reply to Pavel - let's avoid the
>> introduction of another sysfs file with multiple values.
>
> OK for clarification remove the color_mix and color_id files and keep
> the intensity files?

Exactly.

--
Best regards,
Jacek Anaszewski