iio: accel: adxl380: Optimize reading of FIFO entries in interrupt handler

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_noinc_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>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Francesco Lavra 2026-01-19 11:23:17 +01:00 committed by Jonathan Cameron
parent c1b1401522
commit 6939484a42

View File

@ -967,14 +967,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,
sizeof(*st->fifo_buf) * fifo_entries);
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;
}