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>
This commit is contained in:
Daisuke Nojiri
2017-09-07 10:29:28 -07:00
committed by chrome-bot
parent 1bece4ee08
commit ac97fea2d7

View File

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