Skip to contentSkip to conversation

Input: add Synaptics TouchComm I2C touchscreen driver and bindings

PATCH In review Vsevolod Nevorotov 5 participants 7 messages Sep 10 – Nov 21

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

v2 cover Input: add Synaptics TouchComm I2C touchscreen driver and bindings

This series adds devicetree schema bindings and an input touchscreen driver for Synaptics TouchComm (TCM) generation-1 touchscreen controllers connected over I2C, such as the Synaptics S3908 found in the OnePlus 9RT.

The S3908 and compatible generation-1 controllers boot autonomously into application mode directly out of their embedded flash memory. The driver implements communication using the Synaptics TouchComm packet protocol, retrieving device identify information and handling reports through a threaded interrupt handler.

Features supported:
- Multi-touch reporting using the input_mt framework (Protocol B)
- Dynamic touch report layouts and coordinate/pressure decoding
- Standard touchscreen properties (axis swapping/inversion)
- Low-power wakeup gestures (double-tap to wake)
- System suspend / resume with deep sleep transition
- Regulator and reset GPIO lifecycle management

Changes in v2:
- Fixed continued-read chunking in syna_recv_message(): accurately track stream bytes including the trailing 0x5a padding byte, request full 64-byte I2C chunks (up to 62 stream bytes), and ensure trailing padding is consumed and verified even for 60-byte aligned payloads.
- Clamped active touch object count in syna_parse_touch_report() to ts->max_objects and guarded offset calculations against integer overflow and OOB access in syna_get_bits().
- Made regulator power management idempotent with ts->powered flag to prevent unbalanced regulator disable warnings during teardown if hardware recovery fails; power down controller and propagate error code on recovery failure in syna_resume().
- Removed touchscreen-size-x / touchscreen-size-y overrides from driver and DT binding example, relying on native resolution reported by controller firmware.
- Documented mutex locking contract on syna_exec_command().
- Added explanatory comments for ABS_MT_PRESSURE and TOUCH_MAJOR/MINOR default limits.
- Sorted TOUCHSCREEN_SYNAPTICS_TCM_I2C alphabetically in Kconfig.
- Fixed commit title casing and checkpatch warnings.

Vsevolod Nevorotov (2):
dt-bindings: input: touchscreen: add Synaptics S3908 controller
Input: synaptics_tcm_i2c - add Synaptics TouchComm I2C touchscreen
driver

 .../input/touchscreen/syna,s3908.yaml         |   69 ++
 MAINTAINERS                                   |    7 +
 drivers/input/touchscreen/Kconfig             |   15 +
 drivers/input/touchscreen/Makefile            |    1 +
 drivers/input/touchscreen/synaptics_tcm_i2c.c | 1066 +++++++++++++++++
 5 files changed, 1158 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/syna,s3908.yaml
 create mode 100644 drivers/input/touchscreen/synaptics_tcm_i2c.c
Signature · 1 line
2.55.0
#1 lore raw

PATCH v2 1/2 dt-bindings: input: touchscreen: add Synaptics S3908 controller

Add devicetree schema binding for the Synaptics S3908 TouchComm generation-1 I2C touchscreen controller, found in devices such as the OnePlus 9RT.

---
 .../input/touchscreen/syna,s3908.yaml         | 69 +++++++++++++++++++
 1 file changed, 69 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/syna,s3908.yaml
Documentation/devicetree/bindings/input/touchscreen/syna,s3908.yaml new file +69 -0
new file mode 100644
index 00000000000..68479b0b7d7
@@ -0,0 +1,69 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/touchscreen/syna,s3908.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Synaptics S3908 TouchComm I2C Touchscreen
+
+maintainers:
+  - Vsevolod Nevorotov <[email protected]>
+
+description:
+  Synaptics S3908 is a TouchComm generation-1 touchscreen controller connected
+  over I2C.
+
+allOf:
+  - $ref: touchscreen.yaml#
+
+properties:
+  compatible:
+    const: syna,s3908
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  reset-gpios:
+    maxItems: 1
+
+  vdd-supply:
+    description: Core / digital power supply regulator (VDD)
+
+  avdd-supply:
+    description: Analog power supply regulator (AVDD)
+
+  wakeup-source: true
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - reset-gpios
+  - vdd-supply
+  - avdd-supply
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/gpio/gpio.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        touchscreen@4b {
+            compatible = "syna,s3908";
+            reg = <0x4b>;
+            interrupt-parent = <&tlmm>;
+            interrupts = <23 IRQ_TYPE_LEVEL_LOW>;
+            reset-gpios = <&tlmm 22 GPIO_ACTIVE_LOW>;
+            vdd-supply = <&vreg_l3c_3p0>;
+            avdd-supply = <&vreg_l8c_1p8>;
+            wakeup-source;
+        };
+    };
Signature · 1 line
2.55.0
maintainer Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] dt-bindings: input: touchscreen: add Synaptics S3908 controller

Quoted 10 lines · Vsevolod Nevorotov

