summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorEric Yilun Lin <yllin@chromium.org>2022-08-11 09:38:15 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-08-12 08:49:39 +0000
commite979caa645380502da380d99167afa12b8df76bd (patch)
tree9f3732af37b8c6229fd6cf3760f88cabb03e108e /driver
parentfd7d1885787ceccb548f94fd1c7921864ddae9d0 (diff)
downloadchrome-ec-e979caa645380502da380d99167afa12b8df76bd.tar.gz
anx7447: configure usb_mux i2c addr from tcpc i2c config
After the DTS binding CL:3801772 merged, there is no need to set ANX7447 usb_mux config. This CL configures the usb_mux i2c addr from the anx7447 tcpc i2c addr. BUG=b:227359727 b:238170235 TEST=No complain "TCPC I2C addr 0x0 is invalid for ANX7447" BRANCH=none Change-Id: I8d69a9ca5e349856b02789452e89ee89942a82a0 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3823779 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Auto-Submit: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com> Tested-by: Eric Yilun Lin <yllin@google.com>
Diffstat (limited to 'driver')
-rw-r--r--driver/tcpm/anx7447.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/driver/tcpm/anx7447.c b/driver/tcpm/anx7447.c
index 341eca4fd5..7395ba76fc 100644
--- a/driver/tcpm/anx7447.c
+++ b/driver/tcpm/anx7447.c
@@ -604,15 +604,21 @@ static int anx7447_mux_init(const struct usb_mux *me)
int port = me->usb_port;
int i;
bool unused;
+ const uint16_t tcpc_i2c_addr =
+ I2C_STRIP_FLAGS(tcpc_config[me->usb_port].i2c_info.addr_flags);
+ const uint16_t mux_i2c_addr =
+ I2C_STRIP_FLAGS(usb_muxes[port].i2c_addr_flags);
/*
* find corresponding anx7447 SPI address according to
- * specified MUX address
+ * specified MUX address from mux and tcpc i2c addr config.
*/
for (i = 0; i < ARRAY_SIZE(anx7447_i2c_addrs_flags); i++) {
- if (I2C_STRIP_FLAGS(usb_muxes[port].i2c_addr_flags) ==
- I2C_STRIP_FLAGS(
- anx7447_i2c_addrs_flags[i].tcpc_addr_flags)) {
+ uint16_t i2c_addr_key = I2C_STRIP_FLAGS(
+ anx7447_i2c_addrs_flags[i].tcpc_addr_flags);
+
+ if (i2c_addr_key == tcpc_i2c_addr ||
+ i2c_addr_key == mux_i2c_addr) {
anx[port].i2c_addr_flags =
anx7447_i2c_addrs_flags[i].spi_addr_flags;
break;