Re: [PATCH v14 04/19] leds: multicolor: Introduce a multicolor class definition

From: Jacek Anaszewski
Date: Fri Oct 18 2019 - 17:45:01 EST


Dan,

Thank you for the update.

On 10/18/19 2:25 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@xxxxxx>
> ---
> .../ABI/testing/sysfs-class-led-multicolor | 36 +++
> Documentation/leds/index.rst | 1 +
> Documentation/leds/leds-class-multicolor.rst | 100 +++++++
> drivers/leds/Kconfig | 10 +
> drivers/leds/Makefile | 1 +
> drivers/leds/led-class-multicolor.c | 271 ++++++++++++++++++
> include/linux/led-class-multicolor.h | 97 +++++++
> 7 files changed, 516 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
[...]
> # LED Platform Drivers
> diff --git a/drivers/leds/led-class-multicolor.c b/drivers/leds/led-class-multicolor.c
> new file mode 100644
> index 000000000000..453fd8e913e9
> --- /dev/null
> +++ b/drivers/leds/led-class-multicolor.c
> @@ -0,0 +1,271 @@
> +// SPDX-License-Identifier: GPL-2.0
> +// LED Multi Color class interface
> +// Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
> +
> +#include <linux/device.h>
> +#include <linux/init.h>
> +#include <linux/led-class-multicolor.h>
> +#include <linux/module.h>
> +#include <linux/slab.h>
> +#include <linux/uaccess.h>
> +
> +#include "leds.h"
> +
> +#define INTENSITY_NAME "_intensity"
> +#define MAX_INTENSITY_NAME "_max_intensity"
> +
> +int led_mc_calc_color_components(struct led_classdev_mc *mcled_cdev,
> + enum led_brightness brightness,
> + struct led_mc_color_conversion color_component[])
> +{
> + struct led_mc_color_entry *priv;
> + int i = 0;
> +
> + list_for_each_entry(priv, &mcled_cdev->color_list, list) {
> + color_component[i].color_id = priv->led_color_id;
> + color_component[i].brightness = brightness *
> + priv->intensity / priv->max_intensity;
> + i++;
> + }

For lines in the function above:

s/component/components/

> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(led_mc_calc_color_components);


--
Best regards,
Jacek Anaszewski