public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Tao Lan <taolan@huawei.com>
To: <linux-i2c@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: taolan <taolan@huawei.com>
Subject: [PATCH] i2c-hix5hd2:  Add I2C_M_STOP flag support for i2c-hix5hd2 driver.
Date: Fri, 30 Sep 2022 01:45:07 +0000	[thread overview]
Message-ID: <20220930014507.5612-1-taolan@huawei.com> (raw)

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(-)

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;
-- 
2.22.0


             reply	other threads:[~2022-09-30  1:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-30  1:45 Tao Lan [this message]
2023-06-10 13:54 ` [PATCH] i2c-hix5hd2: Add I2C_M_STOP flag support for i2c-hix5hd2 driver Andi Shyti
2023-06-14  8:39 ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220930014507.5612-1-taolan@huawei.com \
    --to=taolan@huawei.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox