diff options
author | Ko_Ko <Ko_Ko@compal.corp-partner.google.com> | 2020-12-07 16:59:05 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-12-08 04:01:21 +0000 |
commit | fc827a9f05a0f139ea198c32a556f662d097d134 (patch) | |
tree | 8468f17134c157caa92d2be6aacd9d4c86509137 /board/madoo | |
parent | a0f2c4640c879521d2e9893317fe50ee1a4c76ee (diff) | |
download | chrome-ec-fc827a9f05a0f139ea198c32a556f662d097d134.tar.gz |
Madoo: Fixing LED behavior
Fix the following behavior:
1. Rescue LED from EVT and previous board(board id<3)
2. Change low battery led color according to customer's demand
3. Fixing the issue that when removing AC from right port, left
battery led will blink and go off.
BUG=b:173464588
BRANCH=None
TEST=flash on EVT board and change cbi to verify the LED functions
Signed-off-by: Ko_Ko <Ko_Ko@compal.corp-partner.google.com>
Change-Id: Ie4a855e4d846a05b681e386cb82f702eea8c4e6e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2577152
Reviewed-by: Diana Z <dzigterman@chromium.org>
Commit-Queue: Ko Ko <ko_ko@compal.corp-partner.google.com>
Tested-by: Ko Ko <ko_ko@compal.corp-partner.google.com>
Diffstat (limited to 'board/madoo')
-rw-r--r-- | board/madoo/led.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/board/madoo/led.c b/board/madoo/led.c index b083b0bad7..639a05c764 100644 --- a/board/madoo/led.c +++ b/board/madoo/led.c @@ -5,12 +5,14 @@ * Power and battery LED control for madoo */ +#include "charge_state.h" #include "driver/tcpm/tcpci.h" #include "ec_commands.h" #include "gpio.h" #include "led_common.h" #include "led_onoff_states.h" #include "hooks.h" +#include "system.h" #define LED_OFF_LVL 1 #define LED_ON_LVL 0 @@ -25,7 +27,7 @@ struct led_descriptor led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = { [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} }, [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} }, [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} }, - [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC}, + [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC}, {LED_OFF, 1 * LED_ONE_SEC} }, /* STATE_DISCHARGE_S3 will changed if sku is clamshells */ [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} }, @@ -65,20 +67,30 @@ void led_set_color_battery(enum ec_led_colors color) switch (color) { case EC_LED_COLOR_WHITE: /* Ports are controlled by different GPIO */ - if (charge_manager_get_active_charge_port()) { + if (charge_manager_get_active_charge_port() == 1 || + system_get_board_version() < 3) { gpio_set_level(GPIO_BAT_LED_WHITE_L, LED_ON_LVL); gpio_set_level(GPIO_BAT_LED_AMBER_L, LED_OFF_LVL); - } else { + } else if (charge_manager_get_active_charge_port() == 0) { gpio_set_level(GPIO_EC_CHG_LED_R_W, LED_ON_LVL); gpio_set_level(GPIO_EC_CHG_LED_R_Y, LED_OFF_LVL); } break; case EC_LED_COLOR_AMBER: /* Ports are controlled by different GPIO */ - if (charge_manager_get_active_charge_port()) { + if (charge_get_state() == PWR_STATE_ERROR && + system_get_board_version() >= 3) { + gpio_set_level(GPIO_EC_CHG_LED_R_W, LED_OFF_LVL); + gpio_set_level(GPIO_EC_CHG_LED_R_Y, LED_ON_LVL); + } else if (charge_manager_get_active_charge_port() == 1 || + system_get_board_version() < 3) { gpio_set_level(GPIO_BAT_LED_WHITE_L, LED_OFF_LVL); gpio_set_level(GPIO_BAT_LED_AMBER_L, LED_ON_LVL); - } else { + } else if (charge_manager_get_active_charge_port() == 0) { + gpio_set_level(GPIO_EC_CHG_LED_R_W, LED_OFF_LVL); + gpio_set_level(GPIO_EC_CHG_LED_R_Y, LED_ON_LVL); + } else if (charge_get_percent() < + CONFIG_LED_ONOFF_STATES_BAT_LOW) { gpio_set_level(GPIO_EC_CHG_LED_R_W, LED_OFF_LVL); gpio_set_level(GPIO_EC_CHG_LED_R_Y, LED_ON_LVL); } |