From 69c18ad6a6a77ea1c82465e6420280c8cf55b12f Mon Sep 17 00:00:00 2001 From: Philip Chen Date: Wed, 28 Feb 2018 16:59:27 -0800 Subject: scarlet: Enable 4A charging for Simplo battery Simplo update battery spec again - the maximal charging current can be 4A now. BUG=b:70820167 BRANCH=scarlet TEST=build scarlet Change-Id: I52e295b83563240aed73944107b00649c9b422b1 Signed-off-by: Philip Chen Reviewed-on: https://chromium-review.googlesource.com/942370 Commit-Ready: Philip Chen Tested-by: Philip Chen Reviewed-by: Alexandru M Stan Reviewed-by: David Schneider --- board/scarlet/battery.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'board') diff --git a/board/scarlet/battery.c b/board/scarlet/battery.c index 8b714ebec7..d84e8c1d6c 100644 --- a/board/scarlet/battery.c +++ b/board/scarlet/battery.c @@ -142,7 +142,7 @@ int charger_profile_override(struct charge_state_data *curr) TEMP_ZONE_COUNT } temp_zone; - static const struct { + static struct { int temp_min; /* 0.1 deg C */ int temp_max; /* 0.1 deg C */ int desired_current; /* mA */ @@ -150,8 +150,8 @@ int charger_profile_override(struct charge_state_data *curr) } temp_zones[BATTERY_COUNT][TEMP_ZONE_COUNT] = { [BATTERY_SIMPLO] = { {0, 150, 1772, 4400}, /* TEMP_ZONE_0 */ - {150, 450, 3000, 4400}, /* TEMP_ZONE_1 */ - {450, 600, 3000, 4100}, /* TEMP_ZONE_2 */ + {150, 450, 4000, 4400}, /* TEMP_ZONE_1 */ + {450, 600, 4000, 4100}, /* TEMP_ZONE_2 */ }, [BATTERY_AETECH] = { {0, 100, 900, 4200}, /* TEMP_ZONE_0 */ @@ -167,6 +167,17 @@ int charger_profile_override(struct charge_state_data *curr) BUILD_ASSERT(ARRAY_SIZE(temp_zones) == BATTERY_COUNT); static int charge_phase = 1; + static uint8_t quirk_batt_update; + + /* + * This is a quirk for old Simplo battery to clamp + * charging current to 3A. + */ + if ((board_get_version() <= 4) && !quirk_batt_update) { + temp_zones[BATTERY_SIMPLO][TEMP_ZONE_1].desired_current = 3000; + temp_zones[BATTERY_SIMPLO][TEMP_ZONE_2].desired_current = 3000; + quirk_batt_update = 1; + } if (batt_id >= BATTERY_COUNT) batt_id = gpio_get_level(GPIO_BATT_ID); -- cgit v1.2.1