Commit 8c427226 authored by Kailang Yang's avatar Kailang Yang Committed by Jaroslav Kysela

[ALSA] hda-codec - Update realtek codec support

1. Support HP rp5700
2. Fixed alc_subsystem_id function (Bug fixed and support Desktop)
3. Support ASUS EP20
Signed-off-by: default avatarKailang Yang <kailang@realtek.com.tw>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
parent 17596a80
...@@ -811,6 +811,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. ...@@ -811,6 +811,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
hp-bpc HP xw4400/6400/8400/9400 laptops hp-bpc HP xw4400/6400/8400/9400 laptops
hp-bpc-d7000 HP BPC D7000 hp-bpc-d7000 HP BPC D7000
hp-tc-t5735 HP Thin Client T5735 hp-tc-t5735 HP Thin Client T5735
hp-rp5700 HP RP5700
benq Benq ED8 benq Benq ED8
benq-t31 Benq T31 benq-t31 Benq T31
hippo Hippo (ATI) with jack detection, Sony UX-90s hippo Hippo (ATI) with jack detection, Sony UX-90s
...@@ -835,7 +836,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. ...@@ -835,7 +836,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
3stack-6ch-dig 3-stack (6-channel) with SPDIF 3stack-6ch-dig 3-stack (6-channel) with SPDIF
6stack-dig 6-stack with SPDIF 6stack-dig 6-stack with SPDIF
lenovo-101e Lenovo laptop lenovo-101e Lenovo laptop
eeepc-p701 ASUS Eeepc eeepc-p701 ASUS Eeepc P701
eeepc-ep20 ASUS Eeepc EP20
auto auto-config reading BIOS (default) auto auto-config reading BIOS (default)
ALC882/885 ALC882/885
......
...@@ -92,6 +92,7 @@ enum { ...@@ -92,6 +92,7 @@ enum {
ALC262_HP_BPC_D7000_WL, ALC262_HP_BPC_D7000_WL,
ALC262_HP_BPC_D7000_WF, ALC262_HP_BPC_D7000_WF,
ALC262_HP_TC_T5735, ALC262_HP_TC_T5735,
ALC262_HP_RP5700,
ALC262_BENQ_ED8, ALC262_BENQ_ED8,
ALC262_SONY_ASSAMD, ALC262_SONY_ASSAMD,
ALC262_BENQ_T31, ALC262_BENQ_T31,
...@@ -155,6 +156,7 @@ enum { ...@@ -155,6 +156,7 @@ enum {
ALC662_5ST_DIG, ALC662_5ST_DIG,
ALC662_LENOVO_101E, ALC662_LENOVO_101E,
ALC662_ASUS_EEEPC_P701, ALC662_ASUS_EEEPC_P701,
ALC662_ASUS_EEEPC_EP20,
ALC662_AUTO, ALC662_AUTO,
ALC662_MODEL_LAST, ALC662_MODEL_LAST,
}; };
...@@ -804,7 +806,7 @@ static void alc_subsystem_id(struct hda_codec *codec, ...@@ -804,7 +806,7 @@ static void alc_subsystem_id(struct hda_codec *codec,
/* check sum */ /* check sum */
tmp = 0; tmp = 0;
for (i = 1; i < 16; i++) { for (i = 1; i < 16; i++) {
if ((ass >> i) && 1) if ((ass >> i) & 1)
tmp++; tmp++;
} }
if (((ass >> 16) & 0xf) != tmp) if (((ass >> 16) & 0xf) != tmp)
...@@ -893,10 +895,10 @@ static void alc_subsystem_id(struct hda_codec *codec, ...@@ -893,10 +895,10 @@ static void alc_subsystem_id(struct hda_codec *codec,
break; break;
} }
/* is laptop and enable the function "Mute internal speaker /* is laptop or Desktop and enable the function "Mute internal speaker
* when the external headphone out jack is plugged" * when the external headphone out jack is plugged"
*/ */
if (!(ass & 0x4) || !(ass & 0x8000)) if (!(ass & 0x8000))
return; return;
/* /*
* 10~8 : Jack location * 10~8 : Jack location
...@@ -906,9 +908,9 @@ static void alc_subsystem_id(struct hda_codec *codec, ...@@ -906,9 +908,9 @@ static void alc_subsystem_id(struct hda_codec *codec,
* when the external headphone out jack is plugged" * when the external headphone out jack is plugged"
*/ */
if (!spec->autocfg.speaker_pins[0]) { if (!spec->autocfg.speaker_pins[0]) {
if (spec->multiout.dac_nids[0]) if (spec->autocfg.line_out_pins[0])
spec->autocfg.speaker_pins[0] = spec->autocfg.speaker_pins[0] =
spec->multiout.dac_nids[0]; spec->autocfg.line_out_pins[0];
else else
return; return;
} }
...@@ -7952,6 +7954,57 @@ static struct hda_verb alc262_hp_t5735_verbs[] = { ...@@ -7952,6 +7954,57 @@ static struct hda_verb alc262_hp_t5735_verbs[] = {
{ } { }
}; };
static struct hda_bind_ctls alc262_hp_rp5700_bind_front_vol = {
.ops = &snd_hda_bind_vol,
.values = {
HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
HDA_COMPOSE_AMP_VAL(0x0e, 3, 0, HDA_OUTPUT),
0
},
};
static struct hda_bind_ctls alc262_hp_rp5700_bind_front_sw = {
.ops = &snd_hda_bind_sw,
.values = {
HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
0
},
};
static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
HDA_BIND_VOL("PCM Playback Volume", &alc262_hp_rp5700_bind_front_vol),
HDA_BIND_SW("PCM Playback Switch", &alc262_hp_rp5700_bind_front_sw),
HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
HDA_CODEC_MUTE("Master Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
{ } /* end */
};
static struct hda_verb alc262_hp_rp5700_verbs[] = {
{0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
{0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
{0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
{0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
{0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
{0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
{0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
{0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
{}
};
static struct hda_input_mux alc262_hp_rp5700_capture_source = {
.num_items = 1,
.items = {
{ "Line", 0x1 },
},
};
/* bind hp and internal speaker mute (with plug check) */ /* bind hp and internal speaker mute (with plug check) */
static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
...@@ -8794,6 +8847,7 @@ static const char *alc262_models[ALC262_MODEL_LAST] = { ...@@ -8794,6 +8847,7 @@ static const char *alc262_models[ALC262_MODEL_LAST] = {
[ALC262_HP_BPC] = "hp-bpc", [ALC262_HP_BPC] = "hp-bpc",
[ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
[ALC262_HP_TC_T5735] = "hp-tc-t5735", [ALC262_HP_TC_T5735] = "hp-tc-t5735",
[ALC262_HP_RP5700] = "hp-rp5700",
[ALC262_BENQ_ED8] = "benq", [ALC262_BENQ_ED8] = "benq",
[ALC262_BENQ_T31] = "benq-t31", [ALC262_BENQ_T31] = "benq-t31",
[ALC262_SONY_ASSAMD] = "sony-assamd", [ALC262_SONY_ASSAMD] = "sony-assamd",
...@@ -8824,6 +8878,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = { ...@@ -8824,6 +8878,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = {
SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
ALC262_HP_TC_T5735), ALC262_HP_TC_T5735),
SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
...@@ -8930,6 +8985,15 @@ static struct alc_config_preset alc262_presets[] = { ...@@ -8930,6 +8985,15 @@ static struct alc_config_preset alc262_presets[] = {
.unsol_event = alc262_hp_t5735_unsol_event, .unsol_event = alc262_hp_t5735_unsol_event,
.init_hook = alc262_hp_t5735_init_hook, .init_hook = alc262_hp_t5735_init_hook,
}, },
[ALC262_HP_RP5700] = {
.mixers = { alc262_hp_rp5700_mixer },
.init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
.num_dacs = ARRAY_SIZE(alc262_dac_nids),
.dac_nids = alc262_dac_nids,
.num_channel_mode = ARRAY_SIZE(alc262_modes),
.channel_mode = alc262_modes,
.input_mux = &alc262_hp_rp5700_capture_source,
},
[ALC262_BENQ_ED8] = { [ALC262_BENQ_ED8] = {
.mixers = { alc262_base_mixer }, .mixers = { alc262_base_mixer },
.init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
...@@ -12520,6 +12584,24 @@ static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { ...@@ -12520,6 +12584,24 @@ static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
{ } /* end */ { } /* end */
}; };
static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
HDA_CODEC_VOLUME("LineOut Playback Volume", 0x02, 0x0, HDA_OUTPUT),
HDA_CODEC_MUTE("LineOut Playback Switch", 0x14, 0x0, HDA_OUTPUT),
HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
{ } /* end */
};
static struct snd_kcontrol_new alc662_chmode_mixer[] = { static struct snd_kcontrol_new alc662_chmode_mixer[] = {
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -12605,6 +12687,13 @@ static struct hda_verb alc662_eeepc_sue_init_verbs[] = { ...@@ -12605,6 +12687,13 @@ static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
{} {}
}; };
/* Set Unsolicited Event*/
static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
{0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
{}
};
/* /*
* generic initialization of ADC, input mixers and output mixers * generic initialization of ADC, input mixers and output mixers
*/ */
...@@ -12741,6 +12830,40 @@ static void alc662_eeepc_inithook(struct hda_codec *codec) ...@@ -12741,6 +12830,40 @@ static void alc662_eeepc_inithook(struct hda_codec *codec)
alc662_eeepc_mic_automute(codec); alc662_eeepc_mic_automute(codec);
} }
static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
{
unsigned int mute;
unsigned int present;
snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
present = snd_hda_codec_read(codec, 0x14, 0,
AC_VERB_GET_PIN_SENSE, 0);
present = (present & 0x80000000) != 0;
if (present) {
/* mute internal speaker */
snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
HDA_AMP_MUTE, HDA_AMP_MUTE);
} else {
/* unmute internal speaker if necessary */
mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
HDA_AMP_MUTE, mute);
}
}
/* unsolicited event for HP jack sensing */
static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
unsigned int res)
{
if ((res >> 26) == ALC880_HP_EVENT)
alc662_eeepc_ep20_automute(codec);
}
static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
{
alc662_eeepc_ep20_automute(codec);
}
#ifdef CONFIG_SND_HDA_POWER_SAVE #ifdef CONFIG_SND_HDA_POWER_SAVE
#define alc662_loopbacks alc880_loopbacks #define alc662_loopbacks alc880_loopbacks
#endif #endif
...@@ -12762,11 +12885,13 @@ static const char *alc662_models[ALC662_MODEL_LAST] = { ...@@ -12762,11 +12885,13 @@ static const char *alc662_models[ALC662_MODEL_LAST] = {
[ALC662_5ST_DIG] = "6stack-dig", [ALC662_5ST_DIG] = "6stack-dig",
[ALC662_LENOVO_101E] = "lenovo-101e", [ALC662_LENOVO_101E] = "lenovo-101e",
[ALC662_ASUS_EEEPC_P701] = "eeepc-p701", [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
[ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
[ALC662_AUTO] = "auto", [ALC662_AUTO] = "auto",
}; };
static struct snd_pci_quirk alc662_cfg_tbl[] = { static struct snd_pci_quirk alc662_cfg_tbl[] = {
SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
{} {}
}; };
...@@ -12854,6 +12979,21 @@ static struct alc_config_preset alc662_presets[] = { ...@@ -12854,6 +12979,21 @@ static struct alc_config_preset alc662_presets[] = {
.unsol_event = alc662_eeepc_unsol_event, .unsol_event = alc662_eeepc_unsol_event,
.init_hook = alc662_eeepc_inithook, .init_hook = alc662_eeepc_inithook,
}, },
[ALC662_ASUS_EEEPC_EP20] = {
.mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer,
alc662_chmode_mixer },
.init_verbs = { alc662_init_verbs,
alc662_eeepc_ep20_sue_init_verbs },
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
.dac_nids = alc662_dac_nids,
.num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
.adc_nids = alc662_adc_nids,
.num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
.channel_mode = alc662_3ST_6ch_modes,
.input_mux = &alc662_lenovo_101e_capture_source,
.unsol_event = alc662_eeepc_ep20_unsol_event,
.init_hook = alc662_eeepc_ep20_inithook,
},
}; };
...@@ -13013,6 +13153,7 @@ static void alc662_auto_init_multi_out(struct hda_codec *codec) ...@@ -13013,6 +13153,7 @@ static void alc662_auto_init_multi_out(struct hda_codec *codec)
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
int i; int i;
alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
for (i = 0; i <= HDA_SIDE; i++) { for (i = 0; i <= HDA_SIDE; i++) {
hda_nid_t nid = spec->autocfg.line_out_pins[i]; hda_nid_t nid = spec->autocfg.line_out_pins[i];
int pin_type = get_pin_type(spec->autocfg.line_out_type); int pin_type = get_pin_type(spec->autocfg.line_out_type);
......
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