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>
This commit is contained in:
Justin Chuang
2014-01-13 23:35:48 +08:00
committed by chrome-internal-fetch
parent 8da44f83fa
commit 0a887c71eb
2 changed files with 8 additions and 5 deletions

View File

@@ -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 */

View File

@@ -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;
}