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
68 /* for backward compitability */
85 struct sigmatel_spec {
86 struct snd_kcontrol_new *mixers[4];
87 unsigned int num_mixers;
90 unsigned int surr_switch: 1;
91 unsigned int line_switch: 1;
92 unsigned int mic_switch: 1;
93 unsigned int alt_switch: 1;
94 unsigned int hp_detect: 1;
95 unsigned int gpio_mute: 1;
98 struct hda_multi_out multiout;
99 hda_nid_t dac_nids[5];
103 unsigned int num_adcs;
105 unsigned int num_muxes;
106 hda_nid_t *dmic_nids;
107 unsigned int num_dmics;
109 hda_nid_t dig_in_nid;
113 unsigned int num_pins;
114 unsigned int *pin_configs;
115 unsigned int *bios_pin_configs;
117 /* codec specific stuff */
118 struct hda_verb *init;
119 struct snd_kcontrol_new *mixer;
122 struct hda_input_mux *dinput_mux;
123 unsigned int cur_dmux;
124 struct hda_input_mux *input_mux;
125 unsigned int cur_mux[3];
128 unsigned int io_switch[2];
130 struct hda_pcm pcm_rec[2]; /* PCM information */
132 /* dynamic controls and input_mux */
133 struct auto_pin_cfg autocfg;
134 unsigned int num_kctl_alloc, num_kctl_used;
135 struct snd_kcontrol_new *kctl_alloc;
136 struct hda_input_mux private_dimux;
137 struct hda_input_mux private_imux;
140 static hda_nid_t stac9200_adc_nids[1] = {
144 static hda_nid_t stac9200_mux_nids[1] = {
148 static hda_nid_t stac9200_dac_nids[1] = {
152 static hda_nid_t stac925x_adc_nids[1] = {
156 static hda_nid_t stac925x_mux_nids[1] = {
160 static hda_nid_t stac925x_dac_nids[1] = {
164 static hda_nid_t stac925x_dmic_nids[1] = {
168 static hda_nid_t stac922x_adc_nids[2] = {
172 static hda_nid_t stac922x_mux_nids[2] = {
176 static hda_nid_t stac927x_adc_nids[3] = {
180 static hda_nid_t stac927x_mux_nids[3] = {
184 static hda_nid_t stac9205_adc_nids[2] = {
188 static hda_nid_t stac9205_mux_nids[2] = {
192 static hda_nid_t stac9205_dmic_nids[2] = {
196 static hda_nid_t stac9200_pin_nids[8] = {
197 0x08, 0x09, 0x0d, 0x0e,
198 0x0f, 0x10, 0x11, 0x12,
201 static hda_nid_t stac925x_pin_nids[8] = {
202 0x07, 0x08, 0x0a, 0x0b,
203 0x0c, 0x0d, 0x10, 0x11,
206 static hda_nid_t stac922x_pin_nids[10] = {
207 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
208 0x0f, 0x10, 0x11, 0x15, 0x1b,
211 static hda_nid_t stac927x_pin_nids[14] = {
212 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
213 0x0f, 0x10, 0x11, 0x12, 0x13,
214 0x14, 0x21, 0x22, 0x23,
217 static hda_nid_t stac9205_pin_nids[12] = {
218 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
219 0x0f, 0x14, 0x16, 0x17, 0x18,
224 static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol,
225 struct snd_ctl_elem_info *uinfo)
227 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
228 struct sigmatel_spec *spec = codec->spec;
229 return snd_hda_input_mux_info(spec->dinput_mux, uinfo);
232 static int stac92xx_dmux_enum_get(struct snd_kcontrol *kcontrol,
233 struct snd_ctl_elem_value *ucontrol)
235 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
236 struct sigmatel_spec *spec = codec->spec;
238 ucontrol->value.enumerated.item[0] = spec->cur_dmux;
242 static int stac92xx_dmux_enum_put(struct snd_kcontrol *kcontrol,
243 struct snd_ctl_elem_value *ucontrol)
245 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
246 struct sigmatel_spec *spec = codec->spec;
248 return snd_hda_input_mux_put(codec, spec->dinput_mux, ucontrol,
249 spec->dmux_nid, &spec->cur_dmux);
252 static int stac92xx_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
254 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
255 struct sigmatel_spec *spec = codec->spec;
256 return snd_hda_input_mux_info(spec->input_mux, uinfo);
259 static int stac92xx_mux_enum_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
261 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
262 struct sigmatel_spec *spec = codec->spec;
263 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
265 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
269 static int stac92xx_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
271 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
272 struct sigmatel_spec *spec = codec->spec;
273 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
275 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol,
276 spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]);
279 static struct hda_verb stac9200_core_init[] = {
280 /* set dac0mux for dac converter */
281 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
285 static struct hda_verb stac925x_core_init[] = {
286 /* set dac0mux for dac converter */
287 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
291 static struct hda_verb stac922x_core_init[] = {
292 /* set master volume and direct control */
293 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
297 static struct hda_verb d965_core_init[] = {
298 /* set master volume and direct control */
299 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
300 /* unmute node 0x1b */
301 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
302 /* select node 0x03 as DAC */
303 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
307 static struct hda_verb stac927x_core_init[] = {
308 /* set master volume and direct control */
309 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
313 static struct hda_verb stac9205_core_init[] = {
314 /* set master volume and direct control */
315 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
319 static struct snd_kcontrol_new stac9200_mixer[] = {
320 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT),
321 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT),
323 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
324 .name = "Input Source",
326 .info = stac92xx_mux_enum_info,
327 .get = stac92xx_mux_enum_get,
328 .put = stac92xx_mux_enum_put,
330 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT),
331 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT),
332 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0c, 0, HDA_OUTPUT),
336 static struct snd_kcontrol_new stac925x_mixer[] = {
337 HDA_CODEC_VOLUME("Master Playback Volume", 0xe, 0, HDA_OUTPUT),
338 HDA_CODEC_MUTE("Master Playback Switch", 0xe, 0, HDA_OUTPUT),
340 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
341 .name = "Input Source",
343 .info = stac92xx_mux_enum_info,
344 .get = stac92xx_mux_enum_get,
345 .put = stac92xx_mux_enum_put,
347 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT),
348 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_OUTPUT),
349 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0f, 0, HDA_OUTPUT),
353 /* This needs to be generated dynamically based on sequence */
354 static struct snd_kcontrol_new stac922x_mixer[] = {
356 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
357 .name = "Input Source",
359 .info = stac92xx_mux_enum_info,
360 .get = stac92xx_mux_enum_get,
361 .put = stac92xx_mux_enum_put,
363 HDA_CODEC_VOLUME("Capture Volume", 0x17, 0x0, HDA_INPUT),
364 HDA_CODEC_MUTE("Capture Switch", 0x17, 0x0, HDA_INPUT),
365 HDA_CODEC_VOLUME("Mux Capture Volume", 0x12, 0x0, HDA_OUTPUT),
369 /* This needs to be generated dynamically based on sequence */
370 static struct snd_kcontrol_new stac9227_mixer[] = {
372 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
373 .name = "Input Source",
375 .info = stac92xx_mux_enum_info,
376 .get = stac92xx_mux_enum_get,
377 .put = stac92xx_mux_enum_put,
379 HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT),
380 HDA_CODEC_MUTE("Capture Switch", 0x1b, 0x0, HDA_OUTPUT),
384 static struct snd_kcontrol_new stac927x_mixer[] = {
386 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
387 .name = "Input Source",
389 .info = stac92xx_mux_enum_info,
390 .get = stac92xx_mux_enum_get,
391 .put = stac92xx_mux_enum_put,
393 HDA_CODEC_VOLUME("InMux Capture Volume", 0x15, 0x0, HDA_OUTPUT),
394 HDA_CODEC_VOLUME("InVol Capture Volume", 0x18, 0x0, HDA_INPUT),
395 HDA_CODEC_MUTE("ADCMux Capture Switch", 0x1b, 0x0, HDA_OUTPUT),
399 static struct snd_kcontrol_new stac9205_mixer[] = {
401 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
402 .name = "Digital Input Source",
404 .info = stac92xx_dmux_enum_info,
405 .get = stac92xx_dmux_enum_get,
406 .put = stac92xx_dmux_enum_put,
409 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
410 .name = "Input Source",
412 .info = stac92xx_mux_enum_info,
413 .get = stac92xx_mux_enum_get,
414 .put = stac92xx_mux_enum_put,
416 HDA_CODEC_VOLUME("InMux Capture Volume", 0x19, 0x0, HDA_OUTPUT),
417 HDA_CODEC_VOLUME("InVol Capture Volume", 0x1b, 0x0, HDA_INPUT),
418 HDA_CODEC_MUTE("ADCMux Capture Switch", 0x1d, 0x0, HDA_OUTPUT),
422 static int stac92xx_build_controls(struct hda_codec *codec)
424 struct sigmatel_spec *spec = codec->spec;
428 err = snd_hda_add_new_ctls(codec, spec->mixer);
432 for (i = 0; i < spec->num_mixers; i++) {
433 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
438 if (spec->multiout.dig_out_nid) {
439 err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid);
443 if (spec->dig_in_nid) {
444 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
451 static unsigned int ref9200_pin_configs[8] = {
452 0x01c47010, 0x01447010, 0x0221401f, 0x01114010,
453 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
456 static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = {
457 [STAC_REF] = ref9200_pin_configs,
460 static const char *stac9200_models[STAC_9200_MODELS] = {
464 static struct snd_pci_quirk stac9200_cfg_tbl[] = {
465 /* SigmaTel reference board */
466 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
467 "DFI LanParty", STAC_REF),
468 /* Dell laptops have BIOS problem */
469 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5,
470 "Dell Inspiron 630m", STAC_REF),
471 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2,
472 "Dell Latitude D620", STAC_REF),
473 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb,
474 "Dell Latitude 120L", STAC_REF),
475 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc,
476 "Dell Latitude D820", STAC_REF),
477 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd,
478 "Dell Inspiron E1705/9400", STAC_REF),
479 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce,
480 "Dell XPS M1710", STAC_REF),
481 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf,
482 "Dell Precision M90", STAC_REF),
483 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6,
484 "unknown Dell", STAC_REF),
485 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8,
486 "Dell Inspiron 640m", STAC_REF),
487 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5,
488 "Dell Inspiron 1501", STAC_REF),
491 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_REF),
496 static unsigned int ref925x_pin_configs[8] = {
497 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
498 0x90a70320, 0x02214210, 0x400003f1, 0x9033032e,
501 static unsigned int stac925x_MA6_pin_configs[8] = {
502 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
503 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e,
506 static unsigned int stac925x_PA6_pin_configs[8] = {
507 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
508 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e,
511 static unsigned int stac925xM2_2_pin_configs[8] = {
512 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020,
513 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e,
516 static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = {
517 [STAC_REF] = ref925x_pin_configs,
518 [STAC_M2_2] = stac925xM2_2_pin_configs,
519 [STAC_MA6] = stac925x_MA6_pin_configs,
520 [STAC_PA6] = stac925x_PA6_pin_configs,
523 static const char *stac925x_models[STAC_925x_MODELS] = {
525 [STAC_M2_2] = "m2-2",
530 static struct snd_pci_quirk stac925x_cfg_tbl[] = {
531 /* SigmaTel reference board */
532 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
533 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
534 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF),
535 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF),
536 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6),
537 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6),
538 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2),
542 static unsigned int ref922x_pin_configs[10] = {
543 0x01014010, 0x01016011, 0x01012012, 0x0221401f,
544 0x01813122, 0x01011014, 0x01441030, 0x01c41030,
545 0x40000100, 0x40000100,
548 static unsigned int d945gtp3_pin_configs[10] = {
549 0x0221401f, 0x01a19022, 0x01813021, 0x01014010,
550 0x40000100, 0x40000100, 0x40000100, 0x40000100,
551 0x02a19120, 0x40000100,
554 static unsigned int d945gtp5_pin_configs[10] = {
555 0x0221401f, 0x01011012, 0x01813024, 0x01014010,
556 0x01a19021, 0x01016011, 0x01452130, 0x40000100,
557 0x02a19320, 0x40000100,
560 static unsigned int intel_mac_v1_pin_configs[10] = {
561 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd,
562 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240,
563 0x400000fc, 0x400000fb,
566 static unsigned int intel_mac_v2_pin_configs[10] = {
567 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
568 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa,
569 0x400000fc, 0x400000fb,
572 static unsigned int intel_mac_v3_pin_configs[10] = {
573 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
574 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240,
575 0x400000fc, 0x400000fb,
578 static unsigned int intel_mac_v4_pin_configs[10] = {
579 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
580 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
581 0x400000fc, 0x400000fb,
584 static unsigned int intel_mac_v5_pin_configs[10] = {
585 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
586 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
587 0x400000fc, 0x400000fb,
590 static unsigned int stac922x_dell_pin_configs[10] = {
591 0x0221121e, 0x408103ff, 0x02a1123e, 0x90100310,
592 0x408003f1, 0x0221122f, 0x03451340, 0x40c003f2,
593 0x50a003f3, 0x405003f4
596 static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
597 [STAC_D945_REF] = ref922x_pin_configs,
598 [STAC_D945GTP3] = d945gtp3_pin_configs,
599 [STAC_D945GTP5] = d945gtp5_pin_configs,
600 [STAC_922X_DELL] = stac922x_dell_pin_configs,
601 [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs,
602 [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs,
603 [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs,
604 [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs,
605 [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs,
606 /* for backward compitability */
607 [STAC_MACMINI] = intel_mac_v3_pin_configs,
608 [STAC_MACBOOK] = intel_mac_v5_pin_configs,
609 [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs,
610 [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs,
611 [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs,
612 [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs,
615 static const char *stac922x_models[STAC_922X_MODELS] = {
616 [STAC_D945_REF] = "ref",
617 [STAC_D945GTP5] = "5stack",
618 [STAC_D945GTP3] = "3stack",
619 [STAC_922X_DELL] = "dell",
620 [STAC_INTEL_MAC_V1] = "intel-mac-v1",
621 [STAC_INTEL_MAC_V2] = "intel-mac-v2",
622 [STAC_INTEL_MAC_V3] = "intel-mac-v3",
623 [STAC_INTEL_MAC_V4] = "intel-mac-v4",
624 [STAC_INTEL_MAC_V5] = "intel-mac-v5",
625 /* for backward compitability */
626 [STAC_MACMINI] = "macmini",
627 [STAC_MACBOOK] = "macbook",
628 [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1",
629 [STAC_MACBOOK_PRO_V2] = "macbook-pro",
630 [STAC_IMAC_INTEL] = "imac-intel",
631 [STAC_IMAC_INTEL_20] = "imac-intel-20",
634 static struct snd_pci_quirk stac922x_cfg_tbl[] = {
635 /* SigmaTel reference board */
636 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
637 "DFI LanParty", STAC_D945_REF),
638 /* Intel 945G based systems */
639 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101,
640 "Intel D945G", STAC_D945GTP3),
641 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202,
642 "Intel D945G", STAC_D945GTP3),
643 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606,
644 "Intel D945G", STAC_D945GTP3),
645 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601,
646 "Intel D945G", STAC_D945GTP3),
647 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111,
648 "Intel D945G", STAC_D945GTP3),
649 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115,
650 "Intel D945G", STAC_D945GTP3),
651 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116,
652 "Intel D945G", STAC_D945GTP3),
653 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117,
654 "Intel D945G", STAC_D945GTP3),
655 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118,
656 "Intel D945G", STAC_D945GTP3),
657 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119,
658 "Intel D945G", STAC_D945GTP3),
659 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826,
660 "Intel D945G", STAC_D945GTP3),
661 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049,
662 "Intel D945G", STAC_D945GTP3),
663 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055,
664 "Intel D945G", STAC_D945GTP3),
665 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048,
666 "Intel D945G", STAC_D945GTP3),
667 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110,
668 "Intel D945G", STAC_D945GTP3),
669 /* Intel D945G 5-stack systems */
670 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404,
671 "Intel D945G", STAC_D945GTP5),
672 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303,
673 "Intel D945G", STAC_D945GTP5),
674 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013,
675 "Intel D945G", STAC_D945GTP5),
676 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417,
677 "Intel D945G", STAC_D945GTP5),
678 /* Intel 945P based systems */
679 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b,
680 "Intel D945P", STAC_D945GTP3),
681 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112,
682 "Intel D945P", STAC_D945GTP3),
683 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d,
684 "Intel D945P", STAC_D945GTP3),
685 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909,
686 "Intel D945P", STAC_D945GTP3),
687 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505,
688 "Intel D945P", STAC_D945GTP3),
689 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707,
690 "Intel D945P", STAC_D945GTP5),
692 /* Apple Mac Mini (early 2006) */
693 SND_PCI_QUIRK(0x8384, 0x7680,
694 "Mac Mini", STAC_INTEL_MAC_V3),
696 SND_PCI_QUIRK(0x1028, 0x01d7, "Dell XPS M1210", STAC_922X_DELL),
701 static unsigned int ref927x_pin_configs[14] = {
702 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
703 0x01a19040, 0x01011012, 0x01016011, 0x0101201f,
704 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070,
705 0x01c42190, 0x40000100,
708 static unsigned int d965_3st_pin_configs[14] = {
709 0x0221401f, 0x02a19120, 0x40000100, 0x01014011,
710 0x01a19021, 0x01813024, 0x40000100, 0x40000100,
711 0x40000100, 0x40000100, 0x40000100, 0x40000100,
712 0x40000100, 0x40000100
715 static unsigned int d965_5st_pin_configs[14] = {
716 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
717 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
718 0x40000100, 0x40000100, 0x40000100, 0x01442070,
719 0x40000100, 0x40000100
722 static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
723 [STAC_D965_REF] = ref927x_pin_configs,
724 [STAC_D965_3ST] = d965_3st_pin_configs,
725 [STAC_D965_5ST] = d965_5st_pin_configs,
728 static const char *stac927x_models[STAC_927X_MODELS] = {
729 [STAC_D965_REF] = "ref",
730 [STAC_D965_3ST] = "3stack",
731 [STAC_D965_5ST] = "5stack",
734 static struct snd_pci_quirk stac927x_cfg_tbl[] = {
735 /* SigmaTel reference board */
736 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
737 "DFI LanParty", STAC_D965_REF),
738 /* Intel 946 based systems */
739 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST),
740 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST),
741 /* 965 based 3 stack systems */
742 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2116, "Intel D965", STAC_D965_3ST),
743 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2115, "Intel D965", STAC_D965_3ST),
744 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2114, "Intel D965", STAC_D965_3ST),
745 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2113, "Intel D965", STAC_D965_3ST),
746 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2112, "Intel D965", STAC_D965_3ST),
747 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2111, "Intel D965", STAC_D965_3ST),
748 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2110, "Intel D965", STAC_D965_3ST),
749 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2009, "Intel D965", STAC_D965_3ST),
750 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2008, "Intel D965", STAC_D965_3ST),
751 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2007, "Intel D965", STAC_D965_3ST),
752 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2006, "Intel D965", STAC_D965_3ST),
753 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2005, "Intel D965", STAC_D965_3ST),
754 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2004, "Intel D965", STAC_D965_3ST),
755 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2003, "Intel D965", STAC_D965_3ST),
756 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2002, "Intel D965", STAC_D965_3ST),
757 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2001, "Intel D965", STAC_D965_3ST),
758 /* 965 based 5 stack systems */
759 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2301, "Intel D965", STAC_D965_5ST),
760 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2302, "Intel D965", STAC_D965_5ST),
761 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2303, "Intel D965", STAC_D965_5ST),
762 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2304, "Intel D965", STAC_D965_5ST),
763 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2305, "Intel D965", STAC_D965_5ST),
764 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2501, "Intel D965", STAC_D965_5ST),
765 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2502, "Intel D965", STAC_D965_5ST),
766 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2503, "Intel D965", STAC_D965_5ST),
767 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2504, "Intel D965", STAC_D965_5ST),
771 static unsigned int ref9205_pin_configs[12] = {
772 0x40000100, 0x40000100, 0x01016011, 0x01014010,
773 0x01813122, 0x01a19021, 0x40000100, 0x40000100,
774 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030
777 static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = {
781 static const char *stac9205_models[STAC_9205_MODELS] = {
782 [STAC_9205_REF] = "ref",
785 static struct snd_pci_quirk stac9205_cfg_tbl[] = {
786 /* SigmaTel reference board */
787 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
788 "DFI LanParty", STAC_9205_REF),
792 static int stac92xx_save_bios_config_regs(struct hda_codec *codec)
795 struct sigmatel_spec *spec = codec->spec;
797 if (! spec->bios_pin_configs) {
798 spec->bios_pin_configs = kcalloc(spec->num_pins,
799 sizeof(*spec->bios_pin_configs), GFP_KERNEL);
800 if (! spec->bios_pin_configs)
804 for (i = 0; i < spec->num_pins; i++) {
805 hda_nid_t nid = spec->pin_nids[i];
806 unsigned int pin_cfg;
808 pin_cfg = snd_hda_codec_read(codec, nid, 0,
809 AC_VERB_GET_CONFIG_DEFAULT, 0x00);
810 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x bios pin config %8.8x\n",
812 spec->bios_pin_configs[i] = pin_cfg;
818 static void stac92xx_set_config_regs(struct hda_codec *codec)
821 struct sigmatel_spec *spec = codec->spec;
822 unsigned int pin_cfg;
824 if (! spec->pin_nids || ! spec->pin_configs)
827 for (i = 0; i < spec->num_pins; i++) {
828 snd_hda_codec_write(codec, spec->pin_nids[i], 0,
829 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
830 spec->pin_configs[i] & 0x000000ff);
831 snd_hda_codec_write(codec, spec->pin_nids[i], 0,
832 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
833 (spec->pin_configs[i] & 0x0000ff00) >> 8);
834 snd_hda_codec_write(codec, spec->pin_nids[i], 0,
835 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
836 (spec->pin_configs[i] & 0x00ff0000) >> 16);
837 snd_hda_codec_write(codec, spec->pin_nids[i], 0,
838 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
839 spec->pin_configs[i] >> 24);
840 pin_cfg = snd_hda_codec_read(codec, spec->pin_nids[i], 0,
841 AC_VERB_GET_CONFIG_DEFAULT,
843 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n", spec->pin_nids[i], pin_cfg);
848 * Analog playback callbacks
850 static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo,
851 struct hda_codec *codec,
852 struct snd_pcm_substream *substream)
854 struct sigmatel_spec *spec = codec->spec;
855 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream);
858 static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
859 struct hda_codec *codec,
860 unsigned int stream_tag,
862 struct snd_pcm_substream *substream)
864 struct sigmatel_spec *spec = codec->spec;
865 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, stream_tag, format, substream);
868 static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
869 struct hda_codec *codec,
870 struct snd_pcm_substream *substream)
872 struct sigmatel_spec *spec = codec->spec;
873 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
877 * Digital playback callbacks
879 static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
880 struct hda_codec *codec,
881 struct snd_pcm_substream *substream)
883 struct sigmatel_spec *spec = codec->spec;
884 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
887 static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
888 struct hda_codec *codec,
889 struct snd_pcm_substream *substream)
891 struct sigmatel_spec *spec = codec->spec;
892 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
895 static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
896 struct hda_codec *codec,
897 unsigned int stream_tag,
899 struct snd_pcm_substream *substream)
901 struct sigmatel_spec *spec = codec->spec;
902 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
903 stream_tag, format, substream);
908 * Analog capture callbacks
910 static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
911 struct hda_codec *codec,
912 unsigned int stream_tag,
914 struct snd_pcm_substream *substream)
916 struct sigmatel_spec *spec = codec->spec;
918 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],
919 stream_tag, 0, format);
923 static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
924 struct hda_codec *codec,
925 struct snd_pcm_substream *substream)
927 struct sigmatel_spec *spec = codec->spec;
929 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], 0, 0, 0);
933 static struct hda_pcm_stream stac92xx_pcm_digital_playback = {
937 /* NID is set in stac92xx_build_pcms */
939 .open = stac92xx_dig_playback_pcm_open,
940 .close = stac92xx_dig_playback_pcm_close,
941 .prepare = stac92xx_dig_playback_pcm_prepare
945 static struct hda_pcm_stream stac92xx_pcm_digital_capture = {
949 /* NID is set in stac92xx_build_pcms */
952 static struct hda_pcm_stream stac92xx_pcm_analog_playback = {
956 .nid = 0x02, /* 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_alt_playback = {
968 .nid = 0x06, /* NID to query formats and rates */
970 .open = stac92xx_playback_pcm_open,
971 .prepare = stac92xx_playback_pcm_prepare,
972 .cleanup = stac92xx_playback_pcm_cleanup
976 static struct hda_pcm_stream stac92xx_pcm_analog_capture = {
980 /* NID is set in stac92xx_build_pcms */
982 .prepare = stac92xx_capture_pcm_prepare,
983 .cleanup = stac92xx_capture_pcm_cleanup
987 static int stac92xx_build_pcms(struct hda_codec *codec)
989 struct sigmatel_spec *spec = codec->spec;
990 struct hda_pcm *info = spec->pcm_rec;
993 codec->pcm_info = info;
995 info->name = "STAC92xx Analog";
996 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback;
997 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture;
998 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
1000 if (spec->alt_switch) {
1003 info->name = "STAC92xx Analog Alt";
1004 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback;
1007 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
1010 info->name = "STAC92xx Digital";
1011 if (spec->multiout.dig_out_nid) {
1012 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback;
1013 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
1015 if (spec->dig_in_nid) {
1016 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_digital_capture;
1017 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
1024 static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid)
1026 unsigned int pincap = snd_hda_param_read(codec, nid,
1028 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
1029 if (pincap & AC_PINCAP_VREF_100)
1030 return AC_PINCTL_VREF_100;
1031 if (pincap & AC_PINCAP_VREF_80)
1032 return AC_PINCTL_VREF_80;
1033 if (pincap & AC_PINCAP_VREF_50)
1034 return AC_PINCTL_VREF_50;
1035 if (pincap & AC_PINCAP_VREF_GRD)
1036 return AC_PINCTL_VREF_GRD;
1040 static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type)
1043 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
1046 static int stac92xx_io_switch_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
1048 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
1050 uinfo->value.integer.min = 0;
1051 uinfo->value.integer.max = 1;
1055 static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1057 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1058 struct sigmatel_spec *spec = codec->spec;
1059 int io_idx = kcontrol-> private_value & 0xff;
1061 ucontrol->value.integer.value[0] = spec->io_switch[io_idx];
1065 static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1067 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1068 struct sigmatel_spec *spec = codec->spec;
1069 hda_nid_t nid = kcontrol->private_value >> 8;
1070 int io_idx = kcontrol-> private_value & 0xff;
1071 unsigned short val = ucontrol->value.integer.value[0];
1073 spec->io_switch[io_idx] = val;
1076 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
1078 unsigned int pinctl = AC_PINCTL_IN_EN;
1079 if (io_idx) /* set VREF for mic */
1080 pinctl |= stac92xx_get_vref(codec, nid);
1081 stac92xx_auto_set_pinctl(codec, nid, pinctl);
1086 #define STAC_CODEC_IO_SWITCH(xname, xpval) \
1087 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1090 .info = stac92xx_io_switch_info, \
1091 .get = stac92xx_io_switch_get, \
1092 .put = stac92xx_io_switch_put, \
1093 .private_value = xpval, \
1098 STAC_CTL_WIDGET_VOL,
1099 STAC_CTL_WIDGET_MUTE,
1100 STAC_CTL_WIDGET_IO_SWITCH,
1103 static struct snd_kcontrol_new stac92xx_control_templates[] = {
1104 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
1105 HDA_CODEC_MUTE(NULL, 0, 0, 0),
1106 STAC_CODEC_IO_SWITCH(NULL, 0),
1109 /* add dynamic controls */
1110 static int stac92xx_add_control(struct sigmatel_spec *spec, int type, const char *name, unsigned long val)
1112 struct snd_kcontrol_new *knew;
1114 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
1115 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
1117 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); /* array + terminator */
1120 if (spec->kctl_alloc) {
1121 memcpy(knew, spec->kctl_alloc, sizeof(*knew) * spec->num_kctl_alloc);
1122 kfree(spec->kctl_alloc);
1124 spec->kctl_alloc = knew;
1125 spec->num_kctl_alloc = num;
1128 knew = &spec->kctl_alloc[spec->num_kctl_used];
1129 *knew = stac92xx_control_templates[type];
1130 knew->name = kstrdup(name, GFP_KERNEL);
1133 knew->private_value = val;
1134 spec->num_kctl_used++;
1138 /* flag inputs as additional dynamic lineouts */
1139 static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cfg *cfg)
1141 struct sigmatel_spec *spec = codec->spec;
1142 unsigned int wcaps, wtype;
1143 int i, num_dacs = 0;
1145 /* use the wcaps cache to count all DACs available for line-outs */
1146 for (i = 0; i < codec->num_nodes; i++) {
1147 wcaps = codec->wcaps[i];
1148 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
1149 if (wtype == AC_WID_AUD_OUT && !(wcaps & AC_WCAP_DIGITAL))
1153 snd_printdd("%s: total dac count=%d\n", __func__, num_dacs);
1155 switch (cfg->line_outs) {
1157 /* add line-in as side */
1158 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 3) {
1159 cfg->line_out_pins[3] = cfg->input_pins[AUTO_PIN_LINE];
1160 spec->line_switch = 1;
1165 /* add line-in as clfe and mic as side */
1166 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 2) {
1167 cfg->line_out_pins[2] = cfg->input_pins[AUTO_PIN_LINE];
1168 spec->line_switch = 1;
1171 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 3) {
1172 cfg->line_out_pins[3] = cfg->input_pins[AUTO_PIN_MIC];
1173 spec->mic_switch = 1;
1178 /* add line-in as surr and mic as clfe */
1179 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 1) {
1180 cfg->line_out_pins[1] = cfg->input_pins[AUTO_PIN_LINE];
1181 spec->line_switch = 1;
1184 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 2) {
1185 cfg->line_out_pins[2] = cfg->input_pins[AUTO_PIN_MIC];
1186 spec->mic_switch = 1;
1196 static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
1200 for (i = 0; i < spec->multiout.num_dacs; i++) {
1201 if (spec->multiout.dac_nids[i] == nid)
1209 * Fill in the dac_nids table from the parsed pin configuration
1210 * This function only works when every pin in line_out_pins[]
1211 * contains atleast one DAC in its connection list. Some 92xx
1212 * codecs are not connected directly to a DAC, such as the 9200
1213 * and 9202/925x. For those, dac_nids[] must be hard-coded.
1215 static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec,
1216 const struct auto_pin_cfg *cfg)
1218 struct sigmatel_spec *spec = codec->spec;
1219 int i, j, conn_len = 0;
1220 hda_nid_t nid, conn[HDA_MAX_CONNECTIONS];
1221 unsigned int wcaps, wtype;
1223 for (i = 0; i < cfg->line_outs; i++) {
1224 nid = cfg->line_out_pins[i];
1225 conn_len = snd_hda_get_connections(codec, nid, conn,
1226 HDA_MAX_CONNECTIONS);
1227 for (j = 0; j < conn_len; j++) {
1228 wcaps = snd_hda_param_read(codec, conn[j],
1229 AC_PAR_AUDIO_WIDGET_CAP);
1230 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
1232 if (wtype != AC_WID_AUD_OUT ||
1233 (wcaps & AC_WCAP_DIGITAL))
1235 /* conn[j] is a DAC routed to this line-out */
1236 if (!is_in_dac_nids(spec, conn[j]))
1240 if (j == conn_len) {
1241 /* error out, no available DAC found */
1243 "%s: No available DAC for pin 0x%x\n",
1248 spec->multiout.dac_nids[i] = conn[j];
1249 spec->multiout.num_dacs++;
1251 /* select this DAC in the pin's input mux */
1252 snd_hda_codec_write(codec, nid, 0,
1253 AC_VERB_SET_CONNECT_SEL, j);
1258 snd_printd("dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
1259 spec->multiout.num_dacs,
1260 spec->multiout.dac_nids[0],
1261 spec->multiout.dac_nids[1],
1262 spec->multiout.dac_nids[2],
1263 spec->multiout.dac_nids[3],
1264 spec->multiout.dac_nids[4]);
1268 /* create volume control/switch for the given prefx type */
1269 static int create_controls(struct sigmatel_spec *spec, const char *pfx, hda_nid_t nid, int chs)
1274 sprintf(name, "%s Playback Volume", pfx);
1275 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name,
1276 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
1279 sprintf(name, "%s Playback Switch", pfx);
1280 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, name,
1281 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
1287 /* add playback controls from the parsed DAC table */
1288 static int stac92xx_auto_create_multi_out_ctls(struct sigmatel_spec *spec,
1289 const struct auto_pin_cfg *cfg)
1291 static const char *chname[4] = {
1292 "Front", "Surround", NULL /*CLFE*/, "Side"
1297 for (i = 0; i < cfg->line_outs; i++) {
1298 if (!spec->multiout.dac_nids[i])
1301 nid = spec->multiout.dac_nids[i];
1305 err = create_controls(spec, "Center", nid, 1);
1308 err = create_controls(spec, "LFE", nid, 2);
1312 err = create_controls(spec, chname[i], nid, 3);
1318 if (spec->line_switch)
1319 if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_IO_SWITCH, "Line In as Output Switch", cfg->input_pins[AUTO_PIN_LINE] << 8)) < 0)
1322 if (spec->mic_switch)
1323 if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_IO_SWITCH, "Mic as Output Switch", (cfg->input_pins[AUTO_PIN_MIC] << 8) | 1)) < 0)
1329 static int check_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
1331 if (is_in_dac_nids(spec, nid))
1333 if (spec->multiout.hp_nid == nid)
1338 static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid)
1340 if (!spec->multiout.hp_nid)
1341 spec->multiout.hp_nid = nid;
1342 else if (spec->multiout.num_dacs > 4) {
1343 printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid);
1346 spec->multiout.dac_nids[spec->multiout.num_dacs] = nid;
1347 spec->multiout.num_dacs++;
1352 /* add playback controls for Speaker and HP outputs */
1353 static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec,
1354 struct auto_pin_cfg *cfg)
1356 struct sigmatel_spec *spec = codec->spec;
1358 int i, old_num_dacs, err;
1360 old_num_dacs = spec->multiout.num_dacs;
1361 for (i = 0; i < cfg->hp_outs; i++) {
1362 unsigned int wid_caps = get_wcaps(codec, cfg->hp_pins[i]);
1363 if (wid_caps & AC_WCAP_UNSOL_CAP)
1364 spec->hp_detect = 1;
1365 nid = snd_hda_codec_read(codec, cfg->hp_pins[i], 0,
1366 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
1367 if (check_in_dac_nids(spec, nid))
1371 add_spec_dacs(spec, nid);
1373 for (i = 0; i < cfg->speaker_outs; i++) {
1374 nid = snd_hda_codec_read(codec, cfg->speaker_pins[i], 0,
1375 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
1376 if (check_in_dac_nids(spec, nid))
1380 add_spec_dacs(spec, nid);
1383 for (i = old_num_dacs; i < spec->multiout.num_dacs; i++) {
1384 static const char *pfxs[] = {
1385 "Speaker", "External Speaker", "Speaker2",
1387 err = create_controls(spec, pfxs[i - old_num_dacs],
1388 spec->multiout.dac_nids[i], 3);
1392 if (spec->multiout.hp_nid) {
1394 if (old_num_dacs == spec->multiout.num_dacs)
1398 err = create_controls(spec, pfx, spec->multiout.hp_nid, 3);
1406 /* labels for dmic mux inputs */
1407 static const char *stac92xx_dmic_labels[5] = {
1408 "Analog Inputs", "Digital Mic 1", "Digital Mic 2",
1409 "Digital Mic 3", "Digital Mic 4"
1412 /* create playback/capture controls for input pins on dmic capable codecs */
1413 static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec,
1414 const struct auto_pin_cfg *cfg)
1416 struct sigmatel_spec *spec = codec->spec;
1417 struct hda_input_mux *dimux = &spec->private_dimux;
1418 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
1421 dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0];
1422 dimux->items[dimux->num_items].index = 0;
1425 for (i = 0; i < spec->num_dmics; i++) {
1428 unsigned int def_conf;
1430 def_conf = snd_hda_codec_read(codec,
1433 AC_VERB_GET_CONFIG_DEFAULT,
1435 if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE)
1438 num_cons = snd_hda_get_connections(codec,
1441 HDA_MAX_NUM_INPUTS);
1442 for (j = 0; j < num_cons; j++)
1443 if (con_lst[j] == spec->dmic_nids[i]) {
1449 dimux->items[dimux->num_items].label =
1450 stac92xx_dmic_labels[dimux->num_items];
1451 dimux->items[dimux->num_items].index = index;
1458 /* create playback/capture controls for input pins */
1459 static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg)
1461 struct sigmatel_spec *spec = codec->spec;
1462 struct hda_input_mux *imux = &spec->private_imux;
1463 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
1466 for (i = 0; i < AUTO_PIN_LAST; i++) {
1469 if (!cfg->input_pins[i])
1472 for (j = 0; j < spec->num_muxes; j++) {
1474 num_cons = snd_hda_get_connections(codec,
1477 HDA_MAX_NUM_INPUTS);
1478 for (k = 0; k < num_cons; k++)
1479 if (con_lst[k] == cfg->input_pins[i]) {
1486 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
1487 imux->items[imux->num_items].index = index;
1491 if (imux->num_items) {
1493 * Set the current input for the muxes.
1494 * The STAC9221 has two input muxes with identical source
1495 * NID lists. Hopefully this won't get confused.
1497 for (i = 0; i < spec->num_muxes; i++) {
1498 snd_hda_codec_write(codec, spec->mux_nids[i], 0,
1499 AC_VERB_SET_CONNECT_SEL,
1500 imux->items[0].index);
1507 static void stac92xx_auto_init_multi_out(struct hda_codec *codec)
1509 struct sigmatel_spec *spec = codec->spec;
1512 for (i = 0; i < spec->autocfg.line_outs; i++) {
1513 hda_nid_t nid = spec->autocfg.line_out_pins[i];
1514 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
1518 static void stac92xx_auto_init_hp_out(struct hda_codec *codec)
1520 struct sigmatel_spec *spec = codec->spec;
1523 for (i = 0; i < spec->autocfg.hp_outs; i++) {
1525 pin = spec->autocfg.hp_pins[i];
1526 if (pin) /* connect to front */
1527 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
1529 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
1531 pin = spec->autocfg.speaker_pins[i];
1532 if (pin) /* connect to front */
1533 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN);
1537 static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out, hda_nid_t dig_in)
1539 struct sigmatel_spec *spec = codec->spec;
1542 if ((err = snd_hda_parse_pin_def_config(codec,
1544 spec->dmic_nids)) < 0)
1546 if (! spec->autocfg.line_outs)
1547 return 0; /* can't find valid pin config */
1549 if ((err = stac92xx_add_dyn_out_pins(codec, &spec->autocfg)) < 0)
1551 if (spec->multiout.num_dacs == 0)
1552 if ((err = stac92xx_auto_fill_dac_nids(codec, &spec->autocfg)) < 0)
1555 if ((err = stac92xx_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 ||
1556 (err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg)) < 0 ||
1557 (err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0)
1560 if (spec->num_dmics > 0)
1561 if ((err = stac92xx_auto_create_dmic_input_ctls(codec,
1562 &spec->autocfg)) < 0)
1565 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
1566 if (spec->multiout.max_channels > 2)
1567 spec->surr_switch = 1;
1569 if (spec->autocfg.dig_out_pin)
1570 spec->multiout.dig_out_nid = dig_out;
1571 if (spec->autocfg.dig_in_pin)
1572 spec->dig_in_nid = dig_in;
1574 if (spec->kctl_alloc)
1575 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
1577 spec->input_mux = &spec->private_imux;
1578 spec->dinput_mux = &spec->private_dimux;
1583 /* add playback controls for HP output */
1584 static int stac9200_auto_create_hp_ctls(struct hda_codec *codec,
1585 struct auto_pin_cfg *cfg)
1587 struct sigmatel_spec *spec = codec->spec;
1588 hda_nid_t pin = cfg->hp_pins[0];
1589 unsigned int wid_caps;
1594 wid_caps = get_wcaps(codec, pin);
1595 if (wid_caps & AC_WCAP_UNSOL_CAP)
1596 spec->hp_detect = 1;
1601 /* add playback controls for LFE output */
1602 static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec,
1603 struct auto_pin_cfg *cfg)
1605 struct sigmatel_spec *spec = codec->spec;
1607 hda_nid_t lfe_pin = 0x0;
1611 * search speaker outs and line outs for a mono speaker pin
1612 * with an amp. If one is found, add LFE controls
1615 for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) {
1616 hda_nid_t pin = spec->autocfg.speaker_pins[i];
1617 unsigned long wcaps = get_wcaps(codec, pin);
1618 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
1619 if (wcaps == AC_WCAP_OUT_AMP)
1620 /* found a mono speaker with an amp, must be lfe */
1624 /* if speaker_outs is 0, then speakers may be in line_outs */
1625 if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) {
1626 for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) {
1627 hda_nid_t pin = spec->autocfg.line_out_pins[i];
1629 cfg = snd_hda_codec_read(codec, pin, 0,
1630 AC_VERB_GET_CONFIG_DEFAULT,
1632 if (get_defcfg_device(cfg) == AC_JACK_SPEAKER) {
1633 unsigned long wcaps = get_wcaps(codec, pin);
1634 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
1635 if (wcaps == AC_WCAP_OUT_AMP)
1636 /* found a mono speaker with an amp,
1644 err = create_controls(spec, "LFE", lfe_pin, 1);
1652 static int stac9200_parse_auto_config(struct hda_codec *codec)
1654 struct sigmatel_spec *spec = codec->spec;
1657 if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0)
1660 if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0)
1663 if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0)
1666 if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0)
1669 if (spec->autocfg.dig_out_pin)
1670 spec->multiout.dig_out_nid = 0x05;
1671 if (spec->autocfg.dig_in_pin)
1672 spec->dig_in_nid = 0x04;
1674 if (spec->kctl_alloc)
1675 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
1677 spec->input_mux = &spec->private_imux;
1678 spec->dinput_mux = &spec->private_dimux;
1684 * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
1685 * funky external mute control using GPIO pins.
1688 static void stac922x_gpio_mute(struct hda_codec *codec, int pin, int muted)
1690 unsigned int gpiostate, gpiomask, gpiodir;
1692 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
1693 AC_VERB_GET_GPIO_DATA, 0);
1696 gpiostate |= (1 << pin);
1698 gpiostate &= ~(1 << pin);
1700 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
1701 AC_VERB_GET_GPIO_MASK, 0);
1702 gpiomask |= (1 << pin);
1704 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
1705 AC_VERB_GET_GPIO_DIRECTION, 0);
1706 gpiodir |= (1 << pin);
1708 /* AppleHDA seems to do this -- WTF is this verb?? */
1709 snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0);
1711 snd_hda_codec_write(codec, codec->afg, 0,
1712 AC_VERB_SET_GPIO_MASK, gpiomask);
1713 snd_hda_codec_write(codec, codec->afg, 0,
1714 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
1718 snd_hda_codec_write(codec, codec->afg, 0,
1719 AC_VERB_SET_GPIO_DATA, gpiostate);
1722 static void enable_pin_detect(struct hda_codec *codec, hda_nid_t nid,
1725 if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)
1726 snd_hda_codec_write(codec, nid, 0,
1727 AC_VERB_SET_UNSOLICITED_ENABLE,
1728 (AC_USRSP_EN | event));
1731 static int stac92xx_init(struct hda_codec *codec)
1733 struct sigmatel_spec *spec = codec->spec;
1734 struct auto_pin_cfg *cfg = &spec->autocfg;
1737 snd_hda_sequence_write(codec, spec->init);
1740 if (spec->hp_detect) {
1741 /* Enable unsolicited responses on the HP widget */
1742 for (i = 0; i < cfg->hp_outs; i++)
1743 enable_pin_detect(codec, cfg->hp_pins[i],
1745 /* force to enable the first line-out; the others are set up
1748 stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0],
1750 stac92xx_auto_init_hp_out(codec);
1751 /* fake event to set up pins */
1752 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
1754 stac92xx_auto_init_multi_out(codec);
1755 stac92xx_auto_init_hp_out(codec);
1757 for (i = 0; i < AUTO_PIN_LAST; i++) {
1758 hda_nid_t nid = cfg->input_pins[i];
1760 unsigned int pinctl = AC_PINCTL_IN_EN;
1761 if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC)
1762 pinctl |= stac92xx_get_vref(codec, nid);
1763 stac92xx_auto_set_pinctl(codec, nid, pinctl);
1766 if (spec->num_dmics > 0)
1767 for (i = 0; i < spec->num_dmics; i++)
1768 stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i],
1771 if (cfg->dig_out_pin)
1772 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin,
1774 if (cfg->dig_in_pin)
1775 stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin,
1778 if (spec->gpio_mute) {
1779 stac922x_gpio_mute(codec, 0, 0);
1780 stac922x_gpio_mute(codec, 1, 0);
1786 static void stac92xx_free(struct hda_codec *codec)
1788 struct sigmatel_spec *spec = codec->spec;
1794 if (spec->kctl_alloc) {
1795 for (i = 0; i < spec->num_kctl_used; i++)
1796 kfree(spec->kctl_alloc[i].name);
1797 kfree(spec->kctl_alloc);
1800 if (spec->bios_pin_configs)
1801 kfree(spec->bios_pin_configs);
1806 static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid,
1809 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
1810 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
1812 if (pin_ctl & AC_PINCTL_IN_EN) {
1814 * we need to check the current set-up direction of
1815 * shared input pins since they can be switched via
1816 * "xxx as Output" mixer switch
1818 struct sigmatel_spec *spec = codec->spec;
1819 struct auto_pin_cfg *cfg = &spec->autocfg;
1820 if ((nid == cfg->input_pins[AUTO_PIN_LINE] &&
1821 spec->line_switch) ||
1822 (nid == cfg->input_pins[AUTO_PIN_MIC] &&
1827 /* if setting pin direction bits, clear the current
1828 direction bits first */
1829 if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN))
1830 pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN);
1832 snd_hda_codec_write(codec, nid, 0,
1833 AC_VERB_SET_PIN_WIDGET_CONTROL,
1837 static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
1840 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
1841 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
1842 snd_hda_codec_write(codec, nid, 0,
1843 AC_VERB_SET_PIN_WIDGET_CONTROL,
1847 static int get_pin_presence(struct hda_codec *codec, hda_nid_t nid)
1851 if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0x00)
1857 static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res)
1859 struct sigmatel_spec *spec = codec->spec;
1860 struct auto_pin_cfg *cfg = &spec->autocfg;
1864 for (i = 0; i < cfg->hp_outs; i++) {
1865 presence = get_pin_presence(codec, cfg->hp_pins[i]);
1871 /* disable lineouts, enable hp */
1872 for (i = 0; i < cfg->line_outs; i++)
1873 stac92xx_reset_pinctl(codec, cfg->line_out_pins[i],
1875 for (i = 0; i < cfg->speaker_outs; i++)
1876 stac92xx_reset_pinctl(codec, cfg->speaker_pins[i],
1879 /* enable lineouts, disable hp */
1880 for (i = 0; i < cfg->line_outs; i++)
1881 stac92xx_set_pinctl(codec, cfg->line_out_pins[i],
1883 for (i = 0; i < cfg->speaker_outs; i++)
1884 stac92xx_set_pinctl(codec, cfg->speaker_pins[i],
1889 static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
1891 switch (res >> 26) {
1893 stac92xx_hp_detect(codec, res);
1899 static int stac92xx_resume(struct hda_codec *codec)
1901 struct sigmatel_spec *spec = codec->spec;
1904 stac92xx_init(codec);
1905 stac92xx_set_config_regs(codec);
1906 snd_hda_resume_ctls(codec, spec->mixer);
1907 for (i = 0; i < spec->num_mixers; i++)
1908 snd_hda_resume_ctls(codec, spec->mixers[i]);
1909 if (spec->multiout.dig_out_nid)
1910 snd_hda_resume_spdif_out(codec);
1911 if (spec->dig_in_nid)
1912 snd_hda_resume_spdif_in(codec);
1918 static struct hda_codec_ops stac92xx_patch_ops = {
1919 .build_controls = stac92xx_build_controls,
1920 .build_pcms = stac92xx_build_pcms,
1921 .init = stac92xx_init,
1922 .free = stac92xx_free,
1923 .unsol_event = stac92xx_unsol_event,
1925 .resume = stac92xx_resume,
1929 static int patch_stac9200(struct hda_codec *codec)
1931 struct sigmatel_spec *spec;
1934 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1940 spec->pin_nids = stac9200_pin_nids;
1941 spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
1944 if (spec->board_config < 0) {
1945 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n");
1946 err = stac92xx_save_bios_config_regs(codec);
1948 stac92xx_free(codec);
1951 spec->pin_configs = spec->bios_pin_configs;
1953 spec->pin_configs = stac9200_brd_tbl[spec->board_config];
1954 stac92xx_set_config_regs(codec);
1957 spec->multiout.max_channels = 2;
1958 spec->multiout.num_dacs = 1;
1959 spec->multiout.dac_nids = stac9200_dac_nids;
1960 spec->adc_nids = stac9200_adc_nids;
1961 spec->mux_nids = stac9200_mux_nids;
1962 spec->num_muxes = 1;
1963 spec->num_dmics = 0;
1965 spec->init = stac9200_core_init;
1966 spec->mixer = stac9200_mixer;
1968 err = stac9200_parse_auto_config(codec);
1970 stac92xx_free(codec);
1974 codec->patch_ops = stac92xx_patch_ops;
1979 static int patch_stac925x(struct hda_codec *codec)
1981 struct sigmatel_spec *spec;
1984 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1990 spec->pin_nids = stac925x_pin_nids;
1991 spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS,
1995 if (spec->board_config < 0) {
1996 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x,"
1997 "using BIOS defaults\n");
1998 err = stac92xx_save_bios_config_regs(codec);
2000 stac92xx_free(codec);
2003 spec->pin_configs = spec->bios_pin_configs;
2004 } else if (stac925x_brd_tbl[spec->board_config] != NULL){
2005 spec->pin_configs = stac925x_brd_tbl[spec->board_config];
2006 stac92xx_set_config_regs(codec);
2009 spec->multiout.max_channels = 2;
2010 spec->multiout.num_dacs = 1;
2011 spec->multiout.dac_nids = stac925x_dac_nids;
2012 spec->adc_nids = stac925x_adc_nids;
2013 spec->mux_nids = stac925x_mux_nids;
2014 spec->num_muxes = 1;
2015 switch (codec->vendor_id) {
2016 case 0x83847632: /* STAC9202 */
2017 case 0x83847633: /* STAC9202D */
2018 case 0x83847636: /* STAC9251 */
2019 case 0x83847637: /* STAC9251D */
2020 spec->num_dmics = 1;
2021 spec->dmic_nids = stac925x_dmic_nids;
2024 spec->num_dmics = 0;
2028 spec->init = stac925x_core_init;
2029 spec->mixer = stac925x_mixer;
2031 err = stac92xx_parse_auto_config(codec, 0x8, 0x7);
2033 if (spec->board_config < 0) {
2034 printk(KERN_WARNING "hda_codec: No auto-config is "
2035 "available, default to model=ref\n");
2036 spec->board_config = STAC_925x_REF;
2042 stac92xx_free(codec);
2046 codec->patch_ops = stac92xx_patch_ops;
2051 static int patch_stac922x(struct hda_codec *codec)
2053 struct sigmatel_spec *spec;
2056 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
2061 spec->num_pins = 10;
2062 spec->pin_nids = stac922x_pin_nids;
2063 spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
2066 if (spec->board_config == STAC_INTEL_MAC_V3) {
2067 spec->gpio_mute = 1;
2068 /* Intel Macs have all same PCI SSID, so we need to check
2069 * codec SSID to distinguish the exact models
2071 printk(KERN_INFO "hda_codec: STAC922x, Apple subsys_id=%x\n", codec->subsystem_id);
2072 switch (codec->subsystem_id) {
2075 spec->board_config = STAC_INTEL_MAC_V1;
2079 spec->board_config = STAC_INTEL_MAC_V2;
2087 spec->board_config = STAC_INTEL_MAC_V3;
2091 spec->board_config = STAC_INTEL_MAC_V4;
2095 spec->board_config = STAC_INTEL_MAC_V5;
2101 if (spec->board_config < 0) {
2102 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, "
2103 "using BIOS defaults\n");
2104 err = stac92xx_save_bios_config_regs(codec);
2106 stac92xx_free(codec);
2109 spec->pin_configs = spec->bios_pin_configs;
2110 } else if (stac922x_brd_tbl[spec->board_config] != NULL) {
2111 spec->pin_configs = stac922x_brd_tbl[spec->board_config];
2112 stac92xx_set_config_regs(codec);
2115 spec->adc_nids = stac922x_adc_nids;
2116 spec->mux_nids = stac922x_mux_nids;
2117 spec->num_muxes = ARRAY_SIZE(stac922x_mux_nids);
2118 spec->num_dmics = 0;
2120 spec->init = stac922x_core_init;
2121 spec->mixer = stac922x_mixer;
2123 spec->multiout.dac_nids = spec->dac_nids;
2125 err = stac92xx_parse_auto_config(codec, 0x08, 0x09);
2127 if (spec->board_config < 0) {
2128 printk(KERN_WARNING "hda_codec: No auto-config is "
2129 "available, default to model=ref\n");
2130 spec->board_config = STAC_D945_REF;
2136 stac92xx_free(codec);
2140 codec->patch_ops = stac92xx_patch_ops;
2142 /* Fix Mux capture level; max to 2 */
2143 snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
2144 (0 << AC_AMPCAP_OFFSET_SHIFT) |
2145 (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
2146 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2147 (0 << AC_AMPCAP_MUTE_SHIFT));
2152 static int patch_stac927x(struct hda_codec *codec)
2154 struct sigmatel_spec *spec;
2157 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
2162 spec->num_pins = 14;
2163 spec->pin_nids = stac927x_pin_nids;
2164 spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS,
2168 if (spec->board_config < 0) {
2169 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC927x, using BIOS defaults\n");
2170 err = stac92xx_save_bios_config_regs(codec);
2172 stac92xx_free(codec);
2175 spec->pin_configs = spec->bios_pin_configs;
2176 } else if (stac927x_brd_tbl[spec->board_config] != NULL) {
2177 spec->pin_configs = stac927x_brd_tbl[spec->board_config];
2178 stac92xx_set_config_regs(codec);
2181 switch (spec->board_config) {
2183 spec->adc_nids = stac927x_adc_nids;
2184 spec->mux_nids = stac927x_mux_nids;
2185 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
2186 spec->num_dmics = 0;
2187 spec->init = d965_core_init;
2188 spec->mixer = stac9227_mixer;
2191 spec->adc_nids = stac927x_adc_nids;
2192 spec->mux_nids = stac927x_mux_nids;
2193 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
2194 spec->num_dmics = 0;
2195 spec->init = d965_core_init;
2196 spec->mixer = stac9227_mixer;
2199 spec->adc_nids = stac927x_adc_nids;
2200 spec->mux_nids = stac927x_mux_nids;
2201 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
2202 spec->num_dmics = 0;
2203 spec->init = stac927x_core_init;
2204 spec->mixer = stac927x_mixer;
2207 spec->multiout.dac_nids = spec->dac_nids;
2209 err = stac92xx_parse_auto_config(codec, 0x1e, 0x20);
2211 if (spec->board_config < 0) {
2212 printk(KERN_WARNING "hda_codec: No auto-config is "
2213 "available, default to model=ref\n");
2214 spec->board_config = STAC_D965_REF;
2220 stac92xx_free(codec);
2224 codec->patch_ops = stac92xx_patch_ops;
2226 /* Fix Mux capture level; max to 2 */
2227 snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
2228 (0 << AC_AMPCAP_OFFSET_SHIFT) |
2229 (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
2230 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2231 (0 << AC_AMPCAP_MUTE_SHIFT));
2236 static int patch_stac9205(struct hda_codec *codec)
2238 struct sigmatel_spec *spec;
2241 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
2246 spec->num_pins = 14;
2247 spec->pin_nids = stac9205_pin_nids;
2248 spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS,
2252 if (spec->board_config < 0) {
2253 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n");
2254 err = stac92xx_save_bios_config_regs(codec);
2256 stac92xx_free(codec);
2259 spec->pin_configs = spec->bios_pin_configs;
2261 spec->pin_configs = stac9205_brd_tbl[spec->board_config];
2262 stac92xx_set_config_regs(codec);
2265 spec->adc_nids = stac9205_adc_nids;
2266 spec->mux_nids = stac9205_mux_nids;
2267 spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids);
2268 spec->dmic_nids = stac9205_dmic_nids;
2269 spec->num_dmics = ARRAY_SIZE(stac9205_dmic_nids);
2270 spec->dmux_nid = 0x1d;
2272 spec->init = stac9205_core_init;
2273 spec->mixer = stac9205_mixer;
2275 spec->multiout.dac_nids = spec->dac_nids;
2277 /* Configure GPIO0 as EAPD output */
2278 snd_hda_codec_write(codec, codec->afg, 0,
2279 AC_VERB_SET_GPIO_DIRECTION, 0x00000001);
2280 /* Configure GPIO0 as CMOS */
2281 snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0x00000000);
2282 /* Assert GPIO0 high */
2283 snd_hda_codec_write(codec, codec->afg, 0,
2284 AC_VERB_SET_GPIO_DATA, 0x00000001);
2286 snd_hda_codec_write(codec, codec->afg, 0,
2287 AC_VERB_SET_GPIO_MASK, 0x00000001);
2289 err = stac92xx_parse_auto_config(codec, 0x1f, 0x20);
2291 if (spec->board_config < 0) {
2292 printk(KERN_WARNING "hda_codec: No auto-config is "
2293 "available, default to model=ref\n");
2294 spec->board_config = STAC_9205_REF;
2300 stac92xx_free(codec);
2304 codec->patch_ops = stac92xx_patch_ops;
2313 /* static config for Sony VAIO FE550G and Sony VAIO AR */
2314 static hda_nid_t vaio_dacs[] = { 0x2 };
2315 #define VAIO_HP_DAC 0x5
2316 static hda_nid_t vaio_adcs[] = { 0x8 /*,0x6*/ };
2317 static hda_nid_t vaio_mux_nids[] = { 0x15 };
2319 static struct hda_input_mux vaio_mux = {
2322 /* { "HP", 0x0 }, */
2329 static struct hda_verb vaio_init[] = {
2330 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
2331 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
2332 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
2333 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
2334 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */
2335 {0x15, AC_VERB_SET_CONNECT_SEL, 0x2}, /* mic-sel: 0a,0d,14,02 */
2336 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */
2337 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */
2338 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
2339 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
2340 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
2344 static struct hda_verb vaio_ar_init[] = {
2345 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
2346 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
2347 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
2348 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
2349 /* {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },*/ /* Optical Out */
2350 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */
2351 {0x15, AC_VERB_SET_CONNECT_SEL, 0x2}, /* mic-sel: 0a,0d,14,02 */
2352 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */
2353 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */
2354 /* {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},*/ /* Optical Out */
2355 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
2356 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
2357 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
2361 /* bind volumes of both NID 0x02 and 0x05 */
2362 static int vaio_master_vol_put(struct snd_kcontrol *kcontrol,
2363 struct snd_ctl_elem_value *ucontrol)
2365 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2366 long *valp = ucontrol->value.integer.value;
2369 change = snd_hda_codec_amp_update(codec, 0x02, 0, HDA_OUTPUT, 0,
2370 0x7f, valp[0] & 0x7f);
2371 change |= snd_hda_codec_amp_update(codec, 0x02, 1, HDA_OUTPUT, 0,
2372 0x7f, valp[1] & 0x7f);
2373 snd_hda_codec_amp_update(codec, 0x05, 0, HDA_OUTPUT, 0,
2374 0x7f, valp[0] & 0x7f);
2375 snd_hda_codec_amp_update(codec, 0x05, 1, HDA_OUTPUT, 0,
2376 0x7f, valp[1] & 0x7f);
2380 /* bind volumes of both NID 0x02 and 0x05 */
2381 static int vaio_master_sw_put(struct snd_kcontrol *kcontrol,
2382 struct snd_ctl_elem_value *ucontrol)
2384 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2385 long *valp = ucontrol->value.integer.value;
2388 change = snd_hda_codec_amp_update(codec, 0x02, 0, HDA_OUTPUT, 0,
2389 0x80, (valp[0] ? 0 : 0x80));
2390 change |= snd_hda_codec_amp_update(codec, 0x02, 1, HDA_OUTPUT, 0,
2391 0x80, (valp[1] ? 0 : 0x80));
2392 snd_hda_codec_amp_update(codec, 0x05, 0, HDA_OUTPUT, 0,
2393 0x80, (valp[0] ? 0 : 0x80));
2394 snd_hda_codec_amp_update(codec, 0x05, 1, HDA_OUTPUT, 0,
2395 0x80, (valp[1] ? 0 : 0x80));
2399 static struct snd_kcontrol_new vaio_mixer[] = {
2401 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2402 .name = "Master Playback Volume",
2403 .info = snd_hda_mixer_amp_volume_info,
2404 .get = snd_hda_mixer_amp_volume_get,
2405 .put = vaio_master_vol_put,
2406 .tlv = { .c = snd_hda_mixer_amp_tlv },
2407 .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
2410 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2411 .name = "Master Playback Switch",
2412 .info = snd_hda_mixer_amp_switch_info,
2413 .get = snd_hda_mixer_amp_switch_get,
2414 .put = vaio_master_sw_put,
2415 .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
2417 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
2418 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
2419 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
2421 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2422 .name = "Capture Source",
2424 .info = stac92xx_mux_enum_info,
2425 .get = stac92xx_mux_enum_get,
2426 .put = stac92xx_mux_enum_put,
2431 static struct snd_kcontrol_new vaio_ar_mixer[] = {
2433 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2434 .name = "Master Playback Volume",
2435 .info = snd_hda_mixer_amp_volume_info,
2436 .get = snd_hda_mixer_amp_volume_get,
2437 .put = vaio_master_vol_put,
2438 .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
2441 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2442 .name = "Master Playback Switch",
2443 .info = snd_hda_mixer_amp_switch_info,
2444 .get = snd_hda_mixer_amp_switch_get,
2445 .put = vaio_master_sw_put,
2446 .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
2448 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
2449 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
2450 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
2451 /*HDA_CODEC_MUTE("Optical Out Switch", 0x10, 0, HDA_OUTPUT),
2452 HDA_CODEC_VOLUME("Optical Out Volume", 0x10, 0, HDA_OUTPUT),*/
2454 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2455 .name = "Capture Source",
2457 .info = stac92xx_mux_enum_info,
2458 .get = stac92xx_mux_enum_get,
2459 .put = stac92xx_mux_enum_put,
2464 static struct hda_codec_ops stac9872_patch_ops = {
2465 .build_controls = stac92xx_build_controls,
2466 .build_pcms = stac92xx_build_pcms,
2467 .init = stac92xx_init,
2468 .free = stac92xx_free,
2470 .resume = stac92xx_resume,
2474 enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */
2476 /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */
2478 /* Unknown. id=0x83847661 and subsys=0x104D1200. */
2480 /* AR Series. id=0x83847664 and subsys=104D1300 */
2485 static const char *stac9872_models[STAC_9872_MODELS] = {
2486 [CXD9872RD_VAIO] = "vaio",
2487 [CXD9872AKD_VAIO] = "vaio-ar",
2490 static struct snd_pci_quirk stac9872_cfg_tbl[] = {
2491 SND_PCI_QUIRK(0x104d, 0x81e6, "Sony VAIO F/S", CXD9872RD_VAIO),
2492 SND_PCI_QUIRK(0x104d, 0x81ef, "Sony VAIO F/S", CXD9872RD_VAIO),
2493 SND_PCI_QUIRK(0x104d, 0x81fd, "Sony VAIO AR", CXD9872AKD_VAIO),
2494 SND_PCI_QUIRK(0x104d, 0x8205, "Sony VAIO AR", CXD9872AKD_VAIO),
2498 static int patch_stac9872(struct hda_codec *codec)
2500 struct sigmatel_spec *spec;
2503 board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS,
2506 if (board_config < 0)
2507 /* unknown config, let generic-parser do its job... */
2508 return snd_hda_parse_generic_codec(codec);
2510 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
2515 switch (board_config) {
2516 case CXD9872RD_VAIO:
2517 case STAC9872AK_VAIO:
2518 case STAC9872K_VAIO:
2519 spec->mixer = vaio_mixer;
2520 spec->init = vaio_init;
2521 spec->multiout.max_channels = 2;
2522 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs);
2523 spec->multiout.dac_nids = vaio_dacs;
2524 spec->multiout.hp_nid = VAIO_HP_DAC;
2525 spec->num_adcs = ARRAY_SIZE(vaio_adcs);
2526 spec->adc_nids = vaio_adcs;
2527 spec->input_mux = &vaio_mux;
2528 spec->mux_nids = vaio_mux_nids;
2531 case CXD9872AKD_VAIO:
2532 spec->mixer = vaio_ar_mixer;
2533 spec->init = vaio_ar_init;
2534 spec->multiout.max_channels = 2;
2535 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs);
2536 spec->multiout.dac_nids = vaio_dacs;
2537 spec->multiout.hp_nid = VAIO_HP_DAC;
2538 spec->num_adcs = ARRAY_SIZE(vaio_adcs);
2539 spec->adc_nids = vaio_adcs;
2540 spec->input_mux = &vaio_mux;
2541 spec->mux_nids = vaio_mux_nids;
2545 codec->patch_ops = stac9872_patch_ops;
2553 struct hda_codec_preset snd_hda_preset_sigmatel[] = {
2554 { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 },
2555 { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x },
2556 { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x },
2557 { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x },
2558 { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x },
2559 { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x },
2560 { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x },
2561 { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x },
2562 { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x },
2563 { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x },
2564 { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x },
2565 { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x },
2566 { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x },
2567 { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x },
2568 { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x },
2569 { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x },
2570 { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x },
2571 { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x },
2572 { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x },
2573 { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x },
2574 { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x },
2575 { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x },
2576 { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x },
2577 { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x },
2578 { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x },
2579 { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x },
2580 { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x },
2581 { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x },
2582 { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x },
2583 /* The following does not take into account .id=0x83847661 when subsys =
2584 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
2585 * currently not fully supported.
2587 { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 },
2588 { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 },
2589 { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 },
2590 { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 },
2591 { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 },
2592 { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 },
2593 { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 },
2594 { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 },
2595 { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 },
2596 { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 },
2597 { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 },