Linux Input/HID development
 help / color / mirror / Atom feed
From: Daniel Golle <daniel@makrotopia.org>
To: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Daniel Golle" <daniel@makrotopia.org>,
	"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
	"Oleh Kuzhylnyi" <kuzhylol@gmail.com>,
	linux-input@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: Chad Monroe <chad@monroe.io>, John Crispin <john@phrozen.org>
Subject: [PATCH 2/4] Input: hynitron-cst816x: respect touchscreen DT properties
Date: Thu, 1 Oct 2026 11:52:51 +0100	[thread overview]
Message-ID: <517bab005d817ae2c8bd771469672b9413e5d9ff.1790851590.git.daniel@makrotopia.org> (raw)
In-Reply-To: <cover.1790851590.git.daniel@makrotopia.org>

Parse common touchscreen properties and use touchscreen_report_pos()
instead of reporting raw absolute position.

This makes the driver respect the touchscreen-inverted-x,
touchscreen-inverted-y and touchscreen-swapped-x-y properties

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
 drivers/input/touchscreen/hynitron-cst816x.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/hynitron-cst816x.c b/drivers/input/touchscreen/hynitron-cst816x.c
index 47d9cd7412d1b..865c5a767ba01 100644
--- a/drivers/input/touchscreen/hynitron-cst816x.c
+++ b/drivers/input/touchscreen/hynitron-cst816x.c
@@ -11,6 +11,7 @@
 #include <linux/gpio/consumer.h>
 #include <linux/i2c.h>
 #include <linux/input.h>
+#include <linux/input/touchscreen.h>
 #include <linux/unaligned.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
@@ -31,6 +32,7 @@ struct cst816x_priv {
 	struct input_dev *input;
 	unsigned int keycode[CST816X_NUM_KEYS];
 	unsigned int keycodemax;
+	struct touchscreen_properties prop;
 };
 
 static int cst816x_parse_keycodes(struct device *dev, struct cst816x_priv *priv)
@@ -142,6 +144,7 @@ static int cst816x_register_input(struct cst816x_priv *priv)
 	input_set_abs_params(priv->input, ABS_X, 0, 240, 0, 0);
 	input_set_abs_params(priv->input, ABS_Y, 0, 240, 0, 0);
 	input_set_capability(priv->input, EV_KEY, BTN_TOUCH);
+	touchscreen_parse_properties(priv->input, false, &priv->prop);
 
 	priv->input->keycode = priv->keycode;
 	priv->input->keycodesize = sizeof(priv->keycode[0]);
@@ -173,8 +176,8 @@ static irqreturn_t cst816x_irq_cb(int irq, void *cookie)
 	if (!cst816x_process_touch(priv, &tch))
 		return IRQ_HANDLED;
 
-	input_report_abs(priv->input, ABS_X, tch.abs_x);
-	input_report_abs(priv->input, ABS_Y, tch.abs_y);
+	touchscreen_report_pos(priv->input, &priv->prop,
+			       tch.abs_x, tch.abs_y, false);
 
 	if (tch.gest)
 		input_report_key(priv->input,
-- 
2.55.0

  parent reply	other threads:[~2026-10-01 10:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01 10:52 [PATCH 0/4] Input: hynitron-cst816x: axis properties and gesture keys Daniel Golle
2026-10-01 10:52 ` [PATCH 1/4] dt-bindings: input: touchscreen: hynitron,cst816x: configure axes Daniel Golle
2026-10-01 11:02   ` sashiko-bot
2026-10-01 19:01   ` Conor Dooley
2026-10-01 10:52 ` Daniel Golle [this message]
2026-10-01 10:53 ` [PATCH 3/4] Input: hynitron-cst816x: release gesture keys Daniel Golle
2026-10-01 11:00   ` sashiko-bot
2026-10-01 10:53 ` [PATCH 4/4] Input: hynitron-cst816x: time out gesture key release Daniel Golle
2026-10-01 11:01   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=517bab005d817ae2c8bd771469672b9413e5d9ff.1790851590.git.daniel@makrotopia.org \
    --to=daniel@makrotopia.org \
    --cc=chad@monroe.io \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=john@phrozen.org \
    --cc=krzk+dt@kernel.org \
    --cc=kuzhylol@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=u.kleine-koenig@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox