linux_dsm_epyc7002/drivers/leds/trigger
Hans de Goede 69cb52f9e0 leds: trigger: audio: Add an activate callback to ensure the initial brightness is set
[ Upstream commit 64f67b5240db79eceb0bd57dae8e591fd3103ba0 ]

Some 2-in-1s with a detachable (USB) keyboard(dock) have mute-LEDs in
the speaker- and/or mic-mute keys on the keyboard.

Examples of this are the Lenovo Thinkpad10 tablet (with its USB kbd-dock)
and the HP x2 10 series.

The detachable nature of these keyboards means that the keyboard and
thus the mute LEDs may show up after the user (or userspace restoring
old mixer settings) has muted the speaker and/or mic.

Current LED-class devices with a default_trigger of "audio-mute" or
"audio-micmute" initialize the brightness member of led_classdev with
ledtrig_audio_get() before registering the LED.

This makes the software state after attaching the keyboard match the
actual audio mute state, e.g. cat /sys/class/leds/foo/brightness will
show the right value.

But before this commit nothing was actually calling the led_classdev's
brightness_set[_blocking] callback so the value returned by
ledtrig_audio_get() was never actually being sent to the hw, leading
to the mute LEDs staying in their default power-on state, after
attaching the keyboard, even if ledtrig_audio_get() returned a different
state.

This could be fixed by having the individual LED drivers call
brightness_set[_blocking] themselves after registering the LED,
but this really is something which should be done by a led-trigger
activate callback.

Add an activate callback for this, fixing the issue of the
mute LEDs being out of sync after (re)attaching the keyboard.

Cc: Takashi Iwai <tiwai@suse.de>
Fixes: faa2541f5b ("leds: trigger: Introduce audio mute LED trigger")
Reviewed-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-05 19:11:28 +02:00
..
Kconfig LED updates for 5.3-rc1 2019-07-09 08:59:39 -07:00
ledtrig-activity.c leds: Use all-in-one vtime aware kcpustat accessor 2019-11-21 07:58:48 +01:00
ledtrig-audio.c leds: trigger: audio: Add an activate callback to ensure the initial brightness is set 2024-07-05 19:11:28 +02:00
ledtrig-backlight.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ledtrig-camera.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ledtrig-cpu.c ledtrig-cpu: Limit to 8 CPUs 2020-09-30 19:15:40 +02:00
ledtrig-default-on.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ledtrig-disk-syno.c init: add dsm gpl source 2024-07-05 18:00:04 +02:00
ledtrig-disk.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ledtrig-gpio.c leds: trigger: gpio: Avoid warning on update of inverted 2020-07-12 10:06:38 +02:00
ledtrig-heartbeat.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ledtrig-mtd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ledtrig-netdev.c leds: trigger: netdev: fix handling on interface rename 2019-11-03 18:10:12 +01:00
ledtrig-oneshot.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ledtrig-panic.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ledtrig-pattern.c leds: pattern trigger -- check pattern for validity 2020-07-24 12:43:57 +02:00
ledtrig-timer.c leds: trigger: remove redundant assignment to variable ret 2020-04-27 14:13:12 +02:00
ledtrig-transient.c docs: leds: convert to ReST 2019-06-28 20:57:31 +02:00
Makefile init: add dsm gpl source 2024-07-05 18:00:04 +02:00
syno_ledtrig.c init: add dsm gpl source 2024-07-05 18:00:04 +02:00