[PATCH/RFC 2/6] dt-bindings: display: bridge: renesas,dw-hdmi: Convert binding to YAML

Maxime Ripard maxime at cerno.tech
Mon Apr 6 07:57:05 UTC 2020


Hi,

On Mon, Apr 06, 2020 at 02:39:31AM +0300, Laurent Pinchart wrote:
> diff --git a/Documentation/devicetree/bindings/display/bridge/renesas,dw-hdmi.yaml b/Documentation/devicetree/bindings/display/bridge/renesas,dw-hdmi.yaml
> new file mode 100644
> index 000000000000..9a543740c81d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/bridge/renesas,dw-hdmi.yaml
> @@ -0,0 +1,142 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/display/bridge/renesas,dw-hdmi.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Renesas R-Car DWC HDMI TX Encoder
> +
> +maintainers:
> +  - Laurent Pinchart <laurent.pinchart+renesas at ideasonboard.com>
> +
> +description: |
> +  The HDMI transmitter is a Synopsys DesignWare HDMI 1.4 TX controller IP
> +  with a companion PHY IP.
> +
> +allOf:
> +  - $ref: synopsys,dw-hdmi.yaml#
> +
> +properties:
> +  compatible:
> +    items:
> +      - enum:
> +        - renesas,r8a774a1-hdmi # for R8A774A1 (RZ/G2M) compatible HDMI TX
> +        - renesas,r8a774b1-hdmi # for R8A774B1 (RZ/G2N) compatible HDMI TX
> +        - renesas,r8a7795-hdmi # for R8A7795 (R-Car H3) compatible HDMI TX
> +        - renesas,r8a7796-hdmi # for R8A7796 (R-Car M3-W) compatible HDMI TX
> +        - renesas,r8a77965-hdmi # for R8A77965 (R-Car M3-N) compatible HDMI TX
> +      - const: renesas,rcar-gen3-hdmi
> +
> +  reg: true
> +
> +  reg-io-width:
> +    const: 1
> +
> +  clocks:
> +    minItems: 2
> +    maxItems: 2

You don't need both, if one is missing the other will be filled by the
dt-schema tools. In this particular case, I guess maxItems would make
more sense.

> +
> +  clock-names:
> +    items:
> +      - const: iahb
> +      - const: isfr
> +
> +  interrupts: true
> +
> +  ports:
> +    type: object
> +    description: |
> +      This device has three video ports. Their connections are modelled using the
> +      OF graph bindings specified in Documentation/devicetree/bindings/graph.txt.
> +      Each port shall have a single endpoint.
> +
> +    properties:
> +      '#address-cells':
> +        const: 1
> +
> +      '#size-cells':
> +        const: 0
> +
> +      port at 0:
> +        type: object
> +        description: Parallel RGB input port
> +
> +      port at 1:
> +        type: object
> +        description: HDMI output port
> +
> +      port at 2:
> +        type: object
> +        description: Sound input port
> +
> +    required:
> +      - port at 0
> +      - port at 1
> +      - port at 2
> +
> +    additionalProperties: false
> +
> +  power-domains:
> +    maxItems: 1
> +
> +required:
> +  - compatible
> +  - reg
> +  - clocks
> +  - clock-names
> +  - interrupts
> +  - ports
> +
> +additionalProperties: false

In the case where you have some kind of generic schema and then a more
specific one like you have here, unevaluatedProperties make more sense
that additionalProperties.

additionalProperties checks that there are no extra properties on the
current schema, which is a problem here since you have to duplicate
the entire list of properties found in the generic schema, while
unevaluatedProperties checks that there are no extra properties in the
entire set of all schemas that apply to this node.

This way, you can just put what is different from the generic schema,
and you don't have to keep it in sync.

It's a feature that has been added in the spec of the schemas that
went on right after the one we support in the tools, so for now the
kernel meta-schemas only allows that property to be there (just like
deprecated) but won't do anything.

This should be fixed quite soon however, the library we depend on
has started to work on that spec apparently.

Maxime
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20200406/dd6ba4f7/attachment-0001.sig>


More information about the dri-devel mailing list