From: Jonathan Cameron <jic23@kernel.org>
To: Remi Buisson via B4 Relay <devnull+remi.buisson.tdk.com@kernel.org>
Cc: remi.buisson@tdk.com, "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>,
linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH v5 4/9] iio: imu: inv_icm45600: add IMU IIO gyroscope device
Date: Mon, 25 Aug 2025 11:55:52 +0100 [thread overview]
Message-ID: <20250825115552.69abe3b3@jic23-huawei> (raw)
In-Reply-To: <20250820-add_newport_driver-v5-4-2fc9f13dddee@tdk.com>
On Wed, 20 Aug 2025 14:24:22 +0000
Remi Buisson via B4 Relay <devnull+remi.buisson.tdk.com@kernel.org> wrote:
> From: Remi Buisson <remi.buisson@tdk.com>
>
> Add IIO device for gyroscope sensor
> with data polling interface and FIFO parsing.
Wrap at 75 chars for commit messages.
> Attributes: raw, scale, sampling_frequency, calibbias.
> Temperature is available as a processed channel.
>
> Signed-off-by: Remi Buisson <remi.buisson@tdk.com>
> ---
Only thing I noticed is some accelerometer calls are made
where the definitions are in the next patch. To sanity check this
tweak the Kconfig to allow you to build it and make sure that it
builds after each patch. At the end of the day we don't want to have
this build without the bus drivers, but hacking it to test 'it could'
is a great way to avoid issues of code in wrong patches etc, missing
definitions etc.
Jonathan
> drivers/iio/imu/inv_icm45600/Kconfig | 2 +
> drivers/iio/imu/inv_icm45600/Makefile | 1 +
> drivers/iio/imu/inv_icm45600/inv_icm45600.h | 29 +
> drivers/iio/imu/inv_icm45600/inv_icm45600_buffer.c | 76 +-
> drivers/iio/imu/inv_icm45600/inv_icm45600_buffer.h | 5 +-
> drivers/iio/imu/inv_icm45600/inv_icm45600_core.c | 104 ++-
> drivers/iio/imu/inv_icm45600/inv_icm45600_gyro.c | 792 +++++++++++++++++++++
> 7 files changed, 1006 insertions(+), 3 deletions(-)
> diff --git a/drivers/iio/imu/inv_icm45600/inv_icm45600_buffer.c b/drivers/iio/imu/inv_icm45600/inv_icm45600_buffer.c
> index 50fd21a24e34decfbe10426946a51c61353eb6a9..5bf9535e27e8942312fe9749ce0c733149de0a9d 100644
> --- a/drivers/iio/imu/inv_icm45600/inv_icm45600_buffer.c
> +++ b/drivers/iio/imu/inv_icm45600/inv_icm45600_buffer.c
> @@ -459,6 +462,77 @@ int inv_icm45600_buffer_fifo_read(struct inv_icm45600_state *st)
> return 0;
> }
>
> +int inv_icm45600_buffer_fifo_parse(struct inv_icm45600_state *st)
> +{
> + struct inv_icm45600_sensor_state *gyro_st = iio_priv(st->indio_gyro);
> + struct inv_icm45600_sensor_state *accel_st = iio_priv(st->indio_accel);
> + struct inv_sensors_timestamp *ts;
> + int ret;
> +
> + if (st->fifo.nb.total == 0)
> + return 0;
> +
> + /* Handle gyroscope timestamp and FIFO data parsing. */
> + if (st->fifo.nb.gyro > 0) {
> + ts = &gyro_st->ts;
> + inv_sensors_timestamp_interrupt(ts, st->fifo.watermark.eff_gyro,
> + st->timestamp.gyro);
> + ret = inv_icm45600_gyro_parse_fifo(st->indio_gyro);
> + if (ret)
> + return ret;
> + }
> +
> + /* Handle accelerometer timestamp and FIFO data parsing. */
> + if (st->fifo.nb.accel > 0) {
> + ts = &accel_st->ts;
> + inv_sensors_timestamp_interrupt(ts, st->fifo.watermark.eff_accel,
> + st->timestamp.accel);
> + ret = inv_icm45600_accel_parse_fifo(st->indio_accel);
As below. No accel stuff available yet.
> + if (ret)
> + return ret;
> + }
> +
> + return 0;
> +}
> +
> +int inv_icm45600_buffer_hwfifo_flush(struct inv_icm45600_state *st,
> + unsigned int count)
> +{
> + struct inv_icm45600_sensor_state *gyro_st = iio_priv(st->indio_gyro);
> + struct inv_icm45600_sensor_state *accel_st = iio_priv(st->indio_accel);
> + struct inv_sensors_timestamp *ts;
> + s64 gyro_ts, accel_ts;
> + int ret;
> +
> + gyro_ts = iio_get_time_ns(st->indio_gyro);
> + accel_ts = iio_get_time_ns(st->indio_accel);
> +
> + ret = inv_icm45600_buffer_fifo_read(st, count);
> + if (ret)
> + return ret;
> +
> + if (st->fifo.nb.total == 0)
> + return 0;
> +
> + if (st->fifo.nb.gyro > 0) {
> + ts = &gyro_st->ts;
> + inv_sensors_timestamp_interrupt(ts, st->fifo.nb.gyro, gyro_ts);
> + ret = inv_icm45600_gyro_parse_fifo(st->indio_gyro);
> + if (ret)
> + return ret;
> + }
> +
> + if (st->fifo.nb.accel > 0) {
> + ts = &accel_st->ts;
> + inv_sensors_timestamp_interrupt(ts, st->fifo.nb.accel, accel_ts);
> + ret = inv_icm45600_accel_parse_fifo(st->indio_accel);
This call should be in the next patch as it's not defined yet.
> + if (ret)
> + return ret;
> + }
> +
> + return 0;
> +}
next prev parent reply other threads:[~2025-08-25 10:56 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-20 14:24 [PATCH v5 0/9] iio: imu: new inv_icm45600 driver Remi Buisson via B4 Relay
2025-08-20 14:24 ` [PATCH v5 1/9] dt-bindings: iio: imu: Add inv_icm45600 Remi Buisson via B4 Relay
2025-08-20 19:33 ` Conor Dooley
2025-08-20 14:24 ` [PATCH v5 2/9] iio: imu: inv_icm45600: add new inv_icm45600 driver Remi Buisson via B4 Relay
2025-08-21 9:02 ` Andy Shevchenko
2025-09-04 12:58 ` Remi Buisson
2025-09-04 13:17 ` Andy Shevchenko
2025-09-05 12:43 ` Remi Buisson
2025-09-05 13:47 ` Andy Shevchenko
2025-08-25 10:34 ` Jonathan Cameron
2025-09-04 13:04 ` Remi Buisson
2025-09-07 13:31 ` Jonathan Cameron
2025-08-20 14:24 ` [PATCH v5 3/9] iio: imu: inv_icm45600: add buffer support in iio devices Remi Buisson via B4 Relay
2025-08-21 9:20 ` Andy Shevchenko
2025-09-04 13:01 ` Remi Buisson
2025-09-04 13:49 ` Andy Shevchenko
2025-09-05 12:44 ` Remi Buisson
2025-09-05 13:49 ` Andy Shevchenko
2025-09-07 13:34 ` Jonathan Cameron
2025-09-22 8:52 ` Remi Buisson
2025-08-25 10:42 ` Jonathan Cameron
2025-09-04 13:05 ` Remi Buisson
2025-08-20 14:24 ` [PATCH v5 4/9] iio: imu: inv_icm45600: add IMU IIO gyroscope device Remi Buisson via B4 Relay
2025-08-25 10:55 ` Jonathan Cameron [this message]
2025-09-04 13:06 ` Remi Buisson
2025-08-20 14:24 ` [PATCH v5 5/9] iio: imu: inv_icm45600: add IMU IIO accelerometer device Remi Buisson via B4 Relay
2025-08-20 14:24 ` [PATCH v5 6/9] iio: imu: inv_icm45600: add I2C driver for inv_icm45600 driver Remi Buisson via B4 Relay
2025-08-20 14:24 ` [PATCH v5 7/9] iio: imu: inv_icm45600: add SPI " Remi Buisson via B4 Relay
2025-08-20 14:24 ` [PATCH v5 8/9] iio: imu: inv_icm45600: add I3C " Remi Buisson via B4 Relay
2025-08-20 14:24 ` [PATCH v5 9/9] MAINTAINERS: add entry for inv_icm45600 6-axis imu sensor Remi Buisson via B4 Relay
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=20250825115552.69abe3b3@jic23-huawei \
--to=jic23@kernel.org \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=devnull+remi.buisson.tdk.com@kernel.org \
--cc=dlechner@baylibre.com \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=remi.buisson@tdk.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