[PATCH v2 0/3] Input: add initial support for Goodix GTX8 touchscreen ICs

Aelin Reidel posted 3 patches 1 month ago
.../bindings/input/touchscreen/goodix,gt9886.yaml  |  71 +++
MAINTAINERS                                        |   7 +
drivers/input/touchscreen/Kconfig                  |  15 +
drivers/input/touchscreen/Makefile                 |   1 +
drivers/input/touchscreen/goodix_gtx8.c            | 563 +++++++++++++++++++++
drivers/input/touchscreen/goodix_gtx8.h            | 141 ++++++
6 files changed, 798 insertions(+)
[PATCH v2 0/3] Input: add initial support for Goodix GTX8 touchscreen ICs
Posted by Aelin Reidel 1 month ago
These ICs support SPI and I2C interfaces, up to 10 finger touch, stylus
and gesture events.

This driver is derived from the Goodix gtx8_driver_linux available at
[1] and only supports the GT9886 and GT9896 ICs present in the Xiaomi
Mi 9T and Xiaomi Redmi Note 10 Pro smartphones.

The current implementation only supports Normandy and Yellowstone type
ICs, aka only GT9886 and GT9896. It is also limited to I2C only, since I
don't have a device with GTX8 over SPI at hand. Adding support for SPI
should be fairly easy in the future, since the code uses a regmap.

Support for advanced features like:
- Firmware updates
- Stylus events
- Gesture events
- Nanjing IC support
is not included in current version.

The current support requires a previously flashed firmware to be
present.

As I did not have access to datasheets for these ICs, I extracted the
addresses from a couple of config files using a small tool [2]. The
addresses are identical for the same IC families in all configs I
observed, however not all of them make sense and I stubbed out firmware
request support due to this.

I've taken a lot of inspiration from the goodix_berlin driver, but the 
Berlin and GTX8 series of touchscreen ICs differ quite a bit. The driver 
architecture is the same overall, i.e. the power-up sequence and general 
concepts are the mostly same, but it is very clear that they are 
different generations when looking at it in more detail.

Some of the differences:
- There is no equivalent to the bootoption reg that I can find in the 
public GTX8 drivers
- Firmware version struct layout is different yet again
- GTX8 does not expose IC information at runtime as far as I can tell
- The checksum method differs yet again
- The vendor driver reads only 1 touch upfront rather than 2
- Register addresses are 16-bit on GTX8 and 32-bit on Berlin
- Firmware requests don't appear to really exist on GTX8

From what I can tell, the evolution seems to be:
Normandy -> Yellowstone -> Berlin
since Normandy and Yellowstone are already quite different (especially 
with the way checksums work) and Yellowstone has a couple of things 
(checksum, fw_version) that appear similar to Berlin series ICs.

I've tried to make the Berlin driver work for GTX8 ICs before, but 
they're so different (and I lack documentation for registers to perhaps 
make some parts work on GTX8) that I'd rather support these ICs in a new 
and tiny driver. I hope that makes sense. I took heavy inspiration from 
the Berlin driver, but the only parts that are really common between 
them are very trivial things like e.g. the input dev config or power on, 
which I don't think are worth putting in a separate header.

[1] https://github.com/goodix/gtx8_driver_linux
[2] https://github.com/sm7150-mainline/goodix-cfg-bin

Signed-off-by: Aelin Reidel <aelin@mainlining.org>
---
Changes in v2:
- Fix compilation issues found by Intel's kernel test robot
- Add Alexander's T-b to the driver patch
- Link to v1: https://lore.kernel.org/r/20260218-gtx8-v1-0-0d575b3dedc5@mainlining.org

Changes in v1 (post-RFC):
- Drop RFC prefix, the series has been tested enough and works well
  as-is
- Update my name and email address
- Add some reasoning for a new driver to the cover letter
- Add Rob's R-b on the dt-bindings patch
- Add Piyush's T-b to the driver patch
- Link to RFC: https://lore.kernel.org/r/20250918-gtx8-v1-0-cba879c84775@mainlining.org

---
Aelin Reidel (3):
      dt-bindings: input: document Goodix GTX8 Touchscreen ICs
      Input: add support for Goodix GTX8 Touchscreen ICs
      MAINTAINERS: add an entry for Goodix GTX8 Touchscreen driver

 .../bindings/input/touchscreen/goodix,gt9886.yaml  |  71 +++
 MAINTAINERS                                        |   7 +
 drivers/input/touchscreen/Kconfig                  |  15 +
 drivers/input/touchscreen/Makefile                 |   1 +
 drivers/input/touchscreen/goodix_gtx8.c            | 563 +++++++++++++++++++++
 drivers/input/touchscreen/goodix_gtx8.h            | 141 ++++++
 6 files changed, 798 insertions(+)
---
base-commit: 3fa5e5702a82d259897bd7e209469bc06368bf31
change-id: 20250918-gtx8-59a50ccd78a5

Best regards,
-- 
Aelin Reidel <aelin@mainlining.org>
Re: [PATCH v2 0/3] Input: add initial support for Goodix GTX8 touchscreen ICs
Posted by Hans de Goede 1 month ago
Hi,

On 28-Feb-26 02:56, Aelin Reidel wrote:
> These ICs support SPI and I2C interfaces, up to 10 finger touch, stylus
> and gesture events.
> 
> This driver is derived from the Goodix gtx8_driver_linux available at
> [1] and only supports the GT9886 and GT9896 ICs present in the Xiaomi
> Mi 9T and Xiaomi Redmi Note 10 Pro smartphones.
> 
> The current implementation only supports Normandy and Yellowstone type
> ICs, aka only GT9886 and GT9896. It is also limited to I2C only, since I
> don't have a device with GTX8 over SPI at hand. Adding support for SPI
> should be fairly easy in the future, since the code uses a regmap.
> 
> Support for advanced features like:
> - Firmware updates
> - Stylus events
> - Gesture events
> - Nanjing IC support
> is not included in current version.
> 
> The current support requires a previously flashed firmware to be
> present.
> 
> As I did not have access to datasheets for these ICs, I extracted the
> addresses from a couple of config files using a small tool [2]. The
> addresses are identical for the same IC families in all configs I
> observed, however not all of them make sense and I stubbed out firmware
> request support due to this.
> 
> I've taken a lot of inspiration from the goodix_berlin driver, but the 
> Berlin and GTX8 series of touchscreen ICs differ quite a bit. The driver 
> architecture is the same overall, i.e. the power-up sequence and general 
> concepts are the mostly same, but it is very clear that they are 
> different generations when looking at it in more detail.

Right, this answers my main question about this driver which was:
"why another goodix driver?" (this would be the third one).

I've also compared this driver with the original goodix.c touchscreen
driver (which I know well) and the protocol is somewhat closer
to the original goodix.c driver then it is to goodix_berlin, but still
different enough that having a separate driver is the best option IMHO.

...

> From what I can tell, the evolution seems to be:
> Normandy -> Yellowstone -> Berlin
> since Normandy and Yellowstone are already quite different (especially 
> with the way checksums work) and Yellowstone has a couple of things 
> (checksum, fw_version) that appear similar to Berlin series ICs.

You forgot the original goodix.c driver, adding that it seems
the evolution is:

GTx1/GTx2/GTx6 -> Normandy -> Yellowstone -> Berlin

With GTx1/GTx2/GTx6 having no checksum at all (and 16 bit
registers) and some of the original GTx1/GTx2/GTx6 don't have
nvram for the firmware, so Linux must upload firmware every boot.

Anyways I agree that these are different enough from the existing
goodix and goodix_berlin drivers, so based on that (and only on that):

Acked-by: Hans de Goede <johannes.goede@oss.qualcomm.com>

Regards,

Hans