From 3b7c9893afc5291d36d778921dcb7c8f5154c583 Mon Sep 17 00:00:00 2001 From: "YongBeum.Ha" Date: Thu, 28 Jan 2021 11:00:34 +0900 Subject: sasuke : set charging current/voltage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Charging Voltage (Battery → Charger IC) Need 100mV margin between battery allowable voltage and Charger IC set voltage. 8860mV → 8760mV 8400mV → 8300mV Charger Current Need 10% marging between battery allowable current and Charging current. - Normal temperature (Battery → Charger IC) ~8.24V : 6916mA → 6224mA ~8.44V : 5320mA → 4788mA ~8.86V : 4256mA → 3830mA BUG=b:178565802 BRANCH=None TEST=make -j BOARD=sasuke Signed-off-by: YongBeum.Ha Change-Id: I41dca90d7ff830a392093163d7d2141cbbd17f09 Signed-off-by: YongBeum.Ha Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2654666 Reviewed-by: Aseda Aboagye Commit-Queue: Aseda Aboagye --- board/sasuke/battery.c | 37 ++++++++++++++++++++++++++++++++++++- board/sasuke/board.h | 1 + 2 files changed, 37 insertions(+), 1 deletion(-) (limited to 'board/sasuke') diff --git a/board/sasuke/battery.c b/board/sasuke/battery.c index 255381d6c9..f6862ca555 100644 --- a/board/sasuke/battery.c +++ b/board/sasuke/battery.c @@ -8,7 +8,9 @@ #include "battery_fuel_gauge.h" #include "charge_state.h" #include "common.h" +#include "util.h" +#define CHARGING_CURRENT_REDUCE 4000 /* * Battery info for all sasuke battery types. Note that the fields * start_charging_min/max and charging_min/max are not used for the charger. @@ -58,7 +60,7 @@ const struct board_batt_params board_battery_info[] = { } }, .batt_info = { - .voltage_max = 8860, + .voltage_max = 8760, .voltage_normal = 7720, /* mV */ .voltage_min = 6000, /* mV */ .precharge_current = 200, /* mA */ @@ -74,3 +76,36 @@ const struct board_batt_params board_battery_info[] = { BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT); const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_SDI; + +int charger_profile_override(struct charge_state_data *curr) +{ + int current; + int voltage; + + current = curr->requested_current; + voltage = curr->requested_voltage; + + voltage -= 100; + if (current > CHARGING_CURRENT_REDUCE) + current -= (current / 10); + + curr->requested_voltage = MIN(curr->requested_voltage, voltage); + curr->requested_current = MIN(curr->requested_current, current); + + return 0; +} + +/* Customs options controllable by host command. */ +#define PARAM_FASTCHARGE (CS_PARAM_CUSTOM_PROFILE_MIN + 0) + +enum ec_status charger_profile_override_get_param(uint32_t param, + uint32_t *value) +{ + return EC_RES_INVALID_PARAM; +} + +enum ec_status charger_profile_override_set_param(uint32_t param, + uint32_t value) +{ + return EC_RES_INVALID_PARAM; +} diff --git a/board/sasuke/board.h b/board/sasuke/board.h index 54fc3292b0..5a77857c0e 100644 --- a/board/sasuke/board.h +++ b/board/sasuke/board.h @@ -33,6 +33,7 @@ #define CONFIG_CHARGER_SENSE_RESISTOR 10 #define CONFIG_OCPC_DEF_RBATT_MOHMS 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr */ #define CONFIG_OCPC +#define CONFIG_CHARGER_PROFILE_OVERRIDE #undef CONFIG_CHARGER_SINGLE_CHIP /* -- cgit v1.2.1