Fizz: Give highest priority to dedicated chargers

This patch gives the highest priority to dedicated chargers. It
means if a dedicated power supply is being connected, other power
supplies such as USB-C adapters will not be recognized as a new
charger.

BUG=b:65059574
BRANCH=none
TEST=Boot Fizz on BJ adapter. Verify plugging in Type-C adapter
doesn't shut down the system.

Change-Id: Ie49b128ae64f917a227f9081148565a3f5356212
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/655638
Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
Daisuke Nojiri
2017-09-06 19:12:07 -07:00
committed by chrome-bot
parent ac97fea2d7
commit 117e59cf7b
3 changed files with 8 additions and 1 deletions

View File

@@ -280,7 +280,7 @@ static void board_charge_manager_init(void)
case CHARGE_PORT_BARRELJACK:
cpi.voltage = input_voltage;
cpi.current = 3330; /* TODO: Set right value */
charge_manager_update_charge(CHARGE_SUPPLIER_PROPRIETARY, 1,
charge_manager_update_charge(CHARGE_SUPPLIER_DEDICATED, 1,
&cpi);
/* Source only. Disable PD negotiation as a sink */
break;

View File

@@ -31,6 +31,9 @@
/* Charge supplier priority: lower number indicates higher priority. */
test_mockable const int supplier_priority[] = {
[CHARGE_SUPPLIER_PD] = 0,
#if CONFIG_DEDICATED_CHARGE_PORT_COUNT > 0
[CHARGE_SUPPLIER_DEDICATED] = 0,
#endif
[CHARGE_SUPPLIER_TYPEC] = 1,
[CHARGE_SUPPLIER_PROPRIETARY] = 1,
[CHARGE_SUPPLIER_BC12_DCP] = 2,
@@ -264,6 +267,7 @@ static void charge_manager_fill_power_info(int port,
const int use_ramp_current = 0;
#endif
/* TODO: Handle CHARGE_SUPPLIER_DEDICATED */
switch (sup) {
case CHARGE_SUPPLIER_PD:
r->type = USB_CHG_TYPE_PD;

View File

@@ -33,6 +33,9 @@ enum charge_supplier {
CHARGE_SUPPLIER_PROPRIETARY,
CHARGE_SUPPLIER_OTHER,
CHARGE_SUPPLIER_VBUS,
#if CONFIG_DEDICATED_CHARGE_PORT_COUNT > 0
CHARGE_SUPPLIER_DEDICATED,
#endif
CHARGE_SUPPLIER_COUNT
};