diff options
author | Vijay Hiremath <vijay.p.hiremath@intel.com> | 2016-10-26 17:40:57 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-10-27 19:28:53 -0700 |
commit | 799c272e282a4727da949940828d815f11c526db (patch) | |
tree | ce54acaa1222a08ed6e761636122087e8eef5e53 /board/eve | |
parent | b6937caeeb3f4642cfdc0bca52a890b30b81e9a4 (diff) | |
download | chrome-ec-799c272e282a4727da949940828d815f11c526db.tar.gz |
BD9995X: Disable input to port when sourcing
POR has both VCC & VBUS enabled. If the port is sourcing VBUS it will
also act as sync and AC_OK pin gets enabled. Hence disable the input
to the port when sourcing.
BUG=chrome-os-partner:59020
BRANCH=none
TEST=Manually verified on Reef. Connected HoHo and AC_OK is not
enabled.
Change-Id: Ic51b81f45759d7dddb2c9744d1c24dbafd1e1293
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/404168
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'board/eve')
-rw-r--r-- | board/eve/board.c | 28 | ||||
-rw-r--r-- | board/eve/usb_pd_policy.c | 3 |
2 files changed, 12 insertions, 19 deletions
diff --git a/board/eve/board.c b/board/eve/board.c index 51cd515cbc..91ea7af370 100644 --- a/board/eve/board.c +++ b/board/eve/board.c @@ -391,20 +391,9 @@ int pd_snk_is_vbus_provided(int port) int board_set_active_charge_port(int charge_port) { enum bd9995x_charge_port bd9995x_port; + int bd9995x_port_select = 1; static int initialized; - /* charge port is a physical port */ - int is_real_port = (charge_port >= 0 && - charge_port < CONFIG_USB_PD_PORT_COUNT); - /* check if we are source VBUS on the port */ - int source = gpio_get_level(charge_port == 0 ? GPIO_USB_C0_5V_EN : - GPIO_USB_C1_5V_EN); - - if (is_real_port && source) { - CPRINTF("Skip enable p%d", charge_port); - return EC_ERROR_INVAL; - } - /* * Reject charge port disable if our battery is critical and we * have yet to initialize a charge port - continue to charge using @@ -415,24 +404,29 @@ int board_set_active_charge_port(int charge_port) charge_get_percent() < 2) return -1; - CPRINTS("New chg p%d", charge_port); - switch (charge_port) { case 0: case 1: + /* Don't charge from a source port */ + if (gpio_get_level(charge_port == 0 ? + GPIO_USB_C0_5V_EN : GPIO_USB_C1_5V_EN)) + return -1; + bd9995x_port = bd9995x_pd_port_to_chg_port(charge_port); break; case CHARGE_PORT_NONE: - bd9995x_port = BD9995X_CHARGE_PORT_NONE; + bd9995x_port_select = 0; + bd9995x_port = BD9995X_CHARGE_PORT_BOTH; break; default: panic("Invalid charge port\n"); break; } + CPRINTS("New chg p%d", charge_port); initialized = 1; - return bd9995x_select_input_port(bd9995x_port); + return bd9995x_select_input_port(bd9995x_port, bd9995x_port_select); } /** @@ -570,5 +564,5 @@ void board_hibernate_late(void) void board_hibernate(void) { /* Enable both the VBUS & VCC ports before entering PG3 */ - bd9995x_select_input_port(BD9995X_CHARGE_PORT_BOTH); + bd9995x_select_input_port(BD9995X_CHARGE_PORT_BOTH, 1); } diff --git a/board/eve/usb_pd_policy.c b/board/eve/usb_pd_policy.c index f0eccf50aa..74c1c54c80 100644 --- a/board/eve/usb_pd_policy.c +++ b/board/eve/usb_pd_policy.c @@ -54,8 +54,7 @@ void pd_transition_voltage(int idx) int pd_set_power_supply_ready(int port) { /* Ensure we're not charging from this port */ - if (charge_manager_get_active_charge_port() == port) - bd9995x_select_input_port(BD9995X_CHARGE_PORT_NONE); + bd9995x_select_input_port(bd9995x_pd_port_to_chg_port(port), 0); /* Provide VBUS */ gpio_set_level(port ? GPIO_USB_C1_5V_EN : |