All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv3 0/5] tsc2005 DT binding
@ 2014-04-25 23:56 ` Sebastian Reichel
  0 siblings, 0 replies; 21+ messages in thread
From: Sebastian Reichel @ 2014-04-25 23:56 UTC (permalink / raw)
  To: Sebastian Reichel, Dmitry Torokhov, Dmitry Torokhov, linux-input,
	Tony Lindgren, Rob Herring
  Cc: Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, devicetree,
	linux-omap, linux-kernel, Sebastian Reichel

Hi,

This adds device tree support for the tsc2005 touchscreen
controller, which is currently only used by the Nokia N900
board.

The patch does not update the reset pin handling for platform
data based probe to avoid merge conflicts. The n900 platform
code will be removed in the near future (3.16?) and the driver
can be simplified once that has happened.

Changes since v2 [0]:
 * rename "ti,x-plate-resistance" to "ti,x-plate-ohms", so that
   the same property name is used for tsc2005 and tsc2007
 * document "x-size" and "y-size" as deprecated form of
   touchscreen-size-x and touchscreen-size-y
 * add documentation for "touchscreen-inverted-x" and
   "touchscreen-inverted-y" to the common touchscreen binding
   and mark "x-invert" and "y-invert" as deprecated.
 * add units to the property descriptions in the common
   touchscreen binding Documentation
 * document "moving-threshold" as deprecated form of
   "touchscreen-fuzz-x" and "touchscreen-fuzz-y" combination
 * document "contact-threshold" as deprecated form of
   "touchscreen-fuzz-pressure"

[0] https://lkml.org/lkml/2014/4/5/103

-- Sebastian

Sebastian Reichel (5):
  Input: add common DT binding for touchscreens
  Input: tsc2005: use dev_err for error messages
  Input: tsc2005: convert driver to use devm_*
  Input: tsc2005: add DT support
  Documentation: dt: Document TSC2005 DT binding

 .../bindings/input/touchscreen/touchscreen.txt     |  27 +++++
 .../bindings/input/touchscreen/tsc2005.txt         |  39 +++++++
 drivers/input/input.c                              |  34 ++++++
 drivers/input/touchscreen/tsc2005.c                | 130 ++++++++++++++-------
 include/linux/input.h                              |   8 ++
 5 files changed, 197 insertions(+), 41 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/tsc2005.txt

-- 
1.9.2


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

* [PATCHv3 0/5] tsc2005 DT binding
@ 2014-04-25 23:56 ` Sebastian Reichel
  0 siblings, 0 replies; 21+ messages in thread
From: Sebastian Reichel @ 2014-04-25 23:56 UTC (permalink / raw)
  To: Sebastian Reichel, Dmitry Torokhov, Dmitry Torokhov,
	linux-input-u79uwXL29TY76Z2rM5mHXA, Tony Lindgren, Rob Herring
  Cc: Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Sebastian Reichel

Hi,

This adds device tree support for the tsc2005 touchscreen
controller, which is currently only used by the Nokia N900
board.

The patch does not update the reset pin handling for platform
data based probe to avoid merge conflicts. The n900 platform
code will be removed in the near future (3.16?) and the driver
can be simplified once that has happened.

Changes since v2 [0]:
 * rename "ti,x-plate-resistance" to "ti,x-plate-ohms", so that
   the same property name is used for tsc2005 and tsc2007
 * document "x-size" and "y-size" as deprecated form of
   touchscreen-size-x and touchscreen-size-y
 * add documentation for "touchscreen-inverted-x" and
   "touchscreen-inverted-y" to the common touchscreen binding
   and mark "x-invert" and "y-invert" as deprecated.
 * add units to the property descriptions in the common
   touchscreen binding Documentation
 * document "moving-threshold" as deprecated form of
   "touchscreen-fuzz-x" and "touchscreen-fuzz-y" combination
 * document "contact-threshold" as deprecated form of
   "touchscreen-fuzz-pressure"

[0] https://lkml.org/lkml/2014/4/5/103

-- Sebastian

Sebastian Reichel (5):
  Input: add common DT binding for touchscreens
  Input: tsc2005: use dev_err for error messages
  Input: tsc2005: convert driver to use devm_*
  Input: tsc2005: add DT support
  Documentation: dt: Document TSC2005 DT binding

 .../bindings/input/touchscreen/touchscreen.txt     |  27 +++++
 .../bindings/input/touchscreen/tsc2005.txt         |  39 +++++++
 drivers/input/input.c                              |  34 ++++++
 drivers/input/touchscreen/tsc2005.c                | 130 ++++++++++++++-------
 include/linux/input.h                              |   8 ++
 5 files changed, 197 insertions(+), 41 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/tsc2005.txt

-- 
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCHv3 1/5] Input: add common DT binding for touchscreens
  2014-04-25 23:56 ` Sebastian Reichel
  (?)
@ 2014-04-25 23:56 ` Sebastian Reichel
  2014-04-29  9:23   ` Pavel Machek
  2014-05-05 19:41   ` Tony Lindgren
  -1 siblings, 2 replies; 21+ messages in thread
From: Sebastian Reichel @ 2014-04-25 23:56 UTC (permalink / raw)
  To: Sebastian Reichel, Dmitry Torokhov, Dmitry Torokhov, linux-input,
	Tony Lindgren, Rob Herring
  Cc: Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, devicetree,
	linux-omap, linux-kernel, Sebastian Reichel

Add common DT binding documentation for touchscreen devices and
implement input_parse_touchscreen_of_params, which parses the common
properties and configures the input device accordingly.

The method currently does not interpret the axis inversion properties,
since there is no matching flag in the generic linux input device.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
---
 .../bindings/input/touchscreen/touchscreen.txt     | 27 +++++++++++++++++
 drivers/input/input.c                              | 34 ++++++++++++++++++++++
 include/linux/input.h                              |  8 +++++
 3 files changed, 69 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt

diff --git a/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
new file mode 100644
index 0000000..d8e0616
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
@@ -0,0 +1,27 @@
+General Touchscreen Properties:
+
+Optional properties for Touchscreens:
+ - touchscreen-size-x		: horizontal resolution of touchscreen
+				  (in pixels)
+ - touchscreen-size-y		: vertical resolution of touchscreen
+				  (in pixels)
+ - touchscreen-max-pressure	: maximum reported pressure (arbitrary range
+				  dependent on the controller)
+ - touchscreen-fuzz-x		: horizontal noise value of the absolute input
+				  device (in pixels)
+ - touchscreen-fuzz-y		: vertical noise value of the absolute input
+				  device (in pixels)
+ - touchscreen-fuzz-pressure	: pressure noise value of the absolute input
+				  device (arbitrary range dependent on the
+				  controller)
+ - touchscreen-inverted-x	: X axis is inverted (boolean)
+ - touchscreen-inverted-y	: Y axis is inverted (boolean)
+
+Deprecated properties for Touchscreens:
+ - x-size			: deprecated name for touchscreen-size-x
+ - y-size			: deprecated name for touchscreen-size-y
+ - moving-threshold		: deprecated name for a combination of
+				  touchscreen-fuzz-x and touchscreen-fuzz-y
+ - contact-threshold		: deprecated name for touchscreen-fuzz-pressure
+ - x-invert			: deprecated name for touchscreen-inverted-x
+ - y-invert			: deprecated name for touchscreen-inverted-y
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 1c4c0db..97966d93 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -27,6 +27,7 @@
 #include <linux/device.h>
 #include <linux/mutex.h>
 #include <linux/rcupdate.h>
+#include <linux/of.h>
 #include "input-compat.h"
 
 MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
@@ -2398,6 +2399,39 @@ void input_free_minor(unsigned int minor)
 }
 EXPORT_SYMBOL(input_free_minor);
 
+#if defined(CONFIG_OF)
+/**
+ * input_parse_touchscreen_of_params - parse common touchscreen DT properties
+ * @dev: device that should be parsed
+ *
+ * This function parses common DT properties for touchscreens and setups the
+ * input device accordingly. The function keeps previously setuped default
+ * values if no value is specified via DT.
+ */
+void input_parse_touchscreen_of_params(struct input_dev *dev)
+{
+	struct device_node *np = dev->dev.parent->of_node;
+	struct input_absinfo *absinfo;
+
+	input_alloc_absinfo(dev);
+	if (!dev->absinfo)
+		return;
+
+	absinfo = &dev->absinfo[ABS_X];
+	of_property_read_u32(np, "touchscreen-size-x", &absinfo->maximum);
+	of_property_read_u32(np, "touchscreen-fuzz-x", &absinfo->fuzz);
+
+	absinfo = &dev->absinfo[ABS_Y];
+	of_property_read_u32(np, "touchscreen-size-y", &absinfo->maximum);
+	of_property_read_u32(np, "touchscreen-fuzz-y", &absinfo->fuzz);
+
+	absinfo = &dev->absinfo[ABS_PRESSURE];
+	of_property_read_u32(np, "touchscreen-max-pressure", &absinfo->maximum);
+	of_property_read_u32(np, "touchscreen-fuzz-pressure", &absinfo->fuzz);
+}
+EXPORT_SYMBOL(input_parse_touchscreen_of_params);
+#endif
+
 static int __init input_init(void)
 {
 	int err;
diff --git a/include/linux/input.h b/include/linux/input.h
index 82ce323..3dc3b1e 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -531,4 +531,12 @@ int input_ff_erase(struct input_dev *dev, int effect_id, struct file *file);
 int input_ff_create_memless(struct input_dev *dev, void *data,
 		int (*play_effect)(struct input_dev *, void *, struct ff_effect *));
 
+#if defined(CONFIG_OF)
+void input_parse_touchscreen_of_params(struct input_dev *dev);
+#else
+static inline void input_parse_touchscreen_of_params(struct input_dev *dev) {
+	return;
+}
+#endif
+
 #endif
-- 
1.9.2


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

* [PATCHv3 2/5] Input: tsc2005: use dev_err for error messages
  2014-04-25 23:56 ` Sebastian Reichel
  (?)
  (?)
@ 2014-04-25 23:56 ` Sebastian Reichel
  2014-04-29  9:23   ` Pavel Machek
  2014-05-19  5:33   ` Dmitry Torokhov
  -1 siblings, 2 replies; 21+ messages in thread
From: Sebastian Reichel @ 2014-04-25 23:56 UTC (permalink / raw)
  To: Sebastian Reichel, Dmitry Torokhov, Dmitry Torokhov, linux-input,
	Tony Lindgren, Rob Herring
  Cc: Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, devicetree,
	linux-omap, linux-kernel, Sebastian Reichel

Change some dev_dbg() invocations to dev_err() ones, because they
are supposed to output error messages.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
---
 drivers/input/touchscreen/tsc2005.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c
index 550adcb..520e673 100644
--- a/drivers/input/touchscreen/tsc2005.c
+++ b/drivers/input/touchscreen/tsc2005.c
@@ -579,7 +579,7 @@ static int tsc2005_probe(struct spi_device *spi)
 	int error;
 
 	if (!pdata) {
-		dev_dbg(&spi->dev, "no platform data\n");
+		dev_err(&spi->dev, "no platform data\n");
 		return -ENODEV;
 	}
 
@@ -591,7 +591,7 @@ static int tsc2005_probe(struct spi_device *spi)
 	max_p	= pdata->ts_pressure_max   ? : MAX_12BIT;
 
 	if (spi->irq <= 0) {
-		dev_dbg(&spi->dev, "no irq\n");
+		dev_err(&spi->dev, "no irq\n");
 		return -ENODEV;
 	}
 
-- 
1.9.2


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

* [PATCHv3 3/5] Input: tsc2005: convert driver to use devm_*
  2014-04-25 23:56 ` Sebastian Reichel
                   ` (2 preceding siblings ...)
  (?)
@ 2014-04-25 23:56 ` Sebastian Reichel
  2014-04-29  9:23   ` Pavel Machek
  2014-05-19  5:33   ` Dmitry Torokhov
  -1 siblings, 2 replies; 21+ messages in thread
From: Sebastian Reichel @ 2014-04-25 23:56 UTC (permalink / raw)
  To: Sebastian Reichel, Dmitry Torokhov, Dmitry Torokhov, linux-input,
	Tony Lindgren, Rob Herring
  Cc: Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, devicetree,
	linux-omap, linux-kernel, Sebastian Reichel

Simplify the driver by using managed resources for memory allocation of
internal struct, input device allocation and irq request.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
---
 drivers/input/touchscreen/tsc2005.c | 30 ++++++++++--------------------
 1 file changed, 10 insertions(+), 20 deletions(-)

diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c
index 520e673..9daaddd 100644
--- a/drivers/input/touchscreen/tsc2005.c
+++ b/drivers/input/touchscreen/tsc2005.c
@@ -604,12 +604,10 @@ static int tsc2005_probe(struct spi_device *spi)
 	if (error)
 		return error;
 
-	ts = kzalloc(sizeof(*ts), GFP_KERNEL);
-	input_dev = input_allocate_device();
-	if (!ts || !input_dev) {
-		error = -ENOMEM;
-		goto err_free_mem;
-	}
+	ts = devm_kzalloc(&spi->dev, sizeof(*ts), GFP_KERNEL);
+	input_dev = devm_input_allocate_device(&spi->dev);
+	if (!ts || !input_dev)
+		return -ENOMEM;
 
 	ts->spi = spi;
 	ts->idev = input_dev;
@@ -649,12 +647,13 @@ static int tsc2005_probe(struct spi_device *spi)
 	/* Ensure the touchscreen is off */
 	tsc2005_stop_scan(ts);
 
-	error = request_threaded_irq(spi->irq, NULL, tsc2005_irq_thread,
-				     IRQF_TRIGGER_RISING | IRQF_ONESHOT,
-				     "tsc2005", ts);
+	error = devm_request_threaded_irq(&spi->dev, spi->irq, NULL,
+					  tsc2005_irq_thread,
+					  IRQF_TRIGGER_RISING | IRQF_ONESHOT,
+					  "tsc2005", ts);
 	if (error) {
 		dev_err(&spi->dev, "Failed to request irq, err: %d\n", error);
-		goto err_free_mem;
+		return error;
 	}
 
 	spi_set_drvdata(spi, ts);
@@ -662,7 +661,7 @@ static int tsc2005_probe(struct spi_device *spi)
 	if (error) {
 		dev_err(&spi->dev,
 			"Failed to create sysfs attributes, err: %d\n", error);
-		goto err_clear_drvdata;
+		return error;
 	}
 
 	error = input_register_device(ts->idev);
@@ -677,11 +676,6 @@ static int tsc2005_probe(struct spi_device *spi)
 
 err_remove_sysfs:
 	sysfs_remove_group(&spi->dev.kobj, &tsc2005_attr_group);
-err_clear_drvdata:
-	free_irq(spi->irq, ts);
-err_free_mem:
-	input_free_device(input_dev);
-	kfree(ts);
 	return error;
 }
 
@@ -691,10 +685,6 @@ static int tsc2005_remove(struct spi_device *spi)
 
 	sysfs_remove_group(&ts->spi->dev.kobj, &tsc2005_attr_group);
 
-	free_irq(ts->spi->irq, ts);
-	input_unregister_device(ts->idev);
-	kfree(ts);
-
 	return 0;
 }
 
-- 
1.9.2


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

* [PATCHv3 4/5] Input: tsc2005: add DT support
  2014-04-25 23:56 ` Sebastian Reichel
                   ` (3 preceding siblings ...)
  (?)
@ 2014-04-25 23:56 ` Sebastian Reichel
  2014-04-29  9:24   ` Pavel Machek
  -1 siblings, 1 reply; 21+ messages in thread
From: Sebastian Reichel @ 2014-04-25 23:56 UTC (permalink / raw)
  To: Sebastian Reichel, Dmitry Torokhov, Dmitry Torokhov, linux-input,
	Tony Lindgren, Rob Herring
  Cc: Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, devicetree,
	linux-omap, linux-kernel, Sebastian Reichel

This adds DT support to the tsc2005 touchscreen
driver.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
---
 drivers/input/touchscreen/tsc2005.c | 96 +++++++++++++++++++++++++++++--------
 1 file changed, 77 insertions(+), 19 deletions(-)

diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c
index 9daaddd..a83d1be 100644
--- a/drivers/input/touchscreen/tsc2005.c
+++ b/drivers/input/touchscreen/tsc2005.c
@@ -28,6 +28,8 @@
 #include <linux/interrupt.h>
 #include <linux/delay.h>
 #include <linux/pm.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/tsc2005.h>
 
@@ -100,6 +102,11 @@
 					 TSC2005_CFR2_AVG_7)
 
 #define MAX_12BIT			0xfff
+#define TSC2005_DEF_X_FUZZ		4
+#define TSC2005_DEF_Y_FUZZ		8
+#define TSC2005_DEF_P_FUZZ		2
+#define TSC2005_DEF_RESISTOR		280
+
 #define TSC2005_SPI_MAX_SPEED_HZ	10000000
 #define TSC2005_PENUP_TIME_MS		40
 
@@ -143,6 +150,7 @@ struct tsc2005 {
 
 	bool			pen_down;
 
+	int			reset_gpio;
 	void			(*set_reset)(bool enable);
 };
 
@@ -337,6 +345,14 @@ static void tsc2005_stop_scan(struct tsc2005 *ts)
 	tsc2005_cmd(ts, TSC2005_CMD_STOP);
 }
 
+static void tsc2005_set_reset(struct tsc2005 *ts, bool enable)
+{
+	if (ts->reset_gpio >= 0)
+		gpio_set_value(ts->reset_gpio, enable);
+	else if (ts->set_reset)
+		ts->set_reset(enable);
+}
+
 /* must be called with ts->mutex held */
 static void __tsc2005_disable(struct tsc2005 *ts)
 {
@@ -355,7 +371,7 @@ static void __tsc2005_enable(struct tsc2005 *ts)
 {
 	tsc2005_start_scan(ts);
 
-	if (ts->esd_timeout && ts->set_reset) {
+	if (ts->esd_timeout && (ts->set_reset || ts->reset_gpio)) {
 		ts->last_valid_interrupt = jiffies;
 		schedule_delayed_work(&ts->esd_work,
 				round_jiffies_relative(
@@ -414,9 +430,9 @@ static ssize_t tsc2005_selftest_show(struct device *dev,
 	}
 
 	/* hardware reset */
-	ts->set_reset(false);
+	tsc2005_set_reset(ts, false);
 	usleep_range(100, 500); /* only 10us required */
-	ts->set_reset(true);
+	tsc2005_set_reset(ts, true);
 
 	if (!success)
 		goto out;
@@ -459,7 +475,7 @@ static umode_t tsc2005_attr_is_visible(struct kobject *kobj,
 	umode_t mode = attr->mode;
 
 	if (attr == &dev_attr_selftest.attr) {
-		if (!ts->set_reset)
+		if (!ts->set_reset && !ts->reset_gpio)
 			mode = 0;
 	}
 
@@ -509,9 +525,9 @@ static void tsc2005_esd_work(struct work_struct *work)
 
 	tsc2005_update_pen_state(ts, 0, 0, 0);
 
-	ts->set_reset(false);
+	tsc2005_set_reset(ts, false);
 	usleep_range(100, 500); /* only 10us required */
-	ts->set_reset(true);
+	tsc2005_set_reset(ts, true);
 
 	enable_irq(ts->spi->irq);
 	tsc2005_start_scan(ts);
@@ -572,29 +588,47 @@ static void tsc2005_setup_spi_xfer(struct tsc2005 *ts)
 static int tsc2005_probe(struct spi_device *spi)
 {
 	const struct tsc2005_platform_data *pdata = dev_get_platdata(&spi->dev);
+	struct device_node *np = spi->dev.of_node;
+
 	struct tsc2005 *ts;
 	struct input_dev *input_dev;
-	unsigned int max_x, max_y, max_p;
-	unsigned int fudge_x, fudge_y, fudge_p;
+	unsigned int max_x = MAX_12BIT;
+	unsigned int max_y = MAX_12BIT;
+	unsigned int max_p = MAX_12BIT;
+	unsigned int fudge_x = TSC2005_DEF_X_FUZZ;
+	unsigned int fudge_y = TSC2005_DEF_Y_FUZZ;
+	unsigned int fudge_p = TSC2005_DEF_P_FUZZ;
+	unsigned int x_plate_ohm = TSC2005_DEF_RESISTOR;
+	unsigned int esd_timeout;
 	int error;
 
-	if (!pdata) {
+	if (!np && !pdata) {
 		dev_err(&spi->dev, "no platform data\n");
 		return -ENODEV;
 	}
 
-	fudge_x	= pdata->ts_x_fudge	   ? : 4;
-	fudge_y	= pdata->ts_y_fudge	   ? : 8;
-	fudge_p	= pdata->ts_pressure_fudge ? : 2;
-	max_x	= pdata->ts_x_max	   ? : MAX_12BIT;
-	max_y	= pdata->ts_y_max	   ? : MAX_12BIT;
-	max_p	= pdata->ts_pressure_max   ? : MAX_12BIT;
-
 	if (spi->irq <= 0) {
 		dev_err(&spi->dev, "no irq\n");
 		return -ENODEV;
 	}
 
+	if (pdata) {
+		fudge_x	= pdata->ts_x_fudge;
+		fudge_y	= pdata->ts_y_fudge;
+		fudge_p	= pdata->ts_pressure_fudge;
+		max_x	= pdata->ts_x_max;
+		max_y	= pdata->ts_y_max;
+		max_p	= pdata->ts_pressure_max;
+		x_plate_ohm = pdata->ts_x_plate_ohm;
+		esd_timeout = pdata->esd_timeout_ms;
+	} else {
+		x_plate_ohm = TSC2005_DEF_RESISTOR;
+		of_property_read_u32(np, "ti,x-plate-ohms", &x_plate_ohm);
+		esd_timeout = 0;
+		of_property_read_u32(np, "ti,esd-recovery-timeout-ms",
+								&esd_timeout);
+	}
+
 	spi->mode = SPI_MODE_0;
 	spi->bits_per_word = 8;
 	if (!spi->max_speed_hz)
@@ -612,9 +646,30 @@ static int tsc2005_probe(struct spi_device *spi)
 	ts->spi = spi;
 	ts->idev = input_dev;
 
-	ts->x_plate_ohm	= pdata->ts_x_plate_ohm	? : 280;
-	ts->esd_timeout	= pdata->esd_timeout_ms;
-	ts->set_reset	= pdata->set_reset;
+	ts->x_plate_ohm = x_plate_ohm;
+	ts->esd_timeout	= esd_timeout;
+
+	if (np) {
+		ts->reset_gpio = of_get_named_gpio(np, "reset-gpios", 0);
+		if (ts->reset_gpio == -EPROBE_DEFER)
+			return ts->reset_gpio;
+		if (ts->reset_gpio < 0) {
+			dev_err(&spi->dev, "error acquiring reset gpio: %d\n",
+				ts->reset_gpio);
+			return ts->reset_gpio;
+		}
+
+		error = devm_gpio_request_one(&spi->dev, ts->reset_gpio, 0,
+					      "reset-gpios");
+		if (error) {
+			dev_err(&spi->dev, "error requesting reset gpio: %d\n",
+				error);
+			return error;
+		}
+	} else {
+		ts->reset_gpio = -1;
+		ts->set_reset = pdata->set_reset;
+	}
 
 	mutex_init(&ts->mutex);
 
@@ -639,6 +694,9 @@ static int tsc2005_probe(struct spi_device *spi)
 	input_set_abs_params(input_dev, ABS_Y, 0, max_y, fudge_y, 0);
 	input_set_abs_params(input_dev, ABS_PRESSURE, 0, max_p, fudge_p, 0);
 
+	if (np)
+		input_parse_touchscreen_of_params(input_dev);
+
 	input_dev->open = tsc2005_open;
 	input_dev->close = tsc2005_close;
 
-- 
1.9.2


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

* [PATCHv3 5/5] Documentation: dt: Document TSC2005 DT binding
  2014-04-25 23:56 ` Sebastian Reichel
                   ` (4 preceding siblings ...)
  (?)
@ 2014-04-25 23:56 ` Sebastian Reichel
  2014-04-29  9:23   ` Pavel Machek
  -1 siblings, 1 reply; 21+ messages in thread
From: Sebastian Reichel @ 2014-04-25 23:56 UTC (permalink / raw)
  To: Sebastian Reichel, Dmitry Torokhov, Dmitry Torokhov, linux-input,
	Tony Lindgren, Rob Herring
  Cc: Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, devicetree,
	linux-omap, linux-kernel, Sebastian Reichel

Add devicetree binding documentation for TSC2005 touchscreen.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
---
 .../bindings/input/touchscreen/tsc2005.txt         | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/tsc2005.txt

diff --git a/Documentation/devicetree/bindings/input/touchscreen/tsc2005.txt b/Documentation/devicetree/bindings/input/touchscreen/tsc2005.txt
new file mode 100644
index 0000000..663f8ab
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/touchscreen/tsc2005.txt
@@ -0,0 +1,39 @@
+* Texas Instruments tsc2005 touchscreen controller
+
+Required properties:
+ - compatible		      : "ti,tsc2005"
+ - reg			      : SPI device address
+ - spi-max-frequency	      : Maximal SPI speed
+ - interrupts		      : IRQ specifier
+ - reset-gpios		      : GPIO specifier
+
+Optional properties:
+ - ti,x-plate-ohms	      : integer, resistance of the touchscreen's X plates
+				in ohm (defaults to 280)
+ - ti,esd-recovery-timeout-ms : integer, if the touchscreen does not respond after
+				the configured time (in milli seconds), the driver
+				will reset it. This is disabled by default.
+ - properties defined in touchscreen.txt
+
+Example:
+
+&mcspi1 {
+	tsc2005@0 {
+		compatible = "ti,tsc2005";
+		spi-max-frequency = <6000000>;
+		reg = <0>;
+
+		reset-gpios = <&gpio4 8 GPIO_ACTIVE_HIGH>; /* 104 */
+		interrupts-extended = <&gpio4 4 IRQ_TYPE_NONE>; /* 100 */
+
+		touchscreen-fuzz-x = <4>;
+		touchscreen-fuzz-y = <7>;
+		touchscreen-fuzz-pressure = <2>;
+		touchscreen-max-x = <4096>;
+		touchscreen-max-y = <4096>;
+		touchscreen-max-pressure = <2048>;
+
+		ti,x-plate-ohms = <280>;
+		ti,esd-recovery-timeout-ms = <8000>;
+	};
+}
-- 
1.9.2


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

* Re: [PATCHv3 1/5] Input: add common DT binding for touchscreens
  2014-04-25 23:56 ` [PATCHv3 1/5] Input: add common DT binding for touchscreens Sebastian Reichel
@ 2014-04-29  9:23   ` Pavel Machek
  2014-05-05 19:41   ` Tony Lindgren
  1 sibling, 0 replies; 21+ messages in thread
From: Pavel Machek @ 2014-04-29  9:23 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Sebastian Reichel, Dmitry Torokhov, Dmitry Torokhov, linux-input,
	Tony Lindgren, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, devicetree, linux-omap, linux-kernel

On Sat 2014-04-26 01:56:15, Sebastian Reichel wrote:
> Add common DT binding documentation for touchscreen devices and
> implement input_parse_touchscreen_of_params, which parses the common
> properties and configures the input device accordingly.
> 
> The method currently does not interpret the axis inversion properties,
> since there is no matching flag in the generic linux input device.
> 
> Signed-off-by: Sebastian Reichel <sre@kernel.org>

Reviewed-by: Pavel Machek <pavel@ucw.cz>
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: [PATCHv3 2/5] Input: tsc2005: use dev_err for error messages
  2014-04-25 23:56 ` [PATCHv3 2/5] Input: tsc2005: use dev_err for error messages Sebastian Reichel
@ 2014-04-29  9:23   ` Pavel Machek
  2014-05-19  5:33   ` Dmitry Torokhov
  1 sibling, 0 replies; 21+ messages in thread
From: Pavel Machek @ 2014-04-29  9:23 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Sebastian Reichel, Dmitry Torokhov, Dmitry Torokhov, linux-input,
	Tony Lindgren, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, devicetree, linux-omap, linux-kernel

On Sat 2014-04-26 01:56:16, Sebastian Reichel wrote:
> Change some dev_dbg() invocations to dev_err() ones, because they
> are supposed to output error messages.
> 
> Signed-off-by: Sebastian Reichel <sre@kernel.org>

Reviewed-by: Pavel Machek <pavel@ucw.cz>
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: [PATCHv3 3/5] Input: tsc2005: convert driver to use devm_*
  2014-04-25 23:56 ` [PATCHv3 3/5] Input: tsc2005: convert driver to use devm_* Sebastian Reichel
@ 2014-04-29  9:23   ` Pavel Machek
  2014-05-19  5:33   ` Dmitry Torokhov
  1 sibling, 0 replies; 21+ messages in thread
From: Pavel Machek @ 2014-04-29  9:23 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Sebastian Reichel, Dmitry Torokhov, Dmitry Torokhov, linux-input,
	Tony Lindgren, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, devicetree, linux-omap, linux-kernel

On Sat 2014-04-26 01:56:17, Sebastian Reichel wrote:
> Simplify the driver by using managed resources for memory allocation of
> internal struct, input device allocation and irq request.
> 
> Signed-off-by: Sebastian Reichel <sre@kernel.org>

Reviewed-by: Pavel Machek <pavel@ucw.cz>

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: [PATCHv3 5/5] Documentation: dt: Document TSC2005 DT binding
  2014-04-25 23:56 ` [PATCHv3 5/5] Documentation: dt: Document TSC2005 DT binding Sebastian Reichel
@ 2014-04-29  9:23   ` Pavel Machek
  0 siblings, 0 replies; 21+ messages in thread
From: Pavel Machek @ 2014-04-29  9:23 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Sebastian Reichel, Dmitry Torokhov, Dmitry Torokhov, linux-input,
	Tony Lindgren, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, devicetree, linux-omap, linux-kernel

On Sat 2014-04-26 01:56:19, Sebastian Reichel wrote:
> Add devicetree binding documentation for TSC2005 touchscreen.
> 

Reviewed-by: Pavel Machek <pavel@ucw.cz>
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: [PATCHv3 4/5] Input: tsc2005: add DT support
  2014-04-25 23:56 ` [PATCHv3 4/5] Input: tsc2005: add DT support Sebastian Reichel
@ 2014-04-29  9:24   ` Pavel Machek
  0 siblings, 0 replies; 21+ messages in thread
From: Pavel Machek @ 2014-04-29  9:24 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Sebastian Reichel, Dmitry Torokhov, Dmitry Torokhov, linux-input,
	Tony Lindgren, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, devicetree, linux-omap, linux-kernel

On Sat 2014-04-26 01:56:18, Sebastian Reichel wrote:
> This adds DT support to the tsc2005 touchscreen
> driver.
> 
> Signed-off-by: Sebastian Reichel <sre@kernel.org>

> @@ -100,6 +102,11 @@
>  					 TSC2005_CFR2_AVG_7)
>  
>  #define MAX_12BIT			0xfff
> +#define TSC2005_DEF_X_FUZZ		4
> +#define TSC2005_DEF_Y_FUZZ		8
> +#define TSC2005_DEF_P_FUZZ		2
> +#define TSC2005_DEF_RESISTOR		280
> 

