kernel_optimize_test/drivers/leds
Hans de Goede a7dd8b778a 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>
2021-09-15 09:50:36 +02:00
..
trigger leds: trigger: audio: Add an activate callback to ensure the initial brightness is set 2021-09-15 09:50:36 +02:00
Kconfig leds: lm3532: select regmap I2C API 2021-07-14 16:56:39 +02:00
led-class-flash.c
led-class-multicolor.c
led-class.c
led-core.c
led-triggers.c
leds-88pm860x.c
leds-aat1290.c
leds-acer-a500.c
leds-adp5520.c
leds-an30259a.c
leds-apu.c
leds-ariel.c
leds-as3645a.c leds: as3645a: Fix error return code in as3645a_parse_node() 2021-07-14 16:56:48 +02:00
leds-asic3.c
leds-aw2013.c
leds-bcm6328.c
leds-bcm6358.c
leds-bd2802.c
leds-blinkm.c
leds-clevo-mail.c
leds-cobalt-qube.c
leds-cobalt-raq.c
leds-cpcap.c
leds-cr0014114.c
leds-da903x.c
leds-da9052.c
leds-dac124s085.c
leds-el15203000.c
leds-fsg.c
leds-gpio-register.c
leds-gpio.c
leds-hp6xx.c
leds-ip30.c
leds-ipaq-micro.c
leds-is31fl32xx.c leds: is31fl32xx: Fix missing error code in is31fl32xx_parse_dt() 2021-09-15 09:50:31 +02:00
leds-is31fl319x.c
leds-ktd2692.c leds: ktd2692: Fix an error handling path 2021-07-14 16:56:48 +02:00
leds-lm355x.c
leds-lm3530.c
leds-lm3532.c
leds-lm3533.c
leds-lm3601x.c
leds-lm3642.c
leds-lm3692x.c leds: lm3692x: Put fwnode in any case during ->probe() 2021-07-14 16:56:40 +02:00
leds-lm3697.c leds: lm3697: Don't spam logs when probe is deferred 2021-07-14 16:56:40 +02:00
leds-lm36274.c leds: lm36274: Put fwnode in error case during ->probe() 2021-07-14 16:56:39 +02:00
leds-locomo.c
leds-lp50xx.c leds: lp50xx: Put fwnode in error case during ->probe() 2021-07-14 16:56:40 +02:00
leds-lp55xx-common.c
leds-lp55xx-common.h
leds-lp3944.c
leds-lp3952.c
leds-lp5521.c
leds-lp5523.c
leds-lp5562.c
leds-lp8501.c
leds-lp8788.c
leds-lp8860.c
leds-lt3593.c leds: lt3593: Put fwnode in any case during ->probe() 2021-09-15 09:50:36 +02:00
leds-max8997.c
leds-max77650.c
leds-max77693.c
leds-mc13783.c
leds-menf21bmc.c
leds-mlxcpld.c
leds-mlxreg.c
leds-mt6323.c
leds-net48xx.c
leds-netxbig.c
leds-nic78bx.c
leds-ns2.c
leds-ot200.c
leds-pca955x.c
leds-pca963x.c
leds-pca9532.c
leds-pm8058.c
leds-powernv.c
leds-pwm.c
leds-rb532.c
leds-regulator.c
leds-s3c24xx.c
leds-sc27xx-bltc.c
leds-sgm3140.c
leds-spi-byte.c
leds-ss4200.c
leds-sunfire.c
leds-syscon.c
leds-tca6507.c
leds-ti-lmu-common.c
leds-tlc591xx.c leds: tlc591xx: fix return value check in tlc591xx_probe() 2021-07-20 16:05:37 +02:00
leds-tps6105x.c
leds-turris-omnia.c leds: turris-omnia: add missing MODULE_DEVICE_TABLE 2021-07-20 16:05:45 +02:00
leds-wm831x-status.c
leds-wm8350.c
leds-wrap.c
leds.h
Makefile
TODO
uleds.c