diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2015-11-19 16:51:37 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2015-11-25 12:59:17 -0800 |
commit | 767e132d133b6f1216d630bd3b59e893a59bcffa (patch) | |
tree | cd42c82ce7d2246484f3980a1dc7e9966e57e633 /board/pdeval-stm32f072/board.c | |
parent | 9665d0b1df2edf954e2c3578c4905d5ca8138edc (diff) | |
download | chrome-ec-767e132d133b6f1216d630bd3b59e893a59bcffa.tar.gz |
pd: Add support for multiple distinct TCPC alert signals
If multiple TCPCs are present on a system then we may have multiple
alert signals, each of which alerts us to the status of a different
TCPC. Make boards with external non cros-ec TCPCs define
tcpc_get_alert_status, which returns alert status based upon any alert
GPIOs present, and then service only ports which are alerting.
BUG=chromium:551683,chrome-os-partner:47851
TEST=Verify snoball PDCMD task sleeps appropriately when no devices are
inserted, and verify ports go to PD_DISCOVERY state when we attach
samus. Also verify that glados / glados_pd can still negotiate PD.
BRANCH=None
Change-Id: Iae6c4e1ef4d6685cb5bf7feef713505925a07c8c
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/313209
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'board/pdeval-stm32f072/board.c')
-rw-r--r-- | board/pdeval-stm32f072/board.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/board/pdeval-stm32f072/board.c b/board/pdeval-stm32f072/board.c index 6fd472eee5..ab476d006e 100644 --- a/board/pdeval-stm32f072/board.c +++ b/board/pdeval-stm32f072/board.c @@ -61,3 +61,17 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { {I2C_PORT_TCPC, TCPC2_I2C_ADDR}, #endif }; + +uint16_t tcpc_get_alert_status(void) +{ + uint16_t status = 0; + + if (!gpio_get_level(GPIO_PD_MCU_INT)) { + status = PD_STATUS_TCPC_ALERT_0; +#if CONFIG_USB_PD_PORT_COUNT >= 2 + status |= PD_STATUS_TCPC_ALERT_1; +#endif + } + + return status; +} |