stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda - let hs_mic be picked ahead of hp_mic
@ 2020-06-25  8:38 Hui Wang
  2020-06-25 13:01 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Hui Wang @ 2020-06-25  8:38 UTC (permalink / raw)
  To: alsa-devel, tiwai; +Cc: stable

We have a Dell AIO, there is neither internal speaker nor internal
mic, only a multi-function audio jack on it.

Users reported that after freshly installing the OS and plug
a headset to the audio jack, the headset can't output sound. I
reproduced this bug, at that moment, the Input Source is as below:
Simple mixer control 'Input Source',0
  Capabilities: cenum
  Items: 'Headphone Mic' 'Headset Mic'
  Item0: 'Headphone Mic'

That is because the patch_realtek will set this audio jack as mic_in
mode if Input Source's value is hp_mic.

If it is not fresh installing, this issue will not happen since the
systemd will run alsactl restore -f /var/lib/alsa/asound.state, this
will set the 'Input Source' according to history value.

If there is internal speaker or internal mic, this issue will not
happen since there is valid sink/source in the pulseaudio, the PA will
set the 'Input Source' according to active_port.

To fix this issue, change the parser function to let the hs_mic be
stored ahead of hp_mic.

Cc: stable@vger.kernel.org
Signed-off-by: Hui Wang <hui.wang@canonical.com>
---
 sound/pci/hda/hda_auto_parser.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c
index 2c6d2becfe1a..824f4ac1a8ce 100644
--- a/sound/pci/hda/hda_auto_parser.c
+++ b/sound/pci/hda/hda_auto_parser.c
@@ -72,6 +72,12 @@ static int compare_input_type(const void *ap, const void *bp)
 	if (a->type != b->type)
 		return (int)(a->type - b->type);
 
+	/* If has both hs_mic and hp_mic, pick the hs_mic ahead of hp_mic. */
+	if (a->is_headset_mic && b->is_headphone_mic)
+		return -1; /* don't swap */
+	else if (a->is_headphone_mic && b->is_headset_mic)
+		return 1; /* swap */
+
 	/* In case one has boost and the other one has not,
 	   pick the one with boost first. */
 	return (int)(b->has_boost_on_pin - a->has_boost_on_pin);
-- 
2.17.1


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

* Re: [PATCH] ALSA: hda - let hs_mic be picked ahead of hp_mic
  2020-06-25  8:38 [PATCH] ALSA: hda - let hs_mic be picked ahead of hp_mic Hui Wang
@ 2020-06-25 13:01 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2020-06-25 13:01 UTC (permalink / raw)
  To: Hui Wang; +Cc: alsa-devel, stable

On Thu, 25 Jun 2020 10:38:33 +0200,
Hui Wang wrote:
> 
> We have a Dell AIO, there is neither internal speaker nor internal
> mic, only a multi-function audio jack on it.
> 
> Users reported that after freshly installing the OS and plug
> a headset to the audio jack, the headset can't output sound. I
> reproduced this bug, at that moment, the Input Source is as below:
> Simple mixer control 'Input Source',0
>   Capabilities: cenum
>   Items: 'Headphone Mic' 'Headset Mic'
>   Item0: 'Headphone Mic'
> 
> That is because the patch_realtek will set this audio jack as mic_in
> mode if Input Source's value is hp_mic.
> 
> If it is not fresh installing, this issue will not happen since the
> systemd will run alsactl restore -f /var/lib/alsa/asound.state, this
> will set the 'Input Source' according to history value.
> 
> If there is internal speaker or internal mic, this issue will not
> happen since there is valid sink/source in the pulseaudio, the PA will
> set the 'Input Source' according to active_port.
> 
> To fix this issue, change the parser function to let the hs_mic be
> stored ahead of hp_mic.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Hui Wang <hui.wang@canonical.com>

Applied now.  Thanks.


Takashi

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

end of thread, other threads:[~2020-06-25 13:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-25  8:38 [PATCH] ALSA: hda - let hs_mic be picked ahead of hp_mic Hui Wang
2020-06-25 13:01 ` Takashi Iwai

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).