Commit cc3d0b5d authored by Kailang Yang's avatar Kailang Yang Committed by Takashi Iwai
Browse files

ALSA: hda/realtek: Update ALC256 depop procedure



Old procedure has a chance to meet Headphone no output.

Fixes: 4a219ef8 ("ALSA: hda/realtek - Add ALC256 HP depop function")
Signed-off-by: default avatarKailang Yang <kailang@realtek.com>
Link: https://lore.kernel.org/463c5f93715d4714967041a0a8cec28e@realtek.com


Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 0e84b414
Loading
Loading
Loading
Loading
+19 −23
Original line number Diff line number Diff line
@@ -3613,25 +3613,22 @@ static void alc256_init(struct hda_codec *codec)

	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);

	if (hp_pin_sense)
	if (hp_pin_sense) {
		msleep(2);

		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */

		snd_hda_codec_write(codec, hp_pin, 0,
			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);

	if (hp_pin_sense || spec->ultra_low_power)
		msleep(85);
		msleep(75);

		snd_hda_codec_write(codec, hp_pin, 0,
			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);

	if (hp_pin_sense || spec->ultra_low_power)
		msleep(100);
			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);

	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
		msleep(75);
		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
	}
	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
	/*
@@ -3655,14 +3652,13 @@ static void alc256_shutup(struct hda_codec *codec)
	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);

	if (hp_pin_sense)
	if (hp_pin_sense) {
		msleep(2);

		snd_hda_codec_write(codec, hp_pin, 0,
			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);

	if (hp_pin_sense || spec->ultra_low_power)
		msleep(85);
		msleep(75);

	/* 3k pull low control for Headset jack. */
	/* NOTE: call this before clearing the pin, otherwise codec stalls */
@@ -3676,8 +3672,8 @@ static void alc256_shutup(struct hda_codec *codec)
			snd_hda_codec_write(codec, hp_pin, 0,
				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);

	if (hp_pin_sense || spec->ultra_low_power)
		msleep(100);
		msleep(75);
	}

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