Skip to contentSkip to conversation

dt-bindings: input: touchscreen: add hynitron cst816x series

PATCH New Oleh Kuzhylnyi 1 participant 2 messages Sep 21, 2025

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

PATCH v10 1/2 dt-bindings: input: touchscreen: add hynitron cst816x series

Add documentation for Hynitron CST816x series touchscreen bindings.

---
Changes in v10:
- No code changes

Changes in v9:
- Adjust linux,keycodes: Add items with event descriptions, and remove maxItems
- Adjust dt example: Fix four-spaces indentation

Changes in v8:
- Update the bindings title to indicate CST816x series support
- Rephrase bindings description to describe controller more precisely
- Remove redundant description field from the reset-gpio property
- Completely remove cst816x,gestures object with all dependants
- Apply linux,keycodes to represent gestures (slide up, slide down, etc.)
- Extend dt example with linux,keycodes
- Align indentation in dt example to use four spaces

Changes in v7:
- Introduce the gestures field along with its sub-fields
- Make reset-gpio property optional
- Extend main description
- Remove "touchscreen" reference

Changes in v6:
- Fix minor tweak adviced by Krzysztof:
- Move additionalProperties field after required

Changes in v5:
- No code changes

Changes in v4:
- Add Conor's Dooley "Reviewed-by" tag

Changes in v3:
- Rename filename to hynitron,cst816s.yaml
- Update description with display details

Changes in v2:
- Apply pin definitions and DT headers
- Use generic name for DT node
- Drop status field

 .../input/touchscreen/hynitron,cst816x.yaml   | 65 +++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/hynitron,cst816x.yaml
Documentation/devicetree/bindings/input/touchscreen/hynitron,cst816x.yaml new file +65 -0
new file mode 100644
index 000000000000..72d4da636881
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/touchscreen/hynitron,cst816x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Hynitron CST816x Series Capacitive Touch controller
+
+maintainers:
+  - Oleh Kuzhylnyi <[email protected]>
+
+description: |
+  Bindings for CST816x high performance self-capacitance touch chip series
+  with single point gesture and real two-point operation.
+
+properties:
+  compatible:
+    enum:
+      - hynitron,cst816s
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  reset-gpios:
+    maxItems: 1
+
+  linux,keycodes:
+    minItems: 1
+    items:
+      - description: Slide up gesture
+      - description: Slide down gesture
+      - description: Slide left gesture
+      - description: Slide right gesture
+      - description: Long press gesture
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/input/linux-event-codes.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        touchscreen@15 {
+            compatible = "hynitron,cst816s";
+            reg = <0x15>;
+            interrupt-parent = <&gpio0>;
+            interrupts = <4 IRQ_TYPE_EDGE_RISING>;
+            reset-gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
+            linux,keycodes = <KEY_UP>, <KEY_DOWN>, <KEY_LEFT>, <KEY_RIGHT>,
+                             <BTN_TOOL_TRIPLETAP>;
+        };
+    };
+
+...
Signature · 1 line
2.43.0
#1 lore raw

PATCH v10 2/2 input: add hynitron cst816x series

Introduce support for the Hynitron CST816x series touchscreen controller used for 240×240 1.28-inch Round LCD Display Module manufactured by Waveshare Electronics. The driver is designed based on an Arduino implementation marked as under MIT License. This driver is written for a particular round display based on the CST816S controller, which is not compatiable with existing driver for Hynitron controllers.

---
Changes in v10:
- In Kconfig help text, remove word "series" to align with other touchscreen drivers

Changes in v9:
- Do not treat TOUCH as a gesture. Use BTN_TOUCH to indicate active touch slots.
- Use u16 for coordinate values to align with the expected input types
- Add cst816x_gest_to_idx() to map gesture ID to keycodes[i] event
- Simplify input reporting order by reporting coordinates first
- Reword cst816x_touch's fields: "gesture" to "gest", and "touch" to "active"
- Rename *desc argument to *tch

Changes in v8:
- Change driver's name to: Hynitron CST816x Series Touchscreen
- Simplify DT gesture mapping for better consistency:
linux,code[0-15]: event_map[gest_id] -> linux,keycodes[0-15]: keycode[gest_id]
- Treat TOUCH as a user-defined gesture
- Minor rewords: error/rc to ret, CST816X_FRAME to CST816X_RD_REG

Changes in v7:
- Update commit based on Jeffs's feedback:
- Move event_map table to Device Tree
- Implement DT parsing functionality
- Use "int" type for iterators
- Get rid of "*dev" entry from private struct
- Use touch_info directly as a buffer for I2C
- Fix coding style tweaks

Changes in v6:
- No code changes

Changes in v5:
- Update commit based on Dmitry's feedback:
- Make GPIO reset optional
- Combine declaration and initialization for i2c_xfer
- Return 0 explicitly where possible
- Rename rc (return code) to error
- Make Touch processing call return boolean
- Improve error handling for i2c_transfer
- Use get_unaligned_be16 for getting coordinates
- Move touch event completeness upper to irq callback

Changes in v4:
- Update commit based on Dmitry's feedback:
- Move abs_x and abs_y to u16
- Remove __packed qualifier for touch_info struct
- Hide tiny touch irq context to stack
- Extend cst816x_i2c_read_register() with buf and buf_size
- Remove loop from event lookup

Changes in v3:
- Drop timer and delayed work
- Process touch in threaded IRQ context
- Fix chip reset sequence
- Move input_register() before devm_request_threaded_irq()
- Re-arrange and document input reporting
- Set u16 data type for event_code
- Remove double tap event to prevent continuous double side sliding

Changes in v2:
- Apply dev_err_probe() for better error handling
- Remove redundant printing, remove dev_warn() message spamming
- Get rid of PM since the touchscreen goes into sleep mode automatically
- Get rid of IRQ control and IRQF_NO_AUTOEN flag
- Reduce timer timeout up to 10ms to handle touch events faster
- Skip registering of non-gesture CST816X_SWIPE event
- Shift input_register_device() as a final call in probe() callback
- Specify name of i2c_device_id explicitly
- Update module description and fix typo
- Add necessary spaces between lines

 drivers/input/touchscreen/Kconfig            |  12 +
 drivers/input/touchscreen/Makefile           |   1 +
 drivers/input/touchscreen/hynitron-cst816x.c | 243 +++++++++++++++++++
 3 files changed, 256 insertions(+)
 create mode 100644 drivers/input/touchscreen/hynitron-cst816x.c
drivers/input/touchscreen/Kconfig +12 -0
index 196905162945..b96d763673e6 100644
@@ -465,6 +465,18 @@ config TOUCHSCREEN_HYNITRON_CSTXXX
 	  To compile this driver as a module, choose M here: the
 	  module will be called hynitron-cstxxx.
 
+config TOUCHSCREEN_HYNITRON_CST816X
+	tristate "Hynitron CST816x touchscreen"
+	depends on I2C
+	help
+	  Say Y here if you have a touchscreen using a Hynitron
+	  CST816x series touchscreen controller.
+
+	  If unsure, say N.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called hynitron-cst816x.
+
 config TOUCHSCREEN_ILI210X
 	tristate "Ilitek ILI210X based touchscreen"
 	depends on I2C
drivers/input/touchscreen/Makefile +1 -0
index 97a025c6a377..6805ab60f016 100644
@@ -50,6 +50,7 @@ obj-$(CONFIG_TOUCHSCREEN_GOODIX_BERLIN_I2C)	+= goodix_berlin_i2c.o
 obj-$(CONFIG_TOUCHSCREEN_GOODIX_BERLIN_SPI)	+= goodix_berlin_spi.o
 obj-$(CONFIG_TOUCHSCREEN_HIDEEP)	+= hideep.o
 obj-$(CONFIG_TOUCHSCREEN_HYNITRON_CSTXXX)	+= hynitron_cstxxx.o
+obj-$(CONFIG_TOUCHSCREEN_HYNITRON_CST816X)	+= hynitron-cst816x.o
 obj-$(CONFIG_TOUCHSCREEN_ILI210X)	+= ili210x.o
 obj-$(CONFIG_TOUCHSCREEN_ILITEK)	+= ilitek_ts_i2c.o
 obj-$(CONFIG_TOUCHSCREEN_IMAGIS)	+= imagis.o
drivers/input/touchscreen/hynitron-cst816x.c new file +243 -0

243 lines not on this page · raw message

Signature · 1 line
2.43.0