From 2c49a96a9215d29d14e41dcc0554c6aa33e46d3a Mon Sep 17 00:00:00 2001 From: Devin Lu Date: Mon, 26 Aug 2019 11:13:17 +0800 Subject: blooglet: override battery LEDs to indicate system suspend As meep, careena and snappy we have some SKUs are non-power LED design, blinking both two side battery white LEDs (1 sec on/1 sec off) to indicate system suspend with non-charging state. BUG=none BRANCH=octopus TEST=make sure both two side LEDs are blinking white after system suspend. Change-Id: I2839309acb91e365b98b5aac024bb7d7ebf287eb Signed-off-by: Devin Lu Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1771099 Reviewed-by: Marco Chen --- board/bloog/led.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/board/bloog/led.c b/board/bloog/led.c index 77e5212b91..ba1a865890 100644 --- a/board/bloog/led.c +++ b/board/bloog/led.c @@ -129,10 +129,33 @@ static void set_active_port_color(enum led_color color) static void led_set_battery(void) { static int battery_ticks; + static int power_ticks; uint32_t chflags = charge_get_flags(); battery_ticks++; + /* + * Override battery LEDs for Blooglet, Blooglet is non-power LED + * design, blinking both two side battery white LEDs to indicate + * system suspend with non-charging state. + */ + if (!board_is_convertible()) { + if (chipset_in_state(CHIPSET_STATE_SUSPEND | + CHIPSET_STATE_STANDBY) && + charge_get_state() != PWR_STATE_CHARGE) { + + power_ticks++; + + led_set_color_battery(0, power_ticks & 0x4 ? + LED_WHITE : LED_OFF); + led_set_color_battery(1, power_ticks & 0x4 ? + LED_WHITE : LED_OFF); + return; + } + } + + power_ticks = 0; + switch (charge_get_state()) { case PWR_STATE_CHARGE: /* Always indicate when charging, even in suspend. */ -- cgit v1.2.1