|
@@ -129,6 +129,9 @@ struct ad7879 {
|
|
|
u16 cmd_crtl1;
|
|
|
u16 cmd_crtl2;
|
|
|
u16 cmd_crtl3;
|
|
|
+ int x;
|
|
|
+ int y;
|
|
|
+ int Rt;
|
|
|
};
|
|
|
|
|
|
static int ad7879_read(struct ad7879 *ts, u8 reg)
|
|
@@ -175,13 +178,32 @@ static int ad7879_report(struct ad7879 *ts)
|
|
|
Rt /= z1;
|
|
|
Rt = (Rt + 2047) >> 12;
|
|
|
|
|
|
- if (!timer_pending(&ts->timer))
|
|
|
+ /*
|
|
|
+ * Sample found inconsistent, pressure is beyond
|
|
|
+ * the maximum. Don't report it to user space.
|
|
|
+ */
|
|
|
+ if (Rt > ts->pressure_max)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ /*
|
|
|
+ * Note that we delay reporting events by one sample.
|
|
|
+ * This is done to avoid reporting last sample of the
|
|
|
+ * touch sequence, which may be incomplete if finger
|
|
|
+ * leaves the surface before last reading is taken.
|
|
|
+ */
|
|
|
+ if (timer_pending(&ts->timer)) {
|
|
|
+ /* Touch continues */
|
|
|
input_report_key(input_dev, BTN_TOUCH, 1);
|
|
|
+ input_report_abs(input_dev, ABS_X, ts->x);
|
|
|
+ input_report_abs(input_dev, ABS_Y, ts->y);
|
|
|
+ input_report_abs(input_dev, ABS_PRESSURE, ts->Rt);
|
|
|
+ input_sync(input_dev);
|
|
|
+ }
|
|
|
+
|
|
|
+ ts->x = x;
|
|
|
+ ts->y = y;
|
|
|
+ ts->Rt = Rt;
|
|
|
|
|
|
- input_report_abs(input_dev, ABS_X, x);
|
|
|
- input_report_abs(input_dev, ABS_Y, y);
|
|
|
- input_report_abs(input_dev, ABS_PRESSURE, Rt);
|
|
|
- input_sync(input_dev);
|
|
|
return 0;
|
|
|
}
|
|
|
|