linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] touchscreen: tsc2007.c  x_plat_ohms must be > 0 for touch to  work
@ 2011-10-11 21:28 Philip Rakity
  2011-10-12  3:55 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Philip Rakity @ 2011-10-11 21:28 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input@vger.kernel.org

Touch events are not processed unless pressure > 0.
x_plat_ohms is used in pressure calculation.  ensure driver
will not start if zero value and indicate reason why there is
a failure

Signed-off-by: Philip Rakity <prakity@marvell.com>
---
 drivers/input/touchscreen/tsc2007.c |    6 ++++++
 include/linux/i2c/tsc2007.h         |    2 +-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c
index 0acca68..628261b 100644
--- a/drivers/input/touchscreen/tsc2007.c
+++ b/drivers/input/touchscreen/tsc2007.c
@@ -310,6 +310,12 @@ static int __devinit tsc2007_probe(struct i2c_client *client,
 	ts->get_pendown_state = pdata->get_pendown_state;
 	ts->clear_penirq      = pdata->clear_penirq;
 
+	if (pdata->x_plate_ohms == 0) {
+		dev_err(&client->dev, "pdata->x_plate_ohms must be > 0");
+		err = -EINVAL;
+		goto err_free_mem;
+	}
+
 	snprintf(ts->phys, sizeof(ts->phys),
 		 "%s/input0", dev_name(&client->dev));
 
diff --git a/include/linux/i2c/tsc2007.h b/include/linux/i2c/tsc2007.h
index 591427a..506a9f7 100644
--- a/include/linux/i2c/tsc2007.h
+++ b/include/linux/i2c/tsc2007.h
@@ -5,7 +5,7 @@
 
 struct tsc2007_platform_data {
 	u16	model;				/* 2007. */
-	u16	x_plate_ohms;
+	u16	x_plate_ohms;	/* must be non-zero value */
 	u16	max_rt; /* max. resistance above which samples are ignored */
 	unsigned long poll_delay; /* delay (in ms) after pen-down event
 				     before polling starts */
-- 
1.7.6



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

end of thread, other threads:[~2011-10-12  3:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-11 21:28 [PATCH] touchscreen: tsc2007.c x_plat_ohms must be > 0 for touch to work Philip Rakity
2011-10-12  3:55 ` Dmitry Torokhov

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).