Re: [PATCH 4/4] regulator: qcom: Rework to single platform device

From: Mark Brown
Date: Wed Mar 04 2015 - 19:30:37 EST

On Wed, Mar 04, 2015 at 11:35:43AM -0800, Stephen Boyd wrote:

> There's another problem with this of_parse_cb design. The regulator
> framework requires supplies to be registered before consumers of the
> supplies are registered. So when we register L23 we need to make sure
> it's supply is already registered (S8 for example). If we used
> of_regulator_match() we could sort the array by hand so that we always
> register the supplies first. Or we could modify the regulator framework
> to have a concept of "orphaned" supplies like the clock framework has so
> that when a regulator is registered it waits until its supply is registered.

Dependency resolution isn't anything new, I'm not sure why you think
this is related to of_parse_cb()? Open coding does exactly the same
thing and the ability to have device specific properties on is not
obviously related to dependency resolution so perhaps I'm
misunderstanding what you're talking about...

If you *are* talking about dependency resolution then just bulk
registering the regulators (which we should be doing anyway) and then
iterating the array until we stop making progress should do the trick
for most cases, normally there's only one PMIC in play, or have people
who care do a single struct device per regulator and then let the probe
deferral stuff sort it out.

I'm a bit nervous of the idea of having orphaning without core support,
it's not just inter regulator dependencies we need to worry about (they
use GPIOs and so on) and there's concerns about debuggability but it is
the kind of thing probe deferral was meant to be a cheap implementation
of. There was a proposal quite recently from someone at Samsung Poland
to do something more coreish and basically split registrations in two,
one half registering the things needed for each resource and then a
second half which runs once the required resources are registered.
Pushing that along might be best, it's a more general approach. The
component stuff Russell did has some similarities here.

Attachment: signature.asc
Description: Digital signature