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 5/8] iio: imu: inv_icm45600: add buffer support in iio devices
Date: Sat, 12 Apr 2025 20:13:54 +0100 [thread overview]
Message-ID: <20250412201354.45eb4dd2@jic23-huawei> (raw)
In-Reply-To: <20250411-add_newport_driver-v1-5-15082160b019@tdk.com>
On Fri, 11 Apr 2025 13:28:37 +0000
Remi Buisson via B4 Relay <devnull+remi.buisson.tdk.com@kernel.org> wrote:
> From: Remi Buisson <remi.buisson@tdk.com>
>
> Add all FIFO parsing and reading functions. Add accel and gyro
> kfifo buffer and FIFO data parsing. Use device interrupt for
> reading data FIFO and launching accel and gyro parsing.
>
> Support hwfifo watermark by multiplexing gyro and accel settings.
> Support hwfifo flush.
>
> Signed-off-by: Remi Buisson <remi.buisson@tdk.com>
I'm out of time and energy today. So just one trivial thing inline.
I'll look more closely at v2 after the patches have been reorganized
to build up features as you go.
Thanks,
Jonathan
> +
> +/**
> + * inv_icm45600_buffer_update_watermark - update watermark FIFO threshold
> + * @st: driver internal state
> + *
> + * Returns 0 on success, a negative error code otherwise.
> + *
> + * FIFO watermark threshold is computed based on the required watermark values
> + * set for gyro and accel sensors. Since watermark is all about acceptable data
> + * latency, use the smallest setting between the 2. It means choosing the
> + * smallest latency but this is not as simple as choosing the smallest watermark
> + * value. Latency depends on watermark and ODR. It requires several steps:
> + * 1) compute gyro and accel latencies and choose the smallest value.
> + * 2) adapt the chosen latency so that it is a multiple of both gyro and accel
> + * ones. Otherwise it is possible that you don't meet a requirement. (for
> + * example with gyro @100Hz wm 4 and accel @100Hz with wm 6, choosing the
> + * value of 4 will not meet accel latency requirement because 6 is not a
> + * multiple of 4. You need to use the value 2.)
> + * 3) Since all periods are multiple of each others, watermark is computed by
> + * dividing this computed latency by the smallest period, which corresponds
> + * to the FIFO frequency.
> + */
> +int inv_icm45600_buffer_update_watermark(struct inv_icm45600_state *st)
> +{
> + raw_wm = INV_ICM45600_FIFO_WATERMARK_VAL(watermark);
> + memcpy(st->buffer, &raw_wm, sizeof(raw_wm));
> + ret = regmap_bulk_write(st->map, INV_ICM45600_REG_FIFO_WATERMARK,
> + st->buffer, sizeof(raw_wm));
> + if (ret)
> + return ret;
> +
> + return 0;
trivial but return regmap_bulk_write()
> +}
next prev parent reply other threads:[~2025-04-12 19:14 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-11 13:28 [PATCH 0/8] iio: imu: new inv_icm45600 driver Remi Buisson via B4 Relay
2025-04-11 13:28 ` [PATCH 1/8] iio: imu: inv_icm45600: add " Remi Buisson via B4 Relay
2025-04-12 19:10 ` Jonathan Cameron
2025-04-11 13:28 ` [PATCH 2/8] iio: imu: inv_icm45600: add I2C driver for " Remi Buisson via B4 Relay
2025-04-11 19:21 ` Andy Shevchenko
2025-04-11 13:28 ` [PATCH 3/8] iio: imu: inv_icm45600: add SPI " Remi Buisson via B4 Relay
2025-04-11 13:28 ` [PATCH 4/8] iio: imu: inv_icm45600: add I3C " Remi Buisson via B4 Relay
2025-04-11 13:28 ` [PATCH 5/8] iio: imu: inv_icm45600: add buffer support in iio devices Remi Buisson via B4 Relay
2025-04-12 19:13 ` Jonathan Cameron [this message]
2025-04-12 19:15 ` Andy Shevchenko
2025-04-11 13:28 ` [PATCH 6/8] iio: imu: add Kconfig and Makefile for inv_icm45600 driver Remi Buisson via B4 Relay
2025-04-11 17:36 ` Jonathan Cameron
2025-04-11 13:28 ` [PATCH 7/8] dt-bindings: iio: imu: Add inv_icm45600 documentation Remi Buisson via B4 Relay
2025-04-11 14:39 ` Rob Herring (Arm)
2025-04-11 21:16 ` Rob Herring
2025-04-11 21:18 ` David Lechner
2025-04-12 18:17 ` Jonathan Cameron
2025-04-12 18:24 ` Jonathan Cameron
2025-04-11 13:28 ` [PATCH 8/8] 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=20250412201354.45eb4dd2@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;
as well as URLs for NNTP newsgroup(s).