All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Samuel Holland <samuel@sholland.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Chen-Yu Tsai <wens@csie.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev
Subject: Re: [PATCH 1/2] regulator: dt-bindings: Add Allwinner D1 LDOs
Date: Mon, 1 Aug 2022 11:27:50 -0600	[thread overview]
Message-ID: <20220801172750.GA1198151-robh@kernel.org> (raw)
In-Reply-To: <20220801044758.12679-1-samuel@sholland.org>

On Sun, Jul 31, 2022 at 11:47:57PM -0500, Samuel Holland wrote:
> The Allwinner D1 SoC contains two pairs of in-package LDOs. One pair is
> for general purpose use. LDOA generally powers the board's 1.8 V rail.
> LDOB generally powers the in-package DRAM, where applicable.
> 
> The other pair of LDOs powers the analog power domains inside the SoC,
> including the audio codec, thermal sensor, and ADCs. These LDOs require
> a 0.9 V bandgap voltage reference. The calibration value for the voltage
> reference is stored in an eFuse, accessed via an NVMEM cell.
> 
> Neither LDO control register is in its own MMIO range; instead, each
> regulator device relies on a syscon exported by some "host" device node.
> Getting the register via a syscon avoids a dependency on the subsystem/
> driver for that host device (e.g. a functioning thermal sensor should
> not depend on having the audio codec driver loaded).
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
> 
>  .../allwinner,sun20i-d1-analog-ldos.yaml      | 77 +++++++++++++++++++
>  .../allwinner,sun20i-d1-system-ldos.yaml      | 55 +++++++++++++
>  2 files changed, 132 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/regulator/allwinner,sun20i-d1-analog-ldos.yaml
>  create mode 100644 Documentation/devicetree/bindings/regulator/allwinner,sun20i-d1-system-ldos.yaml
> 
> diff --git a/Documentation/devicetree/bindings/regulator/allwinner,sun20i-d1-analog-ldos.yaml b/Documentation/devicetree/bindings/regulator/allwinner,sun20i-d1-analog-ldos.yaml
> new file mode 100644
> index 000000000000..df648c56123d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/regulator/allwinner,sun20i-d1-analog-ldos.yaml
> @@ -0,0 +1,77 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/regulator/allwinner,sun20i-d1-analog-ldos.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Allwinner D1 Analog LDOs
> +
> +description:
> +  Allwinner D1 contains a set of LDOs which are designed to supply analog power
> +  inside and outside the SoC. They are controlled by a register within the audio
> +  codec MMIO space, but which is not part of the audio codec clock/reset domain,
> +  and so is exposed as a syscon.
> +
> +maintainers:
> +  - Samuel Holland <samuel@sholland.org>
> +
> +properties:
> +  compatible:
> +    enum:
> +      - allwinner,sun20i-d1-analog-ldos
> +
> +  nvmem-cells:
> +    items:
> +      - description: NVMEM cell for the calibrated bandgap reference trim value
> +
> +  nvmem-cell-names:
> +    items:
> +      - const: bg_trim
> +
> +  syscon:

'syscon' is not a generic property. Name it based on the block you are 
linking to or what the control is. 

Or better yet, if this is the only control interface, make this a child 
node of the referenced node instead.

> +    $ref: /schemas/types.yaml#/definitions/phandle
> +    description: phandle of the device containing the power register
> +
> +patternProperties:
> +  "^(aldo|hpldo)$":
> +    type: object
> +    $ref: regulator.yaml#

       unevaluatedProperties: false

