diff options
Diffstat (limited to 'sound/pci/hda')
33 files changed, 1977 insertions, 6010 deletions
diff --git a/sound/pci/hda/Makefile b/sound/pci/hda/Makefile index 87365d5ea2a..f928d663472 100644 --- a/sound/pci/hda/Makefile +++ b/sound/pci/hda/Makefile | |||
@@ -6,6 +6,9 @@ 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 |
7 | snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o | 7 | snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o |
8 | 8 | ||
9 | # for trace-points | ||
10 | CFLAGS_hda_codec.o := -I$(src) | ||
11 | |||
9 | snd-hda-codec-realtek-objs := patch_realtek.o | 12 | snd-hda-codec-realtek-objs := patch_realtek.o |
10 | snd-hda-codec-cmedia-objs := patch_cmedia.o | 13 | snd-hda-codec-cmedia-objs := patch_cmedia.o |
11 | snd-hda-codec-analog-objs := patch_analog.o | 14 | snd-hda-codec-analog-objs := patch_analog.o |
diff --git a/sound/pci/hda/alc260_quirks.c b/sound/pci/hda/alc260_quirks.c index 21ec2cb100b..3b5170b9700 100644 --- a/sound/pci/hda/alc260_quirks.c +++ b/sound/pci/hda/alc260_quirks.c | |||
@@ -7,9 +7,6 @@ | |||
7 | enum { | 7 | enum { |
8 | ALC260_AUTO, | 8 | ALC260_AUTO, |
9 | ALC260_BASIC, | 9 | ALC260_BASIC, |
10 | ALC260_HP, | ||
11 | ALC260_HP_DC7600, | ||
12 | ALC260_HP_3013, | ||
13 | ALC260_FUJITSU_S702X, | 10 | ALC260_FUJITSU_S702X, |
14 | ALC260_ACER, | 11 | ALC260_ACER, |
15 | ALC260_WILL, | 12 | ALC260_WILL, |
@@ -142,8 +139,6 @@ static const struct hda_channel_mode alc260_modes[1] = { | |||
142 | /* Mixer combinations | 139 | /* Mixer combinations |
143 | * | 140 | * |
144 | * basic: base_output + input + pc_beep + capture | 141 | * basic: base_output + input + pc_beep + capture |
145 | * HP: base_output + input + capture_alt | ||
146 | * HP_3013: hp_3013 + input + capture | ||
147 | * fujitsu: fujitsu + capture | 142 | * fujitsu: fujitsu + capture |
148 | * acer: acer + capture | 143 | * acer: acer + capture |
149 | */ | 144 | */ |
@@ -170,145 +165,6 @@ static const struct snd_kcontrol_new alc260_input_mixer[] = { | |||
170 | { } /* end */ | 165 | { } /* end */ |
171 | }; | 166 | }; |
172 | 167 | ||
173 | /* update HP, line and mono out pins according to the master switch */ | ||
174 | static void alc260_hp_master_update(struct hda_codec *codec) | ||
175 | { | ||
176 | update_speakers(codec); | ||
177 | } | ||
178 | |||
179 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, | ||
180 | struct snd_ctl_elem_value *ucontrol) | ||
181 | { | ||
182 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
183 | struct alc_spec *spec = codec->spec; | ||
184 | *ucontrol->value.integer.value = !spec->master_mute; | ||
185 | return 0; | ||
186 | } | ||
187 | |||
188 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, | ||
189 | struct snd_ctl_elem_value *ucontrol) | ||
190 | { | ||
191 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
192 | struct alc_spec *spec = codec->spec; | ||
193 | int val = !*ucontrol->value.integer.value; | ||
194 | |||
195 | if (val == spec->master_mute) | ||
196 | return 0; | ||
197 | spec->master_mute = val; | ||
198 | alc260_hp_master_update(codec); | ||
199 | return 1; | ||
200 | } | ||
201 | |||
202 | static const struct snd_kcontrol_new alc260_hp_output_mixer[] = { | ||
203 | { | ||
204 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
205 | .name = "Master Playback Switch", | ||
206 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, | ||
207 | .info = snd_ctl_boolean_mono_info, | ||
208 | .get = alc260_hp_master_sw_get, | ||
209 | .put = alc260_hp_master_sw_put, | ||
210 | }, | ||
211 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), | ||
212 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), | ||
213 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), | ||
214 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), | ||
215 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, | ||
216 | HDA_OUTPUT), | ||
217 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), | ||
218 | { } /* end */ | ||
219 | }; | ||
220 | |||
221 | static const struct hda_verb alc260_hp_unsol_verbs[] = { | ||
222 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
223 | {}, | ||
224 | }; | ||
225 | |||
226 | static void alc260_hp_setup(struct hda_codec *codec) | ||
227 | { | ||
228 | struct alc_spec *spec = codec->spec; | ||
229 | |||
230 | spec->autocfg.hp_pins[0] = 0x0f; | ||
231 | spec->autocfg.speaker_pins[0] = 0x10; | ||
232 | spec->autocfg.speaker_pins[1] = 0x11; | ||
233 | spec->automute = 1; | ||
234 | spec->automute_mode = ALC_AUTOMUTE_PIN; | ||
235 | } | ||
236 | |||
237 | static const struct snd_kcontrol_new alc260_hp_3013_mixer[] = { | ||
238 | { | ||
239 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
240 | .name = "Master Playback Switch", | ||
241 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, | ||
242 | .info = snd_ctl_boolean_mono_info, | ||
243 | .get = alc260_hp_master_sw_get, | ||
244 | .put = alc260_hp_master_sw_put, | ||
245 | }, | ||
246 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), | ||
247 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), | ||
248 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), | ||
249 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), | ||
250 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), | ||
251 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
252 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), | ||
253 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), | ||
254 | { } /* end */ | ||
255 | }; | ||
256 | |||
257 | static void alc260_hp_3013_setup(struct hda_codec *codec) | ||
258 | { | ||
259 | struct alc_spec *spec = codec->spec; | ||
260 | |||
261 | spec->autocfg.hp_pins[0] = 0x15; | ||
262 | spec->autocfg.speaker_pins[0] = 0x10; | ||
263 | spec->autocfg.speaker_pins[1] = 0x11; | ||
264 | spec->automute = 1; | ||
265 | spec->automute_mode = ALC_AUTOMUTE_PIN; | ||
266 | } | ||
267 | |||
268 | static const struct hda_bind_ctls alc260_dc7600_bind_master_vol = { | ||
269 | .ops = &snd_hda_bind_vol, | ||
270 | .values = { | ||
271 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), | ||
272 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), | ||
273 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), | ||
274 | 0 | ||
275 | }, | ||
276 | }; | ||
277 | |||
278 | static const struct hda_bind_ctls alc260_dc7600_bind_switch = { | ||
279 | .ops = &snd_hda_bind_sw, | ||
280 | .values = { | ||
281 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), | ||
282 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | ||
283 | 0 | ||
284 | }, | ||
285 | }; | ||
286 | |||
287 | static const struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { | ||
288 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), | ||
289 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), | ||
290 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), | ||
291 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), | ||
292 | { } /* end */ | ||
293 | }; | ||
294 | |||
295 | static const struct hda_verb alc260_hp_3013_unsol_verbs[] = { | ||
296 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
297 | {}, | ||
298 | }; | ||
299 | |||
300 | static void alc260_hp_3012_setup(struct hda_codec *codec) | ||
301 | { | ||
302 | struct alc_spec *spec = codec->spec; | ||
303 | |||
304 | spec->autocfg.hp_pins[0] = 0x10; | ||
305 | spec->autocfg.speaker_pins[0] = 0x0f; | ||
306 | spec->autocfg.speaker_pins[1] = 0x11; | ||
307 | spec->autocfg.speaker_pins[2] = 0x15; | ||
308 | spec->automute = 1; | ||
309 | spec->automute_mode = ALC_AUTOMUTE_PIN; | ||
310 | } | ||
311 | |||
312 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, | 168 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
313 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. | 169 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
314 | */ | 170 | */ |
@@ -480,106 +336,6 @@ static const struct hda_verb alc260_init_verbs[] = { | |||
480 | { } | 336 | { } |
481 | }; | 337 | }; |
482 | 338 | ||
483 | #if 0 /* should be identical with alc260_init_verbs? */ | ||
484 | static const struct hda_verb alc260_hp_init_verbs[] = { | ||
485 | /* Headphone and output */ | ||
486 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | ||
487 | /* mono output */ | ||
488 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | ||
489 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | ||
490 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
491 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | ||
492 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
493 | /* Line In pin widget for input */ | ||
494 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
495 | /* Line-2 pin widget for output */ | ||
496 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | ||
497 | /* CD pin widget for input */ | ||
498 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
499 | /* unmute amp left and right */ | ||
500 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, | ||
501 | /* set connection select to line in (default select for this ADC) */ | ||
502 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
503 | /* unmute Line-Out mixer amp left and right (volume = 0) */ | ||
504 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | ||
505 | /* mute pin widget amp left and right (no gain on this amp) */ | ||
506 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | ||
507 | /* unmute HP mixer amp left and right (volume = 0) */ | ||
508 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | ||
509 | /* mute pin widget amp left and right (no gain on this amp) */ | ||
510 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | ||
511 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & | ||
512 | * Line In 2 = 0x03 | ||
513 | */ | ||
514 | /* mute analog inputs */ | ||
515 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
516 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
517 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
518 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
519 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
520 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ | ||
521 | /* Unmute Front out path */ | ||
522 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
523 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
524 | /* Unmute Headphone out path */ | ||
525 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
526 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
527 | /* Unmute Mono out path */ | ||
528 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
529 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
530 | { } | ||
531 | }; | ||
532 | #endif | ||
533 | |||
534 | static const struct hda_verb alc260_hp_3013_init_verbs[] = { | ||
535 | /* Line out and output */ | ||
536 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | ||
537 | /* mono output */ | ||
538 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | ||
539 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | ||
540 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
541 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | ||
542 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
543 | /* Line In pin widget for input */ | ||
544 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
545 | /* Headphone pin widget for output */ | ||
546 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | ||
547 | /* CD pin widget for input */ | ||
548 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
549 | /* unmute amp left and right */ | ||
550 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, | ||
551 | /* set connection select to line in (default select for this ADC) */ | ||
552 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
553 | /* unmute Line-Out mixer amp left and right (volume = 0) */ | ||
554 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | ||
555 | /* mute pin widget amp left and right (no gain on this amp) */ | ||
556 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | ||
557 | /* unmute HP mixer amp left and right (volume = 0) */ | ||
558 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | ||
559 | /* mute pin widget amp left and right (no gain on this amp) */ | ||
560 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | ||
561 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & | ||
562 | * Line In 2 = 0x03 | ||
563 | */ | ||
564 | /* mute analog inputs */ | ||
565 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
566 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
567 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
568 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
569 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
570 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ | ||
571 | /* Unmute Front out path */ | ||
572 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
573 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
574 | /* Unmute Headphone out path */ | ||
575 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
576 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
577 | /* Unmute Mono out path */ | ||
578 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
579 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
580 | { } | ||
581 | }; | ||
582 | |||
583 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x | 339 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
584 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD | 340 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
585 | * audio = 0x16, internal speaker = 0x10. | 341 | * audio = 0x16, internal speaker = 0x10. |
@@ -1093,9 +849,6 @@ static const struct hda_verb alc260_test_init_verbs[] = { | |||
1093 | */ | 849 | */ |
1094 | static const char * const alc260_models[ALC260_MODEL_LAST] = { | 850 | static const char * const alc260_models[ALC260_MODEL_LAST] = { |
1095 | [ALC260_BASIC] = "basic", | 851 | [ALC260_BASIC] = "basic", |
1096 | [ALC260_HP] = "hp", | ||
1097 | [ALC260_HP_3013] = "hp-3013", | ||
1098 | [ALC260_HP_DC7600] = "hp-dc7600", | ||
1099 | [ALC260_FUJITSU_S702X] = "fujitsu", | 852 | [ALC260_FUJITSU_S702X] = "fujitsu", |
1100 | [ALC260_ACER] = "acer", | 853 | [ALC260_ACER] = "acer", |
1101 | [ALC260_WILL] = "will", | 854 | [ALC260_WILL] = "will", |
@@ -1112,15 +865,6 @@ static const struct snd_pci_quirk alc260_cfg_tbl[] = { | |||
1112 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), | 865 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
1113 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), | 866 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
1114 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), | 867 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
1115 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), | ||
1116 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ | ||
1117 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), | ||
1118 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), | ||
1119 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), | ||
1120 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), | ||
1121 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), | ||
1122 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), | ||
1123 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), | ||
1124 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), | 868 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
1125 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), | 869 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
1126 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), | 870 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
@@ -1144,54 +888,6 @@ static const struct alc_config_preset alc260_presets[] = { | |||
1144 | .channel_mode = alc260_modes, | 888 | .channel_mode = alc260_modes, |
1145 | .input_mux = &alc260_capture_source, | 889 | .input_mux = &alc260_capture_source, |
1146 | }, | 890 | }, |
1147 | [ALC260_HP] = { | ||
1148 | .mixers = { alc260_hp_output_mixer, | ||
1149 | alc260_input_mixer }, | ||
1150 | .init_verbs = { alc260_init_verbs, | ||
1151 | alc260_hp_unsol_verbs }, | ||
1152 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | ||
1153 | .dac_nids = alc260_dac_nids, | ||
1154 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), | ||
1155 | .adc_nids = alc260_adc_nids_alt, | ||
1156 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | ||
1157 | .channel_mode = alc260_modes, | ||
1158 | .input_mux = &alc260_capture_source, | ||
1159 | .unsol_event = alc_sku_unsol_event, | ||
1160 | .setup = alc260_hp_setup, | ||
1161 | .init_hook = alc_inithook, | ||
1162 | }, | ||
1163 | [ALC260_HP_DC7600] = { | ||
1164 | .mixers = { alc260_hp_dc7600_mixer, | ||
1165 | alc260_input_mixer }, | ||
1166 | .init_verbs = { alc260_init_verbs, | ||
1167 | alc260_hp_dc7600_verbs }, | ||
1168 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | ||
1169 | .dac_nids = alc260_dac_nids, | ||
1170 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), | ||
1171 | .adc_nids = alc260_adc_nids_alt, | ||
1172 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | ||
1173 | .channel_mode = alc260_modes, | ||
1174 | .input_mux = &alc260_capture_source, | ||
1175 | .unsol_event = alc_sku_unsol_event, | ||
1176 | .setup = alc260_hp_3012_setup, | ||
1177 | .init_hook = alc_inithook, | ||
1178 | }, | ||
1179 | [ALC260_HP_3013] = { | ||
1180 | .mixers = { alc260_hp_3013_mixer, | ||
1181 | alc260_input_mixer }, | ||
1182 | .init_verbs = { alc260_hp_3013_init_verbs, | ||
1183 | alc260_hp_3013_unsol_verbs }, | ||
1184 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | ||
1185 | .dac_nids = alc260_dac_nids, | ||
1186 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), | ||
1187 | .adc_nids = alc260_adc_nids_alt, | ||
1188 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | ||
1189 | .channel_mode = alc260_modes, | ||
1190 | .input_mux = &alc260_capture_source, | ||
1191 | .unsol_event = alc_sku_unsol_event, | ||
1192 | .setup = alc260_hp_3013_setup, | ||
1193 | .init_hook = alc_inithook, | ||
1194 | }, | ||
1195 | [ALC260_FUJITSU_S702X] = { | 891 | [ALC260_FUJITSU_S702X] = { |
1196 | .mixers = { alc260_fujitsu_mixer }, | 892 | .mixers = { alc260_fujitsu_mixer }, |
1197 | .init_verbs = { alc260_fujitsu_init_verbs }, | 893 | .init_verbs = { alc260_fujitsu_init_verbs }, |
diff --git a/sound/pci/hda/alc262_quirks.c b/sound/pci/hda/alc262_quirks.c index 8d2097d7764..7894b2b5aac 100644 --- a/sound/pci/hda/alc262_quirks.c +++ b/sound/pci/hda/alc262_quirks.c | |||
@@ -10,13 +10,7 @@ enum { | |||
10 | ALC262_HIPPO, | 10 | ALC262_HIPPO, |
11 | ALC262_HIPPO_1, | 11 | ALC262_HIPPO_1, |
12 | ALC262_FUJITSU, | 12 | ALC262_FUJITSU, |
13 | ALC262_HP_BPC, | ||
14 | ALC262_HP_BPC_D7000_WL, | ||
15 | ALC262_HP_BPC_D7000_WF, | ||
16 | ALC262_HP_TC_T5735, | ||
17 | ALC262_HP_RP5700, | ||
18 | ALC262_BENQ_ED8, | 13 | ALC262_BENQ_ED8, |
19 | ALC262_SONY_ASSAMD, | ||
20 | ALC262_BENQ_T31, | 14 | ALC262_BENQ_T31, |
21 | ALC262_ULTRA, | 15 | ALC262_ULTRA, |
22 | ALC262_LENOVO_3000, | 16 | ALC262_LENOVO_3000, |
@@ -66,164 +60,31 @@ static const struct snd_kcontrol_new alc262_base_mixer[] = { | |||
66 | { } /* end */ | 60 | { } /* end */ |
67 | }; | 61 | }; |
68 | 62 | ||
69 | /* update HP, line and mono-out pins according to the master switch */ | 63 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
70 | #define alc262_hp_master_update alc260_hp_master_update | ||
71 | 64 | ||
72 | static void alc262_hp_bpc_setup(struct hda_codec *codec) | 65 | static int alc262_hippo_master_sw_get(struct snd_kcontrol *kcontrol, |
66 | struct snd_ctl_elem_value *ucontrol) | ||
73 | { | 67 | { |
68 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
74 | struct alc_spec *spec = codec->spec; | 69 | struct alc_spec *spec = codec->spec; |
75 | 70 | *ucontrol->value.integer.value = !spec->master_mute; | |
76 | spec->autocfg.hp_pins[0] = 0x1b; | 71 | return 0; |
77 | spec->autocfg.speaker_pins[0] = 0x16; | ||
78 | spec->automute = 1; | ||
79 | spec->automute_mode = ALC_AUTOMUTE_PIN; | ||
80 | } | 72 | } |
81 | 73 | ||
82 | static void alc262_hp_wildwest_setup(struct hda_codec *codec) | 74 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
83 | { | 75 | struct snd_ctl_elem_value *ucontrol) |
84 | struct alc_spec *spec = codec->spec; | ||
85 | |||
86 | spec->autocfg.hp_pins[0] = 0x15; | ||
87 | spec->autocfg.speaker_pins[0] = 0x16; | ||
88 | spec->automute = 1; | ||
89 | spec->automute_mode = ALC_AUTOMUTE_PIN; | ||
90 | } | ||
91 | |||
92 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get | ||
93 | #define alc262_hp_master_sw_put alc260_hp_master_sw_put | ||
94 | |||
95 | #define ALC262_HP_MASTER_SWITCH \ | ||
96 | { \ | ||
97 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | ||
98 | .name = "Master Playback Switch", \ | ||
99 | .info = snd_ctl_boolean_mono_info, \ | ||
100 | .get = alc262_hp_master_sw_get, \ | ||
101 | .put = alc262_hp_master_sw_put, \ | ||
102 | }, \ | ||
103 | { \ | ||
104 | .iface = NID_MAPPING, \ | ||
105 | .name = "Master Playback Switch", \ | ||
106 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ | ||
107 | } | ||
108 | |||
109 | |||
110 | static const struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { | ||
111 | ALC262_HP_MASTER_SWITCH, | ||
112 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
113 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
114 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
115 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, | ||
116 | HDA_OUTPUT), | ||
117 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, | ||
118 | HDA_OUTPUT), | ||
119 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
120 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
121 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
122 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
123 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
124 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
125 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
126 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
127 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
128 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
129 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), | ||
130 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), | ||
131 | { } /* end */ | ||
132 | }; | ||
133 | |||
134 | static const struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { | ||
135 | ALC262_HP_MASTER_SWITCH, | ||
136 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
137 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
138 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
139 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
140 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, | ||
141 | HDA_OUTPUT), | ||
142 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, | ||
143 | HDA_OUTPUT), | ||
144 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
145 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
146 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT), | ||
147 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
148 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
149 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
150 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
151 | { } /* end */ | ||
152 | }; | ||
153 | |||
154 | static const struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { | ||
155 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
156 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
157 | HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
158 | { } /* end */ | ||
159 | }; | ||
160 | |||
161 | /* mute/unmute internal speaker according to the hp jack and mute state */ | ||
162 | static void alc262_hp_t5735_setup(struct hda_codec *codec) | ||
163 | { | 76 | { |
77 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
164 | struct alc_spec *spec = codec->spec; | 78 | struct alc_spec *spec = codec->spec; |
79 | int val = !*ucontrol->value.integer.value; | ||
165 | 80 | ||
166 | spec->autocfg.hp_pins[0] = 0x15; | 81 | if (val == spec->master_mute) |
167 | spec->autocfg.speaker_pins[0] = 0x14; | 82 | return 0; |
168 | spec->automute = 1; | 83 | spec->master_mute = val; |
169 | spec->automute_mode = ALC_AUTOMUTE_PIN; | 84 | update_outputs(codec); |
85 | return 1; | ||
170 | } | 86 | } |
171 | 87 | ||
172 | static const struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { | ||
173 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
174 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
175 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
176 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
177 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
178 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
179 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
180 | { } /* end */ | ||
181 | }; | ||
182 | |||
183 | static const struct hda_verb alc262_hp_t5735_verbs[] = { | ||
184 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
185 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
186 | |||
187 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
188 | { } | ||
189 | }; | ||
190 | |||
191 | static const struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { | ||
192 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
193 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
194 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | ||
195 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), | ||
196 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
197 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
198 | { } /* end */ | ||
199 | }; | ||
200 | |||
201 | static const struct hda_verb alc262_hp_rp5700_verbs[] = { | ||
202 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
203 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
204 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
205 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
206 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
207 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
208 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
209 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
210 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, | ||
211 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, | ||
212 | {} | ||
213 | }; | ||
214 | |||
215 | static const struct hda_input_mux alc262_hp_rp5700_capture_source = { | ||
216 | .num_items = 1, | ||
217 | .items = { | ||
218 | { "Line", 0x1 }, | ||
219 | }, | ||
220 | }; | ||
221 | |||
222 | /* bind hp and internal speaker mute (with plug check) as master switch */ | ||
223 | #define alc262_hippo_master_update alc262_hp_master_update | ||
224 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get | ||
225 | #define alc262_hippo_master_sw_put alc262_hp_master_sw_put | ||
226 | |||
227 | #define ALC262_HIPPO_MASTER_SWITCH \ | 88 | #define ALC262_HIPPO_MASTER_SWITCH \ |
228 | { \ | 89 | { \ |
229 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 90 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
@@ -239,6 +100,9 @@ static const struct hda_input_mux alc262_hp_rp5700_capture_source = { | |||
239 | (SUBDEV_SPEAKER(0) << 16), \ | 100 | (SUBDEV_SPEAKER(0) << 16), \ |
240 | } | 101 | } |
241 | 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 | |||
242 | static const struct snd_kcontrol_new alc262_hippo_mixer[] = { | 106 | static const struct snd_kcontrol_new alc262_hippo_mixer[] = { |
243 | ALC262_HIPPO_MASTER_SWITCH, | 107 | ALC262_HIPPO_MASTER_SWITCH, |
244 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 108 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
@@ -279,8 +143,7 @@ static void alc262_hippo_setup(struct hda_codec *codec) | |||
279 | 143 | ||
280 | spec->autocfg.hp_pins[0] = 0x15; | 144 | spec->autocfg.hp_pins[0] = 0x15; |
281 | spec->autocfg.speaker_pins[0] = 0x14; | 145 | spec->autocfg.speaker_pins[0] = 0x14; |
282 | spec->automute = 1; | 146 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
283 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
284 | } | 147 | } |
285 | 148 | ||
286 | static void alc262_hippo1_setup(struct hda_codec *codec) | 149 | static void alc262_hippo1_setup(struct hda_codec *codec) |
@@ -289,8 +152,7 @@ static void alc262_hippo1_setup(struct hda_codec *codec) | |||
289 | 152 | ||
290 | spec->autocfg.hp_pins[0] = 0x1b; | 153 | spec->autocfg.hp_pins[0] = 0x1b; |
291 | spec->autocfg.speaker_pins[0] = 0x14; | 154 | spec->autocfg.speaker_pins[0] = 0x14; |
292 | spec->automute = 1; | 155 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
293 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
294 | } | 156 | } |
295 | 157 | ||
296 | 158 | ||
@@ -353,8 +215,7 @@ static void alc262_tyan_setup(struct hda_codec *codec) | |||
353 | 215 | ||
354 | spec->autocfg.hp_pins[0] = 0x1b; | 216 | spec->autocfg.hp_pins[0] = 0x1b; |
355 | spec->autocfg.speaker_pins[0] = 0x15; | 217 | spec->autocfg.speaker_pins[0] = 0x15; |
356 | spec->automute = 1; | 218 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
357 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
358 | } | 219 | } |
359 | 220 | ||
360 | 221 | ||
@@ -496,8 +357,7 @@ static void alc262_toshiba_s06_setup(struct hda_codec *codec) | |||
496 | spec->ext_mic_pin = 0x18; | 357 | spec->ext_mic_pin = 0x18; |
497 | spec->int_mic_pin = 0x12; | 358 | spec->int_mic_pin = 0x12; |
498 | spec->auto_mic = 1; | 359 | spec->auto_mic = 1; |
499 | spec->automute = 1; | 360 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_PIN); |
500 | spec->automute_mode = ALC_AUTOMUTE_PIN; | ||
501 | } | 361 | } |
502 | 362 | ||
503 | /* | 363 | /* |
@@ -571,27 +431,6 @@ static const struct hda_input_mux alc262_fujitsu_capture_source = { | |||
571 | }, | 431 | }, |
572 | }; | 432 | }; |
573 | 433 | ||
574 | static const struct hda_input_mux alc262_HP_capture_source = { | ||
575 | .num_items = 5, | ||
576 | .items = { | ||
577 | { "Mic", 0x0 }, | ||
578 | { "Front Mic", 0x1 }, | ||
579 | { "Line", 0x2 }, | ||
580 | { "CD", 0x4 }, | ||
581 | { "AUX IN", 0x6 }, | ||
582 | }, | ||
583 | }; | ||
584 | |||
585 | static const struct hda_input_mux alc262_HP_D7000_capture_source = { | ||
586 | .num_items = 4, | ||
587 | .items = { | ||
588 | { "Mic", 0x0 }, | ||
589 | { "Front Mic", 0x2 }, | ||
590 | { "Line", 0x1 }, | ||
591 | { "CD", 0x4 }, | ||
592 | }, | ||
593 | }; | ||
594 | |||
595 | static void alc262_fujitsu_setup(struct hda_codec *codec) | 434 | static void alc262_fujitsu_setup(struct hda_codec *codec) |
596 | { | 435 | { |
597 | struct alc_spec *spec = codec->spec; | 436 | struct alc_spec *spec = codec->spec; |
@@ -599,8 +438,7 @@ static void alc262_fujitsu_setup(struct hda_codec *codec) | |||
599 | spec->autocfg.hp_pins[0] = 0x14; | 438 | spec->autocfg.hp_pins[0] = 0x14; |
600 | spec->autocfg.hp_pins[1] = 0x1b; | 439 | spec->autocfg.hp_pins[1] = 0x1b; |
601 | spec->autocfg.speaker_pins[0] = 0x15; | 440 | spec->autocfg.speaker_pins[0] = 0x15; |
602 | spec->automute = 1; | 441 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
603 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
604 | } | 442 | } |
605 | 443 | ||
606 | /* bind volumes of both NID 0x0c and 0x0d */ | 444 | /* bind volumes of both NID 0x0c and 0x0d */ |
@@ -646,8 +484,7 @@ static void alc262_lenovo_3000_setup(struct hda_codec *codec) | |||
646 | spec->autocfg.hp_pins[0] = 0x1b; | 484 | spec->autocfg.hp_pins[0] = 0x1b; |
647 | spec->autocfg.speaker_pins[0] = 0x14; | 485 | spec->autocfg.speaker_pins[0] = 0x14; |
648 | spec->autocfg.speaker_pins[1] = 0x16; | 486 | spec->autocfg.speaker_pins[1] = 0x16; |
649 | spec->automute = 1; | 487 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
650 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
651 | } | 488 | } |
652 | 489 | ||
653 | static const struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { | 490 | static const struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
@@ -752,8 +589,8 @@ static void alc262_ultra_automute(struct hda_codec *codec) | |||
752 | mute = 0; | 589 | mute = 0; |
753 | /* auto-mute only when HP is used as HP */ | 590 | /* auto-mute only when HP is used as HP */ |
754 | if (!spec->cur_mux[0]) { | 591 | if (!spec->cur_mux[0]) { |
755 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); | 592 | spec->hp_jack_present = snd_hda_jack_detect(codec, 0x15); |
756 | if (spec->jack_present) | 593 | if (spec->hp_jack_present) |
757 | mute = HDA_AMP_MUTE; | 594 | mute = HDA_AMP_MUTE; |
758 | } | 595 | } |
759 | /* mute/unmute internal speaker */ | 596 | /* mute/unmute internal speaker */ |
@@ -817,206 +654,6 @@ static const struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { | |||
817 | { } /* end */ | 654 | { } /* end */ |
818 | }; | 655 | }; |
819 | 656 | ||
820 | static const struct hda_verb alc262_HP_BPC_init_verbs[] = { | ||
821 | /* | ||
822 | * Unmute ADC0-2 and set the default input to mic-in | ||
823 | */ | ||
824 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
825 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
826 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
827 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
828 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
829 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
830 | |||
831 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | ||
832 | * mixer widget | ||
833 | * Note: PASD motherboards uses the Line In 2 as the input for | ||
834 | * front panel mic (mic 2) | ||
835 | */ | ||
836 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | ||
837 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
838 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
839 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
840 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
841 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
842 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | ||
843 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | ||
844 | |||
845 | /* | ||
846 | * Set up output mixers (0x0c - 0x0e) | ||
847 | */ | ||
848 | /* set vol=0 to output mixers */ | ||
849 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
850 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
851 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
852 | |||
853 | /* set up input amps for analog loopback */ | ||
854 | /* Amp Indices: DAC = 0, mixer = 1 */ | ||
855 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
856 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
857 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
858 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
859 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
860 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
861 | |||
862 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
863 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
864 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
865 | |||
866 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
867 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
868 | |||
869 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
870 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
871 | |||
872 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
873 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
874 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
875 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
876 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
877 | |||
878 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | ||
879 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | ||
880 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | ||
881 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | ||
882 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | ||
883 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | ||
884 | |||
885 | |||
886 | /* FIXME: use matrix-type input source selection */ | ||
887 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ | ||
888 | /* Input mixer1: only unmute Mic */ | ||
889 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
890 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, | ||
891 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | ||
892 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | ||
893 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | ||
894 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, | ||
895 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, | ||
896 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, | ||
897 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, | ||
898 | /* Input mixer2 */ | ||
899 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
900 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, | ||
901 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | ||
902 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | ||
903 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | ||
904 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, | ||
905 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, | ||
906 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, | ||
907 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, | ||
908 | /* Input mixer3 */ | ||
909 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
910 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, | ||
911 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | ||
912 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | ||
913 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | ||
914 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, | ||
915 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, | ||
916 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, | ||
917 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, | ||
918 | |||
919 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
920 | |||
921 | { } | ||
922 | }; | ||
923 | |||
924 | static const struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { | ||
925 | /* | ||
926 | * Unmute ADC0-2 and set the default input to mic-in | ||
927 | */ | ||
928 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
929 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
930 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
931 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
932 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
933 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
934 | |||
935 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | ||
936 | * mixer widget | ||
937 | * Note: PASD motherboards uses the Line In 2 as the input for front | ||
938 | * panel mic (mic 2) | ||
939 | */ | ||
940 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | ||
941 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
942 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
943 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
944 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
945 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
946 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | ||
947 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | ||
948 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | ||
949 | /* | ||
950 | * Set up output mixers (0x0c - 0x0e) | ||
951 | */ | ||
952 | /* set vol=0 to output mixers */ | ||
953 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
954 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
955 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
956 | |||
957 | /* set up input amps for analog loopback */ | ||
958 | /* Amp Indices: DAC = 0, mixer = 1 */ | ||
959 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
960 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
961 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
962 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
963 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
964 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
965 | |||
966 | |||
967 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ | ||
968 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ | ||
969 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ | ||
970 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ | ||
971 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ | ||
972 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ | ||
973 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ | ||
974 | |||
975 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
976 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
977 | |||
978 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
979 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
980 | |||
981 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ | ||
982 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | ||
983 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | ||
984 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, | ||
985 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | ||
986 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | ||
987 | |||
988 | /* FIXME: use matrix-type input source selection */ | ||
989 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | ||
990 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | ||
991 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ | ||
992 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ | ||
993 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ | ||
994 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ | ||
995 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ | ||
996 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | ||
997 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ | ||
998 | /* Input mixer2 */ | ||
999 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
1000 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
1001 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | ||
1002 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | ||
1003 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | ||
1004 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | ||
1005 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, | ||
1006 | /* Input mixer3 */ | ||
1007 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
1008 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
1009 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | ||
1010 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | ||
1011 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | ||
1012 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | ||
1013 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, | ||
1014 | |||
1015 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
1016 | |||
1017 | { } | ||
1018 | }; | ||
1019 | |||
1020 | static const struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { | 657 | static const struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
1021 | 658 | ||
1022 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ | 659 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
@@ -1042,13 +679,8 @@ static const char * const alc262_models[ALC262_MODEL_LAST] = { | |||
1042 | [ALC262_HIPPO] = "hippo", | 679 | [ALC262_HIPPO] = "hippo", |
1043 | [ALC262_HIPPO_1] = "hippo_1", | 680 | [ALC262_HIPPO_1] = "hippo_1", |
1044 | [ALC262_FUJITSU] = "fujitsu", | 681 | [ALC262_FUJITSU] = "fujitsu", |
1045 | [ALC262_HP_BPC] = "hp-bpc", | ||
1046 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", | ||
1047 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", | ||
1048 | [ALC262_HP_RP5700] = "hp-rp5700", | ||
1049 | [ALC262_BENQ_ED8] = "benq", | 682 | [ALC262_BENQ_ED8] = "benq", |
1050 | [ALC262_BENQ_T31] = "benq-t31", | 683 | [ALC262_BENQ_T31] = "benq-t31", |
1051 | [ALC262_SONY_ASSAMD] = "sony-assamd", | ||
1052 | [ALC262_TOSHIBA_S06] = "toshiba-s06", | 684 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
1053 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", | 685 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
1054 | [ALC262_ULTRA] = "ultra", | 686 | [ALC262_ULTRA] = "ultra", |
@@ -1061,41 +693,6 @@ static const char * const alc262_models[ALC262_MODEL_LAST] = { | |||
1061 | static const struct snd_pci_quirk alc262_cfg_tbl[] = { | 693 | static const struct snd_pci_quirk alc262_cfg_tbl[] = { |
1062 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), | 694 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
1063 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), | 695 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
1064 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", | ||
1065 | ALC262_HP_BPC), | ||
1066 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", | ||
1067 | ALC262_HP_BPC), | ||
1068 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series", | ||
1069 | ALC262_HP_BPC), | ||
1070 | SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", | ||
1071 | ALC262_AUTO), | ||
1072 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", | ||
1073 | ALC262_HP_BPC), | ||
1074 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), | ||
1075 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), | ||
1076 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), | ||
1077 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), | ||
1078 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), | ||
1079 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), | ||
1080 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), | ||
1081 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), | ||
1082 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), | ||
1083 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), | ||
1084 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), | ||
1085 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", | ||
1086 | ALC262_HP_TC_T5735), | ||
1087 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), | ||
1088 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), | ||
1089 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), | ||
1090 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), | ||
1091 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ | ||
1092 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), | ||
1093 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), | ||
1094 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), | ||
1095 | #if 0 /* disable the quirk since model=auto works better in recent versions */ | ||
1096 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", | ||
1097 | ALC262_SONY_ASSAMD), | ||
1098 | #endif | ||
1099 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", | 696 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
1100 | ALC262_TOSHIBA_RX1), | 697 | ALC262_TOSHIBA_RX1), |
1101 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), | 698 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
@@ -1166,68 +763,6 @@ static const struct alc_config_preset alc262_presets[] = { | |||
1166 | .setup = alc262_fujitsu_setup, | 763 | .setup = alc262_fujitsu_setup, |
1167 | .init_hook = alc_inithook, | 764 | .init_hook = alc_inithook, |
1168 | }, | 765 | }, |
1169 | [ALC262_HP_BPC] = { | ||
1170 | .mixers = { alc262_HP_BPC_mixer }, | ||
1171 | .init_verbs = { alc262_HP_BPC_init_verbs }, | ||
1172 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
1173 | .dac_nids = alc262_dac_nids, | ||
1174 | .hp_nid = 0x03, | ||
1175 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
1176 | .channel_mode = alc262_modes, | ||
1177 | .input_mux = &alc262_HP_capture_source, | ||
1178 | .unsol_event = alc_sku_unsol_event, | ||
1179 | .setup = alc262_hp_bpc_setup, | ||
1180 | .init_hook = alc_inithook, | ||
1181 | }, | ||
1182 | [ALC262_HP_BPC_D7000_WF] = { | ||
1183 | .mixers = { alc262_HP_BPC_WildWest_mixer }, | ||
1184 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, | ||
1185 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
1186 | .dac_nids = alc262_dac_nids, | ||
1187 | .hp_nid = 0x03, | ||
1188 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
1189 | .channel_mode = alc262_modes, | ||
1190 | .input_mux = &alc262_HP_D7000_capture_source, | ||
1191 | .unsol_event = alc_sku_unsol_event, | ||
1192 | .setup = alc262_hp_wildwest_setup, | ||
1193 | .init_hook = alc_inithook, | ||
1194 | }, | ||
1195 | [ALC262_HP_BPC_D7000_WL] = { | ||
1196 | .mixers = { alc262_HP_BPC_WildWest_mixer, | ||
1197 | alc262_HP_BPC_WildWest_option_mixer }, | ||
1198 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, | ||
1199 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
1200 | .dac_nids = alc262_dac_nids, | ||
1201 | .hp_nid = 0x03, | ||
1202 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
1203 | .channel_mode = alc262_modes, | ||
1204 | .input_mux = &alc262_HP_D7000_capture_source, | ||
1205 | .unsol_event = alc_sku_unsol_event, | ||
1206 | .setup = alc262_hp_wildwest_setup, | ||
1207 | .init_hook = alc_inithook, | ||
1208 | }, | ||
1209 | [ALC262_HP_TC_T5735] = { | ||
1210 | .mixers = { alc262_hp_t5735_mixer }, | ||
1211 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, | ||
1212 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
1213 | .dac_nids = alc262_dac_nids, | ||
1214 | .hp_nid = 0x03, | ||
1215 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
1216 | .channel_mode = alc262_modes, | ||
1217 | .input_mux = &alc262_capture_source, | ||
1218 | .unsol_event = alc_sku_unsol_event, | ||
1219 | .setup = alc262_hp_t5735_setup, | ||
1220 | .init_hook = alc_inithook, | ||
1221 | }, | ||
1222 | [ALC262_HP_RP5700] = { | ||
1223 | .mixers = { alc262_hp_rp5700_mixer }, | ||
1224 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, | ||
1225 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
1226 | .dac_nids = alc262_dac_nids, | ||
1227 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
1228 | .channel_mode = alc262_modes, | ||
1229 | .input_mux = &alc262_hp_rp5700_capture_source, | ||
1230 | }, | ||
1231 | [ALC262_BENQ_ED8] = { | 766 | [ALC262_BENQ_ED8] = { |
1232 | .mixers = { alc262_base_mixer }, | 767 | .mixers = { alc262_base_mixer }, |
1233 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, | 768 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
@@ -1238,19 +773,6 @@ static const struct alc_config_preset alc262_presets[] = { | |||
1238 | .channel_mode = alc262_modes, | 773 | .channel_mode = alc262_modes, |
1239 | .input_mux = &alc262_capture_source, | 774 | .input_mux = &alc262_capture_source, |
1240 | }, | 775 | }, |
1241 | [ALC262_SONY_ASSAMD] = { | ||
1242 | .mixers = { alc262_sony_mixer }, | ||
1243 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, | ||
1244 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
1245 | .dac_nids = alc262_dac_nids, | ||
1246 | .hp_nid = 0x02, | ||
1247 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
1248 | .channel_mode = alc262_modes, | ||
1249 | .input_mux = &alc262_capture_source, | ||
1250 | .unsol_event = alc_sku_unsol_event, | ||
1251 | .setup = alc262_hippo_setup, | ||
1252 | .init_hook = alc_inithook, | ||
1253 | }, | ||
1254 | [ALC262_BENQ_T31] = { | 776 | [ALC262_BENQ_T31] = { |
1255 | .mixers = { alc262_benq_t31_mixer }, | 777 | .mixers = { alc262_benq_t31_mixer }, |
1256 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, | 778 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
diff --git a/sound/pci/hda/alc268_quirks.c b/sound/pci/hda/alc268_quirks.c deleted file mode 100644 index 2e5876ce71f..00000000000 --- a/sound/pci/hda/alc268_quirks.c +++ /dev/null | |||
@@ -1,636 +0,0 @@ | |||
1 | /* | ||
2 | * ALC267/ALC268 quirk models | ||
3 | * included by patch_realtek.c | ||
4 | */ | ||
5 | |||
6 | /* ALC268 models */ | ||
7 | enum { | ||
8 | ALC268_AUTO, | ||
9 | ALC267_QUANTA_IL1, | ||
10 | ALC268_3ST, | ||
11 | ALC268_TOSHIBA, | ||
12 | ALC268_ACER, | ||
13 | ALC268_ACER_DMIC, | ||
14 | ALC268_ACER_ASPIRE_ONE, | ||
15 | ALC268_DELL, | ||
16 | ALC268_ZEPTO, | ||
17 | #ifdef CONFIG_SND_DEBUG | ||
18 | ALC268_TEST, | ||
19 | #endif | ||
20 | ALC268_MODEL_LAST /* last tag */ | ||
21 | }; | ||
22 | |||
23 | /* | ||
24 | * ALC268 channel source setting (2 channel) | ||
25 | */ | ||
26 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID | ||
27 | #define alc268_modes alc260_modes | ||
28 | |||
29 | static const hda_nid_t alc268_dac_nids[2] = { | ||
30 | /* front, hp */ | ||
31 | 0x02, 0x03 | ||
32 | }; | ||
33 | |||
34 | static const hda_nid_t alc268_adc_nids[2] = { | ||
35 | /* ADC0-1 */ | ||
36 | 0x08, 0x07 | ||
37 | }; | ||
38 | |||
39 | static const hda_nid_t alc268_adc_nids_alt[1] = { | ||
40 | /* ADC0 */ | ||
41 | 0x08 | ||
42 | }; | ||
43 | |||
44 | static const hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; | ||
45 | |||
46 | static const struct snd_kcontrol_new alc268_base_mixer[] = { | ||
47 | /* output mixer control */ | ||
48 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | ||
49 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
50 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | ||
51 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
52 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
53 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
54 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), | ||
55 | { } | ||
56 | }; | ||
57 | |||
58 | static const struct snd_kcontrol_new alc268_toshiba_mixer[] = { | ||
59 | /* output mixer control */ | ||
60 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | ||
61 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | ||
62 | ALC262_HIPPO_MASTER_SWITCH, | ||
63 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
64 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
65 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), | ||
66 | { } | ||
67 | }; | ||
68 | |||
69 | static const struct hda_verb alc268_eapd_verbs[] = { | ||
70 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
71 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
72 | { } | ||
73 | }; | ||
74 | |||
75 | /* Toshiba specific */ | ||
76 | static const struct hda_verb alc268_toshiba_verbs[] = { | ||
77 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
78 | { } /* end */ | ||
79 | }; | ||
80 | |||
81 | /* Acer specific */ | ||
82 | /* bind volumes of both NID 0x02 and 0x03 */ | ||
83 | static const struct hda_bind_ctls alc268_acer_bind_master_vol = { | ||
84 | .ops = &snd_hda_bind_vol, | ||
85 | .values = { | ||
86 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | ||
87 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | ||
88 | 0 | ||
89 | }, | ||
90 | }; | ||
91 | |||
92 | static void alc268_acer_setup(struct hda_codec *codec) | ||
93 | { | ||
94 | struct alc_spec *spec = codec->spec; | ||
95 | |||
96 | spec->autocfg.hp_pins[0] = 0x14; | ||
97 | spec->autocfg.speaker_pins[0] = 0x15; | ||
98 | spec->automute = 1; | ||
99 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
100 | } | ||
101 | |||
102 | #define alc268_acer_master_sw_get alc262_hp_master_sw_get | ||
103 | #define alc268_acer_master_sw_put alc262_hp_master_sw_put | ||
104 | |||
105 | static const struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { | ||
106 | /* output mixer control */ | ||
107 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | ||
108 | { | ||
109 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
110 | .name = "Master Playback Switch", | ||
111 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x15, | ||
112 | .info = snd_ctl_boolean_mono_info, | ||
113 | .get = alc268_acer_master_sw_get, | ||
114 | .put = alc268_acer_master_sw_put, | ||
115 | }, | ||
116 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), | ||
117 | { } | ||
118 | }; | ||
119 | |||
120 | static const struct snd_kcontrol_new alc268_acer_mixer[] = { | ||
121 | /* output mixer control */ | ||
122 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | ||
123 | { | ||
124 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
125 | .name = "Master Playback Switch", | ||
126 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x14, | ||
127 | .info = snd_ctl_boolean_mono_info, | ||
128 | .get = alc268_acer_master_sw_get, | ||
129 | .put = alc268_acer_master_sw_put, | ||
130 | }, | ||
131 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
132 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
133 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), | ||
134 | { } | ||
135 | }; | ||
136 | |||
137 | static const struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { | ||
138 | /* output mixer control */ | ||
139 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | ||
140 | { | ||
141 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
142 | .name = "Master Playback Switch", | ||
143 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x14, | ||
144 | .info = snd_ctl_boolean_mono_info, | ||
145 | .get = alc268_acer_master_sw_get, | ||
146 | .put = alc268_acer_master_sw_put, | ||
147 | }, | ||
148 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
149 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), | ||
150 | { } | ||
151 | }; | ||
152 | |||
153 | static const struct hda_verb alc268_acer_aspire_one_verbs[] = { | ||
154 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
155 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
156 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
157 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT}, | ||
158 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, | ||
159 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, | ||
160 | { } | ||
161 | }; | ||
162 | |||
163 | static const struct hda_verb alc268_acer_verbs[] = { | ||
164 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ | ||
165 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
166 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
167 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
168 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
169 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
170 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
171 | { } | ||
172 | }; | ||
173 | |||
174 | /* unsolicited event for HP jack sensing */ | ||
175 | #define alc268_toshiba_setup alc262_hippo_setup | ||
176 | |||
177 | static void alc268_acer_lc_setup(struct hda_codec *codec) | ||
178 | { | ||
179 | struct alc_spec *spec = codec->spec; | ||
180 | spec->autocfg.hp_pins[0] = 0x15; | ||
181 | spec->autocfg.speaker_pins[0] = 0x14; | ||
182 | spec->automute = 1; | ||
183 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
184 | spec->ext_mic_pin = 0x18; | ||
185 | spec->int_mic_pin = 0x12; | ||
186 | spec->auto_mic = 1; | ||
187 | } | ||
188 | |||
189 | static const struct snd_kcontrol_new alc268_dell_mixer[] = { | ||
190 | /* output mixer control */ | ||
191 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
192 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
193 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
194 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
195 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
196 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
197 | { } | ||
198 | }; | ||
199 | |||
200 | static const struct hda_verb alc268_dell_verbs[] = { | ||
201 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
202 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
203 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
204 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_MIC_EVENT | AC_USRSP_EN}, | ||
205 | { } | ||
206 | }; | ||
207 | |||
208 | /* mute/unmute internal speaker according to the hp jack and mute state */ | ||
209 | static void alc268_dell_setup(struct hda_codec *codec) | ||
210 | { | ||
211 | struct alc_spec *spec = codec->spec; | ||
212 | |||
213 | spec->autocfg.hp_pins[0] = 0x15; | ||
214 | spec->autocfg.speaker_pins[0] = 0x14; | ||
215 | spec->ext_mic_pin = 0x18; | ||
216 | spec->int_mic_pin = 0x19; | ||
217 | spec->auto_mic = 1; | ||
218 | spec->automute = 1; | ||
219 | spec->automute_mode = ALC_AUTOMUTE_PIN; | ||
220 | } | ||
221 | |||
222 | static const struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { | ||
223 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), | ||
224 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
225 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | ||
226 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
227 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), | ||
228 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), | ||
229 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
230 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
231 | { } | ||
232 | }; | ||
233 | |||
234 | static const struct hda_verb alc267_quanta_il1_verbs[] = { | ||
235 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
236 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_MIC_EVENT | AC_USRSP_EN}, | ||
237 | { } | ||
238 | }; | ||
239 | |||
240 | static void alc267_quanta_il1_setup(struct hda_codec *codec) | ||
241 | { | ||
242 | struct alc_spec *spec = codec->spec; | ||
243 | spec->autocfg.hp_pins[0] = 0x15; | ||
244 | spec->autocfg.speaker_pins[0] = 0x14; | ||
245 | spec->ext_mic_pin = 0x18; | ||
246 | spec->int_mic_pin = 0x19; | ||
247 | spec->auto_mic = 1; | ||
248 | spec->automute = 1; | ||
249 | spec->automute_mode = ALC_AUTOMUTE_PIN; | ||
250 | } | ||
251 | |||
252 | /* | ||
253 | * generic initialization of ADC, input mixers and output mixers | ||
254 | */ | ||
255 | static const struct hda_verb alc268_base_init_verbs[] = { | ||
256 | /* Unmute DAC0-1 and set vol = 0 */ | ||
257 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
258 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
259 | |||
260 | /* | ||
261 | * Set up output mixers (0x0c - 0x0e) | ||
262 | */ | ||
263 | /* set vol=0 to output mixers */ | ||
264 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
265 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
266 | |||
267 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
268 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
269 | |||
270 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | ||
271 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | ||
272 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | ||
273 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
274 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
275 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
276 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
277 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
278 | |||
279 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
280 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
281 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
282 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
283 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
284 | |||
285 | /* set PCBEEP vol = 0, mute connections */ | ||
286 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
287 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
288 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
289 | |||
290 | /* Unmute Selector 23h,24h and set the default input to mic-in */ | ||
291 | |||
292 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
293 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
294 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
295 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
296 | |||
297 | { } | ||
298 | }; | ||
299 | |||
300 | /* only for model=test */ | ||
301 | #ifdef CONFIG_SND_DEBUG | ||
302 | /* | ||
303 | * generic initialization of ADC, input mixers and output mixers | ||
304 | */ | ||
305 | static const struct hda_verb alc268_volume_init_verbs[] = { | ||
306 | /* set output DAC */ | ||
307 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
308 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
309 | |||
310 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
311 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
312 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
313 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
314 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
315 | |||
316 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
317 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
318 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
319 | |||
320 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
321 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
322 | { } | ||
323 | }; | ||
324 | #endif /* CONFIG_SND_DEBUG */ | ||
325 | |||
326 | static const struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { | ||
327 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | ||
328 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | ||
329 | { } /* end */ | ||
330 | }; | ||
331 | |||
332 | static const struct snd_kcontrol_new alc268_capture_alt_mixer[] = { | ||
333 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | ||
334 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | ||
335 | _DEFINE_CAPSRC(1), | ||
336 | { } /* end */ | ||
337 | }; | ||
338 | |||
339 | static const struct snd_kcontrol_new alc268_capture_mixer[] = { | ||
340 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | ||
341 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | ||
342 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), | ||
343 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), | ||
344 | _DEFINE_CAPSRC(2), | ||
345 | { } /* end */ | ||
346 | }; | ||
347 | |||
348 | static const struct hda_input_mux alc268_capture_source = { | ||
349 | .num_items = 4, | ||
350 | .items = { | ||
351 | { "Mic", 0x0 }, | ||
352 | { "Front Mic", 0x1 }, | ||
353 | { "Line", 0x2 }, | ||
354 | { "CD", 0x3 }, | ||
355 | }, | ||
356 | }; | ||
357 | |||
358 | static const struct hda_input_mux alc268_acer_capture_source = { | ||
359 | .num_items = 3, | ||
360 | .items = { | ||
361 | { "Mic", 0x0 }, | ||
362 | { "Internal Mic", 0x1 }, | ||
363 | { "Line", 0x2 }, | ||
364 | }, | ||
365 | }; | ||
366 | |||
367 | static const struct hda_input_mux alc268_acer_dmic_capture_source = { | ||
368 | .num_items = 3, | ||
369 | .items = { | ||
370 | { "Mic", 0x0 }, | ||
371 | { "Internal Mic", 0x6 }, | ||
372 | { "Line", 0x2 }, | ||
373 | }, | ||
374 | }; | ||
375 | |||
376 | #ifdef CONFIG_SND_DEBUG | ||
377 | static const struct snd_kcontrol_new alc268_test_mixer[] = { | ||
378 | /* Volume widgets */ | ||
379 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
380 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
381 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
382 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), | ||
383 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), | ||
384 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), | ||
385 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), | ||
386 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), | ||
387 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), | ||
388 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), | ||
389 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), | ||
390 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), | ||
391 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), | ||
392 | /* The below appears problematic on some hardwares */ | ||
393 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ | ||
394 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), | ||
395 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), | ||
396 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), | ||
397 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), | ||
398 | |||
399 | /* Modes for retasking pin widgets */ | ||
400 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), | ||
401 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), | ||
402 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), | ||
403 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), | ||
404 | |||
405 | /* Controls for GPIO pins, assuming they are configured as outputs */ | ||
406 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), | ||
407 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), | ||
408 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), | ||
409 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), | ||
410 | |||
411 | /* Switches to allow the digital SPDIF output pin to be enabled. | ||
412 | * The ALC268 does not have an SPDIF input. | ||
413 | */ | ||
414 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), | ||
415 | |||
416 | /* A switch allowing EAPD to be enabled. Some laptops seem to use | ||
417 | * this output to turn on an external amplifier. | ||
418 | */ | ||
419 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), | ||
420 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), | ||
421 | |||
422 | { } /* end */ | ||
423 | }; | ||
424 | #endif | ||
425 | |||
426 | /* | ||
427 | * configuration and preset | ||
428 | */ | ||
429 | static const char * const alc268_models[ALC268_MODEL_LAST] = { | ||
430 | [ALC267_QUANTA_IL1] = "quanta-il1", | ||
431 | [ALC268_3ST] = "3stack", | ||
432 | [ALC268_TOSHIBA] = "toshiba", | ||
433 | [ALC268_ACER] = "acer", | ||
434 | [ALC268_ACER_DMIC] = "acer-dmic", | ||
435 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", | ||
436 | [ALC268_DELL] = "dell", | ||
437 | [ALC268_ZEPTO] = "zepto", | ||
438 | #ifdef CONFIG_SND_DEBUG | ||
439 | [ALC268_TEST] = "test", | ||
440 | #endif | ||
441 | [ALC268_AUTO] = "auto", | ||
442 | }; | ||
443 | |||
444 | static const struct snd_pci_quirk alc268_cfg_tbl[] = { | ||
445 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), | ||
446 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), | ||
447 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), | ||
448 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), | ||
449 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), | ||
450 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", | ||
451 | ALC268_ACER_ASPIRE_ONE), | ||
452 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), | ||
453 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron 910", ALC268_AUTO), | ||
454 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, | ||
455 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), | ||
456 | /* almost compatible with toshiba but with optional digital outs; | ||
457 | * auto-probing seems working fine | ||
458 | */ | ||
459 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", | ||
460 | ALC268_AUTO), | ||
461 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), | ||
462 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), | ||
463 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), | ||
464 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), | ||
465 | {} | ||
466 | }; | ||
467 | |||
468 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ | ||
469 | static const struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { | ||
470 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), | ||
471 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), | ||
472 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", | ||
473 | ALC268_TOSHIBA), | ||
474 | {} | ||
475 | }; | ||
476 | |||
477 | static const struct alc_config_preset alc268_presets[] = { | ||
478 | [ALC267_QUANTA_IL1] = { | ||
479 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, | ||
480 | .cap_mixer = alc268_capture_nosrc_mixer, | ||
481 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | ||
482 | alc267_quanta_il1_verbs }, | ||
483 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | ||
484 | .dac_nids = alc268_dac_nids, | ||
485 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | ||
486 | .adc_nids = alc268_adc_nids_alt, | ||
487 | .hp_nid = 0x03, | ||
488 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | ||
489 | .channel_mode = alc268_modes, | ||
490 | .unsol_event = alc_sku_unsol_event, | ||
491 | .setup = alc267_quanta_il1_setup, | ||
492 | .init_hook = alc_inithook, | ||
493 | }, | ||
494 | [ALC268_3ST] = { | ||
495 | .mixers = { alc268_base_mixer, alc268_beep_mixer }, | ||
496 | .cap_mixer = alc268_capture_alt_mixer, | ||
497 | .init_verbs = { alc268_base_init_verbs }, | ||
498 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | ||
499 | .dac_nids = alc268_dac_nids, | ||
500 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | ||
501 | .adc_nids = alc268_adc_nids_alt, | ||
502 | .capsrc_nids = alc268_capsrc_nids, | ||
503 | .hp_nid = 0x03, | ||
504 | .dig_out_nid = ALC268_DIGOUT_NID, | ||
505 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | ||
506 | .channel_mode = alc268_modes, | ||
507 | .input_mux = &alc268_capture_source, | ||
508 | }, | ||
509 | [ALC268_TOSHIBA] = { | ||
510 | .mixers = { alc268_toshiba_mixer, alc268_beep_mixer }, | ||
511 | .cap_mixer = alc268_capture_alt_mixer, | ||
512 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | ||
513 | alc268_toshiba_verbs }, | ||
514 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | ||
515 | .dac_nids = alc268_dac_nids, | ||
516 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | ||
517 | .adc_nids = alc268_adc_nids_alt, | ||
518 | .capsrc_nids = alc268_capsrc_nids, | ||
519 | .hp_nid = 0x03, | ||
520 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | ||
521 | .channel_mode = alc268_modes, | ||
522 | .input_mux = &alc268_capture_source, | ||
523 | .unsol_event = alc_sku_unsol_event, | ||
524 | .setup = alc268_toshiba_setup, | ||
525 | .init_hook = alc_inithook, | ||
526 | }, | ||
527 | [ALC268_ACER] = { | ||
528 | .mixers = { alc268_acer_mixer, alc268_beep_mixer }, | ||
529 | .cap_mixer = alc268_capture_alt_mixer, | ||
530 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | ||
531 | alc268_acer_verbs }, | ||
532 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | ||
533 | .dac_nids = alc268_dac_nids, | ||
534 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | ||
535 | .adc_nids = alc268_adc_nids_alt, | ||
536 | .capsrc_nids = alc268_capsrc_nids, | ||
537 | .hp_nid = 0x02, | ||
538 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | ||
539 | .channel_mode = alc268_modes, | ||
540 | .input_mux = &alc268_acer_capture_source, | ||
541 | .unsol_event = alc_sku_unsol_event, | ||
542 | .setup = alc268_acer_setup, | ||
543 | .init_hook = alc_inithook, | ||
544 | }, | ||
545 | [ALC268_ACER_DMIC] = { | ||
546 | .mixers = { alc268_acer_dmic_mixer, alc268_beep_mixer }, | ||
547 | .cap_mixer = alc268_capture_alt_mixer, | ||
548 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | ||
549 | alc268_acer_verbs }, | ||
550 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | ||
551 | .dac_nids = alc268_dac_nids, | ||
552 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | ||
553 | .adc_nids = alc268_adc_nids_alt, | ||
554 | .capsrc_nids = alc268_capsrc_nids, | ||
555 | .hp_nid = 0x02, | ||
556 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | ||
557 | .channel_mode = alc268_modes, | ||
558 | .input_mux = &alc268_acer_dmic_capture_source, | ||
559 | .unsol_event = alc_sku_unsol_event, | ||
560 | .setup = alc268_acer_setup, | ||
561 | .init_hook = alc_inithook, | ||
562 | }, | ||
563 | [ALC268_ACER_ASPIRE_ONE] = { | ||
564 | .mixers = { alc268_acer_aspire_one_mixer, alc268_beep_mixer}, | ||
565 | .cap_mixer = alc268_capture_nosrc_mixer, | ||
566 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | ||
567 | alc268_acer_aspire_one_verbs }, | ||
568 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | ||
569 | .dac_nids = alc268_dac_nids, | ||
570 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | ||
571 | .adc_nids = alc268_adc_nids_alt, | ||
572 | .capsrc_nids = alc268_capsrc_nids, | ||
573 | .hp_nid = 0x03, | ||
574 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | ||
575 | .channel_mode = alc268_modes, | ||
576 | .unsol_event = alc_sku_unsol_event, | ||
577 | .setup = alc268_acer_lc_setup, | ||
578 | .init_hook = alc_inithook, | ||
579 | }, | ||
580 | [ALC268_DELL] = { | ||
581 | .mixers = { alc268_dell_mixer, alc268_beep_mixer}, | ||
582 | .cap_mixer = alc268_capture_nosrc_mixer, | ||
583 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | ||
584 | alc268_dell_verbs }, | ||
585 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | ||
586 | .dac_nids = alc268_dac_nids, | ||
587 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | ||
588 | .adc_nids = alc268_adc_nids_alt, | ||
589 | .capsrc_nids = alc268_capsrc_nids, | ||
590 | .hp_nid = 0x02, | ||
591 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | ||
592 | .channel_mode = alc268_modes, | ||
593 | .unsol_event = alc_sku_unsol_event, | ||
594 | .setup = alc268_dell_setup, | ||
595 | .init_hook = alc_inithook, | ||
596 | }, | ||
597 | [ALC268_ZEPTO] = { | ||
598 | .mixers = { alc268_base_mixer, alc268_beep_mixer }, | ||
599 | .cap_mixer = alc268_capture_alt_mixer, | ||
600 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | ||
601 | alc268_toshiba_verbs }, | ||
602 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | ||
603 | .dac_nids = alc268_dac_nids, | ||
604 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | ||
605 | .adc_nids = alc268_adc_nids_alt, | ||
606 | .capsrc_nids = alc268_capsrc_nids, | ||
607 | .hp_nid = 0x03, | ||
608 | .dig_out_nid = ALC268_DIGOUT_NID, | ||
609 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | ||
610 | .channel_mode = alc268_modes, | ||
611 | .input_mux = &alc268_capture_source, | ||
612 | .unsol_event = alc_sku_unsol_event, | ||
613 | .setup = alc268_toshiba_setup, | ||
614 | .init_hook = alc_inithook, | ||
615 | }, | ||
616 | #ifdef CONFIG_SND_DEBUG | ||
617 | [ALC268_TEST] = { | ||
618 | .mixers = { alc268_test_mixer }, | ||
619 | .cap_mixer = alc268_capture_mixer, | ||
620 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | ||
621 | alc268_volume_init_verbs, | ||
622 | alc268_beep_init_verbs }, | ||
623 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | ||
624 | .dac_nids = alc268_dac_nids, | ||
625 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | ||
626 | .adc_nids = alc268_adc_nids_alt, | ||
627 | .capsrc_nids = alc268_capsrc_nids, | ||
628 | .hp_nid = 0x03, | ||
629 | .dig_out_nid = ALC268_DIGOUT_NID, | ||
630 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | ||
631 | .channel_mode = alc268_modes, | ||
632 | .input_mux = &alc268_capture_source, | ||
633 | }, | ||
634 | #endif | ||
635 | }; | ||
636 | |||
diff --git a/sound/pci/hda/alc269_quirks.c b/sound/pci/hda/alc269_quirks.c deleted file mode 100644 index 5ac0e2162a4..00000000000 --- a/sound/pci/hda/alc269_quirks.c +++ /dev/null | |||
@@ -1,674 +0,0 @@ | |||
1 | /* | ||
2 | * ALC269/ALC270/ALC275/ALC276 quirk models | ||
3 | * included by patch_realtek.c | ||
4 | */ | ||
5 | |||
6 | /* ALC269 models */ | ||
7 | enum { | ||
8 | ALC269_AUTO, | ||
9 | ALC269_BASIC, | ||
10 | ALC269_QUANTA_FL1, | ||
11 | ALC269_AMIC, | ||
12 | ALC269_DMIC, | ||
13 | ALC269VB_AMIC, | ||
14 | ALC269VB_DMIC, | ||
15 | ALC269_FUJITSU, | ||
16 | ALC269_LIFEBOOK, | ||
17 | ALC271_ACER, | ||
18 | ALC269_MODEL_LAST /* last tag */ | ||
19 | }; | ||
20 | |||
21 | /* | ||
22 | * ALC269 channel source setting (2 channel) | ||
23 | */ | ||
24 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID | ||
25 | |||
26 | #define alc269_dac_nids alc260_dac_nids | ||
27 | |||
28 | static const hda_nid_t alc269_adc_nids[1] = { | ||
29 | /* ADC1 */ | ||
30 | 0x08, | ||
31 | }; | ||
32 | |||
33 | static const hda_nid_t alc269_capsrc_nids[1] = { | ||
34 | 0x23, | ||
35 | }; | ||
36 | |||
37 | static const hda_nid_t alc269vb_adc_nids[1] = { | ||
38 | /* ADC1 */ | ||
39 | 0x09, | ||
40 | }; | ||
41 | |||
42 | static const hda_nid_t alc269vb_capsrc_nids[1] = { | ||
43 | 0x22, | ||
44 | }; | ||
45 | |||
46 | #define alc269_modes alc260_modes | ||
47 | #define alc269_capture_source alc880_lg_lw_capture_source | ||
48 | |||
49 | static const struct snd_kcontrol_new alc269_base_mixer[] = { | ||
50 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
51 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
52 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
53 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
54 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
55 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
56 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
57 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
58 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
59 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
60 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
61 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | ||
62 | { } /* end */ | ||
63 | }; | ||
64 | |||
65 | static const struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { | ||
66 | /* output mixer control */ | ||
67 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | ||
68 | { | ||
69 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
70 | .name = "Master Playback Switch", | ||
71 | .subdevice = HDA_SUBDEV_AMP_FLAG, | ||
72 | .info = snd_hda_mixer_amp_switch_info, | ||
73 | .get = snd_hda_mixer_amp_switch_get, | ||
74 | .put = alc268_acer_master_sw_put, | ||
75 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
76 | }, | ||
77 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
78 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
79 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
80 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
81 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
82 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
83 | { } | ||
84 | }; | ||
85 | |||
86 | static const struct snd_kcontrol_new alc269_lifebook_mixer[] = { | ||
87 | /* output mixer control */ | ||
88 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | ||
89 | { | ||
90 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
91 | .name = "Master Playback Switch", | ||
92 | .subdevice = HDA_SUBDEV_AMP_FLAG, | ||
93 | .info = snd_hda_mixer_amp_switch_info, | ||
94 | .get = snd_hda_mixer_amp_switch_get, | ||
95 | .put = alc268_acer_master_sw_put, | ||
96 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
97 | }, | ||
98 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
99 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
100 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
101 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
102 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
103 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
104 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), | ||
105 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), | ||
106 | HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT), | ||
107 | { } | ||
108 | }; | ||
109 | |||
110 | static const struct snd_kcontrol_new alc269_laptop_mixer[] = { | ||
111 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
112 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
113 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
114 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
115 | { } /* end */ | ||
116 | }; | ||
117 | |||
118 | static const struct snd_kcontrol_new alc269vb_laptop_mixer[] = { | ||
119 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
120 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
121 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | ||
122 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
123 | { } /* end */ | ||
124 | }; | ||
125 | |||
126 | static const struct snd_kcontrol_new alc269_asus_mixer[] = { | ||
127 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
128 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), | ||
129 | { } /* end */ | ||
130 | }; | ||
131 | |||
132 | /* capture mixer elements */ | ||
133 | static const struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { | ||
134 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | ||
135 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | ||
136 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
137 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
138 | { } /* end */ | ||
139 | }; | ||
140 | |||
141 | static const struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { | ||
142 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | ||
143 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | ||
144 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
145 | { } /* end */ | ||
146 | }; | ||
147 | |||
148 | static const struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { | ||
149 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | ||
150 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | ||
151 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
152 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
153 | { } /* end */ | ||
154 | }; | ||
155 | |||
156 | static const struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { | ||
157 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | ||
158 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | ||
159 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
160 | { } /* end */ | ||
161 | }; | ||
162 | |||
163 | /* FSC amilo */ | ||
164 | #define alc269_fujitsu_mixer alc269_laptop_mixer | ||
165 | |||
166 | static const struct hda_verb alc269_quanta_fl1_verbs[] = { | ||
167 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
168 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
169 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
170 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
171 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT}, | ||
172 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
173 | { } | ||
174 | }; | ||
175 | |||
176 | static const struct hda_verb alc269_lifebook_verbs[] = { | ||
177 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
178 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
179 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
180 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
181 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
182 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
183 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
184 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
185 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT}, | ||
186 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
187 | { } | ||
188 | }; | ||
189 | |||
190 | /* toggle speaker-output according to the hp-jack state */ | ||
191 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) | ||
192 | { | ||
193 | alc_hp_automute(codec); | ||
194 | |||
195 | snd_hda_codec_write(codec, 0x20, 0, | ||
196 | AC_VERB_SET_COEF_INDEX, 0x0c); | ||
197 | snd_hda_codec_write(codec, 0x20, 0, | ||
198 | AC_VERB_SET_PROC_COEF, 0x680); | ||
199 | |||
200 | snd_hda_codec_write(codec, 0x20, 0, | ||
201 | AC_VERB_SET_COEF_INDEX, 0x0c); | ||
202 | snd_hda_codec_write(codec, 0x20, 0, | ||
203 | AC_VERB_SET_PROC_COEF, 0x480); | ||
204 | } | ||
205 | |||
206 | #define alc269_lifebook_speaker_automute \ | ||
207 | alc269_quanta_fl1_speaker_automute | ||
208 | |||
209 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) | ||
210 | { | ||
211 | unsigned int present_laptop; | ||
212 | unsigned int present_dock; | ||
213 | |||
214 | present_laptop = snd_hda_jack_detect(codec, 0x18); | ||
215 | present_dock = snd_hda_jack_detect(codec, 0x1b); | ||
216 | |||
217 | /* Laptop mic port overrides dock mic port, design decision */ | ||
218 | if (present_dock) | ||
219 | snd_hda_codec_write(codec, 0x23, 0, | ||
220 | AC_VERB_SET_CONNECT_SEL, 0x3); | ||
221 | if (present_laptop) | ||
222 | snd_hda_codec_write(codec, 0x23, 0, | ||
223 | AC_VERB_SET_CONNECT_SEL, 0x0); | ||
224 | if (!present_dock && !present_laptop) | ||
225 | snd_hda_codec_write(codec, 0x23, 0, | ||
226 | AC_VERB_SET_CONNECT_SEL, 0x1); | ||
227 | } | ||
228 | |||
229 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, | ||
230 | unsigned int res) | ||
231 | { | ||
232 | switch (res >> 26) { | ||
233 | case ALC_HP_EVENT: | ||
234 | alc269_quanta_fl1_speaker_automute(codec); | ||
235 | break; | ||
236 | case ALC_MIC_EVENT: | ||
237 | alc_mic_automute(codec); | ||
238 | break; | ||
239 | } | ||
240 | } | ||
241 | |||
242 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, | ||
243 | unsigned int res) | ||
244 | { | ||
245 | if ((res >> 26) == ALC_HP_EVENT) | ||
246 | alc269_lifebook_speaker_automute(codec); | ||
247 | if ((res >> 26) == ALC_MIC_EVENT) | ||
248 | alc269_lifebook_mic_autoswitch(codec); | ||
249 | } | ||
250 | |||
251 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) | ||
252 | { | ||
253 | struct alc_spec *spec = codec->spec; | ||
254 | spec->autocfg.hp_pins[0] = 0x15; | ||
255 | spec->autocfg.speaker_pins[0] = 0x14; | ||
256 | spec->automute_mixer_nid[0] = 0x0c; | ||
257 | spec->automute = 1; | ||
258 | spec->automute_mode = ALC_AUTOMUTE_MIXER; | ||
259 | spec->ext_mic_pin = 0x18; | ||
260 | spec->int_mic_pin = 0x19; | ||
261 | spec->auto_mic = 1; | ||
262 | } | ||
263 | |||
264 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) | ||
265 | { | ||
266 | alc269_quanta_fl1_speaker_automute(codec); | ||
267 | alc_mic_automute(codec); | ||
268 | } | ||
269 | |||
270 | static void alc269_lifebook_setup(struct hda_codec *codec) | ||
271 | { | ||
272 | struct alc_spec *spec = codec->spec; | ||
273 | spec->autocfg.hp_pins[0] = 0x15; | ||
274 | spec->autocfg.hp_pins[1] = 0x1a; | ||
275 | spec->autocfg.speaker_pins[0] = 0x14; | ||
276 | spec->automute_mixer_nid[0] = 0x0c; | ||
277 | spec->automute = 1; | ||
278 | spec->automute_mode = ALC_AUTOMUTE_MIXER; | ||
279 | } | ||
280 | |||
281 | static void alc269_lifebook_init_hook(struct hda_codec *codec) | ||
282 | { | ||
283 | alc269_lifebook_speaker_automute(codec); | ||
284 | alc269_lifebook_mic_autoswitch(codec); | ||
285 | } | ||
286 | |||
287 | static const struct hda_verb alc269_laptop_dmic_init_verbs[] = { | ||
288 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
289 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, | ||
290 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | ||
291 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, | ||
292 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
293 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT}, | ||
294 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
295 | {} | ||
296 | }; | ||
297 | |||
298 | static const struct hda_verb alc269_laptop_amic_init_verbs[] = { | ||
299 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
300 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
301 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | ||
302 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, | ||
303 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT}, | ||
304 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
305 | {} | ||
306 | }; | ||
307 | |||
308 | static const struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { | ||
309 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
310 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, | ||
311 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | ||
312 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, | ||
313 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
314 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT}, | ||
315 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
316 | {} | ||
317 | }; | ||
318 | |||
319 | static const struct hda_verb alc269vb_laptop_amic_init_verbs[] = { | ||
320 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
321 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
322 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | ||
323 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, | ||
324 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
325 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT}, | ||
326 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
327 | {} | ||
328 | }; | ||
329 | |||
330 | static const struct hda_verb alc271_acer_dmic_verbs[] = { | ||
331 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, | ||
332 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, | ||
333 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
334 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
335 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
336 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
337 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
338 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
339 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT}, | ||
340 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, | ||
341 | { } | ||
342 | }; | ||
343 | |||
344 | static void alc269_laptop_amic_setup(struct hda_codec *codec) | ||
345 | { | ||
346 | struct alc_spec *spec = codec->spec; | ||
347 | spec->autocfg.hp_pins[0] = 0x15; | ||
348 | spec->autocfg.speaker_pins[0] = 0x14; | ||
349 | spec->automute_mixer_nid[0] = 0x0c; | ||
350 | spec->automute = 1; | ||
351 | spec->automute_mode = ALC_AUTOMUTE_MIXER; | ||
352 | spec->ext_mic_pin = 0x18; | ||
353 | spec->int_mic_pin = 0x19; | ||
354 | spec->auto_mic = 1; | ||
355 | } | ||
356 | |||
357 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) | ||
358 | { | ||
359 | struct alc_spec *spec = codec->spec; | ||
360 | spec->autocfg.hp_pins[0] = 0x15; | ||
361 | spec->autocfg.speaker_pins[0] = 0x14; | ||
362 | spec->automute_mixer_nid[0] = 0x0c; | ||
363 | spec->automute = 1; | ||
364 | spec->automute_mode = ALC_AUTOMUTE_MIXER; | ||
365 | spec->ext_mic_pin = 0x18; | ||
366 | spec->int_mic_pin = 0x12; | ||
367 | spec->auto_mic = 1; | ||
368 | } | ||
369 | |||
370 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) | ||
371 | { | ||
372 | struct alc_spec *spec = codec->spec; | ||
373 | spec->autocfg.hp_pins[0] = 0x21; | ||
374 | spec->autocfg.speaker_pins[0] = 0x14; | ||
375 | spec->automute_mixer_nid[0] = 0x0c; | ||
376 | spec->automute = 1; | ||
377 | spec->automute_mode = ALC_AUTOMUTE_MIXER; | ||
378 | spec->ext_mic_pin = 0x18; | ||
379 | spec->int_mic_pin = 0x19; | ||
380 | spec->auto_mic = 1; | ||
381 | } | ||
382 | |||
383 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) | ||
384 | { | ||
385 | struct alc_spec *spec = codec->spec; | ||
386 | spec->autocfg.hp_pins[0] = 0x21; | ||
387 | spec->autocfg.speaker_pins[0] = 0x14; | ||
388 | spec->automute_mixer_nid[0] = 0x0c; | ||
389 | spec->automute = 1; | ||
390 | spec->automute_mode = ALC_AUTOMUTE_MIXER; | ||
391 | spec->ext_mic_pin = 0x18; | ||
392 | spec->int_mic_pin = 0x12; | ||
393 | spec->auto_mic = 1; | ||
394 | } | ||
395 | |||
396 | /* | ||
397 | * generic initialization of ADC, input mixers and output mixers | ||
398 | */ | ||
399 | static const struct hda_verb alc269_init_verbs[] = { | ||
400 | /* | ||
401 | * Unmute ADC0 and set the default input to mic-in | ||
402 | */ | ||
403 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
404 | |||
405 | /* | ||
406 | * Set up output mixers (0x02 - 0x03) | ||
407 | */ | ||
408 | /* set vol=0 to output mixers */ | ||
409 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
410 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
411 | |||
412 | /* set up input amps for analog loopback */ | ||
413 | /* Amp Indices: DAC = 0, mixer = 1 */ | ||
414 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
415 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
416 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
417 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
418 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
419 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
420 | |||
421 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
422 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
423 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
424 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
425 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
426 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
427 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
428 | |||
429 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
430 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
431 | |||
432 | /* FIXME: use Mux-type input source selection */ | ||
433 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ | ||
434 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | ||
435 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
436 | |||
437 | /* set EAPD */ | ||
438 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
439 | { } | ||
440 | }; | ||
441 | |||
442 | static const struct hda_verb alc269vb_init_verbs[] = { | ||
443 | /* | ||
444 | * Unmute ADC0 and set the default input to mic-in | ||
445 | */ | ||
446 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
447 | |||
448 | /* | ||
449 | * Set up output mixers (0x02 - 0x03) | ||
450 | */ | ||
451 | /* set vol=0 to output mixers */ | ||
452 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
453 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
454 | |||
455 | /* set up input amps for analog loopback */ | ||
456 | /* Amp Indices: DAC = 0, mixer = 1 */ | ||
457 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
458 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
459 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
460 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
461 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
462 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
463 | |||
464 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
465 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
466 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
467 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
468 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
469 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
470 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
471 | |||
472 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
473 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
474 | |||
475 | /* FIXME: use Mux-type input source selection */ | ||
476 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ | ||
477 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | ||
478 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
479 | |||
480 | /* set EAPD */ | ||
481 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
482 | { } | ||
483 | }; | ||
484 | |||
485 | /* | ||
486 | * configuration and preset | ||
487 | */ | ||
488 | static const char * const alc269_models[ALC269_MODEL_LAST] = { | ||
489 | [ALC269_BASIC] = "basic", | ||
490 | [ALC269_QUANTA_FL1] = "quanta", | ||
491 | [ALC269_AMIC] = "laptop-amic", | ||
492 | [ALC269_DMIC] = "laptop-dmic", | ||
493 | [ALC269_FUJITSU] = "fujitsu", | ||
494 | [ALC269_LIFEBOOK] = "lifebook", | ||
495 | [ALC269_AUTO] = "auto", | ||
496 | }; | ||
497 | |||
498 | static const struct snd_pci_quirk alc269_cfg_tbl[] = { | ||
499 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), | ||
500 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), | ||
501 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", | ||
502 | ALC269_AMIC), | ||
503 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), | ||
504 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), | ||
505 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), | ||
506 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), | ||
507 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), | ||
508 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), | ||
509 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), | ||
510 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), | ||
511 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), | ||
512 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC), | ||
513 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), | ||
514 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), | ||
515 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), | ||
516 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), | ||
517 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), | ||
518 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), | ||
519 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), | ||
520 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), | ||
521 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), | ||
522 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), | ||
523 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), | ||
524 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), | ||
525 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), | ||
526 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), | ||
527 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), | ||
528 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), | ||
529 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), | ||
530 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), | ||
531 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), | ||
532 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), | ||
533 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), | ||
534 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), | ||
535 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), | ||
536 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), | ||
537 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), | ||
538 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), | ||
539 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), | ||
540 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), | ||
541 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), | ||
542 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), | ||
543 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), | ||
544 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), | ||
545 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), | ||
546 | {} | ||
547 | }; | ||
548 | |||
549 | static const struct alc_config_preset alc269_presets[] = { | ||
550 | [ALC269_BASIC] = { | ||
551 | .mixers = { alc269_base_mixer }, | ||
552 | .init_verbs = { alc269_init_verbs }, | ||
553 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | ||
554 | .dac_nids = alc269_dac_nids, | ||
555 | .hp_nid = 0x03, | ||
556 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | ||
557 | .channel_mode = alc269_modes, | ||
558 | .input_mux = &alc269_capture_source, | ||
559 | }, | ||
560 | [ALC269_QUANTA_FL1] = { | ||
561 | .mixers = { alc269_quanta_fl1_mixer }, | ||
562 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, | ||
563 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | ||
564 | .dac_nids = alc269_dac_nids, | ||
565 | .hp_nid = 0x03, | ||
566 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | ||
567 | .channel_mode = alc269_modes, | ||
568 | .input_mux = &alc269_capture_source, | ||
569 | .unsol_event = alc269_quanta_fl1_unsol_event, | ||
570 | .setup = alc269_quanta_fl1_setup, | ||
571 | .init_hook = alc269_quanta_fl1_init_hook, | ||
572 | }, | ||
573 | [ALC269_AMIC] = { | ||
574 | .mixers = { alc269_laptop_mixer }, | ||
575 | .cap_mixer = alc269_laptop_analog_capture_mixer, | ||
576 | .init_verbs = { alc269_init_verbs, | ||
577 | alc269_laptop_amic_init_verbs }, | ||
578 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | ||
579 | .dac_nids = alc269_dac_nids, | ||
580 | .hp_nid = 0x03, | ||
581 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | ||
582 | .channel_mode = alc269_modes, | ||
583 | .unsol_event = alc_sku_unsol_event, | ||
584 | .setup = alc269_laptop_amic_setup, | ||
585 | .init_hook = alc_inithook, | ||
586 | }, | ||
587 | [ALC269_DMIC] = { | ||
588 | .mixers = { alc269_laptop_mixer }, | ||
589 | .cap_mixer = alc269_laptop_digital_capture_mixer, | ||
590 | .init_verbs = { alc269_init_verbs, | ||
591 | alc269_laptop_dmic_init_verbs }, | ||
592 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | ||
593 | .dac_nids = alc269_dac_nids, | ||
594 | .hp_nid = 0x03, | ||
595 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | ||
596 | .channel_mode = alc269_modes, | ||
597 | .unsol_event = alc_sku_unsol_event, | ||
598 | .setup = alc269_laptop_dmic_setup, | ||
599 | .init_hook = alc_inithook, | ||
600 | }, | ||
601 | [ALC269VB_AMIC] = { | ||
602 | .mixers = { alc269vb_laptop_mixer }, | ||
603 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, | ||
604 | .init_verbs = { alc269vb_init_verbs, | ||
605 | alc269vb_laptop_amic_init_verbs }, | ||
606 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | ||
607 | .dac_nids = alc269_dac_nids, | ||
608 | .hp_nid = 0x03, | ||
609 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | ||
610 | .channel_mode = alc269_modes, | ||
611 | .unsol_event = alc_sku_unsol_event, | ||
612 | .setup = alc269vb_laptop_amic_setup, | ||
613 | .init_hook = alc_inithook, | ||
614 | }, | ||
615 | [ALC269VB_DMIC] = { | ||
616 | .mixers = { alc269vb_laptop_mixer }, | ||
617 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, | ||
618 | .init_verbs = { alc269vb_init_verbs, | ||
619 | alc269vb_laptop_dmic_init_verbs }, | ||
620 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | ||
621 | .dac_nids = alc269_dac_nids, | ||
622 | .hp_nid = 0x03, | ||
623 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | ||
624 | .channel_mode = alc269_modes, | ||
625 | .unsol_event = alc_sku_unsol_event, | ||
626 | .setup = alc269vb_laptop_dmic_setup, | ||
627 | .init_hook = alc_inithook, | ||
628 | }, | ||
629 | [ALC269_FUJITSU] = { | ||
630 | .mixers = { alc269_fujitsu_mixer }, | ||
631 | .cap_mixer = alc269_laptop_digital_capture_mixer, | ||
632 | .init_verbs = { alc269_init_verbs, | ||
633 | alc269_laptop_dmic_init_verbs }, | ||
634 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | ||
635 | .dac_nids = alc269_dac_nids, | ||
636 | .hp_nid = 0x03, | ||
637 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | ||
638 | .channel_mode = alc269_modes, | ||
639 | .unsol_event = alc_sku_unsol_event, | ||
640 | .setup = alc269_laptop_dmic_setup, | ||
641 | .init_hook = alc_inithook, | ||
642 | }, | ||
643 | [ALC269_LIFEBOOK] = { | ||
644 | .mixers = { alc269_lifebook_mixer }, | ||
645 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, | ||
646 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | ||
647 | .dac_nids = alc269_dac_nids, | ||
648 | .hp_nid = 0x03, | ||
649 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | ||
650 | .channel_mode = alc269_modes, | ||
651 | .input_mux = &alc269_capture_source, | ||
652 | .unsol_event = alc269_lifebook_unsol_event, | ||
653 | .setup = alc269_lifebook_setup, | ||
654 | .init_hook = alc269_lifebook_init_hook, | ||
655 | }, | ||
656 | [ALC271_ACER] = { | ||
657 | .mixers = { alc269_asus_mixer }, | ||
658 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, | ||
659 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, | ||
660 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | ||
661 | .dac_nids = alc269_dac_nids, | ||
662 | .adc_nids = alc262_dmic_adc_nids, | ||
663 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), | ||
664 | .capsrc_nids = alc262_dmic_capsrc_nids, | ||
665 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | ||
666 | .channel_mode = alc269_modes, | ||
667 | .input_mux = &alc269_capture_source, | ||
668 | .dig_out_nid = ALC880_DIGOUT_NID, | ||
669 | .unsol_event = alc_sku_unsol_event, | ||
670 | .setup = alc269vb_laptop_dmic_setup, | ||
671 | .init_hook = alc_inithook, | ||
672 | }, | ||
673 | }; | ||
674 | |||
diff --git a/sound/pci/hda/alc662_quirks.c b/sound/pci/hda/alc662_quirks.c deleted file mode 100644 index e69a6ea3083..00000000000 --- a/sound/pci/hda/alc662_quirks.c +++ /dev/null | |||
@@ -1,1408 +0,0 @@ | |||
1 | /* | ||
2 | * ALC662/ALC663/ALC665/ALC670 quirk models | ||
3 | * included by patch_realtek.c | ||
4 | */ | ||
5 | |||
6 | /* ALC662 models */ | ||
7 | enum { | ||
8 | ALC662_AUTO, | ||
9 | ALC662_3ST_2ch_DIG, | ||
10 | ALC662_3ST_6ch_DIG, | ||
11 | ALC662_3ST_6ch, | ||
12 | ALC662_5ST_DIG, | ||
13 | ALC662_LENOVO_101E, | ||
14 | ALC662_ASUS_EEEPC_P701, | ||
15 | ALC662_ASUS_EEEPC_EP20, | ||
16 | ALC663_ASUS_M51VA, | ||
17 | ALC663_ASUS_G71V, | ||
18 | ALC663_ASUS_H13, | ||
19 | ALC663_ASUS_G50V, | ||
20 | ALC662_ECS, | ||
21 | ALC663_ASUS_MODE1, | ||
22 | ALC662_ASUS_MODE2, | ||
23 | ALC663_ASUS_MODE3, | ||
24 | ALC663_ASUS_MODE4, | ||
25 | ALC663_ASUS_MODE5, | ||
26 | ALC663_ASUS_MODE6, | ||
27 | ALC663_ASUS_MODE7, | ||
28 | ALC663_ASUS_MODE8, | ||
29 | ALC272_DELL, | ||
30 | ALC272_DELL_ZM1, | ||
31 | ALC272_SAMSUNG_NC10, | ||
32 | ALC662_MODEL_LAST, | ||
33 | }; | ||
34 | |||
35 | #define ALC662_DIGOUT_NID 0x06 | ||
36 | #define ALC662_DIGIN_NID 0x0a | ||
37 | |||
38 | static const hda_nid_t alc662_dac_nids[3] = { | ||
39 | /* front, rear, clfe */ | ||
40 | 0x02, 0x03, 0x04 | ||
41 | }; | ||
42 | |||
43 | static const hda_nid_t alc272_dac_nids[2] = { | ||
44 | 0x02, 0x03 | ||
45 | }; | ||
46 | |||
47 | static const hda_nid_t alc662_adc_nids[2] = { | ||
48 | /* ADC1-2 */ | ||
49 | 0x09, 0x08 | ||
50 | }; | ||
51 | |||
52 | static const hda_nid_t alc272_adc_nids[1] = { | ||
53 | /* ADC1-2 */ | ||
54 | 0x08, | ||
55 | }; | ||
56 | |||
57 | static const hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; | ||
58 | static const hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; | ||
59 | |||
60 | |||
61 | /* input MUX */ | ||
62 | /* FIXME: should be a matrix-type input source selection */ | ||
63 | static const struct hda_input_mux alc662_capture_source = { | ||
64 | .num_items = 4, | ||
65 | .items = { | ||
66 | { "Mic", 0x0 }, | ||
67 | { "Front Mic", 0x1 }, | ||
68 | { "Line", 0x2 }, | ||
69 | { "CD", 0x4 }, | ||
70 | }, | ||
71 | }; | ||
72 | |||
73 | static const struct hda_input_mux alc662_lenovo_101e_capture_source = { | ||
74 | .num_items = 2, | ||
75 | .items = { | ||
76 | { "Mic", 0x1 }, | ||
77 | { "Line", 0x2 }, | ||
78 | }, | ||
79 | }; | ||
80 | |||
81 | static const struct hda_input_mux alc663_capture_source = { | ||
82 | .num_items = 3, | ||
83 | .items = { | ||
84 | { "Mic", 0x0 }, | ||
85 | { "Front Mic", 0x1 }, | ||
86 | { "Line", 0x2 }, | ||
87 | }, | ||
88 | }; | ||
89 | |||
90 | #if 0 /* set to 1 for testing other input sources below */ | ||
91 | static const struct hda_input_mux alc272_nc10_capture_source = { | ||
92 | .num_items = 16, | ||
93 | .items = { | ||
94 | { "Autoselect Mic", 0x0 }, | ||
95 | { "Internal Mic", 0x1 }, | ||
96 | { "In-0x02", 0x2 }, | ||
97 | { "In-0x03", 0x3 }, | ||
98 | { "In-0x04", 0x4 }, | ||
99 | { "In-0x05", 0x5 }, | ||
100 | { "In-0x06", 0x6 }, | ||
101 | { "In-0x07", 0x7 }, | ||
102 | { "In-0x08", 0x8 }, | ||
103 | { "In-0x09", 0x9 }, | ||
104 | { "In-0x0a", 0x0a }, | ||
105 | { "In-0x0b", 0x0b }, | ||
106 | { "In-0x0c", 0x0c }, | ||
107 | { "In-0x0d", 0x0d }, | ||
108 | { "In-0x0e", 0x0e }, | ||
109 | { "In-0x0f", 0x0f }, | ||
110 | }, | ||
111 | }; | ||
112 | #endif | ||
113 | |||
114 | /* | ||
115 | * 2ch mode | ||
116 | */ | ||
117 | static const struct hda_channel_mode alc662_3ST_2ch_modes[1] = { | ||
118 | { 2, NULL } | ||
119 | }; | ||
120 | |||
121 | /* | ||
122 | * 2ch mode | ||
123 | */ | ||
124 | static const struct hda_verb alc662_3ST_ch2_init[] = { | ||
125 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
126 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
127 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
128 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
129 | { } /* end */ | ||
130 | }; | ||
131 | |||
132 | /* | ||
133 | * 6ch mode | ||
134 | */ | ||
135 | static const struct hda_verb alc662_3ST_ch6_init[] = { | ||
136 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
137 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
138 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
139 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
140 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
141 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
142 | { } /* end */ | ||
143 | }; | ||
144 | |||
145 | static const struct hda_channel_mode alc662_3ST_6ch_modes[2] = { | ||
146 | { 2, alc662_3ST_ch2_init }, | ||
147 | { 6, alc662_3ST_ch6_init }, | ||
148 | }; | ||
149 | |||
150 | /* | ||
151 | * 2ch mode | ||
152 | */ | ||
153 | static const struct hda_verb alc662_sixstack_ch6_init[] = { | ||
154 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
155 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
156 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
157 | { } /* end */ | ||
158 | }; | ||
159 | |||
160 | /* | ||
161 | * 6ch mode | ||
162 | */ | ||
163 | static const struct hda_verb alc662_sixstack_ch8_init[] = { | ||
164 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
165 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
166 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
167 | { } /* end */ | ||
168 | }; | ||
169 | |||
170 | static const struct hda_channel_mode alc662_5stack_modes[2] = { | ||
171 | { 2, alc662_sixstack_ch6_init }, | ||
172 | { 6, alc662_sixstack_ch8_init }, | ||
173 | }; | ||
174 | |||
175 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | ||
176 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | ||
177 | */ | ||
178 | |||
179 | static const struct snd_kcontrol_new alc662_base_mixer[] = { | ||
180 | /* output mixer control */ | ||
181 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | ||
182 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), | ||
183 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), | ||
184 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), | ||
185 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), | ||
186 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | ||
187 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), | ||
188 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), | ||
189 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
190 | |||
191 | /*Input mixer control */ | ||
192 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), | ||
193 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), | ||
194 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), | ||
195 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), | ||
196 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), | ||
197 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), | ||
198 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), | ||
199 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), | ||
200 | { } /* end */ | ||
201 | }; | ||
202 | |||
203 | static const struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { | ||
204 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
205 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), | ||
206 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
207 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
208 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
209 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
210 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
211 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
212 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
213 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
214 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
215 | { } /* end */ | ||
216 | }; | ||
217 | |||
218 | static const struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { | ||
219 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
220 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), | ||
221 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
222 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), | ||
223 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), | ||
224 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | ||
225 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), | ||
226 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), | ||
227 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
228 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
229 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
230 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
231 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
232 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
233 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
234 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
235 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
236 | { } /* end */ | ||
237 | }; | ||
238 | |||
239 | static const struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { | ||
240 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
241 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), | ||
242 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
243 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), | ||
244 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
245 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
246 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
247 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
248 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
249 | { } /* end */ | ||
250 | }; | ||
251 | |||
252 | static const struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { | ||
253 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
254 | ALC262_HIPPO_MASTER_SWITCH, | ||
255 | |||
256 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
257 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
258 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
259 | |||
260 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
261 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
262 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
263 | { } /* end */ | ||
264 | }; | ||
265 | |||
266 | static const struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { | ||
267 | ALC262_HIPPO_MASTER_SWITCH, | ||
268 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
269 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
270 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), | ||
271 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | ||
272 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), | ||
273 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
274 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
275 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
276 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
277 | { } /* end */ | ||
278 | }; | ||
279 | |||
280 | static const struct hda_bind_ctls alc663_asus_bind_master_vol = { | ||
281 | .ops = &snd_hda_bind_vol, | ||
282 | .values = { | ||
283 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | ||
284 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | ||
285 | 0 | ||
286 | }, | ||
287 | }; | ||
288 | |||
289 | static const struct hda_bind_ctls alc663_asus_one_bind_switch = { | ||
290 | .ops = &snd_hda_bind_sw, | ||
291 | .values = { | ||
292 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
293 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | ||
294 | 0 | ||
295 | }, | ||
296 | }; | ||
297 | |||
298 | static const struct snd_kcontrol_new alc663_m51va_mixer[] = { | ||
299 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | ||
300 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), | ||
301 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
302 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
303 | { } /* end */ | ||
304 | }; | ||
305 | |||
306 | static const struct hda_bind_ctls alc663_asus_tree_bind_switch = { | ||
307 | .ops = &snd_hda_bind_sw, | ||
308 | .values = { | ||
309 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
310 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | ||
311 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | ||
312 | 0 | ||
313 | }, | ||
314 | }; | ||
315 | |||
316 | static const struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { | ||
317 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | ||
318 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), | ||
319 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
320 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
321 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
322 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
323 | |||
324 | { } /* end */ | ||
325 | }; | ||
326 | |||
327 | static const struct hda_bind_ctls alc663_asus_four_bind_switch = { | ||
328 | .ops = &snd_hda_bind_sw, | ||
329 | .values = { | ||
330 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
331 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | ||
332 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | ||
333 | 0 | ||
334 | }, | ||
335 | }; | ||
336 | |||
337 | static const struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { | ||
338 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | ||
339 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), | ||
340 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
341 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
342 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
343 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
344 | { } /* end */ | ||
345 | }; | ||
346 | |||
347 | static const struct snd_kcontrol_new alc662_1bjd_mixer[] = { | ||
348 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
349 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
350 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
351 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
352 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
353 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
354 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
355 | { } /* end */ | ||
356 | }; | ||
357 | |||
358 | static const struct hda_bind_ctls alc663_asus_two_bind_master_vol = { | ||
359 | .ops = &snd_hda_bind_vol, | ||
360 | .values = { | ||
361 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | ||
362 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), | ||
363 | 0 | ||
364 | }, | ||
365 | }; | ||
366 | |||
367 | static const struct hda_bind_ctls alc663_asus_two_bind_switch = { | ||
368 | .ops = &snd_hda_bind_sw, | ||
369 | .values = { | ||
370 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
371 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), | ||
372 | 0 | ||
373 | }, | ||
374 | }; | ||
375 | |||
376 | static const struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { | ||
377 | HDA_BIND_VOL("Master Playback Volume", | ||
378 | &alc663_asus_two_bind_master_vol), | ||
379 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), | ||
380 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
381 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | ||
382 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
383 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
384 | { } /* end */ | ||
385 | }; | ||
386 | |||
387 | static const struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { | ||
388 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | ||
389 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), | ||
390 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
391 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
392 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
393 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
394 | { } /* end */ | ||
395 | }; | ||
396 | |||
397 | static const struct snd_kcontrol_new alc663_g71v_mixer[] = { | ||
398 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
399 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
400 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
401 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
402 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | ||
403 | |||
404 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
405 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
406 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
407 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
408 | { } /* end */ | ||
409 | }; | ||
410 | |||
411 | static const struct snd_kcontrol_new alc663_g50v_mixer[] = { | ||
412 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
413 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
414 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | ||
415 | |||
416 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
417 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
418 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
419 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
420 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
421 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
422 | { } /* end */ | ||
423 | }; | ||
424 | |||
425 | static const struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { | ||
426 | .ops = &snd_hda_bind_sw, | ||
427 | .values = { | ||
428 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
429 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | ||
430 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), | ||
431 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | ||
432 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | ||
433 | 0 | ||
434 | }, | ||
435 | }; | ||
436 | |||
437 | static const struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { | ||
438 | .ops = &snd_hda_bind_sw, | ||
439 | .values = { | ||
440 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
441 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), | ||
442 | 0 | ||
443 | }, | ||
444 | }; | ||
445 | |||
446 | static const struct snd_kcontrol_new alc663_mode7_mixer[] = { | ||
447 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), | ||
448 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), | ||
449 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), | ||
450 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
451 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), | ||
452 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
453 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
454 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
455 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
456 | { } /* end */ | ||
457 | }; | ||
458 | |||
459 | static const struct snd_kcontrol_new alc663_mode8_mixer[] = { | ||
460 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), | ||
461 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), | ||
462 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), | ||
463 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
464 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), | ||
465 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
466 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
467 | { } /* end */ | ||
468 | }; | ||
469 | |||
470 | |||
471 | static const struct snd_kcontrol_new alc662_chmode_mixer[] = { | ||
472 | { | ||
473 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
474 | .name = "Channel Mode", | ||
475 | .info = alc_ch_mode_info, | ||
476 | .get = alc_ch_mode_get, | ||
477 | .put = alc_ch_mode_put, | ||
478 | }, | ||
479 | { } /* end */ | ||
480 | }; | ||
481 | |||
482 | static const struct hda_verb alc662_init_verbs[] = { | ||
483 | /* ADC: mute amp left and right */ | ||
484 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
485 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
486 | |||
487 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
488 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
489 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
490 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
491 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
492 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
493 | |||
494 | /* Front Pin: output 0 (0x0c) */ | ||
495 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
496 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
497 | |||
498 | /* Rear Pin: output 1 (0x0d) */ | ||
499 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
500 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
501 | |||
502 | /* CLFE Pin: output 2 (0x0e) */ | ||
503 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
504 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
505 | |||
506 | /* Mic (rear) pin: input vref at 80% */ | ||
507 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
508 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
509 | /* Front Mic pin: input vref at 80% */ | ||
510 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
511 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
512 | /* Line In pin: input */ | ||
513 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
514 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
515 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | ||
516 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
517 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
518 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
519 | /* CD pin widget for input */ | ||
520 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
521 | |||
522 | /* FIXME: use matrix-type input source selection */ | ||
523 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | ||
524 | /* Input mixer */ | ||
525 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
526 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
527 | |||
528 | { } | ||
529 | }; | ||
530 | |||
531 | static const struct hda_verb alc662_eapd_init_verbs[] = { | ||
532 | /* always trun on EAPD */ | ||
533 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
534 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
535 | { } | ||
536 | }; | ||
537 | |||
538 | static const struct hda_verb alc662_sue_init_verbs[] = { | ||
539 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC_FRONT_EVENT}, | ||
540 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC_HP_EVENT}, | ||
541 | {} | ||
542 | }; | ||
543 | |||
544 | static const struct hda_verb alc662_eeepc_sue_init_verbs[] = { | ||
545 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT}, | ||
546 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
547 | {} | ||
548 | }; | ||
549 | |||
550 | /* Set Unsolicited Event*/ | ||
551 | static const struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { | ||
552 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
553 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
554 | {} | ||
555 | }; | ||
556 | |||
557 | static const struct hda_verb alc663_m51va_init_verbs[] = { | ||
558 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
559 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
560 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
561 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
562 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
563 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
564 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | ||
565 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT}, | ||
566 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
567 | {} | ||
568 | }; | ||
569 | |||
570 | static const struct hda_verb alc663_21jd_amic_init_verbs[] = { | ||
571 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
572 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
573 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
574 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
575 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
576 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT}, | ||
577 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
578 | {} | ||
579 | }; | ||
580 | |||
581 | static const struct hda_verb alc662_1bjd_amic_init_verbs[] = { | ||
582 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
583 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
584 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
585 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | ||
586 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
587 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
588 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT}, | ||
589 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
590 | {} | ||
591 | }; | ||
592 | |||
593 | static const struct hda_verb alc663_15jd_amic_init_verbs[] = { | ||
594 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
595 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
596 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
597 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
598 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
599 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT}, | ||
600 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
601 | {} | ||
602 | }; | ||
603 | |||
604 | static const struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { | ||
605 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
606 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
607 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
608 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ | ||
609 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
610 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
611 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ | ||
612 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
613 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
614 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT}, | ||
615 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
616 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
617 | {} | ||
618 | }; | ||
619 | |||
620 | static const struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { | ||
621 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
622 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
623 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
624 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
625 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
626 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
627 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
628 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
629 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
630 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT}, | ||
631 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
632 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
633 | {} | ||
634 | }; | ||
635 | |||
636 | static const struct hda_verb alc663_g71v_init_verbs[] = { | ||
637 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
638 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ | ||
639 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ | ||
640 | |||
641 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
642 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
643 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | ||
644 | |||
645 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC_FRONT_EVENT}, | ||
646 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC_MIC_EVENT}, | ||
647 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC_HP_EVENT}, | ||
648 | {} | ||
649 | }; | ||
650 | |||
651 | static const struct hda_verb alc663_g50v_init_verbs[] = { | ||
652 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
653 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
654 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | ||
655 | |||
656 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT}, | ||
657 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
658 | {} | ||
659 | }; | ||
660 | |||
661 | static const struct hda_verb alc662_ecs_init_verbs[] = { | ||
662 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, | ||
663 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
664 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT}, | ||
665 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
666 | {} | ||
667 | }; | ||
668 | |||
669 | static const struct hda_verb alc272_dell_zm1_init_verbs[] = { | ||
670 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
671 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
672 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
673 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
674 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
675 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
676 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
677 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
678 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | ||
679 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT}, | ||
680 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
681 | {} | ||
682 | }; | ||
683 | |||
684 | static const struct hda_verb alc272_dell_init_verbs[] = { | ||
685 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
686 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
687 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
688 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
689 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
690 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
691 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
692 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
693 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | ||
694 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT}, | ||
695 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
696 | {} | ||
697 | }; | ||
698 | |||
699 | static const struct hda_verb alc663_mode7_init_verbs[] = { | ||
700 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
701 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
702 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
703 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
704 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
705 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
706 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
707 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
708 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
709 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
710 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
711 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | ||
712 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT}, | ||
713 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
714 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
715 | {} | ||
716 | }; | ||
717 | |||
718 | static const struct hda_verb alc663_mode8_init_verbs[] = { | ||
719 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
720 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
721 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
722 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
723 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
724 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
725 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
726 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
727 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
728 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
729 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
730 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
731 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | ||
732 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
733 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT}, | ||
734 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
735 | {} | ||
736 | }; | ||
737 | |||
738 | static const struct snd_kcontrol_new alc662_auto_capture_mixer[] = { | ||
739 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | ||
740 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | ||
741 | { } /* end */ | ||
742 | }; | ||
743 | |||
744 | static const struct snd_kcontrol_new alc272_auto_capture_mixer[] = { | ||
745 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | ||
746 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | ||
747 | { } /* end */ | ||
748 | }; | ||
749 | |||
750 | static void alc662_lenovo_101e_setup(struct hda_codec *codec) | ||
751 | { | ||
752 | struct alc_spec *spec = codec->spec; | ||
753 | |||
754 | spec->autocfg.hp_pins[0] = 0x1b; | ||
755 | spec->autocfg.line_out_pins[0] = 0x14; | ||
756 | spec->autocfg.speaker_pins[0] = 0x15; | ||
757 | spec->automute = 1; | ||
758 | spec->detect_line = 1; | ||
759 | spec->automute_lines = 1; | ||
760 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
761 | } | ||
762 | |||
763 | static void alc662_eeepc_setup(struct hda_codec *codec) | ||
764 | { | ||
765 | struct alc_spec *spec = codec->spec; | ||
766 | |||
767 | alc262_hippo1_setup(codec); | ||
768 | spec->ext_mic_pin = 0x18; | ||
769 | spec->int_mic_pin = 0x19; | ||
770 | spec->auto_mic = 1; | ||
771 | } | ||
772 | |||
773 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) | ||
774 | { | ||
775 | struct alc_spec *spec = codec->spec; | ||
776 | |||
777 | spec->autocfg.hp_pins[0] = 0x14; | ||
778 | spec->autocfg.speaker_pins[0] = 0x1b; | ||
779 | spec->automute = 1; | ||
780 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
781 | } | ||
782 | |||
783 | static void alc663_m51va_setup(struct hda_codec *codec) | ||
784 | { | ||
785 | struct alc_spec *spec = codec->spec; | ||
786 | spec->autocfg.hp_pins[0] = 0x21; | ||
787 | spec->autocfg.speaker_pins[0] = 0x14; | ||
788 | spec->automute_mixer_nid[0] = 0x0c; | ||
789 | spec->automute = 1; | ||
790 | spec->automute_mode = ALC_AUTOMUTE_MIXER; | ||
791 | spec->ext_mic_pin = 0x18; | ||
792 | spec->int_mic_pin = 0x12; | ||
793 | spec->auto_mic = 1; | ||
794 | } | ||
795 | |||
796 | /* ***************** Mode1 ******************************/ | ||
797 | static void alc663_mode1_setup(struct hda_codec *codec) | ||
798 | { | ||
799 | struct alc_spec *spec = codec->spec; | ||
800 | spec->autocfg.hp_pins[0] = 0x21; | ||
801 | spec->autocfg.speaker_pins[0] = 0x14; | ||
802 | spec->automute_mixer_nid[0] = 0x0c; | ||
803 | spec->automute = 1; | ||
804 | spec->automute_mode = ALC_AUTOMUTE_MIXER; | ||
805 | spec->ext_mic_pin = 0x18; | ||
806 | spec->int_mic_pin = 0x19; | ||
807 | spec->auto_mic = 1; | ||
808 | } | ||
809 | |||
810 | /* ***************** Mode2 ******************************/ | ||
811 | static void alc662_mode2_setup(struct hda_codec *codec) | ||
812 | { | ||
813 | struct alc_spec *spec = codec->spec; | ||
814 | spec->autocfg.hp_pins[0] = 0x1b; | ||
815 | spec->autocfg.speaker_pins[0] = 0x14; | ||
816 | spec->automute = 1; | ||
817 | spec->automute_mode = ALC_AUTOMUTE_PIN; | ||
818 | spec->ext_mic_pin = 0x18; | ||
819 | spec->int_mic_pin = 0x19; | ||
820 | spec->auto_mic = 1; | ||
821 | } | ||
822 | |||
823 | /* ***************** Mode3 ******************************/ | ||
824 | static void alc663_mode3_setup(struct hda_codec *codec) | ||
825 | { | ||
826 | struct alc_spec *spec = codec->spec; | ||
827 | spec->autocfg.hp_pins[0] = 0x21; | ||
828 | spec->autocfg.hp_pins[0] = 0x15; | ||
829 | spec->autocfg.speaker_pins[0] = 0x14; | ||
830 | spec->automute = 1; | ||
831 | spec->automute_mode = ALC_AUTOMUTE_PIN; | ||
832 | spec->ext_mic_pin = 0x18; | ||
833 | spec->int_mic_pin = 0x19; | ||
834 | spec->auto_mic = 1; | ||
835 | } | ||
836 | |||
837 | /* ***************** Mode4 ******************************/ | ||
838 | static void alc663_mode4_setup(struct hda_codec *codec) | ||
839 | { | ||
840 | struct alc_spec *spec = codec->spec; | ||
841 | spec->autocfg.hp_pins[0] = 0x21; | ||
842 | spec->autocfg.speaker_pins[0] = 0x14; | ||
843 | spec->autocfg.speaker_pins[1] = 0x16; | ||
844 | spec->automute_mixer_nid[0] = 0x0c; | ||
845 | spec->automute_mixer_nid[1] = 0x0e; | ||
846 | spec->automute = 1; | ||
847 | spec->automute_mode = ALC_AUTOMUTE_MIXER; | ||
848 | spec->ext_mic_pin = 0x18; | ||
849 | spec->int_mic_pin = 0x19; | ||
850 | spec->auto_mic = 1; | ||
851 | } | ||
852 | |||
853 | /* ***************** Mode5 ******************************/ | ||
854 | static void alc663_mode5_setup(struct hda_codec *codec) | ||
855 | { | ||
856 | struct alc_spec *spec = codec->spec; | ||
857 | spec->autocfg.hp_pins[0] = 0x15; | ||
858 | spec->autocfg.speaker_pins[0] = 0x14; | ||
859 | spec->autocfg.speaker_pins[1] = 0x16; | ||
860 | spec->automute_mixer_nid[0] = 0x0c; | ||
861 | spec->automute_mixer_nid[1] = 0x0e; | ||
862 | spec->automute = 1; | ||
863 | spec->automute_mode = ALC_AUTOMUTE_MIXER; | ||
864 | spec->ext_mic_pin = 0x18; | ||
865 | spec->int_mic_pin = 0x19; | ||
866 | spec->auto_mic = 1; | ||
867 | } | ||
868 | |||
869 | /* ***************** Mode6 ******************************/ | ||
870 | static void alc663_mode6_setup(struct hda_codec *codec) | ||
871 | { | ||
872 | struct alc_spec *spec = codec->spec; | ||
873 | spec->autocfg.hp_pins[0] = 0x1b; | ||
874 | spec->autocfg.hp_pins[0] = 0x15; | ||
875 | spec->autocfg.speaker_pins[0] = 0x14; | ||
876 | spec->automute_mixer_nid[0] = 0x0c; | ||
877 | spec->automute = 1; | ||
878 | spec->automute_mode = ALC_AUTOMUTE_MIXER; | ||
879 | spec->ext_mic_pin = 0x18; | ||
880 | spec->int_mic_pin = 0x19; | ||
881 | spec->auto_mic = 1; | ||
882 | } | ||
883 | |||
884 | /* ***************** Mode7 ******************************/ | ||
885 | static void alc663_mode7_setup(struct hda_codec *codec) | ||
886 | { | ||
887 | struct alc_spec *spec = codec->spec; | ||
888 | spec->autocfg.hp_pins[0] = 0x1b; | ||
889 | spec->autocfg.hp_pins[0] = 0x21; | ||
890 | spec->autocfg.speaker_pins[0] = 0x14; | ||
891 | spec->autocfg.speaker_pins[0] = 0x17; | ||
892 | spec->automute = 1; | ||
893 | spec->automute_mode = ALC_AUTOMUTE_PIN; | ||
894 | spec->ext_mic_pin = 0x18; | ||
895 | spec->int_mic_pin = 0x19; | ||
896 | spec->auto_mic = 1; | ||
897 | } | ||
898 | |||
899 | /* ***************** Mode8 ******************************/ | ||
900 | static void alc663_mode8_setup(struct hda_codec *codec) | ||
901 | { | ||
902 | struct alc_spec *spec = codec->spec; | ||
903 | spec->autocfg.hp_pins[0] = 0x21; | ||
904 | spec->autocfg.hp_pins[1] = 0x15; | ||
905 | spec->autocfg.speaker_pins[0] = 0x14; | ||
906 | spec->autocfg.speaker_pins[0] = 0x17; | ||
907 | spec->automute = 1; | ||
908 | spec->automute_mode = ALC_AUTOMUTE_PIN; | ||
909 | spec->ext_mic_pin = 0x18; | ||
910 | spec->int_mic_pin = 0x12; | ||
911 | spec->auto_mic = 1; | ||
912 | } | ||
913 | |||
914 | static void alc663_g71v_setup(struct hda_codec *codec) | ||
915 | { | ||
916 | struct alc_spec *spec = codec->spec; | ||
917 | spec->autocfg.hp_pins[0] = 0x21; | ||
918 | spec->autocfg.line_out_pins[0] = 0x15; | ||
919 | spec->autocfg.speaker_pins[0] = 0x14; | ||
920 | spec->automute = 1; | ||
921 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
922 | spec->detect_line = 1; | ||
923 | spec->automute_lines = 1; | ||
924 | spec->ext_mic_pin = 0x18; | ||
925 | spec->int_mic_pin = 0x12; | ||
926 | spec->auto_mic = 1; | ||
927 | } | ||
928 | |||
929 | #define alc663_g50v_setup alc663_m51va_setup | ||
930 | |||
931 | static const struct snd_kcontrol_new alc662_ecs_mixer[] = { | ||
932 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
933 | ALC262_HIPPO_MASTER_SWITCH, | ||
934 | |||
935 | HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT), | ||
936 | HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
937 | HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
938 | |||
939 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
940 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
941 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
942 | { } /* end */ | ||
943 | }; | ||
944 | |||
945 | static const struct snd_kcontrol_new alc272_nc10_mixer[] = { | ||
946 | /* Master Playback automatically created from Speaker and Headphone */ | ||
947 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
948 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
949 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
950 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | ||
951 | |||
952 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
953 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
954 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
955 | |||
956 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
957 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
958 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
959 | { } /* end */ | ||
960 | }; | ||
961 | |||
962 | |||
963 | /* | ||
964 | * configuration and preset | ||
965 | */ | ||
966 | static const char * const alc662_models[ALC662_MODEL_LAST] = { | ||
967 | [ALC662_3ST_2ch_DIG] = "3stack-dig", | ||
968 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", | ||
969 | [ALC662_3ST_6ch] = "3stack-6ch", | ||
970 | [ALC662_5ST_DIG] = "5stack-dig", | ||
971 | [ALC662_LENOVO_101E] = "lenovo-101e", | ||
972 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", | ||
973 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", | ||
974 | [ALC662_ECS] = "ecs", | ||
975 | [ALC663_ASUS_M51VA] = "m51va", | ||
976 | [ALC663_ASUS_G71V] = "g71v", | ||
977 | [ALC663_ASUS_H13] = "h13", | ||
978 | [ALC663_ASUS_G50V] = "g50v", | ||
979 | [ALC663_ASUS_MODE1] = "asus-mode1", | ||
980 | [ALC662_ASUS_MODE2] = "asus-mode2", | ||
981 | [ALC663_ASUS_MODE3] = "asus-mode3", | ||
982 | [ALC663_ASUS_MODE4] = "asus-mode4", | ||
983 | [ALC663_ASUS_MODE5] = "asus-mode5", | ||
984 | [ALC663_ASUS_MODE6] = "asus-mode6", | ||
985 | [ALC663_ASUS_MODE7] = "asus-mode7", | ||
986 | [ALC663_ASUS_MODE8] = "asus-mode8", | ||
987 | [ALC272_DELL] = "dell", | ||
988 | [ALC272_DELL_ZM1] = "dell-zm1", | ||
989 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", | ||
990 | [ALC662_AUTO] = "auto", | ||
991 | }; | ||
992 | |||
993 | static const struct snd_pci_quirk alc662_cfg_tbl[] = { | ||
994 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), | ||
995 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), | ||
996 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), | ||
997 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), | ||
998 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), | ||
999 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), | ||
1000 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), | ||
1001 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), | ||
1002 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), | ||
1003 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), | ||
1004 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), | ||
1005 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), | ||
1006 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), | ||
1007 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), | ||
1008 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), | ||
1009 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), | ||
1010 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), | ||
1011 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), | ||
1012 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), | ||
1013 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), | ||
1014 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), | ||
1015 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), | ||
1016 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), | ||
1017 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), | ||
1018 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), | ||
1019 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), | ||
1020 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), | ||
1021 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), | ||
1022 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), | ||
1023 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), | ||
1024 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), | ||
1025 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), | ||
1026 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), | ||
1027 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), | ||
1028 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), | ||
1029 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), | ||
1030 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), | ||
1031 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ | ||
1032 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), | ||
1033 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), | ||
1034 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), | ||
1035 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), | ||
1036 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), | ||
1037 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), | ||
1038 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), | ||
1039 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), | ||
1040 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), | ||
1041 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), | ||
1042 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), | ||
1043 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), | ||
1044 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), | ||
1045 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), | ||
1046 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), | ||
1047 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ | ||
1048 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), | ||
1049 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), | ||
1050 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), | ||
1051 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), | ||
1052 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), | ||
1053 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), | ||
1054 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), | ||
1055 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), | ||
1056 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), | ||
1057 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", | ||
1058 | ALC662_3ST_6ch_DIG), | ||
1059 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), | ||
1060 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), | ||
1061 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", | ||
1062 | ALC662_3ST_6ch_DIG), | ||
1063 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), | ||
1064 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), | ||
1065 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), | ||
1066 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), | ||
1067 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", | ||
1068 | ALC662_3ST_6ch_DIG), | ||
1069 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", | ||
1070 | ALC663_ASUS_H13), | ||
1071 | SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E), | ||
1072 | {} | ||
1073 | }; | ||
1074 | |||
1075 | static const struct alc_config_preset alc662_presets[] = { | ||
1076 | [ALC662_3ST_2ch_DIG] = { | ||
1077 | .mixers = { alc662_3ST_2ch_mixer }, | ||
1078 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, | ||
1079 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
1080 | .dac_nids = alc662_dac_nids, | ||
1081 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
1082 | .dig_in_nid = ALC662_DIGIN_NID, | ||
1083 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
1084 | .channel_mode = alc662_3ST_2ch_modes, | ||
1085 | .input_mux = &alc662_capture_source, | ||
1086 | }, | ||
1087 | [ALC662_3ST_6ch_DIG] = { | ||
1088 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, | ||
1089 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, | ||
1090 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
1091 | .dac_nids = alc662_dac_nids, | ||
1092 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
1093 | .dig_in_nid = ALC662_DIGIN_NID, | ||
1094 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | ||
1095 | .channel_mode = alc662_3ST_6ch_modes, | ||
1096 | .need_dac_fix = 1, | ||
1097 | .input_mux = &alc662_capture_source, | ||
1098 | }, | ||
1099 | [ALC662_3ST_6ch] = { | ||
1100 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, | ||
1101 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, | ||
1102 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
1103 | .dac_nids = alc662_dac_nids, | ||
1104 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | ||
1105 | .channel_mode = alc662_3ST_6ch_modes, | ||
1106 | .need_dac_fix = 1, | ||
1107 | .input_mux = &alc662_capture_source, | ||
1108 | }, | ||
1109 | [ALC662_5ST_DIG] = { | ||
1110 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, | ||
1111 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, | ||
1112 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
1113 | .dac_nids = alc662_dac_nids, | ||
1114 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
1115 | .dig_in_nid = ALC662_DIGIN_NID, | ||
1116 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), | ||
1117 | .channel_mode = alc662_5stack_modes, | ||
1118 | .input_mux = &alc662_capture_source, | ||
1119 | }, | ||
1120 | [ALC662_LENOVO_101E] = { | ||
1121 | .mixers = { alc662_lenovo_101e_mixer }, | ||
1122 | .init_verbs = { alc662_init_verbs, | ||
1123 | alc662_eapd_init_verbs, | ||
1124 | alc662_sue_init_verbs }, | ||
1125 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
1126 | .dac_nids = alc662_dac_nids, | ||
1127 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
1128 | .channel_mode = alc662_3ST_2ch_modes, | ||
1129 | .input_mux = &alc662_lenovo_101e_capture_source, | ||
1130 | .unsol_event = alc_sku_unsol_event, | ||
1131 | .setup = alc662_lenovo_101e_setup, | ||
1132 | .init_hook = alc_inithook, | ||
1133 | }, | ||
1134 | [ALC662_ASUS_EEEPC_P701] = { | ||
1135 | .mixers = { alc662_eeepc_p701_mixer }, | ||
1136 | .init_verbs = { alc662_init_verbs, | ||
1137 | alc662_eapd_init_verbs, | ||
1138 | alc662_eeepc_sue_init_verbs }, | ||
1139 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
1140 | .dac_nids = alc662_dac_nids, | ||
1141 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
1142 | .channel_mode = alc662_3ST_2ch_modes, | ||
1143 | .unsol_event = alc_sku_unsol_event, | ||
1144 | .setup = alc662_eeepc_setup, | ||
1145 | .init_hook = alc_inithook, | ||
1146 | }, | ||
1147 | [ALC662_ASUS_EEEPC_EP20] = { | ||
1148 | .mixers = { alc662_eeepc_ep20_mixer, | ||
1149 | alc662_chmode_mixer }, | ||
1150 | .init_verbs = { alc662_init_verbs, | ||
1151 | alc662_eapd_init_verbs, | ||
1152 | alc662_eeepc_ep20_sue_init_verbs }, | ||
1153 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
1154 | .dac_nids = alc662_dac_nids, | ||
1155 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | ||
1156 | .channel_mode = alc662_3ST_6ch_modes, | ||
1157 | .input_mux = &alc662_lenovo_101e_capture_source, | ||
1158 | .unsol_event = alc_sku_unsol_event, | ||
1159 | .setup = alc662_eeepc_ep20_setup, | ||
1160 | .init_hook = alc_inithook, | ||
1161 | }, | ||
1162 | [ALC662_ECS] = { | ||
1163 | .mixers = { alc662_ecs_mixer }, | ||
1164 | .init_verbs = { alc662_init_verbs, | ||
1165 | alc662_eapd_init_verbs, | ||
1166 | alc662_ecs_init_verbs }, | ||
1167 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
1168 | .dac_nids = alc662_dac_nids, | ||
1169 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
1170 | .channel_mode = alc662_3ST_2ch_modes, | ||
1171 | .unsol_event = alc_sku_unsol_event, | ||
1172 | .setup = alc662_eeepc_setup, | ||
1173 | .init_hook = alc_inithook, | ||
1174 | }, | ||
1175 | [ALC663_ASUS_M51VA] = { | ||
1176 | .mixers = { alc663_m51va_mixer }, | ||
1177 | .init_verbs = { alc662_init_verbs, | ||
1178 | alc662_eapd_init_verbs, | ||
1179 | alc663_m51va_init_verbs }, | ||
1180 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
1181 | .dac_nids = alc662_dac_nids, | ||
1182 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
1183 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
1184 | .channel_mode = alc662_3ST_2ch_modes, | ||
1185 | .unsol_event = alc_sku_unsol_event, | ||
1186 | .setup = alc663_m51va_setup, | ||
1187 | .init_hook = alc_inithook, | ||
1188 | }, | ||
1189 | [ALC663_ASUS_G71V] = { | ||
1190 | .mixers = { alc663_g71v_mixer }, | ||
1191 | .init_verbs = { alc662_init_verbs, | ||
1192 | alc662_eapd_init_verbs, | ||
1193 | alc663_g71v_init_verbs }, | ||
1194 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
1195 | .dac_nids = alc662_dac_nids, | ||
1196 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
1197 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
1198 | .channel_mode = alc662_3ST_2ch_modes, | ||
1199 | .unsol_event = alc_sku_unsol_event, | ||
1200 | .setup = alc663_g71v_setup, | ||
1201 | .init_hook = alc_inithook, | ||
1202 | }, | ||
1203 | [ALC663_ASUS_H13] = { | ||
1204 | .mixers = { alc663_m51va_mixer }, | ||
1205 | .init_verbs = { alc662_init_verbs, | ||
1206 | alc662_eapd_init_verbs, | ||
1207 | alc663_m51va_init_verbs }, | ||
1208 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
1209 | .dac_nids = alc662_dac_nids, | ||
1210 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
1211 | .channel_mode = alc662_3ST_2ch_modes, | ||
1212 | .setup = alc663_m51va_setup, | ||
1213 | .unsol_event = alc_sku_unsol_event, | ||
1214 | .init_hook = alc_inithook, | ||
1215 | }, | ||
1216 | [ALC663_ASUS_G50V] = { | ||
1217 | .mixers = { alc663_g50v_mixer }, | ||
1218 | .init_verbs = { alc662_init_verbs, | ||
1219 | alc662_eapd_init_verbs, | ||
1220 | alc663_g50v_init_verbs }, | ||
1221 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
1222 | .dac_nids = alc662_dac_nids, | ||
1223 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
1224 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | ||
1225 | .channel_mode = alc662_3ST_6ch_modes, | ||
1226 | .input_mux = &alc663_capture_source, | ||
1227 | .unsol_event = alc_sku_unsol_event, | ||
1228 | .setup = alc663_g50v_setup, | ||
1229 | .init_hook = alc_inithook, | ||
1230 | }, | ||
1231 | [ALC663_ASUS_MODE1] = { | ||
1232 | .mixers = { alc663_m51va_mixer }, | ||
1233 | .cap_mixer = alc662_auto_capture_mixer, | ||
1234 | .init_verbs = { alc662_init_verbs, | ||
1235 | alc662_eapd_init_verbs, | ||
1236 | alc663_21jd_amic_init_verbs }, | ||
1237 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
1238 | .hp_nid = 0x03, | ||
1239 | .dac_nids = alc662_dac_nids, | ||
1240 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
1241 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
1242 | .channel_mode = alc662_3ST_2ch_modes, | ||
1243 | .unsol_event = alc_sku_unsol_event, | ||
1244 | .setup = alc663_mode1_setup, | ||
1245 | .init_hook = alc_inithook, | ||
1246 | }, | ||
1247 | [ALC662_ASUS_MODE2] = { | ||
1248 | .mixers = { alc662_1bjd_mixer }, | ||
1249 | .cap_mixer = alc662_auto_capture_mixer, | ||
1250 | .init_verbs = { alc662_init_verbs, | ||
1251 | alc662_eapd_init_verbs, | ||
1252 | alc662_1bjd_amic_init_verbs }, | ||
1253 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
1254 | .dac_nids = alc662_dac_nids, | ||
1255 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
1256 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
1257 | .channel_mode = alc662_3ST_2ch_modes, | ||
1258 | .unsol_event = alc_sku_unsol_event, | ||
1259 | .setup = alc662_mode2_setup, | ||
1260 | .init_hook = alc_inithook, | ||
1261 | }, | ||
1262 | [ALC663_ASUS_MODE3] = { | ||
1263 | .mixers = { alc663_two_hp_m1_mixer }, | ||
1264 | .cap_mixer = alc662_auto_capture_mixer, | ||
1265 | .init_verbs = { alc662_init_verbs, | ||
1266 | alc662_eapd_init_verbs, | ||
1267 | alc663_two_hp_amic_m1_init_verbs }, | ||
1268 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
1269 | .hp_nid = 0x03, | ||
1270 | .dac_nids = alc662_dac_nids, | ||
1271 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
1272 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
1273 | .channel_mode = alc662_3ST_2ch_modes, | ||
1274 | .unsol_event = alc_sku_unsol_event, | ||
1275 | .setup = alc663_mode3_setup, | ||
1276 | .init_hook = alc_inithook, | ||
1277 | }, | ||
1278 | [ALC663_ASUS_MODE4] = { | ||
1279 | .mixers = { alc663_asus_21jd_clfe_mixer }, | ||
1280 | .cap_mixer = alc662_auto_capture_mixer, | ||
1281 | .init_verbs = { alc662_init_verbs, | ||
1282 | alc662_eapd_init_verbs, | ||
1283 | alc663_21jd_amic_init_verbs}, | ||
1284 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
1285 | .hp_nid = 0x03, | ||
1286 | .dac_nids = alc662_dac_nids, | ||
1287 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
1288 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
1289 | .channel_mode = alc662_3ST_2ch_modes, | ||
1290 | .unsol_event = alc_sku_unsol_event, | ||
1291 | .setup = alc663_mode4_setup, | ||
1292 | .init_hook = alc_inithook, | ||
1293 | }, | ||
1294 | [ALC663_ASUS_MODE5] = { | ||
1295 | .mixers = { alc663_asus_15jd_clfe_mixer }, | ||
1296 | .cap_mixer = alc662_auto_capture_mixer, | ||
1297 | .init_verbs = { alc662_init_verbs, | ||
1298 | alc662_eapd_init_verbs, | ||
1299 | alc663_15jd_amic_init_verbs }, | ||
1300 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
1301 | .hp_nid = 0x03, | ||
1302 | .dac_nids = alc662_dac_nids, | ||
1303 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
1304 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
1305 | .channel_mode = alc662_3ST_2ch_modes, | ||
1306 | .unsol_event = alc_sku_unsol_event, | ||
1307 | .setup = alc663_mode5_setup, | ||
1308 | .init_hook = alc_inithook, | ||
1309 | }, | ||
1310 | [ALC663_ASUS_MODE6] = { | ||
1311 | .mixers = { alc663_two_hp_m2_mixer }, | ||
1312 | .cap_mixer = alc662_auto_capture_mixer, | ||
1313 | .init_verbs = { alc662_init_verbs, | ||
1314 | alc662_eapd_init_verbs, | ||
1315 | alc663_two_hp_amic_m2_init_verbs }, | ||
1316 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
1317 | .hp_nid = 0x03, | ||
1318 | .dac_nids = alc662_dac_nids, | ||
1319 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
1320 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
1321 | .channel_mode = alc662_3ST_2ch_modes, | ||
1322 | .unsol_event = alc_sku_unsol_event, | ||
1323 | .setup = alc663_mode6_setup, | ||
1324 | .init_hook = alc_inithook, | ||
1325 | }, | ||
1326 | [ALC663_ASUS_MODE7] = { | ||
1327 | .mixers = { alc663_mode7_mixer }, | ||
1328 | .cap_mixer = alc662_auto_capture_mixer, | ||
1329 | .init_verbs = { alc662_init_verbs, | ||
1330 | alc662_eapd_init_verbs, | ||
1331 | alc663_mode7_init_verbs }, | ||
1332 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
1333 | .hp_nid = 0x03, | ||
1334 | .dac_nids = alc662_dac_nids, | ||
1335 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
1336 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
1337 | .channel_mode = alc662_3ST_2ch_modes, | ||
1338 | .unsol_event = alc_sku_unsol_event, | ||
1339 | .setup = alc663_mode7_setup, | ||
1340 | .init_hook = alc_inithook, | ||
1341 | }, | ||
1342 | [ALC663_ASUS_MODE8] = { | ||
1343 | .mixers = { alc663_mode8_mixer }, | ||
1344 | .cap_mixer = alc662_auto_capture_mixer, | ||
1345 | .init_verbs = { alc662_init_verbs, | ||
1346 | alc662_eapd_init_verbs, | ||
1347 | alc663_mode8_init_verbs }, | ||
1348 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
1349 | .hp_nid = 0x03, | ||
1350 | .dac_nids = alc662_dac_nids, | ||
1351 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
1352 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
1353 | .channel_mode = alc662_3ST_2ch_modes, | ||
1354 | .unsol_event = alc_sku_unsol_event, | ||
1355 | .setup = alc663_mode8_setup, | ||
1356 | .init_hook = alc_inithook, | ||
1357 | }, | ||
1358 | [ALC272_DELL] = { | ||
1359 | .mixers = { alc663_m51va_mixer }, | ||
1360 | .cap_mixer = alc272_auto_capture_mixer, | ||
1361 | .init_verbs = { alc662_init_verbs, | ||
1362 | alc662_eapd_init_verbs, | ||
1363 | alc272_dell_init_verbs }, | ||
1364 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), | ||
1365 | .dac_nids = alc272_dac_nids, | ||
1366 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
1367 | .adc_nids = alc272_adc_nids, | ||
1368 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), | ||
1369 | .capsrc_nids = alc272_capsrc_nids, | ||
1370 | .channel_mode = alc662_3ST_2ch_modes, | ||
1371 | .unsol_event = alc_sku_unsol_event, | ||
1372 | .setup = alc663_m51va_setup, | ||
1373 | .init_hook = alc_inithook, | ||
1374 | }, | ||
1375 | [ALC272_DELL_ZM1] = { | ||
1376 | .mixers = { alc663_m51va_mixer }, | ||
1377 | .cap_mixer = alc662_auto_capture_mixer, | ||
1378 | .init_verbs = { alc662_init_verbs, | ||
1379 | alc662_eapd_init_verbs, | ||
1380 | alc272_dell_zm1_init_verbs }, | ||
1381 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), | ||
1382 | .dac_nids = alc272_dac_nids, | ||
1383 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
1384 | .adc_nids = alc662_adc_nids, | ||
1385 | .num_adc_nids = 1, | ||
1386 | .capsrc_nids = alc662_capsrc_nids, | ||
1387 | .channel_mode = alc662_3ST_2ch_modes, | ||
1388 | .unsol_event = alc_sku_unsol_event, | ||
1389 | .setup = alc663_m51va_setup, | ||
1390 | .init_hook = alc_inithook, | ||
1391 | }, | ||
1392 | [ALC272_SAMSUNG_NC10] = { | ||
1393 | .mixers = { alc272_nc10_mixer }, | ||
1394 | .init_verbs = { alc662_init_verbs, | ||
1395 | alc662_eapd_init_verbs, | ||
1396 | alc663_21jd_amic_init_verbs }, | ||
1397 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), | ||
1398 | .dac_nids = alc272_dac_nids, | ||
1399 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
1400 | .channel_mode = alc662_3ST_2ch_modes, | ||
1401 | /*.input_mux = &alc272_nc10_capture_source,*/ | ||
1402 | .unsol_event = alc_sku_unsol_event, | ||
1403 | .setup = alc663_mode4_setup, | ||
1404 | .init_hook = alc_inithook, | ||
1405 | }, | ||
1406 | }; | ||
1407 | |||
1408 | |||
diff --git a/sound/pci/hda/alc680_quirks.c b/sound/pci/hda/alc680_quirks.c deleted file mode 100644 index 0eeb227c7bc..00000000000 --- a/sound/pci/hda/alc680_quirks.c +++ /dev/null | |||
@@ -1,222 +0,0 @@ | |||
1 | /* | ||
2 | * ALC680 quirk models | ||
3 | * included by patch_realtek.c | ||
4 | */ | ||
5 | |||
6 | /* ALC680 models */ | ||
7 | enum { | ||
8 | ALC680_AUTO, | ||
9 | ALC680_BASE, | ||
10 | ALC680_MODEL_LAST, | ||
11 | }; | ||
12 | |||
13 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID | ||
14 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID | ||
15 | #define alc680_modes alc260_modes | ||
16 | |||
17 | static const hda_nid_t alc680_dac_nids[3] = { | ||
18 | /* Lout1, Lout2, hp */ | ||
19 | 0x02, 0x03, 0x04 | ||
20 | }; | ||
21 | |||
22 | static const hda_nid_t alc680_adc_nids[3] = { | ||
23 | /* ADC0-2 */ | ||
24 | /* DMIC, MIC, Line-in*/ | ||
25 | 0x07, 0x08, 0x09 | ||
26 | }; | ||
27 | |||
28 | /* | ||
29 | * Analog capture ADC cgange | ||
30 | */ | ||
31 | static hda_nid_t alc680_get_cur_adc(struct hda_codec *codec) | ||
32 | { | ||
33 | static hda_nid_t pins[] = {0x18, 0x19}; | ||
34 | static hda_nid_t adcs[] = {0x08, 0x09}; | ||
35 | int i; | ||
36 | |||
37 | for (i = 0; i < ARRAY_SIZE(pins); i++) { | ||
38 | if (!is_jack_detectable(codec, pins[i])) | ||
39 | continue; | ||
40 | if (snd_hda_jack_detect(codec, pins[i])) | ||
41 | return adcs[i]; | ||
42 | } | ||
43 | return 0x07; | ||
44 | } | ||
45 | |||
46 | static void alc680_rec_autoswitch(struct hda_codec *codec) | ||
47 | { | ||
48 | struct alc_spec *spec = codec->spec; | ||
49 | hda_nid_t nid = alc680_get_cur_adc(codec); | ||
50 | if (spec->cur_adc && nid != spec->cur_adc) { | ||
51 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); | ||
52 | spec->cur_adc = nid; | ||
53 | snd_hda_codec_setup_stream(codec, nid, | ||
54 | spec->cur_adc_stream_tag, 0, | ||
55 | spec->cur_adc_format); | ||
56 | } | ||
57 | } | ||
58 | |||
59 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, | ||
60 | struct hda_codec *codec, | ||
61 | unsigned int stream_tag, | ||
62 | unsigned int format, | ||
63 | struct snd_pcm_substream *substream) | ||
64 | { | ||
65 | struct alc_spec *spec = codec->spec; | ||
66 | hda_nid_t nid = alc680_get_cur_adc(codec); | ||
67 | |||
68 | spec->cur_adc = nid; | ||
69 | spec->cur_adc_stream_tag = stream_tag; | ||
70 | spec->cur_adc_format = format; | ||
71 | snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format); | ||
72 | return 0; | ||
73 | } | ||
74 | |||
75 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | ||
76 | struct hda_codec *codec, | ||
77 | struct snd_pcm_substream *substream) | ||
78 | { | ||
79 | struct alc_spec *spec = codec->spec; | ||
80 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); | ||
81 | spec->cur_adc = 0; | ||
82 | return 0; | ||
83 | } | ||
84 | |||
85 | static const struct hda_pcm_stream alc680_pcm_analog_auto_capture = { | ||
86 | .substreams = 1, /* can be overridden */ | ||
87 | .channels_min = 2, | ||
88 | .channels_max = 2, | ||
89 | /* NID is set in alc_build_pcms */ | ||
90 | .ops = { | ||
91 | .prepare = alc680_capture_pcm_prepare, | ||
92 | .cleanup = alc680_capture_pcm_cleanup | ||
93 | }, | ||
94 | }; | ||
95 | |||
96 | static const struct snd_kcontrol_new alc680_base_mixer[] = { | ||
97 | /* output mixer control */ | ||
98 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | ||
99 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
100 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), | ||
101 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), | ||
102 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT), | ||
103 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
104 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT), | ||
105 | { } | ||
106 | }; | ||
107 | |||
108 | static const struct hda_bind_ctls alc680_bind_cap_vol = { | ||
109 | .ops = &snd_hda_bind_vol, | ||
110 | .values = { | ||
111 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), | ||
112 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | ||
113 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | ||
114 | 0 | ||
115 | }, | ||
116 | }; | ||
117 | |||
118 | static const struct hda_bind_ctls alc680_bind_cap_switch = { | ||
119 | .ops = &snd_hda_bind_sw, | ||
120 | .values = { | ||
121 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), | ||
122 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | ||
123 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | ||
124 | 0 | ||
125 | }, | ||
126 | }; | ||
127 | |||
128 | static const struct snd_kcontrol_new alc680_master_capture_mixer[] = { | ||
129 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), | ||
130 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), | ||
131 | { } /* end */ | ||
132 | }; | ||
133 | |||
134 | /* | ||
135 | * generic initialization of ADC, input mixers and output mixers | ||
136 | */ | ||
137 | static const struct hda_verb alc680_init_verbs[] = { | ||
138 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
139 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
140 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
141 | |||
142 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
143 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
144 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
145 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
146 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
147 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
148 | |||
149 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
150 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
151 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
152 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
153 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
154 | |||
155 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, | ||
156 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_MIC_EVENT | AC_USRSP_EN}, | ||
157 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_MIC_EVENT | AC_USRSP_EN}, | ||
158 | |||
159 | { } | ||
160 | }; | ||
161 | |||
162 | /* toggle speaker-output according to the hp-jack state */ | ||
163 | static void alc680_base_setup(struct hda_codec *codec) | ||
164 | { | ||
165 | struct alc_spec *spec = codec->spec; | ||
166 | |||
167 | spec->autocfg.hp_pins[0] = 0x16; | ||
168 | spec->autocfg.speaker_pins[0] = 0x14; | ||
169 | spec->autocfg.speaker_pins[1] = 0x15; | ||
170 | spec->autocfg.num_inputs = 2; | ||
171 | spec->autocfg.inputs[0].pin = 0x18; | ||
172 | spec->autocfg.inputs[0].type = AUTO_PIN_MIC; | ||
173 | spec->autocfg.inputs[1].pin = 0x19; | ||
174 | spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; | ||
175 | spec->automute = 1; | ||
176 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
177 | } | ||
178 | |||
179 | static void alc680_unsol_event(struct hda_codec *codec, | ||
180 | unsigned int res) | ||
181 | { | ||
182 | if ((res >> 26) == ALC_HP_EVENT) | ||
183 | alc_hp_automute(codec); | ||
184 | if ((res >> 26) == ALC_MIC_EVENT) | ||
185 | alc680_rec_autoswitch(codec); | ||
186 | } | ||
187 | |||
188 | static void alc680_inithook(struct hda_codec *codec) | ||
189 | { | ||
190 | alc_hp_automute(codec); | ||
191 | alc680_rec_autoswitch(codec); | ||
192 | } | ||
193 | |||
194 | /* | ||
195 | * configuration and preset | ||
196 | */ | ||
197 | static const char * const alc680_models[ALC680_MODEL_LAST] = { | ||
198 | [ALC680_BASE] = "base", | ||
199 | [ALC680_AUTO] = "auto", | ||
200 | }; | ||
201 | |||
202 | static const struct snd_pci_quirk alc680_cfg_tbl[] = { | ||
203 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), | ||
204 | {} | ||
205 | }; | ||
206 | |||
207 | static const struct alc_config_preset alc680_presets[] = { | ||
208 | [ALC680_BASE] = { | ||
209 | .mixers = { alc680_base_mixer }, | ||
210 | .cap_mixer = alc680_master_capture_mixer, | ||
211 | .init_verbs = { alc680_init_verbs }, | ||
212 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), | ||
213 | .dac_nids = alc680_dac_nids, | ||
214 | .dig_out_nid = ALC680_DIGOUT_NID, | ||
215 | .num_channel_mode = ARRAY_SIZE(alc680_modes), | ||
216 | .channel_mode = alc680_modes, | ||
217 | .unsol_event = alc680_unsol_event, | ||
218 | .setup = alc680_base_setup, | ||
219 | .init_hook = alc680_inithook, | ||
220 | |||
221 | }, | ||
222 | }; | ||
diff --git a/sound/pci/hda/alc861_quirks.c b/sound/pci/hda/alc861_quirks.c deleted file mode 100644 index d719ec6350e..00000000000 --- a/sound/pci/hda/alc861_quirks.c +++ /dev/null | |||
@@ -1,725 +0,0 @@ | |||
1 | /* | ||
2 | * ALC660/ALC861 quirk models | ||
3 | * included by patch_realtek.c | ||
4 | */ | ||
5 | |||
6 | /* ALC861 models */ | ||
7 | enum { | ||
8 | ALC861_AUTO, | ||
9 | ALC861_3ST, | ||
10 | ALC660_3ST, | ||
11 | ALC861_3ST_DIG, | ||
12 | ALC861_6ST_DIG, | ||
13 | ALC861_UNIWILL_M31, | ||
14 | ALC861_TOSHIBA, | ||
15 | ALC861_ASUS, | ||
16 | ALC861_ASUS_LAPTOP, | ||
17 | ALC861_MODEL_LAST, | ||
18 | }; | ||
19 | |||
20 | /* | ||
21 | * ALC861 channel source setting (2/6 channel selection for 3-stack) | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * set the path ways for 2 channel output | ||
26 | * need to set the codec line out and mic 1 pin widgets to inputs | ||
27 | */ | ||
28 | static const struct hda_verb alc861_threestack_ch2_init[] = { | ||
29 | /* set pin widget 1Ah (line in) for input */ | ||
30 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | ||
31 | /* set pin widget 18h (mic1/2) for input, for mic also enable | ||
32 | * the vref | ||
33 | */ | ||
34 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
35 | |||
36 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, | ||
37 | #if 0 | ||
38 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | ||
39 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ | ||
40 | #endif | ||
41 | { } /* end */ | ||
42 | }; | ||
43 | /* | ||
44 | * 6ch mode | ||
45 | * need to set the codec line out and mic 1 pin widgets to outputs | ||
46 | */ | ||
47 | static const struct hda_verb alc861_threestack_ch6_init[] = { | ||
48 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ | ||
49 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
50 | /* set pin widget 18h (mic1) for output (CLFE)*/ | ||
51 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
52 | |||
53 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
54 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
55 | |||
56 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, | ||
57 | #if 0 | ||
58 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | ||
59 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ | ||
60 | #endif | ||
61 | { } /* end */ | ||
62 | }; | ||
63 | |||
64 | static const struct hda_channel_mode alc861_threestack_modes[2] = { | ||
65 | { 2, alc861_threestack_ch2_init }, | ||
66 | { 6, alc861_threestack_ch6_init }, | ||
67 | }; | ||
68 | /* Set mic1 as input and unmute the mixer */ | ||
69 | static const struct hda_verb alc861_uniwill_m31_ch2_init[] = { | ||
70 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
71 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | ||
72 | { } /* end */ | ||
73 | }; | ||
74 | /* Set mic1 as output and mute mixer */ | ||
75 | static const struct hda_verb alc861_uniwill_m31_ch4_init[] = { | ||
76 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
77 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | ||
78 | { } /* end */ | ||
79 | }; | ||
80 | |||
81 | static const struct hda_channel_mode alc861_uniwill_m31_modes[2] = { | ||
82 | { 2, alc861_uniwill_m31_ch2_init }, | ||
83 | { 4, alc861_uniwill_m31_ch4_init }, | ||
84 | }; | ||
85 | |||
86 | /* Set mic1 and line-in as input and unmute the mixer */ | ||
87 | static const struct hda_verb alc861_asus_ch2_init[] = { | ||
88 | /* set pin widget 1Ah (line in) for input */ | ||
89 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | ||
90 | /* set pin widget 18h (mic1/2) for input, for mic also enable | ||
91 | * the vref | ||
92 | */ | ||
93 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
94 | |||
95 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, | ||
96 | #if 0 | ||
97 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | ||
98 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ | ||
99 | #endif | ||
100 | { } /* end */ | ||
101 | }; | ||
102 | /* Set mic1 nad line-in as output and mute mixer */ | ||
103 | static const struct hda_verb alc861_asus_ch6_init[] = { | ||
104 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ | ||
105 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
106 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ | ||
107 | /* set pin widget 18h (mic1) for output (CLFE)*/ | ||
108 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
109 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ | ||
110 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
111 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
112 | |||
113 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, | ||
114 | #if 0 | ||
115 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | ||
116 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ | ||
117 | #endif | ||
118 | { } /* end */ | ||
119 | }; | ||
120 | |||
121 | static const struct hda_channel_mode alc861_asus_modes[2] = { | ||
122 | { 2, alc861_asus_ch2_init }, | ||
123 | { 6, alc861_asus_ch6_init }, | ||
124 | }; | ||
125 | |||
126 | /* patch-ALC861 */ | ||
127 | |||
128 | static const struct snd_kcontrol_new alc861_base_mixer[] = { | ||
129 | /* output mixer control */ | ||
130 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | ||
131 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | ||
132 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | ||
133 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | ||
134 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), | ||
135 | |||
136 | /*Input mixer control */ | ||
137 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | ||
138 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | ||
139 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | ||
140 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | ||
141 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | ||
142 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | ||
143 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | ||
144 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | ||
145 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | ||
146 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | ||
147 | |||
148 | { } /* end */ | ||
149 | }; | ||
150 | |||
151 | static const struct snd_kcontrol_new alc861_3ST_mixer[] = { | ||
152 | /* output mixer control */ | ||
153 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | ||
154 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | ||
155 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | ||
156 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | ||
157 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ | ||
158 | |||
159 | /* Input mixer control */ | ||
160 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | ||
161 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | ||
162 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | ||
163 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | ||
164 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | ||
165 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | ||
166 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | ||
167 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | ||
168 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | ||
169 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | ||
170 | |||
171 | { | ||
172 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
173 | .name = "Channel Mode", | ||
174 | .info = alc_ch_mode_info, | ||
175 | .get = alc_ch_mode_get, | ||
176 | .put = alc_ch_mode_put, | ||
177 | .private_value = ARRAY_SIZE(alc861_threestack_modes), | ||
178 | }, | ||
179 | { } /* end */ | ||
180 | }; | ||
181 | |||
182 | static const struct snd_kcontrol_new alc861_toshiba_mixer[] = { | ||
183 | /* output mixer control */ | ||
184 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), | ||
185 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | ||
186 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | ||
187 | |||
188 | { } /* end */ | ||
189 | }; | ||
190 | |||
191 | static const struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { | ||
192 | /* output mixer control */ | ||
193 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | ||
194 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | ||
195 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | ||
196 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | ||
197 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ | ||
198 | |||
199 | /* Input mixer control */ | ||
200 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | ||
201 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | ||
202 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | ||
203 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | ||
204 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | ||
205 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | ||
206 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | ||
207 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | ||
208 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | ||
209 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | ||
210 | |||
211 | { | ||
212 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
213 | .name = "Channel Mode", | ||
214 | .info = alc_ch_mode_info, | ||
215 | .get = alc_ch_mode_get, | ||
216 | .put = alc_ch_mode_put, | ||
217 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), | ||
218 | }, | ||
219 | { } /* end */ | ||
220 | }; | ||
221 | |||
222 | static const struct snd_kcontrol_new alc861_asus_mixer[] = { | ||
223 | /* output mixer control */ | ||
224 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | ||
225 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | ||
226 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | ||
227 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | ||
228 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), | ||
229 | |||
230 | /* Input mixer control */ | ||
231 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | ||
232 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
233 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | ||
234 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | ||
235 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | ||
236 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | ||
237 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | ||
238 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | ||
239 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | ||
240 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), | ||
241 | |||
242 | { | ||
243 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
244 | .name = "Channel Mode", | ||
245 | .info = alc_ch_mode_info, | ||
246 | .get = alc_ch_mode_get, | ||
247 | .put = alc_ch_mode_put, | ||
248 | .private_value = ARRAY_SIZE(alc861_asus_modes), | ||
249 | }, | ||
250 | { } | ||
251 | }; | ||
252 | |||
253 | /* additional mixer */ | ||
254 | static const struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { | ||
255 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | ||
256 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | ||
257 | { } | ||
258 | }; | ||
259 | |||
260 | /* | ||
261 | * generic initialization of ADC, input mixers and output mixers | ||
262 | */ | ||
263 | static const struct hda_verb alc861_base_init_verbs[] = { | ||
264 | /* | ||
265 | * Unmute ADC0 and set the default input to mic-in | ||
266 | */ | ||
267 | /* port-A for surround (rear panel) */ | ||
268 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
269 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
270 | /* port-B for mic-in (rear panel) with vref */ | ||
271 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
272 | /* port-C for line-in (rear panel) */ | ||
273 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | ||
274 | /* port-D for Front */ | ||
275 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
276 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
277 | /* port-E for HP out (front panel) */ | ||
278 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, | ||
279 | /* route front PCM to HP */ | ||
280 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
281 | /* port-F for mic-in (front panel) with vref */ | ||
282 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
283 | /* port-G for CLFE (rear panel) */ | ||
284 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
285 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
286 | /* port-H for side (rear panel) */ | ||
287 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
288 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
289 | /* CD-in */ | ||
290 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | ||
291 | /* route front mic to ADC1*/ | ||
292 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
293 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
294 | |||
295 | /* Unmute DAC0~3 & spdif out*/ | ||
296 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
297 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
298 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
299 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
300 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
301 | |||
302 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | ||
303 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
304 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
305 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
306 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
307 | |||
308 | /* Unmute Stereo Mixer 15 */ | ||
309 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
310 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
311 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
312 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ | ||
313 | |||
314 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
315 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
316 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
317 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
318 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
319 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
320 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
321 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
322 | /* hp used DAC 3 (Front) */ | ||
323 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | ||
324 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
325 | |||
326 | { } | ||
327 | }; | ||
328 | |||
329 | static const struct hda_verb alc861_threestack_init_verbs[] = { | ||
330 | /* | ||
331 | * Unmute ADC0 and set the default input to mic-in | ||
332 | */ | ||
333 | /* port-A for surround (rear panel) */ | ||
334 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
335 | /* port-B for mic-in (rear panel) with vref */ | ||
336 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
337 | /* port-C for line-in (rear panel) */ | ||
338 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | ||
339 | /* port-D for Front */ | ||
340 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
341 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
342 | /* port-E for HP out (front panel) */ | ||
343 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, | ||
344 | /* route front PCM to HP */ | ||
345 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
346 | /* port-F for mic-in (front panel) with vref */ | ||
347 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
348 | /* port-G for CLFE (rear panel) */ | ||
349 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
350 | /* port-H for side (rear panel) */ | ||
351 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
352 | /* CD-in */ | ||
353 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | ||
354 | /* route front mic to ADC1*/ | ||
355 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
356 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
357 | /* Unmute DAC0~3 & spdif out*/ | ||
358 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
359 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
360 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
361 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
362 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
363 | |||
364 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | ||
365 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
366 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
367 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
368 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
369 | |||
370 | /* Unmute Stereo Mixer 15 */ | ||
371 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
372 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
373 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
374 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ | ||
375 | |||
376 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
377 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
378 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
379 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
380 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
381 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
382 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
383 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
384 | /* hp used DAC 3 (Front) */ | ||
385 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | ||
386 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
387 | { } | ||
388 | }; | ||
389 | |||
390 | static const struct hda_verb alc861_uniwill_m31_init_verbs[] = { | ||
391 | /* | ||
392 | * Unmute ADC0 and set the default input to mic-in | ||
393 | */ | ||
394 | /* port-A for surround (rear panel) */ | ||
395 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
396 | /* port-B for mic-in (rear panel) with vref */ | ||
397 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
398 | /* port-C for line-in (rear panel) */ | ||
399 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | ||
400 | /* port-D for Front */ | ||
401 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
402 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
403 | /* port-E for HP out (front panel) */ | ||
404 | /* this has to be set to VREF80 */ | ||
405 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
406 | /* route front PCM to HP */ | ||
407 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
408 | /* port-F for mic-in (front panel) with vref */ | ||
409 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
410 | /* port-G for CLFE (rear panel) */ | ||
411 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
412 | /* port-H for side (rear panel) */ | ||
413 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
414 | /* CD-in */ | ||
415 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | ||
416 | /* route front mic to ADC1*/ | ||
417 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
418 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
419 | /* Unmute DAC0~3 & spdif out*/ | ||
420 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
421 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
422 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
423 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
424 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
425 | |||
426 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | ||
427 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
428 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
429 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
430 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
431 | |||
432 | /* Unmute Stereo Mixer 15 */ | ||
433 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
434 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
435 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
436 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ | ||
437 | |||
438 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
439 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
440 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
441 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
442 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
443 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
444 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
445 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
446 | /* hp used DAC 3 (Front) */ | ||
447 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | ||
448 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
449 | { } | ||
450 | }; | ||
451 | |||
452 | static const struct hda_verb alc861_asus_init_verbs[] = { | ||
453 | /* | ||
454 | * Unmute ADC0 and set the default input to mic-in | ||
455 | */ | ||
456 | /* port-A for surround (rear panel) | ||
457 | * according to codec#0 this is the HP jack | ||
458 | */ | ||
459 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ | ||
460 | /* route front PCM to HP */ | ||
461 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
462 | /* port-B for mic-in (rear panel) with vref */ | ||
463 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
464 | /* port-C for line-in (rear panel) */ | ||
465 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | ||
466 | /* port-D for Front */ | ||
467 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
468 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
469 | /* port-E for HP out (front panel) */ | ||
470 | /* this has to be set to VREF80 */ | ||
471 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
472 | /* route front PCM to HP */ | ||
473 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
474 | /* port-F for mic-in (front panel) with vref */ | ||
475 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
476 | /* port-G for CLFE (rear panel) */ | ||
477 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
478 | /* port-H for side (rear panel) */ | ||
479 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
480 | /* CD-in */ | ||
481 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | ||
482 | /* route front mic to ADC1*/ | ||
483 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
484 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
485 | /* Unmute DAC0~3 & spdif out*/ | ||
486 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
487 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
488 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
489 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
490 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
491 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | ||
492 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
493 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
494 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
495 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
496 | |||
497 | /* Unmute Stereo Mixer 15 */ | ||
498 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
499 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
500 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
501 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ | ||
502 | |||
503 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
504 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
505 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
506 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
507 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
508 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
509 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
510 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
511 | /* hp used DAC 3 (Front) */ | ||
512 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | ||
513 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
514 | { } | ||
515 | }; | ||
516 | |||
517 | /* additional init verbs for ASUS laptops */ | ||
518 | static const struct hda_verb alc861_asus_laptop_init_verbs[] = { | ||
519 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ | ||
520 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ | ||
521 | { } | ||
522 | }; | ||
523 | |||
524 | static const struct hda_verb alc861_toshiba_init_verbs[] = { | ||
525 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
526 | |||
527 | { } | ||
528 | }; | ||
529 | |||
530 | /* toggle speaker-output according to the hp-jack state */ | ||
531 | static void alc861_toshiba_automute(struct hda_codec *codec) | ||
532 | { | ||
533 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); | ||
534 | |||
535 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, | ||
536 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | ||
537 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, | ||
538 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); | ||
539 | } | ||
540 | |||
541 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, | ||
542 | unsigned int res) | ||
543 | { | ||
544 | if ((res >> 26) == ALC_HP_EVENT) | ||
545 | alc861_toshiba_automute(codec); | ||
546 | } | ||
547 | |||
548 | #define ALC861_DIGOUT_NID 0x07 | ||
549 | |||
550 | static const struct hda_channel_mode alc861_8ch_modes[1] = { | ||
551 | { 8, NULL } | ||
552 | }; | ||
553 | |||
554 | static const hda_nid_t alc861_dac_nids[4] = { | ||
555 | /* front, surround, clfe, side */ | ||
556 | 0x03, 0x06, 0x05, 0x04 | ||
557 | }; | ||
558 | |||
559 | static const hda_nid_t alc660_dac_nids[3] = { | ||
560 | /* front, clfe, surround */ | ||
561 | 0x03, 0x05, 0x06 | ||
562 | }; | ||
563 | |||
564 | static const hda_nid_t alc861_adc_nids[1] = { | ||
565 | /* ADC0-2 */ | ||
566 | 0x08, | ||
567 | }; | ||
568 | |||
569 | static const struct hda_input_mux alc861_capture_source = { | ||
570 | .num_items = 5, | ||
571 | .items = { | ||
572 | { "Mic", 0x0 }, | ||
573 | { "Front Mic", 0x3 }, | ||
574 | { "Line", 0x1 }, | ||
575 | { "CD", 0x4 }, | ||
576 | { "Mixer", 0x5 }, | ||
577 | }, | ||
578 | }; | ||
579 | |||
580 | /* | ||
581 | * configuration and preset | ||
582 | */ | ||
583 | static const char * const alc861_models[ALC861_MODEL_LAST] = { | ||
584 | [ALC861_3ST] = "3stack", | ||
585 | [ALC660_3ST] = "3stack-660", | ||
586 | [ALC861_3ST_DIG] = "3stack-dig", | ||
587 | [ALC861_6ST_DIG] = "6stack-dig", | ||
588 | [ALC861_UNIWILL_M31] = "uniwill-m31", | ||
589 | [ALC861_TOSHIBA] = "toshiba", | ||
590 | [ALC861_ASUS] = "asus", | ||
591 | [ALC861_ASUS_LAPTOP] = "asus-laptop", | ||
592 | [ALC861_AUTO] = "auto", | ||
593 | }; | ||
594 | |||
595 | static const struct snd_pci_quirk alc861_cfg_tbl[] = { | ||
596 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), | ||
597 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), | ||
598 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), | ||
599 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), | ||
600 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), | ||
601 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), | ||
602 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), | ||
603 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) | ||
604 | * Any other models that need this preset? | ||
605 | */ | ||
606 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ | ||
607 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), | ||
608 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), | ||
609 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), | ||
610 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), | ||
611 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), | ||
612 | /* FIXME: the below seems conflict */ | ||
613 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ | ||
614 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), | ||
615 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), | ||
616 | {} | ||
617 | }; | ||
618 | |||
619 | static const struct alc_config_preset alc861_presets[] = { | ||
620 | [ALC861_3ST] = { | ||
621 | .mixers = { alc861_3ST_mixer }, | ||
622 | .init_verbs = { alc861_threestack_init_verbs }, | ||
623 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | ||
624 | .dac_nids = alc861_dac_nids, | ||
625 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | ||
626 | .channel_mode = alc861_threestack_modes, | ||
627 | .need_dac_fix = 1, | ||
628 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | ||
629 | .adc_nids = alc861_adc_nids, | ||
630 | .input_mux = &alc861_capture_source, | ||
631 | }, | ||
632 | [ALC861_3ST_DIG] = { | ||
633 | .mixers = { alc861_base_mixer }, | ||
634 | .init_verbs = { alc861_threestack_init_verbs }, | ||
635 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | ||
636 | .dac_nids = alc861_dac_nids, | ||
637 | .dig_out_nid = ALC861_DIGOUT_NID, | ||
638 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | ||
639 | .channel_mode = alc861_threestack_modes, | ||
640 | .need_dac_fix = 1, | ||
641 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | ||
642 | .adc_nids = alc861_adc_nids, | ||
643 | .input_mux = &alc861_capture_source, | ||
644 | }, | ||
645 | [ALC861_6ST_DIG] = { | ||
646 | .mixers = { alc861_base_mixer }, | ||
647 | .init_verbs = { alc861_base_init_verbs }, | ||
648 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | ||
649 | .dac_nids = alc861_dac_nids, | ||
650 | .dig_out_nid = ALC861_DIGOUT_NID, | ||
651 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), | ||
652 | .channel_mode = alc861_8ch_modes, | ||
653 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | ||
654 | .adc_nids = alc861_adc_nids, | ||
655 | .input_mux = &alc861_capture_source, | ||
656 | }, | ||
657 | [ALC660_3ST] = { | ||
658 | .mixers = { alc861_3ST_mixer }, | ||
659 | .init_verbs = { alc861_threestack_init_verbs }, | ||
660 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), | ||
661 | .dac_nids = alc660_dac_nids, | ||
662 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | ||
663 | .channel_mode = alc861_threestack_modes, | ||
664 | .need_dac_fix = 1, | ||
665 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | ||
666 | .adc_nids = alc861_adc_nids, | ||
667 | .input_mux = &alc861_capture_source, | ||
668 | }, | ||
669 | [ALC861_UNIWILL_M31] = { | ||
670 | .mixers = { alc861_uniwill_m31_mixer }, | ||
671 | .init_verbs = { alc861_uniwill_m31_init_verbs }, | ||
672 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | ||
673 | .dac_nids = alc861_dac_nids, | ||
674 | .dig_out_nid = ALC861_DIGOUT_NID, | ||
675 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), | ||
676 | .channel_mode = alc861_uniwill_m31_modes, | ||
677 | .need_dac_fix = 1, | ||
678 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | ||
679 | .adc_nids = alc861_adc_nids, | ||
680 | .input_mux = &alc861_capture_source, | ||
681 | }, | ||
682 | [ALC861_TOSHIBA] = { | ||
683 | .mixers = { alc861_toshiba_mixer }, | ||
684 | .init_verbs = { alc861_base_init_verbs, | ||
685 | alc861_toshiba_init_verbs }, | ||
686 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | ||
687 | .dac_nids = alc861_dac_nids, | ||
688 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
689 | .channel_mode = alc883_3ST_2ch_modes, | ||
690 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | ||
691 | .adc_nids = alc861_adc_nids, | ||
692 | .input_mux = &alc861_capture_source, | ||
693 | .unsol_event = alc861_toshiba_unsol_event, | ||
694 | .init_hook = alc861_toshiba_automute, | ||
695 | }, | ||
696 | [ALC861_ASUS] = { | ||
697 | .mixers = { alc861_asus_mixer }, | ||
698 | .init_verbs = { alc861_asus_init_verbs }, | ||
699 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | ||
700 | .dac_nids = alc861_dac_nids, | ||
701 | .dig_out_nid = ALC861_DIGOUT_NID, | ||
702 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), | ||
703 | .channel_mode = alc861_asus_modes, | ||
704 | .need_dac_fix = 1, | ||
705 | .hp_nid = 0x06, | ||
706 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | ||
707 | .adc_nids = alc861_adc_nids, | ||
708 | .input_mux = &alc861_capture_source, | ||
709 | }, | ||
710 | [ALC861_ASUS_LAPTOP] = { | ||
711 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, | ||
712 | .init_verbs = { alc861_asus_init_verbs, | ||
713 | alc861_asus_laptop_init_verbs }, | ||
714 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | ||
715 | .dac_nids = alc861_dac_nids, | ||
716 | .dig_out_nid = ALC861_DIGOUT_NID, | ||
717 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
718 | .channel_mode = alc883_3ST_2ch_modes, | ||
719 | .need_dac_fix = 1, | ||
720 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | ||
721 | .adc_nids = alc861_adc_nids, | ||
722 | .input_mux = &alc861_capture_source, | ||
723 | }, | ||
724 | }; | ||
725 | |||
diff --git a/sound/pci/hda/alc861vd_quirks.c b/sound/pci/hda/alc861vd_quirks.c deleted file mode 100644 index 8f28450f41f..00000000000 --- a/sound/pci/hda/alc861vd_quirks.c +++ /dev/null | |||
@@ -1,605 +0,0 @@ | |||
1 | /* | ||
2 | * ALC660-VD/ALC861-VD quirk models | ||
3 | * included by patch_realtek.c | ||
4 | */ | ||
5 | |||
6 | /* ALC861-VD models */ | ||
7 | enum { | ||
8 | ALC861VD_AUTO, | ||
9 | ALC660VD_3ST, | ||
10 | ALC660VD_3ST_DIG, | ||
11 | ALC660VD_ASUS_V1S, | ||
12 | ALC861VD_3ST, | ||
13 | ALC861VD_3ST_DIG, | ||
14 | ALC861VD_6ST_DIG, | ||
15 | ALC861VD_LENOVO, | ||
16 | ALC861VD_DALLAS, | ||
17 | ALC861VD_HP, | ||
18 | ALC861VD_MODEL_LAST, | ||
19 | }; | ||
20 | |||
21 | #define ALC861VD_DIGOUT_NID 0x06 | ||
22 | |||
23 | static const hda_nid_t alc861vd_dac_nids[4] = { | ||
24 | /* front, surr, clfe, side surr */ | ||
25 | 0x02, 0x03, 0x04, 0x05 | ||
26 | }; | ||
27 | |||
28 | /* dac_nids for ALC660vd are in a different order - according to | ||
29 | * Realtek's driver. | ||
30 | * This should probably result in a different mixer for 6stack models | ||
31 | * of ALC660vd codecs, but for now there is only 3stack mixer | ||
32 | * - and it is the same as in 861vd. | ||
33 | * adc_nids in ALC660vd are (is) the same as in 861vd | ||
34 | */ | ||
35 | static const hda_nid_t alc660vd_dac_nids[3] = { | ||
36 | /* front, rear, clfe, rear_surr */ | ||
37 | 0x02, 0x04, 0x03 | ||
38 | }; | ||
39 | |||
40 | static const hda_nid_t alc861vd_adc_nids[1] = { | ||
41 | /* ADC0 */ | ||
42 | 0x09, | ||
43 | }; | ||
44 | |||
45 | static const hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; | ||
46 | |||
47 | /* input MUX */ | ||
48 | /* FIXME: should be a matrix-type input source selection */ | ||
49 | static const struct hda_input_mux alc861vd_capture_source = { | ||
50 | .num_items = 4, | ||
51 | .items = { | ||
52 | { "Mic", 0x0 }, | ||
53 | { "Front Mic", 0x1 }, | ||
54 | { "Line", 0x2 }, | ||
55 | { "CD", 0x4 }, | ||
56 | }, | ||
57 | }; | ||
58 | |||
59 | static const struct hda_input_mux alc861vd_dallas_capture_source = { | ||
60 | .num_items = 2, | ||
61 | .items = { | ||
62 | { "Mic", 0x0 }, | ||
63 | { "Internal Mic", 0x1 }, | ||
64 | }, | ||
65 | }; | ||
66 | |||
67 | static const struct hda_input_mux alc861vd_hp_capture_source = { | ||
68 | .num_items = 2, | ||
69 | .items = { | ||
70 | { "Front Mic", 0x0 }, | ||
71 | { "ATAPI Mic", 0x1 }, | ||
72 | }, | ||
73 | }; | ||
74 | |||
75 | /* | ||
76 | * 2ch mode | ||
77 | */ | ||
78 | static const struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { | ||
79 | { 2, NULL } | ||
80 | }; | ||
81 | |||
82 | /* | ||
83 | * 6ch mode | ||
84 | */ | ||
85 | static const struct hda_verb alc861vd_6stack_ch6_init[] = { | ||
86 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
87 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
88 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
89 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
90 | { } /* end */ | ||
91 | }; | ||
92 | |||
93 | /* | ||
94 | * 8ch mode | ||
95 | */ | ||
96 | static const struct hda_verb alc861vd_6stack_ch8_init[] = { | ||
97 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
98 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
99 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
100 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
101 | { } /* end */ | ||
102 | }; | ||
103 | |||
104 | static const struct hda_channel_mode alc861vd_6stack_modes[2] = { | ||
105 | { 6, alc861vd_6stack_ch6_init }, | ||
106 | { 8, alc861vd_6stack_ch8_init }, | ||
107 | }; | ||
108 | |||
109 | static const struct snd_kcontrol_new alc861vd_chmode_mixer[] = { | ||
110 | { | ||
111 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
112 | .name = "Channel Mode", | ||
113 | .info = alc_ch_mode_info, | ||
114 | .get = alc_ch_mode_get, | ||
115 | .put = alc_ch_mode_put, | ||
116 | }, | ||
117 | { } /* end */ | ||
118 | }; | ||
119 | |||
120 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | ||
121 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | ||
122 | */ | ||
123 | static const struct snd_kcontrol_new alc861vd_6st_mixer[] = { | ||
124 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
125 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
126 | |||
127 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
128 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
129 | |||
130 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, | ||
131 | HDA_OUTPUT), | ||
132 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, | ||
133 | HDA_OUTPUT), | ||
134 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
135 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
136 | |||
137 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), | ||
138 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | ||
139 | |||
140 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
141 | |||
142 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
143 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
144 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
145 | |||
146 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
147 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
148 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
149 | |||
150 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
151 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
152 | |||
153 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
154 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
155 | |||
156 | { } /* end */ | ||
157 | }; | ||
158 | |||
159 | static const struct snd_kcontrol_new alc861vd_3st_mixer[] = { | ||
160 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
161 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
162 | |||
163 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
164 | |||
165 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
166 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
167 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
168 | |||
169 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
170 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
171 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
172 | |||
173 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
174 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
175 | |||
176 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
177 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
178 | |||
179 | { } /* end */ | ||
180 | }; | ||
181 | |||
182 | static const struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { | ||
183 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
184 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ | ||
185 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
186 | |||
187 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
188 | |||
189 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
190 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
191 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
192 | |||
193 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
194 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
195 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
196 | |||
197 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
198 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
199 | |||
200 | { } /* end */ | ||
201 | }; | ||
202 | |||
203 | /* Pin assignment: Speaker=0x14, HP = 0x15, | ||
204 | * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d | ||
205 | */ | ||
206 | static const struct snd_kcontrol_new alc861vd_dallas_mixer[] = { | ||
207 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
208 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), | ||
209 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
210 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | ||
211 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | ||
212 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
213 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
214 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
215 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
216 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
217 | { } /* end */ | ||
218 | }; | ||
219 | |||
220 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, | ||
221 | * Front Mic=0x18, ATAPI Mic = 0x19, | ||
222 | */ | ||
223 | static const struct snd_kcontrol_new alc861vd_hp_mixer[] = { | ||
224 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
225 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
226 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
227 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | ||
228 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
229 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
230 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
231 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
232 | |||
233 | { } /* end */ | ||
234 | }; | ||
235 | |||
236 | /* | ||
237 | * generic initialization of ADC, input mixers and output mixers | ||
238 | */ | ||
239 | static const struct hda_verb alc861vd_volume_init_verbs[] = { | ||
240 | /* | ||
241 | * Unmute ADC0 and set the default input to mic-in | ||
242 | */ | ||
243 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
244 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
245 | |||
246 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of | ||
247 | * the analog-loopback mixer widget | ||
248 | */ | ||
249 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | ||
250 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
251 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
252 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
253 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
254 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
255 | |||
256 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ | ||
257 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
258 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
259 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
260 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | ||
261 | |||
262 | /* | ||
263 | * Set up output mixers (0x02 - 0x05) | ||
264 | */ | ||
265 | /* set vol=0 to output mixers */ | ||
266 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
267 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
268 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
269 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
270 | |||
271 | /* set up input amps for analog loopback */ | ||
272 | /* Amp Indices: DAC = 0, mixer = 1 */ | ||
273 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
274 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
275 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
276 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
277 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
278 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
279 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
280 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
281 | |||
282 | { } | ||
283 | }; | ||
284 | |||
285 | /* | ||
286 | * 3-stack pin configuration: | ||
287 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b | ||
288 | */ | ||
289 | static const struct hda_verb alc861vd_3stack_init_verbs[] = { | ||
290 | /* | ||
291 | * Set pin mode and muting | ||
292 | */ | ||
293 | /* set front pin widgets 0x14 for output */ | ||
294 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
295 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
296 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
297 | |||
298 | /* Mic (rear) pin: input vref at 80% */ | ||
299 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
300 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
301 | /* Front Mic pin: input vref at 80% */ | ||
302 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
303 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
304 | /* Line In pin: input */ | ||
305 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
306 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
307 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | ||
308 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
309 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
310 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
311 | /* CD pin widget for input */ | ||
312 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
313 | |||
314 | { } | ||
315 | }; | ||
316 | |||
317 | /* | ||
318 | * 6-stack pin configuration: | ||
319 | */ | ||
320 | static const struct hda_verb alc861vd_6stack_init_verbs[] = { | ||
321 | /* | ||
322 | * Set pin mode and muting | ||
323 | */ | ||
324 | /* set front pin widgets 0x14 for output */ | ||
325 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
326 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
327 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
328 | |||
329 | /* Rear Pin: output 1 (0x0d) */ | ||
330 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
331 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
332 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
333 | /* CLFE Pin: output 2 (0x0e) */ | ||
334 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
335 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
336 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
337 | /* Side Pin: output 3 (0x0f) */ | ||
338 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
339 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
340 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | ||
341 | |||
342 | /* Mic (rear) pin: input vref at 80% */ | ||
343 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
344 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
345 | /* Front Mic pin: input vref at 80% */ | ||
346 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
347 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
348 | /* Line In pin: input */ | ||
349 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
350 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
351 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | ||
352 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
353 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
354 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
355 | /* CD pin widget for input */ | ||
356 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
357 | |||
358 | { } | ||
359 | }; | ||
360 | |||
361 | static const struct hda_verb alc861vd_eapd_verbs[] = { | ||
362 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
363 | { } | ||
364 | }; | ||
365 | |||
366 | static const struct hda_verb alc861vd_lenovo_unsol_verbs[] = { | ||
367 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
368 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
369 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | ||
370 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
371 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT}, | ||
372 | {} | ||
373 | }; | ||
374 | |||
375 | static void alc861vd_lenovo_setup(struct hda_codec *codec) | ||
376 | { | ||
377 | struct alc_spec *spec = codec->spec; | ||
378 | spec->autocfg.hp_pins[0] = 0x1b; | ||
379 | spec->autocfg.speaker_pins[0] = 0x14; | ||
380 | spec->automute = 1; | ||
381 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
382 | } | ||
383 | |||
384 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) | ||
385 | { | ||
386 | alc_hp_automute(codec); | ||
387 | alc88x_simple_mic_automute(codec); | ||
388 | } | ||
389 | |||
390 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, | ||
391 | unsigned int res) | ||
392 | { | ||
393 | switch (res >> 26) { | ||
394 | case ALC_MIC_EVENT: | ||
395 | alc88x_simple_mic_automute(codec); | ||
396 | break; | ||
397 | default: | ||
398 | alc_sku_unsol_event(codec, res); | ||
399 | break; | ||
400 | } | ||
401 | } | ||
402 | |||
403 | static const struct hda_verb alc861vd_dallas_verbs[] = { | ||
404 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
405 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
406 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
407 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
408 | |||
409 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
410 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
411 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
412 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
413 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
414 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
415 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
416 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
417 | |||
418 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
419 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
420 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
421 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
422 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
423 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
424 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
425 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
426 | |||
427 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | ||
428 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
429 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | ||
430 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
431 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
432 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
433 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
434 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
435 | |||
436 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
437 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
438 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
439 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
440 | |||
441 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
442 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
443 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
444 | |||
445 | { } /* end */ | ||
446 | }; | ||
447 | |||
448 | /* toggle speaker-output according to the hp-jack state */ | ||
449 | static void alc861vd_dallas_setup(struct hda_codec *codec) | ||
450 | { | ||
451 | struct alc_spec *spec = codec->spec; | ||
452 | |||
453 | spec->autocfg.hp_pins[0] = 0x15; | ||
454 | spec->autocfg.speaker_pins[0] = 0x14; | ||
455 | spec->automute = 1; | ||
456 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
457 | } | ||
458 | |||
459 | /* | ||
460 | * configuration and preset | ||
461 | */ | ||
462 | static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = { | ||
463 | [ALC660VD_3ST] = "3stack-660", | ||
464 | [ALC660VD_3ST_DIG] = "3stack-660-digout", | ||
465 | [ALC660VD_ASUS_V1S] = "asus-v1s", | ||
466 | [ALC861VD_3ST] = "3stack", | ||
467 | [ALC861VD_3ST_DIG] = "3stack-digout", | ||
468 | [ALC861VD_6ST_DIG] = "6stack-digout", | ||
469 | [ALC861VD_LENOVO] = "lenovo", | ||
470 | [ALC861VD_DALLAS] = "dallas", | ||
471 | [ALC861VD_HP] = "hp", | ||
472 | [ALC861VD_AUTO] = "auto", | ||
473 | }; | ||
474 | |||
475 | static const struct snd_pci_quirk alc861vd_cfg_tbl[] = { | ||
476 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), | ||
477 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), | ||
478 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), | ||
479 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ | ||
480 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), | ||
481 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), | ||
482 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), | ||
483 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), | ||
484 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ | ||
485 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), | ||
486 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), | ||
487 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), | ||
488 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), | ||
489 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), | ||
490 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), | ||
491 | {} | ||
492 | }; | ||
493 | |||
494 | static const struct alc_config_preset alc861vd_presets[] = { | ||
495 | [ALC660VD_3ST] = { | ||
496 | .mixers = { alc861vd_3st_mixer }, | ||
497 | .init_verbs = { alc861vd_volume_init_verbs, | ||
498 | alc861vd_3stack_init_verbs }, | ||
499 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | ||
500 | .dac_nids = alc660vd_dac_nids, | ||
501 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | ||
502 | .channel_mode = alc861vd_3stack_2ch_modes, | ||
503 | .input_mux = &alc861vd_capture_source, | ||
504 | }, | ||
505 | [ALC660VD_3ST_DIG] = { | ||
506 | .mixers = { alc861vd_3st_mixer }, | ||
507 | .init_verbs = { alc861vd_volume_init_verbs, | ||
508 | alc861vd_3stack_init_verbs }, | ||
509 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | ||
510 | .dac_nids = alc660vd_dac_nids, | ||
511 | .dig_out_nid = ALC861VD_DIGOUT_NID, | ||
512 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | ||
513 | .channel_mode = alc861vd_3stack_2ch_modes, | ||
514 | .input_mux = &alc861vd_capture_source, | ||
515 | }, | ||
516 | [ALC861VD_3ST] = { | ||
517 | .mixers = { alc861vd_3st_mixer }, | ||
518 | .init_verbs = { alc861vd_volume_init_verbs, | ||
519 | alc861vd_3stack_init_verbs }, | ||
520 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | ||
521 | .dac_nids = alc861vd_dac_nids, | ||
522 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | ||
523 | .channel_mode = alc861vd_3stack_2ch_modes, | ||
524 | .input_mux = &alc861vd_capture_source, | ||
525 | }, | ||
526 | [ALC861VD_3ST_DIG] = { | ||
527 | .mixers = { alc861vd_3st_mixer }, | ||
528 | .init_verbs = { alc861vd_volume_init_verbs, | ||
529 | alc861vd_3stack_init_verbs }, | ||
530 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | ||
531 | .dac_nids = alc861vd_dac_nids, | ||
532 | .dig_out_nid = ALC861VD_DIGOUT_NID, | ||
533 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | ||
534 | .channel_mode = alc861vd_3stack_2ch_modes, | ||
535 | .input_mux = &alc861vd_capture_source, | ||
536 | }, | ||
537 | [ALC861VD_6ST_DIG] = { | ||
538 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, | ||
539 | .init_verbs = { alc861vd_volume_init_verbs, | ||
540 | alc861vd_6stack_init_verbs }, | ||
541 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | ||
542 | .dac_nids = alc861vd_dac_nids, | ||
543 | .dig_out_nid = ALC861VD_DIGOUT_NID, | ||
544 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), | ||
545 | .channel_mode = alc861vd_6stack_modes, | ||
546 | .input_mux = &alc861vd_capture_source, | ||
547 | }, | ||
548 | [ALC861VD_LENOVO] = { | ||
549 | .mixers = { alc861vd_lenovo_mixer }, | ||
550 | .init_verbs = { alc861vd_volume_init_verbs, | ||
551 | alc861vd_3stack_init_verbs, | ||
552 | alc861vd_eapd_verbs, | ||
553 | alc861vd_lenovo_unsol_verbs }, | ||
554 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | ||
555 | .dac_nids = alc660vd_dac_nids, | ||
556 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | ||
557 | .channel_mode = alc861vd_3stack_2ch_modes, | ||
558 | .input_mux = &alc861vd_capture_source, | ||
559 | .unsol_event = alc861vd_lenovo_unsol_event, | ||
560 | .setup = alc861vd_lenovo_setup, | ||
561 | .init_hook = alc861vd_lenovo_init_hook, | ||
562 | }, | ||
563 | [ALC861VD_DALLAS] = { | ||
564 | .mixers = { alc861vd_dallas_mixer }, | ||
565 | .init_verbs = { alc861vd_dallas_verbs }, | ||
566 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | ||
567 | .dac_nids = alc861vd_dac_nids, | ||
568 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | ||
569 | .channel_mode = alc861vd_3stack_2ch_modes, | ||
570 | .input_mux = &alc861vd_dallas_capture_source, | ||
571 | .unsol_event = alc_sku_unsol_event, | ||
572 | .setup = alc861vd_dallas_setup, | ||
573 | .init_hook = alc_hp_automute, | ||
574 | }, | ||
575 | [ALC861VD_HP] = { | ||
576 | .mixers = { alc861vd_hp_mixer }, | ||
577 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, | ||
578 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | ||
579 | .dac_nids = alc861vd_dac_nids, | ||
580 | .dig_out_nid = ALC861VD_DIGOUT_NID, | ||
581 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | ||
582 | .channel_mode = alc861vd_3stack_2ch_modes, | ||
583 | .input_mux = &alc861vd_hp_capture_source, | ||
584 | .unsol_event = alc_sku_unsol_event, | ||
585 | .setup = alc861vd_dallas_setup, | ||
586 | .init_hook = alc_hp_automute, | ||
587 | }, | ||
588 | [ALC660VD_ASUS_V1S] = { | ||
589 | .mixers = { alc861vd_lenovo_mixer }, | ||
590 | .init_verbs = { alc861vd_volume_init_verbs, | ||
591 | alc861vd_3stack_init_verbs, | ||
592 | alc861vd_eapd_verbs, | ||
593 | alc861vd_lenovo_unsol_verbs }, | ||
594 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | ||
595 | .dac_nids = alc660vd_dac_nids, | ||
596 | .dig_out_nid = ALC861VD_DIGOUT_NID, | ||
597 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | ||
598 | .channel_mode = alc861vd_3stack_2ch_modes, | ||
599 | .input_mux = &alc861vd_capture_source, | ||
600 | .unsol_event = alc861vd_lenovo_unsol_event, | ||
601 | .setup = alc861vd_lenovo_setup, | ||
602 | .init_hook = alc861vd_lenovo_init_hook, | ||
603 | }, | ||
604 | }; | ||
605 | |||
diff --git a/sound/pci/hda/alc880_quirks.c b/sound/pci/hda/alc880_quirks.c index c844d2b5998..bea22edcfd8 100644 --- a/sound/pci/hda/alc880_quirks.c +++ b/sound/pci/hda/alc880_quirks.c | |||
@@ -749,8 +749,7 @@ static void alc880_uniwill_setup(struct hda_codec *codec) | |||
749 | spec->autocfg.hp_pins[0] = 0x14; | 749 | spec->autocfg.hp_pins[0] = 0x14; |
750 | spec->autocfg.speaker_pins[0] = 0x15; | 750 | spec->autocfg.speaker_pins[0] = 0x15; |
751 | spec->autocfg.speaker_pins[0] = 0x16; | 751 | spec->autocfg.speaker_pins[0] = 0x16; |
752 | spec->automute = 1; | 752 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
753 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
754 | } | 753 | } |
755 | 754 | ||
756 | static void alc880_uniwill_init_hook(struct hda_codec *codec) | 755 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
@@ -781,8 +780,7 @@ static void alc880_uniwill_p53_setup(struct hda_codec *codec) | |||
781 | 780 | ||
782 | spec->autocfg.hp_pins[0] = 0x14; | 781 | spec->autocfg.hp_pins[0] = 0x14; |
783 | spec->autocfg.speaker_pins[0] = 0x15; | 782 | spec->autocfg.speaker_pins[0] = 0x15; |
784 | spec->automute = 1; | 783 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
785 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
786 | } | 784 | } |
787 | 785 | ||
788 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) | 786 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
@@ -1051,8 +1049,7 @@ static void alc880_lg_setup(struct hda_codec *codec) | |||
1051 | 1049 | ||
1052 | spec->autocfg.hp_pins[0] = 0x1b; | 1050 | spec->autocfg.hp_pins[0] = 0x1b; |
1053 | spec->autocfg.speaker_pins[0] = 0x17; | 1051 | spec->autocfg.speaker_pins[0] = 0x17; |
1054 | spec->automute = 1; | 1052 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
1055 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
1056 | } | 1053 | } |
1057 | 1054 | ||
1058 | /* | 1055 | /* |
@@ -1137,8 +1134,7 @@ static void alc880_lg_lw_setup(struct hda_codec *codec) | |||
1137 | 1134 | ||
1138 | spec->autocfg.hp_pins[0] = 0x1b; | 1135 | spec->autocfg.hp_pins[0] = 0x1b; |
1139 | spec->autocfg.speaker_pins[0] = 0x14; | 1136 | spec->autocfg.speaker_pins[0] = 0x14; |
1140 | spec->automute = 1; | 1137 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
1141 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
1142 | } | 1138 | } |
1143 | 1139 | ||
1144 | static const struct snd_kcontrol_new alc880_medion_rim_mixer[] = { | 1140 | static const struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
@@ -1188,7 +1184,7 @@ static void alc880_medion_rim_automute(struct hda_codec *codec) | |||
1188 | struct alc_spec *spec = codec->spec; | 1184 | struct alc_spec *spec = codec->spec; |
1189 | alc_hp_automute(codec); | 1185 | alc_hp_automute(codec); |
1190 | /* toggle EAPD */ | 1186 | /* toggle EAPD */ |
1191 | if (spec->jack_present) | 1187 | if (spec->hp_jack_present) |
1192 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); | 1188 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
1193 | else | 1189 | else |
1194 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); | 1190 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
@@ -1210,8 +1206,7 @@ static void alc880_medion_rim_setup(struct hda_codec *codec) | |||
1210 | 1206 | ||
1211 | spec->autocfg.hp_pins[0] = 0x14; | 1207 | spec->autocfg.hp_pins[0] = 0x14; |
1212 | spec->autocfg.speaker_pins[0] = 0x1b; | 1208 | spec->autocfg.speaker_pins[0] = 0x1b; |
1213 | spec->automute = 1; | 1209 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
1214 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
1215 | } | 1210 | } |
1216 | 1211 | ||
1217 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 1212 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
diff --git a/sound/pci/hda/alc882_quirks.c b/sound/pci/hda/alc882_quirks.c index 617d04723b8..e251514a26a 100644 --- a/sound/pci/hda/alc882_quirks.c +++ b/sound/pci/hda/alc882_quirks.c | |||
@@ -173,8 +173,7 @@ static void alc889_automute_setup(struct hda_codec *codec) | |||
173 | spec->autocfg.speaker_pins[2] = 0x17; | 173 | spec->autocfg.speaker_pins[2] = 0x17; |
174 | spec->autocfg.speaker_pins[3] = 0x19; | 174 | spec->autocfg.speaker_pins[3] = 0x19; |
175 | spec->autocfg.speaker_pins[4] = 0x1a; | 175 | spec->autocfg.speaker_pins[4] = 0x1a; |
176 | spec->automute = 1; | 176 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
177 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
178 | } | 177 | } |
179 | 178 | ||
180 | static void alc889_intel_init_hook(struct hda_codec *codec) | 179 | static void alc889_intel_init_hook(struct hda_codec *codec) |
@@ -191,8 +190,7 @@ static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) | |||
191 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ | 190 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
192 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ | 191 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
193 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ | 192 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
194 | spec->automute = 1; | 193 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
195 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
196 | } | 194 | } |
197 | 195 | ||
198 | /* | 196 | /* |
@@ -475,8 +473,7 @@ static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) | |||
475 | spec->autocfg.speaker_pins[0] = 0x14; | 473 | spec->autocfg.speaker_pins[0] = 0x14; |
476 | spec->autocfg.speaker_pins[1] = 0x16; | 474 | spec->autocfg.speaker_pins[1] = 0x16; |
477 | spec->autocfg.speaker_pins[2] = 0x17; | 475 | spec->autocfg.speaker_pins[2] = 0x17; |
478 | spec->automute = 1; | 476 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
479 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
480 | } | 477 | } |
481 | 478 | ||
482 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) | 479 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
@@ -487,8 +484,7 @@ static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) | |||
487 | spec->autocfg.speaker_pins[0] = 0x14; | 484 | spec->autocfg.speaker_pins[0] = 0x14; |
488 | spec->autocfg.speaker_pins[1] = 0x16; | 485 | spec->autocfg.speaker_pins[1] = 0x16; |
489 | spec->autocfg.speaker_pins[2] = 0x17; | 486 | spec->autocfg.speaker_pins[2] = 0x17; |
490 | spec->automute = 1; | 487 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
491 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
492 | } | 488 | } |
493 | 489 | ||
494 | static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec) | 490 | static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec) |
@@ -499,8 +495,7 @@ static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec) | |||
499 | spec->autocfg.speaker_pins[0] = 0x14; | 495 | spec->autocfg.speaker_pins[0] = 0x14; |
500 | spec->autocfg.speaker_pins[1] = 0x16; | 496 | spec->autocfg.speaker_pins[1] = 0x16; |
501 | spec->autocfg.speaker_pins[2] = 0x17; | 497 | spec->autocfg.speaker_pins[2] = 0x17; |
502 | spec->automute = 1; | 498 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
503 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
504 | } | 499 | } |
505 | 500 | ||
506 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) | 501 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
@@ -511,8 +506,7 @@ static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) | |||
511 | spec->autocfg.speaker_pins[0] = 0x14; | 506 | spec->autocfg.speaker_pins[0] = 0x14; |
512 | spec->autocfg.speaker_pins[1] = 0x16; | 507 | spec->autocfg.speaker_pins[1] = 0x16; |
513 | spec->autocfg.speaker_pins[2] = 0x1b; | 508 | spec->autocfg.speaker_pins[2] = 0x1b; |
514 | spec->automute = 1; | 509 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
515 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
516 | } | 510 | } |
517 | 511 | ||
518 | #define ALC882_DIGOUT_NID 0x06 | 512 | #define ALC882_DIGOUT_NID 0x06 |
@@ -1711,8 +1705,7 @@ static void alc885_imac24_setup(struct hda_codec *codec) | |||
1711 | spec->autocfg.hp_pins[0] = 0x14; | 1705 | spec->autocfg.hp_pins[0] = 0x14; |
1712 | spec->autocfg.speaker_pins[0] = 0x18; | 1706 | spec->autocfg.speaker_pins[0] = 0x18; |
1713 | spec->autocfg.speaker_pins[1] = 0x1a; | 1707 | spec->autocfg.speaker_pins[1] = 0x1a; |
1714 | spec->automute = 1; | 1708 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
1715 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
1716 | } | 1709 | } |
1717 | 1710 | ||
1718 | #define alc885_mb5_setup alc885_imac24_setup | 1711 | #define alc885_mb5_setup alc885_imac24_setup |
@@ -1721,12 +1714,11 @@ static void alc885_imac24_setup(struct hda_codec *codec) | |||
1721 | /* Macbook Air 2,1 */ | 1714 | /* Macbook Air 2,1 */ |
1722 | static void alc885_mba21_setup(struct hda_codec *codec) | 1715 | static void alc885_mba21_setup(struct hda_codec *codec) |
1723 | { | 1716 | { |
1724 | struct alc_spec *spec = codec->spec; | 1717 | struct alc_spec *spec = codec->spec; |
1725 | 1718 | ||
1726 | spec->autocfg.hp_pins[0] = 0x14; | 1719 | spec->autocfg.hp_pins[0] = 0x14; |
1727 | spec->autocfg.speaker_pins[0] = 0x18; | 1720 | spec->autocfg.speaker_pins[0] = 0x18; |
1728 | spec->automute = 1; | 1721 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
1729 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
1730 | } | 1722 | } |
1731 | 1723 | ||
1732 | 1724 | ||
@@ -1737,8 +1729,7 @@ static void alc885_mbp3_setup(struct hda_codec *codec) | |||
1737 | 1729 | ||
1738 | spec->autocfg.hp_pins[0] = 0x15; | 1730 | spec->autocfg.hp_pins[0] = 0x15; |
1739 | spec->autocfg.speaker_pins[0] = 0x14; | 1731 | spec->autocfg.speaker_pins[0] = 0x14; |
1740 | spec->automute = 1; | 1732 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
1741 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
1742 | } | 1733 | } |
1743 | 1734 | ||
1744 | static void alc885_imac91_setup(struct hda_codec *codec) | 1735 | static void alc885_imac91_setup(struct hda_codec *codec) |
@@ -1748,8 +1739,7 @@ static void alc885_imac91_setup(struct hda_codec *codec) | |||
1748 | spec->autocfg.hp_pins[0] = 0x14; | 1739 | spec->autocfg.hp_pins[0] = 0x14; |
1749 | spec->autocfg.speaker_pins[0] = 0x18; | 1740 | spec->autocfg.speaker_pins[0] = 0x18; |
1750 | spec->autocfg.speaker_pins[1] = 0x1a; | 1741 | spec->autocfg.speaker_pins[1] = 0x1a; |
1751 | spec->automute = 1; | 1742 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
1752 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
1753 | } | 1743 | } |
1754 | 1744 | ||
1755 | static const struct hda_verb alc882_targa_verbs[] = { | 1745 | static const struct hda_verb alc882_targa_verbs[] = { |
@@ -1773,7 +1763,7 @@ static void alc882_targa_automute(struct hda_codec *codec) | |||
1773 | struct alc_spec *spec = codec->spec; | 1763 | struct alc_spec *spec = codec->spec; |
1774 | alc_hp_automute(codec); | 1764 | alc_hp_automute(codec); |
1775 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, | 1765 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
1776 | spec->jack_present ? 1 : 3); | 1766 | spec->hp_jack_present ? 1 : 3); |
1777 | } | 1767 | } |
1778 | 1768 | ||
1779 | static void alc882_targa_setup(struct hda_codec *codec) | 1769 | static void alc882_targa_setup(struct hda_codec *codec) |
@@ -1782,8 +1772,7 @@ static void alc882_targa_setup(struct hda_codec *codec) | |||
1782 | 1772 | ||
1783 | spec->autocfg.hp_pins[0] = 0x14; | 1773 | spec->autocfg.hp_pins[0] = 0x14; |
1784 | spec->autocfg.speaker_pins[0] = 0x1b; | 1774 | spec->autocfg.speaker_pins[0] = 0x1b; |
1785 | spec->automute = 1; | 1775 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
1786 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
1787 | } | 1776 | } |
1788 | 1777 | ||
1789 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) | 1778 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
@@ -2187,8 +2176,7 @@ static void alc883_medion_wim2160_setup(struct hda_codec *codec) | |||
2187 | 2176 | ||
2188 | spec->autocfg.hp_pins[0] = 0x1a; | 2177 | spec->autocfg.hp_pins[0] = 0x1a; |
2189 | spec->autocfg.speaker_pins[0] = 0x15; | 2178 | spec->autocfg.speaker_pins[0] = 0x15; |
2190 | spec->automute = 1; | 2179 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
2191 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
2192 | } | 2180 | } |
2193 | 2181 | ||
2194 | static const struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { | 2182 | static const struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
@@ -2341,8 +2329,7 @@ static void alc883_mitac_setup(struct hda_codec *codec) | |||
2341 | spec->autocfg.hp_pins[0] = 0x15; | 2329 | spec->autocfg.hp_pins[0] = 0x15; |
2342 | spec->autocfg.speaker_pins[0] = 0x14; | 2330 | spec->autocfg.speaker_pins[0] = 0x14; |
2343 | spec->autocfg.speaker_pins[1] = 0x17; | 2331 | spec->autocfg.speaker_pins[1] = 0x17; |
2344 | spec->automute = 1; | 2332 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
2345 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
2346 | } | 2333 | } |
2347 | 2334 | ||
2348 | static const struct hda_verb alc883_mitac_verbs[] = { | 2335 | static const struct hda_verb alc883_mitac_verbs[] = { |
@@ -2507,8 +2494,7 @@ static void alc888_3st_hp_setup(struct hda_codec *codec) | |||
2507 | spec->autocfg.speaker_pins[0] = 0x14; | 2494 | spec->autocfg.speaker_pins[0] = 0x14; |
2508 | spec->autocfg.speaker_pins[1] = 0x16; | 2495 | spec->autocfg.speaker_pins[1] = 0x16; |
2509 | spec->autocfg.speaker_pins[2] = 0x18; | 2496 | spec->autocfg.speaker_pins[2] = 0x18; |
2510 | spec->automute = 1; | 2497 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
2511 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
2512 | } | 2498 | } |
2513 | 2499 | ||
2514 | static const struct hda_verb alc888_3st_hp_verbs[] = { | 2500 | static const struct hda_verb alc888_3st_hp_verbs[] = { |
@@ -2568,8 +2554,7 @@ static void alc888_lenovo_ms7195_setup(struct hda_codec *codec) | |||
2568 | spec->autocfg.hp_pins[0] = 0x1b; | 2554 | spec->autocfg.hp_pins[0] = 0x1b; |
2569 | spec->autocfg.line_out_pins[0] = 0x14; | 2555 | spec->autocfg.line_out_pins[0] = 0x14; |
2570 | spec->autocfg.speaker_pins[0] = 0x15; | 2556 | spec->autocfg.speaker_pins[0] = 0x15; |
2571 | spec->automute = 1; | 2557 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
2572 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
2573 | } | 2558 | } |
2574 | 2559 | ||
2575 | /* toggle speaker-output according to the hp-jack state */ | 2560 | /* toggle speaker-output according to the hp-jack state */ |
@@ -2579,8 +2564,7 @@ static void alc883_lenovo_nb0763_setup(struct hda_codec *codec) | |||
2579 | 2564 | ||
2580 | spec->autocfg.hp_pins[0] = 0x14; | 2565 | spec->autocfg.hp_pins[0] = 0x14; |
2581 | spec->autocfg.speaker_pins[0] = 0x15; | 2566 | spec->autocfg.speaker_pins[0] = 0x15; |
2582 | spec->automute = 1; | 2567 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
2583 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
2584 | } | 2568 | } |
2585 | 2569 | ||
2586 | /* toggle speaker-output according to the hp-jack state */ | 2570 | /* toggle speaker-output according to the hp-jack state */ |
@@ -2593,8 +2577,7 @@ static void alc883_clevo_m720_setup(struct hda_codec *codec) | |||
2593 | 2577 | ||
2594 | spec->autocfg.hp_pins[0] = 0x15; | 2578 | spec->autocfg.hp_pins[0] = 0x15; |
2595 | spec->autocfg.speaker_pins[0] = 0x14; | 2579 | spec->autocfg.speaker_pins[0] = 0x14; |
2596 | spec->automute = 1; | 2580 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
2597 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
2598 | } | 2581 | } |
2599 | 2582 | ||
2600 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) | 2583 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
@@ -2623,8 +2606,7 @@ static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) | |||
2623 | 2606 | ||
2624 | spec->autocfg.hp_pins[0] = 0x14; | 2607 | spec->autocfg.hp_pins[0] = 0x14; |
2625 | spec->autocfg.speaker_pins[0] = 0x15; | 2608 | spec->autocfg.speaker_pins[0] = 0x15; |
2626 | spec->automute = 1; | 2609 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
2627 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
2628 | } | 2610 | } |
2629 | 2611 | ||
2630 | static void alc883_haier_w66_setup(struct hda_codec *codec) | 2612 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
@@ -2633,8 +2615,7 @@ static void alc883_haier_w66_setup(struct hda_codec *codec) | |||
2633 | 2615 | ||
2634 | spec->autocfg.hp_pins[0] = 0x1b; | 2616 | spec->autocfg.hp_pins[0] = 0x1b; |
2635 | spec->autocfg.speaker_pins[0] = 0x14; | 2617 | spec->autocfg.speaker_pins[0] = 0x14; |
2636 | spec->automute = 1; | 2618 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
2637 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
2638 | } | 2619 | } |
2639 | 2620 | ||
2640 | static void alc883_lenovo_101e_setup(struct hda_codec *codec) | 2621 | static void alc883_lenovo_101e_setup(struct hda_codec *codec) |
@@ -2644,10 +2625,7 @@ static void alc883_lenovo_101e_setup(struct hda_codec *codec) | |||
2644 | spec->autocfg.hp_pins[0] = 0x1b; | 2625 | spec->autocfg.hp_pins[0] = 0x1b; |
2645 | spec->autocfg.line_out_pins[0] = 0x14; | 2626 | spec->autocfg.line_out_pins[0] = 0x14; |
2646 | spec->autocfg.speaker_pins[0] = 0x15; | 2627 | spec->autocfg.speaker_pins[0] = 0x15; |
2647 | spec->automute = 1; | 2628 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
2648 | spec->detect_line = 1; | ||
2649 | spec->automute_lines = 1; | ||
2650 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
2651 | } | 2629 | } |
2652 | 2630 | ||
2653 | /* toggle speaker-output according to the hp-jack state */ | 2631 | /* toggle speaker-output according to the hp-jack state */ |
@@ -2658,8 +2636,7 @@ static void alc883_acer_aspire_setup(struct hda_codec *codec) | |||
2658 | spec->autocfg.hp_pins[0] = 0x14; | 2636 | spec->autocfg.hp_pins[0] = 0x14; |
2659 | spec->autocfg.speaker_pins[0] = 0x15; | 2637 | spec->autocfg.speaker_pins[0] = 0x15; |
2660 | spec->autocfg.speaker_pins[1] = 0x16; | 2638 | spec->autocfg.speaker_pins[1] = 0x16; |
2661 | spec->automute = 1; | 2639 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
2662 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
2663 | } | 2640 | } |
2664 | 2641 | ||
2665 | static const struct hda_verb alc883_acer_eapd_verbs[] = { | 2642 | static const struct hda_verb alc883_acer_eapd_verbs[] = { |
@@ -2689,8 +2666,7 @@ static void alc888_6st_dell_setup(struct hda_codec *codec) | |||
2689 | spec->autocfg.speaker_pins[1] = 0x15; | 2666 | spec->autocfg.speaker_pins[1] = 0x15; |
2690 | spec->autocfg.speaker_pins[2] = 0x16; | 2667 | spec->autocfg.speaker_pins[2] = 0x16; |
2691 | spec->autocfg.speaker_pins[3] = 0x17; | 2668 | spec->autocfg.speaker_pins[3] = 0x17; |
2692 | spec->automute = 1; | 2669 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
2693 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
2694 | } | 2670 | } |
2695 | 2671 | ||
2696 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) | 2672 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
@@ -2703,8 +2679,7 @@ static void alc888_lenovo_sky_setup(struct hda_codec *codec) | |||
2703 | spec->autocfg.speaker_pins[2] = 0x16; | 2679 | spec->autocfg.speaker_pins[2] = 0x16; |
2704 | spec->autocfg.speaker_pins[3] = 0x17; | 2680 | spec->autocfg.speaker_pins[3] = 0x17; |
2705 | spec->autocfg.speaker_pins[4] = 0x1a; | 2681 | spec->autocfg.speaker_pins[4] = 0x1a; |
2706 | spec->automute = 1; | 2682 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
2707 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
2708 | } | 2683 | } |
2709 | 2684 | ||
2710 | static void alc883_vaiott_setup(struct hda_codec *codec) | 2685 | static void alc883_vaiott_setup(struct hda_codec *codec) |
@@ -2714,8 +2689,7 @@ static void alc883_vaiott_setup(struct hda_codec *codec) | |||
2714 | spec->autocfg.hp_pins[0] = 0x15; | 2689 | spec->autocfg.hp_pins[0] = 0x15; |
2715 | spec->autocfg.speaker_pins[0] = 0x14; | 2690 | spec->autocfg.speaker_pins[0] = 0x14; |
2716 | spec->autocfg.speaker_pins[1] = 0x17; | 2691 | spec->autocfg.speaker_pins[1] = 0x17; |
2717 | spec->automute = 1; | 2692 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
2718 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
2719 | } | 2693 | } |
2720 | 2694 | ||
2721 | static const struct hda_verb alc888_asus_m90v_verbs[] = { | 2695 | static const struct hda_verb alc888_asus_m90v_verbs[] = { |
@@ -2739,8 +2713,7 @@ static void alc883_mode2_setup(struct hda_codec *codec) | |||
2739 | spec->ext_mic_pin = 0x18; | 2713 | spec->ext_mic_pin = 0x18; |
2740 | spec->int_mic_pin = 0x19; | 2714 | spec->int_mic_pin = 0x19; |
2741 | spec->auto_mic = 1; | 2715 | spec->auto_mic = 1; |
2742 | spec->automute = 1; | 2716 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
2743 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
2744 | } | 2717 | } |
2745 | 2718 | ||
2746 | static const struct hda_verb alc888_asus_eee1601_verbs[] = { | 2719 | static const struct hda_verb alc888_asus_eee1601_verbs[] = { |
diff --git a/sound/pci/hda/alc_quirks.c b/sound/pci/hda/alc_quirks.c index 2be1129cf45..a18952ed431 100644 --- a/sound/pci/hda/alc_quirks.c +++ b/sound/pci/hda/alc_quirks.c | |||
@@ -453,6 +453,19 @@ static void setup_preset(struct hda_codec *codec, | |||
453 | alc_fixup_autocfg_pin_nums(codec); | 453 | alc_fixup_autocfg_pin_nums(codec); |
454 | } | 454 | } |
455 | 455 | ||
456 | static void alc_simple_setup_automute(struct alc_spec *spec, int mode) | ||
457 | { | ||
458 | int lo_pin = spec->autocfg.line_out_pins[0]; | ||
459 | |||
460 | if (lo_pin == spec->autocfg.speaker_pins[0] || | ||
461 | lo_pin == spec->autocfg.hp_pins[0]) | ||
462 | lo_pin = 0; | ||
463 | spec->automute_mode = mode; | ||
464 | spec->detect_hp = !!spec->autocfg.hp_pins[0]; | ||
465 | spec->detect_lo = !!lo_pin; | ||
466 | spec->automute_lo = spec->automute_lo_possible = !!lo_pin; | ||
467 | spec->automute_speaker = spec->automute_speaker_possible = !!spec->autocfg.speaker_pins[0]; | ||
468 | } | ||
456 | 469 | ||
457 | /* auto-toggle front mic */ | 470 | /* auto-toggle front mic */ |
458 | static void alc88x_simple_mic_automute(struct hda_codec *codec) | 471 | static void alc88x_simple_mic_automute(struct hda_codec *codec) |
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c index 29714c818b5..60738e52b8f 100644 --- a/sound/pci/hda/hda_beep.c +++ b/sound/pci/hda/hda_beep.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/pci.h> | 23 | #include <linux/pci.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/workqueue.h> | 25 | #include <linux/workqueue.h> |
26 | #include <linux/export.h> | ||
26 | #include <sound/core.h> | 27 | #include <sound/core.h> |
27 | #include "hda_beep.h" | 28 | #include "hda_beep.h" |
28 | #include "hda_local.h" | 29 | #include "hda_local.h" |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index f3aefef3721..e44b107fdc7 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/pci.h> | 25 | #include <linux/pci.h> |
26 | #include <linux/mutex.h> | 26 | #include <linux/mutex.h> |
27 | #include <linux/module.h> | ||
27 | #include <sound/core.h> | 28 | #include <sound/core.h> |
28 | #include "hda_codec.h" | 29 | #include "hda_codec.h" |
29 | #include <sound/asoundef.h> | 30 | #include <sound/asoundef.h> |
@@ -34,6 +35,9 @@ | |||
34 | #include "hda_beep.h" | 35 | #include "hda_beep.h" |
35 | #include <sound/hda_hwdep.h> | 36 | #include <sound/hda_hwdep.h> |
36 | 37 | ||
38 | #define CREATE_TRACE_POINTS | ||
39 | #include "hda_trace.h" | ||
40 | |||
37 | /* | 41 | /* |
38 | * vendor / preset table | 42 | * vendor / preset table |
39 | */ | 43 | */ |
@@ -208,15 +212,19 @@ static int codec_exec_verb(struct hda_codec *codec, unsigned int cmd, | |||
208 | again: | 212 | again: |
209 | snd_hda_power_up(codec); | 213 | snd_hda_power_up(codec); |
210 | mutex_lock(&bus->cmd_mutex); | 214 | mutex_lock(&bus->cmd_mutex); |
215 | trace_hda_send_cmd(codec, cmd); | ||
211 | err = bus->ops.command(bus, cmd); | 216 | err = bus->ops.command(bus, cmd); |
212 | if (!err && res) | 217 | if (!err && res) { |
213 | *res = bus->ops.get_response(bus, codec->addr); | 218 | *res = bus->ops.get_response(bus, codec->addr); |
219 | trace_hda_get_response(codec, *res); | ||
220 | } | ||
214 | mutex_unlock(&bus->cmd_mutex); | 221 | mutex_unlock(&bus->cmd_mutex); |
215 | snd_hda_power_down(codec); | 222 | snd_hda_power_down(codec); |
216 | if (res && *res == -1 && bus->rirb_error) { | 223 | if (res && *res == -1 && bus->rirb_error) { |
217 | if (bus->response_reset) { | 224 | if (bus->response_reset) { |
218 | snd_printd("hda_codec: resetting BUS due to " | 225 | snd_printd("hda_codec: resetting BUS due to " |
219 | "fatal communication error\n"); | 226 | "fatal communication error\n"); |
227 | trace_hda_bus_reset(bus); | ||
220 | bus->ops.bus_reset(bus); | 228 | bus->ops.bus_reset(bus); |
221 | } | 229 | } |
222 | goto again; | 230 | goto again; |
@@ -607,6 +615,7 @@ int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex) | |||
607 | struct hda_bus_unsolicited *unsol; | 615 | struct hda_bus_unsolicited *unsol; |
608 | unsigned int wp; | 616 | unsigned int wp; |
609 | 617 | ||
618 | trace_hda_unsol_event(bus, res, res_ex); | ||
610 | unsol = bus->unsol; | 619 | unsol = bus->unsol; |
611 | if (!unsol) | 620 | if (!unsol) |
612 | return 0; | 621 | return 0; |
@@ -1483,8 +1492,11 @@ static void really_cleanup_stream(struct hda_codec *codec, | |||
1483 | struct hda_cvt_setup *q) | 1492 | struct hda_cvt_setup *q) |
1484 | { | 1493 | { |
1485 | hda_nid_t nid = q->nid; | 1494 | hda_nid_t nid = q->nid; |
1486 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CHANNEL_STREAMID, 0); | 1495 | if (q->stream_tag || q->channel_id) |
1487 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, 0); | 1496 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CHANNEL_STREAMID, 0); |
1497 | if (q->format_id) | ||
1498 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, 0 | ||
1499 | ); | ||
1488 | memset(q, 0, sizeof(*q)); | 1500 | memset(q, 0, sizeof(*q)); |
1489 | q->nid = nid; | 1501 | q->nid = nid; |
1490 | } | 1502 | } |
@@ -1689,6 +1701,29 @@ u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid) | |||
1689 | EXPORT_SYMBOL_HDA(snd_hda_query_pin_caps); | 1701 | EXPORT_SYMBOL_HDA(snd_hda_query_pin_caps); |
1690 | 1702 | ||
1691 | /** | 1703 | /** |
1704 | * snd_hda_override_pin_caps - Override the pin capabilities | ||
1705 | * @codec: the CODEC | ||
1706 | * @nid: the NID to override | ||
1707 | * @caps: the capability bits to set | ||
1708 | * | ||
1709 | * Override the cached PIN capabilitiy bits value by the given one. | ||
1710 | * | ||
1711 | * Returns zero if successful or a negative error code. | ||
1712 | */ | ||
1713 | int snd_hda_override_pin_caps(struct hda_codec *codec, hda_nid_t nid, | ||
1714 | unsigned int caps) | ||
1715 | { | ||
1716 | struct hda_amp_info *info; | ||
1717 | info = get_alloc_amp_hash(codec, HDA_HASH_PINCAP_KEY(nid)); | ||
1718 | if (!info) | ||
1719 | return -ENOMEM; | ||
1720 | info->amp_caps = caps; | ||
1721 | info->head.val |= INFO_AMP_CAPS; | ||
1722 | return 0; | ||
1723 | } | ||
1724 | EXPORT_SYMBOL_HDA(snd_hda_override_pin_caps); | ||
1725 | |||
1726 | /** | ||
1692 | * snd_hda_pin_sense - execute pin sense measurement | 1727 | * snd_hda_pin_sense - execute pin sense measurement |
1693 | * @codec: the CODEC to sense | 1728 | * @codec: the CODEC to sense |
1694 | * @nid: the pin NID to sense | 1729 | * @nid: the pin NID to sense |
@@ -2296,6 +2331,39 @@ int snd_hda_codec_reset(struct hda_codec *codec) | |||
2296 | return 0; | 2331 | return 0; |
2297 | } | 2332 | } |
2298 | 2333 | ||
2334 | typedef int (*map_slave_func_t)(void *, struct snd_kcontrol *); | ||
2335 | |||
2336 | /* apply the function to all matching slave ctls in the mixer list */ | ||
2337 | static int map_slaves(struct hda_codec *codec, const char * const *slaves, | ||
2338 | map_slave_func_t func, void *data) | ||
2339 | { | ||
2340 | struct hda_nid_item *items; | ||
2341 | const char * const *s; | ||
2342 | int i, err; | ||
2343 | |||
2344 | items = codec->mixers.list; | ||
2345 | for (i = 0; i < codec->mixers.used; i++) { | ||
2346 | struct snd_kcontrol *sctl = items[i].kctl; | ||
2347 | if (!sctl || !sctl->id.name || | ||
2348 | sctl->id.iface != SNDRV_CTL_ELEM_IFACE_MIXER) | ||
2349 | continue; | ||
2350 | for (s = slaves; *s; s++) { | ||
2351 | if (!strcmp(sctl->id.name, *s)) { | ||
2352 | err = func(data, sctl); | ||
2353 | if (err) | ||
2354 | return err; | ||
2355 | break; | ||
2356 | } | ||
2357 | } | ||
2358 | } | ||
2359 | return 0; | ||
2360 | } | ||
2361 | |||
2362 | static int check_slave_present(void *data, struct snd_kcontrol *sctl) | ||
2363 | { | ||
2364 | return 1; | ||
2365 | } | ||
2366 | |||
2299 | /** | 2367 | /** |
2300 | * snd_hda_add_vmaster - create a virtual master control and add slaves | 2368 | * snd_hda_add_vmaster - create a virtual master control and add slaves |
2301 | * @codec: HD-audio codec | 2369 | * @codec: HD-audio codec |
@@ -2316,12 +2384,10 @@ int snd_hda_add_vmaster(struct hda_codec *codec, char *name, | |||
2316 | unsigned int *tlv, const char * const *slaves) | 2384 | unsigned int *tlv, const char * const *slaves) |
2317 | { | 2385 | { |
2318 | struct snd_kcontrol *kctl; | 2386 | struct snd_kcontrol *kctl; |
2319 | const char * const *s; | ||
2320 | int err; | 2387 | int err; |
2321 | 2388 | ||
2322 | for (s = slaves; *s && !snd_hda_find_mixer_ctl(codec, *s); s++) | 2389 | err = map_slaves(codec, slaves, check_slave_present, NULL); |
2323 | ; | 2390 | if (err != 1) { |
2324 | if (!*s) { | ||
2325 | snd_printdd("No slave found for %s\n", name); | 2391 | snd_printdd("No slave found for %s\n", name); |
2326 | return 0; | 2392 | return 0; |
2327 | } | 2393 | } |
@@ -2332,23 +2398,10 @@ int snd_hda_add_vmaster(struct hda_codec *codec, char *name, | |||
2332 | if (err < 0) | 2398 | if (err < 0) |
2333 | return err; | 2399 | return err; |
2334 | 2400 | ||
2335 | for (s = slaves; *s; s++) { | 2401 | err = map_slaves(codec, slaves, (map_slave_func_t)snd_ctl_add_slave, |
2336 | struct snd_kcontrol *sctl; | 2402 | kctl); |
2337 | int i = 0; | 2403 | if (err < 0) |
2338 | for (;;) { | 2404 | return err; |
2339 | sctl = _snd_hda_find_mixer_ctl(codec, *s, i); | ||
2340 | if (!sctl) { | ||
2341 | if (!i) | ||
2342 | snd_printdd("Cannot find slave %s, " | ||
2343 | "skipped\n", *s); | ||
2344 | break; | ||
2345 | } | ||
2346 | err = snd_ctl_add_slave(kctl, sctl); | ||
2347 | if (err < 0) | ||
2348 | return err; | ||
2349 | i++; | ||
2350 | } | ||
2351 | } | ||
2352 | return 0; | 2405 | return 0; |
2353 | } | 2406 | } |
2354 | EXPORT_SYMBOL_HDA(snd_hda_add_vmaster); | 2407 | EXPORT_SYMBOL_HDA(snd_hda_add_vmaster); |
@@ -4087,6 +4140,7 @@ static void hda_power_work(struct work_struct *work) | |||
4087 | return; | 4140 | return; |
4088 | } | 4141 | } |
4089 | 4142 | ||
4143 | trace_hda_power_down(codec); | ||
4090 | hda_call_codec_suspend(codec); | 4144 | hda_call_codec_suspend(codec); |
4091 | if (bus->ops.pm_notify) | 4145 | if (bus->ops.pm_notify) |
4092 | bus->ops.pm_notify(bus); | 4146 | bus->ops.pm_notify(bus); |
@@ -4125,6 +4179,7 @@ void snd_hda_power_up(struct hda_codec *codec) | |||
4125 | if (codec->power_on || codec->power_transition) | 4179 | if (codec->power_on || codec->power_transition) |
4126 | return; | 4180 | return; |
4127 | 4181 | ||
4182 | trace_hda_power_up(codec); | ||
4128 | snd_hda_update_power_acct(codec); | 4183 | snd_hda_update_power_acct(codec); |
4129 | codec->power_on = 1; | 4184 | codec->power_on = 1; |
4130 | codec->power_jiffies = jiffies; | 4185 | codec->power_jiffies = jiffies; |
@@ -4537,6 +4592,11 @@ int snd_hda_multi_out_analog_prepare(struct hda_codec *codec, | |||
4537 | snd_hda_codec_setup_stream(codec, mout->hp_nid, stream_tag, | 4592 | snd_hda_codec_setup_stream(codec, mout->hp_nid, stream_tag, |
4538 | 0, format); | 4593 | 0, format); |
4539 | /* extra outputs copied from front */ | 4594 | /* extra outputs copied from front */ |
4595 | for (i = 0; i < ARRAY_SIZE(mout->hp_out_nid); i++) | ||
4596 | if (!mout->no_share_stream && mout->hp_out_nid[i]) | ||
4597 | snd_hda_codec_setup_stream(codec, | ||
4598 | mout->hp_out_nid[i], | ||
4599 | stream_tag, 0, format); | ||
4540 | for (i = 0; i < ARRAY_SIZE(mout->extra_out_nid); i++) | 4600 | for (i = 0; i < ARRAY_SIZE(mout->extra_out_nid); i++) |
4541 | if (!mout->no_share_stream && mout->extra_out_nid[i]) | 4601 | if (!mout->no_share_stream && mout->extra_out_nid[i]) |
4542 | snd_hda_codec_setup_stream(codec, | 4602 | snd_hda_codec_setup_stream(codec, |
@@ -4569,6 +4629,10 @@ int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec, | |||
4569 | snd_hda_codec_cleanup_stream(codec, nids[i]); | 4629 | snd_hda_codec_cleanup_stream(codec, nids[i]); |
4570 | if (mout->hp_nid) | 4630 | if (mout->hp_nid) |
4571 | snd_hda_codec_cleanup_stream(codec, mout->hp_nid); | 4631 | snd_hda_codec_cleanup_stream(codec, mout->hp_nid); |
4632 | for (i = 0; i < ARRAY_SIZE(mout->hp_out_nid); i++) | ||
4633 | if (mout->hp_out_nid[i]) | ||
4634 | snd_hda_codec_cleanup_stream(codec, | ||
4635 | mout->hp_out_nid[i]); | ||
4572 | for (i = 0; i < ARRAY_SIZE(mout->extra_out_nid); i++) | 4636 | for (i = 0; i < ARRAY_SIZE(mout->extra_out_nid); i++) |
4573 | if (mout->extra_out_nid[i]) | 4637 | if (mout->extra_out_nid[i]) |
4574 | snd_hda_codec_cleanup_stream(codec, | 4638 | snd_hda_codec_cleanup_stream(codec, |
@@ -4649,6 +4713,27 @@ static void sort_autocfg_input_pins(struct auto_pin_cfg *cfg) | |||
4649 | } | 4713 | } |
4650 | } | 4714 | } |
4651 | 4715 | ||
4716 | /* Reorder the surround channels | ||
4717 | * ALSA sequence is front/surr/clfe/side | ||
4718 | * HDA sequence is: | ||
4719 | * 4-ch: front/surr => OK as it is | ||
4720 | * 6-ch: front/clfe/surr | ||
4721 | * 8-ch: front/clfe/rear/side|fc | ||
4722 | */ | ||
4723 | static void reorder_outputs(unsigned int nums, hda_nid_t *pins) | ||
4724 | { | ||
4725 | hda_nid_t nid; | ||
4726 | |||
4727 | switch (nums) { | ||
4728 | case 3: | ||
4729 | case 4: | ||
4730 | nid = pins[1]; | ||
4731 | pins[1] = pins[2]; | ||
4732 | pins[2] = nid; | ||
4733 | break; | ||
4734 | } | ||
4735 | } | ||
4736 | |||
4652 | /* | 4737 | /* |
4653 | * Parse all pin widgets and store the useful pin nids to cfg | 4738 | * Parse all pin widgets and store the useful pin nids to cfg |
4654 | * | 4739 | * |
@@ -4666,12 +4751,13 @@ static void sort_autocfg_input_pins(struct auto_pin_cfg *cfg) | |||
4666 | * The digital input/output pins are assigned to dig_in_pin and dig_out_pin, | 4751 | * The digital input/output pins are assigned to dig_in_pin and dig_out_pin, |
4667 | * respectively. | 4752 | * respectively. |
4668 | */ | 4753 | */ |
4669 | int snd_hda_parse_pin_def_config(struct hda_codec *codec, | 4754 | int snd_hda_parse_pin_defcfg(struct hda_codec *codec, |
4670 | struct auto_pin_cfg *cfg, | 4755 | struct auto_pin_cfg *cfg, |
4671 | const hda_nid_t *ignore_nids) | 4756 | const hda_nid_t *ignore_nids, |
4757 | unsigned int cond_flags) | ||
4672 | { | 4758 | { |
4673 | hda_nid_t nid, end_nid; | 4759 | hda_nid_t nid, end_nid; |
4674 | short seq, assoc_line_out, assoc_speaker; | 4760 | short seq, assoc_line_out; |
4675 | short sequences_line_out[ARRAY_SIZE(cfg->line_out_pins)]; | 4761 | short sequences_line_out[ARRAY_SIZE(cfg->line_out_pins)]; |
4676 | short sequences_speaker[ARRAY_SIZE(cfg->speaker_pins)]; | 4762 | short sequences_speaker[ARRAY_SIZE(cfg->speaker_pins)]; |
4677 | short sequences_hp[ARRAY_SIZE(cfg->hp_pins)]; | 4763 | short sequences_hp[ARRAY_SIZE(cfg->hp_pins)]; |
@@ -4682,8 +4768,9 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, | |||
4682 | memset(sequences_line_out, 0, sizeof(sequences_line_out)); | 4768 | memset(sequences_line_out, 0, sizeof(sequences_line_out)); |
4683 | memset(sequences_speaker, 0, sizeof(sequences_speaker)); | 4769 | memset(sequences_speaker, 0, sizeof(sequences_speaker)); |
4684 | memset(sequences_hp, 0, sizeof(sequences_hp)); | 4770 | memset(sequences_hp, 0, sizeof(sequences_hp)); |
4685 | assoc_line_out = assoc_speaker = 0; | 4771 | assoc_line_out = 0; |
4686 | 4772 | ||
4773 | codec->ignore_misc_bit = true; | ||
4687 | end_nid = codec->start_nid + codec->num_nodes; | 4774 | end_nid = codec->start_nid + codec->num_nodes; |
4688 | for (nid = codec->start_nid; nid < end_nid; nid++) { | 4775 | for (nid = codec->start_nid; nid < end_nid; nid++) { |
4689 | unsigned int wid_caps = get_wcaps(codec, nid); | 4776 | unsigned int wid_caps = get_wcaps(codec, nid); |
@@ -4699,6 +4786,9 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, | |||
4699 | continue; | 4786 | continue; |
4700 | 4787 | ||
4701 | def_conf = snd_hda_codec_get_pincfg(codec, nid); | 4788 | def_conf = snd_hda_codec_get_pincfg(codec, nid); |
4789 | if (!(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) & | ||
4790 | AC_DEFCFG_MISC_NO_PRESENCE)) | ||
4791 | codec->ignore_misc_bit = false; | ||
4702 | conn = get_defcfg_connect(def_conf); | 4792 | conn = get_defcfg_connect(def_conf); |
4703 | if (conn == AC_JACK_PORT_NONE) | 4793 | if (conn == AC_JACK_PORT_NONE) |
4704 | continue; | 4794 | continue; |
@@ -4734,16 +4824,10 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, | |||
4734 | case AC_JACK_SPEAKER: | 4824 | case AC_JACK_SPEAKER: |
4735 | seq = get_defcfg_sequence(def_conf); | 4825 | seq = get_defcfg_sequence(def_conf); |
4736 | assoc = get_defcfg_association(def_conf); | 4826 | assoc = get_defcfg_association(def_conf); |
4737 | if (!assoc) | ||
4738 | continue; | ||
4739 | if (!assoc_speaker) | ||
4740 | assoc_speaker = assoc; | ||
4741 | else if (assoc_speaker != assoc) | ||
4742 | continue; | ||
4743 | if (cfg->speaker_outs >= ARRAY_SIZE(cfg->speaker_pins)) | 4827 | if (cfg->speaker_outs >= ARRAY_SIZE(cfg->speaker_pins)) |
4744 | continue; | 4828 | continue; |
4745 | cfg->speaker_pins[cfg->speaker_outs] = nid; | 4829 | cfg->speaker_pins[cfg->speaker_outs] = nid; |
4746 | sequences_speaker[cfg->speaker_outs] = seq; | 4830 | sequences_speaker[cfg->speaker_outs] = (assoc << 4) | seq; |
4747 | cfg->speaker_outs++; | 4831 | cfg->speaker_outs++; |
4748 | break; | 4832 | break; |
4749 | case AC_JACK_HP_OUT: | 4833 | case AC_JACK_HP_OUT: |
@@ -4792,7 +4876,8 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, | |||
4792 | * If no line-out is defined but multiple HPs are found, | 4876 | * If no line-out is defined but multiple HPs are found, |
4793 | * some of them might be the real line-outs. | 4877 | * some of them might be the real line-outs. |
4794 | */ | 4878 | */ |
4795 | if (!cfg->line_outs && cfg->hp_outs > 1) { | 4879 | if (!cfg->line_outs && cfg->hp_outs > 1 && |
4880 | !(cond_flags & HDA_PINCFG_NO_HP_FIXUP)) { | ||
4796 | int i = 0; | 4881 | int i = 0; |
4797 | while (i < cfg->hp_outs) { | 4882 | while (i < cfg->hp_outs) { |
4798 | /* The real HPs should have the sequence 0x0f */ | 4883 | /* The real HPs should have the sequence 0x0f */ |
@@ -4829,7 +4914,8 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, | |||
4829 | * FIX-UP: if no line-outs are detected, try to use speaker or HP pin | 4914 | * FIX-UP: if no line-outs are detected, try to use speaker or HP pin |
4830 | * as a primary output | 4915 | * as a primary output |
4831 | */ | 4916 | */ |
4832 | if (!cfg->line_outs) { | 4917 | if (!cfg->line_outs && |
4918 | !(cond_flags & HDA_PINCFG_NO_LO_FIXUP)) { | ||
4833 | if (cfg->speaker_outs) { | 4919 | if (cfg->speaker_outs) { |
4834 | cfg->line_outs = cfg->speaker_outs; | 4920 | cfg->line_outs = cfg->speaker_outs; |
4835 | memcpy(cfg->line_out_pins, cfg->speaker_pins, | 4921 | memcpy(cfg->line_out_pins, cfg->speaker_pins, |
@@ -4847,21 +4933,9 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, | |||
4847 | } | 4933 | } |
4848 | } | 4934 | } |
4849 | 4935 | ||
4850 | /* Reorder the surround channels | 4936 | reorder_outputs(cfg->line_outs, cfg->line_out_pins); |
4851 | * ALSA sequence is front/surr/clfe/side | 4937 | reorder_outputs(cfg->hp_outs, cfg->hp_pins); |
4852 | * HDA sequence is: | 4938 | reorder_outputs(cfg->speaker_outs, cfg->speaker_pins); |
4853 | * 4-ch: front/surr => OK as it is | ||
4854 | * 6-ch: front/clfe/surr | ||
4855 | * 8-ch: front/clfe/rear/side|fc | ||
4856 | */ | ||
4857 | switch (cfg->line_outs) { | ||
4858 | case 3: | ||
4859 | case 4: | ||
4860 | nid = cfg->line_out_pins[1]; | ||
4861 | cfg->line_out_pins[1] = cfg->line_out_pins[2]; | ||
4862 | cfg->line_out_pins[2] = nid; | ||
4863 | break; | ||
4864 | } | ||
4865 | 4939 | ||
4866 | sort_autocfg_input_pins(cfg); | 4940 | sort_autocfg_input_pins(cfg); |
4867 | 4941 | ||
@@ -4899,7 +4973,7 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, | |||
4899 | 4973 | ||
4900 | return 0; | 4974 | return 0; |
4901 | } | 4975 | } |
4902 | EXPORT_SYMBOL_HDA(snd_hda_parse_pin_def_config); | 4976 | EXPORT_SYMBOL_HDA(snd_hda_parse_pin_defcfg); |
4903 | 4977 | ||
4904 | int snd_hda_get_input_pin_attr(unsigned int def_conf) | 4978 | int snd_hda_get_input_pin_attr(unsigned int def_conf) |
4905 | { | 4979 | { |
@@ -5158,30 +5232,6 @@ void snd_array_free(struct snd_array *array) | |||
5158 | EXPORT_SYMBOL_HDA(snd_array_free); | 5232 | EXPORT_SYMBOL_HDA(snd_array_free); |
5159 | 5233 | ||
5160 | /** | 5234 | /** |
5161 | * snd_print_pcm_rates - Print the supported PCM rates to the string buffer | ||
5162 | * @pcm: PCM caps bits | ||
5163 | * @buf: the string buffer to write | ||
5164 | * @buflen: the max buffer length | ||
5165 | * | ||
5166 | * used by hda_proc.c and hda_eld.c | ||
5167 | */ | ||
5168 | void snd_print_pcm_rates(int pcm, char *buf, int buflen) | ||
5169 | { | ||
5170 | static unsigned int rates[] = { | ||
5171 | 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200, | ||
5172 | 96000, 176400, 192000, 384000 | ||
5173 | }; | ||
5174 | int i, j; | ||
5175 | |||
5176 | for (i = 0, j = 0; i < ARRAY_SIZE(rates); i++) | ||
5177 | if (pcm & (1 << i)) | ||
5178 | j += snprintf(buf + j, buflen - j, " %d", rates[i]); | ||
5179 | |||
5180 | buf[j] = '\0'; /* necessary when j == 0 */ | ||
5181 | } | ||
5182 | EXPORT_SYMBOL_HDA(snd_print_pcm_rates); | ||
5183 | |||
5184 | /** | ||
5185 | * snd_print_pcm_bits - Print the supported PCM fmt bits to the string buffer | 5235 | * snd_print_pcm_bits - Print the supported PCM fmt bits to the string buffer |
5186 | * @pcm: PCM caps bits | 5236 | * @pcm: PCM caps bits |
5187 | * @buf: the string buffer to write | 5237 | * @buf: the string buffer to write |
@@ -5222,6 +5272,8 @@ static const char *get_jack_default_name(struct hda_codec *codec, hda_nid_t nid, | |||
5222 | return "Mic"; | 5272 | return "Mic"; |
5223 | case SND_JACK_LINEOUT: | 5273 | case SND_JACK_LINEOUT: |
5224 | return "Line-out"; | 5274 | return "Line-out"; |
5275 | case SND_JACK_LINEIN: | ||
5276 | return "Line-in"; | ||
5225 | case SND_JACK_HEADSET: | 5277 | case SND_JACK_HEADSET: |
5226 | return "Headset"; | 5278 | return "Headset"; |
5227 | case SND_JACK_VIDEOOUT: | 5279 | case SND_JACK_VIDEOOUT: |
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 755f2b0f9d8..564471169ca 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -854,6 +854,7 @@ struct hda_codec { | |||
854 | unsigned int no_sticky_stream:1; /* no sticky-PCM stream assignment */ | 854 | unsigned int no_sticky_stream:1; /* no sticky-PCM stream assignment */ |
855 | unsigned int pins_shutup:1; /* pins are shut up */ | 855 | unsigned int pins_shutup:1; /* pins are shut up */ |
856 | unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */ | 856 | unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */ |
857 | unsigned int ignore_misc_bit:1; /* ignore MISC_NO_PRESENCE bit */ | ||
857 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 858 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
858 | unsigned int power_on :1; /* current (global) power-state */ | 859 | unsigned int power_on :1; /* current (global) power-state */ |
859 | unsigned int power_transition :1; /* power-state in transition */ | 860 | unsigned int power_transition :1; /* power-state in transition */ |
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c index c34f730f481..1c8ddf547a2 100644 --- a/sound/pci/hda/hda_eld.c +++ b/sound/pci/hda/hda_eld.c | |||
@@ -318,6 +318,11 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld, | |||
318 | int size; | 318 | int size; |
319 | unsigned char *buf; | 319 | unsigned char *buf; |
320 | 320 | ||
321 | /* | ||
322 | * ELD size is initialized to zero in caller function. If no errors and | ||
323 | * ELD is valid, actual eld_size is assigned in hdmi_update_eld() | ||
324 | */ | ||
325 | |||
321 | if (!eld->eld_valid) | 326 | if (!eld->eld_valid) |
322 | return -ENOENT; | 327 | return -ENOENT; |
323 | 328 | ||
@@ -327,14 +332,13 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld, | |||
327 | snd_printd(KERN_INFO "HDMI: ELD buf size is 0, force 128\n"); | 332 | snd_printd(KERN_INFO "HDMI: ELD buf size is 0, force 128\n"); |
328 | size = 128; | 333 | size = 128; |
329 | } | 334 | } |
330 | if (size < ELD_FIXED_BYTES || size > PAGE_SIZE) { | 335 | if (size < ELD_FIXED_BYTES || size > ELD_MAX_SIZE) { |
331 | snd_printd(KERN_INFO "HDMI: invalid ELD buf size %d\n", size); | 336 | snd_printd(KERN_INFO "HDMI: invalid ELD buf size %d\n", size); |
332 | return -ERANGE; | 337 | return -ERANGE; |
333 | } | 338 | } |
334 | 339 | ||
335 | buf = kmalloc(size, GFP_KERNEL); | 340 | /* set ELD buffer */ |
336 | if (!buf) | 341 | buf = eld->eld_buffer; |
337 | return -ENOMEM; | ||
338 | 342 | ||
339 | for (i = 0; i < size; i++) { | 343 | for (i = 0; i < size; i++) { |
340 | unsigned int val = hdmi_get_eld_data(codec, nid, i); | 344 | unsigned int val = hdmi_get_eld_data(codec, nid, i); |
@@ -356,10 +360,31 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld, | |||
356 | ret = hdmi_update_eld(eld, buf, size); | 360 | ret = hdmi_update_eld(eld, buf, size); |
357 | 361 | ||
358 | error: | 362 | error: |
359 | kfree(buf); | ||
360 | return ret; | 363 | return ret; |
361 | } | 364 | } |
362 | 365 | ||
366 | /** | ||
367 | * SNDRV_PCM_RATE_* and AC_PAR_PCM values don't match, print correct rates with | ||
368 | * hdmi-specific routine. | ||
369 | */ | ||
370 | static void hdmi_print_pcm_rates(int pcm, char *buf, int buflen) | ||
371 | { | ||
372 | static unsigned int alsa_rates[] = { | ||
373 | 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200, | ||
374 | 96000, 176400, 192000, 384000 | ||
375 | }; | ||
376 | int i, j; | ||
377 | |||
378 | for (i = 0, j = 0; i < ARRAY_SIZE(alsa_rates); i++) | ||
379 | if (pcm & (1 << i)) | ||
380 | j += snprintf(buf + j, buflen - j, " %d", | ||
381 | alsa_rates[i]); | ||
382 | |||
383 | buf[j] = '\0'; /* necessary when j == 0 */ | ||
384 | } | ||
385 | |||
386 | #define SND_PRINT_RATES_ADVISED_BUFSIZE 80 | ||
387 | |||
363 | static void hdmi_show_short_audio_desc(struct cea_sad *a) | 388 | static void hdmi_show_short_audio_desc(struct cea_sad *a) |
364 | { | 389 | { |
365 | char buf[SND_PRINT_RATES_ADVISED_BUFSIZE]; | 390 | char buf[SND_PRINT_RATES_ADVISED_BUFSIZE]; |
@@ -368,7 +393,7 @@ static void hdmi_show_short_audio_desc(struct cea_sad *a) | |||
368 | if (!a->format) | 393 | if (!a->format) |
369 | return; | 394 | return; |
370 | 395 | ||
371 | snd_print_pcm_rates(a->rates, buf, sizeof(buf)); | 396 | hdmi_print_pcm_rates(a->rates, buf, sizeof(buf)); |
372 | 397 | ||
373 | if (a->format == AUDIO_CODING_TYPE_LPCM) | 398 | if (a->format == AUDIO_CODING_TYPE_LPCM) |
374 | snd_print_pcm_bits(a->sample_bits, buf2 + 8, sizeof(buf2) - 8); | 399 | snd_print_pcm_bits(a->sample_bits, buf2 + 8, sizeof(buf2) - 8); |
@@ -427,7 +452,7 @@ static void hdmi_print_sad_info(int i, struct cea_sad *a, | |||
427 | i, a->format, cea_audio_coding_type_names[a->format]); | 452 | i, a->format, cea_audio_coding_type_names[a->format]); |
428 | snd_iprintf(buffer, "sad%d_channels\t\t%d\n", i, a->channels); | 453 | snd_iprintf(buffer, "sad%d_channels\t\t%d\n", i, a->channels); |
429 | 454 | ||
430 | snd_print_pcm_rates(a->rates, buf, sizeof(buf)); | 455 | hdmi_print_pcm_rates(a->rates, buf, sizeof(buf)); |
431 | snd_iprintf(buffer, "sad%d_rates\t\t[0x%x]%s\n", i, a->rates, buf); | 456 | snd_iprintf(buffer, "sad%d_rates\t\t[0x%x]%s\n", i, a->rates, buf); |
432 | 457 | ||
433 | if (a->format == AUDIO_CODING_TYPE_LPCM) { | 458 | if (a->format == AUDIO_CODING_TYPE_LPCM) { |
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index a63c54d9d76..431bf868711 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/export.h> | ||
25 | #include <sound/core.h> | 26 | #include <sound/core.h> |
26 | #include "hda_codec.h" | 27 | #include "hda_codec.h" |
27 | #include "hda_local.h" | 28 | #include "hda_local.h" |
diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c index bf3ced51e0f..6b2efb8cb1f 100644 --- a/sound/pci/hda/hda_hwdep.c +++ b/sound/pci/hda/hda_hwdep.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/ctype.h> | 26 | #include <linux/ctype.h> |
27 | #include <linux/string.h> | 27 | #include <linux/string.h> |
28 | #include <linux/firmware.h> | 28 | #include <linux/firmware.h> |
29 | #include <linux/export.h> | ||
29 | #include <sound/core.h> | 30 | #include <sound/core.h> |
30 | #include "hda_codec.h" | 31 | #include "hda_codec.h" |
31 | #include "hda_local.h" | 32 | #include "hda_local.h" |
@@ -643,14 +644,14 @@ static inline int strmatch(const char *a, const char *b) | |||
643 | static void parse_codec_mode(char *buf, struct hda_bus *bus, | 644 | static void parse_codec_mode(char *buf, struct hda_bus *bus, |
644 | struct hda_codec **codecp) | 645 | struct hda_codec **codecp) |
645 | { | 646 | { |
646 | unsigned int vendorid, subid, caddr; | 647 | int vendorid, subid, caddr; |
647 | struct hda_codec *codec; | 648 | struct hda_codec *codec; |
648 | 649 | ||
649 | *codecp = NULL; | 650 | *codecp = NULL; |
650 | if (sscanf(buf, "%i %i %i", &vendorid, &subid, &caddr) == 3) { | 651 | if (sscanf(buf, "%i %i %i", &vendorid, &subid, &caddr) == 3) { |
651 | list_for_each_entry(codec, &bus->codec_list, list) { | 652 | list_for_each_entry(codec, &bus->codec_list, list) { |
652 | if (codec->vendor_id == vendorid && | 653 | if ((vendorid <= 0 || codec->vendor_id == vendorid) && |
653 | codec->subsystem_id == subid && | 654 | (subid <= 0 || codec->subsystem_id == subid) && |
654 | codec->addr == caddr) { | 655 | codec->addr == caddr) { |
655 | *codecp = codec; | 656 | *codecp = codec; |
656 | break; | 657 | break; |
@@ -756,8 +757,6 @@ static int get_line_from_fw(char *buf, int size, struct firmware *fw) | |||
756 | } | 757 | } |
757 | if (!fw->size) | 758 | if (!fw->size) |
758 | return 0; | 759 | return 0; |
759 | if (size < fw->size) | ||
760 | size = fw->size; | ||
761 | 760 | ||
762 | for (len = 0; len < fw->size; len++) { | 761 | for (len = 0; len < fw->size; len++) { |
763 | if (!*p) | 762 | if (!*p) |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 191284a1c0a..096507d2ca9 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -34,7 +34,6 @@ | |||
34 | * | 34 | * |
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include <asm/io.h> | ||
38 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
39 | #include <linux/interrupt.h> | 38 | #include <linux/interrupt.h> |
40 | #include <linux/kernel.h> | 39 | #include <linux/kernel.h> |
@@ -46,6 +45,12 @@ | |||
46 | #include <linux/pci.h> | 45 | #include <linux/pci.h> |
47 | #include <linux/mutex.h> | 46 | #include <linux/mutex.h> |
48 | #include <linux/reboot.h> | 47 | #include <linux/reboot.h> |
48 | #include <linux/io.h> | ||
49 | #ifdef CONFIG_X86 | ||
50 | /* for snoop control */ | ||
51 | #include <asm/pgtable.h> | ||
52 | #include <asm/cacheflush.h> | ||
53 | #endif | ||
49 | #include <sound/core.h> | 54 | #include <sound/core.h> |
50 | #include <sound/initval.h> | 55 | #include <sound/initval.h> |
51 | #include "hda_codec.h" | 56 | #include "hda_codec.h" |
@@ -116,6 +121,22 @@ module_param(power_save_controller, bool, 0644); | |||
116 | MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode."); | 121 | MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode."); |
117 | #endif | 122 | #endif |
118 | 123 | ||
124 | static int align_buffer_size = 1; | ||
125 | module_param(align_buffer_size, bool, 0644); | ||
126 | MODULE_PARM_DESC(align_buffer_size, | ||
127 | "Force buffer and period sizes to be multiple of 128 bytes."); | ||
128 | |||
129 | #ifdef CONFIG_X86 | ||
130 | static bool hda_snoop = true; | ||
131 | module_param_named(snoop, hda_snoop, bool, 0444); | ||
132 | MODULE_PARM_DESC(snoop, "Enable/disable snooping"); | ||
133 | #define azx_snoop(chip) (chip)->snoop | ||
134 | #else | ||
135 | #define hda_snoop true | ||
136 | #define azx_snoop(chip) true | ||
137 | #endif | ||
138 | |||
139 | |||
119 | MODULE_LICENSE("GPL"); | 140 | MODULE_LICENSE("GPL"); |
120 | MODULE_SUPPORTED_DEVICE("{{Intel, ICH6}," | 141 | MODULE_SUPPORTED_DEVICE("{{Intel, ICH6}," |
121 | "{Intel, ICH6M}," | 142 | "{Intel, ICH6M}," |
@@ -360,7 +381,7 @@ struct azx_dev { | |||
360 | */ | 381 | */ |
361 | unsigned char stream_tag; /* assigned stream */ | 382 | unsigned char stream_tag; /* assigned stream */ |
362 | unsigned char index; /* stream index */ | 383 | unsigned char index; /* stream index */ |
363 | int device; /* last device number assigned to */ | 384 | int assigned_key; /* last device# key assigned to */ |
364 | 385 | ||
365 | unsigned int opened :1; | 386 | unsigned int opened :1; |
366 | unsigned int running :1; | 387 | unsigned int running :1; |
@@ -371,6 +392,7 @@ struct azx_dev { | |||
371 | * when link position is not greater than FIFO size | 392 | * when link position is not greater than FIFO size |
372 | */ | 393 | */ |
373 | unsigned int insufficient :1; | 394 | unsigned int insufficient :1; |
395 | unsigned int wc_marked:1; | ||
374 | }; | 396 | }; |
375 | 397 | ||
376 | /* CORB/RIRB */ | 398 | /* CORB/RIRB */ |
@@ -438,6 +460,7 @@ struct azx { | |||
438 | unsigned int msi :1; | 460 | unsigned int msi :1; |
439 | unsigned int irq_pending_warned :1; | 461 | unsigned int irq_pending_warned :1; |
440 | unsigned int probing :1; /* codec probing phase */ | 462 | unsigned int probing :1; /* codec probing phase */ |
463 | unsigned int snoop:1; | ||
441 | 464 | ||
442 | /* for debugging */ | 465 | /* for debugging */ |
443 | unsigned int last_cmd[AZX_MAX_CODECS]; | 466 | unsigned int last_cmd[AZX_MAX_CODECS]; |
@@ -481,6 +504,7 @@ enum { | |||
481 | #define AZX_DCAPS_NO_64BIT (1 << 18) /* No 64bit address */ | 504 | #define AZX_DCAPS_NO_64BIT (1 << 18) /* No 64bit address */ |
482 | #define AZX_DCAPS_SYNC_WRITE (1 << 19) /* sync each cmd write */ | 505 | #define AZX_DCAPS_SYNC_WRITE (1 << 19) /* sync each cmd write */ |
483 | #define AZX_DCAPS_OLD_SSYNC (1 << 20) /* Old SSYNC reg for ICH */ | 506 | #define AZX_DCAPS_OLD_SSYNC (1 << 20) /* Old SSYNC reg for ICH */ |
507 | #define AZX_DCAPS_BUFSIZE (1 << 21) /* no buffer size alignment */ | ||
484 | 508 | ||
485 | /* quirks for ATI SB / AMD Hudson */ | 509 | /* quirks for ATI SB / AMD Hudson */ |
486 | #define AZX_DCAPS_PRESET_ATI_SB \ | 510 | #define AZX_DCAPS_PRESET_ATI_SB \ |
@@ -542,6 +566,45 @@ static char *driver_short_names[] __devinitdata = { | |||
542 | /* for pcm support */ | 566 | /* for pcm support */ |
543 | #define get_azx_dev(substream) (substream->runtime->private_data) | 567 | #define get_azx_dev(substream) (substream->runtime->private_data) |
544 | 568 | ||
569 | #ifdef CONFIG_X86 | ||
570 | static void __mark_pages_wc(struct azx *chip, void *addr, size_t size, bool on) | ||
571 | { | ||
572 | if (azx_snoop(chip)) | ||
573 | return; | ||
574 | if (addr && size) { | ||
575 | int pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; | ||
576 | if (on) | ||
577 | set_memory_wc((unsigned long)addr, pages); | ||
578 | else | ||
579 | set_memory_wb((unsigned long)addr, pages); | ||
580 | } | ||
581 | } | ||
582 | |||
583 | static inline void mark_pages_wc(struct azx *chip, struct snd_dma_buffer *buf, | ||
584 | bool on) | ||
585 | { | ||
586 | __mark_pages_wc(chip, buf->area, buf->bytes, on); | ||
587 | } | ||
588 | static inline void mark_runtime_wc(struct azx *chip, struct azx_dev *azx_dev, | ||
589 | struct snd_pcm_runtime *runtime, bool on) | ||
590 | { | ||
591 | if (azx_dev->wc_marked != on) { | ||
592 | __mark_pages_wc(chip, runtime->dma_area, runtime->dma_bytes, on); | ||
593 | azx_dev->wc_marked = on; | ||
594 | } | ||
595 | } | ||
596 | #else | ||
597 | /* NOP for other archs */ | ||
598 | static inline void mark_pages_wc(struct azx *chip, struct snd_dma_buffer *buf, | ||
599 | bool on) | ||
600 | { | ||
601 | } | ||
602 | static inline void mark_runtime_wc(struct azx *chip, struct azx_dev *azx_dev, | ||
603 | struct snd_pcm_runtime *runtime, bool on) | ||
604 | { | ||
605 | } | ||
606 | #endif | ||
607 | |||
545 | static int azx_acquire_irq(struct azx *chip, int do_disconnect); | 608 | static int azx_acquire_irq(struct azx *chip, int do_disconnect); |
546 | static int azx_send_cmd(struct hda_bus *bus, unsigned int val); | 609 | static int azx_send_cmd(struct hda_bus *bus, unsigned int val); |
547 | /* | 610 | /* |
@@ -563,6 +626,7 @@ static int azx_alloc_cmd_io(struct azx *chip) | |||
563 | snd_printk(KERN_ERR SFX "cannot allocate CORB/RIRB\n"); | 626 | snd_printk(KERN_ERR SFX "cannot allocate CORB/RIRB\n"); |
564 | return err; | 627 | return err; |
565 | } | 628 | } |
629 | mark_pages_wc(chip, &chip->rb, true); | ||
566 | return 0; | 630 | return 0; |
567 | } | 631 | } |
568 | 632 | ||
@@ -1079,7 +1143,15 @@ static void update_pci_byte(struct pci_dev *pci, unsigned int reg, | |||
1079 | 1143 | ||
1080 | static void azx_init_pci(struct azx *chip) | 1144 | static void azx_init_pci(struct azx *chip) |
1081 | { | 1145 | { |
1082 | unsigned short snoop; | 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 | } | ||
1083 | 1155 | ||
1084 | /* Clear bits 0-2 of PCI register TCSEL (at offset 0x44) | 1156 | /* Clear bits 0-2 of PCI register TCSEL (at offset 0x44) |
1085 | * TCSEL == Traffic Class Select Register, which sets PCI express QOS | 1157 | * TCSEL == Traffic Class Select Register, which sets PCI express QOS |
@@ -1096,15 +1168,15 @@ static void azx_init_pci(struct azx *chip) | |||
1096 | * we need to enable snoop. | 1168 | * we need to enable snoop. |
1097 | */ | 1169 | */ |
1098 | if (chip->driver_caps & AZX_DCAPS_ATI_SNOOP) { | 1170 | if (chip->driver_caps & AZX_DCAPS_ATI_SNOOP) { |
1099 | snd_printdd(SFX "Enabling ATI snoop\n"); | 1171 | snd_printdd(SFX "Setting ATI snoop: %d\n", azx_snoop(chip)); |
1100 | update_pci_byte(chip->pci, | 1172 | update_pci_byte(chip->pci, |
1101 | ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, | 1173 | ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, 0x07, |
1102 | 0x07, ATI_SB450_HDAUDIO_ENABLE_SNOOP); | 1174 | azx_snoop(chip) ? ATI_SB450_HDAUDIO_ENABLE_SNOOP : 0); |
1103 | } | 1175 | } |
1104 | 1176 | ||
1105 | /* For NVIDIA HDA, enable snoop */ | 1177 | /* For NVIDIA HDA, enable snoop */ |
1106 | if (chip->driver_caps & AZX_DCAPS_NVIDIA_SNOOP) { | 1178 | if (chip->driver_caps & AZX_DCAPS_NVIDIA_SNOOP) { |
1107 | snd_printdd(SFX "Enabling Nvidia snoop\n"); | 1179 | snd_printdd(SFX "Setting Nvidia snoop: %d\n", azx_snoop(chip)); |
1108 | update_pci_byte(chip->pci, | 1180 | update_pci_byte(chip->pci, |
1109 | NVIDIA_HDA_TRANSREG_ADDR, | 1181 | NVIDIA_HDA_TRANSREG_ADDR, |
1110 | 0x0f, NVIDIA_HDA_ENABLE_COHBITS); | 1182 | 0x0f, NVIDIA_HDA_ENABLE_COHBITS); |
@@ -1118,16 +1190,20 @@ static void azx_init_pci(struct azx *chip) | |||
1118 | 1190 | ||
1119 | /* Enable SCH/PCH snoop if needed */ | 1191 | /* Enable SCH/PCH snoop if needed */ |
1120 | if (chip->driver_caps & AZX_DCAPS_SCH_SNOOP) { | 1192 | if (chip->driver_caps & AZX_DCAPS_SCH_SNOOP) { |
1193 | unsigned short snoop; | ||
1121 | pci_read_config_word(chip->pci, INTEL_SCH_HDA_DEVC, &snoop); | 1194 | pci_read_config_word(chip->pci, INTEL_SCH_HDA_DEVC, &snoop); |
1122 | if (snoop & INTEL_SCH_HDA_DEVC_NOSNOOP) { | 1195 | if ((!azx_snoop(chip) && !(snoop & INTEL_SCH_HDA_DEVC_NOSNOOP)) || |
1123 | pci_write_config_word(chip->pci, INTEL_SCH_HDA_DEVC, | 1196 | (azx_snoop(chip) && (snoop & INTEL_SCH_HDA_DEVC_NOSNOOP))) { |
1124 | snoop & (~INTEL_SCH_HDA_DEVC_NOSNOOP)); | 1197 | snoop &= ~INTEL_SCH_HDA_DEVC_NOSNOOP; |
1198 | if (!azx_snoop(chip)) | ||
1199 | snoop |= INTEL_SCH_HDA_DEVC_NOSNOOP; | ||
1200 | pci_write_config_word(chip->pci, INTEL_SCH_HDA_DEVC, snoop); | ||
1125 | pci_read_config_word(chip->pci, | 1201 | pci_read_config_word(chip->pci, |
1126 | INTEL_SCH_HDA_DEVC, &snoop); | 1202 | INTEL_SCH_HDA_DEVC, &snoop); |
1127 | snd_printdd(SFX "HDA snoop disabled, enabling ... %s\n", | ||
1128 | (snoop & INTEL_SCH_HDA_DEVC_NOSNOOP) | ||
1129 | ? "Failed" : "OK"); | ||
1130 | } | 1203 | } |
1204 | snd_printdd(SFX "SCH snoop: %s\n", | ||
1205 | (snoop & INTEL_SCH_HDA_DEVC_NOSNOOP) | ||
1206 | ? "Disabled" : "Enabled"); | ||
1131 | } | 1207 | } |
1132 | } | 1208 | } |
1133 | 1209 | ||
@@ -1334,12 +1410,16 @@ static void azx_stream_reset(struct azx *chip, struct azx_dev *azx_dev) | |||
1334 | */ | 1410 | */ |
1335 | static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev) | 1411 | static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev) |
1336 | { | 1412 | { |
1413 | unsigned int val; | ||
1337 | /* make sure the run bit is zero for SD */ | 1414 | /* make sure the run bit is zero for SD */ |
1338 | azx_stream_clear(chip, azx_dev); | 1415 | azx_stream_clear(chip, azx_dev); |
1339 | /* program the stream_tag */ | 1416 | /* program the stream_tag */ |
1340 | azx_sd_writel(azx_dev, SD_CTL, | 1417 | val = azx_sd_readl(azx_dev, SD_CTL); |
1341 | (azx_sd_readl(azx_dev, SD_CTL) & ~SD_CTL_STREAM_TAG_MASK)| | 1418 | val = (val & ~SD_CTL_STREAM_TAG_MASK) | |
1342 | (azx_dev->stream_tag << SD_CTL_STREAM_TAG_SHIFT)); | 1419 | (azx_dev->stream_tag << SD_CTL_STREAM_TAG_SHIFT); |
1420 | if (!azx_snoop(chip)) | ||
1421 | val |= SD_CTL_TRAFFIC_PRIO; | ||
1422 | azx_sd_writel(azx_dev, SD_CTL, val); | ||
1343 | 1423 | ||
1344 | /* program the length of samples in cyclic buffer */ | 1424 | /* program the length of samples in cyclic buffer */ |
1345 | azx_sd_writel(azx_dev, SD_CBL, azx_dev->bufsize); | 1425 | azx_sd_writel(azx_dev, SD_CBL, azx_dev->bufsize); |
@@ -1533,6 +1613,9 @@ azx_assign_device(struct azx *chip, struct snd_pcm_substream *substream) | |||
1533 | { | 1613 | { |
1534 | int dev, i, nums; | 1614 | int dev, i, nums; |
1535 | struct azx_dev *res = NULL; | 1615 | struct azx_dev *res = NULL; |
1616 | /* make a non-zero unique key for the substream */ | ||
1617 | int key = (substream->pcm->device << 16) | (substream->number << 2) | | ||
1618 | (substream->stream + 1); | ||
1536 | 1619 | ||
1537 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | 1620 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
1538 | dev = chip->playback_index_offset; | 1621 | dev = chip->playback_index_offset; |
@@ -1544,12 +1627,12 @@ azx_assign_device(struct azx *chip, struct snd_pcm_substream *substream) | |||
1544 | for (i = 0; i < nums; i++, dev++) | 1627 | for (i = 0; i < nums; i++, dev++) |
1545 | if (!chip->azx_dev[dev].opened) { | 1628 | if (!chip->azx_dev[dev].opened) { |
1546 | res = &chip->azx_dev[dev]; | 1629 | res = &chip->azx_dev[dev]; |
1547 | if (res->device == substream->pcm->device) | 1630 | if (res->assigned_key == key) |
1548 | break; | 1631 | break; |
1549 | } | 1632 | } |
1550 | if (res) { | 1633 | if (res) { |
1551 | res->opened = 1; | 1634 | res->opened = 1; |
1552 | res->device = substream->pcm->device; | 1635 | res->assigned_key = key; |
1553 | } | 1636 | } |
1554 | return res; | 1637 | return res; |
1555 | } | 1638 | } |
@@ -1599,6 +1682,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream) | |||
1599 | struct snd_pcm_runtime *runtime = substream->runtime; | 1682 | struct snd_pcm_runtime *runtime = substream->runtime; |
1600 | unsigned long flags; | 1683 | unsigned long flags; |
1601 | int err; | 1684 | int err; |
1685 | int buff_step; | ||
1602 | 1686 | ||
1603 | mutex_lock(&chip->open_mutex); | 1687 | mutex_lock(&chip->open_mutex); |
1604 | azx_dev = azx_assign_device(chip, substream); | 1688 | azx_dev = azx_assign_device(chip, substream); |
@@ -1613,10 +1697,25 @@ static int azx_pcm_open(struct snd_pcm_substream *substream) | |||
1613 | runtime->hw.rates = hinfo->rates; | 1697 | runtime->hw.rates = hinfo->rates; |
1614 | snd_pcm_limit_hw_rates(runtime); | 1698 | snd_pcm_limit_hw_rates(runtime); |
1615 | snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); | 1699 | snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); |
1700 | if (align_buffer_size) | ||
1701 | /* constrain buffer sizes to be multiple of 128 | ||
1702 | bytes. This is more efficient in terms of memory | ||
1703 | access but isn't required by the HDA spec and | ||
1704 | prevents users from specifying exact period/buffer | ||
1705 | sizes. For example for 44.1kHz, a period size set | ||
1706 | to 20ms will be rounded to 19.59ms. */ | ||
1707 | buff_step = 128; | ||
1708 | else | ||
1709 | /* Don't enforce steps on buffer sizes, still need to | ||
1710 | be multiple of 4 bytes (HDA spec). Tested on Intel | ||
1711 | HDA controllers, may not work on all devices where | ||
1712 | option needs to be disabled */ | ||
1713 | buff_step = 4; | ||
1714 | |||
1616 | snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, | 1715 | snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, |
1617 | 128); | 1716 | buff_step); |
1618 | snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, | 1717 | snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, |
1619 | 128); | 1718 | buff_step); |
1620 | snd_hda_power_up(apcm->codec); | 1719 | snd_hda_power_up(apcm->codec); |
1621 | err = hinfo->ops.open(hinfo, apcm->codec, substream); | 1720 | err = hinfo->ops.open(hinfo, apcm->codec, substream); |
1622 | if (err < 0) { | 1721 | if (err < 0) { |
@@ -1671,19 +1770,30 @@ static int azx_pcm_close(struct snd_pcm_substream *substream) | |||
1671 | static int azx_pcm_hw_params(struct snd_pcm_substream *substream, | 1770 | static int azx_pcm_hw_params(struct snd_pcm_substream *substream, |
1672 | struct snd_pcm_hw_params *hw_params) | 1771 | struct snd_pcm_hw_params *hw_params) |
1673 | { | 1772 | { |
1773 | struct azx_pcm *apcm = snd_pcm_substream_chip(substream); | ||
1774 | struct azx *chip = apcm->chip; | ||
1775 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
1674 | struct azx_dev *azx_dev = get_azx_dev(substream); | 1776 | struct azx_dev *azx_dev = get_azx_dev(substream); |
1777 | int ret; | ||
1675 | 1778 | ||
1779 | mark_runtime_wc(chip, azx_dev, runtime, false); | ||
1676 | azx_dev->bufsize = 0; | 1780 | azx_dev->bufsize = 0; |
1677 | azx_dev->period_bytes = 0; | 1781 | azx_dev->period_bytes = 0; |
1678 | azx_dev->format_val = 0; | 1782 | azx_dev->format_val = 0; |
1679 | return snd_pcm_lib_malloc_pages(substream, | 1783 | ret = snd_pcm_lib_malloc_pages(substream, |
1680 | params_buffer_bytes(hw_params)); | 1784 | params_buffer_bytes(hw_params)); |
1785 | if (ret < 0) | ||
1786 | return ret; | ||
1787 | mark_runtime_wc(chip, azx_dev, runtime, true); | ||
1788 | return ret; | ||
1681 | } | 1789 | } |
1682 | 1790 | ||
1683 | static int azx_pcm_hw_free(struct snd_pcm_substream *substream) | 1791 | static int azx_pcm_hw_free(struct snd_pcm_substream *substream) |
1684 | { | 1792 | { |
1685 | struct azx_pcm *apcm = snd_pcm_substream_chip(substream); | 1793 | struct azx_pcm *apcm = snd_pcm_substream_chip(substream); |
1686 | struct azx_dev *azx_dev = get_azx_dev(substream); | 1794 | struct azx_dev *azx_dev = get_azx_dev(substream); |
1795 | struct azx *chip = apcm->chip; | ||
1796 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
1687 | struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream]; | 1797 | struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream]; |
1688 | 1798 | ||
1689 | /* reset BDL address */ | 1799 | /* reset BDL address */ |
@@ -1696,6 +1806,7 @@ static int azx_pcm_hw_free(struct snd_pcm_substream *substream) | |||
1696 | 1806 | ||
1697 | snd_hda_codec_cleanup(apcm->codec, hinfo, substream); | 1807 | snd_hda_codec_cleanup(apcm->codec, hinfo, substream); |
1698 | 1808 | ||
1809 | mark_runtime_wc(chip, azx_dev, runtime, false); | ||
1699 | return snd_pcm_lib_free_pages(substream); | 1810 | return snd_pcm_lib_free_pages(substream); |
1700 | } | 1811 | } |
1701 | 1812 | ||
@@ -2055,6 +2166,20 @@ static void azx_clear_irq_pending(struct azx *chip) | |||
2055 | spin_unlock_irq(&chip->reg_lock); | 2166 | spin_unlock_irq(&chip->reg_lock); |
2056 | } | 2167 | } |
2057 | 2168 | ||
2169 | #ifdef CONFIG_X86 | ||
2170 | static int azx_pcm_mmap(struct snd_pcm_substream *substream, | ||
2171 | struct vm_area_struct *area) | ||
2172 | { | ||
2173 | struct azx_pcm *apcm = snd_pcm_substream_chip(substream); | ||
2174 | struct azx *chip = apcm->chip; | ||
2175 | if (!azx_snoop(chip)) | ||
2176 | area->vm_page_prot = pgprot_writecombine(area->vm_page_prot); | ||
2177 | return snd_pcm_lib_default_mmap(substream, area); | ||
2178 | } | ||
2179 | #else | ||
2180 | #define azx_pcm_mmap NULL | ||
2181 | #endif | ||
2182 | |||
2058 | static struct snd_pcm_ops azx_pcm_ops = { | 2183 | static struct snd_pcm_ops azx_pcm_ops = { |
2059 | .open = azx_pcm_open, | 2184 | .open = azx_pcm_open, |
2060 | .close = azx_pcm_close, | 2185 | .close = azx_pcm_close, |
@@ -2064,6 +2189,7 @@ static struct snd_pcm_ops azx_pcm_ops = { | |||
2064 | .prepare = azx_pcm_prepare, | 2189 | .prepare = azx_pcm_prepare, |
2065 | .trigger = azx_pcm_trigger, | 2190 | .trigger = azx_pcm_trigger, |
2066 | .pointer = azx_pcm_pointer, | 2191 | .pointer = azx_pcm_pointer, |
2192 | .mmap = azx_pcm_mmap, | ||
2067 | .page = snd_pcm_sgbuf_ops_page, | 2193 | .page = snd_pcm_sgbuf_ops_page, |
2068 | }; | 2194 | }; |
2069 | 2195 | ||
@@ -2344,13 +2470,19 @@ static int azx_free(struct azx *chip) | |||
2344 | 2470 | ||
2345 | if (chip->azx_dev) { | 2471 | if (chip->azx_dev) { |
2346 | for (i = 0; i < chip->num_streams; i++) | 2472 | for (i = 0; i < chip->num_streams; i++) |
2347 | if (chip->azx_dev[i].bdl.area) | 2473 | if (chip->azx_dev[i].bdl.area) { |
2474 | mark_pages_wc(chip, &chip->azx_dev[i].bdl, false); | ||
2348 | snd_dma_free_pages(&chip->azx_dev[i].bdl); | 2475 | snd_dma_free_pages(&chip->azx_dev[i].bdl); |
2476 | } | ||
2349 | } | 2477 | } |
2350 | if (chip->rb.area) | 2478 | if (chip->rb.area) { |
2479 | mark_pages_wc(chip, &chip->rb, false); | ||
2351 | snd_dma_free_pages(&chip->rb); | 2480 | snd_dma_free_pages(&chip->rb); |
2352 | if (chip->posbuf.area) | 2481 | } |
2482 | if (chip->posbuf.area) { | ||
2483 | mark_pages_wc(chip, &chip->posbuf, false); | ||
2353 | snd_dma_free_pages(&chip->posbuf); | 2484 | snd_dma_free_pages(&chip->posbuf); |
2485 | } | ||
2354 | pci_release_regions(chip->pci); | 2486 | pci_release_regions(chip->pci); |
2355 | pci_disable_device(chip->pci); | 2487 | pci_disable_device(chip->pci); |
2356 | kfree(chip->azx_dev); | 2488 | kfree(chip->azx_dev); |
@@ -2546,6 +2678,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, | |||
2546 | check_probe_mask(chip, dev); | 2678 | check_probe_mask(chip, dev); |
2547 | 2679 | ||
2548 | chip->single_cmd = single_cmd; | 2680 | chip->single_cmd = single_cmd; |
2681 | chip->snoop = hda_snoop; | ||
2549 | 2682 | ||
2550 | if (bdl_pos_adj[dev] < 0) { | 2683 | if (bdl_pos_adj[dev] < 0) { |
2551 | switch (chip->driver_type) { | 2684 | switch (chip->driver_type) { |
@@ -2618,6 +2751,10 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, | |||
2618 | gcap &= ~ICH6_GCAP_64OK; | 2751 | gcap &= ~ICH6_GCAP_64OK; |
2619 | } | 2752 | } |
2620 | 2753 | ||
2754 | /* disable buffer size rounding to 128-byte multiples if supported */ | ||
2755 | if (chip->driver_caps & AZX_DCAPS_BUFSIZE) | ||
2756 | align_buffer_size = 0; | ||
2757 | |||
2621 | /* allow 64bit DMA address if supported by H/W */ | 2758 | /* allow 64bit DMA address if supported by H/W */ |
2622 | if ((gcap & ICH6_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64))) | 2759 | if ((gcap & ICH6_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64))) |
2623 | pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(64)); | 2760 | pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(64)); |
@@ -2669,6 +2806,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, | |||
2669 | snd_printk(KERN_ERR SFX "cannot allocate BDL\n"); | 2806 | snd_printk(KERN_ERR SFX "cannot allocate BDL\n"); |
2670 | goto errout; | 2807 | goto errout; |
2671 | } | 2808 | } |
2809 | mark_pages_wc(chip, &chip->azx_dev[i].bdl, true); | ||
2672 | } | 2810 | } |
2673 | /* allocate memory for the position buffer */ | 2811 | /* allocate memory for the position buffer */ |
2674 | err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, | 2812 | err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, |
@@ -2678,6 +2816,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, | |||
2678 | snd_printk(KERN_ERR SFX "cannot allocate posbuf\n"); | 2816 | snd_printk(KERN_ERR SFX "cannot allocate posbuf\n"); |
2679 | goto errout; | 2817 | goto errout; |
2680 | } | 2818 | } |
2819 | mark_pages_wc(chip, &chip->posbuf, true); | ||
2681 | /* allocate CORB/RIRB */ | 2820 | /* allocate CORB/RIRB */ |
2682 | err = azx_alloc_cmd_io(chip); | 2821 | err = azx_alloc_cmd_io(chip); |
2683 | if (err < 0) | 2822 | if (err < 0) |
@@ -2819,37 +2958,49 @@ static void __devexit azx_remove(struct pci_dev *pci) | |||
2819 | static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { | 2958 | static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { |
2820 | /* CPT */ | 2959 | /* CPT */ |
2821 | { PCI_DEVICE(0x8086, 0x1c20), | 2960 | { PCI_DEVICE(0x8086, 0x1c20), |
2822 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP }, | 2961 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | |
2962 | AZX_DCAPS_BUFSIZE }, | ||
2823 | /* PBG */ | 2963 | /* PBG */ |
2824 | { PCI_DEVICE(0x8086, 0x1d20), | 2964 | { PCI_DEVICE(0x8086, 0x1d20), |
2825 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP }, | 2965 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | |
2966 | AZX_DCAPS_BUFSIZE}, | ||
2826 | /* Panther Point */ | 2967 | /* Panther Point */ |
2827 | { PCI_DEVICE(0x8086, 0x1e20), | 2968 | { PCI_DEVICE(0x8086, 0x1e20), |
2828 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP }, | 2969 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | |
2970 | AZX_DCAPS_BUFSIZE}, | ||
2829 | /* SCH */ | 2971 | /* SCH */ |
2830 | { PCI_DEVICE(0x8086, 0x811b), | 2972 | { PCI_DEVICE(0x8086, 0x811b), |
2831 | .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP }, | 2973 | .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | |
2974 | AZX_DCAPS_BUFSIZE}, | ||
2832 | { PCI_DEVICE(0x8086, 0x2668), | 2975 | { PCI_DEVICE(0x8086, 0x2668), |
2833 | .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC }, /* ICH6 */ | 2976 | .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC | |
2977 | AZX_DCAPS_BUFSIZE }, /* ICH6 */ | ||
2834 | { PCI_DEVICE(0x8086, 0x27d8), | 2978 | { PCI_DEVICE(0x8086, 0x27d8), |
2835 | .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC }, /* ICH7 */ | 2979 | .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC | |
2980 | AZX_DCAPS_BUFSIZE }, /* ICH7 */ | ||
2836 | { PCI_DEVICE(0x8086, 0x269a), | 2981 | { PCI_DEVICE(0x8086, 0x269a), |
2837 | .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC }, /* ESB2 */ | 2982 | .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC | |
2983 | AZX_DCAPS_BUFSIZE }, /* ESB2 */ | ||
2838 | { PCI_DEVICE(0x8086, 0x284b), | 2984 | { PCI_DEVICE(0x8086, 0x284b), |
2839 | .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC }, /* ICH8 */ | 2985 | .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC | |
2986 | AZX_DCAPS_BUFSIZE }, /* ICH8 */ | ||
2840 | { PCI_DEVICE(0x8086, 0x293e), | 2987 | { PCI_DEVICE(0x8086, 0x293e), |
2841 | .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC }, /* ICH9 */ | 2988 | .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC | |
2989 | AZX_DCAPS_BUFSIZE }, /* ICH9 */ | ||
2842 | { PCI_DEVICE(0x8086, 0x293f), | 2990 | { PCI_DEVICE(0x8086, 0x293f), |
2843 | .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC }, /* ICH9 */ | 2991 | .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC | |
2992 | AZX_DCAPS_BUFSIZE }, /* ICH9 */ | ||
2844 | { PCI_DEVICE(0x8086, 0x3a3e), | 2993 | { PCI_DEVICE(0x8086, 0x3a3e), |
2845 | .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC }, /* ICH10 */ | 2994 | .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC | |
2995 | AZX_DCAPS_BUFSIZE }, /* ICH10 */ | ||
2846 | { PCI_DEVICE(0x8086, 0x3a6e), | 2996 | { PCI_DEVICE(0x8086, 0x3a6e), |
2847 | .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC }, /* ICH10 */ | 2997 | .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC | |
2998 | AZX_DCAPS_BUFSIZE }, /* ICH10 */ | ||
2848 | /* Generic Intel */ | 2999 | /* Generic Intel */ |
2849 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_ANY_ID), | 3000 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_ANY_ID), |
2850 | .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8, | 3001 | .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8, |
2851 | .class_mask = 0xffffff, | 3002 | .class_mask = 0xffffff, |
2852 | .driver_data = AZX_DRIVER_ICH }, | 3003 | .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_BUFSIZE }, |
2853 | /* ATI SB 450/600/700/800/900 */ | 3004 | /* ATI SB 450/600/700/800/900 */ |
2854 | { PCI_DEVICE(0x1002, 0x437b), | 3005 | { PCI_DEVICE(0x1002, 0x437b), |
2855 | .driver_data = AZX_DRIVER_ATI | AZX_DCAPS_PRESET_ATI_SB }, | 3006 | .driver_data = AZX_DRIVER_ATI | AZX_DCAPS_PRESET_ATI_SB }, |
@@ -2912,12 +3063,12 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { | |||
2912 | .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8, | 3063 | .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8, |
2913 | .class_mask = 0xffffff, | 3064 | .class_mask = 0xffffff, |
2914 | .driver_data = AZX_DRIVER_CTX | AZX_DCAPS_CTX_WORKAROUND | | 3065 | .driver_data = AZX_DRIVER_CTX | AZX_DCAPS_CTX_WORKAROUND | |
2915 | AZX_DCAPS_RIRB_PRE_DELAY }, | 3066 | AZX_DCAPS_RIRB_PRE_DELAY | AZX_DCAPS_POSFIX_LPIB }, |
2916 | #else | 3067 | #else |
2917 | /* this entry seems still valid -- i.e. without emu20kx chip */ | 3068 | /* this entry seems still valid -- i.e. without emu20kx chip */ |
2918 | { PCI_DEVICE(0x1102, 0x0009), | 3069 | { PCI_DEVICE(0x1102, 0x0009), |
2919 | .driver_data = AZX_DRIVER_CTX | AZX_DCAPS_CTX_WORKAROUND | | 3070 | .driver_data = AZX_DRIVER_CTX | AZX_DCAPS_CTX_WORKAROUND | |
2920 | AZX_DCAPS_RIRB_PRE_DELAY }, | 3071 | AZX_DCAPS_RIRB_PRE_DELAY | AZX_DCAPS_POSFIX_LPIB }, |
2921 | #endif | 3072 | #endif |
2922 | /* Vortex86MX */ | 3073 | /* Vortex86MX */ |
2923 | { PCI_DEVICE(0x17f3, 0x3010), .driver_data = AZX_DRIVER_GENERIC }, | 3074 | { PCI_DEVICE(0x17f3, 0x3010), .driver_data = AZX_DRIVER_GENERIC }, |
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 2e7ac31afa8..6579e0f2bb5 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -267,11 +267,14 @@ int snd_hda_ch_mode_put(struct hda_codec *codec, | |||
267 | enum { HDA_FRONT, HDA_REAR, HDA_CLFE, HDA_SIDE }; /* index for dac_nidx */ | 267 | enum { HDA_FRONT, HDA_REAR, HDA_CLFE, HDA_SIDE }; /* index for dac_nidx */ |
268 | enum { HDA_DIG_NONE, HDA_DIG_EXCLUSIVE, HDA_DIG_ANALOG_DUP }; /* dig_out_used */ | 268 | enum { HDA_DIG_NONE, HDA_DIG_EXCLUSIVE, HDA_DIG_ANALOG_DUP }; /* dig_out_used */ |
269 | 269 | ||
270 | #define HDA_MAX_OUTS 5 | ||
271 | |||
270 | struct hda_multi_out { | 272 | struct hda_multi_out { |
271 | int num_dacs; /* # of DACs, must be more than 1 */ | 273 | int num_dacs; /* # of DACs, must be more than 1 */ |
272 | const hda_nid_t *dac_nids; /* DAC list */ | 274 | const hda_nid_t *dac_nids; /* DAC list */ |
273 | hda_nid_t hp_nid; /* optional DAC for HP, 0 when not exists */ | 275 | hda_nid_t hp_nid; /* optional DAC for HP, 0 when not exists */ |
274 | hda_nid_t extra_out_nid[3]; /* optional DACs, 0 when not exists */ | 276 | hda_nid_t hp_out_nid[HDA_MAX_OUTS]; /* DACs for multiple HPs */ |
277 | hda_nid_t extra_out_nid[HDA_MAX_OUTS]; /* other (e.g. speaker) DACs */ | ||
275 | hda_nid_t dig_out_nid; /* digital out audio widget */ | 278 | hda_nid_t dig_out_nid; /* digital out audio widget */ |
276 | const hda_nid_t *slave_dig_outs; | 279 | const hda_nid_t *slave_dig_outs; |
277 | int max_channels; /* currently supported analog channels */ | 280 | int max_channels; /* currently supported analog channels */ |
@@ -333,9 +336,6 @@ int snd_hda_codec_proc_new(struct hda_codec *codec); | |||
333 | static inline int snd_hda_codec_proc_new(struct hda_codec *codec) { return 0; } | 336 | static inline int snd_hda_codec_proc_new(struct hda_codec *codec) { return 0; } |
334 | #endif | 337 | #endif |
335 | 338 | ||
336 | #define SND_PRINT_RATES_ADVISED_BUFSIZE 80 | ||
337 | void snd_print_pcm_rates(int pcm, char *buf, int buflen); | ||
338 | |||
339 | #define SND_PRINT_BITS_ADVISED_BUFSIZE 16 | 339 | #define SND_PRINT_BITS_ADVISED_BUFSIZE 16 |
340 | void snd_print_pcm_bits(int pcm, char *buf, int buflen); | 340 | void snd_print_pcm_bits(int pcm, char *buf, int buflen); |
341 | 341 | ||
@@ -385,7 +385,7 @@ enum { | |||
385 | AUTO_PIN_HP_OUT | 385 | AUTO_PIN_HP_OUT |
386 | }; | 386 | }; |
387 | 387 | ||
388 | #define AUTO_CFG_MAX_OUTS 5 | 388 | #define AUTO_CFG_MAX_OUTS HDA_MAX_OUTS |
389 | #define AUTO_CFG_MAX_INS 8 | 389 | #define AUTO_CFG_MAX_INS 8 |
390 | 390 | ||
391 | struct auto_pin_cfg_item { | 391 | struct auto_pin_cfg_item { |
@@ -442,10 +442,21 @@ struct auto_pin_cfg { | |||
442 | (cfg & AC_DEFCFG_SEQUENCE) | 442 | (cfg & AC_DEFCFG_SEQUENCE) |
443 | #define get_defcfg_device(cfg) \ | 443 | #define get_defcfg_device(cfg) \ |
444 | ((cfg & AC_DEFCFG_DEVICE) >> AC_DEFCFG_DEVICE_SHIFT) | 444 | ((cfg & AC_DEFCFG_DEVICE) >> AC_DEFCFG_DEVICE_SHIFT) |
445 | #define get_defcfg_misc(cfg) \ | ||
446 | ((cfg & AC_DEFCFG_MISC) >> AC_DEFCFG_MISC_SHIFT) | ||
447 | |||
448 | /* bit-flags for snd_hda_parse_pin_def_config() behavior */ | ||
449 | #define HDA_PINCFG_NO_HP_FIXUP (1 << 0) /* no HP-split */ | ||
450 | #define HDA_PINCFG_NO_LO_FIXUP (1 << 1) /* don't take other outs as LO */ | ||
445 | 451 | ||
446 | int snd_hda_parse_pin_def_config(struct hda_codec *codec, | 452 | int snd_hda_parse_pin_defcfg(struct hda_codec *codec, |
447 | struct auto_pin_cfg *cfg, | 453 | struct auto_pin_cfg *cfg, |
448 | const hda_nid_t *ignore_nids); | 454 | const hda_nid_t *ignore_nids, |
455 | unsigned int cond_flags); | ||
456 | |||
457 | /* older function */ | ||
458 | #define snd_hda_parse_pin_def_config(codec, cfg, ignore) \ | ||
459 | snd_hda_parse_pin_defcfg(codec, cfg, ignore, 0) | ||
449 | 460 | ||
450 | /* amp values */ | 461 | /* amp values */ |
451 | #define AMP_IN_MUTE(idx) (0x7080 | ((idx)<<8)) | 462 | #define AMP_IN_MUTE(idx) (0x7080 | ((idx)<<8)) |
@@ -492,13 +503,22 @@ u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction); | |||
492 | int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, | 503 | int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, |
493 | unsigned int caps); | 504 | unsigned int caps); |
494 | u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid); | 505 | 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, | ||
507 | unsigned int caps); | ||
495 | u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid); | 508 | u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid); |
496 | int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid); | 509 | int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid); |
497 | 510 | ||
498 | static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) | 511 | static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) |
499 | { | 512 | { |
500 | return (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT) && | 513 | if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT)) |
501 | (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP); | 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; | ||
502 | } | 522 | } |
503 | 523 | ||
504 | /* flags for hda_nid_item */ | 524 | /* flags for hda_nid_item */ |
@@ -589,7 +609,8 @@ int snd_hda_check_amp_list_power(struct hda_codec *codec, | |||
589 | #define get_amp_nid_(pv) ((pv) & 0xffff) | 609 | #define get_amp_nid_(pv) ((pv) & 0xffff) |
590 | #define get_amp_nid(kc) get_amp_nid_((kc)->private_value) | 610 | #define get_amp_nid(kc) get_amp_nid_((kc)->private_value) |
591 | #define get_amp_channels(kc) (((kc)->private_value >> 16) & 0x3) | 611 | #define get_amp_channels(kc) (((kc)->private_value >> 16) & 0x3) |
592 | #define get_amp_direction(kc) (((kc)->private_value >> 18) & 0x1) | 612 | #define get_amp_direction_(pv) (((pv) >> 18) & 0x1) |
613 | #define get_amp_direction(kc) get_amp_direction_((kc)->private_value) | ||
593 | #define get_amp_index(kc) (((kc)->private_value >> 19) & 0xf) | 614 | #define get_amp_index(kc) (((kc)->private_value >> 19) & 0xf) |
594 | #define get_amp_offset(kc) (((kc)->private_value >> 23) & 0x3f) | 615 | #define get_amp_offset(kc) (((kc)->private_value >> 23) & 0x3f) |
595 | #define get_amp_min_mute(kc) (((kc)->private_value >> 29) & 0x1) | 616 | #define get_amp_min_mute(kc) (((kc)->private_value >> 29) & 0x1) |
@@ -607,6 +628,7 @@ struct cea_sad { | |||
607 | }; | 628 | }; |
608 | 629 | ||
609 | #define ELD_FIXED_BYTES 20 | 630 | #define ELD_FIXED_BYTES 20 |
631 | #define ELD_MAX_SIZE 256 | ||
610 | #define ELD_MAX_MNL 16 | 632 | #define ELD_MAX_MNL 16 |
611 | #define ELD_MAX_SAD 16 | 633 | #define ELD_MAX_SAD 16 |
612 | 634 | ||
@@ -631,6 +653,7 @@ struct hdmi_eld { | |||
631 | int spk_alloc; | 653 | int spk_alloc; |
632 | int sad_count; | 654 | int sad_count; |
633 | struct cea_sad sad[ELD_MAX_SAD]; | 655 | struct cea_sad sad[ELD_MAX_SAD]; |
656 | char eld_buffer[ELD_MAX_SIZE]; | ||
634 | #ifdef CONFIG_PROC_FS | 657 | #ifdef CONFIG_PROC_FS |
635 | struct snd_info_entry *proc_entry; | 658 | struct snd_info_entry *proc_entry; |
636 | #endif | 659 | #endif |
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index 2be57b051aa..2c981b55940 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c | |||
@@ -152,12 +152,18 @@ static void print_amp_vals(struct snd_info_buffer *buffer, | |||
152 | 152 | ||
153 | static void print_pcm_rates(struct snd_info_buffer *buffer, unsigned int pcm) | 153 | static void print_pcm_rates(struct snd_info_buffer *buffer, unsigned int pcm) |
154 | { | 154 | { |
155 | char buf[SND_PRINT_RATES_ADVISED_BUFSIZE]; | 155 | static unsigned int rates[] = { |
156 | 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200, | ||
157 | 96000, 176400, 192000, 384000 | ||
158 | }; | ||
159 | int i; | ||
156 | 160 | ||
157 | pcm &= AC_SUPPCM_RATES; | 161 | pcm &= AC_SUPPCM_RATES; |
158 | snd_iprintf(buffer, " rates [0x%x]:", pcm); | 162 | snd_iprintf(buffer, " rates [0x%x]:", pcm); |
159 | snd_print_pcm_rates(pcm, buf, sizeof(buf)); | 163 | for (i = 0; i < ARRAY_SIZE(rates); i++) |
160 | snd_iprintf(buffer, "%s\n", buf); | 164 | if (pcm & (1 << i)) |
165 | snd_iprintf(buffer, " %d", rates[i]); | ||
166 | snd_iprintf(buffer, "\n"); | ||
161 | } | 167 | } |
162 | 168 | ||
163 | static void print_pcm_bits(struct snd_info_buffer *buffer, unsigned int pcm) | 169 | static void print_pcm_bits(struct snd_info_buffer *buffer, unsigned int pcm) |
diff --git a/sound/pci/hda/hda_trace.h b/sound/pci/hda/hda_trace.h new file mode 100644 index 00000000000..9884871ddb0 --- /dev/null +++ b/sound/pci/hda/hda_trace.h | |||
@@ -0,0 +1,117 @@ | |||
1 | #undef TRACE_SYSTEM | ||
2 | #define TRACE_SYSTEM hda | ||
3 | #define TRACE_INCLUDE_FILE hda_trace | ||
4 | |||
5 | #if !defined(_TRACE_HDA_H) || defined(TRACE_HEADER_MULTI_READ) | ||
6 | #define _TRACE_HDA_H | ||
7 | |||
8 | #include <linux/tracepoint.h> | ||
9 | |||
10 | struct hda_bus; | ||
11 | struct hda_codec; | ||
12 | |||
13 | DECLARE_EVENT_CLASS(hda_cmd, | ||
14 | |||
15 | TP_PROTO(struct hda_codec *codec, unsigned int val), | ||
16 | |||
17 | TP_ARGS(codec, val), | ||
18 | |||
19 | TP_STRUCT__entry( | ||
20 | __field( unsigned int, card ) | ||
21 | __field( unsigned int, addr ) | ||
22 | __field( unsigned int, val ) | ||
23 | ), | ||
24 | |||
25 | TP_fast_assign( | ||
26 | __entry->card = (codec)->bus->card->number; | ||
27 | __entry->addr = (codec)->addr; | ||
28 | __entry->val = (val); | ||
29 | ), | ||
30 | |||
31 | TP_printk("[%d:%d] val=%x", __entry->card, __entry->addr, __entry->val) | ||
32 | ); | ||
33 | |||
34 | DEFINE_EVENT(hda_cmd, hda_send_cmd, | ||
35 | TP_PROTO(struct hda_codec *codec, unsigned int val), | ||
36 | TP_ARGS(codec, val) | ||
37 | ); | ||
38 | |||
39 | DEFINE_EVENT(hda_cmd, hda_get_response, | ||
40 | TP_PROTO(struct hda_codec *codec, unsigned int val), | ||
41 | TP_ARGS(codec, val) | ||
42 | ); | ||
43 | |||
44 | TRACE_EVENT(hda_bus_reset, | ||
45 | |||
46 | TP_PROTO(struct hda_bus *bus), | ||
47 | |||
48 | TP_ARGS(bus), | ||
49 | |||
50 | TP_STRUCT__entry( | ||
51 | __field( unsigned int, card ) | ||
52 | ), | ||
53 | |||
54 | TP_fast_assign( | ||
55 | __entry->card = (bus)->card->number; | ||
56 | ), | ||
57 | |||
58 | TP_printk("[%d]", __entry->card) | ||
59 | ); | ||
60 | |||
61 | DECLARE_EVENT_CLASS(hda_power, | ||
62 | |||
63 | TP_PROTO(struct hda_codec *codec), | ||
64 | |||
65 | TP_ARGS(codec), | ||
66 | |||
67 | TP_STRUCT__entry( | ||
68 | __field( unsigned int, card ) | ||
69 | __field( unsigned int, addr ) | ||
70 | ), | ||
71 | |||
72 | TP_fast_assign( | ||
73 | __entry->card = (codec)->bus->card->number; | ||
74 | __entry->addr = (codec)->addr; | ||
75 | ), | ||
76 | |||
77 | TP_printk("[%d:%d]", __entry->card, __entry->addr) | ||
78 | ); | ||
79 | |||
80 | DEFINE_EVENT(hda_power, hda_power_down, | ||
81 | TP_PROTO(struct hda_codec *codec), | ||
82 | TP_ARGS(codec) | ||
83 | ); | ||
84 | |||
85 | DEFINE_EVENT(hda_power, hda_power_up, | ||
86 | TP_PROTO(struct hda_codec *codec), | ||
87 | TP_ARGS(codec) | ||
88 | ); | ||
89 | |||
90 | TRACE_EVENT(hda_unsol_event, | ||
91 | |||
92 | TP_PROTO(struct hda_bus *bus, u32 res, u32 res_ex), | ||
93 | |||
94 | TP_ARGS(bus, res, res_ex), | ||
95 | |||
96 | TP_STRUCT__entry( | ||
97 | __field( unsigned int, card ) | ||
98 | __field( u32, res ) | ||
99 | __field( u32, res_ex ) | ||
100 | ), | ||
101 | |||
102 | TP_fast_assign( | ||
103 | __entry->card = (bus)->card->number; | ||
104 | __entry->res = res; | ||
105 | __entry->res_ex = res_ex; | ||
106 | ), | ||
107 | |||
108 | TP_printk("[%d] res=%x, res_ex=%x", __entry->card, | ||
109 | __entry->res, __entry->res_ex) | ||
110 | ); | ||
111 | |||
112 | #endif /* _TRACE_HDA_H */ | ||
113 | |||
114 | /* This part must be outside protection */ | ||
115 | #undef TRACE_INCLUDE_PATH | ||
116 | #define TRACE_INCLUDE_PATH . | ||
117 | #include <trace/define_trace.h> | ||
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 8648917acff..bcb3310c394 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/pci.h> | 25 | #include <linux/pci.h> |
26 | #include <linux/module.h> | ||
26 | 27 | ||
27 | #include <sound/core.h> | 28 | #include <sound/core.h> |
28 | #include "hda_codec.h" | 29 | #include "hda_codec.h" |
@@ -48,6 +49,8 @@ struct ad198x_spec { | |||
48 | 49 | ||
49 | const hda_nid_t *alt_dac_nid; | 50 | const hda_nid_t *alt_dac_nid; |
50 | const struct hda_pcm_stream *stream_analog_alt_playback; | 51 | const struct hda_pcm_stream *stream_analog_alt_playback; |
52 | int independent_hp; | ||
53 | int num_active_streams; | ||
51 | 54 | ||
52 | /* capture */ | 55 | /* capture */ |
53 | unsigned int num_adc_nids; | 56 | unsigned int num_adc_nids; |
@@ -302,6 +305,72 @@ static int ad198x_check_power_status(struct hda_codec *codec, hda_nid_t nid) | |||
302 | } | 305 | } |
303 | #endif | 306 | #endif |
304 | 307 | ||
308 | static void activate_ctl(struct hda_codec *codec, const char *name, int active) | ||
309 | { | ||
310 | struct snd_kcontrol *ctl = snd_hda_find_mixer_ctl(codec, name); | ||
311 | if (ctl) { | ||
312 | ctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; | ||
313 | ctl->vd[0].access |= active ? 0 : | ||
314 | SNDRV_CTL_ELEM_ACCESS_INACTIVE; | ||
315 | ctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_WRITE; | ||
316 | ctl->vd[0].access |= active ? | ||
317 | SNDRV_CTL_ELEM_ACCESS_WRITE : 0; | ||
318 | snd_ctl_notify(codec->bus->card, | ||
319 | SNDRV_CTL_EVENT_MASK_INFO, &ctl->id); | ||
320 | } | ||
321 | } | ||
322 | |||
323 | static void set_stream_active(struct hda_codec *codec, bool active) | ||
324 | { | ||
325 | struct ad198x_spec *spec = codec->spec; | ||
326 | if (active) | ||
327 | spec->num_active_streams++; | ||
328 | else | ||
329 | spec->num_active_streams--; | ||
330 | activate_ctl(codec, "Independent HP", spec->num_active_streams == 0); | ||
331 | } | ||
332 | |||
333 | static int ad1988_independent_hp_info(struct snd_kcontrol *kcontrol, | ||
334 | struct snd_ctl_elem_info *uinfo) | ||
335 | { | ||
336 | static const char * const texts[] = { "OFF", "ON", NULL}; | ||
337 | int index; | ||
338 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | ||
339 | uinfo->count = 1; | ||
340 | uinfo->value.enumerated.items = 2; | ||
341 | index = uinfo->value.enumerated.item; | ||
342 | if (index >= 2) | ||
343 | index = 1; | ||
344 | strcpy(uinfo->value.enumerated.name, texts[index]); | ||
345 | return 0; | ||
346 | } | ||
347 | |||
348 | static int ad1988_independent_hp_get(struct snd_kcontrol *kcontrol, | ||
349 | struct snd_ctl_elem_value *ucontrol) | ||
350 | { | ||
351 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
352 | struct ad198x_spec *spec = codec->spec; | ||
353 | ucontrol->value.enumerated.item[0] = spec->independent_hp; | ||
354 | return 0; | ||
355 | } | ||
356 | |||
357 | static int ad1988_independent_hp_put(struct snd_kcontrol *kcontrol, | ||
358 | struct snd_ctl_elem_value *ucontrol) | ||
359 | { | ||
360 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
361 | struct ad198x_spec *spec = codec->spec; | ||
362 | unsigned int select = ucontrol->value.enumerated.item[0]; | ||
363 | if (spec->independent_hp != select) { | ||
364 | spec->independent_hp = select; | ||
365 | if (spec->independent_hp) | ||
366 | spec->multiout.hp_nid = 0; | ||
367 | else | ||
368 | spec->multiout.hp_nid = spec->alt_dac_nid[0]; | ||
369 | return 1; | ||
370 | } | ||
371 | return 0; | ||
372 | } | ||
373 | |||
305 | /* | 374 | /* |
306 | * Analog playback callbacks | 375 | * Analog playback callbacks |
307 | */ | 376 | */ |
@@ -310,8 +379,15 @@ static int ad198x_playback_pcm_open(struct hda_pcm_stream *hinfo, | |||
310 | struct snd_pcm_substream *substream) | 379 | struct snd_pcm_substream *substream) |
311 | { | 380 | { |
312 | struct ad198x_spec *spec = codec->spec; | 381 | struct ad198x_spec *spec = codec->spec; |
313 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, | 382 | int err; |
383 | set_stream_active(codec, true); | ||
384 | err = snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, | ||
314 | hinfo); | 385 | hinfo); |
386 | if (err < 0) { | ||
387 | set_stream_active(codec, false); | ||
388 | return err; | ||
389 | } | ||
390 | return 0; | ||
315 | } | 391 | } |
316 | 392 | ||
317 | static int ad198x_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | 393 | static int ad198x_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
@@ -333,11 +409,41 @@ static int ad198x_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | |||
333 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); | 409 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
334 | } | 410 | } |
335 | 411 | ||
412 | static int ad198x_playback_pcm_close(struct hda_pcm_stream *hinfo, | ||
413 | struct hda_codec *codec, | ||
414 | struct snd_pcm_substream *substream) | ||
415 | { | ||
416 | set_stream_active(codec, false); | ||
417 | return 0; | ||
418 | } | ||
419 | |||
420 | static int ad1988_alt_playback_pcm_open(struct hda_pcm_stream *hinfo, | ||
421 | struct hda_codec *codec, | ||
422 | struct snd_pcm_substream *substream) | ||
423 | { | ||
424 | struct ad198x_spec *spec = codec->spec; | ||
425 | if (!spec->independent_hp) | ||
426 | return -EBUSY; | ||
427 | set_stream_active(codec, true); | ||
428 | return 0; | ||
429 | } | ||
430 | |||
431 | static int ad1988_alt_playback_pcm_close(struct hda_pcm_stream *hinfo, | ||
432 | struct hda_codec *codec, | ||
433 | struct snd_pcm_substream *substream) | ||
434 | { | ||
435 | set_stream_active(codec, false); | ||
436 | return 0; | ||
437 | } | ||
438 | |||
336 | static const struct hda_pcm_stream ad198x_pcm_analog_alt_playback = { | 439 | static const struct hda_pcm_stream ad198x_pcm_analog_alt_playback = { |
337 | .substreams = 1, | 440 | .substreams = 1, |
338 | .channels_min = 2, | 441 | .channels_min = 2, |
339 | .channels_max = 2, | 442 | .channels_max = 2, |
340 | /* NID is set in ad198x_build_pcms */ | 443 | .ops = { |
444 | .open = ad1988_alt_playback_pcm_open, | ||
445 | .close = ad1988_alt_playback_pcm_close | ||
446 | }, | ||
341 | }; | 447 | }; |
342 | 448 | ||
343 | /* | 449 | /* |
@@ -402,7 +508,6 @@ static int ad198x_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |||
402 | return 0; | 508 | return 0; |
403 | } | 509 | } |
404 | 510 | ||
405 | |||
406 | /* | 511 | /* |
407 | */ | 512 | */ |
408 | static const struct hda_pcm_stream ad198x_pcm_analog_playback = { | 513 | static const struct hda_pcm_stream ad198x_pcm_analog_playback = { |
@@ -413,7 +518,8 @@ static const struct hda_pcm_stream ad198x_pcm_analog_playback = { | |||
413 | .ops = { | 518 | .ops = { |
414 | .open = ad198x_playback_pcm_open, | 519 | .open = ad198x_playback_pcm_open, |
415 | .prepare = ad198x_playback_pcm_prepare, | 520 | .prepare = ad198x_playback_pcm_prepare, |
416 | .cleanup = ad198x_playback_pcm_cleanup | 521 | .cleanup = ad198x_playback_pcm_cleanup, |
522 | .close = ad198x_playback_pcm_close | ||
417 | }, | 523 | }, |
418 | }; | 524 | }; |
419 | 525 | ||
@@ -2058,7 +2164,6 @@ static int patch_ad1981(struct hda_codec *codec) | |||
2058 | enum { | 2164 | enum { |
2059 | AD1988_6STACK, | 2165 | AD1988_6STACK, |
2060 | AD1988_6STACK_DIG, | 2166 | AD1988_6STACK_DIG, |
2061 | AD1988_6STACK_DIG_FP, | ||
2062 | AD1988_3STACK, | 2167 | AD1988_3STACK, |
2063 | AD1988_3STACK_DIG, | 2168 | AD1988_3STACK_DIG, |
2064 | AD1988_LAPTOP, | 2169 | AD1988_LAPTOP, |
@@ -2168,6 +2273,17 @@ static int ad198x_ch_mode_put(struct snd_kcontrol *kcontrol, | |||
2168 | return err; | 2273 | return err; |
2169 | } | 2274 | } |
2170 | 2275 | ||
2276 | static const struct snd_kcontrol_new ad1988_hp_mixers[] = { | ||
2277 | { | ||
2278 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
2279 | .name = "Independent HP", | ||
2280 | .info = ad1988_independent_hp_info, | ||
2281 | .get = ad1988_independent_hp_get, | ||
2282 | .put = ad1988_independent_hp_put, | ||
2283 | }, | ||
2284 | { } /* end */ | ||
2285 | }; | ||
2286 | |||
2171 | /* 6-stack mode */ | 2287 | /* 6-stack mode */ |
2172 | static const struct snd_kcontrol_new ad1988_6stack_mixers1[] = { | 2288 | static const struct snd_kcontrol_new ad1988_6stack_mixers1[] = { |
2173 | HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT), | 2289 | HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT), |
@@ -2188,6 +2304,7 @@ static const struct snd_kcontrol_new ad1988_6stack_mixers1_rev2[] = { | |||
2188 | }; | 2304 | }; |
2189 | 2305 | ||
2190 | static const struct snd_kcontrol_new ad1988_6stack_mixers2[] = { | 2306 | static const struct snd_kcontrol_new ad1988_6stack_mixers2[] = { |
2307 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
2191 | HDA_BIND_MUTE("Front Playback Switch", 0x29, 2, HDA_INPUT), | 2308 | HDA_BIND_MUTE("Front Playback Switch", 0x29, 2, HDA_INPUT), |
2192 | HDA_BIND_MUTE("Surround Playback Switch", 0x2a, 2, HDA_INPUT), | 2309 | HDA_BIND_MUTE("Surround Playback Switch", 0x2a, 2, HDA_INPUT), |
2193 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x27, 1, 2, HDA_INPUT), | 2310 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x27, 1, 2, HDA_INPUT), |
@@ -2210,13 +2327,6 @@ static const struct snd_kcontrol_new ad1988_6stack_mixers2[] = { | |||
2210 | 2327 | ||
2211 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x39, 0x0, HDA_OUTPUT), | 2328 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x39, 0x0, HDA_OUTPUT), |
2212 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x3c, 0x0, HDA_OUTPUT), | 2329 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x3c, 0x0, HDA_OUTPUT), |
2213 | |||
2214 | { } /* end */ | ||
2215 | }; | ||
2216 | |||
2217 | static const struct snd_kcontrol_new ad1988_6stack_fp_mixers[] = { | ||
2218 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
2219 | |||
2220 | { } /* end */ | 2330 | { } /* end */ |
2221 | }; | 2331 | }; |
2222 | 2332 | ||
@@ -2238,6 +2348,7 @@ static const struct snd_kcontrol_new ad1988_3stack_mixers1_rev2[] = { | |||
2238 | }; | 2348 | }; |
2239 | 2349 | ||
2240 | static const struct snd_kcontrol_new ad1988_3stack_mixers2[] = { | 2350 | static const struct snd_kcontrol_new ad1988_3stack_mixers2[] = { |
2351 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
2241 | HDA_BIND_MUTE("Front Playback Switch", 0x29, 2, HDA_INPUT), | 2352 | HDA_BIND_MUTE("Front Playback Switch", 0x29, 2, HDA_INPUT), |
2242 | HDA_BIND_MUTE("Surround Playback Switch", 0x2c, 2, HDA_INPUT), | 2353 | HDA_BIND_MUTE("Surround Playback Switch", 0x2c, 2, HDA_INPUT), |
2243 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x26, 1, 2, HDA_INPUT), | 2354 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x26, 1, 2, HDA_INPUT), |
@@ -2272,6 +2383,7 @@ static const struct snd_kcontrol_new ad1988_3stack_mixers2[] = { | |||
2272 | 2383 | ||
2273 | /* laptop mode */ | 2384 | /* laptop mode */ |
2274 | static const struct snd_kcontrol_new ad1988_laptop_mixers[] = { | 2385 | static const struct snd_kcontrol_new ad1988_laptop_mixers[] = { |
2386 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
2275 | HDA_CODEC_VOLUME("PCM Playback Volume", 0x04, 0x0, HDA_OUTPUT), | 2387 | HDA_CODEC_VOLUME("PCM Playback Volume", 0x04, 0x0, HDA_OUTPUT), |
2276 | HDA_CODEC_MUTE("PCM Playback Switch", 0x29, 0x0, HDA_INPUT), | 2388 | HDA_CODEC_MUTE("PCM Playback Switch", 0x29, 0x0, HDA_INPUT), |
2277 | HDA_BIND_MUTE("Mono Playback Switch", 0x1e, 2, HDA_INPUT), | 2389 | HDA_BIND_MUTE("Mono Playback Switch", 0x1e, 2, HDA_INPUT), |
@@ -2446,7 +2558,7 @@ static const struct hda_verb ad1988_6stack_init_verbs[] = { | |||
2446 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 2558 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
2447 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 2559 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
2448 | /* Port-A front headphon path */ | 2560 | /* Port-A front headphon path */ |
2449 | {0x37, AC_VERB_SET_CONNECT_SEL, 0x01}, /* DAC1:04h */ | 2561 | {0x37, AC_VERB_SET_CONNECT_SEL, 0x00}, /* DAC0:03h */ |
2450 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 2562 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
2451 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | 2563 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
2452 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 2564 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
@@ -2594,7 +2706,7 @@ static const struct hda_verb ad1988_3stack_init_verbs[] = { | |||
2594 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 2706 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
2595 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 2707 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
2596 | /* Port-A front headphon path */ | 2708 | /* Port-A front headphon path */ |
2597 | {0x37, AC_VERB_SET_CONNECT_SEL, 0x01}, /* DAC1:04h */ | 2709 | {0x37, AC_VERB_SET_CONNECT_SEL, 0x00}, /* DAC0:03h */ |
2598 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 2710 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
2599 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | 2711 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
2600 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 2712 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
@@ -2669,7 +2781,7 @@ static const struct hda_verb ad1988_laptop_init_verbs[] = { | |||
2669 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 2781 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
2670 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 2782 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
2671 | /* Port-A front headphon path */ | 2783 | /* Port-A front headphon path */ |
2672 | {0x37, AC_VERB_SET_CONNECT_SEL, 0x01}, /* DAC1:04h */ | 2784 | {0x37, AC_VERB_SET_CONNECT_SEL, 0x00}, /* DAC0:03h */ |
2673 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 2785 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
2674 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | 2786 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
2675 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 2787 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
@@ -2782,11 +2894,11 @@ static inline hda_nid_t ad1988_idx_to_dac(struct hda_codec *codec, int idx) | |||
2782 | { | 2894 | { |
2783 | static const hda_nid_t idx_to_dac[8] = { | 2895 | static const hda_nid_t idx_to_dac[8] = { |
2784 | /* A B C D E F G H */ | 2896 | /* A B C D E F G H */ |
2785 | 0x04, 0x06, 0x05, 0x04, 0x0a, 0x06, 0x05, 0x0a | 2897 | 0x03, 0x06, 0x05, 0x04, 0x0a, 0x06, 0x05, 0x0a |
2786 | }; | 2898 | }; |
2787 | static const hda_nid_t idx_to_dac_rev2[8] = { | 2899 | static const hda_nid_t idx_to_dac_rev2[8] = { |
2788 | /* A B C D E F G H */ | 2900 | /* A B C D E F G H */ |
2789 | 0x04, 0x05, 0x0a, 0x04, 0x06, 0x05, 0x0a, 0x06 | 2901 | 0x03, 0x05, 0x0a, 0x04, 0x06, 0x05, 0x0a, 0x06 |
2790 | }; | 2902 | }; |
2791 | if (is_rev2(codec)) | 2903 | if (is_rev2(codec)) |
2792 | return idx_to_dac_rev2[idx]; | 2904 | return idx_to_dac_rev2[idx]; |
@@ -3023,8 +3135,8 @@ static void ad1988_auto_set_output_and_unmute(struct hda_codec *codec, | |||
3023 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); | 3135 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
3024 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); | 3136 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
3025 | switch (nid) { | 3137 | switch (nid) { |
3026 | case 0x11: /* port-A - DAC 04 */ | 3138 | case 0x11: /* port-A - DAC 03 */ |
3027 | snd_hda_codec_write(codec, 0x37, 0, AC_VERB_SET_CONNECT_SEL, 0x01); | 3139 | snd_hda_codec_write(codec, 0x37, 0, AC_VERB_SET_CONNECT_SEL, 0x00); |
3028 | break; | 3140 | break; |
3029 | case 0x14: /* port-B - DAC 06 */ | 3141 | case 0x14: /* port-B - DAC 06 */ |
3030 | snd_hda_codec_write(codec, 0x30, 0, AC_VERB_SET_CONNECT_SEL, 0x02); | 3142 | snd_hda_codec_write(codec, 0x30, 0, AC_VERB_SET_CONNECT_SEL, 0x02); |
@@ -3150,7 +3262,6 @@ static int ad1988_auto_init(struct hda_codec *codec) | |||
3150 | static const char * const ad1988_models[AD1988_MODEL_LAST] = { | 3262 | static const char * const ad1988_models[AD1988_MODEL_LAST] = { |
3151 | [AD1988_6STACK] = "6stack", | 3263 | [AD1988_6STACK] = "6stack", |
3152 | [AD1988_6STACK_DIG] = "6stack-dig", | 3264 | [AD1988_6STACK_DIG] = "6stack-dig", |
3153 | [AD1988_6STACK_DIG_FP] = "6stack-dig-fp", | ||
3154 | [AD1988_3STACK] = "3stack", | 3265 | [AD1988_3STACK] = "3stack", |
3155 | [AD1988_3STACK_DIG] = "3stack-dig", | 3266 | [AD1988_3STACK_DIG] = "3stack-dig", |
3156 | [AD1988_LAPTOP] = "laptop", | 3267 | [AD1988_LAPTOP] = "laptop", |
@@ -3208,10 +3319,11 @@ static int patch_ad1988(struct hda_codec *codec) | |||
3208 | } | 3319 | } |
3209 | set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); | 3320 | set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); |
3210 | 3321 | ||
3322 | if (!spec->multiout.hp_nid) | ||
3323 | spec->multiout.hp_nid = ad1988_alt_dac_nid[0]; | ||
3211 | switch (board_config) { | 3324 | switch (board_config) { |
3212 | case AD1988_6STACK: | 3325 | case AD1988_6STACK: |
3213 | case AD1988_6STACK_DIG: | 3326 | case AD1988_6STACK_DIG: |
3214 | case AD1988_6STACK_DIG_FP: | ||
3215 | spec->multiout.max_channels = 8; | 3327 | spec->multiout.max_channels = 8; |
3216 | spec->multiout.num_dacs = 4; | 3328 | spec->multiout.num_dacs = 4; |
3217 | if (is_rev2(codec)) | 3329 | if (is_rev2(codec)) |
@@ -3227,19 +3339,7 @@ static int patch_ad1988(struct hda_codec *codec) | |||
3227 | spec->mixers[1] = ad1988_6stack_mixers2; | 3339 | spec->mixers[1] = ad1988_6stack_mixers2; |
3228 | spec->num_init_verbs = 1; | 3340 | spec->num_init_verbs = 1; |
3229 | spec->init_verbs[0] = ad1988_6stack_init_verbs; | 3341 | spec->init_verbs[0] = ad1988_6stack_init_verbs; |
3230 | if (board_config == AD1988_6STACK_DIG_FP) { | 3342 | if (board_config == AD1988_6STACK_DIG) { |
3231 | spec->num_mixers++; | ||
3232 | spec->mixers[2] = ad1988_6stack_fp_mixers; | ||
3233 | spec->num_init_verbs++; | ||
3234 | spec->init_verbs[1] = ad1988_6stack_fp_init_verbs; | ||
3235 | spec->slave_vols = ad1988_6stack_fp_slave_vols; | ||
3236 | spec->slave_sws = ad1988_6stack_fp_slave_sws; | ||
3237 | spec->alt_dac_nid = ad1988_alt_dac_nid; | ||
3238 | spec->stream_analog_alt_playback = | ||
3239 | &ad198x_pcm_analog_alt_playback; | ||
3240 | } | ||
3241 | if ((board_config == AD1988_6STACK_DIG) || | ||
3242 | (board_config == AD1988_6STACK_DIG_FP)) { | ||
3243 | spec->multiout.dig_out_nid = AD1988_SPDIF_OUT; | 3343 | spec->multiout.dig_out_nid = AD1988_SPDIF_OUT; |
3244 | spec->dig_in_nid = AD1988_SPDIF_IN; | 3344 | spec->dig_in_nid = AD1988_SPDIF_IN; |
3245 | } | 3345 | } |
@@ -3282,6 +3382,15 @@ static int patch_ad1988(struct hda_codec *codec) | |||
3282 | break; | 3382 | break; |
3283 | } | 3383 | } |
3284 | 3384 | ||
3385 | if (spec->autocfg.hp_pins[0]) { | ||
3386 | spec->mixers[spec->num_mixers++] = ad1988_hp_mixers; | ||
3387 | spec->slave_vols = ad1988_6stack_fp_slave_vols; | ||
3388 | spec->slave_sws = ad1988_6stack_fp_slave_sws; | ||
3389 | spec->alt_dac_nid = ad1988_alt_dac_nid; | ||
3390 | spec->stream_analog_alt_playback = | ||
3391 | &ad198x_pcm_analog_alt_playback; | ||
3392 | } | ||
3393 | |||
3285 | spec->num_adc_nids = ARRAY_SIZE(ad1988_adc_nids); | 3394 | spec->num_adc_nids = ARRAY_SIZE(ad1988_adc_nids); |
3286 | spec->adc_nids = ad1988_adc_nids; | 3395 | spec->adc_nids = ad1988_adc_nids; |
3287 | spec->capsrc_nids = ad1988_capsrc_nids; | 3396 | spec->capsrc_nids = ad1988_capsrc_nids; |
diff --git a/sound/pci/hda/patch_ca0110.c b/sound/pci/hda/patch_ca0110.c index 6b406840846..993757b6573 100644 --- a/sound/pci/hda/patch_ca0110.c +++ b/sound/pci/hda/patch_ca0110.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/pci.h> | 24 | #include <linux/pci.h> |
25 | #include <linux/module.h> | ||
25 | #include <sound/core.h> | 26 | #include <sound/core.h> |
26 | #include "hda_codec.h" | 27 | #include "hda_codec.h" |
27 | #include "hda_local.h" | 28 | #include "hda_local.h" |
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c index d9a2254ceef..35abe3c6290 100644 --- a/sound/pci/hda/patch_ca0132.c +++ b/sound/pci/hda/patch_ca0132.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/pci.h> | 27 | #include <linux/pci.h> |
28 | #include <linux/mutex.h> | 28 | #include <linux/mutex.h> |
29 | #include <linux/module.h> | ||
29 | #include <sound/core.h> | 30 | #include <sound/core.h> |
30 | #include "hda_codec.h" | 31 | #include "hda_codec.h" |
31 | #include "hda_local.h" | 32 | #include "hda_local.h" |
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index c45f3e69bcf..2a2d8645ba0 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/pci.h> | 24 | #include <linux/pci.h> |
25 | #include <linux/module.h> | ||
25 | #include <sound/core.h> | 26 | #include <sound/core.h> |
26 | #include "hda_codec.h" | 27 | #include "hda_codec.h" |
27 | #include "hda_local.h" | 28 | #include "hda_local.h" |
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c index cd2cf5e94e8..b6767b4ced4 100644 --- a/sound/pci/hda/patch_cmedia.c +++ b/sound/pci/hda/patch_cmedia.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/pci.h> | 27 | #include <linux/pci.h> |
28 | #include <linux/module.h> | ||
28 | #include <sound/core.h> | 29 | #include <sound/core.h> |
29 | #include "hda_codec.h" | 30 | #include "hda_codec.h" |
30 | #include "hda_local.h" | 31 | #include "hda_local.h" |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 76752d8ea73..0de21193a2b 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
27 | #include <linux/module.h> | ||
27 | #include <sound/core.h> | 28 | #include <sound/core.h> |
28 | #include <sound/jack.h> | 29 | #include <sound/jack.h> |
29 | 30 | ||
@@ -136,6 +137,8 @@ struct conexant_spec { | |||
136 | unsigned int thinkpad:1; | 137 | unsigned int thinkpad:1; |
137 | unsigned int hp_laptop:1; | 138 | unsigned int hp_laptop:1; |
138 | unsigned int asus:1; | 139 | unsigned int asus:1; |
140 | unsigned int pin_eapd_ctrls:1; | ||
141 | unsigned int single_adc_amp:1; | ||
139 | 142 | ||
140 | unsigned int adc_switching:1; | 143 | unsigned int adc_switching:1; |
141 | 144 | ||
@@ -1867,39 +1870,6 @@ static const struct hda_verb cxt5051_hp_dv6736_init_verbs[] = { | |||
1867 | { } /* end */ | 1870 | { } /* end */ |
1868 | }; | 1871 | }; |
1869 | 1872 | ||
1870 | static const struct hda_verb cxt5051_lenovo_x200_init_verbs[] = { | ||
1871 | /* Line in, Mic */ | ||
1872 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, | ||
1873 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
1874 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, | ||
1875 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
1876 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
1877 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, | ||
1878 | /* SPK */ | ||
1879 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
1880 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
1881 | /* HP, Amp */ | ||
1882 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
1883 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
1884 | /* Docking HP */ | ||
1885 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
1886 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
1887 | /* DAC1 */ | ||
1888 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
1889 | /* Record selector: Internal mic */ | ||
1890 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x44}, | ||
1891 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1) | 0x44}, | ||
1892 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x44}, | ||
1893 | /* SPDIF route: PCM */ | ||
1894 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* needed for W500 Advanced Mini Dock 250410 */ | ||
1895 | {0x1c, AC_VERB_SET_CONNECT_SEL, 0x0}, | ||
1896 | /* EAPD */ | ||
1897 | {0x1a, AC_VERB_SET_EAPD_BTLENABLE, 0x2}, /* default on */ | ||
1898 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT}, | ||
1899 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT}, | ||
1900 | { } /* end */ | ||
1901 | }; | ||
1902 | |||
1903 | static const struct hda_verb cxt5051_f700_init_verbs[] = { | 1873 | static const struct hda_verb cxt5051_f700_init_verbs[] = { |
1904 | /* Line in, Mic */ | 1874 | /* Line in, Mic */ |
1905 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, | 1875 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, |
@@ -1968,7 +1938,6 @@ enum { | |||
1968 | CXT5051_LAPTOP, /* Laptops w/ EAPD support */ | 1938 | CXT5051_LAPTOP, /* Laptops w/ EAPD support */ |
1969 | CXT5051_HP, /* no docking */ | 1939 | CXT5051_HP, /* no docking */ |
1970 | CXT5051_HP_DV6736, /* HP without mic switch */ | 1940 | CXT5051_HP_DV6736, /* HP without mic switch */ |
1971 | CXT5051_LENOVO_X200, /* Lenovo X200 laptop, also used for Advanced Mini Dock 250410 */ | ||
1972 | CXT5051_F700, /* HP Compaq Presario F700 */ | 1941 | CXT5051_F700, /* HP Compaq Presario F700 */ |
1973 | CXT5051_TOSHIBA, /* Toshiba M300 & co */ | 1942 | CXT5051_TOSHIBA, /* Toshiba M300 & co */ |
1974 | CXT5051_IDEAPAD, /* Lenovo IdeaPad Y430 */ | 1943 | CXT5051_IDEAPAD, /* Lenovo IdeaPad Y430 */ |
@@ -1980,7 +1949,6 @@ static const char *const cxt5051_models[CXT5051_MODELS] = { | |||
1980 | [CXT5051_LAPTOP] = "laptop", | 1949 | [CXT5051_LAPTOP] = "laptop", |
1981 | [CXT5051_HP] = "hp", | 1950 | [CXT5051_HP] = "hp", |
1982 | [CXT5051_HP_DV6736] = "hp-dv6736", | 1951 | [CXT5051_HP_DV6736] = "hp-dv6736", |
1983 | [CXT5051_LENOVO_X200] = "lenovo-x200", | ||
1984 | [CXT5051_F700] = "hp-700", | 1952 | [CXT5051_F700] = "hp-700", |
1985 | [CXT5051_TOSHIBA] = "toshiba", | 1953 | [CXT5051_TOSHIBA] = "toshiba", |
1986 | [CXT5051_IDEAPAD] = "ideapad", | 1954 | [CXT5051_IDEAPAD] = "ideapad", |
@@ -1995,7 +1963,6 @@ static const struct snd_pci_quirk cxt5051_cfg_tbl[] = { | |||
1995 | SND_PCI_QUIRK(0x14f1, 0x0101, "Conexant Reference board", | 1963 | SND_PCI_QUIRK(0x14f1, 0x0101, "Conexant Reference board", |
1996 | CXT5051_LAPTOP), | 1964 | CXT5051_LAPTOP), |
1997 | SND_PCI_QUIRK(0x14f1, 0x5051, "HP Spartan 1.1", CXT5051_HP), | 1965 | SND_PCI_QUIRK(0x14f1, 0x5051, "HP Spartan 1.1", CXT5051_HP), |
1998 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT5051_LENOVO_X200), | ||
1999 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo IdeaPad", CXT5051_IDEAPAD), | 1966 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo IdeaPad", CXT5051_IDEAPAD), |
2000 | {} | 1967 | {} |
2001 | }; | 1968 | }; |
@@ -2053,13 +2020,6 @@ static int patch_cxt5051(struct hda_codec *codec) | |||
2053 | spec->mixers[0] = cxt5051_hp_dv6736_mixers; | 2020 | spec->mixers[0] = cxt5051_hp_dv6736_mixers; |
2054 | spec->auto_mic = 0; | 2021 | spec->auto_mic = 0; |
2055 | break; | 2022 | break; |
2056 | case CXT5051_LENOVO_X200: | ||
2057 | spec->init_verbs[0] = cxt5051_lenovo_x200_init_verbs; | ||
2058 | /* Thinkpad X301 does not have S/PDIF wired and no ability | ||
2059 | to use a docking station. */ | ||
2060 | if (codec->subsystem_id == 0x17aa211f) | ||
2061 | spec->multiout.dig_out_nid = 0; | ||
2062 | break; | ||
2063 | case CXT5051_F700: | 2023 | case CXT5051_F700: |
2064 | spec->init_verbs[0] = cxt5051_f700_init_verbs; | 2024 | spec->init_verbs[0] = cxt5051_f700_init_verbs; |
2065 | spec->mixers[0] = cxt5051_f700_mixers; | 2025 | spec->mixers[0] = cxt5051_f700_mixers; |
@@ -3102,7 +3062,6 @@ static const struct snd_pci_quirk cxt5066_cfg_tbl[] = { | |||
3102 | SND_PCI_QUIRK(0x1043, 0x1993, "Asus U50F", CXT5066_ASUS), | 3062 | SND_PCI_QUIRK(0x1043, 0x1993, "Asus U50F", CXT5066_ASUS), |
3103 | SND_PCI_QUIRK(0x1179, 0xff1e, "Toshiba Satellite C650D", CXT5066_IDEAPAD), | 3063 | SND_PCI_QUIRK(0x1179, 0xff1e, "Toshiba Satellite C650D", CXT5066_IDEAPAD), |
3104 | SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5), | 3064 | SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5), |
3105 | SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5), | ||
3106 | SND_PCI_QUIRK(0x14f1, 0x0101, "Conexant Reference board", | 3065 | SND_PCI_QUIRK(0x14f1, 0x0101, "Conexant Reference board", |
3107 | CXT5066_LAPTOP), | 3066 | CXT5066_LAPTOP), |
3108 | SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT5066_OLPC_XO_1_5), | 3067 | SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT5066_OLPC_XO_1_5), |
@@ -3473,12 +3432,14 @@ static void cx_auto_turn_eapd(struct hda_codec *codec, int num_pins, | |||
3473 | static void do_automute(struct hda_codec *codec, int num_pins, | 3432 | static void do_automute(struct hda_codec *codec, int num_pins, |
3474 | hda_nid_t *pins, bool on) | 3433 | hda_nid_t *pins, bool on) |
3475 | { | 3434 | { |
3435 | struct conexant_spec *spec = codec->spec; | ||
3476 | int i; | 3436 | int i; |
3477 | for (i = 0; i < num_pins; i++) | 3437 | for (i = 0; i < num_pins; i++) |
3478 | snd_hda_codec_write(codec, pins[i], 0, | 3438 | snd_hda_codec_write(codec, pins[i], 0, |
3479 | AC_VERB_SET_PIN_WIDGET_CONTROL, | 3439 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
3480 | on ? PIN_OUT : 0); | 3440 | on ? PIN_OUT : 0); |
3481 | cx_auto_turn_eapd(codec, num_pins, pins, on); | 3441 | if (spec->pin_eapd_ctrls) |
3442 | cx_auto_turn_eapd(codec, num_pins, pins, on); | ||
3482 | } | 3443 | } |
3483 | 3444 | ||
3484 | static int detect_jacks(struct hda_codec *codec, int num_pins, hda_nid_t *pins) | 3445 | static int detect_jacks(struct hda_codec *codec, int num_pins, hda_nid_t *pins) |
@@ -3503,9 +3464,12 @@ static void cx_auto_update_speakers(struct hda_codec *codec) | |||
3503 | int on = 1; | 3464 | int on = 1; |
3504 | 3465 | ||
3505 | /* turn on HP EAPD when HP jacks are present */ | 3466 | /* turn on HP EAPD when HP jacks are present */ |
3506 | if (spec->auto_mute) | 3467 | if (spec->pin_eapd_ctrls) { |
3507 | on = spec->hp_present; | 3468 | if (spec->auto_mute) |
3508 | cx_auto_turn_eapd(codec, cfg->hp_outs, cfg->hp_pins, on); | 3469 | on = spec->hp_present; |
3470 | cx_auto_turn_eapd(codec, cfg->hp_outs, cfg->hp_pins, on); | ||
3471 | } | ||
3472 | |||
3509 | /* mute speakers in auto-mode if HP or LO jacks are plugged */ | 3473 | /* mute speakers in auto-mode if HP or LO jacks are plugged */ |
3510 | if (spec->auto_mute) | 3474 | if (spec->auto_mute) |
3511 | on = !(spec->hp_present || | 3475 | on = !(spec->hp_present || |
@@ -3932,20 +3896,10 @@ static void cx_auto_parse_beep(struct hda_codec *codec) | |||
3932 | #define cx_auto_parse_beep(codec) | 3896 | #define cx_auto_parse_beep(codec) |
3933 | #endif | 3897 | #endif |
3934 | 3898 | ||
3935 | static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums) | 3899 | /* parse EAPDs */ |
3936 | { | ||
3937 | int i; | ||
3938 | for (i = 0; i < nums; i++) | ||
3939 | if (list[i] == nid) | ||
3940 | return true; | ||
3941 | return false; | ||
3942 | } | ||
3943 | |||
3944 | /* parse extra-EAPD that aren't assigned to any pins */ | ||
3945 | static void cx_auto_parse_eapd(struct hda_codec *codec) | 3900 | static void cx_auto_parse_eapd(struct hda_codec *codec) |
3946 | { | 3901 | { |
3947 | struct conexant_spec *spec = codec->spec; | 3902 | struct conexant_spec *spec = codec->spec; |
3948 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
3949 | hda_nid_t nid, end_nid; | 3903 | hda_nid_t nid, end_nid; |
3950 | 3904 | ||
3951 | end_nid = codec->start_nid + codec->num_nodes; | 3905 | end_nid = codec->start_nid + codec->num_nodes; |
@@ -3954,14 +3908,18 @@ static void cx_auto_parse_eapd(struct hda_codec *codec) | |||
3954 | continue; | 3908 | continue; |
3955 | if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)) | 3909 | if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)) |
3956 | continue; | 3910 | continue; |
3957 | if (found_in_nid_list(nid, cfg->line_out_pins, cfg->line_outs) || | ||
3958 | found_in_nid_list(nid, cfg->hp_pins, cfg->hp_outs) || | ||
3959 | found_in_nid_list(nid, cfg->speaker_pins, cfg->speaker_outs)) | ||
3960 | continue; | ||
3961 | spec->eapds[spec->num_eapds++] = nid; | 3911 | spec->eapds[spec->num_eapds++] = nid; |
3962 | if (spec->num_eapds >= ARRAY_SIZE(spec->eapds)) | 3912 | if (spec->num_eapds >= ARRAY_SIZE(spec->eapds)) |
3963 | break; | 3913 | break; |
3964 | } | 3914 | } |
3915 | |||
3916 | /* NOTE: below is a wild guess; if we have more than two EAPDs, | ||
3917 | * it's a new chip, where EAPDs are supposed to be associated to | ||
3918 | * pins, and we can control EAPD per pin. | ||
3919 | * OTOH, if only one or two EAPDs are found, it's an old chip, | ||
3920 | * thus it might control over all pins. | ||
3921 | */ | ||
3922 | spec->pin_eapd_ctrls = spec->num_eapds > 2; | ||
3965 | } | 3923 | } |
3966 | 3924 | ||
3967 | static int cx_auto_parse_auto_config(struct hda_codec *codec) | 3925 | static int cx_auto_parse_auto_config(struct hda_codec *codec) |
@@ -4067,8 +4025,9 @@ static void cx_auto_init_output(struct hda_codec *codec) | |||
4067 | } | 4025 | } |
4068 | } | 4026 | } |
4069 | cx_auto_update_speakers(codec); | 4027 | cx_auto_update_speakers(codec); |
4070 | /* turn on/off extra EAPDs, too */ | 4028 | /* turn on all EAPDs if no individual EAPD control is available */ |
4071 | cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, true); | 4029 | if (!spec->pin_eapd_ctrls) |
4030 | cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, true); | ||
4072 | } | 4031 | } |
4073 | 4032 | ||
4074 | static void cx_auto_init_input(struct hda_codec *codec) | 4033 | static void cx_auto_init_input(struct hda_codec *codec) |
@@ -4255,6 +4214,8 @@ static int cx_auto_add_capture_volume(struct hda_codec *codec, hda_nid_t nid, | |||
4255 | int idx = get_input_connection(codec, adc_nid, nid); | 4214 | int idx = get_input_connection(codec, adc_nid, nid); |
4256 | if (idx < 0) | 4215 | if (idx < 0) |
4257 | continue; | 4216 | continue; |
4217 | if (spec->single_adc_amp) | ||
4218 | idx = 0; | ||
4258 | return cx_auto_add_volume_idx(codec, label, pfx, | 4219 | return cx_auto_add_volume_idx(codec, label, pfx, |
4259 | cidx, adc_nid, HDA_INPUT, idx); | 4220 | cidx, adc_nid, HDA_INPUT, idx); |
4260 | } | 4221 | } |
@@ -4295,14 +4256,21 @@ static int cx_auto_build_input_controls(struct hda_codec *codec) | |||
4295 | struct hda_input_mux *imux = &spec->private_imux; | 4256 | struct hda_input_mux *imux = &spec->private_imux; |
4296 | const char *prev_label; | 4257 | const char *prev_label; |
4297 | int input_conn[HDA_MAX_NUM_INPUTS]; | 4258 | int input_conn[HDA_MAX_NUM_INPUTS]; |
4298 | int i, err, cidx; | 4259 | int i, j, err, cidx; |
4299 | int multi_connection; | 4260 | int multi_connection; |
4300 | 4261 | ||
4262 | if (!imux->num_items) | ||
4263 | return 0; | ||
4264 | |||
4301 | multi_connection = 0; | 4265 | multi_connection = 0; |
4302 | for (i = 0; i < imux->num_items; i++) { | 4266 | for (i = 0; i < imux->num_items; i++) { |
4303 | cidx = get_input_connection(codec, spec->imux_info[i].adc, | 4267 | cidx = get_input_connection(codec, spec->imux_info[i].adc, |
4304 | spec->imux_info[i].pin); | 4268 | spec->imux_info[i].pin); |
4305 | input_conn[i] = (spec->imux_info[i].adc << 8) | cidx; | 4269 | if (cidx < 0) |
4270 | continue; | ||
4271 | input_conn[i] = spec->imux_info[i].adc; | ||
4272 | if (!spec->single_adc_amp) | ||
4273 | input_conn[i] |= cidx << 8; | ||
4306 | if (i > 0 && input_conn[i] != input_conn[0]) | 4274 | if (i > 0 && input_conn[i] != input_conn[0]) |
4307 | multi_connection = 1; | 4275 | multi_connection = 1; |
4308 | } | 4276 | } |
@@ -4331,6 +4299,15 @@ static int cx_auto_build_input_controls(struct hda_codec *codec) | |||
4331 | err = cx_auto_add_capture_volume(codec, nid, | 4299 | err = cx_auto_add_capture_volume(codec, nid, |
4332 | "Capture", "", cidx); | 4300 | "Capture", "", cidx); |
4333 | } else { | 4301 | } else { |
4302 | bool dup_found = false; | ||
4303 | for (j = 0; j < i; j++) { | ||
4304 | if (input_conn[j] == input_conn[i]) { | ||
4305 | dup_found = true; | ||
4306 | break; | ||
4307 | } | ||
4308 | } | ||
4309 | if (dup_found) | ||
4310 | continue; | ||
4334 | err = cx_auto_add_capture_volume(codec, nid, | 4311 | err = cx_auto_add_capture_volume(codec, nid, |
4335 | label, " Capture", cidx); | 4312 | label, " Capture", cidx); |
4336 | } | 4313 | } |
@@ -4394,6 +4371,53 @@ static const struct hda_codec_ops cx_auto_patch_ops = { | |||
4394 | .reboot_notify = snd_hda_shutup_pins, | 4371 | .reboot_notify = snd_hda_shutup_pins, |
4395 | }; | 4372 | }; |
4396 | 4373 | ||
4374 | /* | ||
4375 | * pin fix-up | ||
4376 | */ | ||
4377 | struct cxt_pincfg { | ||
4378 | hda_nid_t nid; | ||
4379 | u32 val; | ||
4380 | }; | ||
4381 | |||
4382 | static void apply_pincfg(struct hda_codec *codec, const struct cxt_pincfg *cfg) | ||
4383 | { | ||
4384 | for (; cfg->nid; cfg++) | ||
4385 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); | ||
4386 | |||
4387 | } | ||
4388 | |||
4389 | static void apply_pin_fixup(struct hda_codec *codec, | ||
4390 | const struct snd_pci_quirk *quirk, | ||
4391 | const struct cxt_pincfg **table) | ||
4392 | { | ||
4393 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); | ||
4394 | if (quirk) { | ||
4395 | snd_printdd(KERN_INFO "hda_codec: applying pincfg for %s\n", | ||
4396 | quirk->name); | ||
4397 | apply_pincfg(codec, table[quirk->value]); | ||
4398 | } | ||
4399 | } | ||
4400 | |||
4401 | enum { | ||
4402 | CXT_PINCFG_LENOVO_X200, | ||
4403 | }; | ||
4404 | |||
4405 | static const struct cxt_pincfg cxt_pincfg_lenovo_x200[] = { | ||
4406 | { 0x16, 0x042140ff }, /* HP (seq# overridden) */ | ||
4407 | { 0x17, 0x21a11000 }, /* dock-mic */ | ||
4408 | { 0x19, 0x2121103f }, /* dock-HP */ | ||
4409 | {} | ||
4410 | }; | ||
4411 | |||
4412 | static const struct cxt_pincfg *cxt_pincfg_tbl[] = { | ||
4413 | [CXT_PINCFG_LENOVO_X200] = cxt_pincfg_lenovo_x200, | ||
4414 | }; | ||
4415 | |||
4416 | static const struct snd_pci_quirk cxt_fixups[] = { | ||
4417 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT_PINCFG_LENOVO_X200), | ||
4418 | {} | ||
4419 | }; | ||
4420 | |||
4397 | static int patch_conexant_auto(struct hda_codec *codec) | 4421 | static int patch_conexant_auto(struct hda_codec *codec) |
4398 | { | 4422 | { |
4399 | struct conexant_spec *spec; | 4423 | struct conexant_spec *spec; |
@@ -4407,6 +4431,15 @@ static int patch_conexant_auto(struct hda_codec *codec) | |||
4407 | return -ENOMEM; | 4431 | return -ENOMEM; |
4408 | codec->spec = spec; | 4432 | codec->spec = spec; |
4409 | codec->pin_amp_workaround = 1; | 4433 | codec->pin_amp_workaround = 1; |
4434 | |||
4435 | switch (codec->vendor_id) { | ||
4436 | case 0x14f15045: | ||
4437 | spec->single_adc_amp = 1; | ||
4438 | break; | ||
4439 | } | ||
4440 | |||
4441 | apply_pin_fixup(codec, cxt_fixups, cxt_pincfg_tbl); | ||
4442 | |||
4410 | err = cx_auto_search_adcs(codec); | 4443 | err = cx_auto_search_adcs(codec); |
4411 | if (err < 0) | 4444 | if (err < 0) |
4412 | return err; | 4445 | return err; |
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 19cb72db9c3..81b7b791b3c 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
32 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <linux/moduleparam.h> | 34 | #include <linux/module.h> |
35 | #include <sound/core.h> | 35 | #include <sound/core.h> |
36 | #include <sound/jack.h> | 36 | #include <sound/jack.h> |
37 | #include "hda_codec.h" | 37 | #include "hda_codec.h" |
@@ -324,6 +324,66 @@ static int cvt_nid_to_cvt_index(struct hdmi_spec *spec, hda_nid_t cvt_nid) | |||
324 | return -EINVAL; | 324 | return -EINVAL; |
325 | } | 325 | } |
326 | 326 | ||
327 | static int hdmi_eld_ctl_info(struct snd_kcontrol *kcontrol, | ||
328 | struct snd_ctl_elem_info *uinfo) | ||
329 | { | ||
330 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
331 | struct hdmi_spec *spec; | ||
332 | int pin_idx; | ||
333 | |||
334 | spec = codec->spec; | ||
335 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; | ||
336 | |||
337 | pin_idx = kcontrol->private_value; | ||
338 | uinfo->count = spec->pins[pin_idx].sink_eld.eld_size; | ||
339 | |||
340 | return 0; | ||
341 | } | ||
342 | |||
343 | static int hdmi_eld_ctl_get(struct snd_kcontrol *kcontrol, | ||
344 | struct snd_ctl_elem_value *ucontrol) | ||
345 | { | ||
346 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
347 | struct hdmi_spec *spec; | ||
348 | int pin_idx; | ||
349 | |||
350 | spec = codec->spec; | ||
351 | pin_idx = kcontrol->private_value; | ||
352 | |||
353 | memcpy(ucontrol->value.bytes.data, | ||
354 | spec->pins[pin_idx].sink_eld.eld_buffer, ELD_MAX_SIZE); | ||
355 | |||
356 | return 0; | ||
357 | } | ||
358 | |||
359 | static struct snd_kcontrol_new eld_bytes_ctl = { | ||
360 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, | ||
361 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | ||
362 | .name = "ELD", | ||
363 | .info = hdmi_eld_ctl_info, | ||
364 | .get = hdmi_eld_ctl_get, | ||
365 | }; | ||
366 | |||
367 | static int hdmi_create_eld_ctl(struct hda_codec *codec, int pin_idx, | ||
368 | int device) | ||
369 | { | ||
370 | struct snd_kcontrol *kctl; | ||
371 | struct hdmi_spec *spec = codec->spec; | ||
372 | int err; | ||
373 | |||
374 | kctl = snd_ctl_new1(&eld_bytes_ctl, codec); | ||
375 | if (!kctl) | ||
376 | return -ENOMEM; | ||
377 | kctl->private_value = pin_idx; | ||
378 | kctl->id.device = device; | ||
379 | |||
380 | err = snd_hda_ctl_add(codec, spec->pins[pin_idx].pin_nid, kctl); | ||
381 | if (err < 0) | ||
382 | return err; | ||
383 | |||
384 | return 0; | ||
385 | } | ||
386 | |||
327 | #ifdef BE_PARANOID | 387 | #ifdef BE_PARANOID |
328 | static void hdmi_get_dip_index(struct hda_codec *codec, hda_nid_t pin_nid, | 388 | static void hdmi_get_dip_index(struct hda_codec *codec, hda_nid_t pin_nid, |
329 | int *packet_index, int *byte_index) | 389 | int *packet_index, int *byte_index) |
@@ -946,7 +1006,6 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) | |||
946 | unsigned int caps, config; | 1006 | unsigned int caps, config; |
947 | int pin_idx; | 1007 | int pin_idx; |
948 | struct hdmi_spec_per_pin *per_pin; | 1008 | struct hdmi_spec_per_pin *per_pin; |
949 | struct hdmi_eld *eld; | ||
950 | int err; | 1009 | int err; |
951 | 1010 | ||
952 | caps = snd_hda_param_read(codec, pin_nid, AC_PAR_PIN_CAP); | 1011 | caps = snd_hda_param_read(codec, pin_nid, AC_PAR_PIN_CAP); |
@@ -963,23 +1022,15 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) | |||
963 | 1022 | ||
964 | pin_idx = spec->num_pins; | 1023 | pin_idx = spec->num_pins; |
965 | per_pin = &spec->pins[pin_idx]; | 1024 | per_pin = &spec->pins[pin_idx]; |
966 | eld = &per_pin->sink_eld; | ||
967 | 1025 | ||
968 | per_pin->pin_nid = pin_nid; | 1026 | per_pin->pin_nid = pin_nid; |
969 | 1027 | ||
970 | err = snd_hda_input_jack_add(codec, pin_nid, | ||
971 | SND_JACK_VIDEOOUT, NULL); | ||
972 | if (err < 0) | ||
973 | return err; | ||
974 | |||
975 | err = hdmi_read_pin_conn(codec, pin_idx); | 1028 | err = hdmi_read_pin_conn(codec, pin_idx); |
976 | if (err < 0) | 1029 | if (err < 0) |
977 | return err; | 1030 | return err; |
978 | 1031 | ||
979 | spec->num_pins++; | 1032 | spec->num_pins++; |
980 | 1033 | ||
981 | hdmi_present_sense(codec, pin_nid, eld); | ||
982 | |||
983 | return 0; | 1034 | return 0; |
984 | } | 1035 | } |
985 | 1036 | ||
@@ -1162,6 +1213,25 @@ static int generic_hdmi_build_pcms(struct hda_codec *codec) | |||
1162 | return 0; | 1213 | return 0; |
1163 | } | 1214 | } |
1164 | 1215 | ||
1216 | static int generic_hdmi_build_jack(struct hda_codec *codec, int pin_idx) | ||
1217 | { | ||
1218 | int err; | ||
1219 | char hdmi_str[32]; | ||
1220 | struct hdmi_spec *spec = codec->spec; | ||
1221 | struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx]; | ||
1222 | int pcmdev = spec->pcm_rec[pin_idx].device; | ||
1223 | |||
1224 | snprintf(hdmi_str, sizeof(hdmi_str), "HDMI/DP,pcm=%d", pcmdev); | ||
1225 | |||
1226 | err = snd_hda_input_jack_add(codec, per_pin->pin_nid, | ||
1227 | SND_JACK_VIDEOOUT, pcmdev > 0 ? hdmi_str : NULL); | ||
1228 | if (err < 0) | ||
1229 | return err; | ||
1230 | |||
1231 | hdmi_present_sense(codec, per_pin->pin_nid, &per_pin->sink_eld); | ||
1232 | return 0; | ||
1233 | } | ||
1234 | |||
1165 | static int generic_hdmi_build_controls(struct hda_codec *codec) | 1235 | static int generic_hdmi_build_controls(struct hda_codec *codec) |
1166 | { | 1236 | { |
1167 | struct hdmi_spec *spec = codec->spec; | 1237 | struct hdmi_spec *spec = codec->spec; |
@@ -1170,12 +1240,25 @@ static int generic_hdmi_build_controls(struct hda_codec *codec) | |||
1170 | 1240 | ||
1171 | for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { | 1241 | for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { |
1172 | struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx]; | 1242 | struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx]; |
1243 | |||
1244 | err = generic_hdmi_build_jack(codec, pin_idx); | ||
1245 | if (err < 0) | ||
1246 | return err; | ||
1247 | |||
1173 | err = snd_hda_create_spdif_out_ctls(codec, | 1248 | err = snd_hda_create_spdif_out_ctls(codec, |
1174 | per_pin->pin_nid, | 1249 | per_pin->pin_nid, |
1175 | per_pin->mux_nids[0]); | 1250 | per_pin->mux_nids[0]); |
1176 | if (err < 0) | 1251 | if (err < 0) |
1177 | return err; | 1252 | return err; |
1178 | snd_hda_spdif_ctls_unassign(codec, pin_idx); | 1253 | snd_hda_spdif_ctls_unassign(codec, pin_idx); |
1254 | |||
1255 | /* add control for ELD Bytes */ | ||
1256 | err = hdmi_create_eld_ctl(codec, | ||
1257 | pin_idx, | ||
1258 | spec->pcm_rec[pin_idx].device); | ||
1259 | |||
1260 | if (err < 0) | ||
1261 | return err; | ||
1179 | } | 1262 | } |
1180 | 1263 | ||
1181 | return 0; | 1264 | return 0; |
@@ -1491,7 +1574,7 @@ static int nvhdmi_8ch_7x_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
1491 | struct snd_pcm_substream *substream) | 1574 | struct snd_pcm_substream *substream) |
1492 | { | 1575 | { |
1493 | int chs; | 1576 | int chs; |
1494 | unsigned int dataDCC1, dataDCC2, channel_id; | 1577 | unsigned int dataDCC2, channel_id; |
1495 | int i; | 1578 | int i; |
1496 | struct hdmi_spec *spec = codec->spec; | 1579 | struct hdmi_spec *spec = codec->spec; |
1497 | struct hda_spdif_out *spdif = | 1580 | struct hda_spdif_out *spdif = |
@@ -1501,7 +1584,6 @@ static int nvhdmi_8ch_7x_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
1501 | 1584 | ||
1502 | chs = substream->runtime->channels; | 1585 | chs = substream->runtime->channels; |
1503 | 1586 | ||
1504 | dataDCC1 = AC_DIG1_ENABLE | AC_DIG1_COPYRIGHT; | ||
1505 | dataDCC2 = 0x2; | 1587 | dataDCC2 = 0x2; |
1506 | 1588 | ||
1507 | /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */ | 1589 | /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */ |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 7a73621a890..308bb575bc0 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/pci.h> | 29 | #include <linux/pci.h> |
30 | #include <linux/module.h> | ||
30 | #include <sound/core.h> | 31 | #include <sound/core.h> |
31 | #include <sound/jack.h> | 32 | #include <sound/jack.h> |
32 | #include "hda_codec.h" | 33 | #include "hda_codec.h" |
@@ -116,6 +117,8 @@ struct alc_spec { | |||
116 | const hda_nid_t *capsrc_nids; | 117 | const hda_nid_t *capsrc_nids; |
117 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ | 118 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
118 | hda_nid_t mixer_nid; /* analog-mixer NID */ | 119 | hda_nid_t mixer_nid; /* analog-mixer NID */ |
120 | DECLARE_BITMAP(vol_ctls, 0x20 << 1); | ||
121 | DECLARE_BITMAP(sw_ctls, 0x20 << 1); | ||
119 | 122 | ||
120 | /* capture setup for dynamic dual-adc switch */ | 123 | /* capture setup for dynamic dual-adc switch */ |
121 | hda_nid_t cur_adc; | 124 | hda_nid_t cur_adc; |
@@ -159,23 +162,27 @@ struct alc_spec { | |||
159 | void (*power_hook)(struct hda_codec *codec); | 162 | void (*power_hook)(struct hda_codec *codec); |
160 | #endif | 163 | #endif |
161 | void (*shutup)(struct hda_codec *codec); | 164 | void (*shutup)(struct hda_codec *codec); |
165 | void (*automute_hook)(struct hda_codec *codec); | ||
162 | 166 | ||
163 | /* for pin sensing */ | 167 | /* for pin sensing */ |
164 | unsigned int jack_present: 1; | 168 | unsigned int hp_jack_present:1; |
165 | unsigned int line_jack_present:1; | 169 | unsigned int line_jack_present:1; |
166 | unsigned int master_mute:1; | 170 | unsigned int master_mute:1; |
167 | unsigned int auto_mic:1; | 171 | unsigned int auto_mic:1; |
168 | unsigned int auto_mic_valid_imux:1; /* valid imux for auto-mic */ | 172 | unsigned int auto_mic_valid_imux:1; /* valid imux for auto-mic */ |
169 | unsigned int automute:1; /* HP automute enabled */ | 173 | unsigned int automute_speaker:1; /* automute speaker outputs */ |
170 | unsigned int detect_line:1; /* Line-out detection enabled */ | 174 | unsigned int automute_lo:1; /* automute LO outputs */ |
171 | unsigned int automute_lines:1; /* automute line-out as well; NOP when automute_hp_lo isn't set */ | 175 | unsigned int detect_hp:1; /* Headphone detection enabled */ |
172 | unsigned int automute_hp_lo:1; /* both HP and LO available */ | 176 | unsigned int detect_lo:1; /* Line-out detection enabled */ |
177 | unsigned int automute_speaker_possible:1; /* there are speakers and either LO or HP */ | ||
178 | unsigned int automute_lo_possible:1; /* there are line outs and HP */ | ||
173 | 179 | ||
174 | /* other flags */ | 180 | /* other flags */ |
175 | unsigned int no_analog :1; /* digital I/O only */ | 181 | unsigned int no_analog :1; /* digital I/O only */ |
176 | unsigned int dyn_adc_switch:1; /* switch ADCs (for ALC275) */ | 182 | unsigned int dyn_adc_switch:1; /* switch ADCs (for ALC275) */ |
177 | unsigned int single_input_src:1; | 183 | unsigned int single_input_src:1; |
178 | unsigned int vol_in_capsrc:1; /* use capsrc volume (ADC has no vol) */ | 184 | 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() */ | ||
179 | 186 | ||
180 | /* auto-mute control */ | 187 | /* auto-mute control */ |
181 | int automute_mode; | 188 | int automute_mode; |
@@ -193,6 +200,7 @@ struct alc_spec { | |||
193 | /* for PLL fix */ | 200 | /* for PLL fix */ |
194 | hda_nid_t pll_nid; | 201 | hda_nid_t pll_nid; |
195 | unsigned int pll_coef_idx, pll_coef_bit; | 202 | unsigned int pll_coef_idx, pll_coef_bit; |
203 | unsigned int coef0; | ||
196 | 204 | ||
197 | /* fix-up list */ | 205 | /* fix-up list */ |
198 | int fixup_id; | 206 | int fixup_id; |
@@ -202,6 +210,9 @@ struct alc_spec { | |||
202 | /* multi-io */ | 210 | /* multi-io */ |
203 | int multi_ios; | 211 | int multi_ios; |
204 | struct alc_multi_io multi_io[4]; | 212 | struct alc_multi_io multi_io[4]; |
213 | |||
214 | /* bind volumes */ | ||
215 | struct snd_array bind_ctls; | ||
205 | }; | 216 | }; |
206 | 217 | ||
207 | #define ALC_MODEL_AUTO 0 /* common for all chips */ | 218 | #define ALC_MODEL_AUTO 0 /* common for all chips */ |
@@ -273,7 +284,7 @@ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, | |||
273 | struct alc_spec *spec = codec->spec; | 284 | struct alc_spec *spec = codec->spec; |
274 | const struct hda_input_mux *imux; | 285 | const struct hda_input_mux *imux; |
275 | unsigned int mux_idx; | 286 | unsigned int mux_idx; |
276 | int i, type; | 287 | int i, type, num_conns; |
277 | hda_nid_t nid; | 288 | hda_nid_t nid; |
278 | 289 | ||
279 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; | 290 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
@@ -296,16 +307,17 @@ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, | |||
296 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; | 307 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
297 | 308 | ||
298 | /* no selection? */ | 309 | /* no selection? */ |
299 | if (snd_hda_get_conn_list(codec, nid, NULL) <= 1) | 310 | num_conns = snd_hda_get_conn_list(codec, nid, NULL); |
311 | if (num_conns <= 1) | ||
300 | return 1; | 312 | return 1; |
301 | 313 | ||
302 | type = get_wcaps_type(get_wcaps(codec, nid)); | 314 | type = get_wcaps_type(get_wcaps(codec, nid)); |
303 | if (type == AC_WID_AUD_MIX) { | 315 | if (type == AC_WID_AUD_MIX) { |
304 | /* Matrix-mixer style (e.g. ALC882) */ | 316 | /* Matrix-mixer style (e.g. ALC882) */ |
305 | for (i = 0; i < imux->num_items; i++) { | 317 | int active = imux->items[idx].index; |
306 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; | 318 | for (i = 0; i < num_conns; i++) { |
307 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, | 319 | unsigned int v = (i == active) ? 0 : HDA_AMP_MUTE; |
308 | imux->items[i].index, | 320 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, i, |
309 | HDA_AMP_MUTE, v); | 321 | HDA_AMP_MUTE, v); |
310 | } | 322 | } |
311 | } else { | 323 | } else { |
@@ -525,8 +537,8 @@ static void do_automute(struct hda_codec *codec, int num_pins, hda_nid_t *pins, | |||
525 | } | 537 | } |
526 | } | 538 | } |
527 | 539 | ||
528 | /* Toggle internal speakers muting */ | 540 | /* Toggle outputs muting */ |
529 | static void update_speakers(struct hda_codec *codec) | 541 | static void update_outputs(struct hda_codec *codec) |
530 | { | 542 | { |
531 | struct alc_spec *spec = codec->spec; | 543 | struct alc_spec *spec = codec->spec; |
532 | int on; | 544 | int on; |
@@ -538,10 +550,10 @@ static void update_speakers(struct hda_codec *codec) | |||
538 | do_automute(codec, ARRAY_SIZE(spec->autocfg.hp_pins), | 550 | do_automute(codec, ARRAY_SIZE(spec->autocfg.hp_pins), |
539 | spec->autocfg.hp_pins, spec->master_mute, true); | 551 | spec->autocfg.hp_pins, spec->master_mute, true); |
540 | 552 | ||
541 | if (!spec->automute) | 553 | if (!spec->automute_speaker) |
542 | on = 0; | 554 | on = 0; |
543 | else | 555 | else |
544 | on = spec->jack_present | spec->line_jack_present; | 556 | on = spec->hp_jack_present | spec->line_jack_present; |
545 | on |= spec->master_mute; | 557 | on |= spec->master_mute; |
546 | do_automute(codec, ARRAY_SIZE(spec->autocfg.speaker_pins), | 558 | do_automute(codec, ARRAY_SIZE(spec->autocfg.speaker_pins), |
547 | spec->autocfg.speaker_pins, on, false); | 559 | spec->autocfg.speaker_pins, on, false); |
@@ -551,26 +563,35 @@ static void update_speakers(struct hda_codec *codec) | |||
551 | if (spec->autocfg.line_out_pins[0] == spec->autocfg.hp_pins[0] || | 563 | if (spec->autocfg.line_out_pins[0] == spec->autocfg.hp_pins[0] || |
552 | spec->autocfg.line_out_pins[0] == spec->autocfg.speaker_pins[0]) | 564 | spec->autocfg.line_out_pins[0] == spec->autocfg.speaker_pins[0]) |
553 | return; | 565 | return; |
554 | if (!spec->automute || (spec->automute_hp_lo && !spec->automute_lines)) | 566 | if (!spec->automute_lo) |
555 | on = 0; | 567 | on = 0; |
556 | else | 568 | else |
557 | on = spec->jack_present; | 569 | on = spec->hp_jack_present; |
558 | on |= spec->master_mute; | 570 | on |= spec->master_mute; |
559 | do_automute(codec, ARRAY_SIZE(spec->autocfg.line_out_pins), | 571 | do_automute(codec, ARRAY_SIZE(spec->autocfg.line_out_pins), |
560 | spec->autocfg.line_out_pins, on, false); | 572 | spec->autocfg.line_out_pins, on, false); |
561 | } | 573 | } |
562 | 574 | ||
575 | static void call_update_outputs(struct hda_codec *codec) | ||
576 | { | ||
577 | struct alc_spec *spec = codec->spec; | ||
578 | if (spec->automute_hook) | ||
579 | spec->automute_hook(codec); | ||
580 | else | ||
581 | update_outputs(codec); | ||
582 | } | ||
583 | |||
563 | /* standard HP-automute helper */ | 584 | /* standard HP-automute helper */ |
564 | static void alc_hp_automute(struct hda_codec *codec) | 585 | static void alc_hp_automute(struct hda_codec *codec) |
565 | { | 586 | { |
566 | struct alc_spec *spec = codec->spec; | 587 | struct alc_spec *spec = codec->spec; |
567 | 588 | ||
568 | spec->jack_present = | 589 | spec->hp_jack_present = |
569 | detect_jacks(codec, ARRAY_SIZE(spec->autocfg.hp_pins), | 590 | detect_jacks(codec, ARRAY_SIZE(spec->autocfg.hp_pins), |
570 | spec->autocfg.hp_pins); | 591 | spec->autocfg.hp_pins); |
571 | if (!spec->automute) | 592 | if (!spec->detect_hp || (!spec->automute_speaker && !spec->automute_lo)) |
572 | return; | 593 | return; |
573 | update_speakers(codec); | 594 | call_update_outputs(codec); |
574 | } | 595 | } |
575 | 596 | ||
576 | /* standard line-out-automute helper */ | 597 | /* standard line-out-automute helper */ |
@@ -585,9 +606,9 @@ static void alc_line_automute(struct hda_codec *codec) | |||
585 | spec->line_jack_present = | 606 | spec->line_jack_present = |
586 | detect_jacks(codec, ARRAY_SIZE(spec->autocfg.line_out_pins), | 607 | detect_jacks(codec, ARRAY_SIZE(spec->autocfg.line_out_pins), |
587 | spec->autocfg.line_out_pins); | 608 | spec->autocfg.line_out_pins); |
588 | if (!spec->automute || !spec->detect_line) | 609 | if (!spec->automute_speaker || !spec->detect_lo) |
589 | return; | 610 | return; |
590 | update_speakers(codec); | 611 | call_update_outputs(codec); |
591 | } | 612 | } |
592 | 613 | ||
593 | #define get_connection_index(codec, mux, nid) \ | 614 | #define get_connection_index(codec, mux, nid) \ |
@@ -785,7 +806,7 @@ static int alc_automute_mode_info(struct snd_kcontrol *kcontrol, | |||
785 | 806 | ||
786 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 807 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
787 | uinfo->count = 1; | 808 | uinfo->count = 1; |
788 | if (spec->automute_hp_lo) { | 809 | if (spec->automute_speaker_possible && spec->automute_lo_possible) { |
789 | uinfo->value.enumerated.items = 3; | 810 | uinfo->value.enumerated.items = 3; |
790 | texts = texts3; | 811 | texts = texts3; |
791 | } else { | 812 | } else { |
@@ -804,13 +825,12 @@ static int alc_automute_mode_get(struct snd_kcontrol *kcontrol, | |||
804 | { | 825 | { |
805 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 826 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
806 | struct alc_spec *spec = codec->spec; | 827 | struct alc_spec *spec = codec->spec; |
807 | unsigned int val; | 828 | unsigned int val = 0; |
808 | if (!spec->automute) | 829 | if (spec->automute_speaker) |
809 | val = 0; | 830 | val++; |
810 | else if (!spec->automute_hp_lo || !spec->automute_lines) | 831 | if (spec->automute_lo) |
811 | val = 1; | 832 | val++; |
812 | else | 833 | |
813 | val = 2; | ||
814 | ucontrol->value.enumerated.item[0] = val; | 834 | ucontrol->value.enumerated.item[0] = val; |
815 | return 0; | 835 | return 0; |
816 | } | 836 | } |
@@ -823,29 +843,36 @@ static int alc_automute_mode_put(struct snd_kcontrol *kcontrol, | |||
823 | 843 | ||
824 | switch (ucontrol->value.enumerated.item[0]) { | 844 | switch (ucontrol->value.enumerated.item[0]) { |
825 | case 0: | 845 | case 0: |
826 | if (!spec->automute) | 846 | if (!spec->automute_speaker && !spec->automute_lo) |
827 | return 0; | 847 | return 0; |
828 | spec->automute = 0; | 848 | spec->automute_speaker = 0; |
849 | spec->automute_lo = 0; | ||
829 | break; | 850 | break; |
830 | case 1: | 851 | case 1: |
831 | if (spec->automute && | 852 | if (spec->automute_speaker_possible) { |
832 | (!spec->automute_hp_lo || !spec->automute_lines)) | 853 | if (!spec->automute_lo && spec->automute_speaker) |
833 | return 0; | 854 | return 0; |
834 | spec->automute = 1; | 855 | spec->automute_speaker = 1; |
835 | spec->automute_lines = 0; | 856 | spec->automute_lo = 0; |
857 | } else if (spec->automute_lo_possible) { | ||
858 | if (spec->automute_lo) | ||
859 | return 0; | ||
860 | spec->automute_lo = 1; | ||
861 | } else | ||
862 | return -EINVAL; | ||
836 | break; | 863 | break; |
837 | case 2: | 864 | case 2: |
838 | if (!spec->automute_hp_lo) | 865 | if (!spec->automute_lo_possible || !spec->automute_speaker_possible) |
839 | return -EINVAL; | 866 | return -EINVAL; |
840 | if (spec->automute && spec->automute_lines) | 867 | if (spec->automute_speaker && spec->automute_lo) |
841 | return 0; | 868 | return 0; |
842 | spec->automute = 1; | 869 | spec->automute_speaker = 1; |
843 | spec->automute_lines = 1; | 870 | spec->automute_lo = 1; |
844 | break; | 871 | break; |
845 | default: | 872 | default: |
846 | return -EINVAL; | 873 | return -EINVAL; |
847 | } | 874 | } |
848 | update_speakers(codec); | 875 | call_update_outputs(codec); |
849 | return 1; | 876 | return 1; |
850 | } | 877 | } |
851 | 878 | ||
@@ -882,7 +909,7 @@ static int alc_add_automute_mode_enum(struct hda_codec *codec) | |||
882 | * Check the availability of HP/line-out auto-mute; | 909 | * Check the availability of HP/line-out auto-mute; |
883 | * Set up appropriately if really supported | 910 | * Set up appropriately if really supported |
884 | */ | 911 | */ |
885 | static void alc_init_auto_hp(struct hda_codec *codec) | 912 | static void alc_init_automute(struct hda_codec *codec) |
886 | { | 913 | { |
887 | struct alc_spec *spec = codec->spec; | 914 | struct alc_spec *spec = codec->spec; |
888 | struct auto_pin_cfg *cfg = &spec->autocfg; | 915 | struct auto_pin_cfg *cfg = &spec->autocfg; |
@@ -897,8 +924,6 @@ static void alc_init_auto_hp(struct hda_codec *codec) | |||
897 | present++; | 924 | present++; |
898 | if (present < 2) /* need two different output types */ | 925 | if (present < 2) /* need two different output types */ |
899 | return; | 926 | return; |
900 | if (present == 3) | ||
901 | spec->automute_hp_lo = 1; /* both HP and LO automute */ | ||
902 | 927 | ||
903 | if (!cfg->speaker_pins[0] && | 928 | if (!cfg->speaker_pins[0] && |
904 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { | 929 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
@@ -914,6 +939,8 @@ static void alc_init_auto_hp(struct hda_codec *codec) | |||
914 | cfg->hp_outs = cfg->line_outs; | 939 | cfg->hp_outs = cfg->line_outs; |
915 | } | 940 | } |
916 | 941 | ||
942 | spec->automute_mode = ALC_AUTOMUTE_PIN; | ||
943 | |||
917 | for (i = 0; i < cfg->hp_outs; i++) { | 944 | for (i = 0; i < cfg->hp_outs; i++) { |
918 | hda_nid_t nid = cfg->hp_pins[i]; | 945 | hda_nid_t nid = cfg->hp_pins[i]; |
919 | if (!is_jack_detectable(codec, nid)) | 946 | if (!is_jack_detectable(codec, nid)) |
@@ -923,28 +950,32 @@ static void alc_init_auto_hp(struct hda_codec *codec) | |||
923 | snd_hda_codec_write_cache(codec, nid, 0, | 950 | snd_hda_codec_write_cache(codec, nid, 0, |
924 | AC_VERB_SET_UNSOLICITED_ENABLE, | 951 | AC_VERB_SET_UNSOLICITED_ENABLE, |
925 | AC_USRSP_EN | ALC_HP_EVENT); | 952 | AC_USRSP_EN | ALC_HP_EVENT); |
926 | spec->automute = 1; | 953 | spec->detect_hp = 1; |
927 | spec->automute_mode = ALC_AUTOMUTE_PIN; | 954 | } |
928 | } | 955 | |
929 | if (spec->automute && cfg->line_out_pins[0] && | 956 | if (cfg->line_out_type == AUTO_PIN_LINE_OUT && cfg->line_outs) { |
930 | cfg->speaker_pins[0] && | 957 | if (cfg->speaker_outs) |
931 | cfg->line_out_pins[0] != cfg->hp_pins[0] && | 958 | for (i = 0; i < cfg->line_outs; i++) { |
932 | cfg->line_out_pins[0] != cfg->speaker_pins[0]) { | 959 | hda_nid_t nid = cfg->line_out_pins[i]; |
933 | for (i = 0; i < cfg->line_outs; i++) { | 960 | if (!is_jack_detectable(codec, nid)) |
934 | hda_nid_t nid = cfg->line_out_pins[i]; | 961 | continue; |
935 | if (!is_jack_detectable(codec, nid)) | 962 | snd_printdd("realtek: Enable Line-Out " |
936 | continue; | 963 | "auto-muting on NID 0x%x\n", nid); |
937 | snd_printdd("realtek: Enable Line-Out auto-muting " | 964 | snd_hda_codec_write_cache(codec, nid, 0, |
938 | "on NID 0x%x\n", nid); | 965 | AC_VERB_SET_UNSOLICITED_ENABLE, |
939 | snd_hda_codec_write_cache(codec, nid, 0, | 966 | AC_USRSP_EN | ALC_FRONT_EVENT); |
940 | AC_VERB_SET_UNSOLICITED_ENABLE, | 967 | spec->detect_lo = 1; |
941 | AC_USRSP_EN | ALC_FRONT_EVENT); | ||
942 | spec->detect_line = 1; | ||
943 | } | 968 | } |
944 | spec->automute_lines = spec->detect_line; | 969 | spec->automute_lo_possible = spec->detect_hp; |
945 | } | 970 | } |
946 | 971 | ||
947 | if (spec->automute) { | 972 | spec->automute_speaker_possible = cfg->speaker_outs && |
973 | (spec->detect_hp || spec->detect_lo); | ||
974 | |||
975 | spec->automute_lo = spec->automute_lo_possible; | ||
976 | spec->automute_speaker = spec->automute_speaker_possible; | ||
977 | |||
978 | if (spec->automute_speaker_possible || spec->automute_lo_possible) { | ||
948 | /* create a control for automute mode */ | 979 | /* create a control for automute mode */ |
949 | alc_add_automute_mode_enum(codec); | 980 | alc_add_automute_mode_enum(codec); |
950 | spec->unsol_event = alc_sku_unsol_event; | 981 | spec->unsol_event = alc_sku_unsol_event; |
@@ -1145,7 +1176,7 @@ static void alc_init_auto_mic(struct hda_codec *codec) | |||
1145 | /* check the availabilities of auto-mute and auto-mic switches */ | 1176 | /* check the availabilities of auto-mute and auto-mic switches */ |
1146 | static void alc_auto_check_switches(struct hda_codec *codec) | 1177 | static void alc_auto_check_switches(struct hda_codec *codec) |
1147 | { | 1178 | { |
1148 | alc_init_auto_hp(codec); | 1179 | alc_init_automute(codec); |
1149 | alc_init_auto_mic(codec); | 1180 | alc_init_auto_mic(codec); |
1150 | } | 1181 | } |
1151 | 1182 | ||
@@ -1528,6 +1559,15 @@ static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx, | |||
1528 | coef_val); | 1559 | coef_val); |
1529 | } | 1560 | } |
1530 | 1561 | ||
1562 | /* a special bypass for COEF 0; read the cached value at the second time */ | ||
1563 | static unsigned int alc_get_coef0(struct hda_codec *codec) | ||
1564 | { | ||
1565 | struct alc_spec *spec = codec->spec; | ||
1566 | if (!spec->coef0) | ||
1567 | spec->coef0 = alc_read_coef_idx(codec, 0); | ||
1568 | return spec->coef0; | ||
1569 | } | ||
1570 | |||
1531 | /* | 1571 | /* |
1532 | * Digital I/O handling | 1572 | * Digital I/O handling |
1533 | */ | 1573 | */ |
@@ -1566,27 +1606,29 @@ static void alc_auto_init_digital(struct hda_codec *codec) | |||
1566 | static void alc_auto_parse_digital(struct hda_codec *codec) | 1606 | static void alc_auto_parse_digital(struct hda_codec *codec) |
1567 | { | 1607 | { |
1568 | struct alc_spec *spec = codec->spec; | 1608 | struct alc_spec *spec = codec->spec; |
1569 | int i, err; | 1609 | int i, err, nums; |
1570 | hda_nid_t dig_nid; | 1610 | hda_nid_t dig_nid; |
1571 | 1611 | ||
1572 | /* support multiple SPDIFs; the secondary is set up as a slave */ | 1612 | /* support multiple SPDIFs; the secondary is set up as a slave */ |
1613 | nums = 0; | ||
1573 | for (i = 0; i < spec->autocfg.dig_outs; i++) { | 1614 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
1574 | hda_nid_t conn[4]; | 1615 | hda_nid_t conn[4]; |
1575 | err = snd_hda_get_connections(codec, | 1616 | err = snd_hda_get_connections(codec, |
1576 | spec->autocfg.dig_out_pins[i], | 1617 | spec->autocfg.dig_out_pins[i], |
1577 | conn, ARRAY_SIZE(conn)); | 1618 | conn, ARRAY_SIZE(conn)); |
1578 | if (err < 0) | 1619 | if (err <= 0) |
1579 | continue; | 1620 | continue; |
1580 | dig_nid = conn[0]; /* assume the first element is audio-out */ | 1621 | dig_nid = conn[0]; /* assume the first element is audio-out */ |
1581 | if (!i) { | 1622 | if (!nums) { |
1582 | spec->multiout.dig_out_nid = dig_nid; | 1623 | spec->multiout.dig_out_nid = dig_nid; |
1583 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; | 1624 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
1584 | } else { | 1625 | } else { |
1585 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; | 1626 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
1586 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) | 1627 | if (nums >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
1587 | break; | 1628 | break; |
1588 | spec->slave_dig_outs[i - 1] = dig_nid; | 1629 | spec->slave_dig_outs[nums - 1] = dig_nid; |
1589 | } | 1630 | } |
1631 | nums++; | ||
1590 | } | 1632 | } |
1591 | 1633 | ||
1592 | if (spec->autocfg.dig_in_pin) { | 1634 | if (spec->autocfg.dig_in_pin) { |
@@ -2232,6 +2274,7 @@ static int alc_build_pcms(struct hda_codec *codec) | |||
2232 | struct alc_spec *spec = codec->spec; | 2274 | struct alc_spec *spec = codec->spec; |
2233 | struct hda_pcm *info = spec->pcm_rec; | 2275 | struct hda_pcm *info = spec->pcm_rec; |
2234 | const struct hda_pcm_stream *p; | 2276 | const struct hda_pcm_stream *p; |
2277 | bool have_multi_adcs; | ||
2235 | int i; | 2278 | int i; |
2236 | 2279 | ||
2237 | codec->num_pcms = 1; | 2280 | codec->num_pcms = 1; |
@@ -2310,8 +2353,11 @@ static int alc_build_pcms(struct hda_codec *codec) | |||
2310 | /* If the use of more than one ADC is requested for the current | 2353 | /* If the use of more than one ADC is requested for the current |
2311 | * model, configure a second analog capture-only PCM. | 2354 | * model, configure a second analog capture-only PCM. |
2312 | */ | 2355 | */ |
2356 | have_multi_adcs = (spec->num_adc_nids > 1) && | ||
2357 | !spec->dyn_adc_switch && !spec->auto_mic && | ||
2358 | (!spec->input_mux || spec->input_mux->num_items > 1); | ||
2313 | /* Additional Analaog capture for index #2 */ | 2359 | /* Additional Analaog capture for index #2 */ |
2314 | if (spec->alt_dac_nid || spec->num_adc_nids > 1) { | 2360 | if (spec->alt_dac_nid || have_multi_adcs) { |
2315 | codec->num_pcms = 3; | 2361 | codec->num_pcms = 3; |
2316 | info = spec->pcm_rec + 2; | 2362 | info = spec->pcm_rec + 2; |
2317 | info->name = spec->stream_name_analog; | 2363 | info->name = spec->stream_name_analog; |
@@ -2327,7 +2373,7 @@ static int alc_build_pcms(struct hda_codec *codec) | |||
2327 | alc_pcm_null_stream; | 2373 | alc_pcm_null_stream; |
2328 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; | 2374 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
2329 | } | 2375 | } |
2330 | if (spec->num_adc_nids > 1) { | 2376 | if (have_multi_adcs) { |
2331 | p = spec->stream_analog_alt_capture; | 2377 | p = spec->stream_analog_alt_capture; |
2332 | if (!p) | 2378 | if (!p) |
2333 | p = &alc_pcm_analog_alt_capture; | 2379 | p = &alc_pcm_analog_alt_capture; |
@@ -2368,6 +2414,18 @@ static void alc_free_kctls(struct hda_codec *codec) | |||
2368 | snd_array_free(&spec->kctls); | 2414 | snd_array_free(&spec->kctls); |
2369 | } | 2415 | } |
2370 | 2416 | ||
2417 | static void alc_free_bind_ctls(struct hda_codec *codec) | ||
2418 | { | ||
2419 | struct alc_spec *spec = codec->spec; | ||
2420 | if (spec->bind_ctls.list) { | ||
2421 | struct hda_bind_ctls **ctl = spec->bind_ctls.list; | ||
2422 | int i; | ||
2423 | for (i = 0; i < spec->bind_ctls.used; i++) | ||
2424 | kfree(ctl[i]); | ||
2425 | } | ||
2426 | snd_array_free(&spec->bind_ctls); | ||
2427 | } | ||
2428 | |||
2371 | static void alc_free(struct hda_codec *codec) | 2429 | static void alc_free(struct hda_codec *codec) |
2372 | { | 2430 | { |
2373 | struct alc_spec *spec = codec->spec; | 2431 | struct alc_spec *spec = codec->spec; |
@@ -2378,6 +2436,7 @@ static void alc_free(struct hda_codec *codec) | |||
2378 | alc_shutup(codec); | 2436 | alc_shutup(codec); |
2379 | snd_hda_input_jack_free(codec); | 2437 | snd_hda_input_jack_free(codec); |
2380 | alc_free_kctls(codec); | 2438 | alc_free_kctls(codec); |
2439 | alc_free_bind_ctls(codec); | ||
2381 | kfree(spec); | 2440 | kfree(spec); |
2382 | snd_hda_detach_beep_device(codec); | 2441 | snd_hda_detach_beep_device(codec); |
2383 | } | 2442 | } |
@@ -2441,6 +2500,47 @@ static int alc_codec_rename(struct hda_codec *codec, const char *name) | |||
2441 | } | 2500 | } |
2442 | 2501 | ||
2443 | /* | 2502 | /* |
2503 | * Rename codecs appropriately from COEF value | ||
2504 | */ | ||
2505 | struct alc_codec_rename_table { | ||
2506 | unsigned int vendor_id; | ||
2507 | unsigned short coef_mask; | ||
2508 | unsigned short coef_bits; | ||
2509 | const char *name; | ||
2510 | }; | ||
2511 | |||
2512 | static struct alc_codec_rename_table rename_tbl[] = { | ||
2513 | { 0x10ec0269, 0xfff0, 0x3010, "ALC277" }, | ||
2514 | { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" }, | ||
2515 | { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" }, | ||
2516 | { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" }, | ||
2517 | { 0x10ec0269, 0xffff, 0xa023, "ALC259" }, | ||
2518 | { 0x10ec0269, 0xffff, 0x6023, "ALC281X" }, | ||
2519 | { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" }, | ||
2520 | { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" }, | ||
2521 | { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" }, | ||
2522 | { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" }, | ||
2523 | { 0x10ec0899, 0x2000, 0x2000, "ALC899" }, | ||
2524 | { 0x10ec0892, 0xffff, 0x8020, "ALC661" }, | ||
2525 | { 0x10ec0892, 0xffff, 0x8011, "ALC661" }, | ||
2526 | { 0x10ec0892, 0xffff, 0x4011, "ALC656" }, | ||
2527 | { } /* terminator */ | ||
2528 | }; | ||
2529 | |||
2530 | static int alc_codec_rename_from_preset(struct hda_codec *codec) | ||
2531 | { | ||
2532 | const struct alc_codec_rename_table *p; | ||
2533 | |||
2534 | for (p = rename_tbl; p->vendor_id; p++) { | ||
2535 | if (p->vendor_id != codec->vendor_id) | ||
2536 | continue; | ||
2537 | if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits) | ||
2538 | return alc_codec_rename(codec, p->name); | ||
2539 | } | ||
2540 | return 0; | ||
2541 | } | ||
2542 | |||
2543 | /* | ||
2444 | * Automatic parse of I/O pins from the BIOS configuration | 2544 | * Automatic parse of I/O pins from the BIOS configuration |
2445 | */ | 2545 | */ |
2446 | 2546 | ||
@@ -2448,11 +2548,15 @@ enum { | |||
2448 | ALC_CTL_WIDGET_VOL, | 2548 | ALC_CTL_WIDGET_VOL, |
2449 | ALC_CTL_WIDGET_MUTE, | 2549 | ALC_CTL_WIDGET_MUTE, |
2450 | ALC_CTL_BIND_MUTE, | 2550 | ALC_CTL_BIND_MUTE, |
2551 | ALC_CTL_BIND_VOL, | ||
2552 | ALC_CTL_BIND_SW, | ||
2451 | }; | 2553 | }; |
2452 | static const struct snd_kcontrol_new alc_control_templates[] = { | 2554 | static const struct snd_kcontrol_new alc_control_templates[] = { |
2453 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), | 2555 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
2454 | HDA_CODEC_MUTE(NULL, 0, 0, 0), | 2556 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
2455 | HDA_BIND_MUTE(NULL, 0, 0, 0), | 2557 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
2558 | HDA_BIND_VOL(NULL, 0), | ||
2559 | HDA_BIND_SW(NULL, 0), | ||
2456 | }; | 2560 | }; |
2457 | 2561 | ||
2458 | /* add dynamic controls */ | 2562 | /* add dynamic controls */ |
@@ -2493,13 +2597,14 @@ static int add_control_with_pfx(struct alc_spec *spec, int type, | |||
2493 | #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \ | 2597 | #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \ |
2494 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val) | 2598 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val) |
2495 | 2599 | ||
2600 | static const char * const channel_name[4] = { | ||
2601 | "Front", "Surround", "CLFE", "Side" | ||
2602 | }; | ||
2603 | |||
2496 | static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch, | 2604 | static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch, |
2497 | bool can_be_master, int *index) | 2605 | bool can_be_master, int *index) |
2498 | { | 2606 | { |
2499 | struct auto_pin_cfg *cfg = &spec->autocfg; | 2607 | struct auto_pin_cfg *cfg = &spec->autocfg; |
2500 | static const char * const chname[4] = { | ||
2501 | "Front", "Surround", NULL /*CLFE*/, "Side" | ||
2502 | }; | ||
2503 | 2608 | ||
2504 | *index = 0; | 2609 | *index = 0; |
2505 | if (cfg->line_outs == 1 && !spec->multi_ios && | 2610 | if (cfg->line_outs == 1 && !spec->multi_ios && |
@@ -2522,7 +2627,10 @@ static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch, | |||
2522 | return "PCM"; | 2627 | return "PCM"; |
2523 | break; | 2628 | break; |
2524 | } | 2629 | } |
2525 | return chname[ch]; | 2630 | if (snd_BUG_ON(ch >= ARRAY_SIZE(channel_name))) |
2631 | return "PCM"; | ||
2632 | |||
2633 | return channel_name[ch]; | ||
2526 | } | 2634 | } |
2527 | 2635 | ||
2528 | /* create input playback/capture controls for the given pin */ | 2636 | /* create input playback/capture controls for the given pin */ |
@@ -2557,7 +2665,6 @@ static int alc_auto_fill_adc_caps(struct hda_codec *codec) | |||
2557 | hda_nid_t *adc_nids = spec->private_adc_nids; | 2665 | hda_nid_t *adc_nids = spec->private_adc_nids; |
2558 | hda_nid_t *cap_nids = spec->private_capsrc_nids; | 2666 | hda_nid_t *cap_nids = spec->private_capsrc_nids; |
2559 | int max_nums = ARRAY_SIZE(spec->private_adc_nids); | 2667 | int max_nums = ARRAY_SIZE(spec->private_adc_nids); |
2560 | bool indep_capsrc = false; | ||
2561 | int i, nums = 0; | 2668 | int i, nums = 0; |
2562 | 2669 | ||
2563 | nid = codec->start_nid; | 2670 | nid = codec->start_nid; |
@@ -2579,13 +2686,11 @@ static int alc_auto_fill_adc_caps(struct hda_codec *codec) | |||
2579 | break; | 2686 | break; |
2580 | if (type == AC_WID_AUD_SEL) { | 2687 | if (type == AC_WID_AUD_SEL) { |
2581 | cap_nids[nums] = src; | 2688 | cap_nids[nums] = src; |
2582 | indep_capsrc = true; | ||
2583 | break; | 2689 | break; |
2584 | } | 2690 | } |
2585 | n = snd_hda_get_conn_list(codec, src, &list); | 2691 | n = snd_hda_get_conn_list(codec, src, &list); |
2586 | if (n > 1) { | 2692 | if (n > 1) { |
2587 | cap_nids[nums] = src; | 2693 | cap_nids[nums] = src; |
2588 | indep_capsrc = true; | ||
2589 | break; | 2694 | break; |
2590 | } else if (n != 1) | 2695 | } else if (n != 1) |
2591 | break; | 2696 | break; |
@@ -2786,8 +2891,9 @@ static hda_nid_t alc_auto_look_for_dac(struct hda_codec *codec, hda_nid_t pin) | |||
2786 | if (found_in_nid_list(nid, spec->multiout.dac_nids, | 2891 | if (found_in_nid_list(nid, spec->multiout.dac_nids, |
2787 | spec->multiout.num_dacs)) | 2892 | spec->multiout.num_dacs)) |
2788 | continue; | 2893 | continue; |
2789 | if (spec->multiout.hp_nid == nid) | 2894 | if (found_in_nid_list(nid, spec->multiout.hp_out_nid, |
2790 | continue; | 2895 | ARRAY_SIZE(spec->multiout.hp_out_nid))) |
2896 | continue; | ||
2791 | if (found_in_nid_list(nid, spec->multiout.extra_out_nid, | 2897 | if (found_in_nid_list(nid, spec->multiout.extra_out_nid, |
2792 | ARRAY_SIZE(spec->multiout.extra_out_nid))) | 2898 | ARRAY_SIZE(spec->multiout.extra_out_nid))) |
2793 | continue; | 2899 | continue; |
@@ -2804,6 +2910,29 @@ static hda_nid_t get_dac_if_single(struct hda_codec *codec, hda_nid_t pin) | |||
2804 | return 0; | 2910 | return 0; |
2805 | } | 2911 | } |
2806 | 2912 | ||
2913 | static int alc_auto_fill_extra_dacs(struct hda_codec *codec, int num_outs, | ||
2914 | const hda_nid_t *pins, hda_nid_t *dacs) | ||
2915 | { | ||
2916 | int i; | ||
2917 | |||
2918 | if (num_outs && !dacs[0]) { | ||
2919 | dacs[0] = alc_auto_look_for_dac(codec, pins[0]); | ||
2920 | if (!dacs[0]) | ||
2921 | return 0; | ||
2922 | } | ||
2923 | |||
2924 | for (i = 1; i < num_outs; i++) | ||
2925 | dacs[i] = get_dac_if_single(codec, pins[i]); | ||
2926 | for (i = 1; i < num_outs; i++) { | ||
2927 | if (!dacs[i]) | ||
2928 | dacs[i] = alc_auto_look_for_dac(codec, pins[i]); | ||
2929 | } | ||
2930 | return 0; | ||
2931 | } | ||
2932 | |||
2933 | static int alc_auto_fill_multi_ios(struct hda_codec *codec, | ||
2934 | unsigned int location); | ||
2935 | |||
2807 | /* fill in the dac_nids table from the parsed pin configuration */ | 2936 | /* fill in the dac_nids table from the parsed pin configuration */ |
2808 | static int alc_auto_fill_dac_nids(struct hda_codec *codec) | 2937 | static int alc_auto_fill_dac_nids(struct hda_codec *codec) |
2809 | { | 2938 | { |
@@ -2815,7 +2944,7 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec) | |||
2815 | again: | 2944 | again: |
2816 | /* set num_dacs once to full for alc_auto_look_for_dac() */ | 2945 | /* set num_dacs once to full for alc_auto_look_for_dac() */ |
2817 | spec->multiout.num_dacs = cfg->line_outs; | 2946 | spec->multiout.num_dacs = cfg->line_outs; |
2818 | spec->multiout.hp_nid = 0; | 2947 | spec->multiout.hp_out_nid[0] = 0; |
2819 | spec->multiout.extra_out_nid[0] = 0; | 2948 | spec->multiout.extra_out_nid[0] = 0; |
2820 | memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids)); | 2949 | memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids)); |
2821 | spec->multiout.dac_nids = spec->private_dac_nids; | 2950 | spec->multiout.dac_nids = spec->private_dac_nids; |
@@ -2826,7 +2955,7 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec) | |||
2826 | spec->private_dac_nids[i] = | 2955 | spec->private_dac_nids[i] = |
2827 | get_dac_if_single(codec, cfg->line_out_pins[i]); | 2956 | get_dac_if_single(codec, cfg->line_out_pins[i]); |
2828 | if (cfg->hp_outs) | 2957 | if (cfg->hp_outs) |
2829 | spec->multiout.hp_nid = | 2958 | spec->multiout.hp_out_nid[0] = |
2830 | get_dac_if_single(codec, cfg->hp_pins[0]); | 2959 | get_dac_if_single(codec, cfg->hp_pins[0]); |
2831 | if (cfg->speaker_outs) | 2960 | if (cfg->speaker_outs) |
2832 | spec->multiout.extra_out_nid[0] = | 2961 | spec->multiout.extra_out_nid[0] = |
@@ -2858,24 +2987,58 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec) | |||
2858 | sizeof(hda_nid_t) * (cfg->line_outs - i - 1)); | 2987 | sizeof(hda_nid_t) * (cfg->line_outs - i - 1)); |
2859 | } | 2988 | } |
2860 | 2989 | ||
2861 | if (cfg->hp_outs && !spec->multiout.hp_nid) | 2990 | if (cfg->line_outs == 1 && cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
2862 | spec->multiout.hp_nid = | 2991 | /* try to fill multi-io first */ |
2863 | alc_auto_look_for_dac(codec, cfg->hp_pins[0]); | 2992 | unsigned int location, defcfg; |
2864 | if (cfg->speaker_outs && !spec->multiout.extra_out_nid[0]) | 2993 | int num_pins; |
2865 | spec->multiout.extra_out_nid[0] = | 2994 | |
2866 | alc_auto_look_for_dac(codec, cfg->speaker_pins[0]); | 2995 | defcfg = snd_hda_codec_get_pincfg(codec, cfg->line_out_pins[0]); |
2996 | location = get_defcfg_location(defcfg); | ||
2997 | |||
2998 | num_pins = alc_auto_fill_multi_ios(codec, location); | ||
2999 | if (num_pins > 0) { | ||
3000 | spec->multi_ios = num_pins; | ||
3001 | spec->ext_channel_count = 2; | ||
3002 | spec->multiout.num_dacs = num_pins + 1; | ||
3003 | } | ||
3004 | } | ||
3005 | |||
3006 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) | ||
3007 | alc_auto_fill_extra_dacs(codec, cfg->hp_outs, cfg->hp_pins, | ||
3008 | spec->multiout.hp_out_nid); | ||
3009 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) | ||
3010 | alc_auto_fill_extra_dacs(codec, cfg->speaker_outs, cfg->speaker_pins, | ||
3011 | spec->multiout.extra_out_nid); | ||
2867 | 3012 | ||
2868 | return 0; | 3013 | return 0; |
2869 | } | 3014 | } |
2870 | 3015 | ||
3016 | static inline unsigned int get_ctl_pos(unsigned int data) | ||
3017 | { | ||
3018 | hda_nid_t nid = get_amp_nid_(data); | ||
3019 | unsigned int dir = get_amp_direction_(data); | ||
3020 | return (nid << 1) | dir; | ||
3021 | } | ||
3022 | |||
3023 | #define is_ctl_used(bits, data) \ | ||
3024 | test_bit(get_ctl_pos(data), bits) | ||
3025 | #define mark_ctl_usage(bits, data) \ | ||
3026 | set_bit(get_ctl_pos(data), bits) | ||
3027 | |||
2871 | static int alc_auto_add_vol_ctl(struct hda_codec *codec, | 3028 | static int alc_auto_add_vol_ctl(struct hda_codec *codec, |
2872 | const char *pfx, int cidx, | 3029 | const char *pfx, int cidx, |
2873 | hda_nid_t nid, unsigned int chs) | 3030 | hda_nid_t nid, unsigned int chs) |
2874 | { | 3031 | { |
3032 | struct alc_spec *spec = codec->spec; | ||
3033 | unsigned int val; | ||
2875 | if (!nid) | 3034 | if (!nid) |
2876 | return 0; | 3035 | return 0; |
3036 | val = HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT); | ||
3037 | if (is_ctl_used(spec->vol_ctls, val) && chs != 2) /* exclude LFE */ | ||
3038 | return 0; | ||
3039 | mark_ctl_usage(spec->vol_ctls, val); | ||
2877 | return __add_pb_vol_ctrl(codec->spec, ALC_CTL_WIDGET_VOL, pfx, cidx, | 3040 | return __add_pb_vol_ctrl(codec->spec, ALC_CTL_WIDGET_VOL, pfx, cidx, |
2878 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); | 3041 | val); |
2879 | } | 3042 | } |
2880 | 3043 | ||
2881 | #define alc_auto_add_stereo_vol(codec, pfx, cidx, nid) \ | 3044 | #define alc_auto_add_stereo_vol(codec, pfx, cidx, nid) \ |
@@ -2888,6 +3051,7 @@ static int alc_auto_add_sw_ctl(struct hda_codec *codec, | |||
2888 | const char *pfx, int cidx, | 3051 | const char *pfx, int cidx, |
2889 | hda_nid_t nid, unsigned int chs) | 3052 | hda_nid_t nid, unsigned int chs) |
2890 | { | 3053 | { |
3054 | struct alc_spec *spec = codec->spec; | ||
2891 | int wid_type; | 3055 | int wid_type; |
2892 | int type; | 3056 | int type; |
2893 | unsigned long val; | 3057 | unsigned long val; |
@@ -2904,6 +3068,9 @@ static int alc_auto_add_sw_ctl(struct hda_codec *codec, | |||
2904 | type = ALC_CTL_BIND_MUTE; | 3068 | type = ALC_CTL_BIND_MUTE; |
2905 | val = HDA_COMPOSE_AMP_VAL(nid, chs, 2, HDA_INPUT); | 3069 | val = HDA_COMPOSE_AMP_VAL(nid, chs, 2, HDA_INPUT); |
2906 | } | 3070 | } |
3071 | if (is_ctl_used(spec->sw_ctls, val) && chs != 2) /* exclude LFE */ | ||
3072 | return 0; | ||
3073 | mark_ctl_usage(spec->sw_ctls, val); | ||
2907 | return __add_pb_sw_ctrl(codec->spec, type, pfx, cidx, val); | 3074 | return __add_pb_sw_ctrl(codec->spec, type, pfx, cidx, val); |
2908 | } | 3075 | } |
2909 | 3076 | ||
@@ -2964,7 +3131,7 @@ static int alc_auto_create_multi_out_ctls(struct hda_codec *codec, | |||
2964 | sw = alc_look_for_out_mute_nid(codec, pin, dac); | 3131 | sw = alc_look_for_out_mute_nid(codec, pin, dac); |
2965 | vol = alc_look_for_out_vol_nid(codec, pin, dac); | 3132 | vol = alc_look_for_out_vol_nid(codec, pin, dac); |
2966 | name = alc_get_line_out_pfx(spec, i, true, &index); | 3133 | name = alc_get_line_out_pfx(spec, i, true, &index); |
2967 | if (!name) { | 3134 | if (!name || !strcmp(name, "CLFE")) { |
2968 | /* Center/LFE */ | 3135 | /* Center/LFE */ |
2969 | err = alc_auto_add_vol_ctl(codec, "Center", 0, vol, 1); | 3136 | err = alc_auto_add_vol_ctl(codec, "Center", 0, vol, 1); |
2970 | if (err < 0) | 3137 | if (err < 0) |
@@ -2990,23 +3157,24 @@ static int alc_auto_create_multi_out_ctls(struct hda_codec *codec, | |||
2990 | return 0; | 3157 | return 0; |
2991 | } | 3158 | } |
2992 | 3159 | ||
2993 | /* add playback controls for speaker and HP outputs */ | ||
2994 | static int alc_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, | 3160 | static int alc_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, |
2995 | hda_nid_t dac, const char *pfx) | 3161 | hda_nid_t dac, const char *pfx) |
2996 | { | 3162 | { |
2997 | struct alc_spec *spec = codec->spec; | 3163 | struct alc_spec *spec = codec->spec; |
2998 | hda_nid_t sw, vol; | 3164 | hda_nid_t sw, vol; |
2999 | int err; | 3165 | int err; |
3000 | 3166 | ||
3001 | if (!pin) | ||
3002 | return 0; | ||
3003 | if (!dac) { | 3167 | if (!dac) { |
3168 | unsigned int val; | ||
3004 | /* the corresponding DAC is already occupied */ | 3169 | /* the corresponding DAC is already occupied */ |
3005 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) | 3170 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
3006 | return 0; /* no way */ | 3171 | return 0; /* no way */ |
3007 | /* create a switch only */ | 3172 | /* create a switch only */ |
3008 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, | 3173 | val = HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT); |
3009 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); | 3174 | if (is_ctl_used(spec->sw_ctls, val)) |
3175 | return 0; /* already created */ | ||
3176 | mark_ctl_usage(spec->sw_ctls, val); | ||
3177 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val); | ||
3010 | } | 3178 | } |
3011 | 3179 | ||
3012 | sw = alc_look_for_out_mute_nid(codec, pin, dac); | 3180 | sw = alc_look_for_out_mute_nid(codec, pin, dac); |
@@ -3020,20 +3188,112 @@ static int alc_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, | |||
3020 | return 0; | 3188 | return 0; |
3021 | } | 3189 | } |
3022 | 3190 | ||
3191 | static struct hda_bind_ctls *new_bind_ctl(struct hda_codec *codec, | ||
3192 | unsigned int nums, | ||
3193 | struct hda_ctl_ops *ops) | ||
3194 | { | ||
3195 | struct alc_spec *spec = codec->spec; | ||
3196 | struct hda_bind_ctls **ctlp, *ctl; | ||
3197 | snd_array_init(&spec->bind_ctls, sizeof(ctl), 8); | ||
3198 | ctlp = snd_array_new(&spec->bind_ctls); | ||
3199 | if (!ctlp) | ||
3200 | return NULL; | ||
3201 | ctl = kzalloc(sizeof(*ctl) + sizeof(long) * (nums + 1), GFP_KERNEL); | ||
3202 | *ctlp = ctl; | ||
3203 | if (ctl) | ||
3204 | ctl->ops = ops; | ||
3205 | return ctl; | ||
3206 | } | ||
3207 | |||
3208 | /* add playback controls for speaker and HP outputs */ | ||
3209 | static int alc_auto_create_extra_outs(struct hda_codec *codec, int num_pins, | ||
3210 | const hda_nid_t *pins, | ||
3211 | const hda_nid_t *dacs, | ||
3212 | const char *pfx) | ||
3213 | { | ||
3214 | struct alc_spec *spec = codec->spec; | ||
3215 | struct hda_bind_ctls *ctl; | ||
3216 | char name[32]; | ||
3217 | int i, n, err; | ||
3218 | |||
3219 | if (!num_pins || !pins[0]) | ||
3220 | return 0; | ||
3221 | |||
3222 | if (num_pins == 1) { | ||
3223 | hda_nid_t dac = *dacs; | ||
3224 | if (!dac) | ||
3225 | dac = spec->multiout.dac_nids[0]; | ||
3226 | return alc_auto_create_extra_out(codec, *pins, dac, pfx); | ||
3227 | } | ||
3228 | |||
3229 | if (dacs[num_pins - 1]) { | ||
3230 | /* OK, we have a multi-output system with individual volumes */ | ||
3231 | for (i = 0; i < num_pins; i++) { | ||
3232 | snprintf(name, sizeof(name), "%s %s", | ||
3233 | pfx, channel_name[i]); | ||
3234 | err = alc_auto_create_extra_out(codec, pins[i], dacs[i], | ||
3235 | name); | ||
3236 | if (err < 0) | ||
3237 | return err; | ||
3238 | } | ||
3239 | return 0; | ||
3240 | } | ||
3241 | |||
3242 | /* Let's create a bind-controls */ | ||
3243 | ctl = new_bind_ctl(codec, num_pins, &snd_hda_bind_sw); | ||
3244 | if (!ctl) | ||
3245 | return -ENOMEM; | ||
3246 | n = 0; | ||
3247 | for (i = 0; i < num_pins; i++) { | ||
3248 | if (get_wcaps(codec, pins[i]) & AC_WCAP_OUT_AMP) | ||
3249 | ctl->values[n++] = | ||
3250 | HDA_COMPOSE_AMP_VAL(pins[i], 3, 0, HDA_OUTPUT); | ||
3251 | } | ||
3252 | if (n) { | ||
3253 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); | ||
3254 | err = add_control(spec, ALC_CTL_BIND_SW, name, 0, (long)ctl); | ||
3255 | if (err < 0) | ||
3256 | return err; | ||
3257 | } | ||
3258 | |||
3259 | ctl = new_bind_ctl(codec, num_pins, &snd_hda_bind_vol); | ||
3260 | if (!ctl) | ||
3261 | return -ENOMEM; | ||
3262 | n = 0; | ||
3263 | for (i = 0; i < num_pins; i++) { | ||
3264 | hda_nid_t vol; | ||
3265 | if (!pins[i] || !dacs[i]) | ||
3266 | continue; | ||
3267 | vol = alc_look_for_out_vol_nid(codec, pins[i], dacs[i]); | ||
3268 | if (vol) | ||
3269 | ctl->values[n++] = | ||
3270 | HDA_COMPOSE_AMP_VAL(vol, 3, 0, HDA_OUTPUT); | ||
3271 | } | ||
3272 | if (n) { | ||
3273 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); | ||
3274 | err = add_control(spec, ALC_CTL_BIND_VOL, name, 0, (long)ctl); | ||
3275 | if (err < 0) | ||
3276 | return err; | ||
3277 | } | ||
3278 | return 0; | ||
3279 | } | ||
3280 | |||
3023 | static int alc_auto_create_hp_out(struct hda_codec *codec) | 3281 | static int alc_auto_create_hp_out(struct hda_codec *codec) |
3024 | { | 3282 | { |
3025 | struct alc_spec *spec = codec->spec; | 3283 | struct alc_spec *spec = codec->spec; |
3026 | return alc_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], | 3284 | return alc_auto_create_extra_outs(codec, spec->autocfg.hp_outs, |
3027 | spec->multiout.hp_nid, | 3285 | spec->autocfg.hp_pins, |
3028 | "Headphone"); | 3286 | spec->multiout.hp_out_nid, |
3287 | "Headphone"); | ||
3029 | } | 3288 | } |
3030 | 3289 | ||
3031 | static int alc_auto_create_speaker_out(struct hda_codec *codec) | 3290 | static int alc_auto_create_speaker_out(struct hda_codec *codec) |
3032 | { | 3291 | { |
3033 | struct alc_spec *spec = codec->spec; | 3292 | struct alc_spec *spec = codec->spec; |
3034 | return alc_auto_create_extra_out(codec, spec->autocfg.speaker_pins[0], | 3293 | return alc_auto_create_extra_outs(codec, spec->autocfg.speaker_outs, |
3035 | spec->multiout.extra_out_nid[0], | 3294 | spec->autocfg.speaker_pins, |
3036 | "Speaker"); | 3295 | spec->multiout.extra_out_nid, |
3296 | "Speaker"); | ||
3037 | } | 3297 | } |
3038 | 3298 | ||
3039 | static void alc_auto_set_output_and_unmute(struct hda_codec *codec, | 3299 | static void alc_auto_set_output_and_unmute(struct hda_codec *codec, |
@@ -3071,6 +3331,12 @@ static void alc_auto_set_output_and_unmute(struct hda_codec *codec, | |||
3071 | if (nid) | 3331 | if (nid) |
3072 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 3332 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
3073 | AMP_OUT_ZERO); | 3333 | AMP_OUT_ZERO); |
3334 | |||
3335 | /* unmute DAC if it's not assigned to a mixer */ | ||
3336 | nid = alc_look_for_out_mute_nid(codec, pin, dac); | ||
3337 | if (nid == mix && nid_has_mute(codec, dac, HDA_OUTPUT)) | ||
3338 | snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
3339 | AMP_OUT_ZERO); | ||
3074 | } | 3340 | } |
3075 | 3341 | ||
3076 | static void alc_auto_init_multi_out(struct hda_codec *codec) | 3342 | static void alc_auto_init_multi_out(struct hda_codec *codec) |
@@ -3090,20 +3356,37 @@ static void alc_auto_init_multi_out(struct hda_codec *codec) | |||
3090 | static void alc_auto_init_extra_out(struct hda_codec *codec) | 3356 | static void alc_auto_init_extra_out(struct hda_codec *codec) |
3091 | { | 3357 | { |
3092 | struct alc_spec *spec = codec->spec; | 3358 | struct alc_spec *spec = codec->spec; |
3359 | int i; | ||
3093 | hda_nid_t pin, dac; | 3360 | hda_nid_t pin, dac; |
3094 | 3361 | ||
3095 | pin = spec->autocfg.hp_pins[0]; | 3362 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
3096 | if (pin) { | 3363 | if (spec->autocfg.line_out_type == AUTO_PIN_HP_OUT) |
3097 | dac = spec->multiout.hp_nid; | 3364 | break; |
3098 | if (!dac) | 3365 | pin = spec->autocfg.hp_pins[i]; |
3099 | dac = spec->multiout.dac_nids[0]; | 3366 | if (!pin) |
3367 | break; | ||
3368 | dac = spec->multiout.hp_out_nid[i]; | ||
3369 | if (!dac) { | ||
3370 | if (i > 0 && spec->multiout.hp_out_nid[0]) | ||
3371 | dac = spec->multiout.hp_out_nid[0]; | ||
3372 | else | ||
3373 | dac = spec->multiout.dac_nids[0]; | ||
3374 | } | ||
3100 | alc_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); | 3375 | alc_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); |
3101 | } | 3376 | } |
3102 | pin = spec->autocfg.speaker_pins[0]; | 3377 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { |
3103 | if (pin) { | 3378 | if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
3104 | dac = spec->multiout.extra_out_nid[0]; | 3379 | break; |
3105 | if (!dac) | 3380 | pin = spec->autocfg.speaker_pins[i]; |
3106 | dac = spec->multiout.dac_nids[0]; | 3381 | if (!pin) |
3382 | break; | ||
3383 | dac = spec->multiout.extra_out_nid[i]; | ||
3384 | if (!dac) { | ||
3385 | if (i > 0 && spec->multiout.extra_out_nid[0]) | ||
3386 | dac = spec->multiout.extra_out_nid[0]; | ||
3387 | else | ||
3388 | dac = spec->multiout.dac_nids[0]; | ||
3389 | } | ||
3107 | alc_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); | 3390 | alc_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); |
3108 | } | 3391 | } |
3109 | } | 3392 | } |
@@ -3116,6 +3399,7 @@ static int alc_auto_fill_multi_ios(struct hda_codec *codec, | |||
3116 | { | 3399 | { |
3117 | struct alc_spec *spec = codec->spec; | 3400 | struct alc_spec *spec = codec->spec; |
3118 | struct auto_pin_cfg *cfg = &spec->autocfg; | 3401 | struct auto_pin_cfg *cfg = &spec->autocfg; |
3402 | hda_nid_t prime_dac = spec->private_dac_nids[0]; | ||
3119 | int type, i, num_pins = 0; | 3403 | int type, i, num_pins = 0; |
3120 | 3404 | ||
3121 | for (type = AUTO_PIN_LINE_IN; type >= AUTO_PIN_MIC; type--) { | 3405 | for (type = AUTO_PIN_LINE_IN; type >= AUTO_PIN_MIC; type--) { |
@@ -3143,8 +3427,13 @@ static int alc_auto_fill_multi_ios(struct hda_codec *codec, | |||
3143 | } | 3427 | } |
3144 | } | 3428 | } |
3145 | spec->multiout.num_dacs = 1; | 3429 | spec->multiout.num_dacs = 1; |
3146 | if (num_pins < 2) | 3430 | if (num_pins < 2) { |
3431 | /* clear up again */ | ||
3432 | memset(spec->private_dac_nids, 0, | ||
3433 | sizeof(spec->private_dac_nids)); | ||
3434 | spec->private_dac_nids[0] = prime_dac; | ||
3147 | return 0; | 3435 | return 0; |
3436 | } | ||
3148 | return num_pins; | 3437 | return num_pins; |
3149 | } | 3438 | } |
3150 | 3439 | ||
@@ -3230,36 +3519,11 @@ static const struct snd_kcontrol_new alc_auto_channel_mode_enum = { | |||
3230 | .put = alc_auto_ch_mode_put, | 3519 | .put = alc_auto_ch_mode_put, |
3231 | }; | 3520 | }; |
3232 | 3521 | ||
3233 | static int alc_auto_add_multi_channel_mode(struct hda_codec *codec, | 3522 | static int alc_auto_add_multi_channel_mode(struct hda_codec *codec) |
3234 | int (*fill_dac)(struct hda_codec *)) | ||
3235 | { | 3523 | { |
3236 | struct alc_spec *spec = codec->spec; | 3524 | struct alc_spec *spec = codec->spec; |
3237 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
3238 | unsigned int location, defcfg; | ||
3239 | int num_pins; | ||
3240 | 3525 | ||
3241 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT && cfg->hp_outs == 1) { | 3526 | if (spec->multi_ios > 0) { |
3242 | /* use HP as primary out */ | ||
3243 | cfg->speaker_outs = cfg->line_outs; | ||
3244 | memcpy(cfg->speaker_pins, cfg->line_out_pins, | ||
3245 | sizeof(cfg->speaker_pins)); | ||
3246 | cfg->line_outs = cfg->hp_outs; | ||
3247 | memcpy(cfg->line_out_pins, cfg->hp_pins, sizeof(cfg->hp_pins)); | ||
3248 | cfg->hp_outs = 0; | ||
3249 | memset(cfg->hp_pins, 0, sizeof(cfg->hp_pins)); | ||
3250 | cfg->line_out_type = AUTO_PIN_HP_OUT; | ||
3251 | if (fill_dac) | ||
3252 | fill_dac(codec); | ||
3253 | } | ||
3254 | if (cfg->line_outs != 1 || | ||
3255 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
3256 | return 0; | ||
3257 | |||
3258 | defcfg = snd_hda_codec_get_pincfg(codec, cfg->line_out_pins[0]); | ||
3259 | location = get_defcfg_location(defcfg); | ||
3260 | |||
3261 | num_pins = alc_auto_fill_multi_ios(codec, location); | ||
3262 | if (num_pins > 0) { | ||
3263 | struct snd_kcontrol_new *knew; | 3527 | struct snd_kcontrol_new *knew; |
3264 | 3528 | ||
3265 | knew = alc_kcontrol_new(spec); | 3529 | knew = alc_kcontrol_new(spec); |
@@ -3269,10 +3533,6 @@ static int alc_auto_add_multi_channel_mode(struct hda_codec *codec, | |||
3269 | knew->name = kstrdup("Channel Mode", GFP_KERNEL); | 3533 | knew->name = kstrdup("Channel Mode", GFP_KERNEL); |
3270 | if (!knew->name) | 3534 | if (!knew->name) |
3271 | return -ENOMEM; | 3535 | return -ENOMEM; |
3272 | |||
3273 | spec->multi_ios = num_pins; | ||
3274 | spec->ext_channel_count = 2; | ||
3275 | spec->multiout.num_dacs = num_pins + 1; | ||
3276 | } | 3536 | } |
3277 | return 0; | 3537 | return 0; |
3278 | } | 3538 | } |
@@ -3555,27 +3815,42 @@ static int alc_parse_auto_config(struct hda_codec *codec, | |||
3555 | const hda_nid_t *ssid_nids) | 3815 | const hda_nid_t *ssid_nids) |
3556 | { | 3816 | { |
3557 | struct alc_spec *spec = codec->spec; | 3817 | struct alc_spec *spec = codec->spec; |
3818 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
3558 | int err; | 3819 | int err; |
3559 | 3820 | ||
3560 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | 3821 | err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids, |
3561 | ignore_nids); | 3822 | spec->parse_flags); |
3562 | if (err < 0) | 3823 | if (err < 0) |
3563 | return err; | 3824 | return err; |
3564 | if (!spec->autocfg.line_outs) { | 3825 | if (!cfg->line_outs) { |
3565 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { | 3826 | if (cfg->dig_outs || cfg->dig_in_pin) { |
3566 | spec->multiout.max_channels = 2; | 3827 | spec->multiout.max_channels = 2; |
3567 | spec->no_analog = 1; | 3828 | spec->no_analog = 1; |
3568 | goto dig_only; | 3829 | goto dig_only; |
3569 | } | 3830 | } |
3570 | return 0; /* can't find valid BIOS pin config */ | 3831 | return 0; /* can't find valid BIOS pin config */ |
3571 | } | 3832 | } |
3833 | |||
3834 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT && | ||
3835 | cfg->line_outs <= cfg->hp_outs) { | ||
3836 | /* use HP as primary out */ | ||
3837 | cfg->speaker_outs = cfg->line_outs; | ||
3838 | memcpy(cfg->speaker_pins, cfg->line_out_pins, | ||
3839 | sizeof(cfg->speaker_pins)); | ||
3840 | cfg->line_outs = cfg->hp_outs; | ||
3841 | memcpy(cfg->line_out_pins, cfg->hp_pins, sizeof(cfg->hp_pins)); | ||
3842 | cfg->hp_outs = 0; | ||
3843 | memset(cfg->hp_pins, 0, sizeof(cfg->hp_pins)); | ||
3844 | cfg->line_out_type = AUTO_PIN_HP_OUT; | ||
3845 | } | ||
3846 | |||
3572 | err = alc_auto_fill_dac_nids(codec); | 3847 | err = alc_auto_fill_dac_nids(codec); |
3573 | if (err < 0) | 3848 | if (err < 0) |
3574 | return err; | 3849 | return err; |
3575 | err = alc_auto_add_multi_channel_mode(codec, alc_auto_fill_dac_nids); | 3850 | err = alc_auto_add_multi_channel_mode(codec); |
3576 | if (err < 0) | 3851 | if (err < 0) |
3577 | return err; | 3852 | return err; |
3578 | err = alc_auto_create_multi_out_ctls(codec, &spec->autocfg); | 3853 | err = alc_auto_create_multi_out_ctls(codec, cfg); |
3579 | if (err < 0) | 3854 | if (err < 0) |
3580 | return err; | 3855 | return err; |
3581 | err = alc_auto_create_hp_out(codec); | 3856 | err = alc_auto_create_hp_out(codec); |
@@ -3678,10 +3953,8 @@ static int patch_alc880(struct hda_codec *codec) | |||
3678 | if (board_config == ALC_MODEL_AUTO) { | 3953 | if (board_config == ALC_MODEL_AUTO) { |
3679 | /* automatic parse from the BIOS config */ | 3954 | /* automatic parse from the BIOS config */ |
3680 | err = alc880_parse_auto_config(codec); | 3955 | err = alc880_parse_auto_config(codec); |
3681 | if (err < 0) { | 3956 | if (err < 0) |
3682 | alc_free(codec); | 3957 | goto error; |
3683 | return err; | ||
3684 | } | ||
3685 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS | 3958 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS |
3686 | else if (!err) { | 3959 | else if (!err) { |
3687 | printk(KERN_INFO | 3960 | printk(KERN_INFO |
@@ -3706,10 +3979,8 @@ static int patch_alc880(struct hda_codec *codec) | |||
3706 | 3979 | ||
3707 | if (!spec->no_analog) { | 3980 | if (!spec->no_analog) { |
3708 | err = snd_hda_attach_beep_device(codec, 0x1); | 3981 | err = snd_hda_attach_beep_device(codec, 0x1); |
3709 | if (err < 0) { | 3982 | if (err < 0) |
3710 | alc_free(codec); | 3983 | goto error; |
3711 | return err; | ||
3712 | } | ||
3713 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | 3984 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
3714 | } | 3985 | } |
3715 | 3986 | ||
@@ -3724,6 +3995,10 @@ static int patch_alc880(struct hda_codec *codec) | |||
3724 | #endif | 3995 | #endif |
3725 | 3996 | ||
3726 | return 0; | 3997 | return 0; |
3998 | |||
3999 | error: | ||
4000 | alc_free(codec); | ||
4001 | return err; | ||
3727 | } | 4002 | } |
3728 | 4003 | ||
3729 | 4004 | ||
@@ -3805,10 +4080,8 @@ static int patch_alc260(struct hda_codec *codec) | |||
3805 | if (board_config == ALC_MODEL_AUTO) { | 4080 | if (board_config == ALC_MODEL_AUTO) { |
3806 | /* automatic parse from the BIOS config */ | 4081 | /* automatic parse from the BIOS config */ |
3807 | err = alc260_parse_auto_config(codec); | 4082 | err = alc260_parse_auto_config(codec); |
3808 | if (err < 0) { | 4083 | if (err < 0) |
3809 | alc_free(codec); | 4084 | goto error; |
3810 | return err; | ||
3811 | } | ||
3812 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS | 4085 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS |
3813 | else if (!err) { | 4086 | else if (!err) { |
3814 | printk(KERN_INFO | 4087 | printk(KERN_INFO |
@@ -3833,10 +4106,8 @@ static int patch_alc260(struct hda_codec *codec) | |||
3833 | 4106 | ||
3834 | if (!spec->no_analog) { | 4107 | if (!spec->no_analog) { |
3835 | err = snd_hda_attach_beep_device(codec, 0x1); | 4108 | err = snd_hda_attach_beep_device(codec, 0x1); |
3836 | if (err < 0) { | 4109 | if (err < 0) |
3837 | alc_free(codec); | 4110 | goto error; |
3838 | return err; | ||
3839 | } | ||
3840 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); | 4111 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
3841 | } | 4112 | } |
3842 | 4113 | ||
@@ -3854,6 +4125,10 @@ static int patch_alc260(struct hda_codec *codec) | |||
3854 | #endif | 4125 | #endif |
3855 | 4126 | ||
3856 | return 0; | 4127 | return 0; |
4128 | |||
4129 | error: | ||
4130 | alc_free(codec); | ||
4131 | return err; | ||
3857 | } | 4132 | } |
3858 | 4133 | ||
3859 | 4134 | ||
@@ -3880,6 +4155,7 @@ enum { | |||
3880 | PINFIX_LENOVO_Y530, | 4155 | PINFIX_LENOVO_Y530, |
3881 | PINFIX_PB_M5210, | 4156 | PINFIX_PB_M5210, |
3882 | PINFIX_ACER_ASPIRE_7736, | 4157 | PINFIX_ACER_ASPIRE_7736, |
4158 | PINFIX_ASUS_W90V, | ||
3883 | }; | 4159 | }; |
3884 | 4160 | ||
3885 | static const struct alc_fixup alc882_fixups[] = { | 4161 | static const struct alc_fixup alc882_fixups[] = { |
@@ -3911,10 +4187,18 @@ static const struct alc_fixup alc882_fixups[] = { | |||
3911 | .type = ALC_FIXUP_SKU, | 4187 | .type = ALC_FIXUP_SKU, |
3912 | .v.sku = ALC_FIXUP_SKU_IGNORE, | 4188 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
3913 | }, | 4189 | }, |
4190 | [PINFIX_ASUS_W90V] = { | ||
4191 | .type = ALC_FIXUP_PINS, | ||
4192 | .v.pins = (const struct alc_pincfg[]) { | ||
4193 | { 0x16, 0x99130110 }, /* fix sequence for CLFE */ | ||
4194 | { } | ||
4195 | } | ||
4196 | }, | ||
3914 | }; | 4197 | }; |
3915 | 4198 | ||
3916 | static const struct snd_pci_quirk alc882_fixup_tbl[] = { | 4199 | static const struct snd_pci_quirk alc882_fixup_tbl[] = { |
3917 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), | 4200 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), |
4201 | SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", PINFIX_ASUS_W90V), | ||
3918 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530), | 4202 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530), |
3919 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), | 4203 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
3920 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), | 4204 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), |
@@ -3961,6 +4245,10 @@ static int patch_alc882(struct hda_codec *codec) | |||
3961 | break; | 4245 | break; |
3962 | } | 4246 | } |
3963 | 4247 | ||
4248 | err = alc_codec_rename_from_preset(codec); | ||
4249 | if (err < 0) | ||
4250 | goto error; | ||
4251 | |||
3964 | board_config = alc_board_config(codec, ALC882_MODEL_LAST, | 4252 | board_config = alc_board_config(codec, ALC882_MODEL_LAST, |
3965 | alc882_models, alc882_cfg_tbl); | 4253 | alc882_models, alc882_cfg_tbl); |
3966 | 4254 | ||
@@ -3984,10 +4272,8 @@ static int patch_alc882(struct hda_codec *codec) | |||
3984 | if (board_config == ALC_MODEL_AUTO) { | 4272 | if (board_config == ALC_MODEL_AUTO) { |
3985 | /* automatic parse from the BIOS config */ | 4273 | /* automatic parse from the BIOS config */ |
3986 | err = alc882_parse_auto_config(codec); | 4274 | err = alc882_parse_auto_config(codec); |
3987 | if (err < 0) { | 4275 | if (err < 0) |
3988 | alc_free(codec); | 4276 | goto error; |
3989 | return err; | ||
3990 | } | ||
3991 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS | 4277 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS |
3992 | else if (!err) { | 4278 | else if (!err) { |
3993 | printk(KERN_INFO | 4279 | printk(KERN_INFO |
@@ -4012,10 +4298,8 @@ static int patch_alc882(struct hda_codec *codec) | |||
4012 | 4298 | ||
4013 | if (!spec->no_analog && has_cdefine_beep(codec)) { | 4299 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
4014 | err = snd_hda_attach_beep_device(codec, 0x1); | 4300 | err = snd_hda_attach_beep_device(codec, 0x1); |
4015 | if (err < 0) { | 4301 | if (err < 0) |
4016 | alc_free(codec); | 4302 | goto error; |
4017 | return err; | ||
4018 | } | ||
4019 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | 4303 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
4020 | } | 4304 | } |
4021 | 4305 | ||
@@ -4034,6 +4318,10 @@ static int patch_alc882(struct hda_codec *codec) | |||
4034 | #endif | 4318 | #endif |
4035 | 4319 | ||
4036 | return 0; | 4320 | return 0; |
4321 | |||
4322 | error: | ||
4323 | alc_free(codec); | ||
4324 | return err; | ||
4037 | } | 4325 | } |
4038 | 4326 | ||
4039 | 4327 | ||
@@ -4138,10 +4426,8 @@ static int patch_alc262(struct hda_codec *codec) | |||
4138 | if (board_config == ALC_MODEL_AUTO) { | 4426 | if (board_config == ALC_MODEL_AUTO) { |
4139 | /* automatic parse from the BIOS config */ | 4427 | /* automatic parse from the BIOS config */ |
4140 | err = alc262_parse_auto_config(codec); | 4428 | err = alc262_parse_auto_config(codec); |
4141 | if (err < 0) { | 4429 | if (err < 0) |
4142 | alc_free(codec); | 4430 | goto error; |
4143 | return err; | ||
4144 | } | ||
4145 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS | 4431 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS |
4146 | else if (!err) { | 4432 | else if (!err) { |
4147 | printk(KERN_INFO | 4433 | printk(KERN_INFO |
@@ -4166,10 +4452,8 @@ static int patch_alc262(struct hda_codec *codec) | |||
4166 | 4452 | ||
4167 | if (!spec->no_analog && has_cdefine_beep(codec)) { | 4453 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
4168 | err = snd_hda_attach_beep_device(codec, 0x1); | 4454 | err = snd_hda_attach_beep_device(codec, 0x1); |
4169 | if (err < 0) { | 4455 | if (err < 0) |
4170 | alc_free(codec); | 4456 | goto error; |
4171 | return err; | ||
4172 | } | ||
4173 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | 4457 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
4174 | } | 4458 | } |
4175 | 4459 | ||
@@ -4189,6 +4473,10 @@ static int patch_alc262(struct hda_codec *codec) | |||
4189 | #endif | 4473 | #endif |
4190 | 4474 | ||
4191 | return 0; | 4475 | return 0; |
4476 | |||
4477 | error: | ||
4478 | alc_free(codec); | ||
4479 | return err; | ||
4192 | } | 4480 | } |
4193 | 4481 | ||
4194 | /* | 4482 | /* |
@@ -4237,14 +4525,9 @@ static int alc268_parse_auto_config(struct hda_codec *codec) | |||
4237 | 4525 | ||
4238 | /* | 4526 | /* |
4239 | */ | 4527 | */ |
4240 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS | ||
4241 | #include "alc268_quirks.c" | ||
4242 | #endif | ||
4243 | |||
4244 | static int patch_alc268(struct hda_codec *codec) | 4528 | static int patch_alc268(struct hda_codec *codec) |
4245 | { | 4529 | { |
4246 | struct alc_spec *spec; | 4530 | struct alc_spec *spec; |
4247 | int board_config; | ||
4248 | int i, has_beep, err; | 4531 | int i, has_beep, err; |
4249 | 4532 | ||
4250 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 4533 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
@@ -4255,38 +4538,10 @@ static int patch_alc268(struct hda_codec *codec) | |||
4255 | 4538 | ||
4256 | /* ALC268 has no aa-loopback mixer */ | 4539 | /* ALC268 has no aa-loopback mixer */ |
4257 | 4540 | ||
4258 | board_config = alc_board_config(codec, ALC268_MODEL_LAST, | 4541 | /* automatic parse from the BIOS config */ |
4259 | alc268_models, alc268_cfg_tbl); | 4542 | err = alc268_parse_auto_config(codec); |
4260 | 4543 | if (err < 0) | |
4261 | if (board_config < 0) | 4544 | goto error; |
4262 | board_config = alc_board_codec_sid_config(codec, | ||
4263 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); | ||
4264 | |||
4265 | if (board_config < 0) { | ||
4266 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | ||
4267 | codec->chip_name); | ||
4268 | board_config = ALC_MODEL_AUTO; | ||
4269 | } | ||
4270 | |||
4271 | if (board_config == ALC_MODEL_AUTO) { | ||
4272 | /* automatic parse from the BIOS config */ | ||
4273 | err = alc268_parse_auto_config(codec); | ||
4274 | if (err < 0) { | ||
4275 | alc_free(codec); | ||
4276 | return err; | ||
4277 | } | ||
4278 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS | ||
4279 | else if (!err) { | ||
4280 | printk(KERN_INFO | ||
4281 | "hda_codec: Cannot set up configuration " | ||
4282 | "from BIOS. Using base mode...\n"); | ||
4283 | board_config = ALC268_3ST; | ||
4284 | } | ||
4285 | #endif | ||
4286 | } | ||
4287 | |||
4288 | if (board_config != ALC_MODEL_AUTO) | ||
4289 | setup_preset(codec, &alc268_presets[board_config]); | ||
4290 | 4545 | ||
4291 | has_beep = 0; | 4546 | has_beep = 0; |
4292 | for (i = 0; i < spec->num_mixers; i++) { | 4547 | for (i = 0; i < spec->num_mixers; i++) { |
@@ -4298,10 +4553,8 @@ static int patch_alc268(struct hda_codec *codec) | |||
4298 | 4553 | ||
4299 | if (has_beep) { | 4554 | if (has_beep) { |
4300 | err = snd_hda_attach_beep_device(codec, 0x1); | 4555 | err = snd_hda_attach_beep_device(codec, 0x1); |
4301 | if (err < 0) { | 4556 | if (err < 0) |
4302 | alc_free(codec); | 4557 | goto error; |
4303 | return err; | ||
4304 | } | ||
4305 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) | 4558 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
4306 | /* override the amp caps for beep generator */ | 4559 | /* override the amp caps for beep generator */ |
4307 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, | 4560 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
@@ -4323,13 +4576,16 @@ static int patch_alc268(struct hda_codec *codec) | |||
4323 | spec->vmaster_nid = 0x02; | 4576 | spec->vmaster_nid = 0x02; |
4324 | 4577 | ||
4325 | codec->patch_ops = alc_patch_ops; | 4578 | codec->patch_ops = alc_patch_ops; |
4326 | if (board_config == ALC_MODEL_AUTO) | 4579 | spec->init_hook = alc_auto_init_std; |
4327 | spec->init_hook = alc_auto_init_std; | ||
4328 | spec->shutup = alc_eapd_shutup; | 4580 | spec->shutup = alc_eapd_shutup; |
4329 | 4581 | ||
4330 | alc_init_jacks(codec); | 4582 | alc_init_jacks(codec); |
4331 | 4583 | ||
4332 | return 0; | 4584 | return 0; |
4585 | |||
4586 | error: | ||
4587 | alc_free(codec); | ||
4588 | return err; | ||
4333 | } | 4589 | } |
4334 | 4590 | ||
4335 | /* | 4591 | /* |
@@ -4423,9 +4679,9 @@ static void alc269_toggle_power_output(struct hda_codec *codec, int power_up) | |||
4423 | 4679 | ||
4424 | static void alc269_shutup(struct hda_codec *codec) | 4680 | static void alc269_shutup(struct hda_codec *codec) |
4425 | { | 4681 | { |
4426 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) | 4682 | if ((alc_get_coef0(codec) & 0x00ff) == 0x017) |
4427 | alc269_toggle_power_output(codec, 0); | 4683 | alc269_toggle_power_output(codec, 0); |
4428 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { | 4684 | if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { |
4429 | alc269_toggle_power_output(codec, 0); | 4685 | alc269_toggle_power_output(codec, 0); |
4430 | msleep(150); | 4686 | msleep(150); |
4431 | } | 4687 | } |
@@ -4434,19 +4690,19 @@ static void alc269_shutup(struct hda_codec *codec) | |||
4434 | #ifdef CONFIG_PM | 4690 | #ifdef CONFIG_PM |
4435 | static int alc269_resume(struct hda_codec *codec) | 4691 | static int alc269_resume(struct hda_codec *codec) |
4436 | { | 4692 | { |
4437 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { | 4693 | if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { |
4438 | alc269_toggle_power_output(codec, 0); | 4694 | alc269_toggle_power_output(codec, 0); |
4439 | msleep(150); | 4695 | msleep(150); |
4440 | } | 4696 | } |
4441 | 4697 | ||
4442 | codec->patch_ops.init(codec); | 4698 | codec->patch_ops.init(codec); |
4443 | 4699 | ||
4444 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { | 4700 | if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { |
4445 | alc269_toggle_power_output(codec, 1); | 4701 | alc269_toggle_power_output(codec, 1); |
4446 | msleep(200); | 4702 | msleep(200); |
4447 | } | 4703 | } |
4448 | 4704 | ||
4449 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) | 4705 | if ((alc_get_coef0(codec) & 0x00ff) == 0x018) |
4450 | alc269_toggle_power_output(codec, 1); | 4706 | alc269_toggle_power_output(codec, 1); |
4451 | 4707 | ||
4452 | snd_hda_codec_resume_amp(codec); | 4708 | snd_hda_codec_resume_amp(codec); |
@@ -4515,6 +4771,30 @@ static void alc269_fixup_stereo_dmic(struct hda_codec *codec, | |||
4515 | alc_write_coef_idx(codec, 0x07, coef | 0x80); | 4771 | alc_write_coef_idx(codec, 0x07, coef | 0x80); |
4516 | } | 4772 | } |
4517 | 4773 | ||
4774 | static void alc269_quanta_automute(struct hda_codec *codec) | ||
4775 | { | ||
4776 | update_outputs(codec); | ||
4777 | |||
4778 | snd_hda_codec_write(codec, 0x20, 0, | ||
4779 | AC_VERB_SET_COEF_INDEX, 0x0c); | ||
4780 | snd_hda_codec_write(codec, 0x20, 0, | ||
4781 | AC_VERB_SET_PROC_COEF, 0x680); | ||
4782 | |||
4783 | snd_hda_codec_write(codec, 0x20, 0, | ||
4784 | AC_VERB_SET_COEF_INDEX, 0x0c); | ||
4785 | snd_hda_codec_write(codec, 0x20, 0, | ||
4786 | AC_VERB_SET_PROC_COEF, 0x480); | ||
4787 | } | ||
4788 | |||
4789 | static void alc269_fixup_quanta_mute(struct hda_codec *codec, | ||
4790 | const struct alc_fixup *fix, int action) | ||
4791 | { | ||
4792 | struct alc_spec *spec = codec->spec; | ||
4793 | if (action != ALC_FIXUP_ACT_PROBE) | ||
4794 | return; | ||
4795 | spec->automute_hook = alc269_quanta_automute; | ||
4796 | } | ||
4797 | |||
4518 | enum { | 4798 | enum { |
4519 | ALC269_FIXUP_SONY_VAIO, | 4799 | ALC269_FIXUP_SONY_VAIO, |
4520 | ALC275_FIXUP_SONY_VAIO_GPIO2, | 4800 | ALC275_FIXUP_SONY_VAIO_GPIO2, |
@@ -4526,6 +4806,12 @@ enum { | |||
4526 | ALC271_FIXUP_DMIC, | 4806 | ALC271_FIXUP_DMIC, |
4527 | ALC269_FIXUP_PCM_44K, | 4807 | ALC269_FIXUP_PCM_44K, |
4528 | ALC269_FIXUP_STEREO_DMIC, | 4808 | ALC269_FIXUP_STEREO_DMIC, |
4809 | ALC269_FIXUP_QUANTA_MUTE, | ||
4810 | ALC269_FIXUP_LIFEBOOK, | ||
4811 | ALC269_FIXUP_AMIC, | ||
4812 | ALC269_FIXUP_DMIC, | ||
4813 | ALC269VB_FIXUP_AMIC, | ||
4814 | ALC269VB_FIXUP_DMIC, | ||
4529 | }; | 4815 | }; |
4530 | 4816 | ||
4531 | static const struct alc_fixup alc269_fixups[] = { | 4817 | static const struct alc_fixup alc269_fixups[] = { |
@@ -4592,6 +4878,60 @@ static const struct alc_fixup alc269_fixups[] = { | |||
4592 | .type = ALC_FIXUP_FUNC, | 4878 | .type = ALC_FIXUP_FUNC, |
4593 | .v.func = alc269_fixup_stereo_dmic, | 4879 | .v.func = alc269_fixup_stereo_dmic, |
4594 | }, | 4880 | }, |
4881 | [ALC269_FIXUP_QUANTA_MUTE] = { | ||
4882 | .type = ALC_FIXUP_FUNC, | ||
4883 | .v.func = alc269_fixup_quanta_mute, | ||
4884 | }, | ||
4885 | [ALC269_FIXUP_LIFEBOOK] = { | ||
4886 | .type = ALC_FIXUP_PINS, | ||
4887 | .v.pins = (const struct alc_pincfg[]) { | ||
4888 | { 0x1a, 0x2101103f }, /* dock line-out */ | ||
4889 | { 0x1b, 0x23a11040 }, /* dock mic-in */ | ||
4890 | { } | ||
4891 | }, | ||
4892 | .chained = true, | ||
4893 | .chain_id = ALC269_FIXUP_QUANTA_MUTE | ||
4894 | }, | ||
4895 | [ALC269_FIXUP_AMIC] = { | ||
4896 | .type = ALC_FIXUP_PINS, | ||
4897 | .v.pins = (const struct alc_pincfg[]) { | ||
4898 | { 0x14, 0x99130110 }, /* speaker */ | ||
4899 | { 0x15, 0x0121401f }, /* HP out */ | ||
4900 | { 0x18, 0x01a19c20 }, /* mic */ | ||
4901 | { 0x19, 0x99a3092f }, /* int-mic */ | ||
4902 | { } | ||
4903 | }, | ||
4904 | }, | ||
4905 | [ALC269_FIXUP_DMIC] = { | ||
4906 | .type = ALC_FIXUP_PINS, | ||
4907 | .v.pins = (const struct alc_pincfg[]) { | ||
4908 | { 0x12, 0x99a3092f }, /* int-mic */ | ||
4909 | { 0x14, 0x99130110 }, /* speaker */ | ||
4910 | { 0x15, 0x0121401f }, /* HP out */ | ||
4911 | { 0x18, 0x01a19c20 }, /* mic */ | ||
4912 | { } | ||
4913 | }, | ||
4914 | }, | ||
4915 | [ALC269VB_FIXUP_AMIC] = { | ||
4916 | .type = ALC_FIXUP_PINS, | ||
4917 | .v.pins = (const struct alc_pincfg[]) { | ||
4918 | { 0x14, 0x99130110 }, /* speaker */ | ||
4919 | { 0x18, 0x01a19c20 }, /* mic */ | ||
4920 | { 0x19, 0x99a3092f }, /* int-mic */ | ||
4921 | { 0x21, 0x0121401f }, /* HP out */ | ||
4922 | { } | ||
4923 | }, | ||
4924 | }, | ||
4925 | [ALC269_FIXUP_DMIC] = { | ||
4926 | .type = ALC_FIXUP_PINS, | ||
4927 | .v.pins = (const struct alc_pincfg[]) { | ||
4928 | { 0x12, 0x99a3092f }, /* int-mic */ | ||
4929 | { 0x14, 0x99130110 }, /* speaker */ | ||
4930 | { 0x18, 0x01a19c20 }, /* mic */ | ||
4931 | { 0x21, 0x0121401f }, /* HP out */ | ||
4932 | { } | ||
4933 | }, | ||
4934 | }, | ||
4595 | }; | 4935 | }; |
4596 | 4936 | ||
4597 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { | 4937 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
@@ -4607,13 +4947,71 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
4607 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), | 4947 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
4608 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), | 4948 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
4609 | SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC), | 4949 | SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC), |
4950 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK), | ||
4610 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), | 4951 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), |
4611 | SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), | 4952 | SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), |
4612 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), | 4953 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), |
4613 | SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE), | 4954 | SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE), |
4614 | SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE), | 4955 | SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE), |
4956 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_QUANTA_MUTE), | ||
4615 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Lenovo Ideapd", ALC269_FIXUP_PCM_44K), | 4957 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Lenovo Ideapd", ALC269_FIXUP_PCM_44K), |
4616 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), | 4958 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), |
4959 | |||
4960 | #if 1 | ||
4961 | /* Below is a quirk table taken from the old code. | ||
4962 | * Basically the device should work as is without the fixup table. | ||
4963 | * If BIOS doesn't give a proper info, enable the corresponding | ||
4964 | * fixup entry. | ||
4965 | */ | ||
4966 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", | ||
4967 | ALC269_FIXUP_AMIC), | ||
4968 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC), | ||
4969 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269_FIXUP_AMIC), | ||
4970 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC), | ||
4971 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC), | ||
4972 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC), | ||
4973 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC), | ||
4974 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC), | ||
4975 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC), | ||
4976 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC), | ||
4977 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC), | ||
4978 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC), | ||
4979 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC), | ||
4980 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC), | ||
4981 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC), | ||
4982 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC), | ||
4983 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC), | ||
4984 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC), | ||
4985 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC), | ||
4986 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC), | ||
4987 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC), | ||
4988 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC), | ||
4989 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC), | ||
4990 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC), | ||
4991 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC), | ||
4992 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC), | ||
4993 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC), | ||
4994 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC), | ||
4995 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC), | ||
4996 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC), | ||
4997 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC), | ||
4998 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC), | ||
4999 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC), | ||
5000 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC), | ||
5001 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC), | ||
5002 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC), | ||
5003 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC), | ||
5004 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC), | ||
5005 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC), | ||
5006 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC), | ||
5007 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC), | ||
5008 | #endif | ||
5009 | {} | ||
5010 | }; | ||
5011 | |||
5012 | static const struct alc_model_fixup alc269_fixup_models[] = { | ||
5013 | {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"}, | ||
5014 | {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"}, | ||
4617 | {} | 5015 | {} |
4618 | }; | 5016 | }; |
4619 | 5017 | ||
@@ -4622,23 +5020,23 @@ static int alc269_fill_coef(struct hda_codec *codec) | |||
4622 | { | 5020 | { |
4623 | int val; | 5021 | int val; |
4624 | 5022 | ||
4625 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) { | 5023 | if ((alc_get_coef0(codec) & 0x00ff) < 0x015) { |
4626 | alc_write_coef_idx(codec, 0xf, 0x960b); | 5024 | alc_write_coef_idx(codec, 0xf, 0x960b); |
4627 | alc_write_coef_idx(codec, 0xe, 0x8817); | 5025 | alc_write_coef_idx(codec, 0xe, 0x8817); |
4628 | } | 5026 | } |
4629 | 5027 | ||
4630 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) { | 5028 | if ((alc_get_coef0(codec) & 0x00ff) == 0x016) { |
4631 | alc_write_coef_idx(codec, 0xf, 0x960b); | 5029 | alc_write_coef_idx(codec, 0xf, 0x960b); |
4632 | alc_write_coef_idx(codec, 0xe, 0x8814); | 5030 | alc_write_coef_idx(codec, 0xe, 0x8814); |
4633 | } | 5031 | } |
4634 | 5032 | ||
4635 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { | 5033 | if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { |
4636 | val = alc_read_coef_idx(codec, 0x04); | 5034 | val = alc_read_coef_idx(codec, 0x04); |
4637 | /* Power up output pin */ | 5035 | /* Power up output pin */ |
4638 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); | 5036 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); |
4639 | } | 5037 | } |
4640 | 5038 | ||
4641 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { | 5039 | if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { |
4642 | val = alc_read_coef_idx(codec, 0xd); | 5040 | val = alc_read_coef_idx(codec, 0xd); |
4643 | if ((val & 0x0c00) >> 10 != 0x1) { | 5041 | if ((val & 0x0c00) >> 10 != 0x1) { |
4644 | /* Capless ramp up clock control */ | 5042 | /* Capless ramp up clock control */ |
@@ -4662,15 +5060,10 @@ static int alc269_fill_coef(struct hda_codec *codec) | |||
4662 | 5060 | ||
4663 | /* | 5061 | /* |
4664 | */ | 5062 | */ |
4665 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS | ||
4666 | #include "alc269_quirks.c" | ||
4667 | #endif | ||
4668 | |||
4669 | static int patch_alc269(struct hda_codec *codec) | 5063 | static int patch_alc269(struct hda_codec *codec) |
4670 | { | 5064 | { |
4671 | struct alc_spec *spec; | 5065 | struct alc_spec *spec; |
4672 | int board_config, coef; | 5066 | int err = 0; |
4673 | int err; | ||
4674 | 5067 | ||
4675 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 5068 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
4676 | if (spec == NULL) | 5069 | if (spec == NULL) |
@@ -4682,72 +5075,41 @@ static int patch_alc269(struct hda_codec *codec) | |||
4682 | 5075 | ||
4683 | alc_auto_parse_customize_define(codec); | 5076 | alc_auto_parse_customize_define(codec); |
4684 | 5077 | ||
5078 | err = alc_codec_rename_from_preset(codec); | ||
5079 | if (err < 0) | ||
5080 | goto error; | ||
5081 | |||
4685 | if (codec->vendor_id == 0x10ec0269) { | 5082 | if (codec->vendor_id == 0x10ec0269) { |
4686 | spec->codec_variant = ALC269_TYPE_ALC269VA; | 5083 | spec->codec_variant = ALC269_TYPE_ALC269VA; |
4687 | coef = alc_read_coef_idx(codec, 0); | 5084 | switch (alc_get_coef0(codec) & 0x00f0) { |
4688 | if ((coef & 0x00f0) == 0x0010) { | 5085 | case 0x0010: |
4689 | if (codec->bus->pci->subsystem_vendor == 0x1025 && | 5086 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
4690 | spec->cdefine.platform_type == 1) { | 5087 | spec->cdefine.platform_type == 1) |
4691 | alc_codec_rename(codec, "ALC271X"); | 5088 | err = alc_codec_rename(codec, "ALC271X"); |
4692 | } else if ((coef & 0xf000) == 0x2000) { | ||
4693 | alc_codec_rename(codec, "ALC259"); | ||
4694 | } else if ((coef & 0xf000) == 0x3000) { | ||
4695 | alc_codec_rename(codec, "ALC258"); | ||
4696 | } else if ((coef & 0xfff0) == 0x3010) { | ||
4697 | alc_codec_rename(codec, "ALC277"); | ||
4698 | } else { | ||
4699 | alc_codec_rename(codec, "ALC269VB"); | ||
4700 | } | ||
4701 | spec->codec_variant = ALC269_TYPE_ALC269VB; | 5089 | spec->codec_variant = ALC269_TYPE_ALC269VB; |
4702 | } else if ((coef & 0x00f0) == 0x0020) { | 5090 | break; |
4703 | if (coef == 0xa023) | 5091 | case 0x0020: |
4704 | alc_codec_rename(codec, "ALC259"); | 5092 | if (codec->bus->pci->subsystem_vendor == 0x17aa && |
4705 | else if (coef == 0x6023) | 5093 | codec->bus->pci->subsystem_device == 0x21f3) |
4706 | alc_codec_rename(codec, "ALC281X"); | 5094 | err = alc_codec_rename(codec, "ALC3202"); |
4707 | else if (codec->bus->pci->subsystem_vendor == 0x17aa && | ||
4708 | codec->bus->pci->subsystem_device == 0x21f3) | ||
4709 | alc_codec_rename(codec, "ALC3202"); | ||
4710 | else | ||
4711 | alc_codec_rename(codec, "ALC269VC"); | ||
4712 | spec->codec_variant = ALC269_TYPE_ALC269VC; | 5095 | spec->codec_variant = ALC269_TYPE_ALC269VC; |
4713 | } else | 5096 | break; |
5097 | default: | ||
4714 | alc_fix_pll_init(codec, 0x20, 0x04, 15); | 5098 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
5099 | } | ||
5100 | if (err < 0) | ||
5101 | goto error; | ||
4715 | alc269_fill_coef(codec); | 5102 | alc269_fill_coef(codec); |
4716 | } | 5103 | } |
4717 | 5104 | ||
4718 | board_config = alc_board_config(codec, ALC269_MODEL_LAST, | 5105 | alc_pick_fixup(codec, alc269_fixup_models, |
4719 | alc269_models, alc269_cfg_tbl); | 5106 | alc269_fixup_tbl, alc269_fixups); |
4720 | 5107 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); | |
4721 | if (board_config < 0) { | ||
4722 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | ||
4723 | codec->chip_name); | ||
4724 | board_config = ALC_MODEL_AUTO; | ||
4725 | } | ||
4726 | |||
4727 | if (board_config == ALC_MODEL_AUTO) { | ||
4728 | alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups); | ||
4729 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); | ||
4730 | } | ||
4731 | |||
4732 | if (board_config == ALC_MODEL_AUTO) { | ||
4733 | /* automatic parse from the BIOS config */ | ||
4734 | err = alc269_parse_auto_config(codec); | ||
4735 | if (err < 0) { | ||
4736 | alc_free(codec); | ||
4737 | return err; | ||
4738 | } | ||
4739 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS | ||
4740 | else if (!err) { | ||
4741 | printk(KERN_INFO | ||
4742 | "hda_codec: Cannot set up configuration " | ||
4743 | "from BIOS. Using base mode...\n"); | ||
4744 | board_config = ALC269_BASIC; | ||
4745 | } | ||
4746 | #endif | ||
4747 | } | ||
4748 | 5108 | ||
4749 | if (board_config != ALC_MODEL_AUTO) | 5109 | /* automatic parse from the BIOS config */ |
4750 | setup_preset(codec, &alc269_presets[board_config]); | 5110 | err = alc269_parse_auto_config(codec); |
5111 | if (err < 0) | ||
5112 | goto error; | ||
4751 | 5113 | ||
4752 | if (!spec->no_analog && !spec->adc_nids) { | 5114 | if (!spec->no_analog && !spec->adc_nids) { |
4753 | alc_auto_fill_adc_caps(codec); | 5115 | alc_auto_fill_adc_caps(codec); |
@@ -4760,10 +5122,8 @@ static int patch_alc269(struct hda_codec *codec) | |||
4760 | 5122 | ||
4761 | if (!spec->no_analog && has_cdefine_beep(codec)) { | 5123 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
4762 | err = snd_hda_attach_beep_device(codec, 0x1); | 5124 | err = snd_hda_attach_beep_device(codec, 0x1); |
4763 | if (err < 0) { | 5125 | if (err < 0) |
4764 | alc_free(codec); | 5126 | goto error; |
4765 | return err; | ||
4766 | } | ||
4767 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); | 5127 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
4768 | } | 5128 | } |
4769 | 5129 | ||
@@ -4775,8 +5135,7 @@ static int patch_alc269(struct hda_codec *codec) | |||
4775 | #ifdef CONFIG_PM | 5135 | #ifdef CONFIG_PM |
4776 | codec->patch_ops.resume = alc269_resume; | 5136 | codec->patch_ops.resume = alc269_resume; |
4777 | #endif | 5137 | #endif |
4778 | if (board_config == ALC_MODEL_AUTO) | 5138 | spec->init_hook = alc_auto_init_std; |
4779 | spec->init_hook = alc_auto_init_std; | ||
4780 | spec->shutup = alc269_shutup; | 5139 | spec->shutup = alc269_shutup; |
4781 | 5140 | ||
4782 | alc_init_jacks(codec); | 5141 | alc_init_jacks(codec); |
@@ -4788,6 +5147,10 @@ static int patch_alc269(struct hda_codec *codec) | |||
4788 | #endif | 5147 | #endif |
4789 | 5148 | ||
4790 | return 0; | 5149 | return 0; |
5150 | |||
5151 | error: | ||
5152 | alc_free(codec); | ||
5153 | return err; | ||
4791 | } | 5154 | } |
4792 | 5155 | ||
4793 | /* | 5156 | /* |
@@ -4835,14 +5198,9 @@ static const struct snd_pci_quirk alc861_fixup_tbl[] = { | |||
4835 | 5198 | ||
4836 | /* | 5199 | /* |
4837 | */ | 5200 | */ |
4838 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS | ||
4839 | #include "alc861_quirks.c" | ||
4840 | #endif | ||
4841 | |||
4842 | static int patch_alc861(struct hda_codec *codec) | 5201 | static int patch_alc861(struct hda_codec *codec) |
4843 | { | 5202 | { |
4844 | struct alc_spec *spec; | 5203 | struct alc_spec *spec; |
4845 | int board_config; | ||
4846 | int err; | 5204 | int err; |
4847 | 5205 | ||
4848 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 5206 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
@@ -4853,39 +5211,13 @@ static int patch_alc861(struct hda_codec *codec) | |||
4853 | 5211 | ||
4854 | spec->mixer_nid = 0x15; | 5212 | spec->mixer_nid = 0x15; |
4855 | 5213 | ||
4856 | board_config = alc_board_config(codec, ALC861_MODEL_LAST, | 5214 | alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); |
4857 | alc861_models, alc861_cfg_tbl); | 5215 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
4858 | |||
4859 | if (board_config < 0) { | ||
4860 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | ||
4861 | codec->chip_name); | ||
4862 | board_config = ALC_MODEL_AUTO; | ||
4863 | } | ||
4864 | |||
4865 | if (board_config == ALC_MODEL_AUTO) { | ||
4866 | alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); | ||
4867 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); | ||
4868 | } | ||
4869 | 5216 | ||
4870 | if (board_config == ALC_MODEL_AUTO) { | 5217 | /* automatic parse from the BIOS config */ |
4871 | /* automatic parse from the BIOS config */ | 5218 | err = alc861_parse_auto_config(codec); |
4872 | err = alc861_parse_auto_config(codec); | 5219 | if (err < 0) |
4873 | if (err < 0) { | 5220 | goto error; |
4874 | alc_free(codec); | ||
4875 | return err; | ||
4876 | } | ||
4877 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS | ||
4878 | else if (!err) { | ||
4879 | printk(KERN_INFO | ||
4880 | "hda_codec: Cannot set up configuration " | ||
4881 | "from BIOS. Using base mode...\n"); | ||
4882 | board_config = ALC861_3ST_DIG; | ||
4883 | } | ||
4884 | #endif | ||
4885 | } | ||
4886 | |||
4887 | if (board_config != ALC_MODEL_AUTO) | ||
4888 | setup_preset(codec, &alc861_presets[board_config]); | ||
4889 | 5221 | ||
4890 | if (!spec->no_analog && !spec->adc_nids) { | 5222 | if (!spec->no_analog && !spec->adc_nids) { |
4891 | alc_auto_fill_adc_caps(codec); | 5223 | alc_auto_fill_adc_caps(codec); |
@@ -4898,10 +5230,8 @@ static int patch_alc861(struct hda_codec *codec) | |||
4898 | 5230 | ||
4899 | if (!spec->no_analog) { | 5231 | if (!spec->no_analog) { |
4900 | err = snd_hda_attach_beep_device(codec, 0x23); | 5232 | err = snd_hda_attach_beep_device(codec, 0x23); |
4901 | if (err < 0) { | 5233 | if (err < 0) |
4902 | alc_free(codec); | 5234 | goto error; |
4903 | return err; | ||
4904 | } | ||
4905 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); | 5235 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
4906 | } | 5236 | } |
4907 | 5237 | ||
@@ -4910,18 +5240,18 @@ static int patch_alc861(struct hda_codec *codec) | |||
4910 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); | 5240 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
4911 | 5241 | ||
4912 | codec->patch_ops = alc_patch_ops; | 5242 | codec->patch_ops = alc_patch_ops; |
4913 | if (board_config == ALC_MODEL_AUTO) { | 5243 | spec->init_hook = alc_auto_init_std; |
4914 | spec->init_hook = alc_auto_init_std; | ||
4915 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
4916 | spec->power_hook = alc_power_eapd; | ||
4917 | #endif | ||
4918 | } | ||
4919 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 5244 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
5245 | spec->power_hook = alc_power_eapd; | ||
4920 | if (!spec->loopback.amplist) | 5246 | if (!spec->loopback.amplist) |
4921 | spec->loopback.amplist = alc861_loopbacks; | 5247 | spec->loopback.amplist = alc861_loopbacks; |
4922 | #endif | 5248 | #endif |
4923 | 5249 | ||
4924 | return 0; | 5250 | return 0; |
5251 | |||
5252 | error: | ||
5253 | alc_free(codec); | ||
5254 | return err; | ||
4925 | } | 5255 | } |
4926 | 5256 | ||
4927 | /* | 5257 | /* |
@@ -4943,24 +5273,41 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec) | |||
4943 | } | 5273 | } |
4944 | 5274 | ||
4945 | enum { | 5275 | enum { |
4946 | ALC660VD_FIX_ASUS_GPIO1 | 5276 | ALC660VD_FIX_ASUS_GPIO1, |
5277 | ALC861VD_FIX_DALLAS, | ||
4947 | }; | 5278 | }; |
4948 | 5279 | ||
4949 | /* reset GPIO1 */ | 5280 | /* exclude VREF80 */ |
5281 | static void alc861vd_fixup_dallas(struct hda_codec *codec, | ||
5282 | const struct alc_fixup *fix, int action) | ||
5283 | { | ||
5284 | if (action == ALC_FIXUP_ACT_PRE_PROBE) { | ||
5285 | snd_hda_override_pin_caps(codec, 0x18, 0x00001714); | ||
5286 | snd_hda_override_pin_caps(codec, 0x19, 0x0000171c); | ||
5287 | } | ||
5288 | } | ||
5289 | |||
4950 | static const struct alc_fixup alc861vd_fixups[] = { | 5290 | static const struct alc_fixup alc861vd_fixups[] = { |
4951 | [ALC660VD_FIX_ASUS_GPIO1] = { | 5291 | [ALC660VD_FIX_ASUS_GPIO1] = { |
4952 | .type = ALC_FIXUP_VERBS, | 5292 | .type = ALC_FIXUP_VERBS, |
4953 | .v.verbs = (const struct hda_verb[]) { | 5293 | .v.verbs = (const struct hda_verb[]) { |
5294 | /* reset GPIO1 */ | ||
4954 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, | 5295 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
4955 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | 5296 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
4956 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | 5297 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
4957 | { } | 5298 | { } |
4958 | } | 5299 | } |
4959 | }, | 5300 | }, |
5301 | [ALC861VD_FIX_DALLAS] = { | ||
5302 | .type = ALC_FIXUP_FUNC, | ||
5303 | .v.func = alc861vd_fixup_dallas, | ||
5304 | }, | ||
4960 | }; | 5305 | }; |
4961 | 5306 | ||
4962 | static const struct snd_pci_quirk alc861vd_fixup_tbl[] = { | 5307 | static const struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
5308 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS), | ||
4963 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), | 5309 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
5310 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS), | ||
4964 | {} | 5311 | {} |
4965 | }; | 5312 | }; |
4966 | 5313 | ||
@@ -4972,14 +5319,10 @@ static const struct hda_verb alc660vd_eapd_verbs[] = { | |||
4972 | 5319 | ||
4973 | /* | 5320 | /* |
4974 | */ | 5321 | */ |
4975 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS | ||
4976 | #include "alc861vd_quirks.c" | ||
4977 | #endif | ||
4978 | |||
4979 | static int patch_alc861vd(struct hda_codec *codec) | 5322 | static int patch_alc861vd(struct hda_codec *codec) |
4980 | { | 5323 | { |
4981 | struct alc_spec *spec; | 5324 | struct alc_spec *spec; |
4982 | int err, board_config; | 5325 | int err; |
4983 | 5326 | ||
4984 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 5327 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
4985 | if (spec == NULL) | 5328 | if (spec == NULL) |
@@ -4989,39 +5332,13 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
4989 | 5332 | ||
4990 | spec->mixer_nid = 0x0b; | 5333 | spec->mixer_nid = 0x0b; |
4991 | 5334 | ||
4992 | board_config = alc_board_config(codec, ALC861VD_MODEL_LAST, | 5335 | alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); |
4993 | alc861vd_models, alc861vd_cfg_tbl); | 5336 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
4994 | 5337 | ||
4995 | if (board_config < 0) { | 5338 | /* automatic parse from the BIOS config */ |
4996 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | 5339 | err = alc861vd_parse_auto_config(codec); |
4997 | codec->chip_name); | 5340 | if (err < 0) |
4998 | board_config = ALC_MODEL_AUTO; | 5341 | goto error; |
4999 | } | ||
5000 | |||
5001 | if (board_config == ALC_MODEL_AUTO) { | ||
5002 | alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); | ||
5003 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); | ||
5004 | } | ||
5005 | |||
5006 | if (board_config == ALC_MODEL_AUTO) { | ||
5007 | /* automatic parse from the BIOS config */ | ||
5008 | err = alc861vd_parse_auto_config(codec); | ||
5009 | if (err < 0) { | ||
5010 | alc_free(codec); | ||
5011 | return err; | ||
5012 | } | ||
5013 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS | ||
5014 | else if (!err) { | ||
5015 | printk(KERN_INFO | ||
5016 | "hda_codec: Cannot set up configuration " | ||
5017 | "from BIOS. Using base mode...\n"); | ||
5018 | board_config = ALC861VD_3ST; | ||
5019 | } | ||
5020 | #endif | ||
5021 | } | ||
5022 | |||
5023 | if (board_config != ALC_MODEL_AUTO) | ||
5024 | setup_preset(codec, &alc861vd_presets[board_config]); | ||
5025 | 5342 | ||
5026 | if (codec->vendor_id == 0x10ec0660) { | 5343 | if (codec->vendor_id == 0x10ec0660) { |
5027 | /* always turn on EAPD */ | 5344 | /* always turn on EAPD */ |
@@ -5039,10 +5356,8 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
5039 | 5356 | ||
5040 | if (!spec->no_analog) { | 5357 | if (!spec->no_analog) { |
5041 | err = snd_hda_attach_beep_device(codec, 0x23); | 5358 | err = snd_hda_attach_beep_device(codec, 0x23); |
5042 | if (err < 0) { | 5359 | if (err < 0) |
5043 | alc_free(codec); | 5360 | goto error; |
5044 | return err; | ||
5045 | } | ||
5046 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | 5361 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
5047 | } | 5362 | } |
5048 | 5363 | ||
@@ -5052,8 +5367,7 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
5052 | 5367 | ||
5053 | codec->patch_ops = alc_patch_ops; | 5368 | codec->patch_ops = alc_patch_ops; |
5054 | 5369 | ||
5055 | if (board_config == ALC_MODEL_AUTO) | 5370 | spec->init_hook = alc_auto_init_std; |
5056 | spec->init_hook = alc_auto_init_std; | ||
5057 | spec->shutup = alc_eapd_shutup; | 5371 | spec->shutup = alc_eapd_shutup; |
5058 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 5372 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
5059 | if (!spec->loopback.amplist) | 5373 | if (!spec->loopback.amplist) |
@@ -5061,6 +5375,10 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
5061 | #endif | 5375 | #endif |
5062 | 5376 | ||
5063 | return 0; | 5377 | return 0; |
5378 | |||
5379 | error: | ||
5380 | alc_free(codec); | ||
5381 | return err; | ||
5064 | } | 5382 | } |
5065 | 5383 | ||
5066 | /* | 5384 | /* |
@@ -5118,6 +5436,14 @@ enum { | |||
5118 | ALC662_FIXUP_CZC_P10T, | 5436 | ALC662_FIXUP_CZC_P10T, |
5119 | ALC662_FIXUP_SKU_IGNORE, | 5437 | ALC662_FIXUP_SKU_IGNORE, |
5120 | ALC662_FIXUP_HP_RP5800, | 5438 | ALC662_FIXUP_HP_RP5800, |
5439 | ALC662_FIXUP_ASUS_MODE1, | ||
5440 | ALC662_FIXUP_ASUS_MODE2, | ||
5441 | ALC662_FIXUP_ASUS_MODE3, | ||
5442 | ALC662_FIXUP_ASUS_MODE4, | ||
5443 | ALC662_FIXUP_ASUS_MODE5, | ||
5444 | ALC662_FIXUP_ASUS_MODE6, | ||
5445 | ALC662_FIXUP_ASUS_MODE7, | ||
5446 | ALC662_FIXUP_ASUS_MODE8, | ||
5121 | }; | 5447 | }; |
5122 | 5448 | ||
5123 | static const struct alc_fixup alc662_fixups[] = { | 5449 | static const struct alc_fixup alc662_fixups[] = { |
@@ -5159,37 +5485,204 @@ static const struct alc_fixup alc662_fixups[] = { | |||
5159 | .chained = true, | 5485 | .chained = true, |
5160 | .chain_id = ALC662_FIXUP_SKU_IGNORE | 5486 | .chain_id = ALC662_FIXUP_SKU_IGNORE |
5161 | }, | 5487 | }, |
5488 | [ALC662_FIXUP_ASUS_MODE1] = { | ||
5489 | .type = ALC_FIXUP_PINS, | ||
5490 | .v.pins = (const struct alc_pincfg[]) { | ||
5491 | { 0x14, 0x99130110 }, /* speaker */ | ||
5492 | { 0x18, 0x01a19c20 }, /* mic */ | ||
5493 | { 0x19, 0x99a3092f }, /* int-mic */ | ||
5494 | { 0x21, 0x0121401f }, /* HP out */ | ||
5495 | { } | ||
5496 | }, | ||
5497 | .chained = true, | ||
5498 | .chain_id = ALC662_FIXUP_SKU_IGNORE | ||
5499 | }, | ||
5500 | [ALC662_FIXUP_ASUS_MODE2] = { | ||
5501 | .type = ALC_FIXUP_PINS, | ||
5502 | .v.pins = (const struct alc_pincfg[]) { | ||
5503 | { 0x14, 0x99130110 }, /* speaker */ | ||
5504 | { 0x18, 0x01a19820 }, /* mic */ | ||
5505 | { 0x19, 0x99a3092f }, /* int-mic */ | ||
5506 | { 0x1b, 0x0121401f }, /* HP out */ | ||
5507 | { } | ||
5508 | }, | ||
5509 | .chained = true, | ||
5510 | .chain_id = ALC662_FIXUP_SKU_IGNORE | ||
5511 | }, | ||
5512 | [ALC662_FIXUP_ASUS_MODE3] = { | ||
5513 | .type = ALC_FIXUP_PINS, | ||
5514 | .v.pins = (const struct alc_pincfg[]) { | ||
5515 | { 0x14, 0x99130110 }, /* speaker */ | ||
5516 | { 0x15, 0x0121441f }, /* HP */ | ||
5517 | { 0x18, 0x01a19840 }, /* mic */ | ||
5518 | { 0x19, 0x99a3094f }, /* int-mic */ | ||
5519 | { 0x21, 0x01211420 }, /* HP2 */ | ||
5520 | { } | ||
5521 | }, | ||
5522 | .chained = true, | ||
5523 | .chain_id = ALC662_FIXUP_SKU_IGNORE | ||
5524 | }, | ||
5525 | [ALC662_FIXUP_ASUS_MODE4] = { | ||
5526 | .type = ALC_FIXUP_PINS, | ||
5527 | .v.pins = (const struct alc_pincfg[]) { | ||
5528 | { 0x14, 0x99130110 }, /* speaker */ | ||
5529 | { 0x16, 0x99130111 }, /* speaker */ | ||
5530 | { 0x18, 0x01a19840 }, /* mic */ | ||
5531 | { 0x19, 0x99a3094f }, /* int-mic */ | ||
5532 | { 0x21, 0x0121441f }, /* HP */ | ||
5533 | { } | ||
5534 | }, | ||
5535 | .chained = true, | ||
5536 | .chain_id = ALC662_FIXUP_SKU_IGNORE | ||
5537 | }, | ||
5538 | [ALC662_FIXUP_ASUS_MODE5] = { | ||
5539 | .type = ALC_FIXUP_PINS, | ||
5540 | .v.pins = (const struct alc_pincfg[]) { | ||
5541 | { 0x14, 0x99130110 }, /* speaker */ | ||
5542 | { 0x15, 0x0121441f }, /* HP */ | ||
5543 | { 0x16, 0x99130111 }, /* speaker */ | ||
5544 | { 0x18, 0x01a19840 }, /* mic */ | ||
5545 | { 0x19, 0x99a3094f }, /* int-mic */ | ||
5546 | { } | ||
5547 | }, | ||
5548 | .chained = true, | ||
5549 | .chain_id = ALC662_FIXUP_SKU_IGNORE | ||
5550 | }, | ||
5551 | [ALC662_FIXUP_ASUS_MODE6] = { | ||
5552 | .type = ALC_FIXUP_PINS, | ||
5553 | .v.pins = (const struct alc_pincfg[]) { | ||
5554 | { 0x14, 0x99130110 }, /* speaker */ | ||
5555 | { 0x15, 0x01211420 }, /* HP2 */ | ||
5556 | { 0x18, 0x01a19840 }, /* mic */ | ||
5557 | { 0x19, 0x99a3094f }, /* int-mic */ | ||
5558 | { 0x1b, 0x0121441f }, /* HP */ | ||
5559 | { } | ||
5560 | }, | ||
5561 | .chained = true, | ||
5562 | .chain_id = ALC662_FIXUP_SKU_IGNORE | ||
5563 | }, | ||
5564 | [ALC662_FIXUP_ASUS_MODE7] = { | ||
5565 | .type = ALC_FIXUP_PINS, | ||
5566 | .v.pins = (const struct alc_pincfg[]) { | ||
5567 | { 0x14, 0x99130110 }, /* speaker */ | ||
5568 | { 0x17, 0x99130111 }, /* speaker */ | ||
5569 | { 0x18, 0x01a19840 }, /* mic */ | ||
5570 | { 0x19, 0x99a3094f }, /* int-mic */ | ||
5571 | { 0x1b, 0x01214020 }, /* HP */ | ||
5572 | { 0x21, 0x0121401f }, /* HP */ | ||
5573 | { } | ||
5574 | }, | ||
5575 | .chained = true, | ||
5576 | .chain_id = ALC662_FIXUP_SKU_IGNORE | ||
5577 | }, | ||
5578 | [ALC662_FIXUP_ASUS_MODE8] = { | ||
5579 | .type = ALC_FIXUP_PINS, | ||
5580 | .v.pins = (const struct alc_pincfg[]) { | ||
5581 | { 0x14, 0x99130110 }, /* speaker */ | ||
5582 | { 0x12, 0x99a30970 }, /* int-mic */ | ||
5583 | { 0x15, 0x01214020 }, /* HP */ | ||
5584 | { 0x17, 0x99130111 }, /* speaker */ | ||
5585 | { 0x18, 0x01a19840 }, /* mic */ | ||
5586 | { 0x21, 0x0121401f }, /* HP */ | ||
5587 | { } | ||
5588 | }, | ||
5589 | .chained = true, | ||
5590 | .chain_id = ALC662_FIXUP_SKU_IGNORE | ||
5591 | }, | ||
5162 | }; | 5592 | }; |
5163 | 5593 | ||
5164 | static const struct snd_pci_quirk alc662_fixup_tbl[] = { | 5594 | static const struct snd_pci_quirk alc662_fixup_tbl[] = { |
5595 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2), | ||
5165 | SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), | 5596 | SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), |
5166 | SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE), | 5597 | SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE), |
5167 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), | 5598 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
5168 | SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), | 5599 | SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), |
5600 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2), | ||
5169 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), | 5601 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
5170 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), | 5602 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
5171 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), | 5603 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
5172 | SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T), | 5604 | SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T), |
5605 | |||
5606 | #if 0 | ||
5607 | /* Below is a quirk table taken from the old code. | ||
5608 | * Basically the device should work as is without the fixup table. | ||
5609 | * If BIOS doesn't give a proper info, enable the corresponding | ||
5610 | * fixup entry. | ||
5611 | */ | ||
5612 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1), | ||
5613 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3), | ||
5614 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1), | ||
5615 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3), | ||
5616 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1), | ||
5617 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | ||
5618 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1), | ||
5619 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1), | ||
5620 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1), | ||
5621 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | ||
5622 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7), | ||
5623 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7), | ||
5624 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8), | ||
5625 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3), | ||
5626 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1), | ||
5627 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | ||
5628 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2), | ||
5629 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1), | ||
5630 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | ||
5631 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6), | ||
5632 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6), | ||
5633 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | ||
5634 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1), | ||
5635 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3), | ||
5636 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2), | ||
5637 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | ||
5638 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5), | ||
5639 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6), | ||
5640 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | ||
5641 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1), | ||
5642 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | ||
5643 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | ||
5644 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3), | ||
5645 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3), | ||
5646 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1), | ||
5647 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1), | ||
5648 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1), | ||
5649 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1), | ||
5650 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1), | ||
5651 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | ||
5652 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2), | ||
5653 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1), | ||
5654 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1), | ||
5655 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3), | ||
5656 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1), | ||
5657 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1), | ||
5658 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1), | ||
5659 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2), | ||
5660 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1), | ||
5661 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4), | ||
5662 | #endif | ||
5173 | {} | 5663 | {} |
5174 | }; | 5664 | }; |
5175 | 5665 | ||
5176 | static const struct alc_model_fixup alc662_fixup_models[] = { | 5666 | static const struct alc_model_fixup alc662_fixup_models[] = { |
5177 | {.id = ALC272_FIXUP_MARIO, .name = "mario"}, | 5667 | {.id = ALC272_FIXUP_MARIO, .name = "mario"}, |
5668 | {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"}, | ||
5669 | {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"}, | ||
5670 | {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"}, | ||
5671 | {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"}, | ||
5672 | {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"}, | ||
5673 | {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"}, | ||
5674 | {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"}, | ||
5675 | {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"}, | ||
5178 | {} | 5676 | {} |
5179 | }; | 5677 | }; |
5180 | 5678 | ||
5181 | 5679 | ||
5182 | /* | 5680 | /* |
5183 | */ | 5681 | */ |
5184 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS | ||
5185 | #include "alc662_quirks.c" | ||
5186 | #endif | ||
5187 | |||
5188 | static int patch_alc662(struct hda_codec *codec) | 5682 | static int patch_alc662(struct hda_codec *codec) |
5189 | { | 5683 | { |
5190 | struct alc_spec *spec; | 5684 | struct alc_spec *spec; |
5191 | int err, board_config; | 5685 | int err = 0; |
5192 | int coef; | ||
5193 | 5686 | ||
5194 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 5687 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
5195 | if (!spec) | 5688 | if (!spec) |
@@ -5199,50 +5692,31 @@ static int patch_alc662(struct hda_codec *codec) | |||
5199 | 5692 | ||
5200 | spec->mixer_nid = 0x0b; | 5693 | spec->mixer_nid = 0x0b; |
5201 | 5694 | ||
5695 | /* handle multiple HPs as is */ | ||
5696 | spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; | ||
5697 | |||
5202 | alc_auto_parse_customize_define(codec); | 5698 | alc_auto_parse_customize_define(codec); |
5203 | 5699 | ||
5204 | alc_fix_pll_init(codec, 0x20, 0x04, 15); | 5700 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
5205 | 5701 | ||
5206 | coef = alc_read_coef_idx(codec, 0); | 5702 | err = alc_codec_rename_from_preset(codec); |
5207 | if (coef == 0x8020 || coef == 0x8011) | 5703 | if (err < 0) |
5208 | alc_codec_rename(codec, "ALC661"); | 5704 | goto error; |
5209 | else if (coef & (1 << 14) && | ||
5210 | codec->bus->pci->subsystem_vendor == 0x1025 && | ||
5211 | spec->cdefine.platform_type == 1) | ||
5212 | alc_codec_rename(codec, "ALC272X"); | ||
5213 | else if (coef == 0x4011) | ||
5214 | alc_codec_rename(codec, "ALC656"); | ||
5215 | |||
5216 | board_config = alc_board_config(codec, ALC662_MODEL_LAST, | ||
5217 | alc662_models, alc662_cfg_tbl); | ||
5218 | if (board_config < 0) { | ||
5219 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | ||
5220 | codec->chip_name); | ||
5221 | board_config = ALC_MODEL_AUTO; | ||
5222 | } | ||
5223 | 5705 | ||
5224 | if (board_config == ALC_MODEL_AUTO) { | 5706 | if ((alc_get_coef0(codec) & (1 << 14)) && |
5225 | alc_pick_fixup(codec, alc662_fixup_models, | 5707 | codec->bus->pci->subsystem_vendor == 0x1025 && |
5226 | alc662_fixup_tbl, alc662_fixups); | 5708 | spec->cdefine.platform_type == 1) { |
5227 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); | 5709 | if (alc_codec_rename(codec, "ALC272X") < 0) |
5228 | /* automatic parse from the BIOS config */ | 5710 | goto error; |
5229 | err = alc662_parse_auto_config(codec); | ||
5230 | if (err < 0) { | ||
5231 | alc_free(codec); | ||
5232 | return err; | ||
5233 | } | ||
5234 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS | ||
5235 | else if (!err) { | ||
5236 | printk(KERN_INFO | ||
5237 | "hda_codec: Cannot set up configuration " | ||
5238 | "from BIOS. Using base mode...\n"); | ||
5239 | board_config = ALC662_3ST_2ch_DIG; | ||
5240 | } | ||
5241 | #endif | ||
5242 | } | 5711 | } |
5243 | 5712 | ||
5244 | if (board_config != ALC_MODEL_AUTO) | 5713 | alc_pick_fixup(codec, alc662_fixup_models, |
5245 | setup_preset(codec, &alc662_presets[board_config]); | 5714 | alc662_fixup_tbl, alc662_fixups); |
5715 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); | ||
5716 | /* automatic parse from the BIOS config */ | ||
5717 | err = alc662_parse_auto_config(codec); | ||
5718 | if (err < 0) | ||
5719 | goto error; | ||
5246 | 5720 | ||
5247 | if (!spec->no_analog && !spec->adc_nids) { | 5721 | if (!spec->no_analog && !spec->adc_nids) { |
5248 | alc_auto_fill_adc_caps(codec); | 5722 | alc_auto_fill_adc_caps(codec); |
@@ -5255,10 +5729,8 @@ static int patch_alc662(struct hda_codec *codec) | |||
5255 | 5729 | ||
5256 | if (!spec->no_analog && has_cdefine_beep(codec)) { | 5730 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
5257 | err = snd_hda_attach_beep_device(codec, 0x1); | 5731 | err = snd_hda_attach_beep_device(codec, 0x1); |
5258 | if (err < 0) { | 5732 | if (err < 0) |
5259 | alc_free(codec); | 5733 | goto error; |
5260 | return err; | ||
5261 | } | ||
5262 | switch (codec->vendor_id) { | 5734 | switch (codec->vendor_id) { |
5263 | case 0x10ec0662: | 5735 | case 0x10ec0662: |
5264 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | 5736 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
@@ -5278,8 +5750,7 @@ static int patch_alc662(struct hda_codec *codec) | |||
5278 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); | 5750 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
5279 | 5751 | ||
5280 | codec->patch_ops = alc_patch_ops; | 5752 | codec->patch_ops = alc_patch_ops; |
5281 | if (board_config == ALC_MODEL_AUTO) | 5753 | spec->init_hook = alc_auto_init_std; |
5282 | spec->init_hook = alc_auto_init_std; | ||
5283 | spec->shutup = alc_eapd_shutup; | 5754 | spec->shutup = alc_eapd_shutup; |
5284 | 5755 | ||
5285 | alc_init_jacks(codec); | 5756 | alc_init_jacks(codec); |
@@ -5290,32 +5761,10 @@ static int patch_alc662(struct hda_codec *codec) | |||
5290 | #endif | 5761 | #endif |
5291 | 5762 | ||
5292 | return 0; | 5763 | return 0; |
5293 | } | ||
5294 | |||
5295 | static int patch_alc888(struct hda_codec *codec) | ||
5296 | { | ||
5297 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ | ||
5298 | kfree(codec->chip_name); | ||
5299 | if (codec->vendor_id == 0x10ec0887) | ||
5300 | codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL); | ||
5301 | else | ||
5302 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); | ||
5303 | if (!codec->chip_name) { | ||
5304 | alc_free(codec); | ||
5305 | return -ENOMEM; | ||
5306 | } | ||
5307 | return patch_alc662(codec); | ||
5308 | } | ||
5309 | return patch_alc882(codec); | ||
5310 | } | ||
5311 | 5764 | ||
5312 | static int patch_alc899(struct hda_codec *codec) | 5765 | error: |
5313 | { | 5766 | alc_free(codec); |
5314 | if ((alc_read_coef_idx(codec, 0) & 0x2000) != 0x2000) { | 5767 | return err; |
5315 | kfree(codec->chip_name); | ||
5316 | codec->chip_name = kstrdup("ALC898", GFP_KERNEL); | ||
5317 | } | ||
5318 | return patch_alc882(codec); | ||
5319 | } | 5768 | } |
5320 | 5769 | ||
5321 | /* | 5770 | /* |
@@ -5329,14 +5778,9 @@ static int alc680_parse_auto_config(struct hda_codec *codec) | |||
5329 | 5778 | ||
5330 | /* | 5779 | /* |
5331 | */ | 5780 | */ |
5332 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS | ||
5333 | #include "alc680_quirks.c" | ||
5334 | #endif | ||
5335 | |||
5336 | static int patch_alc680(struct hda_codec *codec) | 5781 | static int patch_alc680(struct hda_codec *codec) |
5337 | { | 5782 | { |
5338 | struct alc_spec *spec; | 5783 | struct alc_spec *spec; |
5339 | int board_config; | ||
5340 | int err; | 5784 | int err; |
5341 | 5785 | ||
5342 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 5786 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
@@ -5347,43 +5791,11 @@ static int patch_alc680(struct hda_codec *codec) | |||
5347 | 5791 | ||
5348 | /* ALC680 has no aa-loopback mixer */ | 5792 | /* ALC680 has no aa-loopback mixer */ |
5349 | 5793 | ||
5350 | board_config = alc_board_config(codec, ALC680_MODEL_LAST, | 5794 | /* automatic parse from the BIOS config */ |
5351 | alc680_models, alc680_cfg_tbl); | 5795 | err = alc680_parse_auto_config(codec); |
5352 | 5796 | if (err < 0) { | |
5353 | if (board_config < 0) { | 5797 | alc_free(codec); |
5354 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | 5798 | return err; |
5355 | codec->chip_name); | ||
5356 | board_config = ALC_MODEL_AUTO; | ||
5357 | } | ||
5358 | |||
5359 | if (board_config == ALC_MODEL_AUTO) { | ||
5360 | /* automatic parse from the BIOS config */ | ||
5361 | err = alc680_parse_auto_config(codec); | ||
5362 | if (err < 0) { | ||
5363 | alc_free(codec); | ||
5364 | return err; | ||
5365 | } | ||
5366 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS | ||
5367 | else if (!err) { | ||
5368 | printk(KERN_INFO | ||
5369 | "hda_codec: Cannot set up configuration " | ||
5370 | "from BIOS. Using base mode...\n"); | ||
5371 | board_config = ALC680_BASE; | ||
5372 | } | ||
5373 | #endif | ||
5374 | } | ||
5375 | |||
5376 | if (board_config != ALC_MODEL_AUTO) { | ||
5377 | setup_preset(codec, &alc680_presets[board_config]); | ||
5378 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS | ||
5379 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; | ||
5380 | #endif | ||
5381 | } | ||
5382 | |||
5383 | if (!spec->no_analog && !spec->adc_nids) { | ||
5384 | alc_auto_fill_adc_caps(codec); | ||
5385 | alc_rebuild_imux_for_auto_mic(codec); | ||
5386 | alc_remove_invalid_adc_nids(codec); | ||
5387 | } | 5799 | } |
5388 | 5800 | ||
5389 | if (!spec->no_analog && !spec->cap_mixer) | 5801 | if (!spec->no_analog && !spec->cap_mixer) |
@@ -5392,8 +5804,7 @@ static int patch_alc680(struct hda_codec *codec) | |||
5392 | spec->vmaster_nid = 0x02; | 5804 | spec->vmaster_nid = 0x02; |
5393 | 5805 | ||
5394 | codec->patch_ops = alc_patch_ops; | 5806 | codec->patch_ops = alc_patch_ops; |
5395 | if (board_config == ALC_MODEL_AUTO) | 5807 | spec->init_hook = alc_auto_init_std; |
5396 | spec->init_hook = alc_auto_init_std; | ||
5397 | 5808 | ||
5398 | return 0; | 5809 | return 0; |
5399 | } | 5810 | } |
@@ -5421,6 +5832,8 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = { | |||
5421 | .patch = patch_alc882 }, | 5832 | .patch = patch_alc882 }, |
5422 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", | 5833 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
5423 | .patch = patch_alc662 }, | 5834 | .patch = patch_alc662 }, |
5835 | { .id = 0x10ec0662, .rev = 0x100300, .name = "ALC662 rev3", | ||
5836 | .patch = patch_alc662 }, | ||
5424 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, | 5837 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
5425 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, | 5838 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
5426 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, | 5839 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
@@ -5433,13 +5846,13 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = { | |||
5433 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", | 5846 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
5434 | .patch = patch_alc882 }, | 5847 | .patch = patch_alc882 }, |
5435 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, | 5848 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
5436 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 }, | 5849 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
5437 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", | 5850 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
5438 | .patch = patch_alc882 }, | 5851 | .patch = patch_alc882 }, |
5439 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, | 5852 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 }, |
5440 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, | 5853 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
5441 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, | 5854 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
5442 | { .id = 0x10ec0899, .name = "ALC899", .patch = patch_alc899 }, | 5855 | { .id = 0x10ec0899, .name = "ALC898", .patch = patch_alc882 }, |
5443 | {} /* terminator */ | 5856 | {} /* terminator */ |
5444 | }; | 5857 | }; |
5445 | 5858 | ||
diff --git a/sound/pci/hda/patch_si3054.c b/sound/pci/hda/patch_si3054.c index 2f55f32876f..6679a5095e5 100644 --- a/sound/pci/hda/patch_si3054.c +++ b/sound/pci/hda/patch_si3054.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/module.h> | ||
28 | #include <sound/core.h> | 29 | #include <sound/core.h> |
29 | #include "hda_codec.h" | 30 | #include "hda_codec.h" |
30 | #include "hda_local.h" | 31 | #include "hda_local.h" |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 987e3cf71a0..edc2b7bc177 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/pci.h> | 30 | #include <linux/pci.h> |
31 | #include <linux/dmi.h> | 31 | #include <linux/dmi.h> |
32 | #include <linux/module.h> | ||
32 | #include <sound/core.h> | 33 | #include <sound/core.h> |
33 | #include <sound/asoundef.h> | 34 | #include <sound/asoundef.h> |
34 | #include <sound/jack.h> | 35 | #include <sound/jack.h> |
@@ -94,6 +95,7 @@ enum { | |||
94 | STAC_92HD83XXX_REF, | 95 | STAC_92HD83XXX_REF, |
95 | STAC_92HD83XXX_PWR_REF, | 96 | STAC_92HD83XXX_PWR_REF, |
96 | STAC_DELL_S14, | 97 | STAC_DELL_S14, |
98 | STAC_DELL_VOSTRO_3500, | ||
97 | STAC_92HD83XXX_HP, | 99 | STAC_92HD83XXX_HP, |
98 | STAC_92HD83XXX_HP_cNB11_INTQUAD, | 100 | STAC_92HD83XXX_HP_cNB11_INTQUAD, |
99 | STAC_HP_DV7_4000, | 101 | STAC_HP_DV7_4000, |
@@ -1658,6 +1660,12 @@ static const unsigned int dell_s14_pin_configs[10] = { | |||
1658 | 0x40f000f0, 0x40f000f0, | 1660 | 0x40f000f0, 0x40f000f0, |
1659 | }; | 1661 | }; |
1660 | 1662 | ||
1663 | static const unsigned int dell_vostro_3500_pin_configs[10] = { | ||
1664 | 0x02a11020, 0x0221101f, 0x400000f0, 0x90170110, | ||
1665 | 0x400000f1, 0x400000f2, 0x400000f3, 0x90a60160, | ||
1666 | 0x400000f4, 0x400000f5, | ||
1667 | }; | ||
1668 | |||
1661 | static const unsigned int hp_dv7_4000_pin_configs[10] = { | 1669 | static const unsigned int hp_dv7_4000_pin_configs[10] = { |
1662 | 0x03a12050, 0x0321201f, 0x40f000f0, 0x90170110, | 1670 | 0x03a12050, 0x0321201f, 0x40f000f0, 0x90170110, |
1663 | 0x40f000f0, 0x40f000f0, 0x90170110, 0xd5a30140, | 1671 | 0x40f000f0, 0x40f000f0, 0x90170110, 0xd5a30140, |
@@ -1674,6 +1682,7 @@ static const unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = { | |||
1674 | [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs, | 1682 | [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs, |
1675 | [STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs, | 1683 | [STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs, |
1676 | [STAC_DELL_S14] = dell_s14_pin_configs, | 1684 | [STAC_DELL_S14] = dell_s14_pin_configs, |
1685 | [STAC_DELL_VOSTRO_3500] = dell_vostro_3500_pin_configs, | ||
1677 | [STAC_92HD83XXX_HP_cNB11_INTQUAD] = hp_cNB11_intquad_pin_configs, | 1686 | [STAC_92HD83XXX_HP_cNB11_INTQUAD] = hp_cNB11_intquad_pin_configs, |
1678 | [STAC_HP_DV7_4000] = hp_dv7_4000_pin_configs, | 1687 | [STAC_HP_DV7_4000] = hp_dv7_4000_pin_configs, |
1679 | }; | 1688 | }; |
@@ -1683,6 +1692,7 @@ static const char * const stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { | |||
1683 | [STAC_92HD83XXX_REF] = "ref", | 1692 | [STAC_92HD83XXX_REF] = "ref", |
1684 | [STAC_92HD83XXX_PWR_REF] = "mic-ref", | 1693 | [STAC_92HD83XXX_PWR_REF] = "mic-ref", |
1685 | [STAC_DELL_S14] = "dell-s14", | 1694 | [STAC_DELL_S14] = "dell-s14", |
1695 | [STAC_DELL_VOSTRO_3500] = "dell-vostro-3500", | ||
1686 | [STAC_92HD83XXX_HP] = "hp", | 1696 | [STAC_92HD83XXX_HP] = "hp", |
1687 | [STAC_92HD83XXX_HP_cNB11_INTQUAD] = "hp_cNB11_intquad", | 1697 | [STAC_92HD83XXX_HP_cNB11_INTQUAD] = "hp_cNB11_intquad", |
1688 | [STAC_HP_DV7_4000] = "hp-dv7-4000", | 1698 | [STAC_HP_DV7_4000] = "hp-dv7-4000", |
@@ -1696,6 +1706,8 @@ static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { | |||
1696 | "DFI LanParty", STAC_92HD83XXX_REF), | 1706 | "DFI LanParty", STAC_92HD83XXX_REF), |
1697 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ba, | 1707 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ba, |
1698 | "unknown Dell", STAC_DELL_S14), | 1708 | "unknown Dell", STAC_DELL_S14), |
1709 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x1028, | ||
1710 | "Dell Vostro 3500", STAC_DELL_VOSTRO_3500), | ||
1699 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x3600, | 1711 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x3600, |
1700 | "HP", STAC_92HD83XXX_HP), | 1712 | "HP", STAC_92HD83XXX_HP), |
1701 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1656, | 1713 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1656, |
@@ -2972,8 +2984,9 @@ static int check_all_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) | |||
2972 | static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid) | 2984 | static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid) |
2973 | { | 2985 | { |
2974 | struct sigmatel_spec *spec = codec->spec; | 2986 | struct sigmatel_spec *spec = codec->spec; |
2987 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
2975 | int j, conn_len; | 2988 | int j, conn_len; |
2976 | hda_nid_t conn[HDA_MAX_CONNECTIONS]; | 2989 | hda_nid_t conn[HDA_MAX_CONNECTIONS], fallback_dac; |
2977 | unsigned int wcaps, wtype; | 2990 | unsigned int wcaps, wtype; |
2978 | 2991 | ||
2979 | conn_len = snd_hda_get_connections(codec, nid, conn, | 2992 | conn_len = snd_hda_get_connections(codec, nid, conn, |
@@ -3001,10 +3014,21 @@ static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid) | |||
3001 | return conn[j]; | 3014 | return conn[j]; |
3002 | } | 3015 | } |
3003 | } | 3016 | } |
3004 | /* if all DACs are already assigned, connect to the primary DAC */ | 3017 | |
3018 | /* if all DACs are already assigned, connect to the primary DAC, | ||
3019 | unless we're assigning a secondary headphone */ | ||
3020 | fallback_dac = spec->multiout.dac_nids[0]; | ||
3021 | if (spec->multiout.hp_nid) { | ||
3022 | for (j = 0; j < cfg->hp_outs; j++) | ||
3023 | if (cfg->hp_pins[j] == nid) { | ||
3024 | fallback_dac = spec->multiout.hp_nid; | ||
3025 | break; | ||
3026 | } | ||
3027 | } | ||
3028 | |||
3005 | if (conn_len > 1) { | 3029 | if (conn_len > 1) { |
3006 | for (j = 0; j < conn_len; j++) { | 3030 | for (j = 0; j < conn_len; j++) { |
3007 | if (conn[j] == spec->multiout.dac_nids[0]) { | 3031 | if (conn[j] == fallback_dac) { |
3008 | snd_hda_codec_write_cache(codec, nid, 0, | 3032 | snd_hda_codec_write_cache(codec, nid, 0, |
3009 | AC_VERB_SET_CONNECT_SEL, j); | 3033 | AC_VERB_SET_CONNECT_SEL, j); |
3010 | break; | 3034 | break; |
@@ -3779,9 +3803,10 @@ static int is_dual_headphones(struct hda_codec *codec) | |||
3779 | } | 3803 | } |
3780 | 3804 | ||
3781 | 3805 | ||
3782 | static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out, hda_nid_t dig_in) | 3806 | static int stac92xx_parse_auto_config(struct hda_codec *codec) |
3783 | { | 3807 | { |
3784 | struct sigmatel_spec *spec = codec->spec; | 3808 | struct sigmatel_spec *spec = codec->spec; |
3809 | hda_nid_t dig_out = 0, dig_in = 0; | ||
3785 | int hp_swap = 0; | 3810 | int hp_swap = 0; |
3786 | int i, err; | 3811 | int i, err; |
3787 | 3812 | ||
@@ -3964,6 +3989,22 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
3964 | if (spec->multiout.max_channels > 2) | 3989 | if (spec->multiout.max_channels > 2) |
3965 | spec->surr_switch = 1; | 3990 | spec->surr_switch = 1; |
3966 | 3991 | ||
3992 | /* find digital out and in converters */ | ||
3993 | for (i = codec->start_nid; i < codec->start_nid + codec->num_nodes; i++) { | ||
3994 | unsigned int wid_caps = get_wcaps(codec, i); | ||
3995 | if (wid_caps & AC_WCAP_DIGITAL) { | ||
3996 | switch (get_wcaps_type(wid_caps)) { | ||
3997 | case AC_WID_AUD_OUT: | ||
3998 | if (!dig_out) | ||
3999 | dig_out = i; | ||
4000 | break; | ||
4001 | case AC_WID_AUD_IN: | ||
4002 | if (!dig_in) | ||
4003 | dig_in = i; | ||
4004 | break; | ||
4005 | } | ||
4006 | } | ||
4007 | } | ||
3967 | if (spec->autocfg.dig_outs) | 4008 | if (spec->autocfg.dig_outs) |
3968 | spec->multiout.dig_out_nid = dig_out; | 4009 | spec->multiout.dig_out_nid = dig_out; |
3969 | if (dig_in && spec->autocfg.dig_in_pin) | 4010 | if (dig_in && spec->autocfg.dig_in_pin) |
@@ -4130,22 +4171,14 @@ static int stac92xx_add_jack(struct hda_codec *codec, | |||
4130 | #ifdef CONFIG_SND_HDA_INPUT_JACK | 4171 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
4131 | int def_conf = snd_hda_codec_get_pincfg(codec, nid); | 4172 | int def_conf = snd_hda_codec_get_pincfg(codec, nid); |
4132 | int connectivity = get_defcfg_connect(def_conf); | 4173 | int connectivity = get_defcfg_connect(def_conf); |
4133 | char name[32]; | ||
4134 | int err; | ||
4135 | 4174 | ||
4136 | if (connectivity && connectivity != AC_JACK_PORT_FIXED) | 4175 | if (connectivity && connectivity != AC_JACK_PORT_FIXED) |
4137 | return 0; | 4176 | return 0; |
4138 | 4177 | ||
4139 | snprintf(name, sizeof(name), "%s at %s %s Jack", | 4178 | return snd_hda_input_jack_add(codec, nid, type, NULL); |
4140 | snd_hda_get_jack_type(def_conf), | 4179 | #else |
4141 | snd_hda_get_jack_connectivity(def_conf), | ||
4142 | snd_hda_get_jack_location(def_conf)); | ||
4143 | |||
4144 | err = snd_hda_input_jack_add(codec, nid, type, name); | ||
4145 | if (err < 0) | ||
4146 | return err; | ||
4147 | #endif /* CONFIG_SND_HDA_INPUT_JACK */ | ||
4148 | return 0; | 4180 | return 0; |
4181 | #endif /* CONFIG_SND_HDA_INPUT_JACK */ | ||
4149 | } | 4182 | } |
4150 | 4183 | ||
4151 | static int stac_add_event(struct sigmatel_spec *spec, hda_nid_t nid, | 4184 | static int stac_add_event(struct sigmatel_spec *spec, hda_nid_t nid, |
@@ -5275,7 +5308,7 @@ static int patch_stac925x(struct hda_codec *codec) | |||
5275 | spec->capvols = stac925x_capvols; | 5308 | spec->capvols = stac925x_capvols; |
5276 | spec->capsws = stac925x_capsws; | 5309 | spec->capsws = stac925x_capsws; |
5277 | 5310 | ||
5278 | err = stac92xx_parse_auto_config(codec, 0x8, 0x7); | 5311 | err = stac92xx_parse_auto_config(codec); |
5279 | if (!err) { | 5312 | if (!err) { |
5280 | if (spec->board_config < 0) { | 5313 | if (spec->board_config < 0) { |
5281 | printk(KERN_WARNING "hda_codec: No auto-config is " | 5314 | printk(KERN_WARNING "hda_codec: No auto-config is " |
@@ -5416,7 +5449,7 @@ again: | |||
5416 | spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids); | 5449 | spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids); |
5417 | spec->pwr_nids = stac92hd73xx_pwr_nids; | 5450 | spec->pwr_nids = stac92hd73xx_pwr_nids; |
5418 | 5451 | ||
5419 | err = stac92xx_parse_auto_config(codec, 0x25, 0x27); | 5452 | err = stac92xx_parse_auto_config(codec); |
5420 | 5453 | ||
5421 | if (!err) { | 5454 | if (!err) { |
5422 | if (spec->board_config < 0) { | 5455 | if (spec->board_config < 0) { |
@@ -5585,9 +5618,7 @@ static void stac92hd8x_fill_auto_spec(struct hda_codec *codec) | |||
5585 | static int patch_stac92hd83xxx(struct hda_codec *codec) | 5618 | static int patch_stac92hd83xxx(struct hda_codec *codec) |
5586 | { | 5619 | { |
5587 | struct sigmatel_spec *spec; | 5620 | struct sigmatel_spec *spec; |
5588 | hda_nid_t conn[STAC92HD83_DAC_COUNT + 1]; | ||
5589 | int err; | 5621 | int err; |
5590 | int num_dacs; | ||
5591 | 5622 | ||
5592 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 5623 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
5593 | if (spec == NULL) | 5624 | if (spec == NULL) |
@@ -5627,26 +5658,8 @@ again: | |||
5627 | stac92xx_set_config_regs(codec, | 5658 | stac92xx_set_config_regs(codec, |
5628 | stac92hd83xxx_brd_tbl[spec->board_config]); | 5659 | stac92hd83xxx_brd_tbl[spec->board_config]); |
5629 | 5660 | ||
5630 | switch (codec->vendor_id) { | 5661 | if (spec->board_config != STAC_92HD83XXX_PWR_REF) |
5631 | case 0x111d76d1: | ||
5632 | case 0x111d76d9: | ||
5633 | case 0x111d76df: | ||
5634 | case 0x111d76e5: | ||
5635 | case 0x111d7666: | ||
5636 | case 0x111d7667: | ||
5637 | case 0x111d7668: | ||
5638 | case 0x111d7669: | ||
5639 | case 0x111d76e3: | ||
5640 | case 0x111d7604: | ||
5641 | case 0x111d76d4: | ||
5642 | case 0x111d7605: | ||
5643 | case 0x111d76d5: | ||
5644 | case 0x111d76e7: | ||
5645 | if (spec->board_config == STAC_92HD83XXX_PWR_REF) | ||
5646 | break; | ||
5647 | spec->num_pwrs = 0; | 5662 | spec->num_pwrs = 0; |
5648 | break; | ||
5649 | } | ||
5650 | 5663 | ||
5651 | codec->patch_ops = stac92xx_patch_ops; | 5664 | codec->patch_ops = stac92xx_patch_ops; |
5652 | 5665 | ||
@@ -5673,7 +5686,7 @@ again: | |||
5673 | } | 5686 | } |
5674 | #endif | 5687 | #endif |
5675 | 5688 | ||
5676 | err = stac92xx_parse_auto_config(codec, 0x1d, 0); | 5689 | err = stac92xx_parse_auto_config(codec); |
5677 | if (!err) { | 5690 | if (!err) { |
5678 | if (spec->board_config < 0) { | 5691 | if (spec->board_config < 0) { |
5679 | printk(KERN_WARNING "hda_codec: No auto-config is " | 5692 | printk(KERN_WARNING "hda_codec: No auto-config is " |
@@ -5689,22 +5702,6 @@ again: | |||
5689 | return err; | 5702 | return err; |
5690 | } | 5703 | } |
5691 | 5704 | ||
5692 | /* docking output support */ | ||
5693 | num_dacs = snd_hda_get_connections(codec, 0xF, | ||
5694 | conn, STAC92HD83_DAC_COUNT + 1) - 1; | ||
5695 | /* skip non-DAC connections */ | ||
5696 | while (num_dacs >= 0 && | ||
5697 | (get_wcaps_type(get_wcaps(codec, conn[num_dacs])) | ||
5698 | != AC_WID_AUD_OUT)) | ||
5699 | num_dacs--; | ||
5700 | /* set port E and F to select the last DAC */ | ||
5701 | if (num_dacs >= 0) { | ||
5702 | snd_hda_codec_write_cache(codec, 0xE, 0, | ||
5703 | AC_VERB_SET_CONNECT_SEL, num_dacs); | ||
5704 | snd_hda_codec_write_cache(codec, 0xF, 0, | ||
5705 | AC_VERB_SET_CONNECT_SEL, num_dacs); | ||
5706 | } | ||
5707 | |||
5708 | codec->proc_widget_hook = stac92hd_proc_hook; | 5705 | codec->proc_widget_hook = stac92hd_proc_hook; |
5709 | 5706 | ||
5710 | return 0; | 5707 | return 0; |
@@ -6010,7 +6007,7 @@ again: | |||
6010 | 6007 | ||
6011 | spec->multiout.dac_nids = spec->dac_nids; | 6008 | spec->multiout.dac_nids = spec->dac_nids; |
6012 | 6009 | ||
6013 | err = stac92xx_parse_auto_config(codec, 0x21, 0); | 6010 | err = stac92xx_parse_auto_config(codec); |
6014 | if (!err) { | 6011 | if (!err) { |
6015 | if (spec->board_config < 0) { | 6012 | if (spec->board_config < 0) { |
6016 | printk(KERN_WARNING "hda_codec: No auto-config is " | 6013 | printk(KERN_WARNING "hda_codec: No auto-config is " |
@@ -6119,7 +6116,7 @@ static int patch_stac922x(struct hda_codec *codec) | |||
6119 | 6116 | ||
6120 | spec->multiout.dac_nids = spec->dac_nids; | 6117 | spec->multiout.dac_nids = spec->dac_nids; |
6121 | 6118 | ||
6122 | err = stac92xx_parse_auto_config(codec, 0x08, 0x09); | 6119 | err = stac92xx_parse_auto_config(codec); |
6123 | if (!err) { | 6120 | if (!err) { |
6124 | if (spec->board_config < 0) { | 6121 | if (spec->board_config < 0) { |
6125 | printk(KERN_WARNING "hda_codec: No auto-config is " | 6122 | printk(KERN_WARNING "hda_codec: No auto-config is " |
@@ -6244,7 +6241,7 @@ static int patch_stac927x(struct hda_codec *codec) | |||
6244 | spec->aloopback_shift = 0; | 6241 | spec->aloopback_shift = 0; |
6245 | spec->eapd_switch = 1; | 6242 | spec->eapd_switch = 1; |
6246 | 6243 | ||
6247 | err = stac92xx_parse_auto_config(codec, 0x1e, 0x20); | 6244 | err = stac92xx_parse_auto_config(codec); |
6248 | if (!err) { | 6245 | if (!err) { |
6249 | if (spec->board_config < 0) { | 6246 | if (spec->board_config < 0) { |
6250 | printk(KERN_WARNING "hda_codec: No auto-config is " | 6247 | printk(KERN_WARNING "hda_codec: No auto-config is " |
@@ -6369,7 +6366,7 @@ static int patch_stac9205(struct hda_codec *codec) | |||
6369 | break; | 6366 | break; |
6370 | } | 6367 | } |
6371 | 6368 | ||
6372 | err = stac92xx_parse_auto_config(codec, 0x1f, 0x20); | 6369 | err = stac92xx_parse_auto_config(codec); |
6373 | if (!err) { | 6370 | if (!err) { |
6374 | if (spec->board_config < 0) { | 6371 | if (spec->board_config < 0) { |
6375 | printk(KERN_WARNING "hda_codec: No auto-config is " | 6372 | printk(KERN_WARNING "hda_codec: No auto-config is " |
@@ -6474,7 +6471,7 @@ static int patch_stac9872(struct hda_codec *codec) | |||
6474 | spec->capvols = stac9872_capvols; | 6471 | spec->capvols = stac9872_capvols; |
6475 | spec->capsws = stac9872_capsws; | 6472 | spec->capsws = stac9872_capsws; |
6476 | 6473 | ||
6477 | err = stac92xx_parse_auto_config(codec, 0x10, 0x12); | 6474 | err = stac92xx_parse_auto_config(codec); |
6478 | if (err < 0) { | 6475 | if (err < 0) { |
6479 | stac92xx_free(codec); | 6476 | stac92xx_free(codec); |
6480 | return -EINVAL; | 6477 | return -EINVAL; |
@@ -6579,6 +6576,18 @@ static const struct hda_codec_preset snd_hda_preset_sigmatel[] = { | |||
6579 | { .id = 0x111d76e3, .name = "92HD98BXX", .patch = patch_stac92hd83xxx}, | 6576 | { .id = 0x111d76e3, .name = "92HD98BXX", .patch = patch_stac92hd83xxx}, |
6580 | { .id = 0x111d76e5, .name = "92HD99BXX", .patch = patch_stac92hd83xxx}, | 6577 | { .id = 0x111d76e5, .name = "92HD99BXX", .patch = patch_stac92hd83xxx}, |
6581 | { .id = 0x111d76e7, .name = "92HD90BXX", .patch = patch_stac92hd83xxx}, | 6578 | { .id = 0x111d76e7, .name = "92HD90BXX", .patch = patch_stac92hd83xxx}, |
6579 | { .id = 0x111d76e8, .name = "92HD66B1X5", .patch = patch_stac92hd83xxx}, | ||
6580 | { .id = 0x111d76e9, .name = "92HD66B2X5", .patch = patch_stac92hd83xxx}, | ||
6581 | { .id = 0x111d76ea, .name = "92HD66B3X5", .patch = patch_stac92hd83xxx}, | ||
6582 | { .id = 0x111d76eb, .name = "92HD66C1X5", .patch = patch_stac92hd83xxx}, | ||
6583 | { .id = 0x111d76ec, .name = "92HD66C2X5", .patch = patch_stac92hd83xxx}, | ||
6584 | { .id = 0x111d76ed, .name = "92HD66C3X5", .patch = patch_stac92hd83xxx}, | ||
6585 | { .id = 0x111d76ee, .name = "92HD66B1X3", .patch = patch_stac92hd83xxx}, | ||
6586 | { .id = 0x111d76ef, .name = "92HD66B2X3", .patch = patch_stac92hd83xxx}, | ||
6587 | { .id = 0x111d76f0, .name = "92HD66B3X3", .patch = patch_stac92hd83xxx}, | ||
6588 | { .id = 0x111d76f1, .name = "92HD66C1X3", .patch = patch_stac92hd83xxx}, | ||
6589 | { .id = 0x111d76f2, .name = "92HD66C2X3", .patch = patch_stac92hd83xxx}, | ||
6590 | { .id = 0x111d76f3, .name = "92HD66C3/65", .patch = patch_stac92hd83xxx}, | ||
6582 | {} /* terminator */ | 6591 | {} /* terminator */ |
6583 | }; | 6592 | }; |
6584 | 6593 | ||
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 4ebfbd874c9..431c0d417ee 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/init.h> | 49 | #include <linux/init.h> |
50 | #include <linux/delay.h> | 50 | #include <linux/delay.h> |
51 | #include <linux/slab.h> | 51 | #include <linux/slab.h> |
52 | #include <linux/module.h> | ||
52 | #include <sound/core.h> | 53 | #include <sound/core.h> |
53 | #include <sound/asoundef.h> | 54 | #include <sound/asoundef.h> |
54 | #include "hda_codec.h" | 55 | #include "hda_codec.h" |
@@ -1506,39 +1507,49 @@ static int via_build_pcms(struct hda_codec *codec) | |||
1506 | struct via_spec *spec = codec->spec; | 1507 | struct via_spec *spec = codec->spec; |
1507 | struct hda_pcm *info = spec->pcm_rec; | 1508 | struct hda_pcm *info = spec->pcm_rec; |
1508 | 1509 | ||
1509 | codec->num_pcms = 1; | 1510 | codec->num_pcms = 0; |
1510 | codec->pcm_info = info; | 1511 | codec->pcm_info = info; |
1511 | 1512 | ||
1512 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), | 1513 | if (spec->multiout.num_dacs || spec->num_adc_nids) { |
1513 | "%s Analog", codec->chip_name); | 1514 | snprintf(spec->stream_name_analog, |
1514 | info->name = spec->stream_name_analog; | 1515 | sizeof(spec->stream_name_analog), |
1516 | "%s Analog", codec->chip_name); | ||
1517 | info->name = spec->stream_name_analog; | ||
1515 | 1518 | ||
1516 | if (!spec->stream_analog_playback) | 1519 | if (spec->multiout.num_dacs) { |
1517 | spec->stream_analog_playback = &via_pcm_analog_playback; | 1520 | if (!spec->stream_analog_playback) |
1518 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | 1521 | spec->stream_analog_playback = |
1519 | *spec->stream_analog_playback; | 1522 | &via_pcm_analog_playback; |
1520 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = | 1523 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
1521 | spec->multiout.dac_nids[0]; | 1524 | *spec->stream_analog_playback; |
1522 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = | 1525 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
1523 | spec->multiout.max_channels; | 1526 | spec->multiout.dac_nids[0]; |
1527 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = | ||
1528 | spec->multiout.max_channels; | ||
1529 | } | ||
1524 | 1530 | ||
1525 | if (!spec->stream_analog_capture) { | 1531 | if (!spec->stream_analog_capture) { |
1526 | if (spec->dyn_adc_switch) | 1532 | if (spec->dyn_adc_switch) |
1527 | spec->stream_analog_capture = | 1533 | spec->stream_analog_capture = |
1528 | &via_pcm_dyn_adc_analog_capture; | 1534 | &via_pcm_dyn_adc_analog_capture; |
1529 | else | 1535 | else |
1530 | spec->stream_analog_capture = &via_pcm_analog_capture; | 1536 | spec->stream_analog_capture = |
1537 | &via_pcm_analog_capture; | ||
1538 | } | ||
1539 | if (spec->num_adc_nids) { | ||
1540 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = | ||
1541 | *spec->stream_analog_capture; | ||
1542 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = | ||
1543 | spec->adc_nids[0]; | ||
1544 | if (!spec->dyn_adc_switch) | ||
1545 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = | ||
1546 | spec->num_adc_nids; | ||
1547 | } | ||
1548 | codec->num_pcms++; | ||
1549 | info++; | ||
1531 | } | 1550 | } |
1532 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = | ||
1533 | *spec->stream_analog_capture; | ||
1534 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; | ||
1535 | if (!spec->dyn_adc_switch) | ||
1536 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = | ||
1537 | spec->num_adc_nids; | ||
1538 | 1551 | ||
1539 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { | 1552 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
1540 | codec->num_pcms++; | ||
1541 | info++; | ||
1542 | snprintf(spec->stream_name_digital, | 1553 | snprintf(spec->stream_name_digital, |
1543 | sizeof(spec->stream_name_digital), | 1554 | sizeof(spec->stream_name_digital), |
1544 | "%s Digital", codec->chip_name); | 1555 | "%s Digital", codec->chip_name); |
@@ -1562,17 +1573,19 @@ static int via_build_pcms(struct hda_codec *codec) | |||
1562 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = | 1573 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
1563 | spec->dig_in_nid; | 1574 | spec->dig_in_nid; |
1564 | } | 1575 | } |
1576 | codec->num_pcms++; | ||
1577 | info++; | ||
1565 | } | 1578 | } |
1566 | 1579 | ||
1567 | if (spec->hp_dac_nid) { | 1580 | if (spec->hp_dac_nid) { |
1568 | codec->num_pcms++; | ||
1569 | info++; | ||
1570 | snprintf(spec->stream_name_hp, sizeof(spec->stream_name_hp), | 1581 | snprintf(spec->stream_name_hp, sizeof(spec->stream_name_hp), |
1571 | "%s HP", codec->chip_name); | 1582 | "%s HP", codec->chip_name); |
1572 | info->name = spec->stream_name_hp; | 1583 | info->name = spec->stream_name_hp; |
1573 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = via_pcm_hp_playback; | 1584 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = via_pcm_hp_playback; |
1574 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = | 1585 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
1575 | spec->hp_dac_nid; | 1586 | spec->hp_dac_nid; |
1587 | codec->num_pcms++; | ||
1588 | info++; | ||
1576 | } | 1589 | } |
1577 | return 0; | 1590 | return 0; |
1578 | } | 1591 | } |
@@ -3688,13 +3701,8 @@ static const struct hda_verb vt1812_init_verbs[] = { | |||
3688 | static void set_widgets_power_state_vt1812(struct hda_codec *codec) | 3701 | static void set_widgets_power_state_vt1812(struct hda_codec *codec) |
3689 | { | 3702 | { |
3690 | struct via_spec *spec = codec->spec; | 3703 | struct via_spec *spec = codec->spec; |
3691 | int imux_is_smixer = | ||
3692 | snd_hda_codec_read(codec, 0x13, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 3; | ||
3693 | unsigned int parm; | 3704 | unsigned int parm; |
3694 | unsigned int present; | 3705 | unsigned int present; |
3695 | /* MUX10 (1eh) = stereo mixer */ | ||
3696 | imux_is_smixer = | ||
3697 | snd_hda_codec_read(codec, 0x1e, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 5; | ||
3698 | /* inputs */ | 3706 | /* inputs */ |
3699 | /* PW 5/6/7 (29h/2ah/2bh) */ | 3707 | /* PW 5/6/7 (29h/2ah/2bh) */ |
3700 | parm = AC_PWRST_D3; | 3708 | parm = AC_PWRST_D3; |