linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda: Skip creating captures in SOF context
@ 2022-07-19 14:47 Kai-Heng Feng
  2022-07-19 15:41 ` Jaroslav Kysela
  0 siblings, 1 reply; 10+ messages in thread
From: Kai-Heng Feng @ 2022-07-19 14:47 UTC (permalink / raw)
  To: tiwai
  Cc: Kai-Heng Feng, Jaroslav Kysela, Bard Liao, Pierre-Louis Bossart,
	alsa-devel, linux-kernel

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@perex.cz>
Cc: Bard Liao <yung-chuan.liao@linux.intel.com>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] ALSA: hda: Skip creating captures in SOF context
  2022-07-19 14:47 [PATCH] ALSA: hda: Skip creating captures in SOF context Kai-Heng Feng
@ 2022-07-19 15:41 ` Jaroslav Kysela
  2022-07-20  1:45   ` Kai-Heng Feng
  0 siblings, 1 reply; 10+ messages in thread
From: Jaroslav Kysela @ 2022-07-19 15:41 UTC (permalink / raw)
  To: Kai-Heng Feng, tiwai
  Cc: Bard Liao, Pierre-Louis Bossart, alsa-devel, linux-kernel

Dne 19. 07. 22 v 16:47 Kai-Heng Feng napsal(a):
> 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.

It does not mean that it's a wrong behavior. When both controls are muted, the
LED should be turned on. It just requires that all inputs are off (and it may
be the default - probably we can set in UCM or so). If you turn the "Capture
Switch" off in amixer / alsamixer, do things work as expected ?

> So skip creating captures for HDA when it's called from SOF, the
> captures are already handled by SOF.

The capture controls are for other inputs like external analog microphone. If
it is required to suppress the MIC LED for some hardware, just skip the
"spec->mic_mute_led = 1" assignment in hda_generic.c . Also, the check
"codec->core.type != HDA_DEV_ASOC" is not sufficient, because you don't know,
if the topology really sets the MIC LED flag.

					Jaroslav

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ALSA: hda: Skip creating captures in SOF context
  2022-07-19 15:41 ` Jaroslav Kysela
@ 2022-07-20  1:45   ` Kai-Heng Feng
  2022-07-20  6:29     ` Takashi Iwai
  2022-07-20  7:52     ` Jaroslav Kysela
  0 siblings, 2 replies; 10+ messages in thread
From: Kai-Heng Feng @ 2022-07-20  1:45 UTC (permalink / raw)
  To: Jaroslav Kysela
  Cc: tiwai, Bard Liao, Pierre-Louis Bossart, alsa-devel, linux-kernel

On Tue, Jul 19, 2022 at 11:41 PM Jaroslav Kysela <perex@perex.cz> wrote:
>
> Dne 19. 07. 22 v 16:47 Kai-Heng Feng napsal(a):
> > 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.
>
> It does not mean that it's a wrong behavior. When both controls are muted, the
> LED should be turned on. It just requires that all inputs are off (and it may
> be the default - probably we can set in UCM or so). If you turn the "Capture
> Switch" off in amixer / alsamixer, do things work as expected ?

Yes. When all captures are muted the micmute LED is on.

>
> > So skip creating captures for HDA when it's called from SOF, the
> > captures are already handled by SOF.
>
> The capture controls are for other inputs like external analog microphone. If
> it is required to suppress the MIC LED for some hardware, just skip the
> "spec->mic_mute_led = 1" assignment in hda_generic.c . Also, the check
> "codec->core.type != HDA_DEV_ASOC" is not sufficient, because you don't know,
> if the topology really sets the MIC LED flag.

AFAIK the external analog microphone on DMIC laptop is driven by SOF driver too.
If those capture controls are indeed needed for external analog mics,
use UCM to mute them by default won't work either.

Skip "mic_mute_led = 1" can be hard because it's still needed for legacy HDA.
If checking "HDA_DEV_ASOC" isn't sufficient, is it possible to just
check "card" in snd_ctl_led_set_state(), instead of kcontrols?
I think it's reasonable to assume a card has just one speaker LED and
one microphone LED.

Kai-Heng

>
>                                         Jaroslav
>
> --
> Jaroslav Kysela <perex@perex.cz>
> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ALSA: hda: Skip creating captures in SOF context
  2022-07-20  1:45   ` Kai-Heng Feng
