ec/google: Detect keyboard backlight at runtime

This enables adding the backlight driver to boards that may or may not
come with a keyboard backlight function.
It's the responsibility of the EC to report if that feature exists, but
that's not a big extra burden given that it already keeps track of
everything else related to the backlight.

BUG=b:64705535
BRANCH=none
CQ-DEPEND=CL:620595
TEST=configured KBLE manually and noticed the presence/absence of
/sys/devices/platform/GOOG0002:00/ on a Chrome OS Linux kernel,
corresponding to the value reported by the EC.

Change-Id: Idc36bfaa6e69581ba19b52d37af6956f63cfdb8f
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://review.coreboot.org/21099
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Patrick Georgi 2017-08-18 21:06:24 +02:00
parent fbf1018805
commit 4bd68b8e4f
2 changed files with 16 additions and 0 deletions

View File

@ -54,6 +54,8 @@ Device (EC0)
PATC, 8, // Programmable Auxiliary Trip Commit
CHGL, 8, // Charger Current Limit
TBMD, 1, // Tablet mode
Offset (0x0a),
KBLE, 1, // Keyboard Backlight exists
}
#if IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC_ACPI_MEMMAP)

View File

@ -23,6 +23,20 @@ Scope (\_SB)
Name (_HID, "GOOG0002")
Name (_UID, 1)
/* Ask EC if we even have a backlight
* Return 0xf (present, enabled, show in UI, functioning) or 0
*
* With older EC codebases that don't support the Device
* Features bitfield, this reports the keyboard backlight as
* enabled since reads to undefined addresses in EC address
* space return 0xff and so KBLE will be 1.
*/
Method (_STA, 0, NotSerialized)
{
Multiply (0xf, \_SB.PCI0.LPCB.EC0.KBLE, Local0)
Return (Local0)
}
/* Read current backlight value */
Method (KBQC, 0, NotSerialized)
{