IMO using defines insteaed of plain numbers does not help readability much,
but ....

Reviewed-by: Pavel Machek <pavel@ucw.cz>


-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: [PATCHv3 1/5] Input: add common DT binding for touchscreens
  2014-04-25 23:56 ` [PATCHv3 1/5] Input: add common DT binding for touchscreens Sebastian Reichel
  2014-04-29  9:23   ` Pavel Machek
@ 2014-05-05 19:41   ` Tony Lindgren
  2014-05-05 19:51     ` Dmitry Torokhov
  1 sibling, 1 reply; 21+ messages in thread
From: Tony Lindgren @ 2014-05-05 19:41 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Sebastian Reichel, Dmitry Torokhov, Dmitry Torokhov, linux-input,
	Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	devicetree, linux-omap, linux-kernel

* Sebastian Reichel <sre@kernel.org> [140425 16:56]:
> Add common DT binding documentation for touchscreen devices and
> implement input_parse_touchscreen_of_params, which parses the common
> properties and configures the input device accordingly.
> 
> The method currently does not interpret the axis inversion properties,
> since there is no matching flag in the generic linux input device.
> 
> Signed-off-by: Sebastian Reichel <sre@kernel.org>
> ---
>  .../bindings/input/touchscreen/touchscreen.txt     | 27 +++++++++++++++++
>  drivers/input/input.c                              | 34 ++++++++++++++++++++++
>  include/linux/input.h                              |  8 +++++
>  3 files changed, 69 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
> 
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
> new file mode 100644
> index 0000000..d8e0616
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
> @@ -0,0 +1,27 @@
> +General Touchscreen Properties:
> +
> +Optional properties for Touchscreens:
> + - touchscreen-size-x		: horizontal resolution of touchscreen
> +				  (in pixels)
> + - touchscreen-size-y		: vertical resolution of touchscreen
> +				  (in pixels)
> + - touchscreen-max-pressure	: maximum reported pressure (arbitrary range
> +				  dependent on the controller)
> + - touchscreen-fuzz-x		: horizontal noise value of the absolute input
> +				  device (in pixels)
> + - touchscreen-fuzz-y		: vertical noise value of the absolute input
> +				  device (in pixels)
> + - touchscreen-fuzz-pressure	: pressure noise value of the absolute input
> +				  device (arbitrary range dependent on the
> +				  controller)
> + - touchscreen-inverted-x	: X axis is inverted (boolean)
> + - touchscreen-inverted-y	: Y axis is inverted (boolean)

