[PATCH V5 03/11] iio: imu: inv_icm42607: Add inv_icm42607 Core Driver
Jonathan Cameron
jic23 at kernel.org
Mon May 11 10:28:35 PDT 2026
On Sat, 9 May 2026 14:18:57 -0500
Chris Morgan <macroalpha82 at gmail.com> wrote:
> From: Chris Morgan <macromorgan at hotmail.com>
>
> Add the core component of a new inv_icm42607 driver. This includes
> a few setup functions and the full register definition in the
> header file.
>
> Signed-off-by: Chris Morgan <macromorgan at hotmail.com>
Hi Chris
The sashiko bot has taken a look and had some comments
and one in this patch is valid.
https://sashiko.dev/#/patchset/20260509191907.24734-1-macroalpha82%40gmail.com
It's minor though so if everything else looks good I might
just tweak whilst applying.
> ---
> drivers/iio/imu/inv_icm42607/inv_icm42607.h | 332 ++++++++++++++++++
> .../iio/imu/inv_icm42607/inv_icm42607_core.c | 210 +++++++++++
> 2 files changed, 542 insertions(+)
> create mode 100644 drivers/iio/imu/inv_icm42607/inv_icm42607.h
> create mode 100644 drivers/iio/imu/inv_icm42607/inv_icm42607_core.c
>
> diff --git a/drivers/iio/imu/inv_icm42607/inv_icm42607.h b/drivers/iio/imu/inv_icm42607/inv_icm42607.h
> new file mode 100644
> index 000000000000..10dcd3473e9c
> --- /dev/null
> +++ b/drivers/iio/imu/inv_icm42607/inv_icm42607.h
> diff --git a/drivers/iio/imu/inv_icm42607/inv_icm42607_core.c b/drivers/iio/imu/inv_icm42607/inv_icm42607_core.c
> new file mode 100644
> index 000000000000..e84e84416dab
> --- /dev/null
> +/**
> + * inv_icm42607_setup() - check and setup chip
> + * @st: driver internal state
> + * @bus_setup: callback for setting up bus specific registers
> + *
> + * Returns 0 on success, a negative error code otherwise.
> + */
> +static int inv_icm42607_setup(struct inv_icm42607_state *st,
> + inv_icm42607_bus_setup bus_setup)
> +{
> + const struct device *dev = regmap_get_device(st->map);
> + unsigned int val;
> + int ret;
> +
> + ret = regmap_read(st->map, INV_ICM42607_REG_WHOAMI, &val);
> + if (ret)
> + return ret;
> +
> + if (val != st->hw->whoami)
> + dev_warn_probe(dev, -ENODEV,
> + "invalid whoami %#02x expected %#02x (%s)\n",
> + val, st->hw->whoami, st->hw->name);
Sashiko correctly called this out as a bit nonsensical.
dev_warn_probe() is useful for dealing with deferral or that can't happen
with allowing a return dev_warn_probe() type call.
In this particular case it brings us nothing over dev_warn() so better
to just use that.
> +
> + ret = regmap_write(st->map, INV_ICM42607_REG_SIGNAL_PATH_RESET,
> + INV_ICM42607_SIGNAL_PATH_RESET_SOFT_RESET);
> + if (ret)
> + return ret;
More information about the Linux-rockchip
mailing list