diff options
author | david.huang <david.huang@quantatw.com> | 2018-01-10 14:56:35 +0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2019-04-18 22:43:49 +0000 |
commit | faeaf04ec20b67eb9804015c0cff304408dafdc9 (patch) | |
tree | 435b3eca3a8bdf3528cef7a26c497130b7bbe654 | |
parent | b299a3c6717dd93bf9f26e6c00ad13cd9dfd3fd3 (diff) | |
download | chrome-ec-faeaf04ec20b67eb9804015c0cff304408dafdc9.tar.gz |
Yuna: Change charge voltage for battery
Change battery charge voltage based on Cycle Count or State of Health
for different battery.
BRANCH=yuna
BUG=b:37727454
TEST=Use console command "charger" to check charge voltage with
different battery.
Change-Id: Idcdac0e2e3efa815b660d3b3b8db7a091e4ceb98
Signed-off-by: David Huang <David.Huang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/858991
Tested-by: Stefan Reinauer <reinauer@google.com>
Reviewed-by: Vincent Wang <vwang@chromium.org>
Reviewed-by: Scott Collyer <scollyer@chromium.org>
-rw-r--r-- | board/yuna/bq24707a.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/board/yuna/bq24707a.c b/board/yuna/bq24707a.c index 7ac082554c..1dd52816af 100644 --- a/board/yuna/bq24707a.c +++ b/board/yuna/bq24707a.c @@ -152,40 +152,40 @@ int charger_get_voltage(int *voltage) static int battery_charge_voltage_check(void) { - int cycle, fcc, dc, soh, rv, change = 0; + int cycle, fcc, dc, soh, rv; char device[10]; if (!battery_device_name(device, sizeof(device))) { - CPRINTF("Battery device name : %s", device); if (!strcasecmp(device, "AC14B8K")) { rv = battery_cycle_count(&cycle); - if (!rv && cycle >= 21) { - CPRINTF("Cycle change charge voltage\n"); - change = 1; - return change; - } + if (!rv && cycle >= 21) + return 1; } else if (!strcasecmp(device, "AC14B3K")) { rv = battery_full_charge_capacity(&fcc); rv &= battery_design_capacity(&dc); if (!rv) { soh = fcc*100/dc; - if (soh <= 95) { - CPRINTF("SOH change charge voltage\n"); - change = 1; - return change; - } + if (soh <= 95) + return 1; } } } - return change; + return 0; } int charger_set_voltage(int voltage) { + char device[10]; + if (battery_charge_voltage_check()) { if (voltage != 0) { - CPRINTF("Change charge voltage\n"); - voltage = charger_closest_voltage(17000); + if (!battery_device_name(device, sizeof(device))) { + if (!strcasecmp(device, "AC14B8K")) + voltage = 17008; + else if (!strcasecmp(device, "AC14B3K")) + voltage = 17200; + } + voltage = charger_closest_voltage(voltage); } } else voltage = charger_closest_voltage(voltage); |