drivers: i2c_rtio: max32: Inform the rtio executor on errors

Call i2c_rtio_complete with a non-zero status code in case of an error
so that application does not get stuck waiting for the completion queue
event. An example to this situation could be an I2C target device
responding with a NACK to a read or write request by the controller.

Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
This commit is contained in:
Tahsin Mutlugun 2025-04-17 14:47:06 +03:00 committed by Benjamin Cabé
commit c1c31e68b5

View file

@ -199,6 +199,7 @@ static void i2c_max32_isr_controller(const struct device *dev, mxc_i2c_regs_t *i
if (int_fl0 & ADI_MAX32_I2C_INT_FL0_ERR) {
data->err = -EIO;
Wrap_MXC_I2C_SetIntEn(i2c, 0, 0);
max32_complete(dev, data->err);
return;
}
@ -303,7 +304,6 @@ static void max32_complete(const struct device *dev, int status)
struct max32_i2c_data *data = dev->data;
struct i2c_rtio *const ctx = data->ctx;
const struct max32_i2c_config *const cfg = dev->config;
int ret = 0;
if (cfg->regs->clkhi == I2C_STANDAR_BITRATE_CLKHI) {
/* When I2C is configured in Standard Bitrate 100KHz
@ -319,9 +319,12 @@ static void max32_complete(const struct device *dev, int status)
LOG_ERR("For Standard speed HW needs more time to run");
return;
}
if (i2c_rtio_complete(ctx, ret)) {
if (i2c_rtio_complete(ctx, status)) {
data->second_msg_flag = 1;
max32_start(dev);
} else {
data->second_msg_flag = 0;
}
}