Re: [PATCH v5 5/6] platform/x86: thinkpad_acpi: Detect auto-mode capability via MLCG
From: Ilpo Järvinen
Date: Tue Dec 01 2026 - 08:04:45 EST
On Mon, 30 Nov 2026, Qiling Zhu wrote:
> 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>
> Reviewed-by: Mark Pearson <mpearson-lenovo@xxxxxxxxx>
> ---
> drivers/platform/x86/lenovo/thinkpad_acpi.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/platform/x86/lenovo/thinkpad_acpi.c b/drivers/platform/x86/lenovo/thinkpad_acpi.c
> index 764b1efa6..c81f36775 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,9 @@ static bool kbdlight_is_supported(void)
> }
>
> vdbg_printk(TPACPI_DBG_INIT, "kbdlight MLCG returned 0x%x\n", status);
> +
> + tp_features.kbdlight_auto = !!(status & BIT(TPACPI_KBD_LIGHT_AUTO_CAPABLE_BIT));
Why the BIT() isn't in the define?
> +
> /*
> * Guessed test for keyboard backlight:
> *
>
--
i.