Skip to content

Commit cc3d0b5

Browse files
KailangYangtiwai
authored andcommitted
ALSA: hda/realtek: Update ALC256 depop procedure
Old procedure has a chance to meet Headphone no output. Fixes: 4a219ef ("ALSA: hda/realtek - Add ALC256 HP depop function") Signed-off-by: Kailang Yang <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 0e84b41 commit cc3d0b5

File tree

1 file changed

+19
-23
lines changed

1 file changed

+19
-23
lines changed

sound/pci/hda/patch_realtek.c

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3613,25 +3613,22 @@ static void alc256_init(struct hda_codec *codec)
36133613

36143614
hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
36153615

3616-
if (hp_pin_sense)
3616+
if (hp_pin_sense) {
36173617
msleep(2);
3618+
alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
36183619

3619-
alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3620-
3621-
snd_hda_codec_write(codec, hp_pin, 0,
3622-
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3623-
3624-
if (hp_pin_sense || spec->ultra_low_power)
3625-
msleep(85);
3626-
3627-
snd_hda_codec_write(codec, hp_pin, 0,
3620+
snd_hda_codec_write(codec, hp_pin, 0,
36283621
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
36293622

3630-
if (hp_pin_sense || spec->ultra_low_power)
3631-
msleep(100);
3623+
msleep(75);
3624+
3625+
snd_hda_codec_write(codec, hp_pin, 0,
3626+
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
36323627

3628+
msleep(75);
3629+
alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3630+
}
36333631
alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3634-
alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
36353632
alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
36363633
alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
36373634
/*
@@ -3655,29 +3652,28 @@ static void alc256_shutup(struct hda_codec *codec)
36553652
alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
36563653
hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
36573654

3658-
if (hp_pin_sense)
3655+
if (hp_pin_sense) {
36593656
msleep(2);
36603657

3661-
snd_hda_codec_write(codec, hp_pin, 0,
3658+
snd_hda_codec_write(codec, hp_pin, 0,
36623659
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
36633660

3664-
if (hp_pin_sense || spec->ultra_low_power)
3665-
msleep(85);
3661+
msleep(75);
36663662

36673663
/* 3k pull low control for Headset jack. */
36683664
/* NOTE: call this before clearing the pin, otherwise codec stalls */
36693665
/* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
36703666
* when booting with headset plugged. So skip setting it for the codec alc257
36713667
*/
3672-
if (spec->en_3kpull_low)
3673-
alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3668+
if (spec->en_3kpull_low)
3669+
alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
36743670

3675-
if (!spec->no_shutup_pins)
3676-
snd_hda_codec_write(codec, hp_pin, 0,
3671+
if (!spec->no_shutup_pins)
3672+
snd_hda_codec_write(codec, hp_pin, 0,
36773673
AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
36783674

3679-
if (hp_pin_sense || spec->ultra_low_power)
3680-
msleep(100);
3675+
msleep(75);
3676+
}
36813677

36823678
alc_auto_setup_eapd(codec, false);
36833679
alc_shutup_pins(codec);

0 commit comments

Comments
 (0)