diff options
-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; } |