[RFT] i2c: algos: bit: prepare/unprepare before sending initial STOP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxx>
---

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




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux