Skip to content

Commit efda7ec

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

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
#define TSC_IRQENB_MASK (IRQENB_FIFO0THRES | IRQENB_EOS | IRQENB_HW_PEN)
3940

@@ -234,6 +235,7 @@ static void titsc_read_coordinates(struct titsc *ts_dev,
234235
for (i = 0; i < creads; i++) {
235236
xvals[i] = titsc_readl(ts_dev, REG_FIFO0);
236237
xvals[i] &= 0xfff;
238+
pr_debug("i %d xval %d yval %d z1 %d z2 %d\n", i, xvals[i], yvals[i], *z1, *z2);
237239
}
238240

239241
/*
@@ -312,13 +314,13 @@ static irqreturn_t titsc_irq(int irq, void *dev)
312314
* Resistance(touch) = x plate resistance *
313315
* x postion/4096 * ((z2 / z1) - 1)
314316
*/
315-
z = z1 - z2;
317+
z = z2 - z1;
316318
z *= x;
317319
z *= ts_dev->x_plate_resistance;
318-
z /= z2;
320+
z /= z1;
319321
z = (z + 2047) >> 12;
320-
321-
if (z <= MAX_12BIT) {
322+
pr_debug("x %d y %d z1 %d z2 %d z %d\n", x, y, z1, z2, z);
323+
if (z <= PRESSURE_MAX) {
322324
input_report_abs(input_dev, ABS_X, x);
323325
input_report_abs(input_dev, ABS_Y, y);
324326
input_report_abs(input_dev, ABS_PRESSURE, z);

0 commit comments

Comments
 (0)