summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin Lu <Devin.Lu@quantatw.com>2014-06-16 11:04:35 +0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-06-17 00:55:24 +0000
commiteeccf31e138959df9f1513449a06ce40b541cdba (patch)
treeddac55e079cae9f4de3b397040dd6f0db4c2cb2d
parent2c58aaf4971d48bfccf2ac6c7b1743089c070b80 (diff)
downloadchrome-ec-eeccf31e138959df9f1513449a06ce40b541cdba.tar.gz
Kip: Modify battery LED behavior.
We won't to see the corner case when plugging in adpater. if battery want to charge, we want to see the amber led directly when plugging in adapter, not white to amber. if battery into fully charged, we want to see the white led directly when plugging in adapter, not amber to white. BUG=None BRANCH=rambi TEST=manual Check battery LED show amber directly when plugging in adpater, if battery needs to charge. Check battery LED show white directly when plugging in adpater, if battery into fully charged. Check battery LED show white directly when plugging in adpater, if battery near full. Change-Id: I08e6c9ea32dc90599a974d7b5fadaf59f549cc77 Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/203932
-rw-r--r--board/kip/led.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/board/kip/led.c b/board/kip/led.c
index 4de1735e51..79421aa59f 100644
--- a/board/kip/led.c
+++ b/board/kip/led.c
@@ -28,8 +28,8 @@ static int bat_led_set_color(enum led_color color)
{
switch (color) {
case LED_OFF:
- gpio_set_level(GPIO_BAT_LED0, 1);
- gpio_set_level(GPIO_BAT_LED1, 1);
+ gpio_set_level(GPIO_BAT_LED0, 0);
+ gpio_set_level(GPIO_BAT_LED1, 0);
break;
case LED_WHITE:
gpio_set_level(GPIO_BAT_LED0, 1);
@@ -134,14 +134,13 @@ static void kip_led_set_battery(void)
battery_ticks++;
- /* Battery LED is solid white if AC connected, unless the battery is
- * is charging or there is an error. */
- bat_led_set_color(extpower_is_present() ? LED_WHITE : LED_OFF);
-
switch (charge_get_state()) {
case PWR_STATE_CHARGE:
bat_led_set_color(LED_AMBER);
break;
+ case PWR_STATE_CHARGE_NEAR_FULL:
+ bat_led_set_color(LED_WHITE);
+ break;
case PWR_STATE_DISCHARGE:
/* See crosbug.com/p/22159. There's a 3% difference
* between the battery level seen by the kernel and what's
@@ -151,6 +150,8 @@ static void kip_led_set_battery(void)
if (charge_get_percent() < 15)
bat_led_set_color(
(battery_ticks & 0x4) ? LED_WHITE : LED_OFF);
+ else
+ bat_led_set_color(LED_OFF);
break;
case PWR_STATE_ERROR:
bat_led_set_color((battery_ticks & 0x2) ? LED_WHITE : LED_OFF);
@@ -159,6 +160,8 @@ static void kip_led_set_battery(void)
if (chflags & CHARGE_FLAG_FORCE_IDLE)
bat_led_set_color(
(battery_ticks & 0x4) ? LED_AMBER : LED_OFF);
+ else
+ bat_led_set_color(LED_WHITE);
break;
default:
/* Other states don't alter LED behavior */