2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for SigmaTel STAC92xx
6 * Copyright (c) 2005 Embedded Alley Solutions, Inc.
7 * Matt Porter <mporter@embeddedalley.com>
9 * Based on patch_cmedia.c and patch_realtek.c
10 * Copyright (c) 2004 Takashi Iwai <tiwai@suse.de>
12 * This driver is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This driver is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include <sound/driver.h>
28 #include <linux/init.h>
29 #include <linux/delay.h>
30 #include <linux/slab.h>
31 #include <linux/pci.h>
32 #include <sound/core.h>
33 #include <sound/asoundef.h>
34 #include "hda_codec.h"
35 #include "hda_local.h"
37 #define NUM_CONTROL_ALLOC 32
38 #define STAC_HP_EVENT 0x37
81 /* for backward compatibility */
103 struct sigmatel_spec {
104 struct snd_kcontrol_new *mixers[4];
105 unsigned int num_mixers;
108 unsigned int surr_switch: 1;
109 unsigned int line_switch: 1;
110 unsigned int mic_switch: 1;
111 unsigned int alt_switch: 1;
112 unsigned int hp_detect: 1;
113 unsigned int gpio_mute: 1;
115 unsigned int gpio_mask, gpio_data;
118 struct hda_multi_out multiout;
119 hda_nid_t dac_nids[5];
123 unsigned int num_adcs;
125 unsigned int num_muxes;
126 hda_nid_t *dmic_nids;
127 unsigned int num_dmics;
129 hda_nid_t dig_in_nid;
133 unsigned int num_pins;
134 unsigned int *pin_configs;
135 unsigned int *bios_pin_configs;
137 /* codec specific stuff */
138 struct hda_verb *init;
139 struct snd_kcontrol_new *mixer;
142 struct hda_input_mux *dinput_mux;
143 unsigned int cur_dmux;
144 struct hda_input_mux *input_mux;
145 unsigned int cur_mux[3];
148 unsigned int io_switch[2];
149 unsigned int clfe_swap;
150 unsigned int aloopback;
152 struct hda_pcm pcm_rec[2]; /* PCM information */
154 /* dynamic controls and input_mux */
155 struct auto_pin_cfg autocfg;
156 unsigned int num_kctl_alloc, num_kctl_used;
157 struct snd_kcontrol_new *kctl_alloc;
158 struct hda_input_mux private_dimux;
159 struct hda_input_mux private_imux;
162 static hda_nid_t stac9200_adc_nids[1] = {
166 static hda_nid_t stac9200_mux_nids[1] = {
170 static hda_nid_t stac9200_dac_nids[1] = {
174 static hda_nid_t stac925x_adc_nids[1] = {
178 static hda_nid_t stac925x_mux_nids[1] = {
182 static hda_nid_t stac925x_dac_nids[1] = {
186 #define STAC925X_NUM_DMICS 1
187 static hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = {
191 static hda_nid_t stac922x_adc_nids[2] = {
195 static hda_nid_t stac922x_mux_nids[2] = {
199 static hda_nid_t stac927x_adc_nids[3] = {
203 static hda_nid_t stac927x_mux_nids[3] = {
207 #define STAC927X_NUM_DMICS 2
208 static hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = {
212 static hda_nid_t stac9205_adc_nids[2] = {
216 static hda_nid_t stac9205_mux_nids[2] = {
220 #define STAC9205_NUM_DMICS 2
221 static hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = {
225 static hda_nid_t stac9200_pin_nids[8] = {
226 0x08, 0x09, 0x0d, 0x0e,
227 0x0f, 0x10, 0x11, 0x12,
230 static hda_nid_t stac925x_pin_nids[8] = {
231 0x07, 0x08, 0x0a, 0x0b,
232 0x0c, 0x0d, 0x10, 0x11,
235 static hda_nid_t stac922x_pin_nids[10] = {
236 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
237 0x0f, 0x10, 0x11, 0x15, 0x1b,
240 static hda_nid_t stac927x_pin_nids[14] = {
241 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
242 0x0f, 0x10, 0x11, 0x12, 0x13,
243 0x14, 0x21, 0x22, 0x23,
246 static hda_nid_t stac9205_pin_nids[12] = {
247 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
248 0x0f, 0x14, 0x16, 0x17, 0x18,
252 static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol,
253 struct snd_ctl_elem_info *uinfo)
255 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
256 struct sigmatel_spec *spec = codec->spec;
257 return snd_hda_input_mux_info(spec->dinput_mux, uinfo);
260 static int stac92xx_dmux_enum_get(struct snd_kcontrol *kcontrol,
261 struct snd_ctl_elem_value *ucontrol)
263 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
264 struct sigmatel_spec *spec = codec->spec;
266 ucontrol->value.enumerated.item[0] = spec->cur_dmux;
270 static int stac92xx_dmux_enum_put(struct snd_kcontrol *kcontrol,
271 struct snd_ctl_elem_value *ucontrol)
273 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
274 struct sigmatel_spec *spec = codec->spec;
276 return snd_hda_input_mux_put(codec, spec->dinput_mux, ucontrol,
277 spec->dmux_nid, &spec->cur_dmux);
280 static int stac92xx_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
282 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
283 struct sigmatel_spec *spec = codec->spec;
284 return snd_hda_input_mux_info(spec->input_mux, uinfo);
287 static int stac92xx_mux_enum_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
289 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
290 struct sigmatel_spec *spec = codec->spec;
291 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
293 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
297 static int stac92xx_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
299 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
300 struct sigmatel_spec *spec = codec->spec;
301 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
303 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol,
304 spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]);
307 #define stac92xx_aloopback_info snd_ctl_boolean_mono_info
309 static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol,
310 struct snd_ctl_elem_value *ucontrol)
312 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
313 struct sigmatel_spec *spec = codec->spec;
315 ucontrol->value.integer.value[0] = spec->aloopback;
319 static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol,
320 struct snd_ctl_elem_value *ucontrol)
322 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
323 struct sigmatel_spec *spec = codec->spec;
324 unsigned int dac_mode;
326 if (spec->aloopback == ucontrol->value.integer.value[0])
329 spec->aloopback = ucontrol->value.integer.value[0];
332 dac_mode = snd_hda_codec_read(codec, codec->afg, 0,
333 kcontrol->private_value & 0xFFFF, 0x0);
335 if (spec->aloopback) {
336 snd_hda_power_up(codec);
339 snd_hda_power_down(codec);
343 snd_hda_codec_write_cache(codec, codec->afg, 0,
344 kcontrol->private_value >> 16, dac_mode);
349 static struct hda_verb stac9200_core_init[] = {
350 /* set dac0mux for dac converter */
351 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
355 static struct hda_verb stac9200_eapd_init[] = {
356 /* set dac0mux for dac converter */
357 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
358 {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
362 static struct hda_verb stac925x_core_init[] = {
363 /* set dac0mux for dac converter */
364 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
368 static struct hda_verb stac922x_core_init[] = {
369 /* set master volume and direct control */
370 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
374 static struct hda_verb d965_core_init[] = {
375 /* set master volume and direct control */
376 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
377 /* unmute node 0x1b */
378 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
379 /* select node 0x03 as DAC */
380 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
384 static struct hda_verb stac927x_core_init[] = {
385 /* set master volume and direct control */
386 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
390 static struct hda_verb stac9205_core_init[] = {
391 /* set master volume and direct control */
392 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
396 #define STAC_DIGITAL_INPUT_SOURCE(cnt) \
398 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
399 .name = "Digital Input Source", \
401 .info = stac92xx_dmux_enum_info, \
402 .get = stac92xx_dmux_enum_get, \
403 .put = stac92xx_dmux_enum_put,\
406 #define STAC_INPUT_SOURCE(cnt) \
408 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
409 .name = "Input Source", \
411 .info = stac92xx_mux_enum_info, \
412 .get = stac92xx_mux_enum_get, \
413 .put = stac92xx_mux_enum_put, \
416 #define STAC_ANALOG_LOOPBACK(verb_read,verb_write) \
418 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
419 .name = "Analog Loopback", \
421 .info = stac92xx_aloopback_info, \
422 .get = stac92xx_aloopback_get, \
423 .put = stac92xx_aloopback_put, \
424 .private_value = verb_read | (verb_write << 16), \
427 static struct snd_kcontrol_new stac9200_mixer[] = {
428 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT),
429 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT),
430 STAC_INPUT_SOURCE(1),
431 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT),
432 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT),
433 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0c, 0, HDA_OUTPUT),
437 static struct snd_kcontrol_new stac925x_mixer[] = {
438 STAC_INPUT_SOURCE(1),
439 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT),
440 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_OUTPUT),
441 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0f, 0, HDA_OUTPUT),
445 static struct snd_kcontrol_new stac9205_mixer[] = {
446 STAC_DIGITAL_INPUT_SOURCE(1),
447 STAC_INPUT_SOURCE(2),
448 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0),
450 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT),
451 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT),
452 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x19, 0x0, HDA_OUTPUT),
454 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1c, 0x0, HDA_INPUT),
455 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1e, 0x0, HDA_OUTPUT),
456 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x1A, 0x0, HDA_OUTPUT),
461 /* This needs to be generated dynamically based on sequence */
462 static struct snd_kcontrol_new stac922x_mixer[] = {
463 STAC_INPUT_SOURCE(2),
464 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT),
465 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT),
466 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x12, 0x0, HDA_OUTPUT),
468 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_INPUT),
469 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_INPUT),
470 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x13, 0x0, HDA_OUTPUT),
475 static struct snd_kcontrol_new stac927x_mixer[] = {
476 STAC_DIGITAL_INPUT_SOURCE(1),
477 STAC_INPUT_SOURCE(3),
478 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB),
480 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT),
481 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT),
482 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x15, 0x0, HDA_OUTPUT),
484 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x19, 0x0, HDA_INPUT),
485 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1c, 0x0, HDA_OUTPUT),
486 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x16, 0x0, HDA_OUTPUT),
488 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x2, 0x1A, 0x0, HDA_INPUT),
489 HDA_CODEC_MUTE_IDX("Capture Switch", 0x2, 0x1d, 0x0, HDA_OUTPUT),
490 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x2, 0x17, 0x0, HDA_OUTPUT),
494 static int stac92xx_build_controls(struct hda_codec *codec)
496 struct sigmatel_spec *spec = codec->spec;
500 err = snd_hda_add_new_ctls(codec, spec->mixer);
504 for (i = 0; i < spec->num_mixers; i++) {
505 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
510 if (spec->multiout.dig_out_nid) {
511 err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid);
515 if (spec->dig_in_nid) {
516 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
523 static unsigned int ref9200_pin_configs[8] = {
524 0x01c47010, 0x01447010, 0x0221401f, 0x01114010,
525 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
529 STAC 9200 pin configs for
534 static unsigned int dell9200_d21_pin_configs[8] = {
535 0x400001f0, 0x400001f1, 0x02214030, 0x01014010,
536 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
540 STAC 9200 pin configs for
544 static unsigned int dell9200_d22_pin_configs[8] = {
545 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
546 0x01813020, 0x02a19021, 0x90100140, 0x400001f2,
550 STAC 9200 pin configs for
551 102801C4 (Dell Dimension E310)
558 static unsigned int dell9200_d23_pin_configs[8] = {
559 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
560 0x01813020, 0x01a19021, 0x90100140, 0x400001f2,
565 STAC 9200-32 pin configs for
566 102801B5 (Dell Inspiron 630m)
567 102801D8 (Dell Inspiron 640m)
569 static unsigned int dell9200_m21_pin_configs[8] = {
570 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310,
571 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd,
575 STAC 9200-32 pin configs for
576 102801C2 (Dell Latitude D620)
578 102801CC (Dell Latitude D820)
582 static unsigned int dell9200_m22_pin_configs[8] = {
583 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310,
584 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc,
588 STAC 9200-32 pin configs for
589 102801CE (Dell XPS M1710)
590 102801CF (Dell Precision M90)
592 static unsigned int dell9200_m23_pin_configs[8] = {
593 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310,
594 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc,
598 STAC 9200-32 pin configs for
601 102801CB (Dell Latitude 120L)
604 static unsigned int dell9200_m24_pin_configs[8] = {
605 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310,
606 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe,
610 STAC 9200-32 pin configs for
611 102801BD (Dell Inspiron E1505n)
615 static unsigned int dell9200_m25_pin_configs[8] = {
616 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
617 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd,
621 STAC 9200-32 pin configs for
622 102801F5 (Dell Inspiron 1501)
625 static unsigned int dell9200_m26_pin_configs[8] = {
626 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310,
627 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe,
632 102801CD (Dell Inspiron E1705/9400)
634 static unsigned int dell9200_m27_pin_configs[8] = {
635 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
636 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc,
640 static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = {
641 [STAC_REF] = ref9200_pin_configs,
642 [STAC_9200_DELL_D21] = dell9200_d21_pin_configs,
643 [STAC_9200_DELL_D22] = dell9200_d22_pin_configs,
644 [STAC_9200_DELL_D23] = dell9200_d23_pin_configs,
645 [STAC_9200_DELL_M21] = dell9200_m21_pin_configs,
646 [STAC_9200_DELL_M22] = dell9200_m22_pin_configs,
647 [STAC_9200_DELL_M23] = dell9200_m23_pin_configs,
648 [STAC_9200_DELL_M24] = dell9200_m24_pin_configs,
649 [STAC_9200_DELL_M25] = dell9200_m25_pin_configs,
650 [STAC_9200_DELL_M26] = dell9200_m26_pin_configs,
651 [STAC_9200_DELL_M27] = dell9200_m27_pin_configs,
654 static const char *stac9200_models[STAC_9200_MODELS] = {
656 [STAC_9200_DELL_D21] = "dell-d21",
657 [STAC_9200_DELL_D22] = "dell-d22",
658 [STAC_9200_DELL_D23] = "dell-d23",
659 [STAC_9200_DELL_M21] = "dell-m21",
660 [STAC_9200_DELL_M22] = "dell-m22",
661 [STAC_9200_DELL_M23] = "dell-m23",
662 [STAC_9200_DELL_M24] = "dell-m24",
663 [STAC_9200_DELL_M25] = "dell-m25",
664 [STAC_9200_DELL_M26] = "dell-m26",
665 [STAC_9200_DELL_M27] = "dell-m27",
666 [STAC_9200_GATEWAY] = "gateway",
669 static struct snd_pci_quirk stac9200_cfg_tbl[] = {
670 /* SigmaTel reference board */
671 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
672 "DFI LanParty", STAC_REF),
673 /* Dell laptops have BIOS problem */
674 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8,
675 "unknown Dell", STAC_9200_DELL_D21),
676 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5,
677 "Dell Inspiron 630m", STAC_9200_DELL_M21),
678 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd,
679 "Dell Inspiron E1505n", STAC_9200_DELL_M25),
680 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0,
681 "unknown Dell", STAC_9200_DELL_D22),
682 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1,
683 "unknown Dell", STAC_9200_DELL_D22),
684 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2,
685 "Dell Latitude D620", STAC_9200_DELL_M22),
686 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5,
687 "unknown Dell", STAC_9200_DELL_D23),
688 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7,
689 "unknown Dell", STAC_9200_DELL_D23),
690 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8,
691 "unknown Dell", STAC_9200_DELL_M22),
692 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9,
693 "unknown Dell", STAC_9200_DELL_M24),
694 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca,
695 "unknown Dell", STAC_9200_DELL_M24),
696 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb,
697 "Dell Latitude 120L", STAC_9200_DELL_M24),
698 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc,
699 "Dell Latitude D820", STAC_9200_DELL_M22),
700 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd,
701 "Dell Inspiron E1705/9400", STAC_9200_DELL_M27),
702 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce,
703 "Dell XPS M1710", STAC_9200_DELL_M23),
704 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf,
705 "Dell Precision M90", STAC_9200_DELL_M23),
706 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3,
707 "unknown Dell", STAC_9200_DELL_M22),
708 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4,
709 "unknown Dell", STAC_9200_DELL_M22),
710 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6,
711 "unknown Dell", STAC_9200_DELL_M22),
712 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8,
713 "Dell Inspiron 640m", STAC_9200_DELL_M21),
714 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9,
715 "unknown Dell", STAC_9200_DELL_D23),
716 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da,
717 "unknown Dell", STAC_9200_DELL_D23),
718 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de,
719 "unknown Dell", STAC_9200_DELL_D21),
720 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3,
721 "unknown Dell", STAC_9200_DELL_D23),
722 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8,
723 "unknown Dell", STAC_9200_DELL_D21),
724 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee,
725 "unknown Dell", STAC_9200_DELL_M25),
726 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef,
727 "unknown Dell", STAC_9200_DELL_M25),
728 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5,
729 "Dell Inspiron 1501", STAC_9200_DELL_M26),
730 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6,
731 "unknown Dell", STAC_9200_DELL_M26),
733 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_REF),
734 /* Gateway machines needs EAPD to be set on resume */
735 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_GATEWAY),
736 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*",
738 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707",
743 static unsigned int ref925x_pin_configs[8] = {
744 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
745 0x90a70320, 0x02214210, 0x400003f1, 0x9033032e,
748 static unsigned int stac925x_MA6_pin_configs[8] = {
749 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
750 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e,
753 static unsigned int stac925x_PA6_pin_configs[8] = {
754 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
755 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e,
758 static unsigned int stac925xM2_2_pin_configs[8] = {
759 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020,
760 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e,
763 static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = {
764 [STAC_REF] = ref925x_pin_configs,
765 [STAC_M2_2] = stac925xM2_2_pin_configs,
766 [STAC_MA6] = stac925x_MA6_pin_configs,
767 [STAC_PA6] = stac925x_PA6_pin_configs,
770 static const char *stac925x_models[STAC_925x_MODELS] = {
772 [STAC_M2_2] = "m2-2",
777 static struct snd_pci_quirk stac925x_cfg_tbl[] = {
778 /* SigmaTel reference board */
779 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
780 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
781 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF),
782 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF),
783 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6),
784 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6),
785 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2),
789 static unsigned int ref922x_pin_configs[10] = {
790 0x01014010, 0x01016011, 0x01012012, 0x0221401f,
791 0x01813122, 0x01011014, 0x01441030, 0x01c41030,
792 0x40000100, 0x40000100,
796 STAC 922X pin configs for
803 static unsigned int dell_922x_d81_pin_configs[10] = {
804 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
805 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1,
806 0x01813122, 0x400001f2,
810 STAC 922X pin configs for
814 static unsigned int dell_922x_d82_pin_configs[10] = {
815 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
816 0x02a19020, 0x01117011, 0x01451140, 0x400001f0,
817 0x01813122, 0x400001f1,
821 STAC 922X pin configs for
824 static unsigned int dell_922x_m81_pin_configs[10] = {
825 0x0321101f, 0x01112024, 0x01111222, 0x91174220,
826 0x03a11050, 0x01116221, 0x90a70330, 0x01452340,
827 0x40C003f1, 0x405003f0,
831 STAC 9221 A1 pin configs for
832 102801D7 (Dell XPS M1210)
834 static unsigned int dell_922x_m82_pin_configs[10] = {
835 0x0221121f, 0x408103ff, 0x02111212, 0x90100310,
836 0x408003f1, 0x02111211, 0x03451340, 0x40c003f2,
837 0x508003f3, 0x405003f4,
840 static unsigned int d945gtp3_pin_configs[10] = {
841 0x0221401f, 0x01a19022, 0x01813021, 0x01014010,
842 0x40000100, 0x40000100, 0x40000100, 0x40000100,
843 0x02a19120, 0x40000100,
846 static unsigned int d945gtp5_pin_configs[10] = {
847 0x0221401f, 0x01011012, 0x01813024, 0x01014010,
848 0x01a19021, 0x01016011, 0x01452130, 0x40000100,
849 0x02a19320, 0x40000100,
852 static unsigned int intel_mac_v1_pin_configs[10] = {
853 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd,
854 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240,
855 0x400000fc, 0x400000fb,
858 static unsigned int intel_mac_v2_pin_configs[10] = {
859 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
860 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa,
861 0x400000fc, 0x400000fb,
864 static unsigned int intel_mac_v3_pin_configs[10] = {
865 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
866 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240,
867 0x400000fc, 0x400000fb,
870 static unsigned int intel_mac_v4_pin_configs[10] = {
871 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
872 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
873 0x400000fc, 0x400000fb,
876 static unsigned int intel_mac_v5_pin_configs[10] = {
877 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
878 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
879 0x400000fc, 0x400000fb,
883 static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
884 [STAC_D945_REF] = ref922x_pin_configs,
885 [STAC_D945GTP3] = d945gtp3_pin_configs,
886 [STAC_D945GTP5] = d945gtp5_pin_configs,
887 [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs,
888 [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs,
889 [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs,
890 [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs,
891 [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs,
892 /* for backward compatibility */
893 [STAC_MACMINI] = intel_mac_v3_pin_configs,
894 [STAC_MACBOOK] = intel_mac_v5_pin_configs,
895 [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs,
896 [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs,
897 [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs,
898 [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs,
899 [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs,
900 [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs,
901 [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs,
902 [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs,
905 static const char *stac922x_models[STAC_922X_MODELS] = {
906 [STAC_D945_REF] = "ref",
907 [STAC_D945GTP5] = "5stack",
908 [STAC_D945GTP3] = "3stack",
909 [STAC_INTEL_MAC_V1] = "intel-mac-v1",
910 [STAC_INTEL_MAC_V2] = "intel-mac-v2",
911 [STAC_INTEL_MAC_V3] = "intel-mac-v3",
912 [STAC_INTEL_MAC_V4] = "intel-mac-v4",
913 [STAC_INTEL_MAC_V5] = "intel-mac-v5",
914 /* for backward compatibility */
915 [STAC_MACMINI] = "macmini",
916 [STAC_MACBOOK] = "macbook",
917 [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1",
918 [STAC_MACBOOK_PRO_V2] = "macbook-pro",
919 [STAC_IMAC_INTEL] = "imac-intel",
920 [STAC_IMAC_INTEL_20] = "imac-intel-20",
921 [STAC_922X_DELL_D81] = "dell-d81",
922 [STAC_922X_DELL_D82] = "dell-d82",
923 [STAC_922X_DELL_M81] = "dell-m81",
924 [STAC_922X_DELL_M82] = "dell-m82",
927 static struct snd_pci_quirk stac922x_cfg_tbl[] = {
928 /* SigmaTel reference board */
929 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
930 "DFI LanParty", STAC_D945_REF),
931 /* Intel 945G based systems */
932 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101,
933 "Intel D945G", STAC_D945GTP3),
934 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202,
935 "Intel D945G", STAC_D945GTP3),
936 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606,
937 "Intel D945G", STAC_D945GTP3),
938 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601,
939 "Intel D945G", STAC_D945GTP3),
940 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111,
941 "Intel D945G", STAC_D945GTP3),
942 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115,
943 "Intel D945G", STAC_D945GTP3),
944 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116,
945 "Intel D945G", STAC_D945GTP3),
946 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117,
947 "Intel D945G", STAC_D945GTP3),
948 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118,
949 "Intel D945G", STAC_D945GTP3),
950 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119,
951 "Intel D945G", STAC_D945GTP3),
952 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826,
953 "Intel D945G", STAC_D945GTP3),
954 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049,
955 "Intel D945G", STAC_D945GTP3),
956 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055,
957 "Intel D945G", STAC_D945GTP3),
958 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048,
959 "Intel D945G", STAC_D945GTP3),
960 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110,
961 "Intel D945G", STAC_D945GTP3),
962 /* Intel D945G 5-stack systems */
963 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404,
964 "Intel D945G", STAC_D945GTP5),
965 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303,
966 "Intel D945G", STAC_D945GTP5),
967 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013,
968 "Intel D945G", STAC_D945GTP5),
969 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417,
970 "Intel D945G", STAC_D945GTP5),
971 /* Intel 945P based systems */
972 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b,
973 "Intel D945P", STAC_D945GTP3),
974 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112,
975 "Intel D945P", STAC_D945GTP3),
976 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d,
977 "Intel D945P", STAC_D945GTP3),
978 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909,
979 "Intel D945P", STAC_D945GTP3),
980 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505,
981 "Intel D945P", STAC_D945GTP3),
982 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707,
983 "Intel D945P", STAC_D945GTP5),
985 /* Apple Mac Mini (early 2006) */
986 SND_PCI_QUIRK(0x8384, 0x7680,
987 "Mac Mini", STAC_INTEL_MAC_V3),
989 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7,
990 "unknown Dell", STAC_922X_DELL_D81),
991 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9,
992 "unknown Dell", STAC_922X_DELL_D81),
993 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab,
994 "unknown Dell", STAC_922X_DELL_D81),
995 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac,
996 "unknown Dell", STAC_922X_DELL_D82),
997 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf,
998 "unknown Dell", STAC_922X_DELL_M81),
999 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0,
1000 "unknown Dell", STAC_922X_DELL_D82),
1001 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1,
1002 "unknown Dell", STAC_922X_DELL_D81),
1003 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2,
1004 "unknown Dell", STAC_922X_DELL_D81),
1005 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7,
1006 "Dell XPS M1210", STAC_922X_DELL_M82),
1010 static unsigned int ref927x_pin_configs[14] = {
1011 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
1012 0x01a19040, 0x01011012, 0x01016011, 0x0101201f,
1013 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070,
1014 0x01c42190, 0x40000100,
1017 static unsigned int d965_3st_pin_configs[14] = {
1018 0x0221401f, 0x02a19120, 0x40000100, 0x01014011,
1019 0x01a19021, 0x01813024, 0x40000100, 0x40000100,
1020 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1021 0x40000100, 0x40000100
1024 static unsigned int d965_5st_pin_configs[14] = {
1025 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
1026 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
1027 0x40000100, 0x40000100, 0x40000100, 0x01442070,
1028 0x40000100, 0x40000100
1031 static unsigned int dell_3st_pin_configs[14] = {
1032 0x02211230, 0x02a11220, 0x01a19040, 0x01114210,
1033 0x01111212, 0x01116211, 0x01813050, 0x01112214,
1034 0x403003fa, 0x40000100, 0x40000100, 0x404003fb,
1035 0x40c003fc, 0x40000100
1038 static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
1039 [STAC_D965_REF] = ref927x_pin_configs,
1040 [STAC_D965_3ST] = d965_3st_pin_configs,
1041 [STAC_D965_5ST] = d965_5st_pin_configs,
1042 [STAC_DELL_3ST] = dell_3st_pin_configs,
1045 static const char *stac927x_models[STAC_927X_MODELS] = {
1046 [STAC_D965_REF] = "ref",
1047 [STAC_D965_3ST] = "3stack",
1048 [STAC_D965_5ST] = "5stack",
1049 [STAC_DELL_3ST] = "dell-3stack",
1052 static struct snd_pci_quirk stac927x_cfg_tbl[] = {
1053 /* SigmaTel reference board */
1054 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1055 "DFI LanParty", STAC_D965_REF),
1056 /* Intel 946 based systems */
1057 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST),
1058 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST),
1059 /* 965 based 3 stack systems */
1060 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2116, "Intel D965", STAC_D965_3ST),
1061 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2115, "Intel D965", STAC_D965_3ST),
1062 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2114, "Intel D965", STAC_D965_3ST),
1063 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2113, "Intel D965", STAC_D965_3ST),
1064 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2112, "Intel D965", STAC_D965_3ST),
1065 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2111, "Intel D965", STAC_D965_3ST),
1066 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2110, "Intel D965", STAC_D965_3ST),
1067 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2009, "Intel D965", STAC_D965_3ST),
1068 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2008, "Intel D965", STAC_D965_3ST),
1069 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2007, "Intel D965", STAC_D965_3ST),
1070 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2006, "Intel D965", STAC_D965_3ST),
1071 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2005, "Intel D965", STAC_D965_3ST),
1072 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2004, "Intel D965", STAC_D965_3ST),
1073 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2003, "Intel D965", STAC_D965_3ST),
1074 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2002, "Intel D965", STAC_D965_3ST),
1075 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2001, "Intel D965", STAC_D965_3ST),
1076 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_D965_3ST),
1077 /* Dell 3 stack systems */
1078 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST),
1079 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST),
1080 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST),
1081 /* 965 based 5 stack systems */
1082 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0209, "Dell XPS 1330", STAC_D965_5ST),
1083 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2301, "Intel D965", STAC_D965_5ST),
1084 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2302, "Intel D965", STAC_D965_5ST),
1085 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2303, "Intel D965", STAC_D965_5ST),
1086 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2304, "Intel D965", STAC_D965_5ST),
1087 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2305, "Intel D965", STAC_D965_5ST),
1088 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2501, "Intel D965", STAC_D965_5ST),
1089 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2502, "Intel D965", STAC_D965_5ST),
1090 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2503, "Intel D965", STAC_D965_5ST),
1091 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2504, "Intel D965", STAC_D965_5ST),
1095 static unsigned int ref9205_pin_configs[12] = {
1096 0x40000100, 0x40000100, 0x01016011, 0x01014010,
1097 0x01813122, 0x01a19021, 0x40000100, 0x40000100,
1098 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030
1102 STAC 9205 pin configs for
1110 static unsigned int dell_9205_m42_pin_configs[12] = {
1111 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310,
1112 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9,
1113 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE,
1117 STAC 9205 pin configs for
1121 102801FF (Dell Precision M4300)
1126 static unsigned int dell_9205_m43_pin_configs[12] = {
1127 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310,
1128 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9,
1129 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8,
1132 static unsigned int dell_9205_m44_pin_configs[12] = {
1133 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310,
1134 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9,
1135 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe,
1138 static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = {
1139 [STAC_9205_REF] = ref9205_pin_configs,
1140 [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs,
1141 [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs,
1142 [STAC_9205_DELL_M44] = dell_9205_m44_pin_configs,
1145 static const char *stac9205_models[STAC_9205_MODELS] = {
1146 [STAC_9205_REF] = "ref",
1147 [STAC_9205_DELL_M42] = "dell-m42",
1148 [STAC_9205_DELL_M43] = "dell-m43",
1149 [STAC_9205_DELL_M44] = "dell-m44",
1152 static struct snd_pci_quirk stac9205_cfg_tbl[] = {
1153 /* SigmaTel reference board */
1154 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1155 "DFI LanParty", STAC_9205_REF),
1156 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1,
1157 "unknown Dell", STAC_9205_DELL_M42),
1158 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2,
1159 "unknown Dell", STAC_9205_DELL_M42),
1160 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8,
1161 "Dell Precision", STAC_9205_DELL_M43),
1162 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c,
1163 "Dell Precision", STAC_9205_DELL_M43),
1164 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9,
1165 "Dell Precision", STAC_9205_DELL_M43),
1166 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b,
1167 "Dell Precision", STAC_9205_DELL_M43),
1168 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa,
1169 "Dell Precision", STAC_9205_DELL_M43),
1170 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc,
1171 "unknown Dell", STAC_9205_DELL_M42),
1172 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd,
1173 "unknown Dell", STAC_9205_DELL_M42),
1174 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe,
1175 "Dell Precision", STAC_9205_DELL_M43),
1176 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff,
1177 "Dell Precision M4300", STAC_9205_DELL_M43),
1178 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206,
1179 "Dell Precision", STAC_9205_DELL_M43),
1180 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1,
1181 "Dell Inspiron", STAC_9205_DELL_M44),
1182 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2,
1183 "Dell Inspiron", STAC_9205_DELL_M44),
1184 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc,
1185 "Dell Inspiron", STAC_9205_DELL_M44),
1186 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd,
1187 "Dell Inspiron", STAC_9205_DELL_M44),
1188 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204,
1189 "unknown Dell", STAC_9205_DELL_M42),
1190 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f,
1191 "Dell Inspiron", STAC_9205_DELL_M44),
1195 static int stac92xx_save_bios_config_regs(struct hda_codec *codec)
1198 struct sigmatel_spec *spec = codec->spec;
1200 if (! spec->bios_pin_configs) {
1201 spec->bios_pin_configs = kcalloc(spec->num_pins,
1202 sizeof(*spec->bios_pin_configs), GFP_KERNEL);
1203 if (! spec->bios_pin_configs)
1207 for (i = 0; i < spec->num_pins; i++) {
1208 hda_nid_t nid = spec->pin_nids[i];
1209 unsigned int pin_cfg;
1211 pin_cfg = snd_hda_codec_read(codec, nid, 0,
1212 AC_VERB_GET_CONFIG_DEFAULT, 0x00);
1213 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x bios pin config %8.8x\n",
1215 spec->bios_pin_configs[i] = pin_cfg;
1221 static void stac92xx_set_config_reg(struct hda_codec *codec,
1222 hda_nid_t pin_nid, unsigned int pin_config)
1225 snd_hda_codec_write(codec, pin_nid, 0,
1226 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
1227 pin_config & 0x000000ff);
1228 snd_hda_codec_write(codec, pin_nid, 0,
1229 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
1230 (pin_config & 0x0000ff00) >> 8);
1231 snd_hda_codec_write(codec, pin_nid, 0,
1232 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
1233 (pin_config & 0x00ff0000) >> 16);
1234 snd_hda_codec_write(codec, pin_nid, 0,
1235 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
1237 i = snd_hda_codec_read(codec, pin_nid, 0,
1238 AC_VERB_GET_CONFIG_DEFAULT,
1240 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n",
1244 static void stac92xx_set_config_regs(struct hda_codec *codec)
1247 struct sigmatel_spec *spec = codec->spec;
1249 if (!spec->pin_configs)
1252 for (i = 0; i < spec->num_pins; i++)
1253 stac92xx_set_config_reg(codec, spec->pin_nids[i],
1254 spec->pin_configs[i]);
1257 static void stac92xx_enable_gpio_mask(struct hda_codec *codec)
1259 struct sigmatel_spec *spec = codec->spec;
1260 /* Configure GPIOx as output */
1261 snd_hda_codec_write_cache(codec, codec->afg, 0,
1262 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_mask);
1263 /* Configure GPIOx as CMOS */
1264 snd_hda_codec_write_cache(codec, codec->afg, 0, 0x7e7, 0x00000000);
1266 snd_hda_codec_write_cache(codec, codec->afg, 0,
1267 AC_VERB_SET_GPIO_DATA, spec->gpio_data);
1269 snd_hda_codec_write_cache(codec, codec->afg, 0,
1270 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
1274 * Analog playback callbacks
1276 static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo,
1277 struct hda_codec *codec,
1278 struct snd_pcm_substream *substream)
1280 struct sigmatel_spec *spec = codec->spec;
1281 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream);
1284 static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
1285 struct hda_codec *codec,
1286 unsigned int stream_tag,
1287 unsigned int format,
1288 struct snd_pcm_substream *substream)
1290 struct sigmatel_spec *spec = codec->spec;
1291 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, stream_tag, format, substream);
1294 static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
1295 struct hda_codec *codec,
1296 struct snd_pcm_substream *substream)
1298 struct sigmatel_spec *spec = codec->spec;
1299 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
1303 * Digital playback callbacks
1305 static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
1306 struct hda_codec *codec,
1307 struct snd_pcm_substream *substream)
1309 struct sigmatel_spec *spec = codec->spec;
1310 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
1313 static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
1314 struct hda_codec *codec,
1315 struct snd_pcm_substream *substream)
1317 struct sigmatel_spec *spec = codec->spec;
1318 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
1321 static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
1322 struct hda_codec *codec,
1323 unsigned int stream_tag,
1324 unsigned int format,
1325 struct snd_pcm_substream *substream)
1327 struct sigmatel_spec *spec = codec->spec;
1328 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
1329 stream_tag, format, substream);
1334 * Analog capture callbacks
1336 static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
1337 struct hda_codec *codec,
1338 unsigned int stream_tag,
1339 unsigned int format,
1340 struct snd_pcm_substream *substream)
1342 struct sigmatel_spec *spec = codec->spec;
1344 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],
1345 stream_tag, 0, format);
1349 static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
1350 struct hda_codec *codec,
1351 struct snd_pcm_substream *substream)
1353 struct sigmatel_spec *spec = codec->spec;
1355 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], 0, 0, 0);
1359 static struct hda_pcm_stream stac92xx_pcm_digital_playback = {
1363 /* NID is set in stac92xx_build_pcms */
1365 .open = stac92xx_dig_playback_pcm_open,
1366 .close = stac92xx_dig_playback_pcm_close,
1367 .prepare = stac92xx_dig_playback_pcm_prepare
1371 static struct hda_pcm_stream stac92xx_pcm_digital_capture = {
1375 /* NID is set in stac92xx_build_pcms */
1378 static struct hda_pcm_stream stac92xx_pcm_analog_playback = {
1382 .nid = 0x02, /* NID to query formats and rates */
1384 .open = stac92xx_playback_pcm_open,
1385 .prepare = stac92xx_playback_pcm_prepare,
1386 .cleanup = stac92xx_playback_pcm_cleanup
1390 static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = {
1394 .nid = 0x06, /* NID to query formats and rates */
1396 .open = stac92xx_playback_pcm_open,
1397 .prepare = stac92xx_playback_pcm_prepare,
1398 .cleanup = stac92xx_playback_pcm_cleanup
1402 static struct hda_pcm_stream stac92xx_pcm_analog_capture = {
1405 /* NID + .substreams is set in stac92xx_build_pcms */
1407 .prepare = stac92xx_capture_pcm_prepare,
1408 .cleanup = stac92xx_capture_pcm_cleanup
1412 static int stac92xx_build_pcms(struct hda_codec *codec)
1414 struct sigmatel_spec *spec = codec->spec;
1415 struct hda_pcm *info = spec->pcm_rec;
1417 codec->num_pcms = 1;
1418 codec->pcm_info = info;
1420 info->name = "STAC92xx Analog";
1421 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback;
1422 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture;
1423 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
1424 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs;
1426 if (spec->alt_switch) {
1429 info->name = "STAC92xx Analog Alt";
1430 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback;
1433 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
1436 info->name = "STAC92xx Digital";
1437 if (spec->multiout.dig_out_nid) {
1438 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback;
1439 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
1441 if (spec->dig_in_nid) {
1442 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_digital_capture;
1443 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
1450 static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid)
1452 unsigned int pincap = snd_hda_param_read(codec, nid,
1454 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
1455 if (pincap & AC_PINCAP_VREF_100)
1456 return AC_PINCTL_VREF_100;
1457 if (pincap & AC_PINCAP_VREF_80)
1458 return AC_PINCTL_VREF_80;
1459 if (pincap & AC_PINCAP_VREF_50)
1460 return AC_PINCTL_VREF_50;
1461 if (pincap & AC_PINCAP_VREF_GRD)
1462 return AC_PINCTL_VREF_GRD;
1466 static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type)
1469 snd_hda_codec_write_cache(codec, nid, 0,
1470 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
1473 #define stac92xx_io_switch_info snd_ctl_boolean_mono_info
1475 static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1477 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1478 struct sigmatel_spec *spec = codec->spec;
1479 int io_idx = kcontrol-> private_value & 0xff;
1481 ucontrol->value.integer.value[0] = spec->io_switch[io_idx];
1485 static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1487 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1488 struct sigmatel_spec *spec = codec->spec;
1489 hda_nid_t nid = kcontrol->private_value >> 8;
1490 int io_idx = kcontrol-> private_value & 0xff;
1491 unsigned short val = ucontrol->value.integer.value[0];
1493 spec->io_switch[io_idx] = val;
1496 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
1498 unsigned int pinctl = AC_PINCTL_IN_EN;
1499 if (io_idx) /* set VREF for mic */
1500 pinctl |= stac92xx_get_vref(codec, nid);
1501 stac92xx_auto_set_pinctl(codec, nid, pinctl);
1506 #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info
1508 static int stac92xx_clfe_switch_get(struct snd_kcontrol *kcontrol,
1509 struct snd_ctl_elem_value *ucontrol)
1511 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1512 struct sigmatel_spec *spec = codec->spec;
1514 ucontrol->value.integer.value[0] = spec->clfe_swap;
1518 static int stac92xx_clfe_switch_put(struct snd_kcontrol *kcontrol,
1519 struct snd_ctl_elem_value *ucontrol)
1521 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1522 struct sigmatel_spec *spec = codec->spec;
1523 hda_nid_t nid = kcontrol->private_value & 0xff;
1525 if (spec->clfe_swap == ucontrol->value.integer.value[0])
1528 spec->clfe_swap = ucontrol->value.integer.value[0];
1530 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1531 spec->clfe_swap ? 0x4 : 0x0);
1536 #define STAC_CODEC_IO_SWITCH(xname, xpval) \
1537 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1540 .info = stac92xx_io_switch_info, \
1541 .get = stac92xx_io_switch_get, \
1542 .put = stac92xx_io_switch_put, \
1543 .private_value = xpval, \
1546 #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \
1547 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1550 .info = stac92xx_clfe_switch_info, \
1551 .get = stac92xx_clfe_switch_get, \
1552 .put = stac92xx_clfe_switch_put, \
1553 .private_value = xpval, \
1557 STAC_CTL_WIDGET_VOL,
1558 STAC_CTL_WIDGET_MUTE,
1559 STAC_CTL_WIDGET_IO_SWITCH,
1560 STAC_CTL_WIDGET_CLFE_SWITCH
1563 static struct snd_kcontrol_new stac92xx_control_templates[] = {
1564 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
1565 HDA_CODEC_MUTE(NULL, 0, 0, 0),
1566 STAC_CODEC_IO_SWITCH(NULL, 0),
1567 STAC_CODEC_CLFE_SWITCH(NULL, 0),
1570 /* add dynamic controls */
1571 static int stac92xx_add_control(struct sigmatel_spec *spec, int type, const char *name, unsigned long val)
1573 struct snd_kcontrol_new *knew;
1575 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
1576 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
1578 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); /* array + terminator */
1581 if (spec->kctl_alloc) {
1582 memcpy(knew, spec->kctl_alloc, sizeof(*knew) * spec->num_kctl_alloc);
1583 kfree(spec->kctl_alloc);
1585 spec->kctl_alloc = knew;
1586 spec->num_kctl_alloc = num;
1589 knew = &spec->kctl_alloc[spec->num_kctl_used];
1590 *knew = stac92xx_control_templates[type];
1591 knew->name = kstrdup(name, GFP_KERNEL);
1594 knew->private_value = val;
1595 spec->num_kctl_used++;
1599 /* flag inputs as additional dynamic lineouts */
1600 static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cfg *cfg)
1602 struct sigmatel_spec *spec = codec->spec;
1603 unsigned int wcaps, wtype;
1604 int i, num_dacs = 0;
1606 /* use the wcaps cache to count all DACs available for line-outs */
1607 for (i = 0; i < codec->num_nodes; i++) {
1608 wcaps = codec->wcaps[i];
1609 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
1610 if (wtype == AC_WID_AUD_OUT && !(wcaps & AC_WCAP_DIGITAL))
1614 snd_printdd("%s: total dac count=%d\n", __func__, num_dacs);
1616 switch (cfg->line_outs) {
1618 /* add line-in as side */
1619 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 3) {
1620 cfg->line_out_pins[cfg->line_outs] =
1621 cfg->input_pins[AUTO_PIN_LINE];
1622 spec->line_switch = 1;
1627 /* add line-in as clfe and mic as side */
1628 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 2) {
1629 cfg->line_out_pins[cfg->line_outs] =
1630 cfg->input_pins[AUTO_PIN_LINE];
1631 spec->line_switch = 1;
1634 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 3) {
1635 cfg->line_out_pins[cfg->line_outs] =
1636 cfg->input_pins[AUTO_PIN_MIC];
1637 spec->mic_switch = 1;
1642 /* add line-in as surr and mic as clfe */
1643 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 1) {
1644 cfg->line_out_pins[cfg->line_outs] =
1645 cfg->input_pins[AUTO_PIN_LINE];
1646 spec->line_switch = 1;
1649 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 2) {
1650 cfg->line_out_pins[cfg->line_outs] =
1651 cfg->input_pins[AUTO_PIN_MIC];
1652 spec->mic_switch = 1;
1662 static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
1666 for (i = 0; i < spec->multiout.num_dacs; i++) {
1667 if (spec->multiout.dac_nids[i] == nid)
1675 * Fill in the dac_nids table from the parsed pin configuration
1676 * This function only works when every pin in line_out_pins[]
1677 * contains atleast one DAC in its connection list. Some 92xx
1678 * codecs are not connected directly to a DAC, such as the 9200
1679 * and 9202/925x. For those, dac_nids[] must be hard-coded.
1681 static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec,
1682 struct auto_pin_cfg *cfg)
1684 struct sigmatel_spec *spec = codec->spec;
1685 int i, j, conn_len = 0;
1686 hda_nid_t nid, conn[HDA_MAX_CONNECTIONS];
1687 unsigned int wcaps, wtype;
1689 for (i = 0; i < cfg->line_outs; i++) {
1690 nid = cfg->line_out_pins[i];
1691 conn_len = snd_hda_get_connections(codec, nid, conn,
1692 HDA_MAX_CONNECTIONS);
1693 for (j = 0; j < conn_len; j++) {
1694 wcaps = snd_hda_param_read(codec, conn[j],
1695 AC_PAR_AUDIO_WIDGET_CAP);
1696 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
1698 if (wtype != AC_WID_AUD_OUT ||
1699 (wcaps & AC_WCAP_DIGITAL))
1701 /* conn[j] is a DAC routed to this line-out */
1702 if (!is_in_dac_nids(spec, conn[j]))
1706 if (j == conn_len) {
1707 if (spec->multiout.num_dacs > 0) {
1708 /* we have already working output pins,
1709 * so let's drop the broken ones again
1711 cfg->line_outs = spec->multiout.num_dacs;
1714 /* error out, no available DAC found */
1716 "%s: No available DAC for pin 0x%x\n",
1721 spec->multiout.dac_nids[i] = conn[j];
1722 spec->multiout.num_dacs++;
1724 /* select this DAC in the pin's input mux */
1725 snd_hda_codec_write_cache(codec, nid, 0,
1726 AC_VERB_SET_CONNECT_SEL, j);
1731 snd_printd("dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
1732 spec->multiout.num_dacs,
1733 spec->multiout.dac_nids[0],
1734 spec->multiout.dac_nids[1],
1735 spec->multiout.dac_nids[2],
1736 spec->multiout.dac_nids[3],
1737 spec->multiout.dac_nids[4]);
1741 /* create volume control/switch for the given prefx type */
1742 static int create_controls(struct sigmatel_spec *spec, const char *pfx, hda_nid_t nid, int chs)
1747 sprintf(name, "%s Playback Volume", pfx);
1748 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name,
1749 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
1752 sprintf(name, "%s Playback Switch", pfx);
1753 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, name,
1754 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
1760 /* add playback controls from the parsed DAC table */
1761 static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec,
1762 const struct auto_pin_cfg *cfg)
1764 static const char *chname[4] = {
1765 "Front", "Surround", NULL /*CLFE*/, "Side"
1770 struct sigmatel_spec *spec = codec->spec;
1771 unsigned int wid_caps;
1774 for (i = 0; i < cfg->line_outs; i++) {
1775 if (!spec->multiout.dac_nids[i])
1778 nid = spec->multiout.dac_nids[i];
1782 err = create_controls(spec, "Center", nid, 1);
1785 err = create_controls(spec, "LFE", nid, 2);
1789 wid_caps = get_wcaps(codec, nid);
1791 if (wid_caps & AC_WCAP_LR_SWAP) {
1792 err = stac92xx_add_control(spec,
1793 STAC_CTL_WIDGET_CLFE_SWITCH,
1794 "Swap Center/LFE Playback Switch", nid);
1801 err = create_controls(spec, chname[i], nid, 3);
1807 if (spec->line_switch)
1808 if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_IO_SWITCH, "Line In as Output Switch", cfg->input_pins[AUTO_PIN_LINE] << 8)) < 0)
1811 if (spec->mic_switch)
1812 if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_IO_SWITCH, "Mic as Output Switch", (cfg->input_pins[AUTO_PIN_MIC] << 8) | 1)) < 0)
1818 static int check_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
1820 if (is_in_dac_nids(spec, nid))
1822 if (spec->multiout.hp_nid == nid)
1827 static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid)
1829 if (!spec->multiout.hp_nid)
1830 spec->multiout.hp_nid = nid;
1831 else if (spec->multiout.num_dacs > 4) {
1832 printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid);
1835 spec->multiout.dac_nids[spec->multiout.num_dacs] = nid;
1836 spec->multiout.num_dacs++;
1841 /* add playback controls for Speaker and HP outputs */
1842 static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec,
1843 struct auto_pin_cfg *cfg)
1845 struct sigmatel_spec *spec = codec->spec;
1847 int i, old_num_dacs, err;
1849 old_num_dacs = spec->multiout.num_dacs;
1850 for (i = 0; i < cfg->hp_outs; i++) {
1851 unsigned int wid_caps = get_wcaps(codec, cfg->hp_pins[i]);
1852 if (wid_caps & AC_WCAP_UNSOL_CAP)
1853 spec->hp_detect = 1;
1854 nid = snd_hda_codec_read(codec, cfg->hp_pins[i], 0,
1855 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
1856 if (check_in_dac_nids(spec, nid))
1860 add_spec_dacs(spec, nid);
1862 for (i = 0; i < cfg->speaker_outs; i++) {
1863 nid = snd_hda_codec_read(codec, cfg->speaker_pins[i], 0,
1864 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
1865 if (check_in_dac_nids(spec, nid))
1869 add_spec_dacs(spec, nid);
1871 for (i = 0; i < cfg->line_outs; i++) {
1872 nid = snd_hda_codec_read(codec, cfg->line_out_pins[i], 0,
1873 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
1874 if (check_in_dac_nids(spec, nid))
1878 add_spec_dacs(spec, nid);
1880 for (i = old_num_dacs; i < spec->multiout.num_dacs; i++) {
1881 static const char *pfxs[] = {
1882 "Speaker", "External Speaker", "Speaker2",
1884 err = create_controls(spec, pfxs[i - old_num_dacs],
1885 spec->multiout.dac_nids[i], 3);
1889 if (spec->multiout.hp_nid) {
1891 if (old_num_dacs == spec->multiout.num_dacs)
1895 err = create_controls(spec, pfx, spec->multiout.hp_nid, 3);
1903 /* labels for dmic mux inputs */
1904 static const char *stac92xx_dmic_labels[5] = {
1905 "Analog Inputs", "Digital Mic 1", "Digital Mic 2",
1906 "Digital Mic 3", "Digital Mic 4"
1909 /* create playback/capture controls for input pins on dmic capable codecs */
1910 static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec,
1911 const struct auto_pin_cfg *cfg)
1913 struct sigmatel_spec *spec = codec->spec;
1914 struct hda_input_mux *dimux = &spec->private_dimux;
1915 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
1918 dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0];
1919 dimux->items[dimux->num_items].index = 0;
1922 for (i = 0; i < spec->num_dmics; i++) {
1925 unsigned int def_conf;
1927 def_conf = snd_hda_codec_read(codec,
1930 AC_VERB_GET_CONFIG_DEFAULT,
1932 if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE)
1935 num_cons = snd_hda_get_connections(codec,
1938 HDA_MAX_NUM_INPUTS);
1939 for (j = 0; j < num_cons; j++)
1940 if (con_lst[j] == spec->dmic_nids[i]) {
1946 dimux->items[dimux->num_items].label =
1947 stac92xx_dmic_labels[dimux->num_items];
1948 dimux->items[dimux->num_items].index = index;
1955 /* create playback/capture controls for input pins */
1956 static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg)
1958 struct sigmatel_spec *spec = codec->spec;
1959 struct hda_input_mux *imux = &spec->private_imux;
1960 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
1963 for (i = 0; i < AUTO_PIN_LAST; i++) {
1966 if (!cfg->input_pins[i])
1969 for (j = 0; j < spec->num_muxes; j++) {
1971 num_cons = snd_hda_get_connections(codec,
1974 HDA_MAX_NUM_INPUTS);
1975 for (k = 0; k < num_cons; k++)
1976 if (con_lst[k] == cfg->input_pins[i]) {
1983 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
1984 imux->items[imux->num_items].index = index;
1988 if (imux->num_items) {
1990 * Set the current input for the muxes.
1991 * The STAC9221 has two input muxes with identical source
1992 * NID lists. Hopefully this won't get confused.
1994 for (i = 0; i < spec->num_muxes; i++) {
1995 snd_hda_codec_write_cache(codec, spec->mux_nids[i], 0,
1996 AC_VERB_SET_CONNECT_SEL,
1997 imux->items[0].index);
2004 static void stac92xx_auto_init_multi_out(struct hda_codec *codec)
2006 struct sigmatel_spec *spec = codec->spec;
2009 for (i = 0; i < spec->autocfg.line_outs; i++) {
2010 hda_nid_t nid = spec->autocfg.line_out_pins[i];
2011 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
2015 static void stac92xx_auto_init_hp_out(struct hda_codec *codec)
2017 struct sigmatel_spec *spec = codec->spec;
2020 for (i = 0; i < spec->autocfg.hp_outs; i++) {
2022 pin = spec->autocfg.hp_pins[i];
2023 if (pin) /* connect to front */
2024 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
2026 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
2028 pin = spec->autocfg.speaker_pins[i];
2029 if (pin) /* connect to front */
2030 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN);
2034 static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out, hda_nid_t dig_in)
2036 struct sigmatel_spec *spec = codec->spec;
2039 if ((err = snd_hda_parse_pin_def_config(codec,
2041 spec->dmic_nids)) < 0)
2043 if (! spec->autocfg.line_outs)
2044 return 0; /* can't find valid pin config */
2046 if ((err = stac92xx_add_dyn_out_pins(codec, &spec->autocfg)) < 0)
2048 if (spec->multiout.num_dacs == 0)
2049 if ((err = stac92xx_auto_fill_dac_nids(codec, &spec->autocfg)) < 0)
2052 err = stac92xx_auto_create_multi_out_ctls(codec, &spec->autocfg);
2057 err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg);
2062 err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg);
2067 if (spec->num_dmics > 0)
2068 if ((err = stac92xx_auto_create_dmic_input_ctls(codec,
2069 &spec->autocfg)) < 0)
2072 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
2073 if (spec->multiout.max_channels > 2)
2074 spec->surr_switch = 1;
2076 if (spec->autocfg.dig_out_pin)
2077 spec->multiout.dig_out_nid = dig_out;
2078 if (spec->autocfg.dig_in_pin)
2079 spec->dig_in_nid = dig_in;
2081 if (spec->kctl_alloc)
2082 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
2084 spec->input_mux = &spec->private_imux;
2085 spec->dinput_mux = &spec->private_dimux;
2090 /* add playback controls for HP output */
2091 static int stac9200_auto_create_hp_ctls(struct hda_codec *codec,
2092 struct auto_pin_cfg *cfg)
2094 struct sigmatel_spec *spec = codec->spec;
2095 hda_nid_t pin = cfg->hp_pins[0];
2096 unsigned int wid_caps;
2101 wid_caps = get_wcaps(codec, pin);
2102 if (wid_caps & AC_WCAP_UNSOL_CAP)
2103 spec->hp_detect = 1;
2108 /* add playback controls for LFE output */
2109 static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec,
2110 struct auto_pin_cfg *cfg)
2112 struct sigmatel_spec *spec = codec->spec;
2114 hda_nid_t lfe_pin = 0x0;
2118 * search speaker outs and line outs for a mono speaker pin
2119 * with an amp. If one is found, add LFE controls
2122 for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) {
2123 hda_nid_t pin = spec->autocfg.speaker_pins[i];
2124 unsigned long wcaps = get_wcaps(codec, pin);
2125 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
2126 if (wcaps == AC_WCAP_OUT_AMP)
2127 /* found a mono speaker with an amp, must be lfe */
2131 /* if speaker_outs is 0, then speakers may be in line_outs */
2132 if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) {
2133 for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) {
2134 hda_nid_t pin = spec->autocfg.line_out_pins[i];
2136 cfg = snd_hda_codec_read(codec, pin, 0,
2137 AC_VERB_GET_CONFIG_DEFAULT,
2139 if (get_defcfg_device(cfg) == AC_JACK_SPEAKER) {
2140 unsigned long wcaps = get_wcaps(codec, pin);
2141 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
2142 if (wcaps == AC_WCAP_OUT_AMP)
2143 /* found a mono speaker with an amp,
2151 err = create_controls(spec, "LFE", lfe_pin, 1);
2159 static int stac9200_parse_auto_config(struct hda_codec *codec)
2161 struct sigmatel_spec *spec = codec->spec;
2164 if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0)
2167 if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0)
2170 if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0)
2173 if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0)
2176 if (spec->autocfg.dig_out_pin)
2177 spec->multiout.dig_out_nid = 0x05;
2178 if (spec->autocfg.dig_in_pin)
2179 spec->dig_in_nid = 0x04;
2181 if (spec->kctl_alloc)
2182 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
2184 spec->input_mux = &spec->private_imux;
2185 spec->dinput_mux = &spec->private_dimux;
2191 * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
2192 * funky external mute control using GPIO pins.
2195 static void stac922x_gpio_mute(struct hda_codec *codec, int pin, int muted)
2197 unsigned int gpiostate, gpiomask, gpiodir;
2199 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
2200 AC_VERB_GET_GPIO_DATA, 0);
2203 gpiostate |= (1 << pin);
2205 gpiostate &= ~(1 << pin);
2207 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
2208 AC_VERB_GET_GPIO_MASK, 0);
2209 gpiomask |= (1 << pin);
2211 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
2212 AC_VERB_GET_GPIO_DIRECTION, 0);
2213 gpiodir |= (1 << pin);
2215 /* AppleHDA seems to do this -- WTF is this verb?? */
2216 snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0);
2218 snd_hda_codec_write(codec, codec->afg, 0,
2219 AC_VERB_SET_GPIO_MASK, gpiomask);
2220 snd_hda_codec_write(codec, codec->afg, 0,
2221 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
2225 snd_hda_codec_write(codec, codec->afg, 0,
2226 AC_VERB_SET_GPIO_DATA, gpiostate);
2229 static void enable_pin_detect(struct hda_codec *codec, hda_nid_t nid,
2232 if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)
2233 snd_hda_codec_write_cache(codec, nid, 0,
2234 AC_VERB_SET_UNSOLICITED_ENABLE,
2235 (AC_USRSP_EN | event));
2238 static int stac92xx_init(struct hda_codec *codec)
2240 struct sigmatel_spec *spec = codec->spec;
2241 struct auto_pin_cfg *cfg = &spec->autocfg;
2244 snd_hda_sequence_write(codec, spec->init);
2247 if (spec->hp_detect) {
2248 /* Enable unsolicited responses on the HP widget */
2249 for (i = 0; i < cfg->hp_outs; i++)
2250 enable_pin_detect(codec, cfg->hp_pins[i],
2252 /* force to enable the first line-out; the others are set up
2255 stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0],
2257 stac92xx_auto_init_hp_out(codec);
2258 /* fake event to set up pins */
2259 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
2261 stac92xx_auto_init_multi_out(codec);
2262 stac92xx_auto_init_hp_out(codec);
2264 for (i = 0; i < AUTO_PIN_LAST; i++) {
2265 hda_nid_t nid = cfg->input_pins[i];
2267 unsigned int pinctl = AC_PINCTL_IN_EN;
2268 if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC)
2269 pinctl |= stac92xx_get_vref(codec, nid);
2270 stac92xx_auto_set_pinctl(codec, nid, pinctl);
2273 if (spec->num_dmics > 0)
2274 for (i = 0; i < spec->num_dmics; i++)
2275 stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i],
2278 if (cfg->dig_out_pin)
2279 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin,
2281 if (cfg->dig_in_pin)
2282 stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin,
2285 if (spec->gpio_mute) {
2286 stac922x_gpio_mute(codec, 0, 0);
2287 stac922x_gpio_mute(codec, 1, 0);
2293 static void stac92xx_free(struct hda_codec *codec)
2295 struct sigmatel_spec *spec = codec->spec;
2301 if (spec->kctl_alloc) {
2302 for (i = 0; i < spec->num_kctl_used; i++)
2303 kfree(spec->kctl_alloc[i].name);
2304 kfree(spec->kctl_alloc);
2307 if (spec->bios_pin_configs)
2308 kfree(spec->bios_pin_configs);
2313 static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid,
2316 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
2317 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
2319 if (pin_ctl & AC_PINCTL_IN_EN) {
2321 * we need to check the current set-up direction of
2322 * shared input pins since they can be switched via
2323 * "xxx as Output" mixer switch
2325 struct sigmatel_spec *spec = codec->spec;
2326 struct auto_pin_cfg *cfg = &spec->autocfg;
2327 if ((nid == cfg->input_pins[AUTO_PIN_LINE] &&
2328 spec->line_switch) ||
2329 (nid == cfg->input_pins[AUTO_PIN_MIC] &&
2334 /* if setting pin direction bits, clear the current
2335 direction bits first */
2336 if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN))
2337 pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN);
2339 snd_hda_codec_write_cache(codec, nid, 0,
2340 AC_VERB_SET_PIN_WIDGET_CONTROL,
2344 static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
2347 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
2348 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
2349 snd_hda_codec_write_cache(codec, nid, 0,
2350 AC_VERB_SET_PIN_WIDGET_CONTROL,
2354 static int get_pin_presence(struct hda_codec *codec, hda_nid_t nid)
2358 if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0x00)
2364 static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res)
2366 struct sigmatel_spec *spec = codec->spec;
2367 struct auto_pin_cfg *cfg = &spec->autocfg;
2371 for (i = 0; i < cfg->hp_outs; i++) {
2372 presence = get_pin_presence(codec, cfg->hp_pins[i]);
2378 /* disable lineouts, enable hp */
2379 for (i = 0; i < cfg->line_outs; i++)
2380 stac92xx_reset_pinctl(codec, cfg->line_out_pins[i],
2382 for (i = 0; i < cfg->speaker_outs; i++)
2383 stac92xx_reset_pinctl(codec, cfg->speaker_pins[i],
2386 /* enable lineouts, disable hp */
2387 for (i = 0; i < cfg->line_outs; i++)
2388 stac92xx_set_pinctl(codec, cfg->line_out_pins[i],
2390 for (i = 0; i < cfg->speaker_outs; i++)
2391 stac92xx_set_pinctl(codec, cfg->speaker_pins[i],
2396 static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
2398 switch (res >> 26) {
2400 stac92xx_hp_detect(codec, res);
2405 #ifdef SND_HDA_NEEDS_RESUME
2406 static int stac92xx_resume(struct hda_codec *codec)
2408 struct sigmatel_spec *spec = codec->spec;
2410 stac92xx_set_config_regs(codec);
2411 snd_hda_sequence_write(codec, spec->init);
2412 if (spec->gpio_mute) {
2413 stac922x_gpio_mute(codec, 0, 0);
2414 stac922x_gpio_mute(codec, 1, 0);
2416 snd_hda_codec_resume_amp(codec);
2417 snd_hda_codec_resume_cache(codec);
2418 /* invoke unsolicited event to reset the HP state */
2419 if (spec->hp_detect)
2420 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
2425 static struct hda_codec_ops stac92xx_patch_ops = {
2426 .build_controls = stac92xx_build_controls,
2427 .build_pcms = stac92xx_build_pcms,
2428 .init = stac92xx_init,
2429 .free = stac92xx_free,
2430 .unsol_event = stac92xx_unsol_event,
2431 #ifdef SND_HDA_NEEDS_RESUME
2432 .resume = stac92xx_resume,
2436 static int patch_stac9200(struct hda_codec *codec)
2438 struct sigmatel_spec *spec;
2441 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
2446 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
2447 spec->pin_nids = stac9200_pin_nids;
2448 spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
2451 if (spec->board_config < 0) {
2452 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n");
2453 err = stac92xx_save_bios_config_regs(codec);
2455 stac92xx_free(codec);
2458 spec->pin_configs = spec->bios_pin_configs;
2460 spec->pin_configs = stac9200_brd_tbl[spec->board_config];
2461 stac92xx_set_config_regs(codec);
2464 spec->multiout.max_channels = 2;
2465 spec->multiout.num_dacs = 1;
2466 spec->multiout.dac_nids = stac9200_dac_nids;
2467 spec->adc_nids = stac9200_adc_nids;
2468 spec->mux_nids = stac9200_mux_nids;
2469 spec->num_muxes = 1;
2470 spec->num_dmics = 0;
2473 if (spec->board_config == STAC_9200_GATEWAY)
2474 spec->init = stac9200_eapd_init;
2476 spec->init = stac9200_core_init;
2477 spec->mixer = stac9200_mixer;
2479 err = stac9200_parse_auto_config(codec);
2481 stac92xx_free(codec);
2485 codec->patch_ops = stac92xx_patch_ops;
2490 static int patch_stac925x(struct hda_codec *codec)
2492 struct sigmatel_spec *spec;
2495 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
2500 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
2501 spec->pin_nids = stac925x_pin_nids;
2502 spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS,
2506 if (spec->board_config < 0) {
2507 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x,"
2508 "using BIOS defaults\n");
2509 err = stac92xx_save_bios_config_regs(codec);
2511 stac92xx_free(codec);
2514 spec->pin_configs = spec->bios_pin_configs;
2515 } else if (stac925x_brd_tbl[spec->board_config] != NULL){
2516 spec->pin_configs = stac925x_brd_tbl[spec->board_config];
2517 stac92xx_set_config_regs(codec);
2520 spec->multiout.max_channels = 2;
2521 spec->multiout.num_dacs = 1;
2522 spec->multiout.dac_nids = stac925x_dac_nids;
2523 spec->adc_nids = stac925x_adc_nids;
2524 spec->mux_nids = stac925x_mux_nids;
2525 spec->num_muxes = 1;
2527 switch (codec->vendor_id) {
2528 case 0x83847632: /* STAC9202 */
2529 case 0x83847633: /* STAC9202D */
2530 case 0x83847636: /* STAC9251 */
2531 case 0x83847637: /* STAC9251D */
2532 spec->num_dmics = STAC925X_NUM_DMICS;
2533 spec->dmic_nids = stac925x_dmic_nids;
2536 spec->num_dmics = 0;
2540 spec->init = stac925x_core_init;
2541 spec->mixer = stac925x_mixer;
2543 err = stac92xx_parse_auto_config(codec, 0x8, 0x7);
2545 if (spec->board_config < 0) {
2546 printk(KERN_WARNING "hda_codec: No auto-config is "
2547 "available, default to model=ref\n");
2548 spec->board_config = STAC_925x_REF;
2554 stac92xx_free(codec);
2558 codec->patch_ops = stac92xx_patch_ops;
2563 static int patch_stac922x(struct hda_codec *codec)
2565 struct sigmatel_spec *spec;
2568 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
2573 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
2574 spec->pin_nids = stac922x_pin_nids;
2575 spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
2578 if (spec->board_config == STAC_INTEL_MAC_V3) {
2579 spec->gpio_mute = 1;
2580 /* Intel Macs have all same PCI SSID, so we need to check
2581 * codec SSID to distinguish the exact models
2583 printk(KERN_INFO "hda_codec: STAC922x, Apple subsys_id=%x\n", codec->subsystem_id);
2584 switch (codec->subsystem_id) {
2587 spec->board_config = STAC_INTEL_MAC_V1;
2591 spec->board_config = STAC_INTEL_MAC_V2;
2599 spec->board_config = STAC_INTEL_MAC_V3;
2603 spec->board_config = STAC_INTEL_MAC_V4;
2607 spec->board_config = STAC_INTEL_MAC_V5;
2613 if (spec->board_config < 0) {
2614 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, "
2615 "using BIOS defaults\n");
2616 err = stac92xx_save_bios_config_regs(codec);
2618 stac92xx_free(codec);
2621 spec->pin_configs = spec->bios_pin_configs;
2622 } else if (stac922x_brd_tbl[spec->board_config] != NULL) {
2623 spec->pin_configs = stac922x_brd_tbl[spec->board_config];
2624 stac92xx_set_config_regs(codec);
2627 spec->adc_nids = stac922x_adc_nids;
2628 spec->mux_nids = stac922x_mux_nids;
2629 spec->num_muxes = ARRAY_SIZE(stac922x_mux_nids);
2630 spec->num_adcs = ARRAY_SIZE(stac922x_adc_nids);
2631 spec->num_dmics = 0;
2633 spec->init = stac922x_core_init;
2634 spec->mixer = stac922x_mixer;
2636 spec->multiout.dac_nids = spec->dac_nids;
2638 err = stac92xx_parse_auto_config(codec, 0x08, 0x09);
2640 if (spec->board_config < 0) {
2641 printk(KERN_WARNING "hda_codec: No auto-config is "
2642 "available, default to model=ref\n");
2643 spec->board_config = STAC_D945_REF;
2649 stac92xx_free(codec);
2653 codec->patch_ops = stac92xx_patch_ops;
2655 /* Fix Mux capture level; max to 2 */
2656 snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
2657 (0 << AC_AMPCAP_OFFSET_SHIFT) |
2658 (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
2659 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2660 (0 << AC_AMPCAP_MUTE_SHIFT));
2665 static int patch_stac927x(struct hda_codec *codec)
2667 struct sigmatel_spec *spec;
2670 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
2675 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids);
2676 spec->pin_nids = stac927x_pin_nids;
2677 spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS,
2681 if (spec->board_config < 0) {
2682 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC927x, using BIOS defaults\n");
2683 err = stac92xx_save_bios_config_regs(codec);
2685 stac92xx_free(codec);
2688 spec->pin_configs = spec->bios_pin_configs;
2689 } else if (stac927x_brd_tbl[spec->board_config] != NULL) {
2690 spec->pin_configs = stac927x_brd_tbl[spec->board_config];
2691 stac92xx_set_config_regs(codec);
2694 switch (spec->board_config) {
2696 spec->adc_nids = stac927x_adc_nids;
2697 spec->mux_nids = stac927x_mux_nids;
2698 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
2699 spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids);
2700 spec->init = d965_core_init;
2701 spec->mixer = stac927x_mixer;
2704 spec->adc_nids = stac927x_adc_nids;
2705 spec->mux_nids = stac927x_mux_nids;
2706 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
2707 spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids);
2708 spec->init = d965_core_init;
2709 spec->mixer = stac927x_mixer;
2712 spec->adc_nids = stac927x_adc_nids;
2713 spec->mux_nids = stac927x_mux_nids;
2714 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
2715 spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids);
2716 spec->init = stac927x_core_init;
2717 spec->mixer = stac927x_mixer;
2720 switch (codec->subsystem_id) {
2721 case 0x1028020A: /* STAC 9228 */
2722 case 0x10280209: /* STAC 9228 */
2723 spec->dmic_nids = stac927x_dmic_nids;
2724 spec->num_dmics = STAC927X_NUM_DMICS;
2725 spec->dmux_nid = 0x1b;
2728 spec->num_dmics = 0;
2731 spec->multiout.dac_nids = spec->dac_nids;
2732 /* GPIO0 High = Enable EAPD */
2733 spec->gpio_mask = spec->gpio_data = 0x00000001;
2734 stac92xx_enable_gpio_mask(codec);
2736 err = stac92xx_parse_auto_config(codec, 0x1e, 0x20);
2738 if (spec->board_config < 0) {
2739 printk(KERN_WARNING "hda_codec: No auto-config is "
2740 "available, default to model=ref\n");
2741 spec->board_config = STAC_D965_REF;
2747 stac92xx_free(codec);
2751 codec->patch_ops = stac92xx_patch_ops;
2756 static int patch_stac9205(struct hda_codec *codec)
2758 struct sigmatel_spec *spec;
2761 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
2766 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids);
2767 spec->pin_nids = stac9205_pin_nids;
2768 spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS,
2772 if (spec->board_config < 0) {
2773 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n");
2774 err = stac92xx_save_bios_config_regs(codec);
2776 stac92xx_free(codec);
2779 spec->pin_configs = spec->bios_pin_configs;
2781 spec->pin_configs = stac9205_brd_tbl[spec->board_config];
2782 stac92xx_set_config_regs(codec);
2785 spec->adc_nids = stac9205_adc_nids;
2786 spec->num_adcs = ARRAY_SIZE(stac9205_adc_nids);
2787 spec->mux_nids = stac9205_mux_nids;
2788 spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids);
2789 spec->dmic_nids = stac9205_dmic_nids;
2790 spec->num_dmics = STAC9205_NUM_DMICS;
2791 spec->dmux_nid = 0x1d;
2793 spec->init = stac9205_core_init;
2794 spec->mixer = stac9205_mixer;
2796 spec->multiout.dac_nids = spec->dac_nids;
2798 switch (spec->board_config){
2799 case STAC_9205_DELL_M43:
2800 /* Enable SPDIF in/out */
2801 stac92xx_set_config_reg(codec, 0x1f, 0x01441030);
2802 stac92xx_set_config_reg(codec, 0x20, 0x1c410030);
2804 spec->gpio_mask = 0x00000007; /* GPIO0-2 */
2805 /* GPIO0 High = EAPD, GPIO1 Low = DRM,
2806 * GPIO2 High = Headphone Mute
2808 spec->gpio_data = 0x00000005;
2811 /* GPIO0 High = EAPD */
2812 spec->gpio_mask = spec->gpio_data = 0x00000001;
2816 stac92xx_enable_gpio_mask(codec);
2817 err = stac92xx_parse_auto_config(codec, 0x1f, 0x20);
2819 if (spec->board_config < 0) {
2820 printk(KERN_WARNING "hda_codec: No auto-config is "
2821 "available, default to model=ref\n");
2822 spec->board_config = STAC_9205_REF;
2828 stac92xx_free(codec);
2832 codec->patch_ops = stac92xx_patch_ops;
2841 /* static config for Sony VAIO FE550G and Sony VAIO AR */
2842 static hda_nid_t vaio_dacs[] = { 0x2 };
2843 #define VAIO_HP_DAC 0x5
2844 static hda_nid_t vaio_adcs[] = { 0x8 /*,0x6*/ };
2845 static hda_nid_t vaio_mux_nids[] = { 0x15 };
2847 static struct hda_input_mux vaio_mux = {
2850 /* { "HP", 0x0 }, */
2851 { "Mic Jack", 0x1 },
2852 { "Internal Mic", 0x2 },
2857 static struct hda_verb vaio_init[] = {
2858 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
2859 {0x0a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | STAC_HP_EVENT},
2860 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
2861 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
2862 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
2863 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */
2864 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
2865 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */
2866 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */
2867 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
2868 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
2869 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
2873 static struct hda_verb vaio_ar_init[] = {
2874 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
2875 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
2876 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
2877 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
2878 /* {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },*/ /* Optical Out */
2879 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */
2880 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
2881 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */
2882 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */
2883 /* {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},*/ /* Optical Out */
2884 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
2885 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
2886 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
2890 /* bind volumes of both NID 0x02 and 0x05 */
2891 static struct hda_bind_ctls vaio_bind_master_vol = {
2892 .ops = &snd_hda_bind_vol,
2894 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
2895 HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT),
2900 /* bind volumes of both NID 0x02 and 0x05 */
2901 static struct hda_bind_ctls vaio_bind_master_sw = {
2902 .ops = &snd_hda_bind_sw,
2904 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
2905 HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT),
2910 static struct snd_kcontrol_new vaio_mixer[] = {
2911 HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol),
2912 HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw),
2913 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
2914 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
2915 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
2917 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2918 .name = "Capture Source",
2920 .info = stac92xx_mux_enum_info,
2921 .get = stac92xx_mux_enum_get,
2922 .put = stac92xx_mux_enum_put,
2927 static struct snd_kcontrol_new vaio_ar_mixer[] = {
2928 HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol),
2929 HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw),
2930 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
2931 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
2932 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
2933 /*HDA_CODEC_MUTE("Optical Out Switch", 0x10, 0, HDA_OUTPUT),
2934 HDA_CODEC_VOLUME("Optical Out Volume", 0x10, 0, HDA_OUTPUT),*/
2936 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2937 .name = "Capture Source",
2939 .info = stac92xx_mux_enum_info,
2940 .get = stac92xx_mux_enum_get,
2941 .put = stac92xx_mux_enum_put,
2946 static struct hda_codec_ops stac9872_patch_ops = {
2947 .build_controls = stac92xx_build_controls,
2948 .build_pcms = stac92xx_build_pcms,
2949 .init = stac92xx_init,
2950 .free = stac92xx_free,
2951 #ifdef SND_HDA_NEEDS_RESUME
2952 .resume = stac92xx_resume,
2956 static int stac9872_vaio_init(struct hda_codec *codec)
2960 err = stac92xx_init(codec);
2963 if (codec->patch_ops.unsol_event)
2964 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
2968 static void stac9872_vaio_hp_detect(struct hda_codec *codec, unsigned int res)
2970 if (get_pin_presence(codec, 0x0a)) {
2971 stac92xx_reset_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN);
2972 stac92xx_set_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN);
2974 stac92xx_reset_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN);
2975 stac92xx_set_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN);
2979 static void stac9872_vaio_unsol_event(struct hda_codec *codec, unsigned int res)
2981 switch (res >> 26) {
2983 stac9872_vaio_hp_detect(codec, res);
2988 static struct hda_codec_ops stac9872_vaio_patch_ops = {
2989 .build_controls = stac92xx_build_controls,
2990 .build_pcms = stac92xx_build_pcms,
2991 .init = stac9872_vaio_init,
2992 .free = stac92xx_free,
2993 .unsol_event = stac9872_vaio_unsol_event,
2995 .resume = stac92xx_resume,
2999 enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */
3001 /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */
3003 /* Unknown. id=0x83847661 and subsys=0x104D1200. */
3005 /* AR Series. id=0x83847664 and subsys=104D1300 */
3010 static const char *stac9872_models[STAC_9872_MODELS] = {
3011 [CXD9872RD_VAIO] = "vaio",
3012 [CXD9872AKD_VAIO] = "vaio-ar",
3015 static struct snd_pci_quirk stac9872_cfg_tbl[] = {
3016 SND_PCI_QUIRK(0x104d, 0x81e6, "Sony VAIO F/S", CXD9872RD_VAIO),
3017 SND_PCI_QUIRK(0x104d, 0x81ef, "Sony VAIO F/S", CXD9872RD_VAIO),
3018 SND_PCI_QUIRK(0x104d, 0x81fd, "Sony VAIO AR", CXD9872AKD_VAIO),
3019 SND_PCI_QUIRK(0x104d, 0x8205, "Sony VAIO AR", CXD9872AKD_VAIO),
3023 static int patch_stac9872(struct hda_codec *codec)
3025 struct sigmatel_spec *spec;
3028 board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS,
3031 if (board_config < 0)
3032 /* unknown config, let generic-parser do its job... */
3033 return snd_hda_parse_generic_codec(codec);
3035 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3040 switch (board_config) {
3041 case CXD9872RD_VAIO:
3042 case STAC9872AK_VAIO:
3043 case STAC9872K_VAIO:
3044 spec->mixer = vaio_mixer;
3045 spec->init = vaio_init;
3046 spec->multiout.max_channels = 2;
3047 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs);
3048 spec->multiout.dac_nids = vaio_dacs;
3049 spec->multiout.hp_nid = VAIO_HP_DAC;
3050 spec->num_adcs = ARRAY_SIZE(vaio_adcs);
3051 spec->adc_nids = vaio_adcs;
3052 spec->input_mux = &vaio_mux;
3053 spec->mux_nids = vaio_mux_nids;
3054 codec->patch_ops = stac9872_vaio_patch_ops;
3057 case CXD9872AKD_VAIO:
3058 spec->mixer = vaio_ar_mixer;
3059 spec->init = vaio_ar_init;
3060 spec->multiout.max_channels = 2;
3061 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs);
3062 spec->multiout.dac_nids = vaio_dacs;
3063 spec->multiout.hp_nid = VAIO_HP_DAC;
3064 spec->num_adcs = ARRAY_SIZE(vaio_adcs);
3065 spec->adc_nids = vaio_adcs;
3066 spec->input_mux = &vaio_mux;
3067 spec->mux_nids = vaio_mux_nids;
3068 codec->patch_ops = stac9872_patch_ops;
3079 struct hda_codec_preset snd_hda_preset_sigmatel[] = {
3080 { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 },
3081 { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x },
3082 { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x },
3083 { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x },
3084 { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x },
3085 { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x },
3086 { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x },
3087 { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x },
3088 { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x },
3089 { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x },
3090 { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x },
3091 { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x },
3092 { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x },
3093 { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x },
3094 { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x },
3095 { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x },
3096 { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x },
3097 { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x },
3098 { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x },
3099 { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x },
3100 { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x },
3101 { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x },
3102 { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x },
3103 { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x },
3104 { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x },
3105 { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x },
3106 { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x },
3107 { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x },
3108 { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x },
3109 /* The following does not take into account .id=0x83847661 when subsys =
3110 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
3111 * currently not fully supported.
3113 { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 },
3114 { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 },
3115 { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 },
3116 { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 },
3117 { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 },
3118 { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 },
3119 { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 },
3120 { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 },
3121 { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 },
3122 { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 },
3123 { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 },