All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@iki.fi>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Jacek Anaszewski <jacek.anaszewski@gmail.com>,
	Pavel Machek <pavel@ucw.cz>, Dan Murphy <dmurphy@ti.com>,
	Linux LED Subsystem <linux-leds@vger.kernel.org>,
	newbytee@protonmail.com, Stephan Gerhold <stephan@gerhold.net>
Subject: Re: [PATCH 2/2 v3] leds: rt8515: Add Richtek RT8515 LED driver
Date: Wed, 11 Nov 2020 18:55:03 +0200	[thread overview]
Message-ID: <20201111165503.GZ6899@valkosipuli.retiisi.org.uk> (raw)
In-Reply-To: <CACRpkdYK+X==Xm3AfymV_HEaZHOvPS-LtCLKZXc2jmzV7KUZoQ@mail.gmail.com>

Hi Linus,

On Wed, Nov 11, 2020 at 05:34:58PM +0100, Linus Walleij wrote:
> On Wed, Nov 11, 2020 at 12:40 PM Sakari Ailus <sakari.ailus@iki.fi> wrote:
> > On Wed, Nov 11, 2020 at 02:14:17AM +0100, Linus Walleij wrote:
> 
> > > +     } else if (brightness < RT8515_TORCH_MAX) {
> > > +             /* Step it up to movie mode brightness using the flash pin */
> > > +             rt8515_gpio_brightness_commit(rt->ent, brightness);
> >
> > What's the unit of brightness here? If you don't know the unit, you could
> > still assume something and fix it later if needed. Or the current could be
> > just measured.
> >
> > It's usually linear but if the number of steps is small then logarithmic
> > scale is also not unforeseen.
> 
> I will try to come up with something...
> 
> > > +     } else {
> > > +             /* Max torch brightness requested */
> > > +             gpiod_set_value(rt->ent, 1);
> >
> > What's the current in this case? The maximum really should come from DT to
> > avoid frying components.
> 
> The way I understand it is that this component contains its own
> current regulation electronic. You request a brightness
> between 1-100 and it will support this range (no external
> current boost). And as a user that is "all you need to know".
> 
> Isn't this problem more prevalent when you have some kind of
> external current-regulator that you need to program?
> 
> This component draws its power directly from VBAT (the main
> battery) so regulating how much of that it takes is up to the
> component.
> 
> I could think of the component brightness being a problem if
> the flash is embedded in some kind of plastic that cannot
> take the heat though, but I haven't seen any code trying to
> hold it down for this reason. I suppose the component
> datasheet (that I don't have) specifies all these things...

The LED is different from the LED driver. If you happen to have a LED with
smaller maximum current than the LED driver can provide, the software has
to limit the current the driver provides, or hardware damage will result.

This is why virtually all flash LED drivers have these properties.

I guess you could use the maximum as it is known the driver uses the
maximum current on those devices? How about the torch mode, does that use
maximum as well?

A (safe) way forward now, without knowing the current in various
configurations, could be to document the said properties in DT bindings,
but the driver would only work if it gets the maximum values from the DT.
Or use the lowest setting otherwise.

-- 
Kind regards,

Sakari Ailus

  reply	other threads:[~2020-11-11 16:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-11  1:14 [PATCH 1/2 v3] dt-bindings: leds: Add DT binding for Richtek RT8515 Linus Walleij
2020-11-11  1:14 ` [PATCH 2/2 v3] leds: rt8515: Add Richtek RT8515 LED driver Linus Walleij
2020-11-11  7:59   ` Pavel Machek
2020-11-11 11:38   ` Sakari Ailus
2020-11-11 16:34     ` Linus Walleij
2020-11-11 16:55       ` Sakari Ailus [this message]
2020-11-11 22:07         ` Linus Walleij
2020-11-12 10:24           ` Sakari Ailus
2020-11-25 19:35           ` Pavel Machek
2020-11-11 11:04 ` [PATCH 1/2 v3] dt-bindings: leds: Add DT binding for Richtek RT8515 Sakari Ailus
2020-11-11 13:44   ` Linus Walleij

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=20201111165503.GZ6899@valkosipuli.retiisi.org.uk \
    --to=sakari.ailus@iki.fi \
    --cc=dmurphy@ti.com \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=newbytee@protonmail.com \
    --cc=pavel@ucw.cz \
    --cc=stephan@gerhold.net \
    /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.