summaryrefslogtreecommitdiff
path: root/driver/battery
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-12-02 13:12:31 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-12-03 07:28:50 +0000
commit3b0a4055d17c17e4ee8df474858b40ffda518c31 (patch)
tree11f34c41666d8532ad012affea817402d6a75696 /driver/battery
parenta35f1b78417edab1150f1eb68b5d4dee7708dfc8 (diff)
downloadchrome-ec-3b0a4055d17c17e4ee8df474858b40ffda518c31.tar.gz
Move battery temp ranges to battery_info struct
This allows boards to detect the battery and return the correct temp ranges, which will be needed for upcoming boards. In the board-specific implementations, it's pretty much just moving the fields from one const struct to another, so the impact is minor. BUG=chrome-os-partner:24310 BRANCH=none TEST=build all platforms; verify pit and rambi still charge Change-Id: I7be075b3abb4039577f6362316adc1860c121d5c Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/178424 Reviewed-by: Yung-chieh Lo <yjlou@chromium.org> Reviewed-by: Rong Chang <rongchang@chromium.org>
Diffstat (limited to 'driver/battery')
-rw-r--r--driver/battery/link.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/driver/battery/link.c b/driver/battery/link.c
index 891e555922..f870342f9a 100644
--- a/driver/battery/link.c
+++ b/driver/battery/link.c
@@ -20,14 +20,7 @@ static const struct battery_info info = {
/* Pre-charge current: I <= 0.01C */
.precharge_current = 64, /* mA */
-};
-
-const struct battery_info *battery_get_info(void)
-{
- return &info;
-}
-const struct battery_temperature_ranges bat_temp_ranges = {
/*
* Operational temperature range
* 0 <= T_charge <= 50 deg C
@@ -41,6 +34,10 @@ const struct battery_temperature_ranges bat_temp_ranges = {
.discharging_max_c = 60,
};
+const struct battery_info *battery_get_info(void)
+{
+ return &info;
+}
#ifdef CONFIG_BATTERY_VENDOR_PARAMS
@@ -107,8 +104,8 @@ void battery_vendor_params(struct batt_params *batt)
batt->desired_voltage = info.voltage_max;
/* Don't charge if outside of allowable temperature range */
- if (bat_temp_c >= bat_temp_ranges.charging_max_c ||
- bat_temp_c < bat_temp_ranges.charging_min_c) {
+ if (bat_temp_c >= info.charging_max_c ||
+ bat_temp_c < info.charging_min_c) {
batt->flags &= ~BATT_FLAG_WANT_CHARGE;
batt->desired_voltage = 0;
batt->desired_current = 0;