From: Jean Delvare <jdelvare@suse.de>
To: Linux I2C <linux-i2c@vger.kernel.org>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
linux-renesas-soc@vger.kernel.org
Subject: [PATCH v2] i2c: algo-bit: add support for I2C_M_STOP
Date: Wed, 21 Jun 2017 09:24:02 +0200 [thread overview]
Message-ID: <20170621092402.773a4b14@endymion> (raw)
Support for enforced STOPs will allow us to use SCCB compatible devices.
Based on a preliminary patch by Wolfram Sang.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
Changes since v1:
* Simplify logic
drivers/i2c/algos/i2c-algo-bit.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
--- linux-4.11.orig/drivers/i2c/algos/i2c-algo-bit.c 2017-06-19 09:57:17.949074198 +0200
+++ linux-4.11/drivers/i2c/algos/i2c-algo-bit.c 2017-06-21 09:07:07.910049960 +0200
@@ -553,9 +553,18 @@ static int bit_xfer(struct i2c_adapter *
nak_ok = pmsg->flags & I2C_M_IGNORE_NAK;
if (!(pmsg->flags & I2C_M_NOSTART)) {
if (i) {
- bit_dbg(3, &i2c_adap->dev, "emitting "
- "repeated start condition\n");
- i2c_repstart(adap);
+ if (msgs[i - 1].flags & I2C_M_STOP) {
+ bit_dbg(3, &i2c_adap->dev,
+ "emitting enforced stop condition\n");
+ i2c_stop(adap);
+ bit_dbg(3, &i2c_adap->dev,
+ "emitting start condition\n");
+ i2c_start(adap);
+ } else {
+ bit_dbg(3, &i2c_adap->dev,
+ "emitting repeated start condition\n");
+ i2c_repstart(adap);
+ }
}
ret = bit_doAddress(i2c_adap, pmsg);
if ((ret != 0) && !nak_ok) {
--
Jean Delvare
SUSE L3 Support
next reply other threads:[~2017-06-21 7:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-21 7:24 Jean Delvare [this message]
2017-06-21 14:54 ` [PATCH v2] i2c: algo-bit: add support for I2C_M_STOP Wolfram Sang
2017-06-22 9:06 ` Jean Delvare
2017-06-23 18:47 ` 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=20170621092402.773a4b14@endymion \
--to=jdelvare@suse.de \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=wsa+renesas@sang-engineering.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.