From b00ecbc2fef739a38b3972904c71173630b92e3b Mon Sep 17 00:00:00 2001 From: Alec Berg Date: Fri, 29 May 2015 11:42:51 -0700 Subject: pd: fix tcpc alert to handle multiple alert bits set at once Fix tcpc_alert() so it can handle multiple alert bits. This is needed since the initial version of tcpc_alert() is read/clear and so we need to service all bits or else it will get lost. BUG=none BRANCH=none TEST=test on glados. see multiple alert bits and handle both of them. Change-Id: I4d2a19a5d5d6f85cad3d67a96217d65e6e65715c Signed-off-by: Alec Berg Reviewed-on: https://chromium-review.googlesource.com/274084 Reviewed-by: Vincent Palatin --- common/usb_pd_protocol.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 05df773f74..ec0b441da7 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -2352,7 +2352,8 @@ void tcpc_alert(void) if (status & TCPC_REG_ALERT1_CC_STATUS) { /* CC status changed, wake task */ task_set_event(PD_PORT_TO_TASK_ID(i), PD_EVENT_CC, 0); - } else if (status & TCPC_REG_ALERT1_RX_STATUS) { + } + if (status & TCPC_REG_ALERT1_RX_STATUS) { /* message received */ /* * If TCPC is compiled in, then we will have already @@ -2364,11 +2365,13 @@ void tcpc_alert(void) #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) { + } + if (status & TCPC_REG_ALERT1_RX_HARD_RST) { /* hard reset received */ execute_hard_reset(i); task_wake(PD_PORT_TO_TASK_ID(i)); - } else if (status & TCPC_REG_ALERT1_TX_COMPLETE) { + } + if (status & TCPC_REG_ALERT1_TX_COMPLETE) { /* transmit complete */ pd_transmit_complete(i, status); } -- cgit v1.2.1