mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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: David Heidelberg <david@ixit.cz>,
	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
Subject: [PATCH v7 4/7] Input: synaptics-rmi4 - f55: handle zero electrode count
Date: Fri, 20 Mar 2026 17:44:45 +0100	[thread overview]
Message-ID: <20260320-synaptics-rmi4-v7-4-379360de18d0@ixit.cz> (raw)
In-Reply-To: <20260320-synaptics-rmi4-v7-0-379360de18d0@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.53.0



  parent reply	other threads:[~2026-03-20 16:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-20 16:44 [PATCH v7 0/7] Input: synaptics-rmi4 - add quirks for third party touchscreen controllers David Heidelberg via B4 Relay
2026-03-20 16:44 ` [PATCH v7 1/7] dt-bindings: input: syna,rmi4: Document syna,rmi4-s3706b David Heidelberg via B4 Relay
2026-03-20 16:44 ` [PATCH v7 2/7] Input: synaptics-rmi4 - handle duplicate/unknown PDT entries David Heidelberg via B4 Relay
2026-03-20 16:49   ` Casey Connolly
2026-03-20 16:54     ` David Heidelberg
2026-03-20 17:03       ` Casey Connolly
2026-03-20 17:12         ` David Heidelberg
2026-03-20 17:19           ` David Heidelberg
2026-03-20 16:44 ` [PATCH v7 3/7] Input: synaptics-rmi4 - f12: use hardcoded values for aftermarket touch ICs David Heidelberg via B4 Relay
2026-03-20 16:44 ` David Heidelberg via B4 Relay [this message]
2026-03-20 16:44 ` [PATCH v7 5/7] Input: synaptics-rmi4 - don't do unaligned reads in IRQ context David Heidelberg via B4 Relay
2026-03-20 16:44 ` [PATCH v7 6/7] Input: synaptics-rmi4 - read product ID on aftermarket touch ICs David Heidelberg via B4 Relay
2026-03-20 16:44 ` [PATCH v7 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=20260320-synaptics-rmi4-v7-4-379360de18d0@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

all inboxes | Powered by JetHome®