summaryrefslogtreecommitdiff
path: root/board/reef/board.c
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2016-10-26 17:40:57 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-10-27 19:28:53 -0700
commit799c272e282a4727da949940828d815f11c526db (patch)
treece54acaa1222a08ed6e761636122087e8eef5e53 /board/reef/board.c
parentb6937caeeb3f4642cfdc0bca52a890b30b81e9a4 (diff)
downloadchrome-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/reef/board.c')
-rw-r--r--board/reef/board.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/board/reef/board.c b/board/reef/board.c
index cec70666d9..22ca518c39 100644
--- a/board/reef/board.c
+++ b/board/reef/board.c
@@ -488,20 +488,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
@@ -512,24 +501,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);
}
/**
@@ -911,7 +905,7 @@ void board_hibernate(void)
msleep(100);
/* 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);
}
struct {