diff options
author | Takashi Iwai <tiwai@suse.de> | 2012-01-12 03:59:18 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-01-12 03:59:18 -0500 |
commit | 9e4ce164ee3a1d07580f017069c25d180b0aa785 (patch) | |
tree | 7569661eae727a5a349e4c98dba42ca681857462 /sound | |
parent | 627b79628f56c3deeb17dec1edf6899b49552fa4 (diff) | |
parent | f2cbba7602383cd9cdd21f0a5d0b8bd1aad47b33 (diff) |
Merge branch 'topic/hda' into for-linus
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/Kconfig | 3 | ||||
-rw-r--r-- | sound/core/Makefile | 1 | ||||
-rw-r--r-- | sound/core/ctljack.c | 56 | ||||
-rw-r--r-- | sound/pci/hda/Kconfig | 1 | ||||
-rw-r--r-- | sound/pci/hda/Makefile | 2 | ||||
-rw-r--r-- | sound/pci/hda/alc262_quirks.c | 875 | ||||
-rw-r--r-- | sound/pci/hda/alc880_quirks.c | 193 | ||||
-rw-r--r-- | sound/pci/hda/alc882_quirks.c | 2867 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.c | 302 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.h | 6 | ||||
-rw-r--r-- | sound/pci/hda/hda_intel.c | 106 | ||||
-rw-r--r-- | sound/pci/hda/hda_jack.c | 353 | ||||
-rw-r--r-- | sound/pci/hda/hda_jack.h | 86 | ||||
-rw-r--r-- | sound/pci/hda/hda_local.h | 51 | ||||
-rw-r--r-- | sound/pci/hda/hda_proc.c | 2 | ||||
-rw-r--r-- | sound/pci/hda/patch_analog.c | 1 | ||||
-rw-r--r-- | sound/pci/hda/patch_ca0110.c | 6 | ||||
-rw-r--r-- | sound/pci/hda/patch_cirrus.c | 187 | ||||
-rw-r--r-- | sound/pci/hda/patch_conexant.c | 79 | ||||
-rw-r--r-- | sound/pci/hda/patch_hdmi.c | 59 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 758 | ||||
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 301 | ||||
-rw-r--r-- | sound/pci/hda/patch_via.c | 30 |
23 files changed, 1616 insertions, 4709 deletions
diff --git a/sound/core/Kconfig b/sound/core/Kconfig index 2dc7776e218c..ca6cdf6f9968 100644 --- a/sound/core/Kconfig +++ b/sound/core/Kconfig | |||
@@ -217,6 +217,9 @@ config SND_PCM_XRUN_DEBUG | |||
217 | config SND_VMASTER | 217 | config SND_VMASTER |
218 | bool | 218 | bool |
219 | 219 | ||
220 | config SND_KCTL_JACK | ||
221 | bool | ||
222 | |||
220 | config SND_DMA_SGBUF | 223 | config SND_DMA_SGBUF |
221 | def_bool y | 224 | def_bool y |
222 | depends on X86 | 225 | depends on X86 |
diff --git a/sound/core/Makefile b/sound/core/Makefile index 67c8e9336611..43d4117428ac 100644 --- a/sound/core/Makefile +++ b/sound/core/Makefile | |||
@@ -7,6 +7,7 @@ snd-y := sound.o init.o memory.o info.o control.o misc.o device.o | |||
7 | snd-$(CONFIG_ISA_DMA_API) += isadma.o | 7 | snd-$(CONFIG_ISA_DMA_API) += isadma.o |
8 | snd-$(CONFIG_SND_OSSEMUL) += sound_oss.o info_oss.o | 8 | snd-$(CONFIG_SND_OSSEMUL) += sound_oss.o info_oss.o |
9 | snd-$(CONFIG_SND_VMASTER) += vmaster.o | 9 | snd-$(CONFIG_SND_VMASTER) += vmaster.o |
10 | snd-$(CONFIG_SND_KCTL_JACK) += ctljack.o | ||
10 | snd-$(CONFIG_SND_JACK) += jack.o | 11 | snd-$(CONFIG_SND_JACK) += jack.o |
11 | 12 | ||
12 | snd-pcm-objs := pcm.o pcm_native.o pcm_lib.o pcm_timer.o pcm_misc.o \ | 13 | snd-pcm-objs := pcm.o pcm_native.o pcm_lib.o pcm_timer.o pcm_misc.o \ |
diff --git a/sound/core/ctljack.c b/sound/core/ctljack.c new file mode 100644 index 000000000000..e4b38fbe51da --- /dev/null +++ b/sound/core/ctljack.c | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | * Helper functions for jack-detection kcontrols | ||
3 | * | ||
4 | * Copyright (c) 2011 Takashi Iwai <tiwai@suse.de> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the Free | ||
8 | * Software Foundation; either version 2 of the License, or (at your option) | ||
9 | * any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/export.h> | ||
14 | #include <sound/core.h> | ||
15 | #include <sound/control.h> | ||
16 | |||
17 | #define jack_detect_kctl_info snd_ctl_boolean_mono_info | ||
18 | |||
19 | static int jack_detect_kctl_get(struct snd_kcontrol *kcontrol, | ||
20 | struct snd_ctl_elem_value *ucontrol) | ||
21 | { | ||
22 | ucontrol->value.integer.value[0] = kcontrol->private_value; | ||
23 | return 0; | ||
24 | } | ||
25 | |||
26 | static struct snd_kcontrol_new jack_detect_kctl = { | ||
27 | /* name is filled later */ | ||
28 | .iface = SNDRV_CTL_ELEM_IFACE_CARD, | ||
29 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | ||
30 | .info = jack_detect_kctl_info, | ||
31 | .get = jack_detect_kctl_get, | ||
32 | }; | ||
33 | |||
34 | struct snd_kcontrol * | ||
35 | snd_kctl_jack_new(const char *name, int idx, void *private_data) | ||
36 | { | ||
37 | struct snd_kcontrol *kctl; | ||
38 | kctl = snd_ctl_new1(&jack_detect_kctl, private_data); | ||
39 | if (!kctl) | ||
40 | return NULL; | ||
41 | snprintf(kctl->id.name, sizeof(kctl->id.name), "%s Jack", name); | ||
42 | kctl->id.index = idx; | ||
43 | kctl->private_value = 0; | ||
44 | return kctl; | ||
45 | } | ||
46 | EXPORT_SYMBOL_GPL(snd_kctl_jack_new); | ||
47 | |||
48 | void snd_kctl_jack_report(struct snd_card *card, | ||
49 | struct snd_kcontrol *kctl, bool status) | ||
50 | { | ||
51 | if (kctl->private_value == status) | ||
52 | return; | ||
53 | kctl->private_value = status; | ||
54 | snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); | ||
55 | } | ||
56 | EXPORT_SYMBOL_GPL(snd_kctl_jack_report); | ||
diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig index bb7e102d6726..163b6b5de3eb 100644 --- a/sound/pci/hda/Kconfig +++ b/sound/pci/hda/Kconfig | |||
@@ -2,6 +2,7 @@ menuconfig SND_HDA_INTEL | |||
2 | tristate "Intel HD Audio" | 2 | tristate "Intel HD Audio" |
3 | select SND_PCM | 3 | select SND_PCM |
4 | select SND_VMASTER | 4 | select SND_VMASTER |
5 | select SND_KCTL_JACK | ||
5 | help | 6 | help |
6 | Say Y here to include support for Intel "High Definition | 7 | Say Y here to include support for Intel "High Definition |
7 | Audio" (Azalia) and its compatible devices. | 8 | Audio" (Azalia) and its compatible devices. |
diff --git a/sound/pci/hda/Makefile b/sound/pci/hda/Makefile index f928d6634723..ace157cc3d15 100644 --- a/sound/pci/hda/Makefile +++ b/sound/pci/hda/Makefile | |||
@@ -1,6 +1,6 @@ | |||
1 | snd-hda-intel-objs := hda_intel.o | 1 | snd-hda-intel-objs := hda_intel.o |
2 | 2 | ||
3 | snd-hda-codec-y := hda_codec.o | 3 | snd-hda-codec-y := hda_codec.o hda_jack.o |
4 | snd-hda-codec-$(CONFIG_SND_HDA_GENERIC) += hda_generic.o | 4 | snd-hda-codec-$(CONFIG_SND_HDA_GENERIC) += hda_generic.o |
5 | snd-hda-codec-$(CONFIG_PROC_FS) += hda_proc.o | 5 | snd-hda-codec-$(CONFIG_PROC_FS) += hda_proc.o |
6 | snd-hda-codec-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o | 6 | snd-hda-codec-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o |
diff --git a/sound/pci/hda/alc262_quirks.c b/sound/pci/hda/alc262_quirks.c deleted file mode 100644 index 7894b2b5aacf..000000000000 --- a/sound/pci/hda/alc262_quirks.c +++ /dev/null | |||
@@ -1,875 +0,0 @@ | |||
1 | /* | ||
2 | * ALC262 quirk models | ||
3 | * included by patch_realtek.c | ||
4 | */ | ||
5 | |||
6 | /* ALC262 models */ | ||
7 | enum { | ||
8 | ALC262_AUTO, | ||
9 | ALC262_BASIC, | ||
10 | ALC262_HIPPO, | ||
11 | ALC262_HIPPO_1, | ||
12 | ALC262_FUJITSU, | ||
13 | ALC262_BENQ_ED8, | ||
14 | ALC262_BENQ_T31, | ||
15 | ALC262_ULTRA, | ||
16 | ALC262_LENOVO_3000, | ||
17 | ALC262_NEC, | ||
18 | ALC262_TOSHIBA_S06, | ||
19 | ALC262_TOSHIBA_RX1, | ||
20 | ALC262_TYAN, | ||
21 | ALC262_MODEL_LAST /* last tag */ | ||
22 | }; | ||
23 | |||
24 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID | ||
25 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID | ||
26 | |||
27 | #define alc262_dac_nids alc260_dac_nids | ||
28 | #define alc262_adc_nids alc882_adc_nids | ||
29 | #define alc262_adc_nids_alt alc882_adc_nids_alt | ||
30 | #define alc262_capsrc_nids alc882_capsrc_nids | ||
31 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt | ||
32 | |||
33 | #define alc262_modes alc260_modes | ||
34 | #define alc262_capture_source alc882_capture_source | ||
35 | |||
36 | static const hda_nid_t alc262_dmic_adc_nids[1] = { | ||
37 | /* ADC0 */ | ||
38 | 0x09 | ||
39 | }; | ||
40 | |||
41 | static const hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; | ||
42 | |||
43 | static const struct snd_kcontrol_new alc262_base_mixer[] = { | ||
44 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
45 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
46 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
47 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
48 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
49 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
50 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
51 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
52 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
53 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
54 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
55 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
56 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), | ||
57 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
58 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
59 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | ||
60 | { } /* end */ | ||
61 | }; | ||
62 | |||
63 | /* bind hp and internal speaker mute (with plug check) as master switch */ | ||
64 | |||
65 | static int alc262_hippo_master_sw_get(struct snd_kcontrol *kcontrol, | ||
66 | struct snd_ctl_elem_value *ucontrol) | ||
67 | { | ||
68 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
69 | struct alc_spec *spec = codec->spec; | ||
70 | *ucontrol->value.integer.value = !spec->master_mute; | ||
71 | return 0; | ||
72 | } | ||
73 | |||
74 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, | ||
75 | struct snd_ctl_elem_value *ucontrol) | ||
76 | { | ||
77 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
78 | struct alc_spec *spec = codec->spec; | ||
79 | int val = !*ucontrol->value.integer.value; | ||
80 | |||
81 | if (val == spec->master_mute) | ||
82 | return 0; | ||
83 | spec->master_mute = val; | ||
84 | update_outputs(codec); | ||
85 | return 1; | ||
86 | } | ||
87 | |||
88 | #define ALC262_HIPPO_MASTER_SWITCH \ | ||
89 | { \ | ||
90 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | ||
91 | .name = "Master Playback Switch", \ | ||
92 | .info = snd_ctl_boolean_mono_info, \ | ||
93 | .get = alc262_hippo_master_sw_get, \ | ||
94 | .put = alc262_hippo_master_sw_put, \ | ||
95 | }, \ | ||
96 | { \ | ||
97 | .iface = NID_MAPPING, \ | ||
98 | .name = "Master Playback Switch", \ | ||
99 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ | ||
100 | (SUBDEV_SPEAKER(0) << 16), \ | ||
101 | } | ||
102 | |||
103 | #define alc262_hp_master_sw_get alc262_hippo_master_sw_get | ||
104 | #define alc262_hp_master_sw_put alc262_hippo_master_sw_put | ||
105 | |||
106 | static const struct snd_kcontrol_new alc262_hippo_mixer[] = { | ||
107 | ALC262_HIPPO_MASTER_SWITCH, | ||
108 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
109 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
110 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
111 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
112 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
113 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
114 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
115 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
116 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
117 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
118 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
119 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
120 | { } /* end */ | ||
121 | }; | ||
122 | |||
123 | static const struct snd_kcontrol_new alc262_hippo1_mixer[] = { | ||
124 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
125 | ALC262_HIPPO_MASTER_SWITCH, | ||
126 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
127 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
128 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
129 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
130 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
131 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
132 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
133 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
134 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
135 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
136 | { } /* end */ | ||
137 | }; | ||
138 | |||
139 | /* mute/unmute internal speaker according to the hp jack and mute state */ | ||
140 | static void alc262_hippo_setup(struct hda_codec *codec) | ||
141 | { | ||
142 | struct alc_spec *spec = codec->spec; | ||
143 | |||
144 | spec->autocfg.hp_pins[0] = 0x15; | ||
145 | spec->autocfg.speaker_pins[0] = 0x14; | ||
146 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
147 | } | ||
148 | |||
149 | static void alc262_hippo1_setup(struct hda_codec *codec) | ||
150 | { | ||
151 | struct alc_spec *spec = codec->spec; | ||
152 | |||
153 | spec->autocfg.hp_pins[0] = 0x1b; | ||
154 | spec->autocfg.speaker_pins[0] = 0x14; | ||
155 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
156 | } | ||
157 | |||
158 | |||
159 | static const struct snd_kcontrol_new alc262_sony_mixer[] = { | ||
160 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
161 | ALC262_HIPPO_MASTER_SWITCH, | ||
162 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
163 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
164 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
165 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
166 | { } /* end */ | ||
167 | }; | ||
168 | |||
169 | static const struct snd_kcontrol_new alc262_benq_t31_mixer[] = { | ||
170 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
171 | ALC262_HIPPO_MASTER_SWITCH, | ||
172 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
173 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
174 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
175 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
176 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
177 | { } /* end */ | ||
178 | }; | ||
179 | |||
180 | static const struct snd_kcontrol_new alc262_tyan_mixer[] = { | ||
181 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
182 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | ||
183 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), | ||
184 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), | ||
185 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
186 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
187 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
188 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
189 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
190 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
191 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
192 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
193 | { } /* end */ | ||
194 | }; | ||
195 | |||
196 | static const struct hda_verb alc262_tyan_verbs[] = { | ||
197 | /* Headphone automute */ | ||
198 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
199 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
200 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
201 | |||
202 | /* P11 AUX_IN, white 4-pin connector */ | ||
203 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
204 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, | ||
205 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, | ||
206 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, | ||
207 | |||
208 | {} | ||
209 | }; | ||
210 | |||
211 | /* unsolicited event for HP jack sensing */ | ||
212 | static void alc262_tyan_setup(struct hda_codec *codec) | ||
213 | { | ||
214 | struct alc_spec *spec = codec->spec; | ||
215 | |||
216 | spec->autocfg.hp_pins[0] = 0x1b; | ||
217 | spec->autocfg.speaker_pins[0] = 0x15; | ||
218 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
219 | } | ||
220 | |||
221 | |||
222 | #define alc262_capture_mixer alc882_capture_mixer | ||
223 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer | ||
224 | |||
225 | /* | ||
226 | * generic initialization of ADC, input mixers and output mixers | ||
227 | */ | ||
228 | static const struct hda_verb alc262_init_verbs[] = { | ||
229 | /* | ||
230 | * Unmute ADC0-2 and set the default input to mic-in | ||
231 | */ | ||
232 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
233 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
234 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
235 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
236 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
237 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
238 | |||
239 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | ||
240 | * mixer widget | ||
241 | * Note: PASD motherboards uses the Line In 2 as the input for | ||
242 | * front panel mic (mic 2) | ||
243 | */ | ||
244 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | ||
245 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
246 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
247 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
248 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
249 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
250 | |||
251 | /* | ||
252 | * Set up output mixers (0x0c - 0x0e) | ||
253 | */ | ||
254 | /* set vol=0 to output mixers */ | ||
255 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
256 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
257 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
258 | /* set up input amps for analog loopback */ | ||
259 | /* Amp Indices: DAC = 0, mixer = 1 */ | ||
260 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
261 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
262 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
263 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
264 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
265 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
266 | |||
267 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | ||
268 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | ||
269 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | ||
270 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
271 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
272 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
273 | |||
274 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | ||
275 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | ||
276 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | ||
277 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | ||
278 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | ||
279 | |||
280 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
281 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
282 | |||
283 | /* FIXME: use matrix-type input source selection */ | ||
284 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | ||
285 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | ||
286 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
287 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | ||
288 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | ||
289 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | ||
290 | /* Input mixer2 */ | ||
291 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
292 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | ||
293 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | ||
294 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | ||
295 | /* Input mixer3 */ | ||
296 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
297 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | ||
298 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | ||
299 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | ||
300 | |||
301 | { } | ||
302 | }; | ||
303 | |||
304 | static const struct hda_verb alc262_eapd_verbs[] = { | ||
305 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
306 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
307 | { } | ||
308 | }; | ||
309 | |||
310 | static const struct hda_verb alc262_hippo1_unsol_verbs[] = { | ||
311 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | ||
312 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
313 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | ||
314 | |||
315 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
316 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
317 | {} | ||
318 | }; | ||
319 | |||
320 | static const struct hda_verb alc262_sony_unsol_verbs[] = { | ||
321 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | ||
322 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
323 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic | ||
324 | |||
325 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
326 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
327 | {} | ||
328 | }; | ||
329 | |||
330 | static const struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { | ||
331 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
332 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
333 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
334 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
335 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
336 | { } /* end */ | ||
337 | }; | ||
338 | |||
339 | static const struct hda_verb alc262_toshiba_s06_verbs[] = { | ||
340 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
341 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
342 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
343 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
344 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, | ||
345 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
346 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT}, | ||
347 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
348 | {} | ||
349 | }; | ||
350 | |||
351 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) | ||
352 | { | ||
353 | struct alc_spec *spec = codec->spec; | ||
354 | |||
355 | spec->autocfg.hp_pins[0] = 0x15; | ||
356 | spec->autocfg.speaker_pins[0] = 0x14; | ||
357 | spec->ext_mic_pin = 0x18; | ||
358 | spec->int_mic_pin = 0x12; | ||
359 | spec->auto_mic = 1; | ||
360 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_PIN); | ||
361 | } | ||
362 | |||
363 | /* | ||
364 | * nec model | ||
365 | * 0x15 = headphone | ||
366 | * 0x16 = internal speaker | ||
367 | * 0x18 = external mic | ||
368 | */ | ||
369 | |||
370 | static const struct snd_kcontrol_new alc262_nec_mixer[] = { | ||
371 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | ||
372 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), | ||
373 | |||
374 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
375 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
376 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
377 | |||
378 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
379 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
380 | { } /* end */ | ||
381 | }; | ||
382 | |||
383 | static const struct hda_verb alc262_nec_verbs[] = { | ||
384 | /* Unmute Speaker */ | ||
385 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
386 | |||
387 | /* Headphone */ | ||
388 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
389 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
390 | |||
391 | /* External mic to headphone */ | ||
392 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
393 | /* External mic to speaker */ | ||
394 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
395 | {} | ||
396 | }; | ||
397 | |||
398 | /* | ||
399 | * fujitsu model | ||
400 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, | ||
401 | * 0x1b = port replicator headphone out | ||
402 | */ | ||
403 | |||
404 | static const struct hda_verb alc262_fujitsu_unsol_verbs[] = { | ||
405 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
406 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
407 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
408 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
409 | {} | ||
410 | }; | ||
411 | |||
412 | static const struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { | ||
413 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
414 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
415 | {} | ||
416 | }; | ||
417 | |||
418 | static const struct hda_verb alc262_lenovo_3000_init_verbs[] = { | ||
419 | /* Front Mic pin: input vref at 50% */ | ||
420 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | ||
421 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
422 | {} | ||
423 | }; | ||
424 | |||
425 | static const struct hda_input_mux alc262_fujitsu_capture_source = { | ||
426 | .num_items = 3, | ||
427 | .items = { | ||
428 | { "Mic", 0x0 }, | ||
429 | { "Internal Mic", 0x1 }, | ||
430 | { "CD", 0x4 }, | ||
431 | }, | ||
432 | }; | ||
433 | |||
434 | static void alc262_fujitsu_setup(struct hda_codec *codec) | ||
435 | { | ||
436 | struct alc_spec *spec = codec->spec; | ||
437 | |||
438 | spec->autocfg.hp_pins[0] = 0x14; | ||
439 | spec->autocfg.hp_pins[1] = 0x1b; | ||
440 | spec->autocfg.speaker_pins[0] = 0x15; | ||
441 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
442 | } | ||
443 | |||
444 | /* bind volumes of both NID 0x0c and 0x0d */ | ||
445 | static const struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { | ||
446 | .ops = &snd_hda_bind_vol, | ||
447 | .values = { | ||
448 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), | ||
449 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), | ||
450 | 0 | ||
451 | }, | ||
452 | }; | ||
453 | |||
454 | static const struct snd_kcontrol_new alc262_fujitsu_mixer[] = { | ||
455 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | ||
456 | { | ||
457 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
458 | .name = "Master Playback Switch", | ||
459 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x14, | ||
460 | .info = snd_ctl_boolean_mono_info, | ||
461 | .get = alc262_hp_master_sw_get, | ||
462 | .put = alc262_hp_master_sw_put, | ||
463 | }, | ||
464 | { | ||
465 | .iface = NID_MAPPING, | ||
466 | .name = "Master Playback Switch", | ||
467 | .private_value = 0x1b, | ||
468 | }, | ||
469 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
470 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
471 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
472 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
473 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
474 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
475 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
476 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
477 | { } /* end */ | ||
478 | }; | ||
479 | |||
480 | static void alc262_lenovo_3000_setup(struct hda_codec *codec) | ||
481 | { | ||
482 | struct alc_spec *spec = codec->spec; | ||
483 | |||
484 | spec->autocfg.hp_pins[0] = 0x1b; | ||
485 | spec->autocfg.speaker_pins[0] = 0x14; | ||
486 | spec->autocfg.speaker_pins[1] = 0x16; | ||
487 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
488 | } | ||
489 | |||
490 | static const struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { | ||
491 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | ||
492 | { | ||
493 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
494 | .name = "Master Playback Switch", | ||
495 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x1b, | ||
496 | .info = snd_ctl_boolean_mono_info, | ||
497 | .get = alc262_hp_master_sw_get, | ||
498 | .put = alc262_hp_master_sw_put, | ||
499 | }, | ||
500 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
501 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
502 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
503 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
504 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
505 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
506 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
507 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
508 | { } /* end */ | ||
509 | }; | ||
510 | |||
511 | static const struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { | ||
512 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | ||
513 | ALC262_HIPPO_MASTER_SWITCH, | ||
514 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
515 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
516 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
517 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
518 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
519 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
520 | { } /* end */ | ||
521 | }; | ||
522 | |||
523 | /* additional init verbs for Benq laptops */ | ||
524 | static const struct hda_verb alc262_EAPD_verbs[] = { | ||
525 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | ||
526 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | ||
527 | {} | ||
528 | }; | ||
529 | |||
530 | static const struct hda_verb alc262_benq_t31_EAPD_verbs[] = { | ||
531 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
532 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
533 | |||
534 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | ||
535 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, | ||
536 | {} | ||
537 | }; | ||
538 | |||
539 | /* Samsung Q1 Ultra Vista model setup */ | ||
540 | static const struct snd_kcontrol_new alc262_ultra_mixer[] = { | ||
541 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
542 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | ||
543 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
544 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
545 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
546 | HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT), | ||
547 | { } /* end */ | ||
548 | }; | ||
549 | |||
550 | static const struct hda_verb alc262_ultra_verbs[] = { | ||
551 | /* output mixer */ | ||
552 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
553 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
554 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
555 | /* speaker */ | ||
556 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
557 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
558 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
559 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
560 | /* HP */ | ||
561 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
562 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
563 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
564 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
565 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
566 | /* internal mic */ | ||
567 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
568 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
569 | /* ADC, choose mic */ | ||
570 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
571 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
572 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
573 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
574 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
575 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
576 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | ||
577 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | ||
578 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | ||
579 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, | ||
580 | {} | ||
581 | }; | ||
582 | |||
583 | /* mute/unmute internal speaker according to the hp jack and mute state */ | ||
584 | static void alc262_ultra_automute(struct hda_codec *codec) | ||
585 | { | ||
586 | struct alc_spec *spec = codec->spec; | ||
587 | unsigned int mute; | ||
588 | |||
589 | mute = 0; | ||
590 | /* auto-mute only when HP is used as HP */ | ||
591 | if (!spec->cur_mux[0]) { | ||
592 | spec->hp_jack_present = snd_hda_jack_detect(codec, 0x15); | ||
593 | if (spec->hp_jack_present) | ||
594 | mute = HDA_AMP_MUTE; | ||
595 | } | ||
596 | /* mute/unmute internal speaker */ | ||
597 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | ||
598 | HDA_AMP_MUTE, mute); | ||
599 | /* mute/unmute HP */ | ||
600 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | ||
601 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); | ||
602 | } | ||
603 | |||
604 | /* unsolicited event for HP jack sensing */ | ||
605 | static void alc262_ultra_unsol_event(struct hda_codec *codec, | ||
606 | unsigned int res) | ||
607 | { | ||
608 | if ((res >> 26) != ALC_HP_EVENT) | ||
609 | return; | ||
610 | alc262_ultra_automute(codec); | ||
611 | } | ||
612 | |||
613 | static const struct hda_input_mux alc262_ultra_capture_source = { | ||
614 | .num_items = 2, | ||
615 | .items = { | ||
616 | { "Mic", 0x1 }, | ||
617 | { "Headphone", 0x7 }, | ||
618 | }, | ||
619 | }; | ||
620 | |||
621 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, | ||
622 | struct snd_ctl_elem_value *ucontrol) | ||
623 | { | ||
624 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
625 | struct alc_spec *spec = codec->spec; | ||
626 | int ret; | ||
627 | |||
628 | ret = alc_mux_enum_put(kcontrol, ucontrol); | ||
629 | if (!ret) | ||
630 | return 0; | ||
631 | /* reprogram the HP pin as mic or HP according to the input source */ | ||
632 | snd_hda_codec_write_cache(codec, 0x15, 0, | ||
633 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
634 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); | ||
635 | alc262_ultra_automute(codec); /* mute/unmute HP */ | ||
636 | return ret; | ||
637 | } | ||
638 | |||
639 | static const struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { | ||
640 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), | ||
641 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), | ||
642 | { | ||
643 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
644 | .name = "Capture Source", | ||
645 | .info = alc_mux_enum_info, | ||
646 | .get = alc_mux_enum_get, | ||
647 | .put = alc262_ultra_mux_enum_put, | ||
648 | }, | ||
649 | { | ||
650 | .iface = NID_MAPPING, | ||
651 | .name = "Capture Source", | ||
652 | .private_value = 0x15, | ||
653 | }, | ||
654 | { } /* end */ | ||
655 | }; | ||
656 | |||
657 | static const struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { | ||
658 | |||
659 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ | ||
660 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
661 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
662 | |||
663 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ | ||
664 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ | ||
665 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, | ||
666 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, | ||
667 | |||
668 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ | ||
669 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
670 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
671 | {} | ||
672 | }; | ||
673 | |||
674 | /* | ||
675 | * configuration and preset | ||
676 | */ | ||
677 | static const char * const alc262_models[ALC262_MODEL_LAST] = { | ||
678 | [ALC262_BASIC] = "basic", | ||
679 | [ALC262_HIPPO] = "hippo", | ||
680 | [ALC262_HIPPO_1] = "hippo_1", | ||
681 | [ALC262_FUJITSU] = "fujitsu", | ||
682 | [ALC262_BENQ_ED8] = "benq", | ||
683 | [ALC262_BENQ_T31] = "benq-t31", | ||
684 | [ALC262_TOSHIBA_S06] = "toshiba-s06", | ||
685 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", | ||
686 | [ALC262_ULTRA] = "ultra", | ||
687 | [ALC262_LENOVO_3000] = "lenovo-3000", | ||
688 | [ALC262_NEC] = "nec", | ||
689 | [ALC262_TYAN] = "tyan", | ||
690 | [ALC262_AUTO] = "auto", | ||
691 | }; | ||
692 | |||
693 | static const struct snd_pci_quirk alc262_cfg_tbl[] = { | ||
694 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), | ||
695 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), | ||
696 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", | ||
697 | ALC262_TOSHIBA_RX1), | ||
698 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), | ||
699 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), | ||
700 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), | ||
701 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), | ||
702 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", | ||
703 | ALC262_ULTRA), | ||
704 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), | ||
705 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), | ||
706 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), | ||
707 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), | ||
708 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), | ||
709 | {} | ||
710 | }; | ||
711 | |||
712 | static const struct alc_config_preset alc262_presets[] = { | ||
713 | [ALC262_BASIC] = { | ||
714 | .mixers = { alc262_base_mixer }, | ||
715 | .init_verbs = { alc262_init_verbs }, | ||
716 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
717 | .dac_nids = alc262_dac_nids, | ||
718 | .hp_nid = 0x03, | ||
719 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
720 | .channel_mode = alc262_modes, | ||
721 | .input_mux = &alc262_capture_source, | ||
722 | }, | ||
723 | [ALC262_HIPPO] = { | ||
724 | .mixers = { alc262_hippo_mixer }, | ||
725 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, | ||
726 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
727 | .dac_nids = alc262_dac_nids, | ||
728 | .hp_nid = 0x03, | ||
729 | .dig_out_nid = ALC262_DIGOUT_NID, | ||
730 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
731 | .channel_mode = alc262_modes, | ||
732 | .input_mux = &alc262_capture_source, | ||
733 | .unsol_event = alc_sku_unsol_event, | ||
734 | .setup = alc262_hippo_setup, | ||
735 | .init_hook = alc_inithook, | ||
736 | }, | ||
737 | [ALC262_HIPPO_1] = { | ||
738 | .mixers = { alc262_hippo1_mixer }, | ||
739 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, | ||
740 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
741 | .dac_nids = alc262_dac_nids, | ||
742 | .hp_nid = 0x02, | ||
743 | .dig_out_nid = ALC262_DIGOUT_NID, | ||
744 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
745 | .channel_mode = alc262_modes, | ||
746 | .input_mux = &alc262_capture_source, | ||
747 | .unsol_event = alc_sku_unsol_event, | ||
748 | .setup = alc262_hippo1_setup, | ||
749 | .init_hook = alc_inithook, | ||
750 | }, | ||
751 | [ALC262_FUJITSU] = { | ||
752 | .mixers = { alc262_fujitsu_mixer }, | ||
753 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, | ||
754 | alc262_fujitsu_unsol_verbs }, | ||
755 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
756 | .dac_nids = alc262_dac_nids, | ||
757 | .hp_nid = 0x03, | ||
758 | .dig_out_nid = ALC262_DIGOUT_NID, | ||
759 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
760 | .channel_mode = alc262_modes, | ||
761 | .input_mux = &alc262_fujitsu_capture_source, | ||
762 | .unsol_event = alc_sku_unsol_event, | ||
763 | .setup = alc262_fujitsu_setup, | ||
764 | .init_hook = alc_inithook, | ||
765 | }, | ||
766 | [ALC262_BENQ_ED8] = { | ||
767 | .mixers = { alc262_base_mixer }, | ||
768 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, | ||
769 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
770 | .dac_nids = alc262_dac_nids, | ||
771 | .hp_nid = 0x03, | ||
772 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
773 | .channel_mode = alc262_modes, | ||
774 | .input_mux = &alc262_capture_source, | ||
775 | }, | ||
776 | [ALC262_BENQ_T31] = { | ||
777 | .mixers = { alc262_benq_t31_mixer }, | ||
778 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, | ||
779 | alc_hp15_unsol_verbs }, | ||
780 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
781 | .dac_nids = alc262_dac_nids, | ||
782 | .hp_nid = 0x03, | ||
783 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
784 | .channel_mode = alc262_modes, | ||
785 | .input_mux = &alc262_capture_source, | ||
786 | .unsol_event = alc_sku_unsol_event, | ||
787 | .setup = alc262_hippo_setup, | ||
788 | .init_hook = alc_inithook, | ||
789 | }, | ||
790 | [ALC262_ULTRA] = { | ||
791 | .mixers = { alc262_ultra_mixer }, | ||
792 | .cap_mixer = alc262_ultra_capture_mixer, | ||
793 | .init_verbs = { alc262_ultra_verbs }, | ||
794 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
795 | .dac_nids = alc262_dac_nids, | ||
796 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
797 | .channel_mode = alc262_modes, | ||
798 | .input_mux = &alc262_ultra_capture_source, | ||
799 | .adc_nids = alc262_adc_nids, /* ADC0 */ | ||
800 | .capsrc_nids = alc262_capsrc_nids, | ||
801 | .num_adc_nids = 1, /* single ADC */ | ||
802 | .unsol_event = alc262_ultra_unsol_event, | ||
803 | .init_hook = alc262_ultra_automute, | ||
804 | }, | ||
805 | [ALC262_LENOVO_3000] = { | ||
806 | .mixers = { alc262_lenovo_3000_mixer }, | ||
807 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, | ||
808 | alc262_lenovo_3000_unsol_verbs, | ||
809 | alc262_lenovo_3000_init_verbs }, | ||
810 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
811 | .dac_nids = alc262_dac_nids, | ||
812 | .hp_nid = 0x03, | ||
813 | .dig_out_nid = ALC262_DIGOUT_NID, | ||
814 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
815 | .channel_mode = alc262_modes, | ||
816 | .input_mux = &alc262_fujitsu_capture_source, | ||
817 | .unsol_event = alc_sku_unsol_event, | ||
818 | .setup = alc262_lenovo_3000_setup, | ||
819 | .init_hook = alc_inithook, | ||
820 | }, | ||
821 | [ALC262_NEC] = { | ||
822 | .mixers = { alc262_nec_mixer }, | ||
823 | .init_verbs = { alc262_nec_verbs }, | ||
824 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
825 | .dac_nids = alc262_dac_nids, | ||
826 | .hp_nid = 0x03, | ||
827 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
828 | .channel_mode = alc262_modes, | ||
829 | .input_mux = &alc262_capture_source, | ||
830 | }, | ||
831 | [ALC262_TOSHIBA_S06] = { | ||
832 | .mixers = { alc262_toshiba_s06_mixer }, | ||
833 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, | ||
834 | alc262_eapd_verbs }, | ||
835 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
836 | .capsrc_nids = alc262_dmic_capsrc_nids, | ||
837 | .dac_nids = alc262_dac_nids, | ||
838 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ | ||
839 | .num_adc_nids = 1, /* single ADC */ | ||
840 | .dig_out_nid = ALC262_DIGOUT_NID, | ||
841 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
842 | .channel_mode = alc262_modes, | ||
843 | .unsol_event = alc_sku_unsol_event, | ||
844 | .setup = alc262_toshiba_s06_setup, | ||
845 | .init_hook = alc_inithook, | ||
846 | }, | ||
847 | [ALC262_TOSHIBA_RX1] = { | ||
848 | .mixers = { alc262_toshiba_rx1_mixer }, | ||
849 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, | ||
850 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
851 | .dac_nids = alc262_dac_nids, | ||
852 | .hp_nid = 0x03, | ||
853 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
854 | .channel_mode = alc262_modes, | ||
855 | .input_mux = &alc262_capture_source, | ||
856 | .unsol_event = alc_sku_unsol_event, | ||
857 | .setup = alc262_hippo_setup, | ||
858 | .init_hook = alc_inithook, | ||
859 | }, | ||
860 | [ALC262_TYAN] = { | ||
861 | .mixers = { alc262_tyan_mixer }, | ||
862 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, | ||
863 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
864 | .dac_nids = alc262_dac_nids, | ||
865 | .hp_nid = 0x02, | ||
866 | .dig_out_nid = ALC262_DIGOUT_NID, | ||
867 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
868 | .channel_mode = alc262_modes, | ||
869 | .input_mux = &alc262_capture_source, | ||
870 | .unsol_event = alc_sku_unsol_event, | ||
871 | .setup = alc262_tyan_setup, | ||
872 | .init_hook = alc_hp_automute, | ||
873 | }, | ||
874 | }; | ||
875 | |||
diff --git a/sound/pci/hda/alc880_quirks.c b/sound/pci/hda/alc880_quirks.c index bea22edcfd8c..5b68435d195b 100644 --- a/sound/pci/hda/alc880_quirks.c +++ b/sound/pci/hda/alc880_quirks.c | |||
@@ -26,8 +26,6 @@ enum { | |||
26 | ALC880_CLEVO, | 26 | ALC880_CLEVO, |
27 | ALC880_TCL_S700, | 27 | ALC880_TCL_S700, |
28 | ALC880_LG, | 28 | ALC880_LG, |
29 | ALC880_LG_LW, | ||
30 | ALC880_MEDION_RIM, | ||
31 | #ifdef CONFIG_SND_DEBUG | 29 | #ifdef CONFIG_SND_DEBUG |
32 | ALC880_TEST, | 30 | ALC880_TEST, |
33 | #endif | 31 | #endif |
@@ -1052,163 +1050,6 @@ static void alc880_lg_setup(struct hda_codec *codec) | |||
1052 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | 1050 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
1053 | } | 1051 | } |
1054 | 1052 | ||
1055 | /* | ||
1056 | * LG LW20 | ||
1057 | * | ||
1058 | * Pin assignment: | ||
1059 | * Speaker-out: 0x14 | ||
1060 | * Mic-In: 0x18 | ||
1061 | * Built-in Mic-In: 0x19 | ||
1062 | * Line-In: 0x1b | ||
1063 | * HP-Out: 0x1a | ||
1064 | * SPDIF-Out: 0x1e | ||
1065 | */ | ||
1066 | |||
1067 | static const struct hda_input_mux alc880_lg_lw_capture_source = { | ||
1068 | .num_items = 3, | ||
1069 | .items = { | ||
1070 | { "Mic", 0x0 }, | ||
1071 | { "Internal Mic", 0x1 }, | ||
1072 | { "Line In", 0x2 }, | ||
1073 | }, | ||
1074 | }; | ||
1075 | |||
1076 | #define alc880_lg_lw_modes alc880_threestack_modes | ||
1077 | |||
1078 | static const struct snd_kcontrol_new alc880_lg_lw_mixer[] = { | ||
1079 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
1080 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
1081 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
1082 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), | ||
1083 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | ||
1084 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
1085 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
1086 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
1087 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
1088 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
1089 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
1090 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
1091 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
1092 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
1093 | { | ||
1094 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
1095 | .name = "Channel Mode", | ||
1096 | .info = alc_ch_mode_info, | ||
1097 | .get = alc_ch_mode_get, | ||
1098 | .put = alc_ch_mode_put, | ||
1099 | }, | ||
1100 | { } /* end */ | ||
1101 | }; | ||
1102 | |||
1103 | static const struct hda_verb alc880_lg_lw_init_verbs[] = { | ||
1104 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | ||
1105 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | ||
1106 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ | ||
1107 | |||
1108 | /* set capture source to mic-in */ | ||
1109 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
1110 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
1111 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
1112 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | ||
1113 | /* speaker-out */ | ||
1114 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
1115 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
1116 | /* HP-out */ | ||
1117 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
1118 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
1119 | /* mic-in to input */ | ||
1120 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
1121 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
1122 | /* built-in mic */ | ||
1123 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
1124 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
1125 | /* jack sense */ | ||
1126 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
1127 | { } | ||
1128 | }; | ||
1129 | |||
1130 | /* toggle speaker-output according to the hp-jack state */ | ||
1131 | static void alc880_lg_lw_setup(struct hda_codec *codec) | ||
1132 | { | ||
1133 | struct alc_spec *spec = codec->spec; | ||
1134 | |||
1135 | spec->autocfg.hp_pins[0] = 0x1b; | ||
1136 | spec->autocfg.speaker_pins[0] = 0x14; | ||
1137 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
1138 | } | ||
1139 | |||
1140 | static const struct snd_kcontrol_new alc880_medion_rim_mixer[] = { | ||
1141 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
1142 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | ||
1143 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
1144 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
1145 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
1146 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
1147 | { } /* end */ | ||
1148 | }; | ||
1149 | |||
1150 | static const struct hda_input_mux alc880_medion_rim_capture_source = { | ||
1151 | .num_items = 2, | ||
1152 | .items = { | ||
1153 | { "Mic", 0x0 }, | ||
1154 | { "Internal Mic", 0x1 }, | ||
1155 | }, | ||
1156 | }; | ||
1157 | |||
1158 | static const struct hda_verb alc880_medion_rim_init_verbs[] = { | ||
1159 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | ||
1160 | |||
1161 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
1162 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
1163 | |||
1164 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | ||
1165 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
1166 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
1167 | /* Mic2 (as headphone out) for HP output */ | ||
1168 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
1169 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
1170 | /* Internal Speaker */ | ||
1171 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
1172 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
1173 | |||
1174 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | ||
1175 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | ||
1176 | |||
1177 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
1178 | { } | ||
1179 | }; | ||
1180 | |||
1181 | /* toggle speaker-output according to the hp-jack state */ | ||
1182 | static void alc880_medion_rim_automute(struct hda_codec *codec) | ||
1183 | { | ||
1184 | struct alc_spec *spec = codec->spec; | ||
1185 | alc_hp_automute(codec); | ||
1186 | /* toggle EAPD */ | ||
1187 | if (spec->hp_jack_present) | ||
1188 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); | ||
1189 | else | ||
1190 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); | ||
1191 | } | ||
1192 | |||
1193 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, | ||
1194 | unsigned int res) | ||
1195 | { | ||
1196 | /* Looks like the unsol event is incompatible with the standard | ||
1197 | * definition. 4bit tag is placed at 28 bit! | ||
1198 | */ | ||
1199 | if ((res >> 28) == ALC_HP_EVENT) | ||
1200 | alc880_medion_rim_automute(codec); | ||
1201 | } | ||
1202 | |||
1203 | static void alc880_medion_rim_setup(struct hda_codec *codec) | ||
1204 | { | ||
1205 | struct alc_spec *spec = codec->spec; | ||
1206 | |||
1207 | spec->autocfg.hp_pins[0] = 0x14; | ||
1208 | spec->autocfg.speaker_pins[0] = 0x1b; | ||
1209 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
1210 | } | ||
1211 | |||
1212 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 1053 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
1213 | static const struct hda_amp_list alc880_lg_loopbacks[] = { | 1054 | static const struct hda_amp_list alc880_lg_loopbacks[] = { |
1214 | { 0x0b, HDA_INPUT, 1 }, | 1055 | { 0x0b, HDA_INPUT, 1 }, |
@@ -1505,8 +1346,6 @@ static const char * const alc880_models[ALC880_MODEL_LAST] = { | |||
1505 | [ALC880_FUJITSU] = "fujitsu", | 1346 | [ALC880_FUJITSU] = "fujitsu", |
1506 | [ALC880_F1734] = "F1734", | 1347 | [ALC880_F1734] = "F1734", |
1507 | [ALC880_LG] = "lg", | 1348 | [ALC880_LG] = "lg", |
1508 | [ALC880_LG_LW] = "lg-lw", | ||
1509 | [ALC880_MEDION_RIM] = "medion", | ||
1510 | #ifdef CONFIG_SND_DEBUG | 1349 | #ifdef CONFIG_SND_DEBUG |
1511 | [ALC880_TEST] = "test", | 1350 | [ALC880_TEST] = "test", |
1512 | #endif | 1351 | #endif |
@@ -1557,18 +1396,15 @@ static const struct snd_pci_quirk alc880_cfg_tbl[] = { | |||
1557 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), | 1396 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
1558 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), | 1397 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
1559 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), | 1398 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
1560 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), | ||
1561 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), | 1399 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
1562 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), | 1400 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
1563 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), | 1401 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
1564 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), | 1402 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
1565 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), | 1403 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
1566 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), | 1404 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
1567 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), | ||
1568 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), | 1405 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
1569 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG), | 1406 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG), |
1570 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), | 1407 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
1571 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), | ||
1572 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), | 1408 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
1573 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ | 1409 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
1574 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), | 1410 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
@@ -1848,35 +1684,6 @@ static const struct alc_config_preset alc880_presets[] = { | |||
1848 | .loopbacks = alc880_lg_loopbacks, | 1684 | .loopbacks = alc880_lg_loopbacks, |
1849 | #endif | 1685 | #endif |
1850 | }, | 1686 | }, |
1851 | [ALC880_LG_LW] = { | ||
1852 | .mixers = { alc880_lg_lw_mixer }, | ||
1853 | .init_verbs = { alc880_volume_init_verbs, | ||
1854 | alc880_lg_lw_init_verbs }, | ||
1855 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | ||
1856 | .dac_nids = alc880_dac_nids, | ||
1857 | .dig_out_nid = ALC880_DIGOUT_NID, | ||
1858 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), | ||
1859 | .channel_mode = alc880_lg_lw_modes, | ||
1860 | .input_mux = &alc880_lg_lw_capture_source, | ||
1861 | .unsol_event = alc_sku_unsol_event, | ||
1862 | .setup = alc880_lg_lw_setup, | ||
1863 | .init_hook = alc_hp_automute, | ||
1864 | }, | ||
1865 | [ALC880_MEDION_RIM] = { | ||
1866 | .mixers = { alc880_medion_rim_mixer }, | ||
1867 | .init_verbs = { alc880_volume_init_verbs, | ||
1868 | alc880_medion_rim_init_verbs, | ||
1869 | alc_gpio2_init_verbs }, | ||
1870 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | ||
1871 | .dac_nids = alc880_dac_nids, | ||
1872 | .dig_out_nid = ALC880_DIGOUT_NID, | ||
1873 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | ||
1874 | .channel_mode = alc880_2_jack_modes, | ||
1875 | .input_mux = &alc880_medion_rim_capture_source, | ||
1876 | .unsol_event = alc880_medion_rim_unsol_event, | ||
1877 | .setup = alc880_medion_rim_setup, | ||
1878 | .init_hook = alc880_medion_rim_automute, | ||
1879 | }, | ||
1880 | #ifdef CONFIG_SND_DEBUG | 1687 | #ifdef CONFIG_SND_DEBUG |
1881 | [ALC880_TEST] = { | 1688 | [ALC880_TEST] = { |
1882 | .mixers = { alc880_test_mixer }, | 1689 | .mixers = { alc880_test_mixer }, |
diff --git a/sound/pci/hda/alc882_quirks.c b/sound/pci/hda/alc882_quirks.c index e251514a26a4..bdf0ed4ab3e2 100644 --- a/sound/pci/hda/alc882_quirks.c +++ b/sound/pci/hda/alc882_quirks.c | |||
@@ -6,509 +6,15 @@ | |||
6 | /* ALC882 models */ | 6 | /* ALC882 models */ |
7 | enum { | 7 | enum { |
8 | ALC882_AUTO, | 8 | ALC882_AUTO, |
9 | ALC882_3ST_DIG, | ||
10 | ALC882_6ST_DIG, | ||
11 | ALC882_ARIMA, | ||
12 | ALC882_W2JC, | ||
13 | ALC882_TARGA, | ||
14 | ALC882_ASUS_A7J, | ||
15 | ALC882_ASUS_A7M, | ||
16 | ALC885_MACPRO, | ||
17 | ALC885_MBA21, | 9 | ALC885_MBA21, |
18 | ALC885_MBP3, | 10 | ALC885_MBP3, |
19 | ALC885_MB5, | 11 | ALC885_MB5, |
20 | ALC885_MACMINI3, | 12 | ALC885_MACMINI3, |
21 | ALC885_IMAC24, | ||
22 | ALC885_IMAC91, | 13 | ALC885_IMAC91, |
23 | ALC883_3ST_2ch_DIG, | ||
24 | ALC883_3ST_6ch_DIG, | ||
25 | ALC883_3ST_6ch, | ||
26 | ALC883_6ST_DIG, | ||
27 | ALC883_TARGA_DIG, | ||
28 | ALC883_TARGA_2ch_DIG, | ||
29 | ALC883_TARGA_8ch_DIG, | ||
30 | ALC883_ACER, | ||
31 | ALC883_ACER_ASPIRE, | ||
32 | ALC888_ACER_ASPIRE_4930G, | ||
33 | ALC888_ACER_ASPIRE_6530G, | ||
34 | ALC888_ACER_ASPIRE_8930G, | ||
35 | ALC888_ACER_ASPIRE_7730G, | ||
36 | ALC883_MEDION, | ||
37 | ALC883_MEDION_WIM2160, | ||
38 | ALC883_LAPTOP_EAPD, | ||
39 | ALC883_LENOVO_101E_2ch, | ||
40 | ALC883_LENOVO_NB0763, | ||
41 | ALC888_LENOVO_MS7195_DIG, | ||
42 | ALC888_LENOVO_SKY, | ||
43 | ALC883_HAIER_W66, | ||
44 | ALC888_3ST_HP, | ||
45 | ALC888_6ST_DELL, | ||
46 | ALC883_MITAC, | ||
47 | ALC883_CLEVO_M540R, | ||
48 | ALC883_CLEVO_M720, | ||
49 | ALC883_FUJITSU_PI2515, | ||
50 | ALC888_FUJITSU_XA3530, | ||
51 | ALC883_3ST_6ch_INTEL, | ||
52 | ALC889A_INTEL, | ||
53 | ALC889_INTEL, | ||
54 | ALC888_ASUS_M90V, | ||
55 | ALC888_ASUS_EEE1601, | ||
56 | ALC889A_MB31, | 14 | ALC889A_MB31, |
57 | ALC1200_ASUS_P5Q, | ||
58 | ALC883_SONY_VAIO_TT, | ||
59 | ALC882_MODEL_LAST, | 15 | ALC882_MODEL_LAST, |
60 | }; | 16 | }; |
61 | 17 | ||
62 | /* | ||
63 | * 2ch mode | ||
64 | */ | ||
65 | static const struct hda_verb alc888_4ST_ch2_intel_init[] = { | ||
66 | /* Mic-in jack as mic in */ | ||
67 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
68 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
69 | /* Line-in jack as Line in */ | ||
70 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
71 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
72 | /* Line-Out as Front */ | ||
73 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
74 | { } /* end */ | ||
75 | }; | ||
76 | |||
77 | /* | ||
78 | * 4ch mode | ||
79 | */ | ||
80 | static const struct hda_verb alc888_4ST_ch4_intel_init[] = { | ||
81 | /* Mic-in jack as mic in */ | ||
82 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
83 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
84 | /* Line-in jack as Surround */ | ||
85 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
86 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
87 | /* Line-Out as Front */ | ||
88 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
89 | { } /* end */ | ||
90 | }; | ||
91 | |||
92 | /* | ||
93 | * 6ch mode | ||
94 | */ | ||
95 | static const struct hda_verb alc888_4ST_ch6_intel_init[] = { | ||
96 | /* Mic-in jack as CLFE */ | ||
97 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
98 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
99 | /* Line-in jack as Surround */ | ||
100 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
101 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
102 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ | ||
103 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | ||
104 | { } /* end */ | ||
105 | }; | ||
106 | |||
107 | /* | ||
108 | * 8ch mode | ||
109 | */ | ||
110 | static const struct hda_verb alc888_4ST_ch8_intel_init[] = { | ||
111 | /* Mic-in jack as CLFE */ | ||
112 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
113 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
114 | /* Line-in jack as Surround */ | ||
115 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
116 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
117 | /* Line-Out as Side */ | ||
118 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | ||
119 | { } /* end */ | ||
120 | }; | ||
121 | |||
122 | static const struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { | ||
123 | { 2, alc888_4ST_ch2_intel_init }, | ||
124 | { 4, alc888_4ST_ch4_intel_init }, | ||
125 | { 6, alc888_4ST_ch6_intel_init }, | ||
126 | { 8, alc888_4ST_ch8_intel_init }, | ||
127 | }; | ||
128 | |||
129 | /* | ||
130 | * ALC888 Fujitsu Siemens Amillo xa3530 | ||
131 | */ | ||
132 | |||
133 | static const struct hda_verb alc888_fujitsu_xa3530_verbs[] = { | ||
134 | /* Front Mic: set to PIN_IN (empty by default) */ | ||
135 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
136 | /* Connect Internal HP to Front */ | ||
137 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
138 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
139 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
140 | /* Connect Bass HP to Front */ | ||
141 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
142 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
143 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
144 | /* Connect Line-Out side jack (SPDIF) to Side */ | ||
145 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
146 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
147 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | ||
148 | /* Connect Mic jack to CLFE */ | ||
149 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
150 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
151 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
152 | /* Connect Line-in jack to Surround */ | ||
153 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
154 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
155 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
156 | /* Connect HP out jack to Front */ | ||
157 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
158 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
159 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
160 | /* Enable unsolicited event for HP jack and Line-out jack */ | ||
161 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
162 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
163 | {} | ||
164 | }; | ||
165 | |||
166 | static void alc889_automute_setup(struct hda_codec *codec) | ||
167 | { | ||
168 | struct alc_spec *spec = codec->spec; | ||
169 | |||
170 | spec->autocfg.hp_pins[0] = 0x15; | ||
171 | spec->autocfg.speaker_pins[0] = 0x14; | ||
172 | spec->autocfg.speaker_pins[1] = 0x16; | ||
173 | spec->autocfg.speaker_pins[2] = 0x17; | ||
174 | spec->autocfg.speaker_pins[3] = 0x19; | ||
175 | spec->autocfg.speaker_pins[4] = 0x1a; | ||
176 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
177 | } | ||
178 | |||
179 | static void alc889_intel_init_hook(struct hda_codec *codec) | ||
180 | { | ||
181 | alc889_coef_init(codec); | ||
182 | alc_hp_automute(codec); | ||
183 | } | ||
184 | |||
185 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) | ||
186 | { | ||
187 | struct alc_spec *spec = codec->spec; | ||
188 | |||
189 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ | ||
190 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ | ||
191 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ | ||
192 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ | ||
193 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
194 | } | ||
195 | |||
196 | /* | ||
197 | * ALC888 Acer Aspire 4930G model | ||
198 | */ | ||
199 | |||
200 | static const struct hda_verb alc888_acer_aspire_4930g_verbs[] = { | ||
201 | /* Front Mic: set to PIN_IN (empty by default) */ | ||
202 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
203 | /* Unselect Front Mic by default in input mixer 3 */ | ||
204 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | ||
205 | /* Enable unsolicited event for HP jack */ | ||
206 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
207 | /* Connect Internal HP to front */ | ||
208 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
209 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
210 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
211 | /* Connect HP out to front */ | ||
212 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
213 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
214 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
215 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
216 | { } | ||
217 | }; | ||
218 | |||
219 | /* | ||
220 | * ALC888 Acer Aspire 6530G model | ||
221 | */ | ||
222 | |||
223 | static const struct hda_verb alc888_acer_aspire_6530g_verbs[] = { | ||
224 | /* Route to built-in subwoofer as well as speakers */ | ||
225 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
226 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
227 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
228 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
229 | /* Bias voltage on for external mic port */ | ||
230 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, | ||
231 | /* Front Mic: set to PIN_IN (empty by default) */ | ||
232 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
233 | /* Unselect Front Mic by default in input mixer 3 */ | ||
234 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | ||
235 | /* Enable unsolicited event for HP jack */ | ||
236 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
237 | /* Enable speaker output */ | ||
238 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
239 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
240 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
241 | /* Enable headphone output */ | ||
242 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, | ||
243 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
244 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
245 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
246 | { } | ||
247 | }; | ||
248 | |||
249 | /* | ||
250 | *ALC888 Acer Aspire 7730G model | ||
251 | */ | ||
252 | |||
253 | static const struct hda_verb alc888_acer_aspire_7730G_verbs[] = { | ||
254 | /* Bias voltage on for external mic port */ | ||
255 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, | ||
256 | /* Front Mic: set to PIN_IN (empty by default) */ | ||
257 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
258 | /* Unselect Front Mic by default in input mixer 3 */ | ||
259 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | ||
260 | /* Enable unsolicited event for HP jack */ | ||
261 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
262 | /* Enable speaker output */ | ||
263 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
264 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
265 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
266 | /* Enable headphone output */ | ||
267 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, | ||
268 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
269 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
270 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
271 | /*Enable internal subwoofer */ | ||
272 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
273 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
274 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
275 | {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
276 | { } | ||
277 | }; | ||
278 | |||
279 | /* | ||
280 | * ALC889 Acer Aspire 8930G model | ||
281 | */ | ||
282 | |||
283 | static const struct hda_verb alc889_acer_aspire_8930g_verbs[] = { | ||
284 | /* Front Mic: set to PIN_IN (empty by default) */ | ||
285 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
286 | /* Unselect Front Mic by default in input mixer 3 */ | ||
287 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | ||
288 | /* Enable unsolicited event for HP jack */ | ||
289 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
290 | /* Connect Internal Front to Front */ | ||
291 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
292 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
293 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
294 | /* Connect Internal Rear to Rear */ | ||
295 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
296 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
297 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
298 | /* Connect Internal CLFE to CLFE */ | ||
299 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
300 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
301 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
302 | /* Connect HP out to Front */ | ||
303 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, | ||
304 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
305 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
306 | /* Enable all DACs */ | ||
307 | /* DAC DISABLE/MUTE 1? */ | ||
308 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ | ||
309 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, | ||
310 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, | ||
311 | /* DAC DISABLE/MUTE 2? */ | ||
312 | /* some bit here disables the other DACs. Init=0x4900 */ | ||
313 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, | ||
314 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, | ||
315 | /* DMIC fix | ||
316 | * This laptop has a stereo digital microphone. The mics are only 1cm apart | ||
317 | * which makes the stereo useless. However, either the mic or the ALC889 | ||
318 | * makes the signal become a difference/sum signal instead of standard | ||
319 | * stereo, which is annoying. So instead we flip this bit which makes the | ||
320 | * codec replicate the sum signal to both channels, turning it into a | ||
321 | * normal mono mic. | ||
322 | */ | ||
323 | /* DMIC_CONTROL? Init value = 0x0001 */ | ||
324 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, | ||
325 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, | ||
326 | { } | ||
327 | }; | ||
328 | |||
329 | static const struct hda_input_mux alc888_2_capture_sources[2] = { | ||
330 | /* Front mic only available on one ADC */ | ||
331 | { | ||
332 | .num_items = 4, | ||
333 | .items = { | ||
334 | { "Mic", 0x0 }, | ||
335 | { "Line", 0x2 }, | ||
336 | { "CD", 0x4 }, | ||
337 | { "Front Mic", 0xb }, | ||
338 | }, | ||
339 | }, | ||
340 | { | ||
341 | .num_items = 3, | ||
342 | .items = { | ||
343 | { "Mic", 0x0 }, | ||
344 | { "Line", 0x2 }, | ||
345 | { "CD", 0x4 }, | ||
346 | }, | ||
347 | } | ||
348 | }; | ||
349 | |||
350 | static const struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { | ||
351 | /* Interal mic only available on one ADC */ | ||
352 | { | ||
353 | .num_items = 5, | ||
354 | .items = { | ||
355 | { "Mic", 0x0 }, | ||
356 | { "Line In", 0x2 }, | ||
357 | { "CD", 0x4 }, | ||
358 | { "Input Mix", 0xa }, | ||
359 | { "Internal Mic", 0xb }, | ||
360 | }, | ||
361 | }, | ||
362 | { | ||
363 | .num_items = 4, | ||
364 | .items = { | ||
365 | { "Mic", 0x0 }, | ||
366 | { "Line In", 0x2 }, | ||
367 | { "CD", 0x4 }, | ||
368 | { "Input Mix", 0xa }, | ||
369 | }, | ||
370 | } | ||
371 | }; | ||
372 | |||
373 | static const struct hda_input_mux alc889_capture_sources[3] = { | ||
374 | /* Digital mic only available on first "ADC" */ | ||
375 | { | ||
376 | .num_items = 5, | ||
377 | .items = { | ||
378 | { "Mic", 0x0 }, | ||
379 | { "Line", 0x2 }, | ||
380 | { "CD", 0x4 }, | ||
381 | { "Front Mic", 0xb }, | ||
382 | { "Input Mix", 0xa }, | ||
383 | }, | ||
384 | }, | ||
385 | { | ||
386 | .num_items = 4, | ||
387 | .items = { | ||
388 | { "Mic", 0x0 }, | ||
389 | { "Line", 0x2 }, | ||
390 | { "CD", 0x4 }, | ||
391 | { "Input Mix", 0xa }, | ||
392 | }, | ||
393 | }, | ||
394 | { | ||
395 | .num_items = 4, | ||
396 | .items = { | ||
397 | { "Mic", 0x0 }, | ||
398 | { "Line", 0x2 }, | ||
399 | { "CD", 0x4 }, | ||
400 | { "Input Mix", 0xa }, | ||
401 | }, | ||
402 | } | ||
403 | }; | ||
404 | |||
405 | static const struct snd_kcontrol_new alc888_base_mixer[] = { | ||
406 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
407 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
408 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
409 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
410 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | ||
411 | HDA_OUTPUT), | ||
412 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
413 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
414 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
415 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
416 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | ||
417 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
418 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
419 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
420 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
421 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
422 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
423 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
424 | { } /* end */ | ||
425 | }; | ||
426 | |||
427 | static const struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = { | ||
428 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
429 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
430 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
431 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
432 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | ||
433 | HDA_OUTPUT), | ||
434 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
435 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
436 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
437 | HDA_CODEC_VOLUME_MONO("Internal LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT), | ||
438 | HDA_BIND_MUTE_MONO("Internal LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT), | ||
439 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
440 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
441 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
442 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
443 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
444 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
445 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
446 | { } /* end */ | ||
447 | }; | ||
448 | |||
449 | static const struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { | ||
450 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
451 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
452 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
453 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
454 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | ||
455 | HDA_OUTPUT), | ||
456 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
457 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
458 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
459 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
460 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
461 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
462 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
463 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
464 | { } /* end */ | ||
465 | }; | ||
466 | |||
467 | |||
468 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) | ||
469 | { | ||
470 | struct alc_spec *spec = codec->spec; | ||
471 | |||
472 | spec->autocfg.hp_pins[0] = 0x15; | ||
473 | spec->autocfg.speaker_pins[0] = 0x14; | ||
474 | spec->autocfg.speaker_pins[1] = 0x16; | ||
475 | spec->autocfg.speaker_pins[2] = 0x17; | ||
476 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
477 | } | ||
478 | |||
479 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) | ||
480 | { | ||
481 | struct alc_spec *spec = codec->spec; | ||
482 | |||
483 | spec->autocfg.hp_pins[0] = 0x15; | ||
484 | spec->autocfg.speaker_pins[0] = 0x14; | ||
485 | spec->autocfg.speaker_pins[1] = 0x16; | ||
486 | spec->autocfg.speaker_pins[2] = 0x17; | ||
487 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
488 | } | ||
489 | |||
490 | static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec) | ||
491 | { | ||
492 | struct alc_spec *spec = codec->spec; | ||
493 | |||
494 | spec->autocfg.hp_pins[0] = 0x15; | ||
495 | spec->autocfg.speaker_pins[0] = 0x14; | ||
496 | spec->autocfg.speaker_pins[1] = 0x16; | ||
497 | spec->autocfg.speaker_pins[2] = 0x17; | ||
498 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
499 | } | ||
500 | |||
501 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) | ||
502 | { | ||
503 | struct alc_spec *spec = codec->spec; | ||
504 | |||
505 | spec->autocfg.hp_pins[0] = 0x15; | ||
506 | spec->autocfg.speaker_pins[0] = 0x14; | ||
507 | spec->autocfg.speaker_pins[1] = 0x16; | ||
508 | spec->autocfg.speaker_pins[2] = 0x1b; | ||
509 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
510 | } | ||
511 | |||
512 | #define ALC882_DIGOUT_NID 0x06 | 18 | #define ALC882_DIGOUT_NID 0x06 |
513 | #define ALC882_DIGIN_NID 0x0a | 19 | #define ALC882_DIGIN_NID 0x0a |
514 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID | 20 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
@@ -531,15 +37,9 @@ static const hda_nid_t alc882_dac_nids[4] = { | |||
531 | #define alc882_adc_nids alc880_adc_nids | 37 | #define alc882_adc_nids alc880_adc_nids |
532 | #define alc882_adc_nids_alt alc880_adc_nids_alt | 38 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
533 | #define alc883_adc_nids alc882_adc_nids_alt | 39 | #define alc883_adc_nids alc882_adc_nids_alt |
534 | static const hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; | ||
535 | static const hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; | ||
536 | #define alc889_adc_nids alc880_adc_nids | ||
537 | 40 | ||
538 | static const hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; | ||
539 | static const hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; | 41 | static const hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
540 | #define alc883_capsrc_nids alc882_capsrc_nids_alt | 42 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
541 | static const hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; | ||
542 | #define alc889_capsrc_nids alc882_capsrc_nids | ||
543 | 43 | ||
544 | /* input MUX */ | 44 | /* input MUX */ |
545 | /* FIXME: should be a matrix-type input source selection */ | 45 | /* FIXME: should be a matrix-type input source selection */ |
@@ -556,15 +56,6 @@ static const struct hda_input_mux alc882_capture_source = { | |||
556 | 56 | ||
557 | #define alc883_capture_source alc882_capture_source | 57 | #define alc883_capture_source alc882_capture_source |
558 | 58 | ||
559 | static const struct hda_input_mux alc889_capture_source = { | ||
560 | .num_items = 3, | ||
561 | .items = { | ||
562 | { "Front Mic", 0x0 }, | ||
563 | { "Mic", 0x3 }, | ||
564 | { "Line", 0x2 }, | ||
565 | }, | ||
566 | }; | ||
567 | |||
568 | static const struct hda_input_mux mb5_capture_source = { | 59 | static const struct hda_input_mux mb5_capture_source = { |
569 | .num_items = 3, | 60 | .num_items = 3, |
570 | .items = { | 61 | .items = { |
@@ -592,49 +83,6 @@ static const struct hda_input_mux alc883_3stack_6ch_intel = { | |||
592 | }, | 83 | }, |
593 | }; | 84 | }; |
594 | 85 | ||
595 | static const struct hda_input_mux alc883_lenovo_101e_capture_source = { | ||
596 | .num_items = 2, | ||
597 | .items = { | ||
598 | { "Mic", 0x1 }, | ||
599 | { "Line", 0x2 }, | ||
600 | }, | ||
601 | }; | ||
602 | |||
603 | static const struct hda_input_mux alc883_lenovo_nb0763_capture_source = { | ||
604 | .num_items = 4, | ||
605 | .items = { | ||
606 | { "Mic", 0x0 }, | ||
607 | { "Internal Mic", 0x1 }, | ||
608 | { "Line", 0x2 }, | ||
609 | { "CD", 0x4 }, | ||
610 | }, | ||
611 | }; | ||
612 | |||
613 | static const struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { | ||
614 | .num_items = 2, | ||
615 | .items = { | ||
616 | { "Mic", 0x0 }, | ||
617 | { "Internal Mic", 0x1 }, | ||
618 | }, | ||
619 | }; | ||
620 | |||
621 | static const struct hda_input_mux alc883_lenovo_sky_capture_source = { | ||
622 | .num_items = 3, | ||
623 | .items = { | ||
624 | { "Mic", 0x0 }, | ||
625 | { "Front Mic", 0x1 }, | ||
626 | { "Line", 0x4 }, | ||
627 | }, | ||
628 | }; | ||
629 | |||
630 | static const struct hda_input_mux alc883_asus_eee1601_capture_source = { | ||
631 | .num_items = 2, | ||
632 | .items = { | ||
633 | { "Mic", 0x0 }, | ||
634 | { "Line", 0x2 }, | ||
635 | }, | ||
636 | }; | ||
637 | |||
638 | static const struct hda_input_mux alc889A_mb31_capture_source = { | 86 | static const struct hda_input_mux alc889A_mb31_capture_source = { |
639 | .num_items = 2, | 87 | .num_items = 2, |
640 | .items = { | 88 | .items = { |
@@ -654,131 +102,6 @@ static const struct hda_input_mux alc889A_imac91_capture_source = { | |||
654 | }, | 102 | }, |
655 | }; | 103 | }; |
656 | 104 | ||
657 | /* | ||
658 | * 2ch mode | ||
659 | */ | ||
660 | static const struct hda_channel_mode alc883_3ST_2ch_modes[1] = { | ||
661 | { 2, NULL } | ||
662 | }; | ||
663 | |||
664 | /* | ||
665 | * 2ch mode | ||
666 | */ | ||
667 | static const struct hda_verb alc882_3ST_ch2_init[] = { | ||
668 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
669 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
670 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
671 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
672 | { } /* end */ | ||
673 | }; | ||
674 | |||
675 | /* | ||
676 | * 4ch mode | ||
677 | */ | ||
678 | static const struct hda_verb alc882_3ST_ch4_init[] = { | ||
679 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
680 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
681 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
682 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
683 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
684 | { } /* end */ | ||
685 | }; | ||
686 | |||
687 | /* | ||
688 | * 6ch mode | ||
689 | */ | ||
690 | static const struct hda_verb alc882_3ST_ch6_init[] = { | ||
691 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
692 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
693 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
694 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
695 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
696 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
697 | { } /* end */ | ||
698 | }; | ||
699 | |||
700 | static const struct hda_channel_mode alc882_3ST_6ch_modes[3] = { | ||
701 | { 2, alc882_3ST_ch2_init }, | ||
702 | { 4, alc882_3ST_ch4_init }, | ||
703 | { 6, alc882_3ST_ch6_init }, | ||
704 | }; | ||
705 | |||
706 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes | ||
707 | |||
708 | /* | ||
709 | * 2ch mode | ||
710 | */ | ||
711 | static const struct hda_verb alc883_3ST_ch2_clevo_init[] = { | ||
712 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | ||
713 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
714 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
715 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
716 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
717 | { } /* end */ | ||
718 | }; | ||
719 | |||
720 | /* | ||
721 | * 4ch mode | ||
722 | */ | ||
723 | static const struct hda_verb alc883_3ST_ch4_clevo_init[] = { | ||
724 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
725 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
726 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
727 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
728 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
729 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
730 | { } /* end */ | ||
731 | }; | ||
732 | |||
733 | /* | ||
734 | * 6ch mode | ||
735 | */ | ||
736 | static const struct hda_verb alc883_3ST_ch6_clevo_init[] = { | ||
737 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
738 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
739 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
740 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
741 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
742 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
743 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
744 | { } /* end */ | ||
745 | }; | ||
746 | |||
747 | static const struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { | ||
748 | { 2, alc883_3ST_ch2_clevo_init }, | ||
749 | { 4, alc883_3ST_ch4_clevo_init }, | ||
750 | { 6, alc883_3ST_ch6_clevo_init }, | ||
751 | }; | ||
752 | |||
753 | |||
754 | /* | ||
755 | * 6ch mode | ||
756 | */ | ||
757 | static const struct hda_verb alc882_sixstack_ch6_init[] = { | ||
758 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
759 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
760 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
761 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
762 | { } /* end */ | ||
763 | }; | ||
764 | |||
765 | /* | ||
766 | * 8ch mode | ||
767 | */ | ||
768 | static const struct hda_verb alc882_sixstack_ch8_init[] = { | ||
769 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
770 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
771 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
772 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
773 | { } /* end */ | ||
774 | }; | ||
775 | |||
776 | static const struct hda_channel_mode alc882_sixstack_modes[2] = { | ||
777 | { 6, alc882_sixstack_ch6_init }, | ||
778 | { 8, alc882_sixstack_ch8_init }, | ||
779 | }; | ||
780 | |||
781 | |||
782 | /* Macbook Air 2,1 */ | 105 | /* Macbook Air 2,1 */ |
783 | 106 | ||
784 | static const struct hda_channel_mode alc885_mba21_ch_modes[1] = { | 107 | static const struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
@@ -847,216 +170,6 @@ static const struct hda_channel_mode alc885_mb5_6ch_modes[2] = { | |||
847 | 170 | ||
848 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes | 171 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
849 | 172 | ||
850 | /* | ||
851 | * 2ch mode | ||
852 | */ | ||
853 | static const struct hda_verb alc883_4ST_ch2_init[] = { | ||
854 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
855 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
856 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
857 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
858 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
859 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
860 | { } /* end */ | ||
861 | }; | ||
862 | |||
863 | /* | ||
864 | * 4ch mode | ||
865 | */ | ||
866 | static const struct hda_verb alc883_4ST_ch4_init[] = { | ||
867 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
868 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
869 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
870 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
871 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
872 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
873 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
874 | { } /* end */ | ||
875 | }; | ||
876 | |||
877 | /* | ||
878 | * 6ch mode | ||
879 | */ | ||
880 | static const struct hda_verb alc883_4ST_ch6_init[] = { | ||
881 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
882 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
883 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
884 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
885 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
886 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
887 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
888 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
889 | { } /* end */ | ||
890 | }; | ||
891 | |||
892 | /* | ||
893 | * 8ch mode | ||
894 | */ | ||
895 | static const struct hda_verb alc883_4ST_ch8_init[] = { | ||
896 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
897 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
898 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | ||
899 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
900 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
901 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
902 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
903 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
904 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
905 | { } /* end */ | ||
906 | }; | ||
907 | |||
908 | static const struct hda_channel_mode alc883_4ST_8ch_modes[4] = { | ||
909 | { 2, alc883_4ST_ch2_init }, | ||
910 | { 4, alc883_4ST_ch4_init }, | ||
911 | { 6, alc883_4ST_ch6_init }, | ||
912 | { 8, alc883_4ST_ch8_init }, | ||
913 | }; | ||
914 | |||
915 | |||
916 | /* | ||
917 | * 2ch mode | ||
918 | */ | ||
919 | static const struct hda_verb alc883_3ST_ch2_intel_init[] = { | ||
920 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
921 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
922 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
923 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
924 | { } /* end */ | ||
925 | }; | ||
926 | |||
927 | /* | ||
928 | * 4ch mode | ||
929 | */ | ||
930 | static const struct hda_verb alc883_3ST_ch4_intel_init[] = { | ||
931 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
932 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
933 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
934 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
935 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
936 | { } /* end */ | ||
937 | }; | ||
938 | |||
939 | /* | ||
940 | * 6ch mode | ||
941 | */ | ||
942 | static const struct hda_verb alc883_3ST_ch6_intel_init[] = { | ||
943 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
944 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
945 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
946 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
947 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
948 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
949 | { } /* end */ | ||
950 | }; | ||
951 | |||
952 | static const struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { | ||
953 | { 2, alc883_3ST_ch2_intel_init }, | ||
954 | { 4, alc883_3ST_ch4_intel_init }, | ||
955 | { 6, alc883_3ST_ch6_intel_init }, | ||
956 | }; | ||
957 | |||
958 | /* | ||
959 | * 2ch mode | ||
960 | */ | ||
961 | static const struct hda_verb alc889_ch2_intel_init[] = { | ||
962 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
963 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
964 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
965 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
966 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
967 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
968 | { } /* end */ | ||
969 | }; | ||
970 | |||
971 | /* | ||
972 | * 6ch mode | ||
973 | */ | ||
974 | static const struct hda_verb alc889_ch6_intel_init[] = { | ||
975 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
976 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
977 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
978 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | ||
979 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
980 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
981 | { } /* end */ | ||
982 | }; | ||
983 | |||
984 | /* | ||
985 | * 8ch mode | ||
986 | */ | ||
987 | static const struct hda_verb alc889_ch8_intel_init[] = { | ||
988 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
989 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
990 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
991 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | ||
992 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, | ||
993 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
994 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
995 | { } /* end */ | ||
996 | }; | ||
997 | |||
998 | static const struct hda_channel_mode alc889_8ch_intel_modes[3] = { | ||
999 | { 2, alc889_ch2_intel_init }, | ||
1000 | { 6, alc889_ch6_intel_init }, | ||
1001 | { 8, alc889_ch8_intel_init }, | ||
1002 | }; | ||
1003 | |||
1004 | /* | ||
1005 | * 6ch mode | ||
1006 | */ | ||
1007 | static const struct hda_verb alc883_sixstack_ch6_init[] = { | ||
1008 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
1009 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
1010 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
1011 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
1012 | { } /* end */ | ||
1013 | }; | ||
1014 | |||
1015 | /* | ||
1016 | * 8ch mode | ||
1017 | */ | ||
1018 | static const struct hda_verb alc883_sixstack_ch8_init[] = { | ||
1019 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
1020 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
1021 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
1022 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
1023 | { } /* end */ | ||
1024 | }; | ||
1025 | |||
1026 | static const struct hda_channel_mode alc883_sixstack_modes[2] = { | ||
1027 | { 6, alc883_sixstack_ch6_init }, | ||
1028 | { 8, alc883_sixstack_ch8_init }, | ||
1029 | }; | ||
1030 | |||
1031 | |||
1032 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | ||
1033 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | ||
1034 | */ | ||
1035 | static const struct snd_kcontrol_new alc882_base_mixer[] = { | ||
1036 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
1037 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
1038 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
1039 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
1040 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | ||
1041 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
1042 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
1043 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
1044 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
1045 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | ||
1046 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
1047 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
1048 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
1049 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
1050 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
1051 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
1052 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
1053 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
1054 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
1055 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
1056 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
1057 | { } /* end */ | ||
1058 | }; | ||
1059 | |||
1060 | /* Macbook Air 2,1 same control for HP and internal Speaker */ | 173 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
1061 | 174 | ||
1062 | static const struct snd_kcontrol_new alc885_mba21_mixer[] = { | 175 | static const struct snd_kcontrol_new alc885_mba21_mixer[] = { |
@@ -1121,70 +234,6 @@ static const struct snd_kcontrol_new alc885_imac91_mixer[] = { | |||
1121 | }; | 234 | }; |
1122 | 235 | ||
1123 | 236 | ||
1124 | static const struct snd_kcontrol_new alc882_w2jc_mixer[] = { | ||
1125 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
1126 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
1127 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
1128 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
1129 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
1130 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
1131 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
1132 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
1133 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
1134 | { } /* end */ | ||
1135 | }; | ||
1136 | |||
1137 | static const struct snd_kcontrol_new alc882_targa_mixer[] = { | ||
1138 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
1139 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
1140 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
1141 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
1142 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
1143 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
1144 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
1145 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
1146 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
1147 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
1148 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
1149 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
1150 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
1151 | { } /* end */ | ||
1152 | }; | ||
1153 | |||
1154 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? | ||
1155 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c | ||
1156 | */ | ||
1157 | static const struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { | ||
1158 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
1159 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
1160 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
1161 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), | ||
1162 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
1163 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
1164 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
1165 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
1166 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), | ||
1167 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), | ||
1168 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
1169 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
1170 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
1171 | { } /* end */ | ||
1172 | }; | ||
1173 | |||
1174 | static const struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { | ||
1175 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
1176 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
1177 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
1178 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
1179 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
1180 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
1181 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
1182 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
1183 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
1184 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
1185 | { } /* end */ | ||
1186 | }; | ||
1187 | |||
1188 | static const struct snd_kcontrol_new alc882_chmode_mixer[] = { | 237 | static const struct snd_kcontrol_new alc882_chmode_mixer[] = { |
1189 | { | 238 | { |
1190 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 239 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
@@ -1258,179 +307,8 @@ static const struct hda_verb alc882_base_init_verbs[] = { | |||
1258 | { } | 307 | { } |
1259 | }; | 308 | }; |
1260 | 309 | ||
1261 | static const struct hda_verb alc882_adc1_init_verbs[] = { | ||
1262 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | ||
1263 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
1264 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
1265 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
1266 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
1267 | /* ADC1: mute amp left and right */ | ||
1268 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
1269 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
1270 | { } | ||
1271 | }; | ||
1272 | |||
1273 | static const struct hda_verb alc882_eapd_verbs[] = { | ||
1274 | /* change to EAPD mode */ | ||
1275 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | ||
1276 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | ||
1277 | { } | ||
1278 | }; | ||
1279 | |||
1280 | static const struct hda_verb alc889_eapd_verbs[] = { | ||
1281 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
1282 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
1283 | { } | ||
1284 | }; | ||
1285 | |||
1286 | static const struct hda_verb alc_hp15_unsol_verbs[] = { | ||
1287 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
1288 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
1289 | {} | ||
1290 | }; | ||
1291 | |||
1292 | static const struct hda_verb alc885_init_verbs[] = { | ||
1293 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | ||
1294 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
1295 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
1296 | /* Rear mixer */ | ||
1297 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
1298 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
1299 | /* CLFE mixer */ | ||
1300 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
1301 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
1302 | /* Side mixer */ | ||
1303 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
1304 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
1305 | |||
1306 | /* Front HP Pin: output 0 (0x0c) */ | ||
1307 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
1308 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
1309 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
1310 | /* Front Pin: output 0 (0x0c) */ | ||
1311 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
1312 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
1313 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
1314 | /* Rear Pin: output 1 (0x0d) */ | ||
1315 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
1316 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
1317 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
1318 | /* CLFE Pin: output 2 (0x0e) */ | ||
1319 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
1320 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
1321 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
1322 | /* Side Pin: output 3 (0x0f) */ | ||
1323 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
1324 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
1325 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | ||
1326 | /* Mic (rear) pin: input vref at 80% */ | ||
1327 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
1328 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
1329 | /* Front Mic pin: input vref at 80% */ | ||
1330 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
1331 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
1332 | /* Line In pin: input */ | ||
1333 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
1334 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
1335 | |||
1336 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ | ||
1337 | /* Input mixer1 */ | ||
1338 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
1339 | /* Input mixer2 */ | ||
1340 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
1341 | /* Input mixer3 */ | ||
1342 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
1343 | /* ADC2: mute amp left and right */ | ||
1344 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
1345 | /* ADC3: mute amp left and right */ | ||
1346 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
1347 | |||
1348 | { } | ||
1349 | }; | ||
1350 | |||
1351 | static const struct hda_verb alc885_init_input_verbs[] = { | ||
1352 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
1353 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
1354 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | ||
1355 | { } | ||
1356 | }; | ||
1357 | |||
1358 | |||
1359 | /* Unmute Selector 24h and set the default input to front mic */ | ||
1360 | static const struct hda_verb alc889_init_input_verbs[] = { | ||
1361 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
1362 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
1363 | { } | ||
1364 | }; | ||
1365 | |||
1366 | |||
1367 | #define alc883_init_verbs alc882_base_init_verbs | 310 | #define alc883_init_verbs alc882_base_init_verbs |
1368 | 311 | ||
1369 | /* Mac Pro test */ | ||
1370 | static const struct snd_kcontrol_new alc882_macpro_mixer[] = { | ||
1371 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
1372 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
1373 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), | ||
1374 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
1375 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
1376 | /* FIXME: this looks suspicious... | ||
1377 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
1378 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
1379 | */ | ||
1380 | { } /* end */ | ||
1381 | }; | ||
1382 | |||
1383 | static const struct hda_verb alc882_macpro_init_verbs[] = { | ||
1384 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | ||
1385 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
1386 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
1387 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
1388 | /* Front Pin: output 0 (0x0c) */ | ||
1389 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
1390 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
1391 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
1392 | /* Front Mic pin: input vref at 80% */ | ||
1393 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
1394 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
1395 | /* Speaker: output */ | ||
1396 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
1397 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
1398 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, | ||
1399 | /* Headphone output (output 0 - 0x0c) */ | ||
1400 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
1401 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
1402 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
1403 | |||
1404 | /* FIXME: use matrix-type input source selection */ | ||
1405 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | ||
1406 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | ||
1407 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
1408 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
1409 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
1410 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
1411 | /* Input mixer2 */ | ||
1412 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
1413 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
1414 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
1415 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
1416 | /* Input mixer3 */ | ||
1417 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
1418 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
1419 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
1420 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
1421 | /* ADC1: mute amp left and right */ | ||
1422 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
1423 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
1424 | /* ADC2: mute amp left and right */ | ||
1425 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
1426 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
1427 | /* ADC3: mute amp left and right */ | ||
1428 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
1429 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
1430 | |||
1431 | { } | ||
1432 | }; | ||
1433 | |||
1434 | /* Macbook 5,1 */ | 312 | /* Macbook 5,1 */ |
1435 | static const struct hda_verb alc885_mb5_init_verbs[] = { | 313 | static const struct hda_verb alc885_mb5_init_verbs[] = { |
1436 | /* DACs */ | 314 | /* DACs */ |
@@ -1669,34 +547,6 @@ static const struct hda_verb alc885_imac91_init_verbs[] = { | |||
1669 | { } | 547 | { } |
1670 | }; | 548 | }; |
1671 | 549 | ||
1672 | /* iMac 24 mixer. */ | ||
1673 | static const struct snd_kcontrol_new alc885_imac24_mixer[] = { | ||
1674 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | ||
1675 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), | ||
1676 | { } /* end */ | ||
1677 | }; | ||
1678 | |||
1679 | /* iMac 24 init verbs. */ | ||
1680 | static const struct hda_verb alc885_imac24_init_verbs[] = { | ||
1681 | /* Internal speakers: output 0 (0x0c) */ | ||
1682 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
1683 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
1684 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
1685 | /* Internal speakers: output 0 (0x0c) */ | ||
1686 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
1687 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
1688 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
1689 | /* Headphone: output 0 (0x0c) */ | ||
1690 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
1691 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
1692 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
1693 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
1694 | /* Front Mic: input vref at 80% */ | ||
1695 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
1696 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
1697 | { } | ||
1698 | }; | ||
1699 | |||
1700 | /* Toggle speaker-output according to the hp-jack state */ | 550 | /* Toggle speaker-output according to the hp-jack state */ |
1701 | static void alc885_imac24_setup(struct hda_codec *codec) | 551 | static void alc885_imac24_setup(struct hda_codec *codec) |
1702 | { | 552 | { |
@@ -1742,127 +592,6 @@ static void alc885_imac91_setup(struct hda_codec *codec) | |||
1742 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | 592 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
1743 | } | 593 | } |
1744 | 594 | ||
1745 | static const struct hda_verb alc882_targa_verbs[] = { | ||
1746 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
1747 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
1748 | |||
1749 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
1750 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
1751 | |||
1752 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | ||
1753 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | ||
1754 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | ||
1755 | |||
1756 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
1757 | { } /* end */ | ||
1758 | }; | ||
1759 | |||
1760 | /* toggle speaker-output according to the hp-jack state */ | ||
1761 | static void alc882_targa_automute(struct hda_codec *codec) | ||
1762 | { | ||
1763 | struct alc_spec *spec = codec->spec; | ||
1764 | alc_hp_automute(codec); | ||
1765 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, | ||
1766 | spec->hp_jack_present ? 1 : 3); | ||
1767 | } | ||
1768 | |||
1769 | static void alc882_targa_setup(struct hda_codec *codec) | ||
1770 | { | ||
1771 | struct alc_spec *spec = codec->spec; | ||
1772 | |||
1773 | spec->autocfg.hp_pins[0] = 0x14; | ||
1774 | spec->autocfg.speaker_pins[0] = 0x1b; | ||
1775 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
1776 | } | ||
1777 | |||
1778 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) | ||
1779 | { | ||
1780 | if ((res >> 26) == ALC_HP_EVENT) | ||
1781 | alc882_targa_automute(codec); | ||
1782 | } | ||
1783 | |||
1784 | static const struct hda_verb alc882_asus_a7j_verbs[] = { | ||
1785 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
1786 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
1787 | |||
1788 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
1789 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
1790 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
1791 | |||
1792 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | ||
1793 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | ||
1794 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | ||
1795 | |||
1796 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | ||
1797 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | ||
1798 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | ||
1799 | { } /* end */ | ||
1800 | }; | ||
1801 | |||
1802 | static const struct hda_verb alc882_asus_a7m_verbs[] = { | ||
1803 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
1804 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
1805 | |||
1806 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
1807 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
1808 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
1809 | |||
1810 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | ||
1811 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | ||
1812 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | ||
1813 | |||
1814 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | ||
1815 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | ||
1816 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | ||
1817 | { } /* end */ | ||
1818 | }; | ||
1819 | |||
1820 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) | ||
1821 | { | ||
1822 | unsigned int gpiostate, gpiomask, gpiodir; | ||
1823 | |||
1824 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, | ||
1825 | AC_VERB_GET_GPIO_DATA, 0); | ||
1826 | |||
1827 | if (!muted) | ||
1828 | gpiostate |= (1 << pin); | ||
1829 | else | ||
1830 | gpiostate &= ~(1 << pin); | ||
1831 | |||
1832 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, | ||
1833 | AC_VERB_GET_GPIO_MASK, 0); | ||
1834 | gpiomask |= (1 << pin); | ||
1835 | |||
1836 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, | ||
1837 | AC_VERB_GET_GPIO_DIRECTION, 0); | ||
1838 | gpiodir |= (1 << pin); | ||
1839 | |||
1840 | |||
1841 | snd_hda_codec_write(codec, codec->afg, 0, | ||
1842 | AC_VERB_SET_GPIO_MASK, gpiomask); | ||
1843 | snd_hda_codec_write(codec, codec->afg, 0, | ||
1844 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); | ||
1845 | |||
1846 | msleep(1); | ||
1847 | |||
1848 | snd_hda_codec_write(codec, codec->afg, 0, | ||
1849 | AC_VERB_SET_GPIO_DATA, gpiostate); | ||
1850 | } | ||
1851 | |||
1852 | /* set up GPIO at initialization */ | ||
1853 | static void alc885_macpro_init_hook(struct hda_codec *codec) | ||
1854 | { | ||
1855 | alc882_gpio_mute(codec, 0, 0); | ||
1856 | alc882_gpio_mute(codec, 1, 0); | ||
1857 | } | ||
1858 | |||
1859 | /* set up GPIO and update auto-muting at initialization */ | ||
1860 | static void alc885_imac24_init_hook(struct hda_codec *codec) | ||
1861 | { | ||
1862 | alc885_macpro_init_hook(codec); | ||
1863 | alc_hp_automute(codec); | ||
1864 | } | ||
1865 | |||
1866 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ | 595 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
1867 | static const struct hda_verb alc889A_mb31_ch2_init[] = { | 596 | static const struct hda_verb alc889A_mb31_ch2_init[] = { |
1868 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ | 597 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
@@ -1906,77 +635,6 @@ static const struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { | |||
1906 | { 6, alc889A_mb31_ch6_init }, | 635 | { 6, alc889A_mb31_ch6_init }, |
1907 | }; | 636 | }; |
1908 | 637 | ||
1909 | static const struct hda_verb alc883_medion_eapd_verbs[] = { | ||
1910 | /* eanable EAPD on medion laptop */ | ||
1911 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | ||
1912 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | ||
1913 | { } | ||
1914 | }; | ||
1915 | |||
1916 | #define alc883_base_mixer alc882_base_mixer | ||
1917 | |||
1918 | static const struct snd_kcontrol_new alc883_mitac_mixer[] = { | ||
1919 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
1920 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
1921 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | ||
1922 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
1923 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
1924 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
1925 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
1926 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
1927 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
1928 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
1929 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
1930 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
1931 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
1932 | { } /* end */ | ||
1933 | }; | ||
1934 | |||
1935 | static const struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { | ||
1936 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
1937 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | ||
1938 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
1939 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | ||
1940 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
1941 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
1942 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
1943 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
1944 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
1945 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
1946 | { } /* end */ | ||
1947 | }; | ||
1948 | |||
1949 | static const struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { | ||
1950 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
1951 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | ||
1952 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
1953 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | ||
1954 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
1955 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
1956 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
1957 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
1958 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
1959 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
1960 | { } /* end */ | ||
1961 | }; | ||
1962 | |||
1963 | static const struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { | ||
1964 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
1965 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
1966 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
1967 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
1968 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
1969 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
1970 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
1971 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
1972 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
1973 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
1974 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
1975 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
1976 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
1977 | { } /* end */ | ||
1978 | }; | ||
1979 | |||
1980 | static const struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { | 638 | static const struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
1981 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 639 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
1982 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | 640 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
@@ -2000,235 +658,6 @@ static const struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { | |||
2000 | { } /* end */ | 658 | { } /* end */ |
2001 | }; | 659 | }; |
2002 | 660 | ||
2003 | static const struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { | ||
2004 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
2005 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
2006 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
2007 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
2008 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | ||
2009 | HDA_OUTPUT), | ||
2010 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
2011 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
2012 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
2013 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
2014 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
2015 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
2016 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
2017 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
2018 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
2019 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
2020 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
2021 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
2022 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
2023 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
2024 | { } /* end */ | ||
2025 | }; | ||
2026 | |||
2027 | static const struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { | ||
2028 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
2029 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
2030 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
2031 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
2032 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | ||
2033 | HDA_OUTPUT), | ||
2034 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
2035 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
2036 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
2037 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
2038 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), | ||
2039 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
2040 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
2041 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
2042 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), | ||
2043 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT), | ||
2044 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), | ||
2045 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
2046 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
2047 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
2048 | { } /* end */ | ||
2049 | }; | ||
2050 | |||
2051 | static const struct snd_kcontrol_new alc883_fivestack_mixer[] = { | ||
2052 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
2053 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
2054 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
2055 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
2056 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | ||
2057 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
2058 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
2059 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
2060 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
2061 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
2062 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
2063 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
2064 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
2065 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
2066 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
2067 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
2068 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
2069 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
2070 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
2071 | { } /* end */ | ||
2072 | }; | ||
2073 | |||
2074 | static const struct snd_kcontrol_new alc883_targa_mixer[] = { | ||
2075 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
2076 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
2077 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
2078 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
2079 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
2080 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
2081 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | ||
2082 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
2083 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
2084 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
2085 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
2086 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
2087 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
2088 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
2089 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
2090 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
2091 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
2092 | { } /* end */ | ||
2093 | }; | ||
2094 | |||
2095 | static const struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { | ||
2096 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
2097 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
2098 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
2099 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
2100 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
2101 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
2102 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
2103 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
2104 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
2105 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
2106 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
2107 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
2108 | { } /* end */ | ||
2109 | }; | ||
2110 | |||
2111 | static const struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { | ||
2112 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
2113 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | ||
2114 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
2115 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
2116 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
2117 | { } /* end */ | ||
2118 | }; | ||
2119 | |||
2120 | static const struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { | ||
2121 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
2122 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
2123 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
2124 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | ||
2125 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
2126 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
2127 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
2128 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
2129 | { } /* end */ | ||
2130 | }; | ||
2131 | |||
2132 | static const struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { | ||
2133 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
2134 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), | ||
2135 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
2136 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
2137 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
2138 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
2139 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
2140 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
2141 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
2142 | { } /* end */ | ||
2143 | }; | ||
2144 | |||
2145 | static const struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { | ||
2146 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
2147 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
2148 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
2149 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), | ||
2150 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), | ||
2151 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), | ||
2152 | { } /* end */ | ||
2153 | }; | ||
2154 | |||
2155 | static const struct hda_verb alc883_medion_wim2160_verbs[] = { | ||
2156 | /* Unmute front mixer */ | ||
2157 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
2158 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
2159 | |||
2160 | /* Set speaker pin to front mixer */ | ||
2161 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
2162 | |||
2163 | /* Init headphone pin */ | ||
2164 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
2165 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
2166 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
2167 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
2168 | |||
2169 | { } /* end */ | ||
2170 | }; | ||
2171 | |||
2172 | /* toggle speaker-output according to the hp-jack state */ | ||
2173 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) | ||
2174 | { | ||
2175 | struct alc_spec *spec = codec->spec; | ||
2176 | |||
2177 | spec->autocfg.hp_pins[0] = 0x1a; | ||
2178 | spec->autocfg.speaker_pins[0] = 0x15; | ||
2179 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
2180 | } | ||
2181 | |||
2182 | static const struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { | ||
2183 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
2184 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
2185 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
2186 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
2187 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
2188 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
2189 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
2190 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
2191 | { } /* end */ | ||
2192 | }; | ||
2193 | |||
2194 | static const struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { | ||
2195 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
2196 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
2197 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
2198 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
2199 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
2200 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
2201 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
2202 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
2203 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
2204 | { } /* end */ | ||
2205 | }; | ||
2206 | |||
2207 | static const struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { | ||
2208 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
2209 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
2210 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | ||
2211 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), | ||
2212 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", | ||
2213 | 0x0d, 1, 0x0, HDA_OUTPUT), | ||
2214 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | ||
2215 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | ||
2216 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | ||
2217 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
2218 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | ||
2219 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
2220 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
2221 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
2222 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
2223 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
2224 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
2225 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
2226 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
2227 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
2228 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
2229 | { } /* end */ | ||
2230 | }; | ||
2231 | |||
2232 | static const struct snd_kcontrol_new alc889A_mb31_mixer[] = { | 661 | static const struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
2233 | /* Output mixers */ | 662 | /* Output mixers */ |
2234 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | 663 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
@@ -2255,61 +684,6 @@ static const struct snd_kcontrol_new alc889A_mb31_mixer[] = { | |||
2255 | { } /* end */ | 684 | { } /* end */ |
2256 | }; | 685 | }; |
2257 | 686 | ||
2258 | static const struct snd_kcontrol_new alc883_vaiott_mixer[] = { | ||
2259 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
2260 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
2261 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
2262 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
2263 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
2264 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
2265 | { } /* end */ | ||
2266 | }; | ||
2267 | |||
2268 | static const struct hda_bind_ctls alc883_bind_cap_vol = { | ||
2269 | .ops = &snd_hda_bind_vol, | ||
2270 | .values = { | ||
2271 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | ||
2272 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | ||
2273 | 0 | ||
2274 | }, | ||
2275 | }; | ||
2276 | |||
2277 | static const struct hda_bind_ctls alc883_bind_cap_switch = { | ||
2278 | .ops = &snd_hda_bind_sw, | ||
2279 | .values = { | ||
2280 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | ||
2281 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | ||
2282 | 0 | ||
2283 | }, | ||
2284 | }; | ||
2285 | |||
2286 | static const struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { | ||
2287 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
2288 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
2289 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
2290 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
2291 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
2292 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
2293 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
2294 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
2295 | { } /* end */ | ||
2296 | }; | ||
2297 | |||
2298 | static const struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { | ||
2299 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), | ||
2300 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), | ||
2301 | { | ||
2302 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
2303 | /* .name = "Capture Source", */ | ||
2304 | .name = "Input Source", | ||
2305 | .count = 1, | ||
2306 | .info = alc_mux_enum_info, | ||
2307 | .get = alc_mux_enum_get, | ||
2308 | .put = alc_mux_enum_put, | ||
2309 | }, | ||
2310 | { } /* end */ | ||
2311 | }; | ||
2312 | |||
2313 | static const struct snd_kcontrol_new alc883_chmode_mixer[] = { | 687 | static const struct snd_kcontrol_new alc883_chmode_mixer[] = { |
2314 | { | 688 | { |
2315 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 689 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
@@ -2321,423 +695,6 @@ static const struct snd_kcontrol_new alc883_chmode_mixer[] = { | |||
2321 | { } /* end */ | 695 | { } /* end */ |
2322 | }; | 696 | }; |
2323 | 697 | ||
2324 | /* toggle speaker-output according to the hp-jack state */ | ||
2325 | static void alc883_mitac_setup(struct hda_codec *codec) | ||
2326 | { | ||
2327 | struct alc_spec *spec = codec->spec; | ||
2328 | |||
2329 | spec->autocfg.hp_pins[0] = 0x15; | ||
2330 | spec->autocfg.speaker_pins[0] = 0x14; | ||
2331 | spec->autocfg.speaker_pins[1] = 0x17; | ||
2332 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
2333 | } | ||
2334 | |||
2335 | static const struct hda_verb alc883_mitac_verbs[] = { | ||
2336 | /* HP */ | ||
2337 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
2338 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
2339 | /* Subwoofer */ | ||
2340 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
2341 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
2342 | |||
2343 | /* enable unsolicited event */ | ||
2344 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
2345 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_MIC_EVENT | AC_USRSP_EN}, */ | ||
2346 | |||
2347 | { } /* end */ | ||
2348 | }; | ||
2349 | |||
2350 | static const struct hda_verb alc883_clevo_m540r_verbs[] = { | ||
2351 | /* HP */ | ||
2352 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
2353 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
2354 | /* Int speaker */ | ||
2355 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ | ||
2356 | |||
2357 | /* enable unsolicited event */ | ||
2358 | /* | ||
2359 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
2360 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_MIC_EVENT | AC_USRSP_EN}, | ||
2361 | */ | ||
2362 | |||
2363 | { } /* end */ | ||
2364 | }; | ||
2365 | |||
2366 | static const struct hda_verb alc883_clevo_m720_verbs[] = { | ||
2367 | /* HP */ | ||
2368 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
2369 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
2370 | /* Int speaker */ | ||
2371 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
2372 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
2373 | |||
2374 | /* enable unsolicited event */ | ||
2375 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
2376 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_MIC_EVENT | AC_USRSP_EN}, | ||
2377 | |||
2378 | { } /* end */ | ||
2379 | }; | ||
2380 | |||
2381 | static const struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { | ||
2382 | /* HP */ | ||
2383 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
2384 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
2385 | /* Subwoofer */ | ||
2386 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
2387 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
2388 | |||
2389 | /* enable unsolicited event */ | ||
2390 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
2391 | |||
2392 | { } /* end */ | ||
2393 | }; | ||
2394 | |||
2395 | static const struct hda_verb alc883_targa_verbs[] = { | ||
2396 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
2397 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
2398 | |||
2399 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
2400 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
2401 | |||
2402 | /* Connect Line-Out side jack (SPDIF) to Side */ | ||
2403 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
2404 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
2405 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | ||
2406 | /* Connect Mic jack to CLFE */ | ||
2407 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
2408 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
2409 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
2410 | /* Connect Line-in jack to Surround */ | ||
2411 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
2412 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
2413 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
2414 | /* Connect HP out jack to Front */ | ||
2415 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
2416 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
2417 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
2418 | |||
2419 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
2420 | |||
2421 | { } /* end */ | ||
2422 | }; | ||
2423 | |||
2424 | static const struct hda_verb alc883_lenovo_101e_verbs[] = { | ||
2425 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
2426 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_FRONT_EVENT|AC_USRSP_EN}, | ||
2427 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT|AC_USRSP_EN}, | ||
2428 | { } /* end */ | ||
2429 | }; | ||
2430 | |||
2431 | static const struct hda_verb alc883_lenovo_nb0763_verbs[] = { | ||
2432 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
2433 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
2434 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
2435 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
2436 | { } /* end */ | ||
2437 | }; | ||
2438 | |||
2439 | static const struct hda_verb alc888_lenovo_ms7195_verbs[] = { | ||
2440 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
2441 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
2442 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
2443 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_FRONT_EVENT | AC_USRSP_EN}, | ||
2444 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
2445 | { } /* end */ | ||
2446 | }; | ||
2447 | |||
2448 | static const struct hda_verb alc883_haier_w66_verbs[] = { | ||
2449 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
2450 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
2451 | |||
2452 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
2453 | |||
2454 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
2455 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
2456 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
2457 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
2458 | { } /* end */ | ||
2459 | }; | ||
2460 | |||
2461 | static const struct hda_verb alc888_lenovo_sky_verbs[] = { | ||
2462 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
2463 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
2464 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
2465 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
2466 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
2467 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
2468 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
2469 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
2470 | { } /* end */ | ||
2471 | }; | ||
2472 | |||
2473 | static const struct hda_verb alc888_6st_dell_verbs[] = { | ||
2474 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
2475 | { } | ||
2476 | }; | ||
2477 | |||
2478 | static const struct hda_verb alc883_vaiott_verbs[] = { | ||
2479 | /* HP */ | ||
2480 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
2481 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
2482 | |||
2483 | /* enable unsolicited event */ | ||
2484 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
2485 | |||
2486 | { } /* end */ | ||
2487 | }; | ||
2488 | |||
2489 | static void alc888_3st_hp_setup(struct hda_codec *codec) | ||
2490 | { | ||
2491 | struct alc_spec *spec = codec->spec; | ||
2492 | |||
2493 | spec->autocfg.hp_pins[0] = 0x1b; | ||
2494 | spec->autocfg.speaker_pins[0] = 0x14; | ||
2495 | spec->autocfg.speaker_pins[1] = 0x16; | ||
2496 | spec->autocfg.speaker_pins[2] = 0x18; | ||
2497 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
2498 | } | ||
2499 | |||
2500 | static const struct hda_verb alc888_3st_hp_verbs[] = { | ||
2501 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ | ||
2502 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ | ||
2503 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ | ||
2504 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
2505 | { } /* end */ | ||
2506 | }; | ||
2507 | |||
2508 | /* | ||
2509 | * 2ch mode | ||
2510 | */ | ||
2511 | static const struct hda_verb alc888_3st_hp_2ch_init[] = { | ||
2512 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
2513 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
2514 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
2515 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
2516 | { } /* end */ | ||
2517 | }; | ||
2518 | |||
2519 | /* | ||
2520 | * 4ch mode | ||
2521 | */ | ||
2522 | static const struct hda_verb alc888_3st_hp_4ch_init[] = { | ||
2523 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
2524 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
2525 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
2526 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
2527 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
2528 | { } /* end */ | ||
2529 | }; | ||
2530 | |||
2531 | /* | ||
2532 | * 6ch mode | ||
2533 | */ | ||
2534 | static const struct hda_verb alc888_3st_hp_6ch_init[] = { | ||
2535 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
2536 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
2537 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
2538 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
2539 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
2540 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
2541 | { } /* end */ | ||
2542 | }; | ||
2543 | |||
2544 | static const struct hda_channel_mode alc888_3st_hp_modes[3] = { | ||
2545 | { 2, alc888_3st_hp_2ch_init }, | ||
2546 | { 4, alc888_3st_hp_4ch_init }, | ||
2547 | { 6, alc888_3st_hp_6ch_init }, | ||
2548 | }; | ||
2549 | |||
2550 | static void alc888_lenovo_ms7195_setup(struct hda_codec *codec) | ||
2551 | { | ||
2552 | struct alc_spec *spec = codec->spec; | ||
2553 | |||
2554 | spec->autocfg.hp_pins[0] = 0x1b; | ||
2555 | spec->autocfg.line_out_pins[0] = 0x14; | ||
2556 | spec->autocfg.speaker_pins[0] = 0x15; | ||
2557 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
2558 | } | ||
2559 | |||
2560 | /* toggle speaker-output according to the hp-jack state */ | ||
2561 | static void alc883_lenovo_nb0763_setup(struct hda_codec *codec) | ||
2562 | { | ||
2563 | struct alc_spec *spec = codec->spec; | ||
2564 | |||
2565 | spec->autocfg.hp_pins[0] = 0x14; | ||
2566 | spec->autocfg.speaker_pins[0] = 0x15; | ||
2567 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
2568 | } | ||
2569 | |||
2570 | /* toggle speaker-output according to the hp-jack state */ | ||
2571 | #define alc883_targa_init_hook alc882_targa_init_hook | ||
2572 | #define alc883_targa_unsol_event alc882_targa_unsol_event | ||
2573 | |||
2574 | static void alc883_clevo_m720_setup(struct hda_codec *codec) | ||
2575 | { | ||
2576 | struct alc_spec *spec = codec->spec; | ||
2577 | |||
2578 | spec->autocfg.hp_pins[0] = 0x15; | ||
2579 | spec->autocfg.speaker_pins[0] = 0x14; | ||
2580 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
2581 | } | ||
2582 | |||
2583 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) | ||
2584 | { | ||
2585 | alc_hp_automute(codec); | ||
2586 | alc88x_simple_mic_automute(codec); | ||
2587 | } | ||
2588 | |||
2589 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, | ||
2590 | unsigned int res) | ||
2591 | { | ||
2592 | switch (res >> 26) { | ||
2593 | case ALC_MIC_EVENT: | ||
2594 | alc88x_simple_mic_automute(codec); | ||
2595 | break; | ||
2596 | default: | ||
2597 | alc_sku_unsol_event(codec, res); | ||
2598 | break; | ||
2599 | } | ||
2600 | } | ||
2601 | |||
2602 | /* toggle speaker-output according to the hp-jack state */ | ||
2603 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) | ||
2604 | { | ||
2605 | struct alc_spec *spec = codec->spec; | ||
2606 | |||
2607 | spec->autocfg.hp_pins[0] = 0x14; | ||
2608 | spec->autocfg.speaker_pins[0] = 0x15; | ||
2609 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
2610 | } | ||
2611 | |||
2612 | static void alc883_haier_w66_setup(struct hda_codec *codec) | ||
2613 | { | ||
2614 | struct alc_spec *spec = codec->spec; | ||
2615 | |||
2616 | spec->autocfg.hp_pins[0] = 0x1b; | ||
2617 | spec->autocfg.speaker_pins[0] = 0x14; | ||
2618 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
2619 | } | ||
2620 | |||
2621 | static void alc883_lenovo_101e_setup(struct hda_codec *codec) | ||
2622 | { | ||
2623 | struct alc_spec *spec = codec->spec; | ||
2624 | |||
2625 | spec->autocfg.hp_pins[0] = 0x1b; | ||
2626 | spec->autocfg.line_out_pins[0] = 0x14; | ||
2627 | spec->autocfg.speaker_pins[0] = 0x15; | ||
2628 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
2629 | } | ||
2630 | |||
2631 | /* toggle speaker-output according to the hp-jack state */ | ||
2632 | static void alc883_acer_aspire_setup(struct hda_codec *codec) | ||
2633 | { | ||
2634 | struct alc_spec *spec = codec->spec; | ||
2635 | |||
2636 | spec->autocfg.hp_pins[0] = 0x14; | ||
2637 | spec->autocfg.speaker_pins[0] = 0x15; | ||
2638 | spec->autocfg.speaker_pins[1] = 0x16; | ||
2639 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
2640 | } | ||
2641 | |||
2642 | static const struct hda_verb alc883_acer_eapd_verbs[] = { | ||
2643 | /* HP Pin: output 0 (0x0c) */ | ||
2644 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
2645 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
2646 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
2647 | /* Front Pin: output 0 (0x0c) */ | ||
2648 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
2649 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
2650 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
2651 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
2652 | /* eanable EAPD on medion laptop */ | ||
2653 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | ||
2654 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, | ||
2655 | /* enable unsolicited event */ | ||
2656 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
2657 | { } | ||
2658 | }; | ||
2659 | |||
2660 | static void alc888_6st_dell_setup(struct hda_codec *codec) | ||
2661 | { | ||
2662 | struct alc_spec *spec = codec->spec; | ||
2663 | |||
2664 | spec->autocfg.hp_pins[0] = 0x1b; | ||
2665 | spec->autocfg.speaker_pins[0] = 0x14; | ||
2666 | spec->autocfg.speaker_pins[1] = 0x15; | ||
2667 | spec->autocfg.speaker_pins[2] = 0x16; | ||
2668 | spec->autocfg.speaker_pins[3] = 0x17; | ||
2669 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
2670 | } | ||
2671 | |||
2672 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) | ||
2673 | { | ||
2674 | struct alc_spec *spec = codec->spec; | ||
2675 | |||
2676 | spec->autocfg.hp_pins[0] = 0x1b; | ||
2677 | spec->autocfg.speaker_pins[0] = 0x14; | ||
2678 | spec->autocfg.speaker_pins[1] = 0x15; | ||
2679 | spec->autocfg.speaker_pins[2] = 0x16; | ||
2680 | spec->autocfg.speaker_pins[3] = 0x17; | ||
2681 | spec->autocfg.speaker_pins[4] = 0x1a; | ||
2682 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
2683 | } | ||
2684 | |||
2685 | static void alc883_vaiott_setup(struct hda_codec *codec) | ||
2686 | { | ||
2687 | struct alc_spec *spec = codec->spec; | ||
2688 | |||
2689 | spec->autocfg.hp_pins[0] = 0x15; | ||
2690 | spec->autocfg.speaker_pins[0] = 0x14; | ||
2691 | spec->autocfg.speaker_pins[1] = 0x17; | ||
2692 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
2693 | } | ||
2694 | |||
2695 | static const struct hda_verb alc888_asus_m90v_verbs[] = { | ||
2696 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
2697 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
2698 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
2699 | /* enable unsolicited event */ | ||
2700 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
2701 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_MIC_EVENT | AC_USRSP_EN}, | ||
2702 | { } /* end */ | ||
2703 | }; | ||
2704 | |||
2705 | static void alc883_mode2_setup(struct hda_codec *codec) | ||
2706 | { | ||
2707 | struct alc_spec *spec = codec->spec; | ||
2708 | |||
2709 | spec->autocfg.hp_pins[0] = 0x1b; | ||
2710 | spec->autocfg.speaker_pins[0] = 0x14; | ||
2711 | spec->autocfg.speaker_pins[1] = 0x15; | ||
2712 | spec->autocfg.speaker_pins[2] = 0x16; | ||
2713 | spec->ext_mic_pin = 0x18; | ||
2714 | spec->int_mic_pin = 0x19; | ||
2715 | spec->auto_mic = 1; | ||
2716 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); | ||
2717 | } | ||
2718 | |||
2719 | static const struct hda_verb alc888_asus_eee1601_verbs[] = { | ||
2720 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
2721 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
2722 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
2723 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
2724 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
2725 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, | ||
2726 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, | ||
2727 | /* enable unsolicited event */ | ||
2728 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
2729 | { } /* end */ | ||
2730 | }; | ||
2731 | |||
2732 | static void alc883_eee1601_inithook(struct hda_codec *codec) | ||
2733 | { | ||
2734 | struct alc_spec *spec = codec->spec; | ||
2735 | |||
2736 | spec->autocfg.hp_pins[0] = 0x14; | ||
2737 | spec->autocfg.speaker_pins[0] = 0x1b; | ||
2738 | alc_hp_automute(codec); | ||
2739 | } | ||
2740 | |||
2741 | static const struct hda_verb alc889A_mb31_verbs[] = { | 698 | static const struct hda_verb alc889A_mb31_verbs[] = { |
2742 | /* Init rear pin (used as headphone output) */ | 699 | /* Init rear pin (used as headphone output) */ |
2743 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ | 700 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
@@ -2773,211 +730,30 @@ static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) | |||
2773 | alc889A_mb31_automute(codec); | 730 | alc889A_mb31_automute(codec); |
2774 | } | 731 | } |
2775 | 732 | ||
2776 | static const hda_nid_t alc883_slave_dig_outs[] = { | ||
2777 | ALC1200_DIGOUT_NID, 0, | ||
2778 | }; | ||
2779 | |||
2780 | static const hda_nid_t alc1200_slave_dig_outs[] = { | ||
2781 | ALC883_DIGOUT_NID, 0, | ||
2782 | }; | ||
2783 | |||
2784 | /* | 733 | /* |
2785 | * configuration and preset | 734 | * configuration and preset |
2786 | */ | 735 | */ |
2787 | static const char * const alc882_models[ALC882_MODEL_LAST] = { | 736 | static const char * const alc882_models[ALC882_MODEL_LAST] = { |
2788 | [ALC882_3ST_DIG] = "3stack-dig", | ||
2789 | [ALC882_6ST_DIG] = "6stack-dig", | ||
2790 | [ALC882_ARIMA] = "arima", | ||
2791 | [ALC882_W2JC] = "w2jc", | ||
2792 | [ALC882_TARGA] = "targa", | ||
2793 | [ALC882_ASUS_A7J] = "asus-a7j", | ||
2794 | [ALC882_ASUS_A7M] = "asus-a7m", | ||
2795 | [ALC885_MACPRO] = "macpro", | ||
2796 | [ALC885_MB5] = "mb5", | 737 | [ALC885_MB5] = "mb5", |
2797 | [ALC885_MACMINI3] = "macmini3", | 738 | [ALC885_MACMINI3] = "macmini3", |
2798 | [ALC885_MBA21] = "mba21", | 739 | [ALC885_MBA21] = "mba21", |
2799 | [ALC885_MBP3] = "mbp3", | 740 | [ALC885_MBP3] = "mbp3", |
2800 | [ALC885_IMAC24] = "imac24", | ||
2801 | [ALC885_IMAC91] = "imac91", | 741 | [ALC885_IMAC91] = "imac91", |
2802 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", | ||
2803 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", | ||
2804 | [ALC883_3ST_6ch] = "3stack-6ch", | ||
2805 | [ALC883_6ST_DIG] = "alc883-6stack-dig", | ||
2806 | [ALC883_TARGA_DIG] = "targa-dig", | ||
2807 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", | ||
2808 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", | ||
2809 | [ALC883_ACER] = "acer", | ||
2810 | [ALC883_ACER_ASPIRE] = "acer-aspire", | ||
2811 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", | ||
2812 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", | ||
2813 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", | ||
2814 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", | ||
2815 | [ALC883_MEDION] = "medion", | ||
2816 | [ALC883_MEDION_WIM2160] = "medion-wim2160", | ||
2817 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", | ||
2818 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", | ||
2819 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", | ||
2820 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", | ||
2821 | [ALC888_LENOVO_SKY] = "lenovo-sky", | ||
2822 | [ALC883_HAIER_W66] = "haier-w66", | ||
2823 | [ALC888_3ST_HP] = "3stack-hp", | ||
2824 | [ALC888_6ST_DELL] = "6stack-dell", | ||
2825 | [ALC883_MITAC] = "mitac", | ||
2826 | [ALC883_CLEVO_M540R] = "clevo-m540r", | ||
2827 | [ALC883_CLEVO_M720] = "clevo-m720", | ||
2828 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", | ||
2829 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", | ||
2830 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", | ||
2831 | [ALC889A_INTEL] = "intel-alc889a", | ||
2832 | [ALC889_INTEL] = "intel-x58", | ||
2833 | [ALC1200_ASUS_P5Q] = "asus-p5q", | ||
2834 | [ALC889A_MB31] = "mb31", | 742 | [ALC889A_MB31] = "mb31", |
2835 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", | ||
2836 | [ALC882_AUTO] = "auto", | 743 | [ALC882_AUTO] = "auto", |
2837 | }; | 744 | }; |
2838 | 745 | ||
2839 | static const struct snd_pci_quirk alc882_cfg_tbl[] = { | ||
2840 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), | ||
2841 | |||
2842 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), | ||
2843 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), | ||
2844 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), | ||
2845 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), | ||
2846 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), | ||
2847 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), | ||
2848 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", | ||
2849 | ALC888_ACER_ASPIRE_4930G), | ||
2850 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", | ||
2851 | ALC888_ACER_ASPIRE_4930G), | ||
2852 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", | ||
2853 | ALC888_ACER_ASPIRE_8930G), | ||
2854 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", | ||
2855 | ALC888_ACER_ASPIRE_8930G), | ||
2856 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), | ||
2857 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), | ||
2858 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", | ||
2859 | ALC888_ACER_ASPIRE_6530G), | ||
2860 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", | ||
2861 | ALC888_ACER_ASPIRE_6530G), | ||
2862 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", | ||
2863 | ALC888_ACER_ASPIRE_7730G), | ||
2864 | /* default Acer -- disabled as it causes more problems. | ||
2865 | * model=auto should work fine now | ||
2866 | */ | ||
2867 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ | ||
2868 | |||
2869 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), | ||
2870 | |||
2871 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavilion", ALC883_6ST_DIG), | ||
2872 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), | ||
2873 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), | ||
2874 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), | ||
2875 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), | ||
2876 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), | ||
2877 | |||
2878 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), | ||
2879 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), | ||
2880 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), | ||
2881 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), | ||
2882 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), | ||
2883 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), | ||
2884 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), | ||
2885 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), | ||
2886 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), | ||
2887 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), | ||
2888 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), | ||
2889 | |||
2890 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), | ||
2891 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), | ||
2892 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), | ||
2893 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), | ||
2894 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), | ||
2895 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), | ||
2896 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), | ||
2897 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), | ||
2898 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), | ||
2899 | |||
2900 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), | ||
2901 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), | ||
2902 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), | ||
2903 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ | ||
2904 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), | ||
2905 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), | ||
2906 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), | ||
2907 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), | ||
2908 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), | ||
2909 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), | ||
2910 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), | ||
2911 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), | ||
2912 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), | ||
2913 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), | ||
2914 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), | ||
2915 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), | ||
2916 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), | ||
2917 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), | ||
2918 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), | ||
2919 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), | ||
2920 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), | ||
2921 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), | ||
2922 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), | ||
2923 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), | ||
2924 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), | ||
2925 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), | ||
2926 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), | ||
2927 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), | ||
2928 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), | ||
2929 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), | ||
2930 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), | ||
2931 | |||
2932 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), | ||
2933 | SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG), | ||
2934 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), | ||
2935 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), | ||
2936 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), | ||
2937 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), | ||
2938 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), | ||
2939 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ | ||
2940 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), | ||
2941 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", | ||
2942 | ALC883_FUJITSU_PI2515), | ||
2943 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", | ||
2944 | ALC888_FUJITSU_XA3530), | ||
2945 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), | ||
2946 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), | ||
2947 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), | ||
2948 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), | ||
2949 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), | ||
2950 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), | ||
2951 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), | ||
2952 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), | ||
2953 | |||
2954 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), | ||
2955 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), | ||
2956 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), | ||
2957 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), | ||
2958 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), | ||
2959 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), | ||
2960 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), | ||
2961 | |||
2962 | {} | ||
2963 | }; | ||
2964 | |||
2965 | /* codec SSID table for Intel Mac */ | 746 | /* codec SSID table for Intel Mac */ |
2966 | static const struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { | 747 | static const struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
2967 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), | 748 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
2968 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), | 749 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
2969 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), | 750 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
2970 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), | ||
2971 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), | ||
2972 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), | ||
2973 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), | 751 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
2974 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), | 752 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
2975 | SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M), | ||
2976 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), | 753 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
2977 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), | 754 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
2978 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), | 755 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
2979 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), | 756 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
2980 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), | ||
2981 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), | 757 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
2982 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), | 758 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
2983 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), | 759 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
@@ -2991,53 +767,6 @@ static const struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { | |||
2991 | }; | 767 | }; |
2992 | 768 | ||
2993 | static const struct alc_config_preset alc882_presets[] = { | 769 | static const struct alc_config_preset alc882_presets[] = { |
2994 | [ALC882_3ST_DIG] = { | ||
2995 | .mixers = { alc882_base_mixer }, | ||
2996 | .init_verbs = { alc882_base_init_verbs, | ||
2997 | alc882_adc1_init_verbs }, | ||
2998 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
2999 | .dac_nids = alc882_dac_nids, | ||
3000 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
3001 | .dig_in_nid = ALC882_DIGIN_NID, | ||
3002 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | ||
3003 | .channel_mode = alc882_ch_modes, | ||
3004 | .need_dac_fix = 1, | ||
3005 | .input_mux = &alc882_capture_source, | ||
3006 | }, | ||
3007 | [ALC882_6ST_DIG] = { | ||
3008 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | ||
3009 | .init_verbs = { alc882_base_init_verbs, | ||
3010 | alc882_adc1_init_verbs }, | ||
3011 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
3012 | .dac_nids = alc882_dac_nids, | ||
3013 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
3014 | .dig_in_nid = ALC882_DIGIN_NID, | ||
3015 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | ||
3016 | .channel_mode = alc882_sixstack_modes, | ||
3017 | .input_mux = &alc882_capture_source, | ||
3018 | }, | ||
3019 | [ALC882_ARIMA] = { | ||
3020 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | ||
3021 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | ||
3022 | alc882_eapd_verbs }, | ||
3023 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
3024 | .dac_nids = alc882_dac_nids, | ||
3025 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | ||
3026 | .channel_mode = alc882_sixstack_modes, | ||
3027 | .input_mux = &alc882_capture_source, | ||
3028 | }, | ||
3029 | [ALC882_W2JC] = { | ||
3030 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, | ||
3031 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | ||
3032 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, | ||
3033 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
3034 | .dac_nids = alc882_dac_nids, | ||
3035 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | ||
3036 | .channel_mode = alc880_threestack_modes, | ||
3037 | .need_dac_fix = 1, | ||
3038 | .input_mux = &alc882_capture_source, | ||
3039 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
3040 | }, | ||
3041 | [ALC885_MBA21] = { | 770 | [ALC885_MBA21] = { |
3042 | .mixers = { alc885_mba21_mixer }, | 771 | .mixers = { alc885_mba21_mixer }, |
3043 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, | 772 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
@@ -3096,32 +825,6 @@ static const struct alc_config_preset alc882_presets[] = { | |||
3096 | .setup = alc885_macmini3_setup, | 825 | .setup = alc885_macmini3_setup, |
3097 | .init_hook = alc_hp_automute, | 826 | .init_hook = alc_hp_automute, |
3098 | }, | 827 | }, |
3099 | [ALC885_MACPRO] = { | ||
3100 | .mixers = { alc882_macpro_mixer }, | ||
3101 | .init_verbs = { alc882_macpro_init_verbs }, | ||
3102 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
3103 | .dac_nids = alc882_dac_nids, | ||
3104 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
3105 | .dig_in_nid = ALC882_DIGIN_NID, | ||
3106 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | ||
3107 | .channel_mode = alc882_ch_modes, | ||
3108 | .input_mux = &alc882_capture_source, | ||
3109 | .init_hook = alc885_macpro_init_hook, | ||
3110 | }, | ||
3111 | [ALC885_IMAC24] = { | ||
3112 | .mixers = { alc885_imac24_mixer }, | ||
3113 | .init_verbs = { alc885_imac24_init_verbs }, | ||
3114 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
3115 | .dac_nids = alc882_dac_nids, | ||
3116 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
3117 | .dig_in_nid = ALC882_DIGIN_NID, | ||
3118 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | ||
3119 | .channel_mode = alc882_ch_modes, | ||
3120 | .input_mux = &alc882_capture_source, | ||
3121 | .unsol_event = alc_sku_unsol_event, | ||
3122 | .setup = alc885_imac24_setup, | ||
3123 | .init_hook = alc885_imac24_init_hook, | ||
3124 | }, | ||
3125 | [ALC885_IMAC91] = { | 828 | [ALC885_IMAC91] = { |
3126 | .mixers = {alc885_imac91_mixer}, | 829 | .mixers = {alc885_imac91_mixer}, |
3127 | .init_verbs = { alc885_imac91_init_verbs, | 830 | .init_verbs = { alc885_imac91_init_verbs, |
@@ -3137,564 +840,6 @@ static const struct alc_config_preset alc882_presets[] = { | |||
3137 | .setup = alc885_imac91_setup, | 840 | .setup = alc885_imac91_setup, |
3138 | .init_hook = alc_hp_automute, | 841 | .init_hook = alc_hp_automute, |
3139 | }, | 842 | }, |
3140 | [ALC882_TARGA] = { | ||
3141 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, | ||
3142 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | ||
3143 | alc880_gpio3_init_verbs, alc882_targa_verbs}, | ||
3144 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
3145 | .dac_nids = alc882_dac_nids, | ||
3146 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
3147 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | ||
3148 | .adc_nids = alc882_adc_nids, | ||
3149 | .capsrc_nids = alc882_capsrc_nids, | ||
3150 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | ||
3151 | .channel_mode = alc882_3ST_6ch_modes, | ||
3152 | .need_dac_fix = 1, | ||
3153 | .input_mux = &alc882_capture_source, | ||
3154 | .unsol_event = alc_sku_unsol_event, | ||
3155 | .setup = alc882_targa_setup, | ||
3156 | .init_hook = alc882_targa_automute, | ||
3157 | }, | ||
3158 | [ALC882_ASUS_A7J] = { | ||
3159 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, | ||
3160 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | ||
3161 | alc882_asus_a7j_verbs}, | ||
3162 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
3163 | .dac_nids = alc882_dac_nids, | ||
3164 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
3165 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | ||
3166 | .adc_nids = alc882_adc_nids, | ||
3167 | .capsrc_nids = alc882_capsrc_nids, | ||
3168 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | ||
3169 | .channel_mode = alc882_3ST_6ch_modes, | ||
3170 | .need_dac_fix = 1, | ||
3171 | .input_mux = &alc882_capture_source, | ||
3172 | }, | ||
3173 | [ALC882_ASUS_A7M] = { | ||
3174 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, | ||
3175 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | ||
3176 | alc882_eapd_verbs, alc880_gpio1_init_verbs, | ||
3177 | alc882_asus_a7m_verbs }, | ||
3178 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
3179 | .dac_nids = alc882_dac_nids, | ||
3180 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
3181 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | ||
3182 | .channel_mode = alc880_threestack_modes, | ||
3183 | .need_dac_fix = 1, | ||
3184 | .input_mux = &alc882_capture_source, | ||
3185 | }, | ||
3186 | [ALC883_3ST_2ch_DIG] = { | ||
3187 | .mixers = { alc883_3ST_2ch_mixer }, | ||
3188 | .init_verbs = { alc883_init_verbs }, | ||
3189 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3190 | .dac_nids = alc883_dac_nids, | ||
3191 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
3192 | .dig_in_nid = ALC883_DIGIN_NID, | ||
3193 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
3194 | .channel_mode = alc883_3ST_2ch_modes, | ||
3195 | .input_mux = &alc883_capture_source, | ||
3196 | }, | ||
3197 | [ALC883_3ST_6ch_DIG] = { | ||
3198 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | ||
3199 | .init_verbs = { alc883_init_verbs }, | ||
3200 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3201 | .dac_nids = alc883_dac_nids, | ||
3202 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
3203 | .dig_in_nid = ALC883_DIGIN_NID, | ||
3204 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | ||
3205 | .channel_mode = alc883_3ST_6ch_modes, | ||
3206 | .need_dac_fix = 1, | ||
3207 | .input_mux = &alc883_capture_source, | ||
3208 | }, | ||
3209 | [ALC883_3ST_6ch] = { | ||
3210 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | ||
3211 | .init_verbs = { alc883_init_verbs }, | ||
3212 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3213 | .dac_nids = alc883_dac_nids, | ||
3214 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | ||
3215 | .channel_mode = alc883_3ST_6ch_modes, | ||
3216 | .need_dac_fix = 1, | ||
3217 | .input_mux = &alc883_capture_source, | ||
3218 | }, | ||
3219 | [ALC883_3ST_6ch_INTEL] = { | ||
3220 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, | ||
3221 | .init_verbs = { alc883_init_verbs }, | ||
3222 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3223 | .dac_nids = alc883_dac_nids, | ||
3224 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
3225 | .dig_in_nid = ALC883_DIGIN_NID, | ||
3226 | .slave_dig_outs = alc883_slave_dig_outs, | ||
3227 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), | ||
3228 | .channel_mode = alc883_3ST_6ch_intel_modes, | ||
3229 | .need_dac_fix = 1, | ||
3230 | .input_mux = &alc883_3stack_6ch_intel, | ||
3231 | }, | ||
3232 | [ALC889A_INTEL] = { | ||
3233 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, | ||
3234 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, | ||
3235 | alc_hp15_unsol_verbs }, | ||
3236 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3237 | .dac_nids = alc883_dac_nids, | ||
3238 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | ||
3239 | .adc_nids = alc889_adc_nids, | ||
3240 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
3241 | .dig_in_nid = ALC883_DIGIN_NID, | ||
3242 | .slave_dig_outs = alc883_slave_dig_outs, | ||
3243 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), | ||
3244 | .channel_mode = alc889_8ch_intel_modes, | ||
3245 | .capsrc_nids = alc889_capsrc_nids, | ||
3246 | .input_mux = &alc889_capture_source, | ||
3247 | .setup = alc889_automute_setup, | ||
3248 | .init_hook = alc_hp_automute, | ||
3249 | .unsol_event = alc_sku_unsol_event, | ||
3250 | .need_dac_fix = 1, | ||
3251 | }, | ||
3252 | [ALC889_INTEL] = { | ||
3253 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, | ||
3254 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, | ||
3255 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, | ||
3256 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3257 | .dac_nids = alc883_dac_nids, | ||
3258 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | ||
3259 | .adc_nids = alc889_adc_nids, | ||
3260 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
3261 | .dig_in_nid = ALC883_DIGIN_NID, | ||
3262 | .slave_dig_outs = alc883_slave_dig_outs, | ||
3263 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), | ||
3264 | .channel_mode = alc889_8ch_intel_modes, | ||
3265 | .capsrc_nids = alc889_capsrc_nids, | ||
3266 | .input_mux = &alc889_capture_source, | ||
3267 | .setup = alc889_automute_setup, | ||
3268 | .init_hook = alc889_intel_init_hook, | ||
3269 | .unsol_event = alc_sku_unsol_event, | ||
3270 | .need_dac_fix = 1, | ||
3271 | }, | ||
3272 | [ALC883_6ST_DIG] = { | ||
3273 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | ||
3274 | .init_verbs = { alc883_init_verbs }, | ||
3275 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3276 | .dac_nids = alc883_dac_nids, | ||
3277 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
3278 | .dig_in_nid = ALC883_DIGIN_NID, | ||
3279 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | ||
3280 | .channel_mode = alc883_sixstack_modes, | ||
3281 | .input_mux = &alc883_capture_source, | ||
3282 | }, | ||
3283 | [ALC883_TARGA_DIG] = { | ||
3284 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, | ||
3285 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, | ||
3286 | alc883_targa_verbs}, | ||
3287 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3288 | .dac_nids = alc883_dac_nids, | ||
3289 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
3290 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | ||
3291 | .channel_mode = alc883_3ST_6ch_modes, | ||
3292 | .need_dac_fix = 1, | ||
3293 | .input_mux = &alc883_capture_source, | ||
3294 | .unsol_event = alc883_targa_unsol_event, | ||
3295 | .setup = alc882_targa_setup, | ||
3296 | .init_hook = alc882_targa_automute, | ||
3297 | }, | ||
3298 | [ALC883_TARGA_2ch_DIG] = { | ||
3299 | .mixers = { alc883_targa_2ch_mixer}, | ||
3300 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, | ||
3301 | alc883_targa_verbs}, | ||
3302 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3303 | .dac_nids = alc883_dac_nids, | ||
3304 | .adc_nids = alc883_adc_nids_alt, | ||
3305 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | ||
3306 | .capsrc_nids = alc883_capsrc_nids, | ||
3307 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
3308 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
3309 | .channel_mode = alc883_3ST_2ch_modes, | ||
3310 | .input_mux = &alc883_capture_source, | ||
3311 | .unsol_event = alc883_targa_unsol_event, | ||
3312 | .setup = alc882_targa_setup, | ||
3313 | .init_hook = alc882_targa_automute, | ||
3314 | }, | ||
3315 | [ALC883_TARGA_8ch_DIG] = { | ||
3316 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, | ||
3317 | alc883_chmode_mixer }, | ||
3318 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, | ||
3319 | alc883_targa_verbs }, | ||
3320 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3321 | .dac_nids = alc883_dac_nids, | ||
3322 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | ||
3323 | .adc_nids = alc883_adc_nids_rev, | ||
3324 | .capsrc_nids = alc883_capsrc_nids_rev, | ||
3325 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
3326 | .dig_in_nid = ALC883_DIGIN_NID, | ||
3327 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), | ||
3328 | .channel_mode = alc883_4ST_8ch_modes, | ||
3329 | .need_dac_fix = 1, | ||
3330 | .input_mux = &alc883_capture_source, | ||
3331 | .unsol_event = alc883_targa_unsol_event, | ||
3332 | .setup = alc882_targa_setup, | ||
3333 | .init_hook = alc882_targa_automute, | ||
3334 | }, | ||
3335 | [ALC883_ACER] = { | ||
3336 | .mixers = { alc883_base_mixer }, | ||
3337 | /* On TravelMate laptops, GPIO 0 enables the internal speaker | ||
3338 | * and the headphone jack. Turn this on and rely on the | ||
3339 | * standard mute methods whenever the user wants to turn | ||
3340 | * these outputs off. | ||
3341 | */ | ||
3342 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, | ||
3343 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3344 | .dac_nids = alc883_dac_nids, | ||
3345 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
3346 | .channel_mode = alc883_3ST_2ch_modes, | ||
3347 | .input_mux = &alc883_capture_source, | ||
3348 | }, | ||
3349 | [ALC883_ACER_ASPIRE] = { | ||
3350 | .mixers = { alc883_acer_aspire_mixer }, | ||
3351 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, | ||
3352 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3353 | .dac_nids = alc883_dac_nids, | ||
3354 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
3355 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
3356 | .channel_mode = alc883_3ST_2ch_modes, | ||
3357 | .input_mux = &alc883_capture_source, | ||
3358 | .unsol_event = alc_sku_unsol_event, | ||
3359 | .setup = alc883_acer_aspire_setup, | ||
3360 | .init_hook = alc_hp_automute, | ||
3361 | }, | ||
3362 | [ALC888_ACER_ASPIRE_4930G] = { | ||
3363 | .mixers = { alc888_acer_aspire_4930g_mixer, | ||
3364 | alc883_chmode_mixer }, | ||
3365 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | ||
3366 | alc888_acer_aspire_4930g_verbs }, | ||
3367 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3368 | .dac_nids = alc883_dac_nids, | ||
3369 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | ||
3370 | .adc_nids = alc883_adc_nids_rev, | ||
3371 | .capsrc_nids = alc883_capsrc_nids_rev, | ||
3372 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
3373 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | ||
3374 | .channel_mode = alc883_3ST_6ch_modes, | ||
3375 | .need_dac_fix = 1, | ||
3376 | .const_channel_count = 6, | ||
3377 | .num_mux_defs = | ||
3378 | ARRAY_SIZE(alc888_2_capture_sources), | ||
3379 | .input_mux = alc888_2_capture_sources, | ||
3380 | .unsol_event = alc_sku_unsol_event, | ||
3381 | .setup = alc888_acer_aspire_4930g_setup, | ||
3382 | .init_hook = alc_hp_automute, | ||
3383 | }, | ||
3384 | [ALC888_ACER_ASPIRE_6530G] = { | ||
3385 | .mixers = { alc888_acer_aspire_6530_mixer }, | ||
3386 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | ||
3387 | alc888_acer_aspire_6530g_verbs }, | ||
3388 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3389 | .dac_nids = alc883_dac_nids, | ||
3390 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | ||
3391 | .adc_nids = alc883_adc_nids_rev, | ||
3392 | .capsrc_nids = alc883_capsrc_nids_rev, | ||
3393 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
3394 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
3395 | .channel_mode = alc883_3ST_2ch_modes, | ||
3396 | .num_mux_defs = | ||
3397 | ARRAY_SIZE(alc888_2_capture_sources), | ||
3398 | .input_mux = alc888_acer_aspire_6530_sources, | ||
3399 | .unsol_event = alc_sku_unsol_event, | ||
3400 | .setup = alc888_acer_aspire_6530g_setup, | ||
3401 | .init_hook = alc_hp_automute, | ||
3402 | }, | ||
3403 | [ALC888_ACER_ASPIRE_8930G] = { | ||
3404 | .mixers = { alc889_acer_aspire_8930g_mixer, | ||
3405 | alc883_chmode_mixer }, | ||
3406 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | ||
3407 | alc889_acer_aspire_8930g_verbs, | ||
3408 | alc889_eapd_verbs}, | ||
3409 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3410 | .dac_nids = alc883_dac_nids, | ||
3411 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | ||
3412 | .adc_nids = alc889_adc_nids, | ||
3413 | .capsrc_nids = alc889_capsrc_nids, | ||
3414 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
3415 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | ||
3416 | .channel_mode = alc883_3ST_6ch_modes, | ||
3417 | .need_dac_fix = 1, | ||
3418 | .const_channel_count = 6, | ||
3419 | .num_mux_defs = | ||
3420 | ARRAY_SIZE(alc889_capture_sources), | ||
3421 | .input_mux = alc889_capture_sources, | ||
3422 | .unsol_event = alc_sku_unsol_event, | ||
3423 | .setup = alc889_acer_aspire_8930g_setup, | ||
3424 | .init_hook = alc_hp_automute, | ||
3425 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
3426 | .power_hook = alc_power_eapd, | ||
3427 | #endif | ||
3428 | }, | ||
3429 | [ALC888_ACER_ASPIRE_7730G] = { | ||
3430 | .mixers = { alc883_3ST_6ch_mixer, | ||
3431 | alc883_chmode_mixer }, | ||
3432 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | ||
3433 | alc888_acer_aspire_7730G_verbs }, | ||
3434 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3435 | .dac_nids = alc883_dac_nids, | ||
3436 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | ||
3437 | .adc_nids = alc883_adc_nids_rev, | ||
3438 | .capsrc_nids = alc883_capsrc_nids_rev, | ||
3439 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
3440 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | ||
3441 | .channel_mode = alc883_3ST_6ch_modes, | ||
3442 | .need_dac_fix = 1, | ||
3443 | .const_channel_count = 6, | ||
3444 | .input_mux = &alc883_capture_source, | ||
3445 | .unsol_event = alc_sku_unsol_event, | ||
3446 | .setup = alc888_acer_aspire_7730g_setup, | ||
3447 | .init_hook = alc_hp_automute, | ||
3448 | }, | ||
3449 | [ALC883_MEDION] = { | ||
3450 | .mixers = { alc883_fivestack_mixer, | ||
3451 | alc883_chmode_mixer }, | ||
3452 | .init_verbs = { alc883_init_verbs, | ||
3453 | alc883_medion_eapd_verbs }, | ||
3454 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3455 | .dac_nids = alc883_dac_nids, | ||
3456 | .adc_nids = alc883_adc_nids_alt, | ||
3457 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | ||
3458 | .capsrc_nids = alc883_capsrc_nids, | ||
3459 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | ||
3460 | .channel_mode = alc883_sixstack_modes, | ||
3461 | .input_mux = &alc883_capture_source, | ||
3462 | }, | ||
3463 | [ALC883_MEDION_WIM2160] = { | ||
3464 | .mixers = { alc883_medion_wim2160_mixer }, | ||
3465 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, | ||
3466 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3467 | .dac_nids = alc883_dac_nids, | ||
3468 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
3469 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
3470 | .adc_nids = alc883_adc_nids, | ||
3471 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
3472 | .channel_mode = alc883_3ST_2ch_modes, | ||
3473 | .input_mux = &alc883_capture_source, | ||
3474 | .unsol_event = alc_sku_unsol_event, | ||
3475 | .setup = alc883_medion_wim2160_setup, | ||
3476 | .init_hook = alc_hp_automute, | ||
3477 | }, | ||
3478 | [ALC883_LAPTOP_EAPD] = { | ||
3479 | .mixers = { alc883_base_mixer }, | ||
3480 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, | ||
3481 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3482 | .dac_nids = alc883_dac_nids, | ||
3483 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
3484 | .channel_mode = alc883_3ST_2ch_modes, | ||
3485 | .input_mux = &alc883_capture_source, | ||
3486 | }, | ||
3487 | [ALC883_CLEVO_M540R] = { | ||
3488 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | ||
3489 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, | ||
3490 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3491 | .dac_nids = alc883_dac_nids, | ||
3492 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
3493 | .dig_in_nid = ALC883_DIGIN_NID, | ||
3494 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), | ||
3495 | .channel_mode = alc883_3ST_6ch_clevo_modes, | ||
3496 | .need_dac_fix = 1, | ||
3497 | .input_mux = &alc883_capture_source, | ||
3498 | /* This machine has the hardware HP auto-muting, thus | ||
3499 | * we need no software mute via unsol event | ||
3500 | */ | ||
3501 | }, | ||
3502 | [ALC883_CLEVO_M720] = { | ||
3503 | .mixers = { alc883_clevo_m720_mixer }, | ||
3504 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, | ||
3505 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3506 | .dac_nids = alc883_dac_nids, | ||
3507 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
3508 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
3509 | .channel_mode = alc883_3ST_2ch_modes, | ||
3510 | .input_mux = &alc883_capture_source, | ||
3511 | .unsol_event = alc883_clevo_m720_unsol_event, | ||
3512 | .setup = alc883_clevo_m720_setup, | ||
3513 | .init_hook = alc883_clevo_m720_init_hook, | ||
3514 | }, | ||
3515 | [ALC883_LENOVO_101E_2ch] = { | ||
3516 | .mixers = { alc883_lenovo_101e_2ch_mixer}, | ||
3517 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, | ||
3518 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3519 | .dac_nids = alc883_dac_nids, | ||
3520 | .adc_nids = alc883_adc_nids_alt, | ||
3521 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | ||
3522 | .capsrc_nids = alc883_capsrc_nids, | ||
3523 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
3524 | .channel_mode = alc883_3ST_2ch_modes, | ||
3525 | .input_mux = &alc883_lenovo_101e_capture_source, | ||
3526 | .setup = alc883_lenovo_101e_setup, | ||
3527 | .unsol_event = alc_sku_unsol_event, | ||
3528 | .init_hook = alc_inithook, | ||
3529 | }, | ||
3530 | [ALC883_LENOVO_NB0763] = { | ||
3531 | .mixers = { alc883_lenovo_nb0763_mixer }, | ||
3532 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, | ||
3533 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3534 | .dac_nids = alc883_dac_nids, | ||
3535 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
3536 | .channel_mode = alc883_3ST_2ch_modes, | ||
3537 | .need_dac_fix = 1, | ||
3538 | .input_mux = &alc883_lenovo_nb0763_capture_source, | ||
3539 | .unsol_event = alc_sku_unsol_event, | ||
3540 | .setup = alc883_lenovo_nb0763_setup, | ||
3541 | .init_hook = alc_hp_automute, | ||
3542 | }, | ||
3543 | [ALC888_LENOVO_MS7195_DIG] = { | ||
3544 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | ||
3545 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, | ||
3546 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3547 | .dac_nids = alc883_dac_nids, | ||
3548 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
3549 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | ||
3550 | .channel_mode = alc883_3ST_6ch_modes, | ||
3551 | .need_dac_fix = 1, | ||
3552 | .input_mux = &alc883_capture_source, | ||
3553 | .unsol_event = alc_sku_unsol_event, | ||
3554 | .setup = alc888_lenovo_ms7195_setup, | ||
3555 | .init_hook = alc_inithook, | ||
3556 | }, | ||
3557 | [ALC883_HAIER_W66] = { | ||
3558 | .mixers = { alc883_targa_2ch_mixer}, | ||
3559 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, | ||
3560 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3561 | .dac_nids = alc883_dac_nids, | ||
3562 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
3563 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
3564 | .channel_mode = alc883_3ST_2ch_modes, | ||
3565 | .input_mux = &alc883_capture_source, | ||
3566 | .unsol_event = alc_sku_unsol_event, | ||
3567 | .setup = alc883_haier_w66_setup, | ||
3568 | .init_hook = alc_hp_automute, | ||
3569 | }, | ||
3570 | [ALC888_3ST_HP] = { | ||
3571 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | ||
3572 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, | ||
3573 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3574 | .dac_nids = alc883_dac_nids, | ||
3575 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), | ||
3576 | .channel_mode = alc888_3st_hp_modes, | ||
3577 | .need_dac_fix = 1, | ||
3578 | .input_mux = &alc883_capture_source, | ||
3579 | .unsol_event = alc_sku_unsol_event, | ||
3580 | .setup = alc888_3st_hp_setup, | ||
3581 | .init_hook = alc_hp_automute, | ||
3582 | }, | ||
3583 | [ALC888_6ST_DELL] = { | ||
3584 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | ||
3585 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, | ||
3586 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3587 | .dac_nids = alc883_dac_nids, | ||
3588 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
3589 | .dig_in_nid = ALC883_DIGIN_NID, | ||
3590 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | ||
3591 | .channel_mode = alc883_sixstack_modes, | ||
3592 | .input_mux = &alc883_capture_source, | ||
3593 | .unsol_event = alc_sku_unsol_event, | ||
3594 | .setup = alc888_6st_dell_setup, | ||
3595 | .init_hook = alc_hp_automute, | ||
3596 | }, | ||
3597 | [ALC883_MITAC] = { | ||
3598 | .mixers = { alc883_mitac_mixer }, | ||
3599 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, | ||
3600 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3601 | .dac_nids = alc883_dac_nids, | ||
3602 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
3603 | .channel_mode = alc883_3ST_2ch_modes, | ||
3604 | .input_mux = &alc883_capture_source, | ||
3605 | .unsol_event = alc_sku_unsol_event, | ||
3606 | .setup = alc883_mitac_setup, | ||
3607 | .init_hook = alc_hp_automute, | ||
3608 | }, | ||
3609 | [ALC883_FUJITSU_PI2515] = { | ||
3610 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, | ||
3611 | .init_verbs = { alc883_init_verbs, | ||
3612 | alc883_2ch_fujitsu_pi2515_verbs}, | ||
3613 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3614 | .dac_nids = alc883_dac_nids, | ||
3615 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
3616 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
3617 | .channel_mode = alc883_3ST_2ch_modes, | ||
3618 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | ||
3619 | .unsol_event = alc_sku_unsol_event, | ||
3620 | .setup = alc883_2ch_fujitsu_pi2515_setup, | ||
3621 | .init_hook = alc_hp_automute, | ||
3622 | }, | ||
3623 | [ALC888_FUJITSU_XA3530] = { | ||
3624 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, | ||
3625 | .init_verbs = { alc883_init_verbs, | ||
3626 | alc888_fujitsu_xa3530_verbs }, | ||
3627 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3628 | .dac_nids = alc883_dac_nids, | ||
3629 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | ||
3630 | .adc_nids = alc883_adc_nids_rev, | ||
3631 | .capsrc_nids = alc883_capsrc_nids_rev, | ||
3632 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
3633 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), | ||
3634 | .channel_mode = alc888_4ST_8ch_intel_modes, | ||
3635 | .num_mux_defs = | ||
3636 | ARRAY_SIZE(alc888_2_capture_sources), | ||
3637 | .input_mux = alc888_2_capture_sources, | ||
3638 | .unsol_event = alc_sku_unsol_event, | ||
3639 | .setup = alc888_fujitsu_xa3530_setup, | ||
3640 | .init_hook = alc_hp_automute, | ||
3641 | }, | ||
3642 | [ALC888_LENOVO_SKY] = { | ||
3643 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, | ||
3644 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, | ||
3645 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3646 | .dac_nids = alc883_dac_nids, | ||
3647 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
3648 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | ||
3649 | .channel_mode = alc883_sixstack_modes, | ||
3650 | .need_dac_fix = 1, | ||
3651 | .input_mux = &alc883_lenovo_sky_capture_source, | ||
3652 | .unsol_event = alc_sku_unsol_event, | ||
3653 | .setup = alc888_lenovo_sky_setup, | ||
3654 | .init_hook = alc_hp_automute, | ||
3655 | }, | ||
3656 | [ALC888_ASUS_M90V] = { | ||
3657 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | ||
3658 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, | ||
3659 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3660 | .dac_nids = alc883_dac_nids, | ||
3661 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
3662 | .dig_in_nid = ALC883_DIGIN_NID, | ||
3663 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | ||
3664 | .channel_mode = alc883_3ST_6ch_modes, | ||
3665 | .need_dac_fix = 1, | ||
3666 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | ||
3667 | .unsol_event = alc_sku_unsol_event, | ||
3668 | .setup = alc883_mode2_setup, | ||
3669 | .init_hook = alc_inithook, | ||
3670 | }, | ||
3671 | [ALC888_ASUS_EEE1601] = { | ||
3672 | .mixers = { alc883_asus_eee1601_mixer }, | ||
3673 | .cap_mixer = alc883_asus_eee1601_cap_mixer, | ||
3674 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, | ||
3675 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3676 | .dac_nids = alc883_dac_nids, | ||
3677 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
3678 | .dig_in_nid = ALC883_DIGIN_NID, | ||
3679 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
3680 | .channel_mode = alc883_3ST_2ch_modes, | ||
3681 | .need_dac_fix = 1, | ||
3682 | .input_mux = &alc883_asus_eee1601_capture_source, | ||
3683 | .unsol_event = alc_sku_unsol_event, | ||
3684 | .init_hook = alc883_eee1601_inithook, | ||
3685 | }, | ||
3686 | [ALC1200_ASUS_P5Q] = { | ||
3687 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | ||
3688 | .init_verbs = { alc883_init_verbs }, | ||
3689 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3690 | .dac_nids = alc883_dac_nids, | ||
3691 | .dig_out_nid = ALC1200_DIGOUT_NID, | ||
3692 | .dig_in_nid = ALC883_DIGIN_NID, | ||
3693 | .slave_dig_outs = alc1200_slave_dig_outs, | ||
3694 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | ||
3695 | .channel_mode = alc883_sixstack_modes, | ||
3696 | .input_mux = &alc883_capture_source, | ||
3697 | }, | ||
3698 | [ALC889A_MB31] = { | 843 | [ALC889A_MB31] = { |
3699 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, | 844 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
3700 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, | 845 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
@@ -3711,18 +856,6 @@ static const struct alc_config_preset alc882_presets[] = { | |||
3711 | .unsol_event = alc889A_mb31_unsol_event, | 856 | .unsol_event = alc889A_mb31_unsol_event, |
3712 | .init_hook = alc889A_mb31_automute, | 857 | .init_hook = alc889A_mb31_automute, |
3713 | }, | 858 | }, |
3714 | [ALC883_SONY_VAIO_TT] = { | ||
3715 | .mixers = { alc883_vaiott_mixer }, | ||
3716 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, | ||
3717 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
3718 | .dac_nids = alc883_dac_nids, | ||
3719 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
3720 | .channel_mode = alc883_3ST_2ch_modes, | ||
3721 | .input_mux = &alc883_capture_source, | ||
3722 | .unsol_event = alc_sku_unsol_event, | ||
3723 | .setup = alc883_vaiott_setup, | ||
3724 | .init_hook = alc_hp_automute, | ||
3725 | }, | ||
3726 | }; | 859 | }; |
3727 | 860 | ||
3728 | 861 | ||
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 4562e9de6a1a..4df72c0e8c37 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <sound/jack.h> | 33 | #include <sound/jack.h> |
34 | #include "hda_local.h" | 34 | #include "hda_local.h" |
35 | #include "hda_beep.h" | 35 | #include "hda_beep.h" |
36 | #include "hda_jack.h" | ||
36 | #include <sound/hda_hwdep.h> | 37 | #include <sound/hda_hwdep.h> |
37 | 38 | ||
38 | #define CREATE_TRACE_POINTS | 39 | #define CREATE_TRACE_POINTS |
@@ -1723,43 +1724,6 @@ int snd_hda_override_pin_caps(struct hda_codec *codec, hda_nid_t nid, | |||
1723 | } | 1724 | } |
1724 | EXPORT_SYMBOL_HDA(snd_hda_override_pin_caps); | 1725 | EXPORT_SYMBOL_HDA(snd_hda_override_pin_caps); |
1725 | 1726 | ||
1726 | /** | ||
1727 | * snd_hda_pin_sense - execute pin sense measurement | ||
1728 | * @codec: the CODEC to sense | ||
1729 | * @nid: the pin NID to sense | ||
1730 | * | ||
1731 | * Execute necessary pin sense measurement and return its Presence Detect, | ||
1732 | * Impedance, ELD Valid etc. status bits. | ||
1733 | */ | ||
1734 | u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid) | ||
1735 | { | ||
1736 | u32 pincap; | ||
1737 | |||
1738 | if (!codec->no_trigger_sense) { | ||
1739 | pincap = snd_hda_query_pin_caps(codec, nid); | ||
1740 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ | ||
1741 | snd_hda_codec_read(codec, nid, 0, | ||
1742 | AC_VERB_SET_PIN_SENSE, 0); | ||
1743 | } | ||
1744 | return snd_hda_codec_read(codec, nid, 0, | ||
1745 | AC_VERB_GET_PIN_SENSE, 0); | ||
1746 | } | ||
1747 | EXPORT_SYMBOL_HDA(snd_hda_pin_sense); | ||
1748 | |||
1749 | /** | ||
1750 | * snd_hda_jack_detect - query pin Presence Detect status | ||
1751 | * @codec: the CODEC to sense | ||
1752 | * @nid: the pin NID to sense | ||
1753 | * | ||
1754 | * Query and return the pin's Presence Detect status. | ||
1755 | */ | ||
1756 | int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid) | ||
1757 | { | ||
1758 | u32 sense = snd_hda_pin_sense(codec, nid); | ||
1759 | return !!(sense & AC_PINSENSE_PRESENCE); | ||
1760 | } | ||
1761 | EXPORT_SYMBOL_HDA(snd_hda_jack_detect); | ||
1762 | |||
1763 | /* | 1727 | /* |
1764 | * read the current volume to info | 1728 | * read the current volume to info |
1765 | * if the cache exists, read the cache value. | 1729 | * if the cache exists, read the cache value. |
@@ -2308,6 +2272,7 @@ int snd_hda_codec_reset(struct hda_codec *codec) | |||
2308 | } | 2272 | } |
2309 | if (codec->patch_ops.free) | 2273 | if (codec->patch_ops.free) |
2310 | codec->patch_ops.free(codec); | 2274 | codec->patch_ops.free(codec); |
2275 | snd_hda_jack_tbl_clear(codec); | ||
2311 | codec->proc_widget_hook = NULL; | 2276 | codec->proc_widget_hook = NULL; |
2312 | codec->spec = NULL; | 2277 | codec->spec = NULL; |
2313 | free_hda_cache(&codec->amp_cache); | 2278 | free_hda_cache(&codec->amp_cache); |
@@ -3364,6 +3329,7 @@ static void hda_call_codec_resume(struct hda_codec *codec) | |||
3364 | restore_pincfgs(codec); /* restore all current pin configs */ | 3329 | restore_pincfgs(codec); /* restore all current pin configs */ |
3365 | restore_shutup_pins(codec); | 3330 | restore_shutup_pins(codec); |
3366 | hda_exec_init_verbs(codec); | 3331 | hda_exec_init_verbs(codec); |
3332 | snd_hda_jack_set_dirty_all(codec); | ||
3367 | if (codec->patch_ops.resume) | 3333 | if (codec->patch_ops.resume) |
3368 | codec->patch_ops.resume(codec); | 3334 | codec->patch_ops.resume(codec); |
3369 | else { | 3335 | else { |
@@ -3850,6 +3816,12 @@ static int get_empty_pcm_device(struct hda_bus *bus, int type) | |||
3850 | if (!test_and_set_bit(audio_idx[type][i], bus->pcm_dev_bits)) | 3816 | if (!test_and_set_bit(audio_idx[type][i], bus->pcm_dev_bits)) |
3851 | return audio_idx[type][i]; | 3817 | return audio_idx[type][i]; |
3852 | 3818 | ||
3819 | /* non-fixed slots starting from 10 */ | ||
3820 | for (i = 10; i < 32; i++) { | ||
3821 | if (!test_and_set_bit(i, bus->pcm_dev_bits)) | ||
3822 | return i; | ||
3823 | } | ||
3824 | |||
3853 | snd_printk(KERN_WARNING "Too many %s devices\n", | 3825 | snd_printk(KERN_WARNING "Too many %s devices\n", |
3854 | snd_hda_pcm_type_name[type]); | 3826 | snd_hda_pcm_type_name[type]); |
3855 | return -EAGAIN; | 3827 | return -EAGAIN; |
@@ -5004,8 +4976,8 @@ EXPORT_SYMBOL_HDA(snd_hda_get_input_pin_attr); | |||
5004 | * "Rear", "Internal". | 4976 | * "Rear", "Internal". |
5005 | */ | 4977 | */ |
5006 | 4978 | ||
5007 | const char *hda_get_input_pin_label(struct hda_codec *codec, hda_nid_t pin, | 4979 | static const char *hda_get_input_pin_label(struct hda_codec *codec, |
5008 | int check_location) | 4980 | hda_nid_t pin, bool check_location) |
5009 | { | 4981 | { |
5010 | unsigned int def_conf; | 4982 | unsigned int def_conf; |
5011 | static const char * const mic_names[] = { | 4983 | static const char * const mic_names[] = { |
@@ -5044,7 +5016,6 @@ const char *hda_get_input_pin_label(struct hda_codec *codec, hda_nid_t pin, | |||
5044 | return "Misc"; | 5016 | return "Misc"; |
5045 | } | 5017 | } |
5046 | } | 5018 | } |
5047 | EXPORT_SYMBOL_HDA(hda_get_input_pin_label); | ||
5048 | 5019 | ||
5049 | /* Check whether the location prefix needs to be added to the label. | 5020 | /* Check whether the location prefix needs to be added to the label. |
5050 | * If all mic-jacks are in the same location (e.g. rear panel), we don't | 5021 | * If all mic-jacks are in the same location (e.g. rear panel), we don't |
@@ -5101,6 +5072,149 @@ const char *hda_get_autocfg_input_label(struct hda_codec *codec, | |||
5101 | } | 5072 | } |
5102 | EXPORT_SYMBOL_HDA(hda_get_autocfg_input_label); | 5073 | EXPORT_SYMBOL_HDA(hda_get_autocfg_input_label); |
5103 | 5074 | ||
5075 | /* return the position of NID in the list, or -1 if not found */ | ||
5076 | static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums) | ||
5077 | { | ||
5078 | int i; | ||
5079 | for (i = 0; i < nums; i++) | ||
5080 | if (list[i] == nid) | ||
5081 | return i; | ||
5082 | return -1; | ||
5083 | } | ||
5084 | |||
5085 | /* get a unique suffix or an index number */ | ||
5086 | static const char *check_output_sfx(hda_nid_t nid, const hda_nid_t *pins, | ||
5087 | int num_pins, int *indexp) | ||
5088 | { | ||
5089 | static const char * const channel_sfx[] = { | ||
5090 | " Front", " Surround", " CLFE", " Side" | ||
5091 | }; | ||
5092 | int i; | ||
5093 | |||
5094 | i = find_idx_in_nid_list(nid, pins, num_pins); | ||
5095 | if (i < 0) | ||
5096 | return NULL; | ||
5097 | if (num_pins == 1) | ||
5098 | return ""; | ||
5099 | if (num_pins > ARRAY_SIZE(channel_sfx)) { | ||
5100 | if (indexp) | ||
5101 | *indexp = i; | ||
5102 | return ""; | ||
5103 | } | ||
5104 | return channel_sfx[i]; | ||
5105 | } | ||
5106 | |||
5107 | static int fill_audio_out_name(struct hda_codec *codec, hda_nid_t nid, | ||
5108 | const struct auto_pin_cfg *cfg, | ||
5109 | const char *name, char *label, int maxlen, | ||
5110 | int *indexp) | ||
5111 | { | ||
5112 | unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid); | ||
5113 | int attr = snd_hda_get_input_pin_attr(def_conf); | ||
5114 | const char *pfx = "", *sfx = ""; | ||
5115 | |||
5116 | /* handle as a speaker if it's a fixed line-out */ | ||
5117 | if (!strcmp(name, "Line-Out") && attr == INPUT_PIN_ATTR_INT) | ||
5118 | name = "Speaker"; | ||
5119 | /* check the location */ | ||
5120 | switch (attr) { | ||
5121 | case INPUT_PIN_ATTR_DOCK: | ||
5122 | pfx = "Dock "; | ||
5123 | break; | ||
5124 | case INPUT_PIN_ATTR_FRONT: | ||
5125 | pfx = "Front "; | ||
5126 | break; | ||
5127 | } | ||
5128 | if (cfg) { | ||
5129 | /* try to give a unique suffix if needed */ | ||
5130 | sfx = check_output_sfx(nid, cfg->line_out_pins, cfg->line_outs, | ||
5131 | indexp); | ||
5132 | if (!sfx) | ||
5133 | sfx = check_output_sfx(nid, cfg->speaker_pins, cfg->speaker_outs, | ||
5134 | indexp); | ||
5135 | if (!sfx) { | ||
5136 | /* don't add channel suffix for Headphone controls */ | ||
5137 | int idx = find_idx_in_nid_list(nid, cfg->hp_pins, | ||
5138 | cfg->hp_outs); | ||
5139 | if (idx >= 0) | ||
5140 | *indexp = idx; | ||
5141 | sfx = ""; | ||
5142 | } | ||
5143 | } | ||
5144 | snprintf(label, maxlen, "%s%s%s", pfx, name, sfx); | ||
5145 | return 1; | ||
5146 | } | ||
5147 | |||
5148 | /** | ||
5149 | * snd_hda_get_pin_label - Get a label for the given I/O pin | ||
5150 | * | ||
5151 | * Get a label for the given pin. This function works for both input and | ||
5152 | * output pins. When @cfg is given as non-NULL, the function tries to get | ||
5153 | * an optimized label using hda_get_autocfg_input_label(). | ||
5154 | * | ||
5155 | * This function tries to give a unique label string for the pin as much as | ||
5156 | * possible. For example, when the multiple line-outs are present, it adds | ||
5157 | * the channel suffix like "Front", "Surround", etc (only when @cfg is given). | ||
5158 | * If no unique name with a suffix is available and @indexp is non-NULL, the | ||
5159 | * index number is stored in the pointer. | ||
5160 | */ | ||
5161 | int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid, | ||
5162 | const struct auto_pin_cfg *cfg, | ||
5163 | char *label, int maxlen, int *indexp) | ||
5164 | { | ||
5165 | unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid); | ||
5166 | const char *name = NULL; | ||
5167 | int i; | ||
5168 | |||
5169 | if (indexp) | ||
5170 | *indexp = 0; | ||
5171 | if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) | ||
5172 | return 0; | ||
5173 | |||
5174 | switch (get_defcfg_device(def_conf)) { | ||
5175 | case AC_JACK_LINE_OUT: | ||
5176 | return fill_audio_out_name(codec, nid, cfg, "Line-Out", | ||
5177 | label, maxlen, indexp); | ||
5178 | case AC_JACK_SPEAKER: | ||
5179 | return fill_audio_out_name(codec, nid, cfg, "Speaker", | ||
5180 | label, maxlen, indexp); | ||
5181 | case AC_JACK_HP_OUT: | ||
5182 | return fill_audio_out_name(codec, nid, cfg, "Headphone", | ||
5183 | label, maxlen, indexp); | ||
5184 | case AC_JACK_SPDIF_OUT: | ||
5185 | case AC_JACK_DIG_OTHER_OUT: | ||
5186 | if (get_defcfg_location(def_conf) == AC_JACK_LOC_HDMI) | ||
5187 | name = "HDMI"; | ||
5188 | else | ||
5189 | name = "SPDIF"; | ||
5190 | if (cfg && indexp) { | ||
5191 | i = find_idx_in_nid_list(nid, cfg->dig_out_pins, | ||
5192 | cfg->dig_outs); | ||
5193 | if (i >= 0) | ||
5194 | *indexp = i; | ||
5195 | } | ||
5196 | break; | ||
5197 | default: | ||
5198 | if (cfg) { | ||
5199 | for (i = 0; i < cfg->num_inputs; i++) { | ||
5200 | if (cfg->inputs[i].pin != nid) | ||
5201 | continue; | ||
5202 | name = hda_get_autocfg_input_label(codec, cfg, i); | ||
5203 | if (name) | ||
5204 | break; | ||
5205 | } | ||
5206 | } | ||
5207 | if (!name) | ||
5208 | name = hda_get_input_pin_label(codec, nid, true); | ||
5209 | break; | ||
5210 | } | ||
5211 | if (!name) | ||
5212 | return 0; | ||
5213 | strlcpy(label, name, maxlen); | ||
5214 | return 1; | ||
5215 | } | ||
5216 | EXPORT_SYMBOL_HDA(snd_hda_get_pin_label); | ||
5217 | |||
5104 | /** | 5218 | /** |
5105 | * snd_hda_add_imux_item - Add an item to input_mux | 5219 | * snd_hda_add_imux_item - Add an item to input_mux |
5106 | * | 5220 | * |
@@ -5252,113 +5366,5 @@ void snd_print_pcm_bits(int pcm, char *buf, int buflen) | |||
5252 | } | 5366 | } |
5253 | EXPORT_SYMBOL_HDA(snd_print_pcm_bits); | 5367 | EXPORT_SYMBOL_HDA(snd_print_pcm_bits); |
5254 | 5368 | ||
5255 | #ifdef CONFIG_SND_HDA_INPUT_JACK | ||
5256 | /* | ||
5257 | * Input-jack notification support | ||
5258 | */ | ||
5259 | struct hda_jack_item { | ||
5260 | hda_nid_t nid; | ||
5261 | int type; | ||
5262 | struct snd_jack *jack; | ||
5263 | }; | ||
5264 | |||
5265 | static const char *get_jack_default_name(struct hda_codec *codec, hda_nid_t nid, | ||
5266 | int type) | ||
5267 | { | ||
5268 | switch (type) { | ||
5269 | case SND_JACK_HEADPHONE: | ||
5270 | return "Headphone"; | ||
5271 | case SND_JACK_MICROPHONE: | ||
5272 | return "Mic"; | ||
5273 | case SND_JACK_LINEOUT: | ||
5274 | return "Line-out"; | ||
5275 | case SND_JACK_LINEIN: | ||
5276 | return "Line-in"; | ||
5277 | case SND_JACK_HEADSET: | ||
5278 | return "Headset"; | ||
5279 | case SND_JACK_VIDEOOUT: | ||
5280 | return "HDMI/DP"; | ||
5281 | default: | ||
5282 | return "Misc"; | ||
5283 | } | ||
5284 | } | ||
5285 | |||
5286 | static void hda_free_jack_priv(struct snd_jack *jack) | ||
5287 | { | ||
5288 | struct hda_jack_item *jacks = jack->private_data; | ||
5289 | jacks->nid = 0; | ||
5290 | jacks->jack = NULL; | ||
5291 | } | ||
5292 | |||
5293 | int snd_hda_input_jack_add(struct hda_codec *codec, hda_nid_t nid, int type, | ||
5294 | const char *name) | ||
5295 | { | ||
5296 | struct hda_jack_item *jack; | ||
5297 | int err; | ||
5298 | |||
5299 | snd_array_init(&codec->jacks, sizeof(*jack), 32); | ||
5300 | jack = snd_array_new(&codec->jacks); | ||
5301 | if (!jack) | ||
5302 | return -ENOMEM; | ||
5303 | |||
5304 | jack->nid = nid; | ||
5305 | jack->type = type; | ||
5306 | if (!name) | ||
5307 | name = get_jack_default_name(codec, nid, type); | ||
5308 | err = snd_jack_new(codec->bus->card, name, type, &jack->jack); | ||
5309 | if (err < 0) { | ||
5310 | jack->nid = 0; | ||
5311 | return err; | ||
5312 | } | ||
5313 | jack->jack->private_data = jack; | ||
5314 | jack->jack->private_free = hda_free_jack_priv; | ||
5315 | return 0; | ||
5316 | } | ||
5317 | EXPORT_SYMBOL_HDA(snd_hda_input_jack_add); | ||
5318 | |||
5319 | void snd_hda_input_jack_report(struct hda_codec *codec, hda_nid_t nid) | ||
5320 | { | ||
5321 | struct hda_jack_item *jacks = codec->jacks.list; | ||
5322 | int i; | ||
5323 | |||
5324 | if (!jacks) | ||
5325 | return; | ||
5326 | |||
5327 | for (i = 0; i < codec->jacks.used; i++, jacks++) { | ||
5328 | unsigned int pin_ctl; | ||
5329 | unsigned int present; | ||
5330 | int type; | ||
5331 | |||
5332 | if (jacks->nid != nid) | ||
5333 | continue; | ||
5334 | present = snd_hda_jack_detect(codec, nid); | ||
5335 | type = jacks->type; | ||
5336 | if (type == (SND_JACK_HEADPHONE | SND_JACK_LINEOUT)) { | ||
5337 | pin_ctl = snd_hda_codec_read(codec, nid, 0, | ||
5338 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | ||
5339 | type = (pin_ctl & AC_PINCTL_HP_EN) ? | ||
5340 | SND_JACK_HEADPHONE : SND_JACK_LINEOUT; | ||
5341 | } | ||
5342 | snd_jack_report(jacks->jack, present ? type : 0); | ||
5343 | } | ||
5344 | } | ||
5345 | EXPORT_SYMBOL_HDA(snd_hda_input_jack_report); | ||
5346 | |||
5347 | /* free jack instances manually when clearing/reconfiguring */ | ||
5348 | void snd_hda_input_jack_free(struct hda_codec *codec) | ||
5349 | { | ||
5350 | if (!codec->bus->shutdown && codec->jacks.list) { | ||
5351 | struct hda_jack_item *jacks = codec->jacks.list; | ||
5352 | int i; | ||
5353 | for (i = 0; i < codec->jacks.used; i++, jacks++) { | ||
5354 | if (jacks->jack) | ||
5355 | snd_device_free(codec->bus->card, jacks->jack); | ||
5356 | } | ||
5357 | } | ||
5358 | snd_array_free(&codec->jacks); | ||
5359 | } | ||
5360 | EXPORT_SYMBOL_HDA(snd_hda_input_jack_free); | ||
5361 | #endif /* CONFIG_SND_HDA_INPUT_JACK */ | ||
5362 | |||
5363 | MODULE_DESCRIPTION("HDA codec core"); | 5369 | MODULE_DESCRIPTION("HDA codec core"); |
5364 | MODULE_LICENSE("GPL"); | 5370 | MODULE_LICENSE("GPL"); |
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 564471169cae..e9f71dc0d464 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -547,9 +547,6 @@ enum { | |||
547 | /* max. codec address */ | 547 | /* max. codec address */ |
548 | #define HDA_MAX_CODEC_ADDRESS 0x0f | 548 | #define HDA_MAX_CODEC_ADDRESS 0x0f |
549 | 549 | ||
550 | /* max number of PCM devics per card */ | ||
551 | #define HDA_MAX_PCMS 10 | ||
552 | |||
553 | /* | 550 | /* |
554 | * generic arrays | 551 | * generic arrays |
555 | */ | 552 | */ |
@@ -869,6 +866,9 @@ struct hda_codec { | |||
869 | void (*proc_widget_hook)(struct snd_info_buffer *buffer, | 866 | void (*proc_widget_hook)(struct snd_info_buffer *buffer, |
870 | struct hda_codec *codec, hda_nid_t nid); | 867 | struct hda_codec *codec, hda_nid_t nid); |
871 | 868 | ||
869 | /* jack detection */ | ||
870 | struct snd_array jacktbl; | ||
871 | |||
872 | #ifdef CONFIG_SND_HDA_INPUT_JACK | 872 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
873 | /* jack detection */ | 873 | /* jack detection */ |
874 | struct snd_array jacks; | 874 | struct snd_array jacks; |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 06fe2c546ee4..0852e204a4c8 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -407,6 +407,14 @@ struct azx_rb { | |||
407 | u32 res[AZX_MAX_CODECS]; /* last read value */ | 407 | u32 res[AZX_MAX_CODECS]; /* last read value */ |
408 | }; | 408 | }; |
409 | 409 | ||
410 | struct azx_pcm { | ||
411 | struct azx *chip; | ||
412 | struct snd_pcm *pcm; | ||
413 | struct hda_codec *codec; | ||
414 | struct hda_pcm_stream *hinfo[2]; | ||
415 | struct list_head list; | ||
416 | }; | ||
417 | |||
410 | struct azx { | 418 | struct azx { |
411 | struct snd_card *card; | 419 | struct snd_card *card; |
412 | struct pci_dev *pci; | 420 | struct pci_dev *pci; |
@@ -434,7 +442,7 @@ struct azx { | |||
434 | struct azx_dev *azx_dev; | 442 | struct azx_dev *azx_dev; |
435 | 443 | ||
436 | /* PCM */ | 444 | /* PCM */ |
437 | struct snd_pcm *pcm[HDA_MAX_PCMS]; | 445 | struct list_head pcm_list; /* azx_pcm list */ |
438 | 446 | ||
439 | /* HD codec */ | 447 | /* HD codec */ |
440 | unsigned short codec_mask; | 448 | unsigned short codec_mask; |
@@ -479,6 +487,7 @@ enum { | |||
479 | AZX_DRIVER_SCH, | 487 | AZX_DRIVER_SCH, |
480 | AZX_DRIVER_ATI, | 488 | AZX_DRIVER_ATI, |
481 | AZX_DRIVER_ATIHDMI, | 489 | AZX_DRIVER_ATIHDMI, |
490 | AZX_DRIVER_ATIHDMI_NS, | ||
482 | AZX_DRIVER_VIA, | 491 | AZX_DRIVER_VIA, |
483 | AZX_DRIVER_SIS, | 492 | AZX_DRIVER_SIS, |
484 | AZX_DRIVER_ULI, | 493 | AZX_DRIVER_ULI, |
@@ -525,6 +534,7 @@ static char *driver_short_names[] __devinitdata = { | |||
525 | [AZX_DRIVER_SCH] = "HDA Intel MID", | 534 | [AZX_DRIVER_SCH] = "HDA Intel MID", |
526 | [AZX_DRIVER_ATI] = "HDA ATI SB", | 535 | [AZX_DRIVER_ATI] = "HDA ATI SB", |
527 | [AZX_DRIVER_ATIHDMI] = "HDA ATI HDMI", | 536 | [AZX_DRIVER_ATIHDMI] = "HDA ATI HDMI", |
537 | [AZX_DRIVER_ATIHDMI_NS] = "HDA ATI HDMI", | ||
528 | [AZX_DRIVER_VIA] = "HDA VIA VT82xx", | 538 | [AZX_DRIVER_VIA] = "HDA VIA VT82xx", |
529 | [AZX_DRIVER_SIS] = "HDA SIS966", | 539 | [AZX_DRIVER_SIS] = "HDA SIS966", |
530 | [AZX_DRIVER_ULI] = "HDA ULI M5461", | 540 | [AZX_DRIVER_ULI] = "HDA ULI M5461", |
@@ -1143,16 +1153,6 @@ static void update_pci_byte(struct pci_dev *pci, unsigned int reg, | |||
1143 | 1153 | ||
1144 | static void azx_init_pci(struct azx *chip) | 1154 | static void azx_init_pci(struct azx *chip) |
1145 | { | 1155 | { |
1146 | /* force to non-snoop mode for a new VIA controller when BIOS is set */ | ||
1147 | if (chip->snoop && chip->driver_type == AZX_DRIVER_VIA) { | ||
1148 | u8 snoop; | ||
1149 | pci_read_config_byte(chip->pci, 0x42, &snoop); | ||
1150 | if (!(snoop & 0x80) && chip->pci->revision == 0x30) { | ||
1151 | chip->snoop = 0; | ||
1152 | snd_printdd(SFX "Force to non-snoop mode\n"); | ||
1153 | } | ||
1154 | } | ||
1155 | |||
1156 | /* Clear bits 0-2 of PCI register TCSEL (at offset 0x44) | 1156 | /* Clear bits 0-2 of PCI register TCSEL (at offset 0x44) |
1157 | * TCSEL == Traffic Class Select Register, which sets PCI express QOS | 1157 | * TCSEL == Traffic Class Select Register, which sets PCI express QOS |
1158 | * Ensuring these bits are 0 clears playback static on some HD Audio | 1158 | * Ensuring these bits are 0 clears playback static on some HD Audio |
@@ -1486,10 +1486,9 @@ static void azx_bus_reset(struct hda_bus *bus) | |||
1486 | azx_init_chip(chip, 1); | 1486 | azx_init_chip(chip, 1); |
1487 | #ifdef CONFIG_PM | 1487 | #ifdef CONFIG_PM |
1488 | if (chip->initialized) { | 1488 | if (chip->initialized) { |
1489 | int i; | 1489 | struct azx_pcm *p; |
1490 | 1490 | list_for_each_entry(p, &chip->pcm_list, list) | |
1491 | for (i = 0; i < HDA_MAX_PCMS; i++) | 1491 | snd_pcm_suspend_all(p->pcm); |
1492 | snd_pcm_suspend_all(chip->pcm[i]); | ||
1493 | snd_hda_suspend(chip->bus); | 1492 | snd_hda_suspend(chip->bus); |
1494 | snd_hda_resume(chip->bus); | 1493 | snd_hda_resume(chip->bus); |
1495 | } | 1494 | } |
@@ -1667,12 +1666,6 @@ static struct snd_pcm_hardware azx_pcm_hw = { | |||
1667 | .fifo_size = 0, | 1666 | .fifo_size = 0, |
1668 | }; | 1667 | }; |
1669 | 1668 | ||
1670 | struct azx_pcm { | ||
1671 | struct azx *chip; | ||
1672 | struct hda_codec *codec; | ||
1673 | struct hda_pcm_stream *hinfo[2]; | ||
1674 | }; | ||
1675 | |||
1676 | static int azx_pcm_open(struct snd_pcm_substream *substream) | 1669 | static int azx_pcm_open(struct snd_pcm_substream *substream) |
1677 | { | 1670 | { |
1678 | struct azx_pcm *apcm = snd_pcm_substream_chip(substream); | 1671 | struct azx_pcm *apcm = snd_pcm_substream_chip(substream); |
@@ -2197,7 +2190,7 @@ static void azx_pcm_free(struct snd_pcm *pcm) | |||
2197 | { | 2190 | { |
2198 | struct azx_pcm *apcm = pcm->private_data; | 2191 | struct azx_pcm *apcm = pcm->private_data; |
2199 | if (apcm) { | 2192 | if (apcm) { |
2200 | apcm->chip->pcm[pcm->device] = NULL; | 2193 | list_del(&apcm->list); |
2201 | kfree(apcm); | 2194 | kfree(apcm); |
2202 | } | 2195 | } |
2203 | } | 2196 | } |
@@ -2215,14 +2208,11 @@ azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec, | |||
2215 | unsigned int size; | 2208 | unsigned int size; |
2216 | int s, err; | 2209 | int s, err; |
2217 | 2210 | ||
2218 | if (pcm_dev >= HDA_MAX_PCMS) { | 2211 | list_for_each_entry(apcm, &chip->pcm_list, list) { |
2219 | snd_printk(KERN_ERR SFX "Invalid PCM device number %d\n", | 2212 | if (apcm->pcm->device == pcm_dev) { |
2220 | pcm_dev); | 2213 | snd_printk(KERN_ERR SFX "PCM %d already exists\n", pcm_dev); |
2221 | return -EINVAL; | 2214 | return -EBUSY; |
2222 | } | 2215 | } |
2223 | if (chip->pcm[pcm_dev]) { | ||
2224 | snd_printk(KERN_ERR SFX "PCM %d already exists\n", pcm_dev); | ||
2225 | return -EBUSY; | ||
2226 | } | 2216 | } |
2227 | err = snd_pcm_new(chip->card, cpcm->name, pcm_dev, | 2217 | err = snd_pcm_new(chip->card, cpcm->name, pcm_dev, |
2228 | cpcm->stream[SNDRV_PCM_STREAM_PLAYBACK].substreams, | 2218 | cpcm->stream[SNDRV_PCM_STREAM_PLAYBACK].substreams, |
@@ -2235,12 +2225,13 @@ azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec, | |||
2235 | if (apcm == NULL) | 2225 | if (apcm == NULL) |
2236 | return -ENOMEM; | 2226 | return -ENOMEM; |
2237 | apcm->chip = chip; | 2227 | apcm->chip = chip; |
2228 | apcm->pcm = pcm; | ||
2238 | apcm->codec = codec; | 2229 | apcm->codec = codec; |
2239 | pcm->private_data = apcm; | 2230 | pcm->private_data = apcm; |
2240 | pcm->private_free = azx_pcm_free; | 2231 | pcm->private_free = azx_pcm_free; |
2241 | if (cpcm->pcm_type == HDA_PCM_TYPE_MODEM) | 2232 | if (cpcm->pcm_type == HDA_PCM_TYPE_MODEM) |
2242 | pcm->dev_class = SNDRV_PCM_CLASS_MODEM; | 2233 | pcm->dev_class = SNDRV_PCM_CLASS_MODEM; |
2243 | chip->pcm[pcm_dev] = pcm; | 2234 | list_add_tail(&apcm->list, &chip->pcm_list); |
2244 | cpcm->pcm = pcm; | 2235 | cpcm->pcm = pcm; |
2245 | for (s = 0; s < 2; s++) { | 2236 | for (s = 0; s < 2; s++) { |
2246 | apcm->hinfo[s] = &cpcm->stream[s]; | 2237 | apcm->hinfo[s] = &cpcm->stream[s]; |
@@ -2370,12 +2361,12 @@ static int azx_suspend(struct pci_dev *pci, pm_message_t state) | |||
2370 | { | 2361 | { |
2371 | struct snd_card *card = pci_get_drvdata(pci); | 2362 | struct snd_card *card = pci_get_drvdata(pci); |
2372 | struct azx *chip = card->private_data; | 2363 | struct azx *chip = card->private_data; |
2373 | int i; | 2364 | struct azx_pcm *p; |
2374 | 2365 | ||
2375 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 2366 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
2376 | azx_clear_irq_pending(chip); | 2367 | azx_clear_irq_pending(chip); |
2377 | for (i = 0; i < HDA_MAX_PCMS; i++) | 2368 | list_for_each_entry(p, &chip->pcm_list, list) |
2378 | snd_pcm_suspend_all(chip->pcm[i]); | 2369 | snd_pcm_suspend_all(p->pcm); |
2379 | if (chip->initialized) | 2370 | if (chip->initialized) |
2380 | snd_hda_suspend(chip->bus); | 2371 | snd_hda_suspend(chip->bus); |
2381 | azx_stop_chip(chip); | 2372 | azx_stop_chip(chip); |
@@ -2502,7 +2493,6 @@ static int azx_dev_free(struct snd_device *device) | |||
2502 | static struct snd_pci_quirk position_fix_list[] __devinitdata = { | 2493 | static struct snd_pci_quirk position_fix_list[] __devinitdata = { |
2503 | SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB), | 2494 | SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB), |
2504 | SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB), | 2495 | SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB), |
2505 | SND_PCI_QUIRK(0x1028, 0x02c6, "Dell Inspiron 1010", POS_FIX_LPIB), | ||
2506 | SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB), | 2496 | SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB), |
2507 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), | 2497 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), |
2508 | SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), | 2498 | SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), |
@@ -2633,6 +2623,35 @@ static void __devinit check_msi(struct azx *chip) | |||
2633 | } | 2623 | } |
2634 | } | 2624 | } |
2635 | 2625 | ||
2626 | /* check the snoop mode availability */ | ||
2627 | static void __devinit azx_check_snoop_available(struct azx *chip) | ||
2628 | { | ||
2629 | bool snoop = chip->snoop; | ||
2630 | |||
2631 | switch (chip->driver_type) { | ||
2632 | case AZX_DRIVER_VIA: | ||
2633 | /* force to non-snoop mode for a new VIA controller | ||
2634 | * when BIOS is set | ||
2635 | */ | ||
2636 | if (snoop) { | ||
2637 | u8 val; | ||
2638 | pci_read_config_byte(chip->pci, 0x42, &val); | ||
2639 | if (!(val & 0x80) && chip->pci->revision == 0x30) | ||
2640 | snoop = false; | ||
2641 | } | ||
2642 | break; | ||
2643 | case AZX_DRIVER_ATIHDMI_NS: | ||
2644 | /* new ATI HDMI requires non-snoop */ | ||
2645 | snoop = false; | ||
2646 | break; | ||
2647 | } | ||
2648 | |||
2649 | if (snoop != chip->snoop) { | ||
2650 | snd_printk(KERN_INFO SFX "Force to %s mode\n", | ||
2651 | snoop ? "snoop" : "non-snoop"); | ||
2652 | chip->snoop = snoop; | ||
2653 | } | ||
2654 | } | ||
2636 | 2655 | ||
2637 | /* | 2656 | /* |
2638 | * constructor | 2657 | * constructor |
@@ -2671,6 +2690,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, | |||
2671 | check_msi(chip); | 2690 | check_msi(chip); |
2672 | chip->dev_index = dev; | 2691 | chip->dev_index = dev; |
2673 | INIT_WORK(&chip->irq_pending_work, azx_irq_pending_work); | 2692 | INIT_WORK(&chip->irq_pending_work, azx_irq_pending_work); |
2693 | INIT_LIST_HEAD(&chip->pcm_list); | ||
2674 | 2694 | ||
2675 | chip->position_fix[0] = chip->position_fix[1] = | 2695 | chip->position_fix[0] = chip->position_fix[1] = |
2676 | check_position_fix(chip, position_fix[dev]); | 2696 | check_position_fix(chip, position_fix[dev]); |
@@ -2678,6 +2698,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, | |||
2678 | 2698 | ||
2679 | chip->single_cmd = single_cmd; | 2699 | chip->single_cmd = single_cmd; |
2680 | chip->snoop = hda_snoop; | 2700 | chip->snoop = hda_snoop; |
2701 | azx_check_snoop_available(chip); | ||
2681 | 2702 | ||
2682 | if (bdl_pos_adj[dev] < 0) { | 2703 | if (bdl_pos_adj[dev] < 0) { |
2683 | switch (chip->driver_type) { | 2704 | switch (chip->driver_type) { |
@@ -2776,6 +2797,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, | |||
2776 | chip->capture_streams = ULI_NUM_CAPTURE; | 2797 | chip->capture_streams = ULI_NUM_CAPTURE; |
2777 | break; | 2798 | break; |
2778 | case AZX_DRIVER_ATIHDMI: | 2799 | case AZX_DRIVER_ATIHDMI: |
2800 | case AZX_DRIVER_ATIHDMI_NS: | ||
2779 | chip->playback_streams = ATIHDMI_NUM_PLAYBACK; | 2801 | chip->playback_streams = ATIHDMI_NUM_PLAYBACK; |
2780 | chip->capture_streams = ATIHDMI_NUM_CAPTURE; | 2802 | chip->capture_streams = ATIHDMI_NUM_CAPTURE; |
2781 | break; | 2803 | break; |
@@ -2970,7 +2992,11 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { | |||
2970 | /* SCH */ | 2992 | /* SCH */ |
2971 | { PCI_DEVICE(0x8086, 0x811b), | 2993 | { PCI_DEVICE(0x8086, 0x811b), |
2972 | .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | | 2994 | .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | |
2973 | AZX_DCAPS_BUFSIZE}, | 2995 | AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_LPIB }, /* Poulsbo */ |
2996 | { PCI_DEVICE(0x8086, 0x080a), | ||
2997 | .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | | ||
2998 | AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_LPIB }, /* Oaktrail */ | ||
2999 | /* ICH */ | ||
2974 | { PCI_DEVICE(0x8086, 0x2668), | 3000 | { PCI_DEVICE(0x8086, 0x2668), |
2975 | .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC | | 3001 | .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC | |
2976 | AZX_DCAPS_BUFSIZE }, /* ICH6 */ | 3002 | AZX_DCAPS_BUFSIZE }, /* ICH6 */ |
@@ -3037,6 +3063,14 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { | |||
3037 | .driver_data = AZX_DRIVER_ATIHDMI | AZX_DCAPS_PRESET_ATI_HDMI }, | 3063 | .driver_data = AZX_DRIVER_ATIHDMI | AZX_DCAPS_PRESET_ATI_HDMI }, |
3038 | { PCI_DEVICE(0x1002, 0xaa48), | 3064 | { PCI_DEVICE(0x1002, 0xaa48), |
3039 | .driver_data = AZX_DRIVER_ATIHDMI | AZX_DCAPS_PRESET_ATI_HDMI }, | 3065 | .driver_data = AZX_DRIVER_ATIHDMI | AZX_DCAPS_PRESET_ATI_HDMI }, |
3066 | { PCI_DEVICE(0x1002, 0x9902), | ||
3067 | .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI }, | ||
3068 | { PCI_DEVICE(0x1002, 0xaaa0), | ||
3069 | .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI }, | ||
3070 | { PCI_DEVICE(0x1002, 0xaaa8), | ||
3071 | .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI }, | ||
3072 | { PCI_DEVICE(0x1002, 0xaab0), | ||
3073 | .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI }, | ||
3040 | /* VIA VT8251/VT8237A */ | 3074 | /* VIA VT8251/VT8237A */ |
3041 | { PCI_DEVICE(0x1106, 0x3288), | 3075 | { PCI_DEVICE(0x1106, 0x3288), |
3042 | .driver_data = AZX_DRIVER_VIA | AZX_DCAPS_POSFIX_VIA }, | 3076 | .driver_data = AZX_DRIVER_VIA | AZX_DCAPS_POSFIX_VIA }, |
diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c new file mode 100644 index 000000000000..d8a35da0803f --- /dev/null +++ b/sound/pci/hda/hda_jack.c | |||
@@ -0,0 +1,353 @@ | |||
1 | /* | ||
2 | * Jack-detection handling for HD-audio | ||
3 | * | ||
4 | * Copyright (c) 2011 Takashi Iwai <tiwai@suse.de> | ||
5 | * | ||
6 | * This driver is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/init.h> | ||
13 | #include <linux/slab.h> | ||
14 | #include <linux/export.h> | ||
15 | #include <sound/core.h> | ||
16 | #include <sound/control.h> | ||
17 | #include <sound/jack.h> | ||
18 | #include "hda_codec.h" | ||
19 | #include "hda_local.h" | ||
20 | #include "hda_jack.h" | ||
21 | |||
22 | /* execute pin sense measurement */ | ||
23 | static u32 read_pin_sense(struct hda_codec *codec, hda_nid_t nid) | ||
24 | { | ||
25 | u32 pincap; | ||
26 | |||
27 | if (!codec->no_trigger_sense) { | ||
28 | pincap = snd_hda_query_pin_caps(codec, nid); | ||
29 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ | ||
30 | snd_hda_codec_read(codec, nid, 0, | ||
31 | AC_VERB_SET_PIN_SENSE, 0); | ||
32 | } | ||
33 | return snd_hda_codec_read(codec, nid, 0, | ||
34 | AC_VERB_GET_PIN_SENSE, 0); | ||
35 | } | ||
36 | |||
37 | /** | ||
38 | * snd_hda_jack_tbl_get - query the jack-table entry for the given NID | ||
39 | */ | ||
40 | struct hda_jack_tbl * | ||
41 | snd_hda_jack_tbl_get(struct hda_codec *codec, hda_nid_t nid) | ||
42 | { | ||
43 | struct hda_jack_tbl *jack = codec->jacktbl.list; | ||
44 | int i; | ||
45 | |||
46 | if (!nid || !jack) | ||
47 | return NULL; | ||
48 | for (i = 0; i < codec->jacktbl.used; i++, jack++) | ||
49 | if (jack->nid == nid) | ||
50 | return jack; | ||
51 | return NULL; | ||
52 | } | ||
53 | EXPORT_SYMBOL_HDA(snd_hda_jack_tbl_get); | ||
54 | |||
55 | /** | ||
56 | * snd_hda_jack_tbl_get_from_tag - query the jack-table entry for the given tag | ||
57 | */ | ||
58 | struct hda_jack_tbl * | ||
59 | snd_hda_jack_tbl_get_from_tag(struct hda_codec *codec, unsigned char tag) | ||
60 | { | ||
61 | struct hda_jack_tbl *jack = codec->jacktbl.list; | ||
62 | int i; | ||
63 | |||
64 | if (!tag || !jack) | ||
65 | return NULL; | ||
66 | for (i = 0; i < codec->jacktbl.used; i++, jack++) | ||
67 | if (jack->tag == tag) | ||
68 | return jack; | ||
69 | return NULL; | ||
70 | } | ||
71 | EXPORT_SYMBOL_HDA(snd_hda_jack_tbl_get_from_tag); | ||
72 | |||
73 | /** | ||
74 | * snd_hda_jack_tbl_new - create a jack-table entry for the given NID | ||
75 | */ | ||
76 | struct hda_jack_tbl * | ||
77 | snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid) | ||
78 | { | ||
79 | struct hda_jack_tbl *jack = snd_hda_jack_tbl_get(codec, nid); | ||
80 | if (jack) | ||
81 | return jack; | ||
82 | snd_array_init(&codec->jacktbl, sizeof(*jack), 16); | ||
83 | jack = snd_array_new(&codec->jacktbl); | ||
84 | if (!jack) | ||
85 | return NULL; | ||
86 | jack->nid = nid; | ||
87 | jack->jack_dirty = 1; | ||
88 | jack->tag = codec->jacktbl.used; | ||
89 | return jack; | ||
90 | } | ||
91 | EXPORT_SYMBOL_HDA(snd_hda_jack_tbl_new); | ||
92 | |||
93 | void snd_hda_jack_tbl_clear(struct hda_codec *codec) | ||
94 | { | ||
95 | #ifdef CONFIG_SND_HDA_INPUT_JACK | ||
96 | /* free jack instances manually when clearing/reconfiguring */ | ||
97 | if (!codec->bus->shutdown && codec->jacktbl.list) { | ||
98 | struct hda_jack_tbl *jack = codec->jacktbl.list; | ||
99 | int i; | ||
100 | for (i = 0; i < codec->jacktbl.used; i++, jack++) { | ||
101 | if (jack->jack) | ||
102 | snd_device_free(codec->bus->card, jack->jack); | ||
103 | } | ||
104 | } | ||
105 | #endif | ||
106 | snd_array_free(&codec->jacktbl); | ||
107 | } | ||
108 | |||
109 | /* update the cached value and notification flag if needed */ | ||
110 | static void jack_detect_update(struct hda_codec *codec, | ||
111 | struct hda_jack_tbl *jack) | ||
112 | { | ||
113 | if (jack->jack_dirty || !jack->jack_detect) { | ||
114 | jack->pin_sense = read_pin_sense(codec, jack->nid); | ||
115 | jack->jack_dirty = 0; | ||
116 | } | ||
117 | } | ||
118 | |||
119 | /** | ||
120 | * snd_hda_set_dirty_all - Mark all the cached as dirty | ||
121 | * | ||
122 | * This function sets the dirty flag to all entries of jack table. | ||
123 | * It's called from the resume path in hda_codec.c. | ||
124 | */ | ||
125 | void snd_hda_jack_set_dirty_all(struct hda_codec *codec) | ||
126 | { | ||
127 | struct hda_jack_tbl *jack = codec->jacktbl.list; | ||
128 | int i; | ||
129 | |||
130 | for (i = 0; i < codec->jacktbl.used; i++, jack++) | ||
131 | if (jack->nid) | ||
132 | jack->jack_dirty = 1; | ||
133 | } | ||
134 | EXPORT_SYMBOL_HDA(snd_hda_jack_set_dirty_all); | ||
135 | |||
136 | /** | ||
137 | * snd_hda_pin_sense - execute pin sense measurement | ||
138 | * @codec: the CODEC to sense | ||
139 | * @nid: the pin NID to sense | ||
140 | * | ||
141 | * Execute necessary pin sense measurement and return its Presence Detect, | ||
142 | * Impedance, ELD Valid etc. status bits. | ||
143 | */ | ||
144 | u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid) | ||
145 | { | ||
146 | struct hda_jack_tbl *jack = snd_hda_jack_tbl_get(codec, nid); | ||
147 | if (jack) { | ||
148 | jack_detect_update(codec, jack); | ||
149 | return jack->pin_sense; | ||
150 | } | ||
151 | return read_pin_sense(codec, nid); | ||
152 | } | ||
153 | EXPORT_SYMBOL_HDA(snd_hda_pin_sense); | ||
154 | |||
155 | #define get_jack_plug_state(sense) !!(sense & AC_PINSENSE_PRESENCE) | ||
156 | |||
157 | /** | ||
158 | * snd_hda_jack_detect - query pin Presence Detect status | ||
159 | * @codec: the CODEC to sense | ||
160 | * @nid: the pin NID to sense | ||
161 | * | ||
162 | * Query and return the pin's Presence Detect status. | ||
163 | */ | ||
164 | int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid) | ||
165 | { | ||
166 | u32 sense = snd_hda_pin_sense(codec, nid); | ||
167 | return get_jack_plug_state(sense); | ||
168 | } | ||
169 | EXPORT_SYMBOL_HDA(snd_hda_jack_detect); | ||
170 | |||
171 | /** | ||
172 | * snd_hda_jack_detect_enable - enable the jack-detection | ||
173 | */ | ||
174 | int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid, | ||
175 | unsigned char action) | ||
176 | { | ||
177 | struct hda_jack_tbl *jack = snd_hda_jack_tbl_new(codec, nid); | ||
178 | if (!jack) | ||
179 | return -ENOMEM; | ||
180 | if (jack->jack_detect) | ||
181 | return 0; /* already registered */ | ||
182 | jack->jack_detect = 1; | ||
183 | if (action) | ||
184 | jack->action = action; | ||
185 | return snd_hda_codec_write_cache(codec, nid, 0, | ||
186 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
187 | AC_USRSP_EN | jack->tag); | ||
188 | } | ||
189 | EXPORT_SYMBOL_HDA(snd_hda_jack_detect_enable); | ||
190 | |||
191 | /** | ||
192 | * snd_hda_jack_report_sync - sync the states of all jacks and report if changed | ||
193 | */ | ||
194 | void snd_hda_jack_report_sync(struct hda_codec *codec) | ||
195 | { | ||
196 | struct hda_jack_tbl *jack = codec->jacktbl.list; | ||
197 | int i, state; | ||
198 | |||
199 | for (i = 0; i < codec->jacktbl.used; i++, jack++) | ||
200 | if (jack->nid) { | ||
201 | jack_detect_update(codec, jack); | ||
202 | if (!jack->kctl) | ||
203 | continue; | ||
204 | state = get_jack_plug_state(jack->pin_sense); | ||
205 | snd_kctl_jack_report(codec->bus->card, jack->kctl, state); | ||
206 | #ifdef CONFIG_SND_HDA_INPUT_JACK | ||
207 | if (jack->jack) | ||
208 | snd_jack_report(jack->jack, | ||
209 | state ? jack->type : 0); | ||
210 | #endif | ||
211 | } | ||
212 | } | ||
213 | EXPORT_SYMBOL_HDA(snd_hda_jack_report_sync); | ||
214 | |||
215 | #ifdef CONFIG_SND_HDA_INPUT_JACK | ||
216 | /* guess the jack type from the pin-config */ | ||
217 | static int get_input_jack_type(struct hda_codec *codec, hda_nid_t nid) | ||
218 | { | ||
219 | unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid); | ||
220 | switch (get_defcfg_device(def_conf)) { | ||
221 | case AC_JACK_LINE_OUT: | ||
222 | case AC_JACK_SPEAKER: | ||
223 | return SND_JACK_LINEOUT; | ||
224 | case AC_JACK_HP_OUT: | ||
225 | return SND_JACK_HEADPHONE; | ||
226 | case AC_JACK_SPDIF_OUT: | ||
227 | case AC_JACK_DIG_OTHER_OUT: | ||
228 | return SND_JACK_AVOUT; | ||
229 | case AC_JACK_MIC_IN: | ||
230 | return SND_JACK_MICROPHONE; | ||
231 | default: | ||
232 | return SND_JACK_LINEIN; | ||
233 | } | ||
234 | } | ||
235 | |||
236 | static void hda_free_jack_priv(struct snd_jack *jack) | ||
237 | { | ||
238 | struct hda_jack_tbl *jacks = jack->private_data; | ||
239 | jacks->nid = 0; | ||
240 | jacks->jack = NULL; | ||
241 | } | ||
242 | #endif | ||
243 | |||
244 | /** | ||
245 | * snd_hda_jack_add_kctl - Add a kctl for the given pin | ||
246 | * | ||
247 | * This assigns a jack-detection kctl to the given pin. The kcontrol | ||
248 | * will have the given name and index. | ||
249 | */ | ||
250 | int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, | ||
251 | const char *name, int idx) | ||
252 | { | ||
253 | struct hda_jack_tbl *jack; | ||
254 | struct snd_kcontrol *kctl; | ||
255 | int err, state; | ||
256 | |||
257 | jack = snd_hda_jack_tbl_new(codec, nid); | ||
258 | if (!jack) | ||
259 | return 0; | ||
260 | if (jack->kctl) | ||
261 | return 0; /* already created */ | ||
262 | kctl = snd_kctl_jack_new(name, idx, codec); | ||
263 | if (!kctl) | ||
264 | return -ENOMEM; | ||
265 | err = snd_hda_ctl_add(codec, nid, kctl); | ||
266 | if (err < 0) | ||
267 | return err; | ||
268 | jack->kctl = kctl; | ||
269 | state = snd_hda_jack_detect(codec, nid); | ||
270 | snd_kctl_jack_report(codec->bus->card, kctl, state); | ||
271 | #ifdef CONFIG_SND_HDA_INPUT_JACK | ||
272 | jack->type = get_input_jack_type(codec, nid); | ||
273 | err = snd_jack_new(codec->bus->card, name, jack->type, &jack->jack); | ||
274 | if (err < 0) | ||
275 | return err; | ||
276 | jack->jack->private_data = jack; | ||
277 | jack->jack->private_free = hda_free_jack_priv; | ||
278 | snd_jack_report(jack->jack, state ? jack->type : 0); | ||
279 | #endif | ||
280 | return 0; | ||
281 | } | ||
282 | EXPORT_SYMBOL_HDA(snd_hda_jack_add_kctl); | ||
283 | |||
284 | static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid, | ||
285 | const struct auto_pin_cfg *cfg) | ||
286 | { | ||
287 | unsigned int def_conf, conn; | ||
288 | char name[44]; | ||
289 | int idx, err; | ||
290 | |||
291 | if (!nid) | ||
292 | return 0; | ||
293 | if (!is_jack_detectable(codec, nid)) | ||
294 | return 0; | ||
295 | def_conf = snd_hda_codec_get_pincfg(codec, nid); | ||
296 | conn = get_defcfg_connect(def_conf); | ||
297 | if (conn != AC_JACK_PORT_COMPLEX) | ||
298 | return 0; | ||
299 | |||
300 | snd_hda_get_pin_label(codec, nid, cfg, name, sizeof(name), &idx); | ||
301 | err = snd_hda_jack_add_kctl(codec, nid, name, idx); | ||
302 | if (err < 0) | ||
303 | return err; | ||
304 | return snd_hda_jack_detect_enable(codec, nid, 0); | ||
305 | } | ||
306 | |||
307 | /** | ||
308 | * snd_hda_jack_add_kctls - Add kctls for all pins included in the given pincfg | ||
309 | */ | ||
310 | int snd_hda_jack_add_kctls(struct hda_codec *codec, | ||
311 | const struct auto_pin_cfg *cfg) | ||
312 | { | ||
313 | const hda_nid_t *p; | ||
314 | int i, err; | ||
315 | |||
316 | for (i = 0, p = cfg->line_out_pins; i < cfg->line_outs; i++, p++) { | ||
317 | err = add_jack_kctl(codec, *p, cfg); | ||
318 | if (err < 0) | ||
319 | return err; | ||
320 | } | ||
321 | for (i = 0, p = cfg->hp_pins; i < cfg->hp_outs; i++, p++) { | ||
322 | if (*p == *cfg->line_out_pins) /* might be duplicated */ | ||
323 | break; | ||
324 | err = add_jack_kctl(codec, *p, cfg); | ||
325 | if (err < 0) | ||
326 | return err; | ||
327 | } | ||
328 | for (i = 0, p = cfg->speaker_pins; i < cfg->speaker_outs; i++, p++) { | ||
329 | if (*p == *cfg->line_out_pins) /* might be duplicated */ | ||
330 | break; | ||
331 | err = add_jack_kctl(codec, *p, cfg); | ||
332 | if (err < 0) | ||
333 | return err; | ||
334 | } | ||
335 | for (i = 0; i < cfg->num_inputs; i++) { | ||
336 | err = add_jack_kctl(codec, cfg->inputs[i].pin, cfg); | ||
337 | if (err < 0) | ||
338 | return err; | ||
339 | } | ||
340 | for (i = 0, p = cfg->dig_out_pins; i < cfg->dig_outs; i++, p++) { | ||
341 | err = add_jack_kctl(codec, *p, cfg); | ||
342 | if (err < 0) | ||
343 | return err; | ||
344 | } | ||
345 | err = add_jack_kctl(codec, cfg->dig_in_pin, cfg); | ||
346 | if (err < 0) | ||
347 | return err; | ||
348 | err = add_jack_kctl(codec, cfg->mono_out_pin, cfg); | ||
349 | if (err < 0) | ||
350 | return err; | ||
351 | return 0; | ||
352 | } | ||
353 | EXPORT_SYMBOL_HDA(snd_hda_jack_add_kctls); | ||
diff --git a/sound/pci/hda/hda_jack.h b/sound/pci/hda/hda_jack.h new file mode 100644 index 000000000000..f8f97c71c9c1 --- /dev/null +++ b/sound/pci/hda/hda_jack.h | |||
@@ -0,0 +1,86 @@ | |||
1 | /* | ||
2 | * Jack-detection handling for HD-audio | ||
3 | * | ||
4 | * Copyright (c) 2011 Takashi Iwai <tiwai@suse.de> | ||
5 | * | ||
6 | * This driver is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef __SOUND_HDA_JACK_H | ||
13 | #define __SOUND_HDA_JACK_H | ||
14 | |||
15 | struct hda_jack_tbl { | ||
16 | hda_nid_t nid; | ||
17 | unsigned char action; /* event action (0 = none) */ | ||
18 | unsigned char tag; /* unsol event tag */ | ||
19 | unsigned int private_data; /* arbitrary data */ | ||
20 | /* jack-detection stuff */ | ||
21 | unsigned int pin_sense; /* cached pin-sense value */ | ||
22 | unsigned int jack_detect:1; /* capable of jack-detection? */ | ||
23 | unsigned int jack_dirty:1; /* needs to update? */ | ||
24 | struct snd_kcontrol *kctl; /* assigned kctl for jack-detection */ | ||
25 | #ifdef CONFIG_SND_HDA_INPUT_JACK | ||
26 | int type; | ||
27 | struct snd_jack *jack; | ||
28 | #endif | ||
29 | }; | ||
30 | |||
31 | struct hda_jack_tbl * | ||
32 | snd_hda_jack_tbl_get(struct hda_codec *codec, hda_nid_t nid); | ||
33 | struct hda_jack_tbl * | ||
34 | snd_hda_jack_tbl_get_from_tag(struct hda_codec *codec, unsigned char tag); | ||
35 | |||
36 | struct hda_jack_tbl * | ||
37 | snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid); | ||
38 | void snd_hda_jack_tbl_clear(struct hda_codec *codec); | ||
39 | |||
40 | /** | ||
41 | * snd_hda_jack_get_action - get jack-tbl entry for the tag | ||
42 | * | ||
43 | * Call this from the unsol event handler to get the assigned action for the | ||
44 | * event. This will mark the dirty flag for the later reporting, too. | ||
45 | */ | ||
46 | static inline unsigned char | ||
47 | snd_hda_jack_get_action(struct hda_codec *codec, unsigned int tag) | ||
48 | { | ||
49 | struct hda_jack_tbl *jack = snd_hda_jack_tbl_get_from_tag(codec, tag); | ||
50 | if (jack) { | ||
51 | jack->jack_dirty = 1; | ||
52 | return jack->action; | ||
53 | } | ||
54 | return 0; | ||
55 | } | ||
56 | |||
57 | void snd_hda_jack_set_dirty_all(struct hda_codec *codec); | ||
58 | |||
59 | int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid, | ||
60 | unsigned char action); | ||
61 | |||
62 | u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid); | ||
63 | int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid); | ||
64 | |||
65 | static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) | ||
66 | { | ||
67 | if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT)) | ||
68 | return false; | ||
69 | if (!codec->ignore_misc_bit && | ||
70 | (get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) & | ||
71 | AC_DEFCFG_MISC_NO_PRESENCE)) | ||
72 | return false; | ||
73 | if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)) | ||
74 | return false; | ||
75 | return true; | ||
76 | } | ||
77 | |||
78 | int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, | ||
79 | const char *name, int idx); | ||
80 | int snd_hda_jack_add_kctls(struct hda_codec *codec, | ||
81 | const struct auto_pin_cfg *cfg); | ||
82 | |||
83 | void snd_hda_jack_report_sync(struct hda_codec *codec); | ||
84 | |||
85 | |||
86 | #endif /* __SOUND_HDA_JACK_H */ | ||
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 618ddad17236..aca8d3193b95 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -394,11 +394,12 @@ struct auto_pin_cfg_item { | |||
394 | }; | 394 | }; |
395 | 395 | ||
396 | struct auto_pin_cfg; | 396 | struct auto_pin_cfg; |
397 | const char *hda_get_input_pin_label(struct hda_codec *codec, hda_nid_t pin, | ||
398 | int check_location); | ||
399 | const char *hda_get_autocfg_input_label(struct hda_codec *codec, | 397 | const char *hda_get_autocfg_input_label(struct hda_codec *codec, |
400 | const struct auto_pin_cfg *cfg, | 398 | const struct auto_pin_cfg *cfg, |
401 | int input); | 399 | int input); |
400 | int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid, | ||
401 | const struct auto_pin_cfg *cfg, | ||
402 | char *label, int maxlen, int *indexp); | ||
402 | int snd_hda_add_imux_item(struct hda_input_mux *imux, const char *label, | 403 | int snd_hda_add_imux_item(struct hda_input_mux *imux, const char *label, |
403 | int index, int *type_index_ret); | 404 | int index, int *type_index_ret); |
404 | 405 | ||
@@ -487,7 +488,12 @@ static inline u32 get_wcaps(struct hda_codec *codec, hda_nid_t nid) | |||
487 | } | 488 | } |
488 | 489 | ||
489 | /* get the widget type from widget capability bits */ | 490 | /* get the widget type from widget capability bits */ |
490 | #define get_wcaps_type(wcaps) (((wcaps) & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT) | 491 | static inline int get_wcaps_type(unsigned int wcaps) |
492 | { | ||
493 | if (!wcaps) | ||
494 | return -1; /* invalid type */ | ||
495 | return (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | ||
496 | } | ||
491 | 497 | ||
492 | static inline unsigned int get_wcaps_channels(u32 wcaps) | 498 | static inline unsigned int get_wcaps_channels(u32 wcaps) |
493 | { | 499 | { |
@@ -505,21 +511,6 @@ int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, | |||
505 | u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid); | 511 | u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid); |
506 | int snd_hda_override_pin_caps(struct hda_codec *codec, hda_nid_t nid, | 512 | int snd_hda_override_pin_caps(struct hda_codec *codec, hda_nid_t nid, |
507 | unsigned int caps); | 513 | unsigned int caps); |
508 | u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid); | ||
509 | int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid); | ||
510 | |||
511 | static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) | ||
512 | { | ||
513 | if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT)) | ||
514 | return false; | ||
515 | if (!codec->ignore_misc_bit && | ||
516 | (get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) & | ||
517 | AC_DEFCFG_MISC_NO_PRESENCE)) | ||
518 | return false; | ||
519 | if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)) | ||
520 | return false; | ||
521 | return true; | ||
522 | } | ||
523 | 514 | ||
524 | /* flags for hda_nid_item */ | 515 | /* flags for hda_nid_item */ |
525 | #define HDA_NID_ITEM_AMP (1<<0) | 516 | #define HDA_NID_ITEM_AMP (1<<0) |
@@ -688,28 +679,4 @@ static inline void snd_hda_eld_proc_free(struct hda_codec *codec, | |||
688 | #define SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE 80 | 679 | #define SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE 80 |
689 | void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen); | 680 | void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen); |
690 | 681 | ||
691 | /* | ||
692 | * Input-jack notification support | ||
693 | */ | ||
694 | #ifdef CONFIG_SND_HDA_INPUT_JACK | ||
695 | int snd_hda_input_jack_add(struct hda_codec *codec, hda_nid_t nid, int type, | ||
696 | const char *name); | ||
697 | void snd_hda_input_jack_report(struct hda_codec *codec, hda_nid_t nid); | ||
698 | void snd_hda_input_jack_free(struct hda_codec *codec); | ||
699 | #else /* CONFIG_SND_HDA_INPUT_JACK */ | ||
700 | static inline int snd_hda_input_jack_add(struct hda_codec *codec, | ||
701 | hda_nid_t nid, int type, | ||
702 | const char *name) | ||
703 | { | ||
704 | return 0; | ||
705 | } | ||
706 | static inline void snd_hda_input_jack_report(struct hda_codec *codec, | ||
707 | hda_nid_t nid) | ||
708 | { | ||
709 | } | ||
710 | static inline void snd_hda_input_jack_free(struct hda_codec *codec) | ||
711 | { | ||
712 | } | ||
713 | #endif /* CONFIG_SND_HDA_INPUT_JACK */ | ||
714 | |||
715 | #endif /* __SOUND_HDA_LOCAL_H */ | 682 | #endif /* __SOUND_HDA_LOCAL_H */ |
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index 2c981b55940b..254ab5204603 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c | |||
@@ -54,6 +54,8 @@ static const char *get_wid_type_name(unsigned int wid_value) | |||
54 | [AC_WID_BEEP] = "Beep Generator Widget", | 54 | [AC_WID_BEEP] = "Beep Generator Widget", |
55 | [AC_WID_VENDOR] = "Vendor Defined Widget", | 55 | [AC_WID_VENDOR] = "Vendor Defined Widget", |
56 | }; | 56 | }; |
57 | if (wid_value == -1) | ||
58 | return "UNKNOWN Widget"; | ||
57 | wid_value &= 0xf; | 59 | wid_value &= 0xf; |
58 | if (names[wid_value]) | 60 | if (names[wid_value]) |
59 | return names[wid_value]; | 61 | return names[wid_value]; |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index bcb3310c394f..9cb14b42dfff 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include "hda_codec.h" | 29 | #include "hda_codec.h" |
30 | #include "hda_local.h" | 30 | #include "hda_local.h" |
31 | #include "hda_beep.h" | 31 | #include "hda_beep.h" |
32 | #include "hda_jack.h" | ||
32 | 33 | ||
33 | struct ad198x_spec { | 34 | struct ad198x_spec { |
34 | const struct snd_kcontrol_new *mixers[6]; | 35 | const struct snd_kcontrol_new *mixers[6]; |
diff --git a/sound/pci/hda/patch_ca0110.c b/sound/pci/hda/patch_ca0110.c index 993757b65736..09ccfabb4a17 100644 --- a/sound/pci/hda/patch_ca0110.c +++ b/sound/pci/hda/patch_ca0110.c | |||
@@ -41,7 +41,7 @@ struct ca0110_spec { | |||
41 | hda_nid_t dig_out; | 41 | hda_nid_t dig_out; |
42 | hda_nid_t dig_in; | 42 | hda_nid_t dig_in; |
43 | unsigned int num_inputs; | 43 | unsigned int num_inputs; |
44 | const char *input_labels[AUTO_PIN_LAST]; | 44 | char input_labels[AUTO_PIN_LAST][32]; |
45 | struct hda_pcm pcm_rec[2]; /* PCM information */ | 45 | struct hda_pcm pcm_rec[2]; /* PCM information */ |
46 | }; | 46 | }; |
47 | 47 | ||
@@ -476,7 +476,9 @@ static void parse_input(struct hda_codec *codec) | |||
476 | if (j >= cfg->num_inputs) | 476 | if (j >= cfg->num_inputs) |
477 | continue; | 477 | continue; |
478 | spec->input_pins[n] = pin; | 478 | spec->input_pins[n] = pin; |
479 | spec->input_labels[n] = hda_get_input_pin_label(codec, pin, 1); | 479 | snd_hda_get_pin_label(codec, pin, cfg, |
480 | spec->input_labels[n], | ||
481 | sizeof(spec->input_labels[n]), NULL); | ||
480 | spec->adcs[n] = nid; | 482 | spec->adcs[n] = nid; |
481 | n++; | 483 | n++; |
482 | } | 484 | } |
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index 70a7abda7e22..0e99357e822c 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <sound/core.h> | 26 | #include <sound/core.h> |
27 | #include "hda_codec.h" | 27 | #include "hda_codec.h" |
28 | #include "hda_local.h" | 28 | #include "hda_local.h" |
29 | #include "hda_jack.h" | ||
29 | #include <sound/tlv.h> | 30 | #include <sound/tlv.h> |
30 | 31 | ||
31 | /* | 32 | /* |
@@ -78,6 +79,7 @@ enum { | |||
78 | CS420X_MBP53, | 79 | CS420X_MBP53, |
79 | CS420X_MBP55, | 80 | CS420X_MBP55, |
80 | CS420X_IMAC27, | 81 | CS420X_IMAC27, |
82 | CS420X_IMAC27_122, | ||
81 | CS420X_APPLE, | 83 | CS420X_APPLE, |
82 | CS420X_AUTO, | 84 | CS420X_AUTO, |
83 | CS420X_MODELS | 85 | CS420X_MODELS |
@@ -137,7 +139,7 @@ enum { | |||
137 | */ | 139 | */ |
138 | #define CS4210_DAC_NID 0x02 | 140 | #define CS4210_DAC_NID 0x02 |
139 | #define CS4210_ADC_NID 0x03 | 141 | #define CS4210_ADC_NID 0x03 |
140 | #define CS421X_VENDOR_NID 0x0B | 142 | #define CS4210_VENDOR_NID 0x0B |
141 | #define CS421X_DMIC_PIN_NID 0x09 /* Port E */ | 143 | #define CS421X_DMIC_PIN_NID 0x09 /* Port E */ |
142 | #define CS421X_SPDIF_PIN_NID 0x0A /* Port H */ | 144 | #define CS421X_SPDIF_PIN_NID 0x0A /* Port H */ |
143 | 145 | ||
@@ -148,6 +150,10 @@ enum { | |||
148 | 150 | ||
149 | #define SPDIF_EVENT 0x04 | 151 | #define SPDIF_EVENT 0x04 |
150 | 152 | ||
153 | /* Cirrus Logic CS4213 is like CS4210 but does not have SPDIF input/output */ | ||
154 | #define CS4213_VENDOR_NID 0x09 | ||
155 | |||
156 | |||
151 | static inline int cs_vendor_coef_get(struct hda_codec *codec, unsigned int idx) | 157 | static inline int cs_vendor_coef_get(struct hda_codec *codec, unsigned int idx) |
152 | { | 158 | { |
153 | struct cs_spec *spec = codec->spec; | 159 | struct cs_spec *spec = codec->spec; |
@@ -721,8 +727,9 @@ static int cs_capture_source_info(struct snd_kcontrol *kcontrol, | |||
721 | if (uinfo->value.enumerated.item >= spec->num_inputs) | 727 | if (uinfo->value.enumerated.item >= spec->num_inputs) |
722 | uinfo->value.enumerated.item = spec->num_inputs - 1; | 728 | uinfo->value.enumerated.item = spec->num_inputs - 1; |
723 | idx = spec->input_idx[uinfo->value.enumerated.item]; | 729 | idx = spec->input_idx[uinfo->value.enumerated.item]; |
724 | strcpy(uinfo->value.enumerated.name, | 730 | snd_hda_get_pin_label(codec, cfg->inputs[idx].pin, cfg, |
725 | hda_get_input_pin_label(codec, cfg->inputs[idx].pin, 1)); | 731 | uinfo->value.enumerated.name, |
732 | sizeof(uinfo->value.enumerated.name), NULL); | ||
726 | return 0; | 733 | return 0; |
727 | } | 734 | } |
728 | 735 | ||
@@ -920,16 +927,14 @@ static void cs_automute(struct hda_codec *codec) | |||
920 | 927 | ||
921 | /* mute speakers if spdif or hp jack is plugged in */ | 928 | /* mute speakers if spdif or hp jack is plugged in */ |
922 | for (i = 0; i < cfg->speaker_outs; i++) { | 929 | for (i = 0; i < cfg->speaker_outs; i++) { |
930 | int pin_ctl = hp_present ? 0 : PIN_OUT; | ||
931 | /* detect on spdif is specific to CS4210 */ | ||
932 | if (spdif_present && (spec->vendor_nid == CS4210_VENDOR_NID)) | ||
933 | pin_ctl = 0; | ||
934 | |||
923 | nid = cfg->speaker_pins[i]; | 935 | nid = cfg->speaker_pins[i]; |
924 | snd_hda_codec_write(codec, nid, 0, | 936 | snd_hda_codec_write(codec, nid, 0, |
925 | AC_VERB_SET_PIN_WIDGET_CONTROL, | 937 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_ctl); |
926 | hp_present ? 0 : PIN_OUT); | ||
927 | /* detect on spdif is specific to CS421x */ | ||
928 | if (spec->vendor_nid == CS421X_VENDOR_NID) { | ||
929 | snd_hda_codec_write(codec, nid, 0, | ||
930 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
931 | spdif_present ? 0 : PIN_OUT); | ||
932 | } | ||
933 | } | 938 | } |
934 | if (spec->gpio_eapd_hp) { | 939 | if (spec->gpio_eapd_hp) { |
935 | unsigned int gpio = hp_present ? | 940 | unsigned int gpio = hp_present ? |
@@ -938,8 +943,8 @@ static void cs_automute(struct hda_codec *codec) | |||
938 | AC_VERB_SET_GPIO_DATA, gpio); | 943 | AC_VERB_SET_GPIO_DATA, gpio); |
939 | } | 944 | } |
940 | 945 | ||
941 | /* specific to CS421x */ | 946 | /* specific to CS4210 */ |
942 | if (spec->vendor_nid == CS421X_VENDOR_NID) { | 947 | if (spec->vendor_nid == CS4210_VENDOR_NID) { |
943 | /* mute HPs if spdif jack (SENSE_B) is present */ | 948 | /* mute HPs if spdif jack (SENSE_B) is present */ |
944 | for (i = 0; i < cfg->hp_outs; i++) { | 949 | for (i = 0; i < cfg->hp_outs; i++) { |
945 | nid = cfg->hp_pins[i]; | 950 | nid = cfg->hp_pins[i]; |
@@ -976,7 +981,12 @@ static void cs_automic(struct hda_codec *codec) | |||
976 | present = snd_hda_jack_detect(codec, nid); | 981 | present = snd_hda_jack_detect(codec, nid); |
977 | 982 | ||
978 | /* specific to CS421x, single ADC */ | 983 | /* specific to CS421x, single ADC */ |
979 | if (spec->vendor_nid == CS421X_VENDOR_NID) { | 984 | if (spec->vendor_nid == CS420X_VENDOR_NID) { |
985 | if (present) | ||
986 | change_cur_input(codec, spec->automic_idx, 0); | ||
987 | else | ||
988 | change_cur_input(codec, !spec->automic_idx, 0); | ||
989 | } else { | ||
980 | if (present) { | 990 | if (present) { |
981 | spec->last_input = spec->cur_input; | 991 | spec->last_input = spec->cur_input; |
982 | spec->cur_input = spec->automic_idx; | 992 | spec->cur_input = spec->automic_idx; |
@@ -984,11 +994,6 @@ static void cs_automic(struct hda_codec *codec) | |||
984 | spec->cur_input = spec->last_input; | 994 | spec->cur_input = spec->last_input; |
985 | } | 995 | } |
986 | cs_update_input_select(codec); | 996 | cs_update_input_select(codec); |
987 | } else { | ||
988 | if (present) | ||
989 | change_cur_input(codec, spec->automic_idx, 0); | ||
990 | else | ||
991 | change_cur_input(codec, !spec->automic_idx, 0); | ||
992 | } | 997 | } |
993 | } | 998 | } |
994 | 999 | ||
@@ -1027,9 +1032,7 @@ static void init_output(struct hda_codec *codec) | |||
1027 | if (!cfg->speaker_outs) | 1032 | if (!cfg->speaker_outs) |
1028 | continue; | 1033 | continue; |
1029 | if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) { | 1034 | if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) { |
1030 | snd_hda_codec_write(codec, nid, 0, | 1035 | snd_hda_jack_detect_enable(codec, nid, HP_EVENT); |
1031 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
1032 | AC_USRSP_EN | HP_EVENT); | ||
1033 | spec->hp_detect = 1; | 1036 | spec->hp_detect = 1; |
1034 | } | 1037 | } |
1035 | } | 1038 | } |
@@ -1070,19 +1073,10 @@ static void init_input(struct hda_codec *codec) | |||
1070 | AC_VERB_SET_AMP_GAIN_MUTE, | 1073 | AC_VERB_SET_AMP_GAIN_MUTE, |
1071 | AMP_IN_MUTE(spec->adc_idx[i])); | 1074 | AMP_IN_MUTE(spec->adc_idx[i])); |
1072 | if (spec->mic_detect && spec->automic_idx == i) | 1075 | if (spec->mic_detect && spec->automic_idx == i) |
1073 | snd_hda_codec_write(codec, pin, 0, | 1076 | snd_hda_jack_detect_enable(codec, pin, MIC_EVENT); |
1074 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
1075 | AC_USRSP_EN | MIC_EVENT); | ||
1076 | } | 1077 | } |
1077 | /* specific to CS421x */ | 1078 | /* CS420x has multiple ADC, CS421x has single ADC */ |
1078 | if (spec->vendor_nid == CS421X_VENDOR_NID) { | 1079 | if (spec->vendor_nid == CS420X_VENDOR_NID) { |
1079 | if (spec->mic_detect) | ||
1080 | cs_automic(codec); | ||
1081 | else { | ||
1082 | spec->cur_adc = spec->adc_nid[spec->cur_input]; | ||
1083 | cs_update_input_select(codec); | ||
1084 | } | ||
1085 | } else { | ||
1086 | change_cur_input(codec, spec->cur_input, 1); | 1080 | change_cur_input(codec, spec->cur_input, 1); |
1087 | if (spec->mic_detect) | 1081 | if (spec->mic_detect) |
1088 | cs_automic(codec); | 1082 | cs_automic(codec); |
@@ -1096,6 +1090,13 @@ static void init_input(struct hda_codec *codec) | |||
1096 | * selected in IDX_SPDIF_CTL. | 1090 | * selected in IDX_SPDIF_CTL. |
1097 | */ | 1091 | */ |
1098 | cs_vendor_coef_set(codec, IDX_ADC_CFG, coef); | 1092 | cs_vendor_coef_set(codec, IDX_ADC_CFG, coef); |
1093 | } else { | ||
1094 | if (spec->mic_detect) | ||
1095 | cs_automic(codec); | ||
1096 | else { | ||
1097 | spec->cur_adc = spec->adc_nid[spec->cur_input]; | ||
1098 | cs_update_input_select(codec); | ||
1099 | } | ||
1099 | } | 1100 | } |
1100 | } | 1101 | } |
1101 | 1102 | ||
@@ -1200,11 +1201,14 @@ static int cs_init(struct hda_codec *codec) | |||
1200 | init_output(codec); | 1201 | init_output(codec); |
1201 | init_input(codec); | 1202 | init_input(codec); |
1202 | init_digital(codec); | 1203 | init_digital(codec); |
1204 | snd_hda_jack_report_sync(codec); | ||
1205 | |||
1203 | return 0; | 1206 | return 0; |
1204 | } | 1207 | } |
1205 | 1208 | ||
1206 | static int cs_build_controls(struct hda_codec *codec) | 1209 | static int cs_build_controls(struct hda_codec *codec) |
1207 | { | 1210 | { |
1211 | struct cs_spec *spec = codec->spec; | ||
1208 | int err; | 1212 | int err; |
1209 | 1213 | ||
1210 | err = build_output(codec); | 1214 | err = build_output(codec); |
@@ -1219,7 +1223,15 @@ static int cs_build_controls(struct hda_codec *codec) | |||
1219 | err = build_digital_input(codec); | 1223 | err = build_digital_input(codec); |
1220 | if (err < 0) | 1224 | if (err < 0) |
1221 | return err; | 1225 | return err; |
1222 | return cs_init(codec); | 1226 | err = cs_init(codec); |
1227 | if (err < 0) | ||
1228 | return err; | ||
1229 | |||
1230 | err = snd_hda_jack_add_kctls(codec, &spec->autocfg); | ||
1231 | if (err < 0) | ||
1232 | return err; | ||
1233 | |||
1234 | return 0; | ||
1223 | } | 1235 | } |
1224 | 1236 | ||
1225 | static void cs_free(struct hda_codec *codec) | 1237 | static void cs_free(struct hda_codec *codec) |
@@ -1232,7 +1244,7 @@ static void cs_free(struct hda_codec *codec) | |||
1232 | 1244 | ||
1233 | static void cs_unsol_event(struct hda_codec *codec, unsigned int res) | 1245 | static void cs_unsol_event(struct hda_codec *codec, unsigned int res) |
1234 | { | 1246 | { |
1235 | switch ((res >> 26) & 0x7f) { | 1247 | switch (snd_hda_jack_get_action(codec, res >> 26)) { |
1236 | case HP_EVENT: | 1248 | case HP_EVENT: |
1237 | cs_automute(codec); | 1249 | cs_automute(codec); |
1238 | break; | 1250 | break; |
@@ -1240,6 +1252,7 @@ static void cs_unsol_event(struct hda_codec *codec, unsigned int res) | |||
1240 | cs_automic(codec); | 1252 | cs_automic(codec); |
1241 | break; | 1253 | break; |
1242 | } | 1254 | } |
1255 | snd_hda_jack_report_sync(codec); | ||
1243 | } | 1256 | } |
1244 | 1257 | ||
1245 | static const struct hda_codec_ops cs_patch_ops = { | 1258 | static const struct hda_codec_ops cs_patch_ops = { |
@@ -1278,6 +1291,7 @@ static const char * const cs420x_models[CS420X_MODELS] = { | |||
1278 | [CS420X_MBP53] = "mbp53", | 1291 | [CS420X_MBP53] = "mbp53", |
1279 | [CS420X_MBP55] = "mbp55", | 1292 | [CS420X_MBP55] = "mbp55", |
1280 | [CS420X_IMAC27] = "imac27", | 1293 | [CS420X_IMAC27] = "imac27", |
1294 | [CS420X_IMAC27_122] = "imac27_122", | ||
1281 | [CS420X_APPLE] = "apple", | 1295 | [CS420X_APPLE] = "apple", |
1282 | [CS420X_AUTO] = "auto", | 1296 | [CS420X_AUTO] = "auto", |
1283 | }; | 1297 | }; |
@@ -1294,6 +1308,7 @@ static const struct snd_pci_quirk cs420x_cfg_tbl[] = { | |||
1294 | }; | 1308 | }; |
1295 | 1309 | ||
1296 | static const struct snd_pci_quirk cs420x_codec_cfg_tbl[] = { | 1310 | static const struct snd_pci_quirk cs420x_codec_cfg_tbl[] = { |
1311 | SND_PCI_QUIRK(0x106b, 0x2000, "iMac 12,2", CS420X_IMAC27_122), | ||
1297 | SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE), | 1312 | SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE), |
1298 | {} /* terminator */ | 1313 | {} /* terminator */ |
1299 | }; | 1314 | }; |
@@ -1393,6 +1408,12 @@ static int patch_cs420x(struct hda_codec *codec) | |||
1393 | spec->gpio_mask = spec->gpio_dir = | 1408 | spec->gpio_mask = spec->gpio_dir = |
1394 | spec->gpio_eapd_hp | spec->gpio_eapd_speaker; | 1409 | spec->gpio_eapd_hp | spec->gpio_eapd_speaker; |
1395 | break; | 1410 | break; |
1411 | case CS420X_IMAC27_122: | ||
1412 | spec->gpio_eapd_hp = 4; /* GPIO2 = headphones */ | ||
1413 | spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */ | ||
1414 | spec->gpio_mask = spec->gpio_dir = | ||
1415 | spec->gpio_eapd_hp | spec->gpio_eapd_speaker; | ||
1416 | break; | ||
1396 | } | 1417 | } |
1397 | 1418 | ||
1398 | err = cs_parse_auto_config(codec); | 1419 | err = cs_parse_auto_config(codec); |
@@ -1557,7 +1578,7 @@ static const struct snd_kcontrol_new cs421x_speaker_bost_ctl = { | |||
1557 | .tlv = { .p = cs421x_speaker_boost_db_scale }, | 1578 | .tlv = { .p = cs421x_speaker_boost_db_scale }, |
1558 | }; | 1579 | }; |
1559 | 1580 | ||
1560 | static void cs421x_pinmux_init(struct hda_codec *codec) | 1581 | static void cs4210_pinmux_init(struct hda_codec *codec) |
1561 | { | 1582 | { |
1562 | struct cs_spec *spec = codec->spec; | 1583 | struct cs_spec *spec = codec->spec; |
1563 | unsigned int def_conf, coef; | 1584 | unsigned int def_conf, coef; |
@@ -1602,10 +1623,7 @@ static void init_cs421x_digital(struct hda_codec *codec) | |||
1602 | if (!cfg->speaker_outs) | 1623 | if (!cfg->speaker_outs) |
1603 | continue; | 1624 | continue; |
1604 | if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) { | 1625 | if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) { |
1605 | 1626 | snd_hda_jack_detect_enable(codec, nid, SPDIF_EVENT); | |
1606 | snd_hda_codec_write(codec, nid, 0, | ||
1607 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
1608 | AC_USRSP_EN | SPDIF_EVENT); | ||
1609 | spec->spdif_detect = 1; | 1627 | spec->spdif_detect = 1; |
1610 | } | 1628 | } |
1611 | } | 1629 | } |
@@ -1615,10 +1633,11 @@ static int cs421x_init(struct hda_codec *codec) | |||
1615 | { | 1633 | { |
1616 | struct cs_spec *spec = codec->spec; | 1634 | struct cs_spec *spec = codec->spec; |
1617 | 1635 | ||
1618 | snd_hda_sequence_write(codec, cs421x_coef_init_verbs); | 1636 | if (spec->vendor_nid == CS4210_VENDOR_NID) { |
1619 | snd_hda_sequence_write(codec, cs421x_coef_init_verbs_A1_silicon_fixes); | 1637 | snd_hda_sequence_write(codec, cs421x_coef_init_verbs); |
1620 | 1638 | snd_hda_sequence_write(codec, cs421x_coef_init_verbs_A1_silicon_fixes); | |
1621 | cs421x_pinmux_init(codec); | 1639 | cs4210_pinmux_init(codec); |
1640 | } | ||
1622 | 1641 | ||
1623 | if (spec->gpio_mask) { | 1642 | if (spec->gpio_mask) { |
1624 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK, | 1643 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK, |
@@ -1632,6 +1651,7 @@ static int cs421x_init(struct hda_codec *codec) | |||
1632 | init_output(codec); | 1651 | init_output(codec); |
1633 | init_input(codec); | 1652 | init_input(codec); |
1634 | init_cs421x_digital(codec); | 1653 | init_cs421x_digital(codec); |
1654 | snd_hda_jack_report_sync(codec); | ||
1635 | 1655 | ||
1636 | return 0; | 1656 | return 0; |
1637 | } | 1657 | } |
@@ -1771,32 +1791,21 @@ static int build_cs421x_output(struct hda_codec *codec) | |||
1771 | struct auto_pin_cfg *cfg = &spec->autocfg; | 1791 | struct auto_pin_cfg *cfg = &spec->autocfg; |
1772 | struct snd_kcontrol *kctl; | 1792 | struct snd_kcontrol *kctl; |
1773 | int err; | 1793 | int err; |
1774 | char *name = "HP/Speakers"; | 1794 | char *name = "Master"; |
1775 | 1795 | ||
1776 | fix_volume_caps(codec, dac); | 1796 | fix_volume_caps(codec, dac); |
1777 | if (!spec->vmaster_sw) { | ||
1778 | err = add_vmaster(codec, dac); | ||
1779 | if (err < 0) | ||
1780 | return err; | ||
1781 | } | ||
1782 | 1797 | ||
1783 | err = add_mute(codec, name, 0, | 1798 | err = add_mute(codec, name, 0, |
1784 | HDA_COMPOSE_AMP_VAL(dac, 3, 0, HDA_OUTPUT), 0, &kctl); | 1799 | HDA_COMPOSE_AMP_VAL(dac, 3, 0, HDA_OUTPUT), 0, &kctl); |
1785 | if (err < 0) | 1800 | if (err < 0) |
1786 | return err; | 1801 | return err; |
1787 | err = snd_ctl_add_slave(spec->vmaster_sw, kctl); | ||
1788 | if (err < 0) | ||
1789 | return err; | ||
1790 | 1802 | ||
1791 | err = add_volume(codec, name, 0, | 1803 | err = add_volume(codec, name, 0, |
1792 | HDA_COMPOSE_AMP_VAL(dac, 3, 0, HDA_OUTPUT), 0, &kctl); | 1804 | HDA_COMPOSE_AMP_VAL(dac, 3, 0, HDA_OUTPUT), 0, &kctl); |
1793 | if (err < 0) | 1805 | if (err < 0) |
1794 | return err; | 1806 | return err; |
1795 | err = snd_ctl_add_slave(spec->vmaster_vol, kctl); | ||
1796 | if (err < 0) | ||
1797 | return err; | ||
1798 | 1807 | ||
1799 | if (cfg->speaker_outs) { | 1808 | if (cfg->speaker_outs && (spec->vendor_nid == CS4210_VENDOR_NID)) { |
1800 | err = snd_hda_ctl_add(codec, 0, | 1809 | err = snd_hda_ctl_add(codec, 0, |
1801 | snd_ctl_new1(&cs421x_speaker_bost_ctl, codec)); | 1810 | snd_ctl_new1(&cs421x_speaker_bost_ctl, codec)); |
1802 | if (err < 0) | 1811 | if (err < 0) |
@@ -1807,6 +1816,7 @@ static int build_cs421x_output(struct hda_codec *codec) | |||
1807 | 1816 | ||
1808 | static int cs421x_build_controls(struct hda_codec *codec) | 1817 | static int cs421x_build_controls(struct hda_codec *codec) |
1809 | { | 1818 | { |
1819 | struct cs_spec *spec = codec->spec; | ||
1810 | int err; | 1820 | int err; |
1811 | 1821 | ||
1812 | err = build_cs421x_output(codec); | 1822 | err = build_cs421x_output(codec); |
@@ -1818,12 +1828,20 @@ static int cs421x_build_controls(struct hda_codec *codec) | |||
1818 | err = build_digital_output(codec); | 1828 | err = build_digital_output(codec); |
1819 | if (err < 0) | 1829 | if (err < 0) |
1820 | return err; | 1830 | return err; |
1821 | return cs421x_init(codec); | 1831 | err = cs421x_init(codec); |
1832 | if (err < 0) | ||
1833 | return err; | ||
1834 | |||
1835 | err = snd_hda_jack_add_kctls(codec, &spec->autocfg); | ||
1836 | if (err < 0) | ||
1837 | return err; | ||
1838 | |||
1839 | return 0; | ||
1822 | } | 1840 | } |
1823 | 1841 | ||
1824 | static void cs421x_unsol_event(struct hda_codec *codec, unsigned int res) | 1842 | static void cs421x_unsol_event(struct hda_codec *codec, unsigned int res) |
1825 | { | 1843 | { |
1826 | switch ((res >> 26) & 0x3f) { | 1844 | switch (snd_hda_jack_get_action(codec, res >> 26)) { |
1827 | case HP_EVENT: | 1845 | case HP_EVENT: |
1828 | case SPDIF_EVENT: | 1846 | case SPDIF_EVENT: |
1829 | cs_automute(codec); | 1847 | cs_automute(codec); |
@@ -1833,6 +1851,7 @@ static void cs421x_unsol_event(struct hda_codec *codec, unsigned int res) | |||
1833 | cs_automic(codec); | 1851 | cs_automic(codec); |
1834 | break; | 1852 | break; |
1835 | } | 1853 | } |
1854 | snd_hda_jack_report_sync(codec); | ||
1836 | } | 1855 | } |
1837 | 1856 | ||
1838 | static int parse_cs421x_input(struct hda_codec *codec) | 1857 | static int parse_cs421x_input(struct hda_codec *codec) |
@@ -1883,6 +1902,7 @@ static int cs421x_parse_auto_config(struct hda_codec *codec) | |||
1883 | */ | 1902 | */ |
1884 | static int cs421x_suspend(struct hda_codec *codec, pm_message_t state) | 1903 | static int cs421x_suspend(struct hda_codec *codec, pm_message_t state) |
1885 | { | 1904 | { |
1905 | struct cs_spec *spec = codec->spec; | ||
1886 | unsigned int coef; | 1906 | unsigned int coef; |
1887 | 1907 | ||
1888 | snd_hda_shutup_pins(codec); | 1908 | snd_hda_shutup_pins(codec); |
@@ -1892,15 +1912,17 @@ static int cs421x_suspend(struct hda_codec *codec, pm_message_t state) | |||
1892 | snd_hda_codec_write(codec, CS4210_ADC_NID, 0, | 1912 | snd_hda_codec_write(codec, CS4210_ADC_NID, 0, |
1893 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); | 1913 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
1894 | 1914 | ||
1895 | coef = cs_vendor_coef_get(codec, CS421X_IDX_DEV_CFG); | 1915 | if (spec->vendor_nid == CS4210_VENDOR_NID) { |
1896 | coef |= 0x0004; /* PDREF */ | 1916 | coef = cs_vendor_coef_get(codec, CS421X_IDX_DEV_CFG); |
1897 | cs_vendor_coef_set(codec, CS421X_IDX_DEV_CFG, coef); | 1917 | coef |= 0x0004; /* PDREF */ |
1918 | cs_vendor_coef_set(codec, CS421X_IDX_DEV_CFG, coef); | ||
1919 | } | ||
1898 | 1920 | ||
1899 | return 0; | 1921 | return 0; |
1900 | } | 1922 | } |
1901 | #endif | 1923 | #endif |
1902 | 1924 | ||
1903 | static struct hda_codec_ops cs4210_patch_ops = { | 1925 | static struct hda_codec_ops cs421x_patch_ops = { |
1904 | .build_controls = cs421x_build_controls, | 1926 | .build_controls = cs421x_build_controls, |
1905 | .build_pcms = cs_build_pcms, | 1927 | .build_pcms = cs_build_pcms, |
1906 | .init = cs421x_init, | 1928 | .init = cs421x_init, |
@@ -1911,7 +1933,7 @@ static struct hda_codec_ops cs4210_patch_ops = { | |||
1911 | #endif | 1933 | #endif |
1912 | }; | 1934 | }; |
1913 | 1935 | ||
1914 | static int patch_cs421x(struct hda_codec *codec) | 1936 | static int patch_cs4210(struct hda_codec *codec) |
1915 | { | 1937 | { |
1916 | struct cs_spec *spec; | 1938 | struct cs_spec *spec; |
1917 | int err; | 1939 | int err; |
@@ -1921,7 +1943,7 @@ static int patch_cs421x(struct hda_codec *codec) | |||
1921 | return -ENOMEM; | 1943 | return -ENOMEM; |
1922 | codec->spec = spec; | 1944 | codec->spec = spec; |
1923 | 1945 | ||
1924 | spec->vendor_nid = CS421X_VENDOR_NID; | 1946 | spec->vendor_nid = CS4210_VENDOR_NID; |
1925 | 1947 | ||
1926 | spec->board_config = | 1948 | spec->board_config = |
1927 | snd_hda_check_board_config(codec, CS421X_MODELS, | 1949 | snd_hda_check_board_config(codec, CS421X_MODELS, |
@@ -1949,14 +1971,39 @@ static int patch_cs421x(struct hda_codec *codec) | |||
1949 | is auto-parsed. If GPIO or SENSE_B is forced, DMIC input | 1971 | is auto-parsed. If GPIO or SENSE_B is forced, DMIC input |
1950 | is disabled. | 1972 | is disabled. |
1951 | */ | 1973 | */ |
1952 | cs421x_pinmux_init(codec); | 1974 | cs4210_pinmux_init(codec); |
1953 | 1975 | ||
1954 | err = cs421x_parse_auto_config(codec); | 1976 | err = cs421x_parse_auto_config(codec); |
1955 | if (err < 0) | 1977 | if (err < 0) |
1956 | goto error; | 1978 | goto error; |
1957 | 1979 | ||
1958 | codec->patch_ops = cs4210_patch_ops; | 1980 | codec->patch_ops = cs421x_patch_ops; |
1981 | |||
1982 | return 0; | ||
1983 | |||
1984 | error: | ||
1985 | kfree(codec->spec); | ||
1986 | codec->spec = NULL; | ||
1987 | return err; | ||
1988 | } | ||
1989 | |||
1990 | static int patch_cs4213(struct hda_codec *codec) | ||
1991 | { | ||
1992 | struct cs_spec *spec; | ||
1993 | int err; | ||
1994 | |||
1995 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
1996 | if (!spec) | ||
1997 | return -ENOMEM; | ||
1998 | codec->spec = spec; | ||
1999 | |||
2000 | spec->vendor_nid = CS4213_VENDOR_NID; | ||
2001 | |||
2002 | err = cs421x_parse_auto_config(codec); | ||
2003 | if (err < 0) | ||
2004 | goto error; | ||
1959 | 2005 | ||
2006 | codec->patch_ops = cs421x_patch_ops; | ||
1960 | return 0; | 2007 | return 0; |
1961 | 2008 | ||
1962 | error: | 2009 | error: |
@@ -1972,13 +2019,15 @@ static int patch_cs421x(struct hda_codec *codec) | |||
1972 | static const struct hda_codec_preset snd_hda_preset_cirrus[] = { | 2019 | static const struct hda_codec_preset snd_hda_preset_cirrus[] = { |
1973 | { .id = 0x10134206, .name = "CS4206", .patch = patch_cs420x }, | 2020 | { .id = 0x10134206, .name = "CS4206", .patch = patch_cs420x }, |
1974 | { .id = 0x10134207, .name = "CS4207", .patch = patch_cs420x }, | 2021 | { .id = 0x10134207, .name = "CS4207", .patch = patch_cs420x }, |
1975 | { .id = 0x10134210, .name = "CS4210", .patch = patch_cs421x }, | 2022 | { .id = 0x10134210, .name = "CS4210", .patch = patch_cs4210 }, |
2023 | { .id = 0x10134213, .name = "CS4213", .patch = patch_cs4213 }, | ||
1976 | {} /* terminator */ | 2024 | {} /* terminator */ |
1977 | }; | 2025 | }; |
1978 | 2026 | ||
1979 | MODULE_ALIAS("snd-hda-codec-id:10134206"); | 2027 | MODULE_ALIAS("snd-hda-codec-id:10134206"); |
1980 | MODULE_ALIAS("snd-hda-codec-id:10134207"); | 2028 | MODULE_ALIAS("snd-hda-codec-id:10134207"); |
1981 | MODULE_ALIAS("snd-hda-codec-id:10134210"); | 2029 | MODULE_ALIAS("snd-hda-codec-id:10134210"); |
2030 | MODULE_ALIAS("snd-hda-codec-id:10134213"); | ||
1982 | 2031 | ||
1983 | MODULE_LICENSE("GPL"); | 2032 | MODULE_LICENSE("GPL"); |
1984 | MODULE_DESCRIPTION("Cirrus Logic HD-audio codec"); | 2033 | MODULE_DESCRIPTION("Cirrus Logic HD-audio codec"); |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 0de21193a2b0..8a32a69c83c3 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include "hda_codec.h" | 31 | #include "hda_codec.h" |
32 | #include "hda_local.h" | 32 | #include "hda_local.h" |
33 | #include "hda_beep.h" | 33 | #include "hda_beep.h" |
34 | #include "hda_jack.h" | ||
34 | 35 | ||
35 | #define CXT_PIN_DIR_IN 0x00 | 36 | #define CXT_PIN_DIR_IN 0x00 |
36 | #define CXT_PIN_DIR_OUT 0x01 | 37 | #define CXT_PIN_DIR_OUT 0x01 |
@@ -415,40 +416,6 @@ static int conexant_mux_enum_put(struct snd_kcontrol *kcontrol, | |||
415 | &spec->cur_mux[adc_idx]); | 416 | &spec->cur_mux[adc_idx]); |
416 | } | 417 | } |
417 | 418 | ||
418 | static int conexant_init_jacks(struct hda_codec *codec) | ||
419 | { | ||
420 | #ifdef CONFIG_SND_HDA_INPUT_JACK | ||
421 | struct conexant_spec *spec = codec->spec; | ||
422 | int i; | ||
423 | |||
424 | for (i = 0; i < spec->num_init_verbs; i++) { | ||
425 | const struct hda_verb *hv; | ||
426 | |||
427 | hv = spec->init_verbs[i]; | ||
428 | while (hv->nid) { | ||
429 | int err = 0; | ||
430 | switch (hv->param ^ AC_USRSP_EN) { | ||
431 | case CONEXANT_HP_EVENT: | ||
432 | err = snd_hda_input_jack_add(codec, hv->nid, | ||
433 | SND_JACK_HEADPHONE, NULL); | ||
434 | snd_hda_input_jack_report(codec, hv->nid); | ||
435 | break; | ||
436 | case CXT5051_PORTC_EVENT: | ||
437 | case CONEXANT_MIC_EVENT: | ||
438 | err = snd_hda_input_jack_add(codec, hv->nid, | ||
439 | SND_JACK_MICROPHONE, NULL); | ||
440 | snd_hda_input_jack_report(codec, hv->nid); | ||
441 | break; | ||
442 | } | ||
443 | if (err < 0) | ||
444 | return err; | ||
445 | ++hv; | ||
446 | } | ||
447 | } | ||
448 | #endif /* CONFIG_SND_HDA_INPUT_JACK */ | ||
449 | return 0; | ||
450 | } | ||
451 | |||
452 | static void conexant_set_power(struct hda_codec *codec, hda_nid_t fg, | 419 | static void conexant_set_power(struct hda_codec *codec, hda_nid_t fg, |
453 | unsigned int power_state) | 420 | unsigned int power_state) |
454 | { | 421 | { |
@@ -474,7 +441,6 @@ static int conexant_init(struct hda_codec *codec) | |||
474 | 441 | ||
475 | static void conexant_free(struct hda_codec *codec) | 442 | static void conexant_free(struct hda_codec *codec) |
476 | { | 443 | { |
477 | snd_hda_input_jack_free(codec); | ||
478 | snd_hda_detach_beep_device(codec); | 444 | snd_hda_detach_beep_device(codec); |
479 | kfree(codec->spec); | 445 | kfree(codec->spec); |
480 | } | 446 | } |
@@ -1120,8 +1086,6 @@ static const char * const cxt5045_models[CXT5045_MODELS] = { | |||
1120 | 1086 | ||
1121 | static const struct snd_pci_quirk cxt5045_cfg_tbl[] = { | 1087 | static const struct snd_pci_quirk cxt5045_cfg_tbl[] = { |
1122 | SND_PCI_QUIRK(0x103c, 0x30d5, "HP 530", CXT5045_LAPTOP_HP530), | 1088 | SND_PCI_QUIRK(0x103c, 0x30d5, "HP 530", CXT5045_LAPTOP_HP530), |
1123 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP DV Series", | ||
1124 | CXT5045_LAPTOP_HPSENSE), | ||
1125 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P105", CXT5045_LAPTOP_MICSENSE), | 1089 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P105", CXT5045_LAPTOP_MICSENSE), |
1126 | SND_PCI_QUIRK(0x152d, 0x0753, "Benq R55E", CXT5045_BENQ), | 1090 | SND_PCI_QUIRK(0x152d, 0x0753, "Benq R55E", CXT5045_BENQ), |
1127 | SND_PCI_QUIRK(0x1734, 0x10ad, "Fujitsu Si1520", CXT5045_LAPTOP_MICSENSE), | 1091 | SND_PCI_QUIRK(0x1734, 0x10ad, "Fujitsu Si1520", CXT5045_LAPTOP_MICSENSE), |
@@ -1750,7 +1714,6 @@ static void cxt5051_hp_automute(struct hda_codec *codec) | |||
1750 | static void cxt5051_hp_unsol_event(struct hda_codec *codec, | 1714 | static void cxt5051_hp_unsol_event(struct hda_codec *codec, |
1751 | unsigned int res) | 1715 | unsigned int res) |
1752 | { | 1716 | { |
1753 | int nid = (res & AC_UNSOL_RES_SUBTAG) >> 20; | ||
1754 | switch (res >> 26) { | 1717 | switch (res >> 26) { |
1755 | case CONEXANT_HP_EVENT: | 1718 | case CONEXANT_HP_EVENT: |
1756 | cxt5051_hp_automute(codec); | 1719 | cxt5051_hp_automute(codec); |
@@ -1762,7 +1725,6 @@ static void cxt5051_hp_unsol_event(struct hda_codec *codec, | |||
1762 | cxt5051_portc_automic(codec); | 1725 | cxt5051_portc_automic(codec); |
1763 | break; | 1726 | break; |
1764 | } | 1727 | } |
1765 | snd_hda_input_jack_report(codec, nid); | ||
1766 | } | 1728 | } |
1767 | 1729 | ||
1768 | static const struct snd_kcontrol_new cxt5051_playback_mixers[] = { | 1730 | static const struct snd_kcontrol_new cxt5051_playback_mixers[] = { |
@@ -1901,8 +1863,6 @@ static void cxt5051_init_mic_port(struct hda_codec *codec, hda_nid_t nid, | |||
1901 | snd_hda_codec_write(codec, nid, 0, | 1863 | snd_hda_codec_write(codec, nid, 0, |
1902 | AC_VERB_SET_UNSOLICITED_ENABLE, | 1864 | AC_VERB_SET_UNSOLICITED_ENABLE, |
1903 | AC_USRSP_EN | event); | 1865 | AC_USRSP_EN | event); |
1904 | snd_hda_input_jack_add(codec, nid, SND_JACK_MICROPHONE, NULL); | ||
1905 | snd_hda_input_jack_report(codec, nid); | ||
1906 | } | 1866 | } |
1907 | 1867 | ||
1908 | static const struct hda_verb cxt5051_ideapad_init_verbs[] = { | 1868 | static const struct hda_verb cxt5051_ideapad_init_verbs[] = { |
@@ -1918,7 +1878,6 @@ static int cxt5051_init(struct hda_codec *codec) | |||
1918 | struct conexant_spec *spec = codec->spec; | 1878 | struct conexant_spec *spec = codec->spec; |
1919 | 1879 | ||
1920 | conexant_init(codec); | 1880 | conexant_init(codec); |
1921 | conexant_init_jacks(codec); | ||
1922 | 1881 | ||
1923 | if (spec->auto_mic & AUTO_MIC_PORTB) | 1882 | if (spec->auto_mic & AUTO_MIC_PORTB) |
1924 | cxt5051_init_mic_port(codec, 0x17, CXT5051_PORTB_EVENT); | 1883 | cxt5051_init_mic_port(codec, 0x17, CXT5051_PORTB_EVENT); |
@@ -3450,7 +3409,6 @@ static int detect_jacks(struct hda_codec *codec, int num_pins, hda_nid_t *pins) | |||
3450 | hda_nid_t nid = pins[i]; | 3409 | hda_nid_t nid = pins[i]; |
3451 | if (!nid || !is_jack_detectable(codec, nid)) | 3410 | if (!nid || !is_jack_detectable(codec, nid)) |
3452 | break; | 3411 | break; |
3453 | snd_hda_input_jack_report(codec, nid); | ||
3454 | present |= snd_hda_jack_detect(codec, nid); | 3412 | present |= snd_hda_jack_detect(codec, nid); |
3455 | } | 3413 | } |
3456 | return present; | 3414 | return present; |
@@ -3755,8 +3713,7 @@ static void cx_auto_automic(struct hda_codec *codec) | |||
3755 | 3713 | ||
3756 | static void cx_auto_unsol_event(struct hda_codec *codec, unsigned int res) | 3714 | static void cx_auto_unsol_event(struct hda_codec *codec, unsigned int res) |
3757 | { | 3715 | { |
3758 | int nid = (res & AC_UNSOL_RES_SUBTAG) >> 20; | 3716 | switch (snd_hda_jack_get_action(codec, res >> 26)) { |
3759 | switch (res >> 26) { | ||
3760 | case CONEXANT_HP_EVENT: | 3717 | case CONEXANT_HP_EVENT: |
3761 | cx_auto_hp_automute(codec); | 3718 | cx_auto_hp_automute(codec); |
3762 | break; | 3719 | break; |
@@ -3765,9 +3722,9 @@ static void cx_auto_unsol_event(struct hda_codec *codec, unsigned int res) | |||
3765 | break; | 3722 | break; |
3766 | case CONEXANT_MIC_EVENT: | 3723 | case CONEXANT_MIC_EVENT: |
3767 | cx_auto_automic(codec); | 3724 | cx_auto_automic(codec); |
3768 | snd_hda_input_jack_report(codec, nid); | ||
3769 | break; | 3725 | break; |
3770 | } | 3726 | } |
3727 | snd_hda_jack_report_sync(codec); | ||
3771 | } | 3728 | } |
3772 | 3729 | ||
3773 | /* check whether the pin config is suitable for auto-mic switching; | 3730 | /* check whether the pin config is suitable for auto-mic switching; |
@@ -3979,13 +3936,11 @@ static void mute_outputs(struct hda_codec *codec, int num_nids, | |||
3979 | } | 3936 | } |
3980 | 3937 | ||
3981 | static void enable_unsol_pins(struct hda_codec *codec, int num_pins, | 3938 | static void enable_unsol_pins(struct hda_codec *codec, int num_pins, |
3982 | hda_nid_t *pins, unsigned int tag) | 3939 | hda_nid_t *pins, unsigned int action) |
3983 | { | 3940 | { |
3984 | int i; | 3941 | int i; |
3985 | for (i = 0; i < num_pins; i++) | 3942 | for (i = 0; i < num_pins; i++) |
3986 | snd_hda_codec_write(codec, pins[i], 0, | 3943 | snd_hda_jack_detect_enable(codec, pins[i], action); |
3987 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
3988 | AC_USRSP_EN | tag); | ||
3989 | } | 3944 | } |
3990 | 3945 | ||
3991 | static void cx_auto_init_output(struct hda_codec *codec) | 3946 | static void cx_auto_init_output(struct hda_codec *codec) |
@@ -4060,16 +4015,14 @@ static void cx_auto_init_input(struct hda_codec *codec) | |||
4060 | 4015 | ||
4061 | if (spec->auto_mic) { | 4016 | if (spec->auto_mic) { |
4062 | if (spec->auto_mic_ext >= 0) { | 4017 | if (spec->auto_mic_ext >= 0) { |
4063 | snd_hda_codec_write(codec, | 4018 | snd_hda_jack_detect_enable(codec, |
4064 | cfg->inputs[spec->auto_mic_ext].pin, 0, | 4019 | cfg->inputs[spec->auto_mic_ext].pin, |
4065 | AC_VERB_SET_UNSOLICITED_ENABLE, | 4020 | CONEXANT_MIC_EVENT); |
4066 | AC_USRSP_EN | CONEXANT_MIC_EVENT); | ||
4067 | } | 4021 | } |
4068 | if (spec->auto_mic_dock >= 0) { | 4022 | if (spec->auto_mic_dock >= 0) { |
4069 | snd_hda_codec_write(codec, | 4023 | snd_hda_jack_detect_enable(codec, |
4070 | cfg->inputs[spec->auto_mic_dock].pin, 0, | 4024 | cfg->inputs[spec->auto_mic_dock].pin, |
4071 | AC_VERB_SET_UNSOLICITED_ENABLE, | 4025 | CONEXANT_MIC_EVENT); |
4072 | AC_USRSP_EN | CONEXANT_MIC_EVENT); | ||
4073 | } | 4026 | } |
4074 | cx_auto_automic(codec); | 4027 | cx_auto_automic(codec); |
4075 | } else { | 4028 | } else { |
@@ -4097,6 +4050,7 @@ static int cx_auto_init(struct hda_codec *codec) | |||
4097 | cx_auto_init_output(codec); | 4050 | cx_auto_init_output(codec); |
4098 | cx_auto_init_input(codec); | 4051 | cx_auto_init_input(codec); |
4099 | cx_auto_init_digital(codec); | 4052 | cx_auto_init_digital(codec); |
4053 | snd_hda_jack_report_sync(codec); | ||
4100 | return 0; | 4054 | return 0; |
4101 | } | 4055 | } |
4102 | 4056 | ||
@@ -4326,6 +4280,7 @@ static int cx_auto_build_input_controls(struct hda_codec *codec) | |||
4326 | 4280 | ||
4327 | static int cx_auto_build_controls(struct hda_codec *codec) | 4281 | static int cx_auto_build_controls(struct hda_codec *codec) |
4328 | { | 4282 | { |
4283 | struct conexant_spec *spec = codec->spec; | ||
4329 | int err; | 4284 | int err; |
4330 | 4285 | ||
4331 | err = cx_auto_build_output_controls(codec); | 4286 | err = cx_auto_build_output_controls(codec); |
@@ -4334,7 +4289,13 @@ static int cx_auto_build_controls(struct hda_codec *codec) | |||
4334 | err = cx_auto_build_input_controls(codec); | 4289 | err = cx_auto_build_input_controls(codec); |
4335 | if (err < 0) | 4290 | if (err < 0) |
4336 | return err; | 4291 | return err; |
4337 | return conexant_build_controls(codec); | 4292 | err = conexant_build_controls(codec); |
4293 | if (err < 0) | ||
4294 | return err; | ||
4295 | err = snd_hda_jack_add_kctls(codec, &spec->autocfg); | ||
4296 | if (err < 0) | ||
4297 | return err; | ||
4298 | return 0; | ||
4338 | } | 4299 | } |
4339 | 4300 | ||
4340 | static int cx_auto_search_adcs(struct hda_codec *codec) | 4301 | static int cx_auto_search_adcs(struct hda_codec *codec) |
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index c505fd5d338c..1168ebd3fb5c 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <sound/jack.h> | 36 | #include <sound/jack.h> |
37 | #include "hda_codec.h" | 37 | #include "hda_codec.h" |
38 | #include "hda_local.h" | 38 | #include "hda_local.h" |
39 | #include "hda_jack.h" | ||
39 | 40 | ||
40 | static bool static_hdmi_pcm; | 41 | static bool static_hdmi_pcm; |
41 | module_param(static_hdmi_pcm, bool, 0644); | 42 | module_param(static_hdmi_pcm, bool, 0644); |
@@ -48,8 +49,8 @@ MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info"); | |||
48 | * | 49 | * |
49 | * The HDA correspondence of pipes/ports are converter/pin nodes. | 50 | * The HDA correspondence of pipes/ports are converter/pin nodes. |
50 | */ | 51 | */ |
51 | #define MAX_HDMI_CVTS 4 | 52 | #define MAX_HDMI_CVTS 8 |
52 | #define MAX_HDMI_PINS 4 | 53 | #define MAX_HDMI_PINS 8 |
53 | 54 | ||
54 | struct hdmi_spec_per_cvt { | 55 | struct hdmi_spec_per_cvt { |
55 | hda_nid_t cvt_nid; | 56 | hda_nid_t cvt_nid; |
@@ -754,10 +755,18 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll); | |||
754 | static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) | 755 | static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) |
755 | { | 756 | { |
756 | struct hdmi_spec *spec = codec->spec; | 757 | struct hdmi_spec *spec = codec->spec; |
757 | int pin_nid = res >> AC_UNSOL_RES_TAG_SHIFT; | 758 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; |
759 | int pin_nid; | ||
758 | int pd = !!(res & AC_UNSOL_RES_PD); | 760 | int pd = !!(res & AC_UNSOL_RES_PD); |
759 | int eldv = !!(res & AC_UNSOL_RES_ELDV); | 761 | int eldv = !!(res & AC_UNSOL_RES_ELDV); |
760 | int pin_idx; | 762 | int pin_idx; |
763 | struct hda_jack_tbl *jack; | ||
764 | |||
765 | jack = snd_hda_jack_tbl_get_from_tag(codec, tag); | ||
766 | if (!jack) | ||
767 | return; | ||
768 | pin_nid = jack->nid; | ||
769 | jack->jack_dirty = 1; | ||
761 | 770 | ||
762 | printk(KERN_INFO | 771 | printk(KERN_INFO |
763 | "HDMI hot plug event: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n", | 772 | "HDMI hot plug event: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n", |
@@ -768,6 +777,7 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) | |||
768 | return; | 777 | return; |
769 | 778 | ||
770 | hdmi_present_sense(&spec->pins[pin_idx], 1); | 779 | hdmi_present_sense(&spec->pins[pin_idx], 1); |
780 | snd_hda_jack_report_sync(codec); | ||
771 | } | 781 | } |
772 | 782 | ||
773 | static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) | 783 | static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) |
@@ -795,11 +805,10 @@ static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) | |||
795 | 805 | ||
796 | static void hdmi_unsol_event(struct hda_codec *codec, unsigned int res) | 806 | static void hdmi_unsol_event(struct hda_codec *codec, unsigned int res) |
797 | { | 807 | { |
798 | struct hdmi_spec *spec = codec->spec; | ||
799 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; | 808 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; |
800 | int subtag = (res & AC_UNSOL_RES_SUBTAG) >> AC_UNSOL_RES_SUBTAG_SHIFT; | 809 | int subtag = (res & AC_UNSOL_RES_SUBTAG) >> AC_UNSOL_RES_SUBTAG_SHIFT; |
801 | 810 | ||
802 | if (pin_nid_to_pin_index(spec, tag) < 0) { | 811 | if (!snd_hda_jack_tbl_get_from_tag(codec, tag)) { |
803 | snd_printd(KERN_INFO "Unexpected HDMI event tag 0x%x\n", tag); | 812 | snd_printd(KERN_INFO "Unexpected HDMI event tag 0x%x\n", tag); |
804 | return; | 813 | return; |
805 | } | 814 | } |
@@ -996,8 +1005,6 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) | |||
996 | msecs_to_jiffies(300)); | 1005 | msecs_to_jiffies(300)); |
997 | } | 1006 | } |
998 | } | 1007 | } |
999 | |||
1000 | snd_hda_input_jack_report(codec, pin_nid); | ||
1001 | } | 1008 | } |
1002 | 1009 | ||
1003 | static void hdmi_repoll_eld(struct work_struct *work) | 1010 | static void hdmi_repoll_eld(struct work_struct *work) |
@@ -1126,12 +1133,12 @@ static int hdmi_parse_codec(struct hda_codec *codec) | |||
1126 | 1133 | ||
1127 | /* | 1134 | /* |
1128 | */ | 1135 | */ |
1129 | static char *generic_hdmi_pcm_names[MAX_HDMI_PINS] = { | 1136 | static char *get_hdmi_pcm_name(int idx) |
1130 | "HDMI 0", | 1137 | { |
1131 | "HDMI 1", | 1138 | static char names[MAX_HDMI_PINS][8]; |
1132 | "HDMI 2", | 1139 | sprintf(&names[idx][0], "HDMI %d", idx); |
1133 | "HDMI 3", | 1140 | return &names[idx][0]; |
1134 | }; | 1141 | } |
1135 | 1142 | ||
1136 | /* | 1143 | /* |
1137 | * HDMI callbacks | 1144 | * HDMI callbacks |
@@ -1209,7 +1216,7 @@ static int generic_hdmi_build_pcms(struct hda_codec *codec) | |||
1209 | struct hda_pcm_stream *pstr; | 1216 | struct hda_pcm_stream *pstr; |
1210 | 1217 | ||
1211 | info = &spec->pcm_rec[pin_idx]; | 1218 | info = &spec->pcm_rec[pin_idx]; |
1212 | info->name = generic_hdmi_pcm_names[pin_idx]; | 1219 | info->name = get_hdmi_pcm_name(pin_idx); |
1213 | info->pcm_type = HDA_PCM_TYPE_HDMI; | 1220 | info->pcm_type = HDA_PCM_TYPE_HDMI; |
1214 | 1221 | ||
1215 | pstr = &info->stream[SNDRV_PCM_STREAM_PLAYBACK]; | 1222 | pstr = &info->stream[SNDRV_PCM_STREAM_PLAYBACK]; |
@@ -1226,21 +1233,15 @@ static int generic_hdmi_build_pcms(struct hda_codec *codec) | |||
1226 | 1233 | ||
1227 | static int generic_hdmi_build_jack(struct hda_codec *codec, int pin_idx) | 1234 | static int generic_hdmi_build_jack(struct hda_codec *codec, int pin_idx) |
1228 | { | 1235 | { |
1229 | int err; | 1236 | char hdmi_str[32] = "HDMI/DP"; |
1230 | char hdmi_str[32]; | ||
1231 | struct hdmi_spec *spec = codec->spec; | 1237 | struct hdmi_spec *spec = codec->spec; |
1232 | struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx]; | 1238 | struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx]; |
1233 | int pcmdev = spec->pcm_rec[pin_idx].device; | 1239 | int pcmdev = spec->pcm_rec[pin_idx].device; |
1234 | 1240 | ||
1235 | snprintf(hdmi_str, sizeof(hdmi_str), "HDMI/DP,pcm=%d", pcmdev); | 1241 | if (pcmdev > 0) |
1236 | 1242 | sprintf(hdmi_str + strlen(hdmi_str), ",pcm=%d", pcmdev); | |
1237 | err = snd_hda_input_jack_add(codec, per_pin->pin_nid, | ||
1238 | SND_JACK_VIDEOOUT, pcmdev > 0 ? hdmi_str : NULL); | ||
1239 | if (err < 0) | ||
1240 | return err; | ||
1241 | 1243 | ||
1242 | hdmi_present_sense(per_pin, 0); | 1244 | return snd_hda_jack_add_kctl(codec, per_pin->pin_nid, hdmi_str, 0); |
1243 | return 0; | ||
1244 | } | 1245 | } |
1245 | 1246 | ||
1246 | static int generic_hdmi_build_controls(struct hda_codec *codec) | 1247 | static int generic_hdmi_build_controls(struct hda_codec *codec) |
@@ -1270,6 +1271,8 @@ static int generic_hdmi_build_controls(struct hda_codec *codec) | |||
1270 | 1271 | ||
1271 | if (err < 0) | 1272 | if (err < 0) |
1272 | return err; | 1273 | return err; |
1274 | |||
1275 | hdmi_present_sense(per_pin, 0); | ||
1273 | } | 1276 | } |
1274 | 1277 | ||
1275 | return 0; | 1278 | return 0; |
@@ -1286,14 +1289,13 @@ static int generic_hdmi_init(struct hda_codec *codec) | |||
1286 | struct hdmi_eld *eld = &per_pin->sink_eld; | 1289 | struct hdmi_eld *eld = &per_pin->sink_eld; |
1287 | 1290 | ||
1288 | hdmi_init_pin(codec, pin_nid); | 1291 | hdmi_init_pin(codec, pin_nid); |
1289 | snd_hda_codec_write(codec, pin_nid, 0, | 1292 | snd_hda_jack_detect_enable(codec, pin_nid, pin_nid); |
1290 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
1291 | AC_USRSP_EN | pin_nid); | ||
1292 | 1293 | ||
1293 | per_pin->codec = codec; | 1294 | per_pin->codec = codec; |
1294 | INIT_DELAYED_WORK(&per_pin->work, hdmi_repoll_eld); | 1295 | INIT_DELAYED_WORK(&per_pin->work, hdmi_repoll_eld); |
1295 | snd_hda_eld_proc_new(codec, eld, pin_idx); | 1296 | snd_hda_eld_proc_new(codec, eld, pin_idx); |
1296 | } | 1297 | } |
1298 | snd_hda_jack_report_sync(codec); | ||
1297 | return 0; | 1299 | return 0; |
1298 | } | 1300 | } |
1299 | 1301 | ||
@@ -1309,7 +1311,6 @@ static void generic_hdmi_free(struct hda_codec *codec) | |||
1309 | cancel_delayed_work(&per_pin->work); | 1311 | cancel_delayed_work(&per_pin->work); |
1310 | snd_hda_eld_proc_free(codec, eld); | 1312 | snd_hda_eld_proc_free(codec, eld); |
1311 | } | 1313 | } |
1312 | snd_hda_input_jack_free(codec); | ||
1313 | 1314 | ||
1314 | flush_workqueue(codec->bus->workq); | 1315 | flush_workqueue(codec->bus->workq); |
1315 | kfree(spec); | 1316 | kfree(spec); |
@@ -1364,7 +1365,7 @@ static int simple_playback_build_pcms(struct hda_codec *codec) | |||
1364 | chans = get_wcaps(codec, spec->cvts[i].cvt_nid); | 1365 | chans = get_wcaps(codec, spec->cvts[i].cvt_nid); |
1365 | chans = get_wcaps_channels(chans); | 1366 | chans = get_wcaps_channels(chans); |
1366 | 1367 | ||
1367 | info->name = generic_hdmi_pcm_names[i]; | 1368 | info->name = get_hdmi_pcm_name(i); |
1368 | info->pcm_type = HDA_PCM_TYPE_HDMI; | 1369 | info->pcm_type = HDA_PCM_TYPE_HDMI; |
1369 | pstr = &info->stream[SNDRV_PCM_STREAM_PLAYBACK]; | 1370 | pstr = &info->stream[SNDRV_PCM_STREAM_PLAYBACK]; |
1370 | snd_BUG_ON(!spec->pcm_playback); | 1371 | snd_BUG_ON(!spec->pcm_playback); |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index cbde019d3d52..5e82acf77c5a 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "hda_codec.h" | 33 | #include "hda_codec.h" |
34 | #include "hda_local.h" | 34 | #include "hda_local.h" |
35 | #include "hda_beep.h" | 35 | #include "hda_beep.h" |
36 | #include "hda_jack.h" | ||
36 | 37 | ||
37 | /* unsol event tags */ | 38 | /* unsol event tags */ |
38 | #define ALC_FRONT_EVENT 0x01 | 39 | #define ALC_FRONT_EVENT 0x01 |
@@ -183,6 +184,8 @@ struct alc_spec { | |||
183 | unsigned int single_input_src:1; | 184 | unsigned int single_input_src:1; |
184 | unsigned int vol_in_capsrc:1; /* use capsrc volume (ADC has no vol) */ | 185 | unsigned int vol_in_capsrc:1; /* use capsrc volume (ADC has no vol) */ |
185 | unsigned int parse_flags; /* passed to snd_hda_parse_pin_defcfg() */ | 186 | unsigned int parse_flags; /* passed to snd_hda_parse_pin_defcfg() */ |
187 | unsigned int shared_mic_hp:1; /* HP/Mic-in sharing */ | ||
188 | unsigned int use_jack_tbl:1; /* 1 for model=auto */ | ||
186 | 189 | ||
187 | /* auto-mute control */ | 190 | /* auto-mute control */ |
188 | int automute_mode; | 191 | int automute_mode; |
@@ -283,6 +286,8 @@ static inline hda_nid_t get_capsrc(struct alc_spec *spec, int idx) | |||
283 | spec->capsrc_nids[idx] : spec->adc_nids[idx]; | 286 | spec->capsrc_nids[idx] : spec->adc_nids[idx]; |
284 | } | 287 | } |
285 | 288 | ||
289 | static void call_update_outputs(struct hda_codec *codec); | ||
290 | |||
286 | /* select the given imux item; either unmute exclusively or select the route */ | 291 | /* select the given imux item; either unmute exclusively or select the route */ |
287 | static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, | 292 | static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, |
288 | unsigned int idx, bool force) | 293 | unsigned int idx, bool force) |
@@ -297,6 +302,8 @@ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, | |||
297 | imux = &spec->input_mux[mux_idx]; | 302 | imux = &spec->input_mux[mux_idx]; |
298 | if (!imux->num_items && mux_idx > 0) | 303 | if (!imux->num_items && mux_idx > 0) |
299 | imux = &spec->input_mux[0]; | 304 | imux = &spec->input_mux[0]; |
305 | if (!imux->num_items) | ||
306 | return 0; | ||
300 | 307 | ||
301 | if (idx >= imux->num_items) | 308 | if (idx >= imux->num_items) |
302 | idx = imux->num_items - 1; | 309 | idx = imux->num_items - 1; |
@@ -304,6 +311,19 @@ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, | |||
304 | return 0; | 311 | return 0; |
305 | spec->cur_mux[adc_idx] = idx; | 312 | spec->cur_mux[adc_idx] = idx; |
306 | 313 | ||
314 | /* for shared I/O, change the pin-control accordingly */ | ||
315 | if (spec->shared_mic_hp) { | ||
316 | /* NOTE: this assumes that there are only two inputs, the | ||
317 | * first is the real internal mic and the second is HP jack. | ||
318 | */ | ||
319 | snd_hda_codec_write(codec, spec->autocfg.inputs[1].pin, 0, | ||
320 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
321 | spec->cur_mux[adc_idx] ? | ||
322 | PIN_VREF80 : PIN_HP); | ||
323 | spec->automute_speaker = !spec->cur_mux[adc_idx]; | ||
324 | call_update_outputs(codec); | ||
325 | } | ||
326 | |||
307 | if (spec->dyn_adc_switch) { | 327 | if (spec->dyn_adc_switch) { |
308 | alc_dyn_adc_pcm_resetup(codec, idx); | 328 | alc_dyn_adc_pcm_resetup(codec, idx); |
309 | adc_idx = spec->dyn_adc_idx[idx]; | 329 | adc_idx = spec->dyn_adc_idx[idx]; |
@@ -448,46 +468,6 @@ static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, | |||
448 | } | 468 | } |
449 | 469 | ||
450 | /* | 470 | /* |
451 | * Jack-reporting via input-jack layer | ||
452 | */ | ||
453 | |||
454 | /* initialization of jacks; currently checks only a few known pins */ | ||
455 | static int alc_init_jacks(struct hda_codec *codec) | ||
456 | { | ||
457 | #ifdef CONFIG_SND_HDA_INPUT_JACK | ||
458 | struct alc_spec *spec = codec->spec; | ||
459 | int err; | ||
460 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; | ||
461 | unsigned int mic_nid = spec->ext_mic_pin; | ||
462 | unsigned int dock_nid = spec->dock_mic_pin; | ||
463 | |||
464 | if (hp_nid) { | ||
465 | err = snd_hda_input_jack_add(codec, hp_nid, | ||
466 | SND_JACK_HEADPHONE, NULL); | ||
467 | if (err < 0) | ||
468 | return err; | ||
469 | snd_hda_input_jack_report(codec, hp_nid); | ||
470 | } | ||
471 | |||
472 | if (mic_nid) { | ||
473 | err = snd_hda_input_jack_add(codec, mic_nid, | ||
474 | SND_JACK_MICROPHONE, NULL); | ||
475 | if (err < 0) | ||
476 | return err; | ||
477 | snd_hda_input_jack_report(codec, mic_nid); | ||
478 | } | ||
479 | if (dock_nid) { | ||
480 | err = snd_hda_input_jack_add(codec, dock_nid, | ||
481 | SND_JACK_MICROPHONE, NULL); | ||
482 | if (err < 0) | ||
483 | return err; | ||
484 | snd_hda_input_jack_report(codec, dock_nid); | ||
485 | } | ||
486 | #endif /* CONFIG_SND_HDA_INPUT_JACK */ | ||
487 | return 0; | ||
488 | } | ||
489 | |||
490 | /* | ||
491 | * Jack detections for HP auto-mute and mic-switch | 471 | * Jack detections for HP auto-mute and mic-switch |
492 | */ | 472 | */ |
493 | 473 | ||
@@ -500,7 +480,6 @@ static bool detect_jacks(struct hda_codec *codec, int num_pins, hda_nid_t *pins) | |||
500 | hda_nid_t nid = pins[i]; | 480 | hda_nid_t nid = pins[i]; |
501 | if (!nid) | 481 | if (!nid) |
502 | break; | 482 | break; |
503 | snd_hda_input_jack_report(codec, nid); | ||
504 | present |= snd_hda_jack_detect(codec, nid); | 483 | present |= snd_hda_jack_detect(codec, nid); |
505 | } | 484 | } |
506 | return present; | 485 | return present; |
@@ -552,7 +531,8 @@ static void update_outputs(struct hda_codec *codec) | |||
552 | * in general, HP pins/amps control should be enabled in all cases, | 531 | * in general, HP pins/amps control should be enabled in all cases, |
553 | * but currently set only for master_mute, just to be safe | 532 | * but currently set only for master_mute, just to be safe |
554 | */ | 533 | */ |
555 | do_automute(codec, ARRAY_SIZE(spec->autocfg.hp_pins), | 534 | if (!spec->shared_mic_hp) /* don't change HP-pin when shared with mic */ |
535 | do_automute(codec, ARRAY_SIZE(spec->autocfg.hp_pins), | ||
556 | spec->autocfg.hp_pins, spec->master_mute, true); | 536 | spec->autocfg.hp_pins, spec->master_mute, true); |
557 | 537 | ||
558 | if (!spec->automute_speaker) | 538 | if (!spec->automute_speaker) |
@@ -639,19 +619,18 @@ static void alc_mic_automute(struct hda_codec *codec) | |||
639 | alc_mux_select(codec, 0, spec->dock_mic_idx, false); | 619 | alc_mux_select(codec, 0, spec->dock_mic_idx, false); |
640 | else | 620 | else |
641 | alc_mux_select(codec, 0, spec->int_mic_idx, false); | 621 | alc_mux_select(codec, 0, spec->int_mic_idx, false); |
642 | |||
643 | snd_hda_input_jack_report(codec, pins[spec->ext_mic_idx]); | ||
644 | if (spec->dock_mic_idx >= 0) | ||
645 | snd_hda_input_jack_report(codec, pins[spec->dock_mic_idx]); | ||
646 | } | 622 | } |
647 | 623 | ||
648 | /* unsolicited event for HP jack sensing */ | 624 | /* unsolicited event for HP jack sensing */ |
649 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) | 625 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
650 | { | 626 | { |
627 | struct alc_spec *spec = codec->spec; | ||
651 | if (codec->vendor_id == 0x10ec0880) | 628 | if (codec->vendor_id == 0x10ec0880) |
652 | res >>= 28; | 629 | res >>= 28; |
653 | else | 630 | else |
654 | res >>= 26; | 631 | res >>= 26; |
632 | if (spec->use_jack_tbl) | ||
633 | res = snd_hda_jack_get_action(codec, res); | ||
655 | switch (res) { | 634 | switch (res) { |
656 | case ALC_HP_EVENT: | 635 | case ALC_HP_EVENT: |
657 | alc_hp_automute(codec); | 636 | alc_hp_automute(codec); |
@@ -663,6 +642,7 @@ static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) | |||
663 | alc_mic_automute(codec); | 642 | alc_mic_automute(codec); |
664 | break; | 643 | break; |
665 | } | 644 | } |
645 | snd_hda_jack_report_sync(codec); | ||
666 | } | 646 | } |
667 | 647 | ||
668 | /* call init functions of standard auto-mute helpers */ | 648 | /* call init functions of standard auto-mute helpers */ |
@@ -952,9 +932,7 @@ static void alc_init_automute(struct hda_codec *codec) | |||
952 | continue; | 932 | continue; |
953 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", | 933 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
954 | nid); | 934 | nid); |
955 | snd_hda_codec_write_cache(codec, nid, 0, | 935 | snd_hda_jack_detect_enable(codec, nid, ALC_HP_EVENT); |
956 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
957 | AC_USRSP_EN | ALC_HP_EVENT); | ||
958 | spec->detect_hp = 1; | 936 | spec->detect_hp = 1; |
959 | } | 937 | } |
960 | 938 | ||
@@ -966,9 +944,8 @@ static void alc_init_automute(struct hda_codec *codec) | |||
966 | continue; | 944 | continue; |
967 | snd_printdd("realtek: Enable Line-Out " | 945 | snd_printdd("realtek: Enable Line-Out " |
968 | "auto-muting on NID 0x%x\n", nid); | 946 | "auto-muting on NID 0x%x\n", nid); |
969 | snd_hda_codec_write_cache(codec, nid, 0, | 947 | snd_hda_jack_detect_enable(codec, nid, |
970 | AC_VERB_SET_UNSOLICITED_ENABLE, | 948 | ALC_FRONT_EVENT); |
971 | AC_USRSP_EN | ALC_FRONT_EVENT); | ||
972 | spec->detect_lo = 1; | 949 | spec->detect_lo = 1; |
973 | } | 950 | } |
974 | spec->automute_lo_possible = spec->detect_hp; | 951 | spec->automute_lo_possible = spec->detect_hp; |
@@ -1107,13 +1084,10 @@ static bool alc_auto_mic_check_imux(struct hda_codec *codec) | |||
1107 | return false; /* no corresponding imux */ | 1084 | return false; /* no corresponding imux */ |
1108 | } | 1085 | } |
1109 | 1086 | ||
1110 | snd_hda_codec_write_cache(codec, spec->ext_mic_pin, 0, | 1087 | snd_hda_jack_detect_enable(codec, spec->ext_mic_pin, ALC_MIC_EVENT); |
1111 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
1112 | AC_USRSP_EN | ALC_MIC_EVENT); | ||
1113 | if (spec->dock_mic_pin) | 1088 | if (spec->dock_mic_pin) |
1114 | snd_hda_codec_write_cache(codec, spec->dock_mic_pin, 0, | 1089 | snd_hda_jack_detect_enable(codec, spec->dock_mic_pin, |
1115 | AC_VERB_SET_UNSOLICITED_ENABLE, | 1090 | ALC_MIC_EVENT); |
1116 | AC_USRSP_EN | ALC_MIC_EVENT); | ||
1117 | 1091 | ||
1118 | spec->auto_mic_valid_imux = 1; | 1092 | spec->auto_mic_valid_imux = 1; |
1119 | spec->auto_mic = 1; | 1093 | spec->auto_mic = 1; |
@@ -1131,6 +1105,9 @@ static void alc_init_auto_mic(struct hda_codec *codec) | |||
1131 | hda_nid_t fixed, ext, dock; | 1105 | hda_nid_t fixed, ext, dock; |
1132 | int i; | 1106 | int i; |
1133 | 1107 | ||
1108 | if (spec->shared_mic_hp) | ||
1109 | return; /* no auto-mic for the shared I/O */ | ||
1110 | |||
1134 | spec->ext_mic_idx = spec->int_mic_idx = spec->dock_mic_idx = -1; | 1111 | spec->ext_mic_idx = spec->int_mic_idx = spec->dock_mic_idx = -1; |
1135 | 1112 | ||
1136 | fixed = ext = dock = 0; | 1113 | fixed = ext = dock = 0; |
@@ -1522,6 +1499,7 @@ static void alc_pick_fixup(struct hda_codec *codec, | |||
1522 | const struct alc_fixup *fixlist) | 1499 | const struct alc_fixup *fixlist) |
1523 | { | 1500 | { |
1524 | struct alc_spec *spec = codec->spec; | 1501 | struct alc_spec *spec = codec->spec; |
1502 | const struct snd_pci_quirk *q; | ||
1525 | int id = -1; | 1503 | int id = -1; |
1526 | const char *name = NULL; | 1504 | const char *name = NULL; |
1527 | 1505 | ||
@@ -1536,12 +1514,25 @@ static void alc_pick_fixup(struct hda_codec *codec, | |||
1536 | } | 1514 | } |
1537 | } | 1515 | } |
1538 | if (id < 0) { | 1516 | if (id < 0) { |
1539 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); | 1517 | q = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
1540 | if (quirk) { | 1518 | if (q) { |
1541 | id = quirk->value; | 1519 | id = q->value; |
1520 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
1521 | name = q->name; | ||
1522 | #endif | ||
1523 | } | ||
1524 | } | ||
1525 | if (id < 0) { | ||
1526 | for (q = quirk; q->subvendor; q++) { | ||
1527 | unsigned int vendorid = | ||
1528 | q->subdevice | (q->subvendor << 16); | ||
1529 | if (vendorid == codec->subsystem_id) { | ||
1530 | id = q->value; | ||
1542 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 1531 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
1543 | name = quirk->name; | 1532 | name = q->name; |
1544 | #endif | 1533 | #endif |
1534 | break; | ||
1535 | } | ||
1545 | } | 1536 | } |
1546 | } | 1537 | } |
1547 | 1538 | ||
@@ -2038,6 +2029,10 @@ static int alc_build_controls(struct hda_codec *codec) | |||
2038 | 2029 | ||
2039 | alc_free_kctls(codec); /* no longer needed */ | 2030 | alc_free_kctls(codec); /* no longer needed */ |
2040 | 2031 | ||
2032 | err = snd_hda_jack_add_kctls(codec, &spec->autocfg); | ||
2033 | if (err < 0) | ||
2034 | return err; | ||
2035 | |||
2041 | return 0; | 2036 | return 0; |
2042 | } | 2037 | } |
2043 | 2038 | ||
@@ -2065,6 +2060,8 @@ static int alc_init(struct hda_codec *codec) | |||
2065 | 2060 | ||
2066 | alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT); | 2061 | alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT); |
2067 | 2062 | ||
2063 | snd_hda_jack_report_sync(codec); | ||
2064 | |||
2068 | hda_call_check_power_status(codec, 0x01); | 2065 | hda_call_check_power_status(codec, 0x01); |
2069 | return 0; | 2066 | return 0; |
2070 | } | 2067 | } |
@@ -2448,7 +2445,6 @@ static void alc_free(struct hda_codec *codec) | |||
2448 | return; | 2445 | return; |
2449 | 2446 | ||
2450 | alc_shutup(codec); | 2447 | alc_shutup(codec); |
2451 | snd_hda_input_jack_free(codec); | ||
2452 | alc_free_kctls(codec); | 2448 | alc_free_kctls(codec); |
2453 | alc_free_bind_ctls(codec); | 2449 | alc_free_bind_ctls(codec); |
2454 | kfree(spec); | 2450 | kfree(spec); |
@@ -2629,6 +2625,8 @@ static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch, | |||
2629 | case AUTO_PIN_SPEAKER_OUT: | 2625 | case AUTO_PIN_SPEAKER_OUT: |
2630 | if (cfg->line_outs == 1) | 2626 | if (cfg->line_outs == 1) |
2631 | return "Speaker"; | 2627 | return "Speaker"; |
2628 | if (cfg->line_outs == 2) | ||
2629 | return ch ? "Bass Speaker" : "Speaker"; | ||
2632 | break; | 2630 | break; |
2633 | case AUTO_PIN_HP_OUT: | 2631 | case AUTO_PIN_HP_OUT: |
2634 | /* for multi-io case, only the primary out */ | 2632 | /* for multi-io case, only the primary out */ |
@@ -2681,6 +2679,9 @@ static int alc_auto_fill_adc_caps(struct hda_codec *codec) | |||
2681 | int max_nums = ARRAY_SIZE(spec->private_adc_nids); | 2679 | int max_nums = ARRAY_SIZE(spec->private_adc_nids); |
2682 | int i, nums = 0; | 2680 | int i, nums = 0; |
2683 | 2681 | ||
2682 | if (spec->shared_mic_hp) | ||
2683 | max_nums = 1; /* no multi streams with the shared HP/mic */ | ||
2684 | |||
2684 | nid = codec->start_nid; | 2685 | nid = codec->start_nid; |
2685 | for (i = 0; i < codec->num_nodes; i++, nid++) { | 2686 | for (i = 0; i < codec->num_nodes; i++, nid++) { |
2686 | hda_nid_t src; | 2687 | hda_nid_t src; |
@@ -2743,6 +2744,8 @@ static int alc_auto_create_input_ctls(struct hda_codec *codec) | |||
2743 | continue; | 2744 | continue; |
2744 | 2745 | ||
2745 | label = hda_get_autocfg_input_label(codec, cfg, i); | 2746 | label = hda_get_autocfg_input_label(codec, cfg, i); |
2747 | if (spec->shared_mic_hp && !strcmp(label, "Misc")) | ||
2748 | label = "Headphone Mic"; | ||
2746 | if (prev_label && !strcmp(label, prev_label)) | 2749 | if (prev_label && !strcmp(label, prev_label)) |
2747 | type_idx++; | 2750 | type_idx++; |
2748 | else | 2751 | else |
@@ -2777,6 +2780,39 @@ static int alc_auto_create_input_ctls(struct hda_codec *codec) | |||
2777 | return 0; | 2780 | return 0; |
2778 | } | 2781 | } |
2779 | 2782 | ||
2783 | /* create a shared input with the headphone out */ | ||
2784 | static int alc_auto_create_shared_input(struct hda_codec *codec) | ||
2785 | { | ||
2786 | struct alc_spec *spec = codec->spec; | ||
2787 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
2788 | unsigned int defcfg; | ||
2789 | hda_nid_t nid; | ||
2790 | |||
2791 | /* only one internal input pin? */ | ||
2792 | if (cfg->num_inputs != 1) | ||
2793 | return 0; | ||
2794 | defcfg = snd_hda_codec_get_pincfg(codec, cfg->inputs[0].pin); | ||
2795 | if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT) | ||
2796 | return 0; | ||
2797 | |||
2798 | if (cfg->hp_outs == 1 && cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
2799 | nid = cfg->hp_pins[0]; /* OK, we have a single HP-out */ | ||
2800 | else if (cfg->line_outs == 1 && cfg->line_out_type == AUTO_PIN_HP_OUT) | ||
2801 | nid = cfg->line_out_pins[0]; /* OK, we have a single line-out */ | ||
2802 | else | ||
2803 | return 0; /* both not available */ | ||
2804 | |||
2805 | if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_IN)) | ||
2806 | return 0; /* no input */ | ||
2807 | |||
2808 | cfg->inputs[1].pin = nid; | ||
2809 | cfg->inputs[1].type = AUTO_PIN_MIC; | ||
2810 | cfg->num_inputs = 2; | ||
2811 | spec->shared_mic_hp = 1; | ||
2812 | snd_printdd("realtek: Enable shared I/O jack on NID 0x%x\n", nid); | ||
2813 | return 0; | ||
2814 | } | ||
2815 | |||
2780 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, | 2816 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
2781 | unsigned int pin_type) | 2817 | unsigned int pin_type) |
2782 | { | 2818 | { |
@@ -2902,7 +2938,7 @@ static hda_nid_t alc_auto_look_for_dac(struct hda_codec *codec, hda_nid_t pin) | |||
2902 | if (!nid) | 2938 | if (!nid) |
2903 | continue; | 2939 | continue; |
2904 | if (found_in_nid_list(nid, spec->multiout.dac_nids, | 2940 | if (found_in_nid_list(nid, spec->multiout.dac_nids, |
2905 | spec->multiout.num_dacs)) | 2941 | ARRAY_SIZE(spec->private_dac_nids))) |
2906 | continue; | 2942 | continue; |
2907 | if (found_in_nid_list(nid, spec->multiout.hp_out_nid, | 2943 | if (found_in_nid_list(nid, spec->multiout.hp_out_nid, |
2908 | ARRAY_SIZE(spec->multiout.hp_out_nid))) | 2944 | ARRAY_SIZE(spec->multiout.hp_out_nid))) |
@@ -2915,6 +2951,23 @@ static hda_nid_t alc_auto_look_for_dac(struct hda_codec *codec, hda_nid_t pin) | |||
2915 | return 0; | 2951 | return 0; |
2916 | } | 2952 | } |
2917 | 2953 | ||
2954 | /* check whether the DAC is reachable from the pin */ | ||
2955 | static bool alc_auto_is_dac_reachable(struct hda_codec *codec, | ||
2956 | hda_nid_t pin, hda_nid_t dac) | ||
2957 | { | ||
2958 | hda_nid_t srcs[5]; | ||
2959 | int i, num; | ||
2960 | |||
2961 | pin = alc_go_down_to_selector(codec, pin); | ||
2962 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); | ||
2963 | for (i = 0; i < num; i++) { | ||
2964 | hda_nid_t nid = alc_auto_mix_to_dac(codec, srcs[i]); | ||
2965 | if (nid == dac) | ||
2966 | return true; | ||
2967 | } | ||
2968 | return false; | ||
2969 | } | ||
2970 | |||
2918 | static hda_nid_t get_dac_if_single(struct hda_codec *codec, hda_nid_t pin) | 2971 | static hda_nid_t get_dac_if_single(struct hda_codec *codec, hda_nid_t pin) |
2919 | { | 2972 | { |
2920 | hda_nid_t sel = alc_go_down_to_selector(codec, pin); | 2973 | hda_nid_t sel = alc_go_down_to_selector(codec, pin); |
@@ -2923,6 +2976,7 @@ static hda_nid_t get_dac_if_single(struct hda_codec *codec, hda_nid_t pin) | |||
2923 | return 0; | 2976 | return 0; |
2924 | } | 2977 | } |
2925 | 2978 | ||
2979 | /* return 0 if no possible DAC is found, 1 if one or more found */ | ||
2926 | static int alc_auto_fill_extra_dacs(struct hda_codec *codec, int num_outs, | 2980 | static int alc_auto_fill_extra_dacs(struct hda_codec *codec, int num_outs, |
2927 | const hda_nid_t *pins, hda_nid_t *dacs) | 2981 | const hda_nid_t *pins, hda_nid_t *dacs) |
2928 | { | 2982 | { |
@@ -2940,17 +2994,21 @@ static int alc_auto_fill_extra_dacs(struct hda_codec *codec, int num_outs, | |||
2940 | if (!dacs[i]) | 2994 | if (!dacs[i]) |
2941 | dacs[i] = alc_auto_look_for_dac(codec, pins[i]); | 2995 | dacs[i] = alc_auto_look_for_dac(codec, pins[i]); |
2942 | } | 2996 | } |
2943 | return 0; | 2997 | return 1; |
2944 | } | 2998 | } |
2945 | 2999 | ||
2946 | static int alc_auto_fill_multi_ios(struct hda_codec *codec, | 3000 | static int alc_auto_fill_multi_ios(struct hda_codec *codec, |
2947 | unsigned int location); | 3001 | unsigned int location, int offset); |
3002 | static hda_nid_t alc_look_for_out_vol_nid(struct hda_codec *codec, | ||
3003 | hda_nid_t pin, hda_nid_t dac); | ||
2948 | 3004 | ||
2949 | /* fill in the dac_nids table from the parsed pin configuration */ | 3005 | /* fill in the dac_nids table from the parsed pin configuration */ |
2950 | static int alc_auto_fill_dac_nids(struct hda_codec *codec) | 3006 | static int alc_auto_fill_dac_nids(struct hda_codec *codec) |
2951 | { | 3007 | { |
2952 | struct alc_spec *spec = codec->spec; | 3008 | struct alc_spec *spec = codec->spec; |
2953 | const struct auto_pin_cfg *cfg = &spec->autocfg; | 3009 | struct auto_pin_cfg *cfg = &spec->autocfg; |
3010 | unsigned int location, defcfg; | ||
3011 | int num_pins; | ||
2954 | bool redone = false; | 3012 | bool redone = false; |
2955 | int i; | 3013 | int i; |
2956 | 3014 | ||
@@ -2961,6 +3019,7 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec) | |||
2961 | spec->multiout.extra_out_nid[0] = 0; | 3019 | spec->multiout.extra_out_nid[0] = 0; |
2962 | memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids)); | 3020 | memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids)); |
2963 | spec->multiout.dac_nids = spec->private_dac_nids; | 3021 | spec->multiout.dac_nids = spec->private_dac_nids; |
3022 | spec->multi_ios = 0; | ||
2964 | 3023 | ||
2965 | /* fill hard-wired DACs first */ | 3024 | /* fill hard-wired DACs first */ |
2966 | if (!redone) { | 3025 | if (!redone) { |
@@ -2994,21 +3053,20 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec) | |||
2994 | for (i = 0; i < cfg->line_outs; i++) { | 3053 | for (i = 0; i < cfg->line_outs; i++) { |
2995 | if (spec->private_dac_nids[i]) | 3054 | if (spec->private_dac_nids[i]) |
2996 | spec->multiout.num_dacs++; | 3055 | spec->multiout.num_dacs++; |
2997 | else | 3056 | else { |
2998 | memmove(spec->private_dac_nids + i, | 3057 | memmove(spec->private_dac_nids + i, |
2999 | spec->private_dac_nids + i + 1, | 3058 | spec->private_dac_nids + i + 1, |
3000 | sizeof(hda_nid_t) * (cfg->line_outs - i - 1)); | 3059 | sizeof(hda_nid_t) * (cfg->line_outs - i - 1)); |
3060 | spec->private_dac_nids[cfg->line_outs - 1] = 0; | ||
3061 | } | ||
3001 | } | 3062 | } |
3002 | 3063 | ||
3003 | if (cfg->line_outs == 1 && cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { | 3064 | if (cfg->line_outs == 1 && cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
3004 | /* try to fill multi-io first */ | 3065 | /* try to fill multi-io first */ |
3005 | unsigned int location, defcfg; | ||
3006 | int num_pins; | ||
3007 | |||
3008 | defcfg = snd_hda_codec_get_pincfg(codec, cfg->line_out_pins[0]); | 3066 | defcfg = snd_hda_codec_get_pincfg(codec, cfg->line_out_pins[0]); |
3009 | location = get_defcfg_location(defcfg); | 3067 | location = get_defcfg_location(defcfg); |
3010 | 3068 | ||
3011 | num_pins = alc_auto_fill_multi_ios(codec, location); | 3069 | num_pins = alc_auto_fill_multi_ios(codec, location, 0); |
3012 | if (num_pins > 0) { | 3070 | if (num_pins > 0) { |
3013 | spec->multi_ios = num_pins; | 3071 | spec->multi_ios = num_pins; |
3014 | spec->ext_channel_count = 2; | 3072 | spec->ext_channel_count = 2; |
@@ -3019,10 +3077,48 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec) | |||
3019 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) | 3077 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) |
3020 | alc_auto_fill_extra_dacs(codec, cfg->hp_outs, cfg->hp_pins, | 3078 | alc_auto_fill_extra_dacs(codec, cfg->hp_outs, cfg->hp_pins, |
3021 | spec->multiout.hp_out_nid); | 3079 | spec->multiout.hp_out_nid); |
3022 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) | 3080 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
3023 | alc_auto_fill_extra_dacs(codec, cfg->speaker_outs, cfg->speaker_pins, | 3081 | int err = alc_auto_fill_extra_dacs(codec, cfg->speaker_outs, |
3024 | spec->multiout.extra_out_nid); | 3082 | cfg->speaker_pins, |
3083 | spec->multiout.extra_out_nid); | ||
3084 | /* if no speaker volume is assigned, try again as the primary | ||
3085 | * output | ||
3086 | */ | ||
3087 | if (!err && cfg->speaker_outs > 0 && | ||
3088 | cfg->line_out_type == AUTO_PIN_HP_OUT) { | ||
3089 | cfg->hp_outs = cfg->line_outs; | ||
3090 | memcpy(cfg->hp_pins, cfg->line_out_pins, | ||
3091 | sizeof(cfg->hp_pins)); | ||
3092 | cfg->line_outs = cfg->speaker_outs; | ||
3093 | memcpy(cfg->line_out_pins, cfg->speaker_pins, | ||
3094 | sizeof(cfg->speaker_pins)); | ||
3095 | cfg->speaker_outs = 0; | ||
3096 | memset(cfg->speaker_pins, 0, sizeof(cfg->speaker_pins)); | ||
3097 | cfg->line_out_type = AUTO_PIN_SPEAKER_OUT; | ||
3098 | redone = false; | ||
3099 | goto again; | ||
3100 | } | ||
3101 | } | ||
3102 | |||
3103 | if (!spec->multi_ios && | ||
3104 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT && | ||
3105 | cfg->hp_outs) { | ||
3106 | /* try multi-ios with HP + inputs */ | ||
3107 | defcfg = snd_hda_codec_get_pincfg(codec, cfg->hp_pins[0]); | ||
3108 | location = get_defcfg_location(defcfg); | ||
3025 | 3109 | ||
3110 | num_pins = alc_auto_fill_multi_ios(codec, location, 1); | ||
3111 | if (num_pins > 0) { | ||
3112 | spec->multi_ios = num_pins; | ||
3113 | spec->ext_channel_count = 2; | ||
3114 | spec->multiout.num_dacs = num_pins + 1; | ||
3115 | } | ||
3116 | } | ||
3117 | |||
3118 | if (cfg->line_out_pins[0]) | ||
3119 | spec->vmaster_nid = | ||
3120 | alc_look_for_out_vol_nid(codec, cfg->line_out_pins[0], | ||
3121 | spec->multiout.dac_nids[0]); | ||
3026 | return 0; | 3122 | return 0; |
3027 | } | 3123 | } |
3028 | 3124 | ||
@@ -3054,8 +3150,15 @@ static int alc_auto_add_vol_ctl(struct hda_codec *codec, | |||
3054 | val); | 3150 | val); |
3055 | } | 3151 | } |
3056 | 3152 | ||
3057 | #define alc_auto_add_stereo_vol(codec, pfx, cidx, nid) \ | 3153 | static int alc_auto_add_stereo_vol(struct hda_codec *codec, |
3058 | alc_auto_add_vol_ctl(codec, pfx, cidx, nid, 3) | 3154 | const char *pfx, int cidx, |
3155 | hda_nid_t nid) | ||
3156 | { | ||
3157 | int chs = 1; | ||
3158 | if (get_wcaps(codec, nid) & AC_WCAP_STEREO) | ||
3159 | chs = 3; | ||
3160 | return alc_auto_add_vol_ctl(codec, pfx, cidx, nid, chs); | ||
3161 | } | ||
3059 | 3162 | ||
3060 | /* create a mute-switch for the given mixer widget; | 3163 | /* create a mute-switch for the given mixer widget; |
3061 | * if it has multiple sources (e.g. DAC and loopback), create a bind-mute | 3164 | * if it has multiple sources (e.g. DAC and loopback), create a bind-mute |
@@ -3087,8 +3190,14 @@ static int alc_auto_add_sw_ctl(struct hda_codec *codec, | |||
3087 | return __add_pb_sw_ctrl(codec->spec, type, pfx, cidx, val); | 3190 | return __add_pb_sw_ctrl(codec->spec, type, pfx, cidx, val); |
3088 | } | 3191 | } |
3089 | 3192 | ||
3090 | #define alc_auto_add_stereo_sw(codec, pfx, cidx, nid) \ | 3193 | static int alc_auto_add_stereo_sw(struct hda_codec *codec, const char *pfx, |
3091 | alc_auto_add_sw_ctl(codec, pfx, cidx, nid, 3) | 3194 | int cidx, hda_nid_t nid) |
3195 | { | ||
3196 | int chs = 1; | ||
3197 | if (get_wcaps(codec, nid) & AC_WCAP_STEREO) | ||
3198 | chs = 3; | ||
3199 | return alc_auto_add_sw_ctl(codec, pfx, cidx, nid, chs); | ||
3200 | } | ||
3092 | 3201 | ||
3093 | static hda_nid_t alc_look_for_out_mute_nid(struct hda_codec *codec, | 3202 | static hda_nid_t alc_look_for_out_mute_nid(struct hda_codec *codec, |
3094 | hda_nid_t pin, hda_nid_t dac) | 3203 | hda_nid_t pin, hda_nid_t dac) |
@@ -3171,7 +3280,8 @@ static int alc_auto_create_multi_out_ctls(struct hda_codec *codec, | |||
3171 | } | 3280 | } |
3172 | 3281 | ||
3173 | static int alc_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, | 3282 | static int alc_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, |
3174 | hda_nid_t dac, const char *pfx) | 3283 | hda_nid_t dac, const char *pfx, |
3284 | int cidx) | ||
3175 | { | 3285 | { |
3176 | struct alc_spec *spec = codec->spec; | 3286 | struct alc_spec *spec = codec->spec; |
3177 | hda_nid_t sw, vol; | 3287 | hda_nid_t sw, vol; |
@@ -3187,15 +3297,15 @@ static int alc_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, | |||
3187 | if (is_ctl_used(spec->sw_ctls, val)) | 3297 | if (is_ctl_used(spec->sw_ctls, val)) |
3188 | return 0; /* already created */ | 3298 | return 0; /* already created */ |
3189 | mark_ctl_usage(spec->sw_ctls, val); | 3299 | mark_ctl_usage(spec->sw_ctls, val); |
3190 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val); | 3300 | return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, cidx, val); |
3191 | } | 3301 | } |
3192 | 3302 | ||
3193 | sw = alc_look_for_out_mute_nid(codec, pin, dac); | 3303 | sw = alc_look_for_out_mute_nid(codec, pin, dac); |
3194 | vol = alc_look_for_out_vol_nid(codec, pin, dac); | 3304 | vol = alc_look_for_out_vol_nid(codec, pin, dac); |
3195 | err = alc_auto_add_stereo_vol(codec, pfx, 0, vol); | 3305 | err = alc_auto_add_stereo_vol(codec, pfx, cidx, vol); |
3196 | if (err < 0) | 3306 | if (err < 0) |
3197 | return err; | 3307 | return err; |
3198 | err = alc_auto_add_stereo_sw(codec, pfx, 0, sw); | 3308 | err = alc_auto_add_stereo_sw(codec, pfx, cidx, sw); |
3199 | if (err < 0) | 3309 | if (err < 0) |
3200 | return err; | 3310 | return err; |
3201 | return 0; | 3311 | return 0; |
@@ -3236,16 +3346,21 @@ static int alc_auto_create_extra_outs(struct hda_codec *codec, int num_pins, | |||
3236 | hda_nid_t dac = *dacs; | 3346 | hda_nid_t dac = *dacs; |
3237 | if (!dac) | 3347 | if (!dac) |
3238 | dac = spec->multiout.dac_nids[0]; | 3348 | dac = spec->multiout.dac_nids[0]; |
3239 | return alc_auto_create_extra_out(codec, *pins, dac, pfx); | 3349 | return alc_auto_create_extra_out(codec, *pins, dac, pfx, 0); |
3240 | } | 3350 | } |
3241 | 3351 | ||
3242 | if (dacs[num_pins - 1]) { | 3352 | if (dacs[num_pins - 1]) { |
3243 | /* OK, we have a multi-output system with individual volumes */ | 3353 | /* OK, we have a multi-output system with individual volumes */ |
3244 | for (i = 0; i < num_pins; i++) { | 3354 | for (i = 0; i < num_pins; i++) { |
3245 | snprintf(name, sizeof(name), "%s %s", | 3355 | if (num_pins >= 3) { |
3246 | pfx, channel_name[i]); | 3356 | snprintf(name, sizeof(name), "%s %s", |
3247 | err = alc_auto_create_extra_out(codec, pins[i], dacs[i], | 3357 | pfx, channel_name[i]); |
3248 | name); | 3358 | err = alc_auto_create_extra_out(codec, pins[i], dacs[i], |
3359 | name, 0); | ||
3360 | } else { | ||
3361 | err = alc_auto_create_extra_out(codec, pins[i], dacs[i], | ||
3362 | pfx, i); | ||
3363 | } | ||
3249 | if (err < 0) | 3364 | if (err < 0) |
3250 | return err; | 3365 | return err; |
3251 | } | 3366 | } |
@@ -3408,17 +3523,19 @@ static void alc_auto_init_extra_out(struct hda_codec *codec) | |||
3408 | * multi-io helper | 3523 | * multi-io helper |
3409 | */ | 3524 | */ |
3410 | static int alc_auto_fill_multi_ios(struct hda_codec *codec, | 3525 | static int alc_auto_fill_multi_ios(struct hda_codec *codec, |
3411 | unsigned int location) | 3526 | unsigned int location, |
3527 | int offset) | ||
3412 | { | 3528 | { |
3413 | struct alc_spec *spec = codec->spec; | 3529 | struct alc_spec *spec = codec->spec; |
3414 | struct auto_pin_cfg *cfg = &spec->autocfg; | 3530 | struct auto_pin_cfg *cfg = &spec->autocfg; |
3415 | hda_nid_t prime_dac = spec->private_dac_nids[0]; | 3531 | hda_nid_t prime_dac = spec->private_dac_nids[0]; |
3416 | int type, i, num_pins = 0; | 3532 | int type, i, dacs, num_pins = 0; |
3417 | 3533 | ||
3534 | dacs = spec->multiout.num_dacs; | ||
3418 | for (type = AUTO_PIN_LINE_IN; type >= AUTO_PIN_MIC; type--) { | 3535 | for (type = AUTO_PIN_LINE_IN; type >= AUTO_PIN_MIC; type--) { |
3419 | for (i = 0; i < cfg->num_inputs; i++) { | 3536 | for (i = 0; i < cfg->num_inputs; i++) { |
3420 | hda_nid_t nid = cfg->inputs[i].pin; | 3537 | hda_nid_t nid = cfg->inputs[i].pin; |
3421 | hda_nid_t dac; | 3538 | hda_nid_t dac = 0; |
3422 | unsigned int defcfg, caps; | 3539 | unsigned int defcfg, caps; |
3423 | if (cfg->inputs[i].type != type) | 3540 | if (cfg->inputs[i].type != type) |
3424 | continue; | 3541 | continue; |
@@ -3430,7 +3547,13 @@ static int alc_auto_fill_multi_ios(struct hda_codec *codec, | |||
3430 | caps = snd_hda_query_pin_caps(codec, nid); | 3547 | caps = snd_hda_query_pin_caps(codec, nid); |
3431 | if (!(caps & AC_PINCAP_OUT)) | 3548 | if (!(caps & AC_PINCAP_OUT)) |
3432 | continue; | 3549 | continue; |
3433 | dac = alc_auto_look_for_dac(codec, nid); | 3550 | if (offset && offset + num_pins < dacs) { |
3551 | dac = spec->private_dac_nids[offset + num_pins]; | ||
3552 | if (!alc_auto_is_dac_reachable(codec, nid, dac)) | ||
3553 | dac = 0; | ||
3554 | } | ||
3555 | if (!dac) | ||
3556 | dac = alc_auto_look_for_dac(codec, nid); | ||
3434 | if (!dac) | 3557 | if (!dac) |
3435 | continue; | 3558 | continue; |
3436 | spec->multi_io[num_pins].pin = nid; | 3559 | spec->multi_io[num_pins].pin = nid; |
@@ -3439,11 +3562,11 @@ static int alc_auto_fill_multi_ios(struct hda_codec *codec, | |||
3439 | spec->private_dac_nids[spec->multiout.num_dacs++] = dac; | 3562 | spec->private_dac_nids[spec->multiout.num_dacs++] = dac; |
3440 | } | 3563 | } |
3441 | } | 3564 | } |
3442 | spec->multiout.num_dacs = 1; | 3565 | spec->multiout.num_dacs = dacs; |
3443 | if (num_pins < 2) { | 3566 | if (num_pins < 2) { |
3444 | /* clear up again */ | 3567 | /* clear up again */ |
3445 | memset(spec->private_dac_nids, 0, | 3568 | memset(spec->private_dac_nids + dacs, 0, |
3446 | sizeof(spec->private_dac_nids)); | 3569 | sizeof(hda_nid_t) * (AUTO_CFG_MAX_OUTS - dacs)); |
3447 | spec->private_dac_nids[0] = prime_dac; | 3570 | spec->private_dac_nids[0] = prime_dac; |
3448 | return 0; | 3571 | return 0; |
3449 | } | 3572 | } |
@@ -3667,6 +3790,8 @@ static int alc_auto_add_mic_boost(struct hda_codec *codec) | |||
3667 | char boost_label[32]; | 3790 | char boost_label[32]; |
3668 | 3791 | ||
3669 | label = hda_get_autocfg_input_label(codec, cfg, i); | 3792 | label = hda_get_autocfg_input_label(codec, cfg, i); |
3793 | if (spec->shared_mic_hp && !strcmp(label, "Misc")) | ||
3794 | label = "Headphone Mic"; | ||
3670 | if (prev_label && !strcmp(label, prev_label)) | 3795 | if (prev_label && !strcmp(label, prev_label)) |
3671 | type_idx++; | 3796 | type_idx++; |
3672 | else | 3797 | else |
@@ -3779,6 +3904,7 @@ static void set_capture_mixer(struct hda_codec *codec) | |||
3779 | static void alc_auto_init_std(struct hda_codec *codec) | 3904 | static void alc_auto_init_std(struct hda_codec *codec) |
3780 | { | 3905 | { |
3781 | struct alc_spec *spec = codec->spec; | 3906 | struct alc_spec *spec = codec->spec; |
3907 | spec->use_jack_tbl = 1; | ||
3782 | alc_auto_init_multi_out(codec); | 3908 | alc_auto_init_multi_out(codec); |
3783 | alc_auto_init_extra_out(codec); | 3909 | alc_auto_init_extra_out(codec); |
3784 | alc_auto_init_analog_input(codec); | 3910 | alc_auto_init_analog_input(codec); |
@@ -3871,6 +3997,9 @@ static int alc_parse_auto_config(struct hda_codec *codec, | |||
3871 | err = alc_auto_create_speaker_out(codec); | 3997 | err = alc_auto_create_speaker_out(codec); |
3872 | if (err < 0) | 3998 | if (err < 0) |
3873 | return err; | 3999 | return err; |
4000 | err = alc_auto_create_shared_input(codec); | ||
4001 | if (err < 0) | ||
4002 | return err; | ||
3874 | err = alc_auto_create_input_ctls(codec); | 4003 | err = alc_auto_create_input_ctls(codec); |
3875 | if (err < 0) | 4004 | if (err < 0) |
3876 | return err; | 4005 | return err; |
@@ -3918,6 +4047,37 @@ static const struct hda_amp_list alc880_loopbacks[] = { | |||
3918 | #endif | 4047 | #endif |
3919 | 4048 | ||
3920 | /* | 4049 | /* |
4050 | * ALC880 fix-ups | ||
4051 | */ | ||
4052 | enum { | ||
4053 | ALC880_FIXUP_GPIO2, | ||
4054 | ALC880_FIXUP_MEDION_RIM, | ||
4055 | }; | ||
4056 | |||
4057 | static const struct alc_fixup alc880_fixups[] = { | ||
4058 | [ALC880_FIXUP_GPIO2] = { | ||
4059 | .type = ALC_FIXUP_VERBS, | ||
4060 | .v.verbs = alc_gpio2_init_verbs, | ||
4061 | }, | ||
4062 | [ALC880_FIXUP_MEDION_RIM] = { | ||
4063 | .type = ALC_FIXUP_VERBS, | ||
4064 | .v.verbs = (const struct hda_verb[]) { | ||
4065 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | ||
4066 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 }, | ||
4067 | { } | ||
4068 | }, | ||
4069 | .chained = true, | ||
4070 | .chain_id = ALC880_FIXUP_GPIO2, | ||
4071 | }, | ||
4072 | }; | ||
4073 | |||
4074 | static const struct snd_pci_quirk alc880_fixup_tbl[] = { | ||
4075 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM), | ||
4076 | {} | ||
4077 | }; | ||
4078 | |||
4079 | |||
4080 | /* | ||
3921 | * board setups | 4081 | * board setups |
3922 | */ | 4082 | */ |
3923 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS | 4083 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS |
@@ -3963,6 +4123,11 @@ static int patch_alc880(struct hda_codec *codec) | |||
3963 | } | 4123 | } |
3964 | 4124 | ||
3965 | if (board_config == ALC_MODEL_AUTO) { | 4125 | if (board_config == ALC_MODEL_AUTO) { |
4126 | alc_pick_fixup(codec, NULL, alc880_fixup_tbl, alc880_fixups); | ||
4127 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); | ||
4128 | } | ||
4129 | |||
4130 | if (board_config == ALC_MODEL_AUTO) { | ||
3966 | /* automatic parse from the BIOS config */ | 4131 | /* automatic parse from the BIOS config */ |
3967 | err = alc880_parse_auto_config(codec); | 4132 | err = alc880_parse_auto_config(codec); |
3968 | if (err < 0) | 4133 | if (err < 0) |
@@ -3977,8 +4142,10 @@ static int patch_alc880(struct hda_codec *codec) | |||
3977 | #endif | 4142 | #endif |
3978 | } | 4143 | } |
3979 | 4144 | ||
3980 | if (board_config != ALC_MODEL_AUTO) | 4145 | if (board_config != ALC_MODEL_AUTO) { |
4146 | spec->vmaster_nid = 0x0c; | ||
3981 | setup_preset(codec, &alc880_presets[board_config]); | 4147 | setup_preset(codec, &alc880_presets[board_config]); |
4148 | } | ||
3982 | 4149 | ||
3983 | if (!spec->no_analog && !spec->adc_nids) { | 4150 | if (!spec->no_analog && !spec->adc_nids) { |
3984 | alc_auto_fill_adc_caps(codec); | 4151 | alc_auto_fill_adc_caps(codec); |
@@ -3996,7 +4163,7 @@ static int patch_alc880(struct hda_codec *codec) | |||
3996 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | 4163 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
3997 | } | 4164 | } |
3998 | 4165 | ||
3999 | spec->vmaster_nid = 0x0c; | 4166 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
4000 | 4167 | ||
4001 | codec->patch_ops = alc_patch_ops; | 4168 | codec->patch_ops = alc_patch_ops; |
4002 | if (board_config == ALC_MODEL_AUTO) | 4169 | if (board_config == ALC_MODEL_AUTO) |
@@ -4104,8 +4271,10 @@ static int patch_alc260(struct hda_codec *codec) | |||
4104 | #endif | 4271 | #endif |
4105 | } | 4272 | } |
4106 | 4273 | ||
4107 | if (board_config != ALC_MODEL_AUTO) | 4274 | if (board_config != ALC_MODEL_AUTO) { |
4108 | setup_preset(codec, &alc260_presets[board_config]); | 4275 | setup_preset(codec, &alc260_presets[board_config]); |
4276 | spec->vmaster_nid = 0x08; | ||
4277 | } | ||
4109 | 4278 | ||
4110 | if (!spec->no_analog && !spec->adc_nids) { | 4279 | if (!spec->no_analog && !spec->adc_nids) { |
4111 | alc_auto_fill_adc_caps(codec); | 4280 | alc_auto_fill_adc_caps(codec); |
@@ -4125,8 +4294,6 @@ static int patch_alc260(struct hda_codec *codec) | |||
4125 | 4294 | ||
4126 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); | 4295 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
4127 | 4296 | ||
4128 | spec->vmaster_nid = 0x08; | ||
4129 | |||
4130 | codec->patch_ops = alc_patch_ops; | 4297 | codec->patch_ops = alc_patch_ops; |
4131 | if (board_config == ALC_MODEL_AUTO) | 4298 | if (board_config == ALC_MODEL_AUTO) |
4132 | spec->init_hook = alc_auto_init_std; | 4299 | spec->init_hook = alc_auto_init_std; |
@@ -4163,15 +4330,78 @@ static int patch_alc260(struct hda_codec *codec) | |||
4163 | * Pin config fixes | 4330 | * Pin config fixes |
4164 | */ | 4331 | */ |
4165 | enum { | 4332 | enum { |
4166 | PINFIX_ABIT_AW9D_MAX, | 4333 | ALC882_FIXUP_ABIT_AW9D_MAX, |
4167 | PINFIX_LENOVO_Y530, | 4334 | ALC882_FIXUP_LENOVO_Y530, |
4168 | PINFIX_PB_M5210, | 4335 | ALC882_FIXUP_PB_M5210, |
4169 | PINFIX_ACER_ASPIRE_7736, | 4336 | ALC882_FIXUP_ACER_ASPIRE_7736, |
4170 | PINFIX_ASUS_W90V, | 4337 | ALC882_FIXUP_ASUS_W90V, |
4338 | ALC889_FIXUP_VAIO_TT, | ||
4339 | ALC888_FIXUP_EEE1601, | ||
4340 | ALC882_FIXUP_EAPD, | ||
4341 | ALC883_FIXUP_EAPD, | ||
4342 | ALC883_FIXUP_ACER_EAPD, | ||
4343 | ALC882_FIXUP_GPIO3, | ||
4344 | ALC889_FIXUP_COEF, | ||
4345 | ALC882_FIXUP_ASUS_W2JC, | ||
4346 | ALC882_FIXUP_ACER_ASPIRE_4930G, | ||
4347 | ALC882_FIXUP_ACER_ASPIRE_8930G, | ||
4348 | ALC882_FIXUP_ASPIRE_8930G_VERBS, | ||
4349 | ALC885_FIXUP_MACPRO_GPIO, | ||
4171 | }; | 4350 | }; |
4172 | 4351 | ||
4352 | static void alc889_fixup_coef(struct hda_codec *codec, | ||
4353 | const struct alc_fixup *fix, int action) | ||
4354 | { | ||
4355 | if (action != ALC_FIXUP_ACT_INIT) | ||
4356 | return; | ||
4357 | alc889_coef_init(codec); | ||
4358 | } | ||
4359 | |||
4360 | /* toggle speaker-output according to the hp-jack state */ | ||
4361 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) | ||
4362 | { | ||
4363 | unsigned int gpiostate, gpiomask, gpiodir; | ||
4364 | |||
4365 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, | ||
4366 | AC_VERB_GET_GPIO_DATA, 0); | ||
4367 | |||
4368 | if (!muted) | ||
4369 | gpiostate |= (1 << pin); | ||
4370 | else | ||
4371 | gpiostate &= ~(1 << pin); | ||
4372 | |||
4373 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, | ||
4374 | AC_VERB_GET_GPIO_MASK, 0); | ||
4375 | gpiomask |= (1 << pin); | ||
4376 | |||
4377 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, | ||
4378 | AC_VERB_GET_GPIO_DIRECTION, 0); | ||
4379 | gpiodir |= (1 << pin); | ||
4380 | |||
4381 | |||
4382 | snd_hda_codec_write(codec, codec->afg, 0, | ||
4383 | AC_VERB_SET_GPIO_MASK, gpiomask); | ||
4384 | snd_hda_codec_write(codec, codec->afg, 0, | ||
4385 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); | ||
4386 | |||
4387 | msleep(1); | ||
4388 | |||
4389 | snd_hda_codec_write(codec, codec->afg, 0, | ||
4390 | AC_VERB_SET_GPIO_DATA, gpiostate); | ||
4391 | } | ||
4392 | |||
4393 | /* set up GPIO at initialization */ | ||
4394 | static void alc885_fixup_macpro_gpio(struct hda_codec *codec, | ||
4395 | const struct alc_fixup *fix, int action) | ||
4396 | { | ||
4397 | if (action != ALC_FIXUP_ACT_INIT) | ||
4398 | return; | ||
4399 | alc882_gpio_mute(codec, 0, 0); | ||
4400 | alc882_gpio_mute(codec, 1, 0); | ||
4401 | } | ||
4402 | |||
4173 | static const struct alc_fixup alc882_fixups[] = { | 4403 | static const struct alc_fixup alc882_fixups[] = { |
4174 | [PINFIX_ABIT_AW9D_MAX] = { | 4404 | [ALC882_FIXUP_ABIT_AW9D_MAX] = { |
4175 | .type = ALC_FIXUP_PINS, | 4405 | .type = ALC_FIXUP_PINS, |
4176 | .v.pins = (const struct alc_pincfg[]) { | 4406 | .v.pins = (const struct alc_pincfg[]) { |
4177 | { 0x15, 0x01080104 }, /* side */ | 4407 | { 0x15, 0x01080104 }, /* side */ |
@@ -4180,7 +4410,7 @@ static const struct alc_fixup alc882_fixups[] = { | |||
4180 | { } | 4410 | { } |
4181 | } | 4411 | } |
4182 | }, | 4412 | }, |
4183 | [PINFIX_LENOVO_Y530] = { | 4413 | [ALC882_FIXUP_LENOVO_Y530] = { |
4184 | .type = ALC_FIXUP_PINS, | 4414 | .type = ALC_FIXUP_PINS, |
4185 | .v.pins = (const struct alc_pincfg[]) { | 4415 | .v.pins = (const struct alc_pincfg[]) { |
4186 | { 0x15, 0x99130112 }, /* rear int speakers */ | 4416 | { 0x15, 0x99130112 }, /* rear int speakers */ |
@@ -4188,32 +4418,180 @@ static const struct alc_fixup alc882_fixups[] = { | |||
4188 | { } | 4418 | { } |
4189 | } | 4419 | } |
4190 | }, | 4420 | }, |
4191 | [PINFIX_PB_M5210] = { | 4421 | [ALC882_FIXUP_PB_M5210] = { |
4192 | .type = ALC_FIXUP_VERBS, | 4422 | .type = ALC_FIXUP_VERBS, |
4193 | .v.verbs = (const struct hda_verb[]) { | 4423 | .v.verbs = (const struct hda_verb[]) { |
4194 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, | 4424 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
4195 | {} | 4425 | {} |
4196 | } | 4426 | } |
4197 | }, | 4427 | }, |
4198 | [PINFIX_ACER_ASPIRE_7736] = { | 4428 | [ALC882_FIXUP_ACER_ASPIRE_7736] = { |
4199 | .type = ALC_FIXUP_SKU, | 4429 | .type = ALC_FIXUP_SKU, |
4200 | .v.sku = ALC_FIXUP_SKU_IGNORE, | 4430 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
4201 | }, | 4431 | }, |
4202 | [PINFIX_ASUS_W90V] = { | 4432 | [ALC882_FIXUP_ASUS_W90V] = { |
4203 | .type = ALC_FIXUP_PINS, | 4433 | .type = ALC_FIXUP_PINS, |
4204 | .v.pins = (const struct alc_pincfg[]) { | 4434 | .v.pins = (const struct alc_pincfg[]) { |
4205 | { 0x16, 0x99130110 }, /* fix sequence for CLFE */ | 4435 | { 0x16, 0x99130110 }, /* fix sequence for CLFE */ |
4206 | { } | 4436 | { } |
4207 | } | 4437 | } |
4208 | }, | 4438 | }, |
4439 | [ALC889_FIXUP_VAIO_TT] = { | ||
4440 | .type = ALC_FIXUP_PINS, | ||
4441 | .v.pins = (const struct alc_pincfg[]) { | ||
4442 | { 0x17, 0x90170111 }, /* hidden surround speaker */ | ||
4443 | { } | ||
4444 | } | ||
4445 | }, | ||
4446 | [ALC888_FIXUP_EEE1601] = { | ||
4447 | .type = ALC_FIXUP_VERBS, | ||
4448 | .v.verbs = (const struct hda_verb[]) { | ||
4449 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b }, | ||
4450 | { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 }, | ||
4451 | { } | ||
4452 | } | ||
4453 | }, | ||
4454 | [ALC882_FIXUP_EAPD] = { | ||
4455 | .type = ALC_FIXUP_VERBS, | ||
4456 | .v.verbs = (const struct hda_verb[]) { | ||
4457 | /* change to EAPD mode */ | ||
4458 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | ||
4459 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 }, | ||
4460 | { } | ||
4461 | } | ||
4462 | }, | ||
4463 | [ALC883_FIXUP_EAPD] = { | ||
4464 | .type = ALC_FIXUP_VERBS, | ||
4465 | .v.verbs = (const struct hda_verb[]) { | ||
4466 | /* change to EAPD mode */ | ||
4467 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | ||
4468 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 }, | ||
4469 | { } | ||
4470 | } | ||
4471 | }, | ||
4472 | [ALC883_FIXUP_ACER_EAPD] = { | ||
4473 | .type = ALC_FIXUP_VERBS, | ||
4474 | .v.verbs = (const struct hda_verb[]) { | ||
4475 | /* eanable EAPD on Acer laptops */ | ||
4476 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | ||
4477 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 }, | ||
4478 | { } | ||
4479 | } | ||
4480 | }, | ||
4481 | [ALC882_FIXUP_GPIO3] = { | ||
4482 | .type = ALC_FIXUP_VERBS, | ||
4483 | .v.verbs = alc_gpio3_init_verbs, | ||
4484 | }, | ||
4485 | [ALC882_FIXUP_ASUS_W2JC] = { | ||
4486 | .type = ALC_FIXUP_VERBS, | ||
4487 | .v.verbs = alc_gpio1_init_verbs, | ||
4488 | .chained = true, | ||
4489 | .chain_id = ALC882_FIXUP_EAPD, | ||
4490 | }, | ||
4491 | [ALC889_FIXUP_COEF] = { | ||
4492 | .type = ALC_FIXUP_FUNC, | ||
4493 | .v.func = alc889_fixup_coef, | ||
4494 | }, | ||
4495 | [ALC882_FIXUP_ACER_ASPIRE_4930G] = { | ||
4496 | .type = ALC_FIXUP_PINS, | ||
4497 | .v.pins = (const struct alc_pincfg[]) { | ||
4498 | { 0x16, 0x99130111 }, /* CLFE speaker */ | ||
4499 | { 0x17, 0x99130112 }, /* surround speaker */ | ||
4500 | { } | ||
4501 | } | ||
4502 | }, | ||
4503 | [ALC882_FIXUP_ACER_ASPIRE_8930G] = { | ||
4504 | .type = ALC_FIXUP_PINS, | ||
4505 | .v.pins = (const struct alc_pincfg[]) { | ||
4506 | { 0x16, 0x99130111 }, /* CLFE speaker */ | ||
4507 | { 0x1b, 0x99130112 }, /* surround speaker */ | ||
4508 | { } | ||
4509 | }, | ||
4510 | .chained = true, | ||
4511 | .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS, | ||
4512 | }, | ||
4513 | [ALC882_FIXUP_ASPIRE_8930G_VERBS] = { | ||
4514 | /* additional init verbs for Acer Aspire 8930G */ | ||
4515 | .type = ALC_FIXUP_VERBS, | ||
4516 | .v.verbs = (const struct hda_verb[]) { | ||
4517 | /* Enable all DACs */ | ||
4518 | /* DAC DISABLE/MUTE 1? */ | ||
4519 | /* setting bits 1-5 disables DAC nids 0x02-0x06 | ||
4520 | * apparently. Init=0x38 */ | ||
4521 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 }, | ||
4522 | { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 }, | ||
4523 | /* DAC DISABLE/MUTE 2? */ | ||
4524 | /* some bit here disables the other DACs. | ||
4525 | * Init=0x4900 */ | ||
4526 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 }, | ||
4527 | { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 }, | ||
4528 | /* DMIC fix | ||
4529 | * This laptop has a stereo digital microphone. | ||
4530 | * The mics are only 1cm apart which makes the stereo | ||
4531 | * useless. However, either the mic or the ALC889 | ||
4532 | * makes the signal become a difference/sum signal | ||
4533 | * instead of standard stereo, which is annoying. | ||
4534 | * So instead we flip this bit which makes the | ||
4535 | * codec replicate the sum signal to both channels, | ||
4536 | * turning it into a normal mono mic. | ||
4537 | */ | ||
4538 | /* DMIC_CONTROL? Init value = 0x0001 */ | ||
4539 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b }, | ||
4540 | { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 }, | ||
4541 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | ||
4542 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 }, | ||
4543 | { } | ||
4544 | } | ||
4545 | }, | ||
4546 | [ALC885_FIXUP_MACPRO_GPIO] = { | ||
4547 | .type = ALC_FIXUP_FUNC, | ||
4548 | .v.func = alc885_fixup_macpro_gpio, | ||
4549 | }, | ||
4209 | }; | 4550 | }; |
4210 | 4551 | ||
4211 | static const struct snd_pci_quirk alc882_fixup_tbl[] = { | 4552 | static const struct snd_pci_quirk alc882_fixup_tbl[] = { |
4212 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), | 4553 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD), |
4213 | SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", PINFIX_ASUS_W90V), | 4554 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD), |
4214 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530), | 4555 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD), |
4215 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), | 4556 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD), |
4216 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), | 4557 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD), |
4558 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD), | ||
4559 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", | ||
4560 | ALC882_FIXUP_ACER_ASPIRE_4930G), | ||
4561 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", | ||
4562 | ALC882_FIXUP_ACER_ASPIRE_4930G), | ||
4563 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", | ||
4564 | ALC882_FIXUP_ACER_ASPIRE_8930G), | ||
4565 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", | ||
4566 | ALC882_FIXUP_ACER_ASPIRE_8930G), | ||
4567 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", | ||
4568 | ALC882_FIXUP_ACER_ASPIRE_4930G), | ||
4569 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", | ||
4570 | ALC882_FIXUP_ACER_ASPIRE_4930G), | ||
4571 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", | ||
4572 | ALC882_FIXUP_ACER_ASPIRE_4930G), | ||
4573 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210), | ||
4574 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736), | ||
4575 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD), | ||
4576 | SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V), | ||
4577 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC), | ||
4578 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601), | ||
4579 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), | ||
4580 | |||
4581 | /* All Apple entries are in codec SSIDs */ | ||
4582 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_FIXUP_MACPRO_GPIO), | ||
4583 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO), | ||
4584 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO), | ||
4585 | SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD), | ||
4586 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO), | ||
4587 | |||
4588 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD), | ||
4589 | SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), | ||
4590 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), | ||
4591 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD), | ||
4592 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD), | ||
4593 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530), | ||
4594 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF), | ||
4217 | {} | 4595 | {} |
4218 | }; | 4596 | }; |
4219 | 4597 | ||
@@ -4262,8 +4640,7 @@ static int patch_alc882(struct hda_codec *codec) | |||
4262 | goto error; | 4640 | goto error; |
4263 | 4641 | ||
4264 | board_config = alc_board_config(codec, ALC882_MODEL_LAST, | 4642 | board_config = alc_board_config(codec, ALC882_MODEL_LAST, |
4265 | alc882_models, alc882_cfg_tbl); | 4643 | alc882_models, NULL); |
4266 | |||
4267 | if (board_config < 0) | 4644 | if (board_config < 0) |
4268 | board_config = alc_board_codec_sid_config(codec, | 4645 | board_config = alc_board_codec_sid_config(codec, |
4269 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); | 4646 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
@@ -4286,18 +4663,12 @@ static int patch_alc882(struct hda_codec *codec) | |||
4286 | err = alc882_parse_auto_config(codec); | 4663 | err = alc882_parse_auto_config(codec); |
4287 | if (err < 0) | 4664 | if (err < 0) |
4288 | goto error; | 4665 | goto error; |
4289 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS | ||
4290 | else if (!err) { | ||
4291 | printk(KERN_INFO | ||
4292 | "hda_codec: Cannot set up configuration " | ||
4293 | "from BIOS. Using base mode...\n"); | ||
4294 | board_config = ALC882_3ST_DIG; | ||
4295 | } | ||
4296 | #endif | ||
4297 | } | 4666 | } |
4298 | 4667 | ||
4299 | if (board_config != ALC_MODEL_AUTO) | 4668 | if (board_config != ALC_MODEL_AUTO) { |
4300 | setup_preset(codec, &alc882_presets[board_config]); | 4669 | setup_preset(codec, &alc882_presets[board_config]); |
4670 | spec->vmaster_nid = 0x0c; | ||
4671 | } | ||
4301 | 4672 | ||
4302 | if (!spec->no_analog && !spec->adc_nids) { | 4673 | if (!spec->no_analog && !spec->adc_nids) { |
4303 | alc_auto_fill_adc_caps(codec); | 4674 | alc_auto_fill_adc_caps(codec); |
@@ -4317,13 +4688,10 @@ static int patch_alc882(struct hda_codec *codec) | |||
4317 | 4688 | ||
4318 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); | 4689 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
4319 | 4690 | ||
4320 | spec->vmaster_nid = 0x0c; | ||
4321 | |||
4322 | codec->patch_ops = alc_patch_ops; | 4691 | codec->patch_ops = alc_patch_ops; |
4323 | if (board_config == ALC_MODEL_AUTO) | 4692 | if (board_config == ALC_MODEL_AUTO) |
4324 | spec->init_hook = alc_auto_init_std; | 4693 | spec->init_hook = alc_auto_init_std; |
4325 | 4694 | ||
4326 | alc_init_jacks(codec); | ||
4327 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 4695 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
4328 | if (!spec->loopback.amplist) | 4696 | if (!spec->loopback.amplist) |
4329 | spec->loopback.amplist = alc882_loopbacks; | 4697 | spec->loopback.amplist = alc882_loopbacks; |
@@ -4351,12 +4719,17 @@ static int alc262_parse_auto_config(struct hda_codec *codec) | |||
4351 | * Pin config fixes | 4719 | * Pin config fixes |
4352 | */ | 4720 | */ |
4353 | enum { | 4721 | enum { |
4354 | PINFIX_FSC_H270, | 4722 | ALC262_FIXUP_FSC_H270, |
4355 | PINFIX_HP_Z200, | 4723 | ALC262_FIXUP_HP_Z200, |
4724 | ALC262_FIXUP_TYAN, | ||
4725 | ALC262_FIXUP_TOSHIBA_RX1, | ||
4726 | ALC262_FIXUP_LENOVO_3000, | ||
4727 | ALC262_FIXUP_BENQ, | ||
4728 | ALC262_FIXUP_BENQ_T31, | ||
4356 | }; | 4729 | }; |
4357 | 4730 | ||
4358 | static const struct alc_fixup alc262_fixups[] = { | 4731 | static const struct alc_fixup alc262_fixups[] = { |
4359 | [PINFIX_FSC_H270] = { | 4732 | [ALC262_FIXUP_FSC_H270] = { |
4360 | .type = ALC_FIXUP_PINS, | 4733 | .type = ALC_FIXUP_PINS, |
4361 | .v.pins = (const struct alc_pincfg[]) { | 4734 | .v.pins = (const struct alc_pincfg[]) { |
4362 | { 0x14, 0x99130110 }, /* speaker */ | 4735 | { 0x14, 0x99130110 }, /* speaker */ |
@@ -4365,18 +4738,68 @@ static const struct alc_fixup alc262_fixups[] = { | |||
4365 | { } | 4738 | { } |
4366 | } | 4739 | } |
4367 | }, | 4740 | }, |
4368 | [PINFIX_HP_Z200] = { | 4741 | [ALC262_FIXUP_HP_Z200] = { |
4369 | .type = ALC_FIXUP_PINS, | 4742 | .type = ALC_FIXUP_PINS, |
4370 | .v.pins = (const struct alc_pincfg[]) { | 4743 | .v.pins = (const struct alc_pincfg[]) { |
4371 | { 0x16, 0x99130120 }, /* internal speaker */ | 4744 | { 0x16, 0x99130120 }, /* internal speaker */ |
4372 | { } | 4745 | { } |
4373 | } | 4746 | } |
4374 | }, | 4747 | }, |
4748 | [ALC262_FIXUP_TYAN] = { | ||
4749 | .type = ALC_FIXUP_PINS, | ||
4750 | .v.pins = (const struct alc_pincfg[]) { | ||
4751 | { 0x14, 0x1993e1f0 }, /* int AUX */ | ||
4752 | { } | ||
4753 | } | ||
4754 | }, | ||
4755 | [ALC262_FIXUP_TOSHIBA_RX1] = { | ||
4756 | .type = ALC_FIXUP_PINS, | ||
4757 | .v.pins = (const struct alc_pincfg[]) { | ||
4758 | { 0x14, 0x90170110 }, /* speaker */ | ||
4759 | { 0x15, 0x0421101f }, /* HP */ | ||
4760 | { 0x1a, 0x40f000f0 }, /* N/A */ | ||
4761 | { 0x1b, 0x40f000f0 }, /* N/A */ | ||
4762 | { 0x1e, 0x40f000f0 }, /* N/A */ | ||
4763 | } | ||
4764 | }, | ||
4765 | [ALC262_FIXUP_LENOVO_3000] = { | ||
4766 | .type = ALC_FIXUP_VERBS, | ||
4767 | .v.verbs = (const struct hda_verb[]) { | ||
4768 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, | ||
4769 | {} | ||
4770 | }, | ||
4771 | .chained = true, | ||
4772 | .chain_id = ALC262_FIXUP_BENQ, | ||
4773 | }, | ||
4774 | [ALC262_FIXUP_BENQ] = { | ||
4775 | .type = ALC_FIXUP_VERBS, | ||
4776 | .v.verbs = (const struct hda_verb[]) { | ||
4777 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | ||
4778 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 }, | ||
4779 | {} | ||
4780 | } | ||
4781 | }, | ||
4782 | [ALC262_FIXUP_BENQ_T31] = { | ||
4783 | .type = ALC_FIXUP_VERBS, | ||
4784 | .v.verbs = (const struct hda_verb[]) { | ||
4785 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | ||
4786 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 }, | ||
4787 | {} | ||
4788 | } | ||
4789 | }, | ||
4375 | }; | 4790 | }; |
4376 | 4791 | ||
4377 | static const struct snd_pci_quirk alc262_fixup_tbl[] = { | 4792 | static const struct snd_pci_quirk alc262_fixup_tbl[] = { |
4378 | SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", PINFIX_HP_Z200), | 4793 | SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200), |
4379 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), | 4794 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FIXUP_BENQ), |
4795 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ), | ||
4796 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN), | ||
4797 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", | ||
4798 | ALC262_FIXUP_TOSHIBA_RX1), | ||
4799 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270), | ||
4800 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000), | ||
4801 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ), | ||
4802 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31), | ||
4380 | {} | 4803 | {} |
4381 | }; | 4804 | }; |
4382 | 4805 | ||
@@ -4387,14 +4810,9 @@ static const struct snd_pci_quirk alc262_fixup_tbl[] = { | |||
4387 | 4810 | ||
4388 | /* | 4811 | /* |
4389 | */ | 4812 | */ |
4390 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS | ||
4391 | #include "alc262_quirks.c" | ||
4392 | #endif | ||
4393 | |||
4394 | static int patch_alc262(struct hda_codec *codec) | 4813 | static int patch_alc262(struct hda_codec *codec) |
4395 | { | 4814 | { |
4396 | struct alc_spec *spec; | 4815 | struct alc_spec *spec; |
4397 | int board_config; | ||
4398 | int err; | 4816 | int err; |
4399 | 4817 | ||
4400 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 4818 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
@@ -4421,37 +4839,13 @@ static int patch_alc262(struct hda_codec *codec) | |||
4421 | 4839 | ||
4422 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); | 4840 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
4423 | 4841 | ||
4424 | board_config = alc_board_config(codec, ALC262_MODEL_LAST, | 4842 | alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups); |
4425 | alc262_models, alc262_cfg_tbl); | 4843 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
4426 | |||
4427 | if (board_config < 0) { | ||
4428 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | ||
4429 | codec->chip_name); | ||
4430 | board_config = ALC_MODEL_AUTO; | ||
4431 | } | ||
4432 | |||
4433 | if (board_config == ALC_MODEL_AUTO) { | ||
4434 | alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups); | ||
4435 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); | ||
4436 | } | ||
4437 | |||
4438 | if (board_config == ALC_MODEL_AUTO) { | ||
4439 | /* automatic parse from the BIOS config */ | ||
4440 | err = alc262_parse_auto_config(codec); | ||
4441 | if (err < 0) | ||
4442 | goto error; | ||
4443 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS | ||
4444 | else if (!err) { | ||
4445 | printk(KERN_INFO | ||
4446 | "hda_codec: Cannot set up configuration " | ||
4447 | "from BIOS. Using base mode...\n"); | ||
4448 | board_config = ALC262_BASIC; | ||
4449 | } | ||
4450 | #endif | ||
4451 | } | ||
4452 | 4844 | ||
4453 | if (board_config != ALC_MODEL_AUTO) | 4845 | /* automatic parse from the BIOS config */ |
4454 | setup_preset(codec, &alc262_presets[board_config]); | 4846 | err = alc262_parse_auto_config(codec); |
4847 | if (err < 0) | ||
4848 | goto error; | ||
4455 | 4849 | ||
4456 | if (!spec->no_analog && !spec->adc_nids) { | 4850 | if (!spec->no_analog && !spec->adc_nids) { |
4457 | alc_auto_fill_adc_caps(codec); | 4851 | alc_auto_fill_adc_caps(codec); |
@@ -4471,14 +4865,10 @@ static int patch_alc262(struct hda_codec *codec) | |||
4471 | 4865 | ||
4472 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); | 4866 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
4473 | 4867 | ||
4474 | spec->vmaster_nid = 0x0c; | ||
4475 | |||
4476 | codec->patch_ops = alc_patch_ops; | 4868 | codec->patch_ops = alc_patch_ops; |
4477 | if (board_config == ALC_MODEL_AUTO) | 4869 | spec->init_hook = alc_auto_init_std; |
4478 | spec->init_hook = alc_auto_init_std; | ||
4479 | spec->shutup = alc_eapd_shutup; | 4870 | spec->shutup = alc_eapd_shutup; |
4480 | 4871 | ||
4481 | alc_init_jacks(codec); | ||
4482 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 4872 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
4483 | if (!spec->loopback.amplist) | 4873 | if (!spec->loopback.amplist) |
4484 | spec->loopback.amplist = alc262_loopbacks; | 4874 | spec->loopback.amplist = alc262_loopbacks; |
@@ -4585,14 +4975,10 @@ static int patch_alc268(struct hda_codec *codec) | |||
4585 | if (!spec->no_analog && !spec->cap_mixer) | 4975 | if (!spec->no_analog && !spec->cap_mixer) |
4586 | set_capture_mixer(codec); | 4976 | set_capture_mixer(codec); |
4587 | 4977 | ||
4588 | spec->vmaster_nid = 0x02; | ||
4589 | |||
4590 | codec->patch_ops = alc_patch_ops; | 4978 | codec->patch_ops = alc_patch_ops; |
4591 | spec->init_hook = alc_auto_init_std; | 4979 | spec->init_hook = alc_auto_init_std; |
4592 | spec->shutup = alc_eapd_shutup; | 4980 | spec->shutup = alc_eapd_shutup; |
4593 | 4981 | ||
4594 | alc_init_jacks(codec); | ||
4595 | |||
4596 | return 0; | 4982 | return 0; |
4597 | 4983 | ||
4598 | error: | 4984 | error: |
@@ -4934,7 +5320,7 @@ static const struct alc_fixup alc269_fixups[] = { | |||
4934 | { } | 5320 | { } |
4935 | }, | 5321 | }, |
4936 | }, | 5322 | }, |
4937 | [ALC269_FIXUP_DMIC] = { | 5323 | [ALC269VB_FIXUP_DMIC] = { |
4938 | .type = ALC_FIXUP_PINS, | 5324 | .type = ALC_FIXUP_PINS, |
4939 | .v.pins = (const struct alc_pincfg[]) { | 5325 | .v.pins = (const struct alc_pincfg[]) { |
4940 | { 0x12, 0x99a3092f }, /* int-mic */ | 5326 | { 0x12, 0x99a3092f }, /* int-mic */ |
@@ -5141,8 +5527,6 @@ static int patch_alc269(struct hda_codec *codec) | |||
5141 | 5527 | ||
5142 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); | 5528 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
5143 | 5529 | ||
5144 | spec->vmaster_nid = 0x02; | ||
5145 | |||
5146 | codec->patch_ops = alc_patch_ops; | 5530 | codec->patch_ops = alc_patch_ops; |
5147 | #ifdef CONFIG_PM | 5531 | #ifdef CONFIG_PM |
5148 | codec->patch_ops.resume = alc269_resume; | 5532 | codec->patch_ops.resume = alc269_resume; |
@@ -5150,7 +5534,6 @@ static int patch_alc269(struct hda_codec *codec) | |||
5150 | spec->init_hook = alc_auto_init_std; | 5534 | spec->init_hook = alc_auto_init_std; |
5151 | spec->shutup = alc269_shutup; | 5535 | spec->shutup = alc269_shutup; |
5152 | 5536 | ||
5153 | alc_init_jacks(codec); | ||
5154 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 5537 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
5155 | if (!spec->loopback.amplist) | 5538 | if (!spec->loopback.amplist) |
5156 | spec->loopback.amplist = alc269_loopbacks; | 5539 | spec->loopback.amplist = alc269_loopbacks; |
@@ -5247,8 +5630,6 @@ static int patch_alc861(struct hda_codec *codec) | |||
5247 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); | 5630 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
5248 | } | 5631 | } |
5249 | 5632 | ||
5250 | spec->vmaster_nid = 0x03; | ||
5251 | |||
5252 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); | 5633 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
5253 | 5634 | ||
5254 | codec->patch_ops = alc_patch_ops; | 5635 | codec->patch_ops = alc_patch_ops; |
@@ -5373,8 +5754,6 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
5373 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | 5754 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
5374 | } | 5755 | } |
5375 | 5756 | ||
5376 | spec->vmaster_nid = 0x02; | ||
5377 | |||
5378 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); | 5757 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
5379 | 5758 | ||
5380 | codec->patch_ops = alc_patch_ops; | 5759 | codec->patch_ops = alc_patch_ops; |
@@ -5757,7 +6136,6 @@ static int patch_alc662(struct hda_codec *codec) | |||
5757 | break; | 6136 | break; |
5758 | } | 6137 | } |
5759 | } | 6138 | } |
5760 | spec->vmaster_nid = 0x02; | ||
5761 | 6139 | ||
5762 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); | 6140 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
5763 | 6141 | ||
@@ -5765,8 +6143,6 @@ static int patch_alc662(struct hda_codec *codec) | |||
5765 | spec->init_hook = alc_auto_init_std; | 6143 | spec->init_hook = alc_auto_init_std; |
5766 | spec->shutup = alc_eapd_shutup; | 6144 | spec->shutup = alc_eapd_shutup; |
5767 | 6145 | ||
5768 | alc_init_jacks(codec); | ||
5769 | |||
5770 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 6146 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
5771 | if (!spec->loopback.amplist) | 6147 | if (!spec->loopback.amplist) |
5772 | spec->loopback.amplist = alc662_loopbacks; | 6148 | spec->loopback.amplist = alc662_loopbacks; |
@@ -5813,8 +6189,6 @@ static int patch_alc680(struct hda_codec *codec) | |||
5813 | if (!spec->no_analog && !spec->cap_mixer) | 6189 | if (!spec->no_analog && !spec->cap_mixer) |
5814 | set_capture_mixer(codec); | 6190 | set_capture_mixer(codec); |
5815 | 6191 | ||
5816 | spec->vmaster_nid = 0x02; | ||
5817 | |||
5818 | codec->patch_ops = alc_patch_ops; | 6192 | codec->patch_ops = alc_patch_ops; |
5819 | spec->init_hook = alc_auto_init_std; | 6193 | spec->init_hook = alc_auto_init_std; |
5820 | 6194 | ||
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index d8d2f9dccd9b..87e684fa830f 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include "hda_codec.h" | 37 | #include "hda_codec.h" |
38 | #include "hda_local.h" | 38 | #include "hda_local.h" |
39 | #include "hda_beep.h" | 39 | #include "hda_beep.h" |
40 | #include "hda_jack.h" | ||
40 | 41 | ||
41 | enum { | 42 | enum { |
42 | STAC_VREF_EVENT = 1, | 43 | STAC_VREF_EVENT = 1, |
@@ -96,7 +97,6 @@ enum { | |||
96 | STAC_92HD83XXX_PWR_REF, | 97 | STAC_92HD83XXX_PWR_REF, |
97 | STAC_DELL_S14, | 98 | STAC_DELL_S14, |
98 | STAC_DELL_VOSTRO_3500, | 99 | STAC_DELL_VOSTRO_3500, |
99 | STAC_92HD83XXX_HP, | ||
100 | STAC_92HD83XXX_HP_cNB11_INTQUAD, | 100 | STAC_92HD83XXX_HP_cNB11_INTQUAD, |
101 | STAC_HP_DV7_4000, | 101 | STAC_HP_DV7_4000, |
102 | STAC_92HD83XXX_MODELS | 102 | STAC_92HD83XXX_MODELS |
@@ -176,13 +176,6 @@ enum { | |||
176 | STAC_9872_MODELS | 176 | STAC_9872_MODELS |
177 | }; | 177 | }; |
178 | 178 | ||
179 | struct sigmatel_event { | ||
180 | hda_nid_t nid; | ||
181 | unsigned char type; | ||
182 | unsigned char tag; | ||
183 | int data; | ||
184 | }; | ||
185 | |||
186 | struct sigmatel_mic_route { | 179 | struct sigmatel_mic_route { |
187 | hda_nid_t pin; | 180 | hda_nid_t pin; |
188 | signed char mux_idx; | 181 | signed char mux_idx; |
@@ -215,6 +208,7 @@ struct sigmatel_spec { | |||
215 | unsigned int gpio_mute; | 208 | unsigned int gpio_mute; |
216 | unsigned int gpio_led; | 209 | unsigned int gpio_led; |
217 | unsigned int gpio_led_polarity; | 210 | unsigned int gpio_led_polarity; |
211 | unsigned int vref_mute_led_nid; /* pin NID for mute-LED vref control */ | ||
218 | unsigned int vref_led; | 212 | unsigned int vref_led; |
219 | 213 | ||
220 | /* stream */ | 214 | /* stream */ |
@@ -230,9 +224,6 @@ struct sigmatel_spec { | |||
230 | const hda_nid_t *pwr_nids; | 224 | const hda_nid_t *pwr_nids; |
231 | const hda_nid_t *dac_list; | 225 | const hda_nid_t *dac_list; |
232 | 226 | ||
233 | /* events */ | ||
234 | struct snd_array events; | ||
235 | |||
236 | /* playback */ | 227 | /* playback */ |
237 | struct hda_input_mux *mono_mux; | 228 | struct hda_input_mux *mono_mux; |
238 | unsigned int cur_mmux; | 229 | unsigned int cur_mmux; |
@@ -1093,13 +1084,10 @@ static const char * const slave_sws[] = { | |||
1093 | }; | 1084 | }; |
1094 | 1085 | ||
1095 | static void stac92xx_free_kctls(struct hda_codec *codec); | 1086 | static void stac92xx_free_kctls(struct hda_codec *codec); |
1096 | static int stac92xx_add_jack(struct hda_codec *codec, hda_nid_t nid, int type); | ||
1097 | 1087 | ||
1098 | static int stac92xx_build_controls(struct hda_codec *codec) | 1088 | static int stac92xx_build_controls(struct hda_codec *codec) |
1099 | { | 1089 | { |
1100 | struct sigmatel_spec *spec = codec->spec; | 1090 | struct sigmatel_spec *spec = codec->spec; |
1101 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
1102 | hda_nid_t nid; | ||
1103 | int err; | 1091 | int err; |
1104 | int i; | 1092 | int i; |
1105 | 1093 | ||
@@ -1185,31 +1173,9 @@ static int stac92xx_build_controls(struct hda_codec *codec) | |||
1185 | 1173 | ||
1186 | stac92xx_free_kctls(codec); /* no longer needed */ | 1174 | stac92xx_free_kctls(codec); /* no longer needed */ |
1187 | 1175 | ||
1188 | /* create jack input elements */ | 1176 | err = snd_hda_jack_add_kctls(codec, &spec->autocfg); |
1189 | if (spec->hp_detect) { | 1177 | if (err < 0) |
1190 | for (i = 0; i < cfg->hp_outs; i++) { | 1178 | return err; |
1191 | int type = SND_JACK_HEADPHONE; | ||
1192 | nid = cfg->hp_pins[i]; | ||
1193 | /* jack detection */ | ||
1194 | if (cfg->hp_outs == i) | ||
1195 | type |= SND_JACK_LINEOUT; | ||
1196 | err = stac92xx_add_jack(codec, nid, type); | ||
1197 | if (err < 0) | ||
1198 | return err; | ||
1199 | } | ||
1200 | } | ||
1201 | for (i = 0; i < cfg->line_outs; i++) { | ||
1202 | err = stac92xx_add_jack(codec, cfg->line_out_pins[i], | ||
1203 | SND_JACK_LINEOUT); | ||
1204 | if (err < 0) | ||
1205 | return err; | ||
1206 | } | ||
1207 | for (i = 0; i < cfg->num_inputs; i++) { | ||
1208 | nid = cfg->inputs[i].pin; | ||
1209 | err = stac92xx_add_jack(codec, nid, SND_JACK_MICROPHONE); | ||
1210 | if (err < 0) | ||
1211 | return err; | ||
1212 | } | ||
1213 | 1179 | ||
1214 | return 0; | 1180 | return 0; |
1215 | } | 1181 | } |
@@ -1691,7 +1657,6 @@ static const char * const stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { | |||
1691 | [STAC_92HD83XXX_PWR_REF] = "mic-ref", | 1657 | [STAC_92HD83XXX_PWR_REF] = "mic-ref", |
1692 | [STAC_DELL_S14] = "dell-s14", | 1658 | [STAC_DELL_S14] = "dell-s14", |
1693 | [STAC_DELL_VOSTRO_3500] = "dell-vostro-3500", | 1659 | [STAC_DELL_VOSTRO_3500] = "dell-vostro-3500", |
1694 | [STAC_92HD83XXX_HP] = "hp", | ||
1695 | [STAC_92HD83XXX_HP_cNB11_INTQUAD] = "hp_cNB11_intquad", | 1660 | [STAC_92HD83XXX_HP_cNB11_INTQUAD] = "hp_cNB11_intquad", |
1696 | [STAC_HP_DV7_4000] = "hp-dv7-4000", | 1661 | [STAC_HP_DV7_4000] = "hp-dv7-4000", |
1697 | }; | 1662 | }; |
@@ -1706,8 +1671,6 @@ static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { | |||
1706 | "unknown Dell", STAC_DELL_S14), | 1671 | "unknown Dell", STAC_DELL_S14), |
1707 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x1028, | 1672 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x1028, |
1708 | "Dell Vostro 3500", STAC_DELL_VOSTRO_3500), | 1673 | "Dell Vostro 3500", STAC_DELL_VOSTRO_3500), |
1709 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x3600, | ||
1710 | "HP", STAC_92HD83XXX_HP), | ||
1711 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1656, | 1674 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1656, |
1712 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), | 1675 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
1713 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1657, | 1676 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1657, |
@@ -2874,7 +2837,8 @@ static inline int stac92xx_add_jack_mode_control(struct hda_codec *codec, | |||
2874 | } | 2837 | } |
2875 | 2838 | ||
2876 | if (control) { | 2839 | if (control) { |
2877 | strcpy(name, hda_get_input_pin_label(codec, nid, 1)); | 2840 | snd_hda_get_pin_label(codec, nid, &spec->autocfg, |
2841 | name, sizeof(name), NULL); | ||
2878 | return stac92xx_add_control(codec->spec, control, | 2842 | return stac92xx_add_control(codec->spec, control, |
2879 | strcat(name, " Jack Mode"), nid); | 2843 | strcat(name, " Jack Mode"), nid); |
2880 | } | 2844 | } |
@@ -3552,7 +3516,7 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, | |||
3552 | for (i = 0; i < spec->num_dmics; i++) { | 3516 | for (i = 0; i < spec->num_dmics; i++) { |
3553 | hda_nid_t nid; | 3517 | hda_nid_t nid; |
3554 | int index, type_idx; | 3518 | int index, type_idx; |
3555 | const char *label; | 3519 | char label[32]; |
3556 | 3520 | ||
3557 | nid = spec->dmic_nids[i]; | 3521 | nid = spec->dmic_nids[i]; |
3558 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) | 3522 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
@@ -3565,7 +3529,8 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, | |||
3565 | if (index < 0) | 3529 | if (index < 0) |
3566 | continue; | 3530 | continue; |
3567 | 3531 | ||
3568 | label = hda_get_input_pin_label(codec, nid, 1); | 3532 | snd_hda_get_pin_label(codec, nid, &spec->autocfg, |
3533 | label, sizeof(label), NULL); | ||
3569 | snd_hda_add_imux_item(dimux, label, index, &type_idx); | 3534 | snd_hda_add_imux_item(dimux, label, index, &type_idx); |
3570 | if (snd_hda_get_bool_hint(codec, "separate_dmux") != 1) | 3535 | if (snd_hda_get_bool_hint(codec, "separate_dmux") != 1) |
3571 | snd_hda_add_imux_item(imux, label, index, &type_idx); | 3536 | snd_hda_add_imux_item(imux, label, index, &type_idx); |
@@ -4163,65 +4128,18 @@ static void stac_gpio_set(struct hda_codec *codec, unsigned int mask, | |||
4163 | AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */ | 4128 | AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */ |
4164 | } | 4129 | } |
4165 | 4130 | ||
4166 | static int stac92xx_add_jack(struct hda_codec *codec, | 4131 | static int stac_add_event(struct hda_codec *codec, hda_nid_t nid, |
4167 | hda_nid_t nid, int type) | ||
4168 | { | ||
4169 | #ifdef CONFIG_SND_HDA_INPUT_JACK | ||
4170 | int def_conf = snd_hda_codec_get_pincfg(codec, nid); | ||
4171 | int connectivity = get_defcfg_connect(def_conf); | ||
4172 | |||
4173 | if (connectivity && connectivity != AC_JACK_PORT_FIXED) | ||
4174 | return 0; | ||
4175 | |||
4176 | return snd_hda_input_jack_add(codec, nid, type, NULL); | ||
4177 | #else | ||
4178 | return 0; | ||
4179 | #endif /* CONFIG_SND_HDA_INPUT_JACK */ | ||
4180 | } | ||
4181 | |||
4182 | static int stac_add_event(struct sigmatel_spec *spec, hda_nid_t nid, | ||
4183 | unsigned char type, int data) | 4132 | unsigned char type, int data) |
4184 | { | 4133 | { |
4185 | struct sigmatel_event *event; | 4134 | struct hda_jack_tbl *event; |
4186 | 4135 | ||
4187 | snd_array_init(&spec->events, sizeof(*event), 32); | 4136 | event = snd_hda_jack_tbl_new(codec, nid); |
4188 | event = snd_array_new(&spec->events); | ||
4189 | if (!event) | 4137 | if (!event) |
4190 | return -ENOMEM; | 4138 | return -ENOMEM; |
4191 | event->nid = nid; | 4139 | event->action = type; |
4192 | event->type = type; | 4140 | event->private_data = data; |
4193 | event->tag = spec->events.used; | ||
4194 | event->data = data; | ||
4195 | |||
4196 | return event->tag; | ||
4197 | } | ||
4198 | |||
4199 | static struct sigmatel_event *stac_get_event(struct hda_codec *codec, | ||
4200 | hda_nid_t nid) | ||
4201 | { | ||
4202 | struct sigmatel_spec *spec = codec->spec; | ||
4203 | struct sigmatel_event *event = spec->events.list; | ||
4204 | int i; | ||
4205 | |||
4206 | for (i = 0; i < spec->events.used; i++, event++) { | ||
4207 | if (event->nid == nid) | ||
4208 | return event; | ||
4209 | } | ||
4210 | return NULL; | ||
4211 | } | ||
4212 | |||
4213 | static struct sigmatel_event *stac_get_event_from_tag(struct hda_codec *codec, | ||
4214 | unsigned char tag) | ||
4215 | { | ||
4216 | struct sigmatel_spec *spec = codec->spec; | ||
4217 | struct sigmatel_event *event = spec->events.list; | ||
4218 | int i; | ||
4219 | 4141 | ||
4220 | for (i = 0; i < spec->events.used; i++, event++) { | 4142 | return 0; |
4221 | if (event->tag == tag) | ||
4222 | return event; | ||
4223 | } | ||
4224 | return NULL; | ||
4225 | } | 4143 | } |
4226 | 4144 | ||
4227 | /* check if given nid is a valid pin and no other events are assigned | 4145 | /* check if given nid is a valid pin and no other events are assigned |
@@ -4231,24 +4149,17 @@ static struct sigmatel_event *stac_get_event_from_tag(struct hda_codec *codec, | |||
4231 | static int enable_pin_detect(struct hda_codec *codec, hda_nid_t nid, | 4149 | static int enable_pin_detect(struct hda_codec *codec, hda_nid_t nid, |
4232 | unsigned int type) | 4150 | unsigned int type) |
4233 | { | 4151 | { |
4234 | struct sigmatel_event *event; | 4152 | struct hda_jack_tbl *event; |
4235 | int tag; | ||
4236 | 4153 | ||
4237 | if (!is_jack_detectable(codec, nid)) | 4154 | if (!is_jack_detectable(codec, nid)) |
4238 | return 0; | 4155 | return 0; |
4239 | event = stac_get_event(codec, nid); | 4156 | event = snd_hda_jack_tbl_new(codec, nid); |
4240 | if (event) { | 4157 | if (!event) |
4241 | if (event->type != type) | 4158 | return -ENOMEM; |
4242 | return 0; | 4159 | if (event->action && event->action != type) |
4243 | tag = event->tag; | 4160 | return 0; |
4244 | } else { | 4161 | event->action = type; |
4245 | tag = stac_add_event(codec->spec, nid, type, 0); | 4162 | snd_hda_jack_detect_enable(codec, nid, 0); |
4246 | if (tag < 0) | ||
4247 | return 0; | ||
4248 | } | ||
4249 | snd_hda_codec_write_cache(codec, nid, 0, | ||
4250 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
4251 | AC_USRSP_EN | tag); | ||
4252 | return 1; | 4163 | return 1; |
4253 | } | 4164 | } |
4254 | 4165 | ||
@@ -4318,15 +4229,34 @@ static void stac_store_hints(struct hda_codec *codec) | |||
4318 | spec->eapd_switch = val; | 4229 | spec->eapd_switch = val; |
4319 | get_int_hint(codec, "gpio_led_polarity", &spec->gpio_led_polarity); | 4230 | get_int_hint(codec, "gpio_led_polarity", &spec->gpio_led_polarity); |
4320 | if (get_int_hint(codec, "gpio_led", &spec->gpio_led)) { | 4231 | if (get_int_hint(codec, "gpio_led", &spec->gpio_led)) { |
4321 | if (spec->gpio_led <= 8) { | 4232 | spec->gpio_mask |= spec->gpio_led; |
4322 | spec->gpio_mask |= spec->gpio_led; | 4233 | spec->gpio_dir |= spec->gpio_led; |
4323 | spec->gpio_dir |= spec->gpio_led; | 4234 | if (spec->gpio_led_polarity) |
4324 | if (spec->gpio_led_polarity) | 4235 | spec->gpio_data |= spec->gpio_led; |
4325 | spec->gpio_data |= spec->gpio_led; | ||
4326 | } | ||
4327 | } | 4236 | } |
4328 | } | 4237 | } |
4329 | 4238 | ||
4239 | static void stac_issue_unsol_events(struct hda_codec *codec, int num_pins, | ||
4240 | const hda_nid_t *pins) | ||
4241 | { | ||
4242 | while (num_pins--) | ||
4243 | stac_issue_unsol_event(codec, *pins++); | ||
4244 | } | ||
4245 | |||
4246 | /* fake event to set up pins */ | ||
4247 | static void stac_fake_hp_events(struct hda_codec *codec) | ||
4248 | { | ||
4249 | struct sigmatel_spec *spec = codec->spec; | ||
4250 | |||
4251 | if (spec->autocfg.hp_outs) | ||
4252 | stac_issue_unsol_events(codec, spec->autocfg.hp_outs, | ||
4253 | spec->autocfg.hp_pins); | ||
4254 | if (spec->autocfg.line_outs && | ||
4255 | spec->autocfg.line_out_pins[0] != spec->autocfg.hp_pins[0]) | ||
4256 | stac_issue_unsol_events(codec, spec->autocfg.line_outs, | ||
4257 | spec->autocfg.line_out_pins); | ||
4258 | } | ||
4259 | |||
4330 | static int stac92xx_init(struct hda_codec *codec) | 4260 | static int stac92xx_init(struct hda_codec *codec) |
4331 | { | 4261 | { |
4332 | struct sigmatel_spec *spec = codec->spec; | 4262 | struct sigmatel_spec *spec = codec->spec; |
@@ -4377,10 +4307,7 @@ static int stac92xx_init(struct hda_codec *codec) | |||
4377 | stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0], | 4307 | stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0], |
4378 | AC_PINCTL_OUT_EN); | 4308 | AC_PINCTL_OUT_EN); |
4379 | /* fake event to set up pins */ | 4309 | /* fake event to set up pins */ |
4380 | if (cfg->hp_pins[0]) | 4310 | stac_fake_hp_events(codec); |
4381 | stac_issue_unsol_event(codec, cfg->hp_pins[0]); | ||
4382 | else if (cfg->line_out_pins[0]) | ||
4383 | stac_issue_unsol_event(codec, cfg->line_out_pins[0]); | ||
4384 | } else { | 4311 | } else { |
4385 | stac92xx_auto_init_multi_out(codec); | 4312 | stac92xx_auto_init_multi_out(codec); |
4386 | stac92xx_auto_init_hp_out(codec); | 4313 | stac92xx_auto_init_hp_out(codec); |
@@ -4443,7 +4370,7 @@ static int stac92xx_init(struct hda_codec *codec) | |||
4443 | /* power on when no jack detection is available */ | 4370 | /* power on when no jack detection is available */ |
4444 | /* or when the VREF is used for controlling LED */ | 4371 | /* or when the VREF is used for controlling LED */ |
4445 | if (!spec->hp_detect || | 4372 | if (!spec->hp_detect || |
4446 | (spec->gpio_led > 8 && spec->gpio_led == nid)) { | 4373 | spec->vref_mute_led_nid == nid) { |
4447 | stac_toggle_power_map(codec, nid, 1); | 4374 | stac_toggle_power_map(codec, nid, 1); |
4448 | continue; | 4375 | continue; |
4449 | } | 4376 | } |
@@ -4478,6 +4405,8 @@ static int stac92xx_init(struct hda_codec *codec) | |||
4478 | stac_toggle_power_map(codec, nid, 0); | 4405 | stac_toggle_power_map(codec, nid, 0); |
4479 | } | 4406 | } |
4480 | 4407 | ||
4408 | snd_hda_jack_report_sync(codec); | ||
4409 | |||
4481 | /* sync mute LED */ | 4410 | /* sync mute LED */ |
4482 | if (spec->gpio_led) | 4411 | if (spec->gpio_led) |
4483 | hda_call_check_power_status(codec, 0x01); | 4412 | hda_call_check_power_status(codec, 0x01); |
@@ -4534,8 +4463,6 @@ static void stac92xx_free(struct hda_codec *codec) | |||
4534 | return; | 4463 | return; |
4535 | 4464 | ||
4536 | stac92xx_shutup(codec); | 4465 | stac92xx_shutup(codec); |
4537 | snd_hda_input_jack_free(codec); | ||
4538 | snd_array_free(&spec->events); | ||
4539 | 4466 | ||
4540 | kfree(spec); | 4467 | kfree(spec); |
4541 | snd_hda_detach_beep_device(codec); | 4468 | snd_hda_detach_beep_device(codec); |
@@ -4799,26 +4726,13 @@ static void stac92xx_mic_detect(struct hda_codec *codec) | |||
4799 | mic->mux_idx); | 4726 | mic->mux_idx); |
4800 | } | 4727 | } |
4801 | 4728 | ||
4802 | static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid) | 4729 | static void handle_unsol_event(struct hda_codec *codec, |
4803 | { | 4730 | struct hda_jack_tbl *event) |
4804 | struct sigmatel_event *event = stac_get_event(codec, nid); | ||
4805 | if (!event) | ||
4806 | return; | ||
4807 | codec->patch_ops.unsol_event(codec, (unsigned)event->tag << 26); | ||
4808 | } | ||
4809 | |||
4810 | static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) | ||
4811 | { | 4731 | { |
4812 | struct sigmatel_spec *spec = codec->spec; | 4732 | struct sigmatel_spec *spec = codec->spec; |
4813 | struct sigmatel_event *event; | 4733 | int data; |
4814 | int tag, data; | ||
4815 | |||
4816 | tag = (res >> 26) & 0x7f; | ||
4817 | event = stac_get_event_from_tag(codec, tag); | ||
4818 | if (!event) | ||
4819 | return; | ||
4820 | 4734 | ||
4821 | switch (event->type) { | 4735 | switch (event->action) { |
4822 | case STAC_HP_EVENT: | 4736 | case STAC_HP_EVENT: |
4823 | case STAC_LO_EVENT: | 4737 | case STAC_LO_EVENT: |
4824 | stac92xx_hp_detect(codec); | 4738 | stac92xx_hp_detect(codec); |
@@ -4828,7 +4742,7 @@ static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) | |||
4828 | break; | 4742 | break; |
4829 | } | 4743 | } |
4830 | 4744 | ||
4831 | switch (event->type) { | 4745 | switch (event->action) { |
4832 | case STAC_HP_EVENT: | 4746 | case STAC_HP_EVENT: |
4833 | case STAC_LO_EVENT: | 4747 | case STAC_LO_EVENT: |
4834 | case STAC_MIC_EVENT: | 4748 | case STAC_MIC_EVENT: |
@@ -4836,7 +4750,6 @@ static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) | |||
4836 | case STAC_PWR_EVENT: | 4750 | case STAC_PWR_EVENT: |
4837 | if (spec->num_pwrs > 0) | 4751 | if (spec->num_pwrs > 0) |
4838 | stac92xx_pin_sense(codec, event->nid); | 4752 | stac92xx_pin_sense(codec, event->nid); |
4839 | snd_hda_input_jack_report(codec, event->nid); | ||
4840 | 4753 | ||
4841 | switch (codec->subsystem_id) { | 4754 | switch (codec->subsystem_id) { |
4842 | case 0x103c308f: | 4755 | case 0x103c308f: |
@@ -4861,11 +4774,33 @@ static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) | |||
4861 | AC_VERB_GET_GPIO_DATA, 0); | 4774 | AC_VERB_GET_GPIO_DATA, 0); |
4862 | /* toggle VREF state based on GPIOx status */ | 4775 | /* toggle VREF state based on GPIOx status */ |
4863 | snd_hda_codec_write(codec, codec->afg, 0, 0x7e0, | 4776 | snd_hda_codec_write(codec, codec->afg, 0, 0x7e0, |
4864 | !!(data & (1 << event->data))); | 4777 | !!(data & (1 << event->private_data))); |
4865 | break; | 4778 | break; |
4866 | } | 4779 | } |
4867 | } | 4780 | } |
4868 | 4781 | ||
4782 | static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid) | ||
4783 | { | ||
4784 | struct hda_jack_tbl *event = snd_hda_jack_tbl_get(codec, nid); | ||
4785 | if (!event) | ||
4786 | return; | ||
4787 | handle_unsol_event(codec, event); | ||
4788 | } | ||
4789 | |||
4790 | static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) | ||
4791 | { | ||
4792 | struct hda_jack_tbl *event; | ||
4793 | int tag; | ||
4794 | |||
4795 | tag = (res >> 26) & 0x7f; | ||
4796 | event = snd_hda_jack_tbl_get_from_tag(codec, tag); | ||
4797 | if (!event) | ||
4798 | return; | ||
4799 | event->jack_dirty = 1; | ||
4800 | handle_unsol_event(codec, event); | ||
4801 | snd_hda_jack_report_sync(codec); | ||
4802 | } | ||
4803 | |||
4869 | static int hp_blike_system(u32 subsystem_id); | 4804 | static int hp_blike_system(u32 subsystem_id); |
4870 | 4805 | ||
4871 | static void set_hp_led_gpio(struct hda_codec *codec) | 4806 | static void set_hp_led_gpio(struct hda_codec *codec) |
@@ -4904,7 +4839,7 @@ static void set_hp_led_gpio(struct hda_codec *codec) | |||
4904 | * Need more information on whether it is true across the entire series. | 4839 | * Need more information on whether it is true across the entire series. |
4905 | * -- kunal | 4840 | * -- kunal |
4906 | */ | 4841 | */ |
4907 | static int find_mute_led_gpio(struct hda_codec *codec, int default_polarity) | 4842 | static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity) |
4908 | { | 4843 | { |
4909 | struct sigmatel_spec *spec = codec->spec; | 4844 | struct sigmatel_spec *spec = codec->spec; |
4910 | const struct dmi_device *dev = NULL; | 4845 | const struct dmi_device *dev = NULL; |
@@ -4915,8 +4850,14 @@ static int find_mute_led_gpio(struct hda_codec *codec, int default_polarity) | |||
4915 | if (sscanf(dev->name, "HP_Mute_LED_%d_%x", | 4850 | if (sscanf(dev->name, "HP_Mute_LED_%d_%x", |
4916 | &spec->gpio_led_polarity, | 4851 | &spec->gpio_led_polarity, |
4917 | &spec->gpio_led) == 2) { | 4852 | &spec->gpio_led) == 2) { |
4918 | if (spec->gpio_led < 4) | 4853 | unsigned int max_gpio; |
4854 | max_gpio = snd_hda_param_read(codec, codec->afg, | ||
4855 | AC_PAR_GPIO_CAP); | ||
4856 | max_gpio &= AC_GPIO_IO_COUNT; | ||
4857 | if (spec->gpio_led < max_gpio) | ||
4919 | spec->gpio_led = 1 << spec->gpio_led; | 4858 | spec->gpio_led = 1 << spec->gpio_led; |
4859 | else | ||
4860 | spec->vref_mute_led_nid = spec->gpio_led; | ||
4920 | return 1; | 4861 | return 1; |
4921 | } | 4862 | } |
4922 | if (sscanf(dev->name, "HP_Mute_LED_%d", | 4863 | if (sscanf(dev->name, "HP_Mute_LED_%d", |
@@ -4924,13 +4865,21 @@ static int find_mute_led_gpio(struct hda_codec *codec, int default_polarity) | |||
4924 | set_hp_led_gpio(codec); | 4865 | set_hp_led_gpio(codec); |
4925 | return 1; | 4866 | return 1; |
4926 | } | 4867 | } |
4868 | /* BIOS bug: unfilled OEM string */ | ||
4869 | if (strstr(dev->name, "HP_Mute_LED_P_G")) { | ||
4870 | set_hp_led_gpio(codec); | ||
4871 | spec->gpio_led_polarity = 1; | ||
4872 | return 1; | ||
4873 | } | ||
4927 | } | 4874 | } |
4928 | 4875 | ||
4929 | /* | 4876 | /* |
4930 | * Fallback case - if we don't find the DMI strings, | 4877 | * Fallback case - if we don't find the DMI strings, |
4931 | * we statically set the GPIO - if not a B-series system. | 4878 | * we statically set the GPIO - if not a B-series system |
4879 | * and default polarity is provided | ||
4932 | */ | 4880 | */ |
4933 | if (!hp_blike_system(codec->subsystem_id)) { | 4881 | if (!hp_blike_system(codec->subsystem_id) && |
4882 | (default_polarity == 0 || default_polarity == 1)) { | ||
4934 | set_hp_led_gpio(codec); | 4883 | set_hp_led_gpio(codec); |
4935 | spec->gpio_led_polarity = default_polarity; | 4884 | spec->gpio_led_polarity = default_polarity; |
4936 | return 1; | 4885 | return 1; |
@@ -5017,19 +4966,11 @@ static void stac927x_proc_hook(struct snd_info_buffer *buffer, | |||
5017 | #ifdef CONFIG_PM | 4966 | #ifdef CONFIG_PM |
5018 | static int stac92xx_resume(struct hda_codec *codec) | 4967 | static int stac92xx_resume(struct hda_codec *codec) |
5019 | { | 4968 | { |
5020 | struct sigmatel_spec *spec = codec->spec; | ||
5021 | |||
5022 | stac92xx_init(codec); | 4969 | stac92xx_init(codec); |
5023 | snd_hda_codec_resume_amp(codec); | 4970 | snd_hda_codec_resume_amp(codec); |
5024 | snd_hda_codec_resume_cache(codec); | 4971 | snd_hda_codec_resume_cache(codec); |
5025 | /* fake event to set up pins again to override cached values */ | 4972 | /* fake event to set up pins again to override cached values */ |
5026 | if (spec->hp_detect) { | 4973 | stac_fake_hp_events(codec); |
5027 | if (spec->autocfg.hp_pins[0]) | ||
5028 | stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0]); | ||
5029 | else if (spec->autocfg.line_out_pins[0]) | ||
5030 | stac_issue_unsol_event(codec, | ||
5031 | spec->autocfg.line_out_pins[0]); | ||
5032 | } | ||
5033 | return 0; | 4974 | return 0; |
5034 | } | 4975 | } |
5035 | 4976 | ||
@@ -5045,15 +4986,12 @@ static int stac92xx_pre_resume(struct hda_codec *codec) | |||
5045 | struct sigmatel_spec *spec = codec->spec; | 4986 | struct sigmatel_spec *spec = codec->spec; |
5046 | 4987 | ||
5047 | /* sync mute LED */ | 4988 | /* sync mute LED */ |
5048 | if (spec->gpio_led) { | 4989 | if (spec->vref_mute_led_nid) |
5049 | if (spec->gpio_led <= 8) { | 4990 | stac_vrefout_set(codec, spec->vref_mute_led_nid, |
5050 | stac_gpio_set(codec, spec->gpio_mask, | 4991 | spec->vref_led); |
5051 | spec->gpio_dir, spec->gpio_data); | 4992 | else if (spec->gpio_led) |
5052 | } else { | 4993 | stac_gpio_set(codec, spec->gpio_mask, |
5053 | stac_vrefout_set(codec, | 4994 | spec->gpio_dir, spec->gpio_data); |
5054 | spec->gpio_led, spec->vref_led); | ||
5055 | } | ||
5056 | } | ||
5057 | return 0; | 4995 | return 0; |
5058 | } | 4996 | } |
5059 | 4997 | ||
@@ -5064,7 +5002,7 @@ static void stac92xx_set_power_state(struct hda_codec *codec, hda_nid_t fg, | |||
5064 | struct sigmatel_spec *spec = codec->spec; | 5002 | struct sigmatel_spec *spec = codec->spec; |
5065 | 5003 | ||
5066 | if (power_state == AC_PWRST_D3) { | 5004 | if (power_state == AC_PWRST_D3) { |
5067 | if (spec->gpio_led > 8) { | 5005 | if (spec->vref_mute_led_nid) { |
5068 | /* with vref-out pin used for mute led control | 5006 | /* with vref-out pin used for mute led control |
5069 | * codec AFG is prevented from D3 state | 5007 | * codec AFG is prevented from D3 state |
5070 | */ | 5008 | */ |
@@ -5117,7 +5055,7 @@ static int stac92xx_update_led_status(struct hda_codec *codec) | |||
5117 | } | 5055 | } |
5118 | } | 5056 | } |
5119 | /*polarity defines *not* muted state level*/ | 5057 | /*polarity defines *not* muted state level*/ |
5120 | if (spec->gpio_led <= 8) { | 5058 | if (!spec->vref_mute_led_nid) { |
5121 | if (muted) | 5059 | if (muted) |
5122 | spec->gpio_data &= ~spec->gpio_led; /* orange */ | 5060 | spec->gpio_data &= ~spec->gpio_led; /* orange */ |
5123 | else | 5061 | else |
@@ -5135,7 +5073,8 @@ static int stac92xx_update_led_status(struct hda_codec *codec) | |||
5135 | muted_lvl = spec->gpio_led_polarity ? | 5073 | muted_lvl = spec->gpio_led_polarity ? |
5136 | AC_PINCTL_VREF_GRD : AC_PINCTL_VREF_HIZ; | 5074 | AC_PINCTL_VREF_GRD : AC_PINCTL_VREF_HIZ; |
5137 | spec->vref_led = muted ? muted_lvl : notmtd_lvl; | 5075 | spec->vref_led = muted ? muted_lvl : notmtd_lvl; |
5138 | stac_vrefout_set(codec, spec->gpio_led, spec->vref_led); | 5076 | stac_vrefout_set(codec, spec->vref_mute_led_nid, |
5077 | spec->vref_led); | ||
5139 | } | 5078 | } |
5140 | return 0; | 5079 | return 0; |
5141 | } | 5080 | } |
@@ -5642,14 +5581,14 @@ again: | |||
5642 | 5581 | ||
5643 | codec->patch_ops = stac92xx_patch_ops; | 5582 | codec->patch_ops = stac92xx_patch_ops; |
5644 | 5583 | ||
5645 | if (find_mute_led_gpio(codec, 0)) | 5584 | if (find_mute_led_cfg(codec, -1/*no default cfg*/)) |
5646 | snd_printd("mute LED gpio %d polarity %d\n", | 5585 | snd_printd("mute LED gpio %d polarity %d\n", |
5647 | spec->gpio_led, | 5586 | spec->gpio_led, |
5648 | spec->gpio_led_polarity); | 5587 | spec->gpio_led_polarity); |
5649 | 5588 | ||
5650 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 5589 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
5651 | if (spec->gpio_led) { | 5590 | if (spec->gpio_led) { |
5652 | if (spec->gpio_led <= 8) { | 5591 | if (!spec->vref_mute_led_nid) { |
5653 | spec->gpio_mask |= spec->gpio_led; | 5592 | spec->gpio_mask |= spec->gpio_led; |
5654 | spec->gpio_dir |= spec->gpio_led; | 5593 | spec->gpio_dir |= spec->gpio_led; |
5655 | spec->gpio_data |= spec->gpio_led; | 5594 | spec->gpio_data |= spec->gpio_led; |
@@ -5830,15 +5769,13 @@ again: | |||
5830 | switch (spec->board_config) { | 5769 | switch (spec->board_config) { |
5831 | case STAC_HP_M4: | 5770 | case STAC_HP_M4: |
5832 | /* Enable VREF power saving on GPIO1 detect */ | 5771 | /* Enable VREF power saving on GPIO1 detect */ |
5833 | err = stac_add_event(spec, codec->afg, | 5772 | err = stac_add_event(codec, codec->afg, |
5834 | STAC_VREF_EVENT, 0x02); | 5773 | STAC_VREF_EVENT, 0x02); |
5835 | if (err < 0) | 5774 | if (err < 0) |
5836 | return err; | 5775 | return err; |
5837 | snd_hda_codec_write_cache(codec, codec->afg, 0, | 5776 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
5838 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02); | 5777 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02); |
5839 | snd_hda_codec_write_cache(codec, codec->afg, 0, | 5778 | snd_hda_jack_detect_enable(codec, codec->afg, 0); |
5840 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
5841 | AC_USRSP_EN | err); | ||
5842 | spec->gpio_mask |= 0x02; | 5779 | spec->gpio_mask |= 0x02; |
5843 | break; | 5780 | break; |
5844 | } | 5781 | } |
@@ -5955,14 +5892,14 @@ again: | |||
5955 | } | 5892 | } |
5956 | } | 5893 | } |
5957 | 5894 | ||
5958 | if (find_mute_led_gpio(codec, 1)) | 5895 | if (find_mute_led_cfg(codec, 1)) |
5959 | snd_printd("mute LED gpio %d polarity %d\n", | 5896 | snd_printd("mute LED gpio %d polarity %d\n", |
5960 | spec->gpio_led, | 5897 | spec->gpio_led, |
5961 | spec->gpio_led_polarity); | 5898 | spec->gpio_led_polarity); |
5962 | 5899 | ||
5963 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 5900 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
5964 | if (spec->gpio_led) { | 5901 | if (spec->gpio_led) { |
5965 | if (spec->gpio_led <= 8) { | 5902 | if (!spec->vref_mute_led_nid) { |
5966 | spec->gpio_mask |= spec->gpio_led; | 5903 | spec->gpio_mask |= spec->gpio_led; |
5967 | spec->gpio_dir |= spec->gpio_led; | 5904 | spec->gpio_dir |= spec->gpio_led; |
5968 | spec->gpio_data |= spec->gpio_led; | 5905 | spec->gpio_data |= spec->gpio_led; |
@@ -6309,14 +6246,12 @@ static int patch_stac9205(struct hda_codec *codec) | |||
6309 | snd_hda_codec_set_pincfg(codec, 0x20, 0x1c410030); | 6246 | snd_hda_codec_set_pincfg(codec, 0x20, 0x1c410030); |
6310 | 6247 | ||
6311 | /* Enable unsol response for GPIO4/Dock HP connection */ | 6248 | /* Enable unsol response for GPIO4/Dock HP connection */ |
6312 | err = stac_add_event(spec, codec->afg, STAC_VREF_EVENT, 0x01); | 6249 | err = stac_add_event(codec, codec->afg, STAC_VREF_EVENT, 0x01); |
6313 | if (err < 0) | 6250 | if (err < 0) |
6314 | return err; | 6251 | return err; |
6315 | snd_hda_codec_write_cache(codec, codec->afg, 0, | 6252 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
6316 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10); | 6253 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10); |
6317 | snd_hda_codec_write_cache(codec, codec->afg, 0, | 6254 | snd_hda_jack_detect_enable(codec, codec->afg, 0); |
6318 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
6319 | AC_USRSP_EN | err); | ||
6320 | 6255 | ||
6321 | spec->gpio_dir = 0x0b; | 6256 | spec->gpio_dir = 0x0b; |
6322 | spec->eapd_mask = 0x01; | 6257 | spec->eapd_mask = 0x01; |
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index b5137629f8e9..03e63fed9caf 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -54,6 +54,7 @@ | |||
54 | #include <sound/asoundef.h> | 54 | #include <sound/asoundef.h> |
55 | #include "hda_codec.h" | 55 | #include "hda_codec.h" |
56 | #include "hda_local.h" | 56 | #include "hda_local.h" |
57 | #include "hda_jack.h" | ||
57 | 58 | ||
58 | /* Pin Widget NID */ | 59 | /* Pin Widget NID */ |
59 | #define VT1708_HP_PIN_NID 0x20 | 60 | #define VT1708_HP_PIN_NID 0x20 |
@@ -1503,6 +1504,11 @@ static int via_build_controls(struct hda_codec *codec) | |||
1503 | analog_low_current_mode(codec); | 1504 | analog_low_current_mode(codec); |
1504 | 1505 | ||
1505 | via_free_kctls(codec); /* no longer needed */ | 1506 | via_free_kctls(codec); /* no longer needed */ |
1507 | |||
1508 | err = snd_hda_jack_add_kctls(codec, &spec->autocfg); | ||
1509 | if (err < 0) | ||
1510 | return err; | ||
1511 | |||
1506 | return 0; | 1512 | return 0; |
1507 | } | 1513 | } |
1508 | 1514 | ||
@@ -1714,6 +1720,7 @@ static void via_unsol_event(struct hda_codec *codec, | |||
1714 | unsigned int res) | 1720 | unsigned int res) |
1715 | { | 1721 | { |
1716 | res >>= 26; | 1722 | res >>= 26; |
1723 | res = snd_hda_jack_get_action(codec, res); | ||
1717 | 1724 | ||
1718 | if (res & VIA_JACK_EVENT) | 1725 | if (res & VIA_JACK_EVENT) |
1719 | set_widgets_power_state(codec); | 1726 | set_widgets_power_state(codec); |
@@ -1724,6 +1731,7 @@ static void via_unsol_event(struct hda_codec *codec, | |||
1724 | via_hp_automute(codec); | 1731 | via_hp_automute(codec); |
1725 | else if (res == VIA_GPIO_EVENT) | 1732 | else if (res == VIA_GPIO_EVENT) |
1726 | via_gpio_control(codec); | 1733 | via_gpio_control(codec); |
1734 | snd_hda_jack_report_sync(codec); | ||
1727 | } | 1735 | } |
1728 | 1736 | ||
1729 | #ifdef CONFIG_PM | 1737 | #ifdef CONFIG_PM |
@@ -2200,7 +2208,10 @@ static int via_auto_create_loopback_switch(struct hda_codec *codec) | |||
2200 | { | 2208 | { |
2201 | struct via_spec *spec = codec->spec; | 2209 | struct via_spec *spec = codec->spec; |
2202 | 2210 | ||
2203 | if (!spec->aa_mix_nid || !spec->out_mix_path.depth) | 2211 | if (!spec->aa_mix_nid) |
2212 | return 0; /* no loopback switching available */ | ||
2213 | if (!(spec->out_mix_path.depth || spec->hp_mix_path.depth || | ||
2214 | spec->speaker_path.depth)) | ||
2204 | return 0; /* no loopback switching available */ | 2215 | return 0; /* no loopback switching available */ |
2205 | if (!via_clone_control(spec, &via_aamix_ctl_enum)) | 2216 | if (!via_clone_control(spec, &via_aamix_ctl_enum)) |
2206 | return -ENOMEM; | 2217 | return -ENOMEM; |
@@ -2736,9 +2747,8 @@ static void via_auto_init_unsol_event(struct hda_codec *codec) | |||
2736 | int i; | 2747 | int i; |
2737 | 2748 | ||
2738 | if (cfg->hp_pins[0] && is_jack_detectable(codec, cfg->hp_pins[0])) | 2749 | if (cfg->hp_pins[0] && is_jack_detectable(codec, cfg->hp_pins[0])) |
2739 | snd_hda_codec_write(codec, cfg->hp_pins[0], 0, | 2750 | snd_hda_jack_detect_enable(codec, cfg->hp_pins[0], |
2740 | AC_VERB_SET_UNSOLICITED_ENABLE, | 2751 | VIA_HP_EVENT | VIA_JACK_EVENT); |
2741 | AC_USRSP_EN | VIA_HP_EVENT | VIA_JACK_EVENT); | ||
2742 | 2752 | ||
2743 | if (cfg->speaker_pins[0]) | 2753 | if (cfg->speaker_pins[0]) |
2744 | ev = VIA_LINE_EVENT; | 2754 | ev = VIA_LINE_EVENT; |
@@ -2747,16 +2757,14 @@ static void via_auto_init_unsol_event(struct hda_codec *codec) | |||
2747 | for (i = 0; i < cfg->line_outs; i++) { | 2757 | for (i = 0; i < cfg->line_outs; i++) { |
2748 | if (cfg->line_out_pins[i] && | 2758 | if (cfg->line_out_pins[i] && |
2749 | is_jack_detectable(codec, cfg->line_out_pins[i])) | 2759 | is_jack_detectable(codec, cfg->line_out_pins[i])) |
2750 | snd_hda_codec_write(codec, cfg->line_out_pins[i], 0, | 2760 | snd_hda_jack_detect_enable(codec, cfg->line_out_pins[i], |
2751 | AC_VERB_SET_UNSOLICITED_ENABLE, | 2761 | ev | VIA_JACK_EVENT); |
2752 | AC_USRSP_EN | ev | VIA_JACK_EVENT); | ||
2753 | } | 2762 | } |
2754 | 2763 | ||
2755 | for (i = 0; i < cfg->num_inputs; i++) { | 2764 | for (i = 0; i < cfg->num_inputs; i++) { |
2756 | if (is_jack_detectable(codec, cfg->inputs[i].pin)) | 2765 | if (is_jack_detectable(codec, cfg->inputs[i].pin)) |
2757 | snd_hda_codec_write(codec, cfg->inputs[i].pin, 0, | 2766 | snd_hda_jack_detect_enable(codec, cfg->inputs[i].pin, |
2758 | AC_VERB_SET_UNSOLICITED_ENABLE, | 2767 | VIA_JACK_EVENT); |
2759 | AC_USRSP_EN | VIA_JACK_EVENT); | ||
2760 | } | 2768 | } |
2761 | } | 2769 | } |
2762 | 2770 | ||
@@ -2779,6 +2787,7 @@ static int via_init(struct hda_codec *codec) | |||
2779 | 2787 | ||
2780 | via_hp_automute(codec); | 2788 | via_hp_automute(codec); |
2781 | vt1708_update_hp_work(spec); | 2789 | vt1708_update_hp_work(spec); |
2790 | snd_hda_jack_report_sync(codec); | ||
2782 | 2791 | ||
2783 | return 0; | 2792 | return 0; |
2784 | } | 2793 | } |
@@ -2789,6 +2798,7 @@ static void vt1708_update_hp_jack_state(struct work_struct *work) | |||
2789 | vt1708_hp_work.work); | 2798 | vt1708_hp_work.work); |
2790 | if (spec->codec_type != VT1708) | 2799 | if (spec->codec_type != VT1708) |
2791 | return; | 2800 | return; |
2801 | snd_hda_jack_set_dirty_all(spec->codec); | ||
2792 | /* if jack state toggled */ | 2802 | /* if jack state toggled */ |
2793 | if (spec->vt1708_hp_present | 2803 | if (spec->vt1708_hp_present |
2794 | != snd_hda_jack_detect(spec->codec, spec->autocfg.hp_pins[0])) { | 2804 | != snd_hda_jack_detect(spec->codec, spec->autocfg.hp_pins[0])) { |