summaryrefslogtreecommitdiff
path: root/board/bugzzy
diff options
context:
space:
mode:
authorYongBeum.Ha <ybha@samsung.corp-partner.google.com>2021-12-21 08:26:31 +0900
committerCommit Bot <commit-bot@chromium.org>2021-12-22 00:47:28 +0000
commitd94b3ada6e50d0b7d36d21c56d7007c19c1a1aaa (patch)
tree9e3a521c4f9e3cc5a8fa49a1d8f24dd679ee4f9e /board/bugzzy
parent31f050c15de41c2aebf3b0e40032f60bedec855d (diff)
downloadchrome-ec-d94b3ada6e50d0b7d36d21c56d7007c19c1a1aaa.tar.gz
bugzzy : retain LED on sleep mode
Sometimes LED is blinked on sleep because system automatically wakes from sleep. BUG=b:210012410 BRANCH=None TEST=make -j BOARD=bugzzy then check if LED is blinking on sleep state Signed-off-by: YongBeum.Ha <ybha@samsung.corp-partner.google.com> Change-Id: I31b40d6bf71c5e43f7db4e5b1ef47202c33bad94 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3350366 Reviewed-by: Henry Sun <henrysun@google.com> Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'board/bugzzy')
-rw-r--r--board/bugzzy/led.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/board/bugzzy/led.c b/board/bugzzy/led.c
index d04026e0f0..17da244534 100644
--- a/board/bugzzy/led.c
+++ b/board/bugzzy/led.c
@@ -53,12 +53,23 @@ const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
__override void led_set_color_power(enum ec_led_colors color)
{
+ static enum ec_led_colors prev_color = EC_LED_COLOR_COUNT;
+
/* Don't set led if led_auto_control is disabled. */
if (!led_auto_control_is_enabled(EC_LED_ID_POWER_LED) ||
!led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
return;
}
+ /*
+ * Sometimes system wakes and sleeps automatically.
+ * Add LED debounce time to prevent blinking led by this.
+ */
+ if (prev_color != color) {
+ prev_color = color;
+ return;
+ }
+
if (color == EC_LED_COLOR_BLUE)
{
gpio_set_level(GPIO_BAT_LED_RED_L, LED_OFF_LVL);
@@ -72,6 +83,8 @@ __override void led_set_color_power(enum ec_led_colors color)
__override void led_set_color_battery(enum ec_led_colors color)
{
+ static enum ec_led_colors prev_color = EC_LED_COLOR_COUNT;
+
/* Don't set led if led_auto_control is disabled. */
if (!led_auto_control_is_enabled(EC_LED_ID_POWER_LED) ||
!led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
@@ -79,6 +92,14 @@ __override void led_set_color_battery(enum ec_led_colors color)
}
/*
+ * Sometimes system wakes and sleeps automatically.
+ * Add LED debounce time to prevent blinking led by this.
+ */
+ if (prev_color != color) {
+ prev_color = color;
+ return;
+ }
+ /*
* Battery leds must be turn off when blue led is on
* because bugzzy has 3-in-1 led.
*/