Skip to contentSkip to conversation

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

PATCH NAK Charles Wang 3 participants 12 messages Sep 26, 2024 – Oct 8, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v8 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 v8:
- Fix devicetree compatible conflict problem.

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 v8 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 v8 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..849117639
@@ -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-spi
+
+  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-spi";
+        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
#3 lore raw

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

Quoted 6 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.

Why do you send the same? The patches were applied three weeks ago! You were supposed to respond that time by fixing the issue with incremental patch.

Now, work on top of next branch, bring back removed OF support and add missing properties to existing binding.

Quoted 23 lines
---
 .../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..849117639
@@ -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-spi

NAK, you duplicate again the binding. You cannot have bus-flavors. Device is the same.

Best regards,
Krzysztof

#4 lore raw

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

Hi Krzysztof,

Quoted 8 lines · Krzysztof Kozlowski
Quoted 6 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.

Quoted 6 lines

Why do you send the same? The patches were applied three weeks ago! You were supposed to respond that time by fixing the issue with incremental patch.

Now, work on top of next branch, bring back removed OF support and add missing properties to existing binding.

Sorry again for this.

Quoted 29 lines
Quoted 29 lines
---
 .../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 +17 -0
new file mode 100644
index 000000000..849117639
@@ -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#
Quoted 9 lines

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

Quoted 5 lines
Documentation/devicetree/bindings/input/goodix,gt7986u.yaml new file +5 -0
+
+properties:
+  compatible:
+    enum:
+      - goodix,gt7986u-spi

NAK, you duplicate again the binding. You cannot have bus-flavors. Device is the same.

Could you provide some suggestions regarding this issue?

Regards!
Charles

#11 lore raw

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

In reply to Charles Wang
Quoted 6 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.

Please remove my reviewed by, I didn't review this new "spi" compatible.

#5 lore raw

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

In reply to Charles Wang
Quoted 36 lines · Charles Wang
Quoted 26 lines
Quoted 26 lines
 1 file changed, 71 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/goodix,gt7986u.yaml
Documentation/devicetree/bindings/input/goodix,gt7986u.yaml new file +17 -0
new file mode 100644
index 000000000..849117639
@@ -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#
Quoted 9 lines

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

Quoted 5 lines
Documentation/devicetree/bindings/input/goodix,gt7986u.yaml new file +5 -0
+
+properties:
+  compatible:
+    enum:
+      - goodix,gt7986u-spi

NAK, you duplicate again the binding. You cannot have bus-flavors. Device is the same.

Quoted 1 line

Could you provide some suggestions regarding this issue?

What is exactly the question or problem? There is a binding for this device. Extend it with SPI parts, e.g.
https://elixir.bootlin.com/linux/v6.4-rc7/source/Documentation/devicetree/bindings/iio/accel/adi,adxl313.yaml#L22

Best regards,
Krzysztof

#6 lore raw

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

Hi Krzysztof,
Thank you very much for your advice.

Quoted 37 lines · Krzysztof Kozlowski
Quoted 36 lines · Charles Wang
Quoted 35 lines
Quoted 21 lines
 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..849117639
@@ -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-spi

NAK, you duplicate again the binding. You cannot have bus-flavors. Device is the same.

Quoted 6 lines
Quoted 1 line

Could you provide some suggestions regarding this issue?

What is exactly the question or problem? There is a binding for this device. Extend it with SPI parts, e.g.
https://elixir.bootlin.com/linux/v6.4-rc7/source/Documentation/devicetree/bindings/iio/accel/adi,adxl313.yaml#L22

This seems a little different from the adxl313.yaml.

The issue we're encountering involves the chip model gt7986u, which supports both I2C and SPI interfaces. For the I2C interface (using the HID-over-I2C driver), it has already been declared in the goodix,gt7375p.yaml file as follows:

i2c {
#address-cells = <1>;
#size-cells = <0>;

  ap_ts: touchscreen@5d {
    compatible = "goodix,gt7986u";

}
}

Currently, our design requires utilizing the SPI interface with a custom SPI driver. However, the declarations within the binding file have led to conflicts, as shown here:

spi {
#address-cells = <1>;
#size-cells = <0>;

  touchscreen@0 {
    compatible = "goodix,gt7986u";

}
}

Should I consider merging both YAML files into a single one to fix this?

Best regards!
Charles

#7 lore raw

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

Quoted 41 lines · Charles Wang

Hi Krzysztof,
Thank you very much for your advice.

Quoted 37 lines · Krzysztof Kozlowski
Quoted 36 lines · Charles Wang
Quoted 35 lines
Quoted 21 lines
 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..849117639
@@ -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-spi

NAK, you duplicate again the binding. You cannot have bus-flavors. Device is the same.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Could you provide some suggestions regarding this issue?

