diff options
author | Aseda Aboagye <aaboagye@google.com> | 2020-12-01 16:25:12 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-12-10 00:47:24 +0000 |
commit | f871ed9e0d782a1f44a303aa22b55a82874fbeac (patch) | |
tree | c7a69e04757fe2a8cefe5f51b219e97e981f01fc /common/ocpc.c | |
parent | 5f5a23758d17e6b04076d0aad536b80decdac24e (diff) | |
download | chrome-ec-f871ed9e0d782a1f44a303aa22b55a82874fbeac.tar.gz |
OCPC: Improve CV charging phase
This commit improves the CV charging phase by setting the target
charge current to the current currently entering the battery as
opposed to simply keeping VSYS as the max voltage and allowing the
current to asymptotically reach the target.
BUG=b:167913892
BRANCH=dedede
TEST=Build and flash drawlat, charge battery to completion, verify
that voltage remains roughly constant in the CV phase.
Change-Id: Ifa5925e6f5e9e5ba83f6265bff16decaa514e762
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2568567
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'common/ocpc.c')
-rw-r--r-- | common/ocpc.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/common/ocpc.c b/common/ocpc.c index 2a81e6522c..417983bfba 100644 --- a/common/ocpc.c +++ b/common/ocpc.c @@ -174,6 +174,7 @@ int ocpc_config_secondary_charger(int *desired_input_current, int vsys_target = 0; int drive = 0; int i_ma = 0; + static int i_ma_CC_CV; int min_vsys_target; int error = 0; int derivative = 0; @@ -301,6 +302,8 @@ int ocpc_config_secondary_charger(int *desired_input_current, */ i_ma = batt.current; ph = ph == PHASE_CC ? PHASE_CV_TRIP : PHASE_CV_COMPLETE; + if (ph == PHASE_CV_TRIP) + i_ma_CC_CV = batt.current; } } @@ -376,7 +379,13 @@ int ocpc_config_secondary_charger(int *desired_input_current, * Once we're in the CV region, all we need to do is keep VSYS at the * desired voltage. */ - if (ph >= PHASE_CV_TRIP) + if (ph == PHASE_CV_TRIP) { + vsys_target = batt.desired_voltage + + ((i_ma_CC_CV * + ocpc->combined_rsys_rbatt_mo) / 1000); + CPRINTS_DBG("i_ma_CC_CV = %d", i_ma_CC_CV); + } + if (ph == PHASE_CV_COMPLETE) vsys_target = batt.desired_voltage + ((batt_info->precharge_current * ocpc->combined_rsys_rbatt_mo) / 1000); |