Re: [PATCH 1/2] dt-bindings: power: Add regulator-pd yaml file

From: Ulf Hansson
Date: Thu Aug 24 2023 - 05:28:17 EST


On Fri, 18 Aug 2023 at 17:35, Shenwei Wang <shenwei.wang@xxxxxxx> wrote:
>
> Documenting the regulator power domain properties and usage examples.

As Rob and Krzysztof already pointed out, I agree that this binding
looks a bit questionable.

Rather than adding a new DT binding, why can't we just use the
existing way of describing a platform specific power-domain provider?
This still looks platform specific to me.

Kind regards
Uffe

>
> Signed-off-by: Shenwei Wang <shenwei.wang@xxxxxxx>
> ---
> .../bindings/power/regulator-pd.yaml | 71 +++++++++++++++++++
> 1 file changed, 71 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/power/regulator-pd.yaml
>
> diff --git a/Documentation/devicetree/bindings/power/regulator-pd.yaml b/Documentation/devicetree/bindings/power/regulator-pd.yaml
> new file mode 100644
> index 000000000000..181d2fa83f8a
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power/regulator-pd.yaml
> @@ -0,0 +1,71 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/power/regulator-pd.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Regulator Power Domain
> +
> +maintainers:
> + - Shenwei Wang <shenwei.wang@xxxxxxx>
> +
> +description: |
> + This describes a power domain which manages a group of regulators.
> +
> +allOf:
> + - $ref: power-domain.yaml#
> +
> +properties:
> + compatible:
> + items:
> + - const: regulator-power-domain
> +
> + '#power-domain-cells':
> + const: 1
> +
> + regulator-number:
> + minimum: 1
> + maximum: 100
> + description: The count of regulator to be managed by this power domain
> +
> +patternProperties:
> + "regulator-[0-99]-supply$":
> + description: The regulator supply phandle to be managed by this power domain
> +
> +required:
> + - compatible
> + - '#power-domain-cells'
> + - regulator-number
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/gpio/gpio.h>
> +
> + reg1: regulator-1 {
> + compatible = "regulator-fixed";
> + regulator-name = "REG1";
> + regulator-min-microvolt = <3000000>;
> + regulator-max-microvolt = <3000000>;
> + gpio = <&lsio_gpio4 19 GPIO_ACTIVE_HIGH>;
> + enable-active-high;
> + };
> +
> + reg2: regulator-2 {
> + compatible = "regulator-fixed";
> + regulator-name = "REG2";
> + regulator-min-microvolt = <3000000>;
> + regulator-max-microvolt = <3000000>;
> + gpio = <&lsio_gpio4 20 GPIO_ACTIVE_HIGH>;
> + enable-active-high;
> + };
> +
> + power-controller {
> + compatible = "regulator-power-domain";
> + #power-domain-cells = <1>;
> +
> + regulator-number = <2>;
> + regulator-0-supply = <&reg1>;
> + regulator-1-supply = <&reg2>;
> + };
> --
> 2.34.1
>