We probably also need something to swap x and y depending on the
display orientation in addition to the touchscreen-inverted-x and y.
Just swapping x and y is not enough depending if we rotate by 270
degrees instead of 90 degrees.

Naturally that part can be added later.

Regards,

That 

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

* Re: [PATCHv3 1/5] Input: add common DT binding for touchscreens
  2014-05-05 19:41   ` Tony Lindgren
@ 2014-05-05 19:51     ` Dmitry Torokhov
  2014-05-05 20:12       ` Tony Lindgren
  2014-05-05 23:04       ` Sebastian Reichel
  0 siblings, 2 replies; 21+ messages in thread
From: Dmitry Torokhov @ 2014-05-05 19:51 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Sebastian Reichel, Sebastian Reichel, linux-input, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, devicetree,
	linux-omap, linux-kernel

On Mon, May 05, 2014 at 12:41:26PM -0700, Tony Lindgren wrote:
> * Sebastian Reichel <sre@kernel.org> [140425 16:56]:
> > Add common DT binding documentation for touchscreen devices and
> > implement input_parse_touchscreen_of_params, which parses the common
> > properties and configures the input device accordingly.
> > 
> > The method currently does not interpret the axis inversion properties,
> > since there is no matching flag in the generic linux input device.
> > 
> > Signed-off-by: Sebastian Reichel <sre@kernel.org>
> > ---
> >  .../bindings/input/touchscreen/touchscreen.txt     | 27 +++++++++++++++++
> >  drivers/input/input.c                              | 34 ++++++++++++++++++++++
> >  include/linux/input.h                              |  8 +++++
> >  3 files changed, 69 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
> > 
> > diff --git a/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
> > new file mode 100644
> > index 0000000..d8e0616
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
> > @@ -0,0 +1,27 @@
> > +General Touchscreen Properties:
> > +
> > +Optional properties for Touchscreens:
> > + - touchscreen-size-x		: horizontal resolution of touchscreen
> > +				  (in pixels)
> > + - touchscreen-size-y		: vertical resolution of touchscreen
> > +				  (in pixels)
> > + - touchscreen-max-pressure	: maximum reported pressure (arbitrary range
> > +				  dependent on the controller)
> > + - touchscreen-fuzz-x		: horizontal noise value of the absolute input
> > +				  device (in pixels)
> > + - touchscreen-fuzz-y		: vertical noise value of the absolute input
> > +				  device (in pixels)
> > + - touchscreen-fuzz-pressure	: pressure noise value of the absolute input
> > +				  device (arbitrary range dependent on the
> > +				  controller)

