[PATCH v2] dt-bindings: input: Goodix SPI HID Touchscreen

Charles Wang posted 1 patch 2 weeks, 2 days ago
.../bindings/input/goodix,gt7986u.yaml        | 66 +++++++++++++++++++
1 file changed, 66 insertions(+)
create mode 100644 Documentation/devicetree/bindings/input/goodix,gt7986u.yaml
[PATCH v2] dt-bindings: input: Goodix SPI HID Touchscreen
Posted by Charles Wang 2 weeks, 2 days ago
The Goodix GT7986U touch controller report touch data according to the
HID protocol through the SPI bus. However, it is incompatible with
Microsoft's HID-over-SPI protocol.

Signed-off-by: Charles Wang <charles.goodix@gmail.com>
---
Changes in v2:
- Change compatible to 'goodix,gt7986u-spifw'.
- Remove 'goodix,hid-report-addr' property.
- Change additionalProperties to unevaluatedProperties.
- v1: https://lore.kernel.org/all/20241025114642.40793-2-charles.goodix@gmail.com/
---
 .../bindings/input/goodix,gt7986u.yaml        | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/goodix,gt7986u.yaml

diff --git a/Documentation/devicetree/bindings/input/goodix,gt7986u.yaml b/Documentation/devicetree/bindings/input/goodix,gt7986u.yaml
new file mode 100644
index 000000000..b7afa21fb
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/goodix,gt7986u.yaml
@@ -0,0 +1,66 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/goodix,gt7986u.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Goodix GT7986U SPI HID Touchscreen
+
+maintainers:
+  - Charles Wang <charles.goodix@gmail.com>
+
+description: Supports the Goodix GT7986U touchscreen.
+  This touch controller reports data packaged according to the HID protocol
+  over the SPI bus, but it is incompatible with Microsoft's HID-over-SPI protocol.
+
+allOf:
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+properties:
+  compatible:
+    description:
+      Add the 'spifw' suffix to distinguish it from the general GT7986U I2C-HID
+      touchscreen, as it runs a substantially different firmware than GT7986U
+      I2C-HID touchscreens.
+    enum:
+      - goodix,gt7986u-spifw
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  reset-gpios:
+    maxItems: 1
+
+  spi-max-frequency: true
+
+unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - reset-gpios
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/gpio/gpio.h>
+
+    spi {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      touchscreen@0 {
+        compatible = "goodix,gt7986u-spifw";
+        reg = <0>;
+        interrupt-parent = <&gpio>;
+        interrupts = <25 IRQ_TYPE_LEVEL_LOW>;
+        reset-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
+        spi-max-frequency = <10000000>;
+      };
+    };
+
+...
-- 
2.43.0
Re: [PATCH v2] dt-bindings: input: Goodix SPI HID Touchscreen
Posted by Doug Anderson 2 weeks, 2 days ago
Hi,

On Wed, Nov 6, 2024 at 7:23 PM Charles Wang <charles.goodix@gmail.com> wrote:
>
> The Goodix GT7986U touch controller report touch data according to the
> HID protocol through the SPI bus. However, it is incompatible with
> Microsoft's HID-over-SPI protocol.

I think it was requested that both the yaml file and the commit
message mention why there are two different yaml file that both talk
about "gt7986u". In the commit message I think it would be valuable to
point to the previous discussion. AKA, maybe say:

NOTE: these bindings are distinct from the bindings used with the
GT7986U when the chip is running I2C firmware. For some background,
see discussion on the mailing lists in the thread:

https://lore.kernel.org/r/20241018020815.3098263-2-charles.goodix@gmail.com


> Signed-off-by: Charles Wang <charles.goodix@gmail.com>
> ---
> Changes in v2:
> - Change compatible to 'goodix,gt7986u-spifw'.
> - Remove 'goodix,hid-report-addr' property.

Probably this should be a two-patch series now. The first is this
bindings file and the second changes the firmware (which never got
reverted) to default to a hid-report-addr of 1.


> - Change additionalProperties to unevaluatedProperties.
> - v1: https://lore.kernel.org/all/20241025114642.40793-2-charles.goodix@gmail.com/
> ---
>  .../bindings/input/goodix,gt7986u.yaml        | 66 +++++++++++++++++++
>  1 file changed, 66 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/input/goodix,gt7986u.yaml

The name of the file needs to match the primary compatible, so it
should include the "-spifw" part.


> diff --git a/Documentation/devicetree/bindings/input/goodix,gt7986u.yaml b/Documentation/devicetree/bindings/input/goodix,gt7986u.yaml
> new file mode 100644
> index 000000000..b7afa21fb
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/goodix,gt7986u.yaml
> @@ -0,0 +1,66 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/input/goodix,gt7986u.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Goodix GT7986U SPI HID Touchscreen
> +
> +maintainers:
> +  - Charles Wang <charles.goodix@gmail.com>
> +
> +description: Supports the Goodix GT7986U touchscreen.
> +  This touch controller reports data packaged according to the HID protocol
> +  over the SPI bus, but it is incompatible with Microsoft's HID-over-SPI protocol.

