diff mbox series

[v2,3/3] dt-bindings: touchscreen: ad7877: add bindings

Message ID 20240902082707.4325-3-antoniu.miclaus@analog.com (mailing list archive)
State Superseded
Headers show
Series [v2,1/3] input: touchscreem: ad7877: add match table | expand

Commit Message

Miclaus, Antoniu Sept. 2, 2024, 8:24 a.m. UTC
Add device tree bindings for the ad7877 driver.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
changes in v2:
 - add only the used properties from touchscreen.yaml
 - add vendor properties.
 - update dt example.
 .../input/touchscreen/adi,ad7877.yaml         | 110 ++++++++++++++++++
 1 file changed, 110 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/adi,ad7877.yaml

Comments

Krzysztof Kozlowski Sept. 2, 2024, 11:52 a.m. UTC | #1
On Mon, Sep 02, 2024 at 11:24:33AM +0300, Antoniu Miclaus wrote:
> Add device tree bindings for the ad7877 driver.
> 
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
> ---
> changes in v2:
>  - add only the used properties from touchscreen.yaml
>  - add vendor properties.
>  - update dt example.
>  .../input/touchscreen/adi,ad7877.yaml         | 110 ++++++++++++++++++
>  1 file changed, 110 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/input/touchscreen/adi,ad7877.yaml
> 
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/adi,ad7877.yaml b/Documentation/devicetree/bindings/input/touchscreen/adi,ad7877.yaml
> new file mode 100644
> index 000000000000..035e2d5bbcb8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/touchscreen/adi,ad7877.yaml
> @@ -0,0 +1,110 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/input/touchscreen/adi,ad7877.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Analog Devices AD7877 Touch Screen Controller
> +
> +maintainers:
> +  - Antoniu Miclaus <antoniu.miclaus@analog.com>
> +
> +description: |
> +  Analog Devices Touch Screen Controller
> +  https://www.analog.com/media/en/technical-documentation/data-sheets/AD7877.pdf
> +
> +allOf:
> +  - $ref: touchscreen.yaml#
> +  - $ref: /schemas/spi/spi-peripheral-props.yaml#
> +
> +properties:
> +  compatible:
> +    enum:
> +      - adi,ad7877
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  spi-max-frequency:
> +    description: AD7877 SPI bus clock frequency.
> +    minimum: 10000
> +    maximum: 20000000
> +
> +  adi,stopacq-polarity:
> +    description: The polarity of the signal applied to the STOPACQ pin.
> +                 0 = active low
> +                 1 = active high
> +    $ref: /schemas/types.yaml#/definitions/uint8
> +    enum: [0, 1]

I think I was already commenting on this for analog... If using numbers,
why this is reversed from standard GPIO property? Or maybe this should
be just string.

> +
> +  adi,first-conv-delay:
> +    description: Delay before the first conversion.

No, use proper unit suffix.

> +                 0 = 0.5us
> +                 1 = 128us
> +                 2 = 1ms
> +                 3 = 8ms
> +    $ref: /schemas/types.yaml#/definitions/uint8
> +    enum: [0, 1, 2, 3]
> +
> +  adi,pen-down-acc-interval:

Use proper unit suffix.

> +    description: Enable the ADC to repeatedly perform conversions.
> +                  0 = covert once
> +                  1 = every 0.5 ms
> +                  2 = every 1 ms
> +                  3 = every 8 ms
> +    $ref: /schemas/types.yaml#/definitions/uint8
> +    enum: [0, 1, 2, 3]

How is it supposed to work? These are optional but there are no
defaults?

> +
> +  adi,acquisition-time:
> +    description:  Select acquisition times for the ADC.
> +                  0 = 2us
> +                  1 = 4us
> +                  2 = 8us
> +                  3 = 16us

Same problem

