From 443207913b0490e004a87151ebf51f1b96140edd Mon Sep 17 00:00:00 2001 From: Daisuke Nojiri Date: Thu, 9 Nov 2017 17:30:13 -0800 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/762339 Reviewed-by: Shawn N --- common/charge_manager.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/common/charge_manager.c b/common/charge_manager.c index e2256fdcfc..2a97e66235 100644 --- a/common/charge_manager.c +++ b/common/charge_manager.c @@ -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); -- cgit v1.2.1