[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56b1cc39-a17e-0fe5-565b-7f42b6e1dcf1@ti.com>
Date: Wed, 8 Apr 2020 11:33:08 -0500
From: Dan Murphy <dmurphy@...com>
To: Jacek Anaszewski <jacek.anaszewski@...il.com>, <pavel@....cz>
CC: <linux-leds@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v19 04/18] leds: multicolor: Introduce a multicolor class
definition
Jacek
On 4/7/20 4:08 PM, Jacek Anaszewski wrote:
> Dan,
>
> One more nit below.
>
> On 4/2/20 10:42 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.
> [...]
>> # 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..838b1d679647
>> --- /dev/null
>> +++ b/drivers/leds/led-class-multicolor.c
>> @@ -0,0 +1,206 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +// LED Multi Color class interface
>> +// Copyright (C) 2019-20 Texas Instruments Incorporated - http://www.ti.com/
>> +// Author: Dan Murphy <dmurphy@...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"
>> +
>> +int led_mc_calc_color_components(struct led_classdev_mc *mcled_cdev,
>> + enum led_brightness brightness)
>> +{
>> + struct led_classdev *led_cdev = &mcled_cdev->led_cdev;
>> + int i;
>> +
>> + for (i = 0; i < mcled_cdev->num_colors; i++)
>> + mcled_cdev->multicolor_info[i].color_brightness = (brightness *
> If you passed temporary array for collecting calculated brightness
> items to this function then you could remove this color_brightness
> field from struct multicolor_info.
I thought about doing it that way but I liked how each LEDs properties
were stored in a single element in the array.
There would be no issues with referencing the array element and knowing
everything about the specific LED like the
intensity, brightness, output channel and ID. This eliminates any need
for a channel map or mapping brightness to IDs or channels.
Dan
Powered by blists - more mailing lists