diff options
author | Ben Chen <ben.chen2@quanta.corp-partner.google.com> | 2020-06-16 19:44:30 +0800 |
---|---|---|
committer | Marco Chen <marcochen@chromium.org> | 2020-06-17 01:44:23 +0000 |
commit | e947cf156f38f78e852c2978fc5e43f5acd5173f (patch) | |
tree | d45805e23dff8fd7907ea6832a95ca63fb0dc950 /board/bobba | |
parent | 818c57442ae1d4d52b7ad9aa2a9d800075d2b055 (diff) | |
download | chrome-ec-e947cf156f38f78e852c2978fc5e43f5acd5173f.tar.gz |
Bobba: support PPC syv682x by function check
Support SYV682x PPC config in function check, that
Board version is 5 and PPC ID pin is High status.
BUG=b:154772847, b:156711950
BRANCH=octopus
TEST=Check setup ppc syv682x by board id and PPC ID pin
Change-Id: I47561e81ce8e92b497e7e47f6decb00a798d8dc4
Signed-off-by: Ben Chen <ben.chen2@quanta.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2247958
Reviewed-by: Marco Chen <marcochen@chromium.org>
Tested-by: David Huang <david.huang@quanta.corp-partner.google.com>
Commit-Queue: Marco Chen <marcochen@chromium.org>
Diffstat (limited to 'board/bobba')
-rw-r--r-- | board/bobba/board.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/board/bobba/board.c b/board/bobba/board.c index 81840eb7ca..ed869faefd 100644 --- a/board/bobba/board.c +++ b/board/bobba/board.c @@ -34,6 +34,7 @@ #include "motion_sense.h" #include "power.h" #include "power_button.h" +#include "stdbool.h" #include "switch.h" #include "system.h" #include "tablet_mode.h" @@ -71,22 +72,32 @@ const int keyboard_factory_scan_pins[][2] = { const int keyboard_factory_scan_pins_used = ARRAY_SIZE(keyboard_factory_scan_pins); -static void ppc_interrupt(enum gpio_signal signal) +/* Check PPC ID Pin and Board ver to decide which one ppc is used. */ +static bool support_syv_ppc(void) { uint32_t board_version = 0; if (cbi_get_board_version(&board_version) != EC_SUCCESS) CPRINTSUSB("Get board version failed."); + + if ((board_version == 5) && (gpio_get_level(GPIO_PPC_ID))) + return true; + + return false; +} + +static void ppc_interrupt(enum gpio_signal signal) +{ switch (signal) { case GPIO_USB_PD_C0_INT_ODL: - if ((board_version == 5) && (gpio_get_level(GPIO_PPC_ID))) + if (support_syv_ppc()) syv682x_interrupt(0); else nx20p348x_interrupt(0); break; case GPIO_USB_PD_C1_INT_ODL: - if ((board_version == 5) && (gpio_get_level(GPIO_PPC_ID))) + if (support_syv_ppc()) syv682x_interrupt(1); else nx20p348x_interrupt(1); @@ -429,7 +440,7 @@ const struct ppc_config_t ppc_syv682x_port1 = { static void board_setup_ppc(void) { - if (gpio_get_level(GPIO_PPC_ID)) { + if (support_syv_ppc()) { memcpy(&ppc_chips[USB_PD_PORT_TCPC_0], &ppc_syv682x_port0, sizeof(struct ppc_config_t)); |