The power domains are a property of / implemented in the PMU. As such,
they should be modelled as child nodes of the PMU.
Signed-off-by: André Draszik <andre.draszik@linaro.org>
---
Note: Ideally, the newly added properties (ranges, etc.) should only be
'required' if "^power-domain@[0-9a-f]+$" exists as a patternProperty,
as they're needed only in that case. As-is, this patch now causes
warnings for existing DTs as they don't specify the new properties (and
they shouldn't need to). Only if DTs are updated to include
power-domains, such an update should also add the new properties.
I've not been able to come up with the correct schema syntax to achieve
that. dependencies, dependentRequired, and dependentSchemas don't seem
to support patterns. Similarly,
- if:
required:
- ...
then:
required:
- ...
doesn't allow patterns in the 'if' block (or I didn't get the syntax
right).
Rob said in
https://lore.kernel.org/all/20251010141357.GA219719-robh@kernel.org/
that this is a known limitation in json-schema.
---
.../bindings/soc/google/google,gs101-pmu.yaml | 40 ++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml b/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml
index f7119e7a39a3fe0a0a23d1faa251d356f83ba501..a24390f6d2a54afe1aa84935e03f719a62f4fc8e 100644
--- a/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml
+++ b/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml
@@ -26,6 +26,14 @@ properties:
reg:
maxItems: 1
+ '#address-cells':
+ const: 1
+
+ '#size-cells':
+ const: 1
+
+ ranges: true
+
reboot-mode:
$ref: /schemas/power/reset/syscon-reboot-mode.yaml
type: object
@@ -49,9 +57,23 @@ properties:
description:
Phandle to PMU interrupt generation interface.
+patternProperties:
+ "^power-domain@[0-9a-f]+$":
+ type: object
+ description: Child node describing one power domain within the PMU
+
+ additionalProperties: true
+
+ properties:
+ compatible:
+ const: google,gs101-pd
+
required:
- compatible
- reg
+ - '#address-cells'
+ - '#size-cells'
+ - ranges
- google,pmu-intr-gen-syscon
additionalProperties: false
@@ -61,6 +83,24 @@ examples:
system-controller@17460000 {
compatible = "google,gs101-pmu", "syscon";
reg = <0x17460000 0x10000>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges;
google,pmu-intr-gen-syscon = <&pmu_intr_gen>;
+
+ pd_g3d: power-domain@1e00 {
+ compatible = "google,gs101-pd";
+ reg = <0x1e00 0x80>;
+ #power-domain-cells = <0>;
+ label = "g3d";
+ };
+
+ power-domain@2000 {
+ compatible = "google,gs101-pd";
+ reg = <0x2000 0x80>;
+ #power-domain-cells = <0>;
+ power-domains = <&pd_g3d>;
+ label = "embedded_g3d";
+ };
};
--
2.51.0.788.g6d19910ace-goog
On Thu, Oct 16, 2025 at 04:58:36PM +0100, André Draszik wrote: > The power domains are a property of / implemented in the PMU. As such, > they should be modelled as child nodes of the PMU. > > Signed-off-by: André Draszik <andre.draszik@linaro.org> > > --- > Note: Ideally, the newly added properties (ranges, etc.) should only be > 'required' if "^power-domain@[0-9a-f]+$" exists as a patternProperty, > as they're needed only in that case. As-is, this patch now causes > warnings for existing DTs as they don't specify the new properties (and > they shouldn't need to). Only if DTs are updated to include > power-domains, such an update should also add the new properties. > > I've not been able to come up with the correct schema syntax to achieve > that. dependencies, dependentRequired, and dependentSchemas don't seem > to support patterns. Similarly, > - if: > required: > - ... > then: > required: > - ... > > doesn't allow patterns in the 'if' block (or I didn't get the syntax > right). > > Rob said in > https://lore.kernel.org/all/20251010141357.GA219719-robh@kernel.org/ > that this is a known limitation in json-schema. > --- > .../bindings/soc/google/google,gs101-pmu.yaml | 40 ++++++++++++++++++++++ > 1 file changed, 40 insertions(+) > > diff --git a/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml b/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml > index f7119e7a39a3fe0a0a23d1faa251d356f83ba501..a24390f6d2a54afe1aa84935e03f719a62f4fc8e 100644 > --- a/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml > +++ b/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml > @@ -26,6 +26,14 @@ properties: > reg: > maxItems: 1 > > + '#address-cells': > + const: 1 > + > + '#size-cells': > + const: 1 > + > + ranges: true > + > reboot-mode: > $ref: /schemas/power/reset/syscon-reboot-mode.yaml > type: object > @@ -49,9 +57,23 @@ properties: > description: > Phandle to PMU interrupt generation interface. > > +patternProperties: > + "^power-domain@[0-9a-f]+$": Keep consistent quotes, ' or " The problem is that you mix children without and with unit address. I guess that's the limitation of syscon-xxx drivers because they could take the reg/unit-address, so it's fine. Best regards, Krzysztof
On Thu, 16 Oct 2025 at 17:58, André Draszik <andre.draszik@linaro.org> wrote:
>
> The power domains are a property of / implemented in the PMU. As such,
> they should be modelled as child nodes of the PMU.
>
> Signed-off-by: André Draszik <andre.draszik@linaro.org>
>
> ---
> Note: Ideally, the newly added properties (ranges, etc.) should only be
> 'required' if "^power-domain@[0-9a-f]+$" exists as a patternProperty,
> as they're needed only in that case. As-is, this patch now causes
> warnings for existing DTs as they don't specify the new properties (and
> they shouldn't need to). Only if DTs are updated to include
> power-domains, such an update should also add the new properties.
>
> I've not been able to come up with the correct schema syntax to achieve
> that. dependencies, dependentRequired, and dependentSchemas don't seem
> to support patterns. Similarly,
> - if:
> required:
> - ...
> then:
> required:
> - ...
>
> doesn't allow patterns in the 'if' block (or I didn't get the syntax
> right).
>
> Rob said in
> https://lore.kernel.org/all/20251010141357.GA219719-robh@kernel.org/
> that this is a known limitation in json-schema.
> ---
> .../bindings/soc/google/google,gs101-pmu.yaml | 40 ++++++++++++++++++++++
> 1 file changed, 40 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml b/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml
> index f7119e7a39a3fe0a0a23d1faa251d356f83ba501..a24390f6d2a54afe1aa84935e03f719a62f4fc8e 100644
> --- a/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml
> +++ b/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml
> @@ -26,6 +26,14 @@ properties:
> reg:
> maxItems: 1
>
> + '#address-cells':
> + const: 1
> +
> + '#size-cells':
> + const: 1
> +
> + ranges: true
> +
> reboot-mode:
> $ref: /schemas/power/reset/syscon-reboot-mode.yaml
> type: object
> @@ -49,9 +57,23 @@ properties:
> description:
> Phandle to PMU interrupt generation interface.
>
> +patternProperties:
> + "^power-domain@[0-9a-f]+$":
> + type: object
> + description: Child node describing one power domain within the PMU
> +
I think we should specify the power-domain-cells too, along the lines
of the below.
'#power-domain-cells'
const: 0
> + additionalProperties: true
> +
> + properties:
> + compatible:
> + const: google,gs101-pd
> +
> required:
> - compatible
> - reg
> + - '#address-cells'
> + - '#size-cells'
> + - ranges
> - google,pmu-intr-gen-syscon
>
> additionalProperties: false
> @@ -61,6 +83,24 @@ examples:
> system-controller@17460000 {
> compatible = "google,gs101-pmu", "syscon";
> reg = <0x17460000 0x10000>;
> + #address-cells = <1>;
> + #size-cells = <1>;
> + ranges;
>
> google,pmu-intr-gen-syscon = <&pmu_intr_gen>;
> +
> + pd_g3d: power-domain@1e00 {
> + compatible = "google,gs101-pd";
> + reg = <0x1e00 0x80>;
> + #power-domain-cells = <0>;
> + label = "g3d";
> + };
> +
> + power-domain@2000 {
> + compatible = "google,gs101-pd";
> + reg = <0x2000 0x80>;
> + #power-domain-cells = <0>;
> + power-domains = <&pd_g3d>;
> + label = "embedded_g3d";
> + };
> };
>
> --
> 2.51.0.788.g6d19910ace-goog
>
Kind regards
Uffe
On 21/10/2025 14:59, Ulf Hansson wrote: >> + "^power-domain@[0-9a-f]+$": >> + type: object >> + description: Child node describing one power domain within the PMU >> + > > I think we should specify the power-domain-cells too, along the lines > of the below. > > '#power-domain-cells' > const: 0 That's not needed. The child (this child device node) schema will enforce it. Parent (so the PMU) is supposed only to list compatible. Best regards, Krzysztof
On Tue, 21 Oct 2025 at 18:18, Krzysztof Kozlowski <krzk@kernel.org> wrote: > > On 21/10/2025 14:59, Ulf Hansson wrote: > >> + "^power-domain@[0-9a-f]+$": > >> + type: object > >> + description: Child node describing one power domain within the PMU > >> + > > > > I think we should specify the power-domain-cells too, along the lines > > of the below. > > > > '#power-domain-cells' > > const: 0 > > That's not needed. The child (this child device node) schema will > enforce it. Parent (so the PMU) is supposed only to list compatible. Ah, I see. Thanks for clarifying! Kind regards Uffe
© 2016 - 2025 Red Hat, Inc.