From 83995780242fcab243370e4ffa83e70b001848b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Barna=C5=9B?= Date: Fri, 4 Mar 2022 17:16:03 +0100 Subject: zephyr: fix leds behavior on lazor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes the handling of leds definitions in device tree and changes the led tick to be 1s instead of default 200ms. Only the first node of led was set properly, other ones were causing the read outside of an array. BUG=b:222684744 BRANCH=main TEST=flash and check if leds are blinking as they should Change-Id: Id890261e38b7a61dff4827e0a6f192ad10b6ab32 Signed-off-by: Michał Barnaś Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3500522 Reviewed-by: Fabio Baltieri --- zephyr/projects/trogdor/lazor/src/led.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'zephyr/projects/trogdor') diff --git a/zephyr/projects/trogdor/lazor/src/led.c b/zephyr/projects/trogdor/lazor/src/led.c index 2d49d3ce59..682490d0e2 100644 --- a/zephyr/projects/trogdor/lazor/src/led.c +++ b/zephyr/projects/trogdor/lazor/src/led.c @@ -265,7 +265,7 @@ static int find_color(int node_idx, int ticks) ticks = ticks % GET_PERIOD(node_idx, MAX_COLOR - 1); for (color_idx = 0; color_idx < MAX_COLOR; color_idx++) { - if (GET_PERIOD(node_idx, color_idx) < ticks) + if (GET_PERIOD(node_idx, color_idx) > ticks) break; } } @@ -297,7 +297,7 @@ static void led_tick(void) if (led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) board_led_set_color(); } -DECLARE_HOOK(HOOK_TICK, led_tick, HOOK_PRIO_DEFAULT); +DECLARE_HOOK(HOOK_SECOND, led_tick, HOOK_PRIO_DEFAULT); void led_control(enum ec_led_id led_id, enum ec_led_state state) { -- cgit v1.2.1