From 0aff2501fb160fb5c81faa0603bd0749b9456eb0 Mon Sep 17 00:00:00 2001 From: Alejandro Garcia Date: Wed, 28 Oct 2026 22:27:24 -0700 Subject: [PATCH 1/3] Input: ft3658 - make the SPI buffers DMA-safe SPI transfer buffers must be DMA-safe (include/linux/spi/spi.h, Documentation/spi/spi-summary.rst), and tx and rx sit in struct ft3658 next to other fields, so a controller with a DMA channel would map memory those fields share. Put each buffer on its own ARCH_DMA_MINALIGN boundary, after every other field. On gs201 the USI SPI has no DMA channel and runs in polling mode, so this changes nothing on the Pixel 7. Tested on a Pixel 7 (7.3.0-rc6) with the touch node: the controller probes (chip id 0x56, firmware 0x16) and reports touches across the panel with no CRC errors. Suggested-by: Derek Ross Assisted-by: Claude Opus 5.5 Signed-off-by: Alejandro Garcia --- drivers/input/touchscreen/focaltech_ft3658.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/focaltech_ft3658.c b/drivers/input/touchscreen/focaltech_ft3658.c index d16c4bc095..61fc505145 100644 --- a/drivers/input/touchscreen/focaltech_ft3658.c +++ b/drivers/input/touchscreen/focaltech_ft3658.c @@ -29,6 +29,7 @@ * event (2 bits) | x (12) | id (4) | y (12) | pressure | area */ +#include #include #include #include @@ -77,9 +78,10 @@ struct ft3658 { struct regulator *vdd; struct regulator *avdd; struct touchscreen_properties prop; - u8 tx[FT3658_BUF_LEN]; - u8 rx[FT3658_BUF_LEN]; u8 report[FT3658_REPORT_LEN]; + /* SPI buffers, DMA-safe: each on its own DMA alignment boundary */ + u8 tx[FT3658_BUF_LEN] __aligned(ARCH_DMA_MINALIGN); + u8 rx[FT3658_BUF_LEN] __aligned(ARCH_DMA_MINALIGN); }; static int ft3658_read(struct ft3658 *ts, u8 addr, u8 *data, size_t len) From 2f55199a295aed7612e1a022cc85d371659f74fa Mon Sep 17 00:00:00 2001 From: Alejandro Garcia Date: Wed, 28 Oct 2026 22:27:25 -0700 Subject: [PATCH 2/3] Input: ft3658 - sleep instead of busy-waiting after each transfer The controller needs chip select high for 150 us between transfers, and ft3658_read() runs only from probe and the threaded interrupt handler, both of which can sleep. Use fsleep() rather than spinning in udelay() on every transfer. Tested on a Pixel 7 (7.3.0-rc6) with the touch node: the controller probes (chip id 0x56, firmware 0x16) and reports touches across the panel with no CRC errors. Suggested-by: Derek Ross Assisted-by: Claude Opus 5.5 Signed-off-by: Alejandro Garcia --- drivers/input/touchscreen/focaltech_ft3658.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/focaltech_ft3658.c b/drivers/input/touchscreen/focaltech_ft3658.c index 61fc505145..17bdeb15c2 100644 --- a/drivers/input/touchscreen/focaltech_ft3658.c +++ b/drivers/input/touchscreen/focaltech_ft3658.c @@ -111,7 +111,7 @@ static int ft3658_read(struct ft3658 *ts, u8 addr, u8 *data, size_t len) xfer.len = xfer_len; ret = spi_sync_transfer(ts->spi, &xfer, 1); - udelay(FT3658_CS_HIGH_US); + fsleep(FT3658_CS_HIGH_US); if (ret) return ret; From c87796f6749275e1d0d451b6d734b7a18909621c Mon Sep 17 00:00:00 2001 From: Alejandro Garcia Date: Wed, 28 Oct 2026 22:27:25 -0700 Subject: [PATCH 3/3] Input: ft3658 - name the Google driver the protocol follows The header says the protocol follows Google's GPL FocalTech driver for Pixel devices. Name the repository, the directory, the branch and the files, so a reviewer can follow it to the source: focaltech_spi.c for the framing, the status check, the 64-byte alignment rule and the CS-high delay, and focaltech_core.c for the power sequence and the report. Suggested-by: Derek Ross Assisted-by: Claude Opus 5.5 Signed-off-by: Alejandro Garcia --- drivers/input/touchscreen/focaltech_ft3658.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/focaltech_ft3658.c b/drivers/input/touchscreen/focaltech_ft3658.c index 17bdeb15c2..4309c86647 100644 --- a/drivers/input/touchscreen/focaltech_ft3658.c +++ b/drivers/input/touchscreen/focaltech_ft3658.c @@ -3,7 +3,10 @@ * FocalTech FT3658 touchscreen driver (SPI) * * The FT3658 is the touch controller of the Google Pixel 7. The protocol - * follows Google's GPL FocalTech driver for Pixel devices: + * follows Google's GPL FocalTech driver for Pixel devices + * (kernel/google-modules/touch/focaltech_touch, ft3658/, branch + * android-gs-pantah-6.1-android16: focaltech_spi.c for the framing, + * focaltech_core.c for the power sequence and the report): * Copyright (c) 2012-2020, FocalTech Systems, Ltd. * * The controller runs its own firmware from flash; this driver only powers