]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
Input: stmpe - add axis inversion and swapping capability
authorStefan Riedmueller <s.riedmueller@phytec.de>
Mon, 5 Oct 2020 04:12:31 +0000 (21:12 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 12 Dec 2020 00:26:03 +0000 (16:26 -0800)
Make use of generic touchscreen_properties structure to add axis
inversion and swapping capabilities. It's configurable via devicetree
properties:
  touchscreen-inverted-x
  touchscreen-inverted-y
  touchscreen-swapped-x-y

Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de>
Link: https://lore.kernel.org/r/20200922093903.157232-1-s.riedmueller@phytec.de
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/touchscreen/stmpe-ts.c

index 7e16fcfe3b959646571213061b1b8a960b178efa..cd747725589b1ec3585015bb2898b500fbb277d0 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/input.h>
+#include <linux/input/touchscreen.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/i2c.h>
@@ -72,6 +73,7 @@ struct stmpe_touch {
        struct input_dev *idev;
        struct delayed_work work;
        struct device *dev;
+       struct touchscreen_properties prop;
        u8 ave_ctrl;
        u8 touch_det_delay;
        u8 settling;
@@ -150,8 +152,7 @@ static irqreturn_t stmpe_ts_handler(int irq, void *data)
        y = ((data_set[1] & 0xf) << 8) | data_set[2];
        z = data_set[3];
 
-       input_report_abs(ts->idev, ABS_X, x);
-       input_report_abs(ts->idev, ABS_Y, y);
+       touchscreen_report_pos(ts->idev, &ts->prop, x, y, false);
        input_report_abs(ts->idev, ABS_PRESSURE, z);
        input_report_key(ts->idev, BTN_TOUCH, 1);
        input_sync(ts->idev);
@@ -337,6 +338,8 @@ static int stmpe_input_probe(struct platform_device *pdev)
        input_set_abs_params(idev, ABS_Y, 0, XY_MASK, 0, 0);
        input_set_abs_params(idev, ABS_PRESSURE, 0x0, 0xff, 0, 0);
 
+       touchscreen_parse_properties(idev, false, &ts->prop);
+
        error = input_register_device(idev);
        if (error) {
                dev_err(&pdev->dev, "Could not register input device\n");