[PATCH 2/5] Input: imagis - do not report coordinates of released contacts

From: Markuss Broks via B4 Relay

Date: Fri Aug 21 2026 - 17:33:05 EST


From: Markuss Broks <markuss.broks@xxxxxxxxx>

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@xxxxxxxxx>
---
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