summaryrefslogtreecommitdiff
path: root/board/elemi
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2022-06-27 13:32:58 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-06-27 23:20:19 +0000
commitef736ad3635cb29c0b248e826217f52bb8fec77f (patch)
tree1820e527dfb716dd2d763f7ae7ce21f6feac3afa /board/elemi
parent6a4ce69682da935cf62078cf7753b5c4c23bfa0e (diff)
downloadchrome-ec-ef736ad3635cb29c0b248e826217f52bb8fec77f.tar.gz
board/elemi/led.c: Format with clang-format
BUG=b:236386294 BRANCH=none TEST=none Change-Id: I1cc50d6b12815a29129fe47cf0bd1e58da85c022 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3728289 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Diffstat (limited to 'board/elemi')
-rw-r--r--board/elemi/led.c53
1 files changed, 27 insertions, 26 deletions
diff --git a/board/elemi/led.c b/board/elemi/led.c
index d8df9c92a0..fc29c3c67b 100644
--- a/board/elemi/led.c
+++ b/board/elemi/led.c
@@ -21,10 +21,10 @@
#define POWER_LED_ON 0
#define POWER_LED_OFF 1
-#define LED_CYCLE_TIME_MS (2 * 1000)
+#define LED_CYCLE_TIME_MS (2 * 1000)
#define LED_TICKS_PER_CYCLE (LED_CYCLE_TIME_MS / HOOK_TICK_INTERVAL_MS)
-#define LED_ON_TIME_MS (1 * 1000)
-#define LED_ON_TICKS (LED_ON_TIME_MS / HOOK_TICK_INTERVAL_MS)
+#define LED_ON_TIME_MS (1 * 1000)
+#define LED_ON_TICKS (LED_ON_TIME_MS / HOOK_TICK_INTERVAL_MS)
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_LEFT_LED,
@@ -37,22 +37,19 @@ 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 */
};
-enum led_port {
- RIGHT_PORT = 0,
- LEFT_PORT
-};
+enum led_port { RIGHT_PORT = 0, LEFT_PORT };
static void led_set_color_battery(int port, enum led_color color)
{
enum gpio_signal amber_led, white_led;
amber_led = (port == RIGHT_PORT ? GPIO_C0_CHARGE_LED_AMBER_L :
- GPIO_C1_CHARGE_LED_AMBER_L);
+ GPIO_C1_CHARGE_LED_AMBER_L);
white_led = (port == RIGHT_PORT ? GPIO_C0_CHARGE_LED_WHITE_L :
- GPIO_C1_CHARGE_LED_WHITE_L);
+ GPIO_C1_CHARGE_LED_WHITE_L);
switch (color) {
case LED_WHITE:
@@ -124,10 +121,10 @@ static void set_active_port_color(enum led_color color)
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED))
led_set_color_battery(RIGHT_PORT,
- (port == RIGHT_PORT) ? color : LED_OFF);
+ (port == RIGHT_PORT) ? color : LED_OFF);
if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED))
led_set_color_battery(LEFT_PORT,
- (port == LEFT_PORT) ? color : LED_OFF);
+ (port == LEFT_PORT) ? color : LED_OFF);
}
static void led_set_battery(void)
@@ -144,14 +141,13 @@ static void led_set_battery(void)
* system suspend without charging state.
*/
if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND) &&
- charge_get_state() != PWR_STATE_CHARGE) {
-
+ charge_get_state() != PWR_STATE_CHARGE) {
suspend_ticks++;
- led_set_color_battery(RIGHT_PORT, suspend_ticks & 0x4 ?
- LED_WHITE : LED_OFF);
- led_set_color_battery(LEFT_PORT, suspend_ticks & 0x4 ?
- LED_WHITE : LED_OFF);
+ led_set_color_battery(
+ RIGHT_PORT, suspend_ticks & 0x4 ? LED_WHITE : LED_OFF);
+ led_set_color_battery(
+ LEFT_PORT, suspend_ticks & 0x4 ? LED_WHITE : LED_OFF);
return;
}
@@ -165,9 +161,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(RIGHT_PORT,
- (battery_ticks % LED_TICKS_PER_CYCLE
- < LED_ON_TICKS) ? LED_WHITE : LED_OFF);
+ led_set_color_battery(
+ RIGHT_PORT,
+ (battery_ticks % LED_TICKS_PER_CYCLE <
+ LED_ON_TICKS) ?
+ LED_WHITE :
+ LED_OFF);
else
led_set_color_battery(RIGHT_PORT, LED_OFF);
}
@@ -176,17 +175,19 @@ static void led_set_battery(void)
led_set_color_battery(LEFT_PORT, 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);
+ set_active_port_color(
+ (battery_ticks % LED_TICKS_PER_CYCLE <
+ LED_ON_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
else
set_active_port_color(LED_WHITE);
break;