Skip to content

Commit 9b82ff1

Browse files
KailangYangtiwai
authored andcommitted
ALSA: hda/realtek - Fixed ALC256 headphone no sound
Dell platform, plug headphone or headset, it had a chance to get no sound from headphone. Replace depop procedure will solve this issue. Signed-off-by: Kailang Yang <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 91191a6 commit 9b82ff1

File tree

1 file changed

+37
-13
lines changed

1 file changed

+37
-13
lines changed

sound/pci/hda/patch_realtek.c

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4930,6 +4930,30 @@ static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
49304930
}
49314931
}
49324932

4933+
static void alc_hp_mute_disable(struct hda_codec *codec, unsigned int delay)
4934+
{
4935+
if (delay <= 0)
4936+
delay = 75;
4937+
snd_hda_codec_write(codec, 0x21, 0,
4938+
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4939+
msleep(delay);
4940+
snd_hda_codec_write(codec, 0x21, 0,
4941+
AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4942+
msleep(delay);
4943+
}
4944+
4945+
static void alc_hp_enable_unmute(struct hda_codec *codec, unsigned int delay)
4946+
{
4947+
if (delay <= 0)
4948+
delay = 75;
4949+
snd_hda_codec_write(codec, 0x21, 0,
4950+
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4951+
msleep(delay);
4952+
snd_hda_codec_write(codec, 0x21, 0,
4953+
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4954+
msleep(delay);
4955+
}
4956+
49334957
static const struct coef_fw alc225_pre_hsmode[] = {
49344958
UPDATE_COEF(0x4a, 1<<8, 0),
49354959
UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
@@ -5031,6 +5055,7 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec)
50315055
case 0x10ec0236:
50325056
case 0x10ec0256:
50335057
case 0x19e58326:
5058+
alc_hp_mute_disable(codec, 75);
50345059
alc_process_coef_fw(codec, coef0256);
50355060
break;
50365061
case 0x10ec0234:
@@ -5302,6 +5327,7 @@ static void alc_headset_mode_default(struct hda_codec *codec)
53025327
alc_write_coef_idx(codec, 0x45, 0xc089);
53035328
msleep(50);
53045329
alc_process_coef_fw(codec, coef0256);
5330+
alc_hp_enable_unmute(codec, 75);
53055331
break;
53065332
case 0x10ec0234:
53075333
case 0x10ec0274:
@@ -5399,6 +5425,7 @@ static void alc_headset_mode_ctia(struct hda_codec *codec)
53995425
case 0x10ec0256:
54005426
case 0x19e58326:
54015427
alc_process_coef_fw(codec, coef0256);
5428+
alc_hp_enable_unmute(codec, 75);
54025429
break;
54035430
case 0x10ec0234:
54045431
case 0x10ec0274:
@@ -5514,6 +5541,7 @@ static void alc_headset_mode_omtp(struct hda_codec *codec)
55145541
case 0x10ec0256:
55155542
case 0x19e58326:
55165543
alc_process_coef_fw(codec, coef0256);
5544+
alc_hp_enable_unmute(codec, 75);
55175545
break;
55185546
case 0x10ec0234:
55195547
case 0x10ec0274:
@@ -5619,25 +5647,21 @@ static void alc_determine_headset_type(struct hda_codec *codec)
56195647
alc_write_coef_idx(codec, 0x06, 0x6104);
56205648
alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
56215649

5622-
snd_hda_codec_write(codec, 0x21, 0,
5623-
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5624-
msleep(80);
5625-
snd_hda_codec_write(codec, 0x21, 0,
5626-
AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5627-
56285650
alc_process_coef_fw(codec, coef0255);
56295651
msleep(300);
56305652
val = alc_read_coef_idx(codec, 0x46);
56315653
is_ctia = (val & 0x0070) == 0x0070;
5632-
5654+
if (!is_ctia) {
5655+
alc_write_coef_idx(codec, 0x45, 0xe089);
5656+
msleep(100);
5657+
val = alc_read_coef_idx(codec, 0x46);
5658+
if ((val & 0x0070) == 0x0070)
5659+
is_ctia = false;
5660+
else
5661+
is_ctia = true;
5662+
}
56335663
alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
56345664
alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5635-
5636-
snd_hda_codec_write(codec, 0x21, 0,
5637-
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5638-
msleep(80);
5639-
snd_hda_codec_write(codec, 0x21, 0,
5640-
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
56415665
break;
56425666
case 0x10ec0234:
56435667
case 0x10ec0274:

0 commit comments

Comments
 (0)