diff mbox series

[v3,2/2] regulator: mt6360: Add DT binding documentation

Message ID 1597910022-22617-3-git-send-email-gene.chen.richtek@gmail.com
State Changes Requested, archived
Headers show
Series regulator: mt6360: Add support for MT6360 regulator | expand

Checks

Context Check Description
robh/checkpatch success
robh/dt-meta-schema success

Commit Message

Gene Chen Aug. 20, 2020, 7:53 a.m. UTC
From: Gene Chen <gene_chen@richtek.com>

Add a devicetree binding documentation for the mt6360 regulator driver.

Signed-off-by: Gene Chen <gene_chen@richtek.com>
---
 .../bindings/regulator/mt6360-regulator.yaml       | 109 +++++++++++++++++++++
 1 file changed, 109 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/mt6360-regulator.yaml

Comments

Mark Brown Aug. 20, 2020, 11:30 a.m. UTC | #1
On Thu, Aug 20, 2020 at 03:53:42PM +0800, Gene Chen wrote:

> +properties:
> +  compatible:
> +    const: mediatek,mt6360-regulator
> +
> +  LDO_VIN3-supply:
> +    description: Input supply phandle(s) for LDO3
> +

Only LDO3 needs a supply?
Gene Chen Aug. 24, 2020, 7:21 a.m. UTC | #2
⊕

Mark Brown <broonie@kernel.org> 於 2020年8月20日 週四 下午7:30寫道:
>
> On Thu, Aug 20, 2020 at 03:53:42PM +0800, Gene Chen wrote:
>
> > +properties:
> > +  compatible:
> > +    const: mediatek,mt6360-regulator
> > +
> > +  LDO_VIN3-supply:
> > +    description: Input supply phandle(s) for LDO3
> > +
>
> Only LDO3 needs a supply?

LDO_VIN1/LDO_VIN2 is real MT6360 pin supply from VSYS to LDO1/2/3/5
LDO_VIN3 is also real pin supply from BUCK2 to LDO6/7
Mark Brown Aug. 24, 2020, 7:48 p.m. UTC | #3
On Mon, Aug 24, 2020 at 03:21:57PM +0800, Gene Chen wrote:
> > On Thu, Aug 20, 2020 at 03:53:42PM +0800, Gene Chen wrote:

> > > +  LDO_VIN3-supply:
> > > +    description: Input supply phandle(s) for LDO3

> > Only LDO3 needs a supply?

> LDO_VIN1/LDO_VIN2 is real MT6360 pin supply from VSYS to LDO1/2/3/5
> LDO_VIN3 is also real pin supply from BUCK2 to LDO6/7

So shouldn't there be a documented LDO_VIN1/2 then?
Gene Chen Aug. 25, 2020, 9:21 a.m. UTC | #4
Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 上午3:49寫道:
>
> On Mon, Aug 24, 2020 at 03:21:57PM +0800, Gene Chen wrote:
> > > On Thu, Aug 20, 2020 at 03:53:42PM +0800, Gene Chen wrote:
>
> > > > +  LDO_VIN3-supply:
> > > > +    description: Input supply phandle(s) for LDO3
>
> > > Only LDO3 needs a supply?
>
> > LDO_VIN1/LDO_VIN2 is real MT6360 pin supply from VSYS to LDO1/2/3/5
> > LDO_VIN3 is also real pin supply from BUCK2 to LDO6/7
>
> So shouldn't there be a documented LDO_VIN1/2 then?

LDO_VINx is HW design layout, so actually it can't be changed by device tree.
LDO_VIN1/LDO_VIN2 supply from VSYS, not regulator, so I think usually
not to show the supply from in device tree.
or I should declare a dummy reference to system power like "*-supply =
<&system_power>;"?
Mark Brown Aug. 25, 2020, 9:34 a.m. UTC | #5
On Tue, Aug 25, 2020 at 05:21:06PM +0800, Gene Chen wrote:
> Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 上午3:49寫道:

> > So shouldn't there be a documented LDO_VIN1/2 then?

> LDO_VINx is HW design layout, so actually it can't be changed by device tree.
> LDO_VIN1/LDO_VIN2 supply from VSYS, not regulator, so I think usually
> not to show the supply from in device tree.
> or I should declare a dummy reference to system power like "*-supply =
> <&system_power>;"?

When you say it's from the hardware design do you mean it's fixed by the
silicon or is this something that's fixed in the board?
Gene Chen Aug. 25, 2020, 10:01 a.m. UTC | #6
Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 下午5:34寫道:
>
> On Tue, Aug 25, 2020 at 05:21:06PM +0800, Gene Chen wrote:
> > Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 上午3:49寫道:
>
> > > So shouldn't there be a documented LDO_VIN1/2 then?
>
> > LDO_VINx is HW design layout, so actually it can't be changed by device tree.
> > LDO_VIN1/LDO_VIN2 supply from VSYS, not regulator, so I think usually
> > not to show the supply from in device tree.
> > or I should declare a dummy reference to system power like "*-supply =
> > <&system_power>;"?
>
> When you say it's from the hardware design do you mean it's fixed by the
> silicon or is this something that's fixed in the board?

fixed in the board, not silicon.
Mark Brown Aug. 25, 2020, 10:08 a.m. UTC | #7
On Tue, Aug 25, 2020 at 06:01:46PM +0800, Gene Chen wrote:
> Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 下午5:34寫道:

