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 <linux/init.h>
28 #include <linux/delay.h>
29 #include <linux/slab.h>
30 #include <linux/pci.h>
31 #include <sound/core.h>
32 #include <sound/asoundef.h>
33 #include "hda_codec.h"
34 #include "hda_local.h"
35 #include "hda_patch.h"
38 #define NUM_CONTROL_ALLOC 32
39 #define STAC_PWR_EVENT 0x20
40 #define STAC_HP_EVENT 0x30
103 STAC_INTEL_MAC_AUTO
, /* This model is selected if no module parameter
104 * is given, one of the above models will be
105 * chosen according to the subsystem id. */
106 /* for backward compatibility */
130 struct sigmatel_spec
{
131 struct snd_kcontrol_new
*mixers
[4];
132 unsigned int num_mixers
;
135 unsigned int surr_switch
: 1;
136 unsigned int line_switch
: 1;
137 unsigned int mic_switch
: 1;
138 unsigned int alt_switch
: 1;
139 unsigned int hp_detect
: 1;
142 unsigned int eapd_mask
;
143 unsigned int gpio_mask
;
144 unsigned int gpio_dir
;
145 unsigned int gpio_data
;
146 unsigned int gpio_mute
;
149 unsigned int stream_delay
;
151 /* analog loopback */
152 unsigned char aloopback_mask
;
153 unsigned char aloopback_shift
;
155 /* power management */
156 unsigned int num_pwrs
;
157 unsigned int *pwr_mapping
;
162 struct hda_input_mux
*mono_mux
;
163 unsigned int cur_mmux
;
164 struct hda_multi_out multiout
;
165 hda_nid_t dac_nids
[5];
169 unsigned int num_adcs
;
171 unsigned int num_muxes
;
172 hda_nid_t
*dmic_nids
;
173 unsigned int num_dmics
;
174 hda_nid_t
*dmux_nids
;
175 unsigned int num_dmuxes
;
176 hda_nid_t
*smux_nids
;
177 unsigned int num_smuxes
;
179 hda_nid_t dig_in_nid
;
181 hda_nid_t anabeep_nid
;
182 hda_nid_t digbeep_nid
;
186 unsigned int num_pins
;
187 unsigned int *pin_configs
;
188 unsigned int *bios_pin_configs
;
190 /* codec specific stuff */
191 struct hda_verb
*init
;
192 struct snd_kcontrol_new
*mixer
;
195 struct hda_input_mux
*dinput_mux
;
196 unsigned int cur_dmux
[2];
197 struct hda_input_mux
*input_mux
;
198 unsigned int cur_mux
[3];
199 struct hda_input_mux
*sinput_mux
;
200 unsigned int cur_smux
[2];
201 unsigned int powerdown_adcs
;
204 unsigned int io_switch
[2];
205 unsigned int clfe_swap
;
206 unsigned int hp_switch
;
207 unsigned int aloopback
;
209 struct hda_pcm pcm_rec
[2]; /* PCM information */
211 /* dynamic controls and input_mux */
212 struct auto_pin_cfg autocfg
;
213 unsigned int num_kctl_alloc
, num_kctl_used
;
214 struct snd_kcontrol_new
*kctl_alloc
;
215 struct hda_input_mux private_dimux
;
216 struct hda_input_mux private_imux
;
217 struct hda_input_mux private_smux
;
218 struct hda_input_mux private_mono_mux
;
221 static hda_nid_t stac9200_adc_nids
[1] = {
225 static hda_nid_t stac9200_mux_nids
[1] = {
229 static hda_nid_t stac9200_dac_nids
[1] = {
233 static hda_nid_t stac92hd73xx_pwr_nids
[8] = {
234 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
238 static hda_nid_t stac92hd73xx_slave_dig_outs
[2] = {
242 static hda_nid_t stac92hd73xx_adc_nids
[2] = {
246 #define STAC92HD73XX_NUM_DMICS 2
247 static hda_nid_t stac92hd73xx_dmic_nids
[STAC92HD73XX_NUM_DMICS
+ 1] = {
251 #define STAC92HD73_DAC_COUNT 5
252 static hda_nid_t stac92hd73xx_dac_nids
[STAC92HD73_DAC_COUNT
] = {
253 0x15, 0x16, 0x17, 0x18, 0x19,
256 static hda_nid_t stac92hd73xx_mux_nids
[4] = {
257 0x28, 0x29, 0x2a, 0x2b,
260 static hda_nid_t stac92hd73xx_dmux_nids
[2] = {
264 static hda_nid_t stac92hd73xx_smux_nids
[2] = {
268 #define STAC92HD83XXX_NUM_DMICS 2
269 static hda_nid_t stac92hd83xxx_dmic_nids
[STAC92HD83XXX_NUM_DMICS
+ 1] = {
273 #define STAC92HD81_DAC_COUNT 2
274 #define STAC92HD83_DAC_COUNT 3
275 static hda_nid_t stac92hd83xxx_dac_nids
[STAC92HD73_DAC_COUNT
] = {
279 static hda_nid_t stac92hd83xxx_dmux_nids
[2] = {
283 static hda_nid_t stac92hd83xxx_adc_nids
[2] = {
287 static hda_nid_t stac92hd83xxx_pwr_nids
[4] = {
291 static hda_nid_t stac92hd83xxx_slave_dig_outs
[2] = {
295 static unsigned int stac92hd83xxx_pwr_mapping
[4] = {
296 0x03, 0x0c, 0x10, 0x40,
299 static hda_nid_t stac92hd71bxx_pwr_nids
[3] = {
303 static hda_nid_t stac92hd71bxx_adc_nids
[2] = {
307 static hda_nid_t stac92hd71bxx_mux_nids
[2] = {
311 static hda_nid_t stac92hd71bxx_dmux_nids
[1] = {
315 static hda_nid_t stac92hd71bxx_smux_nids
[2] = {
319 static hda_nid_t stac92hd71bxx_dac_nids
[1] = {
323 #define STAC92HD71BXX_NUM_DMICS 2
324 static hda_nid_t stac92hd71bxx_dmic_nids
[STAC92HD71BXX_NUM_DMICS
+ 1] = {
328 static hda_nid_t stac92hd71bxx_slave_dig_outs
[2] = {
332 static hda_nid_t stac925x_adc_nids
[1] = {
336 static hda_nid_t stac925x_mux_nids
[1] = {
340 static hda_nid_t stac925x_dac_nids
[1] = {
344 #define STAC925X_NUM_DMICS 1
345 static hda_nid_t stac925x_dmic_nids
[STAC925X_NUM_DMICS
+ 1] = {
349 static hda_nid_t stac925x_dmux_nids
[1] = {
353 static hda_nid_t stac922x_adc_nids
[2] = {
357 static hda_nid_t stac922x_mux_nids
[2] = {
361 static hda_nid_t stac927x_adc_nids
[3] = {
365 static hda_nid_t stac927x_mux_nids
[3] = {
369 static hda_nid_t stac927x_smux_nids
[1] = {
373 static hda_nid_t stac927x_dac_nids
[6] = {
374 0x02, 0x03, 0x04, 0x05, 0x06, 0
377 static hda_nid_t stac927x_dmux_nids
[1] = {
381 #define STAC927X_NUM_DMICS 2
382 static hda_nid_t stac927x_dmic_nids
[STAC927X_NUM_DMICS
+ 1] = {
386 static hda_nid_t stac9205_adc_nids
[2] = {
390 static hda_nid_t stac9205_mux_nids
[2] = {
394 static hda_nid_t stac9205_dmux_nids
[1] = {
398 static hda_nid_t stac9205_smux_nids
[1] = {
402 #define STAC9205_NUM_DMICS 2
403 static hda_nid_t stac9205_dmic_nids
[STAC9205_NUM_DMICS
+ 1] = {
407 static hda_nid_t stac9200_pin_nids
[8] = {
408 0x08, 0x09, 0x0d, 0x0e,
409 0x0f, 0x10, 0x11, 0x12,
412 static hda_nid_t stac925x_pin_nids
[8] = {
413 0x07, 0x08, 0x0a, 0x0b,
414 0x0c, 0x0d, 0x10, 0x11,
417 static hda_nid_t stac922x_pin_nids
[10] = {
418 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
419 0x0f, 0x10, 0x11, 0x15, 0x1b,
422 static hda_nid_t stac92hd73xx_pin_nids
[13] = {
423 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
424 0x0f, 0x10, 0x11, 0x12, 0x13,
428 static hda_nid_t stac92hd83xxx_pin_nids
[14] = {
429 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
430 0x0f, 0x10, 0x11, 0x12, 0x13,
431 0x1d, 0x1e, 0x1f, 0x20
433 static hda_nid_t stac92hd71bxx_pin_nids
[11] = {
434 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
435 0x0f, 0x14, 0x18, 0x19, 0x1e,
439 static hda_nid_t stac927x_pin_nids
[14] = {
440 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
441 0x0f, 0x10, 0x11, 0x12, 0x13,
442 0x14, 0x21, 0x22, 0x23,
445 static hda_nid_t stac9205_pin_nids
[12] = {
446 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
447 0x0f, 0x14, 0x16, 0x17, 0x18,
451 static int stac92xx_dmux_enum_info(struct snd_kcontrol
*kcontrol
,
452 struct snd_ctl_elem_info
*uinfo
)
454 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
455 struct sigmatel_spec
*spec
= codec
->spec
;
456 return snd_hda_input_mux_info(spec
->dinput_mux
, uinfo
);
459 static int stac92xx_dmux_enum_get(struct snd_kcontrol
*kcontrol
,
460 struct snd_ctl_elem_value
*ucontrol
)
462 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
463 struct sigmatel_spec
*spec
= codec
->spec
;
464 unsigned int dmux_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
466 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_dmux
[dmux_idx
];
470 static int stac92xx_dmux_enum_put(struct snd_kcontrol
*kcontrol
,
471 struct snd_ctl_elem_value
*ucontrol
)
473 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
474 struct sigmatel_spec
*spec
= codec
->spec
;
475 unsigned int dmux_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
477 return snd_hda_input_mux_put(codec
, spec
->dinput_mux
, ucontrol
,
478 spec
->dmux_nids
[dmux_idx
], &spec
->cur_dmux
[dmux_idx
]);
481 static int stac92xx_smux_enum_info(struct snd_kcontrol
*kcontrol
,
482 struct snd_ctl_elem_info
*uinfo
)
484 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
485 struct sigmatel_spec
*spec
= codec
->spec
;
486 return snd_hda_input_mux_info(spec
->sinput_mux
, uinfo
);
489 static int stac92xx_smux_enum_get(struct snd_kcontrol
*kcontrol
,
490 struct snd_ctl_elem_value
*ucontrol
)
492 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
493 struct sigmatel_spec
*spec
= codec
->spec
;
494 unsigned int smux_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
496 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_smux
[smux_idx
];
500 static int stac92xx_smux_enum_put(struct snd_kcontrol
*kcontrol
,
501 struct snd_ctl_elem_value
*ucontrol
)
503 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
504 struct sigmatel_spec
*spec
= codec
->spec
;
505 unsigned int smux_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
507 return snd_hda_input_mux_put(codec
, spec
->sinput_mux
, ucontrol
,
508 spec
->smux_nids
[smux_idx
], &spec
->cur_smux
[smux_idx
]);
511 static int stac92xx_mux_enum_info(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_info
*uinfo
)
513 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
514 struct sigmatel_spec
*spec
= codec
->spec
;
515 return snd_hda_input_mux_info(spec
->input_mux
, uinfo
);
518 static int stac92xx_mux_enum_get(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
520 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
521 struct sigmatel_spec
*spec
= codec
->spec
;
522 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
524 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mux
[adc_idx
];
528 static int stac92xx_mux_enum_put(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
530 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
531 struct sigmatel_spec
*spec
= codec
->spec
;
532 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
534 return snd_hda_input_mux_put(codec
, spec
->input_mux
, ucontrol
,
535 spec
->mux_nids
[adc_idx
], &spec
->cur_mux
[adc_idx
]);
538 static int stac92xx_mono_mux_enum_info(struct snd_kcontrol
*kcontrol
,
539 struct snd_ctl_elem_info
*uinfo
)
541 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
542 struct sigmatel_spec
*spec
= codec
->spec
;
543 return snd_hda_input_mux_info(spec
->mono_mux
, uinfo
);
546 static int stac92xx_mono_mux_enum_get(struct snd_kcontrol
*kcontrol
,
547 struct snd_ctl_elem_value
*ucontrol
)
549 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
550 struct sigmatel_spec
*spec
= codec
->spec
;
552 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mmux
;
556 static int stac92xx_mono_mux_enum_put(struct snd_kcontrol
*kcontrol
,
557 struct snd_ctl_elem_value
*ucontrol
)
559 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
560 struct sigmatel_spec
*spec
= codec
->spec
;
562 return snd_hda_input_mux_put(codec
, spec
->mono_mux
, ucontrol
,
563 spec
->mono_nid
, &spec
->cur_mmux
);
566 #define stac92xx_aloopback_info snd_ctl_boolean_mono_info
568 static int stac92xx_aloopback_get(struct snd_kcontrol
*kcontrol
,
569 struct snd_ctl_elem_value
*ucontrol
)
571 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
572 unsigned int idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
573 struct sigmatel_spec
*spec
= codec
->spec
;
575 ucontrol
->value
.integer
.value
[0] = !!(spec
->aloopback
&
576 (spec
->aloopback_mask
<< idx
));
580 static int stac92xx_aloopback_put(struct snd_kcontrol
*kcontrol
,
581 struct snd_ctl_elem_value
*ucontrol
)
583 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
584 struct sigmatel_spec
*spec
= codec
->spec
;
585 unsigned int idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
586 unsigned int dac_mode
;
587 unsigned int val
, idx_val
;
589 idx_val
= spec
->aloopback_mask
<< idx
;
590 if (ucontrol
->value
.integer
.value
[0])
591 val
= spec
->aloopback
| idx_val
;
593 val
= spec
->aloopback
& ~idx_val
;
594 if (spec
->aloopback
== val
)
597 spec
->aloopback
= val
;
599 /* Only return the bits defined by the shift value of the
600 * first two bytes of the mask
602 dac_mode
= snd_hda_codec_read(codec
, codec
->afg
, 0,
603 kcontrol
->private_value
& 0xFFFF, 0x0);
604 dac_mode
>>= spec
->aloopback_shift
;
606 if (spec
->aloopback
& idx_val
) {
607 snd_hda_power_up(codec
);
610 snd_hda_power_down(codec
);
611 dac_mode
&= ~idx_val
;
614 snd_hda_codec_write_cache(codec
, codec
->afg
, 0,
615 kcontrol
->private_value
>> 16, dac_mode
);
620 static struct hda_verb stac9200_core_init
[] = {
621 /* set dac0mux for dac converter */
622 { 0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
626 static struct hda_verb stac9200_eapd_init
[] = {
627 /* set dac0mux for dac converter */
628 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
629 {0x08, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
633 static struct hda_verb stac92hd73xx_6ch_core_init
[] = {
634 /* set master volume and direct control */
635 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
636 /* setup audio connections */
637 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00},
638 { 0x10, AC_VERB_SET_CONNECT_SEL
, 0x01},
639 { 0x11, AC_VERB_SET_CONNECT_SEL
, 0x02},
640 /* setup adcs to point to mixer */
641 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x0b},
642 { 0x21, AC_VERB_SET_CONNECT_SEL
, 0x0b},
643 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
644 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
645 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
646 /* setup import muxs */
647 { 0x28, AC_VERB_SET_CONNECT_SEL
, 0x01},
648 { 0x29, AC_VERB_SET_CONNECT_SEL
, 0x01},
649 { 0x2a, AC_VERB_SET_CONNECT_SEL
, 0x01},
650 { 0x2b, AC_VERB_SET_CONNECT_SEL
, 0x00},
654 static struct hda_verb dell_eq_core_init
[] = {
655 /* set master volume to max value without distortion
656 * and direct control */
657 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xec},
658 /* setup audio connections */
659 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00},
660 { 0x0a, AC_VERB_SET_CONNECT_SEL
, 0x01},
661 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x02},
662 /* setup adcs to point to mixer */
663 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x0b},
664 { 0x21, AC_VERB_SET_CONNECT_SEL
, 0x0b},
665 /* setup import muxs */
666 { 0x28, AC_VERB_SET_CONNECT_SEL
, 0x01},
667 { 0x29, AC_VERB_SET_CONNECT_SEL
, 0x01},
668 { 0x2a, AC_VERB_SET_CONNECT_SEL
, 0x01},
669 { 0x2b, AC_VERB_SET_CONNECT_SEL
, 0x00},
673 static struct hda_verb dell_m6_core_init
[] = {
674 /* set master volume to max value without distortion
675 * and direct control */
676 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xec},
677 /* setup audio connections */
678 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00},
679 { 0x0a, AC_VERB_SET_CONNECT_SEL
, 0x01},
680 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x02},
681 /* setup adcs to point to mixer */
682 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x0b},
683 { 0x21, AC_VERB_SET_CONNECT_SEL
, 0x0b},
684 /* setup import muxs */
685 { 0x28, AC_VERB_SET_CONNECT_SEL
, 0x01},
686 { 0x29, AC_VERB_SET_CONNECT_SEL
, 0x01},
687 { 0x2a, AC_VERB_SET_CONNECT_SEL
, 0x01},
688 { 0x2b, AC_VERB_SET_CONNECT_SEL
, 0x00},
692 static struct hda_verb stac92hd73xx_8ch_core_init
[] = {
693 /* set master volume and direct control */
694 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
695 /* setup audio connections */
696 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00},
697 { 0x10, AC_VERB_SET_CONNECT_SEL
, 0x01},
698 { 0x11, AC_VERB_SET_CONNECT_SEL
, 0x02},
699 /* connect hp ports to dac3 */
700 { 0x0a, AC_VERB_SET_CONNECT_SEL
, 0x03},
701 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x03},
702 /* setup adcs to point to mixer */
703 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x0b},
704 { 0x21, AC_VERB_SET_CONNECT_SEL
, 0x0b},
705 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
706 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
707 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
708 /* setup import muxs */
709 { 0x28, AC_VERB_SET_CONNECT_SEL
, 0x01},
710 { 0x29, AC_VERB_SET_CONNECT_SEL
, 0x01},
711 { 0x2a, AC_VERB_SET_CONNECT_SEL
, 0x01},
712 { 0x2b, AC_VERB_SET_CONNECT_SEL
, 0x03},
716 static struct hda_verb stac92hd73xx_10ch_core_init
[] = {
717 /* set master volume and direct control */
718 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
719 /* setup audio connections */
720 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
721 { 0x10, AC_VERB_SET_CONNECT_SEL
, 0x01 },
722 { 0x11, AC_VERB_SET_CONNECT_SEL
, 0x02 },
723 /* dac3 is connected to import3 mux */
724 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb07f},
725 /* connect hp ports to dac4 */
726 { 0x0a, AC_VERB_SET_CONNECT_SEL
, 0x04},
727 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x04},
728 /* setup adcs to point to mixer */
729 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x0b},
730 { 0x21, AC_VERB_SET_CONNECT_SEL
, 0x0b},
731 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
732 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
733 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
734 /* setup import muxs */
735 { 0x28, AC_VERB_SET_CONNECT_SEL
, 0x01},
736 { 0x29, AC_VERB_SET_CONNECT_SEL
, 0x01},
737 { 0x2a, AC_VERB_SET_CONNECT_SEL
, 0x01},
738 { 0x2b, AC_VERB_SET_CONNECT_SEL
, 0x03},
742 static struct hda_verb stac92hd83xxx_core_init
[] = {
743 /* start of config #1 */
744 { 0xe, AC_VERB_SET_CONNECT_SEL
, 0x3},
746 /* start of config #2 */
747 { 0xa, AC_VERB_SET_CONNECT_SEL
, 0x0},
748 { 0xb, AC_VERB_SET_CONNECT_SEL
, 0x0},
749 { 0xd, AC_VERB_SET_CONNECT_SEL
, 0x1},
751 /* power state controls amps */
752 { 0x01, AC_VERB_SET_EAPD
, 1 << 2},
755 static struct hda_verb stac92hd71bxx_core_init
[] = {
756 /* set master volume and direct control */
757 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
758 /* connect headphone jack to dac1 */
759 { 0x0a, AC_VERB_SET_CONNECT_SEL
, 0x01},
760 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Speaker */
761 /* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */
762 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
763 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
764 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
767 #define HD_DISABLE_PORTF 3
768 static struct hda_verb stac92hd71bxx_analog_core_init
[] = {
769 /* start of config #1 */
771 /* connect port 0f to audio mixer */
772 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x2},
773 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Speaker */
774 /* unmute right and left channels for node 0x0f */
775 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
776 /* start of config #2 */
778 /* set master volume and direct control */
779 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
780 /* connect headphone jack to dac1 */
781 { 0x0a, AC_VERB_SET_CONNECT_SEL
, 0x01},
782 /* connect port 0d to audio mixer */
783 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x2},
784 /* unmute dac0 input in audio mixer */
785 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, 0x701f},
786 /* unmute right and left channels for nodes 0x0a, 0xd */
787 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
788 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
792 static struct hda_verb stac925x_core_init
[] = {
793 /* set dac0mux for dac converter */
794 { 0x06, AC_VERB_SET_CONNECT_SEL
, 0x00},
798 static struct hda_verb stac922x_core_init
[] = {
799 /* set master volume and direct control */
800 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
804 static struct hda_verb d965_core_init
[] = {
805 /* set master volume and direct control */
806 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
807 /* unmute node 0x1b */
808 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
809 /* select node 0x03 as DAC */
810 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x01},
814 static struct hda_verb stac927x_core_init
[] = {
815 /* set master volume and direct control */
816 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
817 /* enable analog pc beep path */
818 { 0x01, AC_VERB_SET_DIGI_CONVERT_2
, 1 << 5},
822 static struct hda_verb stac9205_core_init
[] = {
823 /* set master volume and direct control */
824 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
825 /* enable analog pc beep path */
826 { 0x01, AC_VERB_SET_DIGI_CONVERT_2
, 1 << 5},
830 #define STAC_MONO_MUX \
832 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
833 .name = "Mono Mux", \
835 .info = stac92xx_mono_mux_enum_info, \
836 .get = stac92xx_mono_mux_enum_get, \
837 .put = stac92xx_mono_mux_enum_put, \
840 #define STAC_INPUT_SOURCE(cnt) \
842 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
843 .name = "Input Source", \
845 .info = stac92xx_mux_enum_info, \
846 .get = stac92xx_mux_enum_get, \
847 .put = stac92xx_mux_enum_put, \
850 #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \
852 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
853 .name = "Analog Loopback", \
855 .info = stac92xx_aloopback_info, \
856 .get = stac92xx_aloopback_get, \
857 .put = stac92xx_aloopback_put, \
858 .private_value = verb_read | (verb_write << 16), \
861 static struct snd_kcontrol_new stac9200_mixer
[] = {
862 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT
),
863 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT
),
864 STAC_INPUT_SOURCE(1),
865 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT
),
866 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT
),
870 static struct snd_kcontrol_new stac92hd73xx_6ch_mixer
[] = {
871 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3),
873 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT
),
874 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT
),
876 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT
),
877 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT
),
879 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT
),
880 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT
),
882 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT
),
883 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT
),
885 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT
),
886 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT
),
888 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT
),
889 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT
),
891 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT
),
892 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT
),
896 static struct snd_kcontrol_new stac92hd73xx_8ch_mixer
[] = {
897 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4),
899 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT
),
900 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT
),
902 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT
),
903 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT
),
905 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT
),
906 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT
),
908 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT
),
909 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT
),
911 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT
),
912 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT
),
914 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT
),
915 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT
),
917 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT
),
918 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT
),
922 static struct snd_kcontrol_new stac92hd73xx_10ch_mixer
[] = {
923 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5),
925 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT
),
926 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT
),
928 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT
),
929 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT
),
931 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT
),
932 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT
),
934 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT
),
935 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT
),
937 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT
),
938 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT
),
940 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT
),
941 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT
),
943 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT
),
944 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT
),
949 static struct snd_kcontrol_new stac92hd83xxx_mixer
[] = {
950 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_OUTPUT
),
951 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_OUTPUT
),
953 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_OUTPUT
),
954 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_OUTPUT
),
956 HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x1b, 0, HDA_INPUT
),
957 HDA_CODEC_MUTE("DAC0 Capture Switch", 0x1b, 0, HDA_INPUT
),
959 HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x1b, 0x1, HDA_INPUT
),
960 HDA_CODEC_MUTE("DAC1 Capture Switch", 0x1b, 0x1, HDA_INPUT
),
962 HDA_CODEC_VOLUME("Front Mic Capture Volume", 0x1b, 0x2, HDA_INPUT
),
963 HDA_CODEC_MUTE("Front Mic Capture Switch", 0x1b, 0x2, HDA_INPUT
),
965 HDA_CODEC_VOLUME("Line In Capture Volume", 0x1b, 0x3, HDA_INPUT
),
966 HDA_CODEC_MUTE("Line In Capture Switch", 0x1b, 0x3, HDA_INPUT
),
969 HDA_CODEC_VOLUME("Mic Capture Volume", 0x1b, 0x4, HDA_INPUT),
970 HDA_CODEC_MUTE("Mic Capture Switch", 0x1b 0x4, HDA_INPUT),
975 static struct snd_kcontrol_new stac92hd71bxx_analog_mixer
[] = {
976 STAC_INPUT_SOURCE(2),
978 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT
),
979 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT
),
981 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT
),
982 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT
),
983 /* analog pc-beep replaced with digital beep support */
985 HDA_CODEC_VOLUME("PC Beep Volume", 0x17, 0x2, HDA_INPUT),
986 HDA_CODEC_MUTE("PC Beep Switch", 0x17, 0x2, HDA_INPUT),
989 HDA_CODEC_MUTE("Analog Loopback 1", 0x17, 0x3, HDA_INPUT
),
990 HDA_CODEC_MUTE("Analog Loopback 2", 0x17, 0x4, HDA_INPUT
),
994 static struct snd_kcontrol_new stac92hd71bxx_mixer
[] = {
995 STAC_INPUT_SOURCE(2),
996 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2),
998 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT
),
999 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT
),
1001 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT
),
1002 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT
),
1006 static struct snd_kcontrol_new stac925x_mixer
[] = {
1007 STAC_INPUT_SOURCE(1),
1008 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT
),
1009 HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT
),
1013 static struct snd_kcontrol_new stac9205_mixer
[] = {
1014 STAC_INPUT_SOURCE(2),
1015 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1),
1017 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT
),
1018 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT
),
1020 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1c, 0x0, HDA_INPUT
),
1021 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1e, 0x0, HDA_OUTPUT
),
1025 /* This needs to be generated dynamically based on sequence */
1026 static struct snd_kcontrol_new stac922x_mixer
[] = {
1027 STAC_INPUT_SOURCE(2),
1028 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT
),
1029 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT
),
1031 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_INPUT
),
1032 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_INPUT
),
1037 static struct snd_kcontrol_new stac927x_mixer
[] = {
1038 STAC_INPUT_SOURCE(3),
1039 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1),
1041 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT
),
1042 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT
),
1044 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x19, 0x0, HDA_INPUT
),
1045 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1c, 0x0, HDA_OUTPUT
),
1047 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x2, 0x1A, 0x0, HDA_INPUT
),
1048 HDA_CODEC_MUTE_IDX("Capture Switch", 0x2, 0x1d, 0x0, HDA_OUTPUT
),
1052 static struct snd_kcontrol_new stac_dmux_mixer
= {
1053 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1054 .name
= "Digital Input Source",
1055 /* count set later */
1056 .info
= stac92xx_dmux_enum_info
,
1057 .get
= stac92xx_dmux_enum_get
,
1058 .put
= stac92xx_dmux_enum_put
,
1061 static struct snd_kcontrol_new stac_smux_mixer
= {
1062 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1063 .name
= "IEC958 Mux",
1064 /* count set later */
1065 .info
= stac92xx_smux_enum_info
,
1066 .get
= stac92xx_smux_enum_get
,
1067 .put
= stac92xx_smux_enum_put
,
1070 static const char *slave_vols
[] = {
1071 "Front Playback Volume",
1072 "Surround Playback Volume",
1073 "Center Playback Volume",
1074 "LFE Playback Volume",
1075 "Side Playback Volume",
1076 "Headphone Playback Volume",
1077 "Headphone Playback Volume",
1078 "Speaker Playback Volume",
1079 "External Speaker Playback Volume",
1080 "Speaker2 Playback Volume",
1084 static const char *slave_sws
[] = {
1085 "Front Playback Switch",
1086 "Surround Playback Switch",
1087 "Center Playback Switch",
1088 "LFE Playback Switch",
1089 "Side Playback Switch",
1090 "Headphone Playback Switch",
1091 "Headphone Playback Switch",
1092 "Speaker Playback Switch",
1093 "External Speaker Playback Switch",
1094 "Speaker2 Playback Switch",
1095 "IEC958 Playback Switch",
1099 static int stac92xx_build_controls(struct hda_codec
*codec
)
1101 struct sigmatel_spec
*spec
= codec
->spec
;
1105 err
= snd_hda_add_new_ctls(codec
, spec
->mixer
);
1109 for (i
= 0; i
< spec
->num_mixers
; i
++) {
1110 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
1114 if (spec
->num_dmuxes
> 0) {
1115 stac_dmux_mixer
.count
= spec
->num_dmuxes
;
1116 err
= snd_ctl_add(codec
->bus
->card
,
1117 snd_ctl_new1(&stac_dmux_mixer
, codec
));
1121 if (spec
->num_smuxes
> 0) {
1122 stac_smux_mixer
.count
= spec
->num_smuxes
;
1123 err
= snd_ctl_add(codec
->bus
->card
,
1124 snd_ctl_new1(&stac_smux_mixer
, codec
));
1129 if (spec
->multiout
.dig_out_nid
) {
1130 err
= snd_hda_create_spdif_out_ctls(codec
, spec
->multiout
.dig_out_nid
);
1133 err
= snd_hda_create_spdif_share_sw(codec
,
1137 spec
->multiout
.share_spdif
= 1;
1139 if (spec
->dig_in_nid
) {
1140 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
1145 /* if we have no master control, let's create it */
1146 if (!snd_hda_find_mixer_ctl(codec
, "Master Playback Volume")) {
1147 unsigned int vmaster_tlv
[4];
1148 snd_hda_set_vmaster_tlv(codec
, spec
->multiout
.dac_nids
[0],
1149 HDA_OUTPUT
, vmaster_tlv
);
1150 err
= snd_hda_add_vmaster(codec
, "Master Playback Volume",
1151 vmaster_tlv
, slave_vols
);
1155 if (!snd_hda_find_mixer_ctl(codec
, "Master Playback Switch")) {
1156 err
= snd_hda_add_vmaster(codec
, "Master Playback Switch",
1165 static unsigned int ref9200_pin_configs
[8] = {
1166 0x01c47010, 0x01447010, 0x0221401f, 0x01114010,
1167 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1171 STAC 9200 pin configs for
1176 static unsigned int dell9200_d21_pin_configs
[8] = {
1177 0x400001f0, 0x400001f1, 0x02214030, 0x01014010,
1178 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1182 STAC 9200 pin configs for
1186 static unsigned int dell9200_d22_pin_configs
[8] = {
1187 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1188 0x01813020, 0x02a19021, 0x90100140, 0x400001f2,
1192 STAC 9200 pin configs for
1193 102801C4 (Dell Dimension E310)
1200 static unsigned int dell9200_d23_pin_configs
[8] = {
1201 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1202 0x01813020, 0x01a19021, 0x90100140, 0x400001f2,
1207 STAC 9200-32 pin configs for
1208 102801B5 (Dell Inspiron 630m)
1209 102801D8 (Dell Inspiron 640m)
1211 static unsigned int dell9200_m21_pin_configs
[8] = {
1212 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310,
1213 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd,
1217 STAC 9200-32 pin configs for
1218 102801C2 (Dell Latitude D620)
1220 102801CC (Dell Latitude D820)
1224 static unsigned int dell9200_m22_pin_configs
[8] = {
1225 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310,
1226 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc,
1230 STAC 9200-32 pin configs for
1231 102801CE (Dell XPS M1710)
1232 102801CF (Dell Precision M90)
1234 static unsigned int dell9200_m23_pin_configs
[8] = {
1235 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310,
1236 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc,
1240 STAC 9200-32 pin configs for
1243 102801CB (Dell Latitude 120L)
1246 static unsigned int dell9200_m24_pin_configs
[8] = {
1247 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310,
1248 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe,
1252 STAC 9200-32 pin configs for
1253 102801BD (Dell Inspiron E1505n)
1257 static unsigned int dell9200_m25_pin_configs
[8] = {
1258 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1259 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd,
1263 STAC 9200-32 pin configs for
1264 102801F5 (Dell Inspiron 1501)
1267 static unsigned int dell9200_m26_pin_configs
[8] = {
1268 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310,
1269 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe,
1274 102801CD (Dell Inspiron E1705/9400)
1276 static unsigned int dell9200_m27_pin_configs
[8] = {
1277 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1278 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc,
1281 static unsigned int oqo9200_pin_configs
[8] = {
1282 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210,
1283 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3,
1287 static unsigned int *stac9200_brd_tbl
[STAC_9200_MODELS
] = {
1288 [STAC_REF
] = ref9200_pin_configs
,
1289 [STAC_9200_OQO
] = oqo9200_pin_configs
,
1290 [STAC_9200_DELL_D21
] = dell9200_d21_pin_configs
,
1291 [STAC_9200_DELL_D22
] = dell9200_d22_pin_configs
,
1292 [STAC_9200_DELL_D23
] = dell9200_d23_pin_configs
,
1293 [STAC_9200_DELL_M21
] = dell9200_m21_pin_configs
,
1294 [STAC_9200_DELL_M22
] = dell9200_m22_pin_configs
,
1295 [STAC_9200_DELL_M23
] = dell9200_m23_pin_configs
,
1296 [STAC_9200_DELL_M24
] = dell9200_m24_pin_configs
,
1297 [STAC_9200_DELL_M25
] = dell9200_m25_pin_configs
,
1298 [STAC_9200_DELL_M26
] = dell9200_m26_pin_configs
,
1299 [STAC_9200_DELL_M27
] = dell9200_m27_pin_configs
,
1300 [STAC_9200_PANASONIC
] = ref9200_pin_configs
,
1303 static const char *stac9200_models
[STAC_9200_MODELS
] = {
1305 [STAC_9200_OQO
] = "oqo",
1306 [STAC_9200_DELL_D21
] = "dell-d21",
1307 [STAC_9200_DELL_D22
] = "dell-d22",
1308 [STAC_9200_DELL_D23
] = "dell-d23",
1309 [STAC_9200_DELL_M21
] = "dell-m21",
1310 [STAC_9200_DELL_M22
] = "dell-m22",
1311 [STAC_9200_DELL_M23
] = "dell-m23",
1312 [STAC_9200_DELL_M24
] = "dell-m24",
1313 [STAC_9200_DELL_M25
] = "dell-m25",
1314 [STAC_9200_DELL_M26
] = "dell-m26",
1315 [STAC_9200_DELL_M27
] = "dell-m27",
1316 [STAC_9200_GATEWAY
] = "gateway",
1317 [STAC_9200_PANASONIC
] = "panasonic",
1320 static struct snd_pci_quirk stac9200_cfg_tbl
[] = {
1321 /* SigmaTel reference board */
1322 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1323 "DFI LanParty", STAC_REF
),
1324 /* Dell laptops have BIOS problem */
1325 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01a8,
1326 "unknown Dell", STAC_9200_DELL_D21
),
1327 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01b5,
1328 "Dell Inspiron 630m", STAC_9200_DELL_M21
),
1329 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01bd,
1330 "Dell Inspiron E1505n", STAC_9200_DELL_M25
),
1331 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c0,
1332 "unknown Dell", STAC_9200_DELL_D22
),
1333 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c1,
1334 "unknown Dell", STAC_9200_DELL_D22
),
1335 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c2,
1336 "Dell Latitude D620", STAC_9200_DELL_M22
),
1337 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c5,
1338 "unknown Dell", STAC_9200_DELL_D23
),
1339 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c7,
1340 "unknown Dell", STAC_9200_DELL_D23
),
1341 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c8,
1342 "unknown Dell", STAC_9200_DELL_M22
),
1343 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c9,
1344 "unknown Dell", STAC_9200_DELL_M24
),
1345 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ca,
1346 "unknown Dell", STAC_9200_DELL_M24
),
1347 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cb,
1348 "Dell Latitude 120L", STAC_9200_DELL_M24
),
1349 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cc,
1350 "Dell Latitude D820", STAC_9200_DELL_M22
),
1351 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cd,
1352 "Dell Inspiron E1705/9400", STAC_9200_DELL_M27
),
1353 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ce,
1354 "Dell XPS M1710", STAC_9200_DELL_M23
),
1355 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cf,
1356 "Dell Precision M90", STAC_9200_DELL_M23
),
1357 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d3,
1358 "unknown Dell", STAC_9200_DELL_M22
),
1359 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d4,
1360 "unknown Dell", STAC_9200_DELL_M22
),
1361 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d6,
1362 "unknown Dell", STAC_9200_DELL_M22
),
1363 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d8,
1364 "Dell Inspiron 640m", STAC_9200_DELL_M21
),
1365 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d9,
1366 "unknown Dell", STAC_9200_DELL_D23
),
1367 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01da,
1368 "unknown Dell", STAC_9200_DELL_D23
),
1369 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01de,
1370 "unknown Dell", STAC_9200_DELL_D21
),
1371 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01e3,
1372 "unknown Dell", STAC_9200_DELL_D23
),
1373 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01e8,
1374 "unknown Dell", STAC_9200_DELL_D21
),
1375 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ee,
1376 "unknown Dell", STAC_9200_DELL_M25
),
1377 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ef,
1378 "unknown Dell", STAC_9200_DELL_M25
),
1379 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f5,
1380 "Dell Inspiron 1501", STAC_9200_DELL_M26
),
1381 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f6,
1382 "unknown Dell", STAC_9200_DELL_M26
),
1384 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC
),
1385 /* Gateway machines needs EAPD to be set on resume */
1386 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_GATEWAY
),
1387 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*",
1389 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707",
1392 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO
),
1396 static unsigned int ref925x_pin_configs
[8] = {
1397 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1398 0x90a70320, 0x02214210, 0x01019020, 0x9033032e,
1401 static unsigned int stac925x_MA6_pin_configs
[8] = {
1402 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1403 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e,
1406 static unsigned int stac925x_PA6_pin_configs
[8] = {
1407 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1408 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e,
1411 static unsigned int stac925xM2_2_pin_configs
[8] = {
1412 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020,
1413 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e,
1416 static unsigned int *stac925x_brd_tbl
[STAC_925x_MODELS
] = {
1417 [STAC_REF
] = ref925x_pin_configs
,
1418 [STAC_M2_2
] = stac925xM2_2_pin_configs
,
1419 [STAC_MA6
] = stac925x_MA6_pin_configs
,
1420 [STAC_PA6
] = stac925x_PA6_pin_configs
,
1423 static const char *stac925x_models
[STAC_925x_MODELS
] = {
1425 [STAC_M2_2
] = "m2-2",
1430 static struct snd_pci_quirk stac925x_cfg_tbl
[] = {
1431 /* SigmaTel reference board */
1432 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668, "DFI LanParty", STAC_REF
),
1433 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF
),
1434 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF
),
1435 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF
),
1436 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6
),
1437 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6
),
1438 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2
),
1442 static unsigned int ref92hd73xx_pin_configs
[13] = {
1443 0x02214030, 0x02a19040, 0x01a19020, 0x02214030,
1444 0x0181302e, 0x01014010, 0x01014020, 0x01014030,
1445 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050,
1449 static unsigned int dell_m6_pin_configs
[13] = {
1450 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110,
1451 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0,
1452 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
1456 static unsigned int *stac92hd73xx_brd_tbl
[STAC_92HD73XX_MODELS
] = {
1457 [STAC_92HD73XX_REF
] = ref92hd73xx_pin_configs
,
1458 [STAC_DELL_M6
] = dell_m6_pin_configs
,
1461 static const char *stac92hd73xx_models
[STAC_92HD73XX_MODELS
] = {
1462 [STAC_92HD73XX_REF
] = "ref",
1463 [STAC_DELL_M6
] = "dell-m6",
1466 static struct snd_pci_quirk stac92hd73xx_cfg_tbl
[] = {
1467 /* SigmaTel reference board */
1468 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1469 "DFI LanParty", STAC_92HD73XX_REF
),
1470 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0254,
1471 "unknown Dell", STAC_DELL_M6
),
1472 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0255,
1473 "unknown Dell", STAC_DELL_M6
),
1474 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0256,
1475 "unknown Dell", STAC_DELL_M6
),
1476 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0257,
1477 "unknown Dell", STAC_DELL_M6
),
1478 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x025e,
1479 "unknown Dell", STAC_DELL_M6
),
1480 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x025f,
1481 "unknown Dell", STAC_DELL_M6
),
1482 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0271,
1483 "unknown Dell", STAC_DELL_M6
),
1487 static unsigned int ref92hd83xxx_pin_configs
[14] = {
1488 0x02214030, 0x02211010, 0x02a19020, 0x02170130,
1489 0x01014050, 0x01819040, 0x01014020, 0x90a3014e,
1490 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x40f000f0,
1491 0x01451160, 0x98560170,
1494 static unsigned int *stac92hd83xxx_brd_tbl
[STAC_92HD83XXX_MODELS
] = {
1495 [STAC_92HD83XXX_REF
] = ref92hd83xxx_pin_configs
,
1498 static const char *stac92hd83xxx_models
[STAC_92HD83XXX_MODELS
] = {
1499 [STAC_92HD83XXX_REF
] = "ref",
1502 static struct snd_pci_quirk stac92hd83xxx_cfg_tbl
[] = {
1503 /* SigmaTel reference board */
1504 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1505 "DFI LanParty", STAC_92HD71BXX_REF
),
1508 static unsigned int ref92hd71bxx_pin_configs
[11] = {
1509 0x02214030, 0x02a19040, 0x01a19020, 0x01014010,
1510 0x0181302e, 0x01114010, 0x01019020, 0x90a000f0,
1511 0x90a000f0, 0x01452050, 0x01452050,
1514 static unsigned int dell_m4_1_pin_configs
[11] = {
1515 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110,
1516 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0,
1517 0x40f000f0, 0x4f0000f0, 0x4f0000f0,
1520 static unsigned int dell_m4_2_pin_configs
[11] = {
1521 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1522 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0,
1523 0x40f000f0, 0x044413b0, 0x044413b0,
1526 static unsigned int *stac92hd71bxx_brd_tbl
[STAC_92HD71BXX_MODELS
] = {
1527 [STAC_92HD71BXX_REF
] = ref92hd71bxx_pin_configs
,
1528 [STAC_DELL_M4_1
] = dell_m4_1_pin_configs
,
1529 [STAC_DELL_M4_2
] = dell_m4_2_pin_configs
,
1532 static const char *stac92hd71bxx_models
[STAC_92HD71BXX_MODELS
] = {
1533 [STAC_92HD71BXX_REF
] = "ref",
1534 [STAC_DELL_M4_1
] = "dell-m4-1",
1535 [STAC_DELL_M4_2
] = "dell-m4-2",
1538 static struct snd_pci_quirk stac92hd71bxx_cfg_tbl
[] = {
1539 /* SigmaTel reference board */
1540 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1541 "DFI LanParty", STAC_92HD71BXX_REF
),
1542 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0233,
1543 "unknown Dell", STAC_DELL_M4_1
),
1544 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0234,
1545 "unknown Dell", STAC_DELL_M4_1
),
1546 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0250,
1547 "unknown Dell", STAC_DELL_M4_1
),
1548 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x024f,
1549 "unknown Dell", STAC_DELL_M4_1
),
1550 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x024d,
1551 "unknown Dell", STAC_DELL_M4_1
),
1552 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0251,
1553 "unknown Dell", STAC_DELL_M4_1
),
1554 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0277,
1555 "unknown Dell", STAC_DELL_M4_1
),
1556 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0263,
1557 "unknown Dell", STAC_DELL_M4_2
),
1558 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0265,
1559 "unknown Dell", STAC_DELL_M4_2
),
1560 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0262,
1561 "unknown Dell", STAC_DELL_M4_2
),
1562 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0264,
1563 "unknown Dell", STAC_DELL_M4_2
),
1567 static unsigned int ref922x_pin_configs
[10] = {
1568 0x01014010, 0x01016011, 0x01012012, 0x0221401f,
1569 0x01813122, 0x01011014, 0x01441030, 0x01c41030,
1570 0x40000100, 0x40000100,
1574 STAC 922X pin configs for
1581 static unsigned int dell_922x_d81_pin_configs
[10] = {
1582 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1583 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1,
1584 0x01813122, 0x400001f2,
1588 STAC 922X pin configs for
1592 static unsigned int dell_922x_d82_pin_configs
[10] = {
1593 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1594 0x02a19020, 0x01117011, 0x01451140, 0x400001f0,
1595 0x01813122, 0x400001f1,
1599 STAC 922X pin configs for
1602 static unsigned int dell_922x_m81_pin_configs
[10] = {
1603 0x0321101f, 0x01112024, 0x01111222, 0x91174220,
1604 0x03a11050, 0x01116221, 0x90a70330, 0x01452340,
1605 0x40C003f1, 0x405003f0,
1609 STAC 9221 A1 pin configs for
1610 102801D7 (Dell XPS M1210)
1612 static unsigned int dell_922x_m82_pin_configs
[10] = {
1613 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310,
1614 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2,
1615 0x508003f3, 0x405003f4,
1618 static unsigned int d945gtp3_pin_configs
[10] = {
1619 0x0221401f, 0x01a19022, 0x01813021, 0x01014010,
1620 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1621 0x02a19120, 0x40000100,
1624 static unsigned int d945gtp5_pin_configs
[10] = {
1625 0x0221401f, 0x01011012, 0x01813024, 0x01014010,
1626 0x01a19021, 0x01016011, 0x01452130, 0x40000100,
1627 0x02a19320, 0x40000100,
1630 static unsigned int intel_mac_v1_pin_configs
[10] = {
1631 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd,
1632 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240,
1633 0x400000fc, 0x400000fb,
1636 static unsigned int intel_mac_v2_pin_configs
[10] = {
1637 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1638 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa,
1639 0x400000fc, 0x400000fb,
1642 static unsigned int intel_mac_v3_pin_configs
[10] = {
1643 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1644 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240,
1645 0x400000fc, 0x400000fb,
1648 static unsigned int intel_mac_v4_pin_configs
[10] = {
1649 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1650 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1651 0x400000fc, 0x400000fb,
1654 static unsigned int intel_mac_v5_pin_configs
[10] = {
1655 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1656 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1657 0x400000fc, 0x400000fb,
1660 static unsigned int ecs202_pin_configs
[10] = {
1661 0x0221401f, 0x02a19020, 0x01a19020, 0x01114010,
1662 0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1,
1663 0x9037012e, 0x40e000f2,
1666 static unsigned int *stac922x_brd_tbl
[STAC_922X_MODELS
] = {
1667 [STAC_D945_REF
] = ref922x_pin_configs
,
1668 [STAC_D945GTP3
] = d945gtp3_pin_configs
,
1669 [STAC_D945GTP5
] = d945gtp5_pin_configs
,
1670 [STAC_INTEL_MAC_V1
] = intel_mac_v1_pin_configs
,
1671 [STAC_INTEL_MAC_V2
] = intel_mac_v2_pin_configs
,
1672 [STAC_INTEL_MAC_V3
] = intel_mac_v3_pin_configs
,
1673 [STAC_INTEL_MAC_V4
] = intel_mac_v4_pin_configs
,
1674 [STAC_INTEL_MAC_V5
] = intel_mac_v5_pin_configs
,
1675 [STAC_INTEL_MAC_AUTO
] = intel_mac_v3_pin_configs
,
1676 /* for backward compatibility */
1677 [STAC_MACMINI
] = intel_mac_v3_pin_configs
,
1678 [STAC_MACBOOK
] = intel_mac_v5_pin_configs
,
1679 [STAC_MACBOOK_PRO_V1
] = intel_mac_v3_pin_configs
,
1680 [STAC_MACBOOK_PRO_V2
] = intel_mac_v3_pin_configs
,
1681 [STAC_IMAC_INTEL
] = intel_mac_v2_pin_configs
,
1682 [STAC_IMAC_INTEL_20
] = intel_mac_v3_pin_configs
,
1683 [STAC_ECS_202
] = ecs202_pin_configs
,
1684 [STAC_922X_DELL_D81
] = dell_922x_d81_pin_configs
,
1685 [STAC_922X_DELL_D82
] = dell_922x_d82_pin_configs
,
1686 [STAC_922X_DELL_M81
] = dell_922x_m81_pin_configs
,
1687 [STAC_922X_DELL_M82
] = dell_922x_m82_pin_configs
,
1690 static const char *stac922x_models
[STAC_922X_MODELS
] = {
1691 [STAC_D945_REF
] = "ref",
1692 [STAC_D945GTP5
] = "5stack",
1693 [STAC_D945GTP3
] = "3stack",
1694 [STAC_INTEL_MAC_V1
] = "intel-mac-v1",
1695 [STAC_INTEL_MAC_V2
] = "intel-mac-v2",
1696 [STAC_INTEL_MAC_V3
] = "intel-mac-v3",
1697 [STAC_INTEL_MAC_V4
] = "intel-mac-v4",
1698 [STAC_INTEL_MAC_V5
] = "intel-mac-v5",
1699 [STAC_INTEL_MAC_AUTO
] = "intel-mac-auto",
1700 /* for backward compatibility */
1701 [STAC_MACMINI
] = "macmini",
1702 [STAC_MACBOOK
] = "macbook",
1703 [STAC_MACBOOK_PRO_V1
] = "macbook-pro-v1",
1704 [STAC_MACBOOK_PRO_V2
] = "macbook-pro",
1705 [STAC_IMAC_INTEL
] = "imac-intel",
1706 [STAC_IMAC_INTEL_20
] = "imac-intel-20",
1707 [STAC_ECS_202
] = "ecs202",
1708 [STAC_922X_DELL_D81
] = "dell-d81",
1709 [STAC_922X_DELL_D82
] = "dell-d82",
1710 [STAC_922X_DELL_M81
] = "dell-m81",
1711 [STAC_922X_DELL_M82
] = "dell-m82",
1714 static struct snd_pci_quirk stac922x_cfg_tbl
[] = {
1715 /* SigmaTel reference board */
1716 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1717 "DFI LanParty", STAC_D945_REF
),
1718 /* Intel 945G based systems */
1719 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0101,
1720 "Intel D945G", STAC_D945GTP3
),
1721 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0202,
1722 "Intel D945G", STAC_D945GTP3
),
1723 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0606,
1724 "Intel D945G", STAC_D945GTP3
),
1725 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0601,
1726 "Intel D945G", STAC_D945GTP3
),
1727 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0111,
1728 "Intel D945G", STAC_D945GTP3
),
1729 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1115,
1730 "Intel D945G", STAC_D945GTP3
),
1731 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1116,
1732 "Intel D945G", STAC_D945GTP3
),
1733 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1117,
1734 "Intel D945G", STAC_D945GTP3
),
1735 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1118,
1736 "Intel D945G", STAC_D945GTP3
),
1737 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1119,
1738 "Intel D945G", STAC_D945GTP3
),
1739 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x8826,
1740 "Intel D945G", STAC_D945GTP3
),
1741 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5049,
1742 "Intel D945G", STAC_D945GTP3
),
1743 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5055,
1744 "Intel D945G", STAC_D945GTP3
),
1745 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5048,
1746 "Intel D945G", STAC_D945GTP3
),
1747 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0110,
1748 "Intel D945G", STAC_D945GTP3
),
1749 /* Intel D945G 5-stack systems */
1750 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0404,
1751 "Intel D945G", STAC_D945GTP5
),
1752 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0303,
1753 "Intel D945G", STAC_D945GTP5
),
1754 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0013,
1755 "Intel D945G", STAC_D945GTP5
),
1756 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0417,
1757 "Intel D945G", STAC_D945GTP5
),
1758 /* Intel 945P based systems */
1759 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0b0b,
1760 "Intel D945P", STAC_D945GTP3
),
1761 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0112,
1762 "Intel D945P", STAC_D945GTP3
),
1763 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0d0d,
1764 "Intel D945P", STAC_D945GTP3
),
1765 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0909,
1766 "Intel D945P", STAC_D945GTP3
),
1767 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0505,
1768 "Intel D945P", STAC_D945GTP3
),
1769 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0707,
1770 "Intel D945P", STAC_D945GTP5
),
1772 /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */
1773 SND_PCI_QUIRK(0x8384, 0x7680,
1774 "Mac", STAC_INTEL_MAC_AUTO
),
1776 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01a7,
1777 "unknown Dell", STAC_922X_DELL_D81
),
1778 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01a9,
1779 "unknown Dell", STAC_922X_DELL_D81
),
1780 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ab,
1781 "unknown Dell", STAC_922X_DELL_D81
),
1782 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ac,
1783 "unknown Dell", STAC_922X_DELL_D82
),
1784 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01bf,
1785 "unknown Dell", STAC_922X_DELL_M81
),
1786 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d0,
1787 "unknown Dell", STAC_922X_DELL_D82
),
1788 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d1,
1789 "unknown Dell", STAC_922X_DELL_D81
),
1790 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d2,
1791 "unknown Dell", STAC_922X_DELL_D81
),
1792 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d7,
1793 "Dell XPS M1210", STAC_922X_DELL_M82
),
1794 /* ECS/PC Chips boards */
1795 SND_PCI_QUIRK(0x1019, 0x2144,
1796 "ECS/PC chips", STAC_ECS_202
),
1797 SND_PCI_QUIRK(0x1019, 0x2608,
1798 "ECS/PC chips", STAC_ECS_202
),
1799 SND_PCI_QUIRK(0x1019, 0x2633,
1800 "ECS/PC chips P17G/1333", STAC_ECS_202
),
1801 SND_PCI_QUIRK(0x1019, 0x2811,
1802 "ECS/PC chips", STAC_ECS_202
),
1803 SND_PCI_QUIRK(0x1019, 0x2812,
1804 "ECS/PC chips", STAC_ECS_202
),
1805 SND_PCI_QUIRK(0x1019, 0x2813,
1806 "ECS/PC chips", STAC_ECS_202
),
1807 SND_PCI_QUIRK(0x1019, 0x2814,
1808 "ECS/PC chips", STAC_ECS_202
),
1809 SND_PCI_QUIRK(0x1019, 0x2815,
1810 "ECS/PC chips", STAC_ECS_202
),
1811 SND_PCI_QUIRK(0x1019, 0x2816,
1812 "ECS/PC chips", STAC_ECS_202
),
1813 SND_PCI_QUIRK(0x1019, 0x2817,
1814 "ECS/PC chips", STAC_ECS_202
),
1815 SND_PCI_QUIRK(0x1019, 0x2818,
1816 "ECS/PC chips", STAC_ECS_202
),
1817 SND_PCI_QUIRK(0x1019, 0x2819,
1818 "ECS/PC chips", STAC_ECS_202
),
1819 SND_PCI_QUIRK(0x1019, 0x2820,
1820 "ECS/PC chips", STAC_ECS_202
),
1824 static unsigned int ref927x_pin_configs
[14] = {
1825 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
1826 0x01a19040, 0x01011012, 0x01016011, 0x0101201f,
1827 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070,
1828 0x01c42190, 0x40000100,
1831 static unsigned int d965_3st_pin_configs
[14] = {
1832 0x0221401f, 0x02a19120, 0x40000100, 0x01014011,
1833 0x01a19021, 0x01813024, 0x40000100, 0x40000100,
1834 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1835 0x40000100, 0x40000100
1838 static unsigned int d965_5st_pin_configs
[14] = {
1839 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
1840 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
1841 0x40000100, 0x40000100, 0x40000100, 0x01442070,
1842 0x40000100, 0x40000100
1845 static unsigned int dell_3st_pin_configs
[14] = {
1846 0x02211230, 0x02a11220, 0x01a19040, 0x01114210,
1847 0x01111212, 0x01116211, 0x01813050, 0x01112214,
1848 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb,
1849 0x40c003fc, 0x40000100
1852 static unsigned int *stac927x_brd_tbl
[STAC_927X_MODELS
] = {
1853 [STAC_D965_REF
] = ref927x_pin_configs
,
1854 [STAC_D965_3ST
] = d965_3st_pin_configs
,
1855 [STAC_D965_5ST
] = d965_5st_pin_configs
,
1856 [STAC_DELL_3ST
] = dell_3st_pin_configs
,
1857 [STAC_DELL_BIOS
] = NULL
,
1860 static const char *stac927x_models
[STAC_927X_MODELS
] = {
1861 [STAC_D965_REF
] = "ref",
1862 [STAC_D965_3ST
] = "3stack",
1863 [STAC_D965_5ST
] = "5stack",
1864 [STAC_DELL_3ST
] = "dell-3stack",
1865 [STAC_DELL_BIOS
] = "dell-bios",
1868 static struct snd_pci_quirk stac927x_cfg_tbl
[] = {
1869 /* SigmaTel reference board */
1870 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1871 "DFI LanParty", STAC_D965_REF
),
1872 /* Intel 946 based systems */
1873 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x3d01, "Intel D946", STAC_D965_3ST
),
1874 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0xa301, "Intel D946", STAC_D965_3ST
),
1875 /* 965 based 3 stack systems */
1876 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2116, "Intel D965", STAC_D965_3ST
),
1877 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2115, "Intel D965", STAC_D965_3ST
),
1878 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2114, "Intel D965", STAC_D965_3ST
),
1879 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2113, "Intel D965", STAC_D965_3ST
),
1880 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2112, "Intel D965", STAC_D965_3ST
),
1881 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2111, "Intel D965", STAC_D965_3ST
),
1882 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2110, "Intel D965", STAC_D965_3ST
),
1883 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2009, "Intel D965", STAC_D965_3ST
),
1884 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2008, "Intel D965", STAC_D965_3ST
),
1885 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2007, "Intel D965", STAC_D965_3ST
),
1886 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2006, "Intel D965", STAC_D965_3ST
),
1887 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2005, "Intel D965", STAC_D965_3ST
),
1888 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2004, "Intel D965", STAC_D965_3ST
),
1889 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2003, "Intel D965", STAC_D965_3ST
),
1890 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2002, "Intel D965", STAC_D965_3ST
),
1891 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2001, "Intel D965", STAC_D965_3ST
),
1892 /* Dell 3 stack systems */
1893 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f7, "Dell XPS M1730", STAC_DELL_3ST
),
1894 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST
),
1895 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ed, "Dell ", STAC_DELL_3ST
),
1896 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f4, "Dell ", STAC_DELL_3ST
),
1897 /* Dell 3 stack systems with verb table in BIOS */
1898 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS
),
1899 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS
),
1900 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x022e, "Dell ", STAC_DELL_BIOS
),
1901 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x022f, "Dell Inspiron 1525", STAC_DELL_3ST
),
1902 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0242, "Dell ", STAC_DELL_BIOS
),
1903 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0243, "Dell ", STAC_DELL_BIOS
),
1904 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02ff, "Dell ", STAC_DELL_BIOS
),
1905 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS
),
1906 /* 965 based 5 stack systems */
1907 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2301, "Intel D965", STAC_D965_5ST
),
1908 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2302, "Intel D965", STAC_D965_5ST
),
1909 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2303, "Intel D965", STAC_D965_5ST
),
1910 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2304, "Intel D965", STAC_D965_5ST
),
1911 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2305, "Intel D965", STAC_D965_5ST
),
1912 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2501, "Intel D965", STAC_D965_5ST
),
1913 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2502, "Intel D965", STAC_D965_5ST
),
1914 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2503, "Intel D965", STAC_D965_5ST
),
1915 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2504, "Intel D965", STAC_D965_5ST
),
1919 static unsigned int ref9205_pin_configs
[12] = {
1920 0x40000100, 0x40000100, 0x01016011, 0x01014010,
1921 0x01813122, 0x01a19021, 0x01019020, 0x40000100,
1922 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030
1926 STAC 9205 pin configs for
1933 10280228 (Dell Vostro 1500)
1935 static unsigned int dell_9205_m42_pin_configs
[12] = {
1936 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310,
1937 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9,
1938 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE,
1942 STAC 9205 pin configs for
1946 102801FF (Dell Precision M4300)
1951 static unsigned int dell_9205_m43_pin_configs
[12] = {
1952 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310,
1953 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9,
1954 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8,
1957 static unsigned int dell_9205_m44_pin_configs
[12] = {
1958 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310,
1959 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9,
1960 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe,
1963 static unsigned int *stac9205_brd_tbl
[STAC_9205_MODELS
] = {
1964 [STAC_9205_REF
] = ref9205_pin_configs
,
1965 [STAC_9205_DELL_M42
] = dell_9205_m42_pin_configs
,
1966 [STAC_9205_DELL_M43
] = dell_9205_m43_pin_configs
,
1967 [STAC_9205_DELL_M44
] = dell_9205_m44_pin_configs
,
1970 static const char *stac9205_models
[STAC_9205_MODELS
] = {
1971 [STAC_9205_REF
] = "ref",
1972 [STAC_9205_DELL_M42
] = "dell-m42",
1973 [STAC_9205_DELL_M43
] = "dell-m43",
1974 [STAC_9205_DELL_M44
] = "dell-m44",
1977 static struct snd_pci_quirk stac9205_cfg_tbl
[] = {
1978 /* SigmaTel reference board */
1979 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1980 "DFI LanParty", STAC_9205_REF
),
1981 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f1,
1982 "unknown Dell", STAC_9205_DELL_M42
),
1983 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f2,
1984 "unknown Dell", STAC_9205_DELL_M42
),
1985 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f8,
1986 "Dell Precision", STAC_9205_DELL_M43
),
1987 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f9,
1988 "Dell Precision", STAC_9205_DELL_M43
),
1989 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01fa,
1990 "Dell Precision", STAC_9205_DELL_M43
),
1991 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01fc,
1992 "unknown Dell", STAC_9205_DELL_M42
),
1993 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01fd,
1994 "unknown Dell", STAC_9205_DELL_M42
),
1995 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01fe,
1996 "Dell Precision", STAC_9205_DELL_M43
),
1997 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ff,
1998 "Dell Precision M4300", STAC_9205_DELL_M43
),
1999 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0204,
2000 "unknown Dell", STAC_9205_DELL_M42
),
2001 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0206,
2002 "Dell Precision", STAC_9205_DELL_M43
),
2003 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x021b,
2004 "Dell Precision", STAC_9205_DELL_M43
),
2005 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x021c,
2006 "Dell Precision", STAC_9205_DELL_M43
),
2007 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x021f,
2008 "Dell Inspiron", STAC_9205_DELL_M44
),
2009 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0228,
2010 "Dell Vostro 1500", STAC_9205_DELL_M42
),
2014 static int stac92xx_save_bios_config_regs(struct hda_codec
*codec
)
2017 struct sigmatel_spec
*spec
= codec
->spec
;
2019 if (! spec
->bios_pin_configs
) {
2020 spec
->bios_pin_configs
= kcalloc(spec
->num_pins
,
2021 sizeof(*spec
->bios_pin_configs
), GFP_KERNEL
);
2022 if (! spec
->bios_pin_configs
)
2026 for (i
= 0; i
< spec
->num_pins
; i
++) {
2027 hda_nid_t nid
= spec
->pin_nids
[i
];
2028 unsigned int pin_cfg
;
2030 pin_cfg
= snd_hda_codec_read(codec
, nid
, 0,
2031 AC_VERB_GET_CONFIG_DEFAULT
, 0x00);
2032 snd_printdd(KERN_INFO
"hda_codec: pin nid %2.2x bios pin config %8.8x\n",
2034 spec
->bios_pin_configs
[i
] = pin_cfg
;
2040 static void stac92xx_set_config_reg(struct hda_codec
*codec
,
2041 hda_nid_t pin_nid
, unsigned int pin_config
)
2044 snd_hda_codec_write(codec
, pin_nid
, 0,
2045 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0
,
2046 pin_config
& 0x000000ff);
2047 snd_hda_codec_write(codec
, pin_nid
, 0,
2048 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1
,
2049 (pin_config
& 0x0000ff00) >> 8);
2050 snd_hda_codec_write(codec
, pin_nid
, 0,
2051 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2
,
2052 (pin_config
& 0x00ff0000) >> 16);
2053 snd_hda_codec_write(codec
, pin_nid
, 0,
2054 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3
,
2056 i
= snd_hda_codec_read(codec
, pin_nid
, 0,
2057 AC_VERB_GET_CONFIG_DEFAULT
,
2059 snd_printdd(KERN_INFO
"hda_codec: pin nid %2.2x pin config %8.8x\n",
2063 static void stac92xx_set_config_regs(struct hda_codec
*codec
)
2066 struct sigmatel_spec
*spec
= codec
->spec
;
2068 if (!spec
->pin_configs
)
2071 for (i
= 0; i
< spec
->num_pins
; i
++)
2072 stac92xx_set_config_reg(codec
, spec
->pin_nids
[i
],
2073 spec
->pin_configs
[i
]);
2077 * Analog playback callbacks
2079 static int stac92xx_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2080 struct hda_codec
*codec
,
2081 struct snd_pcm_substream
*substream
)
2083 struct sigmatel_spec
*spec
= codec
->spec
;
2084 if (spec
->stream_delay
)
2085 msleep(spec
->stream_delay
);
2086 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
,
2090 static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2091 struct hda_codec
*codec
,
2092 unsigned int stream_tag
,
2093 unsigned int format
,
2094 struct snd_pcm_substream
*substream
)
2096 struct sigmatel_spec
*spec
= codec
->spec
;
2097 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
, stream_tag
, format
, substream
);
2100 static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2101 struct hda_codec
*codec
,
2102 struct snd_pcm_substream
*substream
)
2104 struct sigmatel_spec
*spec
= codec
->spec
;
2105 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
2109 * Digital playback callbacks
2111 static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2112 struct hda_codec
*codec
,
2113 struct snd_pcm_substream
*substream
)
2115 struct sigmatel_spec
*spec
= codec
->spec
;
2116 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
2119 static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
2120 struct hda_codec
*codec
,
2121 struct snd_pcm_substream
*substream
)
2123 struct sigmatel_spec
*spec
= codec
->spec
;
2124 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
2127 static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2128 struct hda_codec
*codec
,
2129 unsigned int stream_tag
,
2130 unsigned int format
,
2131 struct snd_pcm_substream
*substream
)
2133 struct sigmatel_spec
*spec
= codec
->spec
;
2134 return snd_hda_multi_out_dig_prepare(codec
, &spec
->multiout
,
2135 stream_tag
, format
, substream
);
2140 * Analog capture callbacks
2142 static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2143 struct hda_codec
*codec
,
2144 unsigned int stream_tag
,
2145 unsigned int format
,
2146 struct snd_pcm_substream
*substream
)
2148 struct sigmatel_spec
*spec
= codec
->spec
;
2149 hda_nid_t nid
= spec
->adc_nids
[substream
->number
];
2151 if (spec
->powerdown_adcs
) {
2153 snd_hda_codec_write_cache(codec
, nid
, 0,
2154 AC_VERB_SET_POWER_STATE
, AC_PWRST_D0
);
2156 snd_hda_codec_setup_stream(codec
, nid
, stream_tag
, 0, format
);
2160 static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2161 struct hda_codec
*codec
,
2162 struct snd_pcm_substream
*substream
)
2164 struct sigmatel_spec
*spec
= codec
->spec
;
2165 hda_nid_t nid
= spec
->adc_nids
[substream
->number
];
2167 snd_hda_codec_cleanup_stream(codec
, nid
);
2168 if (spec
->powerdown_adcs
)
2169 snd_hda_codec_write_cache(codec
, nid
, 0,
2170 AC_VERB_SET_POWER_STATE
, AC_PWRST_D3
);
2174 static struct hda_pcm_stream stac92xx_pcm_digital_playback
= {
2178 /* NID is set in stac92xx_build_pcms */
2180 .open
= stac92xx_dig_playback_pcm_open
,
2181 .close
= stac92xx_dig_playback_pcm_close
,
2182 .prepare
= stac92xx_dig_playback_pcm_prepare
2186 static struct hda_pcm_stream stac92xx_pcm_digital_capture
= {
2190 /* NID is set in stac92xx_build_pcms */
2193 static struct hda_pcm_stream stac92xx_pcm_analog_playback
= {
2197 .nid
= 0x02, /* NID to query formats and rates */
2199 .open
= stac92xx_playback_pcm_open
,
2200 .prepare
= stac92xx_playback_pcm_prepare
,
2201 .cleanup
= stac92xx_playback_pcm_cleanup
2205 static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback
= {
2209 .nid
= 0x06, /* NID to query formats and rates */
2211 .open
= stac92xx_playback_pcm_open
,
2212 .prepare
= stac92xx_playback_pcm_prepare
,
2213 .cleanup
= stac92xx_playback_pcm_cleanup
2217 static struct hda_pcm_stream stac92xx_pcm_analog_capture
= {
2220 /* NID + .substreams is set in stac92xx_build_pcms */
2222 .prepare
= stac92xx_capture_pcm_prepare
,
2223 .cleanup
= stac92xx_capture_pcm_cleanup
2227 static int stac92xx_build_pcms(struct hda_codec
*codec
)
2229 struct sigmatel_spec
*spec
= codec
->spec
;
2230 struct hda_pcm
*info
= spec
->pcm_rec
;
2232 codec
->num_pcms
= 1;
2233 codec
->pcm_info
= info
;
2235 info
->name
= "STAC92xx Analog";
2236 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = stac92xx_pcm_analog_playback
;
2237 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = stac92xx_pcm_analog_capture
;
2238 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
2239 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].substreams
= spec
->num_adcs
;
2241 if (spec
->alt_switch
) {
2244 info
->name
= "STAC92xx Analog Alt";
2245 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = stac92xx_pcm_analog_alt_playback
;
2248 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
2251 info
->name
= "STAC92xx Digital";
2252 info
->pcm_type
= HDA_PCM_TYPE_SPDIF
;
2253 if (spec
->multiout
.dig_out_nid
) {
2254 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = stac92xx_pcm_digital_playback
;
2255 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
2257 if (spec
->dig_in_nid
) {
2258 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = stac92xx_pcm_digital_capture
;
2259 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
2266 static unsigned int stac92xx_get_vref(struct hda_codec
*codec
, hda_nid_t nid
)
2268 unsigned int pincap
= snd_hda_param_read(codec
, nid
,
2270 pincap
= (pincap
& AC_PINCAP_VREF
) >> AC_PINCAP_VREF_SHIFT
;
2271 if (pincap
& AC_PINCAP_VREF_100
)
2272 return AC_PINCTL_VREF_100
;
2273 if (pincap
& AC_PINCAP_VREF_80
)
2274 return AC_PINCTL_VREF_80
;
2275 if (pincap
& AC_PINCAP_VREF_50
)
2276 return AC_PINCTL_VREF_50
;
2277 if (pincap
& AC_PINCAP_VREF_GRD
)
2278 return AC_PINCTL_VREF_GRD
;
2282 static void stac92xx_auto_set_pinctl(struct hda_codec
*codec
, hda_nid_t nid
, int pin_type
)
2285 snd_hda_codec_write_cache(codec
, nid
, 0,
2286 AC_VERB_SET_PIN_WIDGET_CONTROL
, pin_type
);
2289 #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info
2291 static int stac92xx_hp_switch_get(struct snd_kcontrol
*kcontrol
,
2292 struct snd_ctl_elem_value
*ucontrol
)
2294 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2295 struct sigmatel_spec
*spec
= codec
->spec
;
2297 ucontrol
->value
.integer
.value
[0] = spec
->hp_switch
;
2301 static int stac92xx_hp_switch_put(struct snd_kcontrol
*kcontrol
,
2302 struct snd_ctl_elem_value
*ucontrol
)
2304 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2305 struct sigmatel_spec
*spec
= codec
->spec
;
2307 spec
->hp_switch
= ucontrol
->value
.integer
.value
[0];
2309 /* check to be sure that the ports are upto date with
2312 codec
->patch_ops
.unsol_event(codec
, STAC_HP_EVENT
<< 26);
2317 #define stac92xx_io_switch_info snd_ctl_boolean_mono_info
2319 static int stac92xx_io_switch_get(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
2321 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2322 struct sigmatel_spec
*spec
= codec
->spec
;
2323 int io_idx
= kcontrol
-> private_value
& 0xff;
2325 ucontrol
->value
.integer
.value
[0] = spec
->io_switch
[io_idx
];
2329 static int stac92xx_io_switch_put(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
2331 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2332 struct sigmatel_spec
*spec
= codec
->spec
;
2333 hda_nid_t nid
= kcontrol
->private_value
>> 8;
2334 int io_idx
= kcontrol
-> private_value
& 0xff;
2335 unsigned short val
= !!ucontrol
->value
.integer
.value
[0];
2337 spec
->io_switch
[io_idx
] = val
;
2340 stac92xx_auto_set_pinctl(codec
, nid
, AC_PINCTL_OUT_EN
);
2342 unsigned int pinctl
= AC_PINCTL_IN_EN
;
2343 if (io_idx
) /* set VREF for mic */
2344 pinctl
|= stac92xx_get_vref(codec
, nid
);
2345 stac92xx_auto_set_pinctl(codec
, nid
, pinctl
);
2348 /* check the auto-mute again: we need to mute/unmute the speaker
2349 * appropriately according to the pin direction
2351 if (spec
->hp_detect
)
2352 codec
->patch_ops
.unsol_event(codec
, STAC_HP_EVENT
<< 26);
2357 #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info
2359 static int stac92xx_clfe_switch_get(struct snd_kcontrol
*kcontrol
,
2360 struct snd_ctl_elem_value
*ucontrol
)
2362 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2363 struct sigmatel_spec
*spec
= codec
->spec
;
2365 ucontrol
->value
.integer
.value
[0] = spec
->clfe_swap
;
2369 static int stac92xx_clfe_switch_put(struct snd_kcontrol
*kcontrol
,
2370 struct snd_ctl_elem_value
*ucontrol
)
2372 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2373 struct sigmatel_spec
*spec
= codec
->spec
;
2374 hda_nid_t nid
= kcontrol
->private_value
& 0xff;
2375 unsigned int val
= !!ucontrol
->value
.integer
.value
[0];
2377 if (spec
->clfe_swap
== val
)
2380 spec
->clfe_swap
= val
;
2382 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
2383 spec
->clfe_swap
? 0x4 : 0x0);
2388 #define STAC_CODEC_HP_SWITCH(xname) \
2389 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2392 .info = stac92xx_hp_switch_info, \
2393 .get = stac92xx_hp_switch_get, \
2394 .put = stac92xx_hp_switch_put, \
2397 #define STAC_CODEC_IO_SWITCH(xname, xpval) \
2398 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2401 .info = stac92xx_io_switch_info, \
2402 .get = stac92xx_io_switch_get, \
2403 .put = stac92xx_io_switch_put, \
2404 .private_value = xpval, \
2407 #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \
2408 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2411 .info = stac92xx_clfe_switch_info, \
2412 .get = stac92xx_clfe_switch_get, \
2413 .put = stac92xx_clfe_switch_put, \
2414 .private_value = xpval, \
2418 STAC_CTL_WIDGET_VOL
,
2419 STAC_CTL_WIDGET_MUTE
,
2420 STAC_CTL_WIDGET_MONO_MUX
,
2421 STAC_CTL_WIDGET_HP_SWITCH
,
2422 STAC_CTL_WIDGET_IO_SWITCH
,
2423 STAC_CTL_WIDGET_CLFE_SWITCH
2426 static struct snd_kcontrol_new stac92xx_control_templates
[] = {
2427 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
2428 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
2430 STAC_CODEC_HP_SWITCH(NULL
),
2431 STAC_CODEC_IO_SWITCH(NULL
, 0),
2432 STAC_CODEC_CLFE_SWITCH(NULL
, 0),
2435 /* add dynamic controls */
2436 static int stac92xx_add_control_idx(struct sigmatel_spec
*spec
, int type
,
2437 int idx
, const char *name
, unsigned long val
)
2439 struct snd_kcontrol_new
*knew
;
2441 if (spec
->num_kctl_used
>= spec
->num_kctl_alloc
) {
2442 int num
= spec
->num_kctl_alloc
+ NUM_CONTROL_ALLOC
;
2444 knew
= kcalloc(num
+ 1, sizeof(*knew
), GFP_KERNEL
); /* array + terminator */
2447 if (spec
->kctl_alloc
) {
2448 memcpy(knew
, spec
->kctl_alloc
, sizeof(*knew
) * spec
->num_kctl_alloc
);
2449 kfree(spec
->kctl_alloc
);
2451 spec
->kctl_alloc
= knew
;
2452 spec
->num_kctl_alloc
= num
;
2455 knew
= &spec
->kctl_alloc
[spec
->num_kctl_used
];
2456 *knew
= stac92xx_control_templates
[type
];
2458 knew
->name
= kstrdup(name
, GFP_KERNEL
);
2461 knew
->private_value
= val
;
2462 spec
->num_kctl_used
++;
2467 /* add dynamic controls */
2468 static int stac92xx_add_control(struct sigmatel_spec
*spec
, int type
,
2469 const char *name
, unsigned long val
)
2471 return stac92xx_add_control_idx(spec
, type
, 0, name
, val
);
2474 /* flag inputs as additional dynamic lineouts */
2475 static int stac92xx_add_dyn_out_pins(struct hda_codec
*codec
, struct auto_pin_cfg
*cfg
)
2477 struct sigmatel_spec
*spec
= codec
->spec
;
2478 unsigned int wcaps
, wtype
;
2479 int i
, num_dacs
= 0;
2481 /* use the wcaps cache to count all DACs available for line-outs */
2482 for (i
= 0; i
< codec
->num_nodes
; i
++) {
2483 wcaps
= codec
->wcaps
[i
];
2484 wtype
= (wcaps
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
2486 if (wtype
== AC_WID_AUD_OUT
&& !(wcaps
& AC_WCAP_DIGITAL
))
2490 snd_printdd("%s: total dac count=%d\n", __func__
, num_dacs
);
2492 switch (cfg
->line_outs
) {
2494 /* add line-in as side */
2495 if (cfg
->input_pins
[AUTO_PIN_LINE
] && num_dacs
> 3) {
2496 cfg
->line_out_pins
[cfg
->line_outs
] =
2497 cfg
->input_pins
[AUTO_PIN_LINE
];
2498 spec
->line_switch
= 1;
2503 /* add line-in as clfe and mic as side */
2504 if (cfg
->input_pins
[AUTO_PIN_LINE
] && num_dacs
> 2) {
2505 cfg
->line_out_pins
[cfg
->line_outs
] =
2506 cfg
->input_pins
[AUTO_PIN_LINE
];
2507 spec
->line_switch
= 1;
2510 if (cfg
->input_pins
[AUTO_PIN_MIC
] && num_dacs
> 3) {
2511 cfg
->line_out_pins
[cfg
->line_outs
] =
2512 cfg
->input_pins
[AUTO_PIN_MIC
];
2513 spec
->mic_switch
= 1;
2518 /* add line-in as surr and mic as clfe */
2519 if (cfg
->input_pins
[AUTO_PIN_LINE
] && num_dacs
> 1) {
2520 cfg
->line_out_pins
[cfg
->line_outs
] =
2521 cfg
->input_pins
[AUTO_PIN_LINE
];
2522 spec
->line_switch
= 1;
2525 if (cfg
->input_pins
[AUTO_PIN_MIC
] && num_dacs
> 2) {
2526 cfg
->line_out_pins
[cfg
->line_outs
] =
2527 cfg
->input_pins
[AUTO_PIN_MIC
];
2528 spec
->mic_switch
= 1;
2538 static int is_in_dac_nids(struct sigmatel_spec
*spec
, hda_nid_t nid
)
2542 for (i
= 0; i
< spec
->multiout
.num_dacs
; i
++) {
2543 if (spec
->multiout
.dac_nids
[i
] == nid
)
2551 * Fill in the dac_nids table from the parsed pin configuration
2552 * This function only works when every pin in line_out_pins[]
2553 * contains atleast one DAC in its connection list. Some 92xx
2554 * codecs are not connected directly to a DAC, such as the 9200
2555 * and 9202/925x. For those, dac_nids[] must be hard-coded.
2557 static int stac92xx_auto_fill_dac_nids(struct hda_codec
*codec
,
2558 struct auto_pin_cfg
*cfg
)
2560 struct sigmatel_spec
*spec
= codec
->spec
;
2561 int i
, j
, conn_len
= 0;
2562 hda_nid_t nid
, conn
[HDA_MAX_CONNECTIONS
];
2563 unsigned int wcaps
, wtype
;
2565 for (i
= 0; i
< cfg
->line_outs
; i
++) {
2566 nid
= cfg
->line_out_pins
[i
];
2567 conn_len
= snd_hda_get_connections(codec
, nid
, conn
,
2568 HDA_MAX_CONNECTIONS
);
2569 for (j
= 0; j
< conn_len
; j
++) {
2570 wcaps
= snd_hda_param_read(codec
, conn
[j
],
2571 AC_PAR_AUDIO_WIDGET_CAP
);
2572 wtype
= (wcaps
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
2573 if (wtype
!= AC_WID_AUD_OUT
||
2574 (wcaps
& AC_WCAP_DIGITAL
))
2576 /* conn[j] is a DAC routed to this line-out */
2577 if (!is_in_dac_nids(spec
, conn
[j
]))
2581 if (j
== conn_len
) {
2582 if (spec
->multiout
.num_dacs
> 0) {
2583 /* we have already working output pins,
2584 * so let's drop the broken ones again
2586 cfg
->line_outs
= spec
->multiout
.num_dacs
;
2589 /* error out, no available DAC found */
2591 "%s: No available DAC for pin 0x%x\n",
2596 spec
->multiout
.dac_nids
[i
] = conn
[j
];
2597 spec
->multiout
.num_dacs
++;
2599 /* select this DAC in the pin's input mux */
2600 snd_hda_codec_write_cache(codec
, nid
, 0,
2601 AC_VERB_SET_CONNECT_SEL
, j
);
2606 snd_printd("dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
2607 spec
->multiout
.num_dacs
,
2608 spec
->multiout
.dac_nids
[0],
2609 spec
->multiout
.dac_nids
[1],
2610 spec
->multiout
.dac_nids
[2],
2611 spec
->multiout
.dac_nids
[3],
2612 spec
->multiout
.dac_nids
[4]);
2616 /* create volume control/switch for the given prefx type */
2617 static int create_controls(struct sigmatel_spec
*spec
, const char *pfx
, hda_nid_t nid
, int chs
)
2622 sprintf(name
, "%s Playback Volume", pfx
);
2623 err
= stac92xx_add_control(spec
, STAC_CTL_WIDGET_VOL
, name
,
2624 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_OUTPUT
));
2627 sprintf(name
, "%s Playback Switch", pfx
);
2628 err
= stac92xx_add_control(spec
, STAC_CTL_WIDGET_MUTE
, name
,
2629 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_OUTPUT
));
2635 static int add_spec_dacs(struct sigmatel_spec
*spec
, hda_nid_t nid
)
2637 if (!spec
->multiout
.hp_nid
)
2638 spec
->multiout
.hp_nid
= nid
;
2639 else if (spec
->multiout
.num_dacs
> 4) {
2640 printk(KERN_WARNING
"stac92xx: No space for DAC 0x%x\n", nid
);
2643 spec
->multiout
.dac_nids
[spec
->multiout
.num_dacs
] = nid
;
2644 spec
->multiout
.num_dacs
++;
2649 static int check_in_dac_nids(struct sigmatel_spec
*spec
, hda_nid_t nid
)
2651 if (is_in_dac_nids(spec
, nid
))
2653 if (spec
->multiout
.hp_nid
== nid
)
2658 /* add playback controls from the parsed DAC table */
2659 static int stac92xx_auto_create_multi_out_ctls(struct hda_codec
*codec
,
2660 const struct auto_pin_cfg
*cfg
)
2662 static const char *chname
[4] = {
2663 "Front", "Surround", NULL
/*CLFE*/, "Side"
2668 struct sigmatel_spec
*spec
= codec
->spec
;
2669 unsigned int wid_caps
, pincap
;
2672 for (i
= 0; i
< cfg
->line_outs
&& i
< spec
->multiout
.num_dacs
; i
++) {
2673 if (!spec
->multiout
.dac_nids
[i
])
2676 nid
= spec
->multiout
.dac_nids
[i
];
2680 err
= create_controls(spec
, "Center", nid
, 1);
2683 err
= create_controls(spec
, "LFE", nid
, 2);
2687 wid_caps
= get_wcaps(codec
, nid
);
2689 if (wid_caps
& AC_WCAP_LR_SWAP
) {
2690 err
= stac92xx_add_control(spec
,
2691 STAC_CTL_WIDGET_CLFE_SWITCH
,
2692 "Swap Center/LFE Playback Switch", nid
);
2699 err
= create_controls(spec
, chname
[i
], nid
, 3);
2705 if (cfg
->hp_outs
> 1) {
2706 err
= stac92xx_add_control(spec
,
2707 STAC_CTL_WIDGET_HP_SWITCH
,
2708 "Headphone as Line Out Switch", 0);
2713 if (spec
->line_switch
) {
2714 nid
= cfg
->input_pins
[AUTO_PIN_LINE
];
2715 pincap
= snd_hda_param_read(codec
, nid
,
2717 if (pincap
& AC_PINCAP_OUT
) {
2718 err
= stac92xx_add_control(spec
,
2719 STAC_CTL_WIDGET_IO_SWITCH
,
2720 "Line In as Output Switch", nid
<< 8);
2726 if (spec
->mic_switch
) {
2727 unsigned int def_conf
;
2728 unsigned int mic_pin
= AUTO_PIN_MIC
;
2730 nid
= cfg
->input_pins
[mic_pin
];
2731 def_conf
= snd_hda_codec_read(codec
, nid
, 0,
2732 AC_VERB_GET_CONFIG_DEFAULT
, 0);
2733 /* some laptops have an internal analog microphone
2734 * which can't be used as a output */
2735 if (get_defcfg_connect(def_conf
) != AC_JACK_PORT_FIXED
) {
2736 pincap
= snd_hda_param_read(codec
, nid
,
2738 if (pincap
& AC_PINCAP_OUT
) {
2739 err
= stac92xx_add_control(spec
,
2740 STAC_CTL_WIDGET_IO_SWITCH
,
2741 "Mic as Output Switch", (nid
<< 8) | 1);
2742 nid
= snd_hda_codec_read(codec
, nid
, 0,
2743 AC_VERB_GET_CONNECT_LIST
, 0) & 0xff;
2744 if (!check_in_dac_nids(spec
, nid
))
2745 add_spec_dacs(spec
, nid
);
2749 } else if (mic_pin
== AUTO_PIN_MIC
) {
2750 mic_pin
= AUTO_PIN_FRONT_MIC
;
2758 /* add playback controls for Speaker and HP outputs */
2759 static int stac92xx_auto_create_hp_ctls(struct hda_codec
*codec
,
2760 struct auto_pin_cfg
*cfg
)
2762 struct sigmatel_spec
*spec
= codec
->spec
;
2764 int i
, old_num_dacs
, err
;
2766 old_num_dacs
= spec
->multiout
.num_dacs
;
2767 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
2768 unsigned int wid_caps
= get_wcaps(codec
, cfg
->hp_pins
[i
]);
2769 if (wid_caps
& AC_WCAP_UNSOL_CAP
)
2770 spec
->hp_detect
= 1;
2771 nid
= snd_hda_codec_read(codec
, cfg
->hp_pins
[i
], 0,
2772 AC_VERB_GET_CONNECT_LIST
, 0) & 0xff;
2773 if (check_in_dac_nids(spec
, nid
))
2777 add_spec_dacs(spec
, nid
);
2779 for (i
= 0; i
< cfg
->speaker_outs
; i
++) {
2780 nid
= snd_hda_codec_read(codec
, cfg
->speaker_pins
[i
], 0,
2781 AC_VERB_GET_CONNECT_LIST
, 0) & 0xff;
2782 if (check_in_dac_nids(spec
, nid
))
2786 add_spec_dacs(spec
, nid
);
2788 for (i
= 0; i
< cfg
->line_outs
; i
++) {
2789 nid
= snd_hda_codec_read(codec
, cfg
->line_out_pins
[i
], 0,
2790 AC_VERB_GET_CONNECT_LIST
, 0) & 0xff;
2791 if (check_in_dac_nids(spec
, nid
))
2795 add_spec_dacs(spec
, nid
);
2797 for (i
= old_num_dacs
; i
< spec
->multiout
.num_dacs
; i
++) {
2798 static const char *pfxs
[] = {
2799 "Speaker", "External Speaker", "Speaker2",
2801 err
= create_controls(spec
, pfxs
[i
- old_num_dacs
],
2802 spec
->multiout
.dac_nids
[i
], 3);
2806 if (spec
->multiout
.hp_nid
) {
2807 err
= create_controls(spec
, "Headphone",
2808 spec
->multiout
.hp_nid
, 3);
2816 /* labels for mono mux outputs */
2817 static const char *stac92xx_mono_labels
[4] = {
2818 "DAC0", "DAC1", "Mixer", "DAC2"
2821 /* create mono mux for mono out on capable codecs */
2822 static int stac92xx_auto_create_mono_output_ctls(struct hda_codec
*codec
)
2824 struct sigmatel_spec
*spec
= codec
->spec
;
2825 struct hda_input_mux
*mono_mux
= &spec
->private_mono_mux
;
2827 hda_nid_t con_lst
[ARRAY_SIZE(stac92xx_mono_labels
)];
2829 num_cons
= snd_hda_get_connections(codec
,
2832 HDA_MAX_NUM_INPUTS
);
2833 if (!num_cons
|| num_cons
> ARRAY_SIZE(stac92xx_mono_labels
))
2836 for (i
= 0; i
< num_cons
; i
++) {
2837 mono_mux
->items
[mono_mux
->num_items
].label
=
2838 stac92xx_mono_labels
[i
];
2839 mono_mux
->items
[mono_mux
->num_items
].index
= i
;
2840 mono_mux
->num_items
++;
2843 return stac92xx_add_control(spec
, STAC_CTL_WIDGET_MONO_MUX
,
2844 "Mono Mux", spec
->mono_nid
);
2847 /* create PC beep volume controls */
2848 static int stac92xx_auto_create_beep_ctls(struct hda_codec
*codec
,
2851 struct sigmatel_spec
*spec
= codec
->spec
;
2852 u32 caps
= query_amp_caps(codec
, nid
, HDA_OUTPUT
);
2855 /* check for mute support for the the amp */
2856 if ((caps
& AC_AMPCAP_MUTE
) >> AC_AMPCAP_MUTE_SHIFT
) {
2857 err
= stac92xx_add_control(spec
, STAC_CTL_WIDGET_MUTE
,
2858 "PC Beep Playback Switch",
2859 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, HDA_OUTPUT
));
2864 /* check to see if there is volume support for the amp */
2865 if ((caps
& AC_AMPCAP_NUM_STEPS
) >> AC_AMPCAP_NUM_STEPS_SHIFT
) {
2866 err
= stac92xx_add_control(spec
, STAC_CTL_WIDGET_VOL
,
2867 "PC Beep Playback Volume",
2868 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, HDA_OUTPUT
));
2875 static int stac92xx_auto_create_mux_input_ctls(struct hda_codec
*codec
)
2877 struct sigmatel_spec
*spec
= codec
->spec
;
2878 int wcaps
, nid
, i
, err
= 0;
2880 for (i
= 0; i
< spec
->num_muxes
; i
++) {
2881 nid
= spec
->mux_nids
[i
];
2882 wcaps
= get_wcaps(codec
, nid
);
2884 if (wcaps
& AC_WCAP_OUT_AMP
) {
2885 err
= stac92xx_add_control_idx(spec
,
2886 STAC_CTL_WIDGET_VOL
, i
, "Mux Capture Volume",
2887 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
2895 static const char *stac92xx_spdif_labels
[3] = {
2896 "Digital Playback", "Analog Mux 1", "Analog Mux 2"
2899 static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec
*codec
)
2901 struct sigmatel_spec
*spec
= codec
->spec
;
2902 struct hda_input_mux
*spdif_mux
= &spec
->private_smux
;
2904 hda_nid_t con_lst
[ARRAY_SIZE(stac92xx_spdif_labels
)];
2906 num_cons
= snd_hda_get_connections(codec
,
2909 HDA_MAX_NUM_INPUTS
);
2910 if (!num_cons
|| num_cons
> ARRAY_SIZE(stac92xx_spdif_labels
))
2913 for (i
= 0; i
< num_cons
; i
++) {
2914 spdif_mux
->items
[spdif_mux
->num_items
].label
=
2915 stac92xx_spdif_labels
[i
];
2916 spdif_mux
->items
[spdif_mux
->num_items
].index
= i
;
2917 spdif_mux
->num_items
++;
2923 /* labels for dmic mux inputs */
2924 static const char *stac92xx_dmic_labels
[5] = {
2925 "Analog Inputs", "Digital Mic 1", "Digital Mic 2",
2926 "Digital Mic 3", "Digital Mic 4"
2929 /* create playback/capture controls for input pins on dmic capable codecs */
2930 static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec
*codec
,
2931 const struct auto_pin_cfg
*cfg
)
2933 struct sigmatel_spec
*spec
= codec
->spec
;
2934 struct hda_input_mux
*dimux
= &spec
->private_dimux
;
2935 hda_nid_t con_lst
[HDA_MAX_NUM_INPUTS
];
2939 dimux
->items
[dimux
->num_items
].label
= stac92xx_dmic_labels
[0];
2940 dimux
->items
[dimux
->num_items
].index
= 0;
2943 for (i
= 0; i
< spec
->num_dmics
; i
++) {
2948 unsigned int def_conf
;
2950 def_conf
= snd_hda_codec_read(codec
,
2953 AC_VERB_GET_CONFIG_DEFAULT
,
2955 if (get_defcfg_connect(def_conf
) == AC_JACK_PORT_NONE
)
2958 nid
= spec
->dmic_nids
[i
];
2959 num_cons
= snd_hda_get_connections(codec
,
2962 HDA_MAX_NUM_INPUTS
);
2963 for (j
= 0; j
< num_cons
; j
++)
2964 if (con_lst
[j
] == nid
) {
2970 wcaps
= get_wcaps(codec
, nid
) &
2971 (AC_WCAP_OUT_AMP
| AC_WCAP_IN_AMP
);
2974 sprintf(name
, "%s Capture Volume",
2975 stac92xx_dmic_labels
[dimux
->num_items
]);
2977 err
= stac92xx_add_control(spec
,
2978 STAC_CTL_WIDGET_VOL
,
2980 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
2981 (wcaps
& AC_WCAP_OUT_AMP
) ?
2982 HDA_OUTPUT
: HDA_INPUT
));
2987 dimux
->items
[dimux
->num_items
].label
=
2988 stac92xx_dmic_labels
[dimux
->num_items
];
2989 dimux
->items
[dimux
->num_items
].index
= index
;
2996 /* create playback/capture controls for input pins */
2997 static int stac92xx_auto_create_analog_input_ctls(struct hda_codec
*codec
, const struct auto_pin_cfg
*cfg
)
2999 struct sigmatel_spec
*spec
= codec
->spec
;
3000 struct hda_input_mux
*imux
= &spec
->private_imux
;
3001 hda_nid_t con_lst
[HDA_MAX_NUM_INPUTS
];
3004 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
3007 if (!cfg
->input_pins
[i
])
3010 for (j
= 0; j
< spec
->num_muxes
; j
++) {
3012 num_cons
= snd_hda_get_connections(codec
,
3015 HDA_MAX_NUM_INPUTS
);
3016 for (k
= 0; k
< num_cons
; k
++)
3017 if (con_lst
[k
] == cfg
->input_pins
[i
]) {
3024 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
3025 imux
->items
[imux
->num_items
].index
= index
;
3029 if (imux
->num_items
) {
3031 * Set the current input for the muxes.
3032 * The STAC9221 has two input muxes with identical source
3033 * NID lists. Hopefully this won't get confused.
3035 for (i
= 0; i
< spec
->num_muxes
; i
++) {
3036 snd_hda_codec_write_cache(codec
, spec
->mux_nids
[i
], 0,
3037 AC_VERB_SET_CONNECT_SEL
,
3038 imux
->items
[0].index
);
3045 static void stac92xx_auto_init_multi_out(struct hda_codec
*codec
)
3047 struct sigmatel_spec
*spec
= codec
->spec
;
3050 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
3051 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
3052 stac92xx_auto_set_pinctl(codec
, nid
, AC_PINCTL_OUT_EN
);
3056 static void stac92xx_auto_init_hp_out(struct hda_codec
*codec
)
3058 struct sigmatel_spec
*spec
= codec
->spec
;
3061 for (i
= 0; i
< spec
->autocfg
.hp_outs
; i
++) {
3063 pin
= spec
->autocfg
.hp_pins
[i
];
3064 if (pin
) /* connect to front */
3065 stac92xx_auto_set_pinctl(codec
, pin
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
);
3067 for (i
= 0; i
< spec
->autocfg
.speaker_outs
; i
++) {
3069 pin
= spec
->autocfg
.speaker_pins
[i
];
3070 if (pin
) /* connect to front */
3071 stac92xx_auto_set_pinctl(codec
, pin
, AC_PINCTL_OUT_EN
);
3075 static int stac92xx_parse_auto_config(struct hda_codec
*codec
, hda_nid_t dig_out
, hda_nid_t dig_in
)
3077 struct sigmatel_spec
*spec
= codec
->spec
;
3079 int hp_speaker_swap
= 0;
3081 if ((err
= snd_hda_parse_pin_def_config(codec
,
3083 spec
->dmic_nids
)) < 0)
3085 if (! spec
->autocfg
.line_outs
)
3086 return 0; /* can't find valid pin config */
3088 /* If we have no real line-out pin and multiple hp-outs, HPs should
3089 * be set up as multi-channel outputs.
3091 if (spec
->autocfg
.line_out_type
== AUTO_PIN_SPEAKER_OUT
&&
3092 spec
->autocfg
.hp_outs
> 1) {
3093 /* Copy hp_outs to line_outs, backup line_outs in
3094 * speaker_outs so that the following routines can handle
3095 * HP pins as primary outputs.
3097 memcpy(spec
->autocfg
.speaker_pins
, spec
->autocfg
.line_out_pins
,
3098 sizeof(spec
->autocfg
.line_out_pins
));
3099 spec
->autocfg
.speaker_outs
= spec
->autocfg
.line_outs
;
3100 memcpy(spec
->autocfg
.line_out_pins
, spec
->autocfg
.hp_pins
,
3101 sizeof(spec
->autocfg
.hp_pins
));
3102 spec
->autocfg
.line_outs
= spec
->autocfg
.hp_outs
;
3103 hp_speaker_swap
= 1;
3105 if (spec
->autocfg
.mono_out_pin
) {
3106 int dir
= get_wcaps(codec
, spec
->autocfg
.mono_out_pin
) &
3107 (AC_WCAP_OUT_AMP
| AC_WCAP_IN_AMP
);
3108 u32 caps
= query_amp_caps(codec
,
3109 spec
->autocfg
.mono_out_pin
, dir
);
3110 hda_nid_t conn_list
[1];
3112 /* get the mixer node and then the mono mux if it exists */
3113 if (snd_hda_get_connections(codec
,
3114 spec
->autocfg
.mono_out_pin
, conn_list
, 1) &&
3115 snd_hda_get_connections(codec
, conn_list
[0],
3118 int wcaps
= get_wcaps(codec
, conn_list
[0]);
3119 int wid_type
= (wcaps
& AC_WCAP_TYPE
)
3120 >> AC_WCAP_TYPE_SHIFT
;
3121 /* LR swap check, some stac925x have a mux that
3122 * changes the DACs output path instead of the
3125 if (wid_type
== AC_WID_AUD_SEL
&&
3126 !(wcaps
& AC_WCAP_LR_SWAP
))
3127 spec
->mono_nid
= conn_list
[0];
3130 hda_nid_t nid
= spec
->autocfg
.mono_out_pin
;
3132 /* most mono outs have a least a mute/unmute switch */
3133 dir
= (dir
& AC_WCAP_OUT_AMP
) ? HDA_OUTPUT
: HDA_INPUT
;
3134 err
= stac92xx_add_control(spec
, STAC_CTL_WIDGET_MUTE
,
3135 "Mono Playback Switch",
3136 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, dir
));
3139 /* check for volume support for the amp */
3140 if ((caps
& AC_AMPCAP_NUM_STEPS
)
3141 >> AC_AMPCAP_NUM_STEPS_SHIFT
) {
3142 err
= stac92xx_add_control(spec
,
3143 STAC_CTL_WIDGET_VOL
,
3144 "Mono Playback Volume",
3145 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, dir
));
3151 stac92xx_auto_set_pinctl(codec
, spec
->autocfg
.mono_out_pin
,
3155 if ((err
= stac92xx_add_dyn_out_pins(codec
, &spec
->autocfg
)) < 0)
3157 if (spec
->multiout
.num_dacs
== 0)
3158 if ((err
= stac92xx_auto_fill_dac_nids(codec
, &spec
->autocfg
)) < 0)
3161 err
= stac92xx_auto_create_multi_out_ctls(codec
, &spec
->autocfg
);
3166 /* setup analog beep controls */
3167 if (spec
->anabeep_nid
> 0) {
3168 err
= stac92xx_auto_create_beep_ctls(codec
,
3174 /* setup digital beep controls and input device */
3175 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3176 if (spec
->digbeep_nid
> 0) {
3177 hda_nid_t nid
= spec
->digbeep_nid
;
3179 err
= stac92xx_auto_create_beep_ctls(codec
, nid
);
3182 err
= snd_hda_attach_beep_device(codec
, nid
);
3188 if (hp_speaker_swap
== 1) {
3189 /* Restore the hp_outs and line_outs */
3190 memcpy(spec
->autocfg
.hp_pins
, spec
->autocfg
.line_out_pins
,
3191 sizeof(spec
->autocfg
.line_out_pins
));
3192 spec
->autocfg
.hp_outs
= spec
->autocfg
.line_outs
;
3193 memcpy(spec
->autocfg
.line_out_pins
, spec
->autocfg
.speaker_pins
,
3194 sizeof(spec
->autocfg
.speaker_pins
));
3195 spec
->autocfg
.line_outs
= spec
->autocfg
.speaker_outs
;
3196 memset(spec
->autocfg
.speaker_pins
, 0,
3197 sizeof(spec
->autocfg
.speaker_pins
));
3198 spec
->autocfg
.speaker_outs
= 0;
3201 err
= stac92xx_auto_create_hp_ctls(codec
, &spec
->autocfg
);
3206 err
= stac92xx_auto_create_analog_input_ctls(codec
, &spec
->autocfg
);
3211 if (spec
->mono_nid
> 0) {
3212 err
= stac92xx_auto_create_mono_output_ctls(codec
);
3217 if (spec
->num_dmics
> 0)
3218 if ((err
= stac92xx_auto_create_dmic_input_ctls(codec
,
3219 &spec
->autocfg
)) < 0)
3221 if (spec
->num_muxes
> 0) {
3222 err
= stac92xx_auto_create_mux_input_ctls(codec
);
3226 if (spec
->num_smuxes
> 0) {
3227 err
= stac92xx_auto_create_spdif_mux_ctls(codec
);
3232 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
3233 if (spec
->multiout
.max_channels
> 2)
3234 spec
->surr_switch
= 1;
3236 if (spec
->autocfg
.dig_out_pin
)
3237 spec
->multiout
.dig_out_nid
= dig_out
;
3238 if (dig_in
&& spec
->autocfg
.dig_in_pin
)
3239 spec
->dig_in_nid
= dig_in
;
3241 if (spec
->kctl_alloc
)
3242 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
3244 spec
->input_mux
= &spec
->private_imux
;
3245 if (!spec
->dinput_mux
)
3246 spec
->dinput_mux
= &spec
->private_dimux
;
3247 spec
->sinput_mux
= &spec
->private_smux
;
3248 spec
->mono_mux
= &spec
->private_mono_mux
;
3253 /* add playback controls for HP output */
3254 static int stac9200_auto_create_hp_ctls(struct hda_codec
*codec
,
3255 struct auto_pin_cfg
*cfg
)
3257 struct sigmatel_spec
*spec
= codec
->spec
;
3258 hda_nid_t pin
= cfg
->hp_pins
[0];
3259 unsigned int wid_caps
;
3264 wid_caps
= get_wcaps(codec
, pin
);
3265 if (wid_caps
& AC_WCAP_UNSOL_CAP
)
3266 spec
->hp_detect
= 1;
3271 /* add playback controls for LFE output */
3272 static int stac9200_auto_create_lfe_ctls(struct hda_codec
*codec
,
3273 struct auto_pin_cfg
*cfg
)
3275 struct sigmatel_spec
*spec
= codec
->spec
;
3277 hda_nid_t lfe_pin
= 0x0;
3281 * search speaker outs and line outs for a mono speaker pin
3282 * with an amp. If one is found, add LFE controls
3285 for (i
= 0; i
< spec
->autocfg
.speaker_outs
&& lfe_pin
== 0x0; i
++) {
3286 hda_nid_t pin
= spec
->autocfg
.speaker_pins
[i
];
3287 unsigned int wcaps
= get_wcaps(codec
, pin
);
3288 wcaps
&= (AC_WCAP_STEREO
| AC_WCAP_OUT_AMP
);
3289 if (wcaps
== AC_WCAP_OUT_AMP
)
3290 /* found a mono speaker with an amp, must be lfe */
3294 /* if speaker_outs is 0, then speakers may be in line_outs */
3295 if (lfe_pin
== 0 && spec
->autocfg
.speaker_outs
== 0) {
3296 for (i
= 0; i
< spec
->autocfg
.line_outs
&& lfe_pin
== 0x0; i
++) {
3297 hda_nid_t pin
= spec
->autocfg
.line_out_pins
[i
];
3298 unsigned int defcfg
;
3299 defcfg
= snd_hda_codec_read(codec
, pin
, 0,
3300 AC_VERB_GET_CONFIG_DEFAULT
,
3302 if (get_defcfg_device(defcfg
) == AC_JACK_SPEAKER
) {
3303 unsigned int wcaps
= get_wcaps(codec
, pin
);
3304 wcaps
&= (AC_WCAP_STEREO
| AC_WCAP_OUT_AMP
);
3305 if (wcaps
== AC_WCAP_OUT_AMP
)
3306 /* found a mono speaker with an amp,
3314 err
= create_controls(spec
, "LFE", lfe_pin
, 1);
3322 static int stac9200_parse_auto_config(struct hda_codec
*codec
)
3324 struct sigmatel_spec
*spec
= codec
->spec
;
3327 if ((err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
, NULL
)) < 0)
3330 if ((err
= stac92xx_auto_create_analog_input_ctls(codec
, &spec
->autocfg
)) < 0)
3333 if ((err
= stac9200_auto_create_hp_ctls(codec
, &spec
->autocfg
)) < 0)
3336 if ((err
= stac9200_auto_create_lfe_ctls(codec
, &spec
->autocfg
)) < 0)
3339 if (spec
->autocfg
.dig_out_pin
)
3340 spec
->multiout
.dig_out_nid
= 0x05;
3341 if (spec
->autocfg
.dig_in_pin
)
3342 spec
->dig_in_nid
= 0x04;
3344 if (spec
->kctl_alloc
)
3345 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
3347 spec
->input_mux
= &spec
->private_imux
;
3348 spec
->dinput_mux
= &spec
->private_dimux
;
3354 * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
3355 * funky external mute control using GPIO pins.
3358 static void stac_gpio_set(struct hda_codec
*codec
, unsigned int mask
,
3359 unsigned int dir_mask
, unsigned int data
)
3361 unsigned int gpiostate
, gpiomask
, gpiodir
;
3363 gpiostate
= snd_hda_codec_read(codec
, codec
->afg
, 0,
3364 AC_VERB_GET_GPIO_DATA
, 0);
3365 gpiostate
= (gpiostate
& ~dir_mask
) | (data
& dir_mask
);
3367 gpiomask
= snd_hda_codec_read(codec
, codec
->afg
, 0,
3368 AC_VERB_GET_GPIO_MASK
, 0);
3371 gpiodir
= snd_hda_codec_read(codec
, codec
->afg
, 0,
3372 AC_VERB_GET_GPIO_DIRECTION
, 0);
3373 gpiodir
|= dir_mask
;
3375 /* Configure GPIOx as CMOS */
3376 snd_hda_codec_write(codec
, codec
->afg
, 0, 0x7e7, 0);
3378 snd_hda_codec_write(codec
, codec
->afg
, 0,
3379 AC_VERB_SET_GPIO_MASK
, gpiomask
);
3380 snd_hda_codec_read(codec
, codec
->afg
, 0,
3381 AC_VERB_SET_GPIO_DIRECTION
, gpiodir
); /* sync */
3385 snd_hda_codec_read(codec
, codec
->afg
, 0,
3386 AC_VERB_SET_GPIO_DATA
, gpiostate
); /* sync */
3389 static void enable_pin_detect(struct hda_codec
*codec
, hda_nid_t nid
,
3392 if (get_wcaps(codec
, nid
) & AC_WCAP_UNSOL_CAP
)
3393 snd_hda_codec_write_cache(codec
, nid
, 0,
3394 AC_VERB_SET_UNSOLICITED_ENABLE
,
3395 (AC_USRSP_EN
| event
));
3398 static int is_nid_hp_pin(struct auto_pin_cfg
*cfg
, hda_nid_t nid
)
3401 for (i
= 0; i
< cfg
->hp_outs
; i
++)
3402 if (cfg
->hp_pins
[i
] == nid
)
3403 return 1; /* nid is a HP-Out */
3405 return 0; /* nid is not a HP-Out */
3408 static void stac92xx_power_down(struct hda_codec
*codec
)
3410 struct sigmatel_spec
*spec
= codec
->spec
;
3412 /* power down inactive DACs */
3414 for (dac
= spec
->dac_list
; *dac
; dac
++)
3415 if (!is_in_dac_nids(spec
, *dac
) &&
3416 spec
->multiout
.hp_nid
!= *dac
)
3417 snd_hda_codec_write_cache(codec
, *dac
, 0,
3418 AC_VERB_SET_POWER_STATE
, AC_PWRST_D3
);
3421 static int stac92xx_init(struct hda_codec
*codec
)
3423 struct sigmatel_spec
*spec
= codec
->spec
;
3424 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
3427 snd_hda_sequence_write(codec
, spec
->init
);
3429 /* power down adcs initially */
3430 if (spec
->powerdown_adcs
)
3431 for (i
= 0; i
< spec
->num_adcs
; i
++)
3432 snd_hda_codec_write_cache(codec
,
3433 spec
->adc_nids
[i
], 0,
3434 AC_VERB_SET_POWER_STATE
, AC_PWRST_D3
);
3436 if (spec
->hp_detect
) {
3437 /* Enable unsolicited responses on the HP widget */
3438 for (i
= 0; i
< cfg
->hp_outs
; i
++)
3439 enable_pin_detect(codec
, cfg
->hp_pins
[i
],
3441 /* force to enable the first line-out; the others are set up
3444 stac92xx_auto_set_pinctl(codec
, spec
->autocfg
.line_out_pins
[0],
3446 stac92xx_auto_init_hp_out(codec
);
3447 /* fake event to set up pins */
3448 codec
->patch_ops
.unsol_event(codec
, STAC_HP_EVENT
<< 26);
3450 stac92xx_auto_init_multi_out(codec
);
3451 stac92xx_auto_init_hp_out(codec
);
3453 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
3454 hda_nid_t nid
= cfg
->input_pins
[i
];
3456 unsigned int pinctl
= AC_PINCTL_IN_EN
;
3457 if (i
== AUTO_PIN_MIC
|| i
== AUTO_PIN_FRONT_MIC
)
3458 pinctl
|= stac92xx_get_vref(codec
, nid
);
3459 stac92xx_auto_set_pinctl(codec
, nid
, pinctl
);
3462 for (i
= 0; i
< spec
->num_dmics
; i
++)
3463 stac92xx_auto_set_pinctl(codec
, spec
->dmic_nids
[i
],
3465 for (i
= 0; i
< spec
->num_pwrs
; i
++) {
3466 int event
= is_nid_hp_pin(cfg
, spec
->pwr_nids
[i
])
3467 ? STAC_HP_EVENT
: STAC_PWR_EVENT
;
3468 int pinctl
= snd_hda_codec_read(codec
, spec
->pwr_nids
[i
],
3469 0, AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
3470 int def_conf
= snd_hda_codec_read(codec
, spec
->pwr_nids
[i
],
3471 0, AC_VERB_GET_CONFIG_DEFAULT
, 0);
3472 def_conf
= get_defcfg_connect(def_conf
);
3473 /* outputs are only ports capable of power management
3474 * any attempts on powering down a input port cause the
3475 * referenced VREF to act quirky.
3477 if (pinctl
& AC_PINCTL_IN_EN
)
3479 /* skip any ports that don't have jacks since presence
3480 * detection is useless */
3481 if (def_conf
&& def_conf
!= AC_JACK_PORT_FIXED
)
3483 enable_pin_detect(codec
, spec
->pwr_nids
[i
], event
| i
);
3484 codec
->patch_ops
.unsol_event(codec
, (event
| i
) << 26);
3487 stac92xx_power_down(codec
);
3488 if (cfg
->dig_out_pin
)
3489 stac92xx_auto_set_pinctl(codec
, cfg
->dig_out_pin
,
3491 if (cfg
->dig_in_pin
)
3492 stac92xx_auto_set_pinctl(codec
, cfg
->dig_in_pin
,
3495 stac_gpio_set(codec
, spec
->gpio_mask
,
3496 spec
->gpio_dir
, spec
->gpio_data
);
3501 static void stac92xx_free(struct hda_codec
*codec
)
3503 struct sigmatel_spec
*spec
= codec
->spec
;
3509 if (spec
->kctl_alloc
) {
3510 for (i
= 0; i
< spec
->num_kctl_used
; i
++)
3511 kfree(spec
->kctl_alloc
[i
].name
);
3512 kfree(spec
->kctl_alloc
);
3515 if (spec
->bios_pin_configs
)
3516 kfree(spec
->bios_pin_configs
);
3519 snd_hda_detach_beep_device(codec
);
3522 static void stac92xx_set_pinctl(struct hda_codec
*codec
, hda_nid_t nid
,
3525 unsigned int pin_ctl
= snd_hda_codec_read(codec
, nid
,
3526 0, AC_VERB_GET_PIN_WIDGET_CONTROL
, 0x00);
3528 if (pin_ctl
& AC_PINCTL_IN_EN
) {
3530 * we need to check the current set-up direction of
3531 * shared input pins since they can be switched via
3532 * "xxx as Output" mixer switch
3534 struct sigmatel_spec
*spec
= codec
->spec
;
3535 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
3536 if ((nid
== cfg
->input_pins
[AUTO_PIN_LINE
] &&
3537 spec
->line_switch
) ||
3538 (nid
== cfg
->input_pins
[AUTO_PIN_MIC
] &&
3543 /* if setting pin direction bits, clear the current
3544 direction bits first */
3545 if (flag
& (AC_PINCTL_IN_EN
| AC_PINCTL_OUT_EN
))
3546 pin_ctl
&= ~(AC_PINCTL_IN_EN
| AC_PINCTL_OUT_EN
);
3548 snd_hda_codec_write_cache(codec
, nid
, 0,
3549 AC_VERB_SET_PIN_WIDGET_CONTROL
,
3553 static void stac92xx_reset_pinctl(struct hda_codec
*codec
, hda_nid_t nid
,
3556 unsigned int pin_ctl
= snd_hda_codec_read(codec
, nid
,
3557 0, AC_VERB_GET_PIN_WIDGET_CONTROL
, 0x00);
3558 snd_hda_codec_write_cache(codec
, nid
, 0,
3559 AC_VERB_SET_PIN_WIDGET_CONTROL
,
3563 static int get_hp_pin_presence(struct hda_codec
*codec
, hda_nid_t nid
)
3567 if (snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_PIN_SENSE
, 0x00)
3569 unsigned int pinctl
;
3570 pinctl
= snd_hda_codec_read(codec
, nid
, 0,
3571 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
3572 if (pinctl
& AC_PINCTL_IN_EN
)
3573 return 0; /* mic- or line-input */
3575 return 1; /* HP-output */
3580 static void stac92xx_hp_detect(struct hda_codec
*codec
, unsigned int res
)
3582 struct sigmatel_spec
*spec
= codec
->spec
;
3583 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
3584 int nid
= cfg
->hp_pins
[cfg
->hp_outs
- 1];
3588 if (spec
->gpio_mute
)
3589 presence
= !(snd_hda_codec_read(codec
, codec
->afg
, 0,
3590 AC_VERB_GET_GPIO_DATA
, 0) & spec
->gpio_mute
);
3592 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
3595 if (spec
->hp_switch
&& cfg
->hp_pins
[i
] == nid
)
3597 presence
= get_hp_pin_presence(codec
, cfg
->hp_pins
[i
]);
3601 /* disable lineouts, enable hp */
3602 if (spec
->hp_switch
)
3603 stac92xx_reset_pinctl(codec
, nid
, AC_PINCTL_OUT_EN
);
3604 for (i
= 0; i
< cfg
->line_outs
; i
++)
3605 stac92xx_reset_pinctl(codec
, cfg
->line_out_pins
[i
],
3607 for (i
= 0; i
< cfg
->speaker_outs
; i
++)
3608 stac92xx_reset_pinctl(codec
, cfg
->speaker_pins
[i
],
3610 if (spec
->eapd_mask
)
3611 stac_gpio_set(codec
, spec
->gpio_mask
,
3612 spec
->gpio_dir
, spec
->gpio_data
&
3615 /* enable lineouts, disable hp */
3616 if (spec
->hp_switch
)
3617 stac92xx_set_pinctl(codec
, nid
, AC_PINCTL_OUT_EN
);
3618 for (i
= 0; i
< cfg
->line_outs
; i
++)
3619 stac92xx_set_pinctl(codec
, cfg
->line_out_pins
[i
],
3621 for (i
= 0; i
< cfg
->speaker_outs
; i
++)
3622 stac92xx_set_pinctl(codec
, cfg
->speaker_pins
[i
],
3624 if (spec
->eapd_mask
)
3625 stac_gpio_set(codec
, spec
->gpio_mask
,
3626 spec
->gpio_dir
, spec
->gpio_data
|
3629 if (!spec
->hp_switch
&& cfg
->hp_outs
> 1 && presence
)
3630 stac92xx_set_pinctl(codec
, nid
, AC_PINCTL_OUT_EN
);
3633 static void stac92xx_pin_sense(struct hda_codec
*codec
, int idx
)
3635 struct sigmatel_spec
*spec
= codec
->spec
;
3636 hda_nid_t nid
= spec
->pwr_nids
[idx
];
3638 val
= snd_hda_codec_read(codec
, codec
->afg
, 0, 0x0fec, 0x0)
3640 presence
= get_hp_pin_presence(codec
, nid
);
3642 /* several codecs have two power down bits */
3643 if (spec
->pwr_mapping
)
3644 idx
= spec
->pwr_mapping
[idx
];
3653 /* power down unused output ports */
3654 snd_hda_codec_write(codec
, codec
->afg
, 0, 0x7ec, val
);
3657 static void stac92xx_unsol_event(struct hda_codec
*codec
, unsigned int res
)
3659 struct sigmatel_spec
*spec
= codec
->spec
;
3660 int idx
= res
>> 26 & 0x0f;
3662 switch ((res
>> 26) & 0x30) {
3664 stac92xx_hp_detect(codec
, res
);
3666 case STAC_PWR_EVENT
:
3667 if (spec
->num_pwrs
> 0)
3668 stac92xx_pin_sense(codec
, idx
);
3672 #ifdef SND_HDA_NEEDS_RESUME
3673 static int stac92xx_resume(struct hda_codec
*codec
)
3675 struct sigmatel_spec
*spec
= codec
->spec
;
3677 stac92xx_set_config_regs(codec
);
3678 snd_hda_sequence_write(codec
, spec
->init
);
3679 stac_gpio_set(codec
, spec
->gpio_mask
,
3680 spec
->gpio_dir
, spec
->gpio_data
);
3681 snd_hda_codec_resume_amp(codec
);
3682 snd_hda_codec_resume_cache(codec
);
3683 /* power down inactive DACs */
3685 stac92xx_power_down(codec
);
3686 /* invoke unsolicited event to reset the HP state */
3687 if (spec
->hp_detect
)
3688 codec
->patch_ops
.unsol_event(codec
, STAC_HP_EVENT
<< 26);
3693 static struct hda_codec_ops stac92xx_patch_ops
= {
3694 .build_controls
= stac92xx_build_controls
,
3695 .build_pcms
= stac92xx_build_pcms
,
3696 .init
= stac92xx_init
,
3697 .free
= stac92xx_free
,
3698 .unsol_event
= stac92xx_unsol_event
,
3699 #ifdef SND_HDA_NEEDS_RESUME
3700 .resume
= stac92xx_resume
,
3704 static int patch_stac9200(struct hda_codec
*codec
)
3706 struct sigmatel_spec
*spec
;
3709 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
3714 spec
->num_pins
= ARRAY_SIZE(stac9200_pin_nids
);
3715 spec
->pin_nids
= stac9200_pin_nids
;
3716 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_9200_MODELS
,
3719 if (spec
->board_config
< 0) {
3720 snd_printdd(KERN_INFO
"hda_codec: Unknown model for STAC9200, using BIOS defaults\n");
3721 err
= stac92xx_save_bios_config_regs(codec
);
3723 stac92xx_free(codec
);
3726 spec
->pin_configs
= spec
->bios_pin_configs
;
3728 spec
->pin_configs
= stac9200_brd_tbl
[spec
->board_config
];
3729 stac92xx_set_config_regs(codec
);
3732 spec
->multiout
.max_channels
= 2;
3733 spec
->multiout
.num_dacs
= 1;
3734 spec
->multiout
.dac_nids
= stac9200_dac_nids
;
3735 spec
->adc_nids
= stac9200_adc_nids
;
3736 spec
->mux_nids
= stac9200_mux_nids
;
3737 spec
->num_muxes
= 1;
3738 spec
->num_dmics
= 0;
3742 if (spec
->board_config
== STAC_9200_GATEWAY
||
3743 spec
->board_config
== STAC_9200_OQO
)
3744 spec
->init
= stac9200_eapd_init
;
3746 spec
->init
= stac9200_core_init
;
3747 spec
->mixer
= stac9200_mixer
;
3749 if (spec
->board_config
== STAC_9200_PANASONIC
) {
3750 spec
->gpio_mask
= spec
->gpio_dir
= 0x09;
3751 spec
->gpio_data
= 0x00;
3754 err
= stac9200_parse_auto_config(codec
);
3756 stac92xx_free(codec
);
3760 codec
->patch_ops
= stac92xx_patch_ops
;
3765 static int patch_stac925x(struct hda_codec
*codec
)
3767 struct sigmatel_spec
*spec
;
3770 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
3775 spec
->num_pins
= ARRAY_SIZE(stac925x_pin_nids
);
3776 spec
->pin_nids
= stac925x_pin_nids
;
3777 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_925x_MODELS
,
3781 if (spec
->board_config
< 0) {
3782 snd_printdd(KERN_INFO
"hda_codec: Unknown model for STAC925x,"
3783 "using BIOS defaults\n");
3784 err
= stac92xx_save_bios_config_regs(codec
);
3786 stac92xx_free(codec
);
3789 spec
->pin_configs
= spec
->bios_pin_configs
;
3790 } else if (stac925x_brd_tbl
[spec
->board_config
] != NULL
){
3791 spec
->pin_configs
= stac925x_brd_tbl
[spec
->board_config
];
3792 stac92xx_set_config_regs(codec
);
3795 spec
->multiout
.max_channels
= 2;
3796 spec
->multiout
.num_dacs
= 1;
3797 spec
->multiout
.dac_nids
= stac925x_dac_nids
;
3798 spec
->adc_nids
= stac925x_adc_nids
;
3799 spec
->mux_nids
= stac925x_mux_nids
;
3800 spec
->num_muxes
= 1;
3803 switch (codec
->vendor_id
) {
3804 case 0x83847632: /* STAC9202 */
3805 case 0x83847633: /* STAC9202D */
3806 case 0x83847636: /* STAC9251 */
3807 case 0x83847637: /* STAC9251D */
3808 spec
->num_dmics
= STAC925X_NUM_DMICS
;
3809 spec
->dmic_nids
= stac925x_dmic_nids
;
3810 spec
->num_dmuxes
= ARRAY_SIZE(stac925x_dmux_nids
);
3811 spec
->dmux_nids
= stac925x_dmux_nids
;
3814 spec
->num_dmics
= 0;
3818 spec
->init
= stac925x_core_init
;
3819 spec
->mixer
= stac925x_mixer
;
3821 err
= stac92xx_parse_auto_config(codec
, 0x8, 0x7);
3823 if (spec
->board_config
< 0) {
3824 printk(KERN_WARNING
"hda_codec: No auto-config is "
3825 "available, default to model=ref\n");
3826 spec
->board_config
= STAC_925x_REF
;
3832 stac92xx_free(codec
);
3836 codec
->patch_ops
= stac92xx_patch_ops
;
3841 static struct hda_input_mux stac92hd73xx_dmux
= {
3844 { "Analog Inputs", 0x0b },
3846 { "Digital Mic 1", 0x09 },
3847 { "Digital Mic 2", 0x0a },
3851 static int patch_stac92hd73xx(struct hda_codec
*codec
)
3853 struct sigmatel_spec
*spec
;
3854 hda_nid_t conn
[STAC92HD73_DAC_COUNT
+ 2];
3857 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
3862 spec
->num_pins
= ARRAY_SIZE(stac92hd73xx_pin_nids
);
3863 spec
->pin_nids
= stac92hd73xx_pin_nids
;
3864 spec
->board_config
= snd_hda_check_board_config(codec
,
3865 STAC_92HD73XX_MODELS
,
3866 stac92hd73xx_models
,
3867 stac92hd73xx_cfg_tbl
);
3869 if (spec
->board_config
< 0) {
3870 snd_printdd(KERN_INFO
"hda_codec: Unknown model for"
3871 " STAC92HD73XX, using BIOS defaults\n");
3872 err
= stac92xx_save_bios_config_regs(codec
);
3874 stac92xx_free(codec
);
3877 spec
->pin_configs
= spec
->bios_pin_configs
;
3879 spec
->pin_configs
= stac92hd73xx_brd_tbl
[spec
->board_config
];
3880 stac92xx_set_config_regs(codec
);
3883 spec
->multiout
.num_dacs
= snd_hda_get_connections(codec
, 0x0a,
3884 conn
, STAC92HD73_DAC_COUNT
+ 2) - 1;
3886 if (spec
->multiout
.num_dacs
< 0) {
3887 printk(KERN_WARNING
"hda_codec: Could not determine "
3888 "number of channels defaulting to DAC count\n");
3889 spec
->multiout
.num_dacs
= STAC92HD73_DAC_COUNT
;
3892 switch (spec
->multiout
.num_dacs
) {
3893 case 0x3: /* 6 Channel */
3894 spec
->mixer
= stac92hd73xx_6ch_mixer
;
3895 spec
->init
= stac92hd73xx_6ch_core_init
;
3897 case 0x4: /* 8 Channel */
3898 spec
->mixer
= stac92hd73xx_8ch_mixer
;
3899 spec
->init
= stac92hd73xx_8ch_core_init
;
3901 case 0x5: /* 10 Channel */
3902 spec
->mixer
= stac92hd73xx_10ch_mixer
;
3903 spec
->init
= stac92hd73xx_10ch_core_init
;
3906 spec
->multiout
.dac_nids
= stac92hd73xx_dac_nids
;
3907 spec
->aloopback_mask
= 0x01;
3908 spec
->aloopback_shift
= 8;
3910 spec
->digbeep_nid
= 0x1c;
3911 spec
->mux_nids
= stac92hd73xx_mux_nids
;
3912 spec
->adc_nids
= stac92hd73xx_adc_nids
;
3913 spec
->dmic_nids
= stac92hd73xx_dmic_nids
;
3914 spec
->dmux_nids
= stac92hd73xx_dmux_nids
;
3915 spec
->smux_nids
= stac92hd73xx_smux_nids
;
3917 spec
->num_muxes
= ARRAY_SIZE(stac92hd73xx_mux_nids
);
3918 spec
->num_adcs
= ARRAY_SIZE(stac92hd73xx_adc_nids
);
3919 spec
->num_dmuxes
= ARRAY_SIZE(stac92hd73xx_dmux_nids
);
3920 spec
->num_smuxes
= ARRAY_SIZE(stac92hd73xx_smux_nids
);
3921 spec
->dinput_mux
= &stac92hd73xx_dmux
;
3922 /* GPIO0 High = Enable EAPD */
3923 spec
->eapd_mask
= spec
->gpio_mask
= spec
->gpio_dir
= 0x1;
3924 spec
->gpio_data
= 0x01;
3926 switch (spec
->board_config
) {
3928 spec
->init
= dell_eq_core_init
;
3929 switch (codec
->subsystem_id
) {
3930 case 0x1028025e: /* Analog Mics */
3932 stac92xx_set_config_reg(codec
, 0x0b, 0x90A70170);
3933 spec
->num_dmics
= 0;
3935 case 0x10280271: /* Digital Mics */
3937 spec
->init
= dell_m6_core_init
;
3941 stac92xx_set_config_reg(codec
, 0x13, 0x90A60160);
3942 spec
->num_dmics
= 1;
3944 case 0x10280256: /* Both */
3946 stac92xx_set_config_reg(codec
, 0x0b, 0x90A70170);
3947 stac92xx_set_config_reg(codec
, 0x13, 0x90A60160);
3948 spec
->num_dmics
= 1;
3953 spec
->num_dmics
= STAC92HD73XX_NUM_DMICS
;
3956 spec
->num_pwrs
= ARRAY_SIZE(stac92hd73xx_pwr_nids
);
3957 spec
->pwr_nids
= stac92hd73xx_pwr_nids
;
3959 err
= stac92xx_parse_auto_config(codec
, 0x25, 0x27);
3962 if (spec
->board_config
< 0) {
3963 printk(KERN_WARNING
"hda_codec: No auto-config is "
3964 "available, default to model=ref\n");
3965 spec
->board_config
= STAC_92HD73XX_REF
;
3972 stac92xx_free(codec
);
3976 codec
->patch_ops
= stac92xx_patch_ops
;
3981 static struct hda_input_mux stac92hd83xxx_dmux
= {
3984 { "Analog Inputs", 0x03 },
3985 { "Digital Mic 1", 0x04 },
3986 { "Digital Mic 2", 0x05 },
3990 static int patch_stac92hd83xxx(struct hda_codec
*codec
)
3992 struct sigmatel_spec
*spec
;
3995 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
4000 codec
->slave_dig_outs
= stac92hd83xxx_slave_dig_outs
;
4001 spec
->mono_nid
= 0x19;
4002 spec
->digbeep_nid
= 0x21;
4003 spec
->dmic_nids
= stac92hd83xxx_dmic_nids
;
4004 spec
->dmux_nids
= stac92hd83xxx_dmux_nids
;
4005 spec
->adc_nids
= stac92hd83xxx_adc_nids
;
4006 spec
->pwr_nids
= stac92hd83xxx_pwr_nids
;
4007 spec
->pwr_mapping
= stac92hd83xxx_pwr_mapping
;
4008 spec
->num_pwrs
= ARRAY_SIZE(stac92hd83xxx_pwr_nids
);
4009 spec
->multiout
.dac_nids
= stac92hd83xxx_dac_nids
;
4011 spec
->init
= stac92hd83xxx_core_init
;
4012 switch (codec
->vendor_id
) {
4014 spec
->multiout
.num_dacs
= STAC92HD81_DAC_COUNT
;
4018 spec
->init
++; /* switch to config #2 */
4019 spec
->multiout
.num_dacs
= STAC92HD83_DAC_COUNT
;
4022 spec
->mixer
= stac92hd83xxx_mixer
;
4023 spec
->num_pins
= ARRAY_SIZE(stac92hd83xxx_pin_nids
);
4024 spec
->num_dmuxes
= ARRAY_SIZE(stac92hd83xxx_dmux_nids
);
4025 spec
->num_adcs
= ARRAY_SIZE(stac92hd83xxx_adc_nids
);
4026 spec
->num_dmics
= STAC92HD83XXX_NUM_DMICS
;
4027 spec
->dinput_mux
= &stac92hd83xxx_dmux
;
4028 spec
->pin_nids
= stac92hd83xxx_pin_nids
;
4029 spec
->board_config
= snd_hda_check_board_config(codec
,
4030 STAC_92HD83XXX_MODELS
,
4031 stac92hd83xxx_models
,
4032 stac92hd83xxx_cfg_tbl
);
4034 if (spec
->board_config
< 0) {
4035 snd_printdd(KERN_INFO
"hda_codec: Unknown model for"
4036 " STAC92HD83XXX, using BIOS defaults\n");
4037 err
= stac92xx_save_bios_config_regs(codec
);
4039 stac92xx_free(codec
);
4042 spec
->pin_configs
= spec
->bios_pin_configs
;
4044 spec
->pin_configs
= stac92hd83xxx_brd_tbl
[spec
->board_config
];
4045 stac92xx_set_config_regs(codec
);
4048 err
= stac92xx_parse_auto_config(codec
, 0x1d, 0);
4050 if (spec
->board_config
< 0) {
4051 printk(KERN_WARNING
"hda_codec: No auto-config is "
4052 "available, default to model=ref\n");
4053 spec
->board_config
= STAC_92HD83XXX_REF
;
4060 stac92xx_free(codec
);
4064 codec
->patch_ops
= stac92xx_patch_ops
;
4069 #ifdef SND_HDA_NEEDS_RESUME
4070 static void stac92hd71xx_set_power_state(struct hda_codec
*codec
, int pwr
)
4072 struct sigmatel_spec
*spec
= codec
->spec
;
4074 snd_hda_codec_write_cache(codec
, codec
->afg
, 0,
4075 AC_VERB_SET_POWER_STATE
, pwr
);
4078 for (i
= 0; i
< spec
->num_adcs
; i
++) {
4079 snd_hda_codec_write_cache(codec
,
4080 spec
->adc_nids
[i
], 0,
4081 AC_VERB_SET_POWER_STATE
, pwr
);
4085 static int stac92hd71xx_resume(struct hda_codec
*codec
)
4087 stac92hd71xx_set_power_state(codec
, AC_PWRST_D0
);
4088 return stac92xx_resume(codec
);
4091 static int stac92hd71xx_suspend(struct hda_codec
*codec
, pm_message_t state
)
4093 stac92hd71xx_set_power_state(codec
, AC_PWRST_D3
);
4099 static struct hda_codec_ops stac92hd71bxx_patch_ops
= {
4100 .build_controls
= stac92xx_build_controls
,
4101 .build_pcms
= stac92xx_build_pcms
,
4102 .init
= stac92xx_init
,
4103 .free
= stac92xx_free
,
4104 .unsol_event
= stac92xx_unsol_event
,
4105 #ifdef SND_HDA_NEEDS_RESUME
4106 .resume
= stac92hd71xx_resume
,
4107 .suspend
= stac92hd71xx_suspend
,
4111 static int patch_stac92hd71bxx(struct hda_codec
*codec
)
4113 struct sigmatel_spec
*spec
;
4116 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
4121 codec
->patch_ops
= stac92xx_patch_ops
;
4122 spec
->num_pins
= ARRAY_SIZE(stac92hd71bxx_pin_nids
);
4123 spec
->num_pwrs
= ARRAY_SIZE(stac92hd71bxx_pwr_nids
);
4124 spec
->pin_nids
= stac92hd71bxx_pin_nids
;
4125 spec
->board_config
= snd_hda_check_board_config(codec
,
4126 STAC_92HD71BXX_MODELS
,
4127 stac92hd71bxx_models
,
4128 stac92hd71bxx_cfg_tbl
);
4130 if (spec
->board_config
< 0) {
4131 snd_printdd(KERN_INFO
"hda_codec: Unknown model for"
4132 " STAC92HD71BXX, using BIOS defaults\n");
4133 err
= stac92xx_save_bios_config_regs(codec
);
4135 stac92xx_free(codec
);
4138 spec
->pin_configs
= spec
->bios_pin_configs
;
4140 spec
->pin_configs
= stac92hd71bxx_brd_tbl
[spec
->board_config
];
4141 stac92xx_set_config_regs(codec
);
4144 switch (codec
->vendor_id
) {
4145 case 0x111d76b6: /* 4 Port without Analog Mixer */
4147 case 0x111d76b4: /* 6 Port without Analog Mixer */
4149 spec
->mixer
= stac92hd71bxx_mixer
;
4150 spec
->init
= stac92hd71bxx_core_init
;
4151 codec
->slave_dig_outs
= stac92hd71bxx_slave_dig_outs
;
4153 case 0x111d7608: /* 5 Port with Analog Mixer */
4154 if ((codec
->revision_id
& 0xf) == 0 ||
4155 (codec
->revision_id
& 0xf) == 1) {
4156 #ifdef SND_HDA_NEEDS_RESUME
4157 codec
->patch_ops
= stac92hd71bxx_patch_ops
;
4159 spec
->stream_delay
= 40; /* 40 milliseconds */
4162 /* no output amps */
4164 spec
->mixer
= stac92hd71bxx_analog_mixer
;
4167 spec
->init
= &stac92hd71bxx_analog_core_init
[HD_DISABLE_PORTF
];
4168 stac92xx_set_config_reg(codec
, 0xf, 0x40f000f0);
4170 case 0x111d7603: /* 6 Port with Analog Mixer */
4171 if ((codec
->revision_id
& 0xf) == 1) {
4172 #ifdef SND_HDA_NEEDS_RESUME
4173 codec
->patch_ops
= stac92hd71bxx_patch_ops
;
4175 spec
->stream_delay
= 40; /* 40 milliseconds */
4178 /* no output amps */
4182 spec
->mixer
= stac92hd71bxx_analog_mixer
;
4183 spec
->init
= stac92hd71bxx_analog_core_init
;
4184 codec
->slave_dig_outs
= stac92hd71bxx_slave_dig_outs
;
4187 spec
->aloopback_mask
= 0x20;
4188 spec
->aloopback_shift
= 0;
4190 /* GPIO0 High = EAPD */
4191 spec
->gpio_mask
= 0x01;
4192 spec
->gpio_dir
= 0x01;
4193 spec
->gpio_data
= 0x01;
4195 spec
->powerdown_adcs
= 1;
4196 spec
->digbeep_nid
= 0x26;
4197 spec
->mux_nids
= stac92hd71bxx_mux_nids
;
4198 spec
->adc_nids
= stac92hd71bxx_adc_nids
;
4199 spec
->dmic_nids
= stac92hd71bxx_dmic_nids
;
4200 spec
->dmux_nids
= stac92hd71bxx_dmux_nids
;
4201 spec
->smux_nids
= stac92hd71bxx_smux_nids
;
4202 spec
->pwr_nids
= stac92hd71bxx_pwr_nids
;
4204 spec
->num_muxes
= ARRAY_SIZE(stac92hd71bxx_mux_nids
);
4205 spec
->num_adcs
= ARRAY_SIZE(stac92hd71bxx_adc_nids
);
4206 spec
->num_dmics
= STAC92HD71BXX_NUM_DMICS
;
4207 spec
->num_smuxes
= ARRAY_SIZE(stac92hd71bxx_smux_nids
);
4208 spec
->num_dmuxes
= ARRAY_SIZE(stac92hd71bxx_dmux_nids
);
4210 spec
->multiout
.num_dacs
= 1;
4211 spec
->multiout
.hp_nid
= 0x11;
4212 spec
->multiout
.dac_nids
= stac92hd71bxx_dac_nids
;
4214 err
= stac92xx_parse_auto_config(codec
, 0x21, 0x23);
4216 if (spec
->board_config
< 0) {
4217 printk(KERN_WARNING
"hda_codec: No auto-config is "
4218 "available, default to model=ref\n");
4219 spec
->board_config
= STAC_92HD71BXX_REF
;
4226 stac92xx_free(codec
);
4233 static int patch_stac922x(struct hda_codec
*codec
)
4235 struct sigmatel_spec
*spec
;
4238 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
4243 spec
->num_pins
= ARRAY_SIZE(stac922x_pin_nids
);
4244 spec
->pin_nids
= stac922x_pin_nids
;
4245 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_922X_MODELS
,
4248 if (spec
->board_config
== STAC_INTEL_MAC_AUTO
) {
4249 spec
->gpio_mask
= spec
->gpio_dir
= 0x03;
4250 spec
->gpio_data
= 0x03;
4251 /* Intel Macs have all same PCI SSID, so we need to check
4252 * codec SSID to distinguish the exact models
4254 printk(KERN_INFO
"hda_codec: STAC922x, Apple subsys_id=%x\n", codec
->subsystem_id
);
4255 switch (codec
->subsystem_id
) {
4258 spec
->board_config
= STAC_INTEL_MAC_V1
;
4262 spec
->board_config
= STAC_INTEL_MAC_V2
;
4270 spec
->board_config
= STAC_INTEL_MAC_V3
;
4274 spec
->board_config
= STAC_INTEL_MAC_V4
;
4278 spec
->board_config
= STAC_INTEL_MAC_V5
;
4281 spec
->board_config
= STAC_INTEL_MAC_V3
;
4287 if (spec
->board_config
< 0) {
4288 snd_printdd(KERN_INFO
"hda_codec: Unknown model for STAC922x, "
4289 "using BIOS defaults\n");
4290 err
= stac92xx_save_bios_config_regs(codec
);
4292 stac92xx_free(codec
);
4295 spec
->pin_configs
= spec
->bios_pin_configs
;
4296 } else if (stac922x_brd_tbl
[spec
->board_config
] != NULL
) {
4297 spec
->pin_configs
= stac922x_brd_tbl
[spec
->board_config
];
4298 stac92xx_set_config_regs(codec
);
4301 spec
->adc_nids
= stac922x_adc_nids
;
4302 spec
->mux_nids
= stac922x_mux_nids
;
4303 spec
->num_muxes
= ARRAY_SIZE(stac922x_mux_nids
);
4304 spec
->num_adcs
= ARRAY_SIZE(stac922x_adc_nids
);
4305 spec
->num_dmics
= 0;
4308 spec
->init
= stac922x_core_init
;
4309 spec
->mixer
= stac922x_mixer
;
4311 spec
->multiout
.dac_nids
= spec
->dac_nids
;
4313 err
= stac92xx_parse_auto_config(codec
, 0x08, 0x09);
4315 if (spec
->board_config
< 0) {
4316 printk(KERN_WARNING
"hda_codec: No auto-config is "
4317 "available, default to model=ref\n");
4318 spec
->board_config
= STAC_D945_REF
;
4324 stac92xx_free(codec
);
4328 codec
->patch_ops
= stac92xx_patch_ops
;
4330 /* Fix Mux capture level; max to 2 */
4331 snd_hda_override_amp_caps(codec
, 0x12, HDA_OUTPUT
,
4332 (0 << AC_AMPCAP_OFFSET_SHIFT
) |
4333 (2 << AC_AMPCAP_NUM_STEPS_SHIFT
) |
4334 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
4335 (0 << AC_AMPCAP_MUTE_SHIFT
));
4340 static int patch_stac927x(struct hda_codec
*codec
)
4342 struct sigmatel_spec
*spec
;
4345 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
4350 spec
->num_pins
= ARRAY_SIZE(stac927x_pin_nids
);
4351 spec
->pin_nids
= stac927x_pin_nids
;
4352 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_927X_MODELS
,
4356 if (spec
->board_config
< 0 || !stac927x_brd_tbl
[spec
->board_config
]) {
4357 if (spec
->board_config
< 0)
4358 snd_printdd(KERN_INFO
"hda_codec: Unknown model for"
4359 "STAC927x, using BIOS defaults\n");
4360 err
= stac92xx_save_bios_config_regs(codec
);
4362 stac92xx_free(codec
);
4365 spec
->pin_configs
= spec
->bios_pin_configs
;
4367 spec
->pin_configs
= stac927x_brd_tbl
[spec
->board_config
];
4368 stac92xx_set_config_regs(codec
);
4371 spec
->digbeep_nid
= 0x23;
4372 spec
->adc_nids
= stac927x_adc_nids
;
4373 spec
->num_adcs
= ARRAY_SIZE(stac927x_adc_nids
);
4374 spec
->mux_nids
= stac927x_mux_nids
;
4375 spec
->num_muxes
= ARRAY_SIZE(stac927x_mux_nids
);
4376 spec
->smux_nids
= stac927x_smux_nids
;
4377 spec
->num_smuxes
= ARRAY_SIZE(stac927x_smux_nids
);
4378 spec
->dac_list
= stac927x_dac_nids
;
4379 spec
->multiout
.dac_nids
= spec
->dac_nids
;
4381 switch (spec
->board_config
) {
4384 /* GPIO0 High = Enable EAPD */
4385 spec
->eapd_mask
= spec
->gpio_mask
= spec
->gpio_dir
= 0x01;
4386 spec
->gpio_data
= 0x01;
4387 spec
->num_dmics
= 0;
4389 spec
->init
= d965_core_init
;
4390 spec
->mixer
= stac927x_mixer
;
4392 case STAC_DELL_BIOS
:
4393 switch (codec
->subsystem_id
) {
4396 /* correct the device field to SPDIF out */
4397 stac92xx_set_config_reg(codec
, 0x21, 0x01442070);
4400 /* configure the analog microphone on some laptops */
4401 stac92xx_set_config_reg(codec
, 0x0c, 0x90a79130);
4402 /* correct the front output jack as a hp out */
4403 stac92xx_set_config_reg(codec
, 0x0f, 0x0227011f);
4404 /* correct the front input jack as a mic */
4405 stac92xx_set_config_reg(codec
, 0x0e, 0x02a79130);
4408 /* GPIO2 High = Enable EAPD */
4409 spec
->eapd_mask
= spec
->gpio_mask
= spec
->gpio_dir
= 0x04;
4410 spec
->gpio_data
= 0x04;
4411 spec
->dmic_nids
= stac927x_dmic_nids
;
4412 spec
->num_dmics
= STAC927X_NUM_DMICS
;
4414 spec
->init
= d965_core_init
;
4415 spec
->mixer
= stac927x_mixer
;
4416 spec
->dmux_nids
= stac927x_dmux_nids
;
4417 spec
->num_dmuxes
= ARRAY_SIZE(stac927x_dmux_nids
);
4420 /* GPIO0 High = Enable EAPD */
4421 spec
->eapd_mask
= spec
->gpio_mask
= spec
->gpio_dir
= 0x1;
4422 spec
->gpio_data
= 0x01;
4423 spec
->num_dmics
= 0;
4425 spec
->init
= stac927x_core_init
;
4426 spec
->mixer
= stac927x_mixer
;
4430 spec
->aloopback_mask
= 0x40;
4431 spec
->aloopback_shift
= 0;
4433 err
= stac92xx_parse_auto_config(codec
, 0x1e, 0x20);
4435 if (spec
->board_config
< 0) {
4436 printk(KERN_WARNING
"hda_codec: No auto-config is "
4437 "available, default to model=ref\n");
4438 spec
->board_config
= STAC_D965_REF
;
4444 stac92xx_free(codec
);
4448 codec
->patch_ops
= stac92xx_patch_ops
;
4452 * The STAC927x seem to require fairly long delays for certain
4453 * command sequences. With too short delays (even if the answer
4454 * is set to RIRB properly), it results in the silence output
4455 * on some hardwares like Dell.
4457 * The below flag enables the longer delay (see get_response
4460 codec
->bus
->needs_damn_long_delay
= 1;
4465 static int patch_stac9205(struct hda_codec
*codec
)
4467 struct sigmatel_spec
*spec
;
4470 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
4475 spec
->num_pins
= ARRAY_SIZE(stac9205_pin_nids
);
4476 spec
->pin_nids
= stac9205_pin_nids
;
4477 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_9205_MODELS
,
4481 if (spec
->board_config
< 0) {
4482 snd_printdd(KERN_INFO
"hda_codec: Unknown model for STAC9205, using BIOS defaults\n");
4483 err
= stac92xx_save_bios_config_regs(codec
);
4485 stac92xx_free(codec
);
4488 spec
->pin_configs
= spec
->bios_pin_configs
;
4490 spec
->pin_configs
= stac9205_brd_tbl
[spec
->board_config
];
4491 stac92xx_set_config_regs(codec
);
4494 spec
->digbeep_nid
= 0x23;
4495 spec
->adc_nids
= stac9205_adc_nids
;
4496 spec
->num_adcs
= ARRAY_SIZE(stac9205_adc_nids
);
4497 spec
->mux_nids
= stac9205_mux_nids
;
4498 spec
->num_muxes
= ARRAY_SIZE(stac9205_mux_nids
);
4499 spec
->smux_nids
= stac9205_smux_nids
;
4500 spec
->num_smuxes
= ARRAY_SIZE(stac9205_smux_nids
);
4501 spec
->dmic_nids
= stac9205_dmic_nids
;
4502 spec
->num_dmics
= STAC9205_NUM_DMICS
;
4503 spec
->dmux_nids
= stac9205_dmux_nids
;
4504 spec
->num_dmuxes
= ARRAY_SIZE(stac9205_dmux_nids
);
4507 spec
->init
= stac9205_core_init
;
4508 spec
->mixer
= stac9205_mixer
;
4510 spec
->aloopback_mask
= 0x40;
4511 spec
->aloopback_shift
= 0;
4512 spec
->multiout
.dac_nids
= spec
->dac_nids
;
4514 switch (spec
->board_config
){
4515 case STAC_9205_DELL_M43
:
4516 /* Enable SPDIF in/out */
4517 stac92xx_set_config_reg(codec
, 0x1f, 0x01441030);
4518 stac92xx_set_config_reg(codec
, 0x20, 0x1c410030);
4520 /* Enable unsol response for GPIO4/Dock HP connection */
4521 snd_hda_codec_write(codec
, codec
->afg
, 0,
4522 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK
, 0x10);
4523 snd_hda_codec_write_cache(codec
, codec
->afg
, 0,
4524 AC_VERB_SET_UNSOLICITED_ENABLE
,
4525 (AC_USRSP_EN
| STAC_HP_EVENT
));
4527 spec
->gpio_dir
= 0x0b;
4528 spec
->eapd_mask
= 0x01;
4529 spec
->gpio_mask
= 0x1b;
4530 spec
->gpio_mute
= 0x10;
4531 /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute,
4534 spec
->gpio_data
= 0x01;
4537 /* GPIO0 High = EAPD */
4538 spec
->eapd_mask
= spec
->gpio_mask
= spec
->gpio_dir
= 0x1;
4539 spec
->gpio_data
= 0x01;
4543 err
= stac92xx_parse_auto_config(codec
, 0x1f, 0x20);
4545 if (spec
->board_config
< 0) {
4546 printk(KERN_WARNING
"hda_codec: No auto-config is "
4547 "available, default to model=ref\n");
4548 spec
->board_config
= STAC_9205_REF
;
4554 stac92xx_free(codec
);
4558 codec
->patch_ops
= stac92xx_patch_ops
;
4567 /* static config for Sony VAIO FE550G and Sony VAIO AR */
4568 static hda_nid_t vaio_dacs
[] = { 0x2 };
4569 #define VAIO_HP_DAC 0x5
4570 static hda_nid_t vaio_adcs
[] = { 0x8 /*,0x6*/ };
4571 static hda_nid_t vaio_mux_nids
[] = { 0x15 };
4573 static struct hda_input_mux vaio_mux
= {
4576 /* { "HP", 0x0 }, */
4577 { "Mic Jack", 0x1 },
4578 { "Internal Mic", 0x2 },
4583 static struct hda_verb vaio_init
[] = {
4584 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP <- 0x2 */
4585 {0x0a, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| STAC_HP_EVENT
},
4586 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Speaker <- 0x5 */
4587 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Mic? (<- 0x2) */
4588 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* CD */
4589 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Mic? */
4590 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x1}, /* mic-sel: 0a,0d,14,02 */
4591 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* HP */
4592 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Speaker */
4593 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
4594 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
4595 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Mic-in -> 0x9 */
4599 static struct hda_verb vaio_ar_init
[] = {
4600 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP <- 0x2 */
4601 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Speaker <- 0x5 */
4602 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Mic? (<- 0x2) */
4603 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* CD */
4604 /* {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },*/ /* Optical Out */
4605 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Mic? */
4606 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x1}, /* mic-sel: 0a,0d,14,02 */
4607 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* HP */
4608 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Speaker */
4609 /* {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},*/ /* Optical Out */
4610 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
4611 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
4612 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Mic-in -> 0x9 */
4616 /* bind volumes of both NID 0x02 and 0x05 */
4617 static struct hda_bind_ctls vaio_bind_master_vol
= {
4618 .ops
= &snd_hda_bind_vol
,
4620 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
4621 HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT
),
4626 /* bind volumes of both NID 0x02 and 0x05 */
4627 static struct hda_bind_ctls vaio_bind_master_sw
= {
4628 .ops
= &snd_hda_bind_sw
,
4630 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
4631 HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT
),
4636 static struct snd_kcontrol_new vaio_mixer
[] = {
4637 HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol
),
4638 HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw
),
4639 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
4640 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT
),
4641 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT
),
4643 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4644 .name
= "Capture Source",
4646 .info
= stac92xx_mux_enum_info
,
4647 .get
= stac92xx_mux_enum_get
,
4648 .put
= stac92xx_mux_enum_put
,
4653 static struct snd_kcontrol_new vaio_ar_mixer
[] = {
4654 HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol
),
4655 HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw
),
4656 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
4657 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT
),
4658 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT
),
4659 /*HDA_CODEC_MUTE("Optical Out Switch", 0x10, 0, HDA_OUTPUT),
4660 HDA_CODEC_VOLUME("Optical Out Volume", 0x10, 0, HDA_OUTPUT),*/
4662 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4663 .name
= "Capture Source",
4665 .info
= stac92xx_mux_enum_info
,
4666 .get
= stac92xx_mux_enum_get
,
4667 .put
= stac92xx_mux_enum_put
,
4672 static struct hda_codec_ops stac9872_patch_ops
= {
4673 .build_controls
= stac92xx_build_controls
,
4674 .build_pcms
= stac92xx_build_pcms
,
4675 .init
= stac92xx_init
,
4676 .free
= stac92xx_free
,
4677 #ifdef SND_HDA_NEEDS_RESUME
4678 .resume
= stac92xx_resume
,
4682 static int stac9872_vaio_init(struct hda_codec
*codec
)
4686 err
= stac92xx_init(codec
);
4689 if (codec
->patch_ops
.unsol_event
)
4690 codec
->patch_ops
.unsol_event(codec
, STAC_HP_EVENT
<< 26);
4694 static void stac9872_vaio_hp_detect(struct hda_codec
*codec
, unsigned int res
)
4696 if (get_hp_pin_presence(codec
, 0x0a)) {
4697 stac92xx_reset_pinctl(codec
, 0x0f, AC_PINCTL_OUT_EN
);
4698 stac92xx_set_pinctl(codec
, 0x0a, AC_PINCTL_OUT_EN
);
4700 stac92xx_reset_pinctl(codec
, 0x0a, AC_PINCTL_OUT_EN
);
4701 stac92xx_set_pinctl(codec
, 0x0f, AC_PINCTL_OUT_EN
);
4705 static void stac9872_vaio_unsol_event(struct hda_codec
*codec
, unsigned int res
)
4707 switch (res
>> 26) {
4709 stac9872_vaio_hp_detect(codec
, res
);
4714 static struct hda_codec_ops stac9872_vaio_patch_ops
= {
4715 .build_controls
= stac92xx_build_controls
,
4716 .build_pcms
= stac92xx_build_pcms
,
4717 .init
= stac9872_vaio_init
,
4718 .free
= stac92xx_free
,
4719 .unsol_event
= stac9872_vaio_unsol_event
,
4721 .resume
= stac92xx_resume
,
4725 enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */
4727 /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */
4729 /* Unknown. id=0x83847661 and subsys=0x104D1200. */
4731 /* AR Series. id=0x83847664 and subsys=104D1300 */
4736 static const char *stac9872_models
[STAC_9872_MODELS
] = {
4737 [CXD9872RD_VAIO
] = "vaio",
4738 [CXD9872AKD_VAIO
] = "vaio-ar",
4741 static struct snd_pci_quirk stac9872_cfg_tbl
[] = {
4742 SND_PCI_QUIRK(0x104d, 0x81e6, "Sony VAIO F/S", CXD9872RD_VAIO
),
4743 SND_PCI_QUIRK(0x104d, 0x81ef, "Sony VAIO F/S", CXD9872RD_VAIO
),
4744 SND_PCI_QUIRK(0x104d, 0x81fd, "Sony VAIO AR", CXD9872AKD_VAIO
),
4745 SND_PCI_QUIRK(0x104d, 0x8205, "Sony VAIO AR", CXD9872AKD_VAIO
),
4749 static int patch_stac9872(struct hda_codec
*codec
)
4751 struct sigmatel_spec
*spec
;
4754 board_config
= snd_hda_check_board_config(codec
, STAC_9872_MODELS
,
4757 if (board_config
< 0)
4758 /* unknown config, let generic-parser do its job... */
4759 return snd_hda_parse_generic_codec(codec
);
4761 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
4766 switch (board_config
) {
4767 case CXD9872RD_VAIO
:
4768 case STAC9872AK_VAIO
:
4769 case STAC9872K_VAIO
:
4770 spec
->mixer
= vaio_mixer
;
4771 spec
->init
= vaio_init
;
4772 spec
->multiout
.max_channels
= 2;
4773 spec
->multiout
.num_dacs
= ARRAY_SIZE(vaio_dacs
);
4774 spec
->multiout
.dac_nids
= vaio_dacs
;
4775 spec
->multiout
.hp_nid
= VAIO_HP_DAC
;
4776 spec
->num_adcs
= ARRAY_SIZE(vaio_adcs
);
4777 spec
->adc_nids
= vaio_adcs
;
4779 spec
->input_mux
= &vaio_mux
;
4780 spec
->mux_nids
= vaio_mux_nids
;
4781 codec
->patch_ops
= stac9872_vaio_patch_ops
;
4784 case CXD9872AKD_VAIO
:
4785 spec
->mixer
= vaio_ar_mixer
;
4786 spec
->init
= vaio_ar_init
;
4787 spec
->multiout
.max_channels
= 2;
4788 spec
->multiout
.num_dacs
= ARRAY_SIZE(vaio_dacs
);
4789 spec
->multiout
.dac_nids
= vaio_dacs
;
4790 spec
->multiout
.hp_nid
= VAIO_HP_DAC
;
4791 spec
->num_adcs
= ARRAY_SIZE(vaio_adcs
);
4793 spec
->adc_nids
= vaio_adcs
;
4794 spec
->input_mux
= &vaio_mux
;
4795 spec
->mux_nids
= vaio_mux_nids
;
4796 codec
->patch_ops
= stac9872_patch_ops
;
4807 struct hda_codec_preset snd_hda_preset_sigmatel
[] = {
4808 { .id
= 0x83847690, .name
= "STAC9200", .patch
= patch_stac9200
},
4809 { .id
= 0x83847882, .name
= "STAC9220 A1", .patch
= patch_stac922x
},
4810 { .id
= 0x83847680, .name
= "STAC9221 A1", .patch
= patch_stac922x
},
4811 { .id
= 0x83847880, .name
= "STAC9220 A2", .patch
= patch_stac922x
},
4812 { .id
= 0x83847681, .name
= "STAC9220D/9223D A2", .patch
= patch_stac922x
},
4813 { .id
= 0x83847682, .name
= "STAC9221 A2", .patch
= patch_stac922x
},
4814 { .id
= 0x83847683, .name
= "STAC9221D A2", .patch
= patch_stac922x
},
4815 { .id
= 0x83847618, .name
= "STAC9227", .patch
= patch_stac927x
},
4816 { .id
= 0x83847619, .name
= "STAC9227", .patch
= patch_stac927x
},
4817 { .id
= 0x83847616, .name
= "STAC9228", .patch
= patch_stac927x
},
4818 { .id
= 0x83847617, .name
= "STAC9228", .patch
= patch_stac927x
},
4819 { .id
= 0x83847614, .name
= "STAC9229", .patch
= patch_stac927x
},
4820 { .id
= 0x83847615, .name
= "STAC9229", .patch
= patch_stac927x
},
4821 { .id
= 0x83847620, .name
= "STAC9274", .patch
= patch_stac927x
},
4822 { .id
= 0x83847621, .name
= "STAC9274D", .patch
= patch_stac927x
},
4823 { .id
= 0x83847622, .name
= "STAC9273X", .patch
= patch_stac927x
},
4824 { .id
= 0x83847623, .name
= "STAC9273D", .patch
= patch_stac927x
},
4825 { .id
= 0x83847624, .name
= "STAC9272X", .patch
= patch_stac927x
},
4826 { .id
= 0x83847625, .name
= "STAC9272D", .patch
= patch_stac927x
},
4827 { .id
= 0x83847626, .name
= "STAC9271X", .patch
= patch_stac927x
},
4828 { .id
= 0x83847627, .name
= "STAC9271D", .patch
= patch_stac927x
},
4829 { .id
= 0x83847628, .name
= "STAC9274X5NH", .patch
= patch_stac927x
},
4830 { .id
= 0x83847629, .name
= "STAC9274D5NH", .patch
= patch_stac927x
},
4831 { .id
= 0x83847632, .name
= "STAC9202", .patch
= patch_stac925x
},
4832 { .id
= 0x83847633, .name
= "STAC9202D", .patch
= patch_stac925x
},
4833 { .id
= 0x83847634, .name
= "STAC9250", .patch
= patch_stac925x
},
4834 { .id
= 0x83847635, .name
= "STAC9250D", .patch
= patch_stac925x
},
4835 { .id
= 0x83847636, .name
= "STAC9251", .patch
= patch_stac925x
},
4836 { .id
= 0x83847637, .name
= "STAC9250D", .patch
= patch_stac925x
},
4837 { .id
= 0x83847645, .name
= "92HD206X", .patch
= patch_stac927x
},
4838 { .id
= 0x83847646, .name
= "92HD206D", .patch
= patch_stac927x
},
4839 /* The following does not take into account .id=0x83847661 when subsys =
4840 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
4841 * currently not fully supported.
4843 { .id
= 0x83847661, .name
= "CXD9872RD/K", .patch
= patch_stac9872
},
4844 { .id
= 0x83847662, .name
= "STAC9872AK", .patch
= patch_stac9872
},
4845 { .id
= 0x83847664, .name
= "CXD9872AKD", .patch
= patch_stac9872
},
4846 { .id
= 0x838476a0, .name
= "STAC9205", .patch
= patch_stac9205
},
4847 { .id
= 0x838476a1, .name
= "STAC9205D", .patch
= patch_stac9205
},
4848 { .id
= 0x838476a2, .name
= "STAC9204", .patch
= patch_stac9205
},
4849 { .id
= 0x838476a3, .name
= "STAC9204D", .patch
= patch_stac9205
},
4850 { .id
= 0x838476a4, .name
= "STAC9255", .patch
= patch_stac9205
},
4851 { .id
= 0x838476a5, .name
= "STAC9255D", .patch
= patch_stac9205
},
4852 { .id
= 0x838476a6, .name
= "STAC9254", .patch
= patch_stac9205
},
4853 { .id
= 0x838476a7, .name
= "STAC9254D", .patch
= patch_stac9205
},
4854 { .id
= 0x111d7603, .name
= "92HD75B3X5", .patch
= patch_stac92hd71bxx
},
4855 { .id
= 0x111d7604, .name
= "92HD83C1X5", .patch
= patch_stac92hd83xxx
},
4856 { .id
= 0x111d7605, .name
= "92HD81B1X5", .patch
= patch_stac92hd83xxx
},
4857 { .id
= 0x111d7608, .name
= "92HD75B2X5", .patch
= patch_stac92hd71bxx
},
4858 { .id
= 0x111d7674, .name
= "92HD73D1X5", .patch
= patch_stac92hd73xx
},
4859 { .id
= 0x111d7675, .name
= "92HD73C1X5", .patch
= patch_stac92hd73xx
},
4860 { .id
= 0x111d7676, .name
= "92HD73E1X5", .patch
= patch_stac92hd73xx
},
4861 { .id
= 0x111d76b0, .name
= "92HD71B8X", .patch
= patch_stac92hd71bxx
},
4862 { .id
= 0x111d76b1, .name
= "92HD71B8X", .patch
= patch_stac92hd71bxx
},
4863 { .id
= 0x111d76b2, .name
= "92HD71B7X", .patch
= patch_stac92hd71bxx
},
4864 { .id
= 0x111d76b3, .name
= "92HD71B7X", .patch
= patch_stac92hd71bxx
},
4865 { .id
= 0x111d76b4, .name
= "92HD71B6X", .patch
= patch_stac92hd71bxx
},
4866 { .id
= 0x111d76b5, .name
= "92HD71B6X", .patch
= patch_stac92hd71bxx
},
4867 { .id
= 0x111d76b6, .name
= "92HD71B5X", .patch
= patch_stac92hd71bxx
},
4868 { .id
= 0x111d76b7, .name
= "92HD71B5X", .patch
= patch_stac92hd71bxx
},