summaryrefslogtreecommitdiff
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
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>
-rw-r--r--board/dratini/board.c2
-rw-r--r--board/dratini/board.h2
-rw-r--r--board/dratini/led.c23
3 files changed, 26 insertions, 1 deletions
diff --git a/board/dratini/board.c b/board/dratini/board.c
index 8da4e637cc..994dac933d 100644
--- a/board/dratini/board.c
+++ b/board/dratini/board.c
@@ -369,7 +369,7 @@ static void setup_fans(void)
* Returns true for boards that are convertible into tablet mode, and
* false for clamshells.
*/
-static bool board_is_convertible(void)
+bool board_is_convertible(void)
{
uint8_t sku_id = get_board_sku();
diff --git a/board/dratini/board.h b/board/dratini/board.h
index 89db610c63..8d245b2abd 100644
--- a/board/dratini/board.h
+++ b/board/dratini/board.h
@@ -172,6 +172,8 @@ extern const int keyboard_factory_scan_pins[][2];
extern const int keyboard_factory_scan_pins_used;
#endif
+bool board_is_convertible(void);
+
#endif /* !__ASSEMBLER__ */
#endif /* __CROS_EC_BOARD_H */
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. */