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
67 /* for backward compitability */
84 struct sigmatel_spec {
85 struct snd_kcontrol_new *mixers[4];
86 unsigned int num_mixers;
89 unsigned int surr_switch: 1;
90 unsigned int line_switch: 1;
91 unsigned int mic_switch: 1;
92 unsigned int alt_switch: 1;
93 unsigned int hp_detect: 1;
94 unsigned int gpio_mute: 1;
97 struct hda_multi_out multiout;
98 hda_nid_t dac_nids[5];
102 unsigned int num_adcs;
104 unsigned int num_muxes;
105 hda_nid_t *dmic_nids;
106 unsigned int num_dmics;
108 hda_nid_t dig_in_nid;
112 unsigned int num_pins;
113 unsigned int *pin_configs;
114 unsigned int *bios_pin_configs;
116 /* codec specific stuff */
117 struct hda_verb *init;
118 struct snd_kcontrol_new *mixer;
121 struct hda_input_mux *dinput_mux;
122 unsigned int cur_dmux;
123 struct hda_input_mux *input_mux;
124 unsigned int cur_mux[3];
127 unsigned int io_switch[2];
129 struct hda_pcm pcm_rec[2]; /* PCM information */
131 /* dynamic controls and input_mux */
132 struct auto_pin_cfg autocfg;
133 unsigned int num_kctl_alloc, num_kctl_used;
134 struct snd_kcontrol_new *kctl_alloc;
135 struct hda_input_mux private_dimux;
136 struct hda_input_mux private_imux;
139 static hda_nid_t stac9200_adc_nids[1] = {
143 static hda_nid_t stac9200_mux_nids[1] = {
147 static hda_nid_t stac9200_dac_nids[1] = {
151 static hda_nid_t stac925x_adc_nids[1] = {
155 static hda_nid_t stac925x_mux_nids[1] = {
159 static hda_nid_t stac925x_dac_nids[1] = {
163 static hda_nid_t stac925x_dmic_nids[1] = {
167 static hda_nid_t stac922x_adc_nids[2] = {
171 static hda_nid_t stac922x_mux_nids[2] = {
175 static hda_nid_t stac927x_adc_nids[3] = {
179 static hda_nid_t stac927x_mux_nids[3] = {
183 static hda_nid_t stac9205_adc_nids[2] = {
187 static hda_nid_t stac9205_mux_nids[2] = {
191 static hda_nid_t stac9205_dmic_nids[2] = {
195 static hda_nid_t stac9200_pin_nids[8] = {
196 0x08, 0x09, 0x0d, 0x0e,
197 0x0f, 0x10, 0x11, 0x12,
200 static hda_nid_t stac925x_pin_nids[8] = {
201 0x07, 0x08, 0x0a, 0x0b,
202 0x0c, 0x0d, 0x10, 0x11,
205 static hda_nid_t stac922x_pin_nids[10] = {
206 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
207 0x0f, 0x10, 0x11, 0x15, 0x1b,
210 static hda_nid_t stac927x_pin_nids[14] = {
211 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
212 0x0f, 0x10, 0x11, 0x12, 0x13,
213 0x14, 0x21, 0x22, 0x23,
216 static hda_nid_t stac9205_pin_nids[12] = {
217 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
218 0x0f, 0x14, 0x16, 0x17, 0x18,
223 static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol,
224 struct snd_ctl_elem_info *uinfo)
226 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
227 struct sigmatel_spec *spec = codec->spec;
228 return snd_hda_input_mux_info(spec->dinput_mux, uinfo);
231 static int stac92xx_dmux_enum_get(struct snd_kcontrol *kcontrol,
232 struct snd_ctl_elem_value *ucontrol)
234 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
235 struct sigmatel_spec *spec = codec->spec;
237 ucontrol->value.enumerated.item[0] = spec->cur_dmux;
241 static int stac92xx_dmux_enum_put(struct snd_kcontrol *kcontrol,
242 struct snd_ctl_elem_value *ucontrol)
244 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
245 struct sigmatel_spec *spec = codec->spec;
247 return snd_hda_input_mux_put(codec, spec->dinput_mux, ucontrol,
248 spec->dmux_nid, &spec->cur_dmux);
251 static int stac92xx_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
253 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
254 struct sigmatel_spec *spec = codec->spec;
255 return snd_hda_input_mux_info(spec->input_mux, uinfo);
258 static int stac92xx_mux_enum_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
260 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
261 struct sigmatel_spec *spec = codec->spec;
262 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
264 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
268 static int stac92xx_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
270 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
271 struct sigmatel_spec *spec = codec->spec;
272 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
274 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol,
275 spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]);
278 static struct hda_verb stac9200_core_init[] = {
279 /* set dac0mux for dac converter */
280 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
284 static struct hda_verb stac925x_core_init[] = {
285 /* set dac0mux for dac converter */
286 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
290 static struct hda_verb stac922x_core_init[] = {
291 /* set master volume and direct control */
292 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
296 static struct hda_verb d965_core_init[] = {
297 /* set master volume and direct control */
298 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
299 /* unmute node 0x1b */
300 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
301 /* select node 0x03 as DAC */
302 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
306 static struct hda_verb stac927x_core_init[] = {
307 /* set master volume and direct control */
308 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
312 static struct hda_verb stac9205_core_init[] = {
313 /* set master volume and direct control */
314 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
318 static struct snd_kcontrol_new stac9200_mixer[] = {
319 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT),
320 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT),
322 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
323 .name = "Input Source",
325 .info = stac92xx_mux_enum_info,
326 .get = stac92xx_mux_enum_get,
327 .put = stac92xx_mux_enum_put,
329 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT),
330 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT),
331 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0c, 0, HDA_OUTPUT),
335 static struct snd_kcontrol_new stac925x_mixer[] = {
336 HDA_CODEC_VOLUME("Master Playback Volume", 0xe, 0, HDA_OUTPUT),
337 HDA_CODEC_MUTE("Master Playback Switch", 0xe, 0, HDA_OUTPUT),
339 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
340 .name = "Input Source",
342 .info = stac92xx_mux_enum_info,
343 .get = stac92xx_mux_enum_get,
344 .put = stac92xx_mux_enum_put,
346 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT),
347 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_OUTPUT),
348 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0f, 0, HDA_OUTPUT),
352 /* This needs to be generated dynamically based on sequence */
353 static struct snd_kcontrol_new stac922x_mixer[] = {
355 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
356 .name = "Input Source",
358 .info = stac92xx_mux_enum_info,
359 .get = stac92xx_mux_enum_get,
360 .put = stac92xx_mux_enum_put,
362 HDA_CODEC_VOLUME("Capture Volume", 0x17, 0x0, HDA_INPUT),
363 HDA_CODEC_MUTE("Capture Switch", 0x17, 0x0, HDA_INPUT),
364 HDA_CODEC_VOLUME("Mux Capture Volume", 0x12, 0x0, HDA_OUTPUT),
368 /* This needs to be generated dynamically based on sequence */
369 static struct snd_kcontrol_new stac9227_mixer[] = {
371 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
372 .name = "Input Source",
374 .info = stac92xx_mux_enum_info,
375 .get = stac92xx_mux_enum_get,
376 .put = stac92xx_mux_enum_put,
378 HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT),
379 HDA_CODEC_MUTE("Capture Switch", 0x1b, 0x0, HDA_OUTPUT),
383 static struct snd_kcontrol_new stac927x_mixer[] = {
385 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
386 .name = "Input Source",
388 .info = stac92xx_mux_enum_info,
389 .get = stac92xx_mux_enum_get,
390 .put = stac92xx_mux_enum_put,
392 HDA_CODEC_VOLUME("InMux Capture Volume", 0x15, 0x0, HDA_OUTPUT),
393 HDA_CODEC_VOLUME("InVol Capture Volume", 0x18, 0x0, HDA_INPUT),
394 HDA_CODEC_MUTE("ADCMux Capture Switch", 0x1b, 0x0, HDA_OUTPUT),
398 static struct snd_kcontrol_new stac9205_mixer[] = {
400 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
401 .name = "Digital Input Source",
403 .info = stac92xx_dmux_enum_info,
404 .get = stac92xx_dmux_enum_get,
405 .put = stac92xx_dmux_enum_put,
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,
415 HDA_CODEC_VOLUME("InMux Capture Volume", 0x19, 0x0, HDA_OUTPUT),
416 HDA_CODEC_VOLUME("InVol Capture Volume", 0x1b, 0x0, HDA_INPUT),
417 HDA_CODEC_MUTE("ADCMux Capture Switch", 0x1d, 0x0, HDA_OUTPUT),
421 static int stac92xx_build_controls(struct hda_codec *codec)
423 struct sigmatel_spec *spec = codec->spec;
427 err = snd_hda_add_new_ctls(codec, spec->mixer);
431 for (i = 0; i < spec->num_mixers; i++) {
432 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
437 if (spec->multiout.dig_out_nid) {
438 err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid);
442 if (spec->dig_in_nid) {
443 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
450 static unsigned int ref9200_pin_configs[8] = {
451 0x01c47010, 0x01447010, 0x0221401f, 0x01114010,
452 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
455 static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = {
456 [STAC_REF] = ref9200_pin_configs,
459 static const char *stac9200_models[STAC_9200_MODELS] = {
463 static struct snd_pci_quirk stac9200_cfg_tbl[] = {
464 /* SigmaTel reference board */
465 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
466 "DFI LanParty", STAC_REF),
467 /* Dell laptops have BIOS problem */
468 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5,
469 "Dell Inspiron 630m", STAC_REF),
470 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2,
471 "Dell Latitude D620", STAC_REF),
472 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb,
473 "Dell Latitude 120L", STAC_REF),
474 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc,
475 "Dell Latitude D820", STAC_REF),
476 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd,
477 "Dell Inspiron E1705/9400", STAC_REF),
478 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce,
479 "Dell XPS M1710", STAC_REF),
480 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf,
481 "Dell Precision M90", STAC_REF),
482 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6,
483 "unknown Dell", STAC_REF),
484 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8,
485 "Dell Inspiron 640m", STAC_REF),
486 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5,
487 "Dell Inspiron 1501", STAC_REF),
490 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_REF),
495 static unsigned int ref925x_pin_configs[8] = {
496 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
497 0x90a70320, 0x02214210, 0x400003f1, 0x9033032e,
500 static unsigned int stac925x_MA6_pin_configs[8] = {
501 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
502 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e,
505 static unsigned int stac925x_PA6_pin_configs[8] = {
506 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
507 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e,
510 static unsigned int stac925xM2_2_pin_configs[8] = {
511 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020,
512 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e,
515 static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = {
516 [STAC_REF] = ref925x_pin_configs,
517 [STAC_M2_2] = stac925xM2_2_pin_configs,
518 [STAC_MA6] = stac925x_MA6_pin_configs,
519 [STAC_PA6] = stac925x_PA6_pin_configs,
522 static const char *stac925x_models[STAC_925x_MODELS] = {
524 [STAC_M2_2] = "m2-2",
529 static struct snd_pci_quirk stac925x_cfg_tbl[] = {
530 /* SigmaTel reference board */
531 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
532 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
533 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF),
534 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF),
535 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6),
536 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6),
537 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2),
541 static unsigned int ref922x_pin_configs[10] = {
542 0x01014010, 0x01016011, 0x01012012, 0x0221401f,
543 0x01813122, 0x01011014, 0x01441030, 0x01c41030,
544 0x40000100, 0x40000100,
547 static unsigned int d945gtp3_pin_configs[10] = {
548 0x0221401f, 0x01a19022, 0x01813021, 0x01014010,
549 0x40000100, 0x40000100, 0x40000100, 0x40000100,
550 0x02a19120, 0x40000100,
553 static unsigned int d945gtp5_pin_configs[10] = {
554 0x0221401f, 0x01011012, 0x01813024, 0x01014010,
555 0x01a19021, 0x01016011, 0x01452130, 0x40000100,
556 0x02a19320, 0x40000100,
559 static unsigned int intel_mac_v1_pin_configs[10] = {
560 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd,
561 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240,
562 0x400000fc, 0x400000fb,
565 static unsigned int intel_mac_v2_pin_configs[10] = {
566 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
567 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa,
568 0x400000fc, 0x400000fb,
571 static unsigned int intel_mac_v3_pin_configs[10] = {
572 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
573 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240,
574 0x400000fc, 0x400000fb,
577 static unsigned int intel_mac_v4_pin_configs[10] = {
578 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
579 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
580 0x400000fc, 0x400000fb,
583 static unsigned int intel_mac_v5_pin_configs[10] = {
584 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
585 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
586 0x400000fc, 0x400000fb,
589 static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
590 [STAC_D945_REF] = ref922x_pin_configs,
591 [STAC_D945GTP3] = d945gtp3_pin_configs,
592 [STAC_D945GTP5] = d945gtp5_pin_configs,
593 [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs,
594 [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs,
595 [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs,
596 [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs,
597 [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs,
598 /* for backward compitability */
599 [STAC_MACMINI] = intel_mac_v3_pin_configs,
600 [STAC_MACBOOK] = intel_mac_v5_pin_configs,
601 [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs,
602 [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs,
603 [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs,
604 [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs,
607 static const char *stac922x_models[STAC_922X_MODELS] = {
608 [STAC_D945_REF] = "ref",
609 [STAC_D945GTP5] = "5stack",
610 [STAC_D945GTP3] = "3stack",
611 [STAC_INTEL_MAC_V1] = "intel-mac-v1",
612 [STAC_INTEL_MAC_V2] = "intel-mac-v2",
613 [STAC_INTEL_MAC_V3] = "intel-mac-v3",
614 [STAC_INTEL_MAC_V4] = "intel-mac-v4",
615 [STAC_INTEL_MAC_V5] = "intel-mac-v5",
616 /* for backward compitability */
617 [STAC_MACMINI] = "macmini",
618 [STAC_MACBOOK] = "macbook",
619 [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1",
620 [STAC_MACBOOK_PRO_V2] = "macbook-pro",
621 [STAC_IMAC_INTEL] = "imac-intel",
622 [STAC_IMAC_INTEL_20] = "imac-intel-20",
625 static struct snd_pci_quirk stac922x_cfg_tbl[] = {
626 /* SigmaTel reference board */
627 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
628 "DFI LanParty", STAC_D945_REF),
629 /* Intel 945G based systems */
630 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101,
631 "Intel D945G", STAC_D945GTP3),
632 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202,
633 "Intel D945G", STAC_D945GTP3),
634 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606,
635 "Intel D945G", STAC_D945GTP3),
636 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601,
637 "Intel D945G", STAC_D945GTP3),
638 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111,
639 "Intel D945G", STAC_D945GTP3),
640 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115,
641 "Intel D945G", STAC_D945GTP3),
642 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116,
643 "Intel D945G", STAC_D945GTP3),
644 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117,
645 "Intel D945G", STAC_D945GTP3),
646 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118,
647 "Intel D945G", STAC_D945GTP3),
648 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119,
649 "Intel D945G", STAC_D945GTP3),
650 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826,
651 "Intel D945G", STAC_D945GTP3),
652 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049,
653 "Intel D945G", STAC_D945GTP3),
654 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055,
655 "Intel D945G", STAC_D945GTP3),
656 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048,
657 "Intel D945G", STAC_D945GTP3),
658 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110,
659 "Intel D945G", STAC_D945GTP3),
660 /* Intel D945G 5-stack systems */
661 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404,
662 "Intel D945G", STAC_D945GTP5),
663 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303,
664 "Intel D945G", STAC_D945GTP5),
665 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013,
666 "Intel D945G", STAC_D945GTP5),
667 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417,
668 "Intel D945G", STAC_D945GTP5),
669 /* Intel 945P based systems */
670 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b,
671 "Intel D945P", STAC_D945GTP3),
672 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112,
673 "Intel D945P", STAC_D945GTP3),
674 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d,
675 "Intel D945P", STAC_D945GTP3),
676 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909,
677 "Intel D945P", STAC_D945GTP3),
678 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505,
679 "Intel D945P", STAC_D945GTP3),
680 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707,
681 "Intel D945P", STAC_D945GTP5),
683 /* Apple Mac Mini (early 2006) */
684 SND_PCI_QUIRK(0x8384, 0x7680,
685 "Mac Mini", STAC_INTEL_MAC_V3),
689 static unsigned int ref927x_pin_configs[14] = {
690 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
691 0x01a19040, 0x01011012, 0x01016011, 0x0101201f,
692 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070,
693 0x01c42190, 0x40000100,
696 static unsigned int d965_3st_pin_configs[14] = {
697 0x0221401f, 0x02a19120, 0x40000100, 0x01014011,
698 0x01a19021, 0x01813024, 0x40000100, 0x40000100,
699 0x40000100, 0x40000100, 0x40000100, 0x40000100,
700 0x40000100, 0x40000100
703 static unsigned int d965_5st_pin_configs[14] = {
704 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
705 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
706 0x40000100, 0x40000100, 0x40000100, 0x01442070,
707 0x40000100, 0x40000100
710 static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
711 [STAC_D965_REF] = ref927x_pin_configs,
712 [STAC_D965_3ST] = d965_3st_pin_configs,
713 [STAC_D965_5ST] = d965_5st_pin_configs,
716 static const char *stac927x_models[STAC_927X_MODELS] = {
717 [STAC_D965_REF] = "ref",
718 [STAC_D965_3ST] = "3stack",
719 [STAC_D965_5ST] = "5stack",
722 static struct snd_pci_quirk stac927x_cfg_tbl[] = {
723 /* SigmaTel reference board */
724 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
725 "DFI LanParty", STAC_D965_REF),
726 /* Intel 946 based systems */
727 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST),
728 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST),
729 /* 965 based 3 stack systems */
730 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2116, "Intel D965", STAC_D965_3ST),
731 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2115, "Intel D965", STAC_D965_3ST),
732 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2114, "Intel D965", STAC_D965_3ST),
733 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2113, "Intel D965", STAC_D965_3ST),
734 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2112, "Intel D965", STAC_D965_3ST),
735 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2111, "Intel D965", STAC_D965_3ST),
736 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2110, "Intel D965", STAC_D965_3ST),
737 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2009, "Intel D965", STAC_D965_3ST),
738 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2008, "Intel D965", STAC_D965_3ST),
739 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2007, "Intel D965", STAC_D965_3ST),
740 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2006, "Intel D965", STAC_D965_3ST),
741 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2005, "Intel D965", STAC_D965_3ST),
742 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2004, "Intel D965", STAC_D965_3ST),
743 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2003, "Intel D965", STAC_D965_3ST),
744 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2002, "Intel D965", STAC_D965_3ST),
745 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2001, "Intel D965", STAC_D965_3ST),
746 /* 965 based 5 stack systems */
747 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2301, "Intel D965", STAC_D965_5ST),
748 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2302, "Intel D965", STAC_D965_5ST),
749 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2303, "Intel D965", STAC_D965_5ST),
750 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2304, "Intel D965", STAC_D965_5ST),
751 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2305, "Intel D965", STAC_D965_5ST),
752 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2501, "Intel D965", STAC_D965_5ST),
753 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2502, "Intel D965", STAC_D965_5ST),
754 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2503, "Intel D965", STAC_D965_5ST),
755 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2504, "Intel D965", STAC_D965_5ST),
759 static unsigned int ref9205_pin_configs[12] = {
760 0x40000100, 0x40000100, 0x01016011, 0x01014010,
761 0x01813122, 0x01a19021, 0x40000100, 0x40000100,
762 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030
765 static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = {
769 static const char *stac9205_models[STAC_9205_MODELS] = {
770 [STAC_9205_REF] = "ref",
773 static struct snd_pci_quirk stac9205_cfg_tbl[] = {
774 /* SigmaTel reference board */
775 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
776 "DFI LanParty", STAC_9205_REF),
780 static int stac92xx_save_bios_config_regs(struct hda_codec *codec)
783 struct sigmatel_spec *spec = codec->spec;
785 if (! spec->bios_pin_configs) {
786 spec->bios_pin_configs = kcalloc(spec->num_pins,
787 sizeof(*spec->bios_pin_configs), GFP_KERNEL);
788 if (! spec->bios_pin_configs)
792 for (i = 0; i < spec->num_pins; i++) {
793 hda_nid_t nid = spec->pin_nids[i];
794 unsigned int pin_cfg;
796 pin_cfg = snd_hda_codec_read(codec, nid, 0,
797 AC_VERB_GET_CONFIG_DEFAULT, 0x00);
798 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x bios pin config %8.8x\n",
800 spec->bios_pin_configs[i] = pin_cfg;
806 static void stac92xx_set_config_regs(struct hda_codec *codec)
809 struct sigmatel_spec *spec = codec->spec;
810 unsigned int pin_cfg;
812 if (! spec->pin_nids || ! spec->pin_configs)
815 for (i = 0; i < spec->num_pins; i++) {
816 snd_hda_codec_write(codec, spec->pin_nids[i], 0,
817 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
818 spec->pin_configs[i] & 0x000000ff);
819 snd_hda_codec_write(codec, spec->pin_nids[i], 0,
820 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
821 (spec->pin_configs[i] & 0x0000ff00) >> 8);
822 snd_hda_codec_write(codec, spec->pin_nids[i], 0,
823 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
824 (spec->pin_configs[i] & 0x00ff0000) >> 16);
825 snd_hda_codec_write(codec, spec->pin_nids[i], 0,
826 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
827 spec->pin_configs[i] >> 24);
828 pin_cfg = snd_hda_codec_read(codec, spec->pin_nids[i], 0,
829 AC_VERB_GET_CONFIG_DEFAULT,
831 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n", spec->pin_nids[i], pin_cfg);
836 * Analog playback callbacks
838 static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo,
839 struct hda_codec *codec,
840 struct snd_pcm_substream *substream)
842 struct sigmatel_spec *spec = codec->spec;
843 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream);
846 static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
847 struct hda_codec *codec,
848 unsigned int stream_tag,
850 struct snd_pcm_substream *substream)
852 struct sigmatel_spec *spec = codec->spec;
853 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, stream_tag, format, substream);
856 static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
857 struct hda_codec *codec,
858 struct snd_pcm_substream *substream)
860 struct sigmatel_spec *spec = codec->spec;
861 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
865 * Digital playback callbacks
867 static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
868 struct hda_codec *codec,
869 struct snd_pcm_substream *substream)
871 struct sigmatel_spec *spec = codec->spec;
872 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
875 static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
876 struct hda_codec *codec,
877 struct snd_pcm_substream *substream)
879 struct sigmatel_spec *spec = codec->spec;
880 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
883 static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
884 struct hda_codec *codec,
885 unsigned int stream_tag,
887 struct snd_pcm_substream *substream)
889 struct sigmatel_spec *spec = codec->spec;
890 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
891 stream_tag, format, substream);
896 * Analog capture callbacks
898 static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
899 struct hda_codec *codec,
900 unsigned int stream_tag,
902 struct snd_pcm_substream *substream)
904 struct sigmatel_spec *spec = codec->spec;
906 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],
907 stream_tag, 0, format);
911 static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
912 struct hda_codec *codec,
913 struct snd_pcm_substream *substream)
915 struct sigmatel_spec *spec = codec->spec;
917 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], 0, 0, 0);
921 static struct hda_pcm_stream stac92xx_pcm_digital_playback = {
925 /* NID is set in stac92xx_build_pcms */
927 .open = stac92xx_dig_playback_pcm_open,
928 .close = stac92xx_dig_playback_pcm_close,
929 .prepare = stac92xx_dig_playback_pcm_prepare
933 static struct hda_pcm_stream stac92xx_pcm_digital_capture = {
937 /* NID is set in stac92xx_build_pcms */
940 static struct hda_pcm_stream stac92xx_pcm_analog_playback = {
944 .nid = 0x02, /* NID to query formats and rates */
946 .open = stac92xx_playback_pcm_open,
947 .prepare = stac92xx_playback_pcm_prepare,
948 .cleanup = stac92xx_playback_pcm_cleanup
952 static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = {
956 .nid = 0x06, /* NID to query formats and rates */
958 .open = stac92xx_playback_pcm_open,
959 .prepare = stac92xx_playback_pcm_prepare,
960 .cleanup = stac92xx_playback_pcm_cleanup
964 static struct hda_pcm_stream stac92xx_pcm_analog_capture = {
968 /* NID is set in stac92xx_build_pcms */
970 .prepare = stac92xx_capture_pcm_prepare,
971 .cleanup = stac92xx_capture_pcm_cleanup
975 static int stac92xx_build_pcms(struct hda_codec *codec)
977 struct sigmatel_spec *spec = codec->spec;
978 struct hda_pcm *info = spec->pcm_rec;
981 codec->pcm_info = info;
983 info->name = "STAC92xx Analog";
984 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback;
985 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture;
986 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
988 if (spec->alt_switch) {
991 info->name = "STAC92xx Analog Alt";
992 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback;
995 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
998 info->name = "STAC92xx Digital";
999 if (spec->multiout.dig_out_nid) {
1000 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback;
1001 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
1003 if (spec->dig_in_nid) {
1004 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_digital_capture;
1005 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
1012 static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid)
1014 unsigned int pincap = snd_hda_param_read(codec, nid,
1016 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
1017 if (pincap & AC_PINCAP_VREF_100)
1018 return AC_PINCTL_VREF_100;
1019 if (pincap & AC_PINCAP_VREF_80)
1020 return AC_PINCTL_VREF_80;
1021 if (pincap & AC_PINCAP_VREF_50)
1022 return AC_PINCTL_VREF_50;
1023 if (pincap & AC_PINCAP_VREF_GRD)
1024 return AC_PINCTL_VREF_GRD;
1028 static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type)
1031 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
1034 static int stac92xx_io_switch_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
1036 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
1038 uinfo->value.integer.min = 0;
1039 uinfo->value.integer.max = 1;
1043 static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1045 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1046 struct sigmatel_spec *spec = codec->spec;
1047 int io_idx = kcontrol-> private_value & 0xff;
1049 ucontrol->value.integer.value[0] = spec->io_switch[io_idx];
1053 static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1055 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1056 struct sigmatel_spec *spec = codec->spec;
1057 hda_nid_t nid = kcontrol->private_value >> 8;
1058 int io_idx = kcontrol-> private_value & 0xff;
1059 unsigned short val = ucontrol->value.integer.value[0];
1061 spec->io_switch[io_idx] = val;
1064 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
1066 unsigned int pinctl = AC_PINCTL_IN_EN;
1067 if (io_idx) /* set VREF for mic */
1068 pinctl |= stac92xx_get_vref(codec, nid);
1069 stac92xx_auto_set_pinctl(codec, nid, pinctl);
1074 #define STAC_CODEC_IO_SWITCH(xname, xpval) \
1075 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1078 .info = stac92xx_io_switch_info, \
1079 .get = stac92xx_io_switch_get, \
1080 .put = stac92xx_io_switch_put, \
1081 .private_value = xpval, \
1086 STAC_CTL_WIDGET_VOL,
1087 STAC_CTL_WIDGET_MUTE,
1088 STAC_CTL_WIDGET_IO_SWITCH,
1091 static struct snd_kcontrol_new stac92xx_control_templates[] = {
1092 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
1093 HDA_CODEC_MUTE(NULL, 0, 0, 0),
1094 STAC_CODEC_IO_SWITCH(NULL, 0),
1097 /* add dynamic controls */
1098 static int stac92xx_add_control(struct sigmatel_spec *spec, int type, const char *name, unsigned long val)
1100 struct snd_kcontrol_new *knew;
1102 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
1103 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
1105 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); /* array + terminator */
1108 if (spec->kctl_alloc) {
1109 memcpy(knew, spec->kctl_alloc, sizeof(*knew) * spec->num_kctl_alloc);
1110 kfree(spec->kctl_alloc);
1112 spec->kctl_alloc = knew;
1113 spec->num_kctl_alloc = num;
1116 knew = &spec->kctl_alloc[spec->num_kctl_used];
1117 *knew = stac92xx_control_templates[type];
1118 knew->name = kstrdup(name, GFP_KERNEL);
1121 knew->private_value = val;
1122 spec->num_kctl_used++;
1126 /* flag inputs as additional dynamic lineouts */
1127 static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cfg *cfg)
1129 struct sigmatel_spec *spec = codec->spec;
1130 unsigned int wcaps, wtype;
1131 int i, num_dacs = 0;
1133 /* use the wcaps cache to count all DACs available for line-outs */
1134 for (i = 0; i < codec->num_nodes; i++) {
1135 wcaps = codec->wcaps[i];
1136 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
1137 if (wtype == AC_WID_AUD_OUT && !(wcaps & AC_WCAP_DIGITAL))
1141 snd_printdd("%s: total dac count=%d\n", __func__, num_dacs);
1143 switch (cfg->line_outs) {
1145 /* add line-in as side */
1146 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 3) {
1147 cfg->line_out_pins[3] = cfg->input_pins[AUTO_PIN_LINE];
1148 spec->line_switch = 1;
1153 /* add line-in as clfe and mic as side */
1154 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 2) {
1155 cfg->line_out_pins[2] = cfg->input_pins[AUTO_PIN_LINE];
1156 spec->line_switch = 1;
1159 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 3) {
1160 cfg->line_out_pins[3] = cfg->input_pins[AUTO_PIN_MIC];
1161 spec->mic_switch = 1;
1166 /* add line-in as surr and mic as clfe */
1167 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 1) {
1168 cfg->line_out_pins[1] = cfg->input_pins[AUTO_PIN_LINE];
1169 spec->line_switch = 1;
1172 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 2) {
1173 cfg->line_out_pins[2] = cfg->input_pins[AUTO_PIN_MIC];
1174 spec->mic_switch = 1;
1184 static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
1188 for (i = 0; i < spec->multiout.num_dacs; i++) {
1189 if (spec->multiout.dac_nids[i] == nid)
1197 * Fill in the dac_nids table from the parsed pin configuration
1198 * This function only works when every pin in line_out_pins[]
1199 * contains atleast one DAC in its connection list. Some 92xx
1200 * codecs are not connected directly to a DAC, such as the 9200
1201 * and 9202/925x. For those, dac_nids[] must be hard-coded.
1203 static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec,
1204 const struct auto_pin_cfg *cfg)
1206 struct sigmatel_spec *spec = codec->spec;
1207 int i, j, conn_len = 0;
1208 hda_nid_t nid, conn[HDA_MAX_CONNECTIONS];
1209 unsigned int wcaps, wtype;
1211 for (i = 0; i < cfg->line_outs; i++) {
1212 nid = cfg->line_out_pins[i];
1213 conn_len = snd_hda_get_connections(codec, nid, conn,
1214 HDA_MAX_CONNECTIONS);
1215 for (j = 0; j < conn_len; j++) {
1216 wcaps = snd_hda_param_read(codec, conn[j],
1217 AC_PAR_AUDIO_WIDGET_CAP);
1218 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
1220 if (wtype != AC_WID_AUD_OUT ||
1221 (wcaps & AC_WCAP_DIGITAL))
1223 /* conn[j] is a DAC routed to this line-out */
1224 if (!is_in_dac_nids(spec, conn[j]))
1228 if (j == conn_len) {
1229 /* error out, no available DAC found */
1231 "%s: No available DAC for pin 0x%x\n",
1236 spec->multiout.dac_nids[i] = conn[j];
1237 spec->multiout.num_dacs++;
1239 /* select this DAC in the pin's input mux */
1240 snd_hda_codec_write(codec, nid, 0,
1241 AC_VERB_SET_CONNECT_SEL, j);
1246 snd_printd("dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
1247 spec->multiout.num_dacs,
1248 spec->multiout.dac_nids[0],
1249 spec->multiout.dac_nids[1],
1250 spec->multiout.dac_nids[2],
1251 spec->multiout.dac_nids[3],
1252 spec->multiout.dac_nids[4]);
1256 /* create volume control/switch for the given prefx type */
1257 static int create_controls(struct sigmatel_spec *spec, const char *pfx, hda_nid_t nid, int chs)
1262 sprintf(name, "%s Playback Volume", pfx);
1263 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name,
1264 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
1267 sprintf(name, "%s Playback Switch", pfx);
1268 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, name,
1269 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
1275 /* add playback controls from the parsed DAC table */
1276 static int stac92xx_auto_create_multi_out_ctls(struct sigmatel_spec *spec,
1277 const struct auto_pin_cfg *cfg)
1279 static const char *chname[4] = {
1280 "Front", "Surround", NULL /*CLFE*/, "Side"
1285 for (i = 0; i < cfg->line_outs; i++) {
1286 if (!spec->multiout.dac_nids[i])
1289 nid = spec->multiout.dac_nids[i];
1293 err = create_controls(spec, "Center", nid, 1);
1296 err = create_controls(spec, "LFE", nid, 2);
1300 err = create_controls(spec, chname[i], nid, 3);
1306 if (spec->line_switch)
1307 if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_IO_SWITCH, "Line In as Output Switch", cfg->input_pins[AUTO_PIN_LINE] << 8)) < 0)
1310 if (spec->mic_switch)
1311 if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_IO_SWITCH, "Mic as Output Switch", (cfg->input_pins[AUTO_PIN_MIC] << 8) | 1)) < 0)
1317 static int check_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
1319 if (is_in_dac_nids(spec, nid))
1321 if (spec->multiout.hp_nid == nid)
1326 static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid)
1328 if (!spec->multiout.hp_nid)
1329 spec->multiout.hp_nid = nid;
1330 else if (spec->multiout.num_dacs > 4) {
1331 printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid);
1334 spec->multiout.dac_nids[spec->multiout.num_dacs] = nid;
1335 spec->multiout.num_dacs++;
1340 /* add playback controls for Speaker and HP outputs */
1341 static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec,
1342 struct auto_pin_cfg *cfg)
1344 struct sigmatel_spec *spec = codec->spec;
1346 int i, old_num_dacs, err;
1348 old_num_dacs = spec->multiout.num_dacs;
1349 for (i = 0; i < cfg->hp_outs; i++) {
1350 unsigned int wid_caps = get_wcaps(codec, cfg->hp_pins[i]);
1351 if (wid_caps & AC_WCAP_UNSOL_CAP)
1352 spec->hp_detect = 1;
1353 nid = snd_hda_codec_read(codec, cfg->hp_pins[i], 0,
1354 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
1355 if (check_in_dac_nids(spec, nid))
1359 add_spec_dacs(spec, nid);
1361 for (i = 0; i < cfg->speaker_outs; i++) {
1362 nid = snd_hda_codec_read(codec, cfg->speaker_pins[i], 0,
1363 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
1364 if (check_in_dac_nids(spec, nid))
1368 add_spec_dacs(spec, nid);
1371 for (i = old_num_dacs; i < spec->multiout.num_dacs; i++) {
1372 static const char *pfxs[] = {
1373 "Speaker", "External Speaker", "Speaker2",
1375 err = create_controls(spec, pfxs[i - old_num_dacs],
1376 spec->multiout.dac_nids[i], 3);
1380 if (spec->multiout.hp_nid) {
1382 if (old_num_dacs == spec->multiout.num_dacs)
1386 err = create_controls(spec, pfx, spec->multiout.hp_nid, 3);
1394 /* labels for dmic mux inputs */
1395 static const char *stac92xx_dmic_labels[5] = {
1396 "Analog Inputs", "Digital Mic 1", "Digital Mic 2",
1397 "Digital Mic 3", "Digital Mic 4"
1400 /* create playback/capture controls for input pins on dmic capable codecs */
1401 static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec,
1402 const struct auto_pin_cfg *cfg)
1404 struct sigmatel_spec *spec = codec->spec;
1405 struct hda_input_mux *dimux = &spec->private_dimux;
1406 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
1409 dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0];
1410 dimux->items[dimux->num_items].index = 0;
1413 for (i = 0; i < spec->num_dmics; i++) {
1416 unsigned int def_conf;
1418 def_conf = snd_hda_codec_read(codec,
1421 AC_VERB_GET_CONFIG_DEFAULT,
1423 if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE)
1426 num_cons = snd_hda_get_connections(codec,
1429 HDA_MAX_NUM_INPUTS);
1430 for (j = 0; j < num_cons; j++)
1431 if (con_lst[j] == spec->dmic_nids[i]) {
1437 dimux->items[dimux->num_items].label =
1438 stac92xx_dmic_labels[dimux->num_items];
1439 dimux->items[dimux->num_items].index = index;
1446 /* create playback/capture controls for input pins */
1447 static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg)
1449 struct sigmatel_spec *spec = codec->spec;
1450 struct hda_input_mux *imux = &spec->private_imux;
1451 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
1454 for (i = 0; i < AUTO_PIN_LAST; i++) {
1457 if (!cfg->input_pins[i])
1460 for (j = 0; j < spec->num_muxes; j++) {
1462 num_cons = snd_hda_get_connections(codec,
1465 HDA_MAX_NUM_INPUTS);
1466 for (k = 0; k < num_cons; k++)
1467 if (con_lst[k] == cfg->input_pins[i]) {
1474 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
1475 imux->items[imux->num_items].index = index;
1479 if (imux->num_items) {
1481 * Set the current input for the muxes.
1482 * The STAC9221 has two input muxes with identical source
1483 * NID lists. Hopefully this won't get confused.
1485 for (i = 0; i < spec->num_muxes; i++) {
1486 snd_hda_codec_write(codec, spec->mux_nids[i], 0,
1487 AC_VERB_SET_CONNECT_SEL,
1488 imux->items[0].index);
1495 static void stac92xx_auto_init_multi_out(struct hda_codec *codec)
1497 struct sigmatel_spec *spec = codec->spec;
1500 for (i = 0; i < spec->autocfg.line_outs; i++) {
1501 hda_nid_t nid = spec->autocfg.line_out_pins[i];
1502 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
1506 static void stac92xx_auto_init_hp_out(struct hda_codec *codec)
1508 struct sigmatel_spec *spec = codec->spec;
1511 for (i = 0; i < spec->autocfg.hp_outs; i++) {
1513 pin = spec->autocfg.hp_pins[i];
1514 if (pin) /* connect to front */
1515 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
1517 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
1519 pin = spec->autocfg.speaker_pins[i];
1520 if (pin) /* connect to front */
1521 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN);
1525 static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out, hda_nid_t dig_in)
1527 struct sigmatel_spec *spec = codec->spec;
1530 if ((err = snd_hda_parse_pin_def_config(codec,
1532 spec->dmic_nids)) < 0)
1534 if (! spec->autocfg.line_outs)
1535 return 0; /* can't find valid pin config */
1537 if ((err = stac92xx_add_dyn_out_pins(codec, &spec->autocfg)) < 0)
1539 if (spec->multiout.num_dacs == 0)
1540 if ((err = stac92xx_auto_fill_dac_nids(codec, &spec->autocfg)) < 0)
1543 if ((err = stac92xx_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 ||
1544 (err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg)) < 0 ||
1545 (err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0)
1548 if (spec->num_dmics > 0)
1549 if ((err = stac92xx_auto_create_dmic_input_ctls(codec,
1550 &spec->autocfg)) < 0)
1553 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
1554 if (spec->multiout.max_channels > 2)
1555 spec->surr_switch = 1;
1557 if (spec->autocfg.dig_out_pin)
1558 spec->multiout.dig_out_nid = dig_out;
1559 if (spec->autocfg.dig_in_pin)
1560 spec->dig_in_nid = dig_in;
1562 if (spec->kctl_alloc)
1563 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
1565 spec->input_mux = &spec->private_imux;
1566 spec->dinput_mux = &spec->private_dimux;
1571 /* add playback controls for HP output */
1572 static int stac9200_auto_create_hp_ctls(struct hda_codec *codec,
1573 struct auto_pin_cfg *cfg)
1575 struct sigmatel_spec *spec = codec->spec;
1576 hda_nid_t pin = cfg->hp_pins[0];
1577 unsigned int wid_caps;
1582 wid_caps = get_wcaps(codec, pin);
1583 if (wid_caps & AC_WCAP_UNSOL_CAP)
1584 spec->hp_detect = 1;
1589 /* add playback controls for LFE output */
1590 static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec,
1591 struct auto_pin_cfg *cfg)
1593 struct sigmatel_spec *spec = codec->spec;
1595 hda_nid_t lfe_pin = 0x0;
1599 * search speaker outs and line outs for a mono speaker pin
1600 * with an amp. If one is found, add LFE controls
1603 for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) {
1604 hda_nid_t pin = spec->autocfg.speaker_pins[i];
1605 unsigned long wcaps = get_wcaps(codec, pin);
1606 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
1607 if (wcaps == AC_WCAP_OUT_AMP)
1608 /* found a mono speaker with an amp, must be lfe */
1612 /* if speaker_outs is 0, then speakers may be in line_outs */
1613 if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) {
1614 for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) {
1615 hda_nid_t pin = spec->autocfg.line_out_pins[i];
1617 cfg = snd_hda_codec_read(codec, pin, 0,
1618 AC_VERB_GET_CONFIG_DEFAULT,
1620 if (get_defcfg_device(cfg) == AC_JACK_SPEAKER) {
1621 unsigned long wcaps = get_wcaps(codec, pin);
1622 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
1623 if (wcaps == AC_WCAP_OUT_AMP)
1624 /* found a mono speaker with an amp,
1632 err = create_controls(spec, "LFE", lfe_pin, 1);
1640 static int stac9200_parse_auto_config(struct hda_codec *codec)
1642 struct sigmatel_spec *spec = codec->spec;
1645 if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0)
1648 if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0)
1651 if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0)
1654 if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0)
1657 if (spec->autocfg.dig_out_pin)
1658 spec->multiout.dig_out_nid = 0x05;
1659 if (spec->autocfg.dig_in_pin)
1660 spec->dig_in_nid = 0x04;
1662 if (spec->kctl_alloc)
1663 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
1665 spec->input_mux = &spec->private_imux;
1666 spec->dinput_mux = &spec->private_dimux;
1672 * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
1673 * funky external mute control using GPIO pins.
1676 static void stac922x_gpio_mute(struct hda_codec *codec, int pin, int muted)
1678 unsigned int gpiostate, gpiomask, gpiodir;
1680 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
1681 AC_VERB_GET_GPIO_DATA, 0);
1684 gpiostate |= (1 << pin);
1686 gpiostate &= ~(1 << pin);
1688 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
1689 AC_VERB_GET_GPIO_MASK, 0);
1690 gpiomask |= (1 << pin);
1692 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
1693 AC_VERB_GET_GPIO_DIRECTION, 0);
1694 gpiodir |= (1 << pin);
1696 /* AppleHDA seems to do this -- WTF is this verb?? */
1697 snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0);
1699 snd_hda_codec_write(codec, codec->afg, 0,
1700 AC_VERB_SET_GPIO_MASK, gpiomask);
1701 snd_hda_codec_write(codec, codec->afg, 0,
1702 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
1706 snd_hda_codec_write(codec, codec->afg, 0,
1707 AC_VERB_SET_GPIO_DATA, gpiostate);
1710 static void enable_pin_detect(struct hda_codec *codec, hda_nid_t nid,
1713 if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)
1714 snd_hda_codec_write(codec, nid, 0,
1715 AC_VERB_SET_UNSOLICITED_ENABLE,
1716 (AC_USRSP_EN | event));
1719 static int stac92xx_init(struct hda_codec *codec)
1721 struct sigmatel_spec *spec = codec->spec;
1722 struct auto_pin_cfg *cfg = &spec->autocfg;
1725 snd_hda_sequence_write(codec, spec->init);
1728 if (spec->hp_detect) {
1729 /* Enable unsolicited responses on the HP widget */
1730 for (i = 0; i < cfg->hp_outs; i++)
1731 enable_pin_detect(codec, cfg->hp_pins[i],
1733 /* force to enable the first line-out; the others are set up
1736 stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0],
1738 stac92xx_auto_init_hp_out(codec);
1739 /* fake event to set up pins */
1740 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
1742 stac92xx_auto_init_multi_out(codec);
1743 stac92xx_auto_init_hp_out(codec);
1745 for (i = 0; i < AUTO_PIN_LAST; i++) {
1746 hda_nid_t nid = cfg->input_pins[i];
1748 unsigned int pinctl = AC_PINCTL_IN_EN;
1749 if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC)
1750 pinctl |= stac92xx_get_vref(codec, nid);
1751 stac92xx_auto_set_pinctl(codec, nid, pinctl);
1754 if (spec->num_dmics > 0)
1755 for (i = 0; i < spec->num_dmics; i++)
1756 stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i],
1759 if (cfg->dig_out_pin)
1760 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin,
1762 if (cfg->dig_in_pin)
1763 stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin,
1766 if (spec->gpio_mute) {
1767 stac922x_gpio_mute(codec, 0, 0);
1768 stac922x_gpio_mute(codec, 1, 0);
1774 static void stac92xx_free(struct hda_codec *codec)
1776 struct sigmatel_spec *spec = codec->spec;
1782 if (spec->kctl_alloc) {
1783 for (i = 0; i < spec->num_kctl_used; i++)
1784 kfree(spec->kctl_alloc[i].name);
1785 kfree(spec->kctl_alloc);
1788 if (spec->bios_pin_configs)
1789 kfree(spec->bios_pin_configs);
1794 static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid,
1797 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
1798 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
1800 if (pin_ctl & AC_PINCTL_IN_EN) {
1802 * we need to check the current set-up direction of
1803 * shared input pins since they can be switched via
1804 * "xxx as Output" mixer switch
1806 struct sigmatel_spec *spec = codec->spec;
1807 struct auto_pin_cfg *cfg = &spec->autocfg;
1808 if ((nid == cfg->input_pins[AUTO_PIN_LINE] &&
1809 spec->line_switch) ||
1810 (nid == cfg->input_pins[AUTO_PIN_MIC] &&
1815 /* if setting pin direction bits, clear the current
1816 direction bits first */
1817 if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN))
1818 pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN);
1820 snd_hda_codec_write(codec, nid, 0,
1821 AC_VERB_SET_PIN_WIDGET_CONTROL,
1825 static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
1828 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
1829 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
1830 snd_hda_codec_write(codec, nid, 0,
1831 AC_VERB_SET_PIN_WIDGET_CONTROL,
1835 static int get_pin_presence(struct hda_codec *codec, hda_nid_t nid)
1839 if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0x00)
1845 static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res)
1847 struct sigmatel_spec *spec = codec->spec;
1848 struct auto_pin_cfg *cfg = &spec->autocfg;
1852 for (i = 0; i < cfg->hp_outs; i++) {
1853 presence = get_pin_presence(codec, cfg->hp_pins[i]);
1859 /* disable lineouts, enable hp */
1860 for (i = 0; i < cfg->line_outs; i++)
1861 stac92xx_reset_pinctl(codec, cfg->line_out_pins[i],
1863 for (i = 0; i < cfg->speaker_outs; i++)
1864 stac92xx_reset_pinctl(codec, cfg->speaker_pins[i],
1867 /* enable lineouts, disable hp */
1868 for (i = 0; i < cfg->line_outs; i++)
1869 stac92xx_set_pinctl(codec, cfg->line_out_pins[i],
1871 for (i = 0; i < cfg->speaker_outs; i++)
1872 stac92xx_set_pinctl(codec, cfg->speaker_pins[i],
1877 static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
1879 switch (res >> 26) {
1881 stac92xx_hp_detect(codec, res);
1887 static int stac92xx_resume(struct hda_codec *codec)
1889 struct sigmatel_spec *spec = codec->spec;
1892 stac92xx_init(codec);
1893 stac92xx_set_config_regs(codec);
1894 snd_hda_resume_ctls(codec, spec->mixer);
1895 for (i = 0; i < spec->num_mixers; i++)
1896 snd_hda_resume_ctls(codec, spec->mixers[i]);
1897 if (spec->multiout.dig_out_nid)
1898 snd_hda_resume_spdif_out(codec);
1899 if (spec->dig_in_nid)
1900 snd_hda_resume_spdif_in(codec);
1906 static struct hda_codec_ops stac92xx_patch_ops = {
1907 .build_controls = stac92xx_build_controls,
1908 .build_pcms = stac92xx_build_pcms,
1909 .init = stac92xx_init,
1910 .free = stac92xx_free,
1911 .unsol_event = stac92xx_unsol_event,
1913 .resume = stac92xx_resume,
1917 static int patch_stac9200(struct hda_codec *codec)
1919 struct sigmatel_spec *spec;
1922 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1928 spec->pin_nids = stac9200_pin_nids;
1929 spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
1932 if (spec->board_config < 0) {
1933 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n");
1934 err = stac92xx_save_bios_config_regs(codec);
1936 stac92xx_free(codec);
1939 spec->pin_configs = spec->bios_pin_configs;
1941 spec->pin_configs = stac9200_brd_tbl[spec->board_config];
1942 stac92xx_set_config_regs(codec);
1945 spec->multiout.max_channels = 2;
1946 spec->multiout.num_dacs = 1;
1947 spec->multiout.dac_nids = stac9200_dac_nids;
1948 spec->adc_nids = stac9200_adc_nids;
1949 spec->mux_nids = stac9200_mux_nids;
1950 spec->num_muxes = 1;
1951 spec->num_dmics = 0;
1953 spec->init = stac9200_core_init;
1954 spec->mixer = stac9200_mixer;
1956 err = stac9200_parse_auto_config(codec);
1958 stac92xx_free(codec);
1962 codec->patch_ops = stac92xx_patch_ops;
1967 static int patch_stac925x(struct hda_codec *codec)
1969 struct sigmatel_spec *spec;
1972 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1978 spec->pin_nids = stac925x_pin_nids;
1979 spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS,
1983 if (spec->board_config < 0) {
1984 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x,"
1985 "using BIOS defaults\n");
1986 err = stac92xx_save_bios_config_regs(codec);
1988 stac92xx_free(codec);
1991 spec->pin_configs = spec->bios_pin_configs;
1992 } else if (stac925x_brd_tbl[spec->board_config] != NULL){
1993 spec->pin_configs = stac925x_brd_tbl[spec->board_config];
1994 stac92xx_set_config_regs(codec);
1997 spec->multiout.max_channels = 2;
1998 spec->multiout.num_dacs = 1;
1999 spec->multiout.dac_nids = stac925x_dac_nids;
2000 spec->adc_nids = stac925x_adc_nids;
2001 spec->mux_nids = stac925x_mux_nids;
2002 spec->num_muxes = 1;
2003 switch (codec->vendor_id) {
2004 case 0x83847632: /* STAC9202 */
2005 case 0x83847633: /* STAC9202D */
2006 case 0x83847636: /* STAC9251 */
2007 case 0x83847637: /* STAC9251D */
2008 spec->num_dmics = 1;
2009 spec->dmic_nids = stac925x_dmic_nids;
2012 spec->num_dmics = 0;
2016 spec->init = stac925x_core_init;
2017 spec->mixer = stac925x_mixer;
2019 err = stac92xx_parse_auto_config(codec, 0x8, 0x7);
2021 if (spec->board_config < 0) {
2022 printk(KERN_WARNING "hda_codec: No auto-config is "
2023 "available, default to model=ref\n");
2024 spec->board_config = STAC_925x_REF;
2030 stac92xx_free(codec);
2034 codec->patch_ops = stac92xx_patch_ops;
2039 static int patch_stac922x(struct hda_codec *codec)
2041 struct sigmatel_spec *spec;
2044 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
2049 spec->num_pins = 10;
2050 spec->pin_nids = stac922x_pin_nids;
2051 spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
2054 if (spec->board_config == STAC_INTEL_MAC_V3) {
2055 spec->gpio_mute = 1;
2056 /* Intel Macs have all same PCI SSID, so we need to check
2057 * codec SSID to distinguish the exact models
2059 printk(KERN_INFO "hda_codec: STAC922x, Apple subsys_id=%x\n", codec->subsystem_id);
2060 switch (codec->subsystem_id) {
2063 spec->board_config = STAC_INTEL_MAC_V1;
2067 spec->board_config = STAC_INTEL_MAC_V2;
2075 spec->board_config = STAC_INTEL_MAC_V3;
2079 spec->board_config = STAC_INTEL_MAC_V4;
2083 spec->board_config = STAC_INTEL_MAC_V5;
2089 if (spec->board_config < 0) {
2090 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, "
2091 "using BIOS defaults\n");
2092 err = stac92xx_save_bios_config_regs(codec);
2094 stac92xx_free(codec);
2097 spec->pin_configs = spec->bios_pin_configs;
2098 } else if (stac922x_brd_tbl[spec->board_config] != NULL) {
2099 spec->pin_configs = stac922x_brd_tbl[spec->board_config];
2100 stac92xx_set_config_regs(codec);
2103 spec->adc_nids = stac922x_adc_nids;
2104 spec->mux_nids = stac922x_mux_nids;
2105 spec->num_muxes = ARRAY_SIZE(stac922x_mux_nids);
2106 spec->num_dmics = 0;
2108 spec->init = stac922x_core_init;
2109 spec->mixer = stac922x_mixer;
2111 spec->multiout.dac_nids = spec->dac_nids;
2113 err = stac92xx_parse_auto_config(codec, 0x08, 0x09);
2115 if (spec->board_config < 0) {
2116 printk(KERN_WARNING "hda_codec: No auto-config is "
2117 "available, default to model=ref\n");
2118 spec->board_config = STAC_D945_REF;
2124 stac92xx_free(codec);
2128 codec->patch_ops = stac92xx_patch_ops;
2130 /* Fix Mux capture level; max to 2 */
2131 snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
2132 (0 << AC_AMPCAP_OFFSET_SHIFT) |
2133 (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
2134 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2135 (0 << AC_AMPCAP_MUTE_SHIFT));
2140 static int patch_stac927x(struct hda_codec *codec)
2142 struct sigmatel_spec *spec;
2145 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
2150 spec->num_pins = 14;
2151 spec->pin_nids = stac927x_pin_nids;
2152 spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS,
2156 if (spec->board_config < 0) {
2157 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC927x, using BIOS defaults\n");
2158 err = stac92xx_save_bios_config_regs(codec);
2160 stac92xx_free(codec);
2163 spec->pin_configs = spec->bios_pin_configs;
2164 } else if (stac927x_brd_tbl[spec->board_config] != NULL) {
2165 spec->pin_configs = stac927x_brd_tbl[spec->board_config];
2166 stac92xx_set_config_regs(codec);
2169 switch (spec->board_config) {
2171 spec->adc_nids = stac927x_adc_nids;
2172 spec->mux_nids = stac927x_mux_nids;
2173 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
2174 spec->num_dmics = 0;
2175 spec->init = d965_core_init;
2176 spec->mixer = stac9227_mixer;
2179 spec->adc_nids = stac927x_adc_nids;
2180 spec->mux_nids = stac927x_mux_nids;
2181 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
2182 spec->num_dmics = 0;
2183 spec->init = d965_core_init;
2184 spec->mixer = stac9227_mixer;
2187 spec->adc_nids = stac927x_adc_nids;
2188 spec->mux_nids = stac927x_mux_nids;
2189 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
2190 spec->num_dmics = 0;
2191 spec->init = stac927x_core_init;
2192 spec->mixer = stac927x_mixer;
2195 spec->multiout.dac_nids = spec->dac_nids;
2197 err = stac92xx_parse_auto_config(codec, 0x1e, 0x20);
2199 if (spec->board_config < 0) {
2200 printk(KERN_WARNING "hda_codec: No auto-config is "
2201 "available, default to model=ref\n");
2202 spec->board_config = STAC_D965_REF;
2208 stac92xx_free(codec);
2212 codec->patch_ops = stac92xx_patch_ops;
2214 /* Fix Mux capture level; max to 2 */
2215 snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
2216 (0 << AC_AMPCAP_OFFSET_SHIFT) |
2217 (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
2218 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2219 (0 << AC_AMPCAP_MUTE_SHIFT));
2224 static int patch_stac9205(struct hda_codec *codec)
2226 struct sigmatel_spec *spec;
2229 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
2234 spec->num_pins = 14;
2235 spec->pin_nids = stac9205_pin_nids;
2236 spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS,
2240 if (spec->board_config < 0) {
2241 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n");
2242 err = stac92xx_save_bios_config_regs(codec);
2244 stac92xx_free(codec);
2247 spec->pin_configs = spec->bios_pin_configs;
2249 spec->pin_configs = stac9205_brd_tbl[spec->board_config];
2250 stac92xx_set_config_regs(codec);
2253 spec->adc_nids = stac9205_adc_nids;
2254 spec->mux_nids = stac9205_mux_nids;
2255 spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids);
2256 spec->dmic_nids = stac9205_dmic_nids;
2257 spec->num_dmics = ARRAY_SIZE(stac9205_dmic_nids);
2258 spec->dmux_nid = 0x1d;
2260 spec->init = stac9205_core_init;
2261 spec->mixer = stac9205_mixer;
2263 spec->multiout.dac_nids = spec->dac_nids;
2265 /* Configure GPIO0 as EAPD output */
2266 snd_hda_codec_write(codec, codec->afg, 0,
2267 AC_VERB_SET_GPIO_DIRECTION, 0x00000001);
2268 /* Configure GPIO0 as CMOS */
2269 snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0x00000000);
2270 /* Assert GPIO0 high */
2271 snd_hda_codec_write(codec, codec->afg, 0,
2272 AC_VERB_SET_GPIO_DATA, 0x00000001);
2274 snd_hda_codec_write(codec, codec->afg, 0,
2275 AC_VERB_SET_GPIO_MASK, 0x00000001);
2277 err = stac92xx_parse_auto_config(codec, 0x1f, 0x20);
2279 if (spec->board_config < 0) {
2280 printk(KERN_WARNING "hda_codec: No auto-config is "
2281 "available, default to model=ref\n");
2282 spec->board_config = STAC_9205_REF;
2288 stac92xx_free(codec);
2292 codec->patch_ops = stac92xx_patch_ops;
2301 /* static config for Sony VAIO FE550G and Sony VAIO AR */
2302 static hda_nid_t vaio_dacs[] = { 0x2 };
2303 #define VAIO_HP_DAC 0x5
2304 static hda_nid_t vaio_adcs[] = { 0x8 /*,0x6*/ };
2305 static hda_nid_t vaio_mux_nids[] = { 0x15 };
2307 static struct hda_input_mux vaio_mux = {
2310 /* { "HP", 0x0 }, */
2317 static struct hda_verb vaio_init[] = {
2318 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
2319 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
2320 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
2321 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
2322 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */
2323 {0x15, AC_VERB_SET_CONNECT_SEL, 0x2}, /* mic-sel: 0a,0d,14,02 */
2324 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */
2325 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */
2326 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
2327 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
2328 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
2332 static struct hda_verb vaio_ar_init[] = {
2333 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
2334 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
2335 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
2336 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
2337 /* {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },*/ /* Optical Out */
2338 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */
2339 {0x15, AC_VERB_SET_CONNECT_SEL, 0x2}, /* mic-sel: 0a,0d,14,02 */
2340 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */
2341 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */
2342 /* {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},*/ /* Optical Out */
2343 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
2344 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
2345 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
2349 /* bind volumes of both NID 0x02 and 0x05 */
2350 static int vaio_master_vol_put(struct snd_kcontrol *kcontrol,
2351 struct snd_ctl_elem_value *ucontrol)
2353 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2354 long *valp = ucontrol->value.integer.value;
2357 change = snd_hda_codec_amp_update(codec, 0x02, 0, HDA_OUTPUT, 0,
2358 0x7f, valp[0] & 0x7f);
2359 change |= snd_hda_codec_amp_update(codec, 0x02, 1, HDA_OUTPUT, 0,
2360 0x7f, valp[1] & 0x7f);
2361 snd_hda_codec_amp_update(codec, 0x05, 0, HDA_OUTPUT, 0,
2362 0x7f, valp[0] & 0x7f);
2363 snd_hda_codec_amp_update(codec, 0x05, 1, HDA_OUTPUT, 0,
2364 0x7f, valp[1] & 0x7f);
2368 /* bind volumes of both NID 0x02 and 0x05 */
2369 static int vaio_master_sw_put(struct snd_kcontrol *kcontrol,
2370 struct snd_ctl_elem_value *ucontrol)
2372 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2373 long *valp = ucontrol->value.integer.value;
2376 change = snd_hda_codec_amp_update(codec, 0x02, 0, HDA_OUTPUT, 0,
2377 0x80, (valp[0] ? 0 : 0x80));
2378 change |= snd_hda_codec_amp_update(codec, 0x02, 1, HDA_OUTPUT, 0,
2379 0x80, (valp[1] ? 0 : 0x80));
2380 snd_hda_codec_amp_update(codec, 0x05, 0, HDA_OUTPUT, 0,
2381 0x80, (valp[0] ? 0 : 0x80));
2382 snd_hda_codec_amp_update(codec, 0x05, 1, HDA_OUTPUT, 0,
2383 0x80, (valp[1] ? 0 : 0x80));
2387 static struct snd_kcontrol_new vaio_mixer[] = {
2389 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2390 .name = "Master Playback Volume",
2391 .info = snd_hda_mixer_amp_volume_info,
2392 .get = snd_hda_mixer_amp_volume_get,
2393 .put = vaio_master_vol_put,
2394 .tlv = { .c = snd_hda_mixer_amp_tlv },
2395 .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
2398 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2399 .name = "Master Playback Switch",
2400 .info = snd_hda_mixer_amp_switch_info,
2401 .get = snd_hda_mixer_amp_switch_get,
2402 .put = vaio_master_sw_put,
2403 .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
2405 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
2406 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
2407 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
2409 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2410 .name = "Capture Source",
2412 .info = stac92xx_mux_enum_info,
2413 .get = stac92xx_mux_enum_get,
2414 .put = stac92xx_mux_enum_put,
2419 static struct snd_kcontrol_new vaio_ar_mixer[] = {
2421 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2422 .name = "Master Playback Volume",
2423 .info = snd_hda_mixer_amp_volume_info,
2424 .get = snd_hda_mixer_amp_volume_get,
2425 .put = vaio_master_vol_put,
2426 .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
2429 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2430 .name = "Master Playback Switch",
2431 .info = snd_hda_mixer_amp_switch_info,
2432 .get = snd_hda_mixer_amp_switch_get,
2433 .put = vaio_master_sw_put,
2434 .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
2436 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
2437 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
2438 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
2439 /*HDA_CODEC_MUTE("Optical Out Switch", 0x10, 0, HDA_OUTPUT),
2440 HDA_CODEC_VOLUME("Optical Out Volume", 0x10, 0, HDA_OUTPUT),*/
2442 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2443 .name = "Capture Source",
2445 .info = stac92xx_mux_enum_info,
2446 .get = stac92xx_mux_enum_get,
2447 .put = stac92xx_mux_enum_put,
2452 static struct hda_codec_ops stac9872_patch_ops = {
2453 .build_controls = stac92xx_build_controls,
2454 .build_pcms = stac92xx_build_pcms,
2455 .init = stac92xx_init,
2456 .free = stac92xx_free,
2458 .resume = stac92xx_resume,
2462 enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */
2464 /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */
2466 /* Unknown. id=0x83847661 and subsys=0x104D1200. */
2468 /* AR Series. id=0x83847664 and subsys=104D1300 */
2473 static const char *stac9872_models[STAC_9872_MODELS] = {
2474 [CXD9872RD_VAIO] = "vaio",
2475 [CXD9872AKD_VAIO] = "vaio-ar",
2478 static struct snd_pci_quirk stac9872_cfg_tbl[] = {
2479 SND_PCI_QUIRK(0x104d, 0x81e6, "Sony VAIO F/S", CXD9872RD_VAIO),
2480 SND_PCI_QUIRK(0x104d, 0x81ef, "Sony VAIO F/S", CXD9872RD_VAIO),
2481 SND_PCI_QUIRK(0x104d, 0x81fd, "Sony VAIO AR", CXD9872AKD_VAIO),
2482 SND_PCI_QUIRK(0x104d, 0x8205, "Sony VAIO AR", CXD9872AKD_VAIO),
2486 static int patch_stac9872(struct hda_codec *codec)
2488 struct sigmatel_spec *spec;
2491 board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS,
2494 if (board_config < 0)
2495 /* unknown config, let generic-parser do its job... */
2496 return snd_hda_parse_generic_codec(codec);
2498 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
2503 switch (board_config) {
2504 case CXD9872RD_VAIO:
2505 case STAC9872AK_VAIO:
2506 case STAC9872K_VAIO:
2507 spec->mixer = vaio_mixer;
2508 spec->init = vaio_init;
2509 spec->multiout.max_channels = 2;
2510 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs);
2511 spec->multiout.dac_nids = vaio_dacs;
2512 spec->multiout.hp_nid = VAIO_HP_DAC;
2513 spec->num_adcs = ARRAY_SIZE(vaio_adcs);
2514 spec->adc_nids = vaio_adcs;
2515 spec->input_mux = &vaio_mux;
2516 spec->mux_nids = vaio_mux_nids;
2519 case CXD9872AKD_VAIO:
2520 spec->mixer = vaio_ar_mixer;
2521 spec->init = vaio_ar_init;
2522 spec->multiout.max_channels = 2;
2523 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs);
2524 spec->multiout.dac_nids = vaio_dacs;
2525 spec->multiout.hp_nid = VAIO_HP_DAC;
2526 spec->num_adcs = ARRAY_SIZE(vaio_adcs);
2527 spec->adc_nids = vaio_adcs;
2528 spec->input_mux = &vaio_mux;
2529 spec->mux_nids = vaio_mux_nids;
2533 codec->patch_ops = stac9872_patch_ops;
2541 struct hda_codec_preset snd_hda_preset_sigmatel[] = {
2542 { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 },
2543 { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x },
2544 { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x },
2545 { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x },
2546 { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x },
2547 { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x },
2548 { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x },
2549 { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x },
2550 { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x },
2551 { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x },
2552 { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x },
2553 { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x },
2554 { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x },
2555 { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x },
2556 { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x },
2557 { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x },
2558 { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x },
2559 { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x },
2560 { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x },
2561 { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x },
2562 { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x },
2563 { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x },
2564 { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x },
2565 { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x },
2566 { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x },
2567 { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x },
2568 { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x },
2569 { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x },
2570 { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x },
2571 /* The following does not take into account .id=0x83847661 when subsys =
2572 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
2573 * currently not fully supported.
2575 { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 },
2576 { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 },
2577 { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 },
2578 { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 },
2579 { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 },
2580 { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 },
2581 { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 },
2582 { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 },
2583 { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 },
2584 { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 },
2585 { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 },