What is exactly the question or problem? There is a binding for this device. Extend it with SPI parts, e.g.
https://elixir.bootlin.com/linux/v6.4-rc7/source/Documentation/devicetree/bindings/iio/accel/adi,adxl313.yaml#L22

This seems a little different from the adxl313.yaml.

Hm? I am reading below:

Quoted 23 lines

The issue we're encountering involves the chip model gt7986u, which supports both I2C and SPI interfaces. For the I2C interface (using the HID-over-I2C driver), it has already been declared in the goodix,gt7375p.yaml file as follows:

i2c {
#address-cells = <1>;
#size-cells = <0>;

  ap_ts: touchscreen@5d {
    compatible = "goodix,gt7986u";

}
}

Currently, our design requires utilizing the SPI interface with a custom SPI driver. However, the declarations within the binding file have led to conflicts, as shown here:

spi {
#address-cells = <1>;
#size-cells = <0>;

Quoted 6 lines
  touchscreen@0 {
    compatible = "goodix,gt7986u";

}
}

Should I consider merging both YAML files into a single one to fix this?

And there is no difference. I don't understand the problem.

Best regards,
Krzysztof

#8 lore raw

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

Hi Krzysztof,

Quoted 76 lines · Krzysztof Kozlowski
Quoted 41 lines · Charles Wang

Hi Krzysztof,
Thank you very much for your advice.

Quoted 37 lines · Krzysztof Kozlowski
Quoted 36 lines · Charles Wang
Quoted 35 lines
Quoted 21 lines
 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..849117639
@@ -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-spi

NAK, you duplicate again the binding. You cannot have bus-flavors. Device is the same.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Could you provide some suggestions regarding this issue?

What is exactly the question or problem? There is a binding for this device. Extend it with SPI parts, e.g.
https://elixir.bootlin.com/linux/v6.4-rc7/source/Documentation/devicetree/bindings/iio/accel/adi,adxl313.yaml#L22

This seems a little different from the adxl313.yaml.

Hm? I am reading below:

Quoted 23 lines

The issue we're encountering involves the chip model gt7986u, which supports both I2C and SPI interfaces. For the I2C interface (using the HID-over-I2C driver), it has already been declared in the goodix,gt7375p.yaml file as follows:

i2c {
#address-cells = <1>;
#size-cells = <0>;

  ap_ts: touchscreen@5d {
    compatible = "goodix,gt7986u";

}
}

Currently, our design requires utilizing the SPI interface with a custom SPI driver. However, the declarations within the binding file have led to conflicts, as shown here:

spi {
#address-cells = <1>;
#size-cells = <0>;

Quoted 9 lines
Quoted 6 lines
  touchscreen@0 {
    compatible = "goodix,gt7986u";

}
}

Should I consider merging both YAML files into a single one to fix this?

And there is no difference. I don't understand the problem.

I'm sorry for the confusion regarding your comment

"And there is no difference."

Are you implying that the issue we are encountering is no different from 'adi,adxl313.yaml'? Or are you suggesting that the gt7986u device should be treated as the same entity for both I2C and SPI interfaces?

Original error messages: https://lore.kernel.org/all/CAL_Jsq+QfTtRj_JCqXzktQ49H8VUnztVuaBjvvkg3fwEHniUHw@mail.gmail.com/

+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:

I understand this error message to mean the same chip model is redundantly declared in two separate files.

Is my understanding incorrect? Could you provide more explicit guidance?

Note that the 'gt7986u' uses different drivers and has distinct device property for its I2C and SPI interfaces.

Best regards,
Charles

#9 lore raw

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

Quoted 86 lines · Charles Wang

Hi Krzysztof,

Quoted 83 lines · Krzysztof Kozlowski
Quoted 41 lines · Charles Wang

Hi Krzysztof,
Thank you very much for your advice.

Quoted 37 lines · Krzysztof Kozlowski
Quoted 36 lines · Charles Wang
Quoted 35 lines
Quoted 21 lines
 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..849117639
@@ -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-spi

NAK, you duplicate again the binding. You cannot have bus-flavors. Device is the same.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Could you provide some suggestions regarding this issue?

What is exactly the question or problem? There is a binding for this device. Extend it with SPI parts, e.g.
https://elixir.bootlin.com/linux/v6.4-rc7/source/Documentation/devicetree/bindings/iio/accel/adi,adxl313.yaml#L22

This seems a little different from the adxl313.yaml.

Hm? I am reading below:

Quoted 29 lines

The issue we're encountering involves the chip model gt7986u, which supports both I2C and SPI interfaces. For the I2C interface (using the HID-over-I2C driver), it has already been declared in the goodix,gt7375p.yaml file as follows:

i2c {
#address-cells = <1>;
#size-cells = <0>;

  ap_ts: touchscreen@5d {
    compatible = "goodix,gt7986u";

}
}

