Re: [PATCH v4 6/7] dt-bindings: Add ANX6345 DP/eDP transmitter binding

From: Torsten Duwe
Date: Thu Oct 31 2019 - 10:52:29 EST


On Thu, Oct 31, 2019 at 01:51:00PM +0100, Maxime Ripard wrote:
> On Tue, Oct 29, 2019 at 01:16:57PM +0100, Torsten Duwe wrote:
> > +
> > + ports:
> > + anyOf:
> > + - port@0:
> > + description: Video port for LVTTL input
> > + - port@1:
> > + description: Video port for eDP output (panel or connector).
> > + May be omitted if EDID works reliably.
> > + required:
> > + - port@0
>
> Have you tried to validate those two ports in a DT?

Yes, it validates as expected, like I wrote. Various sources told me that
json-schema is not always straightforward so I assumed anyOf was OK.

> I'm not quite sure what you wanted to express with that anyOf, but if
> it was something like port@0 is mandatory, and port@1 is optional, it
> should be something like this:
>
> properties:
>
> ...
>
> ports:
> type: object
>
> properties:
> port@0:
> type: object
> description: |
> Video port for LVTTL input
>
> port@1:
> type: object
> description: |
> Video port for eDP output (..)
>
> required:
> - port@0
>
> This way, you express that both port@0 and port@1 must by nodes, under
> a node called ports, and port@0 is mandatory.

That validates, too. Looks better, admittedly. I don't have a strong
opinion here. It's just that Rob wrote in
<CAL_JsqKAU3WG3L=KP8A8u4vW=q_BQWPN-m_c+ADOwTioJ2-cmg@xxxxxxxxxxxxxx>:

| For this case specifically, we do need to define a common graph
| schema, but haven't yet. You can assume we do and only really need to
| capture what Maxime said above.
(your points back then were port@N descriptions and neccessity for port@0)

Are you sure that "object" is specific enough?

> You should even push this a bit further by adding
> additionalProperties: false to prevent a DT from having undocumented
> properties and children for the main node and ports node.

You mean like

| jsonschema.exceptions.SchemaError: Additional properties are not allowed ('unevaluatedProperties' was unexpected)
[...]
| On schema:
| {'$id': 'http://devicetree.org/schemas/watchdog/allwinner,sun4i-a10-wdt.yaml#',
[...]
| 'unevaluatedProperties': False}

? ;-)

But yes, this patch series passes even with additionalProperties: false.

In which form would you like to receive the update?

Torsten