drivers: i2c_nrfx_twi_rtio: Fix multi-writes with OP_TRANSACTION flag

This patch establishes proper handling of RTIO OPs with multiple write
requests in the same transfer (as in: including OP_TRANSACTION flag).
An example of this is captured in test_ram_rtio_write_with_transaction
test). This patch makes that testcase pass for i2c_nrfx_twi_rtio.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
This commit is contained in:
Luis Ubieda 2025-04-09 15:55:00 -04:00 committed by Benjamin Cabé
commit d1b79aa5bc

View file

@ -41,6 +41,8 @@ static bool i2c_nrfx_twi_rtio_msg_start(const struct device *dev, uint8_t flags,
struct i2c_nrfx_twi_rtio_data *const dev_data = dev->data;
struct i2c_rtio *ctx = dev_data->ctx;
int ret = 0;
bool more_msgs = (rtio_txn_next(ctx->txn_curr) != NULL) &&
((ctx->txn_curr->next->sqe.iodev_flags & RTIO_IODEV_I2C_RESTART) == 0);
/** Enabling while already enabled ends up in a failed assertion: skip it. */
if (!dev_data->twi_enabled) {
@ -48,7 +50,7 @@ static bool i2c_nrfx_twi_rtio_msg_start(const struct device *dev, uint8_t flags,
dev_data->twi_enabled = true;
}
ret = i2c_nrfx_twi_msg_transfer(dev, flags, buf, buf_len, i2c_addr, false);
ret = i2c_nrfx_twi_msg_transfer(dev, flags, buf, buf_len, i2c_addr, more_msgs);
if (ret != 0) {
nrfx_twi_disable(&config->twi);
dev_data->twi_enabled = false;