diff mbox series

[v2,2/2] dt-bindings: regulator: Add bindings for Unisoc's SC2730 regulator

Message ID 20211008031953.339461-3-zhang.lyra@gmail.com
State Not Applicable, archived
Headers show
Series Add Unisoc's SC2730 regulator support | expand

Checks

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

Commit Message

Chunyan Zhang Oct. 8, 2021, 3:19 a.m. UTC
From: Chunyan Zhang <chunyan.zhang@unisoc.com>

SC2730 is used on Unisoc's UMS512 SoC, it integrates low-voltage and low
quiescent current DCDC/LDO.

Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
 .../regulator/sprd,sc2730-regulator.yaml      | 61 +++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/sprd,sc2730-regulator.yaml

Comments

Mark Brown Nov. 12, 2021, 1:46 p.m. UTC | #1
On Fri, Oct 08, 2021 at 11:19:53AM +0800, Chunyan Zhang wrote:

> +properties:
> +  compatible:
> +    const: sprd,sc2730-regulator

I still don't understand why this MFD subfunction for a specific device
is a separate binding with a separate compatible string, the issues I
mentioned previously with this just encoding current Linux internals
into the DT rather than describing the device still apply.
Chunyan Zhang Sept. 22, 2022, 8:25 a.m. UTC | #2
Hi Mark,

Sorry for the late response.
[1] is the v1 on which we had some discussion. I hope that can help
recall the issue below.

On Fri, 12 Nov 2021 at 21:46, Mark Brown <broonie@kernel.org> wrote:
>
> On Fri, Oct 08, 2021 at 11:19:53AM +0800, Chunyan Zhang wrote:
>
> > +properties:
> > +  compatible:
> > +    const: sprd,sc2730-regulator
>
> I still don't understand why this MFD subfunction for a specific device
> is a separate binding with a separate compatible string, the issues I
> mentioned previously with this just encoding current Linux internals
> into the DT rather than describing the device still apply.

I understand your point. But like I described previously [1], if we
still use the current solution (i.e. use devm_of_platform_populate()
to register MFD subdevices), a compatible string is required. I'm open
to switching to other solutions, do you have some suggestions?

Thanks,
Chunyan

[1] https://lkml.org/lkml/2021/9/29/1166
Lee Jones Sept. 22, 2022, 10:19 a.m. UTC | #3
On Thu, 22 Sep 2022, Chunyan Zhang wrote:

> Hi Mark,
> 
> Sorry for the late response.
> [1] is the v1 on which we had some discussion. I hope that can help
> recall the issue below.
> 
> On Fri, 12 Nov 2021 at 21:46, Mark Brown <broonie@kernel.org> wrote:
> >
> > On Fri, Oct 08, 2021 at 11:19:53AM +0800, Chunyan Zhang wrote:
> >
> > > +properties:
> > > +  compatible:
> > > +    const: sprd,sc2730-regulator
> >
> > I still don't understand why this MFD subfunction for a specific device
> > is a separate binding with a separate compatible string, the issues I
> > mentioned previously with this just encoding current Linux internals
> > into the DT rather than describing the device still apply.
> 
> I understand your point. But like I described previously [1], if we
> still use the current solution (i.e. use devm_of_platform_populate()
> to register MFD subdevices), a compatible string is required. I'm open
> to switching to other solutions, do you have some suggestions?

Many IPs encompassing multiple functions are described that way in
DT.  I don't have the details for *this* device to hand, so my
comments here aren't specific to this use-case, but describing each
function individually does describe the H/W accurately, which is all
DT calls for.

Can you imagine describing an SoC, which can be considered as a huge
MFD, with only a single node?

Does the regulator functionality have it's own bank of registers?
Mark Brown Sept. 22, 2022, 11:43 a.m. UTC | #4
On Thu, Sep 22, 2022 at 11:19:08AM +0100, Lee Jones wrote:
> On Thu, 22 Sep 2022, Chunyan Zhang wrote:

> > I understand your point. But like I described previously [1], if we
> > still use the current solution (i.e. use devm_of_platform_populate()
> > to register MFD subdevices), a compatible string is required. I'm open
> > to switching to other solutions, do you have some suggestions?
> 
> Many IPs encompassing multiple functions are described that way in
> DT.  I don't have the details for *this* device to hand, so my
> comments here aren't specific to this use-case, but describing each
> function individually does describe the H/W accurately, which is all
> DT calls for.

If people want to describe the individual regulators that'd be
less of an issue, it's mainly when you're nesting what's
effectively another MFD within a parent MFD that it's just noise
that's being added to the DT.

> Can you imagine describing an SoC, which can be considered as a huge
> MFD, with only a single node?