Fuzz seems like linux-specific property, not generic one.


> > + - touchscreen-inverted-x	: X axis is inverted (boolean)
> > + - touchscreen-inverted-y	: Y axis is inverted (boolean)
> 
> We probably also need something to swap x and y depending on the
> display orientation in addition to the touchscreen-inverted-x and y.
> Just swapping x and y is not enough depending if we rotate by 270
> degrees instead of 90 degrees.
> 
> Naturally that part can be added later.

So far we've been relying on upper layers (such as tslib) to perform
such transformations rather than re-implementing it in every driver. Are
we saying that we need to implement this in input core?

Thanks.

-- 
Dmitry

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

* Re: [PATCHv3 1/5] Input: add common DT binding for touchscreens
  2014-05-05 19:51     ` Dmitry Torokhov
@ 2014-05-05 20:12       ` Tony Lindgren
  2014-05-05 23:04       ` Sebastian Reichel
  1 sibling, 0 replies; 21+ messages in thread
From: Tony Lindgren @ 2014-05-05 20:12 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Sebastian Reichel, Sebastian Reichel, linux-input, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, devicetree,
	linux-omap, linux-kernel

* Dmitry Torokhov <dmitry.torokhov@gmail.com> [140505 12:52]:
> On Mon, May 05, 2014 at 12:41:26PM -0700, Tony Lindgren wrote:
> > * Sebastian Reichel <sre@kernel.org> [140425 16:56]:
> > > Add common DT binding documentation for touchscreen devices and
> > > implement input_parse_touchscreen_of_params, which parses the common
> > > properties and configures the input device accordingly.
> > > 
> > > The method currently does not interpret the axis inversion properties,
> > > since there is no matching flag in the generic linux input device.
> > > 
> > > Signed-off-by: Sebastian Reichel <sre@kernel.org>
> > > ---
> > >  .../bindings/input/touchscreen/touchscreen.txt     | 27 +++++++++++++++++
> > >  drivers/input/input.c                              | 34 ++++++++++++++++++++++
> > >  include/linux/input.h                              |  8 +++++
> > >  3 files changed, 69 insertions(+)
> > >  create mode 100644 Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
> > > 
> > > diff --git a/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
> > > new file mode 100644
> > > index 0000000..d8e0616
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
> > > @@ -0,0 +1,27 @@
> > > +General Touchscreen Properties:
> > > +
> > > +Optional properties for Touchscreens:
> > > + - touchscreen-size-x		: horizontal resolution of touchscreen
> > > +				  (in pixels)
> > > + - touchscreen-size-y		: vertical resolution of touchscreen
> > > +				  (in pixels)
> > > + - touchscreen-max-pressure	: maximum reported pressure (arbitrary range
> > > +				  dependent on the controller)
> > > + - touchscreen-fuzz-x		: horizontal noise value of the absolute input
> > > +				  device (in pixels)
> > > + - touchscreen-fuzz-y		: vertical noise value of the absolute input
> > > +				  device (in pixels)
> > > + - touchscreen-fuzz-pressure	: pressure noise value of the absolute input
> > > +				  device (arbitrary range dependent on the
> > > +				  controller)
> 
> Fuzz seems like linux-specific property, not generic one.
> 
> 
> > > + - touchscreen-inverted-x	: X axis is inverted (boolean)
> > > + - touchscreen-inverted-y	: Y axis is inverted (boolean)
> > 
> > We probably also need something to swap x and y depending on the
> > display orientation in addition to the touchscreen-inverted-x and y.
> > Just swapping x and y is not enough depending if we rotate by 270
> > degrees instead of 90 degrees.
> > 
> > Naturally that part can be added later.
> 
> So far we've been relying on upper layers (such as tslib) to perform
> such transformations rather than re-implementing it in every driver. Are
> we saying that we need to implement this in input core?

We seem to have that already partially implemented at least with
ti,swap-xy in Documentation/devicetree/bindings/input/ads7846.txt.

But that only works for the 90 degree rotation case as it's missing
something similar to touchscreen-inverted-x I just noticed few days
ago while trying to make some legacy code disappear :)

No idea where rotation should be specified. But if the panel is
rotated based on the DT property or kernel cmdline, probably the
touchscreen should be too? In most cases touchscreens are integrated
together with the LCD panel, and they are not separate like other
input devices.

Regards,

Tony

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

* Re: [PATCHv3 1/5] Input: add common DT binding for touchscreens
  2014-05-05 19:51     ` Dmitry Torokhov
  2014-05-05 20:12       ` Tony Lindgren
@ 2014-05-05 23:04       ` Sebastian Reichel
  2014-05-19  5:35         ` Dmitry Torokhov
  1 sibling, 1 reply; 21+ messages in thread
From: Sebastian Reichel @ 2014-05-05 23:04 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Tony Lindgren, linux-input, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, devicetree, linux-omap,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 3183 bytes --]

On Mon, May 05, 2014 at 12:51:39PM -0700, Dmitry Torokhov wrote:
> On Mon, May 05, 2014 at 12:41:26PM -0700, Tony Lindgren wrote:
> > * Sebastian Reichel <sre@kernel.org> [140425 16:56]:
> > > Add common DT binding documentation for touchscreen devices and
> > > implement input_parse_touchscreen_of_params, which parses the common
> > > properties and configures the input device accordingly.
> > > 
> > > The method currently does not interpret the axis inversion properties,
> > > since there is no matching flag in the generic linux input device.
> > > 
> > > Signed-off-by: Sebastian Reichel <sre@kernel.org>
> > > ---
> > >  .../bindings/input/touchscreen/touchscreen.txt     | 27 +++++++++++++++++
> > >  drivers/input/input.c                              | 34 ++++++++++++++++++++++
> > >  include/linux/input.h                              |  8 +++++
> > >  3 files changed, 69 insertions(+)
> > >  create mode 100644 Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
> > > 
> > > diff --git a/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
> > > new file mode 100644
> > > index 0000000..d8e0616
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
> > > @@ -0,0 +1,27 @@
> > > +General Touchscreen Properties:
> > > +
> > > +Optional properties for Touchscreens:
> > > + - touchscreen-size-x		: horizontal resolution of touchscreen
> > > +				  (in pixels)
> > > + - touchscreen-size-y		: vertical resolution of touchscreen
> > > +				  (in pixels)
> > > + - touchscreen-max-pressure	: maximum reported pressure (arbitrary range
> > > +				  dependent on the controller)
> > > + - touchscreen-fuzz-x		: horizontal noise value of the absolute input
> > > +				  device (in pixels)
> > > + - touchscreen-fuzz-y		: vertical noise value of the absolute input
> > > +				  device (in pixels)
> > > + - touchscreen-fuzz-pressure	: pressure noise value of the absolute input
> > > +				  device (arbitrary range dependent on the
> > > +				  controller)
> 
> Fuzz seems like linux-specific property, not generic one.

I don't know about the term "fuzz", but the idea is pretty generic
IMHO. It's similar to debouncing switches/buttons.

> > > + - touchscreen-inverted-x	: X axis is inverted (boolean)
> > > + - touchscreen-inverted-y	: Y axis is inverted (boolean)
> > 
> > We probably also need something to swap x and y depending on the
> > display orientation in addition to the touchscreen-inverted-x and y.
> > Just swapping x and y is not enough depending if we rotate by 270
> > degrees instead of 90 degrees.
> > 
> > Naturally that part can be added later.
> 
> So far we've been relying on upper layers (such as tslib) to perform
> such transformations rather than re-implementing it in every driver. Are
> we saying that we need to implement this in input core?

I would appreciate to add this later to move on with this patchset.
Having the N900's touchscreen working via DT in 3.16 would be nice
now that the display is working :)

-- Sebastian

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCHv3 0/5] tsc2005 DT binding
  2014-04-25 23:56 ` Sebastian Reichel
                   ` (5 preceding siblings ...)
  (?)
@ 2014-05-15 14:23 ` Sebastian Reichel
  2014-05-15 19:16   ` Aaro Koskinen
  -1 siblings, 1 reply; 21+ messages in thread
From: Sebastian Reichel @ 2014-05-15 14:23 UTC (permalink / raw)
  To: Dmitry Torokhov, Dmitry Torokhov, linux-input, Tony Lindgren,
	Rob Herring
  Cc: Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, devicetree,
	linux-omap, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 592 bytes --]

On Sat, Apr 26, 2014 at 01:56:14AM +0200, Sebastian Reichel wrote:
> This adds device tree support for the tsc2005 touchscreen
> controller, which is currently only used by the Nokia N900
> board.
> 
> The patch does not update the reset pin handling for platform
> data based probe to avoid merge conflicts. The n900 platform
> code will be removed in the near future (3.16?) and the driver
> can be simplified once that has happened.

Ping. It would be nice to see this patchset in 3.16, since its
the last important hardware component missing for N900 DT boot.

-- Sebastian

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCHv3 0/5] tsc2005 DT binding
  2014-05-15 14:23 ` [PATCHv3 0/5] tsc2005 " Sebastian Reichel
