Skip to contentSkip to conversation

HID: add initial support for Goodix HID-over-SPI touchscreen

PATCH Superseded Charles Wang 4 participants 13 messages Aug 14, 2024 – Sep 26, 2024

Subsystems (3)

v7 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v7 cover HID: add initial support for Goodix HID-over-SPI touchscreen

This patch introduces a new driver to support the Goodix GT7986U touch controller. This device is not compatible with Microsoft's HID-over-SPI protocol and therefore needs to implement its own flavor. The data reported is packaged according to the HID protocol but uses SPI for communication to improve speed. This enables the device to transmit not only coordinate data but also corresponding raw data that can be accessed by user-space programs through the hidraw interface. The raw data can be utilized for functions like palm rejection, thereby improving the touch experience.

Key features:
- Device connection confirmation and initialization
- IRQ-based event reporting to the input subsystem
- Support for HIDRAW operations (GET_REPORT and SET_REPORT)

---
Changes in v7:
- Add Reviewed-by info.

Changes in v6:
- Remove spi_shutdown() method.
- Use devm_kmalloc to alloc event_buf.

Changes in v5:
- Add additional descriptive information to the dt-binding file.
- Fixed build warnings reported by kernel test robot.

Changes in v4:
- Allocate memory based on the report information.
- Added a new function goodix_get_event_report() to retrieve report data, reducing memory copy operations and avoiding the use of reg_rw_lock.
- Add low power control operations.
- Implemented power management operations.
- Introduced GOODIX_HID_STARTED to record the current device operating state.
- Add OF match table.

Changes in v3:
- Renamed the driver file to hid-goodix-spi.c.
- Mentioned in the commit message that this implementation is not compatible with Microsoft's HID-over-SPI protocol.
- Modified the driver to fetch the GOODIX_HID_REPORT_ADDR from device properties.
- Add a lock to prevent concurrent hid feature request operations.
- Optimized the SPI read/write functions by reducing the number of malloc calls.

Changes in v2:
- Fixed build warnings reported by kernel test robot

---
Charles Wang (2):
HID: hid-goodix: Add Goodix HID-over-SPI driver
dt-bindings: input: Goodix SPI HID Touchscreen

 .../bindings/input/goodix,gt7986u.yaml        |  71 ++
 drivers/hid/Kconfig                           |   6 +
 drivers/hid/Makefile                          |   1 +
 drivers/hid/hid-goodix-spi.c                  | 810 ++++++++++++++++++
 4 files changed, 888 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/goodix,gt7986u.yaml
 create mode 100644 drivers/hid/hid-goodix-spi.c
Signature · 1 line
2.43.0
#1 lore raw

PATCH v7 1/2 HID: hid-goodix: Add Goodix HID-over-SPI driver

This patch introduces a new driver to support the Goodix GT7986U touch controller. This device is not compatible with Microsoft's HID-over-SPI protocol and therefore needs to implement its own flavor. The data reported is packaged according to the HID protocol but uses SPI for communication to improve speed. This enables the device to transmit not only coordinate data but also corresponding raw data that can be accessed by user-space programs through the hidraw interface. The raw data can be utilized for functions like palm rejection, thereby improving the touch experience.

Key features:
- Device connection confirmation and initialization
- IRQ-based event reporting to the input subsystem
- Support for HIDRAW operations (GET_REPORT and SET_REPORT)

---
 drivers/hid/Kconfig          |   6 +
 drivers/hid/Makefile         |   1 +
 drivers/hid/hid-goodix-spi.c | 810 +++++++++++++++++++++++++++++++++++
 3 files changed, 817 insertions(+)
 create mode 100644 drivers/hid/hid-goodix-spi.c
drivers/hid/Kconfig +6 -0
index 4c682c650..03e750e04 100644
@@ -404,6 +404,12 @@ config HID_VIVALDI_COMMON
 	  option so that drivers can use common code to parse the HID
 	  descriptors for vivaldi function row keymap.
 
+config HID_GOODIX_SPI
+	tristate "Goodix GT7986U SPI HID touchscreen"
+	depends on SPI_MASTER
+	help
+	  Support for Goodix GT7986U SPI HID touchscreen device.
+
 config HID_GOOGLE_HAMMER
 	tristate "Google Hammer Keyboard"
 	select HID_VIVALDI_COMMON
