diff options
author | Ting Shen <phoenixshen@google.com> | 2019-07-31 17:11:22 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-08-08 10:45:53 +0000 |
commit | 3e6c5b4673228f2c009c5dd9283f9232ef4f9449 (patch) | |
tree | 6969fe8a0b109c87eaff4841eb22952fd9986593 /board/jacuzzi/battery.c | |
parent | 90b71a9252ad1711dcd73d634a737af862576878 (diff) | |
download | chrome-ec-3e6c5b4673228f2c009c5dd9283f9232ef4f9449.tar.gz |
baseboard/kukui: refactor smart battery code
- Use common fuel gauge implenentation in battery_fuel_gauge.c for
things like cutoff and get_info
- Move battery characteristics data into per-board folder, so follower
devices can add their own battery.
- Move Jacuzzi-only battery_hw_present() into per-board folder
BUG=b:136977971
TEST=boot ec, verify that ec console prints 'found batt:PANASONIC'
BRANCH=master
Change-Id: Ib4d33a2d3b4e1e061b390a000071f805d4780c27
Signed-off-by: Ting Shen <phoenixshen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1728671
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Tested-by: Ting Shen <phoenixshen@chromium.org>
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Reviewed-by: Yilun Lin <yllin@chromium.org>
Diffstat (limited to 'board/jacuzzi/battery.c')
-rw-r--r-- | board/jacuzzi/battery.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/board/jacuzzi/battery.c b/board/jacuzzi/battery.c new file mode 100644 index 0000000000..014a8ae6fc --- /dev/null +++ b/board/jacuzzi/battery.c @@ -0,0 +1,46 @@ +/* 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. + */ + +#include "battery.h" +#include "battery_fuel_gauge.h" +#include "gpio.h" + +const struct board_batt_params board_battery_info[] = { + [BATTERY_PANASONIC_AC15A3J] = { + .fuel_gauge = { + .manuf_name = "PANASONIC", + .device_name = "AC15A3J", + .ship_mode = { + .reg_addr = 0x3A, + .reg_data = { 0xC574, 0xC574 }, + }, + .fet = { + .reg_addr = 0x0, + .reg_mask = 0x4000, + .disconnect_val = 0x0, + } + }, + .batt_info = { + .voltage_max = 13200, + .voltage_normal = 11580, + .voltage_min = 9000, + .precharge_current = 256, + .start_charging_min_c = 0, + .start_charging_max_c = 45, + .charging_min_c = 0, + .charging_max_c = 60, + .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_PANASONIC_AC15A3J; + +enum battery_present battery_hw_present(void) +{ + return gpio_get_level(GPIO_EC_BATT_PRES_ODL) ? BP_NO : BP_YES; +} |