@ 2014-05-15 19:16   ` Aaro Koskinen
  0 siblings, 0 replies; 21+ messages in thread
From: Aaro Koskinen @ 2014-05-15 19:16 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Dmitry Torokhov, Dmitry Torokhov, linux-input, Tony Lindgren,
	Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	devicetree, linux-omap, linux-kernel

Hi,

On Thu, May 15, 2014 at 04:23:16PM +0200, Sebastian Reichel wrote:
> On Sat, Apr 26, 2014 at 01:56:14AM +0200, Sebastian Reichel wrote:
> > This adds device tree support for the tsc2005 touchscreen
> > controller, which is currently only used by the Nokia N900
> > board.
> > 
> > The patch does not update the reset pin handling for platform
> > data based probe to avoid merge conflicts. The n900 platform
> > code will be removed in the near future (3.16?) and the driver
> > can be simplified once that has happened.
> 
> Ping. It would be nice to see this patchset in 3.16, since its
> the last important hardware component missing for N900 DT boot.

FWIW, for all these patches feel free to add:

	Acked-by: Aaro Koskinen <aaro.koskinen@iki.fi>

Thanks for great work,

A.

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

* Re: [PATCHv3 2/5] Input: tsc2005: use dev_err for error messages
  2014-04-25 23:56 ` [PATCHv3 2/5] Input: tsc2005: use dev_err for error messages Sebastian Reichel
  2014-04-29  9:23   ` Pavel Machek
@ 2014-05-19  5:33   ` Dmitry Torokhov
  1 sibling, 0 replies; 21+ messages in thread
