i2c: busses: i2c-rk3x: Fix msg length 32 for autostop tx only mode

If autostop mode is enabled, such as RK3588, autostop mode requires
statistics on the transmission length; for tx only mode, the device
address is also counted as one byte, so the judgment conditions become
different.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I91c0b68fabb60952f630a98133423aa4cb1b9b48
This commit is contained in:
David Wu
2023-10-08 19:22:41 +08:00
committed by Tao Huang
parent e5ab4cbe7f
commit f67504a486

View File

@@ -307,6 +307,13 @@ static bool rk3x_i2c_auto_stop(struct rk3x_i2c *i2c)
if (len > 32)
goto out;
/* For tx mode, one byte of the device address also needs to be counted,
* if the data length is equal to 32, which is actually 33 bytes, it would
* need to be divided into two parts, and needs to jump out of autostop.
*/
if (i2c->msg->len == 32 && i2c->mode == REG_CON_MOD_TX && !i2c->processed)
goto out;
i2c->state = STATE_STOP;
con1 |= REG_CON1_TRANSFER_AUTO_STOP | REG_CON1_AUTO_STOP;