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 v10 04/16] leds: multicolor: Introduce a multicolor class definition
Date: Sun, 6 Oct 2019 17:23:35 +0200 [thread overview]
Message-ID: <8c00d678-48e0-bb2b-a18f-39247eff7fe2@gmail.com> (raw)
In-Reply-To: <20191001145620.11123-5-dmurphy@ti.com>
Dan,
Thank you for the update.
On 10/1/19 4:56 PM, Dan Murphy wrote:
> Introduce a multicolor class that groups colored LEDs
> within a LED node.
>
> The multi color class groups monochrome LEDs and allows controlling two
> aspects of the final combined color: hue and lightness. The former is
> controlled via <color>_intensity files and the latter is controlled
> via brightness file.
>
> Signed-off-by: Dan Murphy <dmurphy@ti.com>
> ---
> .../ABI/testing/sysfs-class-led-multicolor | 35 +++
> Documentation/leds/index.rst | 1 +
> Documentation/leds/leds-class-multicolor.rst | 96 +++++++
> drivers/leds/Kconfig | 10 +
> drivers/leds/Makefile | 1 +
> drivers/leds/led-class-multicolor.c | 268 ++++++++++++++++++
> include/linux/led-class-multicolor.h | 88 ++++++
> 7 files changed, 499 insertions(+)
> create mode 100644 Documentation/ABI/testing/sysfs-class-led-multicolor
> create mode 100644 Documentation/leds/leds-class-multicolor.rst
> create mode 100644 drivers/leds/led-class-multicolor.c
> create mode 100644 include/linux/led-class-multicolor.h
>
> diff --git a/Documentation/ABI/testing/sysfs-class-led-multicolor b/Documentation/ABI/testing/sysfs-class-led-multicolor
> new file mode 100644
> index 000000000000..65cb43de26e6
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-class-led-multicolor
> @@ -0,0 +1,35 @@
> +What: /sys/class/leds/<led>/brightness
> +Date: Sept 2019
> +KernelVersion: 5.5
> +Contact: Dan Murphy <dmurphy@ti.com>
> +Description: read/write
> + Writing to this file will update all LEDs within the group to a
> + calculated percentage of what each color LED intensity is set
> + to. The percentage is calculated via the equation below:
> +
> + led_brightness = brightness * <color>_intensity/<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>_intensity
> +Date: Sept 2019
> +KernelVersion: 5.5
> +Contact: Dan Murphy <dmurphy@ti.com>
> +Description: read/write
> + The <color>_intensity file is created based on the color
> + defined by the registrar of the class.
> + There is one file per color presented.
> +
> + The value of the color is from 0 to
> + /sys/class/leds/<led>/colors/<color>_max_intensity.
> +
> +What: /sys/class/leds/<led>/colors/<color>_max_intensity
> +Date: Sept 2019
> +KernelVersion: 5.5
> +Contact: Dan Murphy <dmurphy@ti.com>
> +Description: read only
> + Maximum intensity level for the LED color.
> diff --git a/Documentation/leds/index.rst b/Documentation/leds/index.rst
> index 060f4e485897..bc70c6aa7138 100644
> --- a/Documentation/leds/index.rst
> +++ b/Documentation/leds/index.rst
> @@ -9,6 +9,7 @@ LEDs
>
> leds-class
> leds-class-flash
> + leds-class-multicolor
> ledtrig-oneshot
> ledtrig-transient
> ledtrig-usbport
> diff --git a/Documentation/leds/leds-class-multicolor.rst b/Documentation/leds/leds-class-multicolor.rst
> new file mode 100644
> index 000000000000..87a1588d7619
> --- /dev/null
> +++ b/Documentation/leds/leds-class-multicolor.rst
> @@ -0,0 +1,96 @@
> +====================================
> +Multi Color LED handling under Linux
> +====================================
> +
> +Description
> +===========
> +The multi color class groups monochrome LEDs and allows controlling two
> +aspects of the final combined color: hue and lightness. The former is
> +controlled via <color>_intensity files and the latter is controlled
> +via brightness file.
> +
> +For more details on hue and lightness notions please refer to
> +https://en.wikipedia.org/wiki/CIECAM02.
> +
> +Note that intensity files only cache the written value and the actual
> +change of hardware state occurs upon writing brightness file. This
> +allows for changing many factors of the perceived color in a virtually
> +unnoticeable way for the human observer.
> +
> +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.rst within this
> +documentation directory.
> +
> +Each colored LED will have two files created under the colors directory
> +<color>_intensity and <color>_max_intensity. These files will contain
> +one of LED_COLOR_ID_* definitions from the header
> +include/dt-bindings/leds/common.h.
> +
> +Directory Layout Example
> +========================
> +root:/sys/class/leds/rgb:grouped_leds# ls -lR colors/
> +-rw-rwxr-- 1 root root 4096 Jul 7 03:10 red_max_intensity
> +--w--wx-w- 1 root root 4096 Jul 7 03:10 red_intensity
> +-rw-rwxr-- 1 root root 4096 Jul 7 03:10 green_max_intensity
> +--w--wx-w- 1 root root 4096 Jul 7 03:10 green_intensity
> +-rw-rwxr-- 1 root root 4096 Jul 7 03:10 blue_max_intensity
> +--w--wx-w- 1 root root 4096 Jul 7 03:10 blue_intensity
Now when you have fixed file permissions in LED mc core the
'ls -l' should report them correctly, so this needs to be
updated.
[...]
> +int devm_led_classdev_multicolor_register(struct device *parent,
> + struct led_classdev_mc *mcled_cdev)
> +{
> + struct led_classdev_mc **dr;
> + int ret;
> +
> + dr = devres_alloc(devm_led_classdev_multicolor_release,
> + sizeof(*dr), GFP_KERNEL);
> + if (!dr)
> + return -ENOMEM;
> +
> + ret = led_classdev_multicolor_register(parent, mcled_cdev);
> + if (ret) {
> + devres_free(dr);
> + return ret;
> + }
> +
> + *dr = mcled_cdev;
> + devres_add(parent, dr);
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(devm_led_classdev_multicolor_register);
> +
> +static int devm_led_classdev_multicolor_match(struct device *dev,
> + void *res, void *data)
> +{
> + struct mcled_cdev **p = res;
s/mcled_cdev/led_classdev_mc/
> +
> + if (WARN_ON(!p || !*p))
> + return 0;
> +
> + return *p == data;
> +}
> +
[...]
--
Best regards,
Jacek Anaszewski
next prev parent reply other threads:[~2019-10-06 15:23 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-01 14:56 [PATCH v10 00/16] Multicolor Framework Dan Murphy
2019-10-01 14:56 ` [PATCH v10 01/16] dt: bindings: Add multicolor class dt bindings documention Dan Murphy
2019-10-01 14:56 ` [PATCH v10 02/16] dt-bindings: leds: Add multicolor ID to the color ID list Dan Murphy
2019-10-01 14:56 ` [PATCH v10 03/16] " Dan Murphy
2019-10-01 14:56 ` [PATCH v10 04/16] leds: multicolor: Introduce a multicolor class definition Dan Murphy
2019-10-06 15:23 ` Jacek Anaszewski [this message]
2019-10-07 11:51 ` Dan Murphy
2019-10-01 14:56 ` [PATCH v10 05/16] dt: bindings: lp50xx: Introduce the lp50xx family of RGB drivers Dan Murphy
2019-10-01 14:56 ` [PATCH v10 06/16] leds: lp50xx: Add the LP50XX family of the RGB LED driver Dan Murphy
2019-10-02 0:16 ` kbuild test robot
2019-10-06 16:12 ` Jacek Anaszewski
2019-10-07 12:35 ` Dan Murphy
2019-10-01 14:56 ` [PATCH v10 07/16] dt: bindings: lp55xx: Be consistent in the document with LED acronym Dan Murphy
2019-10-01 14:56 ` [PATCH v10 08/16] dt: bindings: lp55xx: Update binding for Multicolor Framework Dan Murphy
2019-10-01 14:56 ` [PATCH v10 09/16] ARM: dts: n900: Add reg property to the LP5523 channel node Dan Murphy
2019-10-01 14:56 ` [PATCH v10 10/16] ARM: dts: imx6dl-yapp4: Add reg property to the lp5562 " Dan Murphy
2019-10-01 14:56 ` [PATCH v10 11/16] ARM: dts: ste-href: Add reg property to the LP5521 channel nodes Dan Murphy
2019-10-04 21:50 ` Linus Walleij
2019-10-01 14:56 ` [PATCH v10 12/16] leds: lp55xx: Add multicolor framework support to lp55xx Dan Murphy
2019-10-02 0:31 ` kbuild test robot
2019-10-02 1:24 ` kbuild test robot
2019-10-06 19:52 ` Jacek Anaszewski
2019-10-07 17:08 ` Dan Murphy
2019-10-07 19:27 ` Jacek Anaszewski
2019-10-01 14:56 ` [PATCH v10 13/16] leds: lp5523: Update the lp5523 code to add intensity function Dan Murphy
2019-10-01 14:56 ` [PATCH v10 14/16] leds: lp5521: Add multicolor framework intensity support Dan Murphy
2019-10-01 14:56 ` [PATCH v10 15/16] leds: lp55xx: Fix checkpatch file permissions issues Dan Murphy
2019-10-01 14:56 ` [PATCH v10 16/16] leds: lp5523: Fix checkpatch issues in the code Dan Murphy
2019-10-02 15:53 ` [PATCH v10 00/16] Multicolor Framework 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=8c00d678-48e0-bb2b-a18f-39247eff7fe2@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).