diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2017-08-17 17:55:02 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-09-14 20:14:17 -0700 |
commit | 4566523837774988a9862e07dd42c10c0e4284bc (patch) | |
tree | ed1c1905100fb5250ffa9316c7ac7819a5f53bba /board/fizz/usb_pd_policy.c | |
parent | 0697132df7ffc36ab697ce4de134f585f1644097 (diff) | |
download | chrome-ec-4566523837774988a9862e07dd42c10c0e4284bc.tar.gz |
Fizz: Detect BJ as a power source
Proto2 board has the line ADP_IN, which is raised to 2.5 V when a BJ
adapter is plugged. This patch makes EC running on proto2 and above
use this line to detect the power source at boot (as opposed to proto1
guessing a BJ adapter is plugged if PPVAR_BOOSTIN_SENSE is 19v).
BUG=b:37573548
BRANCH=none
TEST=Boot proto3 Fizz on BJ and Type-C.
Change-Id: I4052a73729d62694ce154bfb33255974dc110841
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/626879
Diffstat (limited to 'board/fizz/usb_pd_policy.c')
-rw-r--r-- | board/fizz/usb_pd_policy.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/board/fizz/usb_pd_policy.c b/board/fizz/usb_pd_policy.c index 70983a7966..c64652ec8e 100644 --- a/board/fizz/usb_pd_policy.c +++ b/board/fizz/usb_pd_policy.c @@ -271,22 +271,25 @@ static void board_charge_manager_init(void) } input_voltage = adc_read_channel(ADC_VBUS); - input_port = input_voltage > 5500 ? + if (system_get_board_version() == 0) + /* TODO(dnojiri): Remove this case after proto1 is deprecated */ + input_port = input_voltage > 5500 ? CHARGE_PORT_BARRELJACK : CHARGE_PORT_TYPEC0; + else /* proto2 and onward */ + input_port = gpio_get_level(GPIO_ADP_IN_L) ? + CHARGE_PORT_TYPEC0 : CHARGE_PORT_BARRELJACK; CPRINTS("Power Source: p%d (%dmV)", input_port, input_voltage); /* Initialize the power source supplier */ switch (input_port) { + case CHARGE_PORT_TYPEC0: + typec_set_input_current_limit(input_port, 3000, input_voltage); + break; case CHARGE_PORT_BARRELJACK: cpi.voltage = input_voltage; - cpi.current = 3330; /* TODO: Set right value */ + cpi.current = 3330; /* TODO(dnojiri): Set right value */ charge_manager_update_charge(CHARGE_SUPPLIER_DEDICATED, 1, &cpi); - /* Source only. Disable PD negotiation as a sink */ - break; - case CHARGE_PORT_TYPEC0: - typec_set_input_current_limit(input_port, 3000, input_voltage); - /* Sink only. Disable PD negotiation as a source */ break; } } |