2020-08-20 07:56:48

by Gene Chen

[permalink] [raw]
Subject: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation

From: Gene Chen <[email protected]>

Add a devicetree binding documentation for the mt6360 regulator driver.

Signed-off-by: Gene Chen <[email protected]>
---
.../bindings/regulator/mt6360-regulator.yaml | 109 +++++++++++++++++++++
1 file changed, 109 insertions(+)
create mode 100644 Documentation/devicetree/bindings/regulator/mt6360-regulator.yaml

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 <[email protected]>
+
+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>;
+ };
+ };
+...
--
2.7.4


2020-08-20 11:40:31

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation

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?


Attachments:
(No filename) (253.00 B)
signature.asc (499.00 B)
Download all attachments

2020-08-24 07:23:02

by Gene Chen

[permalink] [raw]
Subject: Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation



Mark Brown <[email protected]> 於 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

2020-08-24 19:52:47

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation

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?


Attachments:
(No filename) (429.00 B)
signature.asc (499.00 B)
Download all attachments

2020-08-25 09:24:09

by Gene Chen

[permalink] [raw]
Subject: Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation

Mark Brown <[email protected]> 於 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>;"?

2020-08-25 10:03:44

by Gene Chen

[permalink] [raw]
Subject: Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation

Mark Brown <[email protected]> 於 2020年8月25日 週二 下午5:34寫道:
>
> On Tue, Aug 25, 2020 at 05:21:06PM +0800, Gene Chen wrote:
> > Mark Brown <[email protected]> 於 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.

2020-08-25 11:08:55

by Gene Chen

[permalink] [raw]
Subject: Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation

Mark Brown <[email protected]> 於 2020年8月25日 週二 下午6:08寫道:
>
> On Tue, Aug 25, 2020 at 06:01:46PM +0800, Gene Chen wrote:
> > Mark Brown <[email protected]> 於 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

2020-08-25 12:19:35

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation

On Tue, Aug 25, 2020 at 05:21:06PM +0800, Gene Chen wrote:
> Mark Brown <[email protected]> 於 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?


Attachments:
(No filename) (634.00 B)
signature.asc (499.00 B)
Download all attachments

2020-08-25 12:23:02

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation

On Tue, Aug 25, 2020 at 06:01:46PM +0800, Gene Chen wrote:
> Mark Brown <[email protected]> 於 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.


Attachments:
(No filename) (1.10 kB)
signature.asc (499.00 B)
Download all attachments