public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Quentin Strydom <qstrydom0@gmail.com>
To: Guenter Roeck <linux@roeck-us.net>,
	Wolfram Sang <wsa@the-dreams.de>, Peter Rosin <peda@axentia.se>,
	linux-i2c@vger.kernel.org
Cc: Quentin Strydom <qstrydom0@gmail.com>
Subject: [PATCH RESEND] i2c: mux: pca9541: Change bus control commands and release control of bus
Date: Wed, 3 Jun 2020 20:14:28 +0100	[thread overview]
Message-ID: <20200603191426.GA20270@workpc> (raw)

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@gmail.com>
---
 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


             reply	other threads:[~2020-06-03 19:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-03 19:14 Quentin Strydom [this message]
2020-06-03 21:40 ` [PATCH RESEND] i2c: mux: pca9541: Change bus control commands and release control of bus Peter Rosin

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=20200603191426.GA20270@workpc \
    --to=qstrydom0@gmail.com \
    --cc=2e2c3b98-20a6-2671-ad74-a0f171073bd0@axentia.se \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=peda@axentia.se \
    --cc=wsa@the-dreams.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox