summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2016-11-10 08:45:24 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-11-17 16:09:37 -0800
commitc7574ffbe744d80d07488af7ccf681cbc4996347 (patch)
tree583f5d9660749b0838d60385c95735bd1691afa5
parenta1ec4e2d59604a22f15f9b65472c30db7a14c8c0 (diff)
downloadchrome-ec-c7574ffbe744d80d07488af7ccf681cbc4996347.tar.gz
tcpm: fusb302: Mask BC_LVL interrupt when PD is enabled
Avoid needless alerts due to CC lines toggling during PD communication. BUG=chrome-os-partner:58298 BRANCH=gru TEST=Manual on kevin. Verify PD communication with Apple USB-C dongle is functional. Verify Source caps are sent with 100ms-200ms delay. Verify Rp change on Donette is still detected. Signed-off-by; Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I83fcd1b3235969c8462d23c5159564db2c6a8392 Reviewed-on: https://chromium-review.googlesource.com/409693 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> (cherry picked from commit ae9691d0225c78bb183774d585d34de0e7399d7d) Reviewed-on: https://chromium-review.googlesource.com/412033 Commit-Ready: Shawn N <shawnn@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r--driver/tcpm/fusb302.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/driver/tcpm/fusb302.c b/driver/tcpm/fusb302.c
index 728c1deb09..3e650b8df5 100644
--- a/driver/tcpm/fusb302.c
+++ b/driver/tcpm/fusb302.c
@@ -668,6 +668,11 @@ static int fusb302_tcpm_set_rx_enable(int port, int enable)
}
tcpc_write(port, TCPC_REG_SWITCHES0, reg);
+ /* Disable BC_LVL interrupt when enabling PD comm */
+ if (!tcpc_read(port, TCPC_REG_MASK, &reg))
+ tcpc_write(port, TCPC_REG_MASK,
+ reg | TCPC_REG_MASK_BC_LVL);
+
/* flush rx fifo in case messages have been coming our way */
fusb302_flush_rx_fifo(port);
@@ -686,6 +691,11 @@ static int fusb302_tcpm_set_rx_enable(int port, int enable)
tcpm_set_cc(port, state[port].previous_pull);
tcpc_write(port, TCPC_REG_SWITCHES0, reg);
+
+ /* Enable BC_LVL interrupt when disabling PD comm */
+ if (!tcpc_read(port, TCPC_REG_MASK, &reg))
+ tcpc_write(port, TCPC_REG_MASK,
+ reg & ~TCPC_REG_MASK_BC_LVL);
}
fusb302_auto_goodcrc_enable(port, enable);
@@ -836,6 +846,13 @@ void fusb302_tcpc_alert(int port)
tcpc_read(port, TCPC_REG_INTERRUPTA, &interrupta);
tcpc_read(port, TCPC_REG_INTERRUPTB, &interruptb);
+ /*
+ * Ignore BC_LVL changes when transmitting / receiving PD,
+ * since CC level will constantly change.
+ */
+ if (state[port].rx_enable)
+ interrupt &= ~TCPC_REG_INTERRUPT_BC_LVL;
+
if (interrupt & TCPC_REG_INTERRUPT_BC_LVL) {
/* CC Status change */
task_set_event(PD_PORT_TO_TASK_ID(port), PD_EVENT_CC, 0);