mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-11 18:35:28 +00:00
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>
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user