diff options
author | YH Huang <yh.huang@mediatek.com> | 2016-05-20 17:45:39 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-05-31 22:15:49 -0700 |
commit | abe2a55191dbcdf8c92bfea64601b607471d75be (patch) | |
tree | e3da20bafef9c0e797e4de66443b3e694158d566 | |
parent | 9d903a786727c62fb759dd837965d4891c86ff98 (diff) | |
download | chrome-ec-abe2a55191dbcdf8c92bfea64601b607471d75be.tar.gz |
elm: get VBUS statue from GPIO
GPIO_USB_C0_VBUS_WAKE_L is used to show VBUS status on elm.
If VBUS is present, pd sends soft reset on boot.
So it can boot without battery.
BUG=chrome-os-partner:53496
BRANCH=none
TEST=test on elm.
Remove battery and boot up successfully only with AC.
Use "sysjump rw" command and ec won't reboot by pd hard reset.
Change-Id: I1cdb12894c7b6bc41d7a16802b8c0ef14e2aa426
Signed-off-by: YH Huang <yh.huang@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/346261
Tested-by: Koro Chen <koro.chen@mediatek.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r-- | board/elm/board.c | 2 | ||||
-rw-r--r-- | board/elm/board.h | 1 | ||||
-rw-r--r-- | board/elm/usb_pd_policy.c | 5 |
3 files changed, 6 insertions, 2 deletions
diff --git a/board/elm/board.c b/board/elm/board.c index 840da0bd8a..29b77a5889 100644 --- a/board/elm/board.c +++ b/board/elm/board.c @@ -238,7 +238,7 @@ static void board_init(void) board_reset_pd_mcu(); /* Update VBUS supplier */ - usb_charger_vbus_change(0, !gpio_get_level(GPIO_USB_C0_VBUS_WAKE_L)); + usb_charger_vbus_change(0, pd_snk_is_vbus_provided(0)); /* Remap SPI2 to DMA channels 6 and 7 */ REG32(STM32_DMA1_BASE + 0xa8) |= (1 << 20) | (1 << 21) | diff --git a/board/elm/board.h b/board/elm/board.h index 953b296a09..224bb7723a 100644 --- a/board/elm/board.h +++ b/board/elm/board.h @@ -93,7 +93,6 @@ #define CONFIG_USB_PD_TCPM_MUX #define CONFIG_USB_PD_TCPM_TCPCI #define CONFIG_USB_PD_TRY_SRC -#define CONFIG_USB_PD_TCPM_VBUS #undef CONFIG_TCPC_I2C_BASE_ADDR #define CONFIG_TCPC_I2C_BASE_ADDR 0x58 #define CONFIG_USB_PD_ANX7688 diff --git a/board/elm/usb_pd_policy.c b/board/elm/usb_pd_policy.c index adfd814a6f..e54ad16c93 100644 --- a/board/elm/usb_pd_policy.c +++ b/board/elm/usb_pd_policy.c @@ -95,6 +95,11 @@ void typec_set_input_current_limit(int port, uint32_t max_ma, charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge); } +int pd_snk_is_vbus_provided(int port) +{ + return !gpio_get_level(GPIO_USB_C0_VBUS_WAKE_L); +} + int pd_board_checks(void) { return EC_SUCCESS; |