From: Qiling Zhu <kmatzkaczor244@gmail.com>
To: "Mark Pearson" <mpearson-lenovo@squebb.ca>,
"Derek J. Clark" <derekjohn.clark@gmail.com>,
"Rong Zhang" <i@rong.moe>, "Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Henrique de Moraes Holschuh" <hmh@hmh.eng.br>
Cc: platform-driver-x86@vger.kernel.org,
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: [PATCH v6 0/6] platform/x86: thinkpad_acpi: Add a keyboard backlight auto-mode trigger
Date: Thu, 3 Dec 2026 20:06:58 +0800 [thread overview]
Message-ID: <20261203120704.41431-1-kmatzkaczor244@gmail.com> (raw)
Hi all,
On supported ThinkPads, Fn+Space can select automatic keyboard
backlight control. This series exposes that mode through the private
LED trigger "tpacpi-kbd-auto", following the hw control trigger
framework and its ideapad-laptop example. The first patch fixes an
out-of-range brightness value that was reported to make UPower stop
tracking hotkey changes on a ThinkPad X9-14 Gen 1.
The patches:
1/6 Report auto keyboard backlight mode as off (stable)
2/6 Extract kbdlight notify helpers (refactor)
3/6 Don't poke keyboard backlight's LED core brightness (writes)
4/6 Restore keyboard backlight level ourselves (sleep/wake)
5/6 Detect auto-mode capability via MLCG (groundwork)
6/6 Add a keyboard backlight auto-mode trigger (feature)
A few notes on the design:
- The auto mode is EC level 3 and not a brightness, so it is reported
as 0 to the LED core. The trigger is registered when MLCG bit 20
says the EC supports the auto mode, and it is attached by default if
the EC is already in auto mode when the driver loads.
- 4/6 drops kbdlight_suspend() and has kbdlight_resume() write the
cached EC level back on every model: with thinkpad_acpi unloaded,
the firmware turned the backlight off for s2idle and hibernation on
my machine, and the EC came back at its previous level after s2idle
and at 0 after hibernation. No LED_SUSPENDED gate is kept: this LED
does not set LED_CORE_SUSPENDRESUME, and with the suspend callback
gone I do not see what would set the flag for it. With 1/6 on its
own, a backlight that went to sleep in auto mode comes back off
after resume on kernels that still use the LED core suspend/resume
path; the rest of the series restores the level the EC had.
- kbdlight_brightness now holds the raw EC level, including the auto
mode, rather than a brightness; a comment above the variable says
so, and the name is unchanged.
Changes since v5:
- 5/6 defines TPACPI_KBD_LIGHT_AUTO_CAPABLE_BIT with BIT(), as Ilpo
suggested; the name is kept. No other code change, and the
Reviewed-by tags are unchanged. Sent following Ilpo's suggestion on
the timing.
Changes since v4, in short: 2/6 now contains the changes to the notify
helpers that 4/6 used to make, 4/6 shrank accordingly, and 5/6 dropped
a redundant comment. Details are in the v5 thread:
https://lore.kernel.org/r/20261130131252.80436-1-kmatzkaczor244@gmail.com/
Testing was done on a ThinkPad X1 Carbon Gen 14 (linux-next
next-20261030): the software paths, the trigger following Fn+Space in
and out of auto mode, and suspend/resume from manual levels and from
auto mode. S3-capable models and other models are still untested, and
testing there would be very welcome. One observation from testing
with a desktop session: KDE's power management can write back the
keyboard brightness it last knew about after resume, so a level
written directly through sysfs may be replaced by it. The series also
applies cleanly to the current linux-next.
The checkpatch.pl --strict warnings I see are for three commit IDs that
are missing from my shallow clone.
This series was developed with LLM assistance; I reviewed every design
decision against the framework sources and validated the behavior on
real hardware myself.
Thank you all for your time and for the reviews of the earlier
versions.
Regards,
Qiling Zhu
Qiling Zhu (6):
platform/x86: thinkpad_acpi: Report auto keyboard backlight mode as
off
platform/x86: thinkpad_acpi: Extract kbdlight notify helpers
platform/x86: thinkpad_acpi: Don't poke keyboard backlight's LED core
brightness
platform/x86: thinkpad_acpi: Restore keyboard backlight level
ourselves
platform/x86: thinkpad_acpi: Detect auto-mode capability via MLCG
platform/x86: thinkpad_acpi: Add a keyboard backlight auto-mode
trigger
drivers/platform/x86/lenovo/Kconfig | 1 +
drivers/platform/x86/lenovo/thinkpad_acpi.c | 183 +++++++++++++++-----
2 files changed, 142 insertions(+), 42 deletions(-)
base-commit: 7649ba73f9e7e1e04d0b46213e39c79ae09dd55c
--
2.56.1
next reply other threads:[~2026-12-03 12:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 12:06 Qiling Zhu [this message]
2026-12-03 12:06 ` [PATCH v6 1/6] platform/x86: thinkpad_acpi: Report auto keyboard backlight mode as off Qiling Zhu
2026-12-03 12:07 ` [PATCH v6 2/6] platform/x86: thinkpad_acpi: Extract kbdlight notify helpers Qiling Zhu
2026-12-03 12:07 ` [PATCH v6 3/6] platform/x86: thinkpad_acpi: Don't poke keyboard backlight's LED core brightness Qiling Zhu
2026-12-03 12:07 ` [PATCH v6 4/6] platform/x86: thinkpad_acpi: Restore keyboard backlight level ourselves Qiling Zhu
2026-12-03 12:07 ` [PATCH v6 5/6] platform/x86: thinkpad_acpi: Detect auto-mode capability via MLCG Qiling Zhu
2026-12-03 12:07 ` [PATCH v6 6/6] platform/x86: thinkpad_acpi: Add a keyboard backlight auto-mode trigger Qiling Zhu
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=20261203120704.41431-1-kmatzkaczor244@gmail.com \
--to=kmatzkaczor244@gmail.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=ilpo.jarvinen@linux.intel.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®