From: Dmitry Torokhov @ 2014-05-19  5:33 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Sebastian Reichel, linux-input, Tony Lindgren, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, devicetree,
	linux-omap, linux-kernel

On Sat, Apr 26, 2014 at 01:56:16AM +0200, Sebastian Reichel wrote:
> Change some dev_dbg() invocations to dev_err() ones, because they
> are supposed to output error messages.
> 
> Signed-off-by: Sebastian Reichel <sre@kernel.org>

Applied, thank you.

> ---
>  drivers/input/touchscreen/tsc2005.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c
> index 550adcb..520e673 100644
> --- a/drivers/input/touchscreen/tsc2005.c
> +++ b/drivers/input/touchscreen/tsc2005.c
> @@ -579,7 +579,7 @@ static int tsc2005_probe(struct spi_device *spi)
>  	int error;
>  
>  	if (!pdata) {
> -		dev_dbg(&spi->dev, "no platform data\n");
> +		dev_err(&spi->dev, "no platform data\n");
>  		return -ENODEV;
>  	}
>  
> @@ -591,7 +591,7 @@ static int tsc2005_probe(struct spi_device *spi)
>  	max_p	= pdata->ts_pressure_max   ? : MAX_12BIT;
>  
>  	if (spi->irq <= 0) {
> -		dev_dbg(&spi->dev, "no irq\n");
> +		dev_err(&spi->dev, "no irq\n");
>  		return -ENODEV;
>  	}
>  
> -- 
> 1.9.2
> 

-- 
Dmitry

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

* Re: [PATCHv3 3/5] Input: tsc2005: convert driver to use devm_*
  2014-04-25 23:56 ` [PATCHv3 3/5] Input: tsc2005: convert driver to use devm_* Sebastian Reichel
  2014-04-29  9:23   ` Pavel Machek
