[PATCH 3/4] Input: hynitron-cst816x: release gesture keys

From: Daniel Golle

Date: Thu Oct 01 2026 - 06:55:57 EST


The gesture key is reported with the value of the touch flag, so it
stays pressed once the controller stops reporting the gesture code
while the finger is still down. Report the press on its own and
release the keys the input core still holds down on the first report
that carries no gesture code.

Fixes: c87a819bec86 ("Input: add driver for Hynitron CST816x series")
Signed-off-by: Daniel Golle <daniel@xxxxxxxxxxxxxx>
---
drivers/input/touchscreen/hynitron-cst816x.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/hynitron-cst816x.c b/drivers/input/touchscreen/hynitron-cst816x.c
index 865c5a767ba01..e2093518e8af1 100644
--- a/drivers/input/touchscreen/hynitron-cst816x.c
+++ b/drivers/input/touchscreen/hynitron-cst816x.c
@@ -168,6 +168,18 @@ static void cst816x_reset(struct cst816x_priv *priv)
msleep(100);
}

+static void cst816x_release_keys(struct cst816x_priv *priv)
+{
+ unsigned int i;
+
+ for (i = 0; i < priv->keycodemax; i++) {
+ if (!test_bit(priv->keycode[i], priv->input->key))
+ continue;
+
+ input_report_key(priv->input, priv->keycode[i], 0);
+ }
+}
+
static irqreturn_t cst816x_irq_cb(int irq, void *cookie)
{
struct cst816x_priv *priv = cookie;
@@ -181,8 +193,9 @@ static irqreturn_t cst816x_irq_cb(int irq, void *cookie)

if (tch.gest)
input_report_key(priv->input,
- priv->keycode[cst816x_gest_idx(tch.gest)],
- tch.active);
+ priv->keycode[cst816x_gest_idx(tch.gest)], 1);
+ else
+ cst816x_release_keys(priv);

input_report_key(priv->input, BTN_TOUCH, tch.active);

--
2.55.0