@ 2022-07-20  6:29     ` Takashi Iwai
  2022-07-20  7:52     ` Jaroslav Kysela
  1 sibling, 0 replies; 10+ messages in thread
From: Takashi Iwai @ 2022-07-20  6:29 UTC (permalink / raw)
  To: Kai-Heng Feng
  Cc: Jaroslav Kysela, tiwai, Bard Liao, Pierre-Louis Bossart,
	alsa-devel, linux-kernel

On Wed, 20 Jul 2022 03:45:37 +0200,
Kai-Heng Feng wrote:
> 
> On Tue, Jul 19, 2022 at 11:41 PM Jaroslav Kysela <perex@perex.cz> wrote:
> >
> > Dne 19. 07. 22 v 16:47 Kai-Heng Feng napsal(a):
> > > 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.
> >
> > It does not mean that it's a wrong behavior. When both controls are muted, the
> > LED should be turned on. It just requires that all inputs are off (and it may
> > be the default - probably we can set in UCM or so). If you turn the "Capture
> > Switch" off in amixer / alsamixer, do things work as expected ?
> 
> Yes. When all captures are muted the micmute LED is on.
> 
> >
> > > So skip creating captures for HDA when it's called from SOF, the
> > > captures are already handled by SOF.
> >
> > The capture controls are for other inputs like external analog microphone. If
> > it is required to suppress the MIC LED for some hardware, just skip the
> > "spec->mic_mute_led = 1" assignment in hda_generic.c . Also, the check
> > "codec->core.type != HDA_DEV_ASOC" is not sufficient, because you don't know,
> > if the topology really sets the MIC LED flag.
> 
> AFAIK the external analog microphone on DMIC laptop is driven by SOF driver too.
> If those capture controls are indeed needed for external analog mics,
> use UCM to mute them by default won't work either.
> 
> Skip "mic_mute_led = 1" can be hard because it's still needed for legacy HDA.
> If checking "HDA_DEV_ASOC" isn't sufficient, is it possible to just
> check "card" in snd_ctl_led_set_state(), instead of kcontrols?
> I think it's reasonable to assume a card has just one speaker LED and
> one microphone LED.

Hm, but skipping the whole create_capture_mixers() call doesn't sound
right, either.  I thought there are still external mic controls via
codec, and those would be skipped by this patch?

If the mic-mute LED is the problem, it should be rather checked in the
caller of snd_hda_gen_add_micmute_led_cdev(), i.e. patch_realtek.c,
instead, IMO.


thanks,

Takashi

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ALSA: hda: Skip creating captures in SOF context
  2022-07-20  1:45   ` Kai-Heng Feng
  2022-07-20  6:29     ` Takashi Iwai
@ 2022-07-20  7:52     ` Jaroslav Kysela
  2022-07-20 13:31       ` Pierre-Louis Bossart
  1 sibling, 1 reply; 10+ messages in thread
From: Jaroslav Kysela @ 2022-07-20  7:52 UTC (permalink / raw)
  To: Kai-Heng Feng
  Cc: tiwai, Bard Liao, Pierre-Louis Bossart, alsa-devel, linux-kernel

Dne 20. 07. 22 v 3:45 Kai-Heng Feng napsal(a):
> On Tue, Jul 19, 2022 at 11:41 PM Jaroslav Kysela <perex@perex.cz> wrote:
>>
>> Dne 19. 07. 22 v 16:47 Kai-Heng Feng napsal(a):
>>> 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.
>>
>> It does not mean that it's a wrong behavior. When both controls are muted, the
>> LED should be turned on. It just requires that all inputs are off (and it may
>> be the default - probably we can set in UCM or so). If you turn the "Capture
>> Switch" off in amixer / alsamixer, do things work as expected ?
> 
> Yes. When all captures are muted the micmute LED is on.
> 
>>
>>> So skip creating captures for HDA when it's called from SOF, the
>>> captures are already handled by SOF.
>>
>> The capture controls are for other inputs like external analog microphone. If
>> it is required to suppress the MIC LED for some hardware, just skip the
>> "spec->mic_mute_led = 1" assignment in hda_generic.c . Also, the check
>> "codec->core.type != HDA_DEV_ASOC" is not sufficient, because you don't know,
>> if the topology really sets the MIC LED flag.
> 
> AFAIK the external analog microphone on DMIC laptop is driven by SOF driver too.
> If those capture controls are indeed needed for external analog mics,
> use UCM to mute them by default won't work either.

Could you describe this ? I though that only DMIC is handled by SOF when HDA
codec is in the system. There is a separate analog codec for external analog
microphone or the HDA codec is somehow connected to SOF/DSP ? If so, how ?

					Jaroslav

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ALSA: hda: Skip creating captures in SOF context
  2022-07-20  7:52     ` Jaroslav Kysela
@ 2022-07-20 13:31       ` Pierre-Louis Bossart
  2022-08-15  7:55         ` Kai-Heng Feng
  0 siblings, 1 reply; 10+ messages in thread
From: Pierre-Louis Bossart @ 2022-07-20 13:31 UTC (permalink / raw)
  To: Jaroslav Kysela, Kai-Heng Feng; +Cc: tiwai, Bard Liao, alsa-devel, linux-kernel



On 7/20/22 02:52, Jaroslav Kysela wrote:
> Dne 20. 07. 22 v 3:45 Kai-Heng Feng napsal(a):
>> On Tue, Jul 19, 2022 at 11:41 PM Jaroslav Kysela <perex@perex.cz> wrote:
>>>
>>> Dne 19. 07. 22 v 16:47 Kai-Heng Feng napsal(a):
>>>> 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.
>>>
>>> It does not mean that it's a wrong behavior. When both controls are muted, the
>>> LED should be turned on. It just requires that all inputs are off (and it may
>>> be the default - probably we can set in UCM or so). If you turn the "Capture
>>> Switch" off in amixer / alsamixer, do things work as expected ?
>>
>> Yes. When all captures are muted the micmute LED is on.
>>
>>>
>>>> So skip creating captures for HDA when it's called from SOF, the
>>>> captures are already handled by SOF.
>>>
>>> The capture controls are for other inputs like external analog microphone. If
>>> it is required to suppress the MIC LED for some hardware, just skip the
>>> "spec->mic_mute_led = 1" assignment in hda_generic.c . Also, the check
>>> "codec->core.type != HDA_DEV_ASOC" is not sufficient, because you don't know,
>>> if the topology really sets the MIC LED flag.
>>
>> AFAIK the external analog microphone on DMIC laptop is driven by SOF driver too.
>> If those capture controls are indeed needed for external analog mics,
>> use UCM to mute them by default won't work either.
> 
> Could you describe this ? I though that only DMIC is handled by SOF when HDA
> codec is in the system. There is a separate analog codec for external analog
> microphone or the HDA codec is somehow connected to SOF/DSP ? If so, how ?

The HDA codec is connected in the same way in all cases, there's no
hardware/electrical/routing difference.

When used, the SOF driver will handle ALL links, be they DMIC or
HDAudio. The difference for HDaudio is that instead of a single DMA
transfer (DDR->FIFO), we have a first 'Host' DMA into the DSP SRAM, some
processing and a second 'Link' DMA from DSP SRAM to the HDaudio FIFO
(reversed flow for capture).


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ALSA: hda: Skip creating captures in SOF context
  2022-07-20 13:31       ` Pierre-Louis Bossart
@ 2022-08-15  7:55         ` Kai-Heng Feng
  2023-01-05 12:36           ` Kai-Heng Feng
  0 siblings, 1 reply; 10+ messages in thread
From: Kai-Heng Feng @ 2022-08-15  7:55 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: Jaroslav Kysela, tiwai, Bard Liao, alsa-devel, linux-kernel

On Wed, Jul 20, 2022 at 9:31 PM Pierre-Louis Bossart
<pierre-louis.bossart@linux.intel.com> wrote:
>
>
>
> On 7/20/22 02:52, Jaroslav Kysela wrote:
> > Dne 20. 07. 22 v 3:45 Kai-Heng Feng napsal(a):
> >> On Tue, Jul 19, 2022 at 11:41 PM Jaroslav Kysela <perex@perex.cz> wrote:
> >>>
> >>> Dne 19. 07. 22 v 16:47 Kai-Heng Feng napsal(a):
> >>>> 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.
> >>>
> >>> It does not mean that it's a wrong behavior. When both controls are muted, the
> >>> LED should be turned on. It just requires that all inputs are off (and it may
> >>> be the default - probably we can set in UCM or so). If you turn the "Capture
> >>> Switch" off in amixer / alsamixer, do things work as expected ?
> >>
> >> Yes. When all captures are muted the micmute LED is on.
> >>
> >>>
> >>>> So skip creating captures for HDA when it's called from SOF, the
> >>>> captures are already handled by SOF.
> >>>
> >>> The capture controls are for other inputs like external analog microphone. If
> >>> it is required to suppress the MIC LED for some hardware, just skip the
> >>> "spec->mic_mute_led = 1" assignment in hda_generic.c . Also, the check
> >>> "codec->core.type != HDA_DEV_ASOC" is not sufficient, because you don't know,
> >>> if the topology really sets the MIC LED flag.
> >>
> >> AFAIK the external analog microphone on DMIC laptop is driven by SOF driver too.
> >> If those capture controls are indeed needed for external analog mics,
> >> use UCM to mute them by default won't work either.
> >
> > Could you describe this ? I though that only DMIC is handled by SOF when HDA
> > codec is in the system. There is a separate analog codec for external analog
> > microphone or the HDA codec is somehow connected to SOF/DSP ? If so, how ?
>
> The HDA codec is connected in the same way in all cases, there's no
> hardware/electrical/routing difference.
>
> When used, the SOF driver will handle ALL links, be they DMIC or
> HDAudio. The difference for HDaudio is that instead of a single DMA
> transfer (DDR->FIFO), we have a first 'Host' DMA into the DSP SRAM, some
> processing and a second 'Link' DMA from DSP SRAM to the HDaudio FIFO
> (reversed flow for capture).

So is this approach sufficient for this issue? Or should I explore
other possibilities?

Kai-Heng

>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ALSA: hda: Skip creating captures in SOF context
  2022-08-15  7:55         ` Kai-Heng Feng
@ 2023-01-05 12:36           ` Kai-Heng Feng
  2023-01-05 12:43             ` Jaroslav Kysela
  0 siblings, 1 reply; 10+ messages in thread
From: Kai-Heng Feng @ 2023-01-05 12:36 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: Jaroslav Kysela, tiwai, Bard Liao, alsa-devel, linux-kernel

On Mon, Aug 15, 2022 at 3:55 PM Kai-Heng Feng
<kai.heng.feng@canonical.com> wrote:
>
> On Wed, Jul 20, 2022 at 9:31 PM Pierre-Louis Bossart
> <pierre-louis.bossart@linux.intel.com> wrote:
> >
> >
> >
> > On 7/20/22 02:52, Jaroslav Kysela wrote:
> > > Dne 20. 07. 22 v 3:45 Kai-Heng Feng napsal(a):
> > >> On Tue, Jul 19, 2022 at 11:41 PM Jaroslav Kysela <perex@perex.cz> wrote:
> > >>>
> > >>> Dne 19. 07. 22 v 16:47 Kai-Heng Feng napsal(a):
> > >>>> 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.
> > >>>
> > >>> It does not mean that it's a wrong behavior. When both controls are muted, the
> > >>> LED should be turned on. It just requires that all inputs are off (and it may
> > >>> be the default - probably we can set in UCM or so). If you turn the "Capture
> > >>> Switch" off in amixer / alsamixer, do things work as expected ?
> > >>
> > >> Yes. When all captures are muted the micmute LED is on.
> > >>
> > >>>
> > >>>> So skip creating captures for HDA when it's called from SOF, the
> > >>>> captures are already handled by SOF.
> > >>>
> > >>> The capture controls are for other inputs like external analog microphone. If
> > >>> it is required to suppress the MIC LED for some hardware, just skip the
> > >>> "spec->mic_mute_led = 1" assignment in hda_generic.c . Also, the check
> > >>> "codec->core.type != HDA_DEV_ASOC" is not sufficient, because you don't know,
> > >>> if the topology really sets the MIC LED flag.
> > >>
> > >> AFAIK the external analog microphone on DMIC laptop is driven by SOF driver too.
> > >> If those capture controls are indeed needed for external analog mics,
> > >> use UCM to mute them by default won't work either.
> > >
> > > Could you describe this ? I though that only DMIC is handled by SOF when HDA
> > > codec is in the system. There is a separate analog codec for external analog
> > > microphone or the HDA codec is somehow connected to SOF/DSP ? If so, how ?
> >
> > The HDA codec is connected in the same way in all cases, there's no
> > hardware/electrical/routing difference.
> >
> > When used, the SOF driver will handle ALL links, be they DMIC or
> > HDAudio. The difference for HDaudio is that instead of a single DMA
> > transfer (DDR->FIFO), we have a first 'Host' DMA into the DSP SRAM, some
> > processing and a second 'Link' DMA from DSP SRAM to the HDaudio FIFO
> > (reversed flow for capture).
>
> So is this approach sufficient for this issue? Or should I explore
> other possibilities?

A gentle ping...

>
> Kai-Heng
>
> >

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ALSA: hda: Skip creating captures in SOF context
  2023-01-05 12:36           ` Kai-Heng Feng