Add devicetree schema binding for the Synaptics S3908 TouchComm generation-1 I2C touchscreen controller, found in devices such as the OnePlus 9RT.

---
 .../input/touchscreen/syna,s3908.yaml         | 69 +++++++++++++++++++
 1 file changed, 69 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/syna,s3908.yaml
#3 lore raw

PATCH v2 2/2 Input: synaptics_tcm_i2c - add Synaptics TouchComm I2C touchscreen driver

In reply to Vsevolod Nevorotov

Add input touchscreen driver for Synaptics TouchComm (TCM) generation-1 controllers connected over I2C that boot into application mode out of their own flash (such as the Synaptics S3908 fitted to the OnePlus 9RT).

The driver supports:
- Multi-touch reporting via input_mt framework
- Configurable touch report layouts
- Standard touchscreen properties (axis swapping/inversion)
- Low-power wakeup gestures (double-tap to wake)
- Deep sleep mode during system suspend

---
 MAINTAINERS                                   |    7 +
 drivers/input/touchscreen/Kconfig             |   15 +
 drivers/input/touchscreen/Makefile            |    1 +
 drivers/input/touchscreen/synaptics_tcm_i2c.c | 1066 +++++++++++++++++
 4 files changed, 1089 insertions(+)
 create mode 100644 drivers/input/touchscreen/synaptics_tcm_i2c.c
MAINTAINERS +7 -0
index 0d7987278c0..aa20d9153ac 100644
@@ -26125,6 +26125,13 @@ S:	Maintained
 F:	Documentation/devicetree/bindings/regulator/silergy,sy8106a.yaml
 F:	drivers/regulator/sy8106a-regulator.c
 
+SYNAPTICS TOUCHCOMM I2C TOUCHSCREEN DRIVER
+M:	Vsevolod Nevorotov <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/input/touchscreen/syna,s3908.yaml
+F:	drivers/input/touchscreen/synaptics_tcm_i2c.c
+
 SYNC FILE FRAMEWORK
 M:	Sumit Semwal <[email protected]>
 L:	[email protected]
drivers/input/touchscreen/Kconfig +15 -0
index 9b9ae8ac3f7..c58e3e4cc1c 100644
@@ -1310,6 +1310,21 @@ config TOUCHSCREEN_SX8654
 	  To compile this driver as a module, choose M here: the
 	  module will be called sx8654.
 
+config TOUCHSCREEN_SYNAPTICS_TCM_I2C
+	tristate "Synaptics TouchComm I2C touchscreen"
+	depends on I2C
+	help
+	  Say Y here if you have a Synaptics TouchComm (TCM) touch controller
+	  attached over I2C, such as the S3908 found in the OnePlus 9RT.
+
+	  Only controllers that boot into application mode out of their own
+	  flash are supported; there is no host firmware download.
+
+	  If unsure, say N.
+
+	  To compile this driver as a module, choose M here: the module will be
+	  called synaptics_tcm_i2c.
+
 config TOUCHSCREEN_TPS6507X
 	tristate "TPS6507x based touchscreens"
 	depends on I2C
drivers/input/touchscreen/Makefile +1 -0
index bfd9de83389..a1debe134a0 100644
@@ -86,6 +86,7 @@ obj-$(CONFIG_TOUCHSCREEN_STMPE)		+= stmpe-ts.o
 obj-$(CONFIG_TOUCHSCREEN_SUN4I)		+= sun4i-ts.o
 obj-$(CONFIG_TOUCHSCREEN_SUR40)		+= sur40.o
 obj-$(CONFIG_TOUCHSCREEN_SURFACE3_SPI)	+= surface3_spi.o
+obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_I2C)	+= synaptics_tcm_i2c.o
 obj-$(CONFIG_TOUCHSCREEN_TI_AM335X_TSC)	+= ti_am335x_tsc.o
 obj-$(CONFIG_TOUCHSCREEN_TOUCHIT213)	+= touchit213.o
 obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT)	+= touchright.o
drivers/input/touchscreen/synaptics_tcm_i2c.c new file +1066 -0

1,066 lines not on this page · raw message

Signature · 1 line
2.55.0
#4 lore raw

Re: [PATCH v2 2/2] Input: synaptics_tcm_i2c - add Synaptics TouchComm I2C touchscreen driver

drivers/input/touchscreen/synaptics_tcm_i2c.c line 34

Quoted 9 lines · Vsevolod Nevorotov
drivers/input/touchscreen/synaptics_tcm_i2c.c new file +9 -0
+#include <linux/bits.h>
+#include <linux/delay.h>
+#include <linux/gpio/consumer.h>
+#include <linux/i2c.h>
+#include <linux/input.h>
+#include <linux/input/mt.h>
+#include <linux/input/touchscreen.h>
+#include <linux/interrupt.h>
+#include <linux/mod_devicetable.h>

Please rely on <linux/i2c.h> to provide i2c_device_id and of_device_id and drop <linux/mod_devicetable.h>. (And in case you want to do full iwyu use <linux/device-id/i2c.h> and <linux/device-id/of.h> instead.)

Best regards
Uwe

Tested-by on v2 2/2
#5 lore raw

Re: [PATCH v2 2/2] Input: synaptics_tcm_i2c - add Synaptics TouchComm I2C touchscreen driver

In reply to Vsevolod Nevorotov

Hi Vsevolod,

Quoted 3 lines · Vsevolod Nevorotov

Add input touchscreen driver for Synaptics TouchComm (TCM) generation-1 controllers connected over I2C that boot into application mode out of their own flash (such as the Synaptics S3908 fitted to the OnePlus 9RT).

I tested v2 on a OnePlus 11 (SM8550), which has the same S3908, on top of next-20261120 with an out-of-tree device tree.

synaptics-tcm-i2c 1-004b: TouchComm v1, mode 0x01, part s3908-15.0.0 synaptics-tcm-i2c 1-004b: 5760x12864, 10 touch objects

Touch works under Phosh, including multi-touch. With wakeup-source set, the double-tap gesture is reported (KEY_WAKEUP) while the device is suspended, and touch works again after resume. I could only exercise this with /sys/power/pm_test = devices, because a full system suspend does not work on this platform yet.

One question on patch 1/2: the binding describes vdd as the core/digital supply and avdd as the analog one, but its example connects vdd to a 3.0 V and avdd to a 1.8 V regulator. Which is intended?

Thanks,
Majid

#6 lore raw
In reply to Vsevolod Nevorotov
Quoted 49 lines · Vsevolod Nevorotov

This series adds devicetree schema bindings and an input touchscreen driver for Synaptics TouchComm (TCM) generation-1 touchscreen controllers connected over I2C, such as the Synaptics S3908 found in the OnePlus 9RT.

The S3908 and compatible generation-1 controllers boot autonomously into application mode directly out of their embedded flash memory. The driver implements communication using the Synaptics TouchComm packet protocol, retrieving device identify information and handling reports through a threaded interrupt handler.

Features supported:
- Multi-touch reporting using the input_mt framework (Protocol B)
- Dynamic touch report layouts and coordinate/pressure decoding
- Standard touchscreen properties (axis swapping/inversion)
- Low-power wakeup gestures (double-tap to wake)
- System suspend / resume with deep sleep transition
- Regulator and reset GPIO lifecycle management

Changes in v2:
- Fixed continued-read chunking in syna_recv_message(): accurately
track
stream bytes including the trailing 0x5a padding byte, request full 64-byte I2C chunks (up to 62 stream bytes), and ensure trailing
padding
is consumed and verified even for 60-byte aligned payloads.
- Clamped active touch object count in syna_parse_touch_report() to ts->max_objects and guarded offset calculations against integer
overflow
and OOB access in syna_get_bits().
- Made regulator power management idempotent with ts->powered flag to prevent unbalanced regulator disable warnings during teardown if hardware recovery fails; power down controller and propagate error
code
on recovery failure in syna_resume().
- Removed touchscreen-size-x / touchscreen-size-y overrides from
driver
and DT binding example, relying on native resolution reported by controller firmware.
- Documented mutex locking contract on syna_exec_command().
- Added explanatory comments for ABS_MT_PRESSURE and TOUCH_MAJOR/MINOR default limits.
- Sorted TOUCHSCREEN_SYNAPTICS_TCM_I2C alphabetically in Kconfig.
- Fixed commit title casing and checkpatch warnings.

Vsevolod Nevorotov (2):
dt-bindings: input: touchscreen: add Synaptics S3908 controller
Input: synaptics_tcm_i2c - add Synaptics TouchComm I2C touchscreen
driver

Quoted 9 lines
 .../input/touchscreen/syna,s3908.yaml         |   69 ++
 MAINTAINERS                                   |    7 +
 drivers/input/touchscreen/Kconfig             |   15 +
 drivers/input/touchscreen/Makefile            |    1 +
 drivers/input/touchscreen/synaptics_tcm_i2c.c | 1066 +++++++++++++++++
 5 files changed, 1158 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/input/touchscreen/syna,s3908.yaml
 create mode 100644 drivers/input/touchscreen/synaptics_tcm_i2c.c

Hi,

I have tested your driver on Xiaomi Redmi Note 7 (lavender). It is working fine, here is some proof from probing:

[   27.427839] synaptics-tcm-i2c 0-0020: supply avdd not found, using dummy regulator
[   28.570803] synaptics-tcm-i2c 0-0020: TouchComm v1, mode 0x01, part td4320-12.0.9
[   28.590773] synaptics-tcm-i2c 0-0020: 1080x2340, 10 touch objects

Two thing lavender is using same regulators like the panel and no avdd defined, maybe the regulators should not be required in the bindings.
Is it possible to add more generic compatible since this driver working with other TCM variants not just with s3908.

I can send a T-b for the next revision.

Br,
Barnabas