summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-05-29 11:42:51 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-05-29 21:47:51 +0000
commitb00ecbc2fef739a38b3972904c71173630b92e3b (patch)
tree3fac173fb7631bd384cac1d4321ac809d382f589
parenta7ba11c82c6b8bf84799382f5fc166b02bd88165 (diff)
downloadchrome-ec-b00ecbc2fef739a38b3972904c71173630b92e3b.tar.gz
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 <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/274084 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--common/usb_pd_protocol.c9
1 files 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);
}