Skip to contentSkip to conversation

input: touchscreen: eeti: DT bindings and clean-ups

PATCH In review Daniel Mack 3 participants 8 messages Jun 23, 2018 – Jul 4, 2018

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

v2 cover input: touchscreen: eeti: DT bindings and clean-ups

This is v2 of the series that brings DT bindings to the eeti driver and cleans up the code a bit.

Changelog:

v1 → v2:
* dropped module parameters
* use touchscreen_report_pos() and drop some code for that
* squashes 4/5 and 5/5 of v1

Daniel Mack (4):
dt-bindings: input: touchscreen: add bindings for eeti touchscreen
controller
input: touchscreen: eeti: add device tree matching table
input: touchscreen: eeti: drop module parameters, parse DT properties
input: touchscreen: eeti: fix link to documentation and email address
in header

 .../bindings/input/touchscreen/eeti.txt       | 31 ++++++++++++++++
 drivers/input/touchscreen/eeti_ts.c           | 37 +++++++++----------
 2 files changed, 48 insertions(+), 20 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/eeti.txt
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/4 dt-bindings: input: touchscreen: add bindings for eeti touchscreen controller

Describe the bindings for EETI touchscreen controllers.

---
 .../bindings/input/touchscreen/eeti.txt       | 31 +++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/eeti.txt
Documentation/devicetree/bindings/input/touchscreen/eeti.txt new file +31 -0
new file mode 100644
index 000000000000..69c32c286ec7
@@ -0,0 +1,31 @@
+Bindings for EETI touchscreen controller
+
+Required properties:
+- compatible:	should be "eeti,exc3000-i2c"
+- reg:		I2C address of the chip. Should be set to <0xa>
+- interrupts:	interrupt to which the chip is connected
+
+Optional properties:
+- attn-gpios:	A handle to a GPIO to check whether interrupt is still
+		latched. This is necessary for platforms that lack
+		support for level-triggered IRQs.
+
+The following optional properties described in touchscreen.txt are
+also supported:
+
+- touchscreen-inverted-x
+- touchscreen-inverted-y
+- touchscreen-swapped-x-y
+
+Example:
+
+i2c-master {
+	touchscreen@a {
+		compatible = "eeti,exc3000-i2c";
+		reg = <0xa>;
+		interrupt-parent = <&gpio>;
+		interrupts = <123 IRQ_TYPE_EDGE_RISING>;
+		attn-gpios = <&gpio 123 GPIO_ACTIVE_HIGH>;
+	};
+};
+
Signature · 1 line
2.17.1
maintainer Reviewed-by on v2 1/4
#2 lore raw

Re: [PATCH v2 1/4] dt-bindings: input: touchscreen: add bindings for eeti touchscreen controller

Quoted 7 lines · Daniel Mack

Describe the bindings for EETI touchscreen controllers.

---
 .../bindings/input/touchscreen/eeti.txt       | 31 +++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/eeti.txt
#3 lore raw

PATCH v2 2/4 input: touchscreen: eeti: add device tree matching table

In reply to Daniel Mack

Provide a match table so that the driver can be used in devicetree setups. More properties are added in a later patch.

---
 drivers/input/touchscreen/eeti_ts.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/input/touchscreen/eeti_ts.c +9 -0
index 2facad75eb6d..cc4fd33f9d6d 100644
@@ -32,6 +32,7 @@
 #include <linux/i2c.h>
 #include <linux/timer.h>
 #include <linux/gpio/consumer.h>
+#include <linux/of.h>
 #include <linux/slab.h>
 #include <asm/unaligned.h>
 
@@ -262,10 +263,18 @@ static const struct i2c_device_id eeti_ts_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, eeti_ts_id);
 
+#ifdef CONFIG_OF
+static const struct of_device_id of_eeti_ts_match[] = {
+	{ .compatible = "eeti,exc3000-i2c", },
+	{ }
+};
+#endif
+
 static struct i2c_driver eeti_ts_driver = {
 	.driver = {
 		.name = "eeti_ts",
 		.pm = &eeti_ts_pm,
+		.of_match_table = of_match_ptr(of_eeti_ts_match),
 	},
 	.probe = eeti_ts_probe,
 	.id_table = eeti_ts_id,
Signature · 1 line
2.17.1
#4 lore raw

PATCH v2 3/4 input: touchscreen: eeti: drop module parameters, parse DT properties

In reply to Daniel Mack

The only user of this driver in mainline does not make use of the module parameters, so let's remove them. All properties for this driver should be set through DT or pdata.

Use touchscreen_parse_properties() to automatically set some of the common touchscreen properties and derive the axis inversion through that.

And finally, use touchscreen_report_pos() to handle the DT properties automatically instead of doing the inversion ourselves.

---
 drivers/input/touchscreen/eeti_ts.c | 22 +++++-----------------
 1 file changed, 5 insertions(+), 17 deletions(-)
drivers/input/touchscreen/eeti_ts.c +5 -17
index cc4fd33f9d6d..84561dfde7c4 100644
@@ -25,9 +25,9 @@
  */
 
 #include <linux/module.h>
-#include <linux/moduleparam.h>
 #include <linux/kernel.h>
 #include <linux/input.h>
+#include <linux/input/touchscreen.h>
 #include <linux/interrupt.h>
 #include <linux/i2c.h>
 #include <linux/timer.h>
@@ -36,18 +36,11 @@
 #include <linux/slab.h>
 #include <asm/unaligned.h>
 
-static bool flip_x;
-module_param(flip_x, bool, 0644);
-MODULE_PARM_DESC(flip_x, "flip x coordinate");
-
-static bool flip_y;
-module_param(flip_y, bool, 0644);
-MODULE_PARM_DESC(flip_y, "flip y coordinate");
-
 struct eeti_ts {
 	struct i2c_client *client;
 	struct input_dev *input;
 	struct gpio_desc *attn_gpio;
+	struct touchscreen_properties props;
 	bool running;
 };
 
@@ -74,17 +67,10 @@ static void eeti_ts_report_event(struct eeti_ts *eeti, u8 *buf)
 	x >>= res - EETI_TS_BITDEPTH;
 	y >>= res - EETI_TS_BITDEPTH;
 
-	if (flip_x)
-		x = EETI_MAXVAL - x;
-
-	if (flip_y)
-		y = EETI_MAXVAL - y;
-
 	if (buf[0] & REPORT_BIT_HAS_PRESSURE)
 		input_report_abs(eeti->input, ABS_PRESSURE, buf[5]);
 
-	input_report_abs(eeti->input, ABS_X, x);
-	input_report_abs(eeti->input, ABS_Y, y);
+	touchscreen_report_pos(eeti->input, &eeti->props, x, y, false);
 	input_report_key(eeti->input, BTN_TOUCH, buf[0] & REPORT_BIT_PRESSED);
 	input_sync(eeti->input);
 }
@@ -179,6 +165,8 @@ static int eeti_ts_probe(struct i2c_client *client,
 	input_set_abs_params(input, ABS_Y, 0, EETI_MAXVAL, 0, 0);
 	input_set_abs_params(input, ABS_PRESSURE, 0, 0xff, 0, 0);
 
+	touchscreen_parse_properties(input, false, &eeti->props);
+
 	input->name = client->name;
 	input->id.bustype = BUS_I2C;
 	input->open = eeti_ts_open;
Signature · 1 line
2.17.1
#5 lore raw

PATCH v2 4/4 input: touchscreen: eeti: fix link to documentation and email address in header

In reply to Daniel Mack

Keep the documentation link up-to-date in case anybody need to dive into it again, and update email address while at it.

---
 drivers/input/touchscreen/eeti_ts.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/input/touchscreen/eeti_ts.c +3 -3
index 84561dfde7c4..7fe41965c5d1 100644
@@ -1,9 +1,9 @@
 /*
  * Touch Screen driver for EETI's I2C connected touch screen panels
- *   Copyright (c) 2009 Daniel Mack <[email protected]>
+ *   Copyright (c) 2009,2018 Daniel Mack <[email protected]>
  *
  * See EETI's software guide for the protocol specification:
- *   http://home.eeti.com.tw/web20/eg/guide.htm
+ *   http://home.eeti.com.tw/documentation.html
  *
  * Based on migor_ts.c
  *   Copyright (c) 2008 Magnus Damm
@@ -271,5 +271,5 @@ static struct i2c_driver eeti_ts_driver = {
 module_i2c_driver(eeti_ts_driver);
 
 MODULE_DESCRIPTION("EETI Touchscreen driver");
-MODULE_AUTHOR("Daniel Mack <[email protected]>");
+MODULE_AUTHOR("Daniel Mack <[email protected]>");
 MODULE_LICENSE("GPL");
Signature · 1 line
2.17.1
#6 lore raw
In reply to Daniel Mack

Hi Dmitry,

Quoted 2 lines · Daniel Mack

This is v2 of the series that brings DT bindings to the eeti driver and cleans up the code a bit.

Is this set good to go in or should I repost it with Rob's Reviewed-by in 1/4?

Thanks,
Daniel

Quoted 21 lines

Changelog:

v1 → v2:
* dropped module parameters
* use touchscreen_report_pos() and drop some code for that
* squashes 4/5 and 5/5 of v1

Daniel Mack (4):
dt-bindings: input: touchscreen: add bindings for eeti touchscreen
controller
input: touchscreen: eeti: add device tree matching table
input: touchscreen: eeti: drop module parameters, parse DT properties
input: touchscreen: eeti: fix link to documentation and email address
in header

  .../bindings/input/touchscreen/eeti.txt       | 31 ++++++++++++++++
  drivers/input/touchscreen/eeti_ts.c           | 37 +++++++++----------
  2 files changed, 48 insertions(+), 20 deletions(-)

create mode 100644 Documentation/devicetree/bindings/input/touchscreen/eeti.txt

maintainer
#7 lore raw
Quoted 8 lines · Daniel Mack

Hi Dmitry,

Quoted 2 lines · Daniel Mack

This is v2 of the series that brings DT bindings to the eeti driver and cleans up the code a bit.

Is this set good to go in or should I repost it with Rob's Reviewed-by in 1/4?

No, I applied the lot, thanks.

Quoted 28 lines

Thanks,
Daniel

Quoted 21 lines

Changelog:

v1 → v2:
* dropped module parameters
* use touchscreen_report_pos() and drop some code for that
* squashes 4/5 and 5/5 of v1

Daniel Mack (4):
dt-bindings: input: touchscreen: add bindings for eeti touchscreen
controller
input: touchscreen: eeti: add device tree matching table
input: touchscreen: eeti: drop module parameters, parse DT properties
input: touchscreen: eeti: fix link to documentation and email address
in header

  .../bindings/input/touchscreen/eeti.txt       | 31 ++++++++++++++++
  drivers/input/touchscreen/eeti_ts.c           | 37 +++++++++----------
  2 files changed, 48 insertions(+), 20 deletions(-)

create mode 100644 Documentation/devicetree/bindings/input/touchscreen/eeti.txt

Signature · 1 line
Dmitry