summaryrefslogtreecommitdiff
path: root/driver/battery/smart.c
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@google.com>2019-12-02 15:27:57 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-09-13 17:33:44 +0000
commit318557af840588d1c0e95b505f828abbf39363e4 (patch)
tree59203bb1ca581bc667224475ff0a983e85894e4f /driver/battery/smart.c
parent236c7e158d6d3482afa29505d7da718a5598c939 (diff)
downloadchrome-ec-318557af840588d1c0e95b505f828abbf39363e4.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/+/3872709 Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Auto-Submit: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'driver/battery/smart.c')
-rw-r--r--driver/battery/smart.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/driver/battery/smart.c b/driver/battery/smart.c
index cc3ef73c29..51a04d3b6b 100644
--- a/driver/battery/smart.c
+++ b/driver/battery/smart.c
@@ -398,6 +398,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
/* Update visible battery parameters */