summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorDivya Sasidharan <divya.s.sasidharan@intel.com>2016-07-29 09:57:13 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-07-29 15:02:45 -0700
commit7b0206a3a4d69c199fb26527f7cd38fc33732323 (patch)
treeb0f5d337f668cb1b4dc1dc7ba92df995bf92bc1d /driver
parentb517067a418e1551f7c70cc32840f10845003934 (diff)
downloadchrome-ec-7b0206a3a4d69c199fb26527f7cd38fc33732323.tar.gz
tcpm: anx74xx: Fix cable orientation detection
Aux switch settings set the polarity and this happens once on every cable connect. But when the cable is kept connected if the mux is set to 0 this is also reset and remains 0 for any next valid mux state. BRANCH=ToT BUG=chrome-os-partner:55757 TEST=manual:on reef, plug HDMI type-C dongle and check if DUT screen is displayed on HDMI display for both the orientation. Change-Id: Ie1320d11d1927acb292dbaf4c932b48cdfd7768e Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com> Reviewed-on: https://chromium-review.googlesource.com/364693 Commit-Ready: Divya S Sasidharan <divya.s.sasidharan@intel.com> Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com> Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r--driver/tcpm/anx74xx.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/driver/tcpm/anx74xx.c b/driver/tcpm/anx74xx.c
index bd5032376c..58fcc26536 100644
--- a/driver/tcpm/anx74xx.c
+++ b/driver/tcpm/anx74xx.c
@@ -25,6 +25,8 @@ struct anx_state {
};
static struct anx_state anx[CONFIG_USB_PD_PORT_COUNT];
+static int anx74xx_set_mux(int port, int polarity);
+
static void anx74xx_tcpm_set_auto_good_crc(int port, int enable)
{
int reg;
@@ -156,6 +158,11 @@ static int anx74xx_tcpm_mux_set(int i2c_addr, mux_state_t mux_state)
int rv;
int port = i2c_addr;
+ if (!(mux_state & ~MUX_POLARITY_INVERTED)) {
+ anx[port].mux_state = mux_state;
+ return anx74xx_tcpm_mux_exit(port);
+ }
+
rv = tcpc_read(port, ANX74XX_REG_ANALOG_CTRL_5, &reg);
if (rv)
return EC_ERROR_UNKNOWN;
@@ -179,14 +186,14 @@ static int anx74xx_tcpm_mux_set(int i2c_addr, mux_state_t mux_state)
val = ANX74XX_REG_MUX_DP_MODE_ACE_CC1;
reg |= ANX74XX_REG_MUX_ML2_A;
}
- } else if (!mux_state) {
- return anx74xx_tcpm_mux_exit(port);
- } else {
- return EC_ERROR_UNIMPLEMENTED;
- }
+ } else
+ return EC_ERROR_UNIMPLEMENTED;
rv = tcpc_write(port, ANX74XX_REG_ANALOG_CTRL_1, val);
rv |= tcpc_write(port, ANX74XX_REG_ANALOG_CTRL_5, reg);
+
+ anx74xx_set_mux(port, mux_state & MUX_POLARITY_INVERTED ? 1 : 0);
+
anx[port].mux_state = mux_state;
return rv;