summaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2020-06-18 13:08:31 +0200
committerTakashi Iwai <tiwai@suse.de>2020-06-18 13:22:40 +0200
commit7cdf8c49b1df0a385db06c4f9a5ba1b16510fdcc (patch)
treeeb1bdfcc75b8baf62a475a3daaaad8e70a9189e6 /sound/pci/hda/patch_realtek.c
parentALSA: hda: generic: Always call led-trigger for mic mute LED (diff)
downloadlinux-7cdf8c49b1df0a385db06c4f9a5ba1b16510fdcc.tar.xz
linux-7cdf8c49b1df0a385db06c4f9a5ba1b16510fdcc.zip
ALSA: hda: generic: Add a helper for mic-mute LED with LED classdev
A new helper, snd_hda_gen_add_micmute_led_cdev(), is introduced here for creating a LED classdev and setting up the hook to the capture control for controlling the mic-mute LED to follow the capture switch change. This will replace the existing users of snd_hda_gen_add_micmute_led() in later patches. Also, introduce a new kconfig CONFIG_SND_HDA_GENERIC_LEDS, to indicate the usage of mute / mic-mute LED helpers. It's selected by the codec drivers (Realtek, Conexant and Sigmatel), while it selects the necessary LED class dependencies. Tested-by: Kai-Heng Feng <kai.heng.feng@canonical.com> Link: https://lore.kernel.org/r/20200618110842.27238-3-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r--sound/pci/hda/patch_realtek.c30
1 files changed, 1 insertions, 29 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 6d73f8beadb6..1d0fe9a0983f 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4100,16 +4100,6 @@ static void alc_fixup_gpio_mute_hook(void *private_data, int enabled)
}
/* turn on/off mic-mute LED via GPIO per capture hook */
-static void alc_gpio_micmute_update(struct hda_codec *codec)
-{
- struct alc_spec *spec = codec->spec;
-
- alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
- spec->micmute_led_polarity,
- spec->gen.micmute_led.led_value);
-}
-
-#if IS_REACHABLE(CONFIG_LEDS_TRIGGER_AUDIO)
static int micmute_led_set(struct led_classdev *led_cdev,
enum led_brightness brightness)
{
@@ -4121,14 +4111,6 @@ static int micmute_led_set(struct led_classdev *led_cdev,
return 0;
}
-static struct led_classdev micmute_led_cdev = {
- .name = "hda::micmute",
- .max_brightness = 1,
- .brightness_set_blocking = micmute_led_set,
- .default_trigger = "audio-micmute",
-};
-#endif
-
/* setup mute and mic-mute GPIO bits, add hooks appropriately */
static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
int action,
@@ -4136,9 +4118,6 @@ static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
unsigned int micmute_mask)
{
struct alc_spec *spec = codec->spec;
-#if IS_REACHABLE(CONFIG_LEDS_TRIGGER_AUDIO)
- int err;
-#endif
alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
@@ -4150,14 +4129,7 @@ static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
}
if (micmute_mask) {
spec->gpio_mic_led_mask = micmute_mask;
- snd_hda_gen_add_micmute_led(codec, alc_gpio_micmute_update);
-
-#if IS_REACHABLE(CONFIG_LEDS_TRIGGER_AUDIO)
- micmute_led_cdev.brightness = ledtrig_audio_get(LED_AUDIO_MICMUTE);
- err = devm_led_classdev_register(&codec->core.dev, &micmute_led_cdev);
- if (err)
- codec_warn(codec, "failed to register micmute LED\n");
-#endif
+ snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
}
}