Linux Input Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] Input: stmpe: Add axis inversion and swapping capability
@ 2020-09-22  9:39 Stefan Riedmueller
  2020-10-05  4:12 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Riedmueller @ 2020-09-22  9:39 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Lee Jones, linux-input, linux-kernel, linux-arm-kernel,
	Stefan Riedmueller

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>
---
 drivers/input/touchscreen/stmpe-ts.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c
index 7e16fcfe3b95..cd747725589b 100644
--- a/drivers/input/touchscreen/stmpe-ts.c
+++ b/drivers/input/touchscreen/stmpe-ts.c
@@ -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");
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Input: stmpe: Add axis inversion and swapping capability
  2020-09-22  9:39 [PATCH] Input: stmpe: Add axis inversion and swapping capability Stefan Riedmueller
@ 2020-10-05  4:12 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2020-10-05  4:12 UTC (permalink / raw)
  To: Stefan Riedmueller; +Cc: Lee Jones, linux-input, linux-kernel, linux-arm-kernel

On Tue, Sep 22, 2020 at 11:39:03AM +0200, Stefan Riedmueller wrote:
> 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>

Applied, thank you.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-22  9:39 [PATCH] Input: stmpe: Add axis inversion and swapping capability Stefan Riedmueller
2020-10-05  4:12 ` Dmitry Torokhov

Linux Input Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-input/0 linux-input/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-input linux-input/ https://lore.kernel.org/linux-input \
		linux-input@vger.kernel.org
	public-inbox-index linux-input

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-input


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git