diff options
author | YB.Ha <ybha@samsung.com> | 2014-08-08 09:22:32 +0900 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-08-08 06:38:34 +0000 |
commit | 0adfd9d2bfdac3886432f085b583d8e23b9443b8 (patch) | |
tree | 8ab79ed54c4ed96a572f7cbd8f192d90e5cac3c8 | |
parent | 09a9aeca19fbfc550a84e87ec95a7c8904cbacfa (diff) | |
download | chrome-ec-0adfd9d2bfdac3886432f085b583d8e23b9443b8.tar.gz |
Winky : Charging start and stop by battery overtemperature
Charging start temperature : T<0 or T≥45
Charging stop temperature : T<0 or T≥60
Start condition of charge : 0≤T<45
BUG=chrome-os-partner:30951
TEST=emerge-winky chromeos-ec
Check to stop and start charging by overtemperature.
Change-Id: If73df8423c3d997598a49fcbc2926b290958c829
Reviewed-on: https://chromium-review.googlesource.com/211081
Reviewed-by: yoojin lee <yoojin7.lee@samsung.com>
Reviewed-by: Mohammed Habibulla <moch@chromium.org>
Commit-Queue: yoojin lee <yoojin7.lee@samsung.com>
Tested-by: yoojin lee <yoojin7.lee@samsung.com>
-rwxr-xr-x | board/winky/battery.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/board/winky/battery.c b/board/winky/battery.c index 1c21042f93..a8a2b30ff7 100755 --- a/board/winky/battery.c +++ b/board/winky/battery.c @@ -70,6 +70,7 @@ DECLARE_CONSOLE_COMMAND(battcutoff, command_battcutoff, static int oem_battery_state; #define OEM_BATTERY_STATE_DEFAULT 0x00 #define OEM_BATTERY_STATE_ERROR 0x01 +#define OEM_BATTERY_STATE_STOP_CHARGE 0x02 inline void board_battery_not_connected(void) { @@ -78,9 +79,26 @@ inline void board_battery_not_connected(void) void battery_override_params(struct batt_params *batt) { + int bat_temp_c = DECI_KELVIN_TO_CELSIUS(batt->temperature); int chstate = charge_get_state(); - if(oem_battery_state == OEM_BATTERY_STATE_DEFAULT) { + /* Check battery temperature */ + if((chstate == PWR_STATE_CHARGE) || + (chstate == PWR_STATE_CHARGE_NEAR_FULL)) { + if((bat_temp_c < info.charging_min_c) || + (bat_temp_c >= info.charging_max_c)) { + oem_battery_state |= OEM_BATTERY_STATE_STOP_CHARGE; + } + } else { + if((bat_temp_c < info.start_charging_min_c) || + (bat_temp_c >= info.start_charging_max_c)) { + oem_battery_state |= OEM_BATTERY_STATE_STOP_CHARGE; + } else { + oem_battery_state &= ~OEM_BATTERY_STATE_STOP_CHARGE; + } + } + + if(!(oem_battery_state & OEM_BATTERY_STATE_ERROR)) { if((chstate == PWR_STATE_CHARGE) || (chstate == PWR_STATE_CHARGE_NEAR_FULL)) { /* Check battery overvoltage */ @@ -95,5 +113,11 @@ void battery_override_params(struct batt_params *batt) batt->desired_voltage = 0; batt->desired_current = 0; } + + if(oem_battery_state & OEM_BATTERY_STATE_STOP_CHARGE) { + batt->flags &= ~BATT_FLAG_WANT_CHARGE; + batt->desired_voltage = 0; + batt->desired_current = 0; + } } #endif /* CONFIG_BATTERY_OVERRIDE_PARAMS */ |