diff mbox series

[v2] dt-bindings: touchscreen: Convert resistive-adc-touch binding to json schema

Message ID 20210517071825.20316-1-o.rempel@pengutronix.de (mailing list archive)
State New, archived
Headers show
Series [v2] dt-bindings: touchscreen: Convert resistive-adc-touch binding to json schema | expand

Commit Message

Oleksij Rempel May 17, 2021, 7:18 a.m. UTC
Convert the resistive-adc-touch binding to DT schema format using json-schema.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 .../input/touchscreen/resistive-adc-touch.txt | 33 ----------
 .../touchscreen/resistive-adc-touch.yaml      | 61 +++++++++++++++++++
 2 files changed, 61 insertions(+), 33 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.txt
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.yaml

Comments

Oleksij Rempel May 18, 2021, 12:41 p.m. UTC | #1
I'll resend this patch with all followup patches depending on this
change.

On Mon, May 17, 2021 at 09:18:24AM +0200, Oleksij Rempel wrote:
> Convert the resistive-adc-touch binding to DT schema format using json-schema.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
>  .../input/touchscreen/resistive-adc-touch.txt | 33 ----------
>  .../touchscreen/resistive-adc-touch.yaml      | 61 +++++++++++++++++++
>  2 files changed, 61 insertions(+), 33 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.txt
>  create mode 100644 Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.yaml
> 
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.txt b/Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.txt
> deleted file mode 100644
> index af5223bb5bdd..000000000000
> --- a/Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.txt
> +++ /dev/null
> @@ -1,33 +0,0 @@
> -Generic resistive touchscreen ADC
> -
> -Required properties:
> -
> - - compatible: must be "resistive-adc-touch"
> -The device must be connected to an ADC device that provides channels for
> -position measurement and optional pressure.
> -Refer to
> -https://github.com/devicetree-org/dt-schema/blob/master/schemas/iio/iio-consumer.yaml
> -for details
> -
> - - iio-channels: must have at least two channels connected to an ADC device.
> -These should correspond to the channels exposed by the ADC device and should
> -have the right index as the ADC device registers them. These channels
> -represent the relative position on the "x" and "y" axes.
> - - iio-channel-names: must have all the channels' names. Mandatory channels
> -are "x" and "y".
> -
> -Optional properties:
> - - iio-channels: The third channel named "pressure" is optional and can be
> -used if the ADC device also measures pressure besides position.
> -If this channel is missing, pressure will be ignored and the touchscreen
> -will only report position.
> - - iio-channel-names: optional channel named "pressure".
> -
> -Example:
> -
> -	resistive_touch: resistive_touch {
> -		compatible = "resistive-adc-touch";
> -		touchscreen-min-pressure = <50000>;
> -		io-channels = <&adc 24>, <&adc 25>, <&adc 26>;
> -		io-channel-names = "x", "y", "pressure";
> -	};
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.yaml b/Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.yaml
> new file mode 100644
> index 000000000000..53df21a6589e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.yaml
> @@ -0,0 +1,61 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/input/touchscreen/resistive-adc-touch.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Generic resistive touchscreen ADC
> +
> +maintainers:
> +  - Oleksij Rempel <o.rempel@pengutronix.de>
> +
> +description: |
> +  Generic ADC based resistive touchscreen controller
> +  The device must be connected to an ADC device that provides channels for
> +  position measurement and optional pressure.
> +
> +allOf:
> +  - $ref: touchscreen.yaml#
> +
> +properties:
> +  compatible:
> +    const: resistive-adc-touch
> +
> +  io-channels:
> +    minItems: 2
> +    maxItems: 3
> +    items:
> +      - description: x
> +      - description: y
> +      - description: pressure (optional)
> +
> +  io-channel-names:
> +    items:
> +      - const: x
> +      - const: y
> +      - const: pressure
> +
> +  touchscreen-size-x: true
> +  touchscreen-size-y: true
> +  touchscreen-fuzz-x: true
> +  touchscreen-fuzz-y: true
> +  touchscreen-inverted-x: true
> +  touchscreen-inverted-y: true
> +  touchscreen-swapped-x-y: true
> +  touchscreen-min-pressure: true
> +
> +additionalProperties: false
> +
> +required:
> +  - compatible
> +  - io-channels
> +  - io-channel-names
> +
> +examples:
> +  - |
> +    resistive_touch {
> +      compatible = "resistive-adc-touch";
> +      touchscreen-min-pressure = <50000>;
> +      io-channels = <&adc 24>, <&adc 25>, <&adc 26>;
> +      io-channel-names = "x", "y", "pressure";
> +    };
> -- 
> 2.29.2
> 
>
Rob Herring (Arm) May 18, 2021, 2:47 p.m. UTC | #2
On Mon, May 17, 2021 at 09:18:24AM +0200, Oleksij Rempel wrote:
> Convert the resistive-adc-touch binding to DT schema format using json-schema.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
>  .../input/touchscreen/resistive-adc-touch.txt | 33 ----------
>  .../touchscreen/resistive-adc-touch.yaml      | 61 +++++++++++++++++++
>  2 files changed, 61 insertions(+), 33 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.txt
>  create mode 100644 Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.yaml
> 
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.txt b/Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.txt
> deleted file mode 100644
> index af5223bb5bdd..000000000000
> --- a/Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.txt
> +++ /dev/null
> @@ -1,33 +0,0 @@
> -Generic resistive touchscreen ADC
> -
> -Required properties:
> -
> - - compatible: must be "resistive-adc-touch"
> -The device must be connected to an ADC device that provides channels for
> -position measurement and optional pressure.
> -Refer to
> -https://github.com/devicetree-org/dt-schema/blob/master/schemas/iio/iio-consumer.yaml
> -for details
> -
> - - iio-channels: must have at least two channels connected to an ADC device.
> -These should correspond to the channels exposed by the ADC device and should
> -have the right index as the ADC device registers them. These channels
> -represent the relative position on the "x" and "y" axes.
> - - iio-channel-names: must have all the channels' names. Mandatory channels
> -are "x" and "y".
> -
> -Optional properties:
> - - iio-channels: The third channel named "pressure" is optional and can be
> -used if the ADC device also measures pressure besides position.
> -If this channel is missing, pressure will be ignored and the touchscreen
> -will only report position.
> - - iio-channel-names: optional channel named "pressure".
> -
> -Example:
> -
> -	resistive_touch: resistive_touch {
> -		compatible = "resistive-adc-touch";
> -		touchscreen-min-pressure = <50000>;
> -		io-channels = <&adc 24>, <&adc 25>, <&adc 26>;
> -		io-channel-names = "x", "y", "pressure";
> -	};
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.yaml b/Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.yaml
> new file mode 100644
> index 000000000000..53df21a6589e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.yaml
> @@ -0,0 +1,61 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/input/touchscreen/resistive-adc-touch.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Generic resistive touchscreen ADC
> +
> +maintainers:
> +  - Oleksij Rempel <o.rempel@pengutronix.de>
> +
> +description: |
> +  Generic ADC based resistive touchscreen controller
> +  The device must be connected to an ADC device that provides channels for
> +  position measurement and optional pressure.
> +
> +allOf:
> +  - $ref: touchscreen.yaml#
> +
> +properties:
> +  compatible:
> +    const: resistive-adc-touch
> +
> +  io-channels:
> +    minItems: 2
> +    maxItems: 3

