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
;
148 /* analog loopback */
149 unsigned char aloopback_mask
;
150 unsigned char aloopback_shift
;
152 /* power management */
153 unsigned int num_pwrs
;
154 unsigned int *pwr_mapping
;
159 struct hda_input_mux
*mono_mux
;
160 unsigned int cur_mmux
;
161 struct hda_multi_out multiout
;
162 hda_nid_t dac_nids
[5];
166 unsigned int num_adcs
;
168 unsigned int num_muxes
;
169 hda_nid_t
*dmic_nids
;
170 unsigned int num_dmics
;
171 hda_nid_t
*dmux_nids
;
172 unsigned int num_dmuxes
;
173 hda_nid_t dig_in_nid
;
175 hda_nid_t anabeep_nid
;
176 hda_nid_t digbeep_nid
;
180 unsigned int num_pins
;
181 unsigned int *pin_configs
;
182 unsigned int *bios_pin_configs
;
184 /* codec specific stuff */
185 struct hda_verb
*init
;
186 struct snd_kcontrol_new
*mixer
;
189 struct hda_input_mux
*dinput_mux
;
190 unsigned int cur_dmux
[2];
191 struct hda_input_mux
*input_mux
;
192 unsigned int cur_mux
[3];
195 unsigned int io_switch
[2];
196 unsigned int clfe_swap
;
197 unsigned int hp_switch
;
198 unsigned int aloopback
;
200 struct hda_pcm pcm_rec
[2]; /* PCM information */
202 /* dynamic controls and input_mux */
203 struct auto_pin_cfg autocfg
;
204 unsigned int num_kctl_alloc
, num_kctl_used
;
205 struct snd_kcontrol_new
*kctl_alloc
;
206 struct hda_input_mux private_dimux
;
207 struct hda_input_mux private_imux
;
208 struct hda_input_mux private_mono_mux
;
211 static hda_nid_t stac9200_adc_nids
[1] = {
215 static hda_nid_t stac9200_mux_nids
[1] = {
219 static hda_nid_t stac9200_dac_nids
[1] = {
223 static hda_nid_t stac92hd73xx_pwr_nids
[8] = {
224 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
228 static hda_nid_t stac92hd73xx_adc_nids
[2] = {
232 #define STAC92HD73XX_NUM_DMICS 2
233 static hda_nid_t stac92hd73xx_dmic_nids
[STAC92HD73XX_NUM_DMICS
+ 1] = {
237 #define STAC92HD73_DAC_COUNT 5
238 static hda_nid_t stac92hd73xx_dac_nids
[STAC92HD73_DAC_COUNT
] = {
239 0x15, 0x16, 0x17, 0x18, 0x19,
242 static hda_nid_t stac92hd73xx_mux_nids
[4] = {
243 0x28, 0x29, 0x2a, 0x2b,
246 static hda_nid_t stac92hd73xx_dmux_nids
[2] = {
250 #define STAC92HD83XXX_NUM_DMICS 2
251 static hda_nid_t stac92hd83xxx_dmic_nids
[STAC92HD83XXX_NUM_DMICS
+ 1] = {
255 #define STAC92HD81_DAC_COUNT 2
256 #define STAC92HD83_DAC_COUNT 3
257 static hda_nid_t stac92hd83xxx_dac_nids
[STAC92HD73_DAC_COUNT
] = {
261 static hda_nid_t stac92hd83xxx_dmux_nids
[2] = {
265 static hda_nid_t stac92hd83xxx_adc_nids
[2] = {
269 static hda_nid_t stac92hd83xxx_pwr_nids
[4] = {
273 static unsigned int stac92hd83xxx_pwr_mapping
[4] = {
274 0x03, 0x0c, 0x10, 0x40,
277 static hda_nid_t stac92hd71bxx_pwr_nids
[3] = {
281 static hda_nid_t stac92hd71bxx_adc_nids
[2] = {
285 static hda_nid_t stac92hd71bxx_mux_nids
[2] = {
289 static hda_nid_t stac92hd71bxx_dmux_nids
[1] = {
293 static hda_nid_t stac92hd71bxx_dac_nids
[1] = {
297 #define STAC92HD71BXX_NUM_DMICS 2
298 static hda_nid_t stac92hd71bxx_dmic_nids
[STAC92HD71BXX_NUM_DMICS
+ 1] = {
302 static hda_nid_t stac925x_adc_nids
[1] = {
306 static hda_nid_t stac925x_mux_nids
[1] = {
310 static hda_nid_t stac925x_dac_nids
[1] = {
314 #define STAC925X_NUM_DMICS 1
315 static hda_nid_t stac925x_dmic_nids
[STAC925X_NUM_DMICS
+ 1] = {
319 static hda_nid_t stac925x_dmux_nids
[1] = {
323 static hda_nid_t stac922x_adc_nids
[2] = {
327 static hda_nid_t stac922x_mux_nids
[2] = {
331 static hda_nid_t stac927x_adc_nids
[3] = {
335 static hda_nid_t stac927x_mux_nids
[3] = {
339 static hda_nid_t stac927x_dac_nids
[6] = {
340 0x02, 0x03, 0x04, 0x05, 0x06, 0
343 static hda_nid_t stac927x_dmux_nids
[1] = {
347 #define STAC927X_NUM_DMICS 2
348 static hda_nid_t stac927x_dmic_nids
[STAC927X_NUM_DMICS
+ 1] = {
352 static hda_nid_t stac9205_adc_nids
[2] = {
356 static hda_nid_t stac9205_mux_nids
[2] = {
360 static hda_nid_t stac9205_dmux_nids
[1] = {
364 #define STAC9205_NUM_DMICS 2
365 static hda_nid_t stac9205_dmic_nids
[STAC9205_NUM_DMICS
+ 1] = {
369 static hda_nid_t stac9200_pin_nids
[8] = {
370 0x08, 0x09, 0x0d, 0x0e,
371 0x0f, 0x10, 0x11, 0x12,
374 static hda_nid_t stac925x_pin_nids
[8] = {
375 0x07, 0x08, 0x0a, 0x0b,
376 0x0c, 0x0d, 0x10, 0x11,
379 static hda_nid_t stac922x_pin_nids
[10] = {
380 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
381 0x0f, 0x10, 0x11, 0x15, 0x1b,
384 static hda_nid_t stac92hd73xx_pin_nids
[13] = {
385 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
386 0x0f, 0x10, 0x11, 0x12, 0x13,
390 static hda_nid_t stac92hd83xxx_pin_nids
[14] = {
391 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
392 0x0f, 0x10, 0x11, 0x12, 0x13,
393 0x1d, 0x1e, 0x1f, 0x20
395 static hda_nid_t stac92hd71bxx_pin_nids
[10] = {
396 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
397 0x0f, 0x14, 0x18, 0x19, 0x1e,
400 static hda_nid_t stac927x_pin_nids
[14] = {
401 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
402 0x0f, 0x10, 0x11, 0x12, 0x13,
403 0x14, 0x21, 0x22, 0x23,
406 static hda_nid_t stac9205_pin_nids
[12] = {
407 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
408 0x0f, 0x14, 0x16, 0x17, 0x18,
412 static int stac92xx_dmux_enum_info(struct snd_kcontrol
*kcontrol
,
413 struct snd_ctl_elem_info
*uinfo
)
415 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
416 struct sigmatel_spec
*spec
= codec
->spec
;
417 return snd_hda_input_mux_info(spec
->dinput_mux
, uinfo
);
420 static int stac92xx_dmux_enum_get(struct snd_kcontrol
*kcontrol
,
421 struct snd_ctl_elem_value
*ucontrol
)
423 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
424 struct sigmatel_spec
*spec
= codec
->spec
;
425 unsigned int dmux_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
427 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_dmux
[dmux_idx
];
431 static int stac92xx_dmux_enum_put(struct snd_kcontrol
*kcontrol
,
432 struct snd_ctl_elem_value
*ucontrol
)
434 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
435 struct sigmatel_spec
*spec
= codec
->spec
;
436 unsigned int dmux_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
438 return snd_hda_input_mux_put(codec
, spec
->dinput_mux
, ucontrol
,
439 spec
->dmux_nids
[dmux_idx
], &spec
->cur_dmux
[dmux_idx
]);
442 static int stac92xx_mux_enum_info(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_info
*uinfo
)
444 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
445 struct sigmatel_spec
*spec
= codec
->spec
;
446 return snd_hda_input_mux_info(spec
->input_mux
, uinfo
);
449 static int stac92xx_mux_enum_get(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
451 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
452 struct sigmatel_spec
*spec
= codec
->spec
;
453 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
455 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mux
[adc_idx
];
459 static int stac92xx_mux_enum_put(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
461 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
462 struct sigmatel_spec
*spec
= codec
->spec
;
463 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
465 return snd_hda_input_mux_put(codec
, spec
->input_mux
, ucontrol
,
466 spec
->mux_nids
[adc_idx
], &spec
->cur_mux
[adc_idx
]);
469 static int stac92xx_mono_mux_enum_info(struct snd_kcontrol
*kcontrol
,
470 struct snd_ctl_elem_info
*uinfo
)
472 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
473 struct sigmatel_spec
*spec
= codec
->spec
;
474 return snd_hda_input_mux_info(spec
->mono_mux
, uinfo
);
477 static int stac92xx_mono_mux_enum_get(struct snd_kcontrol
*kcontrol
,
478 struct snd_ctl_elem_value
*ucontrol
)
480 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
481 struct sigmatel_spec
*spec
= codec
->spec
;
483 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mmux
;
487 static int stac92xx_mono_mux_enum_put(struct snd_kcontrol
*kcontrol
,
488 struct snd_ctl_elem_value
*ucontrol
)
490 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
491 struct sigmatel_spec
*spec
= codec
->spec
;
493 return snd_hda_input_mux_put(codec
, spec
->mono_mux
, ucontrol
,
494 spec
->mono_nid
, &spec
->cur_mmux
);
497 #define stac92xx_aloopback_info snd_ctl_boolean_mono_info
499 static int stac92xx_aloopback_get(struct snd_kcontrol
*kcontrol
,
500 struct snd_ctl_elem_value
*ucontrol
)
502 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
503 unsigned int idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
504 struct sigmatel_spec
*spec
= codec
->spec
;
506 ucontrol
->value
.integer
.value
[0] = !!(spec
->aloopback
&
507 (spec
->aloopback_mask
<< idx
));
511 static int stac92xx_aloopback_put(struct snd_kcontrol
*kcontrol
,
512 struct snd_ctl_elem_value
*ucontrol
)
514 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
515 struct sigmatel_spec
*spec
= codec
->spec
;
516 unsigned int idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
517 unsigned int dac_mode
;
518 unsigned int val
, idx_val
;
520 idx_val
= spec
->aloopback_mask
<< idx
;
521 if (ucontrol
->value
.integer
.value
[0])
522 val
= spec
->aloopback
| idx_val
;
524 val
= spec
->aloopback
& ~idx_val
;
525 if (spec
->aloopback
== val
)
528 spec
->aloopback
= val
;
530 /* Only return the bits defined by the shift value of the
531 * first two bytes of the mask
533 dac_mode
= snd_hda_codec_read(codec
, codec
->afg
, 0,
534 kcontrol
->private_value
& 0xFFFF, 0x0);
535 dac_mode
>>= spec
->aloopback_shift
;
537 if (spec
->aloopback
& idx_val
) {
538 snd_hda_power_up(codec
);
541 snd_hda_power_down(codec
);
542 dac_mode
&= ~idx_val
;
545 snd_hda_codec_write_cache(codec
, codec
->afg
, 0,
546 kcontrol
->private_value
>> 16, dac_mode
);
551 static struct hda_verb stac9200_core_init
[] = {
552 /* set dac0mux for dac converter */
553 { 0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
557 static struct hda_verb stac9200_eapd_init
[] = {
558 /* set dac0mux for dac converter */
559 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
560 {0x08, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
564 static struct hda_verb stac92hd73xx_6ch_core_init
[] = {
565 /* set master volume and direct control */
566 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
567 /* setup audio connections */
568 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00},
569 { 0x10, AC_VERB_SET_CONNECT_SEL
, 0x01},
570 { 0x11, AC_VERB_SET_CONNECT_SEL
, 0x02},
571 /* setup adcs to point to mixer */
572 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x0b},
573 { 0x21, AC_VERB_SET_CONNECT_SEL
, 0x0b},
574 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
575 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
576 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
577 /* setup import muxs */
578 { 0x28, AC_VERB_SET_CONNECT_SEL
, 0x01},
579 { 0x29, AC_VERB_SET_CONNECT_SEL
, 0x01},
580 { 0x2a, AC_VERB_SET_CONNECT_SEL
, 0x01},
581 { 0x2b, AC_VERB_SET_CONNECT_SEL
, 0x00},
585 static struct hda_verb dell_eq_core_init
[] = {
586 /* set master volume to max value without distortion
587 * and direct control */
588 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xec},
589 /* setup audio connections */
590 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00},
591 { 0x0a, AC_VERB_SET_CONNECT_SEL
, 0x01},
592 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x02},
593 /* setup adcs to point to mixer */
594 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x0b},
595 { 0x21, AC_VERB_SET_CONNECT_SEL
, 0x0b},
596 /* setup import muxs */
597 { 0x28, AC_VERB_SET_CONNECT_SEL
, 0x01},
598 { 0x29, AC_VERB_SET_CONNECT_SEL
, 0x01},
599 { 0x2a, AC_VERB_SET_CONNECT_SEL
, 0x01},
600 { 0x2b, AC_VERB_SET_CONNECT_SEL
, 0x00},
604 static struct hda_verb dell_m6_core_init
[] = {
605 /* set master volume to max value without distortion
606 * and direct control */
607 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xec},
608 /* setup audio connections */
609 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00},
610 { 0x0a, AC_VERB_SET_CONNECT_SEL
, 0x01},
611 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x02},
612 /* setup adcs to point to mixer */
613 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x0b},
614 { 0x21, AC_VERB_SET_CONNECT_SEL
, 0x0b},
615 /* setup import muxs */
616 { 0x28, AC_VERB_SET_CONNECT_SEL
, 0x01},
617 { 0x29, AC_VERB_SET_CONNECT_SEL
, 0x01},
618 { 0x2a, AC_VERB_SET_CONNECT_SEL
, 0x01},
619 { 0x2b, AC_VERB_SET_CONNECT_SEL
, 0x00},
623 static struct hda_verb stac92hd73xx_8ch_core_init
[] = {
624 /* set master volume and direct control */
625 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
626 /* setup audio connections */
627 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00},
628 { 0x10, AC_VERB_SET_CONNECT_SEL
, 0x01},
629 { 0x11, AC_VERB_SET_CONNECT_SEL
, 0x02},
630 /* connect hp ports to dac3 */
631 { 0x0a, AC_VERB_SET_CONNECT_SEL
, 0x03},
632 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x03},
633 /* setup adcs to point to mixer */
634 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x0b},
635 { 0x21, AC_VERB_SET_CONNECT_SEL
, 0x0b},
636 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
637 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
638 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
639 /* setup import muxs */
640 { 0x28, AC_VERB_SET_CONNECT_SEL
, 0x01},
641 { 0x29, AC_VERB_SET_CONNECT_SEL
, 0x01},
642 { 0x2a, AC_VERB_SET_CONNECT_SEL
, 0x01},
643 { 0x2b, AC_VERB_SET_CONNECT_SEL
, 0x03},
647 static struct hda_verb stac92hd73xx_10ch_core_init
[] = {
648 /* set master volume and direct control */
649 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
650 /* setup audio connections */
651 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
652 { 0x10, AC_VERB_SET_CONNECT_SEL
, 0x01 },
653 { 0x11, AC_VERB_SET_CONNECT_SEL
, 0x02 },
654 /* dac3 is connected to import3 mux */
655 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb07f},
656 /* connect hp ports to dac4 */
657 { 0x0a, AC_VERB_SET_CONNECT_SEL
, 0x04},
658 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x04},
659 /* setup adcs to point to mixer */
660 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x0b},
661 { 0x21, AC_VERB_SET_CONNECT_SEL
, 0x0b},
662 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
663 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
664 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
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
, 0x03},
673 static struct hda_verb stac92hd83xxx_core_init
[] = {
674 /* start of config #1 */
675 { 0xe, AC_VERB_SET_CONNECT_SEL
, 0x3},
677 /* start of config #2 */
678 { 0xa, AC_VERB_SET_CONNECT_SEL
, 0x0},
679 { 0xb, AC_VERB_SET_CONNECT_SEL
, 0x0},
680 { 0xd, AC_VERB_SET_CONNECT_SEL
, 0x1},
682 /* power state controls amps */
683 { 0x01, AC_VERB_SET_EAPD
, 1 << 2},
686 static struct hda_verb stac92hd71bxx_core_init
[] = {
687 /* set master volume and direct control */
688 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
689 /* connect headphone jack to dac1 */
690 { 0x0a, AC_VERB_SET_CONNECT_SEL
, 0x01},
691 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Speaker */
692 /* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */
693 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
694 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
695 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
698 #define HD_DISABLE_PORTF 3
699 static struct hda_verb stac92hd71bxx_analog_core_init
[] = {
700 /* start of config #1 */
702 /* connect port 0f to audio mixer */
703 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x2},
704 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Speaker */
705 /* unmute right and left channels for node 0x0f */
706 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
707 /* start of config #2 */
709 /* set master volume and direct control */
710 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
711 /* connect headphone jack to dac1 */
712 { 0x0a, AC_VERB_SET_CONNECT_SEL
, 0x01},
713 /* connect port 0d to audio mixer */
714 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x2},
715 /* unmute dac0 input in audio mixer */
716 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, 0x701f},
717 /* unmute right and left channels for nodes 0x0a, 0xd */
718 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
719 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
723 static struct hda_verb stac925x_core_init
[] = {
724 /* set dac0mux for dac converter */
725 { 0x06, AC_VERB_SET_CONNECT_SEL
, 0x00},
729 static struct hda_verb stac922x_core_init
[] = {
730 /* set master volume and direct control */
731 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
735 static struct hda_verb d965_core_init
[] = {
736 /* set master volume and direct control */
737 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
738 /* unmute node 0x1b */
739 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
740 /* select node 0x03 as DAC */
741 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x01},
745 static struct hda_verb stac927x_core_init
[] = {
746 /* set master volume and direct control */
747 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
748 /* enable analog pc beep path */
749 { 0x01, AC_VERB_SET_DIGI_CONVERT_2
, 1 << 5},
753 static struct hda_verb stac9205_core_init
[] = {
754 /* set master volume and direct control */
755 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
756 /* enable analog pc beep path */
757 { 0x01, AC_VERB_SET_DIGI_CONVERT_2
, 1 << 5},
761 #define STAC_MONO_MUX \
763 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
764 .name = "Mono Mux", \
766 .info = stac92xx_mono_mux_enum_info, \
767 .get = stac92xx_mono_mux_enum_get, \
768 .put = stac92xx_mono_mux_enum_put, \
771 #define STAC_INPUT_SOURCE(cnt) \
773 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
774 .name = "Input Source", \
776 .info = stac92xx_mux_enum_info, \
777 .get = stac92xx_mux_enum_get, \
778 .put = stac92xx_mux_enum_put, \
781 #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \
783 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
784 .name = "Analog Loopback", \
786 .info = stac92xx_aloopback_info, \
787 .get = stac92xx_aloopback_get, \
788 .put = stac92xx_aloopback_put, \
789 .private_value = verb_read | (verb_write << 16), \
792 static struct snd_kcontrol_new stac9200_mixer
[] = {
793 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT
),
794 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT
),
795 STAC_INPUT_SOURCE(1),
796 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT
),
797 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT
),
798 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0c, 0, HDA_OUTPUT
),
802 static struct snd_kcontrol_new stac92hd73xx_6ch_mixer
[] = {
803 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3),
805 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT
),
806 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT
),
808 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT
),
809 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT
),
811 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT
),
812 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT
),
814 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT
),
815 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT
),
817 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT
),
818 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT
),
820 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT
),
821 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT
),
823 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT
),
824 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT
),
828 static struct snd_kcontrol_new stac92hd73xx_8ch_mixer
[] = {
829 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4),
831 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT
),
832 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT
),
834 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT
),
835 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT
),
837 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT
),
838 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT
),
840 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT
),
841 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT
),
843 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT
),
844 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT
),
846 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT
),
847 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT
),
849 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT
),
850 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT
),
854 static struct snd_kcontrol_new stac92hd73xx_10ch_mixer
[] = {
855 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5),
857 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT
),
858 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT
),
860 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT
),
861 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT
),
863 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT
),
864 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT
),
866 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT
),
867 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT
),
869 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT
),
870 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT
),
872 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT
),
873 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT
),
875 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT
),
876 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT
),
881 static struct snd_kcontrol_new stac92hd83xxx_mixer
[] = {
882 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_OUTPUT
),
883 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_OUTPUT
),
885 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_OUTPUT
),
886 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_OUTPUT
),
888 HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x1b, 0, HDA_INPUT
),
889 HDA_CODEC_MUTE("DAC0 Capture Switch", 0x1b, 0, HDA_INPUT
),
891 HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x1b, 0x1, HDA_INPUT
),
892 HDA_CODEC_MUTE("DAC1 Capture Switch", 0x1b, 0x1, HDA_INPUT
),
894 HDA_CODEC_VOLUME("Front Mic Capture Volume", 0x1b, 0x2, HDA_INPUT
),
895 HDA_CODEC_MUTE("Front Mic Capture Switch", 0x1b, 0x2, HDA_INPUT
),
897 HDA_CODEC_VOLUME("Line In Capture Volume", 0x1b, 0x3, HDA_INPUT
),
898 HDA_CODEC_MUTE("Line In Capture Switch", 0x1b, 0x3, HDA_INPUT
),
901 HDA_CODEC_VOLUME("Mic Capture Volume", 0x1b, 0x4, HDA_INPUT),
902 HDA_CODEC_MUTE("Mic Capture Switch", 0x1b 0x4, HDA_INPUT),
907 static struct snd_kcontrol_new stac92hd71bxx_analog_mixer
[] = {
908 STAC_INPUT_SOURCE(2),
910 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT
),
911 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT
),
912 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x0, 0x1a, 0x0, HDA_OUTPUT
),
914 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT
),
915 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT
),
916 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x1, 0x1b, 0x0, HDA_OUTPUT
),
918 /* analog pc-beep replaced with digital beep support */
920 HDA_CODEC_VOLUME("PC Beep Volume", 0x17, 0x2, HDA_INPUT),
921 HDA_CODEC_MUTE("PC Beep Switch", 0x17, 0x2, HDA_INPUT),
924 HDA_CODEC_MUTE("Analog Loopback 1", 0x17, 0x3, HDA_INPUT
),
925 HDA_CODEC_MUTE("Analog Loopback 2", 0x17, 0x4, HDA_INPUT
),
929 static struct snd_kcontrol_new stac92hd71bxx_mixer
[] = {
930 STAC_INPUT_SOURCE(2),
931 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2),
933 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT
),
934 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT
),
935 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x0, 0x1a, 0x0, HDA_OUTPUT
),
937 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT
),
938 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT
),
939 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x1, 0x1b, 0x0, HDA_OUTPUT
),
943 static struct snd_kcontrol_new stac925x_mixer
[] = {
944 STAC_INPUT_SOURCE(1),
945 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT
),
946 HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT
),
947 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0f, 0, HDA_OUTPUT
),
951 static struct snd_kcontrol_new stac9205_mixer
[] = {
952 STAC_INPUT_SOURCE(2),
953 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1),
955 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT
),
956 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT
),
957 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x19, 0x0, HDA_OUTPUT
),
959 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1c, 0x0, HDA_INPUT
),
960 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1e, 0x0, HDA_OUTPUT
),
961 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x1A, 0x0, HDA_OUTPUT
),
966 /* This needs to be generated dynamically based on sequence */
967 static struct snd_kcontrol_new stac922x_mixer
[] = {
968 STAC_INPUT_SOURCE(2),
969 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT
),
970 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT
),
971 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x12, 0x0, HDA_OUTPUT
),
973 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_INPUT
),
974 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_INPUT
),
975 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x13, 0x0, HDA_OUTPUT
),
980 static struct snd_kcontrol_new stac927x_mixer
[] = {
981 STAC_INPUT_SOURCE(3),
982 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1),
984 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT
),
985 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT
),
986 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x15, 0x0, HDA_OUTPUT
),
988 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x19, 0x0, HDA_INPUT
),
989 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1c, 0x0, HDA_OUTPUT
),
990 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x16, 0x0, HDA_OUTPUT
),
992 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x2, 0x1A, 0x0, HDA_INPUT
),
993 HDA_CODEC_MUTE_IDX("Capture Switch", 0x2, 0x1d, 0x0, HDA_OUTPUT
),
994 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x2, 0x17, 0x0, HDA_OUTPUT
),
998 static struct snd_kcontrol_new stac_dmux_mixer
= {
999 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1000 .name
= "Digital Input Source",
1001 /* count set later */
1002 .info
= stac92xx_dmux_enum_info
,
1003 .get
= stac92xx_dmux_enum_get
,
1004 .put
= stac92xx_dmux_enum_put
,
1007 static const char *slave_vols
[] = {
1008 "Front Playback Volume",
1009 "Surround Playback Volume",
1010 "Center Playback Volume",
1011 "LFE Playback Volume",
1012 "Side Playback Volume",
1013 "Headphone Playback Volume",
1014 "Headphone Playback Volume",
1015 "Speaker Playback Volume",
1016 "External Speaker Playback Volume",
1017 "Speaker2 Playback Volume",
1021 static const char *slave_sws
[] = {
1022 "Front Playback Switch",
1023 "Surround Playback Switch",
1024 "Center Playback Switch",
1025 "LFE Playback Switch",
1026 "Side Playback Switch",
1027 "Headphone Playback Switch",
1028 "Headphone Playback Switch",
1029 "Speaker Playback Switch",
1030 "External Speaker Playback Switch",
1031 "Speaker2 Playback Switch",
1032 "IEC958 Playback Switch",
1036 static int stac92xx_build_controls(struct hda_codec
*codec
)
1038 struct sigmatel_spec
*spec
= codec
->spec
;
1042 err
= snd_hda_add_new_ctls(codec
, spec
->mixer
);
1046 for (i
= 0; i
< spec
->num_mixers
; i
++) {
1047 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
1051 if (spec
->num_dmuxes
> 0) {
1052 stac_dmux_mixer
.count
= spec
->num_dmuxes
;
1053 err
= snd_ctl_add(codec
->bus
->card
,
1054 snd_ctl_new1(&stac_dmux_mixer
, codec
));
1059 if (spec
->multiout
.dig_out_nid
) {
1060 err
= snd_hda_create_spdif_out_ctls(codec
, spec
->multiout
.dig_out_nid
);
1063 err
= snd_hda_create_spdif_share_sw(codec
,
1067 spec
->multiout
.share_spdif
= 1;
1069 if (spec
->dig_in_nid
) {
1070 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
1075 /* if we have no master control, let's create it */
1076 if (!snd_hda_find_mixer_ctl(codec
, "Master Playback Volume")) {
1077 unsigned int vmaster_tlv
[4];
1078 snd_hda_set_vmaster_tlv(codec
, spec
->multiout
.dac_nids
[0],
1079 HDA_OUTPUT
, vmaster_tlv
);
1080 err
= snd_hda_add_vmaster(codec
, "Master Playback Volume",
1081 vmaster_tlv
, slave_vols
);
1085 if (!snd_hda_find_mixer_ctl(codec
, "Master Playback Switch")) {
1086 err
= snd_hda_add_vmaster(codec
, "Master Playback Switch",
1095 static unsigned int ref9200_pin_configs
[8] = {
1096 0x01c47010, 0x01447010, 0x0221401f, 0x01114010,
1097 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1101 STAC 9200 pin configs for
1106 static unsigned int dell9200_d21_pin_configs
[8] = {
1107 0x400001f0, 0x400001f1, 0x02214030, 0x01014010,
1108 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1112 STAC 9200 pin configs for
1116 static unsigned int dell9200_d22_pin_configs
[8] = {
1117 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1118 0x01813020, 0x02a19021, 0x90100140, 0x400001f2,
1122 STAC 9200 pin configs for
1123 102801C4 (Dell Dimension E310)
1130 static unsigned int dell9200_d23_pin_configs
[8] = {
1131 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1132 0x01813020, 0x01a19021, 0x90100140, 0x400001f2,
1137 STAC 9200-32 pin configs for
1138 102801B5 (Dell Inspiron 630m)
1139 102801D8 (Dell Inspiron 640m)
1141 static unsigned int dell9200_m21_pin_configs
[8] = {
1142 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310,
1143 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd,
1147 STAC 9200-32 pin configs for
1148 102801C2 (Dell Latitude D620)
1150 102801CC (Dell Latitude D820)
1154 static unsigned int dell9200_m22_pin_configs
[8] = {
1155 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310,
1156 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc,
1160 STAC 9200-32 pin configs for
1161 102801CE (Dell XPS M1710)
1162 102801CF (Dell Precision M90)
1164 static unsigned int dell9200_m23_pin_configs
[8] = {
1165 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310,
1166 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc,
1170 STAC 9200-32 pin configs for
1173 102801CB (Dell Latitude 120L)
1176 static unsigned int dell9200_m24_pin_configs
[8] = {
1177 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310,
1178 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe,
1182 STAC 9200-32 pin configs for
1183 102801BD (Dell Inspiron E1505n)
1187 static unsigned int dell9200_m25_pin_configs
[8] = {
1188 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1189 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd,
1193 STAC 9200-32 pin configs for
1194 102801F5 (Dell Inspiron 1501)
1197 static unsigned int dell9200_m26_pin_configs
[8] = {
1198 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310,
1199 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe,
1204 102801CD (Dell Inspiron E1705/9400)
1206 static unsigned int dell9200_m27_pin_configs
[8] = {
1207 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1208 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc,
1211 static unsigned int oqo9200_pin_configs
[8] = {
1212 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210,
1213 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3,
1217 static unsigned int *stac9200_brd_tbl
[STAC_9200_MODELS
] = {
1218 [STAC_REF
] = ref9200_pin_configs
,
1219 [STAC_9200_OQO
] = oqo9200_pin_configs
,
1220 [STAC_9200_DELL_D21
] = dell9200_d21_pin_configs
,
1221 [STAC_9200_DELL_D22
] = dell9200_d22_pin_configs
,
1222 [STAC_9200_DELL_D23
] = dell9200_d23_pin_configs
,
1223 [STAC_9200_DELL_M21
] = dell9200_m21_pin_configs
,
1224 [STAC_9200_DELL_M22
] = dell9200_m22_pin_configs
,
1225 [STAC_9200_DELL_M23
] = dell9200_m23_pin_configs
,
1226 [STAC_9200_DELL_M24
] = dell9200_m24_pin_configs
,
1227 [STAC_9200_DELL_M25
] = dell9200_m25_pin_configs
,
1228 [STAC_9200_DELL_M26
] = dell9200_m26_pin_configs
,
1229 [STAC_9200_DELL_M27
] = dell9200_m27_pin_configs
,
1230 [STAC_9200_PANASONIC
] = ref9200_pin_configs
,
1233 static const char *stac9200_models
[STAC_9200_MODELS
] = {
1235 [STAC_9200_OQO
] = "oqo",
1236 [STAC_9200_DELL_D21
] = "dell-d21",
1237 [STAC_9200_DELL_D22
] = "dell-d22",
1238 [STAC_9200_DELL_D23
] = "dell-d23",
1239 [STAC_9200_DELL_M21
] = "dell-m21",
1240 [STAC_9200_DELL_M22
] = "dell-m22",
1241 [STAC_9200_DELL_M23
] = "dell-m23",
1242 [STAC_9200_DELL_M24
] = "dell-m24",
1243 [STAC_9200_DELL_M25
] = "dell-m25",
1244 [STAC_9200_DELL_M26
] = "dell-m26",
1245 [STAC_9200_DELL_M27
] = "dell-m27",
1246 [STAC_9200_GATEWAY
] = "gateway",
1247 [STAC_9200_PANASONIC
] = "panasonic",
1250 static struct snd_pci_quirk stac9200_cfg_tbl
[] = {
1251 /* SigmaTel reference board */
1252 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1253 "DFI LanParty", STAC_REF
),
1254 /* Dell laptops have BIOS problem */
1255 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01a8,
1256 "unknown Dell", STAC_9200_DELL_D21
),
1257 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01b5,
1258 "Dell Inspiron 630m", STAC_9200_DELL_M21
),
1259 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01bd,
1260 "Dell Inspiron E1505n", STAC_9200_DELL_M25
),
1261 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c0,
1262 "unknown Dell", STAC_9200_DELL_D22
),
1263 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c1,
1264 "unknown Dell", STAC_9200_DELL_D22
),
1265 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c2,
1266 "Dell Latitude D620", STAC_9200_DELL_M22
),
1267 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c5,
1268 "unknown Dell", STAC_9200_DELL_D23
),
1269 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c7,
1270 "unknown Dell", STAC_9200_DELL_D23
),
1271 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c8,
1272 "unknown Dell", STAC_9200_DELL_M22
),
1273 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c9,
1274 "unknown Dell", STAC_9200_DELL_M24
),
1275 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ca,
1276 "unknown Dell", STAC_9200_DELL_M24
),
1277 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cb,
1278 "Dell Latitude 120L", STAC_9200_DELL_M24
),
1279 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cc,
1280 "Dell Latitude D820", STAC_9200_DELL_M22
),
1281 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cd,
1282 "Dell Inspiron E1705/9400", STAC_9200_DELL_M27
),
1283 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ce,
1284 "Dell XPS M1710", STAC_9200_DELL_M23
),
1285 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cf,
1286 "Dell Precision M90", STAC_9200_DELL_M23
),
1287 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d3,
1288 "unknown Dell", STAC_9200_DELL_M22
),
1289 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d4,
1290 "unknown Dell", STAC_9200_DELL_M22
),
1291 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d6,
1292 "unknown Dell", STAC_9200_DELL_M22
),
1293 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d8,
1294 "Dell Inspiron 640m", STAC_9200_DELL_M21
),
1295 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d9,
1296 "unknown Dell", STAC_9200_DELL_D23
),
1297 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01da,
1298 "unknown Dell", STAC_9200_DELL_D23
),
1299 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01de,
1300 "unknown Dell", STAC_9200_DELL_D21
),
1301 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01e3,
1302 "unknown Dell", STAC_9200_DELL_D23
),
1303 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01e8,
1304 "unknown Dell", STAC_9200_DELL_D21
),
1305 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ee,
1306 "unknown Dell", STAC_9200_DELL_M25
),
1307 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ef,
1308 "unknown Dell", STAC_9200_DELL_M25
),
1309 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f5,
1310 "Dell Inspiron 1501", STAC_9200_DELL_M26
),
1311 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f6,
1312 "unknown Dell", STAC_9200_DELL_M26
),
1314 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC
),
1315 /* Gateway machines needs EAPD to be set on resume */
1316 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_GATEWAY
),
1317 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*",
1319 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707",
1322 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO
),
1326 static unsigned int ref925x_pin_configs
[8] = {
1327 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1328 0x90a70320, 0x02214210, 0x01019020, 0x9033032e,
1331 static unsigned int stac925x_MA6_pin_configs
[8] = {
1332 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1333 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e,
1336 static unsigned int stac925x_PA6_pin_configs
[8] = {
1337 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1338 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e,
1341 static unsigned int stac925xM2_2_pin_configs
[8] = {
1342 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020,
1343 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e,
1346 static unsigned int *stac925x_brd_tbl
[STAC_925x_MODELS
] = {
1347 [STAC_REF
] = ref925x_pin_configs
,
1348 [STAC_M2_2
] = stac925xM2_2_pin_configs
,
1349 [STAC_MA6
] = stac925x_MA6_pin_configs
,
1350 [STAC_PA6
] = stac925x_PA6_pin_configs
,
1353 static const char *stac925x_models
[STAC_925x_MODELS
] = {
1355 [STAC_M2_2
] = "m2-2",
1360 static struct snd_pci_quirk stac925x_cfg_tbl
[] = {
1361 /* SigmaTel reference board */
1362 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668, "DFI LanParty", STAC_REF
),
1363 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF
),
1364 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF
),
1365 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF
),
1366 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6
),
1367 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6
),
1368 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2
),
1372 static unsigned int ref92hd73xx_pin_configs
[13] = {
1373 0x02214030, 0x02a19040, 0x01a19020, 0x02214030,
1374 0x0181302e, 0x01014010, 0x01014020, 0x01014030,
1375 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050,
1379 static unsigned int dell_m6_pin_configs
[13] = {
1380 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110,
1381 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0,
1382 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
1386 static unsigned int *stac92hd73xx_brd_tbl
[STAC_92HD73XX_MODELS
] = {
1387 [STAC_92HD73XX_REF
] = ref92hd73xx_pin_configs
,
1388 [STAC_DELL_M6
] = dell_m6_pin_configs
,
1391 static const char *stac92hd73xx_models
[STAC_92HD73XX_MODELS
] = {
1392 [STAC_92HD73XX_REF
] = "ref",
1393 [STAC_DELL_M6
] = "dell-m6",
1396 static struct snd_pci_quirk stac92hd73xx_cfg_tbl
[] = {
1397 /* SigmaTel reference board */
1398 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1399 "DFI LanParty", STAC_92HD73XX_REF
),
1400 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0254,
1401 "unknown Dell", STAC_DELL_M6
),
1402 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0255,
1403 "unknown Dell", STAC_DELL_M6
),
1404 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0256,
1405 "unknown Dell", STAC_DELL_M6
),
1406 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0257,
1407 "unknown Dell", STAC_DELL_M6
),
1408 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x025e,
1409 "unknown Dell", STAC_DELL_M6
),
1410 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x025f,
1411 "unknown Dell", STAC_DELL_M6
),
1412 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0271,
1413 "unknown Dell", STAC_DELL_M6
),
1417 static unsigned int ref92hd83xxx_pin_configs
[14] = {
1418 0x02214030, 0x02211010, 0x02a19020, 0x02170130,
1419 0x01014050, 0x01819040, 0x01014020, 0x90a3014e,
1420 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x40f000f0,
1421 0x01451160, 0x98560170,
1424 static unsigned int *stac92hd83xxx_brd_tbl
[STAC_92HD83XXX_MODELS
] = {
1425 [STAC_92HD83XXX_REF
] = ref92hd83xxx_pin_configs
,
1428 static const char *stac92hd83xxx_models
[STAC_92HD83XXX_MODELS
] = {
1429 [STAC_92HD83XXX_REF
] = "ref",
1432 static struct snd_pci_quirk stac92hd83xxx_cfg_tbl
[] = {
1433 /* SigmaTel reference board */
1434 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1435 "DFI LanParty", STAC_92HD71BXX_REF
),
1438 static unsigned int ref92hd71bxx_pin_configs
[10] = {
1439 0x02214030, 0x02a19040, 0x01a19020, 0x01014010,
1440 0x0181302e, 0x01114010, 0x01019020, 0x90a000f0,
1441 0x90a000f0, 0x01452050,
1444 static unsigned int dell_m4_1_pin_configs
[10] = {
1445 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110,
1446 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0,
1447 0x40f000f0, 0x4f0000f0,
1450 static unsigned int dell_m4_2_pin_configs
[10] = {
1451 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1452 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0,
1453 0x40f000f0, 0x044413b0,
1456 static unsigned int *stac92hd71bxx_brd_tbl
[STAC_92HD71BXX_MODELS
] = {
1457 [STAC_92HD71BXX_REF
] = ref92hd71bxx_pin_configs
,
1458 [STAC_DELL_M4_1
] = dell_m4_1_pin_configs
,
1459 [STAC_DELL_M4_2
] = dell_m4_2_pin_configs
,
1462 static const char *stac92hd71bxx_models
[STAC_92HD71BXX_MODELS
] = {
1463 [STAC_92HD71BXX_REF
] = "ref",
1464 [STAC_DELL_M4_1
] = "dell-m4-1",
1465 [STAC_DELL_M4_2
] = "dell-m4-2",
1468 static struct snd_pci_quirk stac92hd71bxx_cfg_tbl
[] = {
1469 /* SigmaTel reference board */
1470 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1471 "DFI LanParty", STAC_92HD71BXX_REF
),
1472 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0233,
1473 "unknown Dell", STAC_DELL_M4_1
),
1474 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0234,
1475 "unknown Dell", STAC_DELL_M4_1
),
1476 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0250,
1477 "unknown Dell", STAC_DELL_M4_1
),
1478 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x024f,
1479 "unknown Dell", STAC_DELL_M4_1
),
1480 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x024d,
1481 "unknown Dell", STAC_DELL_M4_1
),
1482 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0251,
1483 "unknown Dell", STAC_DELL_M4_1
),
1484 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0277,
1485 "unknown Dell", STAC_DELL_M4_1
),
1486 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0263,
1487 "unknown Dell", STAC_DELL_M4_2
),
1488 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0265,
1489 "unknown Dell", STAC_DELL_M4_2
),
1490 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0262,
1491 "unknown Dell", STAC_DELL_M4_2
),
1492 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0264,
1493 "unknown Dell", STAC_DELL_M4_2
),
1497 static unsigned int ref922x_pin_configs
[10] = {
1498 0x01014010, 0x01016011, 0x01012012, 0x0221401f,
1499 0x01813122, 0x01011014, 0x01441030, 0x01c41030,
1500 0x40000100, 0x40000100,
1504 STAC 922X pin configs for
1511 static unsigned int dell_922x_d81_pin_configs
[10] = {
1512 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1513 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1,
1514 0x01813122, 0x400001f2,
1518 STAC 922X pin configs for
1522 static unsigned int dell_922x_d82_pin_configs
[10] = {
1523 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1524 0x02a19020, 0x01117011, 0x01451140, 0x400001f0,
1525 0x01813122, 0x400001f1,
1529 STAC 922X pin configs for
1532 static unsigned int dell_922x_m81_pin_configs
[10] = {
1533 0x0321101f, 0x01112024, 0x01111222, 0x91174220,
1534 0x03a11050, 0x01116221, 0x90a70330, 0x01452340,
1535 0x40C003f1, 0x405003f0,
1539 STAC 9221 A1 pin configs for
1540 102801D7 (Dell XPS M1210)
1542 static unsigned int dell_922x_m82_pin_configs
[10] = {
1543 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310,
1544 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2,
1545 0x508003f3, 0x405003f4,
1548 static unsigned int d945gtp3_pin_configs
[10] = {
1549 0x0221401f, 0x01a19022, 0x01813021, 0x01014010,
1550 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1551 0x02a19120, 0x40000100,
1554 static unsigned int d945gtp5_pin_configs
[10] = {
1555 0x0221401f, 0x01011012, 0x01813024, 0x01014010,
1556 0x01a19021, 0x01016011, 0x01452130, 0x40000100,
1557 0x02a19320, 0x40000100,
1560 static unsigned int intel_mac_v1_pin_configs
[10] = {
1561 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd,
1562 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240,
1563 0x400000fc, 0x400000fb,
1566 static unsigned int intel_mac_v2_pin_configs
[10] = {
1567 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1568 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa,
1569 0x400000fc, 0x400000fb,
1572 static unsigned int intel_mac_v3_pin_configs
[10] = {
1573 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1574 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240,
1575 0x400000fc, 0x400000fb,
1578 static unsigned int intel_mac_v4_pin_configs
[10] = {
1579 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1580 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1581 0x400000fc, 0x400000fb,
1584 static unsigned int intel_mac_v5_pin_configs
[10] = {
1585 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1586 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1587 0x400000fc, 0x400000fb,
1590 static unsigned int ecs202_pin_configs
[10] = {
1591 0x0221401f, 0x02a19020, 0x01a19020, 0x01114010,
1592 0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1,
1593 0x9037012e, 0x40e000f2,
1596 static unsigned int *stac922x_brd_tbl
[STAC_922X_MODELS
] = {
1597 [STAC_D945_REF
] = ref922x_pin_configs
,
1598 [STAC_D945GTP3
] = d945gtp3_pin_configs
,
1599 [STAC_D945GTP5
] = d945gtp5_pin_configs
,
1600 [STAC_INTEL_MAC_V1
] = intel_mac_v1_pin_configs
,
1601 [STAC_INTEL_MAC_V2
] = intel_mac_v2_pin_configs
,
1602 [STAC_INTEL_MAC_V3
] = intel_mac_v3_pin_configs
,
1603 [STAC_INTEL_MAC_V4
] = intel_mac_v4_pin_configs
,
1604 [STAC_INTEL_MAC_V5
] = intel_mac_v5_pin_configs
,
1605 [STAC_INTEL_MAC_AUTO
] = intel_mac_v3_pin_configs
,
1606 /* for backward compatibility */
1607 [STAC_MACMINI
] = intel_mac_v3_pin_configs
,
1608 [STAC_MACBOOK
] = intel_mac_v5_pin_configs
,
1609 [STAC_MACBOOK_PRO_V1
] = intel_mac_v3_pin_configs
,
1610 [STAC_MACBOOK_PRO_V2
] = intel_mac_v3_pin_configs
,
1611 [STAC_IMAC_INTEL
] = intel_mac_v2_pin_configs
,
1612 [STAC_IMAC_INTEL_20
] = intel_mac_v3_pin_configs
,
1613 [STAC_ECS_202
] = ecs202_pin_configs
,
1614 [STAC_922X_DELL_D81
] = dell_922x_d81_pin_configs
,
1615 [STAC_922X_DELL_D82
] = dell_922x_d82_pin_configs
,
1616 [STAC_922X_DELL_M81
] = dell_922x_m81_pin_configs
,
1617 [STAC_922X_DELL_M82
] = dell_922x_m82_pin_configs
,
1620 static const char *stac922x_models
[STAC_922X_MODELS
] = {
1621 [STAC_D945_REF
] = "ref",
1622 [STAC_D945GTP5
] = "5stack",
1623 [STAC_D945GTP3
] = "3stack",
1624 [STAC_INTEL_MAC_V1
] = "intel-mac-v1",
1625 [STAC_INTEL_MAC_V2
] = "intel-mac-v2",
1626 [STAC_INTEL_MAC_V3
] = "intel-mac-v3",
1627 [STAC_INTEL_MAC_V4
] = "intel-mac-v4",
1628 [STAC_INTEL_MAC_V5
] = "intel-mac-v5",
1629 [STAC_INTEL_MAC_AUTO
] = "intel-mac-auto",
1630 /* for backward compatibility */
1631 [STAC_MACMINI
] = "macmini",
1632 [STAC_MACBOOK
] = "macbook",
1633 [STAC_MACBOOK_PRO_V1
] = "macbook-pro-v1",
1634 [STAC_MACBOOK_PRO_V2
] = "macbook-pro",
1635 [STAC_IMAC_INTEL
] = "imac-intel",
1636 [STAC_IMAC_INTEL_20
] = "imac-intel-20",
1637 [STAC_ECS_202
] = "ecs202",
1638 [STAC_922X_DELL_D81
] = "dell-d81",
1639 [STAC_922X_DELL_D82
] = "dell-d82",
1640 [STAC_922X_DELL_M81
] = "dell-m81",
1641 [STAC_922X_DELL_M82
] = "dell-m82",
1644 static struct snd_pci_quirk stac922x_cfg_tbl
[] = {
1645 /* SigmaTel reference board */
1646 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1647 "DFI LanParty", STAC_D945_REF
),
1648 /* Intel 945G based systems */
1649 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0101,
1650 "Intel D945G", STAC_D945GTP3
),
1651 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0202,
1652 "Intel D945G", STAC_D945GTP3
),
1653 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0606,
1654 "Intel D945G", STAC_D945GTP3
),
1655 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0601,
1656 "Intel D945G", STAC_D945GTP3
),
1657 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0111,
1658 "Intel D945G", STAC_D945GTP3
),
1659 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1115,
1660 "Intel D945G", STAC_D945GTP3
),
1661 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1116,
1662 "Intel D945G", STAC_D945GTP3
),
1663 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1117,
1664 "Intel D945G", STAC_D945GTP3
),
1665 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1118,
1666 "Intel D945G", STAC_D945GTP3
),
1667 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1119,
1668 "Intel D945G", STAC_D945GTP3
),
1669 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x8826,
1670 "Intel D945G", STAC_D945GTP3
),
1671 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5049,
1672 "Intel D945G", STAC_D945GTP3
),
1673 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5055,
1674 "Intel D945G", STAC_D945GTP3
),
1675 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5048,
1676 "Intel D945G", STAC_D945GTP3
),
1677 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0110,
1678 "Intel D945G", STAC_D945GTP3
),
1679 /* Intel D945G 5-stack systems */
1680 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0404,
1681 "Intel D945G", STAC_D945GTP5
),
1682 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0303,
1683 "Intel D945G", STAC_D945GTP5
),
1684 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0013,
1685 "Intel D945G", STAC_D945GTP5
),
1686 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0417,
1687 "Intel D945G", STAC_D945GTP5
),
1688 /* Intel 945P based systems */
1689 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0b0b,
1690 "Intel D945P", STAC_D945GTP3
),
1691 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0112,
1692 "Intel D945P", STAC_D945GTP3
),
1693 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0d0d,
1694 "Intel D945P", STAC_D945GTP3
),
1695 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0909,
1696 "Intel D945P", STAC_D945GTP3
),
1697 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0505,
1698 "Intel D945P", STAC_D945GTP3
),
1699 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0707,
1700 "Intel D945P", STAC_D945GTP5
),
1702 /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */
1703 SND_PCI_QUIRK(0x8384, 0x7680,
1704 "Mac", STAC_INTEL_MAC_AUTO
),
1706 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01a7,
1707 "unknown Dell", STAC_922X_DELL_D81
),
1708 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01a9,
1709 "unknown Dell", STAC_922X_DELL_D81
),
1710 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ab,
1711 "unknown Dell", STAC_922X_DELL_D81
),
1712 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ac,
1713 "unknown Dell", STAC_922X_DELL_D82
),
1714 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01bf,
1715 "unknown Dell", STAC_922X_DELL_M81
),
1716 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d0,
1717 "unknown Dell", STAC_922X_DELL_D82
),
1718 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d1,
1719 "unknown Dell", STAC_922X_DELL_D81
),
1720 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d2,
1721 "unknown Dell", STAC_922X_DELL_D81
),
1722 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d7,
1723 "Dell XPS M1210", STAC_922X_DELL_M82
),
1724 /* ECS/PC Chips boards */
1725 SND_PCI_QUIRK(0x1019, 0x2144,
1726 "ECS/PC chips", STAC_ECS_202
),
1727 SND_PCI_QUIRK(0x1019, 0x2608,
1728 "ECS/PC chips", STAC_ECS_202
),
1729 SND_PCI_QUIRK(0x1019, 0x2633,
1730 "ECS/PC chips P17G/1333", STAC_ECS_202
),
1731 SND_PCI_QUIRK(0x1019, 0x2811,
1732 "ECS/PC chips", STAC_ECS_202
),
1733 SND_PCI_QUIRK(0x1019, 0x2812,
1734 "ECS/PC chips", STAC_ECS_202
),
1735 SND_PCI_QUIRK(0x1019, 0x2813,
1736 "ECS/PC chips", STAC_ECS_202
),
1737 SND_PCI_QUIRK(0x1019, 0x2814,
1738 "ECS/PC chips", STAC_ECS_202
),
1739 SND_PCI_QUIRK(0x1019, 0x2815,
1740 "ECS/PC chips", STAC_ECS_202
),
1741 SND_PCI_QUIRK(0x1019, 0x2816,
1742 "ECS/PC chips", STAC_ECS_202
),
1743 SND_PCI_QUIRK(0x1019, 0x2817,
1744 "ECS/PC chips", STAC_ECS_202
),
1745 SND_PCI_QUIRK(0x1019, 0x2818,
1746 "ECS/PC chips", STAC_ECS_202
),
1747 SND_PCI_QUIRK(0x1019, 0x2819,
1748 "ECS/PC chips", STAC_ECS_202
),
1749 SND_PCI_QUIRK(0x1019, 0x2820,
1750 "ECS/PC chips", STAC_ECS_202
),
1754 static unsigned int ref927x_pin_configs
[14] = {
1755 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
1756 0x01a19040, 0x01011012, 0x01016011, 0x0101201f,
1757 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070,
1758 0x01c42190, 0x40000100,
1761 static unsigned int d965_3st_pin_configs
[14] = {
1762 0x0221401f, 0x02a19120, 0x40000100, 0x01014011,
1763 0x01a19021, 0x01813024, 0x40000100, 0x40000100,
1764 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1765 0x40000100, 0x40000100
1768 static unsigned int d965_5st_pin_configs
[14] = {
1769 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
1770 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
1771 0x40000100, 0x40000100, 0x40000100, 0x01442070,
1772 0x40000100, 0x40000100
1775 static unsigned int dell_3st_pin_configs
[14] = {
1776 0x02211230, 0x02a11220, 0x01a19040, 0x01114210,
1777 0x01111212, 0x01116211, 0x01813050, 0x01112214,
1778 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb,
1779 0x40c003fc, 0x40000100
1782 static unsigned int *stac927x_brd_tbl
[STAC_927X_MODELS
] = {
1783 [STAC_D965_REF
] = ref927x_pin_configs
,
1784 [STAC_D965_3ST
] = d965_3st_pin_configs
,
1785 [STAC_D965_5ST
] = d965_5st_pin_configs
,
1786 [STAC_DELL_3ST
] = dell_3st_pin_configs
,
1787 [STAC_DELL_BIOS
] = NULL
,
1790 static const char *stac927x_models
[STAC_927X_MODELS
] = {
1791 [STAC_D965_REF
] = "ref",
1792 [STAC_D965_3ST
] = "3stack",
1793 [STAC_D965_5ST
] = "5stack",
1794 [STAC_DELL_3ST
] = "dell-3stack",
1795 [STAC_DELL_BIOS
] = "dell-bios",
1798 static struct snd_pci_quirk stac927x_cfg_tbl
[] = {
1799 /* SigmaTel reference board */
1800 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1801 "DFI LanParty", STAC_D965_REF
),
1802 /* Intel 946 based systems */
1803 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x3d01, "Intel D946", STAC_D965_3ST
),
1804 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0xa301, "Intel D946", STAC_D965_3ST
),
1805 /* 965 based 3 stack systems */
1806 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2116, "Intel D965", STAC_D965_3ST
),
1807 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2115, "Intel D965", STAC_D965_3ST
),
1808 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2114, "Intel D965", STAC_D965_3ST
),
1809 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2113, "Intel D965", STAC_D965_3ST
),
1810 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2112, "Intel D965", STAC_D965_3ST
),
1811 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2111, "Intel D965", STAC_D965_3ST
),
1812 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2110, "Intel D965", STAC_D965_3ST
),
1813 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2009, "Intel D965", STAC_D965_3ST
),
1814 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2008, "Intel D965", STAC_D965_3ST
),
1815 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2007, "Intel D965", STAC_D965_3ST
),
1816 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2006, "Intel D965", STAC_D965_3ST
),
1817 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2005, "Intel D965", STAC_D965_3ST
),
1818 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2004, "Intel D965", STAC_D965_3ST
),
1819 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2003, "Intel D965", STAC_D965_3ST
),
1820 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2002, "Intel D965", STAC_D965_3ST
),
1821 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2001, "Intel D965", STAC_D965_3ST
),
1822 /* Dell 3 stack systems */
1823 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f7, "Dell XPS M1730", STAC_DELL_3ST
),
1824 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST
),
1825 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ed, "Dell ", STAC_DELL_3ST
),
1826 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f4, "Dell ", STAC_DELL_3ST
),
1827 /* Dell 3 stack systems with verb table in BIOS */
1828 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS
),
1829 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS
),
1830 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x022e, "Dell ", STAC_DELL_BIOS
),
1831 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x022f, "Dell Inspiron 1525", STAC_DELL_3ST
),
1832 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0242, "Dell ", STAC_DELL_BIOS
),
1833 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0243, "Dell ", STAC_DELL_BIOS
),
1834 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02ff, "Dell ", STAC_DELL_BIOS
),
1835 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS
),
1836 /* 965 based 5 stack systems */
1837 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2301, "Intel D965", STAC_D965_5ST
),
1838 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2302, "Intel D965", STAC_D965_5ST
),
1839 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2303, "Intel D965", STAC_D965_5ST
),
1840 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2304, "Intel D965", STAC_D965_5ST
),
1841 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2305, "Intel D965", STAC_D965_5ST
),
1842 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2501, "Intel D965", STAC_D965_5ST
),
1843 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2502, "Intel D965", STAC_D965_5ST
),
1844 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2503, "Intel D965", STAC_D965_5ST
),
1845 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2504, "Intel D965", STAC_D965_5ST
),
1849 static unsigned int ref9205_pin_configs
[12] = {
1850 0x40000100, 0x40000100, 0x01016011, 0x01014010,
1851 0x01813122, 0x01a19021, 0x01019020, 0x40000100,
1852 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030
1856 STAC 9205 pin configs for
1863 10280228 (Dell Vostro 1500)
1865 static unsigned int dell_9205_m42_pin_configs
[12] = {
1866 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310,
1867 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9,
1868 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE,
1872 STAC 9205 pin configs for
1876 102801FF (Dell Precision M4300)
1881 static unsigned int dell_9205_m43_pin_configs
[12] = {
1882 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310,
1883 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9,
1884 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8,
1887 static unsigned int dell_9205_m44_pin_configs
[12] = {
1888 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310,
1889 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9,
1890 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe,
1893 static unsigned int *stac9205_brd_tbl
[STAC_9205_MODELS
] = {
1894 [STAC_9205_REF
] = ref9205_pin_configs
,
1895 [STAC_9205_DELL_M42
] = dell_9205_m42_pin_configs
,
1896 [STAC_9205_DELL_M43
] = dell_9205_m43_pin_configs
,
1897 [STAC_9205_DELL_M44
] = dell_9205_m44_pin_configs
,
1900 static const char *stac9205_models
[STAC_9205_MODELS
] = {
1901 [STAC_9205_REF
] = "ref",
1902 [STAC_9205_DELL_M42
] = "dell-m42",
1903 [STAC_9205_DELL_M43
] = "dell-m43",
1904 [STAC_9205_DELL_M44
] = "dell-m44",
1907 static struct snd_pci_quirk stac9205_cfg_tbl
[] = {
1908 /* SigmaTel reference board */
1909 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1910 "DFI LanParty", STAC_9205_REF
),
1911 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f1,
1912 "unknown Dell", STAC_9205_DELL_M42
),
1913 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f2,
1914 "unknown Dell", STAC_9205_DELL_M42
),
1915 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f8,
1916 "Dell Precision", STAC_9205_DELL_M43
),
1917 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f9,
1918 "Dell Precision", STAC_9205_DELL_M43
),
1919 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01fa,
1920 "Dell Precision", STAC_9205_DELL_M43
),
1921 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01fc,
1922 "unknown Dell", STAC_9205_DELL_M42
),
1923 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01fd,
1924 "unknown Dell", STAC_9205_DELL_M42
),
1925 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01fe,
1926 "Dell Precision", STAC_9205_DELL_M43
),
1927 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ff,
1928 "Dell Precision M4300", STAC_9205_DELL_M43
),
1929 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0204,
1930 "unknown Dell", STAC_9205_DELL_M42
),
1931 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0206,
1932 "Dell Precision", STAC_9205_DELL_M43
),
1933 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x021b,
1934 "Dell Precision", STAC_9205_DELL_M43
),
1935 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x021c,
1936 "Dell Precision", STAC_9205_DELL_M43
),
1937 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x021f,
1938 "Dell Inspiron", STAC_9205_DELL_M44
),
1939 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0228,
1940 "Dell Vostro 1500", STAC_9205_DELL_M42
),
1944 static int stac92xx_save_bios_config_regs(struct hda_codec
*codec
)
1947 struct sigmatel_spec
*spec
= codec
->spec
;
1949 if (! spec
->bios_pin_configs
) {
1950 spec
->bios_pin_configs
= kcalloc(spec
->num_pins
,
1951 sizeof(*spec
->bios_pin_configs
), GFP_KERNEL
);
1952 if (! spec
->bios_pin_configs
)
1956 for (i
= 0; i
< spec
->num_pins
; i
++) {
1957 hda_nid_t nid
= spec
->pin_nids
[i
];
1958 unsigned int pin_cfg
;
1960 pin_cfg
= snd_hda_codec_read(codec
, nid
, 0,
1961 AC_VERB_GET_CONFIG_DEFAULT
, 0x00);
1962 snd_printdd(KERN_INFO
"hda_codec: pin nid %2.2x bios pin config %8.8x\n",
1964 spec
->bios_pin_configs
[i
] = pin_cfg
;
1970 static void stac92xx_set_config_reg(struct hda_codec
*codec
,
1971 hda_nid_t pin_nid
, unsigned int pin_config
)
1974 snd_hda_codec_write(codec
, pin_nid
, 0,
1975 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0
,
1976 pin_config
& 0x000000ff);
1977 snd_hda_codec_write(codec
, pin_nid
, 0,
1978 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1
,
1979 (pin_config
& 0x0000ff00) >> 8);
1980 snd_hda_codec_write(codec
, pin_nid
, 0,
1981 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2
,
1982 (pin_config
& 0x00ff0000) >> 16);
1983 snd_hda_codec_write(codec
, pin_nid
, 0,
1984 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3
,
1986 i
= snd_hda_codec_read(codec
, pin_nid
, 0,
1987 AC_VERB_GET_CONFIG_DEFAULT
,
1989 snd_printdd(KERN_INFO
"hda_codec: pin nid %2.2x pin config %8.8x\n",
1993 static void stac92xx_set_config_regs(struct hda_codec
*codec
)
1996 struct sigmatel_spec
*spec
= codec
->spec
;
1998 if (!spec
->pin_configs
)
2001 for (i
= 0; i
< spec
->num_pins
; i
++)
2002 stac92xx_set_config_reg(codec
, spec
->pin_nids
[i
],
2003 spec
->pin_configs
[i
]);
2007 * Analog playback callbacks
2009 static int stac92xx_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2010 struct hda_codec
*codec
,
2011 struct snd_pcm_substream
*substream
)
2013 struct sigmatel_spec
*spec
= codec
->spec
;
2014 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
,
2018 static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2019 struct hda_codec
*codec
,
2020 unsigned int stream_tag
,
2021 unsigned int format
,
2022 struct snd_pcm_substream
*substream
)
2024 struct sigmatel_spec
*spec
= codec
->spec
;
2025 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
, stream_tag
, format
, substream
);
2028 static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2029 struct hda_codec
*codec
,
2030 struct snd_pcm_substream
*substream
)
2032 struct sigmatel_spec
*spec
= codec
->spec
;
2033 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
2037 * Digital playback callbacks
2039 static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2040 struct hda_codec
*codec
,
2041 struct snd_pcm_substream
*substream
)
2043 struct sigmatel_spec
*spec
= codec
->spec
;
2044 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
2047 static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
2048 struct hda_codec
*codec
,
2049 struct snd_pcm_substream
*substream
)
2051 struct sigmatel_spec
*spec
= codec
->spec
;
2052 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
2055 static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2056 struct hda_codec
*codec
,
2057 unsigned int stream_tag
,
2058 unsigned int format
,
2059 struct snd_pcm_substream
*substream
)
2061 struct sigmatel_spec
*spec
= codec
->spec
;
2062 return snd_hda_multi_out_dig_prepare(codec
, &spec
->multiout
,
2063 stream_tag
, format
, substream
);
2068 * Analog capture callbacks
2070 static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2071 struct hda_codec
*codec
,
2072 unsigned int stream_tag
,
2073 unsigned int format
,
2074 struct snd_pcm_substream
*substream
)
2076 struct sigmatel_spec
*spec
= codec
->spec
;
2078 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
],
2079 stream_tag
, 0, format
);
2083 static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2084 struct hda_codec
*codec
,
2085 struct snd_pcm_substream
*substream
)
2087 struct sigmatel_spec
*spec
= codec
->spec
;
2089 snd_hda_codec_cleanup_stream(codec
, spec
->adc_nids
[substream
->number
]);
2093 static struct hda_pcm_stream stac92xx_pcm_digital_playback
= {
2097 /* NID is set in stac92xx_build_pcms */
2099 .open
= stac92xx_dig_playback_pcm_open
,
2100 .close
= stac92xx_dig_playback_pcm_close
,
2101 .prepare
= stac92xx_dig_playback_pcm_prepare
2105 static struct hda_pcm_stream stac92xx_pcm_digital_capture
= {
2109 /* NID is set in stac92xx_build_pcms */
2112 static struct hda_pcm_stream stac92xx_pcm_analog_playback
= {
2116 .nid
= 0x02, /* NID to query formats and rates */
2118 .open
= stac92xx_playback_pcm_open
,
2119 .prepare
= stac92xx_playback_pcm_prepare
,
2120 .cleanup
= stac92xx_playback_pcm_cleanup
2124 static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback
= {
2128 .nid
= 0x06, /* NID to query formats and rates */
2130 .open
= stac92xx_playback_pcm_open
,
2131 .prepare
= stac92xx_playback_pcm_prepare
,
2132 .cleanup
= stac92xx_playback_pcm_cleanup
2136 static struct hda_pcm_stream stac92xx_pcm_analog_capture
= {
2139 /* NID + .substreams is set in stac92xx_build_pcms */
2141 .prepare
= stac92xx_capture_pcm_prepare
,
2142 .cleanup
= stac92xx_capture_pcm_cleanup
2146 static int stac92xx_build_pcms(struct hda_codec
*codec
)
2148 struct sigmatel_spec
*spec
= codec
->spec
;
2149 struct hda_pcm
*info
= spec
->pcm_rec
;
2151 codec
->num_pcms
= 1;
2152 codec
->pcm_info
= info
;
2154 info
->name
= "STAC92xx Analog";
2155 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = stac92xx_pcm_analog_playback
;
2156 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = stac92xx_pcm_analog_capture
;
2157 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
2158 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].substreams
= spec
->num_adcs
;
2160 if (spec
->alt_switch
) {
2163 info
->name
= "STAC92xx Analog Alt";
2164 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = stac92xx_pcm_analog_alt_playback
;
2167 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
2170 info
->name
= "STAC92xx Digital";
2171 info
->pcm_type
= HDA_PCM_TYPE_SPDIF
;
2172 if (spec
->multiout
.dig_out_nid
) {
2173 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = stac92xx_pcm_digital_playback
;
2174 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
2176 if (spec
->dig_in_nid
) {
2177 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = stac92xx_pcm_digital_capture
;
2178 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
2185 static unsigned int stac92xx_get_vref(struct hda_codec
*codec
, hda_nid_t nid
)
2187 unsigned int pincap
= snd_hda_param_read(codec
, nid
,
2189 pincap
= (pincap
& AC_PINCAP_VREF
) >> AC_PINCAP_VREF_SHIFT
;
2190 if (pincap
& AC_PINCAP_VREF_100
)
2191 return AC_PINCTL_VREF_100
;
2192 if (pincap
& AC_PINCAP_VREF_80
)
2193 return AC_PINCTL_VREF_80
;
2194 if (pincap
& AC_PINCAP_VREF_50
)
2195 return AC_PINCTL_VREF_50
;
2196 if (pincap
& AC_PINCAP_VREF_GRD
)
2197 return AC_PINCTL_VREF_GRD
;
2201 static void stac92xx_auto_set_pinctl(struct hda_codec
*codec
, hda_nid_t nid
, int pin_type
)
2204 snd_hda_codec_write_cache(codec
, nid
, 0,
2205 AC_VERB_SET_PIN_WIDGET_CONTROL
, pin_type
);
2208 #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info
2210 static int stac92xx_hp_switch_get(struct snd_kcontrol
*kcontrol
,
2211 struct snd_ctl_elem_value
*ucontrol
)
2213 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2214 struct sigmatel_spec
*spec
= codec
->spec
;
2216 ucontrol
->value
.integer
.value
[0] = spec
->hp_switch
;
2220 static int stac92xx_hp_switch_put(struct snd_kcontrol
*kcontrol
,
2221 struct snd_ctl_elem_value
*ucontrol
)
2223 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2224 struct sigmatel_spec
*spec
= codec
->spec
;
2226 spec
->hp_switch
= ucontrol
->value
.integer
.value
[0];
2228 /* check to be sure that the ports are upto date with
2231 codec
->patch_ops
.unsol_event(codec
, STAC_HP_EVENT
<< 26);
2236 #define stac92xx_io_switch_info snd_ctl_boolean_mono_info
2238 static int stac92xx_io_switch_get(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
2240 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2241 struct sigmatel_spec
*spec
= codec
->spec
;
2242 int io_idx
= kcontrol
-> private_value
& 0xff;
2244 ucontrol
->value
.integer
.value
[0] = spec
->io_switch
[io_idx
];
2248 static int stac92xx_io_switch_put(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
2250 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2251 struct sigmatel_spec
*spec
= codec
->spec
;
2252 hda_nid_t nid
= kcontrol
->private_value
>> 8;
2253 int io_idx
= kcontrol
-> private_value
& 0xff;
2254 unsigned short val
= !!ucontrol
->value
.integer
.value
[0];
2256 spec
->io_switch
[io_idx
] = val
;
2259 stac92xx_auto_set_pinctl(codec
, nid
, AC_PINCTL_OUT_EN
);
2261 unsigned int pinctl
= AC_PINCTL_IN_EN
;
2262 if (io_idx
) /* set VREF for mic */
2263 pinctl
|= stac92xx_get_vref(codec
, nid
);
2264 stac92xx_auto_set_pinctl(codec
, nid
, pinctl
);
2267 /* check the auto-mute again: we need to mute/unmute the speaker
2268 * appropriately according to the pin direction
2270 if (spec
->hp_detect
)
2271 codec
->patch_ops
.unsol_event(codec
, STAC_HP_EVENT
<< 26);
2276 #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info
2278 static int stac92xx_clfe_switch_get(struct snd_kcontrol
*kcontrol
,
2279 struct snd_ctl_elem_value
*ucontrol
)
2281 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2282 struct sigmatel_spec
*spec
= codec
->spec
;
2284 ucontrol
->value
.integer
.value
[0] = spec
->clfe_swap
;
2288 static int stac92xx_clfe_switch_put(struct snd_kcontrol
*kcontrol
,
2289 struct snd_ctl_elem_value
*ucontrol
)
2291 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2292 struct sigmatel_spec
*spec
= codec
->spec
;
2293 hda_nid_t nid
= kcontrol
->private_value
& 0xff;
2294 unsigned int val
= !!ucontrol
->value
.integer
.value
[0];
2296 if (spec
->clfe_swap
== val
)
2299 spec
->clfe_swap
= val
;
2301 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
2302 spec
->clfe_swap
? 0x4 : 0x0);
2307 #define STAC_CODEC_HP_SWITCH(xname) \
2308 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2311 .info = stac92xx_hp_switch_info, \
2312 .get = stac92xx_hp_switch_get, \
2313 .put = stac92xx_hp_switch_put, \
2316 #define STAC_CODEC_IO_SWITCH(xname, xpval) \
2317 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2320 .info = stac92xx_io_switch_info, \
2321 .get = stac92xx_io_switch_get, \
2322 .put = stac92xx_io_switch_put, \
2323 .private_value = xpval, \
2326 #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \
2327 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2330 .info = stac92xx_clfe_switch_info, \
2331 .get = stac92xx_clfe_switch_get, \
2332 .put = stac92xx_clfe_switch_put, \
2333 .private_value = xpval, \
2337 STAC_CTL_WIDGET_VOL
,
2338 STAC_CTL_WIDGET_MUTE
,
2339 STAC_CTL_WIDGET_MONO_MUX
,
2340 STAC_CTL_WIDGET_HP_SWITCH
,
2341 STAC_CTL_WIDGET_IO_SWITCH
,
2342 STAC_CTL_WIDGET_CLFE_SWITCH
2345 static struct snd_kcontrol_new stac92xx_control_templates
[] = {
2346 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
2347 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
2349 STAC_CODEC_HP_SWITCH(NULL
),
2350 STAC_CODEC_IO_SWITCH(NULL
, 0),
2351 STAC_CODEC_CLFE_SWITCH(NULL
, 0),
2354 /* add dynamic controls */
2355 static int stac92xx_add_control(struct sigmatel_spec
*spec
, int type
, const char *name
, unsigned long val
)
2357 struct snd_kcontrol_new
*knew
;
2359 if (spec
->num_kctl_used
>= spec
->num_kctl_alloc
) {
2360 int num
= spec
->num_kctl_alloc
+ NUM_CONTROL_ALLOC
;
2362 knew
= kcalloc(num
+ 1, sizeof(*knew
), GFP_KERNEL
); /* array + terminator */
2365 if (spec
->kctl_alloc
) {
2366 memcpy(knew
, spec
->kctl_alloc
, sizeof(*knew
) * spec
->num_kctl_alloc
);
2367 kfree(spec
->kctl_alloc
);
2369 spec
->kctl_alloc
= knew
;
2370 spec
->num_kctl_alloc
= num
;
2373 knew
= &spec
->kctl_alloc
[spec
->num_kctl_used
];
2374 *knew
= stac92xx_control_templates
[type
];
2375 knew
->name
= kstrdup(name
, GFP_KERNEL
);
2378 knew
->private_value
= val
;
2379 spec
->num_kctl_used
++;
2383 /* flag inputs as additional dynamic lineouts */
2384 static int stac92xx_add_dyn_out_pins(struct hda_codec
*codec
, struct auto_pin_cfg
*cfg
)
2386 struct sigmatel_spec
*spec
= codec
->spec
;
2387 unsigned int wcaps
, wtype
;
2388 int i
, num_dacs
= 0;
2390 /* use the wcaps cache to count all DACs available for line-outs */
2391 for (i
= 0; i
< codec
->num_nodes
; i
++) {
2392 wcaps
= codec
->wcaps
[i
];
2393 wtype
= (wcaps
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
2395 if (wtype
== AC_WID_AUD_OUT
&& !(wcaps
& AC_WCAP_DIGITAL
))
2399 snd_printdd("%s: total dac count=%d\n", __func__
, num_dacs
);
2401 switch (cfg
->line_outs
) {
2403 /* add line-in as side */
2404 if (cfg
->input_pins
[AUTO_PIN_LINE
] && num_dacs
> 3) {
2405 cfg
->line_out_pins
[cfg
->line_outs
] =
2406 cfg
->input_pins
[AUTO_PIN_LINE
];
2407 spec
->line_switch
= 1;
2412 /* add line-in as clfe and mic as side */
2413 if (cfg
->input_pins
[AUTO_PIN_LINE
] && num_dacs
> 2) {
2414 cfg
->line_out_pins
[cfg
->line_outs
] =
2415 cfg
->input_pins
[AUTO_PIN_LINE
];
2416 spec
->line_switch
= 1;
2419 if (cfg
->input_pins
[AUTO_PIN_MIC
] && num_dacs
> 3) {
2420 cfg
->line_out_pins
[cfg
->line_outs
] =
2421 cfg
->input_pins
[AUTO_PIN_MIC
];
2422 spec
->mic_switch
= 1;
2427 /* add line-in as surr and mic as clfe */
2428 if (cfg
->input_pins
[AUTO_PIN_LINE
] && num_dacs
> 1) {
2429 cfg
->line_out_pins
[cfg
->line_outs
] =
2430 cfg
->input_pins
[AUTO_PIN_LINE
];
2431 spec
->line_switch
= 1;
2434 if (cfg
->input_pins
[AUTO_PIN_MIC
] && num_dacs
> 2) {
2435 cfg
->line_out_pins
[cfg
->line_outs
] =
2436 cfg
->input_pins
[AUTO_PIN_MIC
];
2437 spec
->mic_switch
= 1;
2447 static int is_in_dac_nids(struct sigmatel_spec
*spec
, hda_nid_t nid
)
2451 for (i
= 0; i
< spec
->multiout
.num_dacs
; i
++) {
2452 if (spec
->multiout
.dac_nids
[i
] == nid
)
2460 * Fill in the dac_nids table from the parsed pin configuration
2461 * This function only works when every pin in line_out_pins[]
2462 * contains atleast one DAC in its connection list. Some 92xx
2463 * codecs are not connected directly to a DAC, such as the 9200
2464 * and 9202/925x. For those, dac_nids[] must be hard-coded.
2466 static int stac92xx_auto_fill_dac_nids(struct hda_codec
*codec
,
2467 struct auto_pin_cfg
*cfg
)
2469 struct sigmatel_spec
*spec
= codec
->spec
;
2470 int i
, j
, conn_len
= 0;
2471 hda_nid_t nid
, conn
[HDA_MAX_CONNECTIONS
];
2472 unsigned int wcaps
, wtype
;
2474 for (i
= 0; i
< cfg
->line_outs
; i
++) {
2475 nid
= cfg
->line_out_pins
[i
];
2476 conn_len
= snd_hda_get_connections(codec
, nid
, conn
,
2477 HDA_MAX_CONNECTIONS
);
2478 for (j
= 0; j
< conn_len
; j
++) {
2479 wcaps
= snd_hda_param_read(codec
, conn
[j
],
2480 AC_PAR_AUDIO_WIDGET_CAP
);
2481 wtype
= (wcaps
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
2482 if (wtype
!= AC_WID_AUD_OUT
||
2483 (wcaps
& AC_WCAP_DIGITAL
))
2485 /* conn[j] is a DAC routed to this line-out */
2486 if (!is_in_dac_nids(spec
, conn
[j
]))
2490 if (j
== conn_len
) {
2491 if (spec
->multiout
.num_dacs
> 0) {
2492 /* we have already working output pins,
2493 * so let's drop the broken ones again
2495 cfg
->line_outs
= spec
->multiout
.num_dacs
;
2498 /* error out, no available DAC found */
2500 "%s: No available DAC for pin 0x%x\n",
2505 spec
->multiout
.dac_nids
[i
] = conn
[j
];
2506 spec
->multiout
.num_dacs
++;
2508 /* select this DAC in the pin's input mux */
2509 snd_hda_codec_write_cache(codec
, nid
, 0,
2510 AC_VERB_SET_CONNECT_SEL
, j
);
2515 snd_printd("dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
2516 spec
->multiout
.num_dacs
,
2517 spec
->multiout
.dac_nids
[0],
2518 spec
->multiout
.dac_nids
[1],
2519 spec
->multiout
.dac_nids
[2],
2520 spec
->multiout
.dac_nids
[3],
2521 spec
->multiout
.dac_nids
[4]);
2525 /* create volume control/switch for the given prefx type */
2526 static int create_controls(struct sigmatel_spec
*spec
, const char *pfx
, hda_nid_t nid
, int chs
)
2531 sprintf(name
, "%s Playback Volume", pfx
);
2532 err
= stac92xx_add_control(spec
, STAC_CTL_WIDGET_VOL
, name
,
2533 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_OUTPUT
));
2536 sprintf(name
, "%s Playback Switch", pfx
);
2537 err
= stac92xx_add_control(spec
, STAC_CTL_WIDGET_MUTE
, name
,
2538 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_OUTPUT
));
2544 static int add_spec_dacs(struct sigmatel_spec
*spec
, hda_nid_t nid
)
2546 if (!spec
->multiout
.hp_nid
)
2547 spec
->multiout
.hp_nid
= nid
;
2548 else if (spec
->multiout
.num_dacs
> 4) {
2549 printk(KERN_WARNING
"stac92xx: No space for DAC 0x%x\n", nid
);
2552 spec
->multiout
.dac_nids
[spec
->multiout
.num_dacs
] = nid
;
2553 spec
->multiout
.num_dacs
++;
2558 static int check_in_dac_nids(struct sigmatel_spec
*spec
, hda_nid_t nid
)
2560 if (is_in_dac_nids(spec
, nid
))
2562 if (spec
->multiout
.hp_nid
== nid
)
2567 /* add playback controls from the parsed DAC table */
2568 static int stac92xx_auto_create_multi_out_ctls(struct hda_codec
*codec
,
2569 const struct auto_pin_cfg
*cfg
)
2571 static const char *chname
[4] = {
2572 "Front", "Surround", NULL
/*CLFE*/, "Side"
2577 struct sigmatel_spec
*spec
= codec
->spec
;
2578 unsigned int wid_caps
, pincap
;
2581 for (i
= 0; i
< cfg
->line_outs
&& i
< spec
->multiout
.num_dacs
; i
++) {
2582 if (!spec
->multiout
.dac_nids
[i
])
2585 nid
= spec
->multiout
.dac_nids
[i
];
2589 err
= create_controls(spec
, "Center", nid
, 1);
2592 err
= create_controls(spec
, "LFE", nid
, 2);
2596 wid_caps
= get_wcaps(codec
, nid
);
2598 if (wid_caps
& AC_WCAP_LR_SWAP
) {
2599 err
= stac92xx_add_control(spec
,
2600 STAC_CTL_WIDGET_CLFE_SWITCH
,
2601 "Swap Center/LFE Playback Switch", nid
);
2608 err
= create_controls(spec
, chname
[i
], nid
, 3);
2614 if (cfg
->hp_outs
> 1) {
2615 err
= stac92xx_add_control(spec
,
2616 STAC_CTL_WIDGET_HP_SWITCH
,
2617 "Headphone as Line Out Switch", 0);
2622 if (spec
->line_switch
) {
2623 nid
= cfg
->input_pins
[AUTO_PIN_LINE
];
2624 pincap
= snd_hda_param_read(codec
, nid
,
2626 if (pincap
& AC_PINCAP_OUT
) {
2627 err
= stac92xx_add_control(spec
,
2628 STAC_CTL_WIDGET_IO_SWITCH
,
2629 "Line In as Output Switch", nid
<< 8);
2635 if (spec
->mic_switch
) {
2636 unsigned int def_conf
;
2637 unsigned int mic_pin
= AUTO_PIN_MIC
;
2639 nid
= cfg
->input_pins
[mic_pin
];
2640 def_conf
= snd_hda_codec_read(codec
, nid
, 0,
2641 AC_VERB_GET_CONFIG_DEFAULT
, 0);
2642 /* some laptops have an internal analog microphone
2643 * which can't be used as a output */
2644 if (get_defcfg_connect(def_conf
) != AC_JACK_PORT_FIXED
) {
2645 pincap
= snd_hda_param_read(codec
, nid
,
2647 if (pincap
& AC_PINCAP_OUT
) {
2648 err
= stac92xx_add_control(spec
,
2649 STAC_CTL_WIDGET_IO_SWITCH
,
2650 "Mic as Output Switch", (nid
<< 8) | 1);
2651 nid
= snd_hda_codec_read(codec
, nid
, 0,
2652 AC_VERB_GET_CONNECT_LIST
, 0) & 0xff;
2653 if (!check_in_dac_nids(spec
, nid
))
2654 add_spec_dacs(spec
, nid
);
2658 } else if (mic_pin
== AUTO_PIN_MIC
) {
2659 mic_pin
= AUTO_PIN_FRONT_MIC
;
2667 /* add playback controls for Speaker and HP outputs */
2668 static int stac92xx_auto_create_hp_ctls(struct hda_codec
*codec
,
2669 struct auto_pin_cfg
*cfg
)
2671 struct sigmatel_spec
*spec
= codec
->spec
;
2673 int i
, old_num_dacs
, err
;
2675 old_num_dacs
= spec
->multiout
.num_dacs
;
2676 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
2677 unsigned int wid_caps
= get_wcaps(codec
, cfg
->hp_pins
[i
]);
2678 if (wid_caps
& AC_WCAP_UNSOL_CAP
)
2679 spec
->hp_detect
= 1;
2680 nid
= snd_hda_codec_read(codec
, cfg
->hp_pins
[i
], 0,
2681 AC_VERB_GET_CONNECT_LIST
, 0) & 0xff;
2682 if (check_in_dac_nids(spec
, nid
))
2686 add_spec_dacs(spec
, nid
);
2688 for (i
= 0; i
< cfg
->speaker_outs
; i
++) {
2689 nid
= snd_hda_codec_read(codec
, cfg
->speaker_pins
[i
], 0,
2690 AC_VERB_GET_CONNECT_LIST
, 0) & 0xff;
2691 if (check_in_dac_nids(spec
, nid
))
2695 add_spec_dacs(spec
, nid
);
2697 for (i
= 0; i
< cfg
->line_outs
; i
++) {
2698 nid
= snd_hda_codec_read(codec
, cfg
->line_out_pins
[i
], 0,
2699 AC_VERB_GET_CONNECT_LIST
, 0) & 0xff;
2700 if (check_in_dac_nids(spec
, nid
))
2704 add_spec_dacs(spec
, nid
);
2706 for (i
= old_num_dacs
; i
< spec
->multiout
.num_dacs
; i
++) {
2707 static const char *pfxs
[] = {
2708 "Speaker", "External Speaker", "Speaker2",
2710 err
= create_controls(spec
, pfxs
[i
- old_num_dacs
],
2711 spec
->multiout
.dac_nids
[i
], 3);
2715 if (spec
->multiout
.hp_nid
) {
2716 err
= create_controls(spec
, "Headphone",
2717 spec
->multiout
.hp_nid
, 3);
2725 /* labels for mono mux outputs */
2726 static const char *stac92xx_mono_labels
[4] = {
2727 "DAC0", "DAC1", "Mixer", "DAC2"
2730 /* create mono mux for mono out on capable codecs */
2731 static int stac92xx_auto_create_mono_output_ctls(struct hda_codec
*codec
)
2733 struct sigmatel_spec
*spec
= codec
->spec
;
2734 struct hda_input_mux
*mono_mux
= &spec
->private_mono_mux
;
2736 hda_nid_t con_lst
[ARRAY_SIZE(stac92xx_mono_labels
)];
2738 num_cons
= snd_hda_get_connections(codec
,
2741 HDA_MAX_NUM_INPUTS
);
2742 if (!num_cons
|| num_cons
> ARRAY_SIZE(stac92xx_mono_labels
))
2745 for (i
= 0; i
< num_cons
; i
++) {
2746 mono_mux
->items
[mono_mux
->num_items
].label
=
2747 stac92xx_mono_labels
[i
];
2748 mono_mux
->items
[mono_mux
->num_items
].index
= i
;
2749 mono_mux
->num_items
++;
2752 return stac92xx_add_control(spec
, STAC_CTL_WIDGET_MONO_MUX
,
2753 "Mono Mux", spec
->mono_nid
);
2756 /* create PC beep volume controls */
2757 static int stac92xx_auto_create_beep_ctls(struct hda_codec
*codec
,
2760 struct sigmatel_spec
*spec
= codec
->spec
;
2761 u32 caps
= query_amp_caps(codec
, nid
, HDA_OUTPUT
);
2764 /* check for mute support for the the amp */
2765 if ((caps
& AC_AMPCAP_MUTE
) >> AC_AMPCAP_MUTE_SHIFT
) {
2766 err
= stac92xx_add_control(spec
, STAC_CTL_WIDGET_MUTE
,
2767 "PC Beep Playback Switch",
2768 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, HDA_OUTPUT
));
2773 /* check to see if there is volume support for the amp */
2774 if ((caps
& AC_AMPCAP_NUM_STEPS
) >> AC_AMPCAP_NUM_STEPS_SHIFT
) {
2775 err
= stac92xx_add_control(spec
, STAC_CTL_WIDGET_VOL
,
2776 "PC Beep Playback Volume",
2777 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, HDA_OUTPUT
));
2784 /* labels for dmic mux inputs */
2785 static const char *stac92xx_dmic_labels
[5] = {
2786 "Analog Inputs", "Digital Mic 1", "Digital Mic 2",
2787 "Digital Mic 3", "Digital Mic 4"
2790 /* create playback/capture controls for input pins on dmic capable codecs */
2791 static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec
*codec
,
2792 const struct auto_pin_cfg
*cfg
)
2794 struct sigmatel_spec
*spec
= codec
->spec
;
2795 struct hda_input_mux
*dimux
= &spec
->private_dimux
;
2796 hda_nid_t con_lst
[HDA_MAX_NUM_INPUTS
];
2800 dimux
->items
[dimux
->num_items
].label
= stac92xx_dmic_labels
[0];
2801 dimux
->items
[dimux
->num_items
].index
= 0;
2804 for (i
= 0; i
< spec
->num_dmics
; i
++) {
2809 unsigned int def_conf
;
2811 def_conf
= snd_hda_codec_read(codec
,
2814 AC_VERB_GET_CONFIG_DEFAULT
,
2816 if (get_defcfg_connect(def_conf
) == AC_JACK_PORT_NONE
)
2819 nid
= spec
->dmic_nids
[i
];
2820 num_cons
= snd_hda_get_connections(codec
,
2823 HDA_MAX_NUM_INPUTS
);
2824 for (j
= 0; j
< num_cons
; j
++)
2825 if (con_lst
[j
] == nid
) {
2831 wcaps
= get_wcaps(codec
, nid
) &
2832 (AC_WCAP_OUT_AMP
| AC_WCAP_IN_AMP
);
2835 sprintf(name
, "%s Capture Volume",
2836 stac92xx_dmic_labels
[dimux
->num_items
]);
2838 err
= stac92xx_add_control(spec
,
2839 STAC_CTL_WIDGET_VOL
,
2841 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
2842 (wcaps
& AC_WCAP_OUT_AMP
) ?
2843 HDA_OUTPUT
: HDA_INPUT
));
2848 dimux
->items
[dimux
->num_items
].label
=
2849 stac92xx_dmic_labels
[dimux
->num_items
];
2850 dimux
->items
[dimux
->num_items
].index
= index
;
2857 /* create playback/capture controls for input pins */
2858 static int stac92xx_auto_create_analog_input_ctls(struct hda_codec
*codec
, const struct auto_pin_cfg
*cfg
)
2860 struct sigmatel_spec
*spec
= codec
->spec
;
2861 struct hda_input_mux
*imux
= &spec
->private_imux
;
2862 hda_nid_t con_lst
[HDA_MAX_NUM_INPUTS
];
2865 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
2868 if (!cfg
->input_pins
[i
])
2871 for (j
= 0; j
< spec
->num_muxes
; j
++) {
2873 num_cons
= snd_hda_get_connections(codec
,
2876 HDA_MAX_NUM_INPUTS
);
2877 for (k
= 0; k
< num_cons
; k
++)
2878 if (con_lst
[k
] == cfg
->input_pins
[i
]) {
2885 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
2886 imux
->items
[imux
->num_items
].index
= index
;
2890 if (imux
->num_items
) {
2892 * Set the current input for the muxes.
2893 * The STAC9221 has two input muxes with identical source
2894 * NID lists. Hopefully this won't get confused.
2896 for (i
= 0; i
< spec
->num_muxes
; i
++) {
2897 snd_hda_codec_write_cache(codec
, spec
->mux_nids
[i
], 0,
2898 AC_VERB_SET_CONNECT_SEL
,
2899 imux
->items
[0].index
);
2906 static void stac92xx_auto_init_multi_out(struct hda_codec
*codec
)
2908 struct sigmatel_spec
*spec
= codec
->spec
;
2911 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
2912 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
2913 stac92xx_auto_set_pinctl(codec
, nid
, AC_PINCTL_OUT_EN
);
2917 static void stac92xx_auto_init_hp_out(struct hda_codec
*codec
)
2919 struct sigmatel_spec
*spec
= codec
->spec
;
2922 for (i
= 0; i
< spec
->autocfg
.hp_outs
; i
++) {
2924 pin
= spec
->autocfg
.hp_pins
[i
];
2925 if (pin
) /* connect to front */
2926 stac92xx_auto_set_pinctl(codec
, pin
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
);
2928 for (i
= 0; i
< spec
->autocfg
.speaker_outs
; i
++) {
2930 pin
= spec
->autocfg
.speaker_pins
[i
];
2931 if (pin
) /* connect to front */
2932 stac92xx_auto_set_pinctl(codec
, pin
, AC_PINCTL_OUT_EN
);
2936 static int stac92xx_parse_auto_config(struct hda_codec
*codec
, hda_nid_t dig_out
, hda_nid_t dig_in
)
2938 struct sigmatel_spec
*spec
= codec
->spec
;
2940 int hp_speaker_swap
= 0;
2942 if ((err
= snd_hda_parse_pin_def_config(codec
,
2944 spec
->dmic_nids
)) < 0)
2946 if (! spec
->autocfg
.line_outs
)
2947 return 0; /* can't find valid pin config */
2949 /* If we have no real line-out pin and multiple hp-outs, HPs should
2950 * be set up as multi-channel outputs.
2952 if (spec
->autocfg
.line_out_type
== AUTO_PIN_SPEAKER_OUT
&&
2953 spec
->autocfg
.hp_outs
> 1) {
2954 /* Copy hp_outs to line_outs, backup line_outs in
2955 * speaker_outs so that the following routines can handle
2956 * HP pins as primary outputs.
2958 memcpy(spec
->autocfg
.speaker_pins
, spec
->autocfg
.line_out_pins
,
2959 sizeof(spec
->autocfg
.line_out_pins
));
2960 spec
->autocfg
.speaker_outs
= spec
->autocfg
.line_outs
;
2961 memcpy(spec
->autocfg
.line_out_pins
, spec
->autocfg
.hp_pins
,
2962 sizeof(spec
->autocfg
.hp_pins
));
2963 spec
->autocfg
.line_outs
= spec
->autocfg
.hp_outs
;
2964 hp_speaker_swap
= 1;
2966 if (spec
->autocfg
.mono_out_pin
) {
2967 int dir
= get_wcaps(codec
, spec
->autocfg
.mono_out_pin
) &
2968 (AC_WCAP_OUT_AMP
| AC_WCAP_IN_AMP
);
2969 u32 caps
= query_amp_caps(codec
,
2970 spec
->autocfg
.mono_out_pin
, dir
);
2971 hda_nid_t conn_list
[1];
2973 /* get the mixer node and then the mono mux if it exists */
2974 if (snd_hda_get_connections(codec
,
2975 spec
->autocfg
.mono_out_pin
, conn_list
, 1) &&
2976 snd_hda_get_connections(codec
, conn_list
[0],
2979 int wcaps
= get_wcaps(codec
, conn_list
[0]);
2980 int wid_type
= (wcaps
& AC_WCAP_TYPE
)
2981 >> AC_WCAP_TYPE_SHIFT
;
2982 /* LR swap check, some stac925x have a mux that
2983 * changes the DACs output path instead of the
2986 if (wid_type
== AC_WID_AUD_SEL
&&
2987 !(wcaps
& AC_WCAP_LR_SWAP
))
2988 spec
->mono_nid
= conn_list
[0];
2991 hda_nid_t nid
= spec
->autocfg
.mono_out_pin
;
2993 /* most mono outs have a least a mute/unmute switch */
2994 dir
= (dir
& AC_WCAP_OUT_AMP
) ? HDA_OUTPUT
: HDA_INPUT
;
2995 err
= stac92xx_add_control(spec
, STAC_CTL_WIDGET_MUTE
,
2996 "Mono Playback Switch",
2997 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, dir
));
3000 /* check for volume support for the amp */
3001 if ((caps
& AC_AMPCAP_NUM_STEPS
)
3002 >> AC_AMPCAP_NUM_STEPS_SHIFT
) {
3003 err
= stac92xx_add_control(spec
,
3004 STAC_CTL_WIDGET_VOL
,
3005 "Mono Playback Volume",
3006 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, dir
));
3012 stac92xx_auto_set_pinctl(codec
, spec
->autocfg
.mono_out_pin
,
3016 if ((err
= stac92xx_add_dyn_out_pins(codec
, &spec
->autocfg
)) < 0)
3018 if (spec
->multiout
.num_dacs
== 0)
3019 if ((err
= stac92xx_auto_fill_dac_nids(codec
, &spec
->autocfg
)) < 0)
3022 err
= stac92xx_auto_create_multi_out_ctls(codec
, &spec
->autocfg
);
3027 /* setup analog beep controls */
3028 if (spec
->anabeep_nid
> 0) {
3029 err
= stac92xx_auto_create_beep_ctls(codec
,
3035 /* setup digital beep controls and input device */
3036 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3037 if (spec
->digbeep_nid
> 0) {
3038 hda_nid_t nid
= spec
->digbeep_nid
;
3040 err
= stac92xx_auto_create_beep_ctls(codec
, nid
);
3043 err
= snd_hda_attach_beep_device(codec
, nid
);
3049 if (hp_speaker_swap
== 1) {
3050 /* Restore the hp_outs and line_outs */
3051 memcpy(spec
->autocfg
.hp_pins
, spec
->autocfg
.line_out_pins
,
3052 sizeof(spec
->autocfg
.line_out_pins
));
3053 spec
->autocfg
.hp_outs
= spec
->autocfg
.line_outs
;
3054 memcpy(spec
->autocfg
.line_out_pins
, spec
->autocfg
.speaker_pins
,
3055 sizeof(spec
->autocfg
.speaker_pins
));
3056 spec
->autocfg
.line_outs
= spec
->autocfg
.speaker_outs
;
3057 memset(spec
->autocfg
.speaker_pins
, 0,
3058 sizeof(spec
->autocfg
.speaker_pins
));
3059 spec
->autocfg
.speaker_outs
= 0;
3062 err
= stac92xx_auto_create_hp_ctls(codec
, &spec
->autocfg
);
3067 err
= stac92xx_auto_create_analog_input_ctls(codec
, &spec
->autocfg
);
3072 if (spec
->mono_nid
> 0) {
3073 err
= stac92xx_auto_create_mono_output_ctls(codec
);
3078 if (spec
->num_dmics
> 0)
3079 if ((err
= stac92xx_auto_create_dmic_input_ctls(codec
,
3080 &spec
->autocfg
)) < 0)
3083 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
3084 if (spec
->multiout
.max_channels
> 2)
3085 spec
->surr_switch
= 1;
3087 if (spec
->autocfg
.dig_out_pin
)
3088 spec
->multiout
.dig_out_nid
= dig_out
;
3089 if (dig_in
&& spec
->autocfg
.dig_in_pin
)
3090 spec
->dig_in_nid
= dig_in
;
3092 if (spec
->kctl_alloc
)
3093 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
3095 spec
->input_mux
= &spec
->private_imux
;
3096 if (!spec
->dinput_mux
)
3097 spec
->dinput_mux
= &spec
->private_dimux
;
3098 spec
->mono_mux
= &spec
->private_mono_mux
;
3103 /* add playback controls for HP output */
3104 static int stac9200_auto_create_hp_ctls(struct hda_codec
*codec
,
3105 struct auto_pin_cfg
*cfg
)
3107 struct sigmatel_spec
*spec
= codec
->spec
;
3108 hda_nid_t pin
= cfg
->hp_pins
[0];
3109 unsigned int wid_caps
;
3114 wid_caps
= get_wcaps(codec
, pin
);
3115 if (wid_caps
& AC_WCAP_UNSOL_CAP
)
3116 spec
->hp_detect
= 1;
3121 /* add playback controls for LFE output */
3122 static int stac9200_auto_create_lfe_ctls(struct hda_codec
*codec
,
3123 struct auto_pin_cfg
*cfg
)
3125 struct sigmatel_spec
*spec
= codec
->spec
;
3127 hda_nid_t lfe_pin
= 0x0;
3131 * search speaker outs and line outs for a mono speaker pin
3132 * with an amp. If one is found, add LFE controls
3135 for (i
= 0; i
< spec
->autocfg
.speaker_outs
&& lfe_pin
== 0x0; i
++) {
3136 hda_nid_t pin
= spec
->autocfg
.speaker_pins
[i
];
3137 unsigned int wcaps
= get_wcaps(codec
, pin
);
3138 wcaps
&= (AC_WCAP_STEREO
| AC_WCAP_OUT_AMP
);
3139 if (wcaps
== AC_WCAP_OUT_AMP
)
3140 /* found a mono speaker with an amp, must be lfe */
3144 /* if speaker_outs is 0, then speakers may be in line_outs */
3145 if (lfe_pin
== 0 && spec
->autocfg
.speaker_outs
== 0) {
3146 for (i
= 0; i
< spec
->autocfg
.line_outs
&& lfe_pin
== 0x0; i
++) {
3147 hda_nid_t pin
= spec
->autocfg
.line_out_pins
[i
];
3148 unsigned int defcfg
;
3149 defcfg
= snd_hda_codec_read(codec
, pin
, 0,
3150 AC_VERB_GET_CONFIG_DEFAULT
,
3152 if (get_defcfg_device(defcfg
) == AC_JACK_SPEAKER
) {
3153 unsigned int wcaps
= get_wcaps(codec
, pin
);
3154 wcaps
&= (AC_WCAP_STEREO
| AC_WCAP_OUT_AMP
);
3155 if (wcaps
== AC_WCAP_OUT_AMP
)
3156 /* found a mono speaker with an amp,
3164 err
= create_controls(spec
, "LFE", lfe_pin
, 1);
3172 static int stac9200_parse_auto_config(struct hda_codec
*codec
)
3174 struct sigmatel_spec
*spec
= codec
->spec
;
3177 if ((err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
, NULL
)) < 0)
3180 if ((err
= stac92xx_auto_create_analog_input_ctls(codec
, &spec
->autocfg
)) < 0)
3183 if ((err
= stac9200_auto_create_hp_ctls(codec
, &spec
->autocfg
)) < 0)
3186 if ((err
= stac9200_auto_create_lfe_ctls(codec
, &spec
->autocfg
)) < 0)
3189 if (spec
->autocfg
.dig_out_pin
)
3190 spec
->multiout
.dig_out_nid
= 0x05;
3191 if (spec
->autocfg
.dig_in_pin
)
3192 spec
->dig_in_nid
= 0x04;
3194 if (spec
->kctl_alloc
)
3195 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
3197 spec
->input_mux
= &spec
->private_imux
;
3198 spec
->dinput_mux
= &spec
->private_dimux
;
3204 * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
3205 * funky external mute control using GPIO pins.
3208 static void stac_gpio_set(struct hda_codec
*codec
, unsigned int mask
,
3209 unsigned int dir_mask
, unsigned int data
)
3211 unsigned int gpiostate
, gpiomask
, gpiodir
;
3213 gpiostate
= snd_hda_codec_read(codec
, codec
->afg
, 0,
3214 AC_VERB_GET_GPIO_DATA
, 0);
3215 gpiostate
= (gpiostate
& ~dir_mask
) | (data
& dir_mask
);
3217 gpiomask
= snd_hda_codec_read(codec
, codec
->afg
, 0,
3218 AC_VERB_GET_GPIO_MASK
, 0);
3221 gpiodir
= snd_hda_codec_read(codec
, codec
->afg
, 0,
3222 AC_VERB_GET_GPIO_DIRECTION
, 0);
3223 gpiodir
|= dir_mask
;
3225 /* Configure GPIOx as CMOS */
3226 snd_hda_codec_write(codec
, codec
->afg
, 0, 0x7e7, 0);
3228 snd_hda_codec_write(codec
, codec
->afg
, 0,
3229 AC_VERB_SET_GPIO_MASK
, gpiomask
);
3230 snd_hda_codec_read(codec
, codec
->afg
, 0,
3231 AC_VERB_SET_GPIO_DIRECTION
, gpiodir
); /* sync */
3235 snd_hda_codec_read(codec
, codec
->afg
, 0,
3236 AC_VERB_SET_GPIO_DATA
, gpiostate
); /* sync */
3239 static void enable_pin_detect(struct hda_codec
*codec
, hda_nid_t nid
,
3242 if (get_wcaps(codec
, nid
) & AC_WCAP_UNSOL_CAP
)
3243 snd_hda_codec_write_cache(codec
, nid
, 0,
3244 AC_VERB_SET_UNSOLICITED_ENABLE
,
3245 (AC_USRSP_EN
| event
));
3248 static int is_nid_hp_pin(struct auto_pin_cfg
*cfg
, hda_nid_t nid
)
3251 for (i
= 0; i
< cfg
->hp_outs
; i
++)
3252 if (cfg
->hp_pins
[i
] == nid
)
3253 return 1; /* nid is a HP-Out */
3255 return 0; /* nid is not a HP-Out */
3258 static void stac92xx_power_down(struct hda_codec
*codec
)
3260 struct sigmatel_spec
*spec
= codec
->spec
;
3262 /* power down inactive DACs */
3264 for (dac
= spec
->dac_list
; *dac
; dac
++)
3265 if (!is_in_dac_nids(spec
, *dac
) &&
3266 spec
->multiout
.hp_nid
!= *dac
)
3267 snd_hda_codec_write_cache(codec
, *dac
, 0,
3268 AC_VERB_SET_POWER_STATE
, AC_PWRST_D3
);
3271 static int stac92xx_init(struct hda_codec
*codec
)
3273 struct sigmatel_spec
*spec
= codec
->spec
;
3274 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
3277 snd_hda_sequence_write(codec
, spec
->init
);
3280 if (spec
->hp_detect
) {
3281 /* Enable unsolicited responses on the HP widget */
3282 for (i
= 0; i
< cfg
->hp_outs
; i
++)
3283 enable_pin_detect(codec
, cfg
->hp_pins
[i
],
3285 /* force to enable the first line-out; the others are set up
3288 stac92xx_auto_set_pinctl(codec
, spec
->autocfg
.line_out_pins
[0],
3290 stac92xx_auto_init_hp_out(codec
);
3291 /* fake event to set up pins */
3292 codec
->patch_ops
.unsol_event(codec
, STAC_HP_EVENT
<< 26);
3294 stac92xx_auto_init_multi_out(codec
);
3295 stac92xx_auto_init_hp_out(codec
);
3297 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
3298 hda_nid_t nid
= cfg
->input_pins
[i
];
3300 unsigned int pinctl
= AC_PINCTL_IN_EN
;
3301 if (i
== AUTO_PIN_MIC
|| i
== AUTO_PIN_FRONT_MIC
)
3302 pinctl
|= stac92xx_get_vref(codec
, nid
);
3303 stac92xx_auto_set_pinctl(codec
, nid
, pinctl
);
3306 for (i
= 0; i
< spec
->num_dmics
; i
++)
3307 stac92xx_auto_set_pinctl(codec
, spec
->dmic_nids
[i
],
3309 for (i
= 0; i
< spec
->num_pwrs
; i
++) {
3310 int event
= is_nid_hp_pin(cfg
, spec
->pwr_nids
[i
])
3311 ? STAC_HP_EVENT
: STAC_PWR_EVENT
;
3312 int pinctl
= snd_hda_codec_read(codec
, spec
->pwr_nids
[i
],
3313 0, AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
3314 int def_conf
= snd_hda_codec_read(codec
, spec
->pwr_nids
[i
],
3315 0, AC_VERB_GET_CONFIG_DEFAULT
, 0);
3316 def_conf
= get_defcfg_connect(def_conf
);
3317 /* outputs are only ports capable of power management
3318 * any attempts on powering down a input port cause the
3319 * referenced VREF to act quirky.
3321 if (pinctl
& AC_PINCTL_IN_EN
)
3323 /* skip any ports that don't have jacks since presence
3324 * detection is useless */
3325 if (def_conf
&& def_conf
!= AC_JACK_PORT_FIXED
)
3327 enable_pin_detect(codec
, spec
->pwr_nids
[i
], event
| i
);
3328 codec
->patch_ops
.unsol_event(codec
, (event
| i
) << 26);
3331 stac92xx_power_down(codec
);
3332 if (cfg
->dig_out_pin
)
3333 stac92xx_auto_set_pinctl(codec
, cfg
->dig_out_pin
,
3335 if (cfg
->dig_in_pin
)
3336 stac92xx_auto_set_pinctl(codec
, cfg
->dig_in_pin
,
3339 stac_gpio_set(codec
, spec
->gpio_mask
,
3340 spec
->gpio_dir
, spec
->gpio_data
);
3345 static void stac92xx_free(struct hda_codec
*codec
)
3347 struct sigmatel_spec
*spec
= codec
->spec
;
3353 if (spec
->kctl_alloc
) {
3354 for (i
= 0; i
< spec
->num_kctl_used
; i
++)
3355 kfree(spec
->kctl_alloc
[i
].name
);
3356 kfree(spec
->kctl_alloc
);
3359 if (spec
->bios_pin_configs
)
3360 kfree(spec
->bios_pin_configs
);
3363 snd_hda_detach_beep_device(codec
);
3366 static void stac92xx_set_pinctl(struct hda_codec
*codec
, hda_nid_t nid
,
3369 unsigned int pin_ctl
= snd_hda_codec_read(codec
, nid
,
3370 0, AC_VERB_GET_PIN_WIDGET_CONTROL
, 0x00);
3372 if (pin_ctl
& AC_PINCTL_IN_EN
) {
3374 * we need to check the current set-up direction of
3375 * shared input pins since they can be switched via
3376 * "xxx as Output" mixer switch
3378 struct sigmatel_spec
*spec
= codec
->spec
;
3379 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
3380 if ((nid
== cfg
->input_pins
[AUTO_PIN_LINE
] &&
3381 spec
->line_switch
) ||
3382 (nid
== cfg
->input_pins
[AUTO_PIN_MIC
] &&
3387 /* if setting pin direction bits, clear the current
3388 direction bits first */
3389 if (flag
& (AC_PINCTL_IN_EN
| AC_PINCTL_OUT_EN
))
3390 pin_ctl
&= ~(AC_PINCTL_IN_EN
| AC_PINCTL_OUT_EN
);
3392 snd_hda_codec_write_cache(codec
, nid
, 0,
3393 AC_VERB_SET_PIN_WIDGET_CONTROL
,
3397 static void stac92xx_reset_pinctl(struct hda_codec
*codec
, hda_nid_t nid
,
3400 unsigned int pin_ctl
= snd_hda_codec_read(codec
, nid
,
3401 0, AC_VERB_GET_PIN_WIDGET_CONTROL
, 0x00);
3402 snd_hda_codec_write_cache(codec
, nid
, 0,
3403 AC_VERB_SET_PIN_WIDGET_CONTROL
,
3407 static int get_hp_pin_presence(struct hda_codec
*codec
, hda_nid_t nid
)
3411 if (snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_PIN_SENSE
, 0x00)
3413 unsigned int pinctl
;
3414 pinctl
= snd_hda_codec_read(codec
, nid
, 0,
3415 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
3416 if (pinctl
& AC_PINCTL_IN_EN
)
3417 return 0; /* mic- or line-input */
3419 return 1; /* HP-output */
3424 static void stac92xx_hp_detect(struct hda_codec
*codec
, unsigned int res
)
3426 struct sigmatel_spec
*spec
= codec
->spec
;
3427 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
3428 int nid
= cfg
->hp_pins
[cfg
->hp_outs
- 1];
3432 if (spec
->gpio_mute
)
3433 presence
= !(snd_hda_codec_read(codec
, codec
->afg
, 0,
3434 AC_VERB_GET_GPIO_DATA
, 0) & spec
->gpio_mute
);
3436 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
3439 if (spec
->hp_switch
&& cfg
->hp_pins
[i
] == nid
)
3441 presence
= get_hp_pin_presence(codec
, cfg
->hp_pins
[i
]);
3445 /* disable lineouts, enable hp */
3446 if (spec
->hp_switch
)
3447 stac92xx_reset_pinctl(codec
, nid
, AC_PINCTL_OUT_EN
);
3448 for (i
= 0; i
< cfg
->line_outs
; i
++)
3449 stac92xx_reset_pinctl(codec
, cfg
->line_out_pins
[i
],
3451 for (i
= 0; i
< cfg
->speaker_outs
; i
++)
3452 stac92xx_reset_pinctl(codec
, cfg
->speaker_pins
[i
],
3454 if (spec
->eapd_mask
)
3455 stac_gpio_set(codec
, spec
->gpio_mask
,
3456 spec
->gpio_dir
, spec
->gpio_data
&
3459 /* enable lineouts, disable hp */
3460 if (spec
->hp_switch
)
3461 stac92xx_set_pinctl(codec
, nid
, AC_PINCTL_OUT_EN
);
3462 for (i
= 0; i
< cfg
->line_outs
; i
++)
3463 stac92xx_set_pinctl(codec
, cfg
->line_out_pins
[i
],
3465 for (i
= 0; i
< cfg
->speaker_outs
; i
++)
3466 stac92xx_set_pinctl(codec
, cfg
->speaker_pins
[i
],
3468 if (spec
->eapd_mask
)
3469 stac_gpio_set(codec
, spec
->gpio_mask
,
3470 spec
->gpio_dir
, spec
->gpio_data
|
3473 if (!spec
->hp_switch
&& cfg
->hp_outs
> 1 && presence
)
3474 stac92xx_set_pinctl(codec
, nid
, AC_PINCTL_OUT_EN
);
3477 static void stac92xx_pin_sense(struct hda_codec
*codec
, int idx
)
3479 struct sigmatel_spec
*spec
= codec
->spec
;
3480 hda_nid_t nid
= spec
->pwr_nids
[idx
];
3482 val
= snd_hda_codec_read(codec
, codec
->afg
, 0, 0x0fec, 0x0)
3484 presence
= get_hp_pin_presence(codec
, nid
);
3486 /* several codecs have two power down bits */
3487 if (spec
->pwr_mapping
)
3488 idx
= spec
->pwr_mapping
[idx
];
3497 /* power down unused output ports */
3498 snd_hda_codec_write(codec
, codec
->afg
, 0, 0x7ec, val
);
3501 static void stac92xx_unsol_event(struct hda_codec
*codec
, unsigned int res
)
3503 struct sigmatel_spec
*spec
= codec
->spec
;
3504 int idx
= res
>> 26 & 0x0f;
3506 switch ((res
>> 26) & 0x30) {
3508 stac92xx_hp_detect(codec
, res
);
3510 case STAC_PWR_EVENT
:
3511 if (spec
->num_pwrs
> 0)
3512 stac92xx_pin_sense(codec
, idx
);
3516 #ifdef SND_HDA_NEEDS_RESUME
3517 static int stac92xx_resume(struct hda_codec
*codec
)
3519 struct sigmatel_spec
*spec
= codec
->spec
;
3521 stac92xx_set_config_regs(codec
);
3522 snd_hda_sequence_write(codec
, spec
->init
);
3523 stac_gpio_set(codec
, spec
->gpio_mask
,
3524 spec
->gpio_dir
, spec
->gpio_data
);
3525 snd_hda_codec_resume_amp(codec
);
3526 snd_hda_codec_resume_cache(codec
);
3527 /* power down inactive DACs */
3529 stac92xx_power_down(codec
);
3530 /* invoke unsolicited event to reset the HP state */
3531 if (spec
->hp_detect
)
3532 codec
->patch_ops
.unsol_event(codec
, STAC_HP_EVENT
<< 26);
3537 static struct hda_codec_ops stac92xx_patch_ops
= {
3538 .build_controls
= stac92xx_build_controls
,
3539 .build_pcms
= stac92xx_build_pcms
,
3540 .init
= stac92xx_init
,
3541 .free
= stac92xx_free
,
3542 .unsol_event
= stac92xx_unsol_event
,
3543 #ifdef SND_HDA_NEEDS_RESUME
3544 .resume
= stac92xx_resume
,
3548 static int patch_stac9200(struct hda_codec
*codec
)
3550 struct sigmatel_spec
*spec
;
3553 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
3558 spec
->num_pins
= ARRAY_SIZE(stac9200_pin_nids
);
3559 spec
->pin_nids
= stac9200_pin_nids
;
3560 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_9200_MODELS
,
3563 if (spec
->board_config
< 0) {
3564 snd_printdd(KERN_INFO
"hda_codec: Unknown model for STAC9200, using BIOS defaults\n");
3565 err
= stac92xx_save_bios_config_regs(codec
);
3567 stac92xx_free(codec
);
3570 spec
->pin_configs
= spec
->bios_pin_configs
;
3572 spec
->pin_configs
= stac9200_brd_tbl
[spec
->board_config
];
3573 stac92xx_set_config_regs(codec
);
3576 spec
->multiout
.max_channels
= 2;
3577 spec
->multiout
.num_dacs
= 1;
3578 spec
->multiout
.dac_nids
= stac9200_dac_nids
;
3579 spec
->adc_nids
= stac9200_adc_nids
;
3580 spec
->mux_nids
= stac9200_mux_nids
;
3581 spec
->num_muxes
= 1;
3582 spec
->num_dmics
= 0;
3586 if (spec
->board_config
== STAC_9200_GATEWAY
||
3587 spec
->board_config
== STAC_9200_OQO
)
3588 spec
->init
= stac9200_eapd_init
;
3590 spec
->init
= stac9200_core_init
;
3591 spec
->mixer
= stac9200_mixer
;
3593 if (spec
->board_config
== STAC_9200_PANASONIC
) {
3594 spec
->gpio_mask
= spec
->gpio_dir
= 0x09;
3595 spec
->gpio_data
= 0x00;
3598 err
= stac9200_parse_auto_config(codec
);
3600 stac92xx_free(codec
);
3604 codec
->patch_ops
= stac92xx_patch_ops
;
3609 static int patch_stac925x(struct hda_codec
*codec
)
3611 struct sigmatel_spec
*spec
;
3614 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
3619 spec
->num_pins
= ARRAY_SIZE(stac925x_pin_nids
);
3620 spec
->pin_nids
= stac925x_pin_nids
;
3621 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_925x_MODELS
,
3625 if (spec
->board_config
< 0) {
3626 snd_printdd(KERN_INFO
"hda_codec: Unknown model for STAC925x,"
3627 "using BIOS defaults\n");
3628 err
= stac92xx_save_bios_config_regs(codec
);
3630 stac92xx_free(codec
);
3633 spec
->pin_configs
= spec
->bios_pin_configs
;
3634 } else if (stac925x_brd_tbl
[spec
->board_config
] != NULL
){
3635 spec
->pin_configs
= stac925x_brd_tbl
[spec
->board_config
];
3636 stac92xx_set_config_regs(codec
);
3639 spec
->multiout
.max_channels
= 2;
3640 spec
->multiout
.num_dacs
= 1;
3641 spec
->multiout
.dac_nids
= stac925x_dac_nids
;
3642 spec
->adc_nids
= stac925x_adc_nids
;
3643 spec
->mux_nids
= stac925x_mux_nids
;
3644 spec
->num_muxes
= 1;
3647 switch (codec
->vendor_id
) {
3648 case 0x83847632: /* STAC9202 */
3649 case 0x83847633: /* STAC9202D */
3650 case 0x83847636: /* STAC9251 */
3651 case 0x83847637: /* STAC9251D */
3652 spec
->num_dmics
= STAC925X_NUM_DMICS
;
3653 spec
->dmic_nids
= stac925x_dmic_nids
;
3654 spec
->num_dmuxes
= ARRAY_SIZE(stac925x_dmux_nids
);
3655 spec
->dmux_nids
= stac925x_dmux_nids
;
3658 spec
->num_dmics
= 0;
3662 spec
->init
= stac925x_core_init
;
3663 spec
->mixer
= stac925x_mixer
;
3665 err
= stac92xx_parse_auto_config(codec
, 0x8, 0x7);
3667 if (spec
->board_config
< 0) {
3668 printk(KERN_WARNING
"hda_codec: No auto-config is "
3669 "available, default to model=ref\n");
3670 spec
->board_config
= STAC_925x_REF
;
3676 stac92xx_free(codec
);
3680 codec
->patch_ops
= stac92xx_patch_ops
;
3685 static struct hda_input_mux stac92hd73xx_dmux
= {
3688 { "Analog Inputs", 0x0b },
3690 { "Digital Mic 1", 0x09 },
3691 { "Digital Mic 2", 0x0a },
3695 static int patch_stac92hd73xx(struct hda_codec
*codec
)
3697 struct sigmatel_spec
*spec
;
3698 hda_nid_t conn
[STAC92HD73_DAC_COUNT
+ 2];
3701 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
3706 spec
->num_pins
= ARRAY_SIZE(stac92hd73xx_pin_nids
);
3707 spec
->pin_nids
= stac92hd73xx_pin_nids
;
3708 spec
->board_config
= snd_hda_check_board_config(codec
,
3709 STAC_92HD73XX_MODELS
,
3710 stac92hd73xx_models
,
3711 stac92hd73xx_cfg_tbl
);
3713 if (spec
->board_config
< 0) {
3714 snd_printdd(KERN_INFO
"hda_codec: Unknown model for"
3715 " STAC92HD73XX, using BIOS defaults\n");
3716 err
= stac92xx_save_bios_config_regs(codec
);
3718 stac92xx_free(codec
);
3721 spec
->pin_configs
= spec
->bios_pin_configs
;
3723 spec
->pin_configs
= stac92hd73xx_brd_tbl
[spec
->board_config
];
3724 stac92xx_set_config_regs(codec
);
3727 spec
->multiout
.num_dacs
= snd_hda_get_connections(codec
, 0x0a,
3728 conn
, STAC92HD73_DAC_COUNT
+ 2) - 1;
3730 if (spec
->multiout
.num_dacs
< 0) {
3731 printk(KERN_WARNING
"hda_codec: Could not determine "
3732 "number of channels defaulting to DAC count\n");
3733 spec
->multiout
.num_dacs
= STAC92HD73_DAC_COUNT
;
3736 switch (spec
->multiout
.num_dacs
) {
3737 case 0x3: /* 6 Channel */
3738 spec
->multiout
.hp_nid
= 0x17;
3739 spec
->mixer
= stac92hd73xx_6ch_mixer
;
3740 spec
->init
= stac92hd73xx_6ch_core_init
;
3742 case 0x4: /* 8 Channel */
3743 spec
->multiout
.hp_nid
= 0x18;
3744 spec
->mixer
= stac92hd73xx_8ch_mixer
;
3745 spec
->init
= stac92hd73xx_8ch_core_init
;
3747 case 0x5: /* 10 Channel */
3748 spec
->multiout
.hp_nid
= 0x19;
3749 spec
->mixer
= stac92hd73xx_10ch_mixer
;
3750 spec
->init
= stac92hd73xx_10ch_core_init
;
3753 spec
->multiout
.dac_nids
= stac92hd73xx_dac_nids
;
3754 spec
->aloopback_mask
= 0x01;
3755 spec
->aloopback_shift
= 8;
3757 spec
->digbeep_nid
= 0x1c;
3758 spec
->mux_nids
= stac92hd73xx_mux_nids
;
3759 spec
->adc_nids
= stac92hd73xx_adc_nids
;
3760 spec
->dmic_nids
= stac92hd73xx_dmic_nids
;
3761 spec
->dmux_nids
= stac92hd73xx_dmux_nids
;
3763 spec
->num_muxes
= ARRAY_SIZE(stac92hd73xx_mux_nids
);
3764 spec
->num_adcs
= ARRAY_SIZE(stac92hd73xx_adc_nids
);
3765 spec
->num_dmuxes
= ARRAY_SIZE(stac92hd73xx_dmux_nids
);
3766 spec
->dinput_mux
= &stac92hd73xx_dmux
;
3767 /* GPIO0 High = Enable EAPD */
3768 spec
->eapd_mask
= spec
->gpio_mask
= spec
->gpio_dir
= 0x1;
3769 spec
->gpio_data
= 0x01;
3771 switch (spec
->board_config
) {
3773 spec
->init
= dell_eq_core_init
;
3774 switch (codec
->subsystem_id
) {
3775 case 0x1028025e: /* Analog Mics */
3777 stac92xx_set_config_reg(codec
, 0x0b, 0x90A70170);
3778 spec
->num_dmics
= 0;
3780 case 0x10280271: /* Digital Mics */
3782 spec
->init
= dell_m6_core_init
;
3786 stac92xx_set_config_reg(codec
, 0x13, 0x90A60160);
3787 spec
->num_dmics
= 1;
3789 case 0x10280256: /* Both */
3791 stac92xx_set_config_reg(codec
, 0x0b, 0x90A70170);
3792 stac92xx_set_config_reg(codec
, 0x13, 0x90A60160);
3793 spec
->num_dmics
= 1;
3798 spec
->num_dmics
= STAC92HD73XX_NUM_DMICS
;
3801 spec
->num_pwrs
= ARRAY_SIZE(stac92hd73xx_pwr_nids
);
3802 spec
->pwr_nids
= stac92hd73xx_pwr_nids
;
3804 err
= stac92xx_parse_auto_config(codec
, 0x22, 0x24);
3807 if (spec
->board_config
< 0) {
3808 printk(KERN_WARNING
"hda_codec: No auto-config is "
3809 "available, default to model=ref\n");
3810 spec
->board_config
= STAC_92HD73XX_REF
;
3817 stac92xx_free(codec
);
3821 codec
->patch_ops
= stac92xx_patch_ops
;
3826 static struct hda_input_mux stac92hd83xxx_dmux
= {
3829 { "Analog Inputs", 0x03 },
3830 { "Digital Mic 1", 0x04 },
3831 { "Digital Mic 2", 0x05 },
3835 static int patch_stac92hd83xxx(struct hda_codec
*codec
)
3837 struct sigmatel_spec
*spec
;
3840 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
3845 spec
->mono_nid
= 0x19;
3846 spec
->digbeep_nid
= 0x21;
3847 spec
->dmic_nids
= stac92hd83xxx_dmic_nids
;
3848 spec
->dmux_nids
= stac92hd83xxx_dmux_nids
;
3849 spec
->adc_nids
= stac92hd83xxx_adc_nids
;
3850 spec
->pwr_nids
= stac92hd83xxx_pwr_nids
;
3851 spec
->pwr_mapping
= stac92hd83xxx_pwr_mapping
;
3852 spec
->num_pwrs
= ARRAY_SIZE(stac92hd83xxx_pwr_nids
);
3853 spec
->multiout
.dac_nids
= stac92hd83xxx_dac_nids
;
3855 spec
->init
= stac92hd83xxx_core_init
;
3856 switch (codec
->vendor_id
) {
3858 spec
->multiout
.num_dacs
= STAC92HD81_DAC_COUNT
;
3862 spec
->init
++; /* switch to config #2 */
3863 spec
->multiout
.num_dacs
= STAC92HD83_DAC_COUNT
;
3866 spec
->mixer
= stac92hd83xxx_mixer
;
3867 spec
->num_pins
= ARRAY_SIZE(stac92hd83xxx_pin_nids
);
3868 spec
->num_dmuxes
= ARRAY_SIZE(stac92hd83xxx_dmux_nids
);
3869 spec
->num_adcs
= ARRAY_SIZE(stac92hd83xxx_adc_nids
);
3870 spec
->num_dmics
= STAC92HD83XXX_NUM_DMICS
;
3871 spec
->dinput_mux
= &stac92hd83xxx_dmux
;
3872 spec
->pin_nids
= stac92hd83xxx_pin_nids
;
3873 spec
->board_config
= snd_hda_check_board_config(codec
,
3874 STAC_92HD83XXX_MODELS
,
3875 stac92hd83xxx_models
,
3876 stac92hd83xxx_cfg_tbl
);
3878 if (spec
->board_config
< 0) {
3879 snd_printdd(KERN_INFO
"hda_codec: Unknown model for"
3880 " STAC92HD83XXX, using BIOS defaults\n");
3881 err
= stac92xx_save_bios_config_regs(codec
);
3883 stac92xx_free(codec
);
3886 spec
->pin_configs
= spec
->bios_pin_configs
;
3888 spec
->pin_configs
= stac92hd83xxx_brd_tbl
[spec
->board_config
];
3889 stac92xx_set_config_regs(codec
);
3892 err
= stac92xx_parse_auto_config(codec
, 0x1d, 0);
3894 if (spec
->board_config
< 0) {
3895 printk(KERN_WARNING
"hda_codec: No auto-config is "
3896 "available, default to model=ref\n");
3897 spec
->board_config
= STAC_92HD83XXX_REF
;
3904 stac92xx_free(codec
);
3908 codec
->patch_ops
= stac92xx_patch_ops
;
3914 static int patch_stac92hd71bxx(struct hda_codec
*codec
)
3916 struct sigmatel_spec
*spec
;
3919 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
3924 spec
->num_pins
= ARRAY_SIZE(stac92hd71bxx_pin_nids
);
3925 spec
->num_pwrs
= ARRAY_SIZE(stac92hd71bxx_pwr_nids
);
3926 spec
->pin_nids
= stac92hd71bxx_pin_nids
;
3927 spec
->board_config
= snd_hda_check_board_config(codec
,
3928 STAC_92HD71BXX_MODELS
,
3929 stac92hd71bxx_models
,
3930 stac92hd71bxx_cfg_tbl
);
3932 if (spec
->board_config
< 0) {
3933 snd_printdd(KERN_INFO
"hda_codec: Unknown model for"
3934 " STAC92HD71BXX, using BIOS defaults\n");
3935 err
= stac92xx_save_bios_config_regs(codec
);
3937 stac92xx_free(codec
);
3940 spec
->pin_configs
= spec
->bios_pin_configs
;
3942 spec
->pin_configs
= stac92hd71bxx_brd_tbl
[spec
->board_config
];
3943 stac92xx_set_config_regs(codec
);
3946 switch (codec
->vendor_id
) {
3947 case 0x111d76b6: /* 4 Port without Analog Mixer */
3949 case 0x111d76b4: /* 6 Port without Analog Mixer */
3951 spec
->mixer
= stac92hd71bxx_mixer
;
3952 spec
->init
= stac92hd71bxx_core_init
;
3954 case 0x111d7608: /* 5 Port with Analog Mixer */
3955 /* no output amps */
3957 spec
->mixer
= stac92hd71bxx_analog_mixer
;
3960 spec
->init
= &stac92hd71bxx_analog_core_init
[HD_DISABLE_PORTF
];
3961 stac92xx_set_config_reg(codec
, 0xf, 0x40f000f0);
3963 case 0x111d7603: /* 6 Port with Analog Mixer */
3964 /* no output amps */
3968 spec
->mixer
= stac92hd71bxx_analog_mixer
;
3969 spec
->init
= stac92hd71bxx_analog_core_init
;
3972 spec
->aloopback_mask
= 0x20;
3973 spec
->aloopback_shift
= 0;
3975 /* GPIO0 High = EAPD */
3976 spec
->gpio_mask
= 0x01;
3977 spec
->gpio_dir
= 0x01;
3978 spec
->gpio_data
= 0x01;
3980 spec
->digbeep_nid
= 0x26;
3981 spec
->mux_nids
= stac92hd71bxx_mux_nids
;
3982 spec
->adc_nids
= stac92hd71bxx_adc_nids
;
3983 spec
->dmic_nids
= stac92hd71bxx_dmic_nids
;
3984 spec
->dmux_nids
= stac92hd71bxx_dmux_nids
;
3985 spec
->pwr_nids
= stac92hd71bxx_pwr_nids
;
3987 spec
->num_muxes
= ARRAY_SIZE(stac92hd71bxx_mux_nids
);
3988 spec
->num_adcs
= ARRAY_SIZE(stac92hd71bxx_adc_nids
);
3989 spec
->num_dmics
= STAC92HD71BXX_NUM_DMICS
;
3990 spec
->num_dmuxes
= ARRAY_SIZE(stac92hd71bxx_dmux_nids
);
3992 spec
->multiout
.num_dacs
= 1;
3993 spec
->multiout
.hp_nid
= 0x11;
3994 spec
->multiout
.dac_nids
= stac92hd71bxx_dac_nids
;
3996 err
= stac92xx_parse_auto_config(codec
, 0x21, 0x23);
3998 if (spec
->board_config
< 0) {
3999 printk(KERN_WARNING
"hda_codec: No auto-config is "
4000 "available, default to model=ref\n");
4001 spec
->board_config
= STAC_92HD71BXX_REF
;
4008 stac92xx_free(codec
);
4012 codec
->patch_ops
= stac92xx_patch_ops
;
4017 static int patch_stac922x(struct hda_codec
*codec
)
4019 struct sigmatel_spec
*spec
;
4022 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
4027 spec
->num_pins
= ARRAY_SIZE(stac922x_pin_nids
);
4028 spec
->pin_nids
= stac922x_pin_nids
;
4029 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_922X_MODELS
,
4032 if (spec
->board_config
== STAC_INTEL_MAC_AUTO
) {
4033 spec
->gpio_mask
= spec
->gpio_dir
= 0x03;
4034 spec
->gpio_data
= 0x03;
4035 /* Intel Macs have all same PCI SSID, so we need to check
4036 * codec SSID to distinguish the exact models
4038 printk(KERN_INFO
"hda_codec: STAC922x, Apple subsys_id=%x\n", codec
->subsystem_id
);
4039 switch (codec
->subsystem_id
) {
4042 spec
->board_config
= STAC_INTEL_MAC_V1
;
4046 spec
->board_config
= STAC_INTEL_MAC_V2
;
4054 spec
->board_config
= STAC_INTEL_MAC_V3
;
4058 spec
->board_config
= STAC_INTEL_MAC_V4
;
4062 spec
->board_config
= STAC_INTEL_MAC_V5
;
4065 spec
->board_config
= STAC_INTEL_MAC_V3
;
4071 if (spec
->board_config
< 0) {
4072 snd_printdd(KERN_INFO
"hda_codec: Unknown model for STAC922x, "
4073 "using BIOS defaults\n");
4074 err
= stac92xx_save_bios_config_regs(codec
);
4076 stac92xx_free(codec
);
4079 spec
->pin_configs
= spec
->bios_pin_configs
;
4080 } else if (stac922x_brd_tbl
[spec
->board_config
] != NULL
) {
4081 spec
->pin_configs
= stac922x_brd_tbl
[spec
->board_config
];
4082 stac92xx_set_config_regs(codec
);
4085 spec
->adc_nids
= stac922x_adc_nids
;
4086 spec
->mux_nids
= stac922x_mux_nids
;
4087 spec
->num_muxes
= ARRAY_SIZE(stac922x_mux_nids
);
4088 spec
->num_adcs
= ARRAY_SIZE(stac922x_adc_nids
);
4089 spec
->num_dmics
= 0;
4092 spec
->init
= stac922x_core_init
;
4093 spec
->mixer
= stac922x_mixer
;
4095 spec
->multiout
.dac_nids
= spec
->dac_nids
;
4097 err
= stac92xx_parse_auto_config(codec
, 0x08, 0x09);
4099 if (spec
->board_config
< 0) {
4100 printk(KERN_WARNING
"hda_codec: No auto-config is "
4101 "available, default to model=ref\n");
4102 spec
->board_config
= STAC_D945_REF
;
4108 stac92xx_free(codec
);
4112 codec
->patch_ops
= stac92xx_patch_ops
;
4114 /* Fix Mux capture level; max to 2 */
4115 snd_hda_override_amp_caps(codec
, 0x12, HDA_OUTPUT
,
4116 (0 << AC_AMPCAP_OFFSET_SHIFT
) |
4117 (2 << AC_AMPCAP_NUM_STEPS_SHIFT
) |
4118 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
4119 (0 << AC_AMPCAP_MUTE_SHIFT
));
4124 static int patch_stac927x(struct hda_codec
*codec
)
4126 struct sigmatel_spec
*spec
;
4129 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
4134 spec
->num_pins
= ARRAY_SIZE(stac927x_pin_nids
);
4135 spec
->pin_nids
= stac927x_pin_nids
;
4136 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_927X_MODELS
,
4140 if (spec
->board_config
< 0 || !stac927x_brd_tbl
[spec
->board_config
]) {
4141 if (spec
->board_config
< 0)
4142 snd_printdd(KERN_INFO
"hda_codec: Unknown model for"
4143 "STAC927x, using BIOS defaults\n");
4144 err
= stac92xx_save_bios_config_regs(codec
);
4146 stac92xx_free(codec
);
4149 spec
->pin_configs
= spec
->bios_pin_configs
;
4151 spec
->pin_configs
= stac927x_brd_tbl
[spec
->board_config
];
4152 stac92xx_set_config_regs(codec
);
4155 spec
->digbeep_nid
= 0x23;
4156 spec
->adc_nids
= stac927x_adc_nids
;
4157 spec
->num_adcs
= ARRAY_SIZE(stac927x_adc_nids
);
4158 spec
->mux_nids
= stac927x_mux_nids
;
4159 spec
->num_muxes
= ARRAY_SIZE(stac927x_mux_nids
);
4160 spec
->dac_list
= stac927x_dac_nids
;
4161 spec
->multiout
.dac_nids
= spec
->dac_nids
;
4163 switch (spec
->board_config
) {
4166 /* GPIO0 High = Enable EAPD */
4167 spec
->eapd_mask
= spec
->gpio_mask
= spec
->gpio_dir
= 0x01;
4168 spec
->gpio_data
= 0x01;
4169 spec
->num_dmics
= 0;
4171 spec
->init
= d965_core_init
;
4172 spec
->mixer
= stac927x_mixer
;
4174 case STAC_DELL_BIOS
:
4175 switch (codec
->subsystem_id
) {
4178 /* correct the device field to SPDIF out */
4179 stac92xx_set_config_reg(codec
, 0x21, 0x01442070);
4182 /* configure the analog microphone on some laptops */
4183 stac92xx_set_config_reg(codec
, 0x0c, 0x90a79130);
4184 /* correct the front output jack as a hp out */
4185 stac92xx_set_config_reg(codec
, 0x0f, 0x0227011f);
4186 /* correct the front input jack as a mic */
4187 stac92xx_set_config_reg(codec
, 0x0e, 0x02a79130);
4190 /* GPIO2 High = Enable EAPD */
4191 spec
->eapd_mask
= spec
->gpio_mask
= spec
->gpio_dir
= 0x04;
4192 spec
->gpio_data
= 0x04;
4193 spec
->dmic_nids
= stac927x_dmic_nids
;
4194 spec
->num_dmics
= STAC927X_NUM_DMICS
;
4196 spec
->init
= d965_core_init
;
4197 spec
->mixer
= stac927x_mixer
;
4198 spec
->dmux_nids
= stac927x_dmux_nids
;
4199 spec
->num_dmuxes
= ARRAY_SIZE(stac927x_dmux_nids
);
4202 /* GPIO0 High = Enable EAPD */
4203 spec
->eapd_mask
= spec
->gpio_mask
= spec
->gpio_dir
= 0x1;
4204 spec
->gpio_data
= 0x01;
4205 spec
->num_dmics
= 0;
4207 spec
->init
= stac927x_core_init
;
4208 spec
->mixer
= stac927x_mixer
;
4212 spec
->aloopback_mask
= 0x40;
4213 spec
->aloopback_shift
= 0;
4215 err
= stac92xx_parse_auto_config(codec
, 0x1e, 0x20);
4217 if (spec
->board_config
< 0) {
4218 printk(KERN_WARNING
"hda_codec: No auto-config is "
4219 "available, default to model=ref\n");
4220 spec
->board_config
= STAC_D965_REF
;
4226 stac92xx_free(codec
);
4230 codec
->patch_ops
= stac92xx_patch_ops
;
4234 * The STAC927x seem to require fairly long delays for certain
4235 * command sequences. With too short delays (even if the answer
4236 * is set to RIRB properly), it results in the silence output
4237 * on some hardwares like Dell.
4239 * The below flag enables the longer delay (see get_response
4242 codec
->bus
->needs_damn_long_delay
= 1;
4247 static int patch_stac9205(struct hda_codec
*codec
)
4249 struct sigmatel_spec
*spec
;
4252 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
4257 spec
->num_pins
= ARRAY_SIZE(stac9205_pin_nids
);
4258 spec
->pin_nids
= stac9205_pin_nids
;
4259 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_9205_MODELS
,
4263 if (spec
->board_config
< 0) {
4264 snd_printdd(KERN_INFO
"hda_codec: Unknown model for STAC9205, using BIOS defaults\n");
4265 err
= stac92xx_save_bios_config_regs(codec
);
4267 stac92xx_free(codec
);
4270 spec
->pin_configs
= spec
->bios_pin_configs
;
4272 spec
->pin_configs
= stac9205_brd_tbl
[spec
->board_config
];
4273 stac92xx_set_config_regs(codec
);
4276 spec
->digbeep_nid
= 0x23;
4277 spec
->adc_nids
= stac9205_adc_nids
;
4278 spec
->num_adcs
= ARRAY_SIZE(stac9205_adc_nids
);
4279 spec
->mux_nids
= stac9205_mux_nids
;
4280 spec
->num_muxes
= ARRAY_SIZE(stac9205_mux_nids
);
4281 spec
->dmic_nids
= stac9205_dmic_nids
;
4282 spec
->num_dmics
= STAC9205_NUM_DMICS
;
4283 spec
->dmux_nids
= stac9205_dmux_nids
;
4284 spec
->num_dmuxes
= ARRAY_SIZE(stac9205_dmux_nids
);
4287 spec
->init
= stac9205_core_init
;
4288 spec
->mixer
= stac9205_mixer
;
4290 spec
->aloopback_mask
= 0x40;
4291 spec
->aloopback_shift
= 0;
4292 spec
->multiout
.dac_nids
= spec
->dac_nids
;
4294 switch (spec
->board_config
){
4295 case STAC_9205_DELL_M43
:
4296 /* Enable SPDIF in/out */
4297 stac92xx_set_config_reg(codec
, 0x1f, 0x01441030);
4298 stac92xx_set_config_reg(codec
, 0x20, 0x1c410030);
4300 /* Enable unsol response for GPIO4/Dock HP connection */
4301 snd_hda_codec_write(codec
, codec
->afg
, 0,
4302 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK
, 0x10);
4303 snd_hda_codec_write_cache(codec
, codec
->afg
, 0,
4304 AC_VERB_SET_UNSOLICITED_ENABLE
,
4305 (AC_USRSP_EN
| STAC_HP_EVENT
));
4307 spec
->gpio_dir
= 0x0b;
4308 spec
->eapd_mask
= 0x01;
4309 spec
->gpio_mask
= 0x1b;
4310 spec
->gpio_mute
= 0x10;
4311 /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute,
4314 spec
->gpio_data
= 0x01;
4317 /* GPIO0 High = EAPD */
4318 spec
->eapd_mask
= spec
->gpio_mask
= spec
->gpio_dir
= 0x1;
4319 spec
->gpio_data
= 0x01;
4323 err
= stac92xx_parse_auto_config(codec
, 0x1f, 0x20);
4325 if (spec
->board_config
< 0) {
4326 printk(KERN_WARNING
"hda_codec: No auto-config is "
4327 "available, default to model=ref\n");
4328 spec
->board_config
= STAC_9205_REF
;
4334 stac92xx_free(codec
);
4338 codec
->patch_ops
= stac92xx_patch_ops
;
4347 /* static config for Sony VAIO FE550G and Sony VAIO AR */
4348 static hda_nid_t vaio_dacs
[] = { 0x2 };
4349 #define VAIO_HP_DAC 0x5
4350 static hda_nid_t vaio_adcs
[] = { 0x8 /*,0x6*/ };
4351 static hda_nid_t vaio_mux_nids
[] = { 0x15 };
4353 static struct hda_input_mux vaio_mux
= {
4356 /* { "HP", 0x0 }, */
4357 { "Mic Jack", 0x1 },
4358 { "Internal Mic", 0x2 },
4363 static struct hda_verb vaio_init
[] = {
4364 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP <- 0x2 */
4365 {0x0a, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| STAC_HP_EVENT
},
4366 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Speaker <- 0x5 */
4367 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Mic? (<- 0x2) */
4368 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* CD */
4369 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Mic? */
4370 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x1}, /* mic-sel: 0a,0d,14,02 */
4371 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* HP */
4372 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Speaker */
4373 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
4374 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
4375 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Mic-in -> 0x9 */
4379 static struct hda_verb vaio_ar_init
[] = {
4380 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP <- 0x2 */
4381 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Speaker <- 0x5 */
4382 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Mic? (<- 0x2) */
4383 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* CD */
4384 /* {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },*/ /* Optical Out */
4385 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Mic? */
4386 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x1}, /* mic-sel: 0a,0d,14,02 */
4387 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* HP */
4388 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Speaker */
4389 /* {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},*/ /* Optical Out */
4390 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
4391 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
4392 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Mic-in -> 0x9 */
4396 /* bind volumes of both NID 0x02 and 0x05 */
4397 static struct hda_bind_ctls vaio_bind_master_vol
= {
4398 .ops
= &snd_hda_bind_vol
,
4400 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
4401 HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT
),
4406 /* bind volumes of both NID 0x02 and 0x05 */
4407 static struct hda_bind_ctls vaio_bind_master_sw
= {
4408 .ops
= &snd_hda_bind_sw
,
4410 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
4411 HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT
),
4416 static struct snd_kcontrol_new vaio_mixer
[] = {
4417 HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol
),
4418 HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw
),
4419 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
4420 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT
),
4421 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT
),
4423 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4424 .name
= "Capture Source",
4426 .info
= stac92xx_mux_enum_info
,
4427 .get
= stac92xx_mux_enum_get
,
4428 .put
= stac92xx_mux_enum_put
,
4433 static struct snd_kcontrol_new vaio_ar_mixer
[] = {
4434 HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol
),
4435 HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw
),
4436 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
4437 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT
),
4438 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT
),
4439 /*HDA_CODEC_MUTE("Optical Out Switch", 0x10, 0, HDA_OUTPUT),
4440 HDA_CODEC_VOLUME("Optical Out Volume", 0x10, 0, HDA_OUTPUT),*/
4442 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4443 .name
= "Capture Source",
4445 .info
= stac92xx_mux_enum_info
,
4446 .get
= stac92xx_mux_enum_get
,
4447 .put
= stac92xx_mux_enum_put
,
4452 static struct hda_codec_ops stac9872_patch_ops
= {
4453 .build_controls
= stac92xx_build_controls
,
4454 .build_pcms
= stac92xx_build_pcms
,
4455 .init
= stac92xx_init
,
4456 .free
= stac92xx_free
,
4457 #ifdef SND_HDA_NEEDS_RESUME
4458 .resume
= stac92xx_resume
,
4462 static int stac9872_vaio_init(struct hda_codec
*codec
)
4466 err
= stac92xx_init(codec
);
4469 if (codec
->patch_ops
.unsol_event
)
4470 codec
->patch_ops
.unsol_event(codec
, STAC_HP_EVENT
<< 26);
4474 static void stac9872_vaio_hp_detect(struct hda_codec
*codec
, unsigned int res
)
4476 if (get_hp_pin_presence(codec
, 0x0a)) {
4477 stac92xx_reset_pinctl(codec
, 0x0f, AC_PINCTL_OUT_EN
);
4478 stac92xx_set_pinctl(codec
, 0x0a, AC_PINCTL_OUT_EN
);
4480 stac92xx_reset_pinctl(codec
, 0x0a, AC_PINCTL_OUT_EN
);
4481 stac92xx_set_pinctl(codec
, 0x0f, AC_PINCTL_OUT_EN
);
4485 static void stac9872_vaio_unsol_event(struct hda_codec
*codec
, unsigned int res
)
4487 switch (res
>> 26) {
4489 stac9872_vaio_hp_detect(codec
, res
);
4494 static struct hda_codec_ops stac9872_vaio_patch_ops
= {
4495 .build_controls
= stac92xx_build_controls
,
4496 .build_pcms
= stac92xx_build_pcms
,
4497 .init
= stac9872_vaio_init
,
4498 .free
= stac92xx_free
,
4499 .unsol_event
= stac9872_vaio_unsol_event
,
4501 .resume
= stac92xx_resume
,
4505 enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */
4507 /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */
4509 /* Unknown. id=0x83847661 and subsys=0x104D1200. */
4511 /* AR Series. id=0x83847664 and subsys=104D1300 */
4516 static const char *stac9872_models
[STAC_9872_MODELS
] = {
4517 [CXD9872RD_VAIO
] = "vaio",
4518 [CXD9872AKD_VAIO
] = "vaio-ar",
4521 static struct snd_pci_quirk stac9872_cfg_tbl
[] = {
4522 SND_PCI_QUIRK(0x104d, 0x81e6, "Sony VAIO F/S", CXD9872RD_VAIO
),
4523 SND_PCI_QUIRK(0x104d, 0x81ef, "Sony VAIO F/S", CXD9872RD_VAIO
),
4524 SND_PCI_QUIRK(0x104d, 0x81fd, "Sony VAIO AR", CXD9872AKD_VAIO
),
4525 SND_PCI_QUIRK(0x104d, 0x8205, "Sony VAIO AR", CXD9872AKD_VAIO
),
4529 static int patch_stac9872(struct hda_codec
*codec
)
4531 struct sigmatel_spec
*spec
;
4534 board_config
= snd_hda_check_board_config(codec
, STAC_9872_MODELS
,
4537 if (board_config
< 0)
4538 /* unknown config, let generic-parser do its job... */
4539 return snd_hda_parse_generic_codec(codec
);
4541 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
4546 switch (board_config
) {
4547 case CXD9872RD_VAIO
:
4548 case STAC9872AK_VAIO
:
4549 case STAC9872K_VAIO
:
4550 spec
->mixer
= vaio_mixer
;
4551 spec
->init
= vaio_init
;
4552 spec
->multiout
.max_channels
= 2;
4553 spec
->multiout
.num_dacs
= ARRAY_SIZE(vaio_dacs
);
4554 spec
->multiout
.dac_nids
= vaio_dacs
;
4555 spec
->multiout
.hp_nid
= VAIO_HP_DAC
;
4556 spec
->num_adcs
= ARRAY_SIZE(vaio_adcs
);
4557 spec
->adc_nids
= vaio_adcs
;
4559 spec
->input_mux
= &vaio_mux
;
4560 spec
->mux_nids
= vaio_mux_nids
;
4561 codec
->patch_ops
= stac9872_vaio_patch_ops
;
4564 case CXD9872AKD_VAIO
:
4565 spec
->mixer
= vaio_ar_mixer
;
4566 spec
->init
= vaio_ar_init
;
4567 spec
->multiout
.max_channels
= 2;
4568 spec
->multiout
.num_dacs
= ARRAY_SIZE(vaio_dacs
);
4569 spec
->multiout
.dac_nids
= vaio_dacs
;
4570 spec
->multiout
.hp_nid
= VAIO_HP_DAC
;
4571 spec
->num_adcs
= ARRAY_SIZE(vaio_adcs
);
4573 spec
->adc_nids
= vaio_adcs
;
4574 spec
->input_mux
= &vaio_mux
;
4575 spec
->mux_nids
= vaio_mux_nids
;
4576 codec
->patch_ops
= stac9872_patch_ops
;
4587 struct hda_codec_preset snd_hda_preset_sigmatel
[] = {
4588 { .id
= 0x83847690, .name
= "STAC9200", .patch
= patch_stac9200
},
4589 { .id
= 0x83847882, .name
= "STAC9220 A1", .patch
= patch_stac922x
},
4590 { .id
= 0x83847680, .name
= "STAC9221 A1", .patch
= patch_stac922x
},
4591 { .id
= 0x83847880, .name
= "STAC9220 A2", .patch
= patch_stac922x
},
4592 { .id
= 0x83847681, .name
= "STAC9220D/9223D A2", .patch
= patch_stac922x
},
4593 { .id
= 0x83847682, .name
= "STAC9221 A2", .patch
= patch_stac922x
},
4594 { .id
= 0x83847683, .name
= "STAC9221D A2", .patch
= patch_stac922x
},
4595 { .id
= 0x83847618, .name
= "STAC9227", .patch
= patch_stac927x
},
4596 { .id
= 0x83847619, .name
= "STAC9227", .patch
= patch_stac927x
},
4597 { .id
= 0x83847616, .name
= "STAC9228", .patch
= patch_stac927x
},
4598 { .id
= 0x83847617, .name
= "STAC9228", .patch
= patch_stac927x
},
4599 { .id
= 0x83847614, .name
= "STAC9229", .patch
= patch_stac927x
},
4600 { .id
= 0x83847615, .name
= "STAC9229", .patch
= patch_stac927x
},
4601 { .id
= 0x83847620, .name
= "STAC9274", .patch
= patch_stac927x
},
4602 { .id
= 0x83847621, .name
= "STAC9274D", .patch
= patch_stac927x
},
4603 { .id
= 0x83847622, .name
= "STAC9273X", .patch
= patch_stac927x
},
4604 { .id
= 0x83847623, .name
= "STAC9273D", .patch
= patch_stac927x
},
4605 { .id
= 0x83847624, .name
= "STAC9272X", .patch
= patch_stac927x
},
4606 { .id
= 0x83847625, .name
= "STAC9272D", .patch
= patch_stac927x
},
4607 { .id
= 0x83847626, .name
= "STAC9271X", .patch
= patch_stac927x
},
4608 { .id
= 0x83847627, .name
= "STAC9271D", .patch
= patch_stac927x
},
4609 { .id
= 0x83847628, .name
= "STAC9274X5NH", .patch
= patch_stac927x
},
4610 { .id
= 0x83847629, .name
= "STAC9274D5NH", .patch
= patch_stac927x
},
4611 { .id
= 0x83847632, .name
= "STAC9202", .patch
= patch_stac925x
},
4612 { .id
= 0x83847633, .name
= "STAC9202D", .patch
= patch_stac925x
},
4613 { .id
= 0x83847634, .name
= "STAC9250", .patch
= patch_stac925x
},
4614 { .id
= 0x83847635, .name
= "STAC9250D", .patch
= patch_stac925x
},
4615 { .id
= 0x83847636, .name
= "STAC9251", .patch
= patch_stac925x
},
4616 { .id
= 0x83847637, .name
= "STAC9250D", .patch
= patch_stac925x
},
4617 { .id
= 0x83847645, .name
= "92HD206X", .patch
= patch_stac927x
},
4618 { .id
= 0x83847646, .name
= "92HD206D", .patch
= patch_stac927x
},
4619 /* The following does not take into account .id=0x83847661 when subsys =
4620 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
4621 * currently not fully supported.
4623 { .id
= 0x83847661, .name
= "CXD9872RD/K", .patch
= patch_stac9872
},
4624 { .id
= 0x83847662, .name
= "STAC9872AK", .patch
= patch_stac9872
},
4625 { .id
= 0x83847664, .name
= "CXD9872AKD", .patch
= patch_stac9872
},
4626 { .id
= 0x838476a0, .name
= "STAC9205", .patch
= patch_stac9205
},
4627 { .id
= 0x838476a1, .name
= "STAC9205D", .patch
= patch_stac9205
},
4628 { .id
= 0x838476a2, .name
= "STAC9204", .patch
= patch_stac9205
},
4629 { .id
= 0x838476a3, .name
= "STAC9204D", .patch
= patch_stac9205
},
4630 { .id
= 0x838476a4, .name
= "STAC9255", .patch
= patch_stac9205
},
4631 { .id
= 0x838476a5, .name
= "STAC9255D", .patch
= patch_stac9205
},
4632 { .id
= 0x838476a6, .name
= "STAC9254", .patch
= patch_stac9205
},
4633 { .id
= 0x838476a7, .name
= "STAC9254D", .patch
= patch_stac9205
},
4634 { .id
= 0x111d7603, .name
= "92HD75B3X5", .patch
= patch_stac92hd71bxx
},
4635 { .id
= 0x111d7604, .name
= "92HD83C1X5", .patch
= patch_stac92hd83xxx
},
4636 { .id
= 0x111d7605, .name
= "92HD81B1X5", .patch
= patch_stac92hd83xxx
},
4637 { .id
= 0x111d7608, .name
= "92HD75B2X5", .patch
= patch_stac92hd71bxx
},
4638 { .id
= 0x111d7674, .name
= "92HD73D1X5", .patch
= patch_stac92hd73xx
},
4639 { .id
= 0x111d7675, .name
= "92HD73C1X5", .patch
= patch_stac92hd73xx
},
4640 { .id
= 0x111d7676, .name
= "92HD73E1X5", .patch
= patch_stac92hd73xx
},
4641 { .id
= 0x111d76b0, .name
= "92HD71B8X", .patch
= patch_stac92hd71bxx
},
4642 { .id
= 0x111d76b1, .name
= "92HD71B8X", .patch
= patch_stac92hd71bxx
},
4643 { .id
= 0x111d76b2, .name
= "92HD71B7X", .patch
= patch_stac92hd71bxx
},
4644 { .id
= 0x111d76b3, .name
= "92HD71B7X", .patch
= patch_stac92hd71bxx
},
4645 { .id
= 0x111d76b4, .name
= "92HD71B6X", .patch
= patch_stac92hd71bxx
},
4646 { .id
= 0x111d76b5, .name
= "92HD71B6X", .patch
= patch_stac92hd71bxx
},
4647 { .id
= 0x111d76b6, .name
= "92HD71B5X", .patch
= patch_stac92hd71bxx
},
4648 { .id
= 0x111d76b7, .name
= "92HD71B5X", .patch
= patch_stac92hd71bxx
},