From: sashiko-bot@kernel.org
To: "Nikolay Plastinin" <plaztininikolai@gmail.com>
Cc: linux-leds@vger.kernel.org, lee@kernel.org
Subject: Re: [PATCH v4 2/2] leds: trigger: input-events: Restore previous brightness on input
Date: Fri, 30 Oct 2026 14:00:19 +0000 [thread overview]
Message-ID: <sashiko-outbox-191086@kernel.org> (raw)
In-Reply-To: <20261030-leds-input-events-brightness-v4-2-5ea0ead7480c@gmail.com>
> From: Nikolay Plastinin <plaztininikolai@gmail.com>
>
> The trigger turns the LEDs back on with LED_FULL, which the LED core
> clamps to max_brightness. For keyboard backlights with several levels,
> such as asus::kbd_backlight, this means the backlight always comes back
> at maximum after being idle instead of at the level the user picked.
>
> Remember the brightness per LED before turning it off and restore it on
> the next input event. Keep the level in a per-LED state struct allocated
> in activate() and freed in deactivate(), converting the simple trigger
> to a regular trigger. Pick up brightness changes made while the LED is
> on before saving the level again.
>
> Use led_trigger_for_each_led() under guard(rcu)() for both the on and
> off paths. Skip LEDs whose activate() callback has not set up their
> state yet.
>
> Clear trigger_data under the same lock used by the LED walker before
> freeing the per-LED state. Although normal trigger removal waits for an
> RCU grace period, the device_add_groups() error path calls deactivate()
> while the LED is still linked, so a walker must see NULL after teardown.
>
> The previous revision was tested on an ASUS ROG Flow X13 GV302XV:
> keyboard backlight levels 1 and 2 were restored after idle timeout and
> keyboard input, and 20 trigger activate/deactivate cycles completed
> successfully.
>
> Assisted-by: LLM
> Signed-off-by: Nikolay Plastinin <plaztininikolai@gmail.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261030-leds-input-events-brightness-v4-0-5ea0ead7480c@gmail.com?part=2
prev parent reply other threads:[~2026-10-30 14:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 13:51 [PATCH v4 0/2] leds: trigger: input-events: Restore previous brightness on input Nikolay Plastinin via B4 Relay
2026-10-30 13:51 ` Nikolay Plastinin
2026-10-30 13:51 ` [PATCH v4 1/2] leds: triggers: Add led_trigger_for_each_led() Nikolay Plastinin via B4 Relay
2026-10-30 13:51 ` Nikolay Plastinin
2026-10-30 13:54 ` sashiko-bot
2026-10-30 13:51 ` [PATCH v4 2/2] leds: trigger: input-events: Restore previous brightness on input Nikolay Plastinin via B4 Relay
2026-10-30 13:51 ` Nikolay Plastinin
2026-10-30 14:00 ` sashiko-bot [this message]
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=sashiko-outbox-191086@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=lee@kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=plaztininikolai@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.