summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorSam Hurst <shurst@google.com>2019-06-08 10:22:43 -0700
committerCommit Bot <commit-bot@chromium.org>2019-08-23 00:12:28 +0000
commitec9146d6007550fc5874bfa38c2e4cadf4b14dcc (patch)
treee093a922498a15feaa19dac7e8fb68fe88c20e49 /driver
parenta6efb773d4da7d0d412db60fd8252856d9fb1809 (diff)
downloadchrome-ec-ec9146d6007550fc5874bfa38c2e4cadf4b14dcc.tar.gz
anx7447: USB Mux is reset when TCPM is reset
Calling tcpm_init will reset the Analogix USB Mux on port 0. I'm not sure if this is the proper behavior but I lean towards that it's not because there is a separate function, usb_mux_init, for resetting the usb mux. Also, calling tcpm_init for the Parade does not reset it's mux. BUG=b:134829988 BRANCH=none TEST=manual HATCH (Port 0): The original and new stack was tested as follows: 1) Plug in dock 2) Depending on dock, plug in HDMI or DP 3) Plug TypeC power into dock 4) Verify projection on external monitor isn't lost Change-Id: I88d17479f4d5810be3686cd78545cc99b0c41347 Signed-off-by: Sam Hurst <shurst@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1650728 Tested-by: Sam Hurst <shurst@google.com> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Sam Hurst <shurst@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1767521 Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org> Tested-by: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r--driver/tcpm/anx7447.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/driver/tcpm/anx7447.c b/driver/tcpm/anx7447.c
index b0e115ef34..a18aaeb441 100644
--- a/driver/tcpm/anx7447.c
+++ b/driver/tcpm/anx7447.c
@@ -41,12 +41,16 @@
struct anx_state {
int i2c_slave_addr;
- int mux_state;
+};
+
+struct anx_usb_mux {
+ int state;
};
static int anx7447_mux_set(int port, mux_state_t mux_state);
static struct anx_state anx[CONFIG_USB_PD_PORT_COUNT];
+static struct anx_usb_mux mux[CONFIG_USB_PD_PORT_COUNT];
/*
* ANX7447 has two co-existence I2C slave addresses, TCPC slave address and
@@ -354,11 +358,6 @@ static int anx7447_init(int port)
reg |= ANX7447_REG_R_VCONN_PWR_PRT_INRUSH_TIME_2430US;
rv = tcpc_write(port, ANX7447_REG_ANALOG_CTRL_10, reg);
- /* init hpd status */
- anx7447_hpd_mode_en(port);
- anx7447_set_hpd_level(port, 0);
- anx7447_hpd_output_en(port);
-
return rv;
}
@@ -480,6 +479,13 @@ void anx7447_tcpc_clear_hpd_status(int port)
#ifdef CONFIG_USB_PD_TCPM_MUX
static int anx7447_mux_init(int port)
{
+ memset(&mux[port], 0, sizeof(struct anx_usb_mux));
+
+ /* init hpd status */
+ anx7447_hpd_mode_en(port);
+ anx7447_set_hpd_level(port, 0);
+ anx7447_hpd_output_en(port);
+
/*
* ANX initializes its muxes to (MUX_USB_ENABLED | MUX_DP_ENABLED)
* when reinitialized, we need to force initialize it to
@@ -545,7 +551,7 @@ static int anx7447_mux_set(int port, mux_state_t mux_state)
rv |= mux_write(port, ANX7447_REG_TCPC_SWITCH_1, sw_sel);
rv |= mux_write(port, ANX7447_REG_TCPC_AUX_SWITCH, aux_sw);
- anx[port].mux_state = mux_state;
+ mux[port].state = mux_state;
return rv;
}
@@ -553,7 +559,7 @@ static int anx7447_mux_set(int port, mux_state_t mux_state)
/* current mux state */
static int anx7447_mux_get(int port, mux_state_t *mux_state)
{
- *mux_state = anx[port].mux_state;
+ *mux_state = mux[port].state;
return EC_SUCCESS;
}