diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2017-09-07 10:29:28 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-09-12 18:16:27 -0700 |
commit | ac97fea2d7cc5440798cc5de787be4b4c0fa5a68 (patch) | |
tree | 2d59c2dc8cdfb9419bdbf07161d38c72a2b26549 /board/fizz/usb_pd_policy.c | |
parent | 1bece4ee08aa8505e9613e614fc75d254ad5cd40 (diff) | |
download | chrome-ec-ac97fea2d7cc5440798cc5de787be4b4c0fa5a68.tar.gz |
Fizz: Refuse PR swap when powered by USB-C port
This patch makes EC refuse PR swap when the system is powered
through the USB-C port because switching from SNK to SRC will
cause the system to shut down.
BUG=b:65481832
BRANCH=none
TEST=Boot Fizz on USB-C and BJ.
Change-Id: I52c5813adc1ea9b4e69e65599c1794ae43192a1e
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/655643
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board/fizz/usb_pd_policy.c')
-rw-r--r-- | board/fizz/usb_pd_policy.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/board/fizz/usb_pd_policy.c b/board/fizz/usb_pd_policy.c index 179f1ca862..036cf13c64 100644 --- a/board/fizz/usb_pd_policy.c +++ b/board/fizz/usb_pd_policy.c @@ -128,6 +128,9 @@ int pd_board_checks(void) int pd_check_power_swap(int port) { + /* If type-c port is supplying power, we never swap PR (to source) */ + if (port == charge_manager_get_active_charge_port()) + return 0; /* * Allow power swap as long as we are acting as a dual role device, * otherwise assume our role is fixed (not in S0 or console command @@ -253,7 +256,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, static void board_charge_manager_init(void) { - int input_voltage, input_port; + int input_voltage; + enum charge_port input_port; int i, j; struct charge_port_info cpi = { .voltage = USB_CHARGER_VOLTAGE_MV, |