diff options
author | YH Lin <yueherngl@google.com> | 2019-05-02 10:26:06 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-05-09 16:05:55 -0700 |
commit | 1fcab2af05730a3ca938dd651fd9fc9bdc62ab62 (patch) | |
tree | 36831e5ec3950c9dee03483f03850c96e68f1ca1 | |
parent | 44adfa912b7686715e02a00055cc4df238afc508 (diff) | |
download | chrome-ec-1fcab2af05730a3ca938dd651fd9fc9bdc62ab62.tar.gz |
Flapjack: Enable full model of MAX17055
This patch enables full model of MAX17055.
BUG=b:130804959
BRANCH=none
TEST=The simple test steps which we used are as follows:
1. using DCP charger to complete two charge cycles.
2. Connect the serial cable to machaine, and collecting data of
the ec-command "battery 20000 10000"
3. Convert #2 battery log to excel form, and analyze test results
Change-Id: If07d7919142b4fcfb1f69972de70efc3d213bae3
Signed-off-by: YH Lin <yueherngl@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1575558
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r-- | board/flapjack/battery.c | 56 | ||||
-rw-r--r-- | board/flapjack/board.h | 1 |
2 files changed, 53 insertions, 4 deletions
diff --git a/board/flapjack/battery.c b/board/flapjack/battery.c index faa1c8d21f..506ea593c3 100644 --- a/board/flapjack/battery.c +++ b/board/flapjack/battery.c @@ -34,6 +34,46 @@ #define BATTERY_SUNWODA_CHARGE_MIN_TEMP 0 #define BATTERY_SUNWODA_CHARGE_MAX_TEMP 60 +static const uint16_t full_model_ocv_table[][MAX17055_OCV_TABLE_SIZE] = { + [BATTERY_C18_ATL] = { + 0x8fc0, 0xb6c0, 0xb910, 0xbb30, 0xbcb0, 0xbdd0, 0xbef0, 0xc050, + 0xc1a0, 0xc460, 0xc750, 0xca40, 0xcd10, 0xd070, 0xd560, 0xda20, + 0x0060, 0x0f20, 0x0f40, 0x16c0, 0x17f0, 0x15c0, 0x1050, 0x10e0, + 0x09f0, 0x0850, 0x0730, 0x07a0, 0x0730, 0x0700, 0x0710, 0x0710, + 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, + 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, + }, + [BATTERY_C19_ATL] = { + 0xa260, 0xb5d0, 0xb840, 0xb940, 0xbbb0, 0xbcb0, 0xbdb0, 0xbf80, + 0xc0a0, 0xc1e0, 0xc520, 0xc840, 0xcdb0, 0xd150, 0xd590, 0xd9e0, + 0x0030, 0x0cd0, 0x1100, 0x0f30, 0x19e0, 0x19f0, 0x14f0, 0x1160, + 0x0dc0, 0x0980, 0x0850, 0x0780, 0x0730, 0x0700, 0x0710, 0x0710, + 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, + 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, + }, + [BATTERY_C18_SUNWODA] = { + 0x9d70, 0xaf80, 0xb6b0, 0xb830, 0xb990, 0xbc00, 0xbcd0, 0xbea0, + 0xc080, 0xc2e0, 0xc5f0, 0xc890, 0xcb90, 0xcf10, 0xd270, 0xd9e0, + 0x0060, 0x0240, 0x0b20, 0x1210, 0x0f20, 0x2200, 0x1650, 0x14f0, + 0x0980, 0x09c0, 0x07b0, 0x07f0, 0x06f0, 0x07e0, 0x05c0, 0x05c0, + 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, + 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, + }, + [BATTERY_C19_SUNWODA] = { + 0x8590, 0xb1d0, 0xb810, 0xbae0, 0xbc30, 0xbd70, 0xbeb0, 0xbfa0, + 0xc0f0, 0xc330, 0xc640, 0xc890, 0xcb50, 0xce20, 0xd370, 0xd950, + 0x0020, 0x0520, 0x0d80, 0x1860, 0x1910, 0x2040, 0x0be0, 0x0dd0, + 0x0cb0, 0x07b0, 0x08f0, 0x07c0, 0x0790, 0x06e0, 0x0620, 0x0620, + 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, + 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, + }, +}; +BUILD_ASSERT(ARRAY_SIZE(full_model_ocv_table) == BATTERY_COUNT); + +/* + * TODO: Only precharge_current is different. We should consolidate these + * and apply 294 or 327 at run-time.when we need more rom space later. + */ static const struct battery_info info[] = { [BATTERY_C18_ATL] = { .voltage_max = 4400, @@ -90,7 +130,7 @@ static const struct max17055_batt_profile batt_profile[] = { [BATTERY_C18_ATL] = { .is_ez_config = 0, .design_cap = 0x2e78, /* 5948mAh */ - .ichg_term = 0x02ec, /* 117 mA */ + .ichg_term = 0x03c0, /* 150 mA */ /* Empty voltage = 3400mV, Recovery voltage = 4000mV */ .v_empty_detect = 0xaa64, .learn_cfg = 0x4402, @@ -101,11 +141,12 @@ static const struct max17055_batt_profile batt_profile[] = { .qr_table10 = 0x2980, .qr_table20 = 0x1100, .qr_table30 = 0x1000, + .ocv_table = full_model_ocv_table[BATTERY_C18_ATL], }, [BATTERY_C19_ATL] = { .is_ez_config = 0, .design_cap = 0x3407, /* 6659mAh */ - .ichg_term = 0x0340, /* 130mA */ + .ichg_term = 0x03c0, /* 150 mA */ /* Empty voltage = 3400mV, Recovery voltage = 4000mV */ .v_empty_detect = 0xaa64, .learn_cfg = 0x4402, @@ -116,6 +157,7 @@ static const struct max17055_batt_profile batt_profile[] = { .qr_table10 = 0x2680, .qr_table20 = 0x0d00, .qr_table30 = 0x0b00, + .ocv_table = full_model_ocv_table[BATTERY_C19_ATL], }, [BATTERY_C18_SUNWODA] = { .is_ez_config = 0, @@ -131,6 +173,7 @@ static const struct max17055_batt_profile batt_profile[] = { .qr_table10 = 0x4480, .qr_table20 = 0x1600, .qr_table30 = 0x1400, + .ocv_table = full_model_ocv_table[BATTERY_C18_SUNWODA], }, [BATTERY_C19_SUNWODA] = { .is_ez_config = 0, @@ -146,6 +189,7 @@ static const struct max17055_batt_profile batt_profile[] = { .qr_table10 = 0x3d00, .qr_table20 = 0x1200, .qr_table30 = 0x1002, + .ocv_table = full_model_ocv_table[BATTERY_C19_SUNWODA], }, }; BUILD_ASSERT(ARRAY_SIZE(batt_profile) == BATTERY_COUNT); @@ -196,6 +240,10 @@ enum temp_zone { TEMP_OUT_OF_RANGE = TEMP_ZONE_COUNT, }; +/* + * TODO: Many value in temp_zones are pretty similar, we should consolidate + * these and modify the value when we need more rom space later. + */ static const struct { int temp_min; /* 0.1 deg C */ int temp_max; /* 0.1 deg C */ @@ -203,13 +251,13 @@ static const struct { int desired_voltage; /* mV */ } temp_zones[BATTERY_COUNT][TEMP_ZONE_COUNT] = { [BATTERY_C18_ATL] = { - {BATTERY_ATL_CHARGE_MIN_TEMP * 10, 10, 1170, 4400}, + {BATTERY_ATL_CHARGE_MIN_TEMP * 10, 100, 1170, 4400}, {100, 200, 1755, 4400}, {200, 450, 2925, 4400}, {450, BATTERY_ATL_CHARGE_MAX_TEMP * 10, 2925, 4100}, }, [BATTERY_C19_ATL] = { - {BATTERY_ATL_CHARGE_MIN_TEMP * 10, 10, 1300, 4400}, + {BATTERY_ATL_CHARGE_MIN_TEMP * 10, 100, 1300, 4400}, {100, 200, 1950, 4400}, {200, 450, 3250, 4400}, {450, BATTERY_ATL_CHARGE_MAX_TEMP * 10, 3250, 4100}, diff --git a/board/flapjack/board.h b/board/flapjack/board.h index 5d7fdf7c5b..6ce4da0f4e 100644 --- a/board/flapjack/board.h +++ b/board/flapjack/board.h @@ -151,6 +151,7 @@ #define CONFIG_BATTERY_REVIVE_DISCONNECT #define CONFIG_BATTERY_MAX17055 #define CONFIG_BATTERY_MAX17055_ALERT +#define CONFIG_BATTERY_MAX17055_FULL_MODEL /* Battery parameters for max17055 ModelGauge m5 algorithm. */ #define BATTERY_MAX17055_RSENSE 10 /* m-ohm */ |