Skip to content

Commit c1c31e6

Browse files
ttmutkartben
authored andcommitted
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 <[email protected]>
1 parent f28f412 commit c1c31e6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/i2c/i2c_max32_rtio.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ static void i2c_max32_isr_controller(const struct device *dev, mxc_i2c_regs_t *i
199199
if (int_fl0 & ADI_MAX32_I2C_INT_FL0_ERR) {
200200
data->err = -EIO;
201201
Wrap_MXC_I2C_SetIntEn(i2c, 0, 0);
202+
max32_complete(dev, data->err);
202203
return;
203204
}
204205

@@ -303,7 +304,6 @@ static void max32_complete(const struct device *dev, int status)
303304
struct max32_i2c_data *data = dev->data;
304305
struct i2c_rtio *const ctx = data->ctx;
305306
const struct max32_i2c_config *const cfg = dev->config;
306-
int ret = 0;
307307

308308
if (cfg->regs->clkhi == I2C_STANDAR_BITRATE_CLKHI) {
309309
/* When I2C is configured in Standard Bitrate 100KHz
@@ -319,9 +319,12 @@ static void max32_complete(const struct device *dev, int status)
319319
LOG_ERR("For Standard speed HW needs more time to run");
320320
return;
321321
}
322-
if (i2c_rtio_complete(ctx, ret)) {
322+
323+
if (i2c_rtio_complete(ctx, status)) {
323324
data->second_msg_flag = 1;
324325
max32_start(dev);
326+
} else {
327+
data->second_msg_flag = 0;
325328
}
326329
}
327330

0 commit comments

Comments
 (0)