summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Collyer <scollyer@google.com>2019-05-29 14:31:34 -0700
committerCommit Bot <commit-bot@chromium.org>2019-06-21 18:44:28 +0000
commit0b56438581edd5da9dd12f67bf44a95b4f4ed28d (patch)
tree52ba37b270c97bf170e718618fc3ed0e06f3cfce
parentc39005ccf95e393e930f3c7b26df2bcb0f8b2636 (diff)
downloadchrome-ec-0b56438581edd5da9dd12f67bf44a95b4f4ed28d.tar.gz
helios: Add support for power LED
This CL adds support for the power LED. BUG=b:133501368 BRANCH=none TEST=make -j BOARD=helios Change-Id: Ib0d117631b7482fad65e6b8df326194281b21d5b Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1636433 Tested-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org> Auto-Submit: Scott Collyer <scollyer@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
-rw-r--r--board/helios/board.h1
-rw-r--r--board/helios/led.c29
2 files changed, 29 insertions, 1 deletions
diff --git a/board/helios/board.h b/board/helios/board.h
index 2047f21208..1513a07e3a 100644
--- a/board/helios/board.h
+++ b/board/helios/board.h
@@ -18,6 +18,7 @@
#define CONFIG_KEYBOARD_BOARD_CONFIG
#define CONFIG_KEYBOARD_PROTOCOL_8042
#define CONFIG_LED_COMMON
+#define CONFIG_LED_POWER_LED
#define CONFIG_LOW_POWER_IDLE
#define CONFIG_HOSTCMD_ESPI
diff --git a/board/helios/led.c b/board/helios/led.c
index e589ffc252..26461ef103 100644
--- a/board/helios/led.c
+++ b/board/helios/led.c
@@ -31,8 +31,19 @@ struct led_descriptor led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
{EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
};
+const struct led_descriptor
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
+ [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 3 * LED_ONE_SEC},
+ {LED_OFF, 0.5 * LED_ONE_SEC} },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = {{LED_OFF, LED_INDEFINITE} },
+ [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
+};
+
+
const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED
+ EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED,
};
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -55,11 +66,22 @@ void led_set_color_battery(enum ec_led_colors color)
}
}
+void led_set_color_power(enum ec_led_colors color)
+{
+ if (color == EC_LED_COLOR_WHITE)
+ gpio_set_level(GPIO_LED_3_L, LED_ON_LVL);
+ else
+ /* LED_OFF and unsupported colors */
+ gpio_set_level(GPIO_LED_3_L, LED_OFF_LVL);
+}
+
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
{
if (led_id == EC_LED_ID_BATTERY_LED) {
brightness_range[EC_LED_COLOR_AMBER] = 1;
brightness_range[EC_LED_COLOR_WHITE] = 1;
+ } else if (led_id == EC_LED_ID_POWER_LED) {
+ brightness_range[EC_LED_COLOR_WHITE] = 1;
}
}
@@ -72,6 +94,11 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
led_set_color_battery(EC_LED_COLOR_WHITE);
else
led_set_color_battery(LED_OFF);
+ } else if (led_id == EC_LED_ID_POWER_LED) {
+ if (brightness[EC_LED_COLOR_WHITE] != 0)
+ led_set_color_power(EC_LED_COLOR_WHITE);
+ else
+ led_set_color_power(LED_OFF);
}
return EC_SUCCESS;