summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/charge_state.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/common/charge_state.c b/common/charge_state.c
index a47bb2f23d..f8eb9919b3 100644
--- a/common/charge_state.c
+++ b/common/charge_state.c
@@ -388,15 +388,19 @@ static enum power_state state_charge(struct power_state_context *ctx)
*/
static enum power_state state_discharge(struct power_state_context *ctx)
{
+ struct batt_params *batt = &ctx->curr.batt;
if (ctx->curr.ac)
return PWR_STATE_INIT;
if (ctx->curr.error)
return PWR_STATE_ERROR;
- /* TODO(rong): crosbug.com/p/8451
- * handle overtemp in discharge mode
+ /* Overtemp in discharging state
+ * - poweroff host and ec
*/
+ if (batt->temperature > ctx->battery->temp_discharge_max ||
+ batt->temperature < ctx->battery->temp_discharge_min)
+ poweroff_wait_ac();
return PWR_STATE_UNCHANGE;
}