diff options
author | Keith Short <keithshort@chromium.org> | 2019-11-02 10:22:30 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-11-09 04:57:54 +0000 |
commit | bd2b21346ceb7bdd736efcd83f444c1d7f84ee7d (patch) | |
tree | 69d5ebaaa0291c17eed1c795065f54f46397f117 /board | |
parent | b127de71fac86406c275a6ad6d5a7bbcf5d11111 (diff) | |
download | chrome-ec-bd2b21346ceb7bdd736efcd83f444c1d7f84ee7d.tar.gz |
volteer: add initial battery support
Add ODM specified 62 Wh battery.
BUG=b:143477210
BRANCH=none
TEST=make buildall
Change-Id: I7c3292bbd23405781207366981c2af03b6d4624a
Signed-off-by: Keith Short <keithshort@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1896648
Diffstat (limited to 'board')
-rw-r--r-- | board/volteer/battery.c | 68 | ||||
-rw-r--r-- | board/volteer/board.h | 5 | ||||
-rw-r--r-- | board/volteer/build.mk | 1 | ||||
-rw-r--r-- | board/volteer/gpio.inc | 3 |
4 files changed, 77 insertions, 0 deletions
diff --git a/board/volteer/battery.c b/board/volteer/battery.c new file mode 100644 index 0000000000..a74afdd763 --- /dev/null +++ b/board/volteer/battery.c @@ -0,0 +1,68 @@ +/* Copyright 2019 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + * + * Battery pack vendor provided charging profile + */ + +#include "battery_fuel_gauge.h" +#include "common.h" +#include "util.h" + +/* + * Battery info for all Volteer battery types. Note that the fields + * start_charging_min/max and charging_min/max are not used for the charger. + * The effective temperature limits are given by discharging_min/max_c. + * + * Fuel Gauge (FG) parameters which are used for determining if the battery + * is connected, the appropriate ship mode (battery cutoff) command, and the + * charge/discharge FETs status. + * + * Ship mode (battery cutoff) requires 2 writes to the appropriate smart battery + * register. For some batteries, the charge/discharge FET bits are set when + * charging/discharging is active, in other types, these bits set mean that + * charging/discharging is disabled. Therefore, in addition to the mask for + * these bits, a disconnect value must be specified. Note that for TI fuel + * gauge, the charge/discharge FET status is found in Operation Status (0x54), + * but a read of Manufacturer Access (0x00) will return the lower 16 bits of + * Operation status which contains the FET status bits. + * + * The assumption for battery types supported is that the charge/discharge FET + * status can be read with a sb_read() command and therefore, only the register + * address, mask, and disconnect value need to be provided. + */ +const struct board_batt_params board_battery_info[] = { + /* LGC\011 L17L3PB0 Battery Information */ + /* + * Battery info provided by ODM on b/143477210, comment #11 + */ + [BATTERY_LGC011] = { + .fuel_gauge = { + .manuf_name = "LGC", + .ship_mode = { + .reg_addr = 0x00, + .reg_data = { 0x10, 0x10 }, + }, + .fet = { + .reg_addr = 0x0, + .reg_mask = 0x6000, + .disconnect_val = 0x6000, + } + }, + .batt_info = { + .voltage_max = TARGET_WITH_MARGIN(13050, 5), + .voltage_normal = 11400, /* mV */ + .voltage_min = 9000, /* mV */ + .precharge_current = 500, /* mA */ + .start_charging_min_c = 0, + .start_charging_max_c = 50, + .charging_min_c = 0, + .charging_max_c = 60, + .discharging_min_c = 0, + .discharging_max_c = 60, + }, + }, +}; +BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT); + +const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_LGC011; diff --git a/board/volteer/board.h b/board/volteer/board.h index 990dd82194..0d645c99c3 100644 --- a/board/volteer/board.h +++ b/board/volteer/board.h @@ -71,6 +71,11 @@ #include "gpio_signal.h" #include "registers.h" +enum battery_type { + BATTERY_LGC011, + BATTERY_TYPE_COUNT, +}; + /* TODO: b/143375057 - Remove this code after power on. */ void c10_gate_change(enum gpio_signal signal); diff --git a/board/volteer/build.mk b/board/volteer/build.mk index 9ebde9ae1b..681f1b1fe0 100644 --- a/board/volteer/build.mk +++ b/board/volteer/build.mk @@ -28,4 +28,5 @@ ENV_VARS := VOLTEER_POWER_SEQUENCE board-y=board.o +board-y+=battery.o board-$(VOLTEER_POWER_SEQUENCE)+=power_sequence.o diff --git a/board/volteer/gpio.inc b/board/volteer/gpio.inc index c459a8d589..5ce78773b6 100644 --- a/board/volteer/gpio.inc +++ b/board/volteer/gpio.inc @@ -102,6 +102,9 @@ GPIO(EC_I2C5_POWER_SDA, PIN(3, 6), GPIO_INPUT) GPIO(EC_I2C7_EEPROM_SCL, PIN(B, 3), GPIO_INPUT) GPIO(EC_I2C7_EEPROM_SDA, PIN(B, 2), GPIO_INPUT) +/* Battery signals */ +GPIO(EC_BATT_PRES_ODL, PIN(E, 1), GPIO_INPUT) + /* Alternate functions GPIO definitions */ ALTERNATE(PIN_MASK(B, BIT(5) | BIT(4)), 0, MODULE_I2C, (GPIO_INPUT | GPIO_SEL_1P8V)) /* I2C0 */ ALTERNATE(PIN_MASK(9, BIT(0) | BIT(2) | BIT(1)), 0, MODULE_I2C, 0) /* I2C1 SCL / I2C2 */ |