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
77 struct sigmatel_spec
{
78 struct snd_kcontrol_new
*mixers
[4];
79 unsigned int num_mixers
;
82 unsigned int surr_switch
: 1;
83 unsigned int line_switch
: 1;
84 unsigned int mic_switch
: 1;
85 unsigned int alt_switch
: 1;
86 unsigned int hp_detect
: 1;
87 unsigned int gpio_mute
: 1;
90 struct hda_multi_out multiout
;
91 hda_nid_t dac_nids
[5];
95 unsigned int num_adcs
;
97 unsigned int num_muxes
;
99 unsigned int num_dmics
;
101 hda_nid_t dig_in_nid
;
105 unsigned int num_pins
;
106 unsigned int *pin_configs
;
107 unsigned int *bios_pin_configs
;
109 /* codec specific stuff */
110 struct hda_verb
*init
;
111 struct snd_kcontrol_new
*mixer
;
114 struct hda_input_mux
*dinput_mux
;
115 unsigned int cur_dmux
;
116 struct hda_input_mux
*input_mux
;
117 unsigned int cur_mux
[3];
120 unsigned int io_switch
[2];
122 struct hda_pcm pcm_rec
[2]; /* PCM information */
124 /* dynamic controls and input_mux */
125 struct auto_pin_cfg autocfg
;
126 unsigned int num_kctl_alloc
, num_kctl_used
;
127 struct snd_kcontrol_new
*kctl_alloc
;
128 struct hda_input_mux private_dimux
;
129 struct hda_input_mux private_imux
;
132 static hda_nid_t stac9200_adc_nids
[1] = {
136 static hda_nid_t stac9200_mux_nids
[1] = {
140 static hda_nid_t stac9200_dac_nids
[1] = {
144 static hda_nid_t stac925x_adc_nids
[1] = {
148 static hda_nid_t stac925x_mux_nids
[1] = {
152 static hda_nid_t stac925x_dac_nids
[1] = {
156 static hda_nid_t stac925x_dmic_nids
[1] = {
160 static hda_nid_t stac922x_adc_nids
[2] = {
164 static hda_nid_t stac922x_mux_nids
[2] = {
168 static hda_nid_t stac927x_adc_nids
[3] = {
172 static hda_nid_t stac927x_mux_nids
[3] = {
176 static hda_nid_t stac9205_adc_nids
[2] = {
180 static hda_nid_t stac9205_mux_nids
[2] = {
184 static hda_nid_t stac9205_dmic_nids
[2] = {
188 static hda_nid_t stac9200_pin_nids
[8] = {
189 0x08, 0x09, 0x0d, 0x0e,
190 0x0f, 0x10, 0x11, 0x12,
193 static hda_nid_t stac925x_pin_nids
[8] = {
194 0x07, 0x08, 0x0a, 0x0b,
195 0x0c, 0x0d, 0x10, 0x11,
198 static hda_nid_t stac922x_pin_nids
[10] = {
199 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
200 0x0f, 0x10, 0x11, 0x15, 0x1b,
203 static hda_nid_t stac927x_pin_nids
[14] = {
204 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
205 0x0f, 0x10, 0x11, 0x12, 0x13,
206 0x14, 0x21, 0x22, 0x23,
209 static hda_nid_t stac9205_pin_nids
[12] = {
210 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
211 0x0f, 0x14, 0x16, 0x17, 0x18,
216 static int stac92xx_dmux_enum_info(struct snd_kcontrol
*kcontrol
,
217 struct snd_ctl_elem_info
*uinfo
)
219 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
220 struct sigmatel_spec
*spec
= codec
->spec
;
221 return snd_hda_input_mux_info(spec
->dinput_mux
, uinfo
);
224 static int stac92xx_dmux_enum_get(struct snd_kcontrol
*kcontrol
,
225 struct snd_ctl_elem_value
*ucontrol
)
227 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
228 struct sigmatel_spec
*spec
= codec
->spec
;
230 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_dmux
;
234 static int stac92xx_dmux_enum_put(struct snd_kcontrol
*kcontrol
,
235 struct snd_ctl_elem_value
*ucontrol
)
237 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
238 struct sigmatel_spec
*spec
= codec
->spec
;
240 return snd_hda_input_mux_put(codec
, spec
->dinput_mux
, ucontrol
,
241 spec
->dmux_nid
, &spec
->cur_dmux
);
244 static int stac92xx_mux_enum_info(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_info
*uinfo
)
246 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
247 struct sigmatel_spec
*spec
= codec
->spec
;
248 return snd_hda_input_mux_info(spec
->input_mux
, uinfo
);
251 static int stac92xx_mux_enum_get(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
253 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
254 struct sigmatel_spec
*spec
= codec
->spec
;
255 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
257 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mux
[adc_idx
];
261 static int stac92xx_mux_enum_put(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
263 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
264 struct sigmatel_spec
*spec
= codec
->spec
;
265 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
267 return snd_hda_input_mux_put(codec
, spec
->input_mux
, ucontrol
,
268 spec
->mux_nids
[adc_idx
], &spec
->cur_mux
[adc_idx
]);
271 static struct hda_verb stac9200_core_init
[] = {
272 /* set dac0mux for dac converter */
273 { 0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
277 static struct hda_verb stac925x_core_init
[] = {
278 /* set dac0mux for dac converter */
279 { 0x06, AC_VERB_SET_CONNECT_SEL
, 0x00},
283 static struct hda_verb stac922x_core_init
[] = {
284 /* set master volume and direct control */
285 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
289 static struct hda_verb d965_core_init
[] = {
290 /* set master volume and direct control */
291 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
292 /* unmute node 0x1b */
293 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
294 /* select node 0x03 as DAC */
295 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x01},
299 static struct hda_verb stac927x_core_init
[] = {
300 /* set master volume and direct control */
301 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
305 static struct hda_verb stac9205_core_init
[] = {
306 /* set master volume and direct control */
307 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
311 static struct snd_kcontrol_new stac9200_mixer
[] = {
312 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT
),
313 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT
),
315 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
316 .name
= "Input Source",
318 .info
= stac92xx_mux_enum_info
,
319 .get
= stac92xx_mux_enum_get
,
320 .put
= stac92xx_mux_enum_put
,
322 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT
),
323 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT
),
324 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0c, 0, HDA_OUTPUT
),
328 static struct snd_kcontrol_new stac925x_mixer
[] = {
329 HDA_CODEC_VOLUME("Master Playback Volume", 0xe, 0, HDA_OUTPUT
),
330 HDA_CODEC_MUTE("Master Playback Switch", 0xe, 0, HDA_OUTPUT
),
332 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
333 .name
= "Input Source",
335 .info
= stac92xx_mux_enum_info
,
336 .get
= stac92xx_mux_enum_get
,
337 .put
= stac92xx_mux_enum_put
,
339 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT
),
340 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_OUTPUT
),
341 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0f, 0, HDA_OUTPUT
),
345 /* This needs to be generated dynamically based on sequence */
346 static struct snd_kcontrol_new stac922x_mixer
[] = {
348 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
349 .name
= "Input Source",
351 .info
= stac92xx_mux_enum_info
,
352 .get
= stac92xx_mux_enum_get
,
353 .put
= stac92xx_mux_enum_put
,
355 HDA_CODEC_VOLUME("Capture Volume", 0x17, 0x0, HDA_INPUT
),
356 HDA_CODEC_MUTE("Capture Switch", 0x17, 0x0, HDA_INPUT
),
357 HDA_CODEC_VOLUME("Mux Capture Volume", 0x12, 0x0, HDA_OUTPUT
),
361 /* This needs to be generated dynamically based on sequence */
362 static struct snd_kcontrol_new stac9227_mixer
[] = {
364 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
365 .name
= "Input Source",
367 .info
= stac92xx_mux_enum_info
,
368 .get
= stac92xx_mux_enum_get
,
369 .put
= stac92xx_mux_enum_put
,
371 HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT
),
372 HDA_CODEC_MUTE("Capture Switch", 0x1b, 0x0, HDA_OUTPUT
),
376 static struct snd_kcontrol_new stac927x_mixer
[] = {
378 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
379 .name
= "Input Source",
381 .info
= stac92xx_mux_enum_info
,
382 .get
= stac92xx_mux_enum_get
,
383 .put
= stac92xx_mux_enum_put
,
385 HDA_CODEC_VOLUME("InMux Capture Volume", 0x15, 0x0, HDA_OUTPUT
),
386 HDA_CODEC_VOLUME("InVol Capture Volume", 0x18, 0x0, HDA_INPUT
),
387 HDA_CODEC_MUTE("ADCMux Capture Switch", 0x1b, 0x0, HDA_OUTPUT
),
391 static struct snd_kcontrol_new stac9205_mixer
[] = {
393 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
394 .name
= "Digital Input Source",
396 .info
= stac92xx_dmux_enum_info
,
397 .get
= stac92xx_dmux_enum_get
,
398 .put
= stac92xx_dmux_enum_put
,
401 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
402 .name
= "Input Source",
404 .info
= stac92xx_mux_enum_info
,
405 .get
= stac92xx_mux_enum_get
,
406 .put
= stac92xx_mux_enum_put
,
408 HDA_CODEC_VOLUME("InMux Capture Volume", 0x19, 0x0, HDA_OUTPUT
),
409 HDA_CODEC_VOLUME("InVol Capture Volume", 0x1b, 0x0, HDA_INPUT
),
410 HDA_CODEC_MUTE("ADCMux Capture Switch", 0x1d, 0x0, HDA_OUTPUT
),
414 static int stac92xx_build_controls(struct hda_codec
*codec
)
416 struct sigmatel_spec
*spec
= codec
->spec
;
420 err
= snd_hda_add_new_ctls(codec
, spec
->mixer
);
424 for (i
= 0; i
< spec
->num_mixers
; i
++) {
425 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
430 if (spec
->multiout
.dig_out_nid
) {
431 err
= snd_hda_create_spdif_out_ctls(codec
, spec
->multiout
.dig_out_nid
);
435 if (spec
->dig_in_nid
) {
436 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
443 static unsigned int ref9200_pin_configs
[8] = {
444 0x01c47010, 0x01447010, 0x0221401f, 0x01114010,
445 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
448 static unsigned int *stac9200_brd_tbl
[STAC_9200_MODELS
] = {
449 [STAC_REF
] = ref9200_pin_configs
,
452 static const char *stac9200_models
[STAC_9200_MODELS
] = {
456 static struct snd_pci_quirk stac9200_cfg_tbl
[] = {
457 /* SigmaTel reference board */
458 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
459 "DFI LanParty", STAC_REF
),
460 /* Dell laptops have BIOS problem */
461 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01b5,
462 "Dell Inspiron 630m", STAC_REF
),
463 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c2,
464 "Dell Latitude D620", STAC_REF
),
465 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cb,
466 "Dell Latitude 120L", STAC_REF
),
467 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cc,
468 "Dell Latitude D820", STAC_REF
),
469 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cd,
470 "Dell Inspiron E1705/9400", STAC_REF
),
471 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ce,
472 "Dell XPS M1710", STAC_REF
),
473 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cf,
474 "Dell Precision M90", STAC_REF
),
475 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d6,
476 "unknown Dell", STAC_REF
),
477 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d8,
478 "Dell Inspiron 640m", STAC_REF
),
479 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f5,
480 "Dell Inspiron 1501", STAC_REF
),
483 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_REF
),
488 static unsigned int ref925x_pin_configs
[8] = {
489 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
490 0x90a70320, 0x02214210, 0x400003f1, 0x9033032e,
493 static unsigned int stac925x_MA6_pin_configs
[8] = {
494 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
495 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e,
498 static unsigned int stac925x_PA6_pin_configs
[8] = {
499 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
500 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e,
503 static unsigned int stac925xM2_2_pin_configs
[8] = {
504 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020,
505 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e,
508 static unsigned int *stac925x_brd_tbl
[STAC_925x_MODELS
] = {
509 [STAC_REF
] = ref925x_pin_configs
,
510 [STAC_M2_2
] = stac925xM2_2_pin_configs
,
511 [STAC_MA6
] = stac925x_MA6_pin_configs
,
512 [STAC_PA6
] = stac925x_PA6_pin_configs
,
515 static const char *stac925x_models
[STAC_925x_MODELS
] = {
517 [STAC_M2_2
] = "m2-2",
522 static struct snd_pci_quirk stac925x_cfg_tbl
[] = {
523 /* SigmaTel reference board */
524 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668, "DFI LanParty", STAC_REF
),
525 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF
),
526 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF
),
527 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF
),
528 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6
),
529 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6
),
530 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2
),
534 static unsigned int ref922x_pin_configs
[10] = {
535 0x01014010, 0x01016011, 0x01012012, 0x0221401f,
536 0x01813122, 0x01011014, 0x01441030, 0x01c41030,
537 0x40000100, 0x40000100,
540 static unsigned int d945gtp3_pin_configs
[10] = {
541 0x0221401f, 0x01a19022, 0x01813021, 0x01014010,
542 0x40000100, 0x40000100, 0x40000100, 0x40000100,
543 0x02a19120, 0x40000100,
546 static unsigned int d945gtp5_pin_configs
[10] = {
547 0x0221401f, 0x01011012, 0x01813024, 0x01014010,
548 0x01a19021, 0x01016011, 0x01452130, 0x40000100,
549 0x02a19320, 0x40000100,
552 static unsigned int macbook_pro_v1_pin_configs
[10] = {
553 0x0321e230, 0x03a1e020, 0x9017e110, 0x01014010,
554 0x01a19021, 0x0381e021, 0x1345e240, 0x13c5e22e,
555 0x02a19320, 0x400000fb
558 static unsigned int macbook_pro_v2_pin_configs
[10] = {
559 0x0221401f, 0x90a70120, 0x01813024, 0x01014010,
560 0x400000fd, 0x01016011, 0x1345e240, 0x13c5e22e,
561 0x400000fc, 0x400000fb,
564 static unsigned int imac_intel_pin_configs
[10] = {
565 0x0121e230, 0x90a70120, 0x9017e110, 0x400000fe,
566 0x400000fd, 0x0181e021, 0x1145e040, 0x400000fa,
567 0x400000fc, 0x400000fb,
570 static unsigned int *stac922x_brd_tbl
[STAC_922X_MODELS
] = {
571 [STAC_D945_REF
] = ref922x_pin_configs
,
572 [STAC_D945GTP3
] = d945gtp3_pin_configs
,
573 [STAC_D945GTP5
] = d945gtp5_pin_configs
,
574 [STAC_MACMINI
] = macbook_pro_v1_pin_configs
,
575 [STAC_MACBOOK
] = macbook_pro_v1_pin_configs
,
576 [STAC_MACBOOK_PRO_V1
] = macbook_pro_v1_pin_configs
,
577 [STAC_MACBOOK_PRO_V2
] = macbook_pro_v2_pin_configs
,
578 [STAC_IMAC_INTEL
] = imac_intel_pin_configs
,
581 static const char *stac922x_models
[STAC_922X_MODELS
] = {
582 [STAC_D945_REF
] = "ref",
583 [STAC_D945GTP5
] = "5stack",
584 [STAC_D945GTP3
] = "3stack",
585 [STAC_MACMINI
] = "macmini",
586 [STAC_MACBOOK
] = "macbook",
587 [STAC_MACBOOK_PRO_V1
] = "macbook-pro-v1",
588 [STAC_MACBOOK_PRO_V2
] = "macbook-pro",
589 [STAC_IMAC_INTEL
] = "imac-intel",
592 static struct snd_pci_quirk stac922x_cfg_tbl
[] = {
593 /* SigmaTel reference board */
594 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
595 "DFI LanParty", STAC_D945_REF
),
596 /* Intel 945G based systems */
597 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0101,
598 "Intel D945G", STAC_D945GTP3
),
599 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0202,
600 "Intel D945G", STAC_D945GTP3
),
601 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0606,
602 "Intel D945G", STAC_D945GTP3
),
603 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0601,
604 "Intel D945G", STAC_D945GTP3
),
605 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0111,
606 "Intel D945G", STAC_D945GTP3
),
607 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1115,
608 "Intel D945G", STAC_D945GTP3
),
609 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1116,
610 "Intel D945G", STAC_D945GTP3
),
611 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1117,
612 "Intel D945G", STAC_D945GTP3
),
613 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1118,
614 "Intel D945G", STAC_D945GTP3
),
615 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1119,
616 "Intel D945G", STAC_D945GTP3
),
617 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x8826,
618 "Intel D945G", STAC_D945GTP3
),
619 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5049,
620 "Intel D945G", STAC_D945GTP3
),
621 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5055,
622 "Intel D945G", STAC_D945GTP3
),
623 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5048,
624 "Intel D945G", STAC_D945GTP3
),
625 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0110,
626 "Intel D945G", STAC_D945GTP3
),
627 /* Intel D945G 5-stack systems */
628 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0404,
629 "Intel D945G", STAC_D945GTP5
),
630 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0303,
631 "Intel D945G", STAC_D945GTP5
),
632 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0013,
633 "Intel D945G", STAC_D945GTP5
),
634 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0417,
635 "Intel D945G", STAC_D945GTP5
),
636 /* Intel 945P based systems */
637 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0b0b,
638 "Intel D945P", STAC_D945GTP3
),
639 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0112,
640 "Intel D945P", STAC_D945GTP3
),
641 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0d0d,
642 "Intel D945P", STAC_D945GTP3
),
643 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0909,
644 "Intel D945P", STAC_D945GTP3
),
645 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0505,
646 "Intel D945P", STAC_D945GTP3
),
647 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0707,
648 "Intel D945P", STAC_D945GTP5
),
650 /* Apple Mac Mini (early 2006) */
651 SND_PCI_QUIRK(0x8384, 0x7680,
652 "Mac Mini", STAC_MACMINI
),
656 static unsigned int ref927x_pin_configs
[14] = {
657 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
658 0x01a19040, 0x01011012, 0x01016011, 0x0101201f,
659 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070,
660 0x01c42190, 0x40000100,
663 static unsigned int d965_3st_pin_configs
[14] = {
664 0x0221401f, 0x02a19120, 0x40000100, 0x01014011,
665 0x01a19021, 0x01813024, 0x40000100, 0x40000100,
666 0x40000100, 0x40000100, 0x40000100, 0x40000100,
667 0x40000100, 0x40000100
670 static unsigned int d965_5st_pin_configs
[14] = {
671 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
672 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
673 0x40000100, 0x40000100, 0x40000100, 0x01442070,
674 0x40000100, 0x40000100
677 static unsigned int *stac927x_brd_tbl
[STAC_927X_MODELS
] = {
678 [STAC_D965_REF
] = ref927x_pin_configs
,
679 [STAC_D965_3ST
] = d965_3st_pin_configs
,
680 [STAC_D965_5ST
] = d965_5st_pin_configs
,
683 static const char *stac927x_models
[STAC_927X_MODELS
] = {
684 [STAC_D965_REF
] = "ref",
685 [STAC_D965_3ST
] = "3stack",
686 [STAC_D965_5ST
] = "5stack",
689 static struct snd_pci_quirk stac927x_cfg_tbl
[] = {
690 /* SigmaTel reference board */
691 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
692 "DFI LanParty", STAC_D965_REF
),
693 /* Intel 946 based systems */
694 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x3d01, "Intel D946", STAC_D965_3ST
),
695 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0xa301, "Intel D946", STAC_D965_3ST
),
696 /* 965 based 3 stack systems */
697 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2116, "Intel D965", STAC_D965_3ST
),
698 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2115, "Intel D965", STAC_D965_3ST
),
699 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2114, "Intel D965", STAC_D965_3ST
),
700 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2113, "Intel D965", STAC_D965_3ST
),
701 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2112, "Intel D965", STAC_D965_3ST
),
702 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2111, "Intel D965", STAC_D965_3ST
),
703 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2110, "Intel D965", STAC_D965_3ST
),
704 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2009, "Intel D965", STAC_D965_3ST
),
705 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2008, "Intel D965", STAC_D965_3ST
),
706 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2007, "Intel D965", STAC_D965_3ST
),
707 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2006, "Intel D965", STAC_D965_3ST
),
708 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2005, "Intel D965", STAC_D965_3ST
),
709 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2004, "Intel D965", STAC_D965_3ST
),
710 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2003, "Intel D965", STAC_D965_3ST
),
711 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2002, "Intel D965", STAC_D965_3ST
),
712 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2001, "Intel D965", STAC_D965_3ST
),
713 /* 965 based 5 stack systems */
714 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2301, "Intel D965", STAC_D965_5ST
),
715 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2302, "Intel D965", STAC_D965_5ST
),
716 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2303, "Intel D965", STAC_D965_5ST
),
717 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2304, "Intel D965", STAC_D965_5ST
),
718 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2305, "Intel D965", STAC_D965_5ST
),
719 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2501, "Intel D965", STAC_D965_5ST
),
720 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2502, "Intel D965", STAC_D965_5ST
),
721 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2503, "Intel D965", STAC_D965_5ST
),
722 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2504, "Intel D965", STAC_D965_5ST
),
726 static unsigned int ref9205_pin_configs
[12] = {
727 0x40000100, 0x40000100, 0x01016011, 0x01014010,
728 0x01813122, 0x01a19021, 0x40000100, 0x40000100,
729 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030
732 static unsigned int *stac9205_brd_tbl
[STAC_9205_MODELS
] = {
736 static const char *stac9205_models
[STAC_9205_MODELS
] = {
737 [STAC_9205_REF
] = "ref",
740 static struct snd_pci_quirk stac9205_cfg_tbl
[] = {
741 /* SigmaTel reference board */
742 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
743 "DFI LanParty", STAC_9205_REF
),
747 static int stac92xx_save_bios_config_regs(struct hda_codec
*codec
)
750 struct sigmatel_spec
*spec
= codec
->spec
;
752 if (! spec
->bios_pin_configs
) {
753 spec
->bios_pin_configs
= kcalloc(spec
->num_pins
,
754 sizeof(*spec
->bios_pin_configs
), GFP_KERNEL
);
755 if (! spec
->bios_pin_configs
)
759 for (i
= 0; i
< spec
->num_pins
; i
++) {
760 hda_nid_t nid
= spec
->pin_nids
[i
];
761 unsigned int pin_cfg
;
763 pin_cfg
= snd_hda_codec_read(codec
, nid
, 0,
764 AC_VERB_GET_CONFIG_DEFAULT
, 0x00);
765 snd_printdd(KERN_INFO
"hda_codec: pin nid %2.2x bios pin config %8.8x\n",
767 spec
->bios_pin_configs
[i
] = pin_cfg
;
773 static void stac92xx_set_config_regs(struct hda_codec
*codec
)
776 struct sigmatel_spec
*spec
= codec
->spec
;
777 unsigned int pin_cfg
;
779 if (! spec
->pin_nids
|| ! spec
->pin_configs
)
782 for (i
= 0; i
< spec
->num_pins
; i
++) {
783 snd_hda_codec_write(codec
, spec
->pin_nids
[i
], 0,
784 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0
,
785 spec
->pin_configs
[i
] & 0x000000ff);
786 snd_hda_codec_write(codec
, spec
->pin_nids
[i
], 0,
787 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1
,
788 (spec
->pin_configs
[i
] & 0x0000ff00) >> 8);
789 snd_hda_codec_write(codec
, spec
->pin_nids
[i
], 0,
790 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2
,
791 (spec
->pin_configs
[i
] & 0x00ff0000) >> 16);
792 snd_hda_codec_write(codec
, spec
->pin_nids
[i
], 0,
793 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3
,
794 spec
->pin_configs
[i
] >> 24);
795 pin_cfg
= snd_hda_codec_read(codec
, spec
->pin_nids
[i
], 0,
796 AC_VERB_GET_CONFIG_DEFAULT
,
798 snd_printdd(KERN_INFO
"hda_codec: pin nid %2.2x pin config %8.8x\n", spec
->pin_nids
[i
], pin_cfg
);
803 * Analog playback callbacks
805 static int stac92xx_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
806 struct hda_codec
*codec
,
807 struct snd_pcm_substream
*substream
)
809 struct sigmatel_spec
*spec
= codec
->spec
;
810 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
);
813 static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
814 struct hda_codec
*codec
,
815 unsigned int stream_tag
,
817 struct snd_pcm_substream
*substream
)
819 struct sigmatel_spec
*spec
= codec
->spec
;
820 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
, stream_tag
, format
, substream
);
823 static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
824 struct hda_codec
*codec
,
825 struct snd_pcm_substream
*substream
)
827 struct sigmatel_spec
*spec
= codec
->spec
;
828 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
832 * Digital playback callbacks
834 static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
835 struct hda_codec
*codec
,
836 struct snd_pcm_substream
*substream
)
838 struct sigmatel_spec
*spec
= codec
->spec
;
839 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
842 static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
843 struct hda_codec
*codec
,
844 struct snd_pcm_substream
*substream
)
846 struct sigmatel_spec
*spec
= codec
->spec
;
847 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
850 static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
851 struct hda_codec
*codec
,
852 unsigned int stream_tag
,
854 struct snd_pcm_substream
*substream
)
856 struct sigmatel_spec
*spec
= codec
->spec
;
857 return snd_hda_multi_out_dig_prepare(codec
, &spec
->multiout
,
858 stream_tag
, format
, substream
);
863 * Analog capture callbacks
865 static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
866 struct hda_codec
*codec
,
867 unsigned int stream_tag
,
869 struct snd_pcm_substream
*substream
)
871 struct sigmatel_spec
*spec
= codec
->spec
;
873 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
],
874 stream_tag
, 0, format
);
878 static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
879 struct hda_codec
*codec
,
880 struct snd_pcm_substream
*substream
)
882 struct sigmatel_spec
*spec
= codec
->spec
;
884 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
], 0, 0, 0);
888 static struct hda_pcm_stream stac92xx_pcm_digital_playback
= {
892 /* NID is set in stac92xx_build_pcms */
894 .open
= stac92xx_dig_playback_pcm_open
,
895 .close
= stac92xx_dig_playback_pcm_close
,
896 .prepare
= stac92xx_dig_playback_pcm_prepare
900 static struct hda_pcm_stream stac92xx_pcm_digital_capture
= {
904 /* NID is set in stac92xx_build_pcms */
907 static struct hda_pcm_stream stac92xx_pcm_analog_playback
= {
911 .nid
= 0x02, /* NID to query formats and rates */
913 .open
= stac92xx_playback_pcm_open
,
914 .prepare
= stac92xx_playback_pcm_prepare
,
915 .cleanup
= stac92xx_playback_pcm_cleanup
919 static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback
= {
923 .nid
= 0x06, /* NID to query formats and rates */
925 .open
= stac92xx_playback_pcm_open
,
926 .prepare
= stac92xx_playback_pcm_prepare
,
927 .cleanup
= stac92xx_playback_pcm_cleanup
931 static struct hda_pcm_stream stac92xx_pcm_analog_capture
= {
935 /* NID is set in stac92xx_build_pcms */
937 .prepare
= stac92xx_capture_pcm_prepare
,
938 .cleanup
= stac92xx_capture_pcm_cleanup
942 static int stac92xx_build_pcms(struct hda_codec
*codec
)
944 struct sigmatel_spec
*spec
= codec
->spec
;
945 struct hda_pcm
*info
= spec
->pcm_rec
;
948 codec
->pcm_info
= info
;
950 info
->name
= "STAC92xx Analog";
951 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = stac92xx_pcm_analog_playback
;
952 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = stac92xx_pcm_analog_capture
;
953 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
955 if (spec
->alt_switch
) {
958 info
->name
= "STAC92xx Analog Alt";
959 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = stac92xx_pcm_analog_alt_playback
;
962 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
965 info
->name
= "STAC92xx Digital";
966 if (spec
->multiout
.dig_out_nid
) {
967 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = stac92xx_pcm_digital_playback
;
968 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
970 if (spec
->dig_in_nid
) {
971 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = stac92xx_pcm_digital_capture
;
972 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
979 static unsigned int stac92xx_get_vref(struct hda_codec
*codec
, hda_nid_t nid
)
981 unsigned int pincap
= snd_hda_param_read(codec
, nid
,
983 pincap
= (pincap
& AC_PINCAP_VREF
) >> AC_PINCAP_VREF_SHIFT
;
984 if (pincap
& AC_PINCAP_VREF_100
)
985 return AC_PINCTL_VREF_100
;
986 if (pincap
& AC_PINCAP_VREF_80
)
987 return AC_PINCTL_VREF_80
;
988 if (pincap
& AC_PINCAP_VREF_50
)
989 return AC_PINCTL_VREF_50
;
990 if (pincap
& AC_PINCAP_VREF_GRD
)
991 return AC_PINCTL_VREF_GRD
;
995 static void stac92xx_auto_set_pinctl(struct hda_codec
*codec
, hda_nid_t nid
, int pin_type
)
998 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
, pin_type
);
1001 static int stac92xx_io_switch_info(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_info
*uinfo
)
1003 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_BOOLEAN
;
1005 uinfo
->value
.integer
.min
= 0;
1006 uinfo
->value
.integer
.max
= 1;
1010 static int stac92xx_io_switch_get(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
1012 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
1013 struct sigmatel_spec
*spec
= codec
->spec
;
1014 int io_idx
= kcontrol
-> private_value
& 0xff;
1016 ucontrol
->value
.integer
.value
[0] = spec
->io_switch
[io_idx
];
1020 static int stac92xx_io_switch_put(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
1022 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
1023 struct sigmatel_spec
*spec
= codec
->spec
;
1024 hda_nid_t nid
= kcontrol
->private_value
>> 8;
1025 int io_idx
= kcontrol
-> private_value
& 0xff;
1026 unsigned short val
= ucontrol
->value
.integer
.value
[0];
1028 spec
->io_switch
[io_idx
] = val
;
1031 stac92xx_auto_set_pinctl(codec
, nid
, AC_PINCTL_OUT_EN
);
1033 unsigned int pinctl
= AC_PINCTL_IN_EN
;
1034 if (io_idx
) /* set VREF for mic */
1035 pinctl
|= stac92xx_get_vref(codec
, nid
);
1036 stac92xx_auto_set_pinctl(codec
, nid
, pinctl
);
1041 #define STAC_CODEC_IO_SWITCH(xname, xpval) \
1042 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1045 .info = stac92xx_io_switch_info, \
1046 .get = stac92xx_io_switch_get, \
1047 .put = stac92xx_io_switch_put, \
1048 .private_value = xpval, \
1053 STAC_CTL_WIDGET_VOL
,
1054 STAC_CTL_WIDGET_MUTE
,
1055 STAC_CTL_WIDGET_IO_SWITCH
,
1058 static struct snd_kcontrol_new stac92xx_control_templates
[] = {
1059 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
1060 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
1061 STAC_CODEC_IO_SWITCH(NULL
, 0),
1064 /* add dynamic controls */
1065 static int stac92xx_add_control(struct sigmatel_spec
*spec
, int type
, const char *name
, unsigned long val
)
1067 struct snd_kcontrol_new
*knew
;
1069 if (spec
->num_kctl_used
>= spec
->num_kctl_alloc
) {
1070 int num
= spec
->num_kctl_alloc
+ NUM_CONTROL_ALLOC
;
1072 knew
= kcalloc(num
+ 1, sizeof(*knew
), GFP_KERNEL
); /* array + terminator */
1075 if (spec
->kctl_alloc
) {
1076 memcpy(knew
, spec
->kctl_alloc
, sizeof(*knew
) * spec
->num_kctl_alloc
);
1077 kfree(spec
->kctl_alloc
);
1079 spec
->kctl_alloc
= knew
;
1080 spec
->num_kctl_alloc
= num
;
1083 knew
= &spec
->kctl_alloc
[spec
->num_kctl_used
];
1084 *knew
= stac92xx_control_templates
[type
];
1085 knew
->name
= kstrdup(name
, GFP_KERNEL
);
1088 knew
->private_value
= val
;
1089 spec
->num_kctl_used
++;
1093 /* flag inputs as additional dynamic lineouts */
1094 static int stac92xx_add_dyn_out_pins(struct hda_codec
*codec
, struct auto_pin_cfg
*cfg
)
1096 struct sigmatel_spec
*spec
= codec
->spec
;
1097 unsigned int wcaps
, wtype
;
1098 int i
, num_dacs
= 0;
1100 /* use the wcaps cache to count all DACs available for line-outs */
1101 for (i
= 0; i
< codec
->num_nodes
; i
++) {
1102 wcaps
= codec
->wcaps
[i
];
1103 wtype
= (wcaps
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
1104 if (wtype
== AC_WID_AUD_OUT
&& !(wcaps
& AC_WCAP_DIGITAL
))
1108 snd_printdd("%s: total dac count=%d\n", __func__
, num_dacs
);
1110 switch (cfg
->line_outs
) {
1112 /* add line-in as side */
1113 if (cfg
->input_pins
[AUTO_PIN_LINE
] && num_dacs
> 3) {
1114 cfg
->line_out_pins
[3] = cfg
->input_pins
[AUTO_PIN_LINE
];
1115 spec
->line_switch
= 1;
1120 /* add line-in as clfe and mic as side */
1121 if (cfg
->input_pins
[AUTO_PIN_LINE
] && num_dacs
> 2) {
1122 cfg
->line_out_pins
[2] = cfg
->input_pins
[AUTO_PIN_LINE
];
1123 spec
->line_switch
= 1;
1126 if (cfg
->input_pins
[AUTO_PIN_MIC
] && num_dacs
> 3) {
1127 cfg
->line_out_pins
[3] = cfg
->input_pins
[AUTO_PIN_MIC
];
1128 spec
->mic_switch
= 1;
1133 /* add line-in as surr and mic as clfe */
1134 if (cfg
->input_pins
[AUTO_PIN_LINE
] && num_dacs
> 1) {
1135 cfg
->line_out_pins
[1] = cfg
->input_pins
[AUTO_PIN_LINE
];
1136 spec
->line_switch
= 1;
1139 if (cfg
->input_pins
[AUTO_PIN_MIC
] && num_dacs
> 2) {
1140 cfg
->line_out_pins
[2] = cfg
->input_pins
[AUTO_PIN_MIC
];
1141 spec
->mic_switch
= 1;
1151 static int is_in_dac_nids(struct sigmatel_spec
*spec
, hda_nid_t nid
)
1155 for (i
= 0; i
< spec
->multiout
.num_dacs
; i
++) {
1156 if (spec
->multiout
.dac_nids
[i
] == nid
)
1164 * Fill in the dac_nids table from the parsed pin configuration
1165 * This function only works when every pin in line_out_pins[]
1166 * contains atleast one DAC in its connection list. Some 92xx
1167 * codecs are not connected directly to a DAC, such as the 9200
1168 * and 9202/925x. For those, dac_nids[] must be hard-coded.
1170 static int stac92xx_auto_fill_dac_nids(struct hda_codec
*codec
,
1171 const struct auto_pin_cfg
*cfg
)
1173 struct sigmatel_spec
*spec
= codec
->spec
;
1174 int i
, j
, conn_len
= 0;
1175 hda_nid_t nid
, conn
[HDA_MAX_CONNECTIONS
];
1176 unsigned int wcaps
, wtype
;
1178 for (i
= 0; i
< cfg
->line_outs
; i
++) {
1179 nid
= cfg
->line_out_pins
[i
];
1180 conn_len
= snd_hda_get_connections(codec
, nid
, conn
,
1181 HDA_MAX_CONNECTIONS
);
1182 for (j
= 0; j
< conn_len
; j
++) {
1183 wcaps
= snd_hda_param_read(codec
, conn
[j
],
1184 AC_PAR_AUDIO_WIDGET_CAP
);
1185 wtype
= (wcaps
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
1187 if (wtype
!= AC_WID_AUD_OUT
||
1188 (wcaps
& AC_WCAP_DIGITAL
))
1190 /* conn[j] is a DAC routed to this line-out */
1191 if (!is_in_dac_nids(spec
, conn
[j
]))
1195 if (j
== conn_len
) {
1196 /* error out, no available DAC found */
1198 "%s: No available DAC for pin 0x%x\n",
1203 spec
->multiout
.dac_nids
[i
] = conn
[j
];
1204 spec
->multiout
.num_dacs
++;
1206 /* select this DAC in the pin's input mux */
1207 snd_hda_codec_write(codec
, nid
, 0,
1208 AC_VERB_SET_CONNECT_SEL
, j
);
1213 snd_printd("dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
1214 spec
->multiout
.num_dacs
,
1215 spec
->multiout
.dac_nids
[0],
1216 spec
->multiout
.dac_nids
[1],
1217 spec
->multiout
.dac_nids
[2],
1218 spec
->multiout
.dac_nids
[3],
1219 spec
->multiout
.dac_nids
[4]);
1223 /* create volume control/switch for the given prefx type */
1224 static int create_controls(struct sigmatel_spec
*spec
, const char *pfx
, hda_nid_t nid
, int chs
)
1229 sprintf(name
, "%s Playback Volume", pfx
);
1230 err
= stac92xx_add_control(spec
, STAC_CTL_WIDGET_VOL
, name
,
1231 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_OUTPUT
));
1234 sprintf(name
, "%s Playback Switch", pfx
);
1235 err
= stac92xx_add_control(spec
, STAC_CTL_WIDGET_MUTE
, name
,
1236 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_OUTPUT
));
1242 /* add playback controls from the parsed DAC table */
1243 static int stac92xx_auto_create_multi_out_ctls(struct sigmatel_spec
*spec
,
1244 const struct auto_pin_cfg
*cfg
)
1246 static const char *chname
[4] = {
1247 "Front", "Surround", NULL
/*CLFE*/, "Side"
1252 for (i
= 0; i
< cfg
->line_outs
; i
++) {
1253 if (!spec
->multiout
.dac_nids
[i
])
1256 nid
= spec
->multiout
.dac_nids
[i
];
1260 err
= create_controls(spec
, "Center", nid
, 1);
1263 err
= create_controls(spec
, "LFE", nid
, 2);
1267 err
= create_controls(spec
, chname
[i
], nid
, 3);
1273 if (spec
->line_switch
)
1274 if ((err
= stac92xx_add_control(spec
, STAC_CTL_WIDGET_IO_SWITCH
, "Line In as Output Switch", cfg
->input_pins
[AUTO_PIN_LINE
] << 8)) < 0)
1277 if (spec
->mic_switch
)
1278 if ((err
= stac92xx_add_control(spec
, STAC_CTL_WIDGET_IO_SWITCH
, "Mic as Output Switch", (cfg
->input_pins
[AUTO_PIN_MIC
] << 8) | 1)) < 0)
1284 static int check_in_dac_nids(struct sigmatel_spec
*spec
, hda_nid_t nid
)
1286 if (is_in_dac_nids(spec
, nid
))
1288 if (spec
->multiout
.hp_nid
== nid
)
1293 static int add_spec_dacs(struct sigmatel_spec
*spec
, hda_nid_t nid
)
1295 if (!spec
->multiout
.hp_nid
)
1296 spec
->multiout
.hp_nid
= nid
;
1297 else if (spec
->multiout
.num_dacs
> 4) {
1298 printk(KERN_WARNING
"stac92xx: No space for DAC 0x%x\n", nid
);
1301 spec
->multiout
.dac_nids
[spec
->multiout
.num_dacs
] = nid
;
1302 spec
->multiout
.num_dacs
++;
1307 /* add playback controls for Speaker and HP outputs */
1308 static int stac92xx_auto_create_hp_ctls(struct hda_codec
*codec
,
1309 struct auto_pin_cfg
*cfg
)
1311 struct sigmatel_spec
*spec
= codec
->spec
;
1313 int i
, old_num_dacs
, err
;
1315 old_num_dacs
= spec
->multiout
.num_dacs
;
1316 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
1317 unsigned int wid_caps
= get_wcaps(codec
, cfg
->hp_pins
[i
]);
1318 if (wid_caps
& AC_WCAP_UNSOL_CAP
)
1319 spec
->hp_detect
= 1;
1320 nid
= snd_hda_codec_read(codec
, cfg
->hp_pins
[i
], 0,
1321 AC_VERB_GET_CONNECT_LIST
, 0) & 0xff;
1322 if (check_in_dac_nids(spec
, nid
))
1326 add_spec_dacs(spec
, nid
);
1328 for (i
= 0; i
< cfg
->speaker_outs
; i
++) {
1329 nid
= snd_hda_codec_read(codec
, cfg
->speaker_pins
[i
], 0,
1330 AC_VERB_GET_CONNECT_LIST
, 0) & 0xff;
1331 if (check_in_dac_nids(spec
, nid
))
1335 add_spec_dacs(spec
, nid
);
1338 for (i
= old_num_dacs
; i
< spec
->multiout
.num_dacs
; i
++) {
1339 static const char *pfxs
[] = {
1340 "Speaker", "External Speaker", "Speaker2",
1342 err
= create_controls(spec
, pfxs
[i
- old_num_dacs
],
1343 spec
->multiout
.dac_nids
[i
], 3);
1347 if (spec
->multiout
.hp_nid
) {
1349 if (old_num_dacs
== spec
->multiout
.num_dacs
)
1353 err
= create_controls(spec
, pfx
, spec
->multiout
.hp_nid
, 3);
1361 /* labels for dmic mux inputs */
1362 static const char *stac92xx_dmic_labels
[5] = {
1363 "Analog Inputs", "Digital Mic 1", "Digital Mic 2",
1364 "Digital Mic 3", "Digital Mic 4"
1367 /* create playback/capture controls for input pins on dmic capable codecs */
1368 static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec
*codec
,
1369 const struct auto_pin_cfg
*cfg
)
1371 struct sigmatel_spec
*spec
= codec
->spec
;
1372 struct hda_input_mux
*dimux
= &spec
->private_dimux
;
1373 hda_nid_t con_lst
[HDA_MAX_NUM_INPUTS
];
1376 dimux
->items
[dimux
->num_items
].label
= stac92xx_dmic_labels
[0];
1377 dimux
->items
[dimux
->num_items
].index
= 0;
1380 for (i
= 0; i
< spec
->num_dmics
; i
++) {
1383 unsigned int def_conf
;
1385 def_conf
= snd_hda_codec_read(codec
,
1388 AC_VERB_GET_CONFIG_DEFAULT
,
1390 if (get_defcfg_connect(def_conf
) == AC_JACK_PORT_NONE
)
1393 num_cons
= snd_hda_get_connections(codec
,
1396 HDA_MAX_NUM_INPUTS
);
1397 for (j
= 0; j
< num_cons
; j
++)
1398 if (con_lst
[j
] == spec
->dmic_nids
[i
]) {
1404 dimux
->items
[dimux
->num_items
].label
=
1405 stac92xx_dmic_labels
[dimux
->num_items
];
1406 dimux
->items
[dimux
->num_items
].index
= index
;
1413 /* create playback/capture controls for input pins */
1414 static int stac92xx_auto_create_analog_input_ctls(struct hda_codec
*codec
, const struct auto_pin_cfg
*cfg
)
1416 struct sigmatel_spec
*spec
= codec
->spec
;
1417 struct hda_input_mux
*imux
= &spec
->private_imux
;
1418 hda_nid_t con_lst
[HDA_MAX_NUM_INPUTS
];
1421 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
1424 if (!cfg
->input_pins
[i
])
1427 for (j
= 0; j
< spec
->num_muxes
; j
++) {
1429 num_cons
= snd_hda_get_connections(codec
,
1432 HDA_MAX_NUM_INPUTS
);
1433 for (k
= 0; k
< num_cons
; k
++)
1434 if (con_lst
[k
] == cfg
->input_pins
[i
]) {
1441 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
1442 imux
->items
[imux
->num_items
].index
= index
;
1446 if (imux
->num_items
) {
1448 * Set the current input for the muxes.
1449 * The STAC9221 has two input muxes with identical source
1450 * NID lists. Hopefully this won't get confused.
1452 for (i
= 0; i
< spec
->num_muxes
; i
++) {
1453 snd_hda_codec_write(codec
, spec
->mux_nids
[i
], 0,
1454 AC_VERB_SET_CONNECT_SEL
,
1455 imux
->items
[0].index
);
1462 static void stac92xx_auto_init_multi_out(struct hda_codec
*codec
)
1464 struct sigmatel_spec
*spec
= codec
->spec
;
1467 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
1468 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
1469 stac92xx_auto_set_pinctl(codec
, nid
, AC_PINCTL_OUT_EN
);
1473 static void stac92xx_auto_init_hp_out(struct hda_codec
*codec
)
1475 struct sigmatel_spec
*spec
= codec
->spec
;
1478 for (i
= 0; i
< spec
->autocfg
.hp_outs
; i
++) {
1480 pin
= spec
->autocfg
.hp_pins
[i
];
1481 if (pin
) /* connect to front */
1482 stac92xx_auto_set_pinctl(codec
, pin
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
);
1484 for (i
= 0; i
< spec
->autocfg
.speaker_outs
; i
++) {
1486 pin
= spec
->autocfg
.speaker_pins
[i
];
1487 if (pin
) /* connect to front */
1488 stac92xx_auto_set_pinctl(codec
, pin
, AC_PINCTL_OUT_EN
);
1492 static int stac92xx_parse_auto_config(struct hda_codec
*codec
, hda_nid_t dig_out
, hda_nid_t dig_in
)
1494 struct sigmatel_spec
*spec
= codec
->spec
;
1497 if ((err
= snd_hda_parse_pin_def_config(codec
,
1499 spec
->dmic_nids
)) < 0)
1501 if (! spec
->autocfg
.line_outs
)
1502 return 0; /* can't find valid pin config */
1504 if ((err
= stac92xx_add_dyn_out_pins(codec
, &spec
->autocfg
)) < 0)
1506 if (spec
->multiout
.num_dacs
== 0)
1507 if ((err
= stac92xx_auto_fill_dac_nids(codec
, &spec
->autocfg
)) < 0)
1510 if ((err
= stac92xx_auto_create_multi_out_ctls(spec
, &spec
->autocfg
)) < 0 ||
1511 (err
= stac92xx_auto_create_hp_ctls(codec
, &spec
->autocfg
)) < 0 ||
1512 (err
= stac92xx_auto_create_analog_input_ctls(codec
, &spec
->autocfg
)) < 0)
1515 if (spec
->num_dmics
> 0)
1516 if ((err
= stac92xx_auto_create_dmic_input_ctls(codec
,
1517 &spec
->autocfg
)) < 0)
1520 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
1521 if (spec
->multiout
.max_channels
> 2)
1522 spec
->surr_switch
= 1;
1524 if (spec
->autocfg
.dig_out_pin
)
1525 spec
->multiout
.dig_out_nid
= dig_out
;
1526 if (spec
->autocfg
.dig_in_pin
)
1527 spec
->dig_in_nid
= dig_in
;
1529 if (spec
->kctl_alloc
)
1530 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
1532 spec
->input_mux
= &spec
->private_imux
;
1533 spec
->dinput_mux
= &spec
->private_dimux
;
1538 /* add playback controls for HP output */
1539 static int stac9200_auto_create_hp_ctls(struct hda_codec
*codec
,
1540 struct auto_pin_cfg
*cfg
)
1542 struct sigmatel_spec
*spec
= codec
->spec
;
1543 hda_nid_t pin
= cfg
->hp_pins
[0];
1544 unsigned int wid_caps
;
1549 wid_caps
= get_wcaps(codec
, pin
);
1550 if (wid_caps
& AC_WCAP_UNSOL_CAP
)
1551 spec
->hp_detect
= 1;
1556 /* add playback controls for LFE output */
1557 static int stac9200_auto_create_lfe_ctls(struct hda_codec
*codec
,
1558 struct auto_pin_cfg
*cfg
)
1560 struct sigmatel_spec
*spec
= codec
->spec
;
1562 hda_nid_t lfe_pin
= 0x0;
1566 * search speaker outs and line outs for a mono speaker pin
1567 * with an amp. If one is found, add LFE controls
1570 for (i
= 0; i
< spec
->autocfg
.speaker_outs
&& lfe_pin
== 0x0; i
++) {
1571 hda_nid_t pin
= spec
->autocfg
.speaker_pins
[i
];
1572 unsigned long wcaps
= get_wcaps(codec
, pin
);
1573 wcaps
&= (AC_WCAP_STEREO
| AC_WCAP_OUT_AMP
);
1574 if (wcaps
== AC_WCAP_OUT_AMP
)
1575 /* found a mono speaker with an amp, must be lfe */
1579 /* if speaker_outs is 0, then speakers may be in line_outs */
1580 if (lfe_pin
== 0 && spec
->autocfg
.speaker_outs
== 0) {
1581 for (i
= 0; i
< spec
->autocfg
.line_outs
&& lfe_pin
== 0x0; i
++) {
1582 hda_nid_t pin
= spec
->autocfg
.line_out_pins
[i
];
1584 cfg
= snd_hda_codec_read(codec
, pin
, 0,
1585 AC_VERB_GET_CONFIG_DEFAULT
,
1587 if (get_defcfg_device(cfg
) == AC_JACK_SPEAKER
) {
1588 unsigned long wcaps
= get_wcaps(codec
, pin
);
1589 wcaps
&= (AC_WCAP_STEREO
| AC_WCAP_OUT_AMP
);
1590 if (wcaps
== AC_WCAP_OUT_AMP
)
1591 /* found a mono speaker with an amp,
1599 err
= create_controls(spec
, "LFE", lfe_pin
, 1);
1607 static int stac9200_parse_auto_config(struct hda_codec
*codec
)
1609 struct sigmatel_spec
*spec
= codec
->spec
;
1612 if ((err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
, NULL
)) < 0)
1615 if ((err
= stac92xx_auto_create_analog_input_ctls(codec
, &spec
->autocfg
)) < 0)
1618 if ((err
= stac9200_auto_create_hp_ctls(codec
, &spec
->autocfg
)) < 0)
1621 if ((err
= stac9200_auto_create_lfe_ctls(codec
, &spec
->autocfg
)) < 0)
1624 if (spec
->autocfg
.dig_out_pin
)
1625 spec
->multiout
.dig_out_nid
= 0x05;
1626 if (spec
->autocfg
.dig_in_pin
)
1627 spec
->dig_in_nid
= 0x04;
1629 if (spec
->kctl_alloc
)
1630 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
1632 spec
->input_mux
= &spec
->private_imux
;
1633 spec
->dinput_mux
= &spec
->private_dimux
;
1639 * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
1640 * funky external mute control using GPIO pins.
1643 static void stac922x_gpio_mute(struct hda_codec
*codec
, int pin
, int muted
)
1645 unsigned int gpiostate
, gpiomask
, gpiodir
;
1647 gpiostate
= snd_hda_codec_read(codec
, codec
->afg
, 0,
1648 AC_VERB_GET_GPIO_DATA
, 0);
1651 gpiostate
|= (1 << pin
);
1653 gpiostate
&= ~(1 << pin
);
1655 gpiomask
= snd_hda_codec_read(codec
, codec
->afg
, 0,
1656 AC_VERB_GET_GPIO_MASK
, 0);
1657 gpiomask
|= (1 << pin
);
1659 gpiodir
= snd_hda_codec_read(codec
, codec
->afg
, 0,
1660 AC_VERB_GET_GPIO_DIRECTION
, 0);
1661 gpiodir
|= (1 << pin
);
1663 /* AppleHDA seems to do this -- WTF is this verb?? */
1664 snd_hda_codec_write(codec
, codec
->afg
, 0, 0x7e7, 0);
1666 snd_hda_codec_write(codec
, codec
->afg
, 0,
1667 AC_VERB_SET_GPIO_MASK
, gpiomask
);
1668 snd_hda_codec_write(codec
, codec
->afg
, 0,
1669 AC_VERB_SET_GPIO_DIRECTION
, gpiodir
);
1673 snd_hda_codec_write(codec
, codec
->afg
, 0,
1674 AC_VERB_SET_GPIO_DATA
, gpiostate
);
1677 static void enable_pin_detect(struct hda_codec
*codec
, hda_nid_t nid
,
1680 if (get_wcaps(codec
, nid
) & AC_WCAP_UNSOL_CAP
)
1681 snd_hda_codec_write(codec
, nid
, 0,
1682 AC_VERB_SET_UNSOLICITED_ENABLE
,
1683 (AC_USRSP_EN
| event
));
1686 static int stac92xx_init(struct hda_codec
*codec
)
1688 struct sigmatel_spec
*spec
= codec
->spec
;
1689 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
1692 snd_hda_sequence_write(codec
, spec
->init
);
1695 if (spec
->hp_detect
) {
1696 /* Enable unsolicited responses on the HP widget */
1697 for (i
= 0; i
< cfg
->hp_outs
; i
++)
1698 enable_pin_detect(codec
, cfg
->hp_pins
[i
],
1700 /* force to enable the first line-out; the others are set up
1703 stac92xx_auto_set_pinctl(codec
, spec
->autocfg
.line_out_pins
[0],
1705 stac92xx_auto_init_hp_out(codec
);
1706 /* fake event to set up pins */
1707 codec
->patch_ops
.unsol_event(codec
, STAC_HP_EVENT
<< 26);
1709 stac92xx_auto_init_multi_out(codec
);
1710 stac92xx_auto_init_hp_out(codec
);
1712 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
1713 hda_nid_t nid
= cfg
->input_pins
[i
];
1715 unsigned int pinctl
= AC_PINCTL_IN_EN
;
1716 if (i
== AUTO_PIN_MIC
|| i
== AUTO_PIN_FRONT_MIC
)
1717 pinctl
|= stac92xx_get_vref(codec
, nid
);
1718 stac92xx_auto_set_pinctl(codec
, nid
, pinctl
);
1721 if (spec
->num_dmics
> 0)
1722 for (i
= 0; i
< spec
->num_dmics
; i
++)
1723 stac92xx_auto_set_pinctl(codec
, spec
->dmic_nids
[i
],
1726 if (cfg
->dig_out_pin
)
1727 stac92xx_auto_set_pinctl(codec
, cfg
->dig_out_pin
,
1729 if (cfg
->dig_in_pin
)
1730 stac92xx_auto_set_pinctl(codec
, cfg
->dig_in_pin
,
1733 if (spec
->gpio_mute
) {
1734 stac922x_gpio_mute(codec
, 0, 0);
1735 stac922x_gpio_mute(codec
, 1, 0);
1741 static void stac92xx_free(struct hda_codec
*codec
)
1743 struct sigmatel_spec
*spec
= codec
->spec
;
1749 if (spec
->kctl_alloc
) {
1750 for (i
= 0; i
< spec
->num_kctl_used
; i
++)
1751 kfree(spec
->kctl_alloc
[i
].name
);
1752 kfree(spec
->kctl_alloc
);
1755 if (spec
->bios_pin_configs
)
1756 kfree(spec
->bios_pin_configs
);
1761 static void stac92xx_set_pinctl(struct hda_codec
*codec
, hda_nid_t nid
,
1764 unsigned int pin_ctl
= snd_hda_codec_read(codec
, nid
,
1765 0, AC_VERB_GET_PIN_WIDGET_CONTROL
, 0x00);
1767 if (pin_ctl
& AC_PINCTL_IN_EN
) {
1769 * we need to check the current set-up direction of
1770 * shared input pins since they can be switched via
1771 * "xxx as Output" mixer switch
1773 struct sigmatel_spec
*spec
= codec
->spec
;
1774 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
1775 if ((nid
== cfg
->input_pins
[AUTO_PIN_LINE
] &&
1776 spec
->line_switch
) ||
1777 (nid
== cfg
->input_pins
[AUTO_PIN_MIC
] &&
1782 /* if setting pin direction bits, clear the current
1783 direction bits first */
1784 if (flag
& (AC_PINCTL_IN_EN
| AC_PINCTL_OUT_EN
))
1785 pin_ctl
&= ~(AC_PINCTL_IN_EN
| AC_PINCTL_OUT_EN
);
1787 snd_hda_codec_write(codec
, nid
, 0,
1788 AC_VERB_SET_PIN_WIDGET_CONTROL
,
1792 static void stac92xx_reset_pinctl(struct hda_codec
*codec
, hda_nid_t nid
,
1795 unsigned int pin_ctl
= snd_hda_codec_read(codec
, nid
,
1796 0, AC_VERB_GET_PIN_WIDGET_CONTROL
, 0x00);
1797 snd_hda_codec_write(codec
, nid
, 0,
1798 AC_VERB_SET_PIN_WIDGET_CONTROL
,
1802 static int get_pin_presence(struct hda_codec
*codec
, hda_nid_t nid
)
1806 if (snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_PIN_SENSE
, 0x00)
1812 static void stac92xx_hp_detect(struct hda_codec
*codec
, unsigned int res
)
1814 struct sigmatel_spec
*spec
= codec
->spec
;
1815 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
1819 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
1820 presence
= get_pin_presence(codec
, cfg
->hp_pins
[i
]);
1826 /* disable lineouts, enable hp */
1827 for (i
= 0; i
< cfg
->line_outs
; i
++)
1828 stac92xx_reset_pinctl(codec
, cfg
->line_out_pins
[i
],
1830 for (i
= 0; i
< cfg
->speaker_outs
; i
++)
1831 stac92xx_reset_pinctl(codec
, cfg
->speaker_pins
[i
],
1834 /* enable lineouts, disable hp */
1835 for (i
= 0; i
< cfg
->line_outs
; i
++)
1836 stac92xx_set_pinctl(codec
, cfg
->line_out_pins
[i
],
1838 for (i
= 0; i
< cfg
->speaker_outs
; i
++)
1839 stac92xx_set_pinctl(codec
, cfg
->speaker_pins
[i
],
1844 static void stac92xx_unsol_event(struct hda_codec
*codec
, unsigned int res
)
1846 switch (res
>> 26) {
1848 stac92xx_hp_detect(codec
, res
);
1854 static int stac92xx_resume(struct hda_codec
*codec
)
1856 struct sigmatel_spec
*spec
= codec
->spec
;
1859 stac92xx_init(codec
);
1860 stac92xx_set_config_regs(codec
);
1861 snd_hda_resume_ctls(codec
, spec
->mixer
);
1862 for (i
= 0; i
< spec
->num_mixers
; i
++)
1863 snd_hda_resume_ctls(codec
, spec
->mixers
[i
]);
1864 if (spec
->multiout
.dig_out_nid
)
1865 snd_hda_resume_spdif_out(codec
);
1866 if (spec
->dig_in_nid
)
1867 snd_hda_resume_spdif_in(codec
);
1873 static struct hda_codec_ops stac92xx_patch_ops
= {
1874 .build_controls
= stac92xx_build_controls
,
1875 .build_pcms
= stac92xx_build_pcms
,
1876 .init
= stac92xx_init
,
1877 .free
= stac92xx_free
,
1878 .unsol_event
= stac92xx_unsol_event
,
1880 .resume
= stac92xx_resume
,
1884 static int patch_stac9200(struct hda_codec
*codec
)
1886 struct sigmatel_spec
*spec
;
1889 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
1895 spec
->pin_nids
= stac9200_pin_nids
;
1896 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_9200_MODELS
,
1899 if (spec
->board_config
< 0) {
1900 snd_printdd(KERN_INFO
"hda_codec: Unknown model for STAC9200, using BIOS defaults\n");
1901 err
= stac92xx_save_bios_config_regs(codec
);
1903 stac92xx_free(codec
);
1906 spec
->pin_configs
= spec
->bios_pin_configs
;
1908 spec
->pin_configs
= stac9200_brd_tbl
[spec
->board_config
];
1909 stac92xx_set_config_regs(codec
);
1912 spec
->multiout
.max_channels
= 2;
1913 spec
->multiout
.num_dacs
= 1;
1914 spec
->multiout
.dac_nids
= stac9200_dac_nids
;
1915 spec
->adc_nids
= stac9200_adc_nids
;
1916 spec
->mux_nids
= stac9200_mux_nids
;
1917 spec
->num_muxes
= 1;
1918 spec
->num_dmics
= 0;
1920 spec
->init
= stac9200_core_init
;
1921 spec
->mixer
= stac9200_mixer
;
1923 err
= stac9200_parse_auto_config(codec
);
1925 stac92xx_free(codec
);
1929 codec
->patch_ops
= stac92xx_patch_ops
;
1934 static int patch_stac925x(struct hda_codec
*codec
)
1936 struct sigmatel_spec
*spec
;
1939 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
1945 spec
->pin_nids
= stac925x_pin_nids
;
1946 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_925x_MODELS
,
1950 if (spec
->board_config
< 0) {
1951 snd_printdd(KERN_INFO
"hda_codec: Unknown model for STAC925x,"
1952 "using BIOS defaults\n");
1953 err
= stac92xx_save_bios_config_regs(codec
);
1955 stac92xx_free(codec
);
1958 spec
->pin_configs
= spec
->bios_pin_configs
;
1959 } else if (stac925x_brd_tbl
[spec
->board_config
] != NULL
){
1960 spec
->pin_configs
= stac925x_brd_tbl
[spec
->board_config
];
1961 stac92xx_set_config_regs(codec
);
1964 spec
->multiout
.max_channels
= 2;
1965 spec
->multiout
.num_dacs
= 1;
1966 spec
->multiout
.dac_nids
= stac925x_dac_nids
;
1967 spec
->adc_nids
= stac925x_adc_nids
;
1968 spec
->mux_nids
= stac925x_mux_nids
;
1969 spec
->num_muxes
= 1;
1970 switch (codec
->vendor_id
) {
1971 case 0x83847632: /* STAC9202 */
1972 case 0x83847633: /* STAC9202D */
1973 case 0x83847636: /* STAC9251 */
1974 case 0x83847637: /* STAC9251D */
1975 spec
->num_dmics
= 1;
1976 spec
->dmic_nids
= stac925x_dmic_nids
;
1979 spec
->num_dmics
= 0;
1983 spec
->init
= stac925x_core_init
;
1984 spec
->mixer
= stac925x_mixer
;
1986 err
= stac92xx_parse_auto_config(codec
, 0x8, 0x7);
1988 if (spec
->board_config
< 0) {
1989 printk(KERN_WARNING
"hda_codec: No auto-config is "
1990 "available, default to model=ref\n");
1991 spec
->board_config
= STAC_925x_REF
;
1997 stac92xx_free(codec
);
2001 codec
->patch_ops
= stac92xx_patch_ops
;
2006 static int patch_stac922x(struct hda_codec
*codec
)
2008 struct sigmatel_spec
*spec
;
2011 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
2016 spec
->num_pins
= 10;
2017 spec
->pin_nids
= stac922x_pin_nids
;
2018 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_922X_MODELS
,
2021 if (spec
->board_config
== STAC_MACMINI
) {
2022 spec
->gpio_mute
= 1;
2023 /* Intel Macs have all same PCI SSID, so we need to check
2024 * codec SSID to distinguish the exact models
2026 printk(KERN_INFO
"hda_codec: STAC922x, Apple subsys_id=%x\n", codec
->subsystem_id
);
2027 switch (codec
->subsystem_id
) {
2028 case 0x106b0a00: /* MacBook First generatoin */
2029 spec
->board_config
= STAC_MACBOOK
;
2031 case 0x106b0200: /* MacBook Pro first generation */
2032 spec
->board_config
= STAC_MACBOOK_PRO_V1
;
2034 case 0x106b1e00: /* MacBook Pro second generation */
2035 spec
->board_config
= STAC_MACBOOK_PRO_V2
;
2037 case 0x106b0700: /* Intel-based iMac */
2038 spec
->board_config
= STAC_IMAC_INTEL
;
2044 if (spec
->board_config
< 0) {
2045 snd_printdd(KERN_INFO
"hda_codec: Unknown model for STAC922x, "
2046 "using BIOS defaults\n");
2047 err
= stac92xx_save_bios_config_regs(codec
);
2049 stac92xx_free(codec
);
2052 spec
->pin_configs
= spec
->bios_pin_configs
;
2053 } else if (stac922x_brd_tbl
[spec
->board_config
] != NULL
) {
2054 spec
->pin_configs
= stac922x_brd_tbl
[spec
->board_config
];
2055 stac92xx_set_config_regs(codec
);
2058 spec
->adc_nids
= stac922x_adc_nids
;
2059 spec
->mux_nids
= stac922x_mux_nids
;
2060 spec
->num_muxes
= ARRAY_SIZE(stac922x_mux_nids
);
2061 spec
->num_dmics
= 0;
2063 spec
->init
= stac922x_core_init
;
2064 spec
->mixer
= stac922x_mixer
;
2066 spec
->multiout
.dac_nids
= spec
->dac_nids
;
2068 err
= stac92xx_parse_auto_config(codec
, 0x08, 0x09);
2070 if (spec
->board_config
< 0) {
2071 printk(KERN_WARNING
"hda_codec: No auto-config is "
2072 "available, default to model=ref\n");
2073 spec
->board_config
= STAC_D945_REF
;
2079 stac92xx_free(codec
);
2083 codec
->patch_ops
= stac92xx_patch_ops
;
2088 static int patch_stac927x(struct hda_codec
*codec
)
2090 struct sigmatel_spec
*spec
;
2093 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
2098 spec
->num_pins
= 14;
2099 spec
->pin_nids
= stac927x_pin_nids
;
2100 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_927X_MODELS
,
2104 if (spec
->board_config
< 0) {
2105 snd_printdd(KERN_INFO
"hda_codec: Unknown model for STAC927x, using BIOS defaults\n");
2106 err
= stac92xx_save_bios_config_regs(codec
);
2108 stac92xx_free(codec
);
2111 spec
->pin_configs
= spec
->bios_pin_configs
;
2112 } else if (stac927x_brd_tbl
[spec
->board_config
] != NULL
) {
2113 spec
->pin_configs
= stac927x_brd_tbl
[spec
->board_config
];
2114 stac92xx_set_config_regs(codec
);
2117 switch (spec
->board_config
) {
2119 spec
->adc_nids
= stac927x_adc_nids
;
2120 spec
->mux_nids
= stac927x_mux_nids
;
2121 spec
->num_muxes
= ARRAY_SIZE(stac927x_mux_nids
);
2122 spec
->num_dmics
= 0;
2123 spec
->init
= d965_core_init
;
2124 spec
->mixer
= stac9227_mixer
;
2127 spec
->adc_nids
= stac927x_adc_nids
;
2128 spec
->mux_nids
= stac927x_mux_nids
;
2129 spec
->num_muxes
= ARRAY_SIZE(stac927x_mux_nids
);
2130 spec
->num_dmics
= 0;
2131 spec
->init
= d965_core_init
;
2132 spec
->mixer
= stac9227_mixer
;
2135 spec
->adc_nids
= stac927x_adc_nids
;
2136 spec
->mux_nids
= stac927x_mux_nids
;
2137 spec
->num_muxes
= ARRAY_SIZE(stac927x_mux_nids
);
2138 spec
->num_dmics
= 0;
2139 spec
->init
= stac927x_core_init
;
2140 spec
->mixer
= stac927x_mixer
;
2143 spec
->multiout
.dac_nids
= spec
->dac_nids
;
2145 err
= stac92xx_parse_auto_config(codec
, 0x1e, 0x20);
2147 if (spec
->board_config
< 0) {
2148 printk(KERN_WARNING
"hda_codec: No auto-config is "
2149 "available, default to model=ref\n");
2150 spec
->board_config
= STAC_D965_REF
;
2156 stac92xx_free(codec
);
2160 codec
->patch_ops
= stac92xx_patch_ops
;
2162 /* Fix Mux capture level; max to 2 */
2163 snd_hda_override_amp_caps(codec
, 0x12, HDA_OUTPUT
,
2164 (0 << AC_AMPCAP_OFFSET_SHIFT
) |
2165 (2 << AC_AMPCAP_NUM_STEPS_SHIFT
) |
2166 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
2167 (0 << AC_AMPCAP_MUTE_SHIFT
));
2172 static int patch_stac9205(struct hda_codec
*codec
)
2174 struct sigmatel_spec
*spec
;
2177 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
2182 spec
->num_pins
= 14;
2183 spec
->pin_nids
= stac9205_pin_nids
;
2184 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_9205_MODELS
,
2188 if (spec
->board_config
< 0) {
2189 snd_printdd(KERN_INFO
"hda_codec: Unknown model for STAC9205, using BIOS defaults\n");
2190 err
= stac92xx_save_bios_config_regs(codec
);
2192 stac92xx_free(codec
);
2195 spec
->pin_configs
= spec
->bios_pin_configs
;
2197 spec
->pin_configs
= stac9205_brd_tbl
[spec
->board_config
];
2198 stac92xx_set_config_regs(codec
);
2201 spec
->adc_nids
= stac9205_adc_nids
;
2202 spec
->mux_nids
= stac9205_mux_nids
;
2203 spec
->num_muxes
= ARRAY_SIZE(stac9205_mux_nids
);
2204 spec
->dmic_nids
= stac9205_dmic_nids
;
2205 spec
->num_dmics
= ARRAY_SIZE(stac9205_dmic_nids
);
2206 spec
->dmux_nid
= 0x1d;
2208 spec
->init
= stac9205_core_init
;
2209 spec
->mixer
= stac9205_mixer
;
2211 spec
->multiout
.dac_nids
= spec
->dac_nids
;
2213 /* Configure GPIO0 as EAPD output */
2214 snd_hda_codec_write(codec
, codec
->afg
, 0,
2215 AC_VERB_SET_GPIO_DIRECTION
, 0x00000001);
2216 /* Configure GPIO0 as CMOS */
2217 snd_hda_codec_write(codec
, codec
->afg
, 0, 0x7e7, 0x00000000);
2218 /* Assert GPIO0 high */
2219 snd_hda_codec_write(codec
, codec
->afg
, 0,
2220 AC_VERB_SET_GPIO_DATA
, 0x00000001);
2222 snd_hda_codec_write(codec
, codec
->afg
, 0,
2223 AC_VERB_SET_GPIO_MASK
, 0x00000001);
2225 err
= stac92xx_parse_auto_config(codec
, 0x1f, 0x20);
2227 if (spec
->board_config
< 0) {
2228 printk(KERN_WARNING
"hda_codec: No auto-config is "
2229 "available, default to model=ref\n");
2230 spec
->board_config
= STAC_9205_REF
;
2236 stac92xx_free(codec
);
2240 codec
->patch_ops
= stac92xx_patch_ops
;
2249 /* static config for Sony VAIO FE550G and Sony VAIO AR */
2250 static hda_nid_t vaio_dacs
[] = { 0x2 };
2251 #define VAIO_HP_DAC 0x5
2252 static hda_nid_t vaio_adcs
[] = { 0x8 /*,0x6*/ };
2253 static hda_nid_t vaio_mux_nids
[] = { 0x15 };
2255 static struct hda_input_mux vaio_mux
= {
2258 /* { "HP", 0x0 }, */
2265 static struct hda_verb vaio_init
[] = {
2266 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP <- 0x2 */
2267 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Speaker <- 0x5 */
2268 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Mic? (<- 0x2) */
2269 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* CD */
2270 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Mic? */
2271 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x2}, /* mic-sel: 0a,0d,14,02 */
2272 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* HP */
2273 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Speaker */
2274 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
2275 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
2276 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Mic-in -> 0x9 */
2280 static struct hda_verb vaio_ar_init
[] = {
2281 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP <- 0x2 */
2282 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Speaker <- 0x5 */
2283 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Mic? (<- 0x2) */
2284 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* CD */
2285 /* {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },*/ /* Optical Out */
2286 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Mic? */
2287 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x2}, /* mic-sel: 0a,0d,14,02 */
2288 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* HP */
2289 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Speaker */
2290 /* {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},*/ /* Optical Out */
2291 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
2292 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
2293 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Mic-in -> 0x9 */
2297 /* bind volumes of both NID 0x02 and 0x05 */
2298 static int vaio_master_vol_put(struct snd_kcontrol
*kcontrol
,
2299 struct snd_ctl_elem_value
*ucontrol
)
2301 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2302 long *valp
= ucontrol
->value
.integer
.value
;
2305 change
= snd_hda_codec_amp_update(codec
, 0x02, 0, HDA_OUTPUT
, 0,
2306 0x7f, valp
[0] & 0x7f);
2307 change
|= snd_hda_codec_amp_update(codec
, 0x02, 1, HDA_OUTPUT
, 0,
2308 0x7f, valp
[1] & 0x7f);
2309 snd_hda_codec_amp_update(codec
, 0x05, 0, HDA_OUTPUT
, 0,
2310 0x7f, valp
[0] & 0x7f);
2311 snd_hda_codec_amp_update(codec
, 0x05, 1, HDA_OUTPUT
, 0,
2312 0x7f, valp
[1] & 0x7f);
2316 /* bind volumes of both NID 0x02 and 0x05 */
2317 static int vaio_master_sw_put(struct snd_kcontrol
*kcontrol
,
2318 struct snd_ctl_elem_value
*ucontrol
)
2320 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2321 long *valp
= ucontrol
->value
.integer
.value
;
2324 change
= snd_hda_codec_amp_update(codec
, 0x02, 0, HDA_OUTPUT
, 0,
2325 0x80, (valp
[0] ? 0 : 0x80));
2326 change
|= snd_hda_codec_amp_update(codec
, 0x02, 1, HDA_OUTPUT
, 0,
2327 0x80, (valp
[1] ? 0 : 0x80));
2328 snd_hda_codec_amp_update(codec
, 0x05, 0, HDA_OUTPUT
, 0,
2329 0x80, (valp
[0] ? 0 : 0x80));
2330 snd_hda_codec_amp_update(codec
, 0x05, 1, HDA_OUTPUT
, 0,
2331 0x80, (valp
[1] ? 0 : 0x80));
2335 static struct snd_kcontrol_new vaio_mixer
[] = {
2337 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2338 .name
= "Master Playback Volume",
2339 .info
= snd_hda_mixer_amp_volume_info
,
2340 .get
= snd_hda_mixer_amp_volume_get
,
2341 .put
= vaio_master_vol_put
,
2342 .tlv
= { .c
= snd_hda_mixer_amp_tlv
},
2343 .private_value
= HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
2346 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2347 .name
= "Master Playback Switch",
2348 .info
= snd_hda_mixer_amp_switch_info
,
2349 .get
= snd_hda_mixer_amp_switch_get
,
2350 .put
= vaio_master_sw_put
,
2351 .private_value
= HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
2353 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
2354 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT
),
2355 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT
),
2357 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2358 .name
= "Capture Source",
2360 .info
= stac92xx_mux_enum_info
,
2361 .get
= stac92xx_mux_enum_get
,
2362 .put
= stac92xx_mux_enum_put
,
2367 static struct snd_kcontrol_new vaio_ar_mixer
[] = {
2369 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2370 .name
= "Master Playback Volume",
2371 .info
= snd_hda_mixer_amp_volume_info
,
2372 .get
= snd_hda_mixer_amp_volume_get
,
2373 .put
= vaio_master_vol_put
,
2374 .private_value
= HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
2377 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2378 .name
= "Master Playback Switch",
2379 .info
= snd_hda_mixer_amp_switch_info
,
2380 .get
= snd_hda_mixer_amp_switch_get
,
2381 .put
= vaio_master_sw_put
,
2382 .private_value
= HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
2384 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
2385 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT
),
2386 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT
),
2387 /*HDA_CODEC_MUTE("Optical Out Switch", 0x10, 0, HDA_OUTPUT),
2388 HDA_CODEC_VOLUME("Optical Out Volume", 0x10, 0, HDA_OUTPUT),*/
2390 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2391 .name
= "Capture Source",
2393 .info
= stac92xx_mux_enum_info
,
2394 .get
= stac92xx_mux_enum_get
,
2395 .put
= stac92xx_mux_enum_put
,
2400 static struct hda_codec_ops stac9872_patch_ops
= {
2401 .build_controls
= stac92xx_build_controls
,
2402 .build_pcms
= stac92xx_build_pcms
,
2403 .init
= stac92xx_init
,
2404 .free
= stac92xx_free
,
2406 .resume
= stac92xx_resume
,
2410 enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */
2412 /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */
2414 /* Unknown. id=0x83847661 and subsys=0x104D1200. */
2416 /* AR Series. id=0x83847664 and subsys=104D1300 */
2421 static const char *stac9872_models
[STAC_9872_MODELS
] = {
2422 [CXD9872RD_VAIO
] = "vaio",
2423 [CXD9872AKD_VAIO
] = "vaio-ar",
2426 static struct snd_pci_quirk stac9872_cfg_tbl
[] = {
2427 SND_PCI_QUIRK(0x104d, 0x81e6, "Sony VAIO F/S", CXD9872RD_VAIO
),
2428 SND_PCI_QUIRK(0x104d, 0x81ef, "Sony VAIO F/S", CXD9872RD_VAIO
),
2429 SND_PCI_QUIRK(0x104d, 0x81fd, "Sony VAIO AR", CXD9872AKD_VAIO
),
2430 SND_PCI_QUIRK(0x104d, 0x8205, "Sony VAIO AR", CXD9872AKD_VAIO
),
2434 static int patch_stac9872(struct hda_codec
*codec
)
2436 struct sigmatel_spec
*spec
;
2439 board_config
= snd_hda_check_board_config(codec
, STAC_9872_MODELS
,
2442 if (board_config
< 0)
2443 /* unknown config, let generic-parser do its job... */
2444 return snd_hda_parse_generic_codec(codec
);
2446 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
2451 switch (board_config
) {
2452 case CXD9872RD_VAIO
:
2453 case STAC9872AK_VAIO
:
2454 case STAC9872K_VAIO
:
2455 spec
->mixer
= vaio_mixer
;
2456 spec
->init
= vaio_init
;
2457 spec
->multiout
.max_channels
= 2;
2458 spec
->multiout
.num_dacs
= ARRAY_SIZE(vaio_dacs
);
2459 spec
->multiout
.dac_nids
= vaio_dacs
;
2460 spec
->multiout
.hp_nid
= VAIO_HP_DAC
;
2461 spec
->num_adcs
= ARRAY_SIZE(vaio_adcs
);
2462 spec
->adc_nids
= vaio_adcs
;
2463 spec
->input_mux
= &vaio_mux
;
2464 spec
->mux_nids
= vaio_mux_nids
;
2467 case CXD9872AKD_VAIO
:
2468 spec
->mixer
= vaio_ar_mixer
;
2469 spec
->init
= vaio_ar_init
;
2470 spec
->multiout
.max_channels
= 2;
2471 spec
->multiout
.num_dacs
= ARRAY_SIZE(vaio_dacs
);
2472 spec
->multiout
.dac_nids
= vaio_dacs
;
2473 spec
->multiout
.hp_nid
= VAIO_HP_DAC
;
2474 spec
->num_adcs
= ARRAY_SIZE(vaio_adcs
);
2475 spec
->adc_nids
= vaio_adcs
;
2476 spec
->input_mux
= &vaio_mux
;
2477 spec
->mux_nids
= vaio_mux_nids
;
2481 codec
->patch_ops
= stac9872_patch_ops
;
2489 struct hda_codec_preset snd_hda_preset_sigmatel
[] = {
2490 { .id
= 0x83847690, .name
= "STAC9200", .patch
= patch_stac9200
},
2491 { .id
= 0x83847882, .name
= "STAC9220 A1", .patch
= patch_stac922x
},
2492 { .id
= 0x83847680, .name
= "STAC9221 A1", .patch
= patch_stac922x
},
2493 { .id
= 0x83847880, .name
= "STAC9220 A2", .patch
= patch_stac922x
},
2494 { .id
= 0x83847681, .name
= "STAC9220D/9223D A2", .patch
= patch_stac922x
},
2495 { .id
= 0x83847682, .name
= "STAC9221 A2", .patch
= patch_stac922x
},
2496 { .id
= 0x83847683, .name
= "STAC9221D A2", .patch
= patch_stac922x
},
2497 { .id
= 0x83847618, .name
= "STAC9227", .patch
= patch_stac927x
},
2498 { .id
= 0x83847619, .name
= "STAC9227", .patch
= patch_stac927x
},
2499 { .id
= 0x83847616, .name
= "STAC9228", .patch
= patch_stac927x
},
2500 { .id
= 0x83847617, .name
= "STAC9228", .patch
= patch_stac927x
},
2501 { .id
= 0x83847614, .name
= "STAC9229", .patch
= patch_stac927x
},
2502 { .id
= 0x83847615, .name
= "STAC9229", .patch
= patch_stac927x
},
2503 { .id
= 0x83847620, .name
= "STAC9274", .patch
= patch_stac927x
},
2504 { .id
= 0x83847621, .name
= "STAC9274D", .patch
= patch_stac927x
},
2505 { .id
= 0x83847622, .name
= "STAC9273X", .patch
= patch_stac927x
},
2506 { .id
= 0x83847623, .name
= "STAC9273D", .patch
= patch_stac927x
},
2507 { .id
= 0x83847624, .name
= "STAC9272X", .patch
= patch_stac927x
},
2508 { .id
= 0x83847625, .name
= "STAC9272D", .patch
= patch_stac927x
},
2509 { .id
= 0x83847626, .name
= "STAC9271X", .patch
= patch_stac927x
},
2510 { .id
= 0x83847627, .name
= "STAC9271D", .patch
= patch_stac927x
},
2511 { .id
= 0x83847628, .name
= "STAC9274X5NH", .patch
= patch_stac927x
},
2512 { .id
= 0x83847629, .name
= "STAC9274D5NH", .patch
= patch_stac927x
},
2513 { .id
= 0x83847632, .name
= "STAC9202", .patch
= patch_stac925x
},
2514 { .id
= 0x83847633, .name
= "STAC9202D", .patch
= patch_stac925x
},
2515 { .id
= 0x83847634, .name
= "STAC9250", .patch
= patch_stac925x
},
2516 { .id
= 0x83847635, .name
= "STAC9250D", .patch
= patch_stac925x
},
2517 { .id
= 0x83847636, .name
= "STAC9251", .patch
= patch_stac925x
},
2518 { .id
= 0x83847637, .name
= "STAC9250D", .patch
= patch_stac925x
},
2519 /* The following does not take into account .id=0x83847661 when subsys =
2520 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
2521 * currently not fully supported.
2523 { .id
= 0x83847661, .name
= "CXD9872RD/K", .patch
= patch_stac9872
},
2524 { .id
= 0x83847662, .name
= "STAC9872AK", .patch
= patch_stac9872
},
2525 { .id
= 0x83847664, .name
= "CXD9872AKD", .patch
= patch_stac9872
},
2526 { .id
= 0x838476a0, .name
= "STAC9205", .patch
= patch_stac9205
},
2527 { .id
= 0x838476a1, .name
= "STAC9205D", .patch
= patch_stac9205
},
2528 { .id
= 0x838476a2, .name
= "STAC9204", .patch
= patch_stac9205
},
2529 { .id
= 0x838476a3, .name
= "STAC9204D", .patch
= patch_stac9205
},
2530 { .id
= 0x838476a4, .name
= "STAC9255", .patch
= patch_stac9205
},
2531 { .id
= 0x838476a5, .name
= "STAC9255D", .patch
= patch_stac9205
},
2532 { .id
= 0x838476a6, .name
= "STAC9254", .patch
= patch_stac9205
},
2533 { .id
= 0x838476a7, .name
= "STAC9254D", .patch
= patch_stac9205
},