mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] leds: trigger: input-events: Restore previous brightness on input
@ 2026-09-30  6:54 Nikolay Plastinin via B4 Relay
  2026-09-30  6:54 ` [PATCH v2 1/2] leds: triggers: Add led_trigger_walk_leds() Nikolay Plastinin via B4 Relay
  2026-09-30  6:54 ` [PATCH v2 2/2] leds: trigger: input-events: Restore previous brightness on input Nikolay Plastinin via B4 Relay
  0 siblings, 2 replies; 3+ messages in thread
From: Nikolay Plastinin via B4 Relay @ 2026-09-30  6:54 UTC (permalink / raw)
  To: Lee Jones, Pavel Machek
  Cc: Hans de Goede, linux-leds, linux-kernel, Nikolay Plastinin

The input-events trigger turns LEDs back on with LED_FULL, so a keyboard
backlight with several levels always comes back at maximum after being
idle. This series restores the level the user picked instead.

Patch 1 adds led_trigger_walk_leds() to the LED core, so that a
trigger which needs a different brightness per LED does not have to walk
trig->led_cdevs itself. Patch 2 converts the input-events trigger to a
regular trigger with per-LED state in trigger_data and uses the helper.

This came up while looking at a keyboard backlight idle timeout for ASUS
laptops in asusctl:
https://github.com/OpenGamingCollective/asusctl/issues/98

Tested on an ASUS ROG Flow X13 GV302XV (asus::kbd_backlight, 3 levels)
with the trigger built out of tree against Fedora's 7.2.7 kernel and a
local copy of the helper, since the helper itself lives in the built-in
LED core.

---
Changes in v2:
- Keep the saved brightness in a per-LED struct allocated in activate()
  and freed in deactivate(), stored in led_cdev->trigger_data, instead of
  overloading blink_brightness (Lee Jones).
- Add led_trigger_walk_leds() to led-triggers.c and use it instead of
  walking led_cdevs/trig_list from the trigger (Lee Jones).
- Use the Assisted-by tag format from coding-assistants.rst.
- Link to v1: https://lore.kernel.org/r/20260924-leds-input-events-brightness-v1-1-b0ceff3a2343@gmail.com

---
Nikolay Plastinin (2):
      leds: triggers: Add led_trigger_walk_leds()
      leds: trigger: input-events: Restore previous brightness on input

 drivers/leds/led-triggers.c                 | 25 ++++++++++
 drivers/leds/trigger/ledtrig-input-events.c | 74 ++++++++++++++++++++++++++---
 include/linux/leds.h                        |  7 +++
 3 files changed, 100 insertions(+), 6 deletions(-)
---
base-commit: f475845eaf3d749114a63270bf2efea459e14dd2
change-id: 20260924-leds-input-events-brightness-a76ae9a77b85

Best regards,
-- 
Nikolay Plastinin <plaztininikolai@gmail.com>



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

end of thread, other threads:[~2026-09-30  6:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-30  6:54 [PATCH v2 0/2] leds: trigger: input-events: Restore previous brightness on input Nikolay Plastinin via B4 Relay
2026-09-30  6:54 ` [PATCH v2 1/2] leds: triggers: Add led_trigger_walk_leds() Nikolay Plastinin via B4 Relay
2026-09-30  6:54 ` [PATCH v2 2/2] leds: trigger: input-events: Restore previous brightness on input Nikolay Plastinin via B4 Relay

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®