summaryrefslogtreecommitdiff
path: root/common/battery.c
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@google.com>2019-12-02 15:27:57 +0800
committerCommit Bot <commit-bot@chromium.org>2019-12-23 10:00:26 +0000
commit924f9f66d91427c3519a8580ae097af53824be3b (patch)
tree79ed89d4d3e6a65b9de313362e8147faa90eaf7f /common/battery.c
parent29ef57b1bc1b5dd7713f6ab42edb4646f2be756d (diff)
downloadchrome-ec-924f9f66d91427c3519a8580ae097af53824be3b.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>
Diffstat (limited to 'common/battery.c')
-rw-r--r--common/battery.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/battery.c b/common/battery.c
index d55d4d393e..850d703954 100644
--- a/common/battery.c
+++ b/common/battery.c
@@ -615,6 +615,10 @@ void battery_compensate_params(struct batt_params *batt)
batt->display_charge = 0;
}
+__overridable void board_battery_compensate_params(struct batt_params *batt)
+{
+}
+
__attribute__((weak)) int get_battery_manufacturer_name(char *dest, int size)
{
strzcpy(dest, "<unkn>", size);