diff options
author | Justin Chuang <jchuang@chromium.org> | 2014-01-13 23:35:48 +0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-01-14 09:19:45 +0000 |
commit | 0a887c71eb82d365fce58ff267cdea420561e100 (patch) | |
tree | 254cd780527c16946c4d396e43e527f08bfb9b42 | |
parent | 8da44f83faf25ae12a28b4c682b9417ed5130ab9 (diff) | |
download | chrome-ec-0a887c71eb82d365fce58ff267cdea420561e100.tar.gz |
rambi: fix led command
Change rambi LED id to battery and fix led command.
BUG=chrome-os-partner:24980
BRANCH=None
TEST=Manually,
ectool led power query => error
ectool led battery query => success
ectool led red => red
ectool led green => green
ectool led off => off
ectool led auto => default behavior
Change-Id: I151d63a010434ae8cd21b0ae0d935bb9d8c084c7
Signed-off-by: Justin Chuang <jchuang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/182275
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vic Yang <victoryang@chromium.org>
-rw-r--r-- | board/rambi/led.c | 4 | ||||
-rw-r--r-- | common/led_common.c | 9 |
2 files changed, 8 insertions, 5 deletions
diff --git a/board/rambi/led.c b/board/rambi/led.c index 2de4584411..189c179810 100644 --- a/board/rambi/led.c +++ b/board/rambi/led.c @@ -13,7 +13,7 @@ #include "pwm.h" #include "util.h" -const enum ec_led_id supported_led_ids[] = {EC_LED_ID_POWER_LED}; +const enum ec_led_id supported_led_ids[] = {EC_LED_ID_BATTERY_LED}; const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); enum led_color { @@ -88,7 +88,7 @@ static void led_tick(void) int chstate = charge_get_state(); /* If we don't control the LED, nothing to do */ - if (!led_auto_control_is_enabled(EC_LED_ID_POWER_LED)) + if (!led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) return; /* If we're just suspending now, reset ticks so LED changes quickly */ diff --git a/common/led_common.c b/common/led_common.c index 88abd841f6..a894e305db 100644 --- a/common/led_common.c +++ b/common/led_common.c @@ -60,10 +60,13 @@ static int led_command_control(struct host_cmd_handler_args *args) if (r->brightness_range[i] == 0 && p->brightness[i] != 0) return EC_RES_INVALID_PARAM; - if (p->flags & EC_LED_FLAGS_AUTO) + if (p->flags & EC_LED_FLAGS_AUTO) { led_auto_control(p->led_id, 1); - else if (led_set_brightness(p->led_id, p->brightness) != EC_SUCCESS) - return EC_RES_INVALID_PARAM; + } else { + if (led_set_brightness(p->led_id, p->brightness) != EC_SUCCESS) + return EC_RES_INVALID_PARAM; + led_auto_control(p->led_id, 0); + } return EC_RES_SUCCESS; } |