summaryrefslogtreecommitdiff
path: root/board/jinlon/led.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/jinlon/led.c')
-rw-r--r--board/jinlon/led.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/board/jinlon/led.c b/board/jinlon/led.c
index 4cef6dc3ae..8ab3d7631f 100644
--- a/board/jinlon/led.c
+++ b/board/jinlon/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -25,11 +25,9 @@
#define LED_ON_TICKS 5
#define POWER_LED_ON_TICKS 2
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_LEFT_LED,
- EC_LED_ID_RIGHT_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_LEFT_LED,
+ EC_LED_ID_RIGHT_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -37,7 +35,7 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static void led_set_color_battery(int port, enum led_color color)
@@ -147,7 +145,6 @@ static void set_active_port_color(enum led_color color)
static void led_set_battery(void)
{
static int battery_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -159,9 +156,12 @@ static void led_set_battery(void)
case PWR_STATE_DISCHARGE:
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) {
if (charge_get_percent() < 10)
- led_set_color_battery(0, (battery_ticks %
- LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
- LED_WHITE : LED_OFF);
+ led_set_color_battery(
+ 0,
+ (battery_ticks % LED_TICKS_PER_CYCLE <
+ LED_ON_TICKS) ?
+ LED_WHITE :
+ LED_OFF);
else
led_set_color_battery(0, LED_OFF);
}
@@ -170,19 +170,20 @@ static void led_set_battery(void)
led_set_color_battery(1, LED_OFF);
break;
case PWR_STATE_ERROR:
- set_active_port_color((battery_ticks & 0x2) ?
- LED_WHITE : LED_OFF);
+ set_active_port_color((battery_ticks & 0x2) ? LED_WHITE :
+ LED_OFF);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
set_active_port_color(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- set_active_port_color((battery_ticks %
- LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
- LED_AMBER : LED_OFF);
- else
- set_active_port_color(LED_WHITE);
+ set_active_port_color(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ set_active_port_color(
+ (battery_ticks % LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
@@ -200,9 +201,10 @@ static void led_set_power(void)
led_set_color_power(LED_WHITE);
else if (chipset_in_state(CHIPSET_STATE_SUSPEND |
CHIPSET_STATE_STANDBY))
- led_set_color_power((power_tick %
- LED_TICKS_PER_CYCLE < POWER_LED_ON_TICKS) ?
- LED_WHITE : LED_OFF);
+ led_set_color_power((power_tick % LED_TICKS_PER_CYCLE <
+ POWER_LED_ON_TICKS) ?
+ LED_WHITE :
+ LED_OFF);
else
led_set_color_power(LED_OFF);
}