Re: Regulator supplies when using Device Tree

From: Michael Bohan
Date: Mon Apr 02 2012 - 13:35:53 EST


On 3/30/2012 3:36 AM, Mark Brown wrote:
On Thu, Mar 29, 2012 at 06:18:44PM -0700, Michael Bohan wrote:
Can you please elaborate on why this is a bad design? We have always
used this model in the past, and the regulator framework is happy to
support it.

The support for regulator-regulator supplies has always been problematic
and infrequently used -

Hmm, I'd be interested to know the history there.

Please be more specific about what you're actually trying to physically
accomplish here. It would be *extremely* unusual to see a regulator
which was able to do something useful without any input power and if you
genuinely have this need whatever you're doing probably needs the
framework to actually be aware of what's going on. However...

Some of our regulators take inputs from other regulators. Some regulators take their input from the battery. We support both types in the same driver, since the hardware is the same. Thus this supply configuration is natural and matches our hardware closely. The actual connections of our regulators varies between different board designs.

If you're interested, you can checkout some sample driver code:

https://www.codeaurora.org/gitweb/quic/la/?p=kernel/msm.git;a=blob;f=drivers/regulator/pm8xxx-regulator.c;h=fd691f051428158d3543dd7562e4f5e26e905962;hb=msm-3.0

And see how we pass the supply names and other parameters here:

https://www.codeaurora.org/gitweb/quic/la/?p=kernel/msm.git;a=blob;f=arch/arm/mach-msm/board-8960-regulator.c;h=23e3e690ff0e582fd947553a51015f5059750cdf;hb=msm-3.0

We have a table of devices with associated data attributes -- one of them being supplies. For devices with supplies, the name is specified. For devices without supplies, nothing is specified. This works well since then the driver doesn't need to check whether there exists a supply or not.

I was hoping that we could continue to treat regulator supplies as
normal supplies, but somehow allow the framework to determine
whether a regulator supply exists or not in the Device Tree
configuration so the driver doesn't have to.

...this doesn't really make any sense - the new scheme makes regulator
supplies *more* like normal supplies, not less, since they're now
specified in exactly the same way as other supplies and are just assumed
to be provided by the leaf driver.

I don't disagree that the new scheme makes supplies more like normal supplies. I'm just pointing out the solution doesn't appear perfect since extraneous code is put in the driver in this case.

Thanks,
Mike

--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/