Skip to content

Commit dec61ec

Browse files
fagleRobertCNelson
authored andcommitted
ti_am335x_tsc: correct formula code to calculate pressure; fix touchscreen jitter problem
1 parent f4616c9 commit dec61ec

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/input/touchscreen/ti_am335x_tsc.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#define ADCFSM_STEPID 0x10
3535
#define SEQ_SETTLE 275
3636
#define MAX_12BIT ((1 << 12) - 1)
37+
#define PRESSURE_MAX 1000
3738

3839
static const int config_pins[] = {
3940
STEPCONFIG_XPP,
@@ -231,6 +232,7 @@ static void titsc_read_coordinates(struct titsc *ts_dev,
231232
for (i = 0; i < creads; i++) {
232233
xvals[i] = titsc_readl(ts_dev, REG_FIFO0);
233234
xvals[i] &= 0xfff;
235+
pr_debug("i %d xval %d yval %d z1 %d z2 %d\n", i, xvals[i], yvals[i], *z1, *z2);
234236
}
235237

236238
/*
@@ -309,13 +311,13 @@ static irqreturn_t titsc_irq(int irq, void *dev)
309311
* Resistance(touch) = x plate resistance *
310312
* x postion/4096 * ((z2 / z1) - 1)
311313
*/
312-
z = z1 - z2;
314+
z = z2 - z1;
313315
z *= x;
314316
z *= ts_dev->x_plate_resistance;
315-
z /= z2;
317+
z /= z1;
316318
z = (z + 2047) >> 12;
317-
318-
if (z <= MAX_12BIT) {
319+
pr_debug("x %d y %d z1 %d z2 %d z %d\n", x, y, z1, z2, z);
320+
if (z <= PRESSURE_MAX) {
319321
input_report_abs(input_dev, ABS_X, x);
320322
input_report_abs(input_dev, ABS_Y, y);
321323
input_report_abs(input_dev, ABS_PRESSURE, z);

0 commit comments

Comments
 (0)