> +    $ref: /schemas/types.yaml#/definitions/uint8
> +    enum: [0, 1, 2, 3]
> +
> +  adi,vref-delay-usecs:
> +    description: Delay required for the SPI transfers depending on the VREF used.
> +    $ref: /schemas/types.yaml#/definitions/uint16
> +
> +  touchscreen-average-samples:
> +    enum: [1, 4, 8, 16]
> +
> +  touchscreen-x-plate-ohms: true
> +  touchscreen-y-plate-ohms: true
> +  touchscreen-min-x: true
> +  touchscreen-min-y: true
> +  touchscreen-max-x: true
> +  touchscreen-max-y: true
> +  touchscreen-max-pressure: true
> +  touchscreen-min-pressure: true
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - touchscreen-average-samples
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +    spi {
> +      #address-cells = <1>;
> +      #size-cells = <0>;
> +
> +      touchscreen@0 {
> +        compatible = "adi,ad7877";
> +        reg = <0>;
> +        spi-max-frequency = <20000000>;
> +        interrupts = <21 IRQ_TYPE_EDGE_FALLING>;
> +        interrupt-parent = <&gpio>;
> +        touchscreen-average-samples = <16>;

Make the example complete.

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/input/touchscreen/adi,ad7877.yaml b/Documentation/devicetree/bindings/input/touchscreen/adi,ad7877.yaml
new file mode 100644
index 000000000000..035e2d5bbcb8
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/touchscreen/adi,ad7877.yaml
@@ -0,0 +1,110 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/touchscreen/adi,ad7877.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices AD7877 Touch Screen Controller
+
+maintainers:
+  - Antoniu Miclaus <antoniu.miclaus@analog.com>
+
+description: |
+  Analog Devices Touch Screen Controller
+  https://www.analog.com/media/en/technical-documentation/data-sheets/AD7877.pdf
+
+allOf:
+  - $ref: touchscreen.yaml#
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+properties:
+  compatible:
+    enum:
+      - adi,ad7877
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  spi-max-frequency:
+    description: AD7877 SPI bus clock frequency.
+    minimum: 10000
+    maximum: 20000000
+
+  adi,stopacq-polarity:
+    description: The polarity of the signal applied to the STOPACQ pin.
+                 0 = active low
+                 1 = active high
+    $ref: /schemas/types.yaml#/definitions/uint8
+    enum: [0, 1]
+
+  adi,first-conv-delay:
+    description: Delay before the first conversion.
+                 0 = 0.5us
+                 1 = 128us
+                 2 = 1ms
+                 3 = 8ms
+    $ref: /schemas/types.yaml#/definitions/uint8
+    enum: [0, 1, 2, 3]
+
+  adi,pen-down-acc-interval:
+    description: Enable the ADC to repeatedly perform conversions.
+                  0 = covert once
+                  1 = every 0.5 ms
+                  2 = every 1 ms
+                  3 = every 8 ms
+    $ref: /schemas/types.yaml#/definitions/uint8
+    enum: [0, 1, 2, 3]
+
+  adi,acquisition-time:
+    description:  Select acquisition times for the ADC.
+                  0 = 2us
+                  1 = 4us
+                  2 = 8us
+                  3 = 16us
+    $ref: /schemas/types.yaml#/definitions/uint8
+    enum: [0, 1, 2, 3]
+
+  adi,vref-delay-usecs:
+    description: Delay required for the SPI transfers depending on the VREF used.
+    $ref: /schemas/types.yaml#/definitions/uint16
+
+  touchscreen-average-samples:
+    enum: [1, 4, 8, 16]
+
+  touchscreen-x-plate-ohms: true
+  touchscreen-y-plate-ohms: true
+  touchscreen-min-x: true
+  touchscreen-min-y: true
+  touchscreen-max-x: true
+  touchscreen-max-y: true
+  touchscreen-max-pressure: true
+  touchscreen-min-pressure: true
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - touchscreen-average-samples
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    spi {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      touchscreen@0 {
+        compatible = "adi,ad7877";
+        reg = <0>;
+        spi-max-frequency = <20000000>;
+        interrupts = <21 IRQ_TYPE_EDGE_FALLING>;
+        interrupt-parent = <&gpio>;
+        touchscreen-average-samples = <16>;
+      };
+    };
+...