> > > LDO_VINx is HW design layout, so actually it can't be changed by device tree.
> > > LDO_VIN1/LDO_VIN2 supply from VSYS, not regulator, so I think usually
> > > not to show the supply from in device tree.
> > > or I should declare a dummy reference to system power like "*-supply =
> > > <&system_power>;"?

> > When you say it's from the hardware design do you mean it's fixed by the
> > silicon or is this something that's fixed in the board?

> fixed in the board, not silicon.

Ah, if it's fixed by the board that's exactly the sort of thing that
should be in DT - the DT describes the board so if some other system has
a different configuration then it will have a different DT.  With supply
properties you can just leave them missing in the DT, you're not
supposed to but so many systems do it that the framework will handle it.
Otherwise if you want to represent VSYS you can have a fixed voltage
regulator with no control and hook them up to it.
Gene Chen Aug. 25, 2020, 11:07 a.m. UTC | #8
Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 下午6:08寫道:
>
> On Tue, Aug 25, 2020 at 06:01:46PM +0800, Gene Chen wrote:
> > Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 下午5:34寫道:
>
> > > > LDO_VINx is HW design layout, so actually it can't be changed by device tree.
> > > > LDO_VIN1/LDO_VIN2 supply from VSYS, not regulator, so I think usually
> > > > not to show the supply from in device tree.
> > > > or I should declare a dummy reference to system power like "*-supply =
> > > > <&system_power>;"?
>
> > > When you say it's from the hardware design do you mean it's fixed by the
> > > silicon or is this something that's fixed in the board?
>
> > fixed in the board, not silicon.
>
> Ah, if it's fixed by the board that's exactly the sort of thing that
> should be in DT - the DT describes the board so if some other system has
> a different configuration then it will have a different DT.  With supply
> properties you can just leave them missing in the DT, you're not
> supposed to but so many systems do it that the framework will handle it.
> Otherwise if you want to represent VSYS you can have a fixed voltage
> regulator with no control and hook them up to it.

ok, I think I will follow the framework to handle it.
I will add supply description in devicetree
  LDO_VIN1-supply:
    description: Input supply phandle(s) for LDO1/2/3 which is supply from VSYS
  LDO_VIN2-supply:
    description: Input supply phandle(s) for LDO5 which is supply from
VSYS
  LDO_VIN3-supply:
    description: Input supply phandle(s) for LDO6/7
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/regulator/mt6360-regulator.yaml b/Documentation/devicetree/bindings/regulator/mt6360-regulator.yaml
new file mode 100644
index 0000000..bd66754
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/mt6360-regulator.yaml
@@ -0,0 +1,109 @@ 
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/mt6360-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MT6360 Regulator from MediaTek Integrated
+
+maintainers:
+  - Gene Chen <gene_chen@richtek.com>
+
+description: |
+  list of regulators provided by this controller, must be named
+  after their hardware counterparts buck1/2 or ldo1/2/3/5/6/7
+
+properties:
+  compatible:
+    const: mediatek,mt6360-regulator
+
+  LDO_VIN3-supply:
+    description: Input supply phandle(s) for LDO3
+
+patternProperties:
+  "^buck[12]$":
+    $ref: "regulator.yaml#"
+
+  "^ldo[123567]$":
+    $ref: "regulator.yaml#"
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/regulator/mediatek,mt6360-regulator.h>
+    regulator {
+      compatible = "mediatek,mt6360-regulator";
+      LDO_VIN3-supply = <&BUCK2>;
+      buck1 {
+        regulator-compatible = "BUCK1";
+        regulator-name = "mt6360,buck1";
+        regulator-min-microvolt = <300000>;
+        regulator-max-microvolt = <1300000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP
+             MT6360_OPMODE_ULP>;
+      };
+      BUCK2: buck2 {
+        regulator-compatible = "BUCK2";
+        regulator-name = "mt6360,buck2";
+        regulator-min-microvolt = <300000>;
+        regulator-max-microvolt = <1300000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP
+             MT6360_OPMODE_ULP>;
+      };
+      ldo6 {
+        regulator-compatible = "LDO6";
+        regulator-name = "mt6360,ldo6";
+        regulator-min-microvolt = <500000>;
+        regulator-max-microvolt = <2100000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP>;
+      };
+      ldo7 {
+        regulator-compatible = "LDO7";
+        regulator-name = "mt6360,ldo7";
+        regulator-min-microvolt = <500000>;
+        regulator-max-microvolt = <2100000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP>;
+      };
+      ldo1 {
+        regulator-compatible = "LDO1";
+        regulator-name = "mt6360,ldo1";
+        regulator-min-microvolt = <1200000>;
+        regulator-max-microvolt = <3600000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP>;
+      };
+        ldo2 {
+        regulator-compatible = "LDO2";
+        regulator-name = "mt6360,ldo2";
+        regulator-min-microvolt = <1200000>;
+        regulator-max-microvolt = <3600000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP>;
+      };
+      ldo3 {
+        regulator-compatible = "LDO3";
+        regulator-name = "mt6360,ldo3";
+        regulator-min-microvolt = <1200000>;
+        regulator-max-microvolt = <3600000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP>;
+      };
+      ldo5 {
+        regulator-compatible = "LDO5";
+        regulator-name = "mt6360,ldo5";
+        regulator-min-microvolt = <2700000>;
+        regulator-max-microvolt = <3600000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP>;
+      };
+    };
+...