[PATCH v4 5/6] platform/x86: thinkpad_acpi: Detect auto-mode capability via MLCG

From: Qiling Zhu

Date: Wed Nov 25 2026 - 03:49:15 EST


MLCG bit 20 indicates whether the EC supports the auto mode of the
keyboard backlight (0 = manual levels only, 1 = auto mode available), as
defined by the firmware.

Record it in tp_features.kbdlight_auto, for use when registering the
auto-mode trigger in a subsequent change.

Link: https://lore.kernel.org/r/CABxCQKuEP5wMSstO0MK1MhaqXTKrPhUSN3V2mrE_42j4cXsXZQ@xxxxxxxxxxxxxx
Signed-off-by: Qiling Zhu <kmatzkaczor244@xxxxxxxxx>
Reviewed-by: Rong Zhang <i@xxxxxxxx>

---
Mark Pearson's Reviewed-by was given on the v3 version of this patch,
which tested BIT(20) directly. The symbolic name was added at Rong's
request, so the tag is not carried over.
---
drivers/platform/x86/lenovo/thinkpad_acpi.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/drivers/platform/x86/lenovo/thinkpad_acpi.c b/drivers/platform/x86/lenovo/thinkpad_acpi.c
index 764b1efa6..ee8f7429d 100644
--- a/drivers/platform/x86/lenovo/thinkpad_acpi.c
+++ b/drivers/platform/x86/lenovo/thinkpad_acpi.c
@@ -363,6 +363,7 @@ static struct {
TP_HOTKEY_TABLET_USES_GMMS,
} hotkey_tablet;
u32 kbdlight:1;
+ u32 kbdlight_auto:1;
u32 light:1;
u32 light_status:1;
u32 bright_acpimode:1;
@@ -5105,6 +5106,9 @@ static struct ibm_struct video_driver_data = {
/* EC level that selects the auto mode for the keyboard backlight */
#define TPACPI_KBD_LIGHT_AUTO_LEVEL 3

+/* MLCG bit that indicates whether the EC supports the auto mode */
+#define TPACPI_KBD_LIGHT_AUTO_CAPABLE_BIT 20
+
/*
* Cached EC level, including TPACPI_KBD_LIGHT_AUTO_LEVEL. All state
* tracking compares EC levels; the auto mode is translated to a
@@ -5189,6 +5193,13 @@ static bool kbdlight_is_supported(void)
}

vdbg_printk(TPACPI_DBG_INIT, "kbdlight MLCG returned 0x%x\n", status);
+
+ /*
+ * MLCG bit 20 indicates auto mode support: 0 = manual levels only,
+ * 1 = auto mode available (per the firmware definition).
+ */
+ tp_features.kbdlight_auto = !!(status & BIT(TPACPI_KBD_LIGHT_AUTO_CAPABLE_BIT));
+
/*
* Guessed test for keyboard backlight:
*
--
2.56.1