diff mbox series

[v1,1/5] dt-bindings: power: Add bindings for a power domain controlled by a regulator

Message ID 20220609150851.23084-2-max.oss.09@gmail.com
State New
Headers show
Series [v1,1/5] dt-bindings: power: Add bindings for a power domain controlled by a regulator | expand

Commit Message

Max Krummenacher June 9, 2022, 3:08 p.m. UTC
From: Max Krummenacher <max.krummenacher@toradex.com>

Adds binding for a power domain provider which uses a regulator to control
the power domain.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
---

 .../power/regulator-power-domain.yaml         | 58 +++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/regulator-power-domain.yaml

Comments

Geert Uytterhoeven June 14, 2022, 7:23 a.m. UTC | #1
Hi Max,

On Thu, Jun 9, 2022 at 5:16 PM Max Krummenacher <max.oss.09@gmail.com> wrote:
> From: Max Krummenacher <max.krummenacher@toradex.com>
>
> Adds binding for a power domain provider which uses a regulator to control
> the power domain.
>
> Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>

Thanks for your patch!

> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power/regulator-power-domain.yaml
> @@ -0,0 +1,58 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/power/regulator-power-domain.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Power domain controlled by a regulator
> +
> +maintainers:
> +  - Max Krummenacher <max.krummenacher@toradex.com>
> +
> +description: |+
> +  Power domain provider which uses a regulator to control
> +  the power domain.
> +
> +allOf:
> +  - $ref: "power-domain.yaml#"
> +
> +properties:
> +  compatible:
> +    enum:
> +      - regulator-pm-pd
> +
> +  power-supply:
> +    description: The regulator used to control the power domain.

I guess there can be more than one?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Max Krummenacher June 15, 2022, 3:18 p.m. UTC | #2
Hi

On Tue, Jun 14, 2022 at 9:24 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Max,
>
> On Thu, Jun 9, 2022 at 5:16 PM Max Krummenacher <max.oss.09@gmail.com> wrote:
> > From: Max Krummenacher <max.krummenacher@toradex.com>
> >
> > Adds binding for a power domain provider which uses a regulator to control
> > the power domain.
> >
> > Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
>
> Thanks for your patch!
>
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/power/regulator-power-domain.yaml
> > @@ -0,0 +1,58 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/power/regulator-power-domain.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Power domain controlled by a regulator
> > +
> > +maintainers:
> > +  - Max Krummenacher <max.krummenacher@toradex.com>
> > +
> > +description: |+
> > +  Power domain provider which uses a regulator to control
> > +  the power domain.
> > +
> > +allOf:
> > +  - $ref: "power-domain.yaml#"
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - regulator-pm-pd
> > +
> > +  power-supply:
> > +    description: The regulator used to control the power domain.
>
> I guess there can be more than one?

The proposed implementation currently only uses one.

When I did it I considered more than one regulator a rare use case and
I was under the impression that the generic power domain code
can handle multiple power domains. With that in mind I assumed that
one would create multiple regulator-pm-pd instances each controlling
one regulator and add all of them to the power-domains property of
the power domain consumer.

But it seems the implementation requires the power domain consumer
to handle that case in its code rather than relying on the generic code. [1]

Do you see a real world use case to handle multiple regulators?

Max

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/base/power/domain.c?id=8cb1cbd644d5bba5b72eedd632f249c1c677b792#n2290


>
> Gr{oetje,eeting}s,
>
>                         Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
Max Krummenacher June 15, 2022, 3:19 p.m. UTC | #3
Hi

