diff options
author | Diana Z <dzigterman@chromium.org> | 2020-05-28 16:06:37 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-05-30 01:42:51 +0000 |
commit | 432ccd60474143259da309b75cfa915b56bd5d31 (patch) | |
tree | 65a1f57a15ea4f352752d71f7fb66af59bfe89ff | |
parent | 36c8abe317e9edff57fc3e7d1db536f18c63f4d3 (diff) | |
download | chrome-ec-432ccd60474143259da309b75cfa915b56bd5d31.tar.gz |
Waddledee: Set up C1 interrupt line for board rev 1
The C1 interrupt line is swapped between board versions 0 and 1. Track
which line is correct for the board version in a variable. Note that
this commit would not allow the pen charging line to output correctly.
BRANCH=None
BUG=b:153684907
TEST=on waddledee version 0, ensure C1 still works
Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: Ie07052b8b27c219505da5f463d6846a18b08e6a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2220450
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r-- | board/waddledee/board.c | 16 | ||||
-rw-r--r-- | board/waddledee/gpio.inc | 4 |
2 files changed, 15 insertions, 5 deletions
diff --git a/board/waddledee/board.c b/board/waddledee/board.c index 2108e1eba7..7b4c4df0a8 100644 --- a/board/waddledee/board.c +++ b/board/waddledee/board.c @@ -29,6 +29,7 @@ #include "pwm.h" #include "pwm_chip.h" #include "switch.h" +#include "system.h" #include "tablet_mode.h" #include "task.h" #include "tcpci.h" @@ -43,6 +44,9 @@ #define INT_RECHECK_US 5000 +/* C1 interrupt line swapped between board versions, track it in a variable */ +static enum gpio_signal c1_int_line; + /* C0 interrupt line shared by BC 1.2 and charger */ static void check_c0_line(void); DECLARE_DEFERRED(check_c0_line); @@ -94,7 +98,7 @@ static void check_c1_line(void) * If line is still being held low, see if there's more to process from * one of the chips. */ - if (!gpio_get_level(GPIO_USB_C1_INT_ODL)) { + if (!gpio_get_level(c1_int_line)) { notify_c1_chips(); hook_call_deferred(&check_c1_line_data, INT_RECHECK_US); } @@ -196,8 +200,14 @@ void board_init(void) { int on; + if (system_get_board_version() <= 0) + c1_int_line = GPIO_USB_C1_INT_V0_ODL; + else + c1_int_line = GPIO_USB_C1_INT_V1_ODL; + + gpio_enable_interrupt(GPIO_USB_C0_INT_ODL); - gpio_enable_interrupt(GPIO_USB_C1_INT_ODL); + gpio_enable_interrupt(c1_int_line); gpio_enable_interrupt(GPIO_USB_C0_CCSBU_OVP_ODL); /* Charger on the MB will be outputting PROCHOT_ODL and OD CHG_DET */ @@ -243,7 +253,7 @@ uint16_t tcpc_get_alert_status(void) int regval; /* Check whether TCPC 1 pulled the shared interrupt line */ - if (!gpio_get_level(GPIO_USB_C1_INT_ODL)) { + if (!gpio_get_level(c1_int_line)) { if (!tcpc_read16(1, TCPC_REG_ALERT, ®val)) { if (regval) status = PD_STATUS_TCPC_ALERT_1; diff --git a/board/waddledee/gpio.inc b/board/waddledee/gpio.inc index abd18ecbe3..cfa9841d5e 100644 --- a/board/waddledee/gpio.inc +++ b/board/waddledee/gpio.inc @@ -30,7 +30,8 @@ GPIO_INT(UART1_RX, PIN(B, 0), GPIO_INT_BOTH, uart_deepsleep_interrupt) /* UART_ /* USB-C interrupts */ GPIO_INT(USB_C0_INT_ODL, PIN(K, 0), GPIO_INT_FALLING | GPIO_PULL_UP, usb_c0_interrupt) /* BC12 and charger */ -GPIO_INT(USB_C1_INT_ODL, PIN(B, 5), GPIO_INT_FALLING | GPIO_PULL_UP, usb_c1_interrupt) /* TCPC, charger, BC12 */ +GPIO_INT(USB_C1_INT_V0_ODL, PIN(B, 5), GPIO_INT_FALLING | GPIO_PULL_UP, usb_c1_interrupt) /* TCPC, charger, BC12 - board version 0 */ +GPIO_INT(USB_C1_INT_V1_ODL, PIN(E, 6), GPIO_INT_FALLING | GPIO_PULL_UP, usb_c1_interrupt) /* TCPC, charger, BC12 - board version 1 */ GPIO_INT(USB_C0_CCSBU_OVP_ODL, PIN(K, 6), GPIO_INT_FALLING | GPIO_PULL_UP, c0_ccsbu_ovp_interrupt) /* Fault protection */ /* Other interrupts */ @@ -51,7 +52,6 @@ GPIO(EC_AP_WAKE_ODL, PIN(D, 5), GPIO_ODR_HIGH) GPIO(SYS_RST_ODL, PIN(D, 1), GPIO_ODR_HIGH) GPIO(EC_AP_SYS_PWROK, PIN(F, 2), GPIO_OUT_LOW) GPIO(PG_PP5000_U_OD, PIN(E, 3), GPIO_INPUT) -GPIO(EN_PP3300_PEN, PIN(E, 6), GPIO_OUT_LOW) GPIO(EN_PP3300_A, PIN(C, 5), GPIO_OUT_LOW) GPIO(EC_AP_PCH_PWROK_OD, PIN(D, 6), GPIO_ODR_LOW) GPIO(EN_PP5000_U, PIN(K, 5), GPIO_OUT_LOW) |