All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markuss Broks via B4 Relay <devnull+markuss.broks.gmail.com@kernel.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>,
	Henrik Rydberg <rydberg@bitmath.org>
Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org,
	 linux-kernel@vger.kernel.org,
	Markuss Broks <markuss.broks@gmail.com>
Subject: [PATCH 2/5] Input: imagis - do not report coordinates of released contacts
Date: Sat, 22 Aug 2026 00:30:14 +0300	[thread overview]
Message-ID: <20260822-imagis-40xx-v1-2-73e6d6cdf110@gmail.com> (raw)
In-Reply-To: <20260822-imagis-40xx-v1-0-73e6d6cdf110@gmail.com>

From: Markuss Broks <markuss.broks@gmail.com>

The position and the contact area are currently reported even for
contacts which are being released. The slot has already been deactivated
at that point, so these events carry no information for userspace.
Report the position and the contact area only for active contacts.

This also prepares the driver for the IST40xx family: its per-contact
records carry an event type in the bits which hold the contact area on
the currently supported chips, so release records must not be parsed for
coordinates or the contact area.

Signed-off-by: Markuss Broks <markuss.broks@gmail.com>
---
 drivers/input/touchscreen/imagis.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/imagis.c b/drivers/input/touchscreen/imagis.c
index 7bbb00beec3b..7cc91f97c06e 100644
--- a/drivers/input/touchscreen/imagis.c
+++ b/drivers/input/touchscreen/imagis.c
@@ -127,6 +127,8 @@ static irqreturn_t imagis_interrupt(int irq, void *dev_id)
 	finger_pressed = FIELD_GET(IST3038C_FINGER_STATUS_MASK, intr_message);
 
 	for (i = 0; i < finger_count; i++) {
+		bool pressed;
+
 		if (ts->tdata->protocol_b)
 			error = imagis_i2c_read_reg(ts,
 						    ts->tdata->touch_coord_cmd + (i * 4),
@@ -141,9 +143,13 @@ static irqreturn_t imagis_interrupt(int irq, void *dev_id)
 			goto out;
 		}
 
+		pressed = finger_pressed & BIT(i);
+
 		input_mt_slot(ts->input_dev, i);
-		input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER,
-					   finger_pressed & BIT(i));
+		input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, pressed);
+		if (!pressed)
+			continue;
+
 		touchscreen_report_pos(ts->input_dev, &ts->prop,
 				       FIELD_GET(IST3038C_X_MASK, finger_status),
 				       FIELD_GET(IST3038C_Y_MASK, finger_status),

-- 
2.55.0



WARNING: multiple messages have this Message-ID (diff)
From: Markuss Broks <markuss.broks@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	 Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Henrik Rydberg <rydberg@bitmath.org>
Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org,
	 linux-kernel@vger.kernel.org,
	Markuss Broks <markuss.broks@gmail.com>
Subject: [PATCH 2/5] Input: imagis - do not report coordinates of released contacts
Date: Sat, 22 Aug 2026 00:30:14 +0300	[thread overview]
Message-ID: <20260822-imagis-40xx-v1-2-73e6d6cdf110@gmail.com> (raw)
In-Reply-To: <20260822-imagis-40xx-v1-0-73e6d6cdf110@gmail.com>

The position and the contact area are currently reported even for
contacts which are being released. The slot has already been deactivated
at that point, so these events carry no information for userspace.
Report the position and the contact area only for active contacts.

This also prepares the driver for the IST40xx family: its per-contact
records carry an event type in the bits which hold the contact area on
the currently supported chips, so release records must not be parsed for
coordinates or the contact area.

Signed-off-by: Markuss Broks <markuss.broks@gmail.com>
---
 drivers/input/touchscreen/imagis.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/imagis.c b/drivers/input/touchscreen/imagis.c
index 7bbb00beec3b..7cc91f97c06e 100644
--- a/drivers/input/touchscreen/imagis.c
+++ b/drivers/input/touchscreen/imagis.c
@@ -127,6 +127,8 @@ static irqreturn_t imagis_interrupt(int irq, void *dev_id)
 	finger_pressed = FIELD_GET(IST3038C_FINGER_STATUS_MASK, intr_message);
 
 	for (i = 0; i < finger_count; i++) {
+		bool pressed;
+
 		if (ts->tdata->protocol_b)
 			error = imagis_i2c_read_reg(ts,
 						    ts->tdata->touch_coord_cmd + (i * 4),
@@ -141,9 +143,13 @@ static irqreturn_t imagis_interrupt(int irq, void *dev_id)
 			goto out;
 		}
 
+		pressed = finger_pressed & BIT(i);
+
 		input_mt_slot(ts->input_dev, i);
-		input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER,
-					   finger_pressed & BIT(i));
+		input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, pressed);
+		if (!pressed)
+			continue;
+
 		touchscreen_report_pos(ts->input_dev, &ts->prop,
 				       FIELD_GET(IST3038C_X_MASK, finger_status),
 				       FIELD_GET(IST3038C_Y_MASK, finger_status),

-- 
2.55.0


  parent reply	other threads:[~2026-08-21 21:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21 21:30 [PATCH 0/5] Minor Imagis driver refactoring and support for IST4050 Markuss Broks via B4 Relay
2026-08-21 21:30 ` Markuss Broks
2026-08-21 21:30 ` [PATCH 1/5] dt-bindings: input: touchscreen: imagis: add compatible " Markuss Broks via B4 Relay
2026-08-21 21:30   ` Markuss Broks
2026-08-24 16:17   ` Conor Dooley
2026-08-21 21:30 ` Markuss Broks via B4 Relay [this message]
2026-08-21 21:30   ` [PATCH 2/5] Input: imagis - do not report coordinates of released contacts Markuss Broks
2026-08-21 21:39   ` sashiko-bot
2026-08-21 21:30 ` [PATCH 3/5] Input: imagis - replace the protocol_b flag with a protocol enum Markuss Broks via B4 Relay
2026-08-21 21:30   ` Markuss Broks
2026-08-21 21:37   ` sashiko-bot
2026-08-21 21:30 ` [PATCH 4/5] Input: imagis - add support for the IST40xx touch reporting format Markuss Broks via B4 Relay
2026-08-21 21:30   ` Markuss Broks
2026-08-21 21:43   ` sashiko-bot
2026-08-21 21:30 ` [PATCH 5/5] Input: imagis - add support for IST4050 Markuss Broks via B4 Relay
2026-08-21 21:30   ` Markuss Broks
2026-08-21 21:42   ` 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=20260822-imagis-40xx-v1-2-73e6d6cdf110@gmail.com \
    --to=devnull+markuss.broks.gmail.com@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markuss.broks@gmail.com \
    --cc=robh@kernel.org \
    --cc=rydberg@bitmath.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.