diff options
author | Ting Shen <phoenixshen@google.com> | 2019-12-02 15:27:57 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-02-21 07:48:24 +0000 |
commit | 0d77e31ad4535c7e4bced9e84281c0459a7b122e (patch) | |
tree | e9dfaa686c2e99197c97d0f276e08bbef36d8bad /driver | |
parent | 883f54fa1708792ac772c6df7e0587ff410951f6 (diff) | |
download | chrome-ec-0d77e31ad4535c7e4bced9e84281c0459a7b122e.tar.gz |
kodama: overwrite bad battery params to known good value
Kodama's bitbang driver fails randomly, and there's no way to notify
kernel side that bitbang read failed (batt->flags does not propagate
into kernel).
Thus, if any value in batt_params is bad, replace it with a cached
good value, to make sure we never send random numbers to kernel side.
BUG=b:144195782
TEST=Modify smart battery driver to make sb_read has 50% fail rate,
and monitor /sys/class/power_supply/sbs*/*, make sure the bad values
does not observable in kernel.
BRANCH=kukui
Change-Id: Idf4691eb743f1ef785593b308b8f07a34e5ea642
Signed-off-by: Ting Shen <phoenixshen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1943637
Reviewed-by: Eric Yilun Lin <yllin@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Tested-by: Ting Shen <phoenixshen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3469838
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Reviewed-by: Eric Yilun Lin <yllin@google.com>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r-- | driver/battery/smart.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/driver/battery/smart.c b/driver/battery/smart.c index de5bedc9be..a017f0ba96 100644 --- a/driver/battery/smart.c +++ b/driver/battery/smart.c @@ -427,6 +427,7 @@ void battery_get_params(struct batt_params *batt) #ifdef HAS_TASK_HOSTCMD /* if there is no host, we don't care about compensation */ battery_compensate_params(&batt_new); + board_battery_compensate_params(&batt_new); #endif if (IS_ENABLED(CONFIG_CMD_BATTFAKE)) |