diff options
author | YongBeum Ha <ybha@samsung.com> | 2020-08-12 18:12:40 +0900 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-08-13 14:04:38 +0000 |
commit | 53c77e42bc99f8902ebdc9ff71cc94d2ae152fee (patch) | |
tree | e86086eb2ce8d4cb0e529b9d7903b94b9b1e736a | |
parent | f9797e831dd3b96b0f13992a460c90b394e50dd6 (diff) | |
download | chrome-ec-53c77e42bc99f8902ebdc9ff71cc94d2ae152fee.tar.gz |
casta : set a charging voltage limit
limit charging voltage to battery voltage max
BUG=b:163453304
BRANCH=master
TEST=flash EC and check battery charging.
Signed-off-by: YongBeum Ha <ybha@samsung.com>
Change-Id: I5f82f71392bfade3a4b5aa288cf5ba19687556f3
Signed-off-by: YongBeum Ha <ybha@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2351645
Reviewed-by: Henry Sun <henrysun@google.com>
Commit-Queue: Henry Sun <henrysun@google.com>
-rw-r--r-- | board/casta/battery.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/board/casta/battery.c b/board/casta/battery.c index 965db28395..264f554cb7 100644 --- a/board/casta/battery.c +++ b/board/casta/battery.c @@ -5,6 +5,7 @@ * Battery pack vendor provided charging profile */ +#include "battery.h" #include "battery_fuel_gauge.h" #include "battery_smart.h" #include "charge_state.h" @@ -76,6 +77,7 @@ int charger_profile_override(struct charge_state_data *curr) int voltage; /* battery temp in 0.1 deg C */ int bat_temp_c; + const struct battery_info *batt_info; /* * Keep track of battery temperature range: @@ -103,6 +105,7 @@ int charger_profile_override(struct charge_state_data *curr) current = curr->requested_current; voltage = curr->requested_voltage; bat_temp_c = curr->batt.temperature - 2731; + batt_info = battery_get_info(); /* * If the temperature reading is bad, assume the temperature @@ -143,6 +146,9 @@ int charger_profile_override(struct charge_state_data *curr) break; } + if(voltage > batt_info->voltage_max) + voltage = batt_info->voltage_max; + curr->requested_voltage = MIN(curr->requested_voltage, voltage); curr->requested_current = MIN(curr->requested_current, current); |