Devicetree
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Jorijn van der Graaf" <jorijnvdgraaf@catcrafts.net>,
	"Jean-Baptiste Maneyrol" <jean-baptiste.maneyrol@tdk.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Chris Morgan" <macromorgan@hotmail.com>,
	"Luca Weiss" <luca.weiss@fairphone.com>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, "Conor Dooley" <conor@kernel.org>
Subject: Re: [PATCH v4 2/3] iio: imu: inv_icm42600: log whoami mismatch instead of failing probe
Date: Mon, 17 Aug 2026 03:18:59 +0100	[thread overview]
Message-ID: <20260817031859.31212035@jic23-huawei> (raw)
In-Reply-To: <anoqWLNK9_MzU1YP@ashevche-desk.local>

On Mon, 10 Aug 2026 22:45:28 +0300
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

> On Mon, Aug 10, 2026 at 09:11:56PM +0200, Jorijn van der Graaf wrote:
> > A WHOAMI value differing from the one the compatible implies aborts
> > probe with -ENODEV, which prevents a register-compatible part described
> > with a fallback compatible from probing at all.
> > 
> > The devicetree compatible is authoritative for which part is fitted:
> > log the mismatch at info level and continue. The message keeps a
> > breadcrumb for anyone seeing an unexpected part change on their device
> > versus the devicetree; tmp117 takes the same trade at the same level
> > for its fallback matches.
> > 
> > A whoami of 0x00 or 0xff still fails probe: SPI has no transfer-level
> > ack, so those values mean nothing answered; this is the same
> > no-response guard inv_icm45600 carries. Otherwise the probe outcome on
> > mismatch changes for all parts the driver supports.
> > 
> > Tested via a backport to a Fairphone 6 running a 7.1-based kernel: its
> > ICM-42630 (WHOAMI 0x0C), described with an icm42631 fallback compatible
> > and matched as icm42631, probes with the one informational line, and
> > accelerometer, gyroscope and temperature reads work.
> > 
> > Suggested-by: Conor Dooley <conor@kernel.org>
> > Suggested-by: Jonathan Cameron <jic23@kernel.org>  
> 
> > Link: https://lore.kernel.org/all/20260722-creature-volley-0f083b904c1d@spud/
> > Link: https://lore.kernel.org/all/20260728222015.6a62b287@jic23-huawei/
> > Link: https://lore.kernel.org/all/20260801032310.18f5f16d@jic23-huawei/
> > Link: https://lore.kernel.org/all/20260804-scarily-hacker-651df3eafea9@spud/  
> 
> What are those links for? I haven't seen references in the above text.
Yup. That needs tidying up or the links dropping.
> 
> ...
> 
> >  	if (val != hw->whoami) {
> > -		dev_err(dev, "invalid whoami %#02x expected %#02x (%s)\n",
> > -			val, hw->whoami, hw->name);
> > -		return -ENODEV;
> > +		/*
> > +		 * SPI interface has no ack mechanism.
> > +		 * 0xFF or 0x00 whoami means no response from the device.
> > +		 */
> > +		if (val == U8_MAX || val == 0)  
> 
> This is strange to be here. If hw->whoami happens to be 0x00 or 0xff (let's
> assume some hypothetical future case), this check will become invalid for them.
> 
> If it's guaranteed to be not the case for any HW (including the future variants)
> this check should be outside, no?

Hmm. This one has both worked in favour of finding connection trouble
and bitten us in the past. I vaguely recall a device that indeed
had a WHOAMI of 0 (though it might have been a hardware bug) and
tripped on such a check.

Personally I'm not that fixed either way on this. If the device isn't
there we should know the moment we try to get any data anyway.

> 
> > +			return dev_err_probe(dev, -ENODEV,
> > +					     "invalid whoami %#04x expected %#04x (%s)\n",
> > +					     val, hw->whoami, hw->name);
> > +
> > +		dev_info(dev,
> > +			 "device id %#04x is not the %#04x associated with the FW-specified device (%s), probably using a valid fallback compatible\n",
> > +			 val, hw->whoami, hw->name);
> >  	}  
> 


  reply	other threads:[~2026-08-17  2:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-10 19:11 [PATCH v4 0/3] iio: imu: inv_icm42600: add support for icm42630 Jorijn van der Graaf
2026-08-10 19:11 ` [PATCH v4 1/3] iio: imu: inv_icm42600: sort device id tables numerically Jorijn van der Graaf
2026-08-17  2:20   ` Jonathan Cameron
2026-08-10 19:11 ` [PATCH v4 2/3] iio: imu: inv_icm42600: log whoami mismatch instead of failing probe Jorijn van der Graaf
2026-08-10 19:45   ` Andy Shevchenko
2026-08-17  2:18     ` Jonathan Cameron [this message]
2026-08-17  8:28       ` Andy Shevchenko
2026-08-10 19:11 ` [PATCH v4 3/3] dt-bindings: iio: imu: icm42600: add icm42630 Jorijn van der Graaf

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=20260817031859.31212035@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=conor@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jean-baptiste.maneyrol@tdk.com \
    --cc=jorijnvdgraaf@catcrafts.net \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca.weiss@fairphone.com \
    --cc=macromorgan@hotmail.com \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    /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