@ 2023-01-05 12:43             ` Jaroslav Kysela
  2023-01-06  5:00               ` Kai-Heng Feng
  0 siblings, 1 reply; 10+ messages in thread
From: Jaroslav Kysela @ 2023-01-05 12:43 UTC (permalink / raw)
  To: Kai-Heng Feng, Pierre-Louis Bossart
  Cc: tiwai, Bard Liao, alsa-devel, linux-kernel

On 05. 01. 23 13:36, Kai-Heng Feng wrote:
> On Mon, Aug 15, 2022 at 3:55 PM Kai-Heng Feng
> <kai.heng.feng@canonical.com> wrote:
>>
>> On Wed, Jul 20, 2022 at 9:31 PM Pierre-Louis Bossart
>> <pierre-louis.bossart@linux.intel.com> wrote:
>>>
>>>
>>>
>>> On 7/20/22 02:52, Jaroslav Kysela wrote:
>>>> Dne 20. 07. 22 v 3:45 Kai-Heng Feng napsal(a):
>>>>> On Tue, Jul 19, 2022 at 11:41 PM Jaroslav Kysela <perex@perex.cz> wrote:
>>>>>>
>>>>>> Dne 19. 07. 22 v 16:47 Kai-Heng Feng napsal(a):
>>>>>>> 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.
>>>>>>
>>>>>> It does not mean that it's a wrong behavior. When both controls are muted, the
>>>>>> LED should be turned on. It just requires that all inputs are off (and it may
>>>>>> be the default - probably we can set in UCM or so). If you turn the "Capture
>>>>>> Switch" off in amixer / alsamixer, do things work as expected ?
>>>>>
>>>>> Yes. When all captures are muted the micmute LED is on.
>>>>>
>>>>>>
>>>>>>> So skip creating captures for HDA when it's called from SOF, the
>>>>>>> captures are already handled by SOF.
>>>>>>
>>>>>> The capture controls are for other inputs like external analog microphone. If
>>>>>> it is required to suppress the MIC LED for some hardware, just skip the
>>>>>> "spec->mic_mute_led = 1" assignment in hda_generic.c . Also, the check
>>>>>> "codec->core.type != HDA_DEV_ASOC" is not sufficient, because you don't know,
>>>>>> if the topology really sets the MIC LED flag.
>>>>>
>>>>> AFAIK the external analog microphone on DMIC laptop is driven by SOF driver too.
>>>>> If those capture controls are indeed needed for external analog mics,
>>>>> use UCM to mute them by default won't work either.
>>>>
>>>> Could you describe this ? I though that only DMIC is handled by SOF when HDA
>>>> codec is in the system. There is a separate analog codec for external analog
>>>> microphone or the HDA codec is somehow connected to SOF/DSP ? If so, how ?
>>>
>>> The HDA codec is connected in the same way in all cases, there's no
>>> hardware/electrical/routing difference.
>>>
>>> When used, the SOF driver will handle ALL links, be they DMIC or
>>> HDAudio. The difference for HDaudio is that instead of a single DMA
>>> transfer (DDR->FIFO), we have a first 'Host' DMA into the DSP SRAM, some
>>> processing and a second 'Link' DMA from DSP SRAM to the HDaudio FIFO
>>> (reversed flow for capture).
>>
>> So is this approach sufficient for this issue? Or should I explore
>> other possibilities?
> 
> A gentle ping...

This Mic LED problem was resolved through UCM for the moment:

https://github.com/alsa-project/alsa-ucm-conf/commit/79a8ec44d3dcf097f4a4492c506cbcf338324175

More discussion:

https://bugzilla.redhat.com/show_bug.cgi?id=2134824

					Jaroslav

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ALSA: hda: Skip creating captures in SOF context
  2023-01-05 12:43             ` Jaroslav Kysela
@ 2023-01-06  5:00               ` Kai-Heng Feng
  0 siblings, 0 replies; 10+ messages in thread
From: Kai-Heng Feng @ 2023-01-06  5:00 UTC (permalink / raw)
  To: Jaroslav Kysela
  Cc: Pierre-Louis Bossart, tiwai, Bard Liao, alsa-devel, linux-kernel