I probably would have put the note about the compatible here instead
of below. Something like:

NOTE: these bindings are distinct from the bindings used with the
GT7986U when the chip is running I2C firmware. This is because there's
not a single device that talks over both I2C and SPI but rather
distinct touchscreens that happen to be built with the same ASIC but
that are distinct products running distinct firmware.


> +allOf:
> +  - $ref: /schemas/spi/spi-peripheral-props.yaml#
> +
> +properties:
> +  compatible:
> +    description:
> +      Add the 'spifw' suffix to distinguish it from the general GT7986U I2C-HID
> +      touchscreen, as it runs a substantially different firmware than GT7986U
> +      I2C-HID touchscreens.

As per above, I'd remove the "description" here. It's not common for a
compatible to have a "description".


> +    enum:
> +      - goodix,gt7986u-spifw
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  reset-gpios:
> +    maxItems: 1
> +
> +  spi-max-frequency: true
> +
> +unevaluatedProperties: false

I believe "unevaluatedProperties" is supposed to be moved down below
"required" according to previous comments on your patches.
Re: [PATCH v2] dt-bindings: input: Goodix SPI HID Touchscreen
Posted by Charles Wang 2 weeks, 1 day ago
On Thu, Nov 07, 2024 at 01:54:33PM -0800, Doug Anderson wrote:
> Hi,
> 
> On Wed, Nov 6, 2024 at 7:23 PM Charles Wang <charles.goodix@gmail.com> wrote:
> >
> > The Goodix GT7986U touch controller report touch data according to the
> > HID protocol through the SPI bus. However, it is incompatible with
> > Microsoft's HID-over-SPI protocol.
> 
> I think it was requested that both the yaml file and the commit
> message mention why there are two different yaml file that both talk
> about "gt7986u". In the commit message I think it would be valuable to
> point to the previous discussion. AKA, maybe say:
> 
> NOTE: these bindings are distinct from the bindings used with the
> GT7986U when the chip is running I2C firmware. For some background,
> see discussion on the mailing lists in the thread:
> 
> https://lore.kernel.org/r/20241018020815.3098263-2-charles.goodix@gmail.com
> 

Ack,

> 
> > Signed-off-by: Charles Wang <charles.goodix@gmail.com>
> > ---
> > Changes in v2:
> > - Change compatible to 'goodix,gt7986u-spifw'.
> > - Remove 'goodix,hid-report-addr' property.
> 
> Probably this should be a two-patch series now. The first is this
> bindings file and the second changes the firmware (which never got
> reverted) to default to a hid-report-addr of 1.
> 

Ack,

> 
> > - Change additionalProperties to unevaluatedProperties.
> > - v1: https://lore.kernel.org/all/20241025114642.40793-2-charles.goodix@gmail.com/
> > ---
> >  .../bindings/input/goodix,gt7986u.yaml        | 66 +++++++++++++++++++
> >  1 file changed, 66 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/input/goodix,gt7986u.yaml
> 
> The name of the file needs to match the primary compatible, so it
> should include the "-spifw" part.
> 

Ack,

> 
> > diff --git a/Documentation/devicetree/bindings/input/goodix,gt7986u.yaml b/Documentation/devicetree/bindings/input/goodix,gt7986u.yaml
> > new file mode 100644
> > index 000000000..b7afa21fb
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/input/goodix,gt7986u.yaml
> > @@ -0,0 +1,66 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/input/goodix,gt7986u.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Goodix GT7986U SPI HID Touchscreen
> > +
> > +maintainers:
> > +  - Charles Wang <charles.goodix@gmail.com>
> > +
> > +description: Supports the Goodix GT7986U touchscreen.
> > +  This touch controller reports data packaged according to the HID protocol
> > +  over the SPI bus, but it is incompatible with Microsoft's HID-over-SPI protocol.
> 
> I probably would have put the note about the compatible here instead
> of below. Something like:
> 
> NOTE: these bindings are distinct from the bindings used with the
> GT7986U when the chip is running I2C firmware. This is because there's
> not a single device that talks over both I2C and SPI but rather
> distinct touchscreens that happen to be built with the same ASIC but
> that are distinct products running distinct firmware.
>

Ack,

> 
> > +allOf:
> > +  - $ref: /schemas/spi/spi-peripheral-props.yaml#
> > +
> > +properties:
> > +  compatible:
> > +    description:
> > +      Add the 'spifw' suffix to distinguish it from the general GT7986U I2C-HID
> > +      touchscreen, as it runs a substantially different firmware than GT7986U
> > +      I2C-HID touchscreens.
> 
> As per above, I'd remove the "description" here. It's not common for a
> compatible to have a "description".
>

Ack,

> 
> > +    enum:
> > +      - goodix,gt7986u-spifw
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  interrupts:
> > +    maxItems: 1
> > +
> > +  reset-gpios:
> > +    maxItems: 1
> > +
> > +  spi-max-frequency: true
> > +
> > +unevaluatedProperties: false
> 
> I believe "unevaluatedProperties" is supposed to be moved down below
> "required" according to previous comments on your patches.

Ack,

Thank you very much,
Charles