diff options
author | Takashi Iwai <tiwai@suse.de> | 2020-06-18 13:08:38 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2020-06-18 13:23:49 +0200 |
commit | 8d3d1ece311837591341544e458b2dd9628fe6e0 (patch) | |
tree | 39172249b58dbee0a33f6f5226c76b0e73dfcb57 /sound/pci/hda/thinkpad_helper.c | |
parent | 15509b6344726de22bdbfff88b65341dd0dd33af (diff) |
ALSA: hda/realtek: Use the new vmaster mute LED helper
Convert the mute LED handling in Realtek codec to the new vmaster mute
helper. A point to be cautiously handled is that the value passed to
the callback is inverted; the vmaster passes "enabled" (0 = mute),
while LED classdev passes "brightness" (1 = mute).
The code in Thinkpad helper is also converted. In that case, just
call the new function and remove the open-code.
Tested-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Link: https://lore.kernel.org/r/20200618110842.27238-10-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/thinkpad_helper.c')
-rw-r--r-- | sound/pci/hda/thinkpad_helper.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/sound/pci/hda/thinkpad_helper.c b/sound/pci/hda/thinkpad_helper.c index cd14d5a55b42..6698ae241efc 100644 --- a/sound/pci/hda/thinkpad_helper.c +++ b/sound/pci/hda/thinkpad_helper.c @@ -3,13 +3,11 @@ * to be included from codec driver */ -#if IS_ENABLED(CONFIG_THINKPAD_ACPI) && IS_REACHABLE(CONFIG_LEDS_TRIGGER_AUDIO) +#if IS_ENABLED(CONFIG_THINKPAD_ACPI) #include <linux/acpi.h> #include <linux/leds.h> -static void (*old_vmaster_hook)(void *, int); - static bool is_thinkpad(struct hda_codec *codec) { return (codec->core.subsystem_id >> 16 == 0x17aa) && @@ -17,24 +15,13 @@ static bool is_thinkpad(struct hda_codec *codec) acpi_dev_found("IBM0068")); } -static void update_tpacpi_mute_led(void *private_data, int enabled) -{ - if (old_vmaster_hook) - old_vmaster_hook(private_data, enabled); - - ledtrig_audio_set(LED_AUDIO_MUTE, enabled ? LED_OFF : LED_ON); -} - static void hda_fixup_thinkpad_acpi(struct hda_codec *codec, const struct hda_fixup *fix, int action) { - struct hda_gen_spec *spec = codec->spec; - if (action == HDA_FIXUP_ACT_PROBE) { if (!is_thinkpad(codec)) return; - old_vmaster_hook = spec->vmaster_mute.hook; - spec->vmaster_mute.hook = update_tpacpi_mute_led; + snd_hda_gen_add_mute_led_cdev(codec, NULL); snd_hda_gen_add_micmute_led_cdev(codec, NULL); } } |