summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lin <aclin@google.com>2017-04-20 17:01:18 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-05-03 03:31:30 -0700
commitda0f011995ef2f9ceec40f60a5f203c9e86460a4 (patch)
treebf0164a67baf01a31d50fe3f4c23fd91d4c32226
parent7fb0338cbd40d40db2a304cd3e8ed10ae4f59450 (diff)
downloadchrome-ec-da0f011995ef2f9ceec40f60a5f203c9e86460a4.tar.gz
tigertail: LED control
Added GPIOs for LED2, and updated mux control so that LEDs indicate current mux state. BRANCH=none BUG=b:37570358 TEST=make buildall -j TEST=check that LEDs change on tigertail as expected Change-Id: Ibdd3a667316ea64b319562f7a975b09eca08b2a6 Signed-off-by: Andrew Lin <aclin@google.com> Reviewed-on: https://chromium-review.googlesource.com/484727 Commit-Ready: Nick Sanders <nsanders@chromium.org> Tested-by: Nick Sanders <nsanders@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--board/tigertail/board.c26
-rw-r--r--board/tigertail/gpio.inc10
2 files changed, 32 insertions, 4 deletions
diff --git a/board/tigertail/board.c b/board/tigertail/board.c
index 058e15c4a8..923fcc8e40 100644
--- a/board/tigertail/board.c
+++ b/board/tigertail/board.c
@@ -295,6 +295,21 @@ DECLARE_CONSOLE_COMMAND(uart, command_uart,
"[off|on|flip|auto]",
"Get/set the flip and enable state of the SBU UART");
+static void set_led_a(int r, int g, int b)
+{
+ /* LEDs are active low */
+ gpio_set_level(GPIO_LED_R_L, !r);
+ gpio_set_level(GPIO_LED_G_L, !g);
+ gpio_set_level(GPIO_LED_B_L, !b);
+}
+
+static void set_led_b(int r, int g, int b)
+{
+ gpio_set_level(GPIO_LED2_R_L, !r);
+ gpio_set_level(GPIO_LED2_G_L, !g);
+ gpio_set_level(GPIO_LED2_B_L, !b);
+}
+
/* State we intend the mux GPIOs to be set. */
static int mux_state = MUX_OFF;
@@ -327,6 +342,16 @@ void set_mux_state(int state)
mux_state = MUX_OFF;
else
mux_state = state;
+
+ if (state == MUX_A)
+ set_led_a(0, 1, 0);
+ else
+ set_led_a(1, 0, 0);
+
+ if (state == MUX_B)
+ set_led_b(0, 1, 0);
+ else
+ set_led_b(1, 0, 0);
}
static int command_mux(int argc, char **argv)
@@ -378,4 +403,3 @@ static void board_init(void)
ina2xx_init(4, 0x8000, INA2XX_CALIB_1MA(15 /*mOhm*/));
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
-
diff --git a/board/tigertail/gpio.inc b/board/tigertail/gpio.inc
index d7eabf21e1..de68fe1f92 100644
--- a/board/tigertail/gpio.inc
+++ b/board/tigertail/gpio.inc
@@ -19,9 +19,13 @@ GPIO(ST_UART_LVL_DIS, PIN(B, 10), GPIO_OUT_HIGH)
GPIO(ST_UART_TX_DIR, PIN(B, 12), GPIO_OUT_HIGH)
GPIO(ST_UART_TX_DIR_N, PIN(B, 15), GPIO_OUT_LOW)
-GPIO(LED_G, PIN(B, 11), GPIO_OUT_HIGH)
-GPIO(LED_R, PIN(B, 13), GPIO_OUT_LOW)
-GPIO(LED_B, PIN(B, 14), GPIO_OUT_HIGH)
+GPIO(LED2_G_L, PIN(A, 5), GPIO_OUT_HIGH)
+GPIO(LED2_B_L, PIN(A, 8), GPIO_OUT_HIGH)
+GPIO(LED2_R_L, PIN(A, 13), GPIO_OUT_LOW)
+
+GPIO(LED_G_L, PIN(B, 11), GPIO_OUT_HIGH)
+GPIO(LED_R_L, PIN(B, 13), GPIO_OUT_LOW)
+GPIO(LED_B_L, PIN(B, 14), GPIO_OUT_HIGH)
/* Inputs */
GPIO(USB_C_SBU1_DET, PIN(A, 6), GPIO_INPUT)