From: Jacek Anaszewski <j.anaszewski@samsung.com>
To: "David Rivshin (Allworx)" <drivshin.allworx@gmail.com>
Cc: Rob Herring <robh+dt@kernel.org>,
Linux LED Subsystem <linux-leds@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
Richard Purdie <rpurdie@rpsys.net>,
Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
Stefan Wahren <stefan.wahren@i2se.com>
Subject: Re: [PATCH RFC 2/3] DT: leds: Add binding for the ISSI IS31FL32xx family of LED drivers
Date: Fri, 26 Feb 2016 10:56:57 +0100 [thread overview]
Message-ID: <56D02169.8000709@samsung.com> (raw)
In-Reply-To: <20160225193023.6f8f1f89.drivshin.allworx@gmail.com>
On 02/26/2016 01:30 AM, David Rivshin (Allworx) wrote:
> On Wed, 24 Feb 2016 13:49:46 -0600
> Rob Herring <robh+dt@kernel.org> wrote:
>
>> On Wed, Feb 24, 2016 at 1:34 PM, David Rivshin (Allworx)
>> <drivshin.allworx@gmail.com> wrote:
>>> On Wed, 24 Feb 2016 17:04:49 +0100
>>> Jacek Anaszewski <j.anaszewski@samsung.com> wrote:
>>>
>>>> Hi David,
>>>>
>>>> Thanks for the patch.
>>>>
>>>> On 02/23/2016 07:17 PM, David Rivshin (Allworx) wrote:
>>>>> From: David Rivshin <drivshin@allworx.com>
>>>>>
>>>>> This adds a binding description for the is31fl3236/35/18/16 I2C LED
>>>>> drivers.
>>>>>
>>>>> Signed-off-by: David Rivshin <drivshin@allworx.com>
>>>>> ---
>>>>> .../devicetree/bindings/leds/leds-is31fl32xx.txt | 51 ++++++++++++++++++++++
>>>>> 1 file changed, 51 insertions(+)
>>>>> create mode 100644 Documentation/devicetree/bindings/leds/leds-is31fl32xx.txt
>>>>>
>>>>> diff --git a/Documentation/devicetree/bindings/leds/leds-is31fl32xx.txt b/Documentation/devicetree/bindings/leds/leds-is31fl32xx.txt
>>>>> new file mode 100644
>>>>> index 0000000..0a05a1d
>>>>> --- /dev/null
>>>>> +++ b/Documentation/devicetree/bindings/leds/leds-is31fl32xx.txt
>>>>> @@ -0,0 +1,51 @@
>>>>> +Binding for ISSI IS31FL32xx LED Drivers
>>>>> +
>>>>> +The IS31FL32xx family of LED drivers are I2C devices with multiple
>>>>> +constant-current channels, each with independent 256-level PWM control.
>>>>> +Each LED is represented as a sub-node of the device.
>>>>> +
>>>>> +Required properties:
>>>>> +- compatible: one of
>>>>> + issi,is31fl3236
>>>>> + issi,is31fl3235
>>>>> + issi,is31fl3218
>>>>> + issi,is31fl3216
>>>>> +- reg: I2C slave address
>>>>> +- address-cells : must be 1
>>>>> +- size-cells : must be 0
>>>>> +
>>>>> +LED sub-node properties:
>>>>> +- reg : LED channel number (1..N)
>>>>> +- max-brightness : (optional) Maximum brightness possible for the LED.
>>>>
>>>> Please use led-max-microamp instead. You can refer to
>>>> Documentation/devicetree/bindings/leds/common.txt for detailed
>>>> description.
>>>
>>> FYI, I think I got that property from leds-pwm, since these use PWMs
>>> internally, although I don't actually use it myself.
>>>
>>> I can see how led-max-microamp could be a useful property, however
>>> I'm uncertain about computing cdev->max_brightness from it as these
>>> devices look to control their max current via an external resistor.
>>> I suppose either the resistor value, or the resultant max-current
>>> would need to be given in the devicetree, and then that used along
>>> with led-max-microamp to compute cdev->max_brightness. Although I'd
>>> want it to be optional as I suspect most users don't need any
>>> restriction. Also, I don't think I can properly test the result,
>>> which always makes me nervous.
>>>
>>> Would it be acceptable to simply remove the max-brightness property
>>> without adding led-max-microamp? It can always be added if a user
>>> turns out to need it in the future. Or do you feel strongly that
>>> led-max-microamp should be in the binding from the start?
>>
>> You should put in DT whatever makes sense for the controls the h/w
>> has. If you only have a PWM, then only max-brightness makes sense and
>> led-max-microamp does not.
>
> There are multiple ways you can look at it, and I'm not sure which
> is the overriding one. The brightness of the LED is determined by the
> current, which is in turn a combination of the following:
> - The max per-LED current is set with an external resistor.
> - Some devices have a scaling factor, which can be changed dynamically:
> - One of the devices has either a global scaling factor in a register,
> that can adjust max-current from 0.25x to 2x.
> - Two of the devices have a per-LED current divisor (1, 2, 3, or 4).
> - The main control is a 0-255 "PWM duty cycle" register, which
> effectively scales the current.
> IOW, the final current is:
> <resistor-setting> * <scaling> * <PWM-duty-cycle>
> Currently the binding and driver do not support setting either type of
> scaling (always unity) and only use the PWM duty cycle to dim the LED.
>
> So if the purpose is to say "never allow this LED channel to go above
> X current", the leds-max-microamp probably makes sense.
>
> If the purpose is to say "never allow the PWM duty cycle register
> for this channel to go above value X", then max-brightness perhaps
> makes sense.
>
> If the scaling is fixed by the DT (i.e won't be changed dynamically
> by the OS), then those two are basically equivalent in functionality.
> But if scaling can be changed dynamically, then they have different
> implications.
Actually we introduced led-max-microamp property because we came
to conclusion that brightness level is not a suitable unit for
describing hardware.
As stated in Documentation/devicetree/bindings/leds/common.txt,
the led-max-microamp's property purpose is to protect the LEDs
from damaging in case of excessive current is set. This is especially
vital in case of flash LED controllers where the current can reach ~1A.
IMO having max-brightness only for defining a LED class device
usage policy is not justified, since this can be accomplished
from user space.
--
Best regards,
Jacek Anaszewski
next prev parent reply other threads:[~2016-02-26 9:57 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-23 18:17 [PATCH RFC 0/3] leds: Add driver for the ISSI IS31FL32xx family of LED drivers David Rivshin (Allworx)
2016-02-23 18:17 ` [PATCH RFC 1/3] DT: Add vendor prefix for Integrated Silicon Solutions Inc David Rivshin (Allworx)
2016-02-23 23:36 ` Rob Herring
2016-02-23 18:17 ` [PATCH RFC 2/3] DT: leds: Add binding for the ISSI IS31FL32xx family of LED drivers David Rivshin (Allworx)
2016-02-24 1:15 ` Rob Herring
2016-02-24 18:57 ` David Rivshin (Allworx)
2016-02-24 19:45 ` Rob Herring
2016-02-24 23:16 ` David Rivshin (Allworx)
2016-02-25 1:17 ` Rob Herring
2016-02-24 16:04 ` Jacek Anaszewski
2016-02-24 19:34 ` David Rivshin (Allworx)
2016-02-24 19:49 ` Rob Herring
2016-02-26 0:30 ` David Rivshin (Allworx)
2016-02-26 9:56 ` Jacek Anaszewski [this message]
2016-02-23 18:17 ` [PATCH RFC 3/3] leds: Add driver " David Rivshin (Allworx)
2016-02-23 18:45 ` Mark Rutland
2016-02-23 22:38 ` David Rivshin (Allworx)
2016-02-24 16:08 ` Jacek Anaszewski
2016-02-24 16:04 ` Jacek Anaszewski
2016-02-25 2:24 ` David Rivshin (Allworx)
2016-02-25 10:55 ` Jacek Anaszewski
2016-02-25 19:12 ` David Rivshin (Allworx)
2016-02-26 9:47 ` Jacek Anaszewski
2016-02-26 21:58 ` David Rivshin (Allworx)
2016-02-27 10:48 ` Stefan Wahren
2016-02-29 18:02 ` David Rivshin (Allworx)
2016-02-29 19:40 ` Stefan Wahren
2016-03-01 1:32 ` David Rivshin (Allworx)
2016-02-29 9:47 ` Jacek Anaszewski
2016-02-29 18:26 ` David Rivshin (Allworx)
2016-03-01 8:24 ` Jacek Anaszewski
2016-03-01 18:45 ` David Rivshin (Allworx)
2016-03-02 8:15 ` Jacek Anaszewski
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=56D02169.8000709@samsung.com \
--to=j.anaszewski@samsung.com \
--cc=devicetree@vger.kernel.org \
--cc=drivshin.allworx@gmail.com \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=linux-leds@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=rpurdie@rpsys.net \
--cc=stefan.wahren@i2se.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.