All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/4] input: edt-ft5x06: add support for DFROBOT touch controller to
@ 2021-12-16 23:30 Tim Harvey
  2021-12-16 23:30 ` [RFC PATCH 1/4] dt-bindings: input: touchscreen: edt-ft5x06: add poll-interval Tim Harvey
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Tim Harvey @ 2021-12-16 23:30 UTC (permalink / raw)
  To: linux-input, Rob Herring, Dmitry Torokhov; +Cc: Tim Harvey

The DFROBOT DFR0678 [1] and DFR0550 [2] touchscreen displays are meant
to be compatible with the official RaspberryPi 7in display. However
instead of directly conntecting the FT5x06 touch controller to the I2C
bus going to the host processor they route it through an MCU and emulate
a virtual FT5x06 controller but don't do a very good job at it. The
method the RaspberryPi firmware used to read the touch data is supported
(which consists of reading R2 to get the number of touch points, then
reading 4 bytes of data for each point in discrete I2C transactions. If
you try to use the FT5x06 driver which reads all registers starting at
R0 at once you will get invalid point data.

Additionally the RaspberryPi displays like these do not have a touch
controller IRQ so polling mode has to be added.

Also additionally these controllers do not appear to send UP events so
an additional patch slightly modified from the raspberry-pi kernel is used
to  track ID's and report up events.

I'm sending this series as an RFC as I'm not really clear if this is the
best approach vs just adding a new touchscreen driver (which I have
prepared and will probably send in another RFC).

Tim
[1] - https://www.dfrobot.com/product-2193.html
[2] - https://www.dfrobot.com/product-1784.html

Tim Harvey (4):
  dt-bindings: input: touchscreen: edt-ft5x06: add poll-interval
  input: edt-ft5x06 - add polled input support
  input: edt-ft5x06 - add support for DFROBOT touch controllers
  input: edt-ft5x06 - Handle unreliable TOUCH_UP events

 .../input/touchscreen/edt-ft5x06.yaml         |   7 +-
 drivers/input/touchscreen/edt-ft5x06.c        | 144 ++++++++++++++----
 2 files changed, 123 insertions(+), 28 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [RFC PATCH 1/4] dt-bindings: input: touchscreen: edt-ft5x06: add poll-interval
  2021-12-16 23:30 [RFC PATCH 0/4] input: edt-ft5x06: add support for DFROBOT touch controller to Tim Harvey
@ 2021-12-16 23:30 ` Tim Harvey
  2021-12-17 14:53   ` Rob Herring
  2021-12-16 23:30 ` [RFC PATCH 2/4] input: edt-ft5x06 - add polled input support Tim Harvey
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Tim Harvey @ 2021-12-16 23:30 UTC (permalink / raw)
  To: linux-input, Rob Herring, Dmitry Torokhov
  Cc: Tim Harvey, Nicolas Saenz Julienne

Some devices might not provide an interrupt line for the touchscreen.
In that case the driver defaults to using a polled interface.

Cc: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
 .../devicetree/bindings/input/touchscreen/edt-ft5x06.yaml   | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.yaml b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.yaml
index 2e8da7470513..a0d4dabf03b8 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.yaml
+++ b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.yaml
@@ -47,6 +47,11 @@ properties:
   interrupts:
     maxItems: 1
 
+  poll-interval:
+    description: Poll interval time in milliseconds, only relevant if no
+                 interrupt was provided.
+    $ref: /schemas/types.yaml#/definitions/uint32
+
   reset-gpios:
     maxItems: 1
 
@@ -99,7 +104,6 @@ additionalProperties: false
 required:
   - compatible
   - reg
