diff options
author | Scott Chao <scott_chao@wistron.corp-partner.google.com> | 2021-01-14 16:12:29 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-01-16 00:53:53 +0000 |
commit | 2d9f8f9e2f0796eb18aaa3b6f89975d2305b04b6 (patch) | |
tree | a8529eb7345d336a9e53be8f7aaf0bed6afd4c1e /board/eldrid | |
parent | d4712c46a28191bc8ac9962565655b5b6e1a4d95 (diff) | |
download | chrome-ec-2d9f8f9e2f0796eb18aaa3b6f89975d2305b04b6.tar.gz |
eldrid: support ectool led control when no adapter
The 'ectool' command was not able to set the
battery LED color.
When no AC adapter is connected, that battery
LED code temporarily turns of all LEDs until
the next HOST_TICK.
Bypass this check if the host has disabled LED
auto control.
BUG=b:177493741
BRANCH=firmware-volteer-13521.B-master
TEST=make buildall
Signed-off-by: Scott Chao <scott_chao@wistron.corp-partner.google.com>
Change-Id: I82f78bfecbb7f1b8343cf864ad0fd0d9bfc8fdaf
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2627539
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'board/eldrid')
-rw-r--r-- | board/eldrid/led.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/board/eldrid/led.c b/board/eldrid/led.c index a45157a6a2..0a0661d5f7 100644 --- a/board/eldrid/led.c +++ b/board/eldrid/led.c @@ -69,26 +69,26 @@ void led_set_color_battery(enum ec_led_colors color) int port; int side_select_duty; - port = charge_manager_get_active_charge_port(); + if (led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) { + port = charge_manager_get_active_charge_port(); + switch (port) { + case LED_SIDESEL_MB_PORT: + side_select_duty = 0; + break; + case LED_SIDESEL_DB_PORT: + side_select_duty = 100; + break; + default: + /* + * We need to turn off led here since curr.ac won't update + * immediately but led will update every 200ms. + */ + side_select_duty = 50; + color = LED_OFF; + } - switch (port) { - case LED_SIDESEL_MB_PORT: - side_select_duty = 0; - break; - case LED_SIDESEL_DB_PORT: - side_select_duty = 100; - break; - default: - /* - * We need to turn off led here since curr.ac won't update - * immediately but led will update every 200ms. - */ - side_select_duty = 50; - color = LED_OFF; - } - - if (led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) pwm_set_duty(PWM_CH_LED4_SIDESEL, side_select_duty); + } switch (color) { case EC_LED_COLOR_AMBER: @@ -128,6 +128,7 @@ void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range) int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness) { if (led_id == EC_LED_ID_BATTERY_LED) { + led_auto_control(led_id, 0); if (brightness[EC_LED_COLOR_AMBER] != 0) led_set_color_battery(EC_LED_COLOR_AMBER); else if (brightness[EC_LED_COLOR_WHITE] != 0) |