diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2017-01-25 10:39:09 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-01-25 22:12:30 -0800 |
commit | 7a4eac1bed523e0f37597efcf1b887d996a037f0 (patch) | |
tree | 4ec10d33497182116aa9f60fdccab559591451e5 /include | |
parent | 325c93fa94dc8ffbd15386d66c45dc0aaca262bb (diff) | |
download | chrome-ec-7a4eac1bed523e0f37597efcf1b887d996a037f0.tar.gz |
Reef: Reduce max battery charge voltage for 0.5% margin
(From CL 431233)
Limit battery charge voltage to prevent battery over-charge, due to
regulation inaccuracy. Since RO FW may charge > 8656 mV, ensure the
battery is not full before charging.
BUG=chrome-os-partner:61906
BRANCH=none
TEST=Manual on Electro, sysjump with battery @ 99%, verify battery
discharges, then re-charges to 100%, before discharging once again.
Change-Id: I28212c83057a442fd75e39f8ad51927a7a1f2817
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/432857
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/common.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/common.h b/include/common.h index 0bdea8965d..f35d543ce8 100644 --- a/include/common.h +++ b/include/common.h @@ -84,6 +84,12 @@ #define CELSIUS_TO_DECI_KELVIN(temp_c) ((temp_c) * 10 + 2731) #define DECI_KELVIN_TO_CELSIUS(temp_dk) ((temp_dk - 2731) / 10) +/* Calculate a value with error margin considered. For example, + * TARGET_WITH_MARGIN(X, 5) returns X' where X' * 100.5% is almost equal to + * but does not exceed X. */ +#define TARGET_WITH_MARGIN(target, tenths_percent) \ + (((target) * 1000) / (1000 + (tenths_percent))) + /* Include top-level configuration file */ #include "config.h" |