linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFT] i2c: algos: bit: prepare/unprepare before sending initial STOP
@ 2018-06-15  5:17 Wolfram Sang
  2018-06-15  8:25 ` Sergei Shtylyov
  0 siblings, 1 reply; 2+ messages in thread
From: Wolfram Sang @ 2018-06-15  5:17 UTC (permalink / raw)
  To: linux-i2c, cerg2010cerg2010; +Cc: linux-renesas-soc, Wolfram Sang, dri-devel

Some adapters need to be prepared/unprepared before bitbanging the bus.
Do this for the initial STOP, too.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Ok, another idea to fix the regression. I'm not 100% sure if the placement is
perfect, but it should serve well enough as a proof of concept to see if this
is the actual issue. It looks promising, though.

 drivers/i2c/algos/i2c-algo-bit.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
index 4a34f311e1ff..fab4437ecbb5 100644
--- a/drivers/i2c/algos/i2c-algo-bit.c
+++ b/drivers/i2c/algos/i2c-algo-bit.c
@@ -648,10 +648,19 @@ static int __i2c_bit_add_bus(struct i2c_adapter *adap,
 		adap->quirks = &i2c_bit_quirk_no_clk_stretch;
 
 	/* Bring bus to a known state. Looks like STOP if bus is not free yet */
+	if (bit_adap->pre_xfer) {
+		ret = bit_adap->pre_xfer(adap);
+		if (ret < 0)
+			return ret;
+	}
+
 	setscl(bit_adap, 1);
 	udelay(bit_adap->udelay);
 	setsda(bit_adap, 1);
 
+	if (bit_adap->post_xfer)
+		bit_adap->post_xfer(adap);
+
 	ret = add_adapter(adap);
 	if (ret < 0)
 		return ret;
-- 
2.11.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RFT] i2c: algos: bit: prepare/unprepare before sending initial STOP
  2018-06-15  5:17 [RFT] i2c: algos: bit: prepare/unprepare before sending initial STOP Wolfram Sang
@ 2018-06-15  8:25 ` Sergei Shtylyov
  0 siblings, 0 replies; 2+ messages in thread
From: Sergei Shtylyov @ 2018-06-15  8:25 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c, cerg2010cerg2010; +Cc: linux-renesas-soc, dri-devel

On 6/15/2018 8:17 AM, Wolfram Sang wrote:

> Some adapters need to be prepared/unprepared before bitbanging the bus.

    Before/after?

> Do this for the initial STOP, too.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
[...]

MBR, Sergei
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-15  8:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-15  5:17 [RFT] i2c: algos: bit: prepare/unprepare before sending initial STOP Wolfram Sang
2018-06-15  8:25 ` Sergei Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).