diff options
author | Randall Spangler <rspangler@chromium.org> | 2013-02-12 10:54:26 -0800 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-02-12 13:46:44 -0800 |
commit | 9fde14da9b2e8d8944e66c5b8f4798e0c40be72e (patch) | |
tree | 24ebaa6fb2b1ef3e16f5f73bc987b7736a681151 /common/charge_state.c | |
parent | c19a4db9e4935400b24bd5bb43452019ff1843b8 (diff) | |
download | chrome-ec-9fde14da9b2e8d8944e66c5b8f4798e0c40be72e.tar.gz |
Rename and document battery constants
In preparation for cleaning up low-battery logic. Make clear what
comparison operator is used for each constant (<=, <, >=, >).
Also remove hard-coded and unused display of design warning/low
battery levels from ectool. Verified via code search that these are
not used anywhere. Even if we later care about these levels, they
should be battery-specific and not hard-coded as a
platform-independent percentage of full capacity when ectool is
compiled.
BUG=chrome-os-partner:17124
BRANCH=link
TEST=compile link; 'ectool battery' from root shell prints valid info
Change-Id: I3650e27a08f4cc77067beb0685ee1488cc56d02f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43119
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'common/charge_state.c')
-rw-r--r-- | common/charge_state.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/common/charge_state.c b/common/charge_state.c index ef7df7d115..f413d58c3a 100644 --- a/common/charge_state.c +++ b/common/charge_state.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved. +/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. * @@ -350,14 +350,14 @@ static enum power_state state_idle(struct power_state_context *ctx) ctx->curr.charging_current) return PWR_STATE_INIT; - if (batt->state_of_charge >= STOP_CHARGE_THRESHOLD) + if (batt->state_of_charge >= BATTERY_LEVEL_FULL) return PWR_STATE_UNCHANGE; /* Configure init charger state and switch to charge state */ if (batt->desired_voltage && batt->desired_current) { /* Set charger output constraints */ if (batt->desired_current < ctx->charger->current_min && - batt->state_of_charge < PRE_CHARGE_THRESHOLD) { + batt->state_of_charge < BATTERY_LEVEL_PRE_CHARGE) { /* Trickle charging */ if (charger_set_current(c_info->current_min) || charger_set_voltage(batt->voltage)) @@ -377,7 +377,7 @@ static enum power_state state_idle(struct power_state_context *ctx) } update_charger_time(ctx, get_time()); - if (ctx->curr.batt.state_of_charge < NEAR_FULL_THRESHOLD) + if (ctx->curr.batt.state_of_charge < BATTERY_LEVEL_NEAR_FULL) return PWR_STATE_CHARGE; else return PWR_STATE_CHARGE_NEAR_FULL; @@ -406,7 +406,7 @@ static enum power_state state_charge(struct power_state_context *ctx) if (batt->desired_current < c_info->current_min && batt->desired_current > 0 && - batt->state_of_charge < PRE_CHARGE_THRESHOLD) + batt->state_of_charge < BATTERY_LEVEL_PRE_CHARGE) return trickle_charge(ctx); /* Check charger reset */ @@ -417,7 +417,7 @@ static enum power_state state_charge(struct power_state_context *ctx) if (!curr->ac) return PWR_STATE_INIT; - if (batt->state_of_charge >= STOP_CHARGE_THRESHOLD) { + if (batt->state_of_charge >= BATTERY_LEVEL_FULL) { if (charger_set_voltage(0) || charger_set_current(0)) return PWR_STATE_ERROR; return PWR_STATE_IDLE; @@ -645,7 +645,7 @@ void charge_state_machine_task(void) new_state = state_charge(ctx); if (new_state == PWR_STATE_UNCHANGE && (ctx->curr.batt.state_of_charge >= - NEAR_FULL_THRESHOLD)) { + BATTERY_LEVEL_NEAR_FULL)) { /* Almost done charging */ new_state = PWR_STATE_CHARGE_NEAR_FULL; } @@ -655,7 +655,7 @@ void charge_state_machine_task(void) new_state = state_charge(ctx); if (new_state == PWR_STATE_UNCHANGE && (ctx->curr.batt.state_of_charge < - NEAR_FULL_THRESHOLD)) { + BATTERY_LEVEL_NEAR_FULL)) { /* Battery below almost-full threshold. */ new_state = PWR_STATE_CHARGE; } |