summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2014-05-22 08:51:51 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-06-07 01:25:28 +0000
commit5725f4f0ef8a86e81ec3bd5b5f91a74c556e003c (patch)
tree5797070443d7b2c0dbf628c81857206d9b3ee212
parent3d9544ae42a1c952d31a39fea71dc9c6c52fbdcc (diff)
downloadchrome-ec-5725f4f0ef8a86e81ec3bd5b5f91a74c556e003c.tar.gz
samus_pd: 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=chrome-os-partner:28782 TEST=on Samus, put port0 in host mode (by doing "pd charger" on the PD MCU command line), then insert a type-C to type-A cable and observe we have VBUS on the other side. Change-Id: I5c6cd78b54dc1c651420eaaf122b8545b9f0b0de Reviewed-on: https://chromium-review.googlesource.com/201066 Reviewed-by: Alec Berg <alecaberg@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--board/samus_pd/usb_pd_config.h6
-rw-r--r--board/samus_pd/usb_pd_policy.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/board/samus_pd/usb_pd_config.h b/board/samus_pd/usb_pd_config.h
index 767c104e71..d425984357 100644
--- a/board/samus_pd/usb_pd_config.h
+++ b/board/samus_pd/usb_pd_config.h
@@ -92,13 +92,19 @@ static inline void pd_tx_init(void)
static inline void pd_set_host_mode(int enable)
{
if (enable) {
+ /* We never charging in power source mode */
+ gpio_set_level(GPIO_USB_C0_CHARGE_EN_L, 1);
/* High-Z is used for host mode. */
gpio_set_level(GPIO_USB_C0_CC1_ODL, 1);
gpio_set_level(GPIO_USB_C0_CC2_ODL, 1);
} else {
+ /* Kill VBUS power supply */
+ gpio_set_level(GPIO_USB_C0_5V_EN, 0);
/* Pull low for device mode. */
gpio_set_level(GPIO_USB_C0_CC1_ODL, 0);
gpio_set_level(GPIO_USB_C0_CC2_ODL, 0);
+ /* Enable the charging path*/
+ gpio_set_level(GPIO_USB_C0_CHARGE_EN_L, 0);
}
}
diff --git a/board/samus_pd/usb_pd_policy.c b/board/samus_pd/usb_pd_policy.c
index 3d6b30250c..ea5f2d1703 100644
--- a/board/samus_pd/usb_pd_policy.c
+++ b/board/samus_pd/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_C0_5V_EN, 1);
+
return EC_SUCCESS; /* we are ready */
}
void pd_power_supply_reset(void)
{
+ /* Kill VBUS */
+ gpio_set_level(GPIO_USB_C0_5V_EN, 0);
}
int pd_board_checks(void)