From 3d425f1220694dd054ae0d809c056ad102129720 Mon Sep 17 00:00:00 2001 From: Danny Chou Date: Tue, 12 May 2015 16:23:13 +0800 Subject: Support new battery Support new battery function BUG=None TEST=Test battery charge/discharge function. BRANCH=gnawty Change-Id: I5c398bfb5a63d711779eb33322333a149468e857 Signed-off-by: Danny Chou Reviewed-on: https://chromium-review.googlesource.com/270303 Reviewed-by: T.H. Lin Reviewed-by: Shawn N Reviewed-by: Bernie Thompson Commit-Queue: Bernie Thompson Tested-by: Bernie Thompson --- board/gnawty/battery.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/board/gnawty/battery.c b/board/gnawty/battery.c index 50f1e10e4f..902a00da22 100644 --- a/board/gnawty/battery.c +++ b/board/gnawty/battery.c @@ -16,7 +16,7 @@ #define SB_SHIP_MODE_ADDR 0x3a #define SB_SHIP_MODE_DATA 0xc574 -static const struct battery_info info = { +static const struct battery_info info_AC14 = { .voltage_max = 12900, /* mV */ .voltage_normal = 11400, .voltage_min = 9000, @@ -29,9 +29,26 @@ static const struct battery_info info = { .discharging_max_c = 75, }; +static const struct battery_info info_AC15 = { + /* New battery, use BOARD_ID pin 3 tp separate it. */ + .voltage_max = 12600, /* mV */ + .voltage_normal = 10800, + .voltage_min = 82500, + .precharge_current = 340, /* mA */ + .start_charging_min_c = 0, + .start_charging_max_c = 50, + .charging_min_c = 0, + .charging_max_c = 60, + .discharging_min_c = -20, + .discharging_max_c = 75, +}; + const struct battery_info *battery_get_info(void) { - return &info; + if (gpio_get_level(GPIO_BOARD_VERSION3)) + return &info_AC15; + else + return &info_AC14; } static int battery_command_cut_off(struct host_cmd_handler_args *args) -- cgit v1.2.1