From f1bc94f149f4043e01bd604604a44f22aa14cf19 Mon Sep 17 00:00:00 2001 From: Philip Chen Date: Tue, 14 Aug 2018 14:17:31 -0700 Subject: cheza: Fix LED mapping Map EC_LED_ID_RIGHT_LED to p0 and EC_LED_ID_LEFT_LED to p1. BRANCH=none BUG=b:112600822 TEST=switch LED colors by 'ectool led' for right/left LEDs TEST=verify the LED behavior for charge/discharge state doesn't change Change-Id: I12f5e542f9b25a55015c953c8c3814c8772f0c74 Signed-off-by: Philip Chen Reviewed-on: https://chromium-review.googlesource.com/1175132 Commit-Ready: Philip Chen Tested-by: Philip Chen Reviewed-by: Alexandru M Stan Reviewed-by: Wai-Hong Tam --- board/cheza/led.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/board/cheza/led.c b/board/cheza/led.c index 3064f46e70..21ca78cb5c 100644 --- a/board/cheza/led.c +++ b/board/cheza/led.c @@ -21,8 +21,8 @@ #define BAT_LED_OFF 0 const enum ec_led_id supported_led_ids[] = { - EC_LED_ID_LEFT_LED, EC_LED_ID_RIGHT_LED, + EC_LED_ID_LEFT_LED, }; const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); @@ -53,10 +53,10 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness) int port; switch (led_id) { - case EC_LED_ID_LEFT_LED: + case EC_LED_ID_RIGHT_LED: port = 0; break; - case EC_LED_ID_RIGHT_LED: + case EC_LED_ID_LEFT_LED: port = 1; break; default: @@ -81,9 +81,9 @@ static void set_active_port_color(enum led_color color) { int port = charge_manager_get_active_charge_port(); - if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) - side_led_set_color(0, (port == 0) ? color : LED_OFF); if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) + side_led_set_color(0, (port == 0) ? color : LED_OFF); + if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) side_led_set_color(1, (port == 1) ? color : LED_OFF); } @@ -100,7 +100,7 @@ static void board_led_set_battery(void) set_active_port_color(LED_AMBER); break; case PWR_STATE_DISCHARGE: - if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) { + if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) { if (charge_get_percent() <= 10) side_led_set_color(0, (battery_ticks & 0x4) ? LED_WHITE : LED_OFF); @@ -108,7 +108,7 @@ static void board_led_set_battery(void) side_led_set_color(0, LED_OFF); } - if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) + if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) side_led_set_color(1, LED_OFF); break; case PWR_STATE_ERROR: -- cgit v1.2.1