[1/4] devicetree: add a binding for a regulator that constrains its supply
diff mbox

Message ID 1416834123-23139-1-git-send-email-alban.bedel@avionic-design.de
State New, archived
Headers show

Commit Message

Alban Bedel Nov. 24, 2014, 1:02 p.m. UTC
Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de>
---
 .../bindings/regulator/constrained-supply.txt      | 29 ++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/constrained-supply.txt

Comments

Mark Brown Nov. 24, 2014, 3:15 p.m. UTC | #1
On Mon, Nov 24, 2014 at 02:02:00PM +0100, Alban Bedel wrote:

> +Constrained Supply Regulator
> +
> +This binding allow creating a virtual regulator that constrain its
> +supply to provides the requested voltage. This is to allow using
> +simple drivers that don't explicitly request a voltage on boards
> +that have adjustable hardware regulators.
> +
> +Required properties:
> +- compatible : Must be "regulator-constrained-supply".
> +- vin-supply : phandle to the parent supply/regulator node

Reading this description I'm at a loss to explain what this is intended
to achieve - it's obviously not describing hardware which is a rather
large alarm bell and I don't really understand why the constraints
wouldn't be set on the parent regulator.
Alban Bedel Nov. 24, 2014, 5:12 p.m. UTC | #2
On Mon, 24 Nov 2014 15:15:27 +0000
Mark Brown <broonie@kernel.org> wrote:

> On Mon, Nov 24, 2014 at 02:02:00PM +0100, Alban Bedel wrote:
> 
> > +Constrained Supply Regulator
> > +
> > +This binding allow creating a virtual regulator that constrain its
> > +supply to provides the requested voltage. This is to allow using
> > +simple drivers that don't explicitly request a voltage on boards
> > +that have adjustable hardware regulators.
> > +
> > +Required properties:
> > +- compatible : Must be "regulator-constrained-supply".
> > +- vin-supply : phandle to the parent supply/regulator node
> 
> Reading this description I'm at a loss to explain what this is intended
> to achieve - it's obviously not describing hardware which is a rather
> large alarm bell and I don't really understand why the constraints
> wouldn't be set on the parent regulator.

Yes, it is not real hardware. The use case is a generic base board with
one regulator for add-on boards that has a settable voltage output. In
the base board DTS the regulator constraints represent the whole range
that the regulator is capable of, for example 1V to 12V.

Using this driver the DTS for the add-on board can further constrain
this supply to get the voltage it need, for example 3.3V. I understand
that normally the drivers for the consumers on the add-on board should
do this, however I don't really see how that is possible with generic
drivers like simple-panel. Such driver target a large range of
hardware, so just setting an  arbitrary voltage doesn't make much sense.
Furthermore even driver that target a specific hardware usually don't
set a voltage and in many case they couldn't do it without some
knowledge of the board design.

I saw 3 ways to solve this problem:

1) This, use a "filter" regulator
2) Extend each and every driver that use a voltage regulator to
   optionally set the voltage
3) Include the required range in the phandle reference

#1 was the easiest :) #2 doesn't seems practical to me, #3 seems pretty
good but I'm really not sure if that would be acceptable.

Alban
Mark Brown Nov. 24, 2014, 6:04 p.m. UTC | #3
On Mon, Nov 24, 2014 at 06:12:33PM +0100, Alban Bedel wrote:

> Using this driver the DTS for the add-on board can further constrain
> this supply to get the voltage it need, for example 3.3V. I understand

> I saw 3 ways to solve this problem:

> 1) This, use a "filter" regulator
> 2) Extend each and every driver that use a voltage regulator to
>    optionally set the voltage
> 3) Include the required range in the phandle reference

> #1 was the easiest :) #2 doesn't seems practical to me, #3 seems pretty
> good but I'm really not sure if that would be acceptable.

The DT overlay for the add on board should be setting the constraints
for the parent regulator.  I wouldn't expect the final DT to look any
different to how it looks with no hardware modularity unless the actual
module is interesting enough to have a driver of its own.

Patch
diff mbox

diff --git a/Documentation/devicetree/bindings/regulator/constrained-supply.txt b/Documentation/devicetree/bindings/regulator/constrained-supply.txt
new file mode 100644
index 0000000..3c85430
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/constrained-supply.txt
@@ -0,0 +1,29 @@ 
+Constrained Supply Regulator
+
+This binding allow creating a virtual regulator that constrain its
+supply to provides the requested voltage. This is to allow using
+simple drivers that don't explicitly request a voltage on boards
+that have adjustable hardware regulators.
+
+Required properties:
+- compatible : Must be "regulator-constrained-supply".
+- vin-supply : phandle to the parent supply/regulator node
+
+Optional properties:
+- any property defined in regulator.txt
+
+Example:
+
+  /* Adjustable regulator for extension boards */
+  vdd_ext: regulator@0 {
+  	regulator-min-microvolt = <1000000>;
+  	regulator-max-microvolt = <10000000>;
+  };
+
+  /* An extension board that need 3.3V */
+  vdd_ext_board1: regulator@1 {
+	compatible = "regulator-constrained-supply";
+  	regulator-min-microvolt = <3300000>;
+  	regulator-max-microvolt = <3300000>;
+	vin-supply = <&vdd_ext>;
+  };