HID: add initial support for Goodix HID-over-SPI touchscreen
Subsystems (3)
v6 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 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
PATCH v6 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
@@ -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
@@ -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
PATCH v6 2/2 dt-bindings: input: Goodix SPI HID Touchscreen
In reply to Charles WangThe 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
@@ -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
Re: [PATCH v6 1/2] HID: hid-goodix: Add Goodix HID-over-SPI driver
In reply to Charles WangHi,
Quoted 16 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.
Key features:
- Device connection confirmation and initialization
- IRQ-based event reporting to the input subsystem
- Support for HIDRAW operations (GET_REPORTandSET_REPORT)
Quoted 7 lines
Signed-off-by Charles Wang <[email protected]>--- 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
As a point of reference, in v5 Dmitry gave you his "Reviewed-by" tag
[1] despite having some nits. It's usually expected that you could fix the nits and carry the Reviewed-by tag on the next version unless you did something other than what was requested in review feedback.
Re: [PATCH v6 2/2] dt-bindings: input: Goodix SPI HID Touchscreen
In reply to Charles WangHi,
Quoted 10 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.
Signed-off-by Charles Wang <[email protected]>--- .../bindings/input/goodix,gt7986u.yaml | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/goodix,gt7986u.yaml
As a point of reference, in v5 Conor gave you his "Reviewed-by" tag
[1] despite having some nits. It's usually expected that you could fix the nits and carry the Reviewed-by tag on the next version unless you did something other than what was requested in review feedback.
[1] https://lore.kernel.org/all/20240618-affluent-unroasted-e6d5d34d1ea2@spud/
Re: [PATCH v6 1/2] HID: hid-goodix: Add Goodix HID-over-SPI driver
In reply to Doug AndersonHi Doug,
Sorry for missing the "Reviewed-by" tag, will fix in v7.
Quoted 27 lines · Doug Anderson
Hi,
Quoted 16 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.
Key features:
- Device connection confirmation and initialization
- IRQ-based event reporting to the input subsystem
- Support for HIDRAW operations (GET_REPORTandSET_REPORT)Quoted 7 lines
Signed-off-by Charles Wang <[email protected]>--- 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
Quoted 6 lines
As a point of reference, in v5 Dmitry gave you his "Reviewed-by" tag
[1] despite having some nits. It's usually expected that you could fix the nits and carry the Reviewed-by tag on the next version unless you did something other than what was requested in review feedback.
Thanks,
Charles
Re: [PATCH v6 2/2] dt-bindings: input: Goodix SPI HID Touchscreen
In reply to Doug AndersonHi Doug
Sorry for missing the "Reviewed-by" tag, will fix in v7.
Quoted 14 lines · Doug Anderson
Hi,
Quoted 10 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.
Signed-off-by Charles Wang <[email protected]>--- .../bindings/input/goodix,gt7986u.yaml | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/goodix,gt7986u.yaml
Quoted 6 lines
As a point of reference, in v5 Conor gave you his "Reviewed-by" tag
[1] despite having some nits. It's usually expected that you could fix the nits and carry the Reviewed-by tag on the next version unless you did something other than what was requested in review feedback.[1] https://lore.kernel.org/all/20240618-affluent-unroasted-e6d5d34d1ea2@spud/
Thanks,
Charles