Hi,

On Mon, Sep 23, 2019 at 11:49 AM Mark Brown <broo...@kernel.org> wrote:
>
> On Mon, Sep 23, 2019 at 11:36:11AM -0700, Doug Anderson wrote:
> > On Mon, Sep 23, 2019 at 11:14 AM Mark Brown <broo...@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 :/

Should I change the bindings doc to say that?


> > 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.

Ah, I see, I wasn't aware of the "exclusive" special case!  Marco: is
this working for you?  I wonder if we need to match
"regulator->enable_count" to "rdev->use_count" at the end of
_regulator_get() in the exclusive case...

-Doug

Reply via email to