@ 2014-05-19  5:33   ` Dmitry Torokhov
  1 sibling, 0 replies; 21+ messages in thread
From: Dmitry Torokhov @ 2014-05-19  5:33 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Sebastian Reichel, linux-input, Tony Lindgren, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, devicetree,
	linux-omap, linux-kernel

On Sat, Apr 26, 2014 at 01:56:17AM +0200, Sebastian Reichel wrote:
> Simplify the driver by using managed resources for memory allocation of
> internal struct, input device allocation and irq request.
> 
> Signed-off-by: Sebastian Reichel <sre@kernel.org>

Applied, thank you.

> ---
>  drivers/input/touchscreen/tsc2005.c | 30 ++++++++++--------------------
>  1 file changed, 10 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c
> index 520e673..9daaddd 100644
> --- a/drivers/input/touchscreen/tsc2005.c
> +++ b/drivers/input/touchscreen/tsc2005.c
> @@ -604,12 +604,10 @@ static int tsc2005_probe(struct spi_device *spi)
>  	if (error)
>  		return error;
>  
> -	ts = kzalloc(sizeof(*ts), GFP_KERNEL);
> -	input_dev = input_allocate_device();
> -	if (!ts || !input_dev) {
> -		error = -ENOMEM;
> -		goto err_free_mem;
> -	}
> +	ts = devm_kzalloc(&spi->dev, sizeof(*ts), GFP_KERNEL);
> +	input_dev = devm_input_allocate_device(&spi->dev);
> +	if (!ts || !input_dev)
> +		return -ENOMEM;
>  
>  	ts->spi = spi;
>  	ts->idev = input_dev;
> @@ -649,12 +647,13 @@ static int tsc2005_probe(struct spi_device *spi)
>  	/* Ensure the touchscreen is off */
>  	tsc2005_stop_scan(ts);
>  
> -	error = request_threaded_irq(spi->irq, NULL, tsc2005_irq_thread,
> -				     IRQF_TRIGGER_RISING | IRQF_ONESHOT,
> -				     "tsc2005", ts);
> +	error = devm_request_threaded_irq(&spi->dev, spi->irq, NULL,
> +					  tsc2005_irq_thread,
> +					  IRQF_TRIGGER_RISING | IRQF_ONESHOT,
> +					  "tsc2005", ts);
>  	if (error) {
>  		dev_err(&spi->dev, "Failed to request irq, err: %d\n", error);
> -		goto err_free_mem;
> +		return error;
>  	}
>  
>  	spi_set_drvdata(spi, ts);
> @@ -662,7 +661,7 @@ static int tsc2005_probe(struct spi_device *spi)
>  	if (error) {
>  		dev_err(&spi->dev,
>  			"Failed to create sysfs attributes, err: %d\n", error);
> -		goto err_clear_drvdata;
> +		return error;
>  	}
>  
>  	error = input_register_device(ts->idev);
> @@ -677,11 +676,6 @@ static int tsc2005_probe(struct spi_device *spi)
>  
>  err_remove_sysfs:
>  	sysfs_remove_group(&spi->dev.kobj, &tsc2005_attr_group);
> -err_clear_drvdata:
> -	free_irq(spi->irq, ts);
> -err_free_mem:
> -	input_free_device(input_dev);
> -	kfree(ts);
>  	return error;
>  }
>  
> @@ -691,10 +685,6 @@ static int tsc2005_remove(struct spi_device *spi)
>  
>  	sysfs_remove_group(&ts->spi->dev.kobj, &tsc2005_attr_group);
>  
> -	free_irq(ts->spi->irq, ts);
> -	input_unregister_device(ts->idev);
> -	kfree(ts);
> -
>  	return 0;
>  }
>  
> -- 
> 1.9.2
> 

-- 
Dmitry

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

* Re: [PATCHv3 1/5] Input: add common DT binding for touchscreens
  2014-05-05 23:04       ` Sebastian Reichel
@ 2014-05-19  5:35         ` Dmitry Torokhov
  0 siblings, 0 replies; 21+ messages in thread
From: Dmitry Torokhov @ 2014-05-19  5:35 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Tony Lindgren, linux-input, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, devicetree, linux-omap,
	linux-kernel

On Tue, May 06, 2014 at 01:04:12AM +0200, Sebastian Reichel wrote:
> On Mon, May 05, 2014 at 12:51:39PM -0700, Dmitry Torokhov wrote:
> > On Mon, May 05, 2014 at 12:41:26PM -0700, Tony Lindgren wrote:
> > > * Sebastian Reichel <sre@kernel.org> [140425 16:56]:
> > > > Add common DT binding documentation for touchscreen devices and
> > > > implement input_parse_touchscreen_of_params, which parses the common
> > > > properties and configures the input device accordingly.
> > > > 
> > > > The method currently does not interpret the axis inversion properties,
> > > > since there is no matching flag in the generic linux input device.
> > > > 
> > > > Signed-off-by: Sebastian Reichel <sre@kernel.org>
> > > > ---
> > > >  .../bindings/input/touchscreen/touchscreen.txt     | 27 +++++++++++++++++
> > > >  drivers/input/input.c                              | 34 ++++++++++++++++++++++
> > > >  include/linux/input.h                              |  8 +++++
> > > >  3 files changed, 69 insertions(+)
> > > >  create mode 100644 Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
> > > > 
> > > > diff --git a/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
> > > > new file mode 100644
> > > > index 0000000..d8e0616
> > > > --- /dev/null
> > > > +++ b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
> > > > @@ -0,0 +1,27 @@
> > > > +General Touchscreen Properties:
> > > > +
> > > > +Optional properties for Touchscreens:
> > > > + - touchscreen-size-x		: horizontal resolution of touchscreen
> > > > +				  (in pixels)
> > > > + - touchscreen-size-y		: vertical resolution of touchscreen
> > > > +				  (in pixels)
> > > > + - touchscreen-max-pressure	: maximum reported pressure (arbitrary range
> > > > +				  dependent on the controller)
> > > > + - touchscreen-fuzz-x		: horizontal noise value of the absolute input
> > > > +				  device (in pixels)
> > > > + - touchscreen-fuzz-y		: vertical noise value of the absolute input
> > > > +				  device (in pixels)
> > > > + - touchscreen-fuzz-pressure	: pressure noise value of the absolute input
> > > > +				  device (arbitrary range dependent on the
> > > > +				  controller)
> > 
> > Fuzz seems like linux-specific property, not generic one.
> 
> I don't know about the term "fuzz", but the idea is pretty generic
> IMHO. It's similar to debouncing switches/buttons.

OK, fair enough.

> 
> > > > + - touchscreen-inverted-x	: X axis is inverted (boolean)
> > > > + - touchscreen-inverted-y	: Y axis is inverted (boolean)
> > > 
> > > We probably also need something to swap x and y depending on the
> > > display orientation in addition to the touchscreen-inverted-x and y.
> > > Just swapping x and y is not enough depending if we rotate by 270
> > > degrees instead of 90 degrees.
> > > 
> > > Naturally that part can be added later.
> > 
> > So far we've been relying on upper layers (such as tslib) to perform
> > such transformations rather than re-implementing it in every driver. Are
> > we saying that we need to implement this in input core?
> 
> I would appreciate to add this later to move on with this patchset.
> Having the N900's touchscreen working via DT in 3.16 would be nice
> now that the display is working :)
> 

Please remove the "inverted" bits and move touchscreen OF parsing into a
separate file/module, similarly to support for sparse and matrix keymaps
that we have - it does not really belong to input core.

Thanks.

-- 
Dmitry

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

end of thread, other threads:[~2014-05-19  5:35 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-25 23:56 [PATCHv3 0/5] tsc2005 DT binding Sebastian Reichel
2014-04-25 23:56 ` Sebastian Reichel
2014-04-25 23:56 ` [PATCHv3 1/5] Input: add common DT binding for touchscreens Sebastian Reichel
2014-04-29  9:23   ` Pavel Machek
2014-05-05 19:41   ` Tony Lindgren
2014-05-05 19:51     ` Dmitry Torokhov
2014-05-05 20:12       ` Tony Lindgren
2014-05-05 23:04       ` Sebastian Reichel
2014-05-19  5:35         ` Dmitry Torokhov
2014-04-25 23:56 ` [PATCHv3 2/5] Input: tsc2005: use dev_err for error messages Sebastian Reichel
2014-04-29  9:23   ` Pavel Machek
2014-05-19  5:33   ` Dmitry Torokhov
2014-04-25 23:56 ` [PATCHv3 3/5] Input: tsc2005: convert driver to use devm_* Sebastian Reichel
2014-04-29  9:23   ` Pavel Machek
2014-05-19  5:33   ` Dmitry Torokhov
2014-04-25 23:56 ` [PATCHv3 4/5] Input: tsc2005: add DT support Sebastian Reichel
2014-04-29  9:24   ` Pavel Machek
2014-04-25 23:56 ` [PATCHv3 5/5] Documentation: dt: Document TSC2005 DT binding Sebastian Reichel
2014-04-29  9:23   ` Pavel Machek
2014-05-15 14:23 ` [PATCHv3 0/5] tsc2005 " Sebastian Reichel
2014-05-15 19:16   ` Aaro Koskinen

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.