From 1a739132550ade7551c2f6cfeaf745642316e7c9 Mon Sep 17 00:00:00 2001 From: Jeff Glaum Date: Tue, 28 Jan 2025 14:01:43 -0800 Subject: [PATCH] fix missing i2c stop after last message (#51) the boolean flag used to denote the last i2c message wasn't being set to true and as a result, the i2c stop call wasn't issuing a stop sequence. --- drivers/i2c/rk3xi2c/rockchipi2c.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/rk3xi2c/rockchipi2c.c b/drivers/i2c/rk3xi2c/rockchipi2c.c index 69bcba2..d0b9201 100644 --- a/drivers/i2c/rk3xi2c/rockchipi2c.c +++ b/drivers/i2c/rk3xi2c/rockchipi2c.c @@ -186,8 +186,10 @@ static void rk3x_i2c_handle_write(PRK3XI2C_CONTEXT pDevice, unsigned int ipd) write32(pDevice, REG_IPD, REG_INT_MBTF); /* are we finished? */ - if (pDevice->processed >= pDevice->currentDescriptor.TransferLength) + if (pDevice->processed >= pDevice->currentDescriptor.TransferLength) { + pDevice->isLastMsg = TRUE; rk3x_i2c_stop(pDevice, pDevice->transactionStatus); + } else rk3x_i2c_fill_transmit_buf(pDevice); } @@ -227,8 +229,10 @@ static void rk3x_i2c_handle_read(PRK3XI2C_CONTEXT pDevice, unsigned int ipd) } /* are we finished? */ - if (pDevice->processed >= pDevice->currentDescriptor.TransferLength) + if (pDevice->processed >= pDevice->currentDescriptor.TransferLength) { + pDevice->isLastMsg = TRUE; rk3x_i2c_stop(pDevice, pDevice->transactionStatus); + } else rk3x_i2c_prepare_read(pDevice); }