From: Francesco Lavra <hidden> Date: 2026-01-06 19:36:30
Patch 1 fixes a bug that might cause the adxl380 interrupt handler
to read from the sensor FIFO more entries than actually present.
Patch 2 optimizes transfer of FIFO data by minimizing transport protocol
overhead.
Francesco Lavra (2):
iio: accel: adxl380: Avoid reading more entries than present in FIFO
iio: accel: adxl380: Optimize reading of FIFO entries in interrupt
handler
drivers/iio/accel/adxl380.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
--
2.39.5
From: Francesco Lavra <hidden> Date: 2026-01-06 19:36:31
The interrupt handler reads FIFO entries in batches of N samples, where N
is the number of scan elements that have been enabled. However, the sensor
fills the FIFO one sample at a time, even when more than one channel is
enabled. Therefore,the number of entries reported by the FIFO status
registers may not be a multiple of N; if this number is not a multiple, the
number of entries read from the FIFO may exceed the number of entries
actually present.
To fix the above issue, round down the number of FIFO entries read from the
status registers so that it is always a multiple of N.
Fixes: df36de13677a ("iio: accel: add ADXL380 driver")
Signed-off-by: Francesco Lavra <redacted>
---
drivers/iio/accel/adxl380.c | 1 +
1 file changed, 1 insertion(+)
From: Francesco Lavra <hidden> Date: 2026-01-06 19:36:32
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 <redacted>
---
drivers/iio/accel/adxl380.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
From: Jonathan Cameron <jic23@kernel.org> Date: 2026-01-11 13:14:56
On Tue, 6 Jan 2026 20:36:27 +0100
Francesco Lavra [off-list ref] wrote:
quoted hunk
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 <redacted>
---
drivers/iio/accel/adxl380.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
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
quoted hunk
+ 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; }