Re: [PATCH] regulator: Defer init completion for a while after late_initcall

From: Torsten Duwe
Date: Sat Nov 30 2019 - 10:27:35 EST


On Mon, Nov 18, 2019 at 08:29:49PM +0000, Mark Brown wrote:
> On Mon, Nov 18, 2019 at 08:40:12PM +0100, Torsten Duwe wrote:
>
> > kernel: anx6345 0-0038: 0-0038 supply dvdd12-supply not found, using dummy regulator
> > kernel: anx6345 0-0038: 0-0038 supply dvdd25-supply not found, using dummy regulator
>
> > DT has:
> > dvdd25-supply = <&reg_dldo2>;
> > dvdd12-supply = <&reg_dldo3>;

Note these 4 lines...

> > It's only that the regulator driver module has not fully loaded at that point.
>
> We substitute in the dummy regulator in regulator_get() if
> regulator_dev_lookup() returns -ENODEV and a few other conditions are
> satisfied. When lookup up via DT regulator_dev_lookup() will use
> of_find_regulator_by_node() to look up the regulator, if that lookup
> fails it returns -EPROBE_DEFER. Until we get to of_find_regulator_by_node()
> we're just looking to see if nodes exist, not to see if anything is
> registered. What mechanism do you see causing issues? If there's
> something going wrong here it's in that area.

First of all: thanks a lot! This has put me onto the right track.

> As far as I can tell whatever is going on with your system it's only
> ever been working through luck.

Yes indeed. It turned out the regulators were still on from U-Boot
and that code never worked.

> Without any specific references to
> what's going on in the system it's hard to tell what might be happening,

Well, actually the 4 lines above give a good hint :) of_get_regulator()
will look for "dvdd25-supply-supply". I'm fairly relieved that even you
didn't spot this right away. The fix just went to dri-devel, you're Cc'ed.
Unfortunately the documentation for this is buried in the git commit log.

For the record: I'm still convinced that the original change can uncover
bugs unexpectedly, and is not suited for -stable.

Thanks for the help, and sorry for the non-standard nomenclature.

Torsten