aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
authorJiang zhe <zhe.jiang@intel.com>2008-03-04 05:20:33 -0500
committerTakashi Iwai <tiwai@suse.de>2008-04-24 06:00:20 -0400
commit368c7a95ea324b3f9728ba1c901ac119d409bf4e (patch)
treeefa59798615d22aadcc89f13ac2181d3321fe582 /sound/pci/hda/patch_realtek.c
parentfd2499f0ed765de3ab11c7fd6f37f9fbfaf059ec (diff)
[ALSA] hda-codec - model for alc883 to support M720R
There is no suitable model for M720R (ALSA bug#3781). This patch is to support HP jack-sensing and mixer. Signed-off-by: Jiang zhe <zhe.jiang@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r--sound/pci/hda/patch_realtek.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 33c9505adbae..f321abd91e0c 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -201,6 +201,7 @@ enum {
201 ALC888_3ST_HP, 201 ALC888_3ST_HP,
202 ALC888_6ST_DELL, 202 ALC888_6ST_DELL,
203 ALC883_MITAC, 203 ALC883_MITAC,
204 ALC883_CLEVO_M720R,
204 ALC883_AUTO, 205 ALC883_AUTO,
205 ALC883_MODEL_LAST, 206 ALC883_MODEL_LAST,
206}; 207};
@@ -6645,6 +6646,33 @@ static struct snd_kcontrol_new alc883_mitac_mixer[] = {
6645 { } /* end */ 6646 { } /* end */
6646}; 6647};
6647 6648
6649static struct snd_kcontrol_new alc883_clevo_m720r_mixer[] = {
6650 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6651 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
6652 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6653 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6654 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6655 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6656 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6657 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6658 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6659 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6660 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6661 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6662 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6663 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6664 {
6665 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6666 /* .name = "Capture Source", */
6667 .name = "Input Source",
6668 .count = 2,
6669 .info = alc883_mux_enum_info,
6670 .get = alc883_mux_enum_get,
6671 .put = alc883_mux_enum_put,
6672 },
6673 { } /* end */
6674};
6675
6648static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { 6676static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
6649 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 6677 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6650 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 6678 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
@@ -7178,6 +7206,20 @@ static struct hda_verb alc883_mitac_verbs[] = {
7178 { } /* end */ 7206 { } /* end */
7179}; 7207};
7180 7208
7209static struct hda_verb alc883_clevo_m720r_verbs[] = {
7210 /* HP */
7211 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7212 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7213 /* Int speaker */
7214 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7215 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7216
7217 /* enable unsolicited event */
7218 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7219
7220 { } /* end */
7221};
7222
7181static struct hda_verb alc883_tagra_verbs[] = { 7223static struct hda_verb alc883_tagra_verbs[] = {
7182 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7224 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7183 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7225 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
@@ -7361,6 +7403,26 @@ static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7361 alc883_tagra_automute(codec); 7403 alc883_tagra_automute(codec);
7362} 7404}
7363 7405
7406/* toggle speaker-output according to the hp-jack state */
7407static void alc883_clevo_m720r_automute(struct hda_codec *codec)
7408{
7409 unsigned int present;
7410 unsigned char bits;
7411
7412 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
7413 & AC_PINSENSE_PRESENCE;
7414 bits = present ? HDA_AMP_MUTE : 0;
7415 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7416 HDA_AMP_MUTE, bits);
7417}
7418
7419static void alc883_clevo_m720r_unsol_event(struct hda_codec *codec,
7420 unsigned int res)
7421{
7422 if ((res >> 26) == ALC880_HP_EVENT)
7423 alc883_clevo_m720r_automute(codec);
7424}
7425
7364static void alc883_haier_w66_automute(struct hda_codec *codec) 7426static void alc883_haier_w66_automute(struct hda_codec *codec)
7365{ 7427{
7366 unsigned int present; 7428 unsigned int present;
@@ -7598,6 +7660,7 @@ static const char *alc883_models[ALC883_MODEL_LAST] = {
7598 [ALC888_3ST_HP] = "3stack-hp", 7660 [ALC888_3ST_HP] = "3stack-hp",
7599 [ALC888_6ST_DELL] = "6stack-dell", 7661 [ALC888_6ST_DELL] = "6stack-dell",
7600 [ALC883_MITAC] = "mitac", 7662 [ALC883_MITAC] = "mitac",
7663 [ALC883_CLEVO_M720R] = "clevo-m720r",
7601 [ALC883_AUTO] = "auto", 7664 [ALC883_AUTO] = "auto",
7602}; 7665};
7603 7666
@@ -7638,6 +7701,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
7638 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), 7701 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
7639 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), 7702 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
7640 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), 7703 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
7704 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720R),
7641 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), 7705 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
7642 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), 7706 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
7643 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), 7707 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
@@ -7780,6 +7844,18 @@ static struct alc_config_preset alc883_presets[] = {
7780 .channel_mode = alc883_3ST_2ch_modes, 7844 .channel_mode = alc883_3ST_2ch_modes,
7781 .input_mux = &alc883_capture_source, 7845 .input_mux = &alc883_capture_source,
7782 }, 7846 },
7847 [ALC883_CLEVO_M720R] = {
7848 .mixers = { alc883_clevo_m720r_mixer },
7849 .init_verbs = { alc883_init_verbs, alc883_clevo_m720r_verbs },
7850 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7851 .dac_nids = alc883_dac_nids,
7852 .dig_out_nid = ALC883_DIGOUT_NID,
7853 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7854 .channel_mode = alc883_3ST_2ch_modes,
7855 .input_mux = &alc883_capture_source,
7856 .unsol_event = alc883_clevo_m720r_unsol_event,
7857 .init_hook = alc883_clevo_m720r_automute,
7858 },
7783 [ALC883_LENOVO_101E_2ch] = { 7859 [ALC883_LENOVO_101E_2ch] = {
7784 .mixers = { alc883_lenovo_101e_2ch_mixer}, 7860 .mixers = { alc883_lenovo_101e_2ch_mixer},
7785 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, 7861 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},