> +
> +required:
> +  - compatible
> +  - nvmem-cells
> +  - nvmem-cell-names
> +  - syscon
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    sid: efuse {
> +        #address-cells = <1>;
> +        #size-cells = <1>;
> +
> +        bg_trim: bg-trim@28 {
> +            reg = <0x28 0x4>;
> +            bits = <16, 8>;
> +        };
> +    };
> +
> +    ldos-analog {
> +        compatible = "allwinner,sun20i-d1-analog-ldos";
> +        nvmem-cells = <&bg_trim>;
> +        nvmem-cell-names = "bg_trim";
> +        syscon = <&codec>;
> +
> +        reg_aldo: aldo {
> +            regulator-min-microvolt = <1800000>;
> +            regulator-max-microvolt = <1800000>;
> +        };
> +
> +        reg_hpldo: hpldo {
> +            regulator-min-microvolt = <1800000>;
> +            regulator-max-microvolt = <1800000>;
> +        };
> +    };
> +
> +...
> diff --git a/Documentation/devicetree/bindings/regulator/allwinner,sun20i-d1-system-ldos.yaml b/Documentation/devicetree/bindings/regulator/allwinner,sun20i-d1-system-ldos.yaml
> new file mode 100644
> index 000000000000..13b2e8c84f1d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/regulator/allwinner,sun20i-d1-system-ldos.yaml
> @@ -0,0 +1,55 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/regulator/allwinner,sun20i-d1-system-ldos.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Allwinner D1 System LDOs
> +
> +description:
> +  Allwinner D1 contains a pair of general-purpose LDOs which are designed to
> +  supply power inside and outside the SoC. They are controlled by a register
> +  within the system controller MMIO space.
> +
> +maintainers:
> +  - Samuel Holland <samuel@sholland.org>
> +
> +properties:
> +  compatible:
> +    enum:
> +      - allwinner,sun20i-d1-system-ldos
> +
> +  syscon:
> +    $ref: /schemas/types.yaml#/definitions/phandle
> +    description: phandle of the device containing the LDO control register
> +
> +patternProperties:
> +  "^(ldoa|ldob)$":
> +    type: object
> +    $ref: regulator.yaml#
> +
> +required:
> +  - compatible
> +  - syscon
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    ldos-system {
> +        compatible = "allwinner,sun20i-d1-system-ldos";
> +        syscon = <&syscon>;
> +
> +        reg_ldoa: ldoa {
> +            regulator-min-microvolt = <1800000>;
> +            regulator-max-microvolt = <1800000>;
> +        };
> +
> +        reg_ldob: ldob {
> +            regulator-name = "vcc-dram";
> +            regulator-min-microvolt = <1500000>;
> +            regulator-max-microvolt = <1500000>;
> +        };
> +    };
> +
> +...
> -- 
> 2.35.1
> 
> 

WARNING: multiple messages have this Message-ID (diff)
From: Rob Herring <robh@kernel.org>
To: Samuel Holland <samuel@sholland.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Chen-Yu Tsai <wens@csie.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev
Subject: Re: [PATCH 1/2] regulator: dt-bindings: Add Allwinner D1 LDOs
Date: Mon, 1 Aug 2022 11:27:50 -0600	[thread overview]
Message-ID: <20220801172750.GA1198151-robh@kernel.org> (raw)
In-Reply-To: <20220801044758.12679-1-samuel@sholland.org>

On Sun, Jul 31, 2022 at 11:47:57PM -0500, Samuel Holland wrote:
> The Allwinner D1 SoC contains two pairs of in-package LDOs. One pair is
> for general purpose use. LDOA generally powers the board's 1.8 V rail.
> LDOB generally powers the in-package DRAM, where applicable.
> 
> The other pair of LDOs powers the analog power domains inside the SoC,
> including the audio codec, thermal sensor, and ADCs. These LDOs require
> a 0.9 V bandgap voltage reference. The calibration value for the voltage
> reference is stored in an eFuse, accessed via an NVMEM cell.
> 
> Neither LDO control register is in its own MMIO range; instead, each
> regulator device relies on a syscon exported by some "host" device node.
> Getting the register via a syscon avoids a dependency on the subsystem/
> driver for that host device (e.g. a functioning thermal sensor should
> not depend on having the audio codec driver loaded).
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
> 
>  .../allwinner,sun20i-d1-analog-ldos.yaml      | 77 +++++++++++++++++++
>  .../allwinner,sun20i-d1-system-ldos.yaml      | 55 +++++++++++++
>  2 files changed, 132 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/regulator/allwinner,sun20i-d1-analog-ldos.yaml
>  create mode 100644 Documentation/devicetree/bindings/regulator/allwinner,sun20i-d1-system-ldos.yaml
> 
> diff --git a/Documentation/devicetree/bindings/regulator/allwinner,sun20i-d1-analog-ldos.yaml b/Documentation/devicetree/bindings/regulator/allwinner,sun20i-d1-analog-ldos.yaml
> new file mode 100644
> index 000000000000..df648c56123d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/regulator/allwinner,sun20i-d1-analog-ldos.yaml
> @@ -0,0 +1,77 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/regulator/allwinner,sun20i-d1-analog-ldos.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Allwinner D1 Analog LDOs
> +
> +description:
> +  Allwinner D1 contains a set of LDOs which are designed to supply analog power
> +  inside and outside the SoC. They are controlled by a register within the audio
> +  codec MMIO space, but which is not part of the audio codec clock/reset domain,
> +  and so is exposed as a syscon.
> +
> +maintainers:
> +  - Samuel Holland <samuel@sholland.org>
> +
> +properties:
> +  compatible:
> +    enum:
> +      - allwinner,sun20i-d1-analog-ldos
> +
> +  nvmem-cells:
> +    items:
> +      - description: NVMEM cell for the calibrated bandgap reference trim value
> +
> +  nvmem-cell-names:
> +    items:
> +      - const: bg_trim
> +
> +  syscon:

