diff options
author | xiong.huang <xiong.huang@bitland.corp-partner.google.com> | 2020-04-16 12:01:55 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-04-22 04:58:36 +0000 |
commit | 466fcc628fad1771e6720e4b9d75676f30f6d12a (patch) | |
tree | 75382262090a032dac1454a853d4dfc56c09210e | |
parent | 7aee176c6ea1365603a36f2cd9e762c1354fbd03 (diff) | |
download | chrome-ec-466fcc628fad1771e6720e4b9d75676f30f6d12a.tar.gz |
Malefor: Add battery information
Malefor supports three batteries:
- LGC: L19L4PG2
- SUNWODA: L19D4PG2
- SMP: L19M4PG2
BUG=b:154155827
BRANCH=none
TEST=boot malefor board with battery, charging/discharging/cutoff
work as expected.
Signed-off-by: xiong.huang <xiong.huang@bitland.corp-partner.google.com>
Change-Id: I5c639e00bb13f11d0ad11e78d2ede5085c33ca0d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2152027
Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r-- | board/malefor/battery.c | 89 | ||||
-rw-r--r-- | board/malefor/board.h | 4 |
2 files changed, 75 insertions, 18 deletions
diff --git a/board/malefor/battery.c b/board/malefor/battery.c index 9b356a8efd..7f37c6fe10 100644 --- a/board/malefor/battery.c +++ b/board/malefor/battery.c @@ -32,37 +32,92 @@ * 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] = { + [BATTERY_SMP] = { + .fuel_gauge = { + .manuf_name = "SMP", + .device_name = "L19M4PG2", + .ship_mode = { + .reg_addr = 0x34, + .reg_data = { 0x0000, 0x1000 }, + }, + .fet = { + .reg_addr = 0x34, + .reg_mask = 0x0100, + .disconnect_val = 0x0100, + } + }, + .batt_info = { + .voltage_max = 8800, /* mV */ + .voltage_normal = 7680, /* mV */ + .voltage_min = 6000, /* mV */ + .precharge_current = 332, /* 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 = 60, + }, + }, + [BATTERY_LGC] = { .fuel_gauge = { .manuf_name = "LGC", + .device_name = "L19L4PG2", .ship_mode = { - .reg_addr = 0x00, - .reg_data = { 0x10, 0x10 }, + .reg_addr = 0x34, + .reg_data = { 0x0000, 0x1000 }, }, .fet = { - .reg_addr = 0x0, - .reg_mask = 0x6000, - .disconnect_val = 0x6000, + .reg_addr = 0x34, + .reg_mask = 0x0100, + .disconnect_val = 0x0100, } }, .batt_info = { - .voltage_max = TARGET_WITH_MARGIN(13200, 5), - .voltage_normal = 11550, /* mV */ - .voltage_min = 9000, /* mV */ + .voltage_max = 8800, /* mV */ + .voltage_normal = 7700, /* mV */ + /* + * voltage min value and precharge current value are + * specified by LGC directly and not shown in the SPEC. + */ + .voltage_min = 6000, /* mV */ .precharge_current = 256, /* mA */ .start_charging_min_c = 0, - .start_charging_max_c = 45, + .start_charging_max_c = 50, + .charging_min_c = 0, + .charging_max_c = 60, + .discharging_min_c = -20, + .discharging_max_c = 73, + }, + }, + [BATTERY_SUNWODA] = { + .fuel_gauge = { + .manuf_name = "SUNWODA", + .device_name = "L19D4PG2", + .ship_mode = { + .reg_addr = 0x34, + .reg_data = { 0x0000, 0x1000 }, + }, + .fet = { + .reg_addr = 0x34, + .reg_mask = 0x0100, + .disconnect_val = 0x0100, + } + }, + .batt_info = { + .voltage_max = 8800, /* mV */ + .voltage_normal = 7680, /* mV */ + .voltage_min = 6000, /* mV */ + .precharge_current = 333, /* 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 = 75, + .discharging_min_c = -20, + .discharging_max_c = 60, }, }, }; BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT); -const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_LGC011; +const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_SMP; diff --git a/board/malefor/board.h b/board/malefor/board.h index 83c3283bfa..4ae49c49ad 100644 --- a/board/malefor/board.h +++ b/board/malefor/board.h @@ -115,7 +115,9 @@ #include "registers.h" enum battery_type { - BATTERY_LGC011, + BATTERY_SMP, + BATTERY_LGC, + BATTERY_SUNWODA, BATTERY_TYPE_COUNT, }; |