2022-10-04 12:56:00

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH] dt-bindings: display: panel: use spi-peripheral-props.yaml

For devices connectable by SPI bus (e.g. already using
"spi-max-frequency" property), reference the "spi-peripheral-props.yaml"
schema to allow using all SPI device properties, even these which device
bindings author did not tried yet.

Change "additionalProperties" to "unevaluatedProperties", so the actual
other properties from "spi-peripheral-props.yaml" can be used. This has
additional impact of allowing also other properties from
panel-common.yaml to be used.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
.../devicetree/bindings/display/panel/ilitek,ili9163.yaml | 3 ++-
.../devicetree/bindings/display/panel/ilitek,ili9341.yaml | 1 +
.../devicetree/bindings/display/panel/nec,nl8048hl11.yaml | 3 ++-
.../bindings/display/panel/samsung,lms380kf01.yaml | 5 ++---
.../bindings/display/panel/samsung,lms397kf04.yaml | 3 ++-
.../devicetree/bindings/display/panel/samsung,s6d27a1.yaml | 4 ++--
.../devicetree/bindings/display/panel/tpo,tpg110.yaml | 1 +
7 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/panel/ilitek,ili9163.yaml b/Documentation/devicetree/bindings/display/panel/ilitek,ili9163.yaml
index 7e7a8362b951..a4154b51043e 100644
--- a/Documentation/devicetree/bindings/display/panel/ilitek,ili9163.yaml
+++ b/Documentation/devicetree/bindings/display/panel/ilitek,ili9163.yaml
@@ -15,6 +15,7 @@ description:

allOf:
- $ref: panel-common.yaml#
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#

properties:
compatible:
@@ -41,7 +42,7 @@ required:
- dc-gpios
- reset-gpios

-additionalProperties: false
+unevaluatedProperties: false

examples:
- |
diff --git a/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.yaml b/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.yaml
index 99e0cb9440cf..94f169ea065a 100644
--- a/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.yaml
+++ b/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.yaml
@@ -16,6 +16,7 @@ description: |

allOf:
- $ref: panel-common.yaml#
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#

properties:
compatible:
diff --git a/Documentation/devicetree/bindings/display/panel/nec,nl8048hl11.yaml b/Documentation/devicetree/bindings/display/panel/nec,nl8048hl11.yaml
index aa788eaa2f71..3b09b359023e 100644
--- a/Documentation/devicetree/bindings/display/panel/nec,nl8048hl11.yaml
+++ b/Documentation/devicetree/bindings/display/panel/nec,nl8048hl11.yaml
@@ -15,6 +15,7 @@ maintainers:

allOf:
- $ref: panel-common.yaml#
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#

properties:
compatible:
@@ -34,7 +35,7 @@ required:
- reset-gpios
- port

-additionalProperties: false
+unevaluatedProperties: false

examples:
- |
diff --git a/Documentation/devicetree/bindings/display/panel/samsung,lms380kf01.yaml b/Documentation/devicetree/bindings/display/panel/samsung,lms380kf01.yaml
index 251f0c7115aa..70ffc88d2a08 100644
--- a/Documentation/devicetree/bindings/display/panel/samsung,lms380kf01.yaml
+++ b/Documentation/devicetree/bindings/display/panel/samsung,lms380kf01.yaml
@@ -9,14 +9,13 @@ title: Samsung LMS380KF01 display panel
description: The LMS380KF01 is a 480x800 DPI display panel from Samsung Mobile
Displays (SMD) utilizing the WideChips WS2401 display controller. It can be
used with internal or external backlight control.
- The panel must obey the rules for a SPI slave device as specified in
- spi/spi-controller.yaml

maintainers:
- Linus Walleij <[email protected]>

allOf:
- $ref: panel-common.yaml#
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#

properties:
compatible:
@@ -59,7 +58,7 @@ required:
- spi-cpol
- port

-additionalProperties: false
+unevaluatedProperties: false

examples:
- |
diff --git a/Documentation/devicetree/bindings/display/panel/samsung,lms397kf04.yaml b/Documentation/devicetree/bindings/display/panel/samsung,lms397kf04.yaml
index cd62968426fb..5e77cee93f83 100644
--- a/Documentation/devicetree/bindings/display/panel/samsung,lms397kf04.yaml
+++ b/Documentation/devicetree/bindings/display/panel/samsung,lms397kf04.yaml
@@ -14,6 +14,7 @@ maintainers:

allOf:
- $ref: panel-common.yaml#
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#

properties:
compatible:
@@ -51,7 +52,7 @@ required:
- spi-cpol
- port

-additionalProperties: false
+unevaluatedProperties: false

examples:
- |
diff --git a/Documentation/devicetree/bindings/display/panel/samsung,s6d27a1.yaml b/Documentation/devicetree/bindings/display/panel/samsung,s6d27a1.yaml
index 26e3c820a2f7..d273faf4442a 100644
--- a/Documentation/devicetree/bindings/display/panel/samsung,s6d27a1.yaml
+++ b/Documentation/devicetree/bindings/display/panel/samsung,s6d27a1.yaml
@@ -7,14 +7,14 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: Samsung S6D27A1 display panel

description: The S6D27A1 is a 480x800 DPI display panel from Samsung Mobile
- Displays (SMD). The panel must obey the rules for a SPI slave device
- as specified in spi/spi-controller.yaml
+ Displays (SMD).

maintainers:
- Markuss Broks <[email protected]>

allOf:
- $ref: panel-common.yaml#
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#

properties:
compatible:
diff --git a/Documentation/devicetree/bindings/display/panel/tpo,tpg110.yaml b/Documentation/devicetree/bindings/display/panel/tpo,tpg110.yaml
index 6f1f02044b4b..f0243d196191 100644
--- a/Documentation/devicetree/bindings/display/panel/tpo,tpg110.yaml
+++ b/Documentation/devicetree/bindings/display/panel/tpo,tpg110.yaml
@@ -41,6 +41,7 @@ description: |+

allOf:
- $ref: panel-common.yaml#
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#

properties:
compatible:
--
2.34.1


2022-10-04 13:21:37

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH] dt-bindings: display: panel: use spi-peripheral-props.yaml

Hi Krzysztof,

Thank you for the patch.

On Tue, Oct 04, 2022 at 02:09:07PM +0200, Krzysztof Kozlowski wrote:
> For devices connectable by SPI bus (e.g. already using
> "spi-max-frequency" property), reference the "spi-peripheral-props.yaml"
> schema to allow using all SPI device properties, even these which device
> bindings author did not tried yet.

Isn't this done implicitly by spi-controller.yaml ? SPI devices that are
children of an SPI controller should match the patternProperties
"^.*@[0-9a-f]+$" in that file, which has a $ref: spi-peripheral-props.yaml.
Is there something I'm missing ?