On Fri, Jun 10, 2022 at 4:57 AM Rob Herring <robh@kernel.org> wrote:
>
> On Thu, 09 Jun 2022 17:08:47 +0200, Max Krummenacher wrote:
> > From: Max Krummenacher <max.krummenacher@toradex.com>
> >
> > Adds binding for a power domain provider which uses a regulator to control
> > the power domain.
> >
> > Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
> > ---
> >
> >  .../power/regulator-power-domain.yaml         | 58 +++++++++++++++++++
> >  1 file changed, 58 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/power/regulator-power-domain.yaml
> >
>
> My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> on your patch (DT_CHECKER_FLAGS is new in v5.13):
>
> yamllint warnings/errors:
>
> dtschema/dtc warnings/errors:
> /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/power/regulator-power-domain.example.dtb: power-sleep-moci: $nodename:0: 'power-sleep-moci' does not match '^(power-controller|power-domain)([@-].*)?$'
>         From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/power/regulator-power-domain.yaml

Will change to 'power-domain-sleep-moci' in V2.

Regards
Max

>
> doc reference errors (make refcheckdocs):
>
> See https://patchwork.ozlabs.org/patch/
>
> This check can fail if there are any dependencies. The base for a patch
> series is generally the most recent rc1.
>
> If you already ran 'make dt_binding_check' and didn't see the above
> error(s), then make sure 'yamllint' is installed and dt-schema is up to
> date:
>
> pip3 install dtschema --upgrade
>
> Please check and re-submit.
>
Krzysztof Kozlowski June 15, 2022, 5:16 p.m. UTC | #4
On 15/06/2022 08:19, Max Krummenacher wrote:
> Hi
> 
> On Fri, Jun 10, 2022 at 4:57 AM Rob Herring <robh@kernel.org> wrote:
>>
>> On Thu, 09 Jun 2022 17:08:47 +0200, Max Krummenacher wrote:
>>> From: Max Krummenacher <max.krummenacher@toradex.com>
>>>
>>> Adds binding for a power domain provider which uses a regulator to control
>>> the power domain.
>>>
>>> Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
>>> ---
>>>
>>>  .../power/regulator-power-domain.yaml         | 58 +++++++++++++++++++
>>>  1 file changed, 58 insertions(+)
>>>  create mode 100644 Documentation/devicetree/bindings/power/regulator-power-domain.yaml
>>>
>>
>> My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
>> on your patch (DT_CHECKER_FLAGS is new in v5.13):
>>
>> yamllint warnings/errors:
>>
>> dtschema/dtc warnings/errors:
>> /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/power/regulator-power-domain.example.dtb: power-sleep-moci: $nodename:0: 'power-sleep-moci' does not match '^(power-controller|power-domain)([@-].*)?$'
>>         From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/power/regulator-power-domain.yaml
> 
> Will change to 'power-domain-sleep-moci' in V2.
> 

Instead: power-domain
(names should be generic)


Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/power/regulator-power-domain.yaml b/Documentation/devicetree/bindings/power/regulator-power-domain.yaml
new file mode 100644
index 000000000000..2b49c4f2f866
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/regulator-power-domain.yaml
@@ -0,0 +1,58 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/regulator-power-domain.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Power domain controlled by a regulator
+
+maintainers:
+  - Max Krummenacher <max.krummenacher@toradex.com>
+
+description: |+
+  Power domain provider which uses a regulator to control
+  the power domain.
+
+allOf:
+  - $ref: "power-domain.yaml#"
+
+properties:
+  compatible:
+    enum:
+      - regulator-pm-pd
+
+  power-supply:
+    description: The regulator used to control the power domain.
+
+  label:
+    description: Human readable string defining the domain.
+
+  "#power-domain-cells":
+    const: 0
+
+  power-domains:
+    maxItems: 1
+
+required:
+  - compatible
+  - "#power-domain-cells"
+  - power-supply
+
+additionalProperties: true
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    reg_pd_sleep_moci: regulator-sleep-moci {
+        compatible = "regulator-fixed";
+        enable-active-high;
+        gpio = <&gpio5 1 GPIO_ACTIVE_HIGH>;
+        regulator-name = "CTRL_SLEEP_MOCI";
+    };
+
+    pd_sleep_moci: power-sleep-moci {
+        compatible = "regulator-pm-pd";
+        power-supply = <&reg_pd_sleep_moci>;
+        label = "pd_sleep_moci";
+        #power-domain-cells = <0>;
+    };