[2/2] dt-bindings: touchscreen: Convert Goodix touchscreen to json-schema
diff mbox series

Message ID 20200107130903.14421-3-benjamin.gaignard@st.com
State New
Headers show
Series
  • Convert Goodix touchscreen to json-schema
Related show

Commit Message

Benjamin GAIGNARD Jan. 7, 2020, 1:09 p.m. UTC
Convert the Goodix binding to DT schema format using json-schema

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
---
 .../bindings/input/touchscreen/goodix.txt          | 50 ----------------
 .../bindings/input/touchscreen/goodix.yaml         | 69 ++++++++++++++++++++++
 2 files changed, 69 insertions(+), 50 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/input/touchscreen/goodix.txt
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/goodix.yaml

Comments

Bastien Nocera Jan. 7, 2020, 1:38 p.m. UTC | #1
On Tue, 2020-01-07 at 14:09 +0100, Benjamin Gaignard wrote:
> Convert the Goodix binding to DT schema format using json-schema

I don't have an opinion on the migration itself, but this really should
not lose any of the descriptions that were in the old text file.

> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
> ---
>  .../bindings/input/touchscreen/goodix.txt          | 50 ------------
> ----
>  .../bindings/input/touchscreen/goodix.yaml         | 69
> ++++++++++++++++++++++
>  2 files changed, 69 insertions(+), 50 deletions(-)
>  delete mode 100644
> Documentation/devicetree/bindings/input/touchscreen/goodix.txt
>  create mode 100644
> Documentation/devicetree/bindings/input/touchscreen/goodix.yaml
> 
> diff --git
> a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
> b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
> deleted file mode 100644
> index fc03ea4cf5ab..000000000000
> --- a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
> +++ /dev/null
> @@ -1,50 +0,0 @@
> -Device tree bindings for Goodix GT9xx series touchscreen controller
> -
> -Required properties:
> -
> - - compatible		: Should be "goodix,gt1151"
> -				 or "goodix,gt5663"
> -				 or "goodix,gt5688"
> -				 or "goodix,gt911"
> -				 or "goodix,gt9110"
> -				 or "goodix,gt912"
> -				 or "goodix,gt927"
> -				 or "goodix,gt9271"
> -				 or "goodix,gt928"
> -				 or "goodix,gt967"
> - - reg			: I2C address of the chip. Should be
> 0x5d or 0x14
> - - interrupts		: Interrupt to which the chip is
> connected
> -
> -Optional properties:
> -
> - - irq-gpios		: GPIO pin used for IRQ. The driver uses the
> -			  interrupt gpio pin as output to reset the
> device.
> - - reset-gpios		: GPIO pin used for reset
> - - AVDD28-supply	: Analog power supply regulator on AVDD28 pin
> - - VDDIO-supply		: GPIO power supply regulator on VDDIO
> pin
> - - touchscreen-inverted-x
> - - touchscreen-inverted-y
> - - touchscreen-size-x
> - - touchscreen-size-y
> - - touchscreen-swapped-x-y
> -
> -The touchscreen-* properties are documented in touchscreen.txt in
> this
> -directory.
> -
> -Example:
> -
> -	i2c@00000000 {
> -		/* ... */
> -
> -		gt928@5d {
> -			compatible = "goodix,gt928";
> -			reg = <0x5d>;
> -			interrupt-parent = <&gpio>;
> -			interrupts = <0 0>;
> -
> -			irq-gpios = <&gpio1 0 0>;
> -			reset-gpios = <&gpio1 1 0>;
> -		};
> -
> -		/* ... */
> -	};
> diff --git
> a/Documentation/devicetree/bindings/input/touchscreen/goodix.yaml
> b/Documentation/devicetree/bindings/input/touchscreen/goodix.yaml
> new file mode 100644
> index 000000000000..05b52d359ac5
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/touchscreen/goodix.yaml
> @@ -0,0 +1,69 @@
> +# SPDX-License-Identifier: GPL-2.0
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/input/touchscreen/goodix.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Goodix GT9xx series touchscreen controller Bindings
> +
> +maintainers:
> +  - Dmitry Torokhov <dmitry.torokhov@gmail.com>
> +
> +allOf:
> +  - $ref: touchscreen.yaml#
> +
> +properties:
> +  compatible:
> +    enum:
> +      - goodix,gt1151
> +      - goodix,gt5663
> +      - goodix,gt5688
> +      - goodix,gt911
> +      - goodix,gt9110
> +      - goodix,gt912
> +      - goodix,gt927
> +      - goodix,gt9271
> +      - goodix,gt928
> +      - goodix,gt967
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  irq-gpios:
> +    maxItems: 1
> +
> +  reset-gpios:
> +    maxItems: 1
> +
> +  AVDD28-supply:
> +    description: Analog power supply regulator on AVDD28 pin
> +
> +  VDDIO-supply:
> +    description: GPIO power supply regulator on VDDIO pin
> +
> +additionalProperties: false
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +
> +examples:
> +- |
> +    i2c@00000000 {
> +      #address-cells = <1>;
> +      #size-cells = <0>;
> +      gt928@5d {
> +        compatible = "goodix,gt928";
> +        reg = <0x5d>;
> +        interrupt-parent = <&gpio>;
> +        interrupts = <0 0>;
> +        irq-gpios = <&gpio1 0 0>;
> +        reset-gpios = <&gpio1 1 0>;
> +      };
> +    };
> +
> +...
Rob Herring Jan. 7, 2020, 5:56 p.m. UTC | #2
On Tue, Jan 7, 2020 at 7:09 AM Benjamin Gaignard
<benjamin.gaignard@st.com> wrote:
>
> Convert the Goodix binding to DT schema format using json-schema
>
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
> ---
>  .../bindings/input/touchscreen/goodix.txt          | 50 ----------------
>  .../bindings/input/touchscreen/goodix.yaml         | 69 ++++++++++++++++++++++
>  2 files changed, 69 insertions(+), 50 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/input/touchscreen/goodix.txt
>  create mode 100644 Documentation/devicetree/bindings/input/touchscreen/goodix.yaml
>
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
> deleted file mode 100644
> index fc03ea4cf5ab..000000000000
> --- a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
> +++ /dev/null
> @@ -1,50 +0,0 @@
> -Device tree bindings for Goodix GT9xx series touchscreen controller
> -
> -Required properties:
> -
> - - compatible          : Should be "goodix,gt1151"
> -                                or "goodix,gt5663"
> -                                or "goodix,gt5688"
> -                                or "goodix,gt911"
> -                                or "goodix,gt9110"
> -                                or "goodix,gt912"
> -                                or "goodix,gt927"
> -                                or "goodix,gt9271"
> -                                or "goodix,gt928"
> -                                or "goodix,gt967"
> - - reg                 : I2C address of the chip. Should be 0x5d or 0x14
> - - interrupts          : Interrupt to which the chip is connected
> -
> -Optional properties:
> -
> - - irq-gpios           : GPIO pin used for IRQ. The driver uses the
> -                         interrupt gpio pin as output to reset the device.
> - - reset-gpios         : GPIO pin used for reset
> - - AVDD28-supply       : Analog power supply regulator on AVDD28 pin
> - - VDDIO-supply                : GPIO power supply regulator on VDDIO pin
> - - touchscreen-inverted-x
> - - touchscreen-inverted-y
> - - touchscreen-size-x
> - - touchscreen-size-y
> - - touchscreen-swapped-x-y
> -
> -The touchscreen-* properties are documented in touchscreen.txt in this
> -directory.
> -
> -Example:
> -
> -       i2c@00000000 {
> -               /* ... */
> -
> -               gt928@5d {
> -                       compatible = "goodix,gt928";
> -                       reg = <0x5d>;
> -                       interrupt-parent = <&gpio>;
> -                       interrupts = <0 0>;
> -
> -                       irq-gpios = <&gpio1 0 0>;
> -                       reset-gpios = <&gpio1 1 0>;
> -               };
> -
> -               /* ... */
> -       };
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix.yaml b/Documentation/devicetree/bindings/input/touchscreen/goodix.yaml
> new file mode 100644
> index 000000000000..05b52d359ac5
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/touchscreen/goodix.yaml
> @@ -0,0 +1,69 @@
> +# SPDX-License-Identifier: GPL-2.0
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/input/touchscreen/goodix.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Goodix GT9xx series touchscreen controller Bindings
> +
> +maintainers:
> +  - Dmitry Torokhov <dmitry.torokhov@gmail.com>
> +
> +allOf:
> +  - $ref: touchscreen.yaml#
> +
> +properties:
> +  compatible:
> +    enum:
> +      - goodix,gt1151
> +      - goodix,gt5663
> +      - goodix,gt5688
> +      - goodix,gt911
> +      - goodix,gt9110
> +      - goodix,gt912
> +      - goodix,gt927
> +      - goodix,gt9271
> +      - goodix,gt928
> +      - goodix,gt967
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  irq-gpios:
> +    maxItems: 1
> +
> +  reset-gpios:
> +    maxItems: 1
> +
> +  AVDD28-supply:
> +    description: Analog power supply regulator on AVDD28 pin
> +
> +  VDDIO-supply:
> +    description: GPIO power supply regulator on VDDIO pin
> +
> +additionalProperties: false

