diff mbox series

[08/10] Input: stmpe-ts - axes inversion and swapping

Message ID 20190527161938.31871-4-leif.middelschulte@klsmartin.com (mailing list archive)
State New, archived
Headers show
Series input: touchscreen: stmpe: ext. features | expand

Commit Message

Middelschulte, Leif May 27, 2019, 4:19 p.m. UTC
This implements inversion and swapping of the reported X and Y input
values, configurable via the corresponding devicetree properties binding.

Signed-off-by: Leif Middelschulte <leif.middelschulte@klsmartin.com>
---
 drivers/input/touchscreen/stmpe-ts.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c
index 152aac8b3ab7..1d114278e7e9 100644
--- a/drivers/input/touchscreen/stmpe-ts.c
+++ b/drivers/input/touchscreen/stmpe-ts.c
@@ -217,8 +217,12 @@  static irqreturn_t stmpe_ts_handler(int irq, void *data)
 		goto _skip_input_events;
 	}
 
-	input_report_abs(ts->idev, ABS_X, x);
-	input_report_abs(ts->idev, ABS_Y, y);
+	if (ts->props.invert_x)
+		x -= ts->min.x;
+	if (ts->props.invert_y)
+		y -= ts->min.y;
+
+	touchscreen_report_pos(ts->idev, &ts->props, x, y, false);
 	if (report_pressure)
 		input_report_abs(ts->idev, ABS_PRESSURE, z);
 	input_report_key(ts->idev, BTN_TOUCH, 1);