summaryrefslogtreecommitdiff
path: root/board/dratini/led.c
diff options
context:
space:
mode:
authorDevin Lu <devin.lu@quantatw.com>2019-12-20 15:39:48 +0800
committerCommit Bot <commit-bot@chromium.org>2019-12-22 05:41:51 +0000
commit0fd5e4bdb160c30692e6e547767cb356a8dce282 (patch)
tree1d90e3dcfd95d316451c76bbb879ec9813b42dc8 /board/dratini/led.c
parent5164686d5c08ae52abe55687bf3650edecdb27e0 (diff)
downloadchrome-ec-0fd5e4bdb160c30692e6e547767cb356a8dce282.tar.gz
dratini: override battery LEDs to indicate system suspend
Dratini is non-power LED design, to indicate system suspend, blinking both two side battery white LEDs (1 sec on/1 sec off) to indicate system suspend with non-charging state. BUG=none BRANCH=hatch TEST=make sure both two side LEDs are blinking white after system suspend. Change-Id: Ia8173bd78b6678633de50c747100c6c3f11fb29e Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1977989 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
Diffstat (limited to 'board/dratini/led.c')
-rw-r--r--board/dratini/led.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/board/dratini/led.c b/board/dratini/led.c
index 60e54a505e..5cc256b2c5 100644
--- a/board/dratini/led.c
+++ b/board/dratini/led.c
@@ -146,10 +146,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 Dratini, Dratini 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. */