aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/algos/i2c-algo-bit.c
diff options
context:
space:
mode:
authorWolfram Sang <wsa+renesas@sang-engineering.com>2017-12-04 03:16:18 -0500
committerWolfram Sang <wsa@the-dreams.de>2017-12-30 18:16:37 -0500
commit3e5f06bed72fe72166a6778f630241a893f67799 (patch)
treeecfdc707cf42d7e687ba406bc8042ba502c65bb4 /drivers/i2c/algos/i2c-algo-bit.c
parente53537653791b4aaa9ec88a9eb5fd187d44ff6ac (diff)
i2c: algo-bit: init the bus to a known state
Ensure the bus is free when we register the adapter. Before the SCL/SDA wires were in an unknown state. It used to work because sending a byte has a retry mechanism which was triggered if the bus was initially in a non-free state. But the graceful way to do it is to initialize correctly. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/algos/i2c-algo-bit.c')
-rw-r--r--drivers/i2c/algos/i2c-algo-bit.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
index 1147bddb8b2c..3df0efd69ae3 100644
--- a/drivers/i2c/algos/i2c-algo-bit.c
+++ b/drivers/i2c/algos/i2c-algo-bit.c
@@ -649,6 +649,11 @@ static int __i2c_bit_add_bus(struct i2c_adapter *adap,
649 if (bit_adap->getscl == NULL) 649 if (bit_adap->getscl == NULL)
650 adap->quirks = &i2c_bit_quirk_no_clk_stretch; 650 adap->quirks = &i2c_bit_quirk_no_clk_stretch;
651 651
652 /* Bring bus to a known state. Looks like STOP if bus is not free yet */
653 setscl(bit_adap, 1);
654 udelay(bit_adap->udelay);
655 setsda(bit_adap, 1);
656
652 ret = add_adapter(adap); 657 ret = add_adapter(adap);
653 if (ret < 0) 658 if (ret < 0)
654 return ret; 659 return ret;