diff options
author | Vic Yang <victoryang@chromium.org> | 2012-07-12 16:33:10 +0800 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-07-18 09:31:27 -0700 |
commit | f322e1b96a5a7400d283b2a6397e020e6200522c (patch) | |
tree | 82c4f47bf2af9fb654a502c037b051e9007dfdbf /common/battery_precharge.c | |
parent | 9c289eda9f4fc9d14ea334cf57bc94f789c890e9 (diff) | |
download | chrome-ec-f322e1b96a5a7400d283b2a6397e020e6200522c.tar.gz |
Set power LED to green when we are trickle charging nearly full
When battery is nearly full, battery sometimes demands for very low
current and we are actually trickle charging. This causes the last part
of charging process very long, but the actual charged amount is only few
mAh. Let's set power LED to green in this case so that user doesn't feel
the device is charging forever.
BUG=chrome-os-partner:11248
TEST=Charge the battery to nearly full. Disconnect and connect AC power.
Check the power LED is green when we are trickle charging.
Change-Id: Ide108778232e9f1d3abe6b61af7518af25040d10
Reviewed-on: https://gerrit.chromium.org/gerrit/27264
Commit-Ready: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common/battery_precharge.c')
-rw-r--r-- | common/battery_precharge.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/common/battery_precharge.c b/common/battery_precharge.c index 22c60d878f..9f9f46de95 100644 --- a/common/battery_precharge.c +++ b/common/battery_precharge.c @@ -9,6 +9,7 @@ #include "battery_pack.h" #include "charge_state.h" #include "charger.h" +#include "power_led.h" #include "smart_battery.h" #include "timer.h" #include "uart.h" @@ -17,6 +18,9 @@ /* Buffer size for charging resistance calculation */ #define LOG_BUFFER_SIZE 16 +/* Threshold for power led to turn green */ +#define POWERLED_GREEN_THRESHOLD 90 + static int log_index; static short log_volt[LOG_BUFFER_SIZE]; static short log_curr[LOG_BUFFER_SIZE]; @@ -100,6 +104,11 @@ enum power_state trickle_charge(struct power_state_context *ctx) const struct charger_info *cinfo = ctx->charger; const struct battery_info *binfo = ctx->battery; + /* If battery is nearly full and we are trickle charging, we should + * change the power led to green. */ + if (batt->state_of_charge >= POWERLED_GREEN_THRESHOLD) + curr->led_color = POWERLED_GREEN; + /* Clear trickle charging duration on AC change */ if (curr->ac != ctx->prev.ac) { ctx->trickle_charging_time.val = 0; |