Re: [PATCH v5 5/6] platform/x86: thinkpad_acpi: Detect auto-mode capability via MLCG
From: Rong Zhang
Date: Wed Dec 02 2026 - 07:01:00 EST
Hi Qiling,
On Wed, 2026-12-02 at 16:43 +0800, Qiling Zhu wrote:
> Hi Ilpo,
>
> On Tue, Dec 01, 2026 at 03:04:31PM +0200, Ilpo Järvinen wrote:
> > 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?
>
> I kept it as a plain number to match TPACPI_KBD_LIGHT_AUTO_LEVEL right
> above it, so that both constants read as integers, but I see the point
> of having the define carry the mask. Happy to change it; the result
> would be:
>
> /* MLCG bit that indicates whether the EC supports the auto mode */
> #define TPACPI_KBD_LIGHT_AUTO_CAPABLE_BIT BIT(20)
>
> ...
>
> tp_features.kbdlight_auto = !!(status & TPACPI_KBD_LIGHT_AUTO_CAPABLE_BIT);
>
> I left the name as it is, following DPRC_WWAN_ANTENNA_TYPE_A_BIT and
> USCS_CAP_BIT elsewhere in the file, whose values are masks too. If you
> would rather see a different name, that is easy to do.
Yeah, I agree that defining a BIT() will be neater.
>
> My plan is to wait another week or two for further comments and then
> send the next version with everything together. If that timing does
> not suit you, just say so and I will go with whatever timing works
> best for you.
If you've collected enough reviews you can respin the series slightly
more frequently. It's also OK to wait another week given the timing in
this cycle.
Thanks,
Rong
>
> Regards,
> Qiling