summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Yung-Chieh Lo <yjlou@chromium.org>2014-03-12 18:21:39 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-04-01 02:46:34 +0000
commitbe17ca9d91d097f2ec742393e7c69928f46f1e17 (patch)
treea4799077e9c8a642efd6fff8617cab64b6891386
parentdaeddb75e9e203d90e0e8dd576aa39be8dc84ea1 (diff)
downloadchrome-ec-be17ca9d91d097f2ec742393e7c69928f46f1e17.tar.gz
big: fixed a LED corner case while almost full
Vic points out a corner case that the battery LED could be off by the followng steps: 1. charge the battery to very full 2. disconnact the AC so that the LED is off for discharge. 3. plug AC again, then charger enters INIT state --> IDLE0 --> IDLE where those states don't toggle LED. BUG=none BRANCH=big TEST=Reproduced this bug on big. Verified this has been fixed by this CL. Change-Id: I7125acd6b11953675ac6d4085e31e0560b384015 Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/189757
-rw-r--r--board/big/led.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/board/big/led.c b/board/big/led.c
index 0d3b33567d..82c9de6b55 100644
--- a/board/big/led.c
+++ b/board/big/led.c
@@ -121,11 +121,13 @@ static void big_led_set_power(void)
static void big_led_set_battery(void)
{
static int battery_second;
+ uint32_t chflags = charge_get_flags();
battery_second++;
/* BAT LED behavior:
- * Fully charged: Blue
+ * Fully charged / idle: Blue
+ * Force idle (for factory): 2 secs of blue, 2 secs of yellow
* Under charging: Orange
* Battery low (10%): Orange in breeze mode (1 sec on, 3 sec off)
* Battery critical low (less than 3%) or abnormal battery
@@ -152,6 +154,13 @@ static void big_led_set_battery(void)
case PWR_STATE_CHARGE_NEAR_FULL:
bat_led_set_color(LED_BLUE);
break;
+ case PWR_STATE_IDLE: /* External power connected in IDLE. */
+ if (chflags & CHARGE_FLAG_FORCE_IDLE)
+ bat_led_set_color(
+ (battery_second & 0x2) ? LED_BLUE : LED_ORANGE);
+ else
+ bat_led_set_color(LED_BLUE);
+ break;
default:
/* Other states don't alter LED behavior */
break;