diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2014-06-02 17:11:48 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-06-07 01:28:30 +0000 |
commit | 1ba242d9959ac0813221c4e9e543b936eeeaec28 (patch) | |
tree | 7713ba6da2b87ba4bd4a5bd4169177a40219a6c3 | |
parent | 5725f4f0ef8a86e81ec3bd5b5f91a74c556e003c (diff) | |
download | chrome-ec-1ba242d9959ac0813221c4e9e543b936eeeaec28.tar.gz |
fruitpie: provide VBUS in host mode
When we are a USB host (and a power source), provide 5V VBUS on the
type-C receptacle.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=none
BUG=none
TEST=with 2 Fruitpies, put one in source mode ("pd charger" command) and
plug a type-C cable between them.
Change-Id: Ifbdbf9db659b2fd03d11197faf2c7e14cb971e75
Reviewed-on: https://chromium-review.googlesource.com/202446
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
-rw-r--r-- | board/fruitpie/usb_pd_config.h | 10 | ||||
-rw-r--r-- | board/fruitpie/usb_pd_policy.c | 6 |
2 files changed, 16 insertions, 0 deletions
diff --git a/board/fruitpie/usb_pd_config.h b/board/fruitpie/usb_pd_config.h index efd702a284..f05b71c920 100644 --- a/board/fruitpie/usb_pd_config.h +++ b/board/fruitpie/usb_pd_config.h @@ -82,6 +82,16 @@ static inline void pd_tx_init(void) static inline void pd_set_host_mode(int enable) { + /* We never charging in power source mode */ + if (enable) { + gpio_set_level(GPIO_CHARGE_EN_L, 1); + } else { + /* Kill VBUS power supply */ + gpio_set_level(GPIO_USB_C_5V_EN, 0); + /* Enable the charging path*/ + gpio_set_level(GPIO_CHARGE_EN_L, 0); + } + gpio_set_level(GPIO_CC_HOST, enable); } diff --git a/board/fruitpie/usb_pd_policy.c b/board/fruitpie/usb_pd_policy.c index 8f1cde1c6e..9464b242be 100644 --- a/board/fruitpie/usb_pd_policy.c +++ b/board/fruitpie/usb_pd_policy.c @@ -6,6 +6,7 @@ #include "board.h" #include "common.h" #include "console.h" +#include "gpio.h" #include "hooks.h" #include "registers.h" #include "task.h" @@ -106,11 +107,16 @@ int pd_request_voltage(uint32_t rdo) int pd_set_power_supply_ready(void) { + /* provide VBUS */ + gpio_set_level(GPIO_USB_C_5V_EN, 1); + return EC_SUCCESS; /* we are ready */ } void pd_power_supply_reset(void) { + /* Kill VBUS */ + gpio_set_level(GPIO_USB_C_5V_EN, 0); } int pd_board_checks(void) |