Re: [PATCH 1/3] regulator: core: fix boot-on regulators use_count usage

From: Marco Felsch
Date: Tue Oct 08 2019 - 16:16:29 EST


On 19-10-08 17:23, Mark Brown wrote:
> On Tue, Oct 08, 2019 at 06:16:40PM +0200, Marco Felsch wrote:
> > On 19-10-08 16:42, Mark Brown wrote:
>
> > > If this is a GPIO regulator then the Linux APIs mean you can't read the
> > > status back so it's one of the regulators for which this property was
> > > invented. This is a real limitation of the Linux APIs, with most
> > > hardware you can actually read the status back so we shouldn't need
> > > this.
>
> > I know and I followed the discussion between you and Doug. But it
> > is a valid use-case to have a external gpio-enabled regualtor connected
> > to a panel. If I don't mark the regulator as 'regualtor-boot-on' and use
> > the fixed.c driver (IMHO this is correct), the regulator gets disabled
> > during probe. So I will have a panel off/ panel on sequence during boot.
>
> Right, this is why I am saying that this is one of the regulators for
> which this property was defined and where you should be using it.
>
> > To avoid this I set the 'regualtor-boot-on' property but then I can't
> > disable the panel during suspend..
>
> As you'll have seen from the discussion that's a bug, nothing should be
> taking a reference to the regulator outside of explicit enable calls.

Okay now we are on the right way :) Is the solution proposed by Doug:
".. we need to match "regulator->enable_count" to "rdev->use_count" at
the end of _regulator_get() in the exclusive case..." the correct fix?

Another question. Please can you have a look on the "DA9062 PMIC fixes
and features" series as well?

Regards,
Marco