Hi Jaroslav,

On Thu, Jan 5, 2023 at 8:43 PM Jaroslav Kysela <perex@perex.cz> wrote:
>
> On 05. 01. 23 13:36, Kai-Heng Feng wrote:
> > On Mon, Aug 15, 2022 at 3:55 PM Kai-Heng Feng
> > <kai.heng.feng@canonical.com> wrote:
> >>
> >> On Wed, Jul 20, 2022 at 9:31 PM Pierre-Louis Bossart
> >> <pierre-louis.bossart@linux.intel.com> wrote:
> >>>
> >>>
> >>>
> >>> On 7/20/22 02:52, Jaroslav Kysela wrote:
> >>>> Dne 20. 07. 22 v 3:45 Kai-Heng Feng napsal(a):
> >>>>> On Tue, Jul 19, 2022 at 11:41 PM Jaroslav Kysela <perex@perex.cz> wrote:
> >>>>>>
> >>>>>> Dne 19. 07. 22 v 16:47 Kai-Heng Feng napsal(a):
> >>>>>>> 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.
> >>>>>>
> >>>>>> It does not mean that it's a wrong behavior. When both controls are muted, the
> >>>>>> LED should be turned on. It just requires that all inputs are off (and it may
> >>>>>> be the default - probably we can set in UCM or so). If you turn the "Capture
> >>>>>> Switch" off in amixer / alsamixer, do things work as expected ?
> >>>>>
> >>>>> Yes. When all captures are muted the micmute LED is on.
> >>>>>
> >>>>>>
> >>>>>>> So skip creating captures for HDA when it's called from SOF, the
> >>>>>>> captures are already handled by SOF.
> >>>>>>
> >>>>>> The capture controls are for other inputs like external analog microphone. If
> >>>>>> it is required to suppress the MIC LED for some hardware, just skip the
> >>>>>> "spec->mic_mute_led = 1" assignment in hda_generic.c . Also, the check
> >>>>>> "codec->core.type != HDA_DEV_ASOC" is not sufficient, because you don't know,
> >>>>>> if the topology really sets the MIC LED flag.
> >>>>>
> >>>>> AFAIK the external analog microphone on DMIC laptop is driven by SOF driver too.
> >>>>> If those capture controls are indeed needed for external analog mics,
> >>>>> use UCM to mute them by default won't work either.
> >>>>
> >>>> Could you describe this ? I though that only DMIC is handled by SOF when HDA
> >>>> codec is in the system. There is a separate analog codec for external analog
> >>>> microphone or the HDA codec is somehow connected to SOF/DSP ? If so, how ?
> >>>
> >>> The HDA codec is connected in the same way in all cases, there's no
> >>> hardware/electrical/routing difference.
> >>>
> >>> When used, the SOF driver will handle ALL links, be they DMIC or
> >>> HDAudio. The difference for HDaudio is that instead of a single DMA
> >>> transfer (DDR->FIFO), we have a first 'Host' DMA into the DSP SRAM, some
> >>> processing and a second 'Link' DMA from DSP SRAM to the HDaudio FIFO
> >>> (reversed flow for capture).
> >>
> >> So is this approach sufficient for this issue? Or should I explore
> >> other possibilities?
> >
> > A gentle ping...
>
> This Mic LED problem was resolved through UCM for the moment:
>
> https://github.com/alsa-project/alsa-ucm-conf/commit/79a8ec44d3dcf097f4a4492c506cbcf338324175

That solves the issue, thanks!

Kai-Heng

>
> More discussion:
>
> https://bugzilla.redhat.com/show_bug.cgi?id=2134824
>
>                                         Jaroslav
>
> --
> Jaroslav Kysela <perex@perex.cz>
> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-01-06  5:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-19 14:47 [PATCH] ALSA: hda: Skip creating captures in SOF context Kai-Heng Feng
2022-07-19 15:41 ` Jaroslav Kysela
2022-07-20  1:45   ` Kai-Heng Feng
2022-07-20  6:29     ` Takashi Iwai
2022-07-20  7:52     ` Jaroslav Kysela
2022-07-20 13:31       ` Pierre-Louis Bossart
2022-08-15  7:55         ` Kai-Heng Feng
2023-01-05 12:36           ` Kai-Heng Feng
2023-01-05 12:43             ` Jaroslav Kysela
2023-01-06  5:00               ` Kai-Heng Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).