diff options
author | Wai-Hong Tam <waihong@google.com> | 2020-03-03 14:45:08 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-03-10 03:09:21 +0000 |
commit | 98327d8e0e27a14961b78916d558451341b0b646 (patch) | |
tree | 476c0841f2725f63c90166f492c4ea0bb55c8b0e /board/trogdor | |
parent | 194ee584440fb01466f0c9231b7505759ad560b0 (diff) | |
download | chrome-ec-98327d8e0e27a14961b78916d558451341b0b646.tar.gz |
Trogdor: Use TCPC to detect VBUS
In hardware rev-1, the BC1.2 part is changed and doesn't has the VBUS
detection capability. Should use the TCPC to detect VBUS. This change
also works on hardware rev-0.
BRANCH=None
BUG=b:150682632
TEST=Tested on hardware rev-0. Checked sinking power from 20V properly.
Change-Id: I15779c50e8e5cd9e67a45b4d90cb227c1b59c1f9
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2086092
Reviewed-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Diffstat (limited to 'board/trogdor')
-rw-r--r-- | board/trogdor/board.c | 16 | ||||
-rw-r--r-- | board/trogdor/board.h | 2 | ||||
-rw-r--r-- | board/trogdor/gpio.inc | 4 |
3 files changed, 3 insertions, 19 deletions
diff --git a/board/trogdor/board.c b/board/trogdor/board.c index 16de20b2f8..2fef52e31f 100644 --- a/board/trogdor/board.c +++ b/board/trogdor/board.c @@ -40,8 +40,6 @@ /* Forward declaration */ static void tcpc_alert_event(enum gpio_signal signal); -static void vbus0_evt(enum gpio_signal signal); -static void vbus1_evt(enum gpio_signal signal); static void usb0_evt(enum gpio_signal signal); static void usb1_evt(enum gpio_signal signal); static void ppc_interrupt(enum gpio_signal signal); @@ -68,20 +66,6 @@ static void tcpc_alert_event(enum gpio_signal signal) schedule_deferred_pd_interrupt(port); } -static void vbus0_evt(enum gpio_signal signal) -{ - /* VBUS present GPIO is inverted */ - usb_charger_vbus_change(0, !gpio_get_level(GPIO_USB_C0_VBUS_DET_L)); - task_wake(TASK_ID_PD_C0); -} - -static void vbus1_evt(enum gpio_signal signal) -{ - /* VBUS present GPIO is inverted */ - usb_charger_vbus_change(1, !gpio_get_level(GPIO_USB_C1_VBUS_DET_L)); - task_wake(TASK_ID_PD_C1); -} - static void usb0_evt(enum gpio_signal signal) { task_set_event(TASK_ID_USB_CHG_P0, USB_CHG_EVENT_BC12, 0); diff --git a/board/trogdor/board.h b/board/trogdor/board.h index c9a6b80bc2..c7bb6f0ff3 100644 --- a/board/trogdor/board.h +++ b/board/trogdor/board.h @@ -120,7 +120,7 @@ #define CONFIG_USB_PD_TCPM_MUX #define CONFIG_USB_PD_TCPM_TCPCI #define CONFIG_USB_PD_TRY_SRC -#define CONFIG_USB_PD_VBUS_DETECT_CHARGER +#define CONFIG_USB_PD_VBUS_DETECT_TCPC #define CONFIG_USB_PD_5V_EN_CUSTOM #define CONFIG_USBC_PPC_SN5S330 #define CONFIG_USBC_SS_MUX diff --git a/board/trogdor/gpio.inc b/board/trogdor/gpio.inc index 8c608451ca..f22339435d 100644 --- a/board/trogdor/gpio.inc +++ b/board/trogdor/gpio.inc @@ -15,8 +15,6 @@ GPIO_INT(USB_C0_SWCTL_INT_ODL, PIN(0, 3), GPIO_INT_FALLING, ppc_interrupt) /* I GPIO_INT(USB_C1_SWCTL_INT_ODL, PIN(4, 0), GPIO_INT_FALLING, ppc_interrupt) /* Interrupt from port-1 PPC */ GPIO_INT(USB_C0_BC12_INT_L, PIN(6, 1), GPIO_INT_FALLING, usb0_evt) /* Interrupt from port-0 BC1.2 */ GPIO_INT(USB_C1_BC12_INT_L, PIN(8, 2), GPIO_INT_FALLING, usb1_evt) /* Interrupt from port-1 BC1.2 */ -GPIO_INT(USB_C0_VBUS_DET_L, PIN(6, 2), GPIO_INT_BOTH | GPIO_PULL_UP, vbus0_evt) /* BC1.2 VBUS detection on port-0 */ -GPIO_INT(USB_C1_VBUS_DET_L, PIN(8, 3), GPIO_INT_BOTH | GPIO_PULL_UP, vbus1_evt) /* BC1.2 VBUS detection on port-1 */ /* System interrupts */ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, extpower_interrupt) /* AC OK? */ @@ -85,6 +83,8 @@ GPIO(DP_MUX_SEL, PIN(4, 5), GPIO_OUT_HIGH) /* DP mux selection: L:C0 GPIO(DP_HOT_PLUG_DET, PIN(9, 5), GPIO_OUT_LOW) /* DP HPD to AP */ /* TODO(waihong): Remove it from schematic. No use. */ GPIO(USBC_MUX_CONF0, PIN(5, 1), GPIO_INPUT) +GPIO(USB_C0_VBUS_DET_L, PIN(6, 2), GPIO_INPUT) /* Deprecated BC1.2 VBUS detection on port-0 */ +GPIO(USB_C1_VBUS_DET_L, PIN(8, 3), GPIO_INPUT) /* Deprecated BC1.2 VBUS detection on port-1 */ /* USB-A */ GPIO(EN_USB_A_5V, PIN(8, 6), GPIO_OUT_LOW) |