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>
This commit is contained in:
Vincent Palatin
2014-06-02 17:11:48 -07:00
committed by chrome-internal-fetch
parent 5725f4f0ef
commit 1ba242d995
2 changed files with 16 additions and 0 deletions

View File

@@ -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);
}

View File

@@ -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)