linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Feng Tang <feng.tang@intel.com>
To: dtor@mail.ru, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org, kwlee@mtekvision.com
Cc: joel.clark@intel.com, Feng Tang <feng.tang@intel.com>
Subject: [PATCH 2/2] Input: tsc2007 - Add a z1_low_threshhold platform data parameter
Date: Tue, 29 Nov 2011 16:12:58 +0800	[thread overview]
Message-ID: <1322554378-348-2-git-send-email-feng.tang@intel.com> (raw)
In-Reply-To: <1322554378-348-1-git-send-email-feng.tang@intel.com>

This originates from a patch in Meego IVI kernel with the name
	linux-2.6.37-connext-0027-tsc2007.patch
There is no author info excepte a line "From  MeeGo <kernel@meego.com>"

When integrating tsc2007 on Intel IVI platform, there are a lot of noise
data whose z1 value is around 10 which is not a sane "z1". So add
a "z1_low_threshhold" to filter those nosie data, to make the device work
properly.

Signed-off-by: Feng Tang <feng.tang@intel.com>
---
 drivers/input/touchscreen/tsc2007.c |    4 +++-
 include/linux/i2c/tsc2007.h         |    1 +
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c
index 789f216..1bf3503 100644
--- a/drivers/input/touchscreen/tsc2007.c
+++ b/drivers/input/touchscreen/tsc2007.c
@@ -72,6 +72,7 @@ struct tsc2007 {
 	u16			model;
 	u16			x_plate_ohms;
 	u16			max_rt;
+	u16			z1_low_threshhold;
 	unsigned long		poll_delay;
 	unsigned long		poll_period;
 
@@ -130,7 +131,7 @@ static u32 tsc2007_calculate_pressure(struct tsc2007 *tsc, struct ts_event *tc)
 	if (tc->x == MAX_12BIT)
 		tc->x = 0;
 
-	if (likely(tc->x && tc->z1)) {
+	if (likely(tc->x && tc->z1 > tsc->z1_low_threshhold)) {
 		/* compute touch pressure resistance using equation #1 */
 		rt = tc->z2 - tc->z1;
 		rt *= tc->x;
@@ -313,6 +314,7 @@ static int __devinit tsc2007_probe(struct i2c_client *client,
 	ts->model             = pdata->model;
 	ts->x_plate_ohms      = pdata->x_plate_ohms;
 	ts->max_rt            = pdata->max_rt ? : MAX_12BIT;
+	ts->z1_low_threshhold = pdata->z1_low_threshhold ? : 1;
 	ts->poll_delay        = pdata->poll_delay ? : 1;
 	ts->poll_period       = pdata->poll_period ? : 1;
 	ts->get_pendown_state = pdata->get_pendown_state;
diff --git a/include/linux/i2c/tsc2007.h b/include/linux/i2c/tsc2007.h
index 506a9f7..638c6c7 100644
--- a/include/linux/i2c/tsc2007.h
+++ b/include/linux/i2c/tsc2007.h
@@ -7,6 +7,7 @@ struct tsc2007_platform_data {
 	u16	model;				/* 2007. */
 	u16	x_plate_ohms;	/* must be non-zero value */
 	u16	max_rt; /* max. resistance above which samples are ignored */
+	u16	z1_low_threshhold; /* threshhold to prevent some noise data */
 	unsigned long poll_delay; /* delay (in ms) after pen-down event
 				     before polling starts */
 	unsigned long poll_period; /* time (in ms) between samples */
-- 
1.7.1

  reply	other threads:[~2011-11-29  8:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-29  8:12 [PATCH 1/2] Input: tsc2007 - Disable irq when the irq thread is handling data Feng Tang
2011-11-29  8:12 ` Feng Tang [this message]
2011-11-29  9:23   ` [PATCH 2/2] Input: tsc2007 - Add a z1_low_threshhold platform data parameter Dmitry Torokhov
2011-11-30  2:34     ` Feng Tang
2011-12-01  5:47       ` Dmitry Torokhov
2011-12-01  6:19         ` Feng Tang
2011-12-01  8:45           ` Dmitry Torokhov
2011-12-01  9:04             ` Feng Tang
2011-12-04  8:54               ` Dmitry Torokhov
2011-12-05  5:35                 ` Feng Tang
2011-12-26  3:16                   ` Feng Tang
2011-11-29  9:22 ` [PATCH 1/2] Input: tsc2007 - Disable irq when the irq thread is handling data Dmitry Torokhov
2011-11-30  2:08   ` Feng Tang
2011-12-01  6:10     ` Dmitry Torokhov
2011-12-01  6:30       ` Feng Tang
2011-12-01  8:48         ` Dmitry Torokhov
2011-12-01  9:00           ` Feng Tang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1322554378-348-2-git-send-email-feng.tang@intel.com \
    --to=feng.tang@intel.com \
    --cc=dtor@mail.ru \
    --cc=joel.clark@intel.com \
    --cc=kwlee@mtekvision.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).