diff options
author | qijun tang <qijun.tang@ecs.corp-partner.google.com> | 2021-07-27 00:43:47 -0400 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-08-06 17:37:06 +0000 |
commit | d1e00461da059508890fd44869c98f6835fc96e2 (patch) | |
tree | 4fe9817a1c259cfa08f1151ee0a50a91906976d3 | |
parent | 6e9c1b3a27c96267cda3329fdb50114a26bef9c3 (diff) | |
download | chrome-ec-d1e00461da059508890fd44869c98f6835fc96e2.tar.gz |
pazquel: Modify battery information
Modify battery information to match spec
BUG=b:188393713
BRANCH=trogdor
TEST= > battery
Status: 0x00e0 FULL DCHG INIT
Param flags:00000002
Temp: 0x0bd1 = 302.5 K (29.4 C)
V: 0x21d3 = 8659 mV
V-desired: 0x0000 = 0 mV
I: 0x0000 = 0 mA
I-desired: 0x0000 = 0 mA
Charging: Not Allowed
Charge: 100 %
Display: 100.0 %
Manuf: BMSPow
Device: SG20
Chem: GF
Serial: 0x0007
V-design: 0x1db0 = 7600 mV
Mode: 0x0000
Abs charge:99 %
Remaining: 5641 mAh
Cap-full: 5650 mAh
Design: 5650 mAh
Time-full: 0h:0
Empty: 0h:0
full_factor:0.97
shutdown_soc:4 %
Signed-off-by: qijun tang <qijun.tang@ecs.corp-partner.google.com>
Change-Id: Idbef7873107025bf1e426910a163bf5293ed288e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3054224
Reviewed-by: Philip Chen <philipchen@chromium.org>
Commit-Queue: Philip Chen <philipchen@chromium.org>
-rw-r--r-- | board/pazquel/battery.c | 70 | ||||
-rw-r--r-- | board/pazquel/board.h | 9 |
2 files changed, 43 insertions, 36 deletions
diff --git a/board/pazquel/battery.c b/board/pazquel/battery.c index 47bacd3c31..20a4c3b80e 100644 --- a/board/pazquel/battery.c +++ b/board/pazquel/battery.c @@ -5,41 +5,39 @@ * Battery pack vendor provided charging profile */ -#include "battery.h" -#include "battery_smart.h" - -/* Shutdown mode parameter to write to manufacturer access register */ -#define SB_SHIP_MODE_REG SB_MANUFACTURER_ACCESS -#define SB_SHUTDOWN_DATA 0x0010 - -/* Battery info */ -static const struct battery_info info = { - .voltage_max = 8800, - .voltage_normal = 7700, - .voltage_min = 6000, - .precharge_current = 256, /* 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, +#include "battery_fuel_gauge.h" +#include "common.h" + +const struct board_batt_params board_battery_info[] = { + [BATTERY_BMSPOW] = { + .fuel_gauge = { + .manuf_name = "BMSPow", + .device_name = "SG20", + .ship_mode = { + .reg_addr = 0x00, + .reg_data = { 0x0010, 0x0010 }, + }, + .fet = { + .reg_addr = 0x43, + .reg_mask = 0x0003, + .disconnect_val = 0x0000, + } + + }, + .batt_info = { + .voltage_max = 8700, /* mV */ + .voltage_normal = 7600, /* mV */ + .voltage_min = 6000, /* mV */ + .precharge_current = 256, /* 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, + }, + }, }; +BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT); -const struct battery_info *battery_get_info(void) -{ - return &info; -} - -int board_cut_off_battery(void) -{ - int rv; - - /* Ship mode command must be sent twice to take effect */ - rv = sb_write(SB_SHIP_MODE_REG, SB_SHUTDOWN_DATA); - - if (rv != EC_SUCCESS) - return rv; - - return sb_write(SB_SHIP_MODE_REG, SB_SHUTDOWN_DATA); -} +const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_BMSPOW; diff --git a/board/pazquel/board.h b/board/pazquel/board.h index 121158f231..dec83dcc05 100644 --- a/board/pazquel/board.h +++ b/board/pazquel/board.h @@ -26,6 +26,11 @@ #define CONFIG_PWM_KBLIGHT +/* Battery */ +#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION" +#define CONFIG_BATTERY_FUEL_GAUGE +#define CONFIG_BATTERY_REVIVE_DISCONNECT + /* BC 1.2 Charger */ #define CONFIG_BC12_DETECT_PI3USB9201 @@ -92,6 +97,10 @@ enum pwm_channel { PWM_CH_COUNT }; +enum battery_type { + BATTERY_BMSPOW, + BATTERY_TYPE_COUNT, +}; /* Reset all TCPCs. */ void board_reset_pd_mcu(void); void board_set_tcpc_power_mode(int port, int mode); |