From: David Heidelberg via B4 Relay <devnull+david.ixit.cz@kernel.org>
To: Kaustabh Chakraborty <kauschluss@disroot.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
"Jason A. Donenfeld" <Jason@zx2c4.com>,
Matthias Schiffer <matthias.schiffer@ew.tq-group.com>,
Vincent Huang <vincent.huang@tw.synaptics.com>
Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
Casey Connolly <casey.connolly@linaro.org>,
phone-devel@vger.kernel.org, David Heidelberg <david@ixit.cz>
Subject: [PATCH v6 4/7] Input: synaptics-rmi4 - f55: handle zero electrode count
Date: Thu, 13 Nov 2025 17:31:00 +0100 [thread overview]
Message-ID: <20251113-synaptics-rmi4-v6-4-d9836afab801@ixit.cz> (raw)
In-Reply-To: <20251113-synaptics-rmi4-v6-0-d9836afab801@ixit.cz>
From: Kaustabh Chakraborty <kauschluss@disroot.org>
Some third party ICs claim to support f55 but report an electrode count
of 0. Catch this and bail out early so that we don't confuse the i2c bus
with 0 sized reads.
Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
[simplify code, adjust wording]
Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
Signed-off-by: David Heidelberg <david@ixit.cz>
---
drivers/input/rmi4/rmi_f55.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/input/rmi4/rmi_f55.c b/drivers/input/rmi4/rmi_f55.c
index 488adaca4dd00..776c915b82e72 100644
--- a/drivers/input/rmi4/rmi_f55.c
+++ b/drivers/input/rmi4/rmi_f55.c
@@ -52,6 +52,11 @@ static int rmi_f55_detect(struct rmi_function *fn)
f55->num_rx_electrodes = f55->qry[F55_NUM_RX_OFFSET];
f55->num_tx_electrodes = f55->qry[F55_NUM_TX_OFFSET];
+ if (!f55->num_rx_electrodes || !f55->num_tx_electrodes) {
+ dev_err(&fn->dev, "%s: F55 query returned no electrodes, giving up\n",
+ __func__);
+ return -EINVAL;
+ }
f55->cfg_num_rx_electrodes = f55->num_rx_electrodes;
f55->cfg_num_tx_electrodes = f55->num_rx_electrodes;
--
2.51.0
next prev parent reply other threads:[~2025-11-13 16:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-13 16:30 [PATCH v6 0/7] Input: synaptics-rmi4 - add quirks for third party touchscreen controllers David Heidelberg via B4 Relay
2025-11-13 16:30 ` [PATCH v6 1/7] dt-bindings: input: syna,rmi4: Document syna,rmi4-s3706b David Heidelberg via B4 Relay
2025-11-13 16:30 ` [PATCH v6 2/7] Input: synaptics-rmi4 - handle duplicate/unknown PDT entries David Heidelberg via B4 Relay
2025-11-13 16:30 ` [PATCH v6 3/7] Input: synaptics-rmi4 - f12: use hardcoded values for aftermarket touch ICs David Heidelberg via B4 Relay
2025-11-13 16:31 ` David Heidelberg via B4 Relay [this message]
2025-11-13 16:31 ` [PATCH v6 5/7] Input: synaptics-rmi4 - don't do unaligned reads in IRQ context David Heidelberg via B4 Relay
2025-11-13 16:31 ` [PATCH v6 6/7] Input: synaptics-rmi4 - read product ID on aftermarket touch ICs David Heidelberg via B4 Relay
2025-11-13 16:31 ` [PATCH v6 7/7] Input: synaptics-rmi4 - support fallback values for PDT descriptor bytes David Heidelberg via B4 Relay
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=20251113-synaptics-rmi4-v6-4-d9836afab801@ixit.cz \
--to=devnull+david.ixit.cz@kernel.org \
--cc=Jason@zx2c4.com \
--cc=casey.connolly@linaro.org \
--cc=conor+dt@kernel.org \
--cc=david@ixit.cz \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=kauschluss@disroot.org \
--cc=krzk+dt@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthias.schiffer@ew.tq-group.com \
--cc=phone-devel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=vincent.huang@tw.synaptics.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;
as well as URLs for NNTP newsgroup(s).