-  - interrupts
 
 examples:
   - |
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [RFC PATCH 2/4] input: edt-ft5x06 - add polled input support
  2021-12-16 23:30 [RFC PATCH 0/4] input: edt-ft5x06: add support for DFROBOT touch controller to Tim Harvey
  2021-12-16 23:30 ` [RFC PATCH 1/4] dt-bindings: input: touchscreen: edt-ft5x06: add poll-interval Tim Harvey
@ 2021-12-16 23:30 ` Tim Harvey
  2021-12-16 23:30 ` [RFC PATCH 3/4] input: edt-ft5x06 - add support for DFROBOT touch controllers Tim Harvey
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Tim Harvey @ 2021-12-16 23:30 UTC (permalink / raw)
  To: linux-input, Rob Herring, Dmitry Torokhov
  Cc: Tim Harvey, Nicolas Saenz Julienne, Dave Stevenson

Some hardware configurations might pass on providing an interrupt line.
In that case there is always the option to use a polled input approach.
This patch adapts the driver for it.

The polled approach is only triggered if no interrupt is provided by the
firmware or platform data.

Cc: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Cc: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
 drivers/input/touchscreen/edt-ft5x06.c | 63 ++++++++++++++++++--------
 1 file changed, 45 insertions(+), 18 deletions(-)

diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index bb2e1cbffba7..06662f2258b1 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -187,9 +187,8 @@ static bool edt_ft5x06_ts_check_crc(struct edt_ft5x06_ts_data *tsdata,
 	return true;
 }
 
-static irqreturn_t edt_ft5x06_ts_isr(int irq, void *dev_id)
+static void edt_ft5x06_process(struct edt_ft5x06_ts_data *tsdata)
 {
-	struct edt_ft5x06_ts_data *tsdata = dev_id;
 	struct device *dev = &tsdata->client->dev;
 	u8 cmd;
 	u8 rdbuf[63];
@@ -216,7 +215,7 @@ static irqreturn_t edt_ft5x06_ts_isr(int irq, void *dev_id)
 		break;
 
 	default:
-		goto out;
+		return;
 	}
 
 	memset(rdbuf, 0, sizeof(rdbuf));
@@ -228,7 +227,7 @@ static irqreturn_t edt_ft5x06_ts_isr(int irq, void *dev_id)
 	if (error) {
 		dev_err_ratelimited(dev, "Unable to fetch data, error: %d\n",
 				    error);
-		goto out;
+		return;
 	}
 
 	/* M09/M12 does not send header or CRC */
@@ -238,11 +237,11 @@ static irqreturn_t edt_ft5x06_ts_isr(int irq, void *dev_id)
 			dev_err_ratelimited(dev,
 					"Unexpected header: %02x%02x%02x!\n",
 					rdbuf[0], rdbuf[1], rdbuf[2]);
-			goto out;
+			return;
 		}
 
 		if (!edt_ft5x06_ts_check_crc(tsdata, rdbuf, datalen))
-			goto out;
+			return;
 	}
 
 	for (i = 0; i < tsdata->max_support_points; i++) {
@@ -274,11 +273,23 @@ static irqreturn_t edt_ft5x06_ts_isr(int irq, void *dev_id)
 
 	input_mt_report_pointer_emulation(tsdata->input, true);
 	input_sync(tsdata->input);
+}
 
-out:
+static irqreturn_t edt_ft5x06_ts_isr(int irq, void *dev_id)
+{
+	struct edt_ft5x06_ts_data *tsdata = dev_id;
+
+	edt_ft5x06_process(tsdata);
 	return IRQ_HANDLED;
 }
 
+static void edt_ft5x06_ts_poll(struct input_dev *dev)
+{
+	struct edt_ft5x06_ts_data *tsdata = input_get_drvdata(dev);
+
+	edt_ft5x06_process(tsdata);
+}
+
 static int edt_ft5x06_register_write(struct edt_ft5x06_ts_data *tsdata,
 				     u8 addr, u8 value)
 {
@@ -1080,6 +1091,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
 	u8 buf[2] = { 0xfc, 0x00 };
 	struct input_dev *input;
 	unsigned long irq_flags;
+	u32 poll_interval = 0;
 	int error;
 	char fw_version[EDT_NAME_LEN];
 
@@ -1234,17 +1246,32 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
 
 	i2c_set_clientdata(client, tsdata);
 
-	irq_flags = irq_get_trigger_type(client->irq);
-	if (irq_flags == IRQF_TRIGGER_NONE)
-		irq_flags = IRQF_TRIGGER_FALLING;
-	irq_flags |= IRQF_ONESHOT;
-
-	error = devm_request_threaded_irq(&client->dev, client->irq,
-					NULL, edt_ft5x06_ts_isr, irq_flags,
-					client->name, tsdata);
-	if (error) {
-		dev_err(&client->dev, "Unable to request touchscreen IRQ.\n");
-		return error;
+	device_property_read_u32(&client->dev, "poll-interval",
+				 &poll_interval);
+	if (poll_interval) {
+		error = input_setup_polling(input, edt_ft5x06_ts_poll);
+		if (error) {
+			dev_err(&client->dev,
+				"Unable to set up polling mode: %d\n", error);
+			return error;
+		}
+		input_set_drvdata(input, tsdata);
+		input_set_poll_interval(input, poll_interval);
+		dev_info(&client->dev, "Polling device at %dms\n",
+			 poll_interval);
+	} else {
+		irq_flags = irq_get_trigger_type(client->irq);
+		if (irq_flags == IRQF_TRIGGER_NONE)
+			irq_flags = IRQF_TRIGGER_FALLING;
+		irq_flags |= IRQF_ONESHOT;
+
+		error = devm_request_threaded_irq(&client->dev, client->irq,
+						NULL, edt_ft5x06_ts_isr, irq_flags,
+						client->name, tsdata);
+		if (error) {
+			dev_err(&client->dev, "Unable to request touchscreen IRQ.\n");
+			return error;
+		}
 	}
 
 	error = devm_device_add_group(&client->dev, &edt_ft5x06_attr_group);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [RFC PATCH 3/4] input: edt-ft5x06 - add support for DFROBOT touch controllers
  2021-12-16 23:30 [RFC PATCH 0/4] input: edt-ft5x06: add support for DFROBOT touch controller to Tim Harvey
  2021-12-16 23:30 ` [RFC PATCH 1/4] dt-bindings: input: touchscreen: edt-ft5x06: add poll-interval Tim Harvey
  2021-12-16 23:30 ` [RFC PATCH 2/4] input: edt-ft5x06 - add polled input support Tim Harvey
@ 2021-12-16 23:30 ` Tim Harvey
  2021-12-16 23:30 ` [RFC PATCH 4/4] input: edt-ft5x06 - Handle unreliable TOUCH_UP events Tim Harvey
  2022-01-21 17:24 ` [RFC PATCH 0/4] input: edt-ft5x06: add support for DFROBOT touch controller to Tim Harvey
  4 siblings, 0 replies; 7+ messages in thread
