[PATCH V12 6/9] iio: imu: inv_icm42607: Add Temp Support in icm42607
Jonathan Cameron
jic23 at kernel.org
Sun Jun 14 09:34:53 PDT 2026
On Thu, 11 Jun 2026 15:26:03 -0500
Chris Morgan <macroalpha82 at gmail.com> wrote:
> From: Chris Morgan <macromorgan at hotmail.com>
>
> Add functions for reading temperature sensor data.
>
> Signed-off-by: Chris Morgan <macromorgan at hotmail.com>
The buffer isn't safe for use for DMA. See below.
I'm not sure I'd have noticed. This used to be a common bug but not seen it that
often recently for some reason!
Jonathan
> ---
> drivers/iio/imu/inv_icm42607/Makefile | 1 +
> drivers/iio/imu/inv_icm42607/inv_icm42607.h | 5 ++
> .../iio/imu/inv_icm42607/inv_icm42607_core.c | 18 +++++
> .../iio/imu/inv_icm42607/inv_icm42607_temp.c | 76 +++++++++++++++++++
> .../iio/imu/inv_icm42607/inv_icm42607_temp.h | 37 +++++++++
> 5 files changed, 137 insertions(+)
> create mode 100644 drivers/iio/imu/inv_icm42607/inv_icm42607_temp.c
> create mode 100644 drivers/iio/imu/inv_icm42607/inv_icm42607_temp.h
>
> diff --git a/drivers/iio/imu/inv_icm42607/Makefile b/drivers/iio/imu/inv_icm42607/Makefile
> index be109102e203..c04953ed42ce 100644
> --- a/drivers/iio/imu/inv_icm42607/Makefile
> +++ b/drivers/iio/imu/inv_icm42607/Makefile
> @@ -2,6 +2,7 @@
>
> obj-$(CONFIG_INV_ICM42607) += inv-icm42607.o
> inv-icm42607-y += inv_icm42607_core.o
> +inv-icm42607-y += inv_icm42607_temp.o
>
> obj-$(CONFIG_INV_ICM42607_I2C) += inv-icm42607-i2c.o
> inv-icm42607-i2c-y += inv_icm42607_i2c.o
> diff --git a/drivers/iio/imu/inv_icm42607/inv_icm42607.h b/drivers/iio/imu/inv_icm42607/inv_icm42607.h
> index 28edc12d5373..53dd23509a53 100644
> --- a/drivers/iio/imu/inv_icm42607/inv_icm42607.h
> +++ b/drivers/iio/imu/inv_icm42607/inv_icm42607.h
> @@ -114,6 +114,7 @@ struct inv_icm42607_suspended {
>
> /**
> * struct inv_icm42607_state - driver state variables
> + * @buffer: data transfer buffer aligned for DMA.
> * @hw: Hardware specific data.
> * @map: regmap pointer.
> * @vddio_supply: I/O voltage regulator for the chip.
> @@ -124,6 +125,7 @@ struct inv_icm42607_suspended {
> * @orientation: sensor chip orientation relative to main hardware.
> */
> struct inv_icm42607_state {
> + __be16 buffer[3] __aligned(IIO_DMA_MINALIGN);
Look in more depth at what this does. Key thing is there is a reason
this should always be at the end of the iio_priv() structure.
(Sashiko caught this btw)
> const struct inv_icm42607_hw *hw;
> struct regmap *map;
> struct regulator *vddio_supply;
> @@ -363,6 +365,9 @@ extern const struct inv_icm42607_hw inv_icm42607_hw_data;
> extern const struct inv_icm42607_hw inv_icm42607p_hw_data;
> extern const struct dev_pm_ops inv_icm42607_pm_ops;
>
More information about the Linux-rockchip
mailing list