ec/google/chromeec: Add option to set keyboard backlight level at boot

Add the ability to set the keyboard backlight level at boot, controlled
by a setup option variable and restricted to devices which actually
have a backlit keyboard.

TEST=tested hooked up to a CFR option 'ec_kb_backlight' (added later in
the patch series) to set the keyboard backlight at boot, with
visibility controlled by backlight presence, on a range of Chromebooks
with and without keyboard backlight support.

Change-Id: I92eed62935d0333f548599860b7bbe22f6b9f2b4
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/89828
Reviewed-by: Caveh Jalali <caveh@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
This commit is contained in:
Matt DeVillier 2025-10-19 17:33:46 -05:00
commit 8d7183a904

View file

@ -3,6 +3,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <acpi/acpi.h>
#include <assert.h>
#include <console/console.h>
#include <delay.h>
@ -10,6 +11,7 @@
#include <device/path.h>
#include <elog.h>
#include <halt.h>
#include <option.h>
#include <reset.h>
#include <rtc.h>
#include <security/vboot/vboot_common.h>
@ -1329,6 +1331,11 @@ void google_chromeec_init(void)
if (CONFIG(EC_GOOGLE_CHROMEEC_AUTO_FAN_CTRL)) {
ec_cmd_thermal_auto_fan_ctrl(PLAT_EC);
}
/* Set keyboard backlight */
int backlight_level = get_uint_option("ec_kb_backlight", -1);
if (backlight_level != -1 && !acpi_is_wakeup_s3() && google_chromeec_has_kbbacklight())
google_chromeec_kbbacklight(backlight_level);
}
int google_ec_running_ro(void)