From c60cee7cfe80e448683b44ef0d740ccc5236c6ea Mon Sep 17 00:00:00 2001 From: Philip Chen Date: Wed, 6 Dec 2017 23:19:19 -0800 Subject: scarlet: Define battery profile Also updated the basic parameters (design_cap, ichg_term, and v_empty) based on the characterization result. BUG=b:69634899 CQ-DEPEND=CL:813038 BRANCH=none TEST=manually test on Scarlet rev2, 'battery' command shows reasonable reading no matter is_ez_config is set as 0 or not. Change-Id: I55889efe39cc43e38c0285d298bcf39f0a4e49a1 Signed-off-by: Philip Chen Reviewed-on: https://chromium-review.googlesource.com/812481 Commit-Ready: Philip Chen Tested-by: Philip Chen Reviewed-by: Shawn N --- board/scarlet/battery.c | 22 ++++++++++++++++++++++ board/scarlet/board.h | 3 --- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/board/scarlet/battery.c b/board/scarlet/battery.c index e27d547a71..32819f6f57 100644 --- a/board/scarlet/battery.c +++ b/board/scarlet/battery.c @@ -9,6 +9,7 @@ #include "battery_smart.h" #include "charge_state.h" #include "console.h" +#include "driver/battery/max17055.h" #include "driver/charger/rt946x.h" #include "ec_commands.h" #include "extpower.h" @@ -27,11 +28,32 @@ static const struct battery_info info = { .discharging_max_c = 55, }; +static const struct max17055_batt_profile batt_profile = { + .is_ez_config = 0, + .design_cap = 0x232f, /* 9007mAh */ + .ichg_term = 0x0240, /* 180mA */ + /* Empty voltage = 2700mV, Recovery voltage = 3280mV */ + .v_empty_detect = 0x8752, + .dpacc = 0x0c7b, + .learn_cfg = 0x4476, + .rcomp0 = 0x0077, + .tempco = 0x1d3f, + .qr_table00 = 0x1200, + .qr_table10 = 0x0900, + .qr_table20 = 0x0480, + .qr_table30 = 0x0480, +}; + const struct battery_info *battery_get_info(void) { return &info; } +const struct max17055_batt_profile *max17055_get_batt_profile(void) +{ + return &batt_profile; +} + int board_cut_off_battery(void) { return rt946x_cutoff_battery(); diff --git a/board/scarlet/board.h b/board/scarlet/board.h index 7a4d936d02..8452c0118c 100644 --- a/board/scarlet/board.h +++ b/board/scarlet/board.h @@ -122,9 +122,6 @@ #define CONFIG_BATTERY_MAX17055 /* Battery parameters for max17055 ModelGauge m5 algorithm. */ -#define BATTERY_MAX17055_DESIGNCAP 0x2328 -#define BATTERY_MAX17055_ICHGTERM 0x0220 -#define BATTERY_MAX17055_VEMPTY 0xa561 #define BATTERY_MAX17055_RSENSE 5 /* m-ohm */ #define BATTERY_DESIRED_CHARGING_CURRENT 2000 /* mA */ -- cgit v1.2.1