From 46ed8a026f0370de341cb0ebb192ad91a936345b Mon Sep 17 00:00:00 2001 From: Ryan Zhang Date: Tue, 29 Nov 2016 15:13:30 +0800 Subject: [PATCH] Common: Fix factory mode hook by override function 1. factory mode is blocked by the override function. BUG=chrome-os-partner:60338 BRANCH=master TEST=`make -j buildall`,`ectool chargecontrol discharge will work` Change-Id: I0570a15351d1a5a08797749906b000e7bfc0534b Signed-off-by: Ryan Zhang Reviewed-on: https://chromium-review.googlesource.com/414969 Commit-Ready: Ryan Zhang Tested-by: Ryan Zhang Reviewed-by: Vijay P Hiremath Reviewed-by: Shawn N --- common/charge_state_v2.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c index 98461bb2c3..41152ff961 100644 --- a/common/charge_state_v2.c +++ b/common/charge_state_v2.c @@ -835,9 +835,11 @@ void charger_task(void) wait_for_it: #ifdef CONFIG_CHARGER_PROFILE_OVERRIDE - sleep_usec = charger_profile_override(&curr); - if (sleep_usec < 0) - problem(PR_CUSTOM, sleep_usec); + if (chg_ctl_mode == CHARGE_CONTROL_NORMAL) { + sleep_usec = charger_profile_override(&curr); + if (sleep_usec < 0) + problem(PR_CUSTOM, sleep_usec); + } #endif /* Keep the AP informed */