summaryrefslogtreecommitdiff
path: root/driver/tcpm/anx7447.c
diff options
context:
space:
mode:
authorSam Hurst <shurst@google.com>2019-06-08 10:22:43 -0700
committerCommit Bot <commit-bot@chromium.org>2019-06-13 21:41:29 +0000
commit9c8e7c6d700c583f8de3a537b4cde74327de0f34 (patch)
treeca3abff7d0cea7d132d682c7e5f89b6a200634e5 /driver/tcpm/anx7447.c
parent77161023d45559feb338d9d556a86c35c79d07f4 (diff)
downloadchrome-ec-9c8e7c6d700c583f8de3a537b4cde74327de0f34.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>
Diffstat (limited to 'driver/tcpm/anx7447.c')
-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 9e540f95aa..0a3c98c6ac 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;
}