From 2cf498c23ca0bc788518635d8ea565f94ce2979b Mon Sep 17 00:00:00 2001 From: Caveh Jalali Date: Tue, 16 Apr 2019 20:05:31 -0700 Subject: led_pwm: use NEAR_FULL_COLOR when discharging-on-ac when CONFIG_PWR_STATE_DISCHARGE_FULL is enabled for a board, the charge state machine can enter a special PWR_STATE_DISCHARGE_FULL state used to indicate that we're on AC but powering the system from the battery. the system will hover in-and-out of this state over time while on AC. this should generally be transparent to the user, so we should indicate it using the LEDs the same way we indicate PWR_STATE_CHARGE_NEAR_FULL. BUG=b:128709632 BRANCH=none TEST=verified LED stays white on atlas while battery is draining on AC. LED goes out when charger is removed Change-Id: I3af6783bcdbe399a444099fcee8ebab07451ff2c Signed-off-by: Caveh Jalali Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1570612 Tested-by: Caveh Jalali Reviewed-by: Caveh Jalali Commit-Queue: Caveh Jalali --- common/led_pwm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/led_pwm.c b/common/led_pwm.c index 87ec59a127..d167a5bd6f 100644 --- a/common/led_pwm.c +++ b/common/led_pwm.c @@ -151,7 +151,8 @@ static int show_charge_state(void) if (chg_st == PWR_STATE_CHARGE) { led_is_pulsing = 0; set_led_color(CONFIG_LED_PWM_CHARGE_COLOR); - } else if (chg_st == PWR_STATE_CHARGE_NEAR_FULL) { + } else if (chg_st == PWR_STATE_CHARGE_NEAR_FULL || + chg_st == PWR_STATE_DISCHARGE_FULL) { led_is_pulsing = 0; set_led_color(CONFIG_LED_PWM_NEAR_FULL_COLOR); } else if ((battery_is_present() != BP_YES) || -- cgit v1.2.1