diff options
Diffstat (limited to 'board/kappa/led.c')
-rw-r--r-- | board/kappa/led.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/board/kappa/led.c b/board/kappa/led.c index 5b65d7b948..1c7979eac0 100644 --- a/board/kappa/led.c +++ b/board/kappa/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. * @@ -14,7 +14,7 @@ #define BAT_LED_ON 0 #define BAT_LED_OFF 1 -const enum ec_led_id supported_led_ids[] = {EC_LED_ID_BATTERY_LED}; +const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED }; const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); @@ -22,7 +22,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 int led_set_color_battery(enum led_color color) @@ -82,16 +82,14 @@ static void led_set_battery(void) { static int battery_ticks; static int power_ticks; - uint32_t chflags = charge_get_flags(); battery_ticks++; /* override battery led for system suspend */ - if (chipset_in_state(CHIPSET_STATE_SUSPEND | - CHIPSET_STATE_STANDBY) && + if (chipset_in_state(CHIPSET_STATE_SUSPEND | CHIPSET_STATE_STANDBY) && charge_get_state() != PWR_STATE_CHARGE) { - led_set_color_battery(power_ticks++ & 0x2 ? - LED_WHITE : LED_OFF); + led_set_color_battery(power_ticks++ & 0x2 ? LED_WHITE : + LED_OFF); return; } @@ -119,19 +117,18 @@ static void led_set_battery(void) led_set_color_battery(LED_OFF); break; case PWR_STATE_ERROR: - led_set_color_battery( - (battery_ticks % 0x2) ? LED_WHITE : LED_OFF); + led_set_color_battery((battery_ticks % 0x2) ? LED_WHITE : + LED_OFF); break; case PWR_STATE_CHARGE_NEAR_FULL: led_set_color_battery(LED_WHITE); break; case PWR_STATE_IDLE: /* External power connected in IDLE */ - if (chflags & CHARGE_FLAG_FORCE_IDLE) - led_set_color_battery( - (battery_ticks & 0x2) ? LED_AMBER : LED_OFF); - else - led_set_color_battery(LED_WHITE); + led_set_color_battery(LED_WHITE); break; + case PWR_STATE_FORCED_IDLE: + led_set_color_battery((battery_ticks & 0x2) ? LED_AMBER : + LED_OFF); default: /* Other states don't alter LED behavior */ break; |