drivers/hid/Makefile +1 -0
index 082a728ea..56e3ed4c1 100644
@@ -54,6 +54,7 @@ obj-$(CONFIG_HID_GEMBIRD)	+= hid-gembird.o
 obj-$(CONFIG_HID_GFRM)		+= hid-gfrm.o
 obj-$(CONFIG_HID_GLORIOUS)  += hid-glorious.o
 obj-$(CONFIG_HID_VIVALDI_COMMON) += hid-vivaldi-common.o
+obj-$(CONFIG_HID_GOODIX_SPI)	+= hid-goodix-spi.o
 obj-$(CONFIG_HID_GOOGLE_HAMMER)	+= hid-google-hammer.o
 obj-$(CONFIG_HID_GOOGLE_STADIA_FF)	+= hid-google-stadiaff.o
 obj-$(CONFIG_HID_VIVALDI)	+= hid-vivaldi.o
drivers/hid/hid-goodix-spi.c new file +810 -0

810 lines not on this page · raw message

Signature · 1 line
2.43.0
#2 lore raw

PATCH v7 2/2 dt-bindings: input: Goodix SPI HID Touchscreen

In reply to Charles Wang

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.

---
 .../bindings/input/goodix,gt7986u.yaml        | 71 +++++++++++++++++++
 1 file changed, 71 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/goodix,gt7986u.yaml
Documentation/devicetree/bindings/input/goodix,gt7986u.yaml new file +71 -0
new file mode 100644
index 000000000..a7d42a5d6
@@ -0,0 +1,71 @@
+# 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 <[email protected]>
+
+description: Supports the Goodix GT7986U touchscreen.
+  This touch controller reports data packaged according to the HID protocol,
+  but is incompatible with Microsoft's HID-over-SPI protocol.
+
+allOf:
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+properties:
+  compatible:
+    enum:
+      - goodix,gt7986u
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  reset-gpios:
+    maxItems: 1
+
+  goodix,hid-report-addr:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      The register address for retrieving HID report data.
+      This address is related to the device firmware and may
+      change after a firmware update.
+
+  spi-max-frequency: true
+
+additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - reset-gpios
+  - goodix,hid-report-addr
+
+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";
+        reg = <0>;
+        interrupt-parent = <&gpio>;
+        interrupts = <25 IRQ_TYPE_LEVEL_LOW>;
+        reset-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
+        spi-max-frequency = <10000000>;
+        goodix,hid-report-addr = <0x22c8c>;
+      };
+    };
+
+...
Signature · 1 line
2.43.0
maintainer
#12 lore raw
In reply to Charles Wang
Quoted 10 lines · Charles Wang

This patch introduces a new driver to support the Goodix GT7986U touch controller. This device is not compatible with Microsoft's HID-over-SPI protocol and therefore needs to implement its own flavor. The data reported is packaged according to the HID protocol but uses SPI for communication to improve speed. This enables the device to transmit not only coordinate data but also corresponding raw data that can be accessed by user-space programs through the hidraw interface. The raw data can be utilized for functions like palm rejection, thereby improving the touch experience.

Quoted 6 lines

Key features:
- Device connection confirmation and initialization
- IRQ-based event reporting to the input subsystem
- Support for HIDRAW operations (GET_REPORT and SET_REPORT)

Now queued in hid.git#for-6.12/goodix-spi. Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs
maintainer
#3 lore raw

Re: [PATCH v7 2/2] dt-bindings: input: Goodix SPI HID Touchscreen

In reply to Charles Wang
Quoted 30 lines · Charles Wang

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.

---
 .../bindings/input/goodix,gt7986u.yaml        | 71 +++++++++++++++++++
 1 file changed, 71 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/goodix,gt7986u.yaml
Documentation/devicetree/bindings/input/goodix,gt7986u.yaml new file +12 -0
new file mode 100644
index 000000000..a7d42a5d6
@@ -0,0 +1,71 @@
+# 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 <[email protected]>
+
+description: Supports the Goodix GT7986U touchscreen.

Documentation/devicetree/bindings/input/goodix,gt7986u.yaml line 22

Quoted 10 lines
Documentation/devicetree/bindings/input/goodix,gt7986u.yaml new file +10 -0
+  This touch controller reports data packaged according to the HID protocol,
+  but is incompatible with Microsoft's HID-over-SPI protocol.
+
+allOf:
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+properties:
+  compatible:
+    enum:
+      - goodix,gt7986u

This is already documented in goodix,gt7375p.yaml. Now linux-next has warnings:

/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/goodix,gt7986u.example.dtb:
touchscreen@0: compatible: 'oneOf' conditional failed, one must be
fixed:
['goodix,gt7986u'] is too short
'goodix,gt7375p' was expected
from schema $id:
http://devicetree.org/schemas/input/goodix,gt7375p.yaml#
/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/goodix,gt7986u.example.dtb:
touchscreen@0: reg:0:0: 0 is not one of [93, 20]
from schema $id:
http://devicetree.org/schemas/input/goodix,gt7375p.yaml#
/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/goodix,gt7986u.example.dtb:
touchscreen@0: 'vdd-supply' is a required property
from schema $id:
http://devicetree.org/schemas/input/goodix,gt7375p.yaml#
/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/goodix,gt7986u.example.dtb:
touchscreen@0: 'goodix,hid-report-addr', 'spi-max-frequency' do not
match any of the regexes: 'pinctrl-[0-9]+'
from schema $id:
http://devicetree.org/schemas/input/goodix,gt7375p.yaml#

Please sort this out and send a fix.

Rob

maintainer
#4 lore raw

Re: [PATCH v7 2/2] dt-bindings: input: Goodix SPI HID Touchscreen

Quoted 66 lines · Rob Herring
Quoted 30 lines · Charles Wang

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.

---
 .../bindings/input/goodix,gt7986u.yaml        | 71 +++++++++++++++++++
 1 file changed, 71 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/goodix,gt7986u.yaml
Documentation/devicetree/bindings/input/goodix,gt7986u.yaml new file +12 -0
new file mode 100644
index 000000000..a7d42a5d6
@@ -0,0 +1,71 @@
+# 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 <[email protected]>
+
+description: Supports the Goodix GT7986U touchscreen.

Documentation/devicetree/bindings/input/goodix,gt7986u.yaml line 22

Quoted 10 lines
Documentation/devicetree/bindings/input/goodix,gt7986u.yaml new file +10 -0
+  This touch controller reports data packaged according to the HID protocol,
+  but is incompatible with Microsoft's HID-over-SPI protocol.
+
+allOf:
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+properties:
+  compatible:
+    enum:
+      - goodix,gt7986u

This is already documented in goodix,gt7375p.yaml. Now linux-next has warnings:

/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/goodix,gt7986u.example.dtb:
touchscreen@0: compatible: 'oneOf' conditional failed, one must be
fixed:
['goodix,gt7986u'] is too short
'goodix,gt7375p' was expected
from schema $id:
http://devicetree.org/schemas/input/goodix,gt7375p.yaml#
/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/goodix,gt7986u.example.dtb:
touchscreen@0: reg:0:0: 0 is not one of [93, 20]
from schema $id:
http://devicetree.org/schemas/input/goodix,gt7375p.yaml#
/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/goodix,gt7986u.example.dtb:
touchscreen@0: 'vdd-supply' is a required property
from schema $id:
http://devicetree.org/schemas/input/goodix,gt7375p.yaml#
/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/goodix,gt7986u.example.dtb:
touchscreen@0: 'goodix,hid-report-addr', 'spi-max-frequency' do not
match any of the regexes: 'pinctrl-[0-9]+'
from schema $id:
http://devicetree.org/schemas/input/goodix,gt7375p.yaml#

Quoted 1 line

Please sort this out and send a fix.

I should add that it is intermittent whether you see this error or not. The tools select a single schema based on the compatible string and it is undefined which of the 2 schemas you will get.

Rob

maintainer
#5 lore raw

Re: [PATCH v7 2/2] dt-bindings: input: Goodix SPI HID Touchscreen

Quoted 68 lines · Rob Herring
Quoted 66 lines · Rob Herring
Quoted 30 lines · Charles Wang

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.

---
 .../bindings/input/goodix,gt7986u.yaml        | 71 +++++++++++++++++++
 1 file changed, 71 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/goodix,gt7986u.yaml
Documentation/devicetree/bindings/input/goodix,gt7986u.yaml new file +12 -0
new file mode 100644
index 000000000..a7d42a5d6
@@ -0,0 +1,71 @@
+# 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 <[email protected]>
+
+description: Supports the Goodix GT7986U touchscreen.

Documentation/devicetree/bindings/input/goodix,gt7986u.yaml line 22

Quoted 10 lines
Documentation/devicetree/bindings/input/goodix,gt7986u.yaml new file +10 -0
+  This touch controller reports data packaged according to the HID protocol,
+  but is incompatible with Microsoft's HID-over-SPI protocol.
+
+allOf:
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+properties:
+  compatible:
+    enum:
+      - goodix,gt7986u

