diff options
author | Aseda Aboagye <aaboagye@google.com> | 2021-03-05 16:50:33 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-03-12 22:40:53 +0000 |
commit | aced2136d49090f4efc2a84601902e2997260e64 (patch) | |
tree | 74c7e2f987799cb7045af66d47555f08a6f87f60 | |
parent | c8eb3936e5360eff30786ee0f2080e0f6aee3884 (diff) | |
download | chrome-ec-aced2136d49090f4efc2a84601902e2997260e64.tar.gz |
ocpc: Use desired current from charger task
OCPC was directly querying the desired battery current instead of
honoring the request from the charger task by mistake. This commit
fixes that and makes sure that we don't set our current target from
the desired battery current directly.
BUG=b:180710082
BRANCH=dedede
TEST=Build and flash sasuke, charge from C1, verify that desired
charge profile is adhered to.
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Change-Id: I6d59babcad891fd09ab9a4fc5641e6d152223b74
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2740572
Tested-by: YongBeum.Ha <ybha@samsung.corp-partner.google.com>
Reviewed-by: YongBeum.Ha <ybha@samsung.corp-partner.google.com>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Auto-Submit: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Diana Z <dzigterman@chromium.org>
-rw-r--r-- | common/ocpc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/common/ocpc.c b/common/ocpc.c index cf0d3adedb..70abfac969 100644 --- a/common/ocpc.c +++ b/common/ocpc.c @@ -379,7 +379,7 @@ int ocpc_config_secondary_charger(int *desired_input_current, if (batt.desired_voltage) { if (((batt.voltage < batt_info->voltage_min) || ((batt.voltage < batt_info->voltage_normal) && - (batt.desired_current <= batt_info->precharge_current))) && + (current_ma <= batt_info->precharge_current))) && (ph != PHASE_PRECHARGE)) { /* * If the charger IC doesn't support the linear charge @@ -391,11 +391,11 @@ int ocpc_config_secondary_charger(int *desired_input_current, } else if (result == EC_SUCCESS) { CPRINTS("OCPC: Enabling linear precharge"); ph = PHASE_PRECHARGE; - i_ma = batt.desired_current; + i_ma = current_ma; } } else if (batt.voltage < batt.desired_voltage) { if ((ph == PHASE_PRECHARGE) && - (batt.desired_current > + (current_ma > batt_info->precharge_current)) { /* * Precharge phase is complete. Now set the @@ -425,7 +425,7 @@ int ocpc_config_secondary_charger(int *desired_input_current, if ((ph != PHASE_PRECHARGE) && (ph < PHASE_CV_TRIP)) ph = PHASE_CC; - i_ma = batt.desired_current; + i_ma = current_ma; } else { /* * Once the battery voltage reaches the desired voltage, @@ -587,7 +587,7 @@ set_vsys: CPRINT_VIZ(i == loc ? "o" : "-"); } CPRINT_VIZ("] (actual)%dmA (desired)%dmA\n", batt.current, - batt.desired_current); + i_ma); } return rv; |