Currently, our design requires utilizing the SPI interface with a custom SPI driver. However, the declarations within the binding file have led to conflicts, as shown here:

spi {
#address-cells = <1>;
#size-cells = <0>;

  touchscreen@0 {
    compatible = "goodix,gt7986u";

}
}

Should I consider merging both YAML files into a single one to fix this?

Quoted 7 lines
Quoted 2 lines

And there is no difference. I don't understand the problem.

I'm sorry for the confusion regarding your comment

"And there is no difference."

Are you implying that the issue we are encountering is no different from

I don't understand the issue.

Quoted 2 lines

'adi,adxl313.yaml'? Or are you suggesting that the gt7986u device should be treated as the same entity for both I2C and SPI interfaces?

I told you what to do - extend existing binding. I gave you example how one binding is for both I2C and SPI devices.

Quoted 20 lines

Original error messages: https://lore.kernel.org/all/CAL_Jsq+QfTtRj_JCqXzktQ49H8VUnztVuaBjvvkg3fwEHniUHw@mail.gmail.com/

(quoted diff) +7 -0
+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:

Quoted 2 lines

I understand this error message to mean the same chip model is redundantly declared in two separate files.

That was old error, which I fixed by reverting your patches.

Quoted 5 lines

Is my understanding incorrect? Could you provide more explicit guidance?

Note that the 'gt7986u' uses different drivers and has distinct device property for its I2C and SPI interfaces.

Drivers don't matter. We talk about bindings here. One device, one binding, one compatible. Regardless of the bus.

Best regards,
Krzysztof

#10 lore raw

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

Quoted 89 lines · Krzysztof Kozlowski
Quoted 88 lines · Charles Wang

Hi Krzysztof,

Quoted 85 lines · Krzysztof Kozlowski
Quoted 41 lines · Charles Wang

Hi Krzysztof,
Thank you very much for your advice.

Quoted 37 lines · Krzysztof Kozlowski
Quoted 36 lines · Charles Wang
Quoted 35 lines
Quoted 21 lines
 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..849117639
@@ -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-spi

NAK, you duplicate again the binding. You cannot have bus-flavors. Device is the same.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Could you provide some suggestions regarding this issue?

What is exactly the question or problem? There is a binding for this device. Extend it with SPI parts, e.g.
https://elixir.bootlin.com/linux/v6.4-rc7/source/Documentation/devicetree/bindings/iio/accel/adi,adxl313.yaml#L22

This seems a little different from the adxl313.yaml.

Hm? I am reading below:

Quoted 23 lines

The issue we're encountering involves the chip model gt7986u, which supports both I2C and SPI interfaces. For the I2C interface (using the HID-over-I2C driver), it has already been declared in the goodix,gt7375p.yaml file as follows:

i2c {
#address-cells = <1>;
#size-cells = <0>;

  ap_ts: touchscreen@5d {
    compatible = "goodix,gt7986u";

}
}

Currently, our design requires utilizing the SPI interface with a custom SPI driver. However, the declarations within the binding file have led to conflicts, as shown here:

spi {
#address-cells = <1>;
#size-cells = <0>;

Quoted 6 lines
  touchscreen@0 {
    compatible = "goodix,gt7986u";

}
}

Should I consider merging both YAML files into a single one to fix this?

And there is no difference. I don't understand the problem.

Quoted 8 lines
Quoted 5 lines

I'm sorry for the confusion regarding your comment

"And there is no difference."

Are you implying that the issue we are encountering is no different from

I don't understand the issue.

Sorry for my poor English expression.

Quoted 6 lines
Quoted 2 lines

'adi,adxl313.yaml'? Or are you suggesting that the gt7986u device should be treated as the same entity for both I2C and SPI interfaces?

I told you what to do - extend existing binding. I gave you example how one binding is for both I2C and SPI devices.

Ack, thank you for the clarification and the example provided.

Quoted 26 lines
Quoted 20 lines

Original error messages: https://lore.kernel.org/all/CAL_Jsq+QfTtRj_JCqXzktQ49H8VUnztVuaBjvvkg3fwEHniUHw@mail.gmail.com/

(quoted diff) +7 -0
+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:

Quoted 2 lines

I understand this error message to mean the same chip model is redundantly declared in two separate files.

That was old error, which I fixed by reverting your patches.

Quoted 1 line
Quoted 8 lines
Quoted 4 lines

Is my understanding incorrect? Could you provide more explicit guidance?

Note that the 'gt7986u' uses different drivers and has distinct device property for its I2C and SPI interfaces.

Drivers don't matter. We talk about bindings here. One device, one binding, one compatible. Regardless of the bus.

Okay, really appreciate your guidance.

Best regards,
Charles