pd: fix duplicate PD receive event on combined TCPM/TCPC

Fix duplicate PD RX event when using combined TCPM/TCPC. Problem
is that PD_EVENT_RX is already set in the phy layer in pd_rx_event
when CC edges are detected. Therefore, we shouldn't set it again
when the TCPC detects that receiving has started.

BUG=none
BRANCH=none
TEST=test on samus. without this change we occasionally get a
PD error and hard reset under certain timing circumstances due
to the repeated event. with this change, those errors go away.

Change-Id: If1034a549b75740f327e16810e81c9aa28d71b00
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/273418
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Alec Berg
2015-05-26 18:06:06 -07:00
committed by ChromeOS Commit Bot
parent 11df27d5f7
commit 97934e4041

View File

@@ -2355,7 +2355,16 @@ void tcpc_alert(void)
task_set_event(PD_PORT_TO_TASK_ID(i), PD_EVENT_CC, 0);
} else if (status & TCPC_REG_ALERT1_RX_STATUS) {
/* message received */
/*
* If TCPC is compiled in, then we will have already
* received PD_EVENT_RX from phy layer in
* pd_rx_event(), so we don't need to set another
* event. If TCPC is not running on this MCU, then
* this needs to wake the PD task.
*/
#ifndef CONFIG_USB_PD_TCPC
task_set_event(PD_PORT_TO_TASK_ID(i), PD_EVENT_RX, 0);
#endif
} else if (status & TCPC_REG_ALERT1_RX_HARD_RST) {
/* hard reset received */
execute_hard_reset(i);