All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Kanak Shilledar" <kanak.shilledar@axis.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v4 5/5] iio: imu: inv_icm42607: Add accelerometer calibbias support
Date: Thu, 17 Sep 2026 13:50:27 +0000	[thread overview]
Message-ID: <20260917135028.135A31F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260917-b4-inv_icm42370p-v4-5-fd9373f123c9@axis.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] iio: imu: inv_icm42607: calibration bias lost across suspend
--

commit 265a6fbb240f73261702e44167f3a068fc676f5f
Author: Kanak Shilledar <kanak.shilledar@axis.com>

iio: imu: inv_icm42607: Add accelerometer calibbias support

Expose IIO_CHAN_INFO_CALIBBIAS on the accelerometer channels. The
registers are stored in MREG1. The calibration bias is written to
OFFSET_USER4 to OFFSET_USER8 registers in MREG1. Reject the out of
limit calibbias values instead of clamping it.

Datasheet: https://www.invensense.tdk.com/en-us/products/3-axis/icm-42370-p
Datasheet: https://www.lcsc.com/product-detail/C5129967.html

> diff --git a/drivers/iio/imu/inv_icm42607/inv_icm42607_accel.c b/drivers/iio/imu/inv_icm42607/inv_icm42607_accel.c
> index 8f61bc9014526..39c5a3f80b2eb 100644
> --- a/drivers/iio/imu/inv_icm42607/inv_icm42607_accel.c
> +++ b/drivers/iio/imu/inv_icm42607/inv_icm42607_accel.c

[ ... ]

> @@ -176,6 +189,171 @@ static int inv_icm42607_accel_write_odr(struct iio_dev *indio_dev,
>  	return inv_icm42607_set_sensor_conf(st, &conf, IIO_ACCEL);
>  }
>  

[ ... ]

> +static int inv_icm42607_accel_write_offset(struct iio_dev *indio_dev,
> +					   struct iio_chan_spec const *chan,
> +					   int val, int val2)
> +{

[ ... ]

> +	switch (chan->channel2) {
> +	case IIO_MOD_X:
> +		/* OFFSET_USER4 upper nibble is shared. */
> +		ret = regmap_update_bits(st->map, INV_ICM42607_REG_OFFSET_USER4,
> +					 GENMASK(7, 4), (offset & 0xF00) >> 4);

[Severity: Medium]
Are user-configured accelerometer calibration biases lost across system
suspend and resume cycles?

Since inv_icm42607_accel_write_offset() writes directly to the MREG1 bank
registers in drivers/iio/imu/inv_icm42607/inv_icm42607_accel.c, and the
driver explicitly marks MREG registers as volatile in
inv_icm42607_is_volatile_reg():

    if ((reg & INV_ICM42607_REG_BANK_MASK) != INV_ICM42607_BANK0)
        return true;

won't regcache_sync() skip these registers upon resume?

If the vddio_supply is turned off during suspend, the sensor's internal
state is wiped. Because regmap doesn't cache volatile registers, the
calibration biases would be reset to zero upon resume instead of being
restored.

Could this be updated to cache the user's bias setting in the driver's
software state so it can be restored after resume?

> +		if (ret)
> +			return ret;
> +
> +		return regmap_write(st->map, INV_ICM42607_REG_OFFSET_USER5,
> +				    offset & 0xFF);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260917-b4-inv_icm42370p-v4-0-fd9373f123c9@axis.com?part=5

  reply	other threads:[~2026-09-17 13:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 13:38 [PATCH v4 0/5] Add support for InvenSense ICM-42370-P accelerometer Kanak Shilledar
2026-09-17 13:38 ` [PATCH v4 1/5] dt-bindings: Add InvenSense ICM-42370-p accelerometer Kanak Shilledar
2026-09-20 13:52   ` Marcelo Schmitt
2026-09-28  8:55     ` Kanak Shilledar
2026-09-28 17:56       ` Rob Herring
2026-09-29 15:15       ` Marcelo Schmitt
2026-09-28 17:58   ` Rob Herring
2026-09-17 13:38 ` [PATCH v4 2/5] iio: imu: inv_icm42607: Simplify IIO channel macros Kanak Shilledar
2026-09-20 13:55   ` Marcelo Schmitt
2026-09-20 23:29     ` Jonathan Cameron
2026-09-17 13:38 ` [PATCH v4 3/5] iio: imu: inv_icm42607: Add support for ICM-42370-P Kanak Shilledar
2026-09-17 13:49   ` sashiko-bot
2026-09-20 14:03   ` Marcelo Schmitt
2026-09-20 23:33   ` Jonathan Cameron
2026-09-17 13:38 ` [PATCH v4 4/5] iio: imu: inv_icm42607: Implement MREGx register access Kanak Shilledar
2026-09-17 13:51   ` sashiko-bot
2026-09-20 14:09   ` Marcelo Schmitt
2026-09-20 23:51   ` Jonathan Cameron
2026-09-17 13:38 ` [PATCH v4 5/5] iio: imu: inv_icm42607: Add accelerometer calibbias support Kanak Shilledar
2026-09-17 13:50   ` sashiko-bot [this message]
2026-09-20 23:55   ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260917135028.135A31F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=kanak.shilledar@axis.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.