diff mbox series

[v4,3/6] Documentation: DT bindings for Microsoft G6 Touch Digitizer

Message ID 20220225005936.3485405-4-dmanti@microsoft.com (mailing list archive)
State New, archived
Headers show
Series Add spi-hid, transport for HID over SPI bus | expand

Commit Message

Dmitry Antipov Feb. 25, 2022, 12:59 a.m. UTC
From: Dmitry Antipov <dmanti@microsoft.com>

Documentation describes the required and optional properties for
implementing Device Tree for a Microsoft G6 Touch Digitizer that
supports HID over SPI Protocol 1.0 specification.

Signed-off-by: Dmitry Antipov <dmanti@microsoft.com>
---
 .../input/microsoft,g6-touch-digitizer.yaml   | 105 ++++++++++++++++++
 1 file changed, 105 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/microsoft,g6-touch-digitizer.yaml

Comments

Rob Herring Feb. 25, 2022, 2:16 p.m. UTC | #1
On Thu, 24 Feb 2022 16:59:33 -0800, Dmitry Antipov wrote:
> From: Dmitry Antipov <dmanti@microsoft.com>
> 
> Documentation describes the required and optional properties for
> implementing Device Tree for a Microsoft G6 Touch Digitizer that
> supports HID over SPI Protocol 1.0 specification.
> 
> Signed-off-by: Dmitry Antipov <dmanti@microsoft.com>
> ---
>  .../input/microsoft,g6-touch-digitizer.yaml   | 105 ++++++++++++++++++
>  1 file changed, 105 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/input/microsoft,g6-touch-digitizer.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:
./Documentation/devicetree/bindings/input/microsoft,g6-touch-digitizer.yaml:22:9: [warning] wrong indentation: expected 10 but found 8 (indentation)

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/input/microsoft,g6-touch-digitizer.example.dts:23.11-21: Warning (reg_format): /example-0/spi-hid-dev0:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1)
Documentation/devicetree/bindings/input/microsoft,g6-touch-digitizer.example.dts:21.22-37.11: Warning (unit_address_vs_reg): /example-0/spi-hid-dev0: node has a reg or ranges property, but no unit name
Documentation/devicetree/bindings/input/microsoft,g6-touch-digitizer.example.dt.yaml: Warning (pci_device_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/input/microsoft,g6-touch-digitizer.example.dt.yaml: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/input/microsoft,g6-touch-digitizer.example.dt.yaml: Warning (simple_bus_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/input/microsoft,g6-touch-digitizer.example.dt.yaml: Warning (i2c_bus_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/input/microsoft,g6-touch-digitizer.example.dt.yaml: Warning (spi_bus_reg): Failed prerequisite 'reg_format'

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/1597405

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.
Rob Herring Feb. 25, 2022, 2:58 p.m. UTC | #2
On Thu, Feb 24, 2022 at 04:59:33PM -0800, Dmitry Antipov wrote:
> From: Dmitry Antipov <dmanti@microsoft.com>

Please follow the conventions of the subsystem for the subject:

dt-bindings: input: ...

> 
> Documentation describes the required and optional properties for
> implementing Device Tree for a Microsoft G6 Touch Digitizer that
> supports HID over SPI Protocol 1.0 specification.
> 
> Signed-off-by: Dmitry Antipov <dmanti@microsoft.com>
> ---
>  .../input/microsoft,g6-touch-digitizer.yaml   | 105 ++++++++++++++++++
>  1 file changed, 105 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/input/microsoft,g6-touch-digitizer.yaml
> 
> diff --git a/Documentation/devicetree/bindings/input/microsoft,g6-touch-digitizer.yaml b/Documentation/devicetree/bindings/input/microsoft,g6-touch-digitizer.yaml
> new file mode 100644
> index 000000000000..e516717527e9
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/microsoft,g6-touch-digitizer.yaml
> @@ -0,0 +1,105 @@
> +# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/input/microsoft,g6-touch-digitizer.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Microsoft G6 Touch Digitizer
> +
> +maintainers:
> +  - Dmitry Antipov <dmanti@microsoft.com>
> +
> +description: |
> +  Microsoft G6 touch digitizer is a HID over SPI device supporting HID Over SPI
> +  Protocol Specification 1.0, available at
> +  https://www.microsoft.com/en-us/download/details.aspx?id=103325.
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - const: microsoft,g6-touch-digitizer
> +      - items:
> +        - const: microsoft,g6-touch-digitizer
> +        - const: hid-over-spi

Why are both cases needed?

Assuming you keep the 2nd case, you will need a custom 'select' to avoid 
applying this schema to another binding using 'hid-over-spi':

select:
  properties:
    compatible:
      contains:
	const: microsoft,g6-touch-digitizer

  required:
    - compatible


> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  reset-gpios:
> +    maxItems: 1
> +    description:
> +      GPIO specifier for the digitizer's reset pin (active low). The line must
> +      be flagged with GPIO_ACTIVE_LOW.
> +
> +  vdd-supply:
> +    description:
> +      Regulator for the VDD supply voltage.
> +
> +  input-report-header-address:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description:
> +      This property and the rest are described in HID Over SPI Protocol Spec 1.0

Each property needs a description and a more specific spec location.

No constraints on the values? 0 - 2^32 is valid?

> +
> +  input-report-body-address:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +
> +  output-report-address:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +
> +  read-opcode:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +
> +  write-opcode:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +
> +  hid-over-spi-flags:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +

> +  post-power-on-delay-ms:
> +    description:
> +      Optional time in ms required by the device after enabling its regulators
> +      or powering it on, before it is ready for communication.
> +
> +  minimal-reset-delay-ms:
> +    description:
> +      Optional minimum amount of time in ms that device needs to be in reset
> +      state for the reset to take effect.

These should be implied by the compatible string.

> +
> +required:
> +  - compatible
> +  - interrupts
> +  - reset-gpios

It's not allowed to have reset under h/w control?

> +  - vdd-supply
> +  - input-report-header-address
> +  - input-report-body-address
> +  - output-report-address
> +  - read-opcode
> +  - write-opcode
> +  - hid-over-spi-flags
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +    #include <dt-bindings/gpio/gpio.h>
> +    spi-hid-dev0 {

hid@0

And you'll need to define a spi bus.

> +      compatible = "microsoft,g6-touch-digitizer", "hid-over-spi";
> +      reg = <0>;
> +      interrupts-extended = <&gpio 42 IRQ_TYPE_EDGE_FALLING>;
> +      reset-gpios = <&gpio 27 GPIO_ACTIVE_LOW>;
> +      vdd-supply = <&pm8350c_l3>;
> +      pinctrl-names = "default";
> +      pinctrl-0 = <&ts_d6_reset_assert &ts_d6_int_bias>;
> +      input-report-header-address = <0x1000>;
> +      input-report-body-address = <0x1004>;
> +      output-report-address = <0x2000>;
> +      read-opcode = <0x0b>;
> +      write-opcode = <0x02>;
> +      hid-over-spi-flags = <0x00>;
> +      post-power-on-delay-ms = <5>;
> +      minimal-reset-delay-ms = <5>;
> +    };
> -- 
> 2.25.1
> 
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/input/microsoft,g6-touch-digitizer.yaml b/Documentation/devicetree/bindings/input/microsoft,g6-touch-digitizer.yaml
new file mode 100644
index 000000000000..e516717527e9
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/microsoft,g6-touch-digitizer.yaml
@@ -0,0 +1,105 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/microsoft,g6-touch-digitizer.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microsoft G6 Touch Digitizer
+
+maintainers:
+  - Dmitry Antipov <dmanti@microsoft.com>
+
+description: |
+  Microsoft G6 touch digitizer is a HID over SPI device supporting HID Over SPI
+  Protocol Specification 1.0, available at
+  https://www.microsoft.com/en-us/download/details.aspx?id=103325.
+
+properties:
+  compatible:
+    oneOf:
+      - const: microsoft,g6-touch-digitizer
+      - items:
+        - const: microsoft,g6-touch-digitizer
+        - const: hid-over-spi
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  reset-gpios:
+    maxItems: 1
+    description:
+      GPIO specifier for the digitizer's reset pin (active low). The line must
+      be flagged with GPIO_ACTIVE_LOW.
+
+  vdd-supply:
+    description:
+      Regulator for the VDD supply voltage.
+
+  input-report-header-address:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      This property and the rest are described in HID Over SPI Protocol Spec 1.0
+
+  input-report-body-address:
+    $ref: /schemas/types.yaml#/definitions/uint32
+
+  output-report-address:
+    $ref: /schemas/types.yaml#/definitions/uint32
+
+  read-opcode:
+    $ref: /schemas/types.yaml#/definitions/uint32
+
+  write-opcode:
+    $ref: /schemas/types.yaml#/definitions/uint32
+
+  hid-over-spi-flags:
+    $ref: /schemas/types.yaml#/definitions/uint32
+
+  post-power-on-delay-ms:
+    description:
+      Optional time in ms required by the device after enabling its regulators
+      or powering it on, before it is ready for communication.
+
+  minimal-reset-delay-ms:
+    description:
+      Optional minimum amount of time in ms that device needs to be in reset
+      state for the reset to take effect.
+
+required:
+  - compatible
+  - interrupts
+  - reset-gpios
+  - vdd-supply
+  - input-report-header-address
+  - input-report-body-address
+  - output-report-address
+  - read-opcode
+  - write-opcode
+  - hid-over-spi-flags
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/gpio/gpio.h>
+    spi-hid-dev0 {
+      compatible = "microsoft,g6-touch-digitizer", "hid-over-spi";
+      reg = <0>;
+      interrupts-extended = <&gpio 42 IRQ_TYPE_EDGE_FALLING>;
+      reset-gpios = <&gpio 27 GPIO_ACTIVE_LOW>;
+      vdd-supply = <&pm8350c_l3>;
+      pinctrl-names = "default";
+      pinctrl-0 = <&ts_d6_reset_assert &ts_d6_int_bias>;
+      input-report-header-address = <0x1000>;
+      input-report-body-address = <0x1004>;
+      output-report-address = <0x2000>;
+      read-opcode = <0x0b>;
+      write-opcode = <0x02>;
+      hid-over-spi-flags = <0x00>;
+      post-power-on-delay-ms = <5>;
+      minimal-reset-delay-ms = <5>;
+    };