[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260111131435.6460d968@jic23-huawei>
Date: Sun, 11 Jan 2026 13:14:46 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Francesco Lavra <flavra@...libre.com>
Cc: Ramona Gradinariu <ramona.gradinariu@...log.com>, Antoniu Miclaus
<antoniu.miclaus@...log.com>, Lars-Peter Clausen <lars@...afoo.de>, Michael
Hennerich <Michael.Hennerich@...log.com>, David Lechner
<dlechner@...libre.com>, Nuno Sá <nuno.sa@...log.com>, Andy
Shevchenko <andy@...nel.org>, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] iio: accel: adxl380: Optimize reading of FIFO
entries in interrupt handler
On Tue, 6 Jan 2026 20:36:27 +0100
Francesco Lavra <flavra@...libre.com> wrote:
> In order to minimize the time required for transferring FIFO data from the
> sensor to the host machine, perform the read from the FIFO in a single call
> to regmap_bulk_read().
> This allows reading acceleration data for all 3 axes at 16 kHz
> sampling frequency using a 1MHz I2C bus frequency.
>
> Signed-off-by: Francesco Lavra <flavra@...libre.com>
> ---
> drivers/iio/accel/adxl380.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/iio/accel/adxl380.c b/drivers/iio/accel/adxl380.c
> index 9f6c0e02575a..ce3643c5deb8 100644
> --- a/drivers/iio/accel/adxl380.c
> +++ b/drivers/iio/accel/adxl380.c
> @@ -950,14 +950,12 @@ static irqreturn_t adxl380_irq_handler(int irq, void *p)
> return IRQ_HANDLED;
>
> fifo_entries = rounddown(fifo_entries, st->fifo_set_size);
> - for (i = 0; i < fifo_entries; i += st->fifo_set_size) {
> - ret = regmap_noinc_read(st->regmap, ADXL380_FIFO_DATA,
> - &st->fifo_buf[i],
> - 2 * st->fifo_set_size);
> - if (ret)
> - return IRQ_HANDLED;
> + ret = regmap_noinc_read(st->regmap, ADXL380_FIFO_DATA,
> + &st->fifo_buf, 2 * fifo_entries);
Whilst we are here can we replace that 2 with sizeof(*st->fifo_buf)?
Otherwise, Antoniu, can you take a look at these change.
Seem reasonable to me. Given we are fairly late in the cycle I'll
probably merge them both for the next merge window and we'll have
to wait until after that for the fix to make it to stable.
Jonathan
> + if (ret)
> + return IRQ_HANDLED;
> + for (i = 0; i < fifo_entries; i += st->fifo_set_size)
> iio_push_to_buffers(indio_dev, &st->fifo_buf[i]);
> - }
>
> return IRQ_HANDLED;
> }
Powered by blists - more mailing lists