Honestly we should be arranging things so they're more like that,
at least using overlays for the internals of the SoC so you don't
have to rebuild the whole DT for updates to the SoC internals.
Lee Jones Sept. 26, 2022, 6:59 a.m. UTC | #5
On Thu, 22 Sep 2022, Mark Brown wrote:

> On Thu, Sep 22, 2022 at 11:19:08AM +0100, Lee Jones wrote:
> > On Thu, 22 Sep 2022, Chunyan Zhang wrote:
> 
> > > I understand your point. But like I described previously [1], if we
> > > still use the current solution (i.e. use devm_of_platform_populate()
> > > to register MFD subdevices), a compatible string is required. I'm open
> > > to switching to other solutions, do you have some suggestions?
> > 
> > Many IPs encompassing multiple functions are described that way in
> > DT.  I don't have the details for *this* device to hand, so my
> > comments here aren't specific to this use-case, but describing each
> > function individually does describe the H/W accurately, which is all
> > DT calls for.
> 
> If people want to describe the individual regulators that'd be
> less of an issue, it's mainly when you're nesting what's
> effectively another MFD within a parent MFD that it's just noise
> that's being added to the DT.

As I say, I haven't studied this use-case.

These comments were designed to be more generic.

What do you mean by nested MFDs?

> > Can you imagine describing an SoC, which can be considered as a huge
> > MFD, with only a single node?
> 
> Honestly we should be arranging things so they're more like that,
> at least using overlays for the internals of the SoC so you don't
> have to rebuild the whole DT for updates to the SoC internals.

Right, there would be one device root node.  However each function;
clock providers, regulator controllers, PWMs, GPIOs, networking
(various), reset, watchdog, etc would have their own nodes.  Rather
than attempting to describe everything in the parent's node.
Mark Brown Sept. 28, 2022, 5:27 p.m. UTC | #6
On Mon, Sep 26, 2022 at 07:59:08AM +0100, Lee Jones wrote:
> On Thu, 22 Sep 2022, Mark Brown wrote:

> > If people want to describe the individual regulators that'd be
> > less of an issue, it's mainly when you're nesting what's
> > effectively another MFD within a parent MFD that it's just noise
> > that's being added to the DT.

> As I say, I haven't studied this use-case.

> These comments were designed to be more generic.

> What do you mean by nested MFDs?

Given that individual regulators tend to be separate physical IPs in the
chip if you create a single device tree node that lumps them together
you still need to also represent the individual regulators as well so
that collection is functioning like a MFD does except not on a chip
boundary.

> > > Can you imagine describing an SoC, which can be considered as a huge
> > > MFD, with only a single node?

> > Honestly we should be arranging things so they're more like that,
> > at least using overlays for the internals of the SoC so you don't
> > have to rebuild the whole DT for updates to the SoC internals.

> Right, there would be one device root node.  However each function;
> clock providers, regulator controllers, PWMs, GPIOs, networking
> (various), reset, watchdog, etc would have their own nodes.  Rather
> than attempting to describe everything in the parent's node.

We don't split things up by function, we split them up by IP - we don't
just allocate a compatible for all the networking related functionality
simply because there's a networking subsystem in Linux for example.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/regulator/sprd,sc2730-regulator.yaml b/Documentation/devicetree/bindings/regulator/sprd,sc2730-regulator.yaml
new file mode 100644
index 000000000000..6d1bec03eb52
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/sprd,sc2730-regulator.yaml
@@ -0,0 +1,61 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright 2019-2021 Unisoc Inc.
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/regulator/sprd,sc2730-regulator.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Unisoc SC2730 Voltage Regulators Device Tree Bindings
+
+maintainers:
+  - Orson Zhai <orsonzhai@gmail.com>
+  - Baolin Wang <baolin.wang7@gmail.com>
+  - Chunyan Zhang <zhang.lyra@gmail.com>
+
+properties:
+  compatible:
+    const: sprd,sc2730-regulator
+
+  reg:
+    maxItems: 1
+
+patternProperties:
+  "^(DCDC|BUCK|LDO)_.+":
+    # Child node
+    type: object
+    description: dcdc/buck/ldo regulator nodes(s).
+    $ref: "regulator.yaml#"
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    pmic {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      regulators@1800 {
+        compatible = "sprd,sc2730-regulator";
+        reg = <0x1800>;
+
+        DCDC_CPU {
+          regulator-name = "vddcpu";
+          regulator-min-microvolt = <200000>;
+          regulator-max-microvolt = <1596875>;
+          regulator-ramp-delay = <25000>;
+          regulator-always-on;
+        };
+
+        LDO_VDDWCN {
+          regulator-name = "vddwcn";
+          regulator-min-microvolt = <900000>;
+          regulator-max-microvolt = <1845000>;
+          regulator-ramp-delay = <25000>;
+        };
+      };
+    };
+...