summaryrefslogtreecommitdiff
path: root/common/led_policy_std.c
diff options
context:
space:
mode:
authorZhengShunQian <zhengsq@rock-chips.com>2015-01-23 16:30:50 +0800
committerchrome-bot <chrome-bot@chromium.org>2016-05-18 15:08:28 -0700
commit77e23a4fc99c7cadfa7717544b464ef59773c223 (patch)
treeb9eca922418c54c4b1c2b3f6bf2f7fb1e536e5c8 /common/led_policy_std.c
parent2388211bd74fab4b93e90831e6a323650d6438aa (diff)
downloadchrome-ec-77e23a4fc99c7cadfa7717544b464ef59773c223.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=chrome-os-partner:35416 TEST=build and run on veyron ectool led battery green ectool led battery red ectool led battery red=1 green=1 #this gives amber ectool led battery off ectool led power white ectool led power off ectool led battery auto ectool led power auto BRANCH=veyron Change-Id: I65a73275741ada5c01e041ae2c11efe3aa2d8c38 (cherry picked from commit ba88b6d6b35959d7ff33cdf075e494406a2f4b5f) Reviewed-on: https://chromium-review.googlesource.com/345693 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'common/led_policy_std.c')
-rw-r--r--common/led_policy_std.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/common/led_policy_std.c b/common/led_policy_std.c
index 2fd159ec49..32351d7e07 100644
--- a/common/led_policy_std.c
+++ b/common/led_policy_std.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015 The Chromium OS Authors. All rights reserved.
+/* Copyright 2015 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -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)