diff options
author | Yu-An Chen <yu-an.chen@quanta.corp-partner.google.com> | 2020-07-30 17:03:31 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-08-03 01:44:13 +0000 |
commit | cbe62193bae4632d0845de48b952107415a115e0 (patch) | |
tree | 236965f645d584f9bd2e102dd52b8f783ba6b308 | |
parent | cb1410cedabad98053f29a4f200e936cc79b9f8a (diff) | |
download | chrome-ec-cbe62193bae4632d0845de48b952107415a115e0.tar.gz |
dood: fix triggering condition for PPC interrupt of SYV682A
The ALERT_L of SYV682A will be kept low when there are any pending bits
waited for host to process and the driver itself will maintain the
flags like OCP and 5V_OC by monitoring the the CONTROL_4 and STATUS
registers. As a result
1. we need to enable both GPIO_INT_[FALLING|RISING] in order to set
/ clear self maintained flags.
2. CONFIG_USBC_PPC_DEDICATED_INT is defined to monitor ALERT_L
status by reading the GPIO state directly.
BUG=b:162221150
BRANCH=octopus
TEST=Check the interrupt handler is triggered twice for OC_5V set
and cleared by PPC.
Signed-off-by: Yu-An Chen <yu-an.chen@quanta.corp-partner.google.com>
Change-Id: Ief175f8b6044266e3e8e47d5532da86b4fc2fec9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2328946
Reviewed-by: Henry Sun <henrysun@google.com>
Commit-Queue: Henry Sun <henrysun@google.com>
Tested-by: Henry Sun <henrysun@google.com>
(cherry picked from commit 583fb37a3169cca8345799dbdd5ee7fde2f24dd1)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2334426
-rw-r--r-- | board/dood/board.c | 28 | ||||
-rw-r--r-- | board/dood/board.h | 1 |
2 files changed, 21 insertions, 8 deletions
diff --git a/board/dood/board.c b/board/dood/board.c index 73a900b322..4e09cb29c8 100644 --- a/board/dood/board.c +++ b/board/dood/board.c @@ -326,13 +326,25 @@ const struct ppc_config_t ppc_syv682x_port1 = { static void board_setup_ppc(void) { - if (support_syv_ppc()) { - memcpy(&ppc_chips[USB_PD_PORT_TCPC_0], - &ppc_syv682x_port0, - sizeof(struct ppc_config_t)); - memcpy(&ppc_chips[USB_PD_PORT_TCPC_1], - &ppc_syv682x_port1, - sizeof(struct ppc_config_t)); - } + if (!support_syv_ppc()) + return; + + memcpy(&ppc_chips[USB_PD_PORT_TCPC_0], + &ppc_syv682x_port0, + sizeof(struct ppc_config_t)); + memcpy(&ppc_chips[USB_PD_PORT_TCPC_1], + &ppc_syv682x_port1, + sizeof(struct ppc_config_t)); + + gpio_set_flags(GPIO_USB_PD_C0_INT_ODL, GPIO_INT_BOTH); + gpio_set_flags(GPIO_USB_PD_C1_INT_ODL, GPIO_INT_BOTH); } DECLARE_HOOK(HOOK_INIT, board_setup_ppc, HOOK_PRIO_INIT_I2C + 2); + +int ppc_get_alert_status(int port) +{ + if (port == 0) + return gpio_get_level(GPIO_USB_PD_C0_INT_ODL) == 0; + + return gpio_get_level(GPIO_USB_PD_C1_INT_ODL) == 0; +} diff --git a/board/dood/board.h b/board/dood/board.h index 7a50ff44b0..6f4c93c035 100644 --- a/board/dood/board.h +++ b/board/dood/board.h @@ -50,6 +50,7 @@ /* Additional PPC second source */ #define CONFIG_USBC_PPC_SYV682X +#define CONFIG_USBC_PPC_DEDICATED_INT #ifndef __ASSEMBLER__ |