Linux LED subsystem development
 help / color / mirror / Atom feed
* [PATCH v6 0/6] platform/x86: thinkpad_acpi: Add a keyboard backlight auto-mode trigger
@ 2026-12-03 12:06 Qiling Zhu
  2026-12-03 12:06 ` [PATCH v6 1/6] platform/x86: thinkpad_acpi: Report auto keyboard backlight mode as off Qiling Zhu
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Qiling Zhu @ 2026-12-03 12:06 UTC (permalink / raw)
  To: Mark Pearson, Derek J. Clark, Rong Zhang, Hans de Goede,
	Ilpo Järvinen, Henrique de Moraes Holschuh
  Cc: platform-driver-x86, linux-kernel, ibm-acpi-devel, Lee Jones,
	Pavel Machek, Griffin Kroah-Hartman, linux-leds, vishnuocv,
	vsankar, Andrea Rabbaglietti

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-12-03 12:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 12:06 [PATCH v6 0/6] platform/x86: thinkpad_acpi: Add a keyboard backlight auto-mode trigger Qiling Zhu
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:50   ` sashiko-bot
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
2026-12-03 12:50   ` sashiko-bot
2026-12-03 12:50 ` [PATCH v6 0/6] " sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox