diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2018-11-09 09:43:42 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-11-16 05:01:57 -0800 |
commit | cd2364b2da37d851baa36378eb3c8dd5846ab98a (patch) | |
tree | e057eda720f6e96681b5b235f26a50bef0349c09 /driver | |
parent | a2c7fd10c148a913828f63fdbc0599f63804b22e (diff) | |
download | chrome-ec-cd2364b2da37d851baa36378eb3c8dd5846ab98a.tar.gz |
Battery: Use host full capacity to compute display percentage
The full capacity known by the host may slightly differ from the full
capacity known by the EC because we notify the host of the new
capacity only if the difference is larger than 5 mAh.
This patch makes the EC use the host's full capacity instead of the
local full capacity to compute the display percentage.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
BUG=b:109954565,b:80270446
BRANCH=none
TEST=Verify display percentages printed by EC and power_supply_info
move up synchronously on charge and the LED and the taskbar icon
turn to full at the same time.
TEST=buildall
Change-Id: Ie695a9937a22fc7a769b82448f4600d4491935b3
Reviewed-on: https://chromium-review.googlesource.com/1330101
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r-- | driver/battery/smart.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/driver/battery/smart.c b/driver/battery/smart.c index 0598653768..758a60f546 100644 --- a/driver/battery/smart.c +++ b/driver/battery/smart.c @@ -396,7 +396,10 @@ void battery_get_params(struct batt_params *batt) /* Force both to zero */ batt_new.desired_voltage = batt_new.desired_current = 0; +#ifdef HAS_TASK_HOSTCMD + /* if there is no host, we don't care about compensation */ battery_compensate_params(&batt_new); +#endif /* Update visible battery parameters */ memcpy(batt, &batt_new, sizeof(*batt)); |