maxItems is implied by the 'items' length.

> +    items:
> +      - description: x
> +      - description: y
> +      - description: pressure (optional)
> +
> +  io-channel-names:

This needs minItems, too.

> +    items:
> +      - const: x
> +      - const: y
> +      - const: pressure
> +
> +  touchscreen-size-x: true
> +  touchscreen-size-y: true
> +  touchscreen-fuzz-x: true
> +  touchscreen-fuzz-y: true
> +  touchscreen-inverted-x: true
> +  touchscreen-inverted-y: true
> +  touchscreen-swapped-x-y: true
> +  touchscreen-min-pressure: true
> +
> +additionalProperties: false
> +
> +required:
> +  - compatible
> +  - io-channels
> +  - io-channel-names
> +
> +examples:
> +  - |
> +    resistive_touch {

touchscreen {

> +      compatible = "resistive-adc-touch";
> +      touchscreen-min-pressure = <50000>;
> +      io-channels = <&adc 24>, <&adc 25>, <&adc 26>;
> +      io-channel-names = "x", "y", "pressure";
> +    };
> -- 
> 2.29.2
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.txt b/Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.txt
deleted file mode 100644
index af5223bb5bdd..000000000000
--- a/Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.txt
+++ /dev/null
@@ -1,33 +0,0 @@ 
-Generic resistive touchscreen ADC
-
-Required properties:
-
- - compatible: must be "resistive-adc-touch"
-The device must be connected to an ADC device that provides channels for
-position measurement and optional pressure.
-Refer to
-https://github.com/devicetree-org/dt-schema/blob/master/schemas/iio/iio-consumer.yaml
-for details
-
- - iio-channels: must have at least two channels connected to an ADC device.
-These should correspond to the channels exposed by the ADC device and should
-have the right index as the ADC device registers them. These channels
-represent the relative position on the "x" and "y" axes.
- - iio-channel-names: must have all the channels' names. Mandatory channels
-are "x" and "y".
-
-Optional properties:
- - iio-channels: The third channel named "pressure" is optional and can be
-used if the ADC device also measures pressure besides position.
-If this channel is missing, pressure will be ignored and the touchscreen
-will only report position.
- - iio-channel-names: optional channel named "pressure".
-
-Example:
-
-	resistive_touch: resistive_touch {
-		compatible = "resistive-adc-touch";
-		touchscreen-min-pressure = <50000>;
-		io-channels = <&adc 24>, <&adc 25>, <&adc 26>;
-		io-channel-names = "x", "y", "pressure";
-	};
diff --git a/Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.yaml b/Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.yaml
new file mode 100644
index 000000000000..53df21a6589e
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.yaml
@@ -0,0 +1,61 @@ 
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/touchscreen/resistive-adc-touch.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Generic resistive touchscreen ADC
+
+maintainers:
+  - Oleksij Rempel <o.rempel@pengutronix.de>
+
+description: |
+  Generic ADC based resistive touchscreen controller
+  The device must be connected to an ADC device that provides channels for
+  position measurement and optional pressure.
+
+allOf:
+  - $ref: touchscreen.yaml#
+
+properties:
+  compatible:
+    const: resistive-adc-touch
+
+  io-channels:
+    minItems: 2
+    maxItems: 3
+    items:
+      - description: x
+      - description: y
+      - description: pressure (optional)
+
+  io-channel-names:
+    items:
+      - const: x
+      - const: y
+      - const: pressure
+
+  touchscreen-size-x: true
+  touchscreen-size-y: true
+  touchscreen-fuzz-x: true
+  touchscreen-fuzz-y: true
+  touchscreen-inverted-x: true
+  touchscreen-inverted-y: true
+  touchscreen-swapped-x-y: true
+  touchscreen-min-pressure: true
+
+additionalProperties: false
+
+required:
+  - compatible
+  - io-channels
+  - io-channel-names
+
+examples:
+  - |
+    resistive_touch {
+      compatible = "resistive-adc-touch";
+      touchscreen-min-pressure = <50000>;
+      io-channels = <&adc 24>, <&adc 25>, <&adc 26>;
+      io-channel-names = "x", "y", "pressure";
+    };