summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Chuang <jchuang@chromium.org>2014-01-13 23:35:48 +0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-01-15 22:46:47 +0000
commitafa0ef2e6d54fe3aab8788bd9d9a1327bed1a1eb (patch)
tree40aa215126e8a2b5c0e2631cbeff703ec7b80d23
parent4ab1cc63218735c5a8c13f739046392688a1dddd (diff)
downloadchrome-ec-afa0ef2e6d54fe3aab8788bd9d9a1327bed1a1eb.tar.gz
rambi: fix led command
Change rambi LED id to battery and fix led command. BUG=None Original-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: I835d17905cb637f7b0188948c8df51923022d84c Original-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> Reviewed-on: https://chromium-review.googlesource.com/182657 Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
-rw-r--r--board/rambi/led.c4
-rw-r--r--common/led_common.c9
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;
}