Re: [PATCH v1 03/16] dt-bindings: power: mediatek: Refine multiple level power domain nodes

From: Rob Herring
Date: Tue Jul 05 2022 - 16:57:54 EST


On Mon, Jul 04, 2022 at 06:00:15PM +0800, Tinghan Shen wrote:
> Extract duplicated properties and support more levels of power
> domain nodes.
>
> This change fix following error when do dtbs_check,
> arch/arm64/boot/dts/mediatek/mt8195-evb.dtb: power-controller: power-domain@15:power-domain@16:power-domain@18: 'power-domain@19', 'power-domain@20', 'power-domain@21' do not match any of the regexes: 'pinctrl-[0-9]+'
> From schema: Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
>
> Signed-off-by: Tinghan Shen <tinghan.shen@xxxxxxxxxxxx>
> ---
> .../power/mediatek,power-controller.yaml | 132 ++----------------
> 1 file changed, 12 insertions(+), 120 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml b/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
> index 135c6f722091..09a537a802b8 100644
> --- a/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
> +++ b/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
> @@ -39,8 +39,17 @@ properties:
> '#size-cells':
> const: 0
>
> +required:
> + - compatible
> +
> +additionalProperties: false
> +
> patternProperties:
> "^power-domain@[0-9a-f]+$":
> + $ref: "#/$defs/power-domain-node"
> +
> +$defs:
> + power-domain-node:
> type: object
> description: |
> Represents the power domains within the power controller node as documented
> @@ -98,127 +107,10 @@ patternProperties:
> $ref: /schemas/types.yaml#/definitions/phandle
> description: phandle to the device containing the SMI register range.
>
> - patternProperties:
> - "^power-domain@[0-9a-f]+$":
> - type: object
> - description: |
> - Represents a power domain child within a power domain parent node.
> -
> - properties:
> -
> - '#power-domain-cells':
> - description:
> - Must be 0 for nodes representing a single PM domain and 1 for nodes
> - providing multiple PM domains.
> -
> - '#address-cells':
> - const: 1
> -
> - '#size-cells':
> - const: 0
> -
> - reg:
> - maxItems: 1
> -
> - clocks:
> - description: |
> - A number of phandles to clocks that need to be enabled during domain
> - power-up sequencing.
> -
> - clock-names:
> - description: |
> - List of names of clocks, in order to match the power-up sequencing
> - for each power domain we need to group the clocks by name. BASIC
> - clocks need to be enabled before enabling the corresponding power
> - domain, and should not have a '-' in their name (i.e mm, mfg, venc).
> - SUSBYS clocks need to be enabled before releasing the bus protection,
> - and should contain a '-' in their name (i.e mm-0, isp-0, cam-0).
> -
> - In order to follow properly the power-up sequencing, the clocks must
> - be specified by order, adding first the BASIC clocks followed by the
> - SUSBSYS clocks.
> -
> - domain-supply:
> - description: domain regulator supply.
> -
> - mediatek,infracfg:
> - $ref: /schemas/types.yaml#/definitions/phandle
> - description: phandle to the device containing the INFRACFG register range.
> -
> - mediatek,smi:
> - $ref: /schemas/types.yaml#/definitions/phandle
> - description: phandle to the device containing the SMI register range.
> -
> - patternProperties:
> - "^power-domain@[0-9a-f]+$":
> - type: object
> - description: |
> - Represents a power domain child within a power domain parent node.
> -
> - properties:
> + required:
> + - reg
>
> - '#power-domain-cells':
> - description:
> - Must be 0 for nodes representing a single PM domain and 1 for nodes
> - providing multiple PM domains.
> -
> - '#address-cells':
> - const: 1
> -
> - '#size-cells':
> - const: 0
> -
> - reg:
> - maxItems: 1
> -
> - clocks:
> - description: |
> - A number of phandles to clocks that need to be enabled during domain
> - power-up sequencing.
> -
> - clock-names:
> - description: |
> - List of names of clocks, in order to match the power-up sequencing
> - for each power domain we need to group the clocks by name. BASIC
> - clocks need to be enabled before enabling the corresponding power
> - domain, and should not have a '-' in their name (i.e mm, mfg, venc).
> - SUSBYS clocks need to be enabled before releasing the bus protection,
> - and should contain a '-' in their name (i.e mm-0, isp-0, cam-0).
> -
> - In order to follow properly the power-up sequencing, the clocks must
> - be specified by order, adding first the BASIC clocks followed by the
> - SUSBSYS clocks.
> -
> - domain-supply:
> - description: domain regulator supply.
> -
> - mediatek,infracfg:
> - $ref: /schemas/types.yaml#/definitions/phandle
> - description: phandle to the device containing the INFRACFG register range.
> -
> - mediatek,smi:
> - $ref: /schemas/types.yaml#/definitions/phandle
> - description: phandle to the device containing the SMI register range.
> -
> - required:
> - - reg
> -
> - additionalProperties: false
> -
> - required:
> - - reg
> -
> - additionalProperties: false
> -
> - required:
> - - reg
> -
> - additionalProperties: false
> -
> -required:
> - - compatible
> -
> -additionalProperties: false
> + additionalProperties: false

You now aren't checking more than 1 level because you have defined
'additionalProperties' to be a DT property. Check the indentation.

You need this in $defs/power-domain-node to recurse:

additionalProperties:
$ref: #/$defs/power-domain-node

>
> examples:
> - |
> --
> 2.18.0
>
>