charge_manager: Give dedicated chargers highest priority

This patch lowers the priorities of other chargers so that dedicated
chargers are given the highest priority.

Dedicated chargers are adapters shipped with the device and do nothing
but being the power source. Thus, when they're connected, it should be
always used even if other suppliers offer more power.

BUG=b:38321259
BRANCH=none
TEST=make runtests

Change-Id: Ida862eb31c7f9ede36cade99f53645196b6a3f70
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/762339
Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
Daisuke Nojiri
2017-11-09 17:30:13 -08:00
committed by chrome-bot
parent 84b20f9225
commit 443207913b

View File

@@ -30,19 +30,19 @@
/* 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_TYPEC_DTS] = 1,
[CHARGE_SUPPLIER_PD] = 1,
[CHARGE_SUPPLIER_TYPEC] = 2,
[CHARGE_SUPPLIER_TYPEC_DTS] = 2,
#ifdef CHARGE_MANAGER_BC12
[CHARGE_SUPPLIER_PROPRIETARY] = 1,
[CHARGE_SUPPLIER_BC12_DCP] = 2,
[CHARGE_SUPPLIER_BC12_CDP] = 3,
[CHARGE_SUPPLIER_BC12_SDP] = 4,
[CHARGE_SUPPLIER_OTHER] = 5,
[CHARGE_SUPPLIER_VBUS] = 6
[CHARGE_SUPPLIER_PROPRIETARY] = 2,
[CHARGE_SUPPLIER_BC12_DCP] = 3,
[CHARGE_SUPPLIER_BC12_CDP] = 4,
[CHARGE_SUPPLIER_BC12_SDP] = 5,
[CHARGE_SUPPLIER_OTHER] = 6,
[CHARGE_SUPPLIER_VBUS] = 7
#endif
};
BUILD_ASSERT(ARRAY_SIZE(supplier_priority) == CHARGE_SUPPLIER_COUNT);