diff mbox series

i2c-hix5hd2: Add I2C_M_STOP flag support for i2c-hix5hd2 driver.

Message ID 20220930014507.5612-1-taolan@huawei.com
State New
Headers show
Series i2c-hix5hd2: Add I2C_M_STOP flag support for i2c-hix5hd2 driver. | expand

Commit Message

Tao Lan Sept. 30, 2022, 1:45 a.m. UTC
From: taolan <taolan@huawei.com>

For compatibility, some devices need to work with controller between
messages using a stop.

Signed-off-by: taolan <taolan@huawei.com>
---
 drivers/i2c/busses/i2c-hix5hd2.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Andi Shyti June 10, 2023, 1:54 p.m. UTC | #1
Hi Taolan,

On Fri, Sep 30, 2022 at 01:45:07AM +0000, Tao Lan wrote:
> From: taolan <taolan@huawei.com>
> 
> For compatibility, some devices need to work with controller between
> messages using a stop.
> 
> Signed-off-by: taolan <taolan@huawei.com>

Acked-by: Andi Shyti <andi.shyti@kernel.org> 

Thanks,
Andi
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-hix5hd2.c b/drivers/i2c/busses/i2c-hix5hd2.c
index 61ae58f57047..e5042e34ecc7 100644
--- a/drivers/i2c/busses/i2c-hix5hd2.c
+++ b/drivers/i2c/busses/i2c-hix5hd2.c
@@ -360,7 +360,11 @@  static int hix5hd2_i2c_xfer(struct i2c_adapter *adap,
 	pm_runtime_get_sync(priv->dev);
 
 	for (i = 0; i < num; i++, msgs++) {
-		stop = (i == num - 1);
+		if ((i == num - 1) || (msgs->flags & I2C_M_STOP))
+			stop = 1;
+		else
+			stop = 0;
+
 		ret = hix5hd2_i2c_xfer_msg(priv, msgs, stop);
 		if (ret < 0)
 			goto out;