From: Jonathan Cameron <jic23@kernel.org>
To: Remi Buisson <Remi.Buisson@tdk.com>
Cc: "Remi Buisson via B4 Relay"
<devnull+remi.buisson.tdk.com@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>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH v2 3/8] iio: imu: inv_icm45600: add buffer support in iio devices
Date: Sat, 16 Aug 2025 12:17:13 +0100 [thread overview]
Message-ID: <20250816121713.48c01e62@jic23-huawei> (raw)
In-Reply-To: <FR2PPF4571F02BCAEF9767DFCEAC0031CB08C28A@FR2PPF4571F02BC.DEUP281.PROD.OUTLOOK.COM>
On Mon, 11 Aug 2025 14:13:54 +0000
Remi Buisson <Remi.Buisson@tdk.com> wrote:
> >
> >
> >From: Jonathan Cameron <jic23@kernel.org>
> >Sent: Thursday, July 17, 2025 4:34 PM
> >To: Remi Buisson via B4 Relay <devnull+remi.buisson.tdk.com@kernel.org>
> >Cc: Remi Buisson <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 v2 3/8] iio: imu: inv_icm45600: add buffer support in iio devices
> >On Thu, 10 Jul 2025 08:57:58 +0000
> >Remi Buisson via B4 Relay <devnull+remi.buisson.tdk.com@kernel.org> wrote:
> >
> >> From: Remi Buisson <remi.buisson@tdk.com>
> >>
> >> Add FIFO control functions.
> >> Support hwfifo watermark by multiplexing gyro and accel settings.
> >> Support hwfifo flush.
> >>
> >> Signed-off-by: Remi Buisson <remi.buisson@tdk.com>
> >Hi Remi,
> >
> >Sorry for delay - hectic week.
> >
> >Jonathan
> No problem, thanks for the review ! (and sorry for my late reply)
> >
> >> ---
> >> drivers/iio/imu/inv_icm45600/Makefile | 1 +
> >> drivers/iio/imu/inv_icm45600/inv_icm45600.h | 4 +
> >> drivers/iio/imu/inv_icm45600/inv_icm45600_buffer.c | 514 +++++++++++++++++++++
> >> drivers/iio/imu/inv_icm45600/inv_icm45600_buffer.h | 99 ++++
> >> drivers/iio/imu/inv_icm45600/inv_icm45600_core.c | 137 +++++-
> >We used to do the buffer / core split a lot but it often ends up more trouble
> >that it is worth and we no longer make buffer support a build time option (which was
> >what motivated the separate files) Consider how much simplification you'd get by squashing them into
> >one file.
> I understand the point.
> However merging files will allow to remove 5 lines at most,
> while the length of the core file will increase a lot.
> I'm not sure of the benefit in the end, but
> please let me know if you really want me to proceed with the merge.
It's only a combined 1.5k. That would be fine even if the savings are fairly small.
It's not something I care that much about though.
> >> +const struct iio_buffer_setup_ops inv_icm45600_buffer_ops = {
> >> + .preenable = inv_icm45600_buffer_preenable,
> >> + .postenable = inv_icm45600_buffer_postenable,
> >> + .predisable = inv_icm45600_buffer_predisable,
> >> + .postdisable = inv_icm45600_buffer_postdisable,
> >> +};
> >> +
> >> +int inv_icm45600_buffer_fifo_read(struct inv_icm45600_state *st,
> >> + unsigned int max)
> >What is max here? Seems to be passed 0 in the only caller.
> Function call with max > 0 is implemented later in the same patch
> (in 4/8, from inv_icm45600_buffer_hwfifo_flush).
Maybe push the parameter being introduced to ther.
> >> +{
> >> + const ssize_t packet_size = INV_ICM45600_FIFO_2SENSORS_PACKET_SIZE;
> >> + __le16 *raw_fifo_count;
> >> + size_t fifo_nb, i;
> >> + ssize_t size;
> >> + const struct inv_icm45600_fifo_sensor_data *accel, *gyro;
> >> + const __le16 *timestamp;
> >> + const s8 *temp;
> >> + unsigned int odr;
> >> + int ret;
> >> +
> >> + /* Reset all samples counters. */
> >> + st->fifo.count = 0;
> >> + st->fifo.nb.gyro = 0;
> >> + st->fifo.nb.accel = 0;
> >> + st->fifo.nb.total = 0;
> >> +
> >> + /* Read FIFO count value. */
> >> + raw_fifo_count = &st->buffer.u16;
> >> + ret = regmap_bulk_read(st->map, INV_ICM45600_REG_FIFO_COUNT,
> >> + raw_fifo_count, sizeof(*raw_fifo_count));
> >
> >For IIO drivers at least we still operated under some guidance the regmap maintainer
> >gave years ago to never assume regmap (for busses that otherwise require DMA safe
> >buffers) will always bounce the data. So bulk reads with SPI buffers need
> >DMA safe buffers. Easiest is usually an __aligned(IIO_DMA_MINALIGN) buffer
> >(or set of buffers) at the end of st.
> >
> >In practice last time I checked regmap doesn't bother with the zero copy
> >optimization that would need this safety so you won't actually hit this
> >issue.
> From my understanding, alignment of &st->buffer.u16 is correct because the union is aligned,
>
> union {
> u8 buff[2];
> __le16 u16;
> } buffer __aligned(IIO_DMA_MINALIGN);
>
> Please let me know if my answer is not correct.
Ah. I probably just missed that. can't remember!
> >
next prev parent reply other threads:[~2025-08-16 11:17 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-10 8:57 [PATCH v2 0/8] iio: imu: new inv_icm45600 driver Remi Buisson via B4 Relay
2025-07-10 8:57 ` [PATCH v2 1/8] dt-bindings: iio: imu: Add inv_icm45600 Remi Buisson via B4 Relay
2025-07-10 22:41 ` Rob Herring
2025-07-11 11:40 ` Remi Buisson
2025-07-14 5:38 ` Krzysztof Kozlowski
2025-07-15 8:35 ` Remi Buisson
2025-07-15 12:16 ` Krzysztof Kozlowski
2025-07-16 14:31 ` Remi Buisson
2025-08-19 10:19 ` Remi Buisson
[not found] ` <FR2PPF4571F02BC2C08BFD80F57AC4F45AA8C30A@FR2PPF4571F02BC.DEUP281.PROD.OUTLOOK.COM>
2025-08-19 14:28 ` Krzysztof Kozlowski
2025-08-19 14:53 ` Remi Buisson
2025-07-10 8:57 ` [PATCH v2 2/8] iio: imu: inv_icm45600: add new inv_icm45600 driver Remi Buisson via B4 Relay
2025-07-10 9:29 ` Andy Shevchenko
2025-07-11 11:39 ` Remi Buisson
[not found] ` <FR2PPF4571F02BC5366477EC02E9C44041A8C4BA@FR2PPF4571F02BC.DEUP281.PROD.OUTLOOK.COM>
2025-07-11 11:55 ` Andy Shevchenko
2025-07-15 9:11 ` Remi Buisson
2025-07-15 10:42 ` Andy Shevchenko
2025-07-15 15:26 ` Remi Buisson
2025-07-16 9:25 ` Andy Shevchenko
2025-07-11 2:58 ` kernel test robot
2025-07-13 16:00 ` Jonathan Cameron
2025-07-15 9:33 ` Remi Buisson
2025-07-10 8:57 ` [PATCH v2 3/8] iio: imu: inv_icm45600: add buffer support in iio devices Remi Buisson via B4 Relay
2025-07-17 14:33 ` Jonathan Cameron
2025-08-11 14:13 ` Remi Buisson
2025-08-16 11:17 ` Jonathan Cameron [this message]
2025-08-20 13:34 ` Remi Buisson
2025-07-10 8:57 ` [PATCH v2 4/8] iio: imu: inv_icm45600: add IMU IIO devices Remi Buisson via B4 Relay
2025-07-17 14:47 ` Jonathan Cameron
2025-08-11 14:56 ` Remi Buisson
2025-07-10 8:58 ` [PATCH v2 5/8] iio: imu: inv_icm45600: add I2C driver for inv_icm45600 driver Remi Buisson via B4 Relay
2025-07-11 7:24 ` kernel test robot
2025-07-14 20:21 ` Dan Carpenter
2025-07-15 8:09 ` Andy Shevchenko
2025-07-15 9:17 ` Remi Buisson
2025-07-10 8:58 ` [PATCH v2 6/8] iio: imu: inv_icm45600: add SPI " Remi Buisson via B4 Relay
2025-07-11 4:55 ` kernel test robot
2025-07-11 6:09 ` Andy Shevchenko
2025-07-15 9:18 ` Remi Buisson
2025-07-10 8:58 ` [PATCH v2 7/8] iio: imu: inv_icm45600: add I3C " Remi Buisson via B4 Relay
2025-07-14 12:56 ` Sean Nyekjaer
2025-07-15 8:48 ` Remi Buisson
2025-07-10 8:58 ` [PATCH v2 8/8] MAINTAINERS: add entry for inv_icm45600 6-axis imu sensor Remi Buisson via B4 Relay
2025-07-14 12:06 ` [PATCH v2 0/8] iio: imu: new inv_icm45600 driver Sean Nyekjaer
2025-07-15 9:03 ` Remi Buisson
2025-07-15 9:18 ` Sean Nyekjaer
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=20250816121713.48c01e62@jic23-huawei \
--to=jic23@kernel.org \
--cc=Remi.Buisson@tdk.com \
--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=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