summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Collyer <scollyer@google.com>2018-08-29 16:53:55 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-08-31 15:08:53 -0700
commitf0d0b21589ce2e0e7ef016ba7a729cd402214193 (patch)
tree5ac0f91c2e118cfd8f96bee4b5441e1f0bde4b16
parent20622804ce85eed0f3ff6562e9d3324c1788f156 (diff)
downloadchrome-ec-f0d0b21589ce2e0e7ef016ba7a729cd402214193.tar.gz
nocturne: Use USBC alert signal for TCPC alert status
Because the TCPC and PPC share a common interrupt signal, the TCPC alert register must be read to know when to process alerts for the TCPC. However, the interrupt signal can be used to know which port to check and prevent interrupts from one port causing the TCPC on another port from being pulled out of low power mode unecessarily. This CL adds a check of the USBC interrupt line level to know which TCPC to check. BUG=b:112039224 BRANCH=nocturne TEST=Verifed that connecting to 1 of the ports no longer causes the other port to exit/enter low power mode. Change-Id: I70384a1fc8f1cc03ad81e694a4246e0cb284375f Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/1196044 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--board/nocturne/board.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/board/nocturne/board.c b/board/nocturne/board.c
index 39a7913f56..4afb2fb581 100644
--- a/board/nocturne/board.c
+++ b/board/nocturne/board.c
@@ -749,20 +749,24 @@ uint16_t tcpc_get_alert_status(void)
* The interrupt line is shared between the TCPC and PPC. Therefore, go
* out and actually read the alert registers to report the alert status.
*/
- if (!tcpc_read16(0, TCPC_REG_ALERT, &regval)) {
- /* The TCPCI spec says to ignore bits 14:12. */
- regval &= ~((1 << 14) | (1 << 13) | (1 << 12));
+ if (!gpio_get_level(GPIO_USB_C0_PD_INT_ODL)) {
+ if (!tcpc_read16(0, TCPC_REG_ALERT, &regval)) {
+ /* The TCPCI spec says to ignore bits 14:12. */
+ regval &= ~((1 << 14) | (1 << 13) | (1 << 12));
- if (regval)
- status |= PD_STATUS_TCPC_ALERT_0;
+ if (regval)
+ status |= PD_STATUS_TCPC_ALERT_0;
+ }
}
- if (!tcpc_read16(1, TCPC_REG_ALERT, &regval)) {
- /* TCPCI spec says to ignore bits 14:12. */
- regval &= ~((1 << 14) | (1 << 13) | (1 << 12));
+ if (!gpio_get_level(GPIO_USB_C1_PD_INT_ODL)) {
+ if (!tcpc_read16(1, TCPC_REG_ALERT, &regval)) {
+ /* TCPCI spec says to ignore bits 14:12. */
+ regval &= ~((1 << 14) | (1 << 13) | (1 << 12));
- if (regval)
- status |= PD_STATUS_TCPC_ALERT_1;
+ if (regval)
+ status |= PD_STATUS_TCPC_ALERT_1;
+ }
}
return status;