diff options
author | Philip Chen <philipchen@google.com> | 2018-05-10 23:38:04 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-05-14 23:56:58 -0700 |
commit | 163263c9a3eedacff191b50a9da55fd1454fcc86 (patch) | |
tree | d42e0caad3b9310ec319a6933e2ad720cf7bbbd9 /board/scarlet | |
parent | 492b1aceeb307949ed42da65aa0ce60b4cb18325 (diff) | |
download | chrome-ec-163263c9a3eedacff191b50a9da55fd1454fcc86.tar.gz |
scarlet: Clamp reported battery SOC when charge terminates
After we set TE (CL:958295), rt946x terminates charging when
the charge current is below IEOC in constant-voltage mode.
When AC is plugged and rt946x terminates, we see cases that
battery SOC falls below BATTERY_LEVEL_NEAR_FULL but rt946x doesn't
re-enable charging yet, which leads to amber LED. The Chrome OS UI
might also show battery is not full in this case.
Let's clamp the reported battery SOC in this scenario to
avoid user confusion.
BUG=b:77870927
BRANCH=scarlet
TEST=When AC is on, charge terminates, and BATTERY_LEVEL_NEAR_FULL
is hit, confirm battery SOC is overwritten.
Change-Id: I4575e562873d149d6f349ddb578334d107e21776
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1055194
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Diffstat (limited to 'board/scarlet')
-rw-r--r-- | board/scarlet/battery.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/board/scarlet/battery.c b/board/scarlet/battery.c index bc3ec6e84c..25b161dee2 100644 --- a/board/scarlet/battery.c +++ b/board/scarlet/battery.c @@ -242,6 +242,16 @@ int charger_profile_override(struct charge_state_data *curr) break; } + /* + * When the charger says it's done charging, even if fuel gauge says + * SOC < BATTERY_LEVEL_NEAR_FULL, we'll overwrite SOC with + * BATTERY_LEVEL_NEAR_FULL. So we can ensure both Chrome OS UI + * and battery LED indicate full charge. + */ + if (rt946x_is_charge_done()) + curr->batt.state_of_charge = MAX(BATTERY_LEVEL_NEAR_FULL, + curr->batt.state_of_charge); + return 0; } |