> Change "additionalProperties" to "unevaluatedProperties", so the actual
> other properties from "spi-peripheral-props.yaml" can be used. This has
> additional impact of allowing also other properties from
> panel-common.yaml to be used.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> ---
> .../devicetree/bindings/display/panel/ilitek,ili9163.yaml | 3 ++-
> .../devicetree/bindings/display/panel/ilitek,ili9341.yaml | 1 +
> .../devicetree/bindings/display/panel/nec,nl8048hl11.yaml | 3 ++-
> .../bindings/display/panel/samsung,lms380kf01.yaml | 5 ++---
> .../bindings/display/panel/samsung,lms397kf04.yaml | 3 ++-
> .../devicetree/bindings/display/panel/samsung,s6d27a1.yaml | 4 ++--
> .../devicetree/bindings/display/panel/tpo,tpg110.yaml | 1 +
> 7 files changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/display/panel/ilitek,ili9163.yaml b/Documentation/devicetree/bindings/display/panel/ilitek,ili9163.yaml
> index 7e7a8362b951..a4154b51043e 100644
> --- a/Documentation/devicetree/bindings/display/panel/ilitek,ili9163.yaml
> +++ b/Documentation/devicetree/bindings/display/panel/ilitek,ili9163.yaml
> @@ -15,6 +15,7 @@ description:
>
> allOf:
> - $ref: panel-common.yaml#
> + - $ref: /schemas/spi/spi-peripheral-props.yaml#
>
> properties:
> compatible:
> @@ -41,7 +42,7 @@ required:
> - dc-gpios
> - reset-gpios
>
> -additionalProperties: false
> +unevaluatedProperties: false
>
> examples:
> - |
> diff --git a/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.yaml b/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.yaml
> index 99e0cb9440cf..94f169ea065a 100644
> --- a/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.yaml
> +++ b/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.yaml
> @@ -16,6 +16,7 @@ description: |
>
> allOf:
> - $ref: panel-common.yaml#
> + - $ref: /schemas/spi/spi-peripheral-props.yaml#
>
> properties:
> compatible:
> diff --git a/Documentation/devicetree/bindings/display/panel/nec,nl8048hl11.yaml b/Documentation/devicetree/bindings/display/panel/nec,nl8048hl11.yaml
> index aa788eaa2f71..3b09b359023e 100644
> --- a/Documentation/devicetree/bindings/display/panel/nec,nl8048hl11.yaml
> +++ b/Documentation/devicetree/bindings/display/panel/nec,nl8048hl11.yaml
> @@ -15,6 +15,7 @@ maintainers:
>
> allOf:
> - $ref: panel-common.yaml#
> + - $ref: /schemas/spi/spi-peripheral-props.yaml#
>
> properties:
> compatible:
> @@ -34,7 +35,7 @@ required:
> - reset-gpios
> - port
>
> -additionalProperties: false
> +unevaluatedProperties: false
>
> examples:
> - |
> diff --git a/Documentation/devicetree/bindings/display/panel/samsung,lms380kf01.yaml b/Documentation/devicetree/bindings/display/panel/samsung,lms380kf01.yaml
> index 251f0c7115aa..70ffc88d2a08 100644
> --- a/Documentation/devicetree/bindings/display/panel/samsung,lms380kf01.yaml
> +++ b/Documentation/devicetree/bindings/display/panel/samsung,lms380kf01.yaml
> @@ -9,14 +9,13 @@ title: Samsung LMS380KF01 display panel
> description: The LMS380KF01 is a 480x800 DPI display panel from Samsung Mobile
> Displays (SMD) utilizing the WideChips WS2401 display controller. It can be
> used with internal or external backlight control.
> - The panel must obey the rules for a SPI slave device as specified in
> - spi/spi-controller.yaml
>
> maintainers:
> - Linus Walleij <[email protected]>
>
> allOf:
> - $ref: panel-common.yaml#
> + - $ref: /schemas/spi/spi-peripheral-props.yaml#
>
> properties:
> compatible:
> @@ -59,7 +58,7 @@ required:
> - spi-cpol
> - port
>
> -additionalProperties: false
> +unevaluatedProperties: false
>
> examples:
> - |
> diff --git a/Documentation/devicetree/bindings/display/panel/samsung,lms397kf04.yaml b/Documentation/devicetree/bindings/display/panel/samsung,lms397kf04.yaml
> index cd62968426fb..5e77cee93f83 100644
> --- a/Documentation/devicetree/bindings/display/panel/samsung,lms397kf04.yaml
> +++ b/Documentation/devicetree/bindings/display/panel/samsung,lms397kf04.yaml
> @@ -14,6 +14,7 @@ maintainers:
>
> allOf:
> - $ref: panel-common.yaml#
> + - $ref: /schemas/spi/spi-peripheral-props.yaml#
>
> properties:
> compatible:
> @@ -51,7 +52,7 @@ required:
> - spi-cpol
> - port
>
> -additionalProperties: false
> +unevaluatedProperties: false
>
> examples:
> - |
> diff --git a/Documentation/devicetree/bindings/display/panel/samsung,s6d27a1.yaml b/Documentation/devicetree/bindings/display/panel/samsung,s6d27a1.yaml
> index 26e3c820a2f7..d273faf4442a 100644
> --- a/Documentation/devicetree/bindings/display/panel/samsung,s6d27a1.yaml
> +++ b/Documentation/devicetree/bindings/display/panel/samsung,s6d27a1.yaml
> @@ -7,14 +7,14 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
> title: Samsung S6D27A1 display panel
>
> description: The S6D27A1 is a 480x800 DPI display panel from Samsung Mobile
> - Displays (SMD). The panel must obey the rules for a SPI slave device
> - as specified in spi/spi-controller.yaml
> + Displays (SMD).
>
> maintainers:
> - Markuss Broks <[email protected]>
>
> allOf:
> - $ref: panel-common.yaml#
> + - $ref: /schemas/spi/spi-peripheral-props.yaml#
>
> properties:
> compatible:
> diff --git a/Documentation/devicetree/bindings/display/panel/tpo,tpg110.yaml b/Documentation/devicetree/bindings/display/panel/tpo,tpg110.yaml
> index 6f1f02044b4b..f0243d196191 100644
> --- a/Documentation/devicetree/bindings/display/panel/tpo,tpg110.yaml
> +++ b/Documentation/devicetree/bindings/display/panel/tpo,tpg110.yaml
> @@ -41,6 +41,7 @@ description: |+
>
> allOf:
> - $ref: panel-common.yaml#
> + - $ref: /schemas/spi/spi-peripheral-props.yaml#
>
> properties:
> compatible:

