From: Kanak Shilledar <Kanak.Shilledar@axis.com>
To: "macromorgan@hotmail.com" <macromorgan@hotmail.com>
Cc: "dlechner@baylibre.com" <dlechner@baylibre.com>,
"joshua.crofts1@gmail.com" <joshua.crofts1@gmail.com>,
Kernel <Kernel@axis.com>,
Henrik Grimler <Henrik.Grimler@axis.com>,
"nuno.sa@analog.com" <nuno.sa@analog.com>,
"jean-baptiste.maneyrol@tdk.com" <jean-baptiste.maneyrol@tdk.com>,
"robh@kernel.org" <robh@kernel.org>,
"jic23@kernel.org" <jic23@kernel.org>,
"andy@kernel.org" <andy@kernel.org>,
"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
"conor+dt@kernel.org" <conor+dt@kernel.org>,
"marcelo.schmitt1@gmail.com" <marcelo.schmitt1@gmail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH v3 7/8] iio: imu: inv_icm42607: Add accelerometer calibbias support
Date: Wed, 16 Sep 2026 09:42:03 +0000 [thread overview]
Message-ID: <e2e6b3b8bcfc841d15241e54eeb18a13ec10994a.camel@axis.com> (raw)
In-Reply-To: <PH0PR19MB9973387A54F1734E51312C4C92A5BA2@PH0PR19MB997338.namprd19.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 4441 bytes --]
Hi Chris,
On Tue, 2026-09-15 at 12:27 -0500, Chris Morgan wrote:
> [Some people who received this message don't often get email from
> macromorgan@hotmail.com. Learn why this is important at
> https://aka.ms/LearnAboutSenderIdentification ]
>
> On Tue, Sep 01, 2026 at 04:36:00PM +0200, Kanak Shilledar wrote:
> > Expose IIO_CHAN_INFO_CALIBBIAS on the accelerometer channels. The
> > registers are stored in MREG1, which can be accessed by the
> > mreg_read
> > and mreg_write routines. The calibration bias is written to
> > OFFSET_USER4
> > to OFFSET_USER8 registers in MREG1.
> >
> > Note: The accelerometer functionality is tested with Invensense,
> > ICM42370-P development board.
> >
> > Datasheet:
> > https://www.invensense.tdk.com/en-us/products/3-axis/icm-42370-p
> > Datasheet: https://www.lcsc.com/product-detail/C5129967.html
> > Signed-off-by: Kanak Shilledar <kanak.shilledar@axis.com>
> > ---
> > drivers/iio/imu/inv_icm42607/inv_icm42607_accel.c | 238
> > +++++++++++++++++++++-
> > 1 file changed, 236 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/iio/imu/inv_icm42607/inv_icm42607_accel.c
> > b/drivers/iio/imu/inv_icm42607/inv_icm42607_accel.c
> > index 318373efeb9e..af2ac9d6a47c 100644
> > --- a/drivers/iio/imu/inv_icm42607/inv_icm42607_accel.c
> > +++ b/drivers/iio/imu/inv_icm42607/inv_icm42607_accel.c
> > @@ -13,6 +13,7 @@
> > #include <linux/pm_runtime.h>
> > #include <linux/regmap.h>
> > #include <linux/types.h>
> > +#include <linux/units.h>
> >
> > #include "inv_icm42607.h"
> > #include "inv_icm42607_temp.h"
> > @@ -22,9 +23,11 @@
> > .type =
> > IIO_ACCEL, \
> > .modified =
> > 1, \
> > .channel2 =
> > _modifier, \
> > - .info_mask_separate =
> > BIT(IIO_CHAN_INFO_RAW), \
> > + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW)
> > | \
> > +
> > BIT(IIO_CHAN_INFO_CALIBBIAS), \
> > .info_mask_shared_by_type =
> > BIT(IIO_CHAN_INFO_SCALE), \
> > - .info_mask_shared_by_type_available =
> > BIT(IIO_CHAN_INFO_SCALE), \
> > + .info_mask_shared_by_type_available =
> > BIT(IIO_CHAN_INFO_SCALE) | \
> > +
> > BIT(IIO_CHAN_INFO_CALIBBIAS), \
> > .info_mask_shared_by_all =
> > BIT(IIO_CHAN_INFO_SAMP_FREQ), \
> > .info_mask_shared_by_all_available =
> > BIT(IIO_CHAN_INFO_SAMP_FREQ), \
> > .scan_index =
> > _index, \
> > @@ -56,6 +59,16 @@ static const struct iio_chan_spec
> > inv_icm42607_accel_channels[] = {
> > INV_ICM42607_TEMP_CHAN(INV_ICM42607_ACCEL_SCAN_TEMP),
> > };
> >
> > +/*
> > + * Calibration bias values, IIO range format int + micro.
> > + * Value is limited to +/-1g coded on 12 bits signed. Step is
> > 0.5mg.
> > + */
> > +static int inv_icm42607_accel_calibbias[] = {
> > + -10, 42010, /* Min : -2^11 * 0.0005 * 9.80665 = -
> > 10.042010 m/s² */
> > + 0, 4903, /* Step: 0.5 * 0.00980655 = 0.004903
> > m/s² */
> > + 10, 37106, /* Max : (2^11 - 1) * 0.0005 * 9.80665 =
> > 10.037106 m/s² */
> > +};
> > +
>
> For whatever it's worth, when I read the calibbias values for my
> board
> from sysfs after applying this patch I get 0.000000 for
> in_accel_x_calibbias (or y or z) and in_accel_calibbias_available
> gives
> me an -EINVAL.
>
> But the accelerometer still seems to output data corresponding to the
> correct orientation.
>
> Thank you,
> Chris
Thanks for testing the patch. I have fixed the
in_accel_calibbias_available returning -EINVAL and should not be giving
the error in the v4.
Best Regards,
Kanak Shilledar
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2026-09-16 9:42 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 14:35 [PATCH v3 0/8] Add support for InvenSense ICM-42370-P accelerometer Kanak Shilledar
2026-09-01 14:35 ` [PATCH v3 1/8] dt-bindings: Add InvenSense ICM-42370-p accelerometer Kanak Shilledar
2026-09-07 1:54 ` Jonathan Cameron
2026-09-16 9:25 ` Kanak Shilledar
2026-09-01 14:35 ` [PATCH v3 2/8] iio: imu: inv_icm42607: Update IIO channel macros Kanak Shilledar
2026-09-01 14:35 ` [PATCH v3 3/8] iio: imu: inv_icm42607: Update _odr_to_period_us formatting Kanak Shilledar
2026-09-07 1:54 ` Jonathan Cameron
2026-09-15 17:20 ` Chris Morgan
2026-09-16 9:23 ` Kanak Shilledar
2026-09-01 14:35 ` [PATCH v3 4/8] iio: imu: inv_icm42607: Switch to little endian Kanak Shilledar
2026-09-07 1:54 ` Jonathan Cameron
2026-09-16 9:26 ` Kanak Shilledar
2026-09-01 14:35 ` [PATCH v3 5/8] iio: imu: inv_icm42607: Add support for ICM-42370-P Kanak Shilledar
2026-09-07 1:54 ` Jonathan Cameron
2026-09-16 9:28 ` Kanak Shilledar
2026-09-01 14:35 ` [PATCH v3 6/8] iio: imu: inv_icm42607: Implement MREGx register access Kanak Shilledar
2026-09-07 1:54 ` Jonathan Cameron
2026-09-07 11:52 ` Jean-Baptiste Maneyrol
2026-09-16 9:30 ` Kanak Shilledar
2026-09-01 14:36 ` [PATCH v3 7/8] iio: imu: inv_icm42607: Add accelerometer calibbias support Kanak Shilledar
2026-09-07 1:54 ` Jonathan Cameron
2026-09-16 9:37 ` Kanak Shilledar
2026-09-16 9:44 ` Joshua Crofts
2026-09-15 17:27 ` Chris Morgan
2026-09-16 9:42 ` Kanak Shilledar [this message]
2026-09-01 14:36 ` [PATCH v3 8/8] iio: imu: inv_icm42607: Add gyroscope " Kanak Shilledar
2026-09-07 1:54 ` Jonathan Cameron
2026-09-02 5:30 ` [PATCH v3 0/8] Add support for InvenSense ICM-42370-P accelerometer Andy Shevchenko
2026-09-07 1:54 ` 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=e2e6b3b8bcfc841d15241e54eeb18a13ec10994a.camel@axis.com \
--to=kanak.shilledar@axis.com \
--cc=Henrik.Grimler@axis.com \
--cc=Kernel@axis.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jean-baptiste.maneyrol@tdk.com \
--cc=jic23@kernel.org \
--cc=joshua.crofts1@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=macromorgan@hotmail.com \
--cc=marcelo.schmitt1@gmail.com \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®