[PATCH] ALSA: hda: Skip creating captures in SOF context
From: Kai-Heng Feng
Date: Tue Jul 19 2022 - 10:48:48 EST
On HP laptops that use SOF driver for DMIC, the micmute LED doesn't
light up when mic is muted after commit 9b014266ef8a ("ASoC: SOF:
topology: use new sound control LED layer").
The micmute LED itself is still working via sysfs, but it doesn't follow
mute anymore. That's because unlike vendors like Dell and Lenovo, HP
laptops use HDA codec to control mute LEDs instead of ACPI. So on HP
laptops, both SOF and HDA create captures with
SNDRV_CTL_ELEM_ACCESS_MIC_LED access, snd_ctl_led_set_state() considers
there are two different kcontrols and one of them is not muted.
So skip creating captures for HDA when it's called from SOF, the
captures are already handled by SOF.
Cc: Jaroslav Kysela <perex@xxxxxxxx>
Cc: Bard Liao <yung-chuan.liao@xxxxxxxxxxxxxxx>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx>
Signed-off-by: Kai-Heng Feng <kai.heng.feng@xxxxxxxxxxxxx>
---
sound/pci/hda/hda_generic.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index fc114e5224806..2a6c1a77c49ac 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -5075,10 +5075,14 @@ int snd_hda_gen_parse_auto_config(struct hda_codec *codec,
return err;
}
-
- err = create_capture_mixers(codec);
- if (err < 0)
- return err;
+ /* Skip creating capture on SOF which creates captures based on
+ * topology file.
+ */
+ if (codec->core.type != HDA_DEV_ASOC) {
+ err = create_capture_mixers(codec);
+ if (err < 0)
+ return err;
+ }
err = parse_mic_boost(codec);
if (err < 0)
--
2.36.1