'syscon' is not a generic property. Name it based on the block you are 
linking to or what the control is. 

Or better yet, if this is the only control interface, make this a child 
node of the referenced node instead.

> +    $ref: /schemas/types.yaml#/definitions/phandle
> +    description: phandle of the device containing the power register
> +
> +patternProperties:
> +  "^(aldo|hpldo)$":
> +    type: object
> +    $ref: regulator.yaml#

       unevaluatedProperties: false

> +
> +required:
> +  - compatible
> +  - nvmem-cells
> +  - nvmem-cell-names
> +  - syscon
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    sid: efuse {
> +        #address-cells = <1>;
> +        #size-cells = <1>;
> +
> +        bg_trim: bg-trim@28 {
> +            reg = <0x28 0x4>;
> +            bits = <16, 8>;
> +        };
> +    };
> +
> +    ldos-analog {
> +        compatible = "allwinner,sun20i-d1-analog-ldos";
> +        nvmem-cells = <&bg_trim>;
> +        nvmem-cell-names = "bg_trim";
> +        syscon = <&codec>;
> +
> +        reg_aldo: aldo {
> +            regulator-min-microvolt = <1800000>;
> +            regulator-max-microvolt = <1800000>;
> +        };
> +
> +        reg_hpldo: hpldo {
> +            regulator-min-microvolt = <1800000>;
> +            regulator-max-microvolt = <1800000>;
> +        };
> +    };
> +
> +...
> diff --git a/Documentation/devicetree/bindings/regulator/allwinner,sun20i-d1-system-ldos.yaml b/Documentation/devicetree/bindings/regulator/allwinner,sun20i-d1-system-ldos.yaml
> new file mode 100644
> index 000000000000..13b2e8c84f1d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/regulator/allwinner,sun20i-d1-system-ldos.yaml
> @@ -0,0 +1,55 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/regulator/allwinner,sun20i-d1-system-ldos.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Allwinner D1 System LDOs
> +
> +description:
> +  Allwinner D1 contains a pair of general-purpose LDOs which are designed to
> +  supply power inside and outside the SoC. They are controlled by a register
> +  within the system controller MMIO space.
> +
> +maintainers:
> +  - Samuel Holland <samuel@sholland.org>
> +
> +properties:
> +  compatible:
> +    enum:
> +      - allwinner,sun20i-d1-system-ldos
> +
> +  syscon:
> +    $ref: /schemas/types.yaml#/definitions/phandle
> +    description: phandle of the device containing the LDO control register
> +
> +patternProperties:
> +  "^(ldoa|ldob)$":
> +    type: object
> +    $ref: regulator.yaml#
> +
> +required:
> +  - compatible
> +  - syscon
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    ldos-system {
> +        compatible = "allwinner,sun20i-d1-system-ldos";
> +        syscon = <&syscon>;
> +
> +        reg_ldoa: ldoa {
> +            regulator-min-microvolt = <1800000>;
> +            regulator-max-microvolt = <1800000>;
> +        };
> +
> +        reg_ldob: ldob {
> +            regulator-name = "vcc-dram";
> +            regulator-min-microvolt = <1500000>;
> +            regulator-max-microvolt = <1500000>;
> +        };
> +    };
> +
> +...
> -- 
> 2.35.1
> 
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-08-01 17:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-01  4:47 [PATCH 1/2] regulator: dt-bindings: Add Allwinner D1 LDOs Samuel Holland
2022-08-01  4:47 ` Samuel Holland
2022-08-01  4:47 ` [PATCH 2/2] regulator: sun20i: Add support for " Samuel Holland
2022-08-01  4:47   ` Samuel Holland
2022-08-01 16:03   ` Mark Brown
2022-08-01 16:03     ` Mark Brown
2022-08-01 13:43 ` [PATCH 1/2] regulator: dt-bindings: Add " Rob Herring
2022-08-01 13:43   ` Rob Herring
2022-08-01 17:27 ` Rob Herring [this message]
2022-08-01 17:27   ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220801172750.GA1198151-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=samuel@sholland.org \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.