Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
Commit b8bd1157 authored by frost's avatar frost Committed by Robert Nelson
Browse files

ti_am335x_tsc: correct formula code to calculate pressure; fix touchscreen jitter problem

parent 5a1f4e2f
Branches
Tags 5.4.106-ti-r33
No related merge requests found
......@@ -34,6 +34,7 @@
#define ADCFSM_STEPID 0x10
#define SEQ_SETTLE 275
#define MAX_12BIT ((1 << 12) - 1)
#define PRESSURE_MAX 1000
#define TSC_IRQENB_MASK (IRQENB_FIFO0THRES | IRQENB_EOS | IRQENB_HW_PEN)
......@@ -234,6 +235,7 @@ static void titsc_read_coordinates(struct titsc *ts_dev,
for (i = 0; i < creads; i++) {
xvals[i] = titsc_readl(ts_dev, REG_FIFO0);
xvals[i] &= 0xfff;
pr_debug("i %d xval %d yval %d z1 %d z2 %d\n", i, xvals[i], yvals[i], *z1, *z2);
}
/*
......@@ -312,13 +314,13 @@ static irqreturn_t titsc_irq(int irq, void *dev)
* Resistance(touch) = x plate resistance *
* x postion/4096 * ((z2 / z1) - 1)
*/
z = z1 - z2;
z = z2 - z1;
z *= x;
z *= ts_dev->x_plate_resistance;
z /= z2;
z /= z1;
z = (z + 2047) >> 12;
if (z <= MAX_12BIT) {
pr_debug("x %d y %d z1 %d z2 %d z %d\n", x, y, z1, z2, z);
if (z <= PRESSURE_MAX) {
input_report_abs(input_dev, ABS_X, x);
input_report_abs(input_dev, ABS_Y, y);
input_report_abs(input_dev, ABS_PRESSURE, z);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment