devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] dt-bindings: input: touchscreen: add bindings for eeti touchscreen controller
@ 2018-06-17 11:46 Daniel Mack
  2018-06-17 11:46 ` [PATCH 2/5] input: touchscreen: eeti: add device tree matching table Daniel Mack
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Daniel Mack @ 2018-06-17 11:46 UTC (permalink / raw)
  To: dmitry.torokhov, robh+dt; +Cc: linux-input, devicetree, Daniel Mack

Describe the bindings for EETI touchscreen controllers.

Signed-off-by: Daniel Mack <daniel@zonque.org>
---
 .../bindings/input/touchscreen/eeti.txt       | 31 +++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/eeti.txt

diff --git a/Documentation/devicetree/bindings/input/touchscreen/eeti.txt b/Documentation/devicetree/bindings/input/touchscreen/eeti.txt
new file mode 100644
index 000000000000..735e75db023f
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/touchscreen/eeti.txt
@@ -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
+
+
+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>;
+	};
+};
+
-- 
2.17.1

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

* [PATCH 2/5] input: touchscreen: eeti: add device tree matching table
  2018-06-17 11:46 [PATCH 1/5] dt-bindings: input: touchscreen: add bindings for eeti touchscreen controller Daniel Mack
@ 2018-06-17 11:46 ` Daniel Mack
  2018-06-17 11:46 ` [PATCH 3/5] input: touchscreen: eeti: add support for DT properties to flip screen Daniel Mack
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Daniel Mack @ 2018-06-17 11:46 UTC (permalink / raw)
  To: dmitry.torokhov, robh+dt; +Cc: linux-input, devicetree, Daniel Mack

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

Signed-off-by: Daniel Mack <daniel@zonque.org>
---
 drivers/input/touchscreen/eeti_ts.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c
index 2facad75eb6d..cc4fd33f9d6d 100644
--- a/drivers/input/touchscreen/eeti_ts.c
+++ b/drivers/input/touchscreen/eeti_ts.c
@@ -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,
-- 
2.17.1

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

* [PATCH 3/5] input: touchscreen: eeti: add support for DT properties to flip screen
  2018-06-17 11:46 [PATCH 1/5] dt-bindings: input: touchscreen: add bindings for eeti touchscreen controller Daniel Mack
  2018-06-17 11:46 ` [PATCH 2/5] input: touchscreen: eeti: add device tree matching table Daniel Mack
@ 2018-06-17 11:46 ` Daniel Mack
  2018-06-22 18:59   ` Dmitry Torokhov
  2018-06-17 11:46 ` [PATCH 4/5] input: touchscreen: eeti: fix link to documentation in header Daniel Mack
  2018-06-17 11:46 ` [PATCH 5/5] input: touchscreen: eeti: update email address Daniel Mack
  3 siblings, 1 reply; 7+ messages in thread
From: Daniel Mack @ 2018-06-17 11:46 UTC (permalink / raw)
  To: dmitry.torokhov, robh+dt; +Cc: linux-input, devicetree, Daniel Mack

Use touchscreen_parse_properties() to automatically set some of the common
touchscreen properties. Also make flip_x and flip_y members of the private
device context and allow setting them through both the module parameters and
devicetree properties.

Signed-off-by: Daniel Mack <daniel@zonque.org>
---
 drivers/input/touchscreen/eeti_ts.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c
index cc4fd33f9d6d..e7fade1a895c 100644
--- a/drivers/input/touchscreen/eeti_ts.c
+++ b/drivers/input/touchscreen/eeti_ts.c
@@ -28,6 +28,7 @@
 #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>
@@ -48,6 +49,7 @@ struct eeti_ts {
 	struct i2c_client *client;
 	struct input_dev *input;
 	struct gpio_desc *attn_gpio;
+	bool flip_x, flip_y;
 	bool running;
 };
 
@@ -74,10 +76,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)
+	if (eeti->flip_x)
 		x = EETI_MAXVAL - x;
 
-	if (flip_y)
+	if (eeti->flip_y)
 		y = EETI_MAXVAL - y;
 
 	if (buf[0] & REPORT_BIT_HAS_PRESSURE)
@@ -149,6 +151,7 @@ static void eeti_ts_close(struct input_dev *dev)
 static int eeti_ts_probe(struct i2c_client *client,
 			 const struct i2c_device_id *idp)
 {
+	struct touchscreen_properties props;
 	struct device *dev = &client->dev;
 	struct eeti_ts *eeti;
 	struct input_dev *input;
@@ -179,6 +182,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, &props);
+
 	input->name = client->name;
 	input->id.bustype = BUS_I2C;
 	input->open = eeti_ts_open;