--
Regards,

Laurent Pinchart

2022-10-04 13:55:22

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH] dt-bindings: display: panel: use spi-peripheral-props.yaml

On 04/10/2022 15:03, Laurent Pinchart wrote:
> Hi Krzysztof,
>
> Thank you for the patch.
>
> On Tue, Oct 04, 2022 at 02:09:07PM +0200, Krzysztof Kozlowski wrote:
>> For devices connectable by SPI bus (e.g. already using
>> "spi-max-frequency" property), reference the "spi-peripheral-props.yaml"
>> schema to allow using all SPI device properties, even these which device
>> bindings author did not tried yet.
>
> Isn't this done implicitly by spi-controller.yaml ? SPI devices that are
> children of an SPI controller should match the patternProperties
> "^.*@[0-9a-f]+$" in that file, which has a $ref: spi-peripheral-props.yaml.
> Is there something I'm missing ?
>

You are correct about one side of this - SPI controller bindings.
However these schemas here have clear: additional/unevaluatedProperties:
false, thus when they find DTS like:
panel@xxx {
compatible = "one of these spi panels";
...
spi-cs-high;
spi-rx-delay-us = <50>;
... and some more from specific controllers
}

you will get errors, because the panel schema does not allow them.

The bindings were done (some time ago) in such way, that they require
that both SPI controller and SPI device reference spi-props.

Best regards,
Krzysztof

2022-10-04 14:05:24

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH] dt-bindings: display: panel: use spi-peripheral-props.yaml

Hi Krzysztof,

On Tue, Oct 04, 2022 at 03:10:29PM +0200, Krzysztof Kozlowski wrote:
> On 04/10/2022 15:03, Laurent Pinchart wrote:
> > On Tue, Oct 04, 2022 at 02:09:07PM +0200, Krzysztof Kozlowski wrote:
> >> For devices connectable by SPI bus (e.g. already using
> >> "spi-max-frequency" property), reference the "spi-peripheral-props.yaml"
> >> schema to allow using all SPI device properties, even these which device
> >> bindings author did not tried yet.
> >
> > Isn't this done implicitly by spi-controller.yaml ? SPI devices that are
> > children of an SPI controller should match the patternProperties
> > "^.*@[0-9a-f]+$" in that file, which has a $ref: spi-peripheral-props.yaml.
> > Is there something I'm missing ?
>
> You are correct about one side of this - SPI controller bindings.
> However these schemas here have clear: additional/unevaluatedProperties:
> false, thus when they find DTS like:
> panel@xxx {
> compatible = "one of these spi panels";
> ...
> spi-cs-high;
> spi-rx-delay-us = <50>;
> ... and some more from specific controllers
> }
>
> you will get errors, because the panel schema does not allow them.
>
> The bindings were done (some time ago) in such way, that they require
> that both SPI controller and SPI device reference spi-props.

You're absolutely right that additionalProperties needs to be replaced
by unevaluatedProperties. Can the additions of $ref be dropped, or is
that needed too ?

--
Regards,

Laurent Pinchart

2022-10-04 15:37:44

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH] dt-bindings: display: panel: use spi-peripheral-props.yaml

On 04/10/2022 15:17, Laurent Pinchart wrote:
> Hi Krzysztof,
>
> On Tue, Oct 04, 2022 at 03:10:29PM +0200, Krzysztof Kozlowski wrote:
>> On 04/10/2022 15:03, Laurent Pinchart wrote:
>>> On Tue, Oct 04, 2022 at 02:09:07PM +0200, Krzysztof Kozlowski wrote:
>>>> For devices connectable by SPI bus (e.g. already using
>>>> "spi-max-frequency" property), reference the "spi-peripheral-props.yaml"
>>>> schema to allow using all SPI device properties, even these which device
>>>> bindings author did not tried yet.
>>>
>>> Isn't this done implicitly by spi-controller.yaml ? SPI devices that are
>>> children of an SPI controller should match the patternProperties
>>> "^.*@[0-9a-f]+$" in that file, which has a $ref: spi-peripheral-props.yaml.
>>> Is there something I'm missing ?
>>
>> You are correct about one side of this - SPI controller bindings.
>> However these schemas here have clear: additional/unevaluatedProperties:
>> false, thus when they find DTS like:
>> panel@xxx {
>> compatible = "one of these spi panels";
>> ...
>> spi-cs-high;
>> spi-rx-delay-us = <50>;
>> ... and some more from specific controllers
>> }
>>
>> you will get errors, because the panel schema does not allow them.
>>
>> The bindings were done (some time ago) in such way, that they require
>> that both SPI controller and SPI device reference spi-props.
>
> You're absolutely right that additionalProperties needs to be replaced
> by unevaluatedProperties. Can the additions of $ref be dropped, or is
> that needed too ?

I just wrote above - you need to reference the spi-props. Otherwise all
the SPI-related properties will be unknown/unevaluated.

Best regards,
Krzysztof

2022-10-04 21:14:50

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH] dt-bindings: display: panel: use spi-peripheral-props.yaml

On Tue, Oct 4, 2022 at 8:17 AM Laurent Pinchart
<[email protected]> wrote:
>
> Hi Krzysztof,
>
> On Tue, Oct 04, 2022 at 03:10:29PM +0200, Krzysztof Kozlowski wrote:
> > On 04/10/2022 15:03, Laurent Pinchart wrote:
> > > On Tue, Oct 04, 2022 at 02:09:07PM +0200, Krzysztof Kozlowski wrote:
> > >> For devices connectable by SPI bus (e.g. already using
> > >> "spi-max-frequency" property), reference the "spi-peripheral-props.yaml"
> > >> schema to allow using all SPI device properties, even these which device
> > >> bindings author did not tried yet.
> > >
> > > Isn't this done implicitly by spi-controller.yaml ? SPI devices that are
> > > children of an SPI controller should match the patternProperties
> > > "^.*@[0-9a-f]+$" in that file, which has a $ref: spi-peripheral-props.yaml.
> > > Is there something I'm missing ?
> >
> > You are correct about one side of this - SPI controller bindings.
> > However these schemas here have clear: additional/unevaluatedProperties:
> > false, thus when they find DTS like:
> > panel@xxx {
> > compatible = "one of these spi panels";
> > ...
> > spi-cs-high;
> > spi-rx-delay-us = <50>;
> > ... and some more from specific controllers
> > }
> >
> > you will get errors, because the panel schema does not allow them.
> >
> > The bindings were done (some time ago) in such way, that they require
> > that both SPI controller and SPI device reference spi-props.
>
> You're absolutely right that additionalProperties needs to be replaced
> by unevaluatedProperties. Can the additions of $ref be dropped, or is
> that needed too ?

unevaluatedProperties doesn't work with child node schemas (from one
or both schemas). This is because the schemas are applied
independently and can't 'see' each other. The spi-controller.yaml
schema is applied to the SPI bus node and SPI peripheral schemas are
applied to SPI device nodes. This means that child node schemas have
to either be complete or only list properties which will be listed in
the complete schema for the child nodes. For example, 'reg' has to be
listed anyways to define how many entries. This is also why we need a
ref at each level in the graph binding anytime there are additional
properties defined.

Rob

2022-10-14 21:25:40

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH] dt-bindings: display: panel: use spi-peripheral-props.yaml

On Tue, 04 Oct 2022 14:09:07 +0200, Krzysztof Kozlowski wrote:
> For devices connectable by SPI bus (e.g. already using
> "spi-max-frequency" property), reference the "spi-peripheral-props.yaml"
> schema to allow using all SPI device properties, even these which device
> bindings author did not tried yet.
>
> Change "additionalProperties" to "unevaluatedProperties", so the actual
> other properties from "spi-peripheral-props.yaml" can be used. This has
> additional impact of allowing also other properties from
> panel-common.yaml to be used.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> ---
> .../devicetree/bindings/display/panel/ilitek,ili9163.yaml | 3 ++-
> .../devicetree/bindings/display/panel/ilitek,ili9341.yaml | 1 +
> .../devicetree/bindings/display/panel/nec,nl8048hl11.yaml | 3 ++-
> .../bindings/display/panel/samsung,lms380kf01.yaml | 5 ++---
> .../bindings/display/panel/samsung,lms397kf04.yaml | 3 ++-
> .../devicetree/bindings/display/panel/samsung,s6d27a1.yaml | 4 ++--
> .../devicetree/bindings/display/panel/tpo,tpg110.yaml | 1 +
> 7 files changed, 12 insertions(+), 8 deletions(-)
>

Applied, thanks!