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 leds: flash: Add devm_* functions to the flash class 2019-11-03 17:38:36 +01:00
led-class-multicolor.c leds: multicolor: Introduce a multicolor class definition 2020-07-22 14:41:29 +02:00
led-class.c leds: class: The -ENOTSUPP should never be seen by user space 2021-07-14 16:56:39 +02:00
led-core.c leds: disallow /sys/class/leds/*:multi:* for now 2020-08-03 14:00:06 +02:00
led-triggers.c leds: trigger: fix potential deadlock with libata 2021-02-03 23:28:41 +01:00
leds-88pm860x.c leds: various: use only available OF children 2020-09-26 21:56:39 +02:00
leds-aat1290.c leds: various: use dev_of_node(dev) instead of dev->of_node 2020-09-26 21:56:39 +02:00
leds-acer-a500.c leds: Add driver for Acer Iconia Tab A500 2020-09-26 21:56:42 +02:00
leds-adp5520.c
leds-an30259a.c leds: parse linux,default-trigger DT property in LED core 2020-09-26 21:56:43 +02:00
leds-apu.c
leds-ariel.c leds: ariel: Add driver for status LEDs on Dell Wyse 3020 2020-04-27 11:35:11 +02:00
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: parse linux,default-trigger DT property in LED core 2020-09-26 21:56:43 +02:00
leds-bcm6328.c leds: parse linux,default-trigger DT property in LED core 2020-09-26 21:56:43 +02:00
leds-bcm6358.c leds: parse linux,default-trigger DT property in LED core 2020-09-26 21:56:43 +02:00
leds-bd2802.c leds: leds-bd2802: remove set but not used variable 'pdata' 2020-02-26 14:34:55 +01:00
leds-blinkm.c
leds-clevo-mail.c
leds-cobalt-qube.c
leds-cobalt-raq.c
leds-cpcap.c leds: various: use device_get_match_data 2020-09-26 21:56:39 +02:00
leds-cr0014114.c leds: parse linux,default-trigger DT property in LED core 2020-09-26 21:56:43 +02:00
leds-da903x.c leds: da903x: fix use-after-free on unbind 2020-06-22 10:37:58 +02:00
leds-da9052.c
leds-dac124s085.c
leds-el15203000.c leds: parse linux,default-trigger DT property in LED core 2020-09-26 21:56:43 +02:00
leds-fsg.c
leds-gpio-register.c
leds-gpio.c leds: parse linux,default-trigger DT property in LED core 2020-09-26 21:56:43 +02:00
leds-hp6xx.c
leds-ip30.c leds: ip30: compile if COMPILE_TEST=y 2020-09-26 21:56:38 +02:00
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: various: use only available OF children 2020-09-26 21:56:39 +02:00
leds-ktd2692.c leds: ktd2692: Fix an error handling path 2021-07-14 16:56:48 +02:00
leds-lm355x.c leds: drop redundant struct-device pointer casts 2020-06-22 10:38:00 +02:00
leds-lm3530.c
leds-lm3532.c leds: lm3532: Fix warnings for undefined parameters 2020-09-30 18:53:28 +02:00
leds-lm3533.c leds: lm3533: fix use-after-free on unbind 2020-06-22 10:37:59 +02:00
leds-lm3601x.c leds: Replace HTTP links with HTTPS ones 2020-07-22 14:48:40 +02:00
leds-lm3642.c leds: drop redundant struct-device pointer casts 2020-06-22 10:38:00 +02:00
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: various: fix OF node leaks 2020-09-26 21:56:39 +02:00
leds-lp55xx-common.h leds: lp55xx: Add multicolor framework support to lp55xx 2020-07-22 14:42:06 +02:00
leds-lp3944.c
leds-lp3952.c leds: lp3952: Include the right header 2020-04-17 14:49:22 +02:00
leds-lp5521.c leds: various: use dev_of_node(dev) instead of dev->of_node 2020-09-26 21:56:39 +02:00
leds-lp5523.c leds: lp5523: check return value of lp5xx_read and jump to cleanup code 2021-05-26 12:06:56 +02:00
leds-lp5562.c leds: various: use dev_of_node(dev) instead of dev->of_node 2020-09-26 21:56:39 +02:00
leds-lp8501.c leds: various: use dev_of_node(dev) instead of dev->of_node 2020-09-26 21:56:39 +02:00
leds-lp8788.c
leds-lp8860.c leds: parse linux,default-trigger DT property in LED core 2020-09-26 21:56:43 +02:00
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: parse linux,default-trigger DT property in LED core 2020-09-26 21:56:43 +02:00
leds-max77693.c leds: various: use dev_of_node(dev) instead of dev->of_node 2020-09-26 21:56:39 +02:00
leds-mc13783.c leds: various: use only available OF children 2020-09-26 21:56:39 +02:00
leds-menf21bmc.c
leds-mlxcpld.c
leds-mlxreg.c leds: mlxreg: Fix possible buffer overflow 2019-11-03 17:39:00 +01:00
leds-mt6323.c leds: parse linux,default-trigger DT property in LED core 2020-09-26 21:56:43 +02:00
leds-net48xx.c
leds-netxbig.c leds: netxbig: add missing put_device() call in netxbig_leds_get_of_pdata() 2020-12-30 11:53:21 +01:00
leds-nic78bx.c
leds-ns2.c leds: ns2: do not guard OF match pointer with of_match_ptr 2020-09-30 19:22:58 +02:00
leds-ot200.c
leds-pca955x.c leds: pca955x: Add an IBM software implementation of the PCA9552 chip 2020-08-17 22:24:21 +02:00
leds-pca963x.c leds: pca963x: use struct led_init_data when registering 2020-09-30 19:15:42 +02:00
leds-pca9532.c leds: pca9532: read pwm settings from device tree 2020-09-30 18:53:28 +02:00
leds-pm8058.c leds: parse linux,default-trigger DT property in LED core 2020-09-26 21:56:43 +02:00
leds-powernv.c leds: various: use only available OF children 2020-09-26 21:56:39 +02:00
leds-pwm.c leds: pwm: Remove platform_data support 2020-10-07 12:02:58 +02:00
leds-rb532.c leds: rb532: cleanup whitespace 2020-01-02 22:41:53 +01:00
leds-regulator.c
leds-s3c24xx.c leds: s3c24xx: Remove unused machine header include 2020-08-17 18:04:06 +02:00
leds-sc27xx-bltc.c leds: various: use only available OF children 2020-09-26 21:56:39 +02:00
leds-sgm3140.c leds: sgm3140: Simplify with dev_err_probe() 2020-09-09 11:20:09 +02:00
leds-spi-byte.c leds: various: use only available OF children 2020-09-26 21:56:39 +02:00
leds-ss4200.c
leds-sunfire.c
leds-syscon.c leds: parse linux,default-trigger DT property in LED core 2020-09-26 21:56:43 +02:00
leds-tca6507.c leds: tca6507: remove binding comment 2020-09-30 19:15:41 +02:00
leds-ti-lmu-common.c leds: ti-lmu-common: Move static keyword to the front of declaration 2019-09-03 20:34:46 +02:00
leds-tlc591xx.c leds: tlc591xx: fix return value check in tlc591xx_probe() 2021-07-20 16:05:37 +02:00
leds-tps6105x.c leds: tps6105x: add driver for MFD chip LED mode 2019-12-21 20:10:02 +01:00
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: wm831x-status: fix use-after-free on unbind 2020-06-22 10:38:00 +02:00
leds-wm8350.c
leds-wrap.c
leds.h leds: remove PAGE_SIZE limit of /sys/class/leds/<led>/trigger 2019-11-03 17:38:14 +01:00
Makefile leds: Add driver for Acer Iconia Tab A500 2020-09-26 21:56:42 +02:00
TODO leds: TODO: Add documentation about possible subsystem improvements 2020-09-30 19:15:33 +02:00
uleds.c