This doesn't work if you have any touchscreen properties as this
doesn't account for things referenced. You need add them in this
schema:

touchscreen-inverted-x: true

This serves 2 purposes. It prevents additional properties not defined
here and defines which of the common properties are valid for this
device.

Rob
Rob Herring Jan. 7, 2020, 6:02 p.m. UTC | #3
On Tue, Jan 7, 2020 at 7:38 AM Bastien Nocera <hadess@hadess.net> wrote:
>
> On Tue, 2020-01-07 at 14:09 +0100, Benjamin Gaignard wrote:
> > Convert the Goodix binding to DT schema format using json-schema
>
> I don't have an opinion on the migration itself, but this really should
> not lose any of the descriptions that were in the old text file.

To some extent, yes. Any information specific to the device should be.
Anything generic can be dropped. I see 2 cases that should be kept:

> > - - reg                       : I2C address of the chip. Should be
> > 0x5d or 0x14

'I2C address of the chip' can be dropped as that's every 'reg'
property for I2C devices. The addresses can be expressed as
constraints.

> > - - irq-gpios         : GPIO pin used for IRQ. The driver uses the
> > -                       interrupt gpio pin as output to reset the
> > device.

Also useful info.

Rob

Patch
diff mbox series

diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
deleted file mode 100644
index fc03ea4cf5ab..000000000000
--- a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
+++ /dev/null
@@ -1,50 +0,0 @@ 
-Device tree bindings for Goodix GT9xx series touchscreen controller
-
-Required properties:
-
- - compatible		: Should be "goodix,gt1151"
-				 or "goodix,gt5663"
-				 or "goodix,gt5688"
-				 or "goodix,gt911"
-				 or "goodix,gt9110"
-				 or "goodix,gt912"
-				 or "goodix,gt927"
-				 or "goodix,gt9271"
-				 or "goodix,gt928"
-				 or "goodix,gt967"
- - reg			: I2C address of the chip. Should be 0x5d or 0x14
- - interrupts		: Interrupt to which the chip is connected
-
-Optional properties:
-
- - irq-gpios		: GPIO pin used for IRQ. The driver uses the
-			  interrupt gpio pin as output to reset the device.
- - reset-gpios		: GPIO pin used for reset
- - AVDD28-supply	: Analog power supply regulator on AVDD28 pin
- - VDDIO-supply		: GPIO power supply regulator on VDDIO pin
- - touchscreen-inverted-x
- - touchscreen-inverted-y
- - touchscreen-size-x
- - touchscreen-size-y
- - touchscreen-swapped-x-y
-
-The touchscreen-* properties are documented in touchscreen.txt in this
-directory.
-
-Example:
-
-	i2c@00000000 {
-		/* ... */
-
-		gt928@5d {
-			compatible = "goodix,gt928";
-			reg = <0x5d>;
-			interrupt-parent = <&gpio>;
-			interrupts = <0 0>;
-
-			irq-gpios = <&gpio1 0 0>;
-			reset-gpios = <&gpio1 1 0>;
-		};
-
-		/* ... */
-	};
diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix.yaml b/Documentation/devicetree/bindings/input/touchscreen/goodix.yaml
new file mode 100644
index 000000000000..05b52d359ac5
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/touchscreen/goodix.yaml
@@ -0,0 +1,69 @@ 
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/touchscreen/goodix.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Goodix GT9xx series touchscreen controller Bindings
+
+maintainers:
+  - Dmitry Torokhov <dmitry.torokhov@gmail.com>
+
+allOf:
+  - $ref: touchscreen.yaml#
+
+properties:
+  compatible:
+    enum:
+      - goodix,gt1151
+      - goodix,gt5663
+      - goodix,gt5688
+      - goodix,gt911
+      - goodix,gt9110
+      - goodix,gt912
+      - goodix,gt927
+      - goodix,gt9271
+      - goodix,gt928
+      - goodix,gt967
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  irq-gpios:
+    maxItems: 1
+
+  reset-gpios:
+    maxItems: 1
+
+  AVDD28-supply:
+    description: Analog power supply regulator on AVDD28 pin
+
+  VDDIO-supply:
+    description: GPIO power supply regulator on VDDIO pin
+
+additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+examples:
+- |
+    i2c@00000000 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      gt928@5d {
+        compatible = "goodix,gt928";
+        reg = <0x5d>;
+        interrupt-parent = <&gpio>;
+        interrupts = <0 0>;
+        irq-gpios = <&gpio1 0 0>;
+        reset-gpios = <&gpio1 1 0>;
+      };
+    };
+
+...