[PATCH v5 4/6] iio: imu: inv_icm42607: Add support for ICM-42370-P

From: Kanak Shilledar

Date: Fri Oct 02 2026 - 07:59:11 EST


Add support for the Invensense ICM-42370-P MEMS MotionTracking 3-axis
accelerometer with built-in temperature sensor. This device is almost
identical to the existing Invensense ICM-42607-P IMU, but lacks
gyroscope. The device supports I2C, SPI and I3C. Implement only I2C
support for now, and provide support for raw sensor reads via sysfs.
There is also a built-in temperature sensor but it can not be turned off
similar to the ICM-42607.

While at it, change so dev_err_probe() is returned
when the WHO_AM_I read fails.

Datasheet: https://www.invensense.tdk.com/en-us/products/3-axis/icm-42370-p
Signed-off-by: Kanak Shilledar <kanak.shilledar@xxxxxxxx>
---
drivers/iio/imu/inv_icm42607/inv_icm42607.h | 2 ++
drivers/iio/imu/inv_icm42607/inv_icm42607_core.c | 24 ++++++++++++++++++++++--
drivers/iio/imu/inv_icm42607/inv_icm42607_i2c.c | 6 ++++++
3 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/imu/inv_icm42607/inv_icm42607.h b/drivers/iio/imu/inv_icm42607/inv_icm42607.h
index e4075288247b8..ca5f59eb436c0 100644
--- a/drivers/iio/imu/inv_icm42607/inv_icm42607.h
+++ b/drivers/iio/imu/inv_icm42607/inv_icm42607.h
@@ -367,6 +367,7 @@ struct inv_icm42607_sensor_state {
#define INV_ICM42607_REG_FIFO_DATA 0x3F

#define INV_ICM42607_REG_WHOAMI 0x75
+#define INV_ICM42370P_WHOAMI 0x0D
#define INV_ICM42607P_WHOAMI 0x60
#define INV_ICM42607_WHOAMI 0x67

@@ -393,6 +394,7 @@ typedef int (*inv_icm42607_bus_setup)(struct inv_icm42607_state *);
extern const struct regmap_config inv_icm42607_regmap_config;
extern const struct inv_icm42607_hw inv_icm42607_hw_data;
extern const struct inv_icm42607_hw inv_icm42607p_hw_data;
+extern const struct inv_icm42607_hw inv_icm42370p_hw_data;
extern const struct dev_pm_ops inv_icm42607_pm_ops;

const struct iio_mount_matrix *
diff --git a/drivers/iio/imu/inv_icm42607/inv_icm42607_core.c b/drivers/iio/imu/inv_icm42607/inv_icm42607_core.c
index d974cba66e1be..87b1499a3689f 100644
--- a/drivers/iio/imu/inv_icm42607/inv_icm42607_core.c
+++ b/drivers/iio/imu/inv_icm42607/inv_icm42607_core.c
@@ -92,6 +92,22 @@ static const struct inv_icm42607_conf inv_icm42607_default_conf = {
},
};

+static const struct inv_icm42607_conf inv_icm42370_default_conf = {
+ .accel = {
+ .mode = INV_ICM42607_SENSOR_MODE_OFF,
+ .fs = INV_ICM42607_ACCEL_FS_4G,
+ .odr = INV_ICM42607_ODR_100HZ,
+ .filter = INV_ICM42607_FILTER_BW_25HZ,
+ },
+};
+
+const struct inv_icm42607_hw inv_icm42370p_hw_data = {
+ .whoami = INV_ICM42370P_WHOAMI,
+ .name = "icm42370p",
+ .conf = &inv_icm42370_default_conf,
+};
+EXPORT_SYMBOL_NS_GPL(inv_icm42370p_hw_data, "IIO_ICM42607");
+
const struct inv_icm42607_hw inv_icm42607_hw_data = {
.whoami = INV_ICM42607_WHOAMI,
.name = "icm42607",
@@ -476,7 +492,7 @@ static int inv_icm42607_setup(struct inv_icm42607_state *st,

ret = regmap_read(st->map, INV_ICM42607_REG_WHOAMI, &val);
if (ret)
- return ret;
+ return dev_err_probe(dev, ret, "WHOAMI read failed\n");

/* Warn, but don't fail. */
if (val != st->hw->whoami)
@@ -638,7 +654,11 @@ int inv_icm42607_core_probe(struct regmap *regmap,
pm_runtime_set_autosuspend_delay(dev, INV_ICM42607_SUSPEND_DELAY_MS);
pm_runtime_use_autosuspend(dev);

- /* Initialize IIO device for Accel */
+ /*
+ * Invensense, ICM42607 and ICM42607P both have accelerometer
+ * and gyroscope functionality. Whereas, Invensense, ICM42370P
+ * has only accelerometer.
+ */
st->indio_accel = inv_icm42607_accel_init(st);
if (IS_ERR(st->indio_accel))
return PTR_ERR(st->indio_accel);
diff --git a/drivers/iio/imu/inv_icm42607/inv_icm42607_i2c.c b/drivers/iio/imu/inv_icm42607/inv_icm42607_i2c.c
index e903106af84a8..cfafba2e3e68e 100644
--- a/drivers/iio/imu/inv_icm42607/inv_icm42607_i2c.c
+++ b/drivers/iio/imu/inv_icm42607/inv_icm42607_i2c.c
@@ -63,6 +63,9 @@ static const struct i2c_device_id inv_icm42607_id[] = {
}, {
.name = "icm42607p",
.driver_data = (kernel_ulong_t)&inv_icm42607p_hw_data,
+ }, {
+ .name = "icm42370p",
+ .driver_data = (kernel_ulong_t)&inv_icm42370p_hw_data,
},
{ }
};
@@ -75,6 +78,9 @@ static const struct of_device_id inv_icm42607_of_matches[] = {
}, {
.compatible = "invensense,icm42607p",
.data = &inv_icm42607p_hw_data,
+ }, {
+ .compatible = "invensense,icm42370p",
+ .data = &inv_icm42370p_hw_data,
},
{ }
};

--
2.43.0