i2c: hix5hd2: Add I2C_M_STOP flag support for i2c-hix5hd2 driver.
authortaolan <taolan@huawei.com>
Fri, 30 Sep 2022 01:45:07 +0000 (01:45 +0000)
committerWolfram Sang <wsa@kernel.org>
Wed, 14 Jun 2023 08:38:30 +0000 (10:38 +0200)
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>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
drivers/i2c/busses/i2c-hix5hd2.c

index 64feaa9dca619d7ab44e1a4616df5ef9b3e6298b..48163759c142c2d1fe163e7c9b23492040e82785 100644 (file)
@@ -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;