[PATCH RESEND] i2c: mux: pca9541: Change bus control commands and release control of bus

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

 



Change current bus commands to match the pca9541a datasheet
(see table 12 on page 14 of
https://www.nxp.com/docs/en/data-sheet/PCA9541A.pdf).

Also add change so that previous master releases control of bus.

Signed-off-by: Quentin Strydom <qstrydom0@xxxxxxxxx>
---
 drivers/i2c/muxes/i2c-mux-pca9541.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/muxes/i2c-mux-pca9541.c b/drivers/i2c/muxes/i2c-mux-pca9541.c
index 50e1fb4aedf5..eb2552fbd0d0 100644
--- a/drivers/i2c/muxes/i2c-mux-pca9541.c
+++ b/drivers/i2c/muxes/i2c-mux-pca9541.c
@@ -134,7 +134,8 @@ static void pca9541_release_bus(struct i2c_client *client)
 	reg = pca9541_reg_read(client, PCA9541_CONTROL);
 	if (reg >= 0 && !busoff(reg) && mybus(reg))
 		pca9541_reg_write(client, PCA9541_CONTROL,
-				  (reg & PCA9541_CTL_NBUSON) >> 1);
+				 (reg & (PCA9541_CTL_BUSON | PCA9541_CTL_MYBUS))
+				 ^ (PCA9541_CTL_BUSON | PCA9541_CTL_MYBUS));
 }
 
 /*
@@ -163,7 +164,7 @@ static void pca9541_release_bus(struct i2c_client *client)
 
 /* Control commands per PCA9541 datasheet */
 static const u8 pca9541_control[16] = {
-	4, 0, 1, 5, 4, 4, 5, 5, 0, 0, 1, 1, 0, 4, 5, 1
+	4, 4, 5, 5, 4, 4, 5, 5, 0, 0, 1, 1, 0, 0, 1, 1
 };
 
 /*
-- 
2.17.1




[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux