diff options
author | Diana Z <dzigterman@chromium.org> | 2021-04-16 12:02:12 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-04-22 22:30:32 +0000 |
commit | 4746791009b75da679d44d45e8487c57c9191329 (patch) | |
tree | 5401e9c35f6bae95373f5fa472680813dc69d47f /board/sasukette | |
parent | 7fa18f56441dd596927845198ea61dbe164d7a00 (diff) | |
download | chrome-ec-4746791009b75da679d44d45e8487c57c9191329.tar.gz |
LED On/Off: Remove power LED config
Move the LED on/off module towards using a more flexible LED support
approach. Define a weak power LED table and setter for boards to
override when needed. Note that during run-time these functions will
not get called since led_auto_control_is_enabled() will return false for
nonexistent LEDs.
This consumes an average of 165 additional bytes of flash space on
boards which do not use a power LED.
BRANCH=None
BUG=b:185508707
TEST=make -j buildall, load on guybrush (battery LED only) and confirm
no errors are seen. Load on Boten (both LEDs) and confirm behavior
appears normal
Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: Iaa1e22a7f5d8be39eb8792ee13d358087d7f7482
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2832691
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'board/sasukette')
-rw-r--r-- | board/sasukette/board.h | 1 | ||||
-rw-r--r-- | board/sasukette/led.c | 4 |
2 files changed, 2 insertions, 3 deletions
diff --git a/board/sasukette/board.h b/board/sasukette/board.h index 8e84201af3..2e2e302ea8 100644 --- a/board/sasukette/board.h +++ b/board/sasukette/board.h @@ -40,7 +40,6 @@ /* LED */ #define CONFIG_LED_COMMON #define CONFIG_LED_ONOFF_STATES -#define CONFIG_LED_POWER_LED #define GPIO_BAT_LED_RED_L GPIO_LED_R_ODL #define GPIO_BAT_LED_GREEN_L GPIO_LED_G_ODL #define GPIO_PWR_LED_BLUE_L GPIO_LED_B_ODL diff --git a/board/sasukette/led.c b/board/sasukette/led.c index 116fbd6840..11b734b995 100644 --- a/board/sasukette/led.c +++ b/board/sasukette/led.c @@ -36,7 +36,7 @@ struct led_descriptor led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = { {LED_OFF, 1 * LED_ONE_SEC} }, }; -const struct led_descriptor +__override const struct led_descriptor led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = { [PWR_LED_STATE_ON] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} }, [PWR_LED_STATE_SUSPEND_AC] = {{LED_OFF, LED_INDEFINITE} }, @@ -51,7 +51,7 @@ const enum ec_led_id supported_led_ids[] = { const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); -void led_set_color_power(enum ec_led_colors color) +__override void led_set_color_power(enum ec_led_colors color) { /* Don't set led if led_auto_control is disabled. */ if (!led_auto_control_is_enabled(EC_LED_ID_POWER_LED) || |