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>
This commit is contained in:
Shawn Nematbakhsh
2016-11-10 08:45:24 -08:00
committed by chrome-bot
parent a1ec4e2d59
commit c7574ffbe7

View File

@@ -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);