From: Tim Harvey @ 2021-12-16 23:30 UTC (permalink / raw)
  To: linux-input, Rob Herring, Dmitry Torokhov; +Cc: Tim Harvey

Add support for the touch controller found on a DFROBOT DFR0550/DFR0776
touchscreen display.

These touchscreen displays are intended to be compatible with the official
Raspberry Pi 7in display which has an FTx06 touch controller directly
attached to the 15pin connector to the host processor. However these
displays have an FTx06 touch controller that connected to an I2C master
on a STM32F103 micro controller which polls the FTx06 and emulates a
virtual I2C device connected to the 15pin connector to the host processor.

The emulated FTx06 implements a subset of the FTx06 register set but
must be read with individual transactions between reading the number
of points and the point data itself.

Additionally there is no IRQ made available.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
 .../input/touchscreen/edt-ft5x06.yaml         |  1 +
 drivers/input/touchscreen/edt-ft5x06.c        | 65 ++++++++++++++++---
 2 files changed, 58 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.yaml b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.yaml
index a0d4dabf03b8..45a9cb1d4f14 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.yaml
+++ b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.yaml
@@ -40,6 +40,7 @@ properties:
       - edt,edt-ft5506
       - evervision,ev-ft5726
       - focaltech,ft6236
+      - dfr,dfr0550
 
   reg:
     maxItems: 1
diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index 06662f2258b1..a3622d6e8e65 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -84,6 +84,7 @@ enum edt_ver {
 	EDT_M12,
 	EV_FT,
 	GENERIC_FT,
+	DFR,
 };
 
 struct edt_reg_addr {
@@ -134,6 +135,7 @@ struct edt_ft5x06_ts_data {
 
 struct edt_i2c_chip_data {
 	int  max_support_points;
+	bool dfr;
 };
 
 static int edt_ft5x06_ts_readwrite(struct i2c_client *client,
@@ -195,6 +197,7 @@ static void edt_ft5x06_process(struct edt_ft5x06_ts_data *tsdata)
 	int i, type, x, y, id;
 	int offset, tplen, datalen, crclen;
 	int error;
+	int num_points;
 
 	switch (tsdata->version) {
 	case EDT_M06:
@@ -202,6 +205,7 @@ static void edt_ft5x06_process(struct edt_ft5x06_ts_data *tsdata)
 		offset = 5; /* where the actual touch data starts */
 		tplen = 4;  /* data comes in so called frames */
 		crclen = 1; /* length of the crc data */
+		datalen = tplen * tsdata->max_support_points + offset + crclen;
 		break;
 
 	case EDT_M09:
@@ -212,6 +216,14 @@ static void edt_ft5x06_process(struct edt_ft5x06_ts_data *tsdata)
 		offset = 3;
 		tplen = 6;
 		crclen = 0;
+		datalen = tplen * tsdata->max_support_points + offset + crclen;
+		break;
+	/* DFR needs to read 1 byte R2 for num points */
+	case DFR:
+		cmd = 0x2;
+		offset = 3;
+		crclen = 0;
+		datalen = 1;
 		break;
 
 	default:
@@ -219,7 +231,6 @@ static void edt_ft5x06_process(struct edt_ft5x06_ts_data *tsdata)
 	}
 
 	memset(rdbuf, 0, sizeof(rdbuf));
-	datalen = tplen * tsdata->max_support_points + offset + crclen;
 
 	error = edt_ft5x06_ts_readwrite(tsdata->client,
 					sizeof(cmd), &cmd,
@@ -242,11 +253,31 @@ static void edt_ft5x06_process(struct edt_ft5x06_ts_data *tsdata)
 
 		if (!edt_ft5x06_ts_check_crc(tsdata, rdbuf, datalen))
 			return;
+		num_points = tsdata->max_support_points;
+	} else if (tsdata->version == DFR) {
+		num_points = min(rdbuf[0] & 0xf, tsdata->max_support_points);
+	} else {
+		num_points = min(rdbuf[2] & 0xf, tsdata->max_support_points);
 	}
 
-	for (i = 0; i < tsdata->max_support_points; i++) {
+	for (i = 0; i < num_points; i++) {
 		u8 *buf = &rdbuf[i * tplen + offset];
 
+		/* DFR must read each point in separate transaction */
+		if (tsdata->version == DFR) {
+			cmd = 3+6*i;
+			datalen = 4;
+			buf = rdbuf;
+			error = edt_ft5x06_ts_readwrite(tsdata->client,
+							sizeof(cmd), &cmd,
+							datalen, buf);
+			if (error) {
+				dev_err_ratelimited(dev, "Unable to fetch point data, error: %d\n",
+						    error);
+				return;
+			}
+		}
+
 		type = buf[0] >> 6;
 		/* ignore Reserved events */
 		if (type == TOUCH_EVENT_RESERVED)
@@ -1072,6 +1103,9 @@ static void edt_ft5x06_ts_set_regs(struct edt_ft5x06_ts_data *tsdata)
 		reg_addr->reg_num_x = NO_REGISTER;
 		reg_addr->reg_num_y = NO_REGISTER;
 		break;
+
+	case DFR:
+		break;
 	}
 }
 
@@ -1206,21 +1240,29 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
 	tsdata->input = input;
 	tsdata->factory_mode = false;
 
-	error = edt_ft5x06_ts_identify(client, tsdata, fw_version);
-	if (error) {
-		dev_err(&client->dev, "touchscreen probe failed\n");
-		return error;
+	if (chip_data->dfr) {
+		tsdata->version = DFR;
+		snprintf(tsdata->name, EDT_NAME_LEN, "DFROBOT");
+		fw_version[0] = 0;
+	} else {
+		error = edt_ft5x06_ts_identify(client, tsdata, fw_version);
+		if (error) {
+			dev_err(&client->dev, "touchscreen probe failed\n");
+			return error;
+		}
 	}
 
 	/*
 	 * Dummy read access. EP0700MLP1 returns bogus data on the first
 	 * register read access and ignores writes.
 	 */
-	edt_ft5x06_ts_readwrite(tsdata->client, 2, buf, 2, buf);
+	if (!chip_data->dfr) /* this gets the DFR controller out of sync */
+		edt_ft5x06_ts_readwrite(tsdata->client, 2, buf, 2, buf);
 
 	edt_ft5x06_ts_set_regs(tsdata);
 	edt_ft5x06_ts_get_defaults(&client->dev, tsdata);
-	edt_ft5x06_ts_get_parameters(tsdata);
+	if (!chip_data->dfr)
+		edt_ft5x06_ts_get_parameters(tsdata);
 
 	dev_dbg(&client->dev,
 		"Model \"%s\", Rev. \"%s\", %dx%d sensors\n",
@@ -1423,12 +1465,18 @@ static const struct edt_i2c_chip_data edt_ft6236_data = {
 	.max_support_points = 2,
 };
 
+static const struct edt_i2c_chip_data edt_dfr0550_data = {
+	.max_support_points = 5,
+	.dfr = true,
+};
+
 static const struct i2c_device_id edt_ft5x06_ts_id[] = {
 	{ .name = "edt-ft5x06", .driver_data = (long)&edt_ft5x06_data },
 	{ .name = "edt-ft5506", .driver_data = (long)&edt_ft5506_data },
 	{ .name = "ev-ft5726", .driver_data = (long)&edt_ft5506_data },
 	/* Note no edt- prefix for compatibility with the ft6236.c driver */
 	{ .name = "ft6236", .driver_data = (long)&edt_ft6236_data },
+	{ .name = "dfr0550", .driver_data = (long)&edt_dfr0550_data },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(i2c, edt_ft5x06_ts_id);
@@ -1441,6 +1489,7 @@ static const struct of_device_id edt_ft5x06_of_match[] = {
 	{ .compatible = "evervision,ev-ft5726", .data = &edt_ft5506_data },
 	/* Note focaltech vendor prefix for compatibility with ft6236.c */
 	{ .compatible = "focaltech,ft6236", .data = &edt_ft6236_data },
+	{ .compatible = "dfr,dfr0550", .data = &edt_dfr0550_data },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, edt_ft5x06_of_match);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [RFC PATCH 4/4] input: edt-ft5x06 - Handle unreliable TOUCH_UP events
  2021-12-16 23:30 [RFC PATCH 0/4] input: edt-ft5x06: add support for DFROBOT touch controller to Tim Harvey
                   ` (2 preceding siblings ...)
  2021-12-16 23:30 ` [RFC PATCH 3/4] input: edt-ft5x06 - add support for DFROBOT touch controllers Tim Harvey
@ 2021-12-16 23:30 ` Tim Harvey
  2022-01-21 17:24 ` [RFC PATCH 0/4] input: edt-ft5x06: add support for DFROBOT touch controller to Tim Harvey
  4 siblings, 0 replies; 7+ messages in thread
From: Tim Harvey @ 2021-12-16 23:30 UTC (permalink / raw)
  To: linux-input, Rob Herring, Dmitry Torokhov; +Cc: Tim Harvey, Dave Stevenson

The ft5x06 is unreliable in sending touch up events, so some
touch IDs can become stuck in the detected state.

Ensure that IDs that are unreported by the controller are
released.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
 drivers/input/touchscreen/edt-ft5x06.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index a3622d6e8e65..53906fcbaa51 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -126,6 +126,7 @@ struct edt_ft5x06_ts_data {
 	int offset_y;
 	int report_rate;
 	int max_support_points;
+	unsigned int known_ids;
 
 	char name[EDT_NAME_LEN];
 
@@ -198,6 +199,8 @@ static void edt_ft5x06_process(struct edt_ft5x06_ts_data *tsdata)
 	int offset, tplen, datalen, crclen;
 	int error;
 	int num_points;
+	unsigned int active_ids = 0, known_ids = tsdata->known_ids;
+	long released_ids;
 
 	switch (tsdata->version) {
 	case EDT_M06:
@@ -297,10 +300,21 @@ static void edt_ft5x06_process(struct edt_ft5x06_ts_data *tsdata)
 
 		input_mt_slot(tsdata->input, id);
 		if (input_mt_report_slot_state(tsdata->input, MT_TOOL_FINGER,
-					       type != TOUCH_EVENT_UP))
+					       type != TOUCH_EVENT_UP)) {
 			touchscreen_report_pos(tsdata->input, &tsdata->prop,
 					       x, y, true);
+			active_ids |= BIT(id);
+		} else {
+			known_ids &= ~BIT(id);
+		}
+	}
+
+	released_ids = known_ids & ~active_ids;
+	for_each_set_bit_from(i, &released_ids, tsdata->max_support_points) {
+		input_mt_slot(tsdata->input, i);
+		input_mt_report_slot_inactive(tsdata->input);
 	}
+	tsdata->known_ids = active_ids;
 
 	input_mt_report_pointer_emulation(tsdata->input, true);
 	input_sync(tsdata->input);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH 1/4] dt-bindings: input: touchscreen: edt-ft5x06: add poll-interval
  2021-12-16 23:30 ` [RFC PATCH 1/4] dt-bindings: input: touchscreen: edt-ft5x06: add poll-interval Tim Harvey
@ 2021-12-17 14:53   ` Rob Herring
  0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2021-12-17 14:53 UTC (permalink / raw)
  To: Tim Harvey; +Cc: Linux Input, Dmitry Torokhov, Nicolas Saenz Julienne

On Thu, Dec 16, 2021 at 5:30 PM Tim Harvey <tharvey@gateworks.com> wrote:
>

Please CC the DT list.

> Some devices might not provide an interrupt line for the touchscreen.
> In that case the driver defaults to using a polled interface.
>
> Cc: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> ---
>  .../devicetree/bindings/input/touchscreen/edt-ft5x06.yaml   | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.yaml b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.yaml
> index 2e8da7470513..a0d4dabf03b8 100644
> --- a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.yaml
> +++ b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.yaml
> @@ -47,6 +47,11 @@ properties:
>    interrupts:
>      maxItems: 1
>
> +  poll-interval:
> +    description: Poll interval time in milliseconds, only relevant if no
> +                 interrupt was provided.
> +    $ref: /schemas/types.yaml#/definitions/uint32

Reference input.yaml so we aren't redefining this property.

> +
>    reset-gpios:
>      maxItems: 1
>
> @@ -99,7 +104,6 @@ additionalProperties: false
>  required:
>    - compatible
>    - reg
> -  - interrupts
>
>  examples:
>    - |
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH 0/4] input: edt-ft5x06: add support for DFROBOT touch controller to
  2021-12-16 23:30 [RFC PATCH 0/4] input: edt-ft5x06: add support for DFROBOT touch controller to Tim Harvey
                   ` (3 preceding siblings ...)
  2021-12-16 23:30 ` [RFC PATCH 4/4] input: edt-ft5x06 - Handle unreliable TOUCH_UP events Tim Harvey
@ 2022-01-21 17:24 ` Tim Harvey
  4 siblings, 0 replies; 7+ messages in thread
From: Tim Harvey @ 2022-01-21 17:24 UTC (permalink / raw)
  To: linux-input, Rob Herring, Dmitry Torokhov

On Thu, Dec 16, 2021 at 3:30 PM Tim Harvey <tharvey@gateworks.com> wrote:
>
> The DFROBOT DFR0678 [1] and DFR0550 [2] touchscreen displays are meant
> to be compatible with the official RaspberryPi 7in display. However
> instead of directly conntecting the FT5x06 touch controller to the I2C
> bus going to the host processor they route it through an MCU and emulate
> a virtual FT5x06 controller but don't do a very good job at it. The
> method the RaspberryPi firmware used to read the touch data is supported
> (which consists of reading R2 to get the number of touch points, then
> reading 4 bytes of data for each point in discrete I2C transactions. If
> you try to use the FT5x06 driver which reads all registers starting at
> R0 at once you will get invalid point data.
>
> Additionally the RaspberryPi displays like these do not have a touch
> controller IRQ so polling mode has to be added.
>
> Also additionally these controllers do not appear to send UP events so
> an additional patch slightly modified from the raspberry-pi kernel is used
> to  track ID's and report up events.
>
> I'm sending this series as an RFC as I'm not really clear if this is the
> best approach vs just adding a new touchscreen driver (which I have
> prepared and will probably send in another RFC).
>
> Tim
> [1] - https://www.dfrobot.com/product-2193.html
> [2] - https://www.dfrobot.com/product-1784.html
>
> Tim Harvey (4):
>   dt-bindings: input: touchscreen: edt-ft5x06: add poll-interval
>   input: edt-ft5x06 - add polled input support
>   input: edt-ft5x06 - add support for DFROBOT touch controllers
>   input: edt-ft5x06 - Handle unreliable TOUCH_UP events
>
>  .../input/touchscreen/edt-ft5x06.yaml         |   7 +-
>  drivers/input/touchscreen/edt-ft5x06.c        | 144 ++++++++++++++----
>  2 files changed, 123 insertions(+), 28 deletions(-)
>
> --

Any feedback on this?

The other approach I posted an RFC series for was to add a completely
new driver [1]

Best regards,

Tim
[1] https://patchwork.kernel.org/project/linux-input/list/?series=596975

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-01-21 17:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-16 23:30 [RFC PATCH 0/4] input: edt-ft5x06: add support for DFROBOT touch controller to Tim Harvey
2021-12-16 23:30 ` [RFC PATCH 1/4] dt-bindings: input: touchscreen: edt-ft5x06: add poll-interval Tim Harvey
2021-12-17 14:53   ` Rob Herring
2021-12-16 23:30 ` [RFC PATCH 2/4] input: edt-ft5x06 - add polled input support Tim Harvey
2021-12-16 23:30 ` [RFC PATCH 3/4] input: edt-ft5x06 - add support for DFROBOT touch controllers Tim Harvey
2021-12-16 23:30 ` [RFC PATCH 4/4] input: edt-ft5x06 - Handle unreliable TOUCH_UP events Tim Harvey
2022-01-21 17:24 ` [RFC PATCH 0/4] input: edt-ft5x06: add support for DFROBOT touch controller to Tim Harvey

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.