This is already documented in goodix,gt7375p.yaml. Now linux-next has warnings:

/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/goodix,gt7986u.example.dtb:
touchscreen@0: compatible: 'oneOf' conditional failed, one must be
fixed:
['goodix,gt7986u'] is too short
'goodix,gt7375p' was expected
from schema $id:
http://devicetree.org/schemas/input/goodix,gt7375p.yaml#
/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/goodix,gt7986u.example.dtb:
touchscreen@0: reg:0:0: 0 is not one of [93, 20]
from schema $id:
http://devicetree.org/schemas/input/goodix,gt7375p.yaml#
/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/goodix,gt7986u.example.dtb:
touchscreen@0: 'vdd-supply' is a required property
from schema $id:
http://devicetree.org/schemas/input/goodix,gt7375p.yaml#
/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/goodix,gt7986u.example.dtb:
touchscreen@0: 'goodix,hid-report-addr', 'spi-max-frequency' do not
match any of the regexes: 'pinctrl-[0-9]+'
from schema $id:
http://devicetree.org/schemas/input/goodix,gt7375p.yaml#

Quoted 5 lines
Quoted 1 line

Please sort this out and send a fix.

I should add that it is intermittent whether you see this error or not. The tools select a single schema based on the compatible string and it is undefined which of the 2 schemas you will get.

Still an issue and no response. Please fix or revert the series.

Rob

maintainer
#6 lore raw

Re: [PATCH v7 2/2] dt-bindings: input: Goodix SPI HID Touchscreen

Quoted 1 line · Rob Herring

Still an issue and no response. Please fix or revert the series.

Reverts are now queued in hid.git#for-6.12/upstream-fixes and I will be sending them to Linus ASAP.

Sorry for the delay,

Signature · 2 lines
Jiri Kosina
SUSE Labs
maintainer
#7 lore raw

Re: [PATCH v7 2/2] dt-bindings: input: Goodix SPI HID Touchscreen

In reply to Rob Herring
Quoted 69 lines · Rob Herring
Quoted 68 lines · Rob Herring
Quoted 66 lines · Rob Herring
Quoted 30 lines · Charles Wang

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.

---
 .../bindings/input/goodix,gt7986u.yaml        | 71 +++++++++++++++++++
 1 file changed, 71 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/goodix,gt7986u.yaml
Documentation/devicetree/bindings/input/goodix,gt7986u.yaml new file +12 -0
new file mode 100644
index 000000000..a7d42a5d6
@@ -0,0 +1,71 @@
+# 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 <[email protected]>
+
+description: Supports the Goodix GT7986U touchscreen.

Documentation/devicetree/bindings/input/goodix,gt7986u.yaml line 22

Quoted 10 lines
Documentation/devicetree/bindings/input/goodix,gt7986u.yaml new file +10 -0
+  This touch controller reports data packaged according to the HID protocol,
+  but is incompatible with Microsoft's HID-over-SPI protocol.
+
+allOf:
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+properties:
+  compatible:
+    enum:
+      - goodix,gt7986u

This is already documented in goodix,gt7375p.yaml. Now linux-next has warnings:

/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/goodix,gt7986u.example.dtb:
touchscreen@0: compatible: 'oneOf' conditional failed, one must be
fixed:
['goodix,gt7986u'] is too short
'goodix,gt7375p' was expected
from schema $id:
http://devicetree.org/schemas/input/goodix,gt7375p.yaml#
/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/goodix,gt7986u.example.dtb:
touchscreen@0: reg:0:0: 0 is not one of [93, 20]
from schema $id:
http://devicetree.org/schemas/input/goodix,gt7375p.yaml#
/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/goodix,gt7986u.example.dtb:
touchscreen@0: 'vdd-supply' is a required property
from schema $id:
http://devicetree.org/schemas/input/goodix,gt7375p.yaml#
/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/goodix,gt7986u.example.dtb:
touchscreen@0: 'goodix,hid-report-addr', 'spi-max-frequency' do not
match any of the regexes: 'pinctrl-[0-9]+'
from schema $id:
http://devicetree.org/schemas/input/goodix,gt7375p.yaml#

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Please sort this out and send a fix.

I should add that it is intermittent whether you see this error or not. The tools select a single schema based on the compatible string and it is undefined which of the 2 schemas you will get.

Still an issue and no response. Please fix or revert the series.

I see that Krzysztof sent a revert, but what a proper fix would be? Apparently Goodix is using the same product ID gt7986u for both I2C and SPI parts, and covering them in one binding is not really easy (well, I guess it is possible with a big ugly "if"). Do we just slap "-spi" suffix on the compatible, so it becomes "goodix,gt7986u-spi" and go on on our merry way? Is there a better option for such products that support multiple interfaces/transports?

Thanks.

Signature · 1 line
Dmitry
maintainer
#8 lore raw

Re: [PATCH v7 2/2] dt-bindings: input: Goodix SPI HID Touchscreen

Quoted 6 lines · Dmitry Torokhov

I see that Krzysztof sent a revert, but what a proper fix would be? Apparently Goodix is using the same product ID gt7986u for both I2C and SPI parts, and covering them in one binding is not really easy (well, I guess it is possible with a big ugly "if"). Do we just slap "-spi" suffix on the compatible, so it becomes "goodix,gt7986u-spi" and go on on our merry way?

I actually see this as a viable option, given the circumstances.

However, given the non-responsiveness of the original author, I am now proceeding with the revert, and we can try to sort it out later.

Quoted 2 lines

Is there a better option for such products that support multiple interfaces/transports?

I unfortunately currently don't see one.

Signature · 2 lines
Jiri Kosina
SUSE Labs
maintainer
#9 lore raw

Re: [PATCH v7 2/2] dt-bindings: input: Goodix SPI HID Touchscreen

Quoted 9 lines · Jiri Kosina
Quoted 6 lines · Dmitry Torokhov

I see that Krzysztof sent a revert, but what a proper fix would be? Apparently Goodix is using the same product ID gt7986u for both I2C and SPI parts, and covering them in one binding is not really easy (well, I guess it is possible with a big ugly "if"). Do we just slap "-spi" suffix on the compatible, so it becomes "goodix,gt7986u-spi" and go on on our merry way?

Quoted 4 lines

I actually see this as a viable option, given the circumstances.

However, given the non-responsiveness of the original author, I am now proceeding with the revert, and we can try to sort it out later.

Yeah, no objections there.

Thanks.

Signature · 1 line
Dmitry
maintainer
#10 lore raw

Re: [PATCH v7 2/2] dt-bindings: input: Goodix SPI HID Touchscreen

In reply to Dmitry Torokhov
Quoted 79 lines · Dmitry Torokhov
Quoted 69 lines · Rob Herring
Quoted 68 lines · Rob Herring
Quoted 66 lines · Rob Herring
Quoted 30 lines · Charles Wang

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.

---
 .../bindings/input/goodix,gt7986u.yaml        | 71 +++++++++++++++++++
 1 file changed, 71 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/goodix,gt7986u.yaml
Documentation/devicetree/bindings/input/goodix,gt7986u.yaml new file +12 -0
new file mode 100644
index 000000000..a7d42a5d6
@@ -0,0 +1,71 @@
+# 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 <[email protected]>
+
+description: Supports the Goodix GT7986U touchscreen.

Documentation/devicetree/bindings/input/goodix,gt7986u.yaml line 22

Quoted 10 lines
Documentation/devicetree/bindings/input/goodix,gt7986u.yaml new file +10 -0
+  This touch controller reports data packaged according to the HID protocol,
+  but is incompatible with Microsoft's HID-over-SPI protocol.
+
+allOf:
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+properties:
+  compatible:
+    enum:
+      - goodix,gt7986u

This is already documented in goodix,gt7375p.yaml. Now linux-next has warnings:

/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/goodix,gt7986u.example.dtb:
touchscreen@0: compatible: 'oneOf' conditional failed, one must be
fixed:
['goodix,gt7986u'] is too short
'goodix,gt7375p' was expected
from schema $id:
http://devicetree.org/schemas/input/goodix,gt7375p.yaml#
/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/goodix,gt7986u.example.dtb:
touchscreen@0: reg:0:0: 0 is not one of [93, 20]
from schema $id:
http://devicetree.org/schemas/input/goodix,gt7375p.yaml#
/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/goodix,gt7986u.example.dtb:
touchscreen@0: 'vdd-supply' is a required property
from schema $id:
http://devicetree.org/schemas/input/goodix,gt7375p.yaml#
/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/goodix,gt7986u.example.dtb:
touchscreen@0: 'goodix,hid-report-addr', 'spi-max-frequency' do not
match any of the regexes: 'pinctrl-[0-9]+'
from schema $id:
http://devicetree.org/schemas/input/goodix,gt7375p.yaml#

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Please sort this out and send a fix.

I should add that it is intermittent whether you see this error or not. The tools select a single schema based on the compatible string and it is undefined which of the 2 schemas you will get.

Still an issue and no response. Please fix or revert the series.

Quoted 7 lines

I see that Krzysztof sent a revert, but what a proper fix would be? Apparently Goodix is using the same product ID gt7986u for both I2C and SPI parts, and covering them in one binding is not really easy (well, I guess it is possible with a big ugly "if"). Do we just slap "-spi" suffix on the compatible, so it becomes "goodix,gt7986u-spi" and go on on our merry way? Is there a better option for such products that support multiple interfaces/transports?

Generally we just have 1 compatible and 1 schema for both. The schema can reference spi-peripheral-props.yaml unconditionally. If someone wants to put SPI properties in a node for I2C connected device, then that would be allowed, but who cares.

There's been some discussion about having some sort of pseudo property similar to $nodename to define the bus for a node and then we could use that.

Rob

#11 lore raw

Re: [PATCH v7 2/2] dt-bindings: input: Goodix SPI HID Touchscreen

Hi Rob,

Very sorry for the late response. A fiexd version with compatible "goodix,gt7986u-spi" has been submitted.

Quoted 89 lines · Rob Herring
Quoted 79 lines · Dmitry Torokhov
Quoted 69 lines · Rob Herring
Quoted 68 lines · Rob Herring
Quoted 66 lines · Rob Herring
Quoted 30 lines · Charles Wang

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.

---
 .../bindings/input/goodix,gt7986u.yaml        | 71 +++++++++++++++++++
 1 file changed, 71 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/goodix,gt7986u.yaml
Documentation/devicetree/bindings/input/goodix,gt7986u.yaml new file +12 -0
new file mode 100644
index 000000000..a7d42a5d6
@@ -0,0 +1,71 @@
+# 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 <[email protected]>
+
+description: Supports the Goodix GT7986U touchscreen.

Documentation/devicetree/bindings/input/goodix,gt7986u.yaml line 22

Quoted 10 lines
Documentation/devicetree/bindings/input/goodix,gt7986u.yaml new file +10 -0
+  This touch controller reports data packaged according to the HID protocol,
+  but is incompatible with Microsoft's HID-over-SPI protocol.
+
+allOf:
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+properties:
+  compatible:
+    enum:
+      - goodix,gt7986u

This is already documented in goodix,gt7375p.yaml. Now linux-next has warnings:

/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/goodix,gt7986u.example.dtb:
touchscreen@0: compatible: 'oneOf' conditional failed, one must be
fixed:
['goodix,gt7986u'] is too short
'goodix,gt7375p' was expected
from schema $id:
http://devicetree.org/schemas/input/goodix,gt7375p.yaml#
/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/goodix,gt7986u.example.dtb:
touchscreen@0: reg:0:0: 0 is not one of [93, 20]
from schema $id:
http://devicetree.org/schemas/input/goodix,gt7375p.yaml#
/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/goodix,gt7986u.example.dtb:
touchscreen@0: 'vdd-supply' is a required property
from schema $id:
http://devicetree.org/schemas/input/goodix,gt7375p.yaml#
/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/goodix,gt7986u.example.dtb:
touchscreen@0: 'goodix,hid-report-addr', 'spi-max-frequency' do not
match any of the regexes: 'pinctrl-[0-9]+'
from schema $id:
http://devicetree.org/schemas/input/goodix,gt7375p.yaml#

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Please sort this out and send a fix.

I should add that it is intermittent whether you see this error or not. The tools select a single schema based on the compatible string and it is undefined which of the 2 schemas you will get.

Still an issue and no response. Please fix or revert the series.

Quoted 7 lines

I see that Krzysztof sent a revert, but what a proper fix would be? Apparently Goodix is using the same product ID gt7986u for both I2C and SPI parts, and covering them in one binding is not really easy (well, I guess it is possible with a big ugly "if"). Do we just slap "-spi" suffix on the compatible, so it becomes "goodix,gt7986u-spi" and go on on our merry way? Is there a better option for such products that support multiple interfaces/transports?

Quoted 9 lines

Generally we just have 1 compatible and 1 schema for both. The schema can reference spi-peripheral-props.yaml unconditionally. If someone wants to put SPI properties in a node for I2C connected device, then that would be allowed, but who cares.

There's been some discussion about having some sort of pseudo property similar to $nodename to define the bus for a node and then we could use that.

Charles