Commit 394c97f8 authored by Kailang Yang's avatar Kailang Yang Committed by Takashi Iwai

ALSA: hda/realtek - Change EAPD to verb control

This will fix no sound in Linux system after reboot from windows.

Change log:
- alc662_fill_coef() is replaced with alc_fill_eapd_coef_idx()
  and move into alc_auto_init_amp().
- For ALC262, ALC267, ALC268, ALC269, ALC233, ALC255, ALC280, ALC282,
  ALC283, ALC284, ALC285, ALC286, ALC288, ALC290, ALC292, ALC293, ALC294,
  ALC668, ALC888VC, ALC888VD, ALC891, ALC892, ALC898 and ALC1150, add update
  COEF control for EAPD setting.
- Remove alc269_fill_coef() for update EAPD control line.

ADDITIONAL NOTE:
Many Realtek cdoecs have a COEF bit to switch the master amp control
between COEF and EAPD.  Windows drivers seem using COEF while we use
EAPD, which is more standard.  As a result, some system suffer from
the silent output when booting after Windows.  This patch sets the
COEF bits on the relevant codecs properly to switch to EAPD control.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=87771Signed-off-by: default avatarKailang Yang <kailang@realtek.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 1a290581
...@@ -288,6 +288,80 @@ static void alc880_unsol_event(struct hda_codec *codec, unsigned int res) ...@@ -288,6 +288,80 @@ static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
snd_hda_jack_unsol_event(codec, res >> 2); snd_hda_jack_unsol_event(codec, res >> 2);
} }
/* Change EAPD to verb control */
static void alc_fill_eapd_coef(struct hda_codec *codec)
{
int coef;
coef = alc_get_coef0(codec);
switch (codec->vendor_id) {
case 0x10ec0262:
alc_update_coef_idx(codec, 0x7, 0, 1<<5);
break;
case 0x10ec0267:
case 0x10ec0268:
alc_update_coef_idx(codec, 0x7, 0, 1<<13);
break;
case 0x10ec0269:
if ((coef & 0x00f0) == 0x0010)
alc_update_coef_idx(codec, 0xd, 0, 1<<14);
if ((coef & 0x00f0) == 0x0020)
alc_update_coef_idx(codec, 0x4, 1<<15, 0);
if ((coef & 0x00f0) == 0x0030)
alc_update_coef_idx(codec, 0x10, 1<<9, 0);
break;
case 0x10ec0280:
case 0x10ec0284:
case 0x10ec0290:
case 0x10ec0292:
alc_update_coef_idx(codec, 0x4, 1<<15, 0);
break;
case 0x10ec0233:
case 0x10ec0255:
case 0x10ec0282:
case 0x10ec0283:
case 0x10ec0286:
case 0x10ec0288:
alc_update_coef_idx(codec, 0x10, 1<<9, 0);
break;
case 0x10ec0285:
case 0x10ec0293:
alc_update_coef_idx(codec, 0xa, 1<<13, 0);
break;
case 0x10ec0662:
if ((coef & 0x00f0) == 0x0030)
alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
break;
case 0x10ec0272:
case 0x10ec0273:
case 0x10ec0663:
case 0x10ec0665:
case 0x10ec0670:
case 0x10ec0671:
case 0x10ec0672:
alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
break;
case 0x10ec0668:
alc_update_coef_idx(codec, 0x7, 3<<13, 0);
break;
case 0x10ec0867:
alc_update_coef_idx(codec, 0x4, 1<<10, 0);
break;
case 0x10ec0888:
if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
alc_update_coef_idx(codec, 0x7, 1<<5, 0);
break;
case 0x10ec0892:
alc_update_coef_idx(codec, 0x7, 1<<5, 0);
break;
case 0x10ec0899:
case 0x10ec0900:
alc_update_coef_idx(codec, 0x7, 1<<1, 0);
break;
}
}
/* additional initialization for ALC888 variants */ /* additional initialization for ALC888 variants */
static void alc888_coef_init(struct hda_codec *codec) static void alc888_coef_init(struct hda_codec *codec)
{ {
...@@ -339,6 +413,7 @@ static void alc_eapd_shutup(struct hda_codec *codec) ...@@ -339,6 +413,7 @@ static void alc_eapd_shutup(struct hda_codec *codec)
/* generic EAPD initialization */ /* generic EAPD initialization */
static void alc_auto_init_amp(struct hda_codec *codec, int type) static void alc_auto_init_amp(struct hda_codec *codec, int type)
{ {
alc_fill_eapd_coef(codec);
alc_auto_setup_eapd(codec, true); alc_auto_setup_eapd(codec, true);
switch (type) { switch (type) {
case ALC_INIT_GPIO1: case ALC_INIT_GPIO1:
...@@ -5212,9 +5287,6 @@ static void alc269_fill_coef(struct hda_codec *codec) ...@@ -5212,9 +5287,6 @@ static void alc269_fill_coef(struct hda_codec *codec)
} }
} }
/* Class D */
alc_update_coef_idx(codec, 0xd, 0, 1<<14);
/* HP */ /* HP */
alc_update_coef_idx(codec, 0x4, 0, 1<<11); alc_update_coef_idx(codec, 0x4, 0, 1<<11);
} }
...@@ -6124,29 +6196,6 @@ static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = { ...@@ -6124,29 +6196,6 @@ static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
{} {}
}; };
static void alc662_fill_coef(struct hda_codec *codec)
{
int coef;
coef = alc_get_coef0(codec);
switch (codec->vendor_id) {
case 0x10ec0662:
if ((coef & 0x00f0) == 0x0030)
alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
break;
case 0x10ec0272:
case 0x10ec0273:
case 0x10ec0663:
case 0x10ec0665:
case 0x10ec0670:
case 0x10ec0671:
case 0x10ec0672:
alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
break;
}
}
/* /*
*/ */
static int patch_alc662(struct hda_codec *codec) static int patch_alc662(struct hda_codec *codec)
...@@ -6169,10 +6218,6 @@ static int patch_alc662(struct hda_codec *codec) ...@@ -6169,10 +6218,6 @@ static int patch_alc662(struct hda_codec *codec)
case 0x10ec0668: case 0x10ec0668:
spec->init_hook = alc668_restore_default_value; spec->init_hook = alc668_restore_default_value;
break; break;
default:
spec->init_hook = alc662_fill_coef;
alc662_fill_coef(codec);
break;
} }
snd_hda_pick_fixup(codec, alc662_fixup_models, snd_hda_pick_fixup(codec, alc662_fixup_models,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment