summaryrefslogtreecommitdiff
path: root/board/coachz/led.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/coachz/led.c')
-rw-r--r--board/coachz/led.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/board/coachz/led.c b/board/coachz/led.c
index 9dd8729a04..6623089db0 100644
--- a/board/coachz/led.c
+++ b/board/coachz/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -35,15 +35,15 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_BLUE,
- 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(enum led_color color)
{
gpio_set_level(GPIO_EC_CHG_LED_Y_C0,
- (color == LED_AMBER) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_AMBER) ? BAT_LED_ON : BAT_LED_OFF);
gpio_set_level(GPIO_EC_CHG_LED_W_C0,
- (color == LED_BLUE) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_BLUE) ? BAT_LED_ON : BAT_LED_OFF);
}
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
@@ -69,7 +69,6 @@ static void board_led_set_battery(void)
static int battery_ticks;
int color = LED_OFF;
int period = 0;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -84,16 +83,15 @@ static void board_led_set_battery(void)
period = (1 + 1) * LED_ONE_SEC;
battery_ticks = battery_ticks % period;
if (battery_ticks < 1 * LED_ONE_SEC) {
- if (charge_get_percent() < 10)
- {
- /* Blink amber light (1 sec on, 1 sec off) */
+ if (charge_get_percent() < 10) {
+ /* Blink amber light (1 sec on, 1 sec
+ * off) */
color = LED_AMBER;
- }
- else
- {
- /* Blink white light (1 sec on, 1 sec off) */
+ } else {
+ /* Blink white light (1 sec on, 1 sec
+ * off) */
color = LED_BLUE;
- }
+ }
} else {
color = LED_OFF;
}
@@ -138,16 +136,16 @@ static void board_led_set_battery(void)
}
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE) {
- /* Factory mode: Blue 2 sec, Amber 2 sec */
- period = (2 + 2) * LED_ONE_SEC;
- battery_ticks = battery_ticks % period;
- if (battery_ticks < 2 * LED_ONE_SEC)
- color = LED_BLUE;
- else
- color = LED_AMBER;
- } else
+ color = LED_BLUE;
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ /* Factory mode: Blue 2 sec, Amber 2 sec */
+ period = (2 + 2) * LED_ONE_SEC;
+ battery_ticks = battery_ticks % period;
+ if (battery_ticks < 2 * LED_ONE_SEC)
color = LED_BLUE;
+ else
+ color = LED_AMBER;
break;
default:
/* Other states don't alter LED behavior */