From 13fa4c5bb4c69d0c5836e002cd59f404ce0576b4 Mon Sep 17 00:00:00 2001 From: Chris Gray Date: Sat, 24 Oct 2026 10:22:31 -0500 Subject: [PATCH 1/3] dt-bindings: input: goodix,gt9916: Add GT9895 The GT9895 is a Berlin-series controller used over SPI in the Pixel 7a. It uses the same register map and supplies as the GT9916. Assisted-by: LLM Signed-off-by: Chris Gray --- .../devicetree/bindings/input/touchscreen/goodix,gt9916.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix,gt9916.yaml b/Documentation/devicetree/bindings/input/touchscreen/goodix,gt9916.yaml index c40d92b7f4..9a107dbb76 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/goodix,gt9916.yaml +++ b/Documentation/devicetree/bindings/input/touchscreen/goodix,gt9916.yaml @@ -19,6 +19,7 @@ allOf: properties: compatible: enum: + - goodix,gt9895 - goodix,gt9897 - goodix,gt9916 From 8312e439be87c5c2f80e742b0d9b59efbb414e5d Mon Sep 17 00:00:00 2001 From: Chris Gray Date: Sat, 24 Oct 2026 10:22:31 -0500 Subject: [PATCH 2/3] Input: goodix-berlin - add GT9895 with 14-byte contact records The GT9895 in the Pixel 7a uses the GT9916's register map, but its firmware reports 14 bytes per contact instead of 8: the usual status, x, y and width, then a pressure byte, both axes and an orientation. The checksum follows the last record as before. With 8-byte records every touch fails the checksum. Make the record size part of the per-chip data, keep 8 bytes as the default, and add a GT9895 entry that uses 14. The extra fields are not reported yet. Tested on a Pixel 7a: touches report with no checksum errors, and touch input works in the desktop session. Assisted-by: LLM Signed-off-by: Chris Gray --- drivers/input/touchscreen/goodix_berlin.h | 2 ++ .../input/touchscreen/goodix_berlin_core.c | 24 ++++++++++++------- drivers/input/touchscreen/goodix_berlin_spi.c | 10 ++++++++ 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/drivers/input/touchscreen/goodix_berlin.h b/drivers/input/touchscreen/goodix_berlin.h index d8bbd48532..e2ac4fc212 100644 --- a/drivers/input/touchscreen/goodix_berlin.h +++ b/drivers/input/touchscreen/goodix_berlin.h @@ -23,6 +23,8 @@ struct goodix_berlin_ic_data { int ic_info_addr; ssize_t read_dummy_len; ssize_t read_prefix_len; + /* Size of one contact record, 0 for the 8-byte default */ + size_t touch_size; }; struct device; diff --git a/drivers/input/touchscreen/goodix_berlin_core.c b/drivers/input/touchscreen/goodix_berlin_core.c index b0938a4f3f..ff3534de4e 100644 --- a/drivers/input/touchscreen/goodix_berlin_core.c +++ b/drivers/input/touchscreen/goodix_berlin_core.c @@ -144,6 +144,11 @@ struct goodix_berlin_touch { __le16 w; }; #define GOODIX_BERLIN_TOUCH_SIZE sizeof(struct goodix_berlin_touch) +/* + * Some firmware appends pressure, both axes and an orientation to each + * record. The first GOODIX_BERLIN_TOUCH_SIZE bytes keep the layout above. + */ +#define GOODIX_BERLIN_TOUCH_SIZE_MAX 14 struct goodix_berlin_header { u8 status; @@ -157,7 +162,7 @@ struct goodix_berlin_header { struct goodix_berlin_event { struct goodix_berlin_header hdr; /* The data below is u16/__le16 aligned */ - u8 data[GOODIX_BERLIN_TOUCH_SIZE * GOODIX_BERLIN_MAX_TOUCH + + u8 data[GOODIX_BERLIN_TOUCH_SIZE_MAX * GOODIX_BERLIN_MAX_TOUCH + GOODIX_BERLIN_CHECKSUM_SIZE]; }; @@ -176,6 +181,7 @@ struct goodix_berlin_core { u32 touch_data_addr; const struct goodix_berlin_ic_data *ic_data; + size_t touch_size; struct goodix_berlin_event event; }; @@ -416,14 +422,14 @@ static int goodix_berlin_get_ic_info(struct goodix_berlin_core *cd) static int goodix_berlin_get_remaining_contacts(struct goodix_berlin_core *cd, int n) { - size_t offset = 2 * GOODIX_BERLIN_TOUCH_SIZE + + size_t offset = 2 * cd->touch_size + GOODIX_BERLIN_CHECKSUM_SIZE; u32 addr = cd->touch_data_addr + GOODIX_BERLIN_HEADER_SIZE + offset; int error; error = regmap_raw_read(cd->regmap, addr, &cd->event.data[offset], - (n - 2) * GOODIX_BERLIN_TOUCH_SIZE); + (n - 2) * cd->touch_size); if (error) { dev_err_ratelimited(cd->dev, "failed to get touch data, %d\n", error); @@ -435,14 +441,12 @@ static int goodix_berlin_get_remaining_contacts(struct goodix_berlin_core *cd, static void goodix_berlin_report_state(struct goodix_berlin_core *cd, int n) { - struct goodix_berlin_touch *touch_data = - (struct goodix_berlin_touch *)cd->event.data; struct goodix_berlin_touch *t; int i; u8 type, id; for (i = 0; i < n; i++) { - t = &touch_data[i]; + t = (struct goodix_berlin_touch *)&cd->event.data[i * cd->touch_size]; type = FIELD_GET(GOODIX_BERLIN_POINT_TYPE_MASK, t->status); if (type == GOODIX_BERLIN_POINT_TYPE_STYLUS || @@ -491,7 +495,7 @@ static void goodix_berlin_touch_handler(struct goodix_berlin_core *cd) } if (touch_num) { - int len = touch_num * GOODIX_BERLIN_TOUCH_SIZE + + int len = touch_num * cd->touch_size + GOODIX_BERLIN_CHECKSUM_SIZE; if (!goodix_berlin_checksum_valid(cd->event.data, len)) { dev_err(cd->dev, "touch data checksum error: %*ph\n", @@ -524,7 +528,8 @@ static irqreturn_t goodix_berlin_irq(int irq, void *data) * - GOODIX_BERLIN_HEADER_SIZE = 8 bytes * - GOODIX_BERLIN_TOUCH_SIZE * 2 = 16 bytes * - GOODIX_BERLIN_CHECKLSUM_SIZE = 2 bytes - * For a total of 26 bytes. + * For a total of 26 bytes. The layout below is for 8-byte records; + * with a larger touch_size the same reads cover touch_size per finger. * * If only a single finger is reported, we will read 8 bytes more than * needed: @@ -557,7 +562,7 @@ static irqreturn_t goodix_berlin_irq(int irq, void *data) error = regmap_raw_read(cd->regmap, cd->touch_data_addr, &cd->event, GOODIX_BERLIN_HEADER_SIZE + - 2 * GOODIX_BERLIN_TOUCH_SIZE + + 2 * cd->touch_size + GOODIX_BERLIN_CHECKSUM_SIZE); if (error) { dev_warn_ratelimited(cd->dev, @@ -745,6 +750,7 @@ int goodix_berlin_probe(struct device *dev, int irq, const struct input_id *id, cd->regmap = regmap; cd->irq = irq; cd->ic_data = ic_data; + cd->touch_size = ic_data->touch_size ?: GOODIX_BERLIN_TOUCH_SIZE; cd->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); if (IS_ERR(cd->reset_gpio)) diff --git a/drivers/input/touchscreen/goodix_berlin_spi.c b/drivers/input/touchscreen/goodix_berlin_spi.c index 01f850f484..2616afe307 100644 --- a/drivers/input/touchscreen/goodix_berlin_spi.c +++ b/drivers/input/touchscreen/goodix_berlin_spi.c @@ -158,6 +158,14 @@ static int goodix_berlin_spi_probe(struct spi_device *spi) return 0; } +static const struct goodix_berlin_ic_data gt9895_data = { + .fw_version_info_addr = GOODIX_BERLIN_FW_VERSION_INFO_ADDR_D, + .ic_info_addr = GOODIX_BERLIN_IC_INFO_ADDR_D, + .read_dummy_len = GOODIX_BERLIN_SPI_READ_DUMMY_LEN_D, + .read_prefix_len = GOODIX_BERLIN_SPI_READ_PREFIX_LEN_D, + .touch_size = 14, +}; + static const struct goodix_berlin_ic_data gt9897_data = { .fw_version_info_addr = GOODIX_BERLIN_FW_VERSION_INFO_ADDR_A, .ic_info_addr = GOODIX_BERLIN_IC_INFO_ADDR_A, @@ -173,6 +181,7 @@ static const struct goodix_berlin_ic_data gt9916_data = { }; static const struct spi_device_id goodix_berlin_spi_ids[] = { + { .name = "gt9895", .driver_data = (long)>9895_data }, { .name = "gt9897", .driver_data = (long)>9897_data }, { .name = "gt9916", .driver_data = (long)>9916_data }, { }, @@ -180,6 +189,7 @@ static const struct spi_device_id goodix_berlin_spi_ids[] = { MODULE_DEVICE_TABLE(spi, goodix_berlin_spi_ids); static const struct of_device_id goodix_berlin_spi_of_match[] = { + { .compatible = "goodix,gt9895", .data = >9895_data }, { .compatible = "goodix,gt9897", .data = >9897_data }, { .compatible = "goodix,gt9916", .data = >9916_data }, { } From f9d10b039e65c1f889dcd1c89df20adb5ae0e6e3 Mon Sep 17 00:00:00 2001 From: Chris Gray Date: Sat, 24 Oct 2026 10:22:31 -0500 Subject: [PATCH 3/3] arm64: dts: exynos: google: gs201-lynx: enable the touchscreen The touchscreen is a Goodix GT9895 on USI0's SPI, with the interrupt, reset and chip select on the same pins as on cheetah. Unlike cheetah, the bootloader leaves its supplies (S2MPG12 LDO25M and LDO26M) off, so describe the main PMIC with those two rails and let the driver enable them. LDO25M is the 1.8 V I/O rail (PP1800_L25M_TSP_DVDD), so it is fixed at 1.8 V rather than the LDO's 1.6-1.95 V range; LDO26M is fixed at 3.0 V as in stock's lynx PMIC description. The PMIC's RTC now sets the clock at boot. Tested on a Pixel 7a from slot B: the controller identifies, and touch input works in the desktop session. Assisted-by: LLM Signed-off-by: Chris Gray --- .../boot/dts/exynos/google/gs201-lynx.dts | 61 ++++++++++++++++++- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/exynos/google/gs201-lynx.dts b/arch/arm64/boot/dts/exynos/google/gs201-lynx.dts index b02f97f8a2..5c0bfb1bce 100644 --- a/arch/arm64/boot/dts/exynos/google/gs201-lynx.dts +++ b/arch/arm64/boot/dts/exynos/google/gs201-lynx.dts @@ -3,8 +3,8 @@ * Google Pixel 7a (lynx) - M1 bring-up board file. * * USB (NCM + ACM), the cluster watchdogs from gs201.dtsi, a - * simple-framebuffer on the buffer ABL leaves DPP0 scanning out, and UFS. - * The panel driver, touch and the GPU stay disabled. + * simple-framebuffer on the buffer ABL leaves DPP0 scanning out, UFS and + * the touchscreen. The panel driver and the GPU stay disabled. */ /dts-v1/; @@ -94,6 +94,58 @@ }; }; +&acpm_ipc { + /* + * Main PMIC, touch rails only. LDO25M is L25M_TSP_DVDD and LDO26M is + * L26M_TS_AVDD, with stock's ranges; nothing else on the stock board + * consumes them. Unlike on cheetah, the bootloader leaves both off. + * The sub-PMIC is not described. + */ + pmic-1 { + compatible = "samsung,s2mpg12-pmic"; + interrupts = ; + google,vgpio2ap-sysreg = <&sysreg_vgpio2ap>; + wakeup-source; + + regulators { + ldo25m: ldo25m { + regulator-name = "vddio-ts"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; + + ldo26m: ldo26m { + regulator-name = "avdd-ts"; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + }; + }; + }; +}; + +/* Touchscreen: Goodix GT9895 (Berlin) on USI0 SPI, wired as on cheetah */ +&spi_0 { + pinctrl-0 = <&spi0_bus &spi0_miso &spi0_cs_gpio>; + cs-gpios = <&gpp20 3 GPIO_ACTIVE_LOW>; + num-cs = <1>; + status = "okay"; + + touchscreen@0 { + compatible = "goodix,gt9895"; + reg = <0>; + spi-max-frequency = <10000000>; + interrupt-parent = <&gpa7>; + interrupts = <0 IRQ_TYPE_EDGE_FALLING>; + reset-gpios = <&gpp23 2 GPIO_ACTIVE_LOW>; + pinctrl-0 = <&ts_irq &ts_reset>; + pinctrl-names = "default"; + avdd-supply = <&ldo26m>; + vddio-supply = <&ldo25m>; + touchscreen-size-x = <1080>; + touchscreen-size-y = <2400>; + }; +}; + &usbdrd31_phy { status = "okay"; }; @@ -110,3 +162,8 @@ &ufs_0_phy { status = "okay"; }; + +&usi0 { + samsung,mode = ; + status = "okay"; +};