From: Kanak Shilledar <kanak.shilledar@axis.com>
To: "Henrik Grimler" <henrik.grimler@axis.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Jean-Baptiste Maneyrol" <jean-baptiste.maneyrol@tdk.com>,
"Joshua Crofts" <joshua.crofts1@gmail.com>,
"Marcelo Schmitt" <marcelo.schmitt1@gmail.com>,
"Chris Morgan" <macromorgan@hotmail.com>
Cc: Kanak Shilledar <kanak.shilledar@axis.com>, <kernel@axis.com>,
<linux-iio@vger.kernel.org>, <devicetree@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH v3 3/8] iio: imu: inv_icm42607: Update _odr_to_period_us formatting
Date: Tue, 1 Sep 2026 16:35:56 +0200 [thread overview]
Message-ID: <20260901-b4-inv_icm42370p-v3-3-77cc31642115@axis.com> (raw)
In-Reply-To: <20260901-b4-inv_icm42370p-v3-0-77cc31642115@axis.com>
Update the function formatting for the inv_icm42607_odr_to_period_us
function. This enhances the readability of the function and drop the
unnecessary comments in the array elements.
Signed-off-by: Kanak Shilledar <kanak.shilledar@axis.com>
---
drivers/iio/imu/inv_icm42607/inv_icm42607.h | 20 +++++++-------
drivers/iio/imu/inv_icm42607/inv_icm42607_core.c | 35 ++++++++----------------
2 files changed, 21 insertions(+), 34 deletions(-)
diff --git a/drivers/iio/imu/inv_icm42607/inv_icm42607.h b/drivers/iio/imu/inv_icm42607/inv_icm42607.h
index 4d51b0da1aa1..fa85cf738cc0 100644
--- a/drivers/iio/imu/inv_icm42607/inv_icm42607.h
+++ b/drivers/iio/imu/inv_icm42607/inv_icm42607.h
@@ -62,16 +62,16 @@ enum inv_icm42607_accel_fs {
/* ODR values - Note Gyro does not support ODR less than 12.5Hz */
enum inv_icm42607_odr {
INV_ICM42607_ODR_1600HZ = 5,
- INV_ICM42607_ODR_800HZ = 6,
- INV_ICM42607_ODR_400HZ = 7,
- INV_ICM42607_ODR_200HZ = 8,
- INV_ICM42607_ODR_100HZ = 9,
- INV_ICM42607_ODR_50HZ = 10,
- INV_ICM42607_ODR_25HZ = 11,
- INV_ICM42607_ODR_12_5HZ = 12,
- INV_ICM42607_ODR_6_25HZ_LP = 13,
- INV_ICM42607_ODR_3_125HZ_LP = 14,
- INV_ICM42607_ODR_1_5625HZ_LP = 15,
+ INV_ICM42607_ODR_800HZ,
+ INV_ICM42607_ODR_400HZ,
+ INV_ICM42607_ODR_200HZ,
+ INV_ICM42607_ODR_100HZ,
+ INV_ICM42607_ODR_50HZ,
+ INV_ICM42607_ODR_25HZ,
+ INV_ICM42607_ODR_12_5HZ,
+ INV_ICM42607_ODR_6_25HZ_LP,
+ INV_ICM42607_ODR_3_125HZ_LP,
+ INV_ICM42607_ODR_1_5625HZ_LP,
INV_ICM42607_ODR_NB
};
diff --git a/drivers/iio/imu/inv_icm42607/inv_icm42607_core.c b/drivers/iio/imu/inv_icm42607/inv_icm42607_core.c
index 190e998f7b8e..de3b158f446c 100644
--- a/drivers/iio/imu/inv_icm42607/inv_icm42607_core.c
+++ b/drivers/iio/imu/inv_icm42607/inv_icm42607_core.c
@@ -118,30 +118,17 @@ inv_icm42607_get_mount_matrix(struct iio_dev *indio_dev,
static u32 inv_icm42607_odr_to_period_us(enum inv_icm42607_odr odr)
{
static const u32 odr_periods[INV_ICM42607_ODR_NB] = {
- /* Reserved values */
- 0, 0, 0, 0, 0,
- /* 1600Hz */
- 625,
- /* 800Hz */
- 1250,
- /* 400Hz */
- 2500,
- /* 200Hz */
- 5000,
- /* 100 Hz */
- 10000,
- /* 50Hz */
- 20000,
- /* 25Hz */
- 40000,
- /* 12.5Hz */
- 80000,
- /* 6.25Hz */
- 160000,
- /* 3.125Hz */
- 320000,
- /* 1.5625Hz */
- 640000,
+ [INV_ICM42607_ODR_1600HZ] = 625,
+ [INV_ICM42607_ODR_800HZ] = 1250,
+ [INV_ICM42607_ODR_400HZ] = 2500,
+ [INV_ICM42607_ODR_200HZ] = 5000,
+ [INV_ICM42607_ODR_100HZ] = 10000,
+ [INV_ICM42607_ODR_50HZ] = 20000,
+ [INV_ICM42607_ODR_25HZ] = 40000,
+ [INV_ICM42607_ODR_12_5HZ] = 80000,
+ [INV_ICM42607_ODR_6_25HZ_LP] = 160000,
+ [INV_ICM42607_ODR_3_125HZ_LP] = 320000,
+ [INV_ICM42607_ODR_1_5625HZ_LP] = 640000,
};
odr = clamp(odr, INV_ICM42607_ODR_1600HZ, INV_ICM42607_ODR_1_5625HZ_LP);
--
2.43.0
next prev parent reply other threads:[~2026-09-01 14:36 UTC|newest]
Thread overview: 13+ 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-01 14:42 ` sashiko-bot
2026-09-01 14:35 ` [PATCH v3 2/8] iio: imu: inv_icm42607: Update IIO channel macros Kanak Shilledar
2026-09-01 14:35 ` Kanak Shilledar [this message]
2026-09-01 14:35 ` [PATCH v3 4/8] iio: imu: inv_icm42607: Switch to little endian 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-01 14:35 ` [PATCH v3 6/8] iio: imu: inv_icm42607: Implement MREGx register access Kanak Shilledar
2026-09-01 14:47 ` sashiko-bot
2026-09-01 14:36 ` [PATCH v3 7/8] iio: imu: inv_icm42607: Add accelerometer calibbias support Kanak Shilledar
2026-09-01 14:49 ` sashiko-bot
2026-09-01 14:36 ` [PATCH v3 8/8] iio: imu: inv_icm42607: Add gyroscope " Kanak Shilledar
2026-09-02 5:30 ` [PATCH v3 0/8] Add support for InvenSense ICM-42370-P accelerometer Andy Shevchenko
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=20260901-b4-inv_icm42370p-v3-3-77cc31642115@axis.com \
--to=kanak.shilledar@axis.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=henrik.grimler@axis.com \
--cc=jean-baptiste.maneyrol@tdk.com \
--cc=jic23@kernel.org \
--cc=joshua.crofts1@gmail.com \
--cc=kernel@axis.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