From 81c26dbb0a88be3471f31db9aa8f25b639f32eea Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Fri, 15 Feb 2013 12:44:02 +1100 Subject: tsc2007 fixes. pressures is being reported inverted - fix that Signed-off-by: NeilBrown --- drivers/input/touchscreen/tsc2007.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c index 1473d23..c37c31e 100644 --- a/drivers/input/touchscreen/tsc2007.c +++ b/drivers/input/touchscreen/tsc2007.c @@ -130,13 +130,17 @@ 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 && tc->z2 > tc->z1)) { /* compute touch pressure resistance using equation #1 */ rt = tc->z2 - tc->z1; rt *= tc->x; +#if 0 rt *= tsc->x_plate_ohms; rt /= tc->z1; rt = (rt + 2047) >> 12; +#else + rt = (tc->z1 << (32-12)) / rt * 2048 / tsc->x_plate_ohms; +#endif } return rt; -- cgit v1.1