From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Qiling Zhu <kmatzkaczor244@gmail.com>
Cc: Mark Pearson <mpearson-lenovo@squebb.ca>,
"Derek J. Clark" <derekjohn.clark@gmail.com>,
Rong Zhang <i@rong.moe>, Hans de Goede <hansg@kernel.org>,
Henrique de Moraes Holschuh <hmh@hmh.eng.br>,
platform-driver-x86@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
ibm-acpi-devel@lists.sourceforge.net, Lee Jones <lee@kernel.org>,
Pavel Machek <pavel@kernel.org>,
Griffin Kroah-Hartman <griffin@kroah.com>,
linux-leds@vger.kernel.org, vishnuocv@gmail.com,
vsankar@lenovo.com,
Andrea Rabbaglietti <rabbagliettiandrea@gmail.com>
Subject: Re: [PATCH v5 5/6] platform/x86: thinkpad_acpi: Detect auto-mode capability via MLCG
Date: Wed, 2 Dec 2026 15:13:37 +0200 (EET) [thread overview]
Message-ID: <5a82a4a4-eab5-3b68-04ce-f9bde0ce4a2d@linux.intel.com> (raw)
In-Reply-To: <aw_XpBOR3VTN8u6m@ThinkPad>
[-- Attachment #1: Type: text/plain, Size: 4010 bytes --]
On Wed, 2 Dec 2026, Qiling Zhu wrote:
> 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@mail.gmail.com
> > > Signed-off-by: Qiling Zhu <kmatzkaczor244@gmail.com>
> > > Reviewed-by: Rong Zhang <i@rong.moe>
> > > Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
> > > ---
> > > 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.
I'm okay with keeping _BIT in the name because it seems to be used by
many case in this driver. That being said, "BIT", "MASK", or "ENABLE"
postfixes rarely add any value over just naming what it is about when it
comes to understanding the code.
What they surely do is they make lines longer but some people seem to love
long lines. In turn I'll then be picky about linesplits being done in
proper places and indentation levels when one wants the pain of long lines
for oneself, I think that's fair. :-)
Some cases may need both BIT() and non-BIT() value, those cannot easily
use BIT() in the define but for other cases placing BIT() already into
the define is preferred way.
> 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.
We're now on -rc5 week, so please consider sending it before -rc7 is
tagged by Linus (one and half week from now) to give me some time to
(possibly) process it in this cycle.
--
i.
next prev parent reply other threads:[~2026-12-02 13:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 13:12 [PATCH v5 0/6] platform/x86: thinkpad_acpi: Add a keyboard backlight auto-mode trigger Qiling Zhu
2026-11-30 13:12 ` [PATCH v5 1/6] platform/x86: thinkpad_acpi: Report auto keyboard backlight mode as off Qiling Zhu
2026-11-30 13:12 ` [PATCH v5 2/6] platform/x86: thinkpad_acpi: Extract kbdlight notify helpers Qiling Zhu
2026-11-30 13:12 ` [PATCH v5 3/6] platform/x86: thinkpad_acpi: Don't poke keyboard backlight's LED core brightness Qiling Zhu
2026-11-30 13:12 ` [PATCH v5 4/6] platform/x86: thinkpad_acpi: Restore keyboard backlight level ourselves Qiling Zhu
2026-11-30 13:12 ` [PATCH v5 5/6] platform/x86: thinkpad_acpi: Detect auto-mode capability via MLCG Qiling Zhu
2026-12-01 13:04 ` Ilpo Järvinen
2026-12-02 8:43 ` Qiling Zhu
2026-12-02 11:54 ` Rong Zhang
2026-12-02 13:13 ` Ilpo Järvinen [this message]
2026-11-30 13:12 ` [PATCH v5 6/6] platform/x86: thinkpad_acpi: Add a keyboard backlight auto-mode trigger Qiling Zhu
2026-11-30 15:04 ` [PATCH v5 0/6] " Lee Jones
2026-11-30 15:46 ` Qiling Zhu
2026-12-01 11:19 ` Lee Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5a82a4a4-eab5-3b68-04ce-f9bde0ce4a2d@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=derekjohn.clark@gmail.com \
--cc=griffin@kroah.com \
--cc=hansg@kernel.org \
--cc=hmh@hmh.eng.br \
--cc=i@rong.moe \
--cc=ibm-acpi-devel@lists.sourceforge.net \
--cc=kmatzkaczor244@gmail.com \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=mpearson-lenovo@squebb.ca \
--cc=pavel@kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rabbagliettiandrea@gmail.com \
--cc=vishnuocv@gmail.com \
--cc=vsankar@lenovo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®