Skip to content

Commit e655e2f

Browse files
fcoopertinsekhar
authored andcommitted
input: ti_am335x_tsc: Ignore previous pen down event when pen up event occurs
Frequently when a pen up event occurs the sampling for the previous pen down event ends up being incomplete. From a userspace perspective you will see an abnormal jump when comparing the pen down events to the one right before the pen up event. To avoid this issue delay sending a pen down event until the next touch event has occurred. If the current touch event is not a pen up event then send the previously detected pen down values. If the current touch event is a pen up then simply ignore the previous pen down value. Signed-off-by: Franklin S Cooper Jr. <fcooper@ti.com> Acked-by: Vignesh R <vigneshr@ti.com> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
1 parent 267f0e0 commit e655e2f

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

drivers/input/touchscreen/ti_am335x_tsc.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ struct titsc {
5353
u32 inp_xp, inp_xn, inp_yp, inp_yn;
5454
u32 step_mask;
5555
u32 charge_delay;
56+
u32 prev_x, prev_y, prev_z;
57+
bool event_pending;
5658
};
5759

5860
static unsigned int titsc_readl(struct titsc *ts, unsigned int reg)
@@ -276,6 +278,14 @@ static irqreturn_t titsc_irq(int irq, void *dev)
276278
input_report_abs(input_dev, ABS_PRESSURE, 0);
277279
input_sync(input_dev);
278280
irqclr |= IRQENB_PENUP;
281+
ts_dev->event_pending = false;
282+
} else if (ts_dev->event_pending == true) {
283+
input_report_abs(input_dev, ABS_X, ts_dev->prev_x);
284+
input_report_abs(input_dev, ABS_Y, ts_dev->prev_y);
285+
input_report_abs(input_dev, ABS_PRESSURE, ts_dev->prev_z);
286+
input_report_key(input_dev, BTN_TOUCH, 1);
287+
input_sync(input_dev);
288+
ts_dev->event_pending = false;
279289
}
280290

281291
if (status & IRQENB_EOS)
@@ -302,11 +312,10 @@ static irqreturn_t titsc_irq(int irq, void *dev)
302312
z = (z + 2047) >> 12;
303313

304314
if (z <= MAX_12BIT) {
305-
input_report_abs(input_dev, ABS_X, x);
306-
input_report_abs(input_dev, ABS_Y, y);
307-
input_report_abs(input_dev, ABS_PRESSURE, z);
308-
input_report_key(input_dev, BTN_TOUCH, 1);
309-
input_sync(input_dev);
315+
ts_dev->prev_x = x;
316+
ts_dev->prev_y = y;
317+
ts_dev->prev_z = z;
318+
ts_dev->event_pending = true;
310319
}
311320
}
312321
irqclr |= IRQENB_FIFO0THRES;
@@ -396,6 +405,7 @@ static int titsc_probe(struct platform_device *pdev)
396405
ts_dev->mfd_tscadc = tscadc_dev;
397406
ts_dev->input = input_dev;
398407
ts_dev->irq = tscadc_dev->irq;
408+
ts_dev->event_pending = false;
399409

400410
err = titsc_parse_dt(pdev, ts_dev);
401411
if (err) {
@@ -472,6 +482,7 @@ static int titsc_suspend(struct device *dev)
472482
struct ti_tscadc_dev *tscadc_dev;
473483
unsigned int idle;
474484

485+
ts_dev->event_pending = false;
475486
tscadc_dev = ti_tscadc_dev_get(to_platform_device(dev));
476487
if (device_may_wakeup(tscadc_dev->dev)) {
477488
idle = titsc_readl(ts_dev, REG_IRQENABLE);

0 commit comments

Comments
 (0)