Skip to content

Commit 1fd5050

Browse files
KailangYangtiwai
authored andcommitted
ALSA: hda/realtek: Update ALC225 depop procedure
Old procedure has a chance to meet Headphone no output. Fixes: da911b1 ("ALSA: hda/realtek - update ALC225 depop optimize") Signed-off-by: Kailang Yang <[email protected]> Cc: <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 31917b7 commit 1fd5050

File tree

1 file changed

+39
-48
lines changed

1 file changed

+39
-48
lines changed

sound/pci/hda/patch_realtek.c

Lines changed: 39 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3768,33 +3768,28 @@ static void alc225_init(struct hda_codec *codec)
37683768
hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
37693769
hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
37703770

3771-
if (hp1_pin_sense || hp2_pin_sense)
3771+
if (hp1_pin_sense || hp2_pin_sense) {
37723772
msleep(2);
3773+
alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
37733774

3774-
alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3775-
3776-
if (hp1_pin_sense || spec->ultra_low_power)
3777-
snd_hda_codec_write(codec, hp_pin, 0,
3778-
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3779-
if (hp2_pin_sense)
3780-
snd_hda_codec_write(codec, 0x16, 0,
3781-
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3782-
3783-
if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3784-
msleep(85);
3785-
3786-
if (hp1_pin_sense || spec->ultra_low_power)
3787-
snd_hda_codec_write(codec, hp_pin, 0,
3788-
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3789-
if (hp2_pin_sense)
3790-
snd_hda_codec_write(codec, 0x16, 0,
3791-
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3775+
if (hp1_pin_sense)
3776+
snd_hda_codec_write(codec, hp_pin, 0,
3777+
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3778+
if (hp2_pin_sense)
3779+
snd_hda_codec_write(codec, 0x16, 0,
3780+
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3781+
msleep(75);
37923782

3793-
if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3794-
msleep(100);
3783+
if (hp1_pin_sense)
3784+
snd_hda_codec_write(codec, hp_pin, 0,
3785+
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3786+
if (hp2_pin_sense)
3787+
snd_hda_codec_write(codec, 0x16, 0,
3788+
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
37953789

3796-
alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3797-
alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3790+
msleep(75);
3791+
alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3792+
}
37983793
}
37993794

38003795
static void alc225_shutup(struct hda_codec *codec)
@@ -3806,36 +3801,35 @@ static void alc225_shutup(struct hda_codec *codec)
38063801
if (!hp_pin)
38073802
hp_pin = 0x21;
38083803

3809-
alc_disable_headset_jack_key(codec);
3810-
/* 3k pull low control for Headset jack. */
3811-
alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3812-
38133804
hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
38143805
hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
38153806

3816-
if (hp1_pin_sense || hp2_pin_sense)
3807+
if (hp1_pin_sense || hp2_pin_sense) {
3808+
alc_disable_headset_jack_key(codec);
3809+
/* 3k pull low control for Headset jack. */
3810+
alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
38173811
msleep(2);
38183812

3819-
if (hp1_pin_sense || spec->ultra_low_power)
3820-
snd_hda_codec_write(codec, hp_pin, 0,
3821-
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3822-
if (hp2_pin_sense)
3823-
snd_hda_codec_write(codec, 0x16, 0,
3824-
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3825-
3826-
if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3827-
msleep(85);
3813+
if (hp1_pin_sense)
3814+
snd_hda_codec_write(codec, hp_pin, 0,
3815+
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3816+
if (hp2_pin_sense)
3817+
snd_hda_codec_write(codec, 0x16, 0,
3818+
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
38283819

3829-
if (hp1_pin_sense || spec->ultra_low_power)
3830-
snd_hda_codec_write(codec, hp_pin, 0,
3831-
AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3832-
if (hp2_pin_sense)
3833-
snd_hda_codec_write(codec, 0x16, 0,
3834-
AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3820+
msleep(75);
38353821

3836-
if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3837-
msleep(100);
3822+
if (hp1_pin_sense)
3823+
snd_hda_codec_write(codec, hp_pin, 0,
3824+
AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3825+
if (hp2_pin_sense)
3826+
snd_hda_codec_write(codec, 0x16, 0,
3827+
AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
38383828

3829+
msleep(75);
3830+
alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3831+
alc_enable_headset_jack_key(codec);
3832+
}
38393833
alc_auto_setup_eapd(codec, false);
38403834
alc_shutup_pins(codec);
38413835
if (spec->ultra_low_power) {
@@ -3846,9 +3840,6 @@ static void alc225_shutup(struct hda_codec *codec)
38463840
alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
38473841
msleep(30);
38483842
}
3849-
3850-
alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3851-
alc_enable_headset_jack_key(codec);
38523843
}
38533844

38543845
static void alc_default_init(struct hda_codec *codec)

0 commit comments

Comments
 (0)