devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: david@ixit.cz
Cc: 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>,
	linux-input@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, phone-devel@vger.kernel.org,
	~postmarketos/upstreaming@lists.sr.ht,
	methanal <baclofen@tuta.io>,
	Caleb Connolly <caleb.connolly@linaro.org>
Subject: Re: [PATCH v3 4/7] Input: synaptics-rmi4 - f55: handle zero electrode count
Date: Mon, 10 Mar 2025 12:00:12 -0700	[thread overview]
Message-ID: <Z882vDOOac0kMKg9@google.com> (raw)
In-Reply-To: <20250308-synaptics-rmi4-v3-4-215d3e7289a2@ixit.cz>

On Sat, Mar 08, 2025 at 03:08:40PM +0100, David Heidelberg via B4 Relay wrote:
> From: methanal <baclofen@tuta.io>
> 
> 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: methanal <baclofen@tuta.io>
> [simplify code, adjust wording]
> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
> ---
>  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 488adaca4dd00482cd1106d813b32871092c83a0..ad2ef14ae9f4e897473db43334792cc3de966d52 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) {
> +		rmi_dbg(RMI_DEBUG_FN, &fn->dev,
> +			"F55 query returned no electrodes, giving up\n");
> +		return 0;

0 here means "successfully detected" and will result in F55 probe
succeeding. I expect you want -EINVAL or -ENODEV here.

Thanks.

-- 
Dmitry

  reply	other threads:[~2025-03-10 19:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-08 14:08 [PATCH v3 0/7] Subject: [PATCH v3 0/7] Input: synaptics-rmi4: add quirks for third party touchscreen controllers David Heidelberg via B4 Relay
2025-03-08 14:08 ` [PATCH v3 1/7] dt-bindings: input: syna,rmi4: document syna,pdt-fallback-desc David Heidelberg via B4 Relay
2025-03-10  9:45   ` Krzysztof Kozlowski
2025-03-24 18:00     ` David Heidelberg
2025-03-25  7:36       ` Krzysztof Kozlowski
2025-03-25 13:23         ` Caleb Connolly
2025-03-26  6:57           ` Krzysztof Kozlowski
2025-03-26 10:26             ` Caleb Connolly
2025-03-28 22:45               ` David Heidelberg
2025-03-29  9:56                 ` Caleb Connolly
2025-03-08 14:08 ` [PATCH v3 2/7] Input: synaptics-rmi4 - handle duplicate/unknown PDT entries David Heidelberg via B4 Relay
2025-03-10 19:10   ` Dmitry Torokhov
2025-03-11 12:22     ` Caleb Connolly
2025-04-02 18:54     ` David Heidelberg
2025-03-08 14:08 ` [PATCH v3 3/7] Input: synaptics-rmi4 - f12: use hardcoded values for aftermarket touch ICs David Heidelberg via B4 Relay
2025-03-08 14:08 ` [PATCH v3 4/7] Input: synaptics-rmi4 - f55: handle zero electrode count David Heidelberg via B4 Relay
2025-03-10 19:00   ` Dmitry Torokhov [this message]
2025-03-08 14:08 ` [PATCH v3 5/7] Input: synaptics-rmi4 - don't do unaligned reads in IRQ context David Heidelberg via B4 Relay
2025-03-08 14:08 ` [PATCH v3 6/7] Input: synaptics-rmi4 - read product ID on aftermarket touch ICs David Heidelberg via B4 Relay
2025-03-08 14:08 ` [PATCH v3 7/7] Input: synaptics-rmi4 - support fallback values for PDT descriptor bytes David Heidelberg via B4 Relay
2025-03-10 10:04 ` [PATCH v3 0/7] Subject: [PATCH v3 0/7] Input: synaptics-rmi4: add quirks for third party touchscreen controllers Caleb Connolly
2025-03-10 10:47   ` David Heidelberg

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=Z882vDOOac0kMKg9@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=Jason@zx2c4.com \
    --cc=baclofen@tuta.io \
    --cc=caleb.connolly@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=david@ixit.cz \
    --cc=devicetree@vger.kernel.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 \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /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).