Re: [PATCH v4 1/4] regulator: helper routine to extract regulator_init_data

Olof Johansson
2011-11-04T22:16:15Z

On Fri, Nov 4, 2011 at 2:46 PM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
> On Fri, Nov 04, 2011 at 02:34:35PM -0700, Olof Johansson wrote:
>> On Fri, Nov 4, 2011 at 2:29 PM, Mark Brown
>
>> > I think it's useful to define how consumers are supposed to do this
>> > somewhere - it is actually part of the core binding how consumers are
>> > supposed to do this.
>
>> Yeah, ok, but it shouldn't be part of the description of regulator
>> properties per se. See how gpio does it, defining how a gpio-specifier
>> is crafted. The equivalent should be done for regulators.
>
> That seems to be pretty much exactly what's being done here, and like
> the GPIO bindings it's specified in the core document.  Though perhaps
> there's some aspect of how the document is written that's missing.

Yep, sounds good. A slightly more elaborate description of the binding
inspired by the gpio.txt document would be the way to do that.

> If you're talking about the specifics of the binding the GPIO bindings
> do suffer from the whole magic indexes into arrays problem that makes a
> lot of the older device tree bindings quite hard to read.

I wasn't talking about that in this case, but that is unfortunate and
I do agree that the ordered array of gpios is messy and hard to
follow.

I've been trying to catch those as they are introduced -- i.e. we
moved away from the magic array-of-three-gpios to discrete properties
on the sdhci binding for tegra, for example. We'll keep an eye on the
same for regulators.

>> > There's also a bit of magic here for chained supplies with one regulator
>> > supplying another (eg, using a DCDC to drop the system supply down to a
>> > lower voltage to supply a bunch of LDOs for improved efficiency).
>
>> Describing that in the device tree using regulator-specifiers
>> shouldn't be too bad? The LDO will reference the DCDC as the parent
>> supply (or input or whatever language you prefer). They don't have to
>> be in the same topology, they will instead be under whatever
>> controller/bus they are on for control -- i2c, etc.
>
> That's not great as it means you've got a separate binding for supplies
> that happen to be connected to another regulator from that used for
> other supplies on the device which is particularly confusing in the
> fairly common case where a regulator chip has multiple supplies.  Using
> the same method for binding all supplies seems much neater.

I'm not following the above 100%, but I think you are saying that you
would prefer to describe the regulator / power hierarchy in the
functional topology instead of how the various regulators and supplies
are organized on i2c busses and other controllers? And the obvious
one that would be less than trivial to find a home for would be the
top-level or freestanding fixed regulators that don't sit on a
controlling bus.

If that is the case then this is yet another case of where we have a
couple of different structures that are overlaid on each other in the
device tree. Another is/will be clocking.

That should be OK, since you can have a binding for your PMIC that
splits up the various rails in separate subnodes, where each can
specify a reference to the upstream supply for that rail, etc. Would
that work?

Finding a best-practices location for where to put the fixed
regulators that don't sit on a controlling bus would be the trickiest
part, and I suppose we will just have to make up a location for those
(/power-supplies or something). But various regulators will need to
be spread around the device tree a bit, in particular the i2c vs gpio
controlled ones will need to sit on their controlling busses.

-Olof