drivers/intel/gma: Cache brightness level

Cache the brightness level requested via _BCM and return it from XBQC
while the IGD OpRegion registers are still zeroed during S3 resume.
Once BCLM is valid we refresh the cache with the hardware reading.
This keeps _BQC from reporting zero after resume.

Change-Id: I3f06c9cf6529da6d634d7b0368f0c88b468f0c45
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/89986
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Sean Rhodes 2025-11-10 21:34:50 +00:00 committed by Matt DeVillier
commit 2e96a71e6f

View file

@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
Name (BRLV, 100)
/*
* Pseudo device that contains methods to modify Opregion
* "Mailbox 3 BIOS to Driver Notification"
@ -147,6 +148,7 @@
Method (XBCM, 1, NotSerialized)
{
BRLV = Arg0
If (^BOX3.XBCM (Arg0) == Ones)
{
/*
@ -163,9 +165,16 @@
Method (XBQC, 0, NotSerialized)
{
/*
* Always query the hardware directly. Not all OS drivers
* keep CBLV up to date (one is Linux' i915). Some years
* after that is fixed we can probably use CBLV?
* During early boot / resume the IGD driver has not yet populated
* the OpRegion brightness fields (BCLM stays zero), so fall back to
* the cached value we last exposed to the OS.
*/
Return (^LEGA.XBQC ())
If (BCLM == 0)
{
Return (BRLV)
}
Local0 = ^LEGA.XBQC ()
BRLV = Local0
Return (Local0)
}