diff options
author | ZhengShunQian <zhengsq@rock-chips.com> | 2015-01-23 16:30:50 +0800 |
---|---|---|
committer | ChromeOS bot <3su6n15k.default@developer.gserviceaccount.com> | 2015-12-07 19:27:49 +0000 |
commit | f2a05b1a0d807ab1e462495736633610d76ce5bc (patch) | |
tree | 91db7b5d05d567ea5aa5940b61050f03780523d3 | |
parent | 341c9ded4aad739a8cd99ff3278b7c5f26117df2 (diff) | |
download | chrome-ec-f2a05b1a0d807ab1e462495736633610d76ce5bc.tar.gz |
LED: add green/red support for host commands
The host command(ectool) to set led colors will read the brightness
range and then set as requested. If brightness range is 0, then it will just
return INVALID_PARAM.
BUG=None
TEST=build and run on terra
ectool led battery green
ectool led battery red
ectool led battery off
ectool led power white
ectool led power off
ectool led battery auto
ectool led power auto
BRANCH=firmware-strago-7287.B
Change-Id: I65a73275741ada5c01e041ae2c11efe3aa2d8c38
Signed-off-by: ZhengShunQian <zhengsq@rock-chips.com>
Signed-off-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/242531
Reviewed-by: Randall Spangler <rspangler@chromium.org>
(cherry picked from commit ba88b6d6b35959d7ff33cdf075e494406a2f4b5f)
Reviewed-on: https://chromium-review.googlesource.com/316361
Reviewed-by: Shawn N <shawnn@chromium.org>
Tested-by: BoChao Jhan <james_chao@asus.com>
Commit-Queue: BoChao Jhan <james_chao@asus.com>
-rw-r--r-- | common/led_policy_std.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/common/led_policy_std.c b/common/led_policy_std.c index 2fd159ec49..ebb7125105 100644 --- a/common/led_policy_std.c +++ b/common/led_policy_std.c @@ -88,9 +88,18 @@ static int pwr_led_set_color(enum led_color color) void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range) { - /* Ignoring led_id as both leds support the same colors */ - brightness_range[EC_LED_COLOR_BLUE] = 1; - brightness_range[EC_LED_COLOR_YELLOW] = 1; + switch (led_id) { + case EC_LED_ID_BATTERY_LED: + brightness_range[EC_LED_COLOR_RED] = 1; + brightness_range[EC_LED_COLOR_GREEN] = 1; + break; + case EC_LED_ID_POWER_LED: + brightness_range[EC_LED_COLOR_WHITE] = 1; + break; + default: + /* ignore */ + break; + } } int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness) |