-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Description
Describe the bug
SPI RTIO default handler does not properly execute multi-transaction OPs (e.g: write + read in a single transfer).
Expected behavior
The expectation is to perform a single SPI transfer without de-asserting CS line.
What is currently happening is that the CS line is de-asserted at the end of each OP, resetting the state for the second or third operations.
Impact
In-tree Sensor drivers depend on this behavior, for instance:
- ICM42688:
zephyr/drivers/sensor/tdk/icm42688/icm42688_rtio_stream.c
Lines 155 to 158 in 1280f43
rtio_sqe_prep_tiny_write(write_fifo_addr, spi_iodev, RTIO_PRIO_NORM, ®_addr, 1, NULL); write_fifo_addr->flags = RTIO_SQE_TRANSACTION; rtio_sqe_prep_read(read_fifo_data, spi_iodev, RTIO_PRIO_NORM, read_buf, read_len, iodev_sqe); - ADXL's:
zephyr/drivers/sensor/adi/adxl345/adxl345_stream.c
Lines 212 to 217 in 1280f43
rtio_sqe_prep_tiny_write(write_fifo_addr, data->iodev, RTIO_PRIO_NORM, ®_addr, 1, NULL); write_fifo_addr->flags = RTIO_SQE_TRANSACTION; rtio_sqe_prep_read(read_fifo_data, data->iodev, RTIO_PRIO_NORM, read_buf + data->fifo_total_bytes, SAMPLE_SIZE, current_sqe); - LSM6DSV:
zephyr/drivers/sensor/st/lsm6dsv16x/lsm6dsv16x_rtio_stream.c
Lines 358 to 361 in 1280f43
rtio_sqe_prep_tiny_write(write_fifo_dout_addr, iodev, RTIO_PRIO_NORM, ®, 1, NULL); write_fifo_dout_addr->flags = RTIO_SQE_TRANSACTION; rtio_sqe_prep_read(read_fifo_dout_reg, iodev, RTIO_PRIO_NORM, read_buf, buf_avail, lsm6dsv16x->streaming_sqe);
Additional context
A similar fix was already applied to i2c_rtio_default: #79890.