From: "Richard Röjfors" <richard.rojfors@pelagicore.com>
To: linux-input@vger.kernel.org
Cc: dmitry.torokhov@gmail.com, kwangwoo.lee@gmail.com,
thierry.reding@avionic-design.de, soni.trilok@gmail.com
Subject: [PATCH] tsc2007: Add z1 lower threshold
Date: Fri, 11 Jun 2010 14:36:56 +0200 [thread overview]
Message-ID: <1276259816.12874.5.camel@debian> (raw)
There are hardware where the z1 value never reaches 0 even of the film
is not touch. This patch introduces a lower threshold which is useful
in these situations.
I also kernel doc:ed the platform data.
Signed-off-by: Richard Röjfors <richard.rojfors@pelagicore.com>
---
diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c
index be23780..fffa448 100644
--- a/drivers/input/touchscreen/tsc2007.c
+++ b/drivers/input/touchscreen/tsc2007.c
@@ -75,6 +75,7 @@ struct tsc2007 {
u16 model;
u16 x_plate_ohms;
+ u16 z1_low_threshold;
bool pendown;
int irq;
@@ -129,7 +130,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_threshold))) {
/* compute touch pressure resistance using equation #1 */
rt = tc->z2 - tc->z1;
rt *= tc->x;
@@ -292,6 +293,7 @@ static int __devinit tsc2007_probe(struct i2c_client *client,
ts->model = pdata->model;
ts->x_plate_ohms = pdata->x_plate_ohms;
+ ts->z1_low_threshold = pdata->z1_low_threshold;
ts->get_pendown_state = pdata->get_pendown_state;
ts->clear_penirq = pdata->clear_penirq;
diff --git a/include/linux/i2c/tsc2007.h b/include/linux/i2c/tsc2007.h
index c6361fb..75b75fb 100644
--- a/include/linux/i2c/tsc2007.h
+++ b/include/linux/i2c/tsc2007.h
@@ -3,13 +3,27 @@
/* linux/i2c/tsc2007.h */
+/**
+ * struct tsc2007_platform_data - Platform data of the TSC2007 driver
+ *
+ * @model: Touch controller model, currently 2003 or 2007.
+ * @x_plate_ohms: X-Plate resistance.
+ * @z1_low_threshold: All measured Z1 values below or equal to the threshold
+ * are regarded as 0.
+ * @get_pendown_state: Optional callback used to check if the film is touched.
+ * Can be useful since the pressure value can fluctuate for
+ * quite a while after lifting the pen.
+ * @clear_penirq: Optional callback clear 2nd level interrupt source.
+ * @init_platform_hw: Optional callback to initialise the hardware.
+ * @exit_platform_hw: Optional callback to de-initialise the hardware.
+ */
struct tsc2007_platform_data {
- u16 model; /* 2007. */
+ u16 model;
u16 x_plate_ohms;
+ u16 z1_low_threshold;
int (*get_pendown_state)(void);
- void (*clear_penirq)(void); /* If needed, clear 2nd level
- interrupt source */
+ void (*clear_penirq)(void);
int (*init_platform_hw)(void);
void (*exit_platform_hw)(void);
};
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
reply other threads:[~2010-06-11 12:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1276259816.12874.5.camel@debian \
--to=richard.rojfors@pelagicore.com \
--cc=dmitry.torokhov@gmail.com \
--cc=kwangwoo.lee@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=soni.trilok@gmail.com \
--cc=thierry.reding@avionic-design.de \
/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