Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH] Input: sx8654 - ignore incomplete SX8650 coordinate pairs
@ 2026-12-01  5:55 Fil Dunsky
  2026-12-01  6:00 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Fil Dunsky @ 2026-12-01  5:55 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input

Invalid samples can leave one axis unset. Reporting that scan sends
a spurious coordinate and resets the pen-up timer. Require both
axes before publishing a sample or extending the timer.

Signed-off-by: Fil Dunsky <filipp.dunsky@gmail.com>
---
Based on Input for-linus (through 55909e337adf).
Tested touch input on Securifi Almond+ with the backported change.

 drivers/input/touchscreen/sx8654.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/input/touchscreen/sx8654.c b/drivers/input/touchscreen/sx8654.c
index 1ae00cc2a..6fba0176f 100644
--- a/drivers/input/touchscreen/sx8654.c
+++ b/drivers/input/touchscreen/sx8654.c
@@ -131,6 +131,7 @@ static irqreturn_t sx8650_irq(int irq, void *handle)
 	struct sx8654 *ts = handle;
 	struct device *dev = &ts->client->dev;
 	int len, i, stat;
+	bool have_x = false, have_y = false;
 	u16 x, y;
 	u16 ch;
 	u16 chdata;
@@ -155,8 +156,6 @@ static irqreturn_t sx8650_irq(int irq, void *handle)
 		return IRQ_HANDLED;
 	}
 
-	guard(spinlock_irqsave)(&ts->lock);
-
 	x = 0;
 	y = 0;
 	for (i = 0; i < nchan; i++) {
@@ -171,15 +170,22 @@ static irqreturn_t sx8650_irq(int irq, void *handle)
 		}
 
 		ch = chdata >> 12;
-		if (ch == CH_X)
+		if (ch == CH_X) {
 			x = chdata & MAX_12BIT;
-		else if (ch == CH_Y)
+			have_x = true;
+		} else if (ch == CH_Y) {
 			y = chdata & MAX_12BIT;
-		else
+			have_y = true;
+		} else {
 			dev_warn(dev, "unknown channel %d [0x%04x]\n", ch,
 				 chdata);
+		}
 	}
 
+	if (!have_x || !have_y)
+		return IRQ_HANDLED;
+
+	guard(spinlock_irqsave)(&ts->lock);
 	touchscreen_report_pos(ts->input, &ts->props, x, y, false);
 	input_report_key(ts->input, BTN_TOUCH, 1);
 	input_sync(ts->input);
-- 
2.53.0


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

end of thread, other threads:[~2026-12-01  6:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01  5:55 [PATCH] Input: sx8654 - ignore incomplete SX8650 coordinate pairs Fil Dunsky
2026-12-01  6:00 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox