lkml.org 
[lkml]   [2019]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/3] regulator: core: fix boot-on regulators use_count usage
On Mon, Sep 23, 2019 at 11:36:11AM -0700, Doug Anderson wrote:
> On Mon, Sep 23, 2019 at 11:14 AM Mark Brown <broonie@kernel.org> wrote:

> > Boot on means that it's powered on when the kernel starts, it's
> > for regulators that we can't read back the status of.

> 1. Would it be valid to say that it's always incorrect to set this
> property if there is a way to read the status back from the regulator?

As originally intended, yes. I'm now not 100% sure that it won't
break any existing systems though :/

> 2. Would this be a valid description of how the property is expected to behave
> a) At early boot this regulator will be turned on if it wasn't already on.
> b) If no clients are found for this regulator after everything has
> loaded, this regulator will be automatically disabled.

> If so then I don't _think_ #2b is happening, but I haven't confirmed.

> > boot-on just refers to the status at boot, we can still turn
> > those regulators off later on if we want to.

> How, exactly? As of my commit 5451781dadf8 ("regulator: core: Only
> count load for enabled consumers") if you do:

> r = regulator_get(...)
> regulator_disable(r)

> ...then you'll get "Underflow of regulator enable count". In other
> words, if a given regulator client disables more times than it enables
> then you will get an error. Since there is no client that did the
> initial "boot" enable then there's no way to do the disable unless it
> happens automatically (as per 2b above).

It should be possible to do a regulator_disable() though I'm not
sure anyone actually uses that. The pattern for a regular
consumer should be the normal enable/disable pair to handle
shared usage, only an exclusive consumer should be able to use
just a straight disable.

> ...or do you mean that people could call regulator_force_disable()?
> Couldn't they also do that with an always-on regulator?

No, nothing should use that in a non-emergency situation.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2019-09-23 20:50    [W:0.094 / U:0.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site