Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

ALSA: hda - Fix no sound from ALC662 after Windows reboot



Windows use hidden register to control EAPD.
Linux use verb to control EAPD.
If windows reboot to Linux, it must change the EAPD control to verb
control.

Signed-off-by: default avatarKailang Yang <kailang@realtek.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent c47ccb2e
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -6688,6 +6688,31 @@ static const struct alc_model_fixup alc662_fixup_models[] = {
	{}
};

static void alc662_fill_coef(struct hda_codec *codec)
{
	int val, coef;

	coef = alc_get_coef0(codec);

	switch (codec->vendor_id) {
	case 0x10ec0662:
		if ((coef & 0x00f0) == 0x0030) {
			val = alc_read_coef_idx(codec, 0x4); /* EAPD Ctrl */
			alc_write_coef_idx(codec, 0x4, val & ~(1<<10));
		}
		break;
	case 0x10ec0272:
	case 0x10ec0273:
	case 0x10ec0663:
	case 0x10ec0665:
	case 0x10ec0670:
	case 0x10ec0671:
	case 0x10ec0672:
		val = alc_read_coef_idx(codec, 0xd); /* EAPD Ctrl */
		alc_write_coef_idx(codec, 0xd, val | (1<<14));
		break;
	}
}

/*
 */
@@ -6707,6 +6732,9 @@ static int patch_alc662(struct hda_codec *codec)

	alc_fix_pll_init(codec, 0x20, 0x04, 15);

	spec->init_hook = alc662_fill_coef;
	alc662_fill_coef(codec);

	alc_pick_fixup(codec, alc662_fixup_models,
		       alc662_fixup_tbl, alc662_fixups);
	alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);