Skip to content

Commit

Permalink
[ALSA] hda - Fix EAPD and COEF setups for realtek codecs
Browse files Browse the repository at this point in the history
Fixed EAPD and COEF setups for Realtek ALC662/663, 660-VD and 888 codecs.

Signed-off-by: Kailang Yang <kailang@realtek.com.tw>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Kailang Yang authored and Takashi Iwai committed May 27, 2008
1 parent 2f89328 commit f9423e7
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions sound/pci/hda/patch_realtek.c
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,24 @@ static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
alc_sku_automute(codec);
}

/* additional initialization for ALC888 variants */
static void alc888_coef_init(struct hda_codec *codec)
{
unsigned int tmp;

snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
if ((tmp & 0xf0) == 2)
/* alc888S-VC */
snd_hda_codec_read(codec, 0x20, 0,
AC_VERB_SET_PROC_COEF, 0x830);
else
/* alc888-VB */
snd_hda_codec_read(codec, 0x20, 0,
AC_VERB_SET_PROC_COEF, 0x3030);
}

/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
* 31 ~ 16 : Manufacture ID
* 15 ~ 8 : SKU ID
Expand Down Expand Up @@ -855,8 +873,10 @@ static void alc_subsystem_id(struct hda_codec *codec,
case 0x10ec0267:
case 0x10ec0268:
case 0x10ec0269:
case 0x10ec0660:
case 0x10ec0662:
case 0x10ec0663:
case 0x10ec0862:
case 0x10ec0662:
case 0x10ec0889:
snd_hda_codec_write(codec, 0x14, 0,
AC_VERB_SET_EAPD_BTLENABLE, 2);
Expand All @@ -881,7 +901,6 @@ static void alc_subsystem_id(struct hda_codec *codec,
case 0x10ec0882:
case 0x10ec0883:
case 0x10ec0885:
case 0x10ec0888:
case 0x10ec0889:
snd_hda_codec_write(codec, 0x20, 0,
AC_VERB_SET_COEF_INDEX, 7);
Expand All @@ -893,6 +912,9 @@ static void alc_subsystem_id(struct hda_codec *codec,
AC_VERB_SET_PROC_COEF,
tmp | 0x2010);
break;
case 0x10ec0888:
alc888_coef_init(codec);
break;
case 0x10ec0267:
case 0x10ec0268:
snd_hda_codec_write(codec, 0x20, 0,
Expand Down Expand Up @@ -8214,6 +8236,9 @@ static int patch_alc883(struct hda_codec *codec)
codec->patch_ops = alc_patch_ops;
if (board_config == ALC883_AUTO)
spec->init_hook = alc883_auto_init;
else if (codec->vendor_id == 0x10ec0888)
spec->init_hook = alc888_coef_init;

#ifdef CONFIG_SND_HDA_POWER_SAVE
if (!spec->loopback.amplist)
spec->loopback.amplist = alc883_loopbacks;
Expand Down Expand Up @@ -12662,6 +12687,12 @@ static struct hda_verb alc861vd_eapd_verbs[] = {
{ }
};

static struct hda_verb alc660vd_eapd_verbs[] = {
{0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
{0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
{ }
};

static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
Expand Down Expand Up @@ -13202,6 +13233,8 @@ static int patch_alc861vd(struct hda_codec *codec)
if (codec->vendor_id == 0x10ec0660) {
spec->stream_name_analog = "ALC660-VD Analog";
spec->stream_name_digital = "ALC660-VD Digital";
/* always turn on EAPD */
spec->init_verbs[spec->num_init_verbs++] = alc660vd_eapd_verbs;
} else {
spec->stream_name_analog = "ALC861VD Analog";
spec->stream_name_digital = "ALC861VD Digital";
Expand Down

0 comments on commit f9423e7

Please sign in to comment.