@@ -187,6 +192,9 @@ static int eeti_ts_probe(struct i2c_client *client,
 	eeti->client = client;
 	eeti->input = input;
 
+	eeti->flip_x = flip_x || props.invert_x;
+	eeti->flip_y = flip_y || props.invert_y;
+
 	eeti->attn_gpio = devm_gpiod_get_optional(dev, "attn", GPIOD_IN);
 	if (IS_ERR(eeti->attn_gpio))
 		return PTR_ERR(eeti->attn_gpio);
-- 
2.17.1

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

* [PATCH 4/5] input: touchscreen: eeti: fix link to documentation in header
  2018-06-17 11:46 [PATCH 1/5] dt-bindings: input: touchscreen: add bindings for eeti touchscreen controller Daniel Mack
  2018-06-17 11:46 ` [PATCH 2/5] input: touchscreen: eeti: add device tree matching table Daniel Mack
  2018-06-17 11:46 ` [PATCH 3/5] input: touchscreen: eeti: add support for DT properties to flip screen Daniel Mack
@ 2018-06-17 11:46 ` Daniel Mack
  2018-06-17 11:46 ` [PATCH 5/5] input: touchscreen: eeti: update email address Daniel Mack
  3 siblings, 0 replies; 7+ messages in thread
From: Daniel Mack @ 2018-06-17 11:46 UTC (permalink / raw)
  To: dmitry.torokhov, robh+dt; +Cc: linux-input, devicetree, Daniel Mack

Keep this up-to-date in case anybody need to dive into the documentation
again.

Signed-off-by: Daniel Mack <daniel@zonque.org>
---
 drivers/input/touchscreen/eeti_ts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c
index e7fade1a895c..0c1092fb4955 100644
--- a/drivers/input/touchscreen/eeti_ts.c
+++ b/drivers/input/touchscreen/eeti_ts.c
@@ -3,7 +3,7 @@
  *   Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
  *
  * 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
-- 
2.17.1

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

* [PATCH 5/5] input: touchscreen: eeti: update email address
  2018-06-17 11:46 [PATCH 1/5] dt-bindings: input: touchscreen: add bindings for eeti touchscreen controller Daniel Mack
                   ` (2 preceding siblings ...)
  2018-06-17 11:46 ` [PATCH 4/5] input: touchscreen: eeti: fix link to documentation in header Daniel Mack
@ 2018-06-17 11:46 ` Daniel Mack
  3 siblings, 0 replies; 7+ messages in thread
From: Daniel Mack @ 2018-06-17 11:46 UTC (permalink / raw)
  To: dmitry.torokhov, robh+dt; +Cc: linux-input, devicetree, Daniel Mack

Update the email address in the header and in the module properties.

Signed-off-by: Daniel Mack <daniel@zonque.org>
---
 drivers/input/touchscreen/eeti_ts.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c
index 0c1092fb4955..51060299b06a 100644
--- a/drivers/input/touchscreen/eeti_ts.c
+++ b/drivers/input/touchscreen/eeti_ts.c
@@ -1,6 +1,6 @@
 /*
  * Touch Screen driver for EETI's I2C connected touch screen panels
- *   Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
+ *   Copyright (c) 2009,2018 Daniel Mack <daniel@zonque.org>
  *
  * See EETI's software guide for the protocol specification:
  *   http://home.eeti.com.tw/documentation.html
@@ -291,5 +291,5 @@ static struct i2c_driver eeti_ts_driver = {
 module_i2c_driver(eeti_ts_driver);
 
 MODULE_DESCRIPTION("EETI Touchscreen driver");
-MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>");
+MODULE_AUTHOR("Daniel Mack <daniel@zonque.org>");
 MODULE_LICENSE("GPL");
-- 
2.17.1

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

* Re: [PATCH 3/5] input: touchscreen: eeti: add support for DT properties to flip screen
  2018-06-17 11:46 ` [PATCH 3/5] input: touchscreen: eeti: add support for DT properties to flip screen Daniel Mack
@ 2018-06-22 18:59   ` Dmitry Torokhov
  2018-06-23 15:41     ` Daniel Mack
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Torokhov @ 2018-06-22 18:59 UTC (permalink / raw)
  To: Daniel Mack; +Cc: robh+dt, linux-input, devicetree

Hi Daniel,

On Sun, Jun 17, 2018 at 01:46:57PM +0200, Daniel Mack wrote:
> Use touchscreen_parse_properties() to automatically set some of the common
> touchscreen properties. Also make flip_x and flip_y members of the private
> device context and allow setting them through both the module parameters and
> devicetree properties.
> 
> Signed-off-by: Daniel Mack <daniel@zonque.org>
> ---
>  drivers/input/touchscreen/eeti_ts.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c
> index cc4fd33f9d6d..e7fade1a895c 100644
> --- a/drivers/input/touchscreen/eeti_ts.c
> +++ b/drivers/input/touchscreen/eeti_ts.c
> @@ -28,6 +28,7 @@
>  #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>
> @@ -48,6 +49,7 @@ struct eeti_ts {
>  	struct i2c_client *client;
>  	struct input_dev *input;
>  	struct gpio_desc *attn_gpio;
> +	bool flip_x, flip_y;
>  	bool running;
>  };
>  
> @@ -74,10 +76,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)
> +	if (eeti->flip_x)
>  		x = EETI_MAXVAL - x;
>  
> -	if (flip_y)
> +	if (eeti->flip_y)
>  		y = EETI_MAXVAL - y;
>  
>  	if (buf[0] & REPORT_BIT_HAS_PRESSURE)
> @@ -149,6 +151,7 @@ static void eeti_ts_close(struct input_dev *dev)
>  static int eeti_ts_probe(struct i2c_client *client,
>  			 const struct i2c_device_id *idp)
>  {
> +	struct touchscreen_properties props;
>  	struct device *dev = &client->dev;
>  	struct eeti_ts *eeti;
>  	struct input_dev *input;
> @@ -179,6 +182,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, &props);
> +
>  	input->name = client->name;
>  	input->id.bustype = BUS_I2C;
>  	input->open = eeti_ts_open;
> @@ -187,6 +192,9 @@ static int eeti_ts_probe(struct i2c_client *client,
>  	eeti->client = client;
>  	eeti->input = input;
>  
> +	eeti->flip_x = flip_x || props.invert_x;
> +	eeti->flip_y = flip_y || props.invert_y;

I would like to get rid completely of these module parameters. The only
user of this drover in mainline is arch/arm/mach-pxa/raumfeld.c and I do
not know how it is mounted there, but we can adjust with static board
properties if needed.

Can we please switch to not only touchscreen_parse_properties() but also
touchscreen_report_pos()?

> +
>  	eeti->attn_gpio = devm_gpiod_get_optional(dev, "attn", GPIOD_IN);
>  	if (IS_ERR(eeti->attn_gpio))
>  		return PTR_ERR(eeti->attn_gpio);
> -- 
> 2.17.1
> 

Thanks.

-- 
Dmitry

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

* Re: [PATCH 3/5] input: touchscreen: eeti: add support for DT properties to flip screen
  2018-06-22 18:59   ` Dmitry Torokhov
@ 2018-06-23 15:41     ` Daniel Mack
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Mack @ 2018-06-23 15:41 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: robh+dt, linux-input, devicetree

Hi Dmitry,

On Friday, June 22, 2018 08:59 PM, Dmitry Torokhov wrote:
> On Sun, Jun 17, 2018 at 01:46:57PM +0200, Daniel Mack wrote:
>> +	eeti->flip_x = flip_x || props.invert_x;
>> +	eeti->flip_y = flip_y || props.invert_y;
> 
> I would like to get rid completely of these module parameters. The only
> user of this drover in mainline is arch/arm/mach-pxa/raumfeld.c and I do
> not know how it is mounted there, but we can adjust with static board
> properties if needed.

Yeah, you're right. I know for a fact that this platform does not use 
the module parameters, so let's just drop them.

> Can we please switch to not only touchscreen_parse_properties() but also
> touchscreen_report_pos()?

Didn't know about this one. Nice. Will update the series and repost.


Thanks!
Daniel

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

end of thread, other threads:[~2018-06-23 15:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-17 11:46 [PATCH 1/5] dt-bindings: input: touchscreen: add bindings for eeti touchscreen controller Daniel Mack
2018-06-17 11:46 ` [PATCH 2/5] input: touchscreen: eeti: add device tree matching table Daniel Mack
2018-06-17 11:46 ` [PATCH 3/5] input: touchscreen: eeti: add support for DT properties to flip screen Daniel Mack
2018-06-22 18:59   ` Dmitry Torokhov
2018-06-23 15:41     ` Daniel Mack
2018-06-17 11:46 ` [PATCH 4/5] input: touchscreen: eeti: fix link to documentation in header Daniel Mack
2018-06-17 11:46 ` [PATCH 5/5] input: touchscreen: eeti: update email address Daniel Mack

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).