eve: Fix LED behavior when discharging with full battery

In order to prevent noise when using the system with a full
battery the EC can disable charging at full until it reaches
97% and then turn on charging again.

However this needs additional LED handling to ensure that the
charging LED is shown green in this state.

BUG=b:36024657
BRANCH=none
TEST=manual test with full battery on Eve P1b, ensure that the
LED is still green when battery is full and discharging.

Change-Id: Iad2b1462ad85163dc9702ff1154f3ff10eb0f7ca
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://chromium-review.googlesource.com/450953
Reviewed-by: Scott Collyer <scollyer@chromium.org>
This commit is contained in:
Duncan Laurie
2017-03-07 09:47:29 -08:00
committed by chrome-bot
parent cf015d1e31
commit b1e212dabe
2 changed files with 16 additions and 0 deletions

View File

@@ -77,6 +77,7 @@
/* Battery */
#define CONFIG_BATTERY_CUT_OFF
#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
#define CONFIG_BATTERY_LEVEL_NEAR_FULL 94
#define CONFIG_BATTERY_PRESENT_CUSTOM
#define CONFIG_BATTERY_REVIVE_DISCONNECT
#define CONFIG_BATTERY_SMART
@@ -109,6 +110,7 @@
#define CONFIG_POWER_BUTTON_X86
#define CONFIG_POWER_COMMON
#define CONFIG_POWER_SIGNAL_INTERRUPT_STORM_DETECT_THRESHOLD 30
#define CONFIG_PWR_STATE_DISCHARGE_FULL
/* Sensor */
#define CONFIG_MKBP_EVENT

View File

@@ -140,6 +140,10 @@ static void eve_led_set_power_battery(void)
PWR_STATE_CHARGE_NEAR_FULL) {
set_color(LED_GREEN, side);
blueside = !side;
} else if (chg_state == PWR_STATE_DISCHARGE_FULL &&
extpower_is_present()) {
set_color(LED_GREEN, side);
blueside = !side;
}
set_color(LED_BLUE, blueside);
return;
@@ -165,8 +169,13 @@ static void eve_led_set_power_battery(void)
} else if (chg_state == PWR_STATE_CHARGE) {
set_color(LED_AMBER, side);
blinkside = !side;
} else if (chg_state == PWR_STATE_DISCHARGE_FULL &&
extpower_is_present()) {
set_color(LED_GREEN, side);
blinkside = !side;
}
if (chg_state == PWR_STATE_DISCHARGE ||
chg_state == PWR_STATE_DISCHARGE_FULL ||
chg_state == PWR_STATE_CHARGE ||
chg_state == PWR_STATE_CHARGE_NEAR_FULL ||
chg_state == PWR_STATE_IDLE) {
@@ -183,6 +192,11 @@ static void eve_led_set_power_battery(void)
/* CHIPSET_STATE_OFF */
switch (chg_state) {
case PWR_STATE_DISCHARGE_FULL:
set_color(LED_OFF, LED_BOTH);
if (extpower_is_present())
set_color(LED_GREEN, side);
break;
case PWR_STATE_DISCHARGE:
set_color(LED_OFF, LED_BOTH);
break;