All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] iio: imu: inv_icm42600: add support for icm42630
@ 2026-07-28 18:43 Jorijn van der Graaf
  2026-07-28 18:43 ` [PATCH v3 1/3] iio: imu: inv_icm42600: sort device id tables numerically Jorijn van der Graaf
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jorijn van der Graaf @ 2026-07-28 18:43 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 TDK InvenSense ICM-42630 is a 6-axis IMU of the ICM-42600 family,
used in the Fairphone 6. The existing inv_icm42600 driver drives it
unmodified.

The binding documents the new compatible with an invensense,icm42631
fallback, and the driver's WHOAMI check is dropped so that a
fallback-matched part can probe (on older kernels via a backport of
that one patch). 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 silently, and accelerometer, gyroscope
and temperature reads work. The fuller v1 test set (all full-scale
ranges, several sampling frequencies, watermark-paced FIFO reads via
INT1) ran with v1's dedicated icm42630 id entries, whose configuration
is the same family default the fallback match selects.

Chris Morgan's icm42607 series [1] touches the same binding enum, so
whichever lands second has a trivial merge conflict. Its conditional
interrupts requirement covers the ICM-42630 automatically through the
fallback compatible.

Changes in v3:
- patch 2: drop the whoami check entirely instead of demoting the
  mismatch error to a warning, and remove the now-unused whoami
  definitions (Conor)
- dropped v2's patch 4 (dedicated icm42630 driver id entries): the
  part binds through the fallback (Conor); Jean-Baptiste's Acked-by
  on it lapses with the patch
- patch 1 and the binding patch are unchanged; series rebased onto
  current iio/togreg

[1] https://lore.kernel.org/all/20260727164815.65190-1-macroalpha82@gmail.com/

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: drop the whoami check
  dt-bindings: iio: imu: icm42600: add icm42630

 .../bindings/iio/imu/invensense,icm42600.yaml | 20 +++++++++++--------
 drivers/iio/imu/inv_icm42600/inv_icm42600.h   |  9 ---------
 .../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 +++++++--------
 5 files changed, 28 insertions(+), 50 deletions(-)


base-commit: 0506462caaecb179708657142575823177c83783
-- 
2.55.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v3 1/3] iio: imu: inv_icm42600: sort device id tables numerically
  2026-07-28 18:43 [PATCH v3 0/3] iio: imu: inv_icm42600: add support for icm42630 Jorijn van der Graaf
@ 2026-07-28 18:43 ` Jorijn van der Graaf
  2026-07-28 18:43 ` [PATCH v3 2/3] iio: imu: inv_icm42600: drop the whoami check Jorijn van der Graaf
  2026-07-28 18:43 ` [PATCH v3 3/3] dt-bindings: iio: imu: icm42600: add icm42630 Jorijn van der Graaf
  2 siblings, 0 replies; 5+ messages in thread
From: Jorijn van der Graaf @ 2026-07-28 18:43 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 v3.
 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] 5+ messages in thread

* [PATCH v3 2/3] iio: imu: inv_icm42600: drop the whoami check
  2026-07-28 18:43 [PATCH v3 0/3] iio: imu: inv_icm42600: add support for icm42630 Jorijn van der Graaf
  2026-07-28 18:43 ` [PATCH v3 1/3] iio: imu: inv_icm42600: sort device id tables numerically Jorijn van der Graaf
@ 2026-07-28 18:43 ` Jorijn van der Graaf
  2026-07-28 18:52   ` sashiko-bot
  2026-07-28 18:43 ` [PATCH v3 3/3] dt-bindings: iio: imu: icm42600: add icm42630 Jorijn van der Graaf
  2 siblings, 1 reply; 5+ messages in thread
From: Jorijn van der Graaf @ 2026-07-28 18:43 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, preventing a register-compatible part described
with a fallback compatible from probing at all.

The devicetree compatible is authoritative for which part is fitted:
drop the check, and with it the now-unused whoami definitions. No
warning replaces it, since probing via a fallback compatible is
legitimate use, not a condition to report. This changes the probe
outcome on mismatch 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 silently, and accelerometer, gyroscope
and temperature reads work.

Suggested-by: Conor Dooley <conor@kernel.org>
Link: https://lore.kernel.org/all/20260722-creature-volley-0f083b904c1d@spud/
Link: https://lore.kernel.org/all/20260728-extradite-yanking-42d918637f61@spud/
Assisted-by: Claude:claude-fable-5
Signed-off-by: Jorijn van der Graaf <jorijnvdgraaf@catcrafts.net>
---
v3: drop the check and the now-unused whoami definitions instead of
demoting the mismatch error to a warning (Conor); retested on the
device.
New in v2, as a demotion of the error to a warning.
 drivers/iio/imu/inv_icm42600/inv_icm42600.h     |  9 ---------
 .../iio/imu/inv_icm42600/inv_icm42600_core.c    | 17 -----------------
 2 files changed, 26 deletions(-)

diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600.h b/drivers/iio/imu/inv_icm42600/inv_icm42600.h
index b55d993f0264..88acdbab14c3 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600.h
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600.h
@@ -378,15 +378,6 @@ struct inv_icm42600_sensor_state {
 #define INV_ICM42600_INT_SOURCE1_SMD_INT1_EN		BIT(3)
 #define INV_ICM42600_INT_SOURCE1_WOM_INT1_EN		GENMASK(2, 0)
 
-#define INV_ICM42600_REG_WHOAMI				0x0075
-#define INV_ICM42600_WHOAMI_ICM42600			0x40
-#define INV_ICM42600_WHOAMI_ICM42602			0x41
-#define INV_ICM42600_WHOAMI_ICM42605			0x42
-#define INV_ICM42600_WHOAMI_ICM42686			0x44
-#define INV_ICM42600_WHOAMI_ICM42622			0x46
-#define INV_ICM42600_WHOAMI_ICM42688			0x47
-#define INV_ICM42600_WHOAMI_ICM42631			0x5C
-
 /* User bank 1 (MSB 0x10) */
 #define INV_ICM42600_REG_SENSOR_CONFIG0			0x1003
 #define INV_ICM42600_SENSOR_CONFIG0_ZG_DISABLE		BIT(5)
diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
index dc97d8a274e3..963c9425e31a 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
@@ -103,7 +103,6 @@ const struct regmap_config inv_icm42600_spi_regmap_config = {
 EXPORT_SYMBOL_NS_GPL(inv_icm42600_spi_regmap_config, "IIO_ICM42600");
 
 struct inv_icm42600_hw {
-	u8 whoami;
 	const char *name;
 	const struct inv_icm42600_conf *conf;
 };
@@ -143,37 +142,30 @@ static const struct inv_icm42600_conf inv_icm42686_default_conf = {
 
 static const struct inv_icm42600_hw inv_icm42600_hw[INV_CHIP_NB] = {
 	[INV_CHIP_ICM42600] = {
-		.whoami = INV_ICM42600_WHOAMI_ICM42600,
 		.name = "icm42600",
 		.conf = &inv_icm42600_default_conf,
 	},
 	[INV_CHIP_ICM42602] = {
-		.whoami = INV_ICM42600_WHOAMI_ICM42602,
 		.name = "icm42602",
 		.conf = &inv_icm42600_default_conf,
 	},
 	[INV_CHIP_ICM42605] = {
-		.whoami = INV_ICM42600_WHOAMI_ICM42605,
 		.name = "icm42605",
 		.conf = &inv_icm42600_default_conf,
 	},
 	[INV_CHIP_ICM42686] = {
-		.whoami = INV_ICM42600_WHOAMI_ICM42686,
 		.name = "icm42686",
 		.conf = &inv_icm42686_default_conf,
 	},
 	[INV_CHIP_ICM42622] = {
-		.whoami = INV_ICM42600_WHOAMI_ICM42622,
 		.name = "icm42622",
 		.conf = &inv_icm42600_default_conf,
 	},
 	[INV_CHIP_ICM42688] = {
-		.whoami = INV_ICM42600_WHOAMI_ICM42688,
 		.name = "icm42688",
 		.conf = &inv_icm42600_default_conf,
 	},
 	[INV_CHIP_ICM42631] = {
-		.whoami = INV_ICM42600_WHOAMI_ICM42631,
 		.name = "icm42631",
 		.conf = &inv_icm42600_default_conf,
 	},
@@ -505,15 +497,6 @@ static int inv_icm42600_setup(struct inv_icm42600_state *st,
 	unsigned int val;
 	int ret;
 
-	/* check chip self-identification value */
-	ret = regmap_read(st->map, INV_ICM42600_REG_WHOAMI, &val);
-	if (ret)
-		return ret;
-	if (val != hw->whoami) {
-		dev_err(dev, "invalid whoami %#02x expected %#02x (%s)\n",
-			val, hw->whoami, hw->name);
-		return -ENODEV;
-	}
 	st->name = hw->name;
 
 	/* reset to make sure previous state are not there */
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 3/3] dt-bindings: iio: imu: icm42600: add icm42630
  2026-07-28 18:43 [PATCH v3 0/3] iio: imu: inv_icm42600: add support for icm42630 Jorijn van der Graaf
  2026-07-28 18:43 ` [PATCH v3 1/3] iio: imu: inv_icm42600: sort device id tables numerically Jorijn van der Graaf
  2026-07-28 18:43 ` [PATCH v3 2/3] iio: imu: inv_icm42600: drop the whoami check Jorijn van der Graaf
@ 2026-07-28 18:43 ` Jorijn van der Graaf
  2 siblings, 0 replies; 5+ messages in thread
From: Jorijn van der Graaf @ 2026-07-28 18:43 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 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/
Assisted-by: Claude:claude-fable-5
Signed-off-by: Jorijn van der Graaf <jorijnvdgraaf@catcrafts.net>
---
No changes in v3.
 .../bindings/iio/imu/invensense,icm42600.yaml | 20 +++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/imu/invensense,icm42600.yaml b/Documentation/devicetree/bindings/iio/imu/invensense,icm42600.yaml
index 119e28a833fd..39d8afd8d4a6 100644
--- a/Documentation/devicetree/bindings/iio/imu/invensense,icm42600.yaml
+++ b/Documentation/devicetree/bindings/iio/imu/invensense,icm42600.yaml
@@ -26,14 +26,18 @@ description: |
 
 properties:
   compatible:
-    enum:
-      - invensense,icm42600
-      - invensense,icm42602
-      - invensense,icm42605
-      - invensense,icm42622
-      - invensense,icm42631
-      - invensense,icm42686
-      - invensense,icm42688
+    oneOf:
+      - enum:
+          - invensense,icm42600
+          - invensense,icm42602
+          - invensense,icm42605
+          - 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] 5+ messages in thread

* Re: [PATCH v3 2/3] iio: imu: inv_icm42600: drop the whoami check
  2026-07-28 18:43 ` [PATCH v3 2/3] iio: imu: inv_icm42600: drop the whoami check Jorijn van der Graaf
@ 2026-07-28 18:52   ` sashiko-bot
  0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-07-28 18:52 UTC (permalink / raw)
  To: Jorijn van der Graaf; +Cc: conor+dt, devicetree, robh

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Complete removal of the WHOAMI check breaks hardware presence detection on SPI buses, allowing the driver to successfully probe absent or non-existent devices.
--

--- Patch [2]: [PATCH v3 2/3] iio: imu: inv_icm42600: drop the whoami check ---
commit 3a74aa023a51d52a25e7f4af731835e3a6cd0b6a
Author: Jorijn van der Graaf <jorijnvdgraaf@catcrafts.net>

iio: imu: inv_icm42600: drop the whoami check

This commit drops the WHOAMI check from the inv_icm42600 driver to allow
fallback compatibles to probe successfully even if the WHOAMI value does
not strictly match. The unused WHOAMI definitions are also removed. This
changes the probe outcome on mismatch for all parts supported by the driver.

Link: https://lore.kernel.org/all/20260722-creature-volley-0f083b904c1d@spud/
Link: https://lore.kernel.org/all/20260728-extradite-yanking-42d918637f61@spud/

[Note: The standard inline quoting format has been altered to a free-form
summary due to recitation restrictions.]

[Severity: High]
With the WHOAMI check removed, does this break hardware presence detection 
on SPI buses? 

When an SPI device is unpopulated or unpowered, the MISO line often floats 
high, causing regmap reads to return 0xFF. Looking at inv_icm42600_setup() 
in drivers/iio/imu/inv_icm42600/inv_icm42600_core.c, the only remaining 
hardware verification is the check for the reset done bit.

Because the reset done bit is BIT(4) (0x10), reading 0xFF means 
(0xFF & 0x10) is non-zero. The condition 
!(val & INV_ICM42600_INT_STATUS_RESET_DONE) evaluates to false, bypassing 
the -ENODEV error path. 

Will this allow the driver to successfully probe absent or non-existent 
devices, exposing dummy IIO interfaces that yield -1 for all readings?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260728184351.75015-1-jorijnvdgraaf@catcrafts.net?part=2

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-07-28 18:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-28 18:43 [PATCH v3 0/3] iio: imu: inv_icm42600: add support for icm42630 Jorijn van der Graaf
2026-07-28 18:43 ` [PATCH v3 1/3] iio: imu: inv_icm42600: sort device id tables numerically Jorijn van der Graaf
2026-07-28 18:43 ` [PATCH v3 2/3] iio: imu: inv_icm42600: drop the whoami check Jorijn van der Graaf
2026-07-28 18:52   ` sashiko-bot
2026-07-28 18:43 ` [PATCH v3 3/3] dt-bindings: iio: imu: icm42600: add icm42630 Jorijn van der Graaf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.