* [PATCH v5 1/3] iio: imu: inv_icm42600: sort device id tables numerically
2026-08-23 0:33 [PATCH v5 0/3] iio: imu: inv_icm42600: add support for icm42630 Jorijn van der Graaf
@ 2026-08-23 0:33 ` Jorijn van der Graaf
2026-08-23 0:33 ` [PATCH v5 2/3] iio: imu: inv_icm42600: log whoami mismatch instead of failing probe Jorijn van der Graaf
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Jorijn van der Graaf @ 2026-08-23 0:33 UTC (permalink / raw)
To: Jonathan Cameron, Jean-Baptiste Maneyrol
Cc: Jorijn van der Graaf, David Lechner, Nuno Sá,
Andy Shevchenko, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Chris Morgan, Luca Weiss, linux-iio, devicetree, linux-kernel
The I2C, SPI and OF device id tables list the parts in the chip enum's
declaration order, which is neither numeric nor alphabetical. Sort the
entries numerically by part number so new entries have an unambiguous
position.
Suggested-by: Jonathan Cameron <jic23@kernel.org>
Link: https://lore.kernel.org/all/20260724012505.02029e51@jic23-huawei/
Assisted-by: Claude:claude-fable-5
Signed-off-by: Jorijn van der Graaf <jorijnvdgraaf@catcrafts.net>
---
No changes in v5.
drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c | 16 ++++++++--------
drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c | 16 ++++++++--------
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
index 28552d2db91d..e44ed6dcde02 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
@@ -77,10 +77,10 @@ static const struct i2c_device_id inv_icm42600_id[] = {
{ .name = "icm42600", .driver_data = INV_CHIP_ICM42600 },
{ .name = "icm42602", .driver_data = INV_CHIP_ICM42602 },
{ .name = "icm42605", .driver_data = INV_CHIP_ICM42605 },
- { .name = "icm42686", .driver_data = INV_CHIP_ICM42686 },
{ .name = "icm42622", .driver_data = INV_CHIP_ICM42622 },
- { .name = "icm42688", .driver_data = INV_CHIP_ICM42688 },
{ .name = "icm42631", .driver_data = INV_CHIP_ICM42631 },
+ { .name = "icm42686", .driver_data = INV_CHIP_ICM42686 },
+ { .name = "icm42688", .driver_data = INV_CHIP_ICM42688 },
{ }
};
MODULE_DEVICE_TABLE(i2c, inv_icm42600_id);
@@ -95,18 +95,18 @@ static const struct of_device_id inv_icm42600_of_matches[] = {
}, {
.compatible = "invensense,icm42605",
.data = (void *)INV_CHIP_ICM42605,
- }, {
- .compatible = "invensense,icm42686",
- .data = (void *)INV_CHIP_ICM42686,
}, {
.compatible = "invensense,icm42622",
.data = (void *)INV_CHIP_ICM42622,
- }, {
- .compatible = "invensense,icm42688",
- .data = (void *)INV_CHIP_ICM42688,
}, {
.compatible = "invensense,icm42631",
.data = (void *)INV_CHIP_ICM42631,
+ }, {
+ .compatible = "invensense,icm42686",
+ .data = (void *)INV_CHIP_ICM42686,
+ }, {
+ .compatible = "invensense,icm42688",
+ .data = (void *)INV_CHIP_ICM42688,
},
{ }
};
diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c
index faf743bc6444..3e2f4eb42e97 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c
@@ -74,10 +74,10 @@ static const struct spi_device_id inv_icm42600_id[] = {
{ .name = "icm42600", .driver_data = INV_CHIP_ICM42600 },
{ .name = "icm42602", .driver_data = INV_CHIP_ICM42602 },
{ .name = "icm42605", .driver_data = INV_CHIP_ICM42605 },
- { .name = "icm42686", .driver_data = INV_CHIP_ICM42686 },
{ .name = "icm42622", .driver_data = INV_CHIP_ICM42622 },
- { .name = "icm42688", .driver_data = INV_CHIP_ICM42688 },
{ .name = "icm42631", .driver_data = INV_CHIP_ICM42631 },
+ { .name = "icm42686", .driver_data = INV_CHIP_ICM42686 },
+ { .name = "icm42688", .driver_data = INV_CHIP_ICM42688 },
{ }
};
MODULE_DEVICE_TABLE(spi, inv_icm42600_id);
@@ -92,18 +92,18 @@ static const struct of_device_id inv_icm42600_of_matches[] = {
}, {
.compatible = "invensense,icm42605",
.data = (void *)INV_CHIP_ICM42605,
- }, {
- .compatible = "invensense,icm42686",
- .data = (void *)INV_CHIP_ICM42686,
}, {
.compatible = "invensense,icm42622",
.data = (void *)INV_CHIP_ICM42622,
- }, {
- .compatible = "invensense,icm42688",
- .data = (void *)INV_CHIP_ICM42688,
}, {
.compatible = "invensense,icm42631",
.data = (void *)INV_CHIP_ICM42631,
+ }, {
+ .compatible = "invensense,icm42686",
+ .data = (void *)INV_CHIP_ICM42686,
+ }, {
+ .compatible = "invensense,icm42688",
+ .data = (void *)INV_CHIP_ICM42688,
},
{ }
};
--
2.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH v5 2/3] iio: imu: inv_icm42600: log whoami mismatch instead of failing probe
2026-08-23 0:33 [PATCH v5 0/3] iio: imu: inv_icm42600: add support for icm42630 Jorijn van der Graaf
2026-08-23 0:33 ` [PATCH v5 1/3] iio: imu: inv_icm42600: sort device id tables numerically Jorijn van der Graaf
@ 2026-08-23 0:33 ` Jorijn van der Graaf
2026-08-24 8:52 ` Andy Shevchenko
2026-08-23 0:33 ` [PATCH v5 3/3] dt-bindings: iio: imu: icm42600: add icm42630 Jorijn van der Graaf
2026-08-23 17:42 ` [PATCH v5 0/3] iio: imu: inv_icm42600: add support for icm42630 Jonathan Cameron
3 siblings, 1 reply; 6+ messages in thread
From: Jorijn van der Graaf @ 2026-08-23 0:33 UTC (permalink / raw)
To: Jonathan Cameron, Jean-Baptiste Maneyrol
Cc: Jorijn van der Graaf, David Lechner, Nuno Sá,
Andy Shevchenko, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Chris Morgan, Luca Weiss, linux-iio, devicetree, linux-kernel,
Conor Dooley
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. Otherwise the probe outcome
on mismatch changes for all parts the driver supports. The check sits
before the mismatch comparison; it does not depend on hw->whoami, since
no supported part uses either value (the WHOAMI values the driver
defines span 0x40-0x5C). inv_icm45600 carries the same guard nested in
its mismatch branch.
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>
Assisted-by: Claude:claude-fable-5
Signed-off-by: Jorijn van der Graaf <jorijnvdgraaf@catcrafts.net>
---
v5: the no-response guard moves before the whoami-mismatch comparison
as its own check (Andy); the four Link trailers are dropped (Andy,
Jonathan); retested on the device.
v4 kept the whoami read, logging the mismatch at info level
(Jonathan, Conor), and added inv_icm45600's no-response guard; both
prints use %#04x so the two ids render at equal width.
v3 dropped the check and the whoami definitions entirely.
New in v2, as a demotion of the error to a warning.
.../iio/imu/inv_icm42600/inv_icm42600_core.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
index dc97d8a274e3..be8cbecdd92e 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
@@ -8,6 +8,7 @@
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/kernel.h>
+#include <linux/limits.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/pm_runtime.h>
@@ -509,10 +510,20 @@ static int inv_icm42600_setup(struct inv_icm42600_state *st,
ret = regmap_read(st->map, INV_ICM42600_REG_WHOAMI, &val);
if (ret)
return ret;
+
+ /*
+ * SPI interface has no ack mechanism.
+ * 0xFF or 0x00 whoami means no response from the device.
+ */
+ if (val == U8_MAX || val == 0)
+ return dev_err_probe(dev, -ENODEV,
+ "invalid whoami %#04x expected %#04x (%s)\n",
+ val, hw->whoami, hw->name);
+
if (val != hw->whoami) {
- dev_err(dev, "invalid whoami %#02x expected %#02x (%s)\n",
- val, hw->whoami, hw->name);
- return -ENODEV;
+ 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);
}
st->name = hw->name;
--
2.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v5 2/3] iio: imu: inv_icm42600: log whoami mismatch instead of failing probe
2026-08-23 0:33 ` [PATCH v5 2/3] iio: imu: inv_icm42600: log whoami mismatch instead of failing probe Jorijn van der Graaf
@ 2026-08-24 8:52 ` Andy Shevchenko
0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2026-08-24 8:52 UTC (permalink / raw)
To: Jorijn van der Graaf
Cc: Jonathan Cameron, Jean-Baptiste Maneyrol, David Lechner,
Nuno Sá, Andy Shevchenko, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Chris Morgan, Luca Weiss, linux-iio, devicetree,
linux-kernel, Conor Dooley
On Sun, Aug 23, 2026 at 02:33:19AM +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. Otherwise the probe outcome
> on mismatch changes for all parts the driver supports. The check sits
> before the mismatch comparison; it does not depend on hw->whoami, since
> no supported part uses either value (the WHOAMI values the driver
> defines span 0x40-0x5C). inv_icm45600 carries the same guard nested in
> its mismatch branch.
>
> 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.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
...
> + /*
> + * SPI interface has no ack mechanism.
> + * 0xFF or 0x00 whoami means no response from the device.
> + */
> + if (val == U8_MAX || val == 0)
Not sure if U8_MAX is better or worse than simple 0xff, but either work for me.
> + return dev_err_probe(dev, -ENODEV,
> + "invalid whoami %#04x expected %#04x (%s)\n",
> + val, hw->whoami, hw->name);
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v5 3/3] dt-bindings: iio: imu: icm42600: add icm42630
2026-08-23 0:33 [PATCH v5 0/3] iio: imu: inv_icm42600: add support for icm42630 Jorijn van der Graaf
2026-08-23 0:33 ` [PATCH v5 1/3] iio: imu: inv_icm42600: sort device id tables numerically Jorijn van der Graaf
2026-08-23 0:33 ` [PATCH v5 2/3] iio: imu: inv_icm42600: log whoami mismatch instead of failing probe Jorijn van der Graaf
@ 2026-08-23 0:33 ` Jorijn van der Graaf
2026-08-23 17:42 ` [PATCH v5 0/3] iio: imu: inv_icm42600: add support for icm42630 Jonathan Cameron
3 siblings, 0 replies; 6+ messages in thread
From: Jorijn van der Graaf @ 2026-08-23 0:33 UTC (permalink / raw)
To: Jonathan Cameron, Jean-Baptiste Maneyrol
Cc: Jorijn van der Graaf, David Lechner, Nuno Sá,
Andy Shevchenko, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Chris Morgan, Luca Weiss, linux-iio, devicetree, linux-kernel,
Conor Dooley
The TDK InvenSense ICM-42630 is a 6-axis IMU of the ICM-42600 family,
found e.g. in the Fairphone 6. Document its compatible with the
ICM-42631 as fallback: TDK confirmed the part is similar to the
ICM-42631 and driven by the same driver without modification. The
dedicated compatible records the exact part so a difference can still
be handled if one surfaces (the part has no public datasheet).
Link: https://lore.kernel.org/all/BE1P281MB1426D6579C0E2709574549B6CEC22@BE1P281MB1426.DEUP281.PROD.OUTLOOK.COM/
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Assisted-by: Claude:claude-fable-5
Signed-off-by: Jorijn van der Graaf <jorijnvdgraaf@catcrafts.net>
---
No changes in v5.
v4: rebased over the icm42607 and mount-matrix changes to this file
(no content change); added Conor's Acked-by.
No changes in v3.
v2: restructured to the icm42631 fallback form; Jean-Baptiste's v1
Acked-by lapsed with the rework.
.../bindings/iio/imu/invensense,icm42600.yaml | 24 +++++++++++--------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/Documentation/devicetree/bindings/iio/imu/invensense,icm42600.yaml b/Documentation/devicetree/bindings/iio/imu/invensense,icm42600.yaml
index 81b6e85decd5..9e22b603d47f 100644
--- a/Documentation/devicetree/bindings/iio/imu/invensense,icm42600.yaml
+++ b/Documentation/devicetree/bindings/iio/imu/invensense,icm42600.yaml
@@ -26,16 +26,20 @@ description: |
properties:
compatible:
- enum:
- - invensense,icm42600
- - invensense,icm42602
- - invensense,icm42605
- - invensense,icm42607
- - invensense,icm42607p
- - invensense,icm42622
- - invensense,icm42631
- - invensense,icm42686
- - invensense,icm42688
+ oneOf:
+ - enum:
+ - invensense,icm42600
+ - invensense,icm42602
+ - invensense,icm42605
+ - invensense,icm42607
+ - invensense,icm42607p
+ - invensense,icm42622
+ - invensense,icm42631
+ - invensense,icm42686
+ - invensense,icm42688
+ - items:
+ - const: invensense,icm42630
+ - const: invensense,icm42631
reg:
maxItems: 1
--
2.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v5 0/3] iio: imu: inv_icm42600: add support for icm42630
2026-08-23 0:33 [PATCH v5 0/3] iio: imu: inv_icm42600: add support for icm42630 Jorijn van der Graaf
` (2 preceding siblings ...)
2026-08-23 0:33 ` [PATCH v5 3/3] dt-bindings: iio: imu: icm42600: add icm42630 Jorijn van der Graaf
@ 2026-08-23 17:42 ` Jonathan Cameron
3 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2026-08-23 17:42 UTC (permalink / raw)
To: Jorijn van der Graaf
Cc: Jean-Baptiste Maneyrol, David Lechner, Nuno Sá,
Andy Shevchenko, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Chris Morgan, Luca Weiss, linux-iio, devicetree, linux-kernel
On Sun, 23 Aug 2026 02:33:17 +0200
Jorijn van der Graaf <jorijnvdgraaf@catcrafts.net> wrote:
> The TDK InvenSense ICM-42630 is a 6-axis IMU of the ICM-42600 family,
> used in the Fairphone 6. It needs no part-specific driver code: TDK
> confirmed it can be supported by inv_icm42600 without modification.
>
> The binding documents the new compatible with an invensense,icm42631
> fallback, and a WHOAMI mismatch no longer fails probe, so that a
> fallback-matched part can probe; one informational line records the
> mismatch, and a whoami of 0x00/0xff (no response) still fails. No
> driver id entries are added: the part binds through the fallback.
>
> Tested on the Fairphone 6 with the fallback pair in the devicetree,
> via a backport to its 7.1-based kernel: matched as icm42631 through
> the fallback, the part probes with the one informational line, and
> accelerometer, gyroscope and temperature reads work.
>
> Changes in v5:
> - patch 2: the no-response guard moves before the whoami-mismatch
> comparison as its own check (Andy); it does not depend on
> hw->whoami, since no supported part uses either value
> - patch 2: the four Link trailers are dropped (Andy, Jonathan); the
> Suggested-by tags carry the attribution
>
> v4: https://lore.kernel.org/all/20260810191157.125550-1-jorijnvdgraaf@catcrafts.net/
> v3: https://lore.kernel.org/all/20260728184351.75015-1-jorijnvdgraaf@catcrafts.net/
> v2: https://lore.kernel.org/all/20260724202708.128267-1-jorijnvdgraaf@catcrafts.net/
> v1: https://lore.kernel.org/all/20260720173411.82979-1-jorijnvdgraaf@catcrafts.net/
>
> Jorijn van der Graaf (3):
> iio: imu: inv_icm42600: sort device id tables numerically
> iio: imu: inv_icm42600: log whoami mismatch instead of failing probe
> dt-bindings: iio: imu: icm42600: add icm42630
Applied to the testing branch of iio.git. Note I'll be rebasing on rc1 once
available (in about 1 week) so until then I'm fine adding tags or with changes
on top if any review feedback comes in.
Thanks,
Jonathan
>
> .../bindings/iio/imu/invensense,icm42600.yaml | 24 +++++++++++--------
> .../iio/imu/inv_icm42600/inv_icm42600_core.c | 17 ++++++++++---
> .../iio/imu/inv_icm42600/inv_icm42600_i2c.c | 16 ++++++-------
> .../iio/imu/inv_icm42600/inv_icm42600_spi.c | 16 ++++++-------
> 4 files changed, 44 insertions(+), 29 deletions(-)
>
>
> base-commit: 350d1fb9204b13c5f95e511e98b8bcb47574d425
^ permalink raw reply [flat|nested] 6+ messages in thread