summaryrefslogtreecommitdiff
path: root/board/wormdingler/led.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/wormdingler/led.c')
-rw-r--r--board/wormdingler/led.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/board/wormdingler/led.c b/board/wormdingler/led.c
index 40de6257fa..c314d584c3 100644
--- a/board/wormdingler/led.c
+++ b/board/wormdingler/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -36,15 +36,15 @@ enum led_color {
LED_RED,
LED_GREEN,
LED_AMBER,
- 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_R_C0,
- (color == LED_RED) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_RED) ? BAT_LED_ON : BAT_LED_OFF);
gpio_set_level(GPIO_EC_CHG_LED_G_C0,
- (color == LED_GREEN) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_GREEN) ? BAT_LED_ON : BAT_LED_OFF);
if (color == LED_AMBER) {
gpio_set_level(GPIO_EC_CHG_LED_R_C0, BAT_LED_ON);
gpio_set_level(GPIO_EC_CHG_LED_G_C0, BAT_LED_ON);
@@ -78,7 +78,6 @@ static void board_led_set_battery(void)
int color = LED_OFF;
int period = 0;
int percent = DIV_ROUND_NEAREST(charge_get_display_charge(), 10);
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -86,13 +85,13 @@ static void board_led_set_battery(void)
case PWR_STATE_CHARGE:
case PWR_STATE_CHARGE_NEAR_FULL:
if (chipset_in_state(CHIPSET_STATE_ON |
- CHIPSET_STATE_ANY_SUSPEND |
- CHIPSET_STATE_ANY_OFF)) {
+ CHIPSET_STATE_ANY_SUSPEND |
+ CHIPSET_STATE_ANY_OFF)) {
if (percent <= BATTERY_LEVEL_CRITICAL) {
/* battery capa <= 5%, Red */
color = LED_RED;
} else if (percent > BATTERY_LEVEL_CRITICAL &&
- percent < BATTERY_LEVEL_NEAR_FULL) {
+ percent < BATTERY_LEVEL_NEAR_FULL) {
/* 5% < battery capa < 97%, Orange */
color = LED_AMBER;
} else {
@@ -102,8 +101,8 @@ static void board_led_set_battery(void)
}
break;
case PWR_STATE_DISCHARGE:
- /* Always indicate off on when discharging */
- color = LED_OFF;
+ /* Always indicate off on when discharging */
+ color = LED_OFF;
break;
case PWR_STATE_ERROR:
/* Battery error, Red on 1sec off 1sec */
@@ -115,16 +114,16 @@ static void board_led_set_battery(void)
color = LED_OFF;
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE) {
- /* Factory mode, Red 2 sec, green 2 sec */
- period = (2 + 2) * LED_ONE_SEC;
- battery_ticks = battery_ticks % period;
- if (battery_ticks < 2 * LED_ONE_SEC)
- color = LED_RED;
- else
- color = LED_GREEN;
- } else
+ color = LED_RED;
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ /* Factory mode, Red 2 sec, green 2 sec */
+ period = (2 + 2) * LED_ONE_SEC;
+ battery_ticks = battery_ticks % period;
+ if (battery_ticks < 2 * LED_ONE_SEC)
color = LED_RED;
+ else
+ color = LED_GREEN;
break;
default:
/* Other states don't alter LED behavior */
@@ -147,7 +146,7 @@ void led_control(enum ec_led_id led_id, enum ec_led_state state)
enum led_color color;
if ((led_id != EC_LED_ID_RECOVERY_HW_REINIT_LED) &&
- (led_id != EC_LED_ID_SYSRQ_DEBUG_LED))
+ (led_id != EC_LED_ID_SYSRQ_DEBUG_LED))
return;
if (state == LED_STATE_RESET) {