mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Francesco Lavra <flavra@baylibre.com>
Cc: "Ramona Gradinariu" <ramona.gradinariu@analog.com>,
	"Antoniu Miclaus" <antoniu.miclaus@analog.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] iio: accel: adxl380: Optimize reading of FIFO entries in interrupt handler
Date: Sun, 11 Jan 2026 13:14:46 +0000	[thread overview]
Message-ID: <20260111131435.6460d968@jic23-huawei> (raw)
In-Reply-To: <20260106193627.3989930-3-flavra@baylibre.com>

On Tue,  6 Jan 2026 20:36:27 +0100
Francesco Lavra <flavra@baylibre.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@baylibre.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;
>  }


      reply	other threads:[~2026-01-11 13:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-06 19:36 [PATCH 0/2] accel: adxl380: improve data reading from FIFO Francesco Lavra
2026-01-06 19:36 ` [PATCH 1/2] iio: accel: adxl380: Avoid reading more entries than present in FIFO Francesco Lavra
2026-01-06 19:36 ` [PATCH 2/2] iio: accel: adxl380: Optimize reading of FIFO entries in interrupt handler Francesco Lavra
2026-01-11 13:14   ` Jonathan Cameron [this message]

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=20260111131435.6460d968@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=antoniu.miclaus@analog.com \
    --cc=dlechner@baylibre.com \
    --cc=flavra@baylibre.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=ramona.gradinariu@analog.com \
    /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

all inboxes | Powered by JetHome®