[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220210094843.1889881-1-y.bas@phytec.de>
Date: Thu, 10 Feb 2022 10:48:43 +0100
From: Yunus Bas <y.bas@...tec.de>
To: dmitry.torokhov@...il.com, yuehaibing@...wei.com,
linux-input@...r.kernel.org
Cc: u.kleine-koenig@...gutronix.de, linux-kernel@...r.kernel.org
Subject: [PATCH RESEND v2] Input: tsc200x-core - Add axis inversion and swapping support
Since Commit ed7c9870c9bc ("Input: of_touchscreen - add support for
inverted / swapped axes"), the of_touchscreen interface supports axis
inverting and swapping through Devicetree properties. Make use of this
feature.
Signed-off-by: Yunus Bas <y.bas@...tec.de>
---
Changes in v2:
- Added additional properties to documentation
---
.../devicetree/bindings/input/touchscreen/ti,tsc2005.yaml | 3 +++
drivers/input/touchscreen/tsc200x-core.c | 7 ++++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/input/touchscreen/ti,tsc2005.yaml b/Documentation/devicetree/bindings/input/touchscreen/ti,tsc2005.yaml
index 938aab016cc2..166a254c8472 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/ti,tsc2005.yaml
+++ b/Documentation/devicetree/bindings/input/touchscreen/ti,tsc2005.yaml
@@ -54,6 +54,9 @@ properties:
touchscreen-max-pressure: true
touchscreen-size-x: true
touchscreen-size-y: true
+ touchscreen-inverted-x: true
+ touchscreen-inverted-y: true
+ touchscreen-swapped-x-y: true
allOf:
- $ref: touchscreen.yaml#
diff --git a/drivers/input/touchscreen/tsc200x-core.c b/drivers/input/touchscreen/tsc200x-core.c
index 27810f6c69f6..72c7258b93a5 100644
--- a/drivers/input/touchscreen/tsc200x-core.c
+++ b/drivers/input/touchscreen/tsc200x-core.c
@@ -88,6 +88,8 @@ struct tsc200x {
int in_z1;
int in_z2;
+ struct touchscreen_properties prop;
+
spinlock_t lock;
struct timer_list penup_timer;
@@ -113,8 +115,7 @@ static void tsc200x_update_pen_state(struct tsc200x *ts,
int x, int y, int pressure)
{
if (pressure) {
- 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, pressure);
if (!ts->pen_down) {
input_report_key(ts->idev, BTN_TOUCH, !!pressure);
@@ -533,7 +534,7 @@ int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id,
input_set_abs_params(input_dev, ABS_PRESSURE,
0, MAX_12BIT, TSC200X_DEF_P_FUZZ, 0);
- touchscreen_parse_properties(input_dev, false, NULL);
+ touchscreen_parse_properties(input_dev, false, &ts->prop);
/* Ensure the touchscreen is off */
tsc200x_stop_scan(ts);
--
2.25.1
Powered by blists - more mailing lists