Skip to content

Commit 6a6ca78

Browse files
jason77-wangtiwai
authored andcommitted
ALSA: hda - let hs_mic be picked ahead of hp_mic
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: [email protected] Signed-off-by: Hui Wang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 220345e commit 6a6ca78

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sound/pci/hda/hda_auto_parser.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ static int compare_input_type(const void *ap, const void *bp)
7272
if (a->type != b->type)
7373
return (int)(a->type - b->type);
7474

75+
/* If has both hs_mic and hp_mic, pick the hs_mic ahead of hp_mic. */
76+
if (a->is_headset_mic && b->is_headphone_mic)
77+
return -1; /* don't swap */
78+
else if (a->is_headphone_mic && b->is_headset_mic)
79+
return 1; /* swap */
80+
7581
/* In case one has boost and the other one has not,
7682
pick the one with boost first. */
7783
return (int)(b->has_boost_on_pin - a->has_boost_on_pin);

0 commit comments

Comments
 (0)