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 <linux/dmi.h>
32 #include <linux/module.h>
33 #include <sound/core.h>
34 #include <sound/asoundef.h>
35 #include <sound/jack.h>
36 #include <sound/tlv.h>
37 #include "hda_codec.h"
38 #include "hda_local.h"
39 #include "hda_auto_parser.h"
84 STAC_92HD73XX_NO_JD
, /* no jack-detection */
98 STAC_92HD83XXX_PWR_REF
,
100 STAC_DELL_VOSTRO_3500
,
101 STAC_92HD83XXX_HP_cNB11_INTQUAD
,
104 STAC_92HD83XXX_HP_LED
,
105 STAC_92HD83XXX_HP_INV_LED
,
106 STAC_92HD83XXX_HP_MIC_LED
,
107 STAC_92HD83XXX_HEADSET_JACK
,
108 STAC_92HD83XXX_MODELS
122 STAC_92HD71BXX_MODELS
147 STAC_INTEL_MAC_AUTO
, /* This model is selected if no module parameter
148 * is given, one of the above models will be
149 * chosen according to the subsystem id. */
150 /* for backward compatibility */
167 STAC_D965_REF_NO_JD
, /* no jack-detection */
184 struct sigmatel_mic_route
{
187 signed char dmux_idx
;
190 #define MAX_PINS_NUM 16
191 #define MAX_ADCS_NUM 4
192 #define MAX_DMICS_NUM 4
194 struct sigmatel_spec
{
195 struct snd_kcontrol_new
*mixers
[4];
196 unsigned int num_mixers
;
199 unsigned int eapd_switch
: 1;
200 unsigned int surr_switch
: 1;
201 unsigned int alt_switch
: 1;
202 unsigned int hp_detect
: 1;
203 unsigned int spdif_mute
: 1;
204 unsigned int check_volume_offset
:1;
205 unsigned int auto_mic
:1;
206 unsigned int linear_tone_beep
:1;
207 unsigned int headset_jack
:1; /* 4-pin headset jack (hp + mono mic) */
210 unsigned int eapd_mask
;
211 unsigned int gpio_mask
;
212 unsigned int gpio_dir
;
213 unsigned int gpio_data
;
214 unsigned int gpio_mute
;
215 unsigned int gpio_led
;
216 unsigned int gpio_led_polarity
;
217 unsigned int vref_mute_led_nid
; /* pin NID for mute-LED vref control */
218 unsigned int vref_led
;
220 unsigned int mic_mute_led_gpio
; /* capture mute LED GPIO */
221 bool mic_mute_led_on
; /* current mic mute state */
224 unsigned int stream_delay
;
226 /* analog loopback */
227 const struct snd_kcontrol_new
*aloopback_ctl
;
228 unsigned char aloopback_mask
;
229 unsigned char aloopback_shift
;
231 /* power management */
232 unsigned int power_map_bits
;
233 unsigned int num_pwrs
;
234 const hda_nid_t
*pwr_nids
;
235 const hda_nid_t
*dac_list
;
238 struct hda_input_mux
*mono_mux
;
239 unsigned int cur_mmux
;
240 struct hda_multi_out multiout
;
241 hda_nid_t dac_nids
[5];
242 hda_nid_t hp_dacs
[5];
243 hda_nid_t speaker_dacs
[5];
248 const hda_nid_t
*adc_nids
;
249 unsigned int num_adcs
;
250 const hda_nid_t
*mux_nids
;
251 unsigned int num_muxes
;
252 const hda_nid_t
*dmic_nids
;
253 unsigned int num_dmics
;
254 const hda_nid_t
*dmux_nids
;
255 unsigned int num_dmuxes
;
256 const hda_nid_t
*smux_nids
;
257 unsigned int num_smuxes
;
258 unsigned int num_analog_muxes
;
260 const unsigned long *capvols
; /* amp-volume attr: HDA_COMPOSE_AMP_VAL() */
261 const unsigned long *capsws
; /* amp-mute attr: HDA_COMPOSE_AMP_VAL() */
262 unsigned int num_caps
; /* number of capture volume/switch elements */
264 struct sigmatel_mic_route ext_mic
;
265 struct sigmatel_mic_route int_mic
;
266 struct sigmatel_mic_route dock_mic
;
268 const char * const *spdif_labels
;
270 hda_nid_t dig_in_nid
;
272 hda_nid_t anabeep_nid
;
273 hda_nid_t digbeep_nid
;
276 const hda_nid_t
*pin_nids
;
277 unsigned int num_pins
;
279 /* codec specific stuff */
280 const struct hda_verb
*init
;
281 const struct snd_kcontrol_new
*mixer
;
284 struct hda_input_mux
*dinput_mux
;
285 unsigned int cur_dmux
[2];
286 struct hda_input_mux
*input_mux
;
287 unsigned int cur_mux
[3];
288 struct hda_input_mux
*sinput_mux
;
289 unsigned int cur_smux
[2];
290 unsigned int cur_amux
;
292 unsigned int powerdown_adcs
;
295 unsigned int io_switch
[2];
296 unsigned int clfe_swap
;
297 hda_nid_t line_switch
; /* shared line-in for input and output */
298 hda_nid_t mic_switch
; /* shared mic-in for input and output */
299 hda_nid_t hp_switch
; /* NID of HP as line-out */
300 unsigned int aloopback
;
302 struct hda_pcm pcm_rec
[2]; /* PCM information */
304 /* dynamic controls and input_mux */
305 struct auto_pin_cfg autocfg
;
306 struct snd_array kctls
;
307 struct hda_input_mux private_dimux
;
308 struct hda_input_mux private_imux
;
309 struct hda_input_mux private_smux
;
310 struct hda_input_mux private_mono_mux
;
313 unsigned auto_pin_cnt
;
314 hda_nid_t auto_pin_nids
[MAX_PINS_NUM
];
315 unsigned auto_adc_cnt
;
316 hda_nid_t auto_adc_nids
[MAX_ADCS_NUM
];
317 hda_nid_t auto_mux_nids
[MAX_ADCS_NUM
];
318 hda_nid_t auto_dmux_nids
[MAX_ADCS_NUM
];
319 unsigned long auto_capvols
[MAX_ADCS_NUM
];
320 unsigned auto_dmic_cnt
;
321 hda_nid_t auto_dmic_nids
[MAX_DMICS_NUM
];
323 struct hda_vmaster_mute_hook vmaster_mute
;
326 #define AC_VERB_IDT_SET_POWER_MAP 0x7ec
327 #define AC_VERB_IDT_GET_POWER_MAP 0xfec
329 static const hda_nid_t stac9200_adc_nids
[1] = {
333 static const hda_nid_t stac9200_mux_nids
[1] = {
337 static const hda_nid_t stac9200_dac_nids
[1] = {
341 static const hda_nid_t stac92hd73xx_pwr_nids
[8] = {
342 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
346 static const hda_nid_t stac92hd73xx_slave_dig_outs
[2] = {
350 static const hda_nid_t stac92hd73xx_adc_nids
[2] = {
354 #define STAC92HD73XX_NUM_DMICS 2
355 static const hda_nid_t stac92hd73xx_dmic_nids
[STAC92HD73XX_NUM_DMICS
+ 1] = {
359 #define STAC92HD73_DAC_COUNT 5
361 static const hda_nid_t stac92hd73xx_mux_nids
[2] = {
365 static const hda_nid_t stac92hd73xx_dmux_nids
[2] = {
369 static const hda_nid_t stac92hd73xx_smux_nids
[2] = {
373 #define STAC92HD73XX_NUM_CAPS 2
374 static const unsigned long stac92hd73xx_capvols
[] = {
375 HDA_COMPOSE_AMP_VAL(0x20, 3, 0, HDA_OUTPUT
),
376 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
378 #define stac92hd73xx_capsws stac92hd73xx_capvols
380 #define STAC92HD83_DAC_COUNT 3
382 static const hda_nid_t stac92hd83xxx_pwr_nids
[7] = {
383 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
387 static const hda_nid_t stac92hd83xxx_slave_dig_outs
[2] = {
391 static const hda_nid_t stac92hd83xxx_dmic_nids
[] = {
395 static const hda_nid_t stac92hd71bxx_pwr_nids
[3] = {
399 static const hda_nid_t stac92hd71bxx_adc_nids
[2] = {
403 static const hda_nid_t stac92hd71bxx_mux_nids
[2] = {
407 static const hda_nid_t stac92hd71bxx_dmux_nids
[2] = {
411 static const hda_nid_t stac92hd71bxx_smux_nids
[2] = {
415 #define STAC92HD71BXX_NUM_DMICS 2
416 static const hda_nid_t stac92hd71bxx_dmic_nids
[STAC92HD71BXX_NUM_DMICS
+ 1] = {
420 static const hda_nid_t stac92hd71bxx_dmic_5port_nids
[STAC92HD71BXX_NUM_DMICS
] = {
424 static const hda_nid_t stac92hd71bxx_slave_dig_outs
[2] = {
428 #define STAC92HD71BXX_NUM_CAPS 2
429 static const unsigned long stac92hd71bxx_capvols
[] = {
430 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT
),
431 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT
),
433 #define stac92hd71bxx_capsws stac92hd71bxx_capvols
435 static const hda_nid_t stac925x_adc_nids
[1] = {
439 static const hda_nid_t stac925x_mux_nids
[1] = {
443 static const hda_nid_t stac925x_dac_nids
[1] = {
447 #define STAC925X_NUM_DMICS 1
448 static const hda_nid_t stac925x_dmic_nids
[STAC925X_NUM_DMICS
+ 1] = {
452 static const hda_nid_t stac925x_dmux_nids
[1] = {
456 static const unsigned long stac925x_capvols
[] = {
457 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT
),
459 static const unsigned long stac925x_capsws
[] = {
460 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
463 static const hda_nid_t stac922x_adc_nids
[2] = {
467 static const hda_nid_t stac922x_mux_nids
[2] = {
471 #define STAC922X_NUM_CAPS 2
472 static const unsigned long stac922x_capvols
[] = {
473 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_INPUT
),
474 HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT
),
476 #define stac922x_capsws stac922x_capvols
478 static const hda_nid_t stac927x_slave_dig_outs
[2] = {
482 static const hda_nid_t stac927x_adc_nids
[3] = {
486 static const hda_nid_t stac927x_mux_nids
[3] = {
490 static const hda_nid_t stac927x_smux_nids
[1] = {
494 static const hda_nid_t stac927x_dac_nids
[6] = {
495 0x02, 0x03, 0x04, 0x05, 0x06, 0
498 static const hda_nid_t stac927x_dmux_nids
[1] = {
502 #define STAC927X_NUM_DMICS 2
503 static const hda_nid_t stac927x_dmic_nids
[STAC927X_NUM_DMICS
+ 1] = {
507 #define STAC927X_NUM_CAPS 3
508 static const unsigned long stac927x_capvols
[] = {
509 HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT
),
510 HDA_COMPOSE_AMP_VAL(0x19, 3, 0, HDA_INPUT
),
511 HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_INPUT
),
513 static const unsigned long stac927x_capsws
[] = {
514 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
515 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT
),
516 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT
),
519 static const char * const stac927x_spdif_labels
[5] = {
520 "Digital Playback", "ADAT", "Analog Mux 1",
521 "Analog Mux 2", "Analog Mux 3"
524 static const hda_nid_t stac9205_adc_nids
[2] = {
528 static const hda_nid_t stac9205_mux_nids
[2] = {
532 static const hda_nid_t stac9205_dmux_nids
[1] = {
536 static const hda_nid_t stac9205_smux_nids
[1] = {
540 #define STAC9205_NUM_DMICS 2
541 static const hda_nid_t stac9205_dmic_nids
[STAC9205_NUM_DMICS
+ 1] = {
545 #define STAC9205_NUM_CAPS 2
546 static const unsigned long stac9205_capvols
[] = {
547 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_INPUT
),
548 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_INPUT
),
550 static const unsigned long stac9205_capsws
[] = {
551 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT
),
552 HDA_COMPOSE_AMP_VAL(0x1e, 3, 0, HDA_OUTPUT
),
555 static const hda_nid_t stac9200_pin_nids
[8] = {
556 0x08, 0x09, 0x0d, 0x0e,
557 0x0f, 0x10, 0x11, 0x12,
560 static const hda_nid_t stac925x_pin_nids
[8] = {
561 0x07, 0x08, 0x0a, 0x0b,
562 0x0c, 0x0d, 0x10, 0x11,
565 static const hda_nid_t stac922x_pin_nids
[10] = {
566 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
567 0x0f, 0x10, 0x11, 0x15, 0x1b,
570 static const hda_nid_t stac92hd73xx_pin_nids
[13] = {
571 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
572 0x0f, 0x10, 0x11, 0x12, 0x13,
576 #define STAC92HD71BXX_NUM_PINS 13
577 static const hda_nid_t stac92hd71bxx_pin_nids_4port
[STAC92HD71BXX_NUM_PINS
] = {
578 0x0a, 0x0b, 0x0c, 0x0d, 0x00,
579 0x00, 0x14, 0x18, 0x19, 0x1e,
582 static const hda_nid_t stac92hd71bxx_pin_nids_6port
[STAC92HD71BXX_NUM_PINS
] = {
583 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
584 0x0f, 0x14, 0x18, 0x19, 0x1e,
588 static const hda_nid_t stac927x_pin_nids
[14] = {
589 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
590 0x0f, 0x10, 0x11, 0x12, 0x13,
591 0x14, 0x21, 0x22, 0x23,
594 static const hda_nid_t stac9205_pin_nids
[12] = {
595 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
596 0x0f, 0x14, 0x16, 0x17, 0x18,
600 static int stac92xx_dmux_enum_info(struct snd_kcontrol
*kcontrol
,
601 struct snd_ctl_elem_info
*uinfo
)
603 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
604 struct sigmatel_spec
*spec
= codec
->spec
;
605 return snd_hda_input_mux_info(spec
->dinput_mux
, uinfo
);
608 static int stac92xx_dmux_enum_get(struct snd_kcontrol
*kcontrol
,
609 struct snd_ctl_elem_value
*ucontrol
)
611 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
612 struct sigmatel_spec
*spec
= codec
->spec
;
613 unsigned int dmux_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
615 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_dmux
[dmux_idx
];
619 static int stac92xx_dmux_enum_put(struct snd_kcontrol
*kcontrol
,
620 struct snd_ctl_elem_value
*ucontrol
)
622 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
623 struct sigmatel_spec
*spec
= codec
->spec
;
624 unsigned int dmux_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
626 return snd_hda_input_mux_put(codec
, spec
->dinput_mux
, ucontrol
,
627 spec
->dmux_nids
[dmux_idx
], &spec
->cur_dmux
[dmux_idx
]);
630 static int stac92xx_smux_enum_info(struct snd_kcontrol
*kcontrol
,
631 struct snd_ctl_elem_info
*uinfo
)
633 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
634 struct sigmatel_spec
*spec
= codec
->spec
;
635 return snd_hda_input_mux_info(spec
->sinput_mux
, uinfo
);
638 static int stac92xx_smux_enum_get(struct snd_kcontrol
*kcontrol
,
639 struct snd_ctl_elem_value
*ucontrol
)
641 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
642 struct sigmatel_spec
*spec
= codec
->spec
;
643 unsigned int smux_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
645 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_smux
[smux_idx
];
649 static int stac92xx_smux_enum_put(struct snd_kcontrol
*kcontrol
,
650 struct snd_ctl_elem_value
*ucontrol
)
652 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
653 struct sigmatel_spec
*spec
= codec
->spec
;
654 struct hda_input_mux
*smux
= &spec
->private_smux
;
655 unsigned int smux_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
659 err
= snd_hda_input_mux_put(codec
, spec
->sinput_mux
, ucontrol
,
660 spec
->smux_nids
[smux_idx
], &spec
->cur_smux
[smux_idx
]);
664 if (spec
->spdif_mute
) {
666 nid
= spec
->multiout
.dig_out_nid
;
668 nid
= codec
->slave_dig_outs
[smux_idx
- 1];
669 if (spec
->cur_smux
[smux_idx
] == smux
->num_items
- 1)
673 /* un/mute SPDIF out */
674 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
680 static int stac_vrefout_set(struct hda_codec
*codec
,
681 hda_nid_t nid
, unsigned int new_vref
)
685 snd_printdd("%s, nid %x ctl %x\n", __func__
, nid
, new_vref
);
686 pinctl
= snd_hda_codec_read(codec
, nid
, 0,
687 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
693 pinctl
&= ~AC_PINCTL_VREFEN
;
694 pinctl
|= (new_vref
& AC_PINCTL_VREFEN
);
696 error
= snd_hda_set_pin_ctl_cache(codec
, nid
, pinctl
);
703 static unsigned int stac92xx_vref_set(struct hda_codec
*codec
,
704 hda_nid_t nid
, unsigned int new_vref
)
708 pincfg
= snd_hda_codec_read(codec
, nid
, 0,
709 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
712 pincfg
&= ~(AC_PINCTL_VREFEN
| AC_PINCTL_IN_EN
| AC_PINCTL_OUT_EN
);
715 if (new_vref
== AC_PINCTL_VREF_HIZ
)
716 pincfg
|= AC_PINCTL_OUT_EN
;
718 pincfg
|= AC_PINCTL_IN_EN
;
720 error
= snd_hda_set_pin_ctl_cache(codec
, nid
, pincfg
);
727 static unsigned int stac92xx_vref_get(struct hda_codec
*codec
, hda_nid_t nid
)
730 vref
= snd_hda_codec_read(codec
, nid
, 0,
731 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
732 vref
&= AC_PINCTL_VREFEN
;
736 static int stac92xx_mux_enum_info(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_info
*uinfo
)
738 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
739 struct sigmatel_spec
*spec
= codec
->spec
;
740 return snd_hda_input_mux_info(spec
->input_mux
, uinfo
);
743 static int stac92xx_mux_enum_get(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
745 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
746 struct sigmatel_spec
*spec
= codec
->spec
;
747 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
749 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mux
[adc_idx
];
753 static int stac92xx_mux_enum_put(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
755 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
756 struct sigmatel_spec
*spec
= codec
->spec
;
757 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
758 const struct hda_input_mux
*imux
= spec
->input_mux
;
759 unsigned int idx
, prev_idx
, didx
;
761 idx
= ucontrol
->value
.enumerated
.item
[0];
762 if (idx
>= imux
->num_items
)
763 idx
= imux
->num_items
- 1;
764 prev_idx
= spec
->cur_mux
[adc_idx
];
767 if (idx
< spec
->num_analog_muxes
) {
768 snd_hda_codec_write_cache(codec
, spec
->mux_nids
[adc_idx
], 0,
769 AC_VERB_SET_CONNECT_SEL
,
770 imux
->items
[idx
].index
);
771 if (prev_idx
>= spec
->num_analog_muxes
&&
772 spec
->mux_nids
[adc_idx
] != spec
->dmux_nids
[adc_idx
]) {
773 imux
= spec
->dinput_mux
;
775 snd_hda_codec_write_cache(codec
,
776 spec
->dmux_nids
[adc_idx
], 0,
777 AC_VERB_SET_CONNECT_SEL
,
778 imux
->items
[0].index
);
781 imux
= spec
->dinput_mux
;
782 /* first dimux item is hardcoded to select analog imux,
785 didx
= idx
- spec
->num_analog_muxes
+ 1;
786 snd_hda_codec_write_cache(codec
, spec
->dmux_nids
[adc_idx
], 0,
787 AC_VERB_SET_CONNECT_SEL
,
788 imux
->items
[didx
].index
);
790 spec
->cur_mux
[adc_idx
] = idx
;
794 static int stac92xx_mono_mux_enum_info(struct snd_kcontrol
*kcontrol
,
795 struct snd_ctl_elem_info
*uinfo
)
797 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
798 struct sigmatel_spec
*spec
= codec
->spec
;
799 return snd_hda_input_mux_info(spec
->mono_mux
, uinfo
);
802 static int stac92xx_mono_mux_enum_get(struct snd_kcontrol
*kcontrol
,
803 struct snd_ctl_elem_value
*ucontrol
)
805 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
806 struct sigmatel_spec
*spec
= codec
->spec
;
808 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mmux
;
812 static int stac92xx_mono_mux_enum_put(struct snd_kcontrol
*kcontrol
,
813 struct snd_ctl_elem_value
*ucontrol
)
815 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
816 struct sigmatel_spec
*spec
= codec
->spec
;
818 return snd_hda_input_mux_put(codec
, spec
->mono_mux
, ucontrol
,
819 spec
->mono_nid
, &spec
->cur_mmux
);
822 #define stac92xx_aloopback_info snd_ctl_boolean_mono_info
824 static int stac92xx_aloopback_get(struct snd_kcontrol
*kcontrol
,
825 struct snd_ctl_elem_value
*ucontrol
)
827 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
828 unsigned int idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
829 struct sigmatel_spec
*spec
= codec
->spec
;
831 ucontrol
->value
.integer
.value
[0] = !!(spec
->aloopback
&
832 (spec
->aloopback_mask
<< idx
));
836 static int stac92xx_aloopback_put(struct snd_kcontrol
*kcontrol
,
837 struct snd_ctl_elem_value
*ucontrol
)
839 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
840 struct sigmatel_spec
*spec
= codec
->spec
;
841 unsigned int idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
842 unsigned int dac_mode
;
843 unsigned int val
, idx_val
;
845 idx_val
= spec
->aloopback_mask
<< idx
;
846 if (ucontrol
->value
.integer
.value
[0])
847 val
= spec
->aloopback
| idx_val
;
849 val
= spec
->aloopback
& ~idx_val
;
850 if (spec
->aloopback
== val
)
853 spec
->aloopback
= val
;
855 /* Only return the bits defined by the shift value of the
856 * first two bytes of the mask
858 dac_mode
= snd_hda_codec_read(codec
, codec
->afg
, 0,
859 kcontrol
->private_value
& 0xFFFF, 0x0);
860 dac_mode
>>= spec
->aloopback_shift
;
862 if (spec
->aloopback
& idx_val
) {
863 snd_hda_power_up(codec
);
866 snd_hda_power_down(codec
);
867 dac_mode
&= ~idx_val
;
870 snd_hda_codec_write_cache(codec
, codec
->afg
, 0,
871 kcontrol
->private_value
>> 16, dac_mode
);
876 static const struct hda_verb stac9200_core_init
[] = {
877 /* set dac0mux for dac converter */
878 { 0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
882 static const struct hda_verb stac9200_eapd_init
[] = {
883 /* set dac0mux for dac converter */
884 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
885 {0x08, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
889 static const struct hda_verb dell_eq_core_init
[] = {
890 /* set master volume to max value without distortion
891 * and direct control */
892 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xec},
896 static const struct hda_verb stac92hd73xx_core_init
[] = {
897 /* set master volume and direct control */
898 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
902 static const struct hda_verb stac92hd83xxx_core_init
[] = {
903 /* power state controls amps */
904 { 0x01, AC_VERB_SET_EAPD
, 1 << 2},
908 static const struct hda_verb stac92hd83xxx_hp_zephyr_init
[] = {
909 { 0x22, 0x785, 0x43 },
910 { 0x22, 0x782, 0xe0 },
911 { 0x22, 0x795, 0x00 },
915 static const struct hda_verb stac92hd71bxx_core_init
[] = {
916 /* set master volume and direct control */
917 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
921 static const struct hda_verb stac92hd71bxx_unmute_core_init
[] = {
922 /* unmute right and left channels for nodes 0x0f, 0xa, 0x0d */
923 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
924 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
925 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
929 static const struct hda_verb stac925x_core_init
[] = {
930 /* set dac0mux for dac converter */
931 { 0x06, AC_VERB_SET_CONNECT_SEL
, 0x00},
932 /* mute the master volume */
933 { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
937 static const struct hda_verb stac922x_core_init
[] = {
938 /* set master volume and direct control */
939 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
943 static const struct hda_verb d965_core_init
[] = {
944 /* set master volume and direct control */
945 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
946 /* unmute node 0x1b */
947 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
948 /* select node 0x03 as DAC */
949 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x01},
953 static const struct hda_verb dell_3st_core_init
[] = {
954 /* don't set delta bit */
955 {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0x7f},
956 /* unmute node 0x1b */
957 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
958 /* select node 0x03 as DAC */
959 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0x01},
963 static const struct hda_verb stac927x_core_init
[] = {
964 /* set master volume and direct control */
965 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
966 /* enable analog pc beep path */
967 { 0x01, AC_VERB_SET_DIGI_CONVERT_2
, 1 << 5},
971 static const struct hda_verb stac927x_volknob_core_init
[] = {
972 /* don't set delta bit */
973 {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0x7f},
974 /* enable analog pc beep path */
975 {0x01, AC_VERB_SET_DIGI_CONVERT_2
, 1 << 5},
979 static const struct hda_verb stac9205_core_init
[] = {
980 /* set master volume and direct control */
981 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
982 /* enable analog pc beep path */
983 { 0x01, AC_VERB_SET_DIGI_CONVERT_2
, 1 << 5},
987 #define STAC_MONO_MUX \
989 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
990 .name = "Mono Mux", \
992 .info = stac92xx_mono_mux_enum_info, \
993 .get = stac92xx_mono_mux_enum_get, \
994 .put = stac92xx_mono_mux_enum_put, \
997 #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \
999 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1000 .name = "Analog Loopback", \
1002 .info = stac92xx_aloopback_info, \
1003 .get = stac92xx_aloopback_get, \
1004 .put = stac92xx_aloopback_put, \
1005 .private_value = verb_read | (verb_write << 16), \
1008 #define DC_BIAS(xname, idx, nid) \
1010 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1013 .info = stac92xx_dc_bias_info, \
1014 .get = stac92xx_dc_bias_get, \
1015 .put = stac92xx_dc_bias_put, \
1016 .private_value = nid, \
1019 static const struct snd_kcontrol_new stac9200_mixer
[] = {
1020 HDA_CODEC_VOLUME_MIN_MUTE("PCM Playback Volume", 0xb, 0, HDA_OUTPUT
),
1021 HDA_CODEC_MUTE("PCM Playback Switch", 0xb, 0, HDA_OUTPUT
),
1022 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT
),
1023 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT
),
1027 static const struct snd_kcontrol_new stac92hd73xx_6ch_loopback
[] = {
1028 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3),
1032 static const struct snd_kcontrol_new stac92hd73xx_8ch_loopback
[] = {
1033 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4),
1037 static const struct snd_kcontrol_new stac92hd73xx_10ch_loopback
[] = {
1038 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5),
1043 static const struct snd_kcontrol_new stac92hd71bxx_loopback
[] = {
1044 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2)
1047 static const struct snd_kcontrol_new stac925x_mixer
[] = {
1048 HDA_CODEC_VOLUME_MIN_MUTE("PCM Playback Volume", 0xe, 0, HDA_OUTPUT
),
1049 HDA_CODEC_MUTE("PCM Playback Switch", 0x0e, 0, HDA_OUTPUT
),
1053 static const struct snd_kcontrol_new stac9205_loopback
[] = {
1054 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1),
1058 static const struct snd_kcontrol_new stac927x_loopback
[] = {
1059 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1),
1063 static struct snd_kcontrol_new stac_dmux_mixer
= {
1064 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1065 .name
= "Digital Input Source",
1066 /* count set later */
1067 .info
= stac92xx_dmux_enum_info
,
1068 .get
= stac92xx_dmux_enum_get
,
1069 .put
= stac92xx_dmux_enum_put
,
1072 static struct snd_kcontrol_new stac_smux_mixer
= {
1073 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1074 .name
= "IEC958 Playback Source",
1075 /* count set later */
1076 .info
= stac92xx_smux_enum_info
,
1077 .get
= stac92xx_smux_enum_get
,
1078 .put
= stac92xx_smux_enum_put
,
1081 static const char * const slave_pfxs
[] = {
1082 "Front", "Surround", "Center", "LFE", "Side",
1083 "Headphone", "Speaker", "Bass Speaker", "IEC958", "PCM",
1087 static void stac92xx_update_led_status(struct hda_codec
*codec
, int enabled
);
1089 static void stac92xx_vmaster_hook(void *private_data
, int val
)
1091 stac92xx_update_led_status(private_data
, val
);
1094 static void stac92xx_free_kctls(struct hda_codec
*codec
);
1096 static int stac92xx_build_controls(struct hda_codec
*codec
)
1098 struct sigmatel_spec
*spec
= codec
->spec
;
1099 unsigned int vmaster_tlv
[4];
1104 err
= snd_hda_add_new_ctls(codec
, spec
->mixer
);
1109 for (i
= 0; i
< spec
->num_mixers
; i
++) {
1110 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
1114 if (!spec
->auto_mic
&& spec
->num_dmuxes
> 0 &&
1115 snd_hda_get_bool_hint(codec
, "separate_dmux") == 1) {
1116 stac_dmux_mixer
.count
= spec
->num_dmuxes
;
1117 err
= snd_hda_ctl_add(codec
, 0,
1118 snd_ctl_new1(&stac_dmux_mixer
, codec
));
1122 if (spec
->num_smuxes
> 0) {
1123 int wcaps
= get_wcaps(codec
, spec
->multiout
.dig_out_nid
);
1124 struct hda_input_mux
*smux
= &spec
->private_smux
;
1125 /* check for mute support on SPDIF out */
1126 if (wcaps
& AC_WCAP_OUT_AMP
) {
1127 snd_hda_add_imux_item(smux
, "Off", 0, NULL
);
1128 spec
->spdif_mute
= 1;
1130 stac_smux_mixer
.count
= spec
->num_smuxes
;
1131 err
= snd_hda_ctl_add(codec
, 0,
1132 snd_ctl_new1(&stac_smux_mixer
, codec
));
1137 if (spec
->multiout
.dig_out_nid
) {
1138 err
= snd_hda_create_dig_out_ctls(codec
,
1139 spec
->multiout
.dig_out_nid
,
1140 spec
->multiout
.dig_out_nid
,
1141 spec
->autocfg
.dig_out_type
[0]);
1144 err
= snd_hda_create_spdif_share_sw(codec
,
1148 spec
->multiout
.share_spdif
= 1;
1150 if (spec
->dig_in_nid
&& !(spec
->gpio_dir
& 0x01)) {
1151 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
1156 /* if we have no master control, let's create it */
1157 snd_hda_set_vmaster_tlv(codec
, spec
->multiout
.dac_nids
[0],
1158 HDA_OUTPUT
, vmaster_tlv
);
1159 /* correct volume offset */
1160 vmaster_tlv
[2] += vmaster_tlv
[3] * spec
->volume_offset
;
1161 /* minimum value is actually mute */
1162 vmaster_tlv
[3] |= TLV_DB_SCALE_MUTE
;
1163 err
= snd_hda_add_vmaster(codec
, "Master Playback Volume",
1164 vmaster_tlv
, slave_pfxs
,
1169 err
= __snd_hda_add_vmaster(codec
, "Master Playback Switch",
1171 "Playback Switch", true,
1172 &spec
->vmaster_mute
.sw_kctl
);
1176 if (spec
->gpio_led
) {
1177 spec
->vmaster_mute
.hook
= stac92xx_vmaster_hook
;
1178 err
= snd_hda_add_vmaster_hook(codec
, &spec
->vmaster_mute
, true);
1183 if (spec
->aloopback_ctl
&&
1184 snd_hda_get_bool_hint(codec
, "loopback") == 1) {
1185 err
= snd_hda_add_new_ctls(codec
, spec
->aloopback_ctl
);
1190 stac92xx_free_kctls(codec
); /* no longer needed */
1192 err
= snd_hda_jack_add_kctls(codec
, &spec
->autocfg
);
1199 static const struct hda_pintbl ref9200_pin_configs
[] = {
1200 { 0x08, 0x01c47010 },
1201 { 0x09, 0x01447010 },
1202 { 0x0d, 0x0221401f },
1203 { 0x0e, 0x01114010 },
1204 { 0x0f, 0x02a19020 },
1205 { 0x10, 0x01a19021 },
1206 { 0x11, 0x90100140 },
1207 { 0x12, 0x01813122 },
1211 static const struct hda_pintbl gateway9200_m4_pin_configs
[] = {
1212 { 0x08, 0x400000fe },
1213 { 0x09, 0x404500f4 },
1214 { 0x0d, 0x400100f0 },
1215 { 0x0e, 0x90110010 },
1216 { 0x0f, 0x400100f1 },
1217 { 0x10, 0x02a1902e },
1218 { 0x11, 0x500000f2 },
1219 { 0x12, 0x500000f3 },
1223 static const struct hda_pintbl gateway9200_m4_2_pin_configs
[] = {
1224 { 0x08, 0x400000fe },
1225 { 0x09, 0x404500f4 },
1226 { 0x0d, 0x400100f0 },
1227 { 0x0e, 0x90110010 },
1228 { 0x0f, 0x400100f1 },
1229 { 0x10, 0x02a1902e },
1230 { 0x11, 0x500000f2 },
1231 { 0x12, 0x500000f3 },
1236 STAC 9200 pin configs for
1241 static const struct hda_pintbl dell9200_d21_pin_configs
[] = {
1242 { 0x08, 0x400001f0 },
1243 { 0x09, 0x400001f1 },
1244 { 0x0d, 0x02214030 },
1245 { 0x0e, 0x01014010 },
1246 { 0x0f, 0x02a19020 },
1247 { 0x10, 0x01a19021 },
1248 { 0x11, 0x90100140 },
1249 { 0x12, 0x01813122 },
1254 STAC 9200 pin configs for
1258 static const struct hda_pintbl dell9200_d22_pin_configs
[] = {
1259 { 0x08, 0x400001f0 },
1260 { 0x09, 0x400001f1 },
1261 { 0x0d, 0x0221401f },
1262 { 0x0e, 0x01014010 },
1263 { 0x0f, 0x01813020 },
1264 { 0x10, 0x02a19021 },
1265 { 0x11, 0x90100140 },
1266 { 0x12, 0x400001f2 },
1271 STAC 9200 pin configs for
1272 102801C4 (Dell Dimension E310)
1279 static const struct hda_pintbl dell9200_d23_pin_configs
[] = {
1280 { 0x08, 0x400001f0 },
1281 { 0x09, 0x400001f1 },
1282 { 0x0d, 0x0221401f },
1283 { 0x0e, 0x01014010 },
1284 { 0x0f, 0x01813020 },
1285 { 0x10, 0x01a19021 },
1286 { 0x11, 0x90100140 },
1287 { 0x12, 0x400001f2 },
1293 STAC 9200-32 pin configs for
1294 102801B5 (Dell Inspiron 630m)
1295 102801D8 (Dell Inspiron 640m)
1297 static const struct hda_pintbl dell9200_m21_pin_configs
[] = {
1298 { 0x08, 0x40c003fa },
1299 { 0x09, 0x03441340 },
1300 { 0x0d, 0x0321121f },
1301 { 0x0e, 0x90170310 },
1302 { 0x0f, 0x408003fb },
1303 { 0x10, 0x03a11020 },
1304 { 0x11, 0x401003fc },
1305 { 0x12, 0x403003fd },
1310 STAC 9200-32 pin configs for
1311 102801C2 (Dell Latitude D620)
1313 102801CC (Dell Latitude D820)
1317 static const struct hda_pintbl dell9200_m22_pin_configs
[] = {
1318 { 0x08, 0x40c003fa },
1319 { 0x09, 0x0144131f },
1320 { 0x0d, 0x0321121f },
1321 { 0x0e, 0x90170310 },
1322 { 0x0f, 0x90a70321 },
1323 { 0x10, 0x03a11020 },
1324 { 0x11, 0x401003fb },
1325 { 0x12, 0x40f000fc },
1330 STAC 9200-32 pin configs for
1331 102801CE (Dell XPS M1710)
1332 102801CF (Dell Precision M90)
1334 static const struct hda_pintbl dell9200_m23_pin_configs
[] = {
1335 { 0x08, 0x40c003fa },
1336 { 0x09, 0x01441340 },
1337 { 0x0d, 0x0421421f },
1338 { 0x0e, 0x90170310 },
1339 { 0x0f, 0x408003fb },
1340 { 0x10, 0x04a1102e },
1341 { 0x11, 0x90170311 },
1342 { 0x12, 0x403003fc },
1347 STAC 9200-32 pin configs for
1350 102801CB (Dell Latitude 120L)
1353 static const struct hda_pintbl dell9200_m24_pin_configs
[] = {
1354 { 0x08, 0x40c003fa },
1355 { 0x09, 0x404003fb },
1356 { 0x0d, 0x0321121f },
1357 { 0x0e, 0x90170310 },
1358 { 0x0f, 0x408003fc },
1359 { 0x10, 0x03a11020 },
1360 { 0x11, 0x401003fd },
1361 { 0x12, 0x403003fe },
1366 STAC 9200-32 pin configs for
1367 102801BD (Dell Inspiron E1505n)
1371 static const struct hda_pintbl dell9200_m25_pin_configs
[] = {
1372 { 0x08, 0x40c003fa },
1373 { 0x09, 0x01441340 },
1374 { 0x0d, 0x0421121f },
1375 { 0x0e, 0x90170310 },
1376 { 0x0f, 0x408003fb },
1377 { 0x10, 0x04a11020 },
1378 { 0x11, 0x401003fc },
1379 { 0x12, 0x403003fd },
1384 STAC 9200-32 pin configs for
1385 102801F5 (Dell Inspiron 1501)
1388 static const struct hda_pintbl dell9200_m26_pin_configs
[] = {
1389 { 0x08, 0x40c003fa },
1390 { 0x09, 0x404003fb },
1391 { 0x0d, 0x0421121f },
1392 { 0x0e, 0x90170310 },
1393 { 0x0f, 0x408003fc },
1394 { 0x10, 0x04a11020 },
1395 { 0x11, 0x401003fd },
1396 { 0x12, 0x403003fe },
1402 102801CD (Dell Inspiron E1705/9400)
1404 static const struct hda_pintbl dell9200_m27_pin_configs
[] = {
1405 { 0x08, 0x40c003fa },
1406 { 0x09, 0x01441340 },
1407 { 0x0d, 0x0421121f },
1408 { 0x0e, 0x90170310 },
1409 { 0x0f, 0x90170310 },
1410 { 0x10, 0x04a11020 },
1411 { 0x11, 0x90170310 },
1412 { 0x12, 0x40f003fc },
1416 static const struct hda_pintbl oqo9200_pin_configs
[] = {
1417 { 0x08, 0x40c000f0 },
1418 { 0x09, 0x404000f1 },
1419 { 0x0d, 0x0221121f },
1420 { 0x0e, 0x02211210 },
1421 { 0x0f, 0x90170111 },
1422 { 0x10, 0x90a70120 },
1423 { 0x11, 0x400000f2 },
1424 { 0x12, 0x400000f3 },
1429 static void stac9200_fixup_panasonic(struct hda_codec
*codec
,
1430 const struct hda_fixup
*fix
, int action
)
1432 struct sigmatel_spec
*spec
= codec
->spec
;
1435 case HDA_FIXUP_ACT_PRE_PROBE
:
1436 spec
->gpio_mask
= spec
->gpio_dir
= 0x09;
1437 spec
->gpio_data
= 0x00;
1439 case HDA_FIXUP_ACT_PROBE
:
1440 /* CF-74 has no headphone detection, and the driver should *NOT*
1441 * do detection and HP/speaker toggle because the hardware does it.
1443 spec
->hp_detect
= 0;
1449 static const struct hda_fixup stac9200_fixups
[] = {
1451 .type
= HDA_FIXUP_PINS
,
1452 .v
.pins
= ref9200_pin_configs
,
1455 .type
= HDA_FIXUP_PINS
,
1456 .v
.pins
= oqo9200_pin_configs
,
1458 .chain_id
= STAC_9200_EAPD_INIT
,
1460 [STAC_9200_DELL_D21
] = {
1461 .type
= HDA_FIXUP_PINS
,
1462 .v
.pins
= dell9200_d21_pin_configs
,
1464 [STAC_9200_DELL_D22
] = {
1465 .type
= HDA_FIXUP_PINS
,
1466 .v
.pins
= dell9200_d22_pin_configs
,
1468 [STAC_9200_DELL_D23
] = {
1469 .type
= HDA_FIXUP_PINS
,
1470 .v
.pins
= dell9200_d23_pin_configs
,
1472 [STAC_9200_DELL_M21
] = {
1473 .type
= HDA_FIXUP_PINS
,
1474 .v
.pins
= dell9200_m21_pin_configs
,
1476 [STAC_9200_DELL_M22
] = {
1477 .type
= HDA_FIXUP_PINS
,
1478 .v
.pins
= dell9200_m22_pin_configs
,
1480 [STAC_9200_DELL_M23
] = {
1481 .type
= HDA_FIXUP_PINS
,
1482 .v
.pins
= dell9200_m23_pin_configs
,
1484 [STAC_9200_DELL_M24
] = {
1485 .type
= HDA_FIXUP_PINS
,
1486 .v
.pins
= dell9200_m24_pin_configs
,
1488 [STAC_9200_DELL_M25
] = {
1489 .type
= HDA_FIXUP_PINS
,
1490 .v
.pins
= dell9200_m25_pin_configs
,
1492 [STAC_9200_DELL_M26
] = {
1493 .type
= HDA_FIXUP_PINS
,
1494 .v
.pins
= dell9200_m26_pin_configs
,
1496 [STAC_9200_DELL_M27
] = {
1497 .type
= HDA_FIXUP_PINS
,
1498 .v
.pins
= dell9200_m27_pin_configs
,
1501 .type
= HDA_FIXUP_PINS
,
1502 .v
.pins
= gateway9200_m4_pin_configs
,
1504 .chain_id
= STAC_9200_EAPD_INIT
,
1506 [STAC_9200_M4_2
] = {
1507 .type
= HDA_FIXUP_PINS
,
1508 .v
.pins
= gateway9200_m4_2_pin_configs
,
1510 .chain_id
= STAC_9200_EAPD_INIT
,
1512 [STAC_9200_PANASONIC
] = {
1513 .type
= HDA_FIXUP_FUNC
,
1514 .v
.func
= stac9200_fixup_panasonic
,
1516 [STAC_9200_EAPD_INIT
] = {
1517 .type
= HDA_FIXUP_VERBS
,
1518 .v
.verbs
= (const struct hda_verb
[]) {
1519 {0x08, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
1525 static const struct hda_model_fixup stac9200_models
[] = {
1526 { .id
= STAC_REF
, .name
= "ref" },
1527 { .id
= STAC_9200_OQO
, .name
= "oqo" },
1528 { .id
= STAC_9200_DELL_D21
, .name
= "dell-d21" },
1529 { .id
= STAC_9200_DELL_D22
, .name
= "dell-d22" },
1530 { .id
= STAC_9200_DELL_D23
, .name
= "dell-d23" },
1531 { .id
= STAC_9200_DELL_M21
, .name
= "dell-m21" },
1532 { .id
= STAC_9200_DELL_M22
, .name
= "dell-m22" },
1533 { .id
= STAC_9200_DELL_M23
, .name
= "dell-m23" },
1534 { .id
= STAC_9200_DELL_M24
, .name
= "dell-m24" },
1535 { .id
= STAC_9200_DELL_M25
, .name
= "dell-m25" },
1536 { .id
= STAC_9200_DELL_M26
, .name
= "dell-m26" },
1537 { .id
= STAC_9200_DELL_M27
, .name
= "dell-m27" },
1538 { .id
= STAC_9200_M4
, .name
= "gateway-m4" },
1539 { .id
= STAC_9200_M4_2
, .name
= "gateway-m4-2" },
1540 { .id
= STAC_9200_PANASONIC
, .name
= "panasonic" },
1544 static const struct snd_pci_quirk stac9200_fixup_tbl
[] = {
1545 /* SigmaTel reference board */
1546 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1547 "DFI LanParty", STAC_REF
),
1548 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI
, 0x3101,
1549 "DFI LanParty", STAC_REF
),
1550 /* Dell laptops have BIOS problem */
1551 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01a8,
1552 "unknown Dell", STAC_9200_DELL_D21
),
1553 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01b5,
1554 "Dell Inspiron 630m", STAC_9200_DELL_M21
),
1555 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01bd,
1556 "Dell Inspiron E1505n", STAC_9200_DELL_M25
),
1557 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c0,
1558 "unknown Dell", STAC_9200_DELL_D22
),
1559 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c1,
1560 "unknown Dell", STAC_9200_DELL_D22
),
1561 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c2,
1562 "Dell Latitude D620", STAC_9200_DELL_M22
),
1563 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c5,
1564 "unknown Dell", STAC_9200_DELL_D23
),
1565 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c7,
1566 "unknown Dell", STAC_9200_DELL_D23
),
1567 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c8,
1568 "unknown Dell", STAC_9200_DELL_M22
),
1569 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c9,
1570 "unknown Dell", STAC_9200_DELL_M24
),
1571 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ca,
1572 "unknown Dell", STAC_9200_DELL_M24
),
1573 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cb,
1574 "Dell Latitude 120L", STAC_9200_DELL_M24
),
1575 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cc,
1576 "Dell Latitude D820", STAC_9200_DELL_M22
),
1577 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cd,
1578 "Dell Inspiron E1705/9400", STAC_9200_DELL_M27
),
1579 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ce,
1580 "Dell XPS M1710", STAC_9200_DELL_M23
),
1581 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cf,
1582 "Dell Precision M90", STAC_9200_DELL_M23
),
1583 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d3,
1584 "unknown Dell", STAC_9200_DELL_M22
),
1585 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d4,
1586 "unknown Dell", STAC_9200_DELL_M22
),
1587 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d6,
1588 "unknown Dell", STAC_9200_DELL_M22
),
1589 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d8,
1590 "Dell Inspiron 640m", STAC_9200_DELL_M21
),
1591 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d9,
1592 "unknown Dell", STAC_9200_DELL_D23
),
1593 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01da,
1594 "unknown Dell", STAC_9200_DELL_D23
),
1595 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01de,
1596 "unknown Dell", STAC_9200_DELL_D21
),
1597 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01e3,
1598 "unknown Dell", STAC_9200_DELL_D23
),
1599 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01e8,
1600 "unknown Dell", STAC_9200_DELL_D21
),
1601 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ee,
1602 "unknown Dell", STAC_9200_DELL_M25
),
1603 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ef,
1604 "unknown Dell", STAC_9200_DELL_M25
),
1605 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f5,
1606 "Dell Inspiron 1501", STAC_9200_DELL_M26
),
1607 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f6,
1608 "unknown Dell", STAC_9200_DELL_M26
),
1610 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC
),
1611 /* Gateway machines needs EAPD to be set on resume */
1612 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_M4
),
1613 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", STAC_9200_M4_2
),
1614 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", STAC_9200_M4_2
),
1616 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO
),
1620 static const struct hda_pintbl ref925x_pin_configs
[] = {
1621 { 0x07, 0x40c003f0 },
1622 { 0x08, 0x424503f2 },
1623 { 0x0a, 0x01813022 },
1624 { 0x0b, 0x02a19021 },
1625 { 0x0c, 0x90a70320 },
1626 { 0x0d, 0x02214210 },
1627 { 0x10, 0x01019020 },
1628 { 0x11, 0x9033032e },
1632 static const struct hda_pintbl stac925xM1_pin_configs
[] = {
1633 { 0x07, 0x40c003f4 },
1634 { 0x08, 0x424503f2 },
1635 { 0x0a, 0x400000f3 },
1636 { 0x0b, 0x02a19020 },
1637 { 0x0c, 0x40a000f0 },
1638 { 0x0d, 0x90100210 },
1639 { 0x10, 0x400003f1 },
1640 { 0x11, 0x9033032e },
1644 static const struct hda_pintbl stac925xM1_2_pin_configs
[] = {
1645 { 0x07, 0x40c003f4 },
1646 { 0x08, 0x424503f2 },
1647 { 0x0a, 0x400000f3 },
1648 { 0x0b, 0x02a19020 },
1649 { 0x0c, 0x40a000f0 },
1650 { 0x0d, 0x90100210 },
1651 { 0x10, 0x400003f1 },
1652 { 0x11, 0x9033032e },
1656 static const struct hda_pintbl stac925xM2_pin_configs
[] = {
1657 { 0x07, 0x40c003f4 },
1658 { 0x08, 0x424503f2 },
1659 { 0x0a, 0x400000f3 },
1660 { 0x0b, 0x02a19020 },
1661 { 0x0c, 0x40a000f0 },
1662 { 0x0d, 0x90100210 },
1663 { 0x10, 0x400003f1 },
1664 { 0x11, 0x9033032e },
1668 static const struct hda_pintbl stac925xM2_2_pin_configs
[] = {
1669 { 0x07, 0x40c003f4 },
1670 { 0x08, 0x424503f2 },
1671 { 0x0a, 0x400000f3 },
1672 { 0x0b, 0x02a19020 },
1673 { 0x0c, 0x40a000f0 },
1674 { 0x0d, 0x90100210 },
1675 { 0x10, 0x400003f1 },
1676 { 0x11, 0x9033032e },
1680 static const struct hda_pintbl stac925xM3_pin_configs
[] = {
1681 { 0x07, 0x40c003f4 },
1682 { 0x08, 0x424503f2 },
1683 { 0x0a, 0x400000f3 },
1684 { 0x0b, 0x02a19020 },
1685 { 0x0c, 0x40a000f0 },
1686 { 0x0d, 0x90100210 },
1687 { 0x10, 0x400003f1 },
1688 { 0x11, 0x503303f3 },
1692 static const struct hda_pintbl stac925xM5_pin_configs
[] = {
1693 { 0x07, 0x40c003f4 },
1694 { 0x08, 0x424503f2 },
1695 { 0x0a, 0x400000f3 },
1696 { 0x0b, 0x02a19020 },
1697 { 0x0c, 0x40a000f0 },
1698 { 0x0d, 0x90100210 },
1699 { 0x10, 0x400003f1 },
1700 { 0x11, 0x9033032e },
1704 static const struct hda_pintbl stac925xM6_pin_configs
[] = {
1705 { 0x07, 0x40c003f4 },
1706 { 0x08, 0x424503f2 },
1707 { 0x0a, 0x400000f3 },
1708 { 0x0b, 0x02a19020 },
1709 { 0x0c, 0x40a000f0 },
1710 { 0x0d, 0x90100210 },
1711 { 0x10, 0x400003f1 },
1712 { 0x11, 0x90330320 },
1716 static const struct hda_fixup stac925x_fixups
[] = {
1718 .type
= HDA_FIXUP_PINS
,
1719 .v
.pins
= ref925x_pin_configs
,
1722 .type
= HDA_FIXUP_PINS
,
1723 .v
.pins
= stac925xM1_pin_configs
,
1726 .type
= HDA_FIXUP_PINS
,
1727 .v
.pins
= stac925xM1_2_pin_configs
,
1730 .type
= HDA_FIXUP_PINS
,
1731 .v
.pins
= stac925xM2_pin_configs
,
1734 .type
= HDA_FIXUP_PINS
,
1735 .v
.pins
= stac925xM2_2_pin_configs
,
1738 .type
= HDA_FIXUP_PINS
,
1739 .v
.pins
= stac925xM3_pin_configs
,
1742 .type
= HDA_FIXUP_PINS
,
1743 .v
.pins
= stac925xM5_pin_configs
,
1746 .type
= HDA_FIXUP_PINS
,
1747 .v
.pins
= stac925xM6_pin_configs
,
1751 static const struct hda_model_fixup stac925x_models
[] = {
1752 { .id
= STAC_REF
, .name
= "ref" },
1753 { .id
= STAC_M1
, .name
= "m1" },
1754 { .id
= STAC_M1_2
, .name
= "m1-2" },
1755 { .id
= STAC_M2
, .name
= "m2" },
1756 { .id
= STAC_M2_2
, .name
= "m2-2" },
1757 { .id
= STAC_M3
, .name
= "m3" },
1758 { .id
= STAC_M5
, .name
= "m5" },
1759 { .id
= STAC_M6
, .name
= "m6" },
1763 static const struct snd_pci_quirk stac925x_fixup_tbl
[] = {
1764 /* SigmaTel reference board */
1765 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668, "DFI LanParty", STAC_REF
),
1766 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI
, 0x3101, "DFI LanParty", STAC_REF
),
1767 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF
),
1769 /* Default table for unknown ID */
1770 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2
),
1772 /* gateway machines are checked via codec ssid */
1773 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2
),
1774 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5
),
1775 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1
),
1776 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_M2
),
1777 SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2
),
1778 /* Not sure about the brand name for those */
1779 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1
),
1780 SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3
),
1781 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6
),
1782 SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2
),
1786 static const unsigned int ref92hd73xx_pin_configs
[13] = {
1787 0x02214030, 0x02a19040, 0x01a19020, 0x02214030,
1788 0x0181302e, 0x01014010, 0x01014020, 0x01014030,
1789 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050,
1793 static const unsigned int dell_m6_pin_configs
[13] = {
1794 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110,
1795 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0,
1796 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
1800 static const unsigned int alienware_m17x_pin_configs
[13] = {
1801 0x0321101f, 0x0321101f, 0x03a11020, 0x03014020,
1802 0x90170110, 0x4f0000f0, 0x4f0000f0, 0x4f0000f0,
1803 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
1807 static const unsigned int intel_dg45id_pin_configs
[13] = {
1808 0x02214230, 0x02A19240, 0x01013214, 0x01014210,
1809 0x01A19250, 0x01011212, 0x01016211
1812 static const unsigned int *stac92hd73xx_brd_tbl
[STAC_92HD73XX_MODELS
] = {
1813 [STAC_92HD73XX_REF
] = ref92hd73xx_pin_configs
,
1814 [STAC_DELL_M6_AMIC
] = dell_m6_pin_configs
,
1815 [STAC_DELL_M6_DMIC
] = dell_m6_pin_configs
,
1816 [STAC_DELL_M6_BOTH
] = dell_m6_pin_configs
,
1817 [STAC_DELL_EQ
] = dell_m6_pin_configs
,
1818 [STAC_ALIENWARE_M17X
] = alienware_m17x_pin_configs
,
1819 [STAC_92HD73XX_INTEL
] = intel_dg45id_pin_configs
,
1822 static const char * const stac92hd73xx_models
[STAC_92HD73XX_MODELS
] = {
1823 [STAC_92HD73XX_AUTO
] = "auto",
1824 [STAC_92HD73XX_NO_JD
] = "no-jd",
1825 [STAC_92HD73XX_REF
] = "ref",
1826 [STAC_92HD73XX_INTEL
] = "intel",
1827 [STAC_DELL_M6_AMIC
] = "dell-m6-amic",
1828 [STAC_DELL_M6_DMIC
] = "dell-m6-dmic",
1829 [STAC_DELL_M6_BOTH
] = "dell-m6",
1830 [STAC_DELL_EQ
] = "dell-eq",
1831 [STAC_ALIENWARE_M17X
] = "alienware",
1834 static const struct snd_pci_quirk stac92hd73xx_cfg_tbl
[] = {
1835 /* SigmaTel reference board */
1836 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1837 "DFI LanParty", STAC_92HD73XX_REF
),
1838 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI
, 0x3101,
1839 "DFI LanParty", STAC_92HD73XX_REF
),
1840 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5002,
1841 "Intel DG45ID", STAC_92HD73XX_INTEL
),
1842 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5003,
1843 "Intel DG45FC", STAC_92HD73XX_INTEL
),
1844 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0254,
1845 "Dell Studio 1535", STAC_DELL_M6_DMIC
),
1846 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0255,
1847 "unknown Dell", STAC_DELL_M6_DMIC
),
1848 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0256,
1849 "unknown Dell", STAC_DELL_M6_BOTH
),
1850 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0257,
1851 "unknown Dell", STAC_DELL_M6_BOTH
),
1852 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x025e,
1853 "unknown Dell", STAC_DELL_M6_AMIC
),
1854 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x025f,
1855 "unknown Dell", STAC_DELL_M6_AMIC
),
1856 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0271,
1857 "unknown Dell", STAC_DELL_M6_DMIC
),
1858 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0272,
1859 "unknown Dell", STAC_DELL_M6_DMIC
),
1860 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x029f,
1861 "Dell Studio 1537", STAC_DELL_M6_DMIC
),
1862 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02a0,
1863 "Dell Studio 17", STAC_DELL_M6_DMIC
),
1864 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02be,
1865 "Dell Studio 1555", STAC_DELL_M6_DMIC
),
1866 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02bd,
1867 "Dell Studio 1557", STAC_DELL_M6_DMIC
),
1868 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02fe,
1869 "Dell Studio XPS 1645", STAC_DELL_M6_DMIC
),
1870 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0413,
1871 "Dell Studio 1558", STAC_DELL_M6_DMIC
),
1875 static const struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl
[] = {
1876 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02a1,
1877 "Alienware M17x", STAC_ALIENWARE_M17X
),
1878 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x043a,
1879 "Alienware M17x", STAC_ALIENWARE_M17X
),
1880 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0490,
1881 "Alienware M17x R3", STAC_DELL_EQ
),
1885 static const unsigned int ref92hd83xxx_pin_configs
[10] = {
1886 0x02214030, 0x02211010, 0x02a19020, 0x02170130,
1887 0x01014050, 0x01819040, 0x01014020, 0x90a3014e,
1888 0x01451160, 0x98560170,
1891 static const unsigned int dell_s14_pin_configs
[10] = {
1892 0x0221403f, 0x0221101f, 0x02a19020, 0x90170110,
1893 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a60160,
1894 0x40f000f0, 0x40f000f0,
1897 static const unsigned int dell_vostro_3500_pin_configs
[10] = {
1898 0x02a11020, 0x0221101f, 0x400000f0, 0x90170110,
1899 0x400000f1, 0x400000f2, 0x400000f3, 0x90a60160,
1900 0x400000f4, 0x400000f5,
1903 static const unsigned int hp_dv7_4000_pin_configs
[10] = {
1904 0x03a12050, 0x0321201f, 0x40f000f0, 0x90170110,
1905 0x40f000f0, 0x40f000f0, 0x90170110, 0xd5a30140,
1906 0x40f000f0, 0x40f000f0,
1909 static const unsigned int hp_zephyr_pin_configs
[10] = {
1910 0x01813050, 0x0421201f, 0x04a1205e, 0x96130310,
1911 0x96130310, 0x0101401f, 0x1111611f, 0xd5a30130,
1915 static const unsigned int hp_cNB11_intquad_pin_configs
[10] = {
1916 0x40f000f0, 0x0221101f, 0x02a11020, 0x92170110,
1917 0x40f000f0, 0x92170110, 0x40f000f0, 0xd5a30130,
1918 0x40f000f0, 0x40f000f0,
1921 static const unsigned int *stac92hd83xxx_brd_tbl
[STAC_92HD83XXX_MODELS
] = {
1922 [STAC_92HD83XXX_REF
] = ref92hd83xxx_pin_configs
,
1923 [STAC_92HD83XXX_PWR_REF
] = ref92hd83xxx_pin_configs
,
1924 [STAC_DELL_S14
] = dell_s14_pin_configs
,
1925 [STAC_DELL_VOSTRO_3500
] = dell_vostro_3500_pin_configs
,
1926 [STAC_92HD83XXX_HP_cNB11_INTQUAD
] = hp_cNB11_intquad_pin_configs
,
1927 [STAC_HP_DV7_4000
] = hp_dv7_4000_pin_configs
,
1928 [STAC_HP_ZEPHYR
] = hp_zephyr_pin_configs
,
1931 static const char * const stac92hd83xxx_models
[STAC_92HD83XXX_MODELS
] = {
1932 [STAC_92HD83XXX_AUTO
] = "auto",
1933 [STAC_92HD83XXX_REF
] = "ref",
1934 [STAC_92HD83XXX_PWR_REF
] = "mic-ref",
1935 [STAC_DELL_S14
] = "dell-s14",
1936 [STAC_DELL_VOSTRO_3500
] = "dell-vostro-3500",
1937 [STAC_92HD83XXX_HP_cNB11_INTQUAD
] = "hp_cNB11_intquad",
1938 [STAC_HP_DV7_4000
] = "hp-dv7-4000",
1939 [STAC_HP_ZEPHYR
] = "hp-zephyr",
1940 [STAC_92HD83XXX_HP_LED
] = "hp-led",
1941 [STAC_92HD83XXX_HP_INV_LED
] = "hp-inv-led",
1942 [STAC_92HD83XXX_HP_MIC_LED
] = "hp-mic-led",
1943 [STAC_92HD83XXX_HEADSET_JACK
] = "headset-jack",
1946 static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl
[] = {
1947 /* SigmaTel reference board */
1948 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1949 "DFI LanParty", STAC_92HD83XXX_REF
),
1950 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI
, 0x3101,
1951 "DFI LanParty", STAC_92HD83XXX_REF
),
1952 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02ba,
1953 "unknown Dell", STAC_DELL_S14
),
1954 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0532,
1955 "Dell Latitude E6230", STAC_92HD83XXX_HEADSET_JACK
),
1956 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0533,
1957 "Dell Latitude E6330", STAC_92HD83XXX_HEADSET_JACK
),
1958 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0534,
1959 "Dell Latitude E6430", STAC_92HD83XXX_HEADSET_JACK
),
1960 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0535,
1961 "Dell Latitude E6530", STAC_92HD83XXX_HEADSET_JACK
),
1962 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x053c,
1963 "Dell Latitude E5430", STAC_92HD83XXX_HEADSET_JACK
),
1964 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x053d,
1965 "Dell Latitude E5530", STAC_92HD83XXX_HEADSET_JACK
),
1966 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0549,
1967 "Dell Latitude E5430", STAC_92HD83XXX_HEADSET_JACK
),
1968 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x057d,
1969 "Dell Latitude E6430s", STAC_92HD83XXX_HEADSET_JACK
),
1970 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0584,
1971 "Dell Latitude E6430U", STAC_92HD83XXX_HEADSET_JACK
),
1972 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x1028,
1973 "Dell Vostro 3500", STAC_DELL_VOSTRO_3500
),
1974 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x1656,
1975 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
1976 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x1657,
1977 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
1978 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x1658,
1979 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
1980 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x1659,
1981 "HP Pavilion dv7", STAC_HP_DV7_4000
),
1982 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x165A,
1983 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
1984 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x165B,
1985 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
1986 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x18df,
1987 "HP Folio", STAC_92HD83XXX_HP_MIC_LED
),
1988 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x3388,
1989 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
1990 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x3389,
1991 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
1992 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x355B,
1993 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
1994 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x355C,
1995 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
1996 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x355D,
1997 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
1998 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x355E,
1999 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2000 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x355F,
2001 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2002 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x3560,
2003 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2004 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x358B,
2005 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2006 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x358C,
2007 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2008 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x358D,
2009 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2010 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x3591,
2011 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2012 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x3592,
2013 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2014 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x3593,
2015 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2016 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x3561,
2017 "HP", STAC_HP_ZEPHYR
),
2018 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x3660,
2019 "HP Mini", STAC_92HD83XXX_HP_LED
),
2020 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x144E,
2021 "HP Pavilion dv5", STAC_92HD83XXX_HP_INV_LED
),
2025 static const struct snd_pci_quirk stac92hd83xxx_codec_id_cfg_tbl
[] = {
2026 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x3561,
2027 "HP", STAC_HP_ZEPHYR
),
2031 static const unsigned int ref92hd71bxx_pin_configs
[STAC92HD71BXX_NUM_PINS
] = {
2032 0x02214030, 0x02a19040, 0x01a19020, 0x01014010,
2033 0x0181302e, 0x01014010, 0x01019020, 0x90a000f0,
2034 0x90a000f0, 0x01452050, 0x01452050, 0x00000000,
2038 static const unsigned int dell_m4_1_pin_configs
[STAC92HD71BXX_NUM_PINS
] = {
2039 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110,
2040 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0,
2041 0x40f000f0, 0x4f0000f0, 0x4f0000f0, 0x00000000,
2045 static const unsigned int dell_m4_2_pin_configs
[STAC92HD71BXX_NUM_PINS
] = {
2046 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
2047 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0,
2048 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000,
2052 static const unsigned int dell_m4_3_pin_configs
[STAC92HD71BXX_NUM_PINS
] = {
2053 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
2054 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0,
2055 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000,
2059 static const unsigned int *stac92hd71bxx_brd_tbl
[STAC_92HD71BXX_MODELS
] = {
2060 [STAC_92HD71BXX_REF
] = ref92hd71bxx_pin_configs
,
2061 [STAC_DELL_M4_1
] = dell_m4_1_pin_configs
,
2062 [STAC_DELL_M4_2
] = dell_m4_2_pin_configs
,
2063 [STAC_DELL_M4_3
] = dell_m4_3_pin_configs
,
2064 [STAC_HP_M4
] = NULL
,
2065 [STAC_HP_DV4
] = NULL
,
2066 [STAC_HP_DV5
] = NULL
,
2067 [STAC_HP_HDX
] = NULL
,
2068 [STAC_HP_DV4_1222NR
] = NULL
,
2071 static const char * const stac92hd71bxx_models
[STAC_92HD71BXX_MODELS
] = {
2072 [STAC_92HD71BXX_AUTO
] = "auto",
2073 [STAC_92HD71BXX_REF
] = "ref",
2074 [STAC_DELL_M4_1
] = "dell-m4-1",
2075 [STAC_DELL_M4_2
] = "dell-m4-2",
2076 [STAC_DELL_M4_3
] = "dell-m4-3",
2077 [STAC_HP_M4
] = "hp-m4",
2078 [STAC_HP_DV4
] = "hp-dv4",
2079 [STAC_HP_DV5
] = "hp-dv5",
2080 [STAC_HP_HDX
] = "hp-hdx",
2081 [STAC_HP_DV4_1222NR
] = "hp-dv4-1222nr",
2084 static const struct snd_pci_quirk stac92hd71bxx_cfg_tbl
[] = {
2085 /* SigmaTel reference board */
2086 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
2087 "DFI LanParty", STAC_92HD71BXX_REF
),
2088 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI
, 0x3101,
2089 "DFI LanParty", STAC_92HD71BXX_REF
),
2090 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x30fb,
2091 "HP dv4-1222nr", STAC_HP_DV4_1222NR
),
2092 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP
, 0xfff0, 0x1720,
2094 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP
, 0xfff0, 0x3080,
2096 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP
, 0xfff0, 0x30f0,
2097 "HP dv4-7", STAC_HP_DV4
),
2098 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP
, 0xfff0, 0x3600,
2099 "HP dv4-7", STAC_HP_DV5
),
2100 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x3610,
2101 "HP HDX", STAC_HP_HDX
), /* HDX18 */
2102 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x361a,
2103 "HP mini 1000", STAC_HP_M4
),
2104 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x361b,
2105 "HP HDX", STAC_HP_HDX
), /* HDX16 */
2106 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP
, 0xfff0, 0x3620,
2107 "HP dv6", STAC_HP_DV5
),
2108 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x3061,
2109 "HP dv6", STAC_HP_DV5
), /* HP dv6-1110ax */
2110 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x363e,
2111 "HP DV6", STAC_HP_DV5
),
2112 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP
, 0xfff0, 0x7010,
2114 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0233,
2115 "unknown Dell", STAC_DELL_M4_1
),
2116 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0234,
2117 "unknown Dell", STAC_DELL_M4_1
),
2118 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0250,
2119 "unknown Dell", STAC_DELL_M4_1
),
2120 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x024f,
2121 "unknown Dell", STAC_DELL_M4_1
),
2122 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x024d,
2123 "unknown Dell", STAC_DELL_M4_1
),
2124 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0251,
2125 "unknown Dell", STAC_DELL_M4_1
),
2126 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0277,
2127 "unknown Dell", STAC_DELL_M4_1
),
2128 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0263,
2129 "unknown Dell", STAC_DELL_M4_2
),
2130 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0265,
2131 "unknown Dell", STAC_DELL_M4_2
),
2132 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0262,
2133 "unknown Dell", STAC_DELL_M4_2
),
2134 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0264,
2135 "unknown Dell", STAC_DELL_M4_2
),
2136 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02aa,
2137 "unknown Dell", STAC_DELL_M4_3
),
2141 static const unsigned int ref922x_pin_configs
[10] = {
2142 0x01014010, 0x01016011, 0x01012012, 0x0221401f,
2143 0x01813122, 0x01011014, 0x01441030, 0x01c41030,
2144 0x40000100, 0x40000100,
2148 STAC 922X pin configs for
2155 static const unsigned int dell_922x_d81_pin_configs
[10] = {
2156 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
2157 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1,
2158 0x01813122, 0x400001f2,
2162 STAC 922X pin configs for
2166 static const unsigned int dell_922x_d82_pin_configs
[10] = {
2167 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
2168 0x02a19020, 0x01117011, 0x01451140, 0x400001f0,
2169 0x01813122, 0x400001f1,
2173 STAC 922X pin configs for
2176 static const unsigned int dell_922x_m81_pin_configs
[10] = {
2177 0x0321101f, 0x01112024, 0x01111222, 0x91174220,
2178 0x03a11050, 0x01116221, 0x90a70330, 0x01452340,
2179 0x40C003f1, 0x405003f0,
2183 STAC 9221 A1 pin configs for
2184 102801D7 (Dell XPS M1210)
2186 static const unsigned int dell_922x_m82_pin_configs
[10] = {
2187 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310,
2188 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2,
2189 0x508003f3, 0x405003f4,
2192 static const unsigned int d945gtp3_pin_configs
[10] = {
2193 0x0221401f, 0x01a19022, 0x01813021, 0x01014010,
2194 0x40000100, 0x40000100, 0x40000100, 0x40000100,
2195 0x02a19120, 0x40000100,
2198 static const unsigned int d945gtp5_pin_configs
[10] = {
2199 0x0221401f, 0x01011012, 0x01813024, 0x01014010,
2200 0x01a19021, 0x01016011, 0x01452130, 0x40000100,
2201 0x02a19320, 0x40000100,
2204 static const unsigned int intel_mac_v1_pin_configs
[10] = {
2205 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd,
2206 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240,
2207 0x400000fc, 0x400000fb,
2210 static const unsigned int intel_mac_v2_pin_configs
[10] = {
2211 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
2212 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa,
2213 0x400000fc, 0x400000fb,
2216 static const unsigned int intel_mac_v3_pin_configs
[10] = {
2217 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
2218 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240,
2219 0x400000fc, 0x400000fb,
2222 static const unsigned int intel_mac_v4_pin_configs
[10] = {
2223 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
2224 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
2225 0x400000fc, 0x400000fb,
2228 static const unsigned int intel_mac_v5_pin_configs
[10] = {
2229 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
2230 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
2231 0x400000fc, 0x400000fb,
2234 static const unsigned int ecs202_pin_configs
[10] = {
2235 0x0221401f, 0x02a19020, 0x01a19020, 0x01114010,
2236 0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1,
2237 0x9037012e, 0x40e000f2,
2240 static const unsigned int *stac922x_brd_tbl
[STAC_922X_MODELS
] = {
2241 [STAC_D945_REF
] = ref922x_pin_configs
,
2242 [STAC_D945GTP3
] = d945gtp3_pin_configs
,
2243 [STAC_D945GTP5
] = d945gtp5_pin_configs
,
2244 [STAC_INTEL_MAC_V1
] = intel_mac_v1_pin_configs
,
2245 [STAC_INTEL_MAC_V2
] = intel_mac_v2_pin_configs
,
2246 [STAC_INTEL_MAC_V3
] = intel_mac_v3_pin_configs
,
2247 [STAC_INTEL_MAC_V4
] = intel_mac_v4_pin_configs
,
2248 [STAC_INTEL_MAC_V5
] = intel_mac_v5_pin_configs
,
2249 [STAC_INTEL_MAC_AUTO
] = intel_mac_v3_pin_configs
,
2250 /* for backward compatibility */
2251 [STAC_MACMINI
] = intel_mac_v3_pin_configs
,
2252 [STAC_MACBOOK
] = intel_mac_v5_pin_configs
,
2253 [STAC_MACBOOK_PRO_V1
] = intel_mac_v3_pin_configs
,
2254 [STAC_MACBOOK_PRO_V2
] = intel_mac_v3_pin_configs
,
2255 [STAC_IMAC_INTEL
] = intel_mac_v2_pin_configs
,
2256 [STAC_IMAC_INTEL_20
] = intel_mac_v3_pin_configs
,
2257 [STAC_ECS_202
] = ecs202_pin_configs
,
2258 [STAC_922X_DELL_D81
] = dell_922x_d81_pin_configs
,
2259 [STAC_922X_DELL_D82
] = dell_922x_d82_pin_configs
,
2260 [STAC_922X_DELL_M81
] = dell_922x_m81_pin_configs
,
2261 [STAC_922X_DELL_M82
] = dell_922x_m82_pin_configs
,
2264 static const char * const stac922x_models
[STAC_922X_MODELS
] = {
2265 [STAC_922X_AUTO
] = "auto",
2266 [STAC_D945_REF
] = "ref",
2267 [STAC_D945GTP5
] = "5stack",
2268 [STAC_D945GTP3
] = "3stack",
2269 [STAC_INTEL_MAC_V1
] = "intel-mac-v1",
2270 [STAC_INTEL_MAC_V2
] = "intel-mac-v2",
2271 [STAC_INTEL_MAC_V3
] = "intel-mac-v3",
2272 [STAC_INTEL_MAC_V4
] = "intel-mac-v4",
2273 [STAC_INTEL_MAC_V5
] = "intel-mac-v5",
2274 [STAC_INTEL_MAC_AUTO
] = "intel-mac-auto",
2275 /* for backward compatibility */
2276 [STAC_MACMINI
] = "macmini",
2277 [STAC_MACBOOK
] = "macbook",
2278 [STAC_MACBOOK_PRO_V1
] = "macbook-pro-v1",
2279 [STAC_MACBOOK_PRO_V2
] = "macbook-pro",
2280 [STAC_IMAC_INTEL
] = "imac-intel",
2281 [STAC_IMAC_INTEL_20
] = "imac-intel-20",
2282 [STAC_ECS_202
] = "ecs202",
2283 [STAC_922X_DELL_D81
] = "dell-d81",
2284 [STAC_922X_DELL_D82
] = "dell-d82",
2285 [STAC_922X_DELL_M81
] = "dell-m81",
2286 [STAC_922X_DELL_M82
] = "dell-m82",
2289 static const struct snd_pci_quirk stac922x_cfg_tbl
[] = {
2290 /* SigmaTel reference board */
2291 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
2292 "DFI LanParty", STAC_D945_REF
),
2293 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI
, 0x3101,
2294 "DFI LanParty", STAC_D945_REF
),
2295 /* Intel 945G based systems */
2296 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0101,
2297 "Intel D945G", STAC_D945GTP3
),
2298 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0202,
2299 "Intel D945G", STAC_D945GTP3
),
2300 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0606,
2301 "Intel D945G", STAC_D945GTP3
),
2302 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0601,
2303 "Intel D945G", STAC_D945GTP3
),
2304 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0111,
2305 "Intel D945G", STAC_D945GTP3
),
2306 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1115,
2307 "Intel D945G", STAC_D945GTP3
),
2308 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1116,
2309 "Intel D945G", STAC_D945GTP3
),
2310 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1117,
2311 "Intel D945G", STAC_D945GTP3
),
2312 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1118,
2313 "Intel D945G", STAC_D945GTP3
),
2314 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1119,
2315 "Intel D945G", STAC_D945GTP3
),
2316 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x8826,
2317 "Intel D945G", STAC_D945GTP3
),
2318 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5049,
2319 "Intel D945G", STAC_D945GTP3
),
2320 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5055,
2321 "Intel D945G", STAC_D945GTP3
),
2322 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5048,
2323 "Intel D945G", STAC_D945GTP3
),
2324 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0110,
2325 "Intel D945G", STAC_D945GTP3
),
2326 /* Intel D945G 5-stack systems */
2327 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0404,
2328 "Intel D945G", STAC_D945GTP5
),
2329 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0303,
2330 "Intel D945G", STAC_D945GTP5
),
2331 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0013,
2332 "Intel D945G", STAC_D945GTP5
),
2333 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0417,
2334 "Intel D945G", STAC_D945GTP5
),
2335 /* Intel 945P based systems */
2336 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0b0b,
2337 "Intel D945P", STAC_D945GTP3
),
2338 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0112,
2339 "Intel D945P", STAC_D945GTP3
),
2340 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0d0d,
2341 "Intel D945P", STAC_D945GTP3
),
2342 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0909,
2343 "Intel D945P", STAC_D945GTP3
),
2344 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0505,
2345 "Intel D945P", STAC_D945GTP3
),
2346 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0707,
2347 "Intel D945P", STAC_D945GTP5
),
2349 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0204,
2350 "Intel D945", STAC_D945_REF
),
2352 /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */
2353 SND_PCI_QUIRK(0x8384, 0x7680,
2354 "Mac", STAC_INTEL_MAC_AUTO
),
2356 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01a7,
2357 "unknown Dell", STAC_922X_DELL_D81
),
2358 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01a9,
2359 "unknown Dell", STAC_922X_DELL_D81
),
2360 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ab,
2361 "unknown Dell", STAC_922X_DELL_D81
),
2362 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ac,
2363 "unknown Dell", STAC_922X_DELL_D82
),
2364 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01bf,
2365 "unknown Dell", STAC_922X_DELL_M81
),
2366 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d0,
2367 "unknown Dell", STAC_922X_DELL_D82
),
2368 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d1,
2369 "unknown Dell", STAC_922X_DELL_D81
),
2370 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d2,
2371 "unknown Dell", STAC_922X_DELL_D81
),
2372 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d7,
2373 "Dell XPS M1210", STAC_922X_DELL_M82
),
2374 /* ECS/PC Chips boards */
2375 SND_PCI_QUIRK_MASK(0x1019, 0xf000, 0x2000,
2376 "ECS/PC chips", STAC_ECS_202
),
2380 static const unsigned int ref927x_pin_configs
[14] = {
2381 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
2382 0x01a19040, 0x01011012, 0x01016011, 0x0101201f,
2383 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070,
2384 0x01c42190, 0x40000100,
2387 static const unsigned int d965_3st_pin_configs
[14] = {
2388 0x0221401f, 0x02a19120, 0x40000100, 0x01014011,
2389 0x01a19021, 0x01813024, 0x40000100, 0x40000100,
2390 0x40000100, 0x40000100, 0x40000100, 0x40000100,
2391 0x40000100, 0x40000100
2394 static const unsigned int d965_5st_pin_configs
[14] = {
2395 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
2396 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
2397 0x40000100, 0x40000100, 0x40000100, 0x01442070,
2398 0x40000100, 0x40000100
2401 static const unsigned int d965_5st_no_fp_pin_configs
[14] = {
2402 0x40000100, 0x40000100, 0x0181304e, 0x01014010,
2403 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
2404 0x40000100, 0x40000100, 0x40000100, 0x01442070,
2405 0x40000100, 0x40000100
2408 static const unsigned int dell_3st_pin_configs
[14] = {
2409 0x02211230, 0x02a11220, 0x01a19040, 0x01114210,
2410 0x01111212, 0x01116211, 0x01813050, 0x01112214,
2411 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb,
2412 0x40c003fc, 0x40000100
2415 static const unsigned int *stac927x_brd_tbl
[STAC_927X_MODELS
] = {
2416 [STAC_D965_REF_NO_JD
] = ref927x_pin_configs
,
2417 [STAC_D965_REF
] = ref927x_pin_configs
,
2418 [STAC_D965_3ST
] = d965_3st_pin_configs
,
2419 [STAC_D965_5ST
] = d965_5st_pin_configs
,
2420 [STAC_D965_5ST_NO_FP
] = d965_5st_no_fp_pin_configs
,
2421 [STAC_DELL_3ST
] = dell_3st_pin_configs
,
2422 [STAC_DELL_BIOS
] = NULL
,
2423 [STAC_927X_VOLKNOB
] = NULL
,
2426 static const char * const stac927x_models
[STAC_927X_MODELS
] = {
2427 [STAC_927X_AUTO
] = "auto",
2428 [STAC_D965_REF_NO_JD
] = "ref-no-jd",
2429 [STAC_D965_REF
] = "ref",
2430 [STAC_D965_3ST
] = "3stack",
2431 [STAC_D965_5ST
] = "5stack",
2432 [STAC_D965_5ST_NO_FP
] = "5stack-no-fp",
2433 [STAC_DELL_3ST
] = "dell-3stack",
2434 [STAC_DELL_BIOS
] = "dell-bios",
2435 [STAC_927X_VOLKNOB
] = "volknob",
2438 static const struct snd_pci_quirk stac927x_cfg_tbl
[] = {
2439 /* SigmaTel reference board */
2440 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
2441 "DFI LanParty", STAC_D965_REF
),
2442 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI
, 0x3101,
2443 "DFI LanParty", STAC_D965_REF
),
2444 /* Intel 946 based systems */
2445 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x3d01, "Intel D946", STAC_D965_3ST
),
2446 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0xa301, "Intel D946", STAC_D965_3ST
),
2447 /* 965 based 3 stack systems */
2448 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL
, 0xff00, 0x2100,
2449 "Intel D965", STAC_D965_3ST
),
2450 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL
, 0xff00, 0x2000,
2451 "Intel D965", STAC_D965_3ST
),
2452 /* Dell 3 stack systems */
2453 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST
),
2454 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ed, "Dell ", STAC_DELL_3ST
),
2455 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f4, "Dell ", STAC_DELL_3ST
),
2456 /* Dell 3 stack systems with verb table in BIOS */
2457 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS
),
2458 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f7, "Dell XPS M1730", STAC_DELL_BIOS
),
2459 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS
),
2460 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x022e, "Dell ", STAC_DELL_BIOS
),
2461 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x022f, "Dell Inspiron 1525", STAC_DELL_BIOS
),
2462 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0242, "Dell ", STAC_DELL_BIOS
),
2463 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0243, "Dell ", STAC_DELL_BIOS
),
2464 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02ff, "Dell ", STAC_DELL_BIOS
),
2465 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS
),
2466 /* 965 based 5 stack systems */
2467 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL
, 0xff00, 0x2300,
2468 "Intel D965", STAC_D965_5ST
),
2469 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL
, 0xff00, 0x2500,
2470 "Intel D965", STAC_D965_5ST
),
2471 /* volume-knob fixes */
2472 SND_PCI_QUIRK_VENDOR(0x10cf, "FSC", STAC_927X_VOLKNOB
),
2476 static const unsigned int ref9205_pin_configs
[12] = {
2477 0x40000100, 0x40000100, 0x01016011, 0x01014010,
2478 0x01813122, 0x01a19021, 0x01019020, 0x40000100,
2479 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030
2483 STAC 9205 pin configs for
2490 10280228 (Dell Vostro 1500)
2491 10280229 (Dell Vostro 1700)
2493 static const unsigned int dell_9205_m42_pin_configs
[12] = {
2494 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310,
2495 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9,
2496 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE,
2500 STAC 9205 pin configs for
2504 102801FF (Dell Precision M4300)
2509 static const unsigned int dell_9205_m43_pin_configs
[12] = {
2510 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310,
2511 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9,
2512 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8,
2515 static const unsigned int dell_9205_m44_pin_configs
[12] = {
2516 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310,
2517 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9,
2518 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe,
2521 static const unsigned int *stac9205_brd_tbl
[STAC_9205_MODELS
] = {
2522 [STAC_9205_REF
] = ref9205_pin_configs
,
2523 [STAC_9205_DELL_M42
] = dell_9205_m42_pin_configs
,
2524 [STAC_9205_DELL_M43
] = dell_9205_m43_pin_configs
,
2525 [STAC_9205_DELL_M44
] = dell_9205_m44_pin_configs
,
2526 [STAC_9205_EAPD
] = NULL
,
2529 static const char * const stac9205_models
[STAC_9205_MODELS
] = {
2530 [STAC_9205_AUTO
] = "auto",
2531 [STAC_9205_REF
] = "ref",
2532 [STAC_9205_DELL_M42
] = "dell-m42",
2533 [STAC_9205_DELL_M43
] = "dell-m43",
2534 [STAC_9205_DELL_M44
] = "dell-m44",
2535 [STAC_9205_EAPD
] = "eapd",
2538 static const struct snd_pci_quirk stac9205_cfg_tbl
[] = {
2539 /* SigmaTel reference board */
2540 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
2541 "DFI LanParty", STAC_9205_REF
),
2542 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0xfb30,
2543 "SigmaTel", STAC_9205_REF
),
2544 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI
, 0x3101,
2545 "DFI LanParty", STAC_9205_REF
),
2547 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f1,
2548 "unknown Dell", STAC_9205_DELL_M42
),
2549 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f2,
2550 "unknown Dell", STAC_9205_DELL_M42
),
2551 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f8,
2552 "Dell Precision", STAC_9205_DELL_M43
),
2553 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f9,
2554 "Dell Precision", STAC_9205_DELL_M43
),
2555 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01fa,
2556 "Dell Precision", STAC_9205_DELL_M43
),
2557 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01fc,
2558 "unknown Dell", STAC_9205_DELL_M42
),
2559 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01fd,
2560 "unknown Dell", STAC_9205_DELL_M42
),
2561 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01fe,
2562 "Dell Precision", STAC_9205_DELL_M43
),
2563 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ff,
2564 "Dell Precision M4300", STAC_9205_DELL_M43
),
2565 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0204,
2566 "unknown Dell", STAC_9205_DELL_M42
),
2567 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0206,
2568 "Dell Precision", STAC_9205_DELL_M43
),
2569 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x021b,
2570 "Dell Precision", STAC_9205_DELL_M43
),
2571 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x021c,
2572 "Dell Precision", STAC_9205_DELL_M43
),
2573 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x021f,
2574 "Dell Inspiron", STAC_9205_DELL_M44
),
2575 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0228,
2576 "Dell Vostro 1500", STAC_9205_DELL_M42
),
2577 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0229,
2578 "Dell Vostro 1700", STAC_9205_DELL_M42
),
2580 SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD
),
2581 SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD
),
2585 static void stac92xx_set_config_regs(struct hda_codec
*codec
,
2586 const unsigned int *pincfgs
)
2589 struct sigmatel_spec
*spec
= codec
->spec
;
2594 for (i
= 0; i
< spec
->num_pins
; i
++)
2595 if (spec
->pin_nids
[i
] && pincfgs
[i
])
2596 snd_hda_codec_set_pincfg(codec
, spec
->pin_nids
[i
],
2601 * Analog playback callbacks
2603 static int stac92xx_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2604 struct hda_codec
*codec
,
2605 struct snd_pcm_substream
*substream
)
2607 struct sigmatel_spec
*spec
= codec
->spec
;
2608 if (spec
->stream_delay
)
2609 msleep(spec
->stream_delay
);
2610 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
,
2614 static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2615 struct hda_codec
*codec
,
2616 unsigned int stream_tag
,
2617 unsigned int format
,
2618 struct snd_pcm_substream
*substream
)
2620 struct sigmatel_spec
*spec
= codec
->spec
;
2621 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
, stream_tag
, format
, substream
);
2624 static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2625 struct hda_codec
*codec
,
2626 struct snd_pcm_substream
*substream
)
2628 struct sigmatel_spec
*spec
= codec
->spec
;
2629 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
2633 * Digital playback callbacks
2635 static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2636 struct hda_codec
*codec
,
2637 struct snd_pcm_substream
*substream
)
2639 struct sigmatel_spec
*spec
= codec
->spec
;
2640 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
2643 static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
2644 struct hda_codec
*codec
,
2645 struct snd_pcm_substream
*substream
)
2647 struct sigmatel_spec
*spec
= codec
->spec
;
2648 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
2651 static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2652 struct hda_codec
*codec
,
2653 unsigned int stream_tag
,
2654 unsigned int format
,
2655 struct snd_pcm_substream
*substream
)
2657 struct sigmatel_spec
*spec
= codec
->spec
;
2658 return snd_hda_multi_out_dig_prepare(codec
, &spec
->multiout
,
2659 stream_tag
, format
, substream
);
2662 static int stac92xx_dig_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2663 struct hda_codec
*codec
,
2664 struct snd_pcm_substream
*substream
)
2666 struct sigmatel_spec
*spec
= codec
->spec
;
2667 return snd_hda_multi_out_dig_cleanup(codec
, &spec
->multiout
);
2672 * Analog capture callbacks
2674 static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2675 struct hda_codec
*codec
,
2676 unsigned int stream_tag
,
2677 unsigned int format
,
2678 struct snd_pcm_substream
*substream
)
2680 struct sigmatel_spec
*spec
= codec
->spec
;
2681 hda_nid_t nid
= spec
->adc_nids
[substream
->number
];
2683 if (spec
->powerdown_adcs
) {
2685 snd_hda_codec_write(codec
, nid
, 0,
2686 AC_VERB_SET_POWER_STATE
, AC_PWRST_D0
);
2688 snd_hda_codec_setup_stream(codec
, nid
, stream_tag
, 0, format
);
2692 static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2693 struct hda_codec
*codec
,
2694 struct snd_pcm_substream
*substream
)
2696 struct sigmatel_spec
*spec
= codec
->spec
;
2697 hda_nid_t nid
= spec
->adc_nids
[substream
->number
];
2699 snd_hda_codec_cleanup_stream(codec
, nid
);
2700 if (spec
->powerdown_adcs
)
2701 snd_hda_codec_write(codec
, nid
, 0,
2702 AC_VERB_SET_POWER_STATE
, AC_PWRST_D3
);
2706 static const struct hda_pcm_stream stac92xx_pcm_digital_playback
= {
2710 /* NID is set in stac92xx_build_pcms */
2712 .open
= stac92xx_dig_playback_pcm_open
,
2713 .close
= stac92xx_dig_playback_pcm_close
,
2714 .prepare
= stac92xx_dig_playback_pcm_prepare
,
2715 .cleanup
= stac92xx_dig_playback_pcm_cleanup
2719 static const struct hda_pcm_stream stac92xx_pcm_digital_capture
= {
2723 /* NID is set in stac92xx_build_pcms */
2726 static const struct hda_pcm_stream stac92xx_pcm_analog_playback
= {
2730 .nid
= 0x02, /* NID to query formats and rates */
2732 .open
= stac92xx_playback_pcm_open
,
2733 .prepare
= stac92xx_playback_pcm_prepare
,
2734 .cleanup
= stac92xx_playback_pcm_cleanup
2738 static const struct hda_pcm_stream stac92xx_pcm_analog_alt_playback
= {
2742 .nid
= 0x06, /* NID to query formats and rates */
2744 .open
= stac92xx_playback_pcm_open
,
2745 .prepare
= stac92xx_playback_pcm_prepare
,
2746 .cleanup
= stac92xx_playback_pcm_cleanup
2750 static const struct hda_pcm_stream stac92xx_pcm_analog_capture
= {
2753 /* NID + .substreams is set in stac92xx_build_pcms */
2755 .prepare
= stac92xx_capture_pcm_prepare
,
2756 .cleanup
= stac92xx_capture_pcm_cleanup
2760 static int stac92xx_build_pcms(struct hda_codec
*codec
)
2762 struct sigmatel_spec
*spec
= codec
->spec
;
2763 struct hda_pcm
*info
= spec
->pcm_rec
;
2765 codec
->num_pcms
= 1;
2766 codec
->pcm_info
= info
;
2768 info
->name
= "STAC92xx Analog";
2769 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = stac92xx_pcm_analog_playback
;
2770 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
=
2771 spec
->multiout
.dac_nids
[0];
2772 if (spec
->autocfg
.line_out_type
== AUTO_PIN_SPEAKER_OUT
&&
2773 spec
->autocfg
.line_outs
== 2)
2774 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].chmap
=
2777 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = stac92xx_pcm_analog_capture
;
2778 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
2779 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].substreams
= spec
->num_adcs
;
2781 if (spec
->alt_switch
) {
2784 info
->name
= "STAC92xx Analog Alt";
2785 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = stac92xx_pcm_analog_alt_playback
;
2788 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
2791 info
->name
= "STAC92xx Digital";
2792 info
->pcm_type
= spec
->autocfg
.dig_out_type
[0];
2793 if (spec
->multiout
.dig_out_nid
) {
2794 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = stac92xx_pcm_digital_playback
;
2795 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
2797 if (spec
->dig_in_nid
) {
2798 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = stac92xx_pcm_digital_capture
;
2799 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
2806 static void stac92xx_auto_set_pinctl(struct hda_codec
*codec
, hda_nid_t nid
, int pin_type
)
2809 snd_hda_set_pin_ctl_cache(codec
, nid
, pin_type
);
2812 #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info
2814 static int stac92xx_hp_switch_get(struct snd_kcontrol
*kcontrol
,
2815 struct snd_ctl_elem_value
*ucontrol
)
2817 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2818 struct sigmatel_spec
*spec
= codec
->spec
;
2820 ucontrol
->value
.integer
.value
[0] = !!spec
->hp_switch
;
2824 static void stac_issue_unsol_event(struct hda_codec
*codec
, hda_nid_t nid
);
2826 static int stac92xx_hp_switch_put(struct snd_kcontrol
*kcontrol
,
2827 struct snd_ctl_elem_value
*ucontrol
)
2829 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2830 struct sigmatel_spec
*spec
= codec
->spec
;
2831 int nid
= kcontrol
->private_value
;
2833 spec
->hp_switch
= ucontrol
->value
.integer
.value
[0] ? nid
: 0;
2835 /* check to be sure that the ports are up to date with
2838 stac_issue_unsol_event(codec
, nid
);
2843 static int stac92xx_dc_bias_info(struct snd_kcontrol
*kcontrol
,
2844 struct snd_ctl_elem_info
*uinfo
)
2847 static const char * const texts
[] = {
2848 "Mic In", "Line In", "Line Out"
2851 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2852 struct sigmatel_spec
*spec
= codec
->spec
;
2853 hda_nid_t nid
= kcontrol
->private_value
;
2855 if (nid
== spec
->mic_switch
|| nid
== spec
->line_switch
)
2860 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
2861 uinfo
->value
.enumerated
.items
= i
;
2863 if (uinfo
->value
.enumerated
.item
>= i
)
2864 uinfo
->value
.enumerated
.item
= i
-1;
2865 strcpy(uinfo
->value
.enumerated
.name
,
2866 texts
[uinfo
->value
.enumerated
.item
]);
2871 static int stac92xx_dc_bias_get(struct snd_kcontrol
*kcontrol
,
2872 struct snd_ctl_elem_value
*ucontrol
)
2874 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2875 hda_nid_t nid
= kcontrol
->private_value
;
2876 unsigned int vref
= stac92xx_vref_get(codec
, nid
);
2878 if (vref
== snd_hda_get_default_vref(codec
, nid
))
2879 ucontrol
->value
.enumerated
.item
[0] = 0;
2880 else if (vref
== AC_PINCTL_VREF_GRD
)
2881 ucontrol
->value
.enumerated
.item
[0] = 1;
2882 else if (vref
== AC_PINCTL_VREF_HIZ
)
2883 ucontrol
->value
.enumerated
.item
[0] = 2;
2888 static int stac92xx_dc_bias_put(struct snd_kcontrol
*kcontrol
,
2889 struct snd_ctl_elem_value
*ucontrol
)
2891 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2892 unsigned int new_vref
= 0;
2894 hda_nid_t nid
= kcontrol
->private_value
;
2896 if (ucontrol
->value
.enumerated
.item
[0] == 0)
2897 new_vref
= snd_hda_get_default_vref(codec
, nid
);
2898 else if (ucontrol
->value
.enumerated
.item
[0] == 1)
2899 new_vref
= AC_PINCTL_VREF_GRD
;
2900 else if (ucontrol
->value
.enumerated
.item
[0] == 2)
2901 new_vref
= AC_PINCTL_VREF_HIZ
;
2905 if (new_vref
!= stac92xx_vref_get(codec
, nid
)) {
2906 error
= stac92xx_vref_set(codec
, nid
, new_vref
);
2913 static int stac92xx_io_switch_info(struct snd_kcontrol
*kcontrol
,
2914 struct snd_ctl_elem_info
*uinfo
)
2917 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2918 struct sigmatel_spec
*spec
= codec
->spec
;
2920 if (kcontrol
->private_value
== spec
->line_switch
)
2921 texts
[0] = "Line In";
2923 texts
[0] = "Mic In";
2924 texts
[1] = "Line Out";
2925 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
2926 uinfo
->value
.enumerated
.items
= 2;
2929 if (uinfo
->value
.enumerated
.item
>= 2)
2930 uinfo
->value
.enumerated
.item
= 1;
2931 strcpy(uinfo
->value
.enumerated
.name
,
2932 texts
[uinfo
->value
.enumerated
.item
]);
2937 static int stac92xx_io_switch_get(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
2939 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2940 struct sigmatel_spec
*spec
= codec
->spec
;
2941 hda_nid_t nid
= kcontrol
->private_value
;
2942 int io_idx
= (nid
== spec
->mic_switch
) ? 1 : 0;
2944 ucontrol
->value
.enumerated
.item
[0] = spec
->io_switch
[io_idx
];
2948 static int stac92xx_io_switch_put(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
2950 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2951 struct sigmatel_spec
*spec
= codec
->spec
;
2952 hda_nid_t nid
= kcontrol
->private_value
;
2953 int io_idx
= (nid
== spec
->mic_switch
) ? 1 : 0;
2954 unsigned short val
= !!ucontrol
->value
.enumerated
.item
[0];
2956 spec
->io_switch
[io_idx
] = val
;
2959 stac92xx_auto_set_pinctl(codec
, nid
, AC_PINCTL_OUT_EN
);
2961 unsigned int pinctl
= AC_PINCTL_IN_EN
;
2962 if (io_idx
) /* set VREF for mic */
2963 pinctl
|= snd_hda_get_default_vref(codec
, nid
);
2964 stac92xx_auto_set_pinctl(codec
, nid
, pinctl
);
2967 /* check the auto-mute again: we need to mute/unmute the speaker
2968 * appropriately according to the pin direction
2970 if (spec
->hp_detect
)
2971 stac_issue_unsol_event(codec
, nid
);
2976 #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info
2978 static int stac92xx_clfe_switch_get(struct snd_kcontrol
*kcontrol
,
2979 struct snd_ctl_elem_value
*ucontrol
)
2981 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2982 struct sigmatel_spec
*spec
= codec
->spec
;
2984 ucontrol
->value
.integer
.value
[0] = spec
->clfe_swap
;
2988 static int stac92xx_clfe_switch_put(struct snd_kcontrol
*kcontrol
,
2989 struct snd_ctl_elem_value
*ucontrol
)
2991 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2992 struct sigmatel_spec
*spec
= codec
->spec
;
2993 hda_nid_t nid
= kcontrol
->private_value
& 0xff;
2994 unsigned int val
= !!ucontrol
->value
.integer
.value
[0];
2996 if (spec
->clfe_swap
== val
)
2999 spec
->clfe_swap
= val
;
3001 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
3002 spec
->clfe_swap
? 0x4 : 0x0);
3007 #define STAC_CODEC_HP_SWITCH(xname) \
3008 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3011 .info = stac92xx_hp_switch_info, \
3012 .get = stac92xx_hp_switch_get, \
3013 .put = stac92xx_hp_switch_put, \
3016 #define STAC_CODEC_IO_SWITCH(xname, xpval) \
3017 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3020 .info = stac92xx_io_switch_info, \
3021 .get = stac92xx_io_switch_get, \
3022 .put = stac92xx_io_switch_put, \
3023 .private_value = xpval, \
3026 #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \
3027 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3030 .info = stac92xx_clfe_switch_info, \
3031 .get = stac92xx_clfe_switch_get, \
3032 .put = stac92xx_clfe_switch_put, \
3033 .private_value = xpval, \
3037 STAC_CTL_WIDGET_VOL
,
3038 STAC_CTL_WIDGET_MUTE
,
3039 STAC_CTL_WIDGET_MUTE_BEEP
,
3040 STAC_CTL_WIDGET_MONO_MUX
,
3041 STAC_CTL_WIDGET_HP_SWITCH
,
3042 STAC_CTL_WIDGET_IO_SWITCH
,
3043 STAC_CTL_WIDGET_CLFE_SWITCH
,
3044 STAC_CTL_WIDGET_DC_BIAS
3047 static const struct snd_kcontrol_new stac92xx_control_templates
[] = {
3048 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
3049 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
3050 HDA_CODEC_MUTE_BEEP(NULL
, 0, 0, 0),
3052 STAC_CODEC_HP_SWITCH(NULL
),
3053 STAC_CODEC_IO_SWITCH(NULL
, 0),
3054 STAC_CODEC_CLFE_SWITCH(NULL
, 0),
3055 DC_BIAS(NULL
, 0, 0),
3058 /* add dynamic controls */
3059 static struct snd_kcontrol_new
*
3060 stac_control_new(struct sigmatel_spec
*spec
,
3061 const struct snd_kcontrol_new
*ktemp
,
3063 unsigned int subdev
)
3065 struct snd_kcontrol_new
*knew
;
3067 knew
= snd_array_new(&spec
->kctls
);
3071 knew
->name
= kstrdup(name
, GFP_KERNEL
);
3074 memset(knew
, 0, sizeof(*knew
));
3075 spec
->kctls
.alloced
--;
3078 knew
->subdevice
= subdev
;
3082 static struct snd_kcontrol_new
*
3083 add_control_temp(struct sigmatel_spec
*spec
,
3084 const struct snd_kcontrol_new
*ktemp
,
3085 int idx
, const char *name
,
3088 struct snd_kcontrol_new
*knew
= stac_control_new(spec
, ktemp
, name
,
3089 HDA_SUBDEV_AMP_FLAG
);
3093 knew
->private_value
= val
;
3097 static int stac92xx_add_control_temp(struct sigmatel_spec
*spec
,
3098 const struct snd_kcontrol_new
*ktemp
,
3099 int idx
, const char *name
,
3102 return add_control_temp(spec
, ktemp
, idx
, name
, val
) ? 0 : -ENOMEM
;
3105 static inline int stac92xx_add_control_idx(struct sigmatel_spec
*spec
,
3106 int type
, int idx
, const char *name
,
3109 return stac92xx_add_control_temp(spec
,
3110 &stac92xx_control_templates
[type
],
3115 /* add dynamic controls */
3116 static inline int stac92xx_add_control(struct sigmatel_spec
*spec
, int type
,
3117 const char *name
, unsigned long val
)
3119 return stac92xx_add_control_idx(spec
, type
, 0, name
, val
);
3122 static const struct snd_kcontrol_new stac_input_src_temp
= {
3123 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3124 .name
= "Input Source",
3125 .info
= stac92xx_mux_enum_info
,
3126 .get
= stac92xx_mux_enum_get
,
3127 .put
= stac92xx_mux_enum_put
,
3130 static inline int stac92xx_add_jack_mode_control(struct hda_codec
*codec
,
3131 hda_nid_t nid
, int idx
)
3133 int def_conf
= snd_hda_codec_get_pincfg(codec
, nid
);
3135 struct sigmatel_spec
*spec
= codec
->spec
;
3138 if (snd_hda_get_input_pin_attr(def_conf
) != INPUT_PIN_ATTR_INT
) {
3139 if (spec
->headset_jack
&& snd_hda_get_input_pin_attr(def_conf
)
3140 != INPUT_PIN_ATTR_DOCK
)
3142 if (snd_hda_get_default_vref(codec
, nid
) == AC_PINCTL_VREF_GRD
3143 && nid
== spec
->line_switch
)
3144 control
= STAC_CTL_WIDGET_IO_SWITCH
;
3145 else if (snd_hda_query_pin_caps(codec
, nid
)
3146 & (AC_PINCAP_VREF_GRD
<< AC_PINCAP_VREF_SHIFT
))
3147 control
= STAC_CTL_WIDGET_DC_BIAS
;
3148 else if (nid
== spec
->mic_switch
)
3149 control
= STAC_CTL_WIDGET_IO_SWITCH
;
3153 snd_hda_get_pin_label(codec
, nid
, &spec
->autocfg
,
3154 name
, sizeof(name
), NULL
);
3155 return stac92xx_add_control(codec
->spec
, control
,
3156 strcat(name
, " Jack Mode"), nid
);
3162 static int stac92xx_add_input_source(struct sigmatel_spec
*spec
)
3164 struct snd_kcontrol_new
*knew
;
3165 struct hda_input_mux
*imux
= &spec
->private_imux
;
3168 return 0; /* no need for input source */
3169 if (!spec
->num_adcs
|| imux
->num_items
<= 1)
3170 return 0; /* no need for input source control */
3171 knew
= stac_control_new(spec
, &stac_input_src_temp
,
3172 stac_input_src_temp
.name
, 0);
3175 knew
->count
= spec
->num_adcs
;
3179 /* check whether the line-input can be used as line-out */
3180 static hda_nid_t
check_line_out_switch(struct hda_codec
*codec
)
3182 struct sigmatel_spec
*spec
= codec
->spec
;
3183 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
3185 unsigned int pincap
;
3188 if (cfg
->line_out_type
!= AUTO_PIN_LINE_OUT
)
3190 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
3191 if (cfg
->inputs
[i
].type
== AUTO_PIN_LINE_IN
) {
3192 nid
= cfg
->inputs
[i
].pin
;
3193 pincap
= snd_hda_query_pin_caps(codec
, nid
);
3194 if (pincap
& AC_PINCAP_OUT
)
3201 static hda_nid_t
get_unassigned_dac(struct hda_codec
*codec
, hda_nid_t nid
);
3203 /* check whether the mic-input can be used as line-out */
3204 static hda_nid_t
check_mic_out_switch(struct hda_codec
*codec
, hda_nid_t
*dac
)
3206 struct sigmatel_spec
*spec
= codec
->spec
;
3207 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
3208 unsigned int def_conf
, pincap
;
3212 if (cfg
->line_out_type
!= AUTO_PIN_LINE_OUT
)
3214 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
3215 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
3216 if (cfg
->inputs
[i
].type
!= AUTO_PIN_MIC
)
3218 def_conf
= snd_hda_codec_get_pincfg(codec
, nid
);
3219 /* some laptops have an internal analog microphone
3220 * which can't be used as a output */
3221 if (snd_hda_get_input_pin_attr(def_conf
) != INPUT_PIN_ATTR_INT
) {
3222 pincap
= snd_hda_query_pin_caps(codec
, nid
);
3223 if (pincap
& AC_PINCAP_OUT
) {
3224 *dac
= get_unassigned_dac(codec
, nid
);
3233 static int is_in_dac_nids(struct sigmatel_spec
*spec
, hda_nid_t nid
)
3237 for (i
= 0; i
< spec
->multiout
.num_dacs
; i
++) {
3238 if (spec
->multiout
.dac_nids
[i
] == nid
)
3245 static int check_all_dac_nids(struct sigmatel_spec
*spec
, hda_nid_t nid
)
3248 if (is_in_dac_nids(spec
, nid
))
3250 for (i
= 0; i
< spec
->autocfg
.hp_outs
; i
++)
3251 if (spec
->hp_dacs
[i
] == nid
)
3253 for (i
= 0; i
< spec
->autocfg
.speaker_outs
; i
++)
3254 if (spec
->speaker_dacs
[i
] == nid
)
3259 static hda_nid_t
get_unassigned_dac(struct hda_codec
*codec
, hda_nid_t nid
)
3261 struct sigmatel_spec
*spec
= codec
->spec
;
3262 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
3264 hda_nid_t conn
[HDA_MAX_CONNECTIONS
], fallback_dac
;
3265 unsigned int wcaps
, wtype
;
3267 conn_len
= snd_hda_get_connections(codec
, nid
, conn
,
3268 HDA_MAX_CONNECTIONS
);
3269 /* 92HD88: trace back up the link of nids to find the DAC */
3270 while (conn_len
== 1 && (get_wcaps_type(get_wcaps(codec
, conn
[0]))
3271 != AC_WID_AUD_OUT
)) {
3273 conn_len
= snd_hda_get_connections(codec
, nid
, conn
,
3274 HDA_MAX_CONNECTIONS
);
3276 for (j
= 0; j
< conn_len
; j
++) {
3277 wcaps
= get_wcaps(codec
, conn
[j
]);
3278 wtype
= get_wcaps_type(wcaps
);
3279 /* we check only analog outputs */
3280 if (wtype
!= AC_WID_AUD_OUT
|| (wcaps
& AC_WCAP_DIGITAL
))
3282 /* if this route has a free DAC, assign it */
3283 if (!check_all_dac_nids(spec
, conn
[j
])) {
3285 /* select this DAC in the pin's input mux */
3286 snd_hda_codec_write_cache(codec
, nid
, 0,
3287 AC_VERB_SET_CONNECT_SEL
, j
);
3293 /* if all DACs are already assigned, connect to the primary DAC,
3294 unless we're assigning a secondary headphone */
3295 fallback_dac
= spec
->multiout
.dac_nids
[0];
3296 if (spec
->multiout
.hp_nid
) {
3297 for (j
= 0; j
< cfg
->hp_outs
; j
++)
3298 if (cfg
->hp_pins
[j
] == nid
) {
3299 fallback_dac
= spec
->multiout
.hp_nid
;
3305 for (j
= 0; j
< conn_len
; j
++) {
3306 if (conn
[j
] == fallback_dac
) {
3307 snd_hda_codec_write_cache(codec
, nid
, 0,
3308 AC_VERB_SET_CONNECT_SEL
, j
);
3316 static int add_spec_dacs(struct sigmatel_spec
*spec
, hda_nid_t nid
);
3317 static int add_spec_extra_dacs(struct sigmatel_spec
*spec
, hda_nid_t nid
);
3320 * Fill in the dac_nids table from the parsed pin configuration
3321 * This function only works when every pin in line_out_pins[]
3322 * contains atleast one DAC in its connection list. Some 92xx
3323 * codecs are not connected directly to a DAC, such as the 9200
3324 * and 9202/925x. For those, dac_nids[] must be hard-coded.
3326 static int stac92xx_auto_fill_dac_nids(struct hda_codec
*codec
)
3328 struct sigmatel_spec
*spec
= codec
->spec
;
3329 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
3333 for (i
= 0; i
< cfg
->line_outs
; i
++) {
3334 nid
= cfg
->line_out_pins
[i
];
3335 dac
= get_unassigned_dac(codec
, nid
);
3337 if (spec
->multiout
.num_dacs
> 0) {
3338 /* we have already working output pins,
3339 * so let's drop the broken ones again
3341 cfg
->line_outs
= spec
->multiout
.num_dacs
;
3344 /* error out, no available DAC found */
3346 "%s: No available DAC for pin 0x%x\n",
3350 add_spec_dacs(spec
, dac
);
3353 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
3354 nid
= cfg
->hp_pins
[i
];
3355 dac
= get_unassigned_dac(codec
, nid
);
3357 if (!spec
->multiout
.hp_nid
)
3358 spec
->multiout
.hp_nid
= dac
;
3360 add_spec_extra_dacs(spec
, dac
);
3362 spec
->hp_dacs
[i
] = dac
;
3365 for (i
= 0; i
< cfg
->speaker_outs
; i
++) {
3366 nid
= cfg
->speaker_pins
[i
];
3367 dac
= get_unassigned_dac(codec
, nid
);
3369 add_spec_extra_dacs(spec
, dac
);
3370 spec
->speaker_dacs
[i
] = dac
;
3373 /* add line-in as output */
3374 nid
= check_line_out_switch(codec
);
3376 dac
= get_unassigned_dac(codec
, nid
);
3378 snd_printdd("STAC: Add line-in 0x%x as output %d\n",
3379 nid
, cfg
->line_outs
);
3380 cfg
->line_out_pins
[cfg
->line_outs
] = nid
;
3382 spec
->line_switch
= nid
;
3383 add_spec_dacs(spec
, dac
);
3386 /* add mic as output */
3387 nid
= check_mic_out_switch(codec
, &dac
);
3389 snd_printdd("STAC: Add mic-in 0x%x as output %d\n",
3390 nid
, cfg
->line_outs
);
3391 cfg
->line_out_pins
[cfg
->line_outs
] = nid
;
3393 spec
->mic_switch
= nid
;
3394 add_spec_dacs(spec
, dac
);
3397 snd_printd("stac92xx: dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
3398 spec
->multiout
.num_dacs
,
3399 spec
->multiout
.dac_nids
[0],
3400 spec
->multiout
.dac_nids
[1],
3401 spec
->multiout
.dac_nids
[2],
3402 spec
->multiout
.dac_nids
[3],
3403 spec
->multiout
.dac_nids
[4]);
3408 /* create volume control/switch for the given prefx type */
3409 static int create_controls_idx(struct hda_codec
*codec
, const char *pfx
,
3410 int idx
, hda_nid_t nid
, int chs
)
3412 struct sigmatel_spec
*spec
= codec
->spec
;
3416 if (!spec
->check_volume_offset
) {
3417 unsigned int caps
, step
, nums
, db_scale
;
3418 caps
= query_amp_caps(codec
, nid
, HDA_OUTPUT
);
3419 step
= (caps
& AC_AMPCAP_STEP_SIZE
) >>
3420 AC_AMPCAP_STEP_SIZE_SHIFT
;
3421 step
= (step
+ 1) * 25; /* in .01dB unit */
3422 nums
= (caps
& AC_AMPCAP_NUM_STEPS
) >>
3423 AC_AMPCAP_NUM_STEPS_SHIFT
;
3424 db_scale
= nums
* step
;
3425 /* if dB scale is over -64dB, and finer enough,
3426 * let's reduce it to half
3428 if (db_scale
> 6400 && nums
>= 0x1f)
3429 spec
->volume_offset
= nums
/ 2;
3430 spec
->check_volume_offset
= 1;
3433 sprintf(name
, "%s Playback Volume", pfx
);
3434 err
= stac92xx_add_control_idx(spec
, STAC_CTL_WIDGET_VOL
, idx
, name
,
3435 HDA_COMPOSE_AMP_VAL_OFS(nid
, chs
, 0, HDA_OUTPUT
,
3436 spec
->volume_offset
));
3439 sprintf(name
, "%s Playback Switch", pfx
);
3440 err
= stac92xx_add_control_idx(spec
, STAC_CTL_WIDGET_MUTE
, idx
, name
,
3441 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_OUTPUT
));
3447 #define create_controls(codec, pfx, nid, chs) \
3448 create_controls_idx(codec, pfx, 0, nid, chs)
3450 static int add_spec_dacs(struct sigmatel_spec
*spec
, hda_nid_t nid
)
3452 if (spec
->multiout
.num_dacs
> 4) {
3453 printk(KERN_WARNING
"stac92xx: No space for DAC 0x%x\n", nid
);
3456 snd_BUG_ON(spec
->multiout
.dac_nids
!= spec
->dac_nids
);
3457 spec
->dac_nids
[spec
->multiout
.num_dacs
] = nid
;
3458 spec
->multiout
.num_dacs
++;
3463 static int add_spec_extra_dacs(struct sigmatel_spec
*spec
, hda_nid_t nid
)
3466 for (i
= 0; i
< ARRAY_SIZE(spec
->multiout
.extra_out_nid
); i
++) {
3467 if (!spec
->multiout
.extra_out_nid
[i
]) {
3468 spec
->multiout
.extra_out_nid
[i
] = nid
;
3472 printk(KERN_WARNING
"stac92xx: No space for extra DAC 0x%x\n", nid
);
3476 /* Create output controls
3477 * The mixer elements are named depending on the given type (AUTO_PIN_XXX_OUT)
3479 static int create_multi_out_ctls(struct hda_codec
*codec
, int num_outs
,
3480 const hda_nid_t
*pins
,
3481 const hda_nid_t
*dac_nids
,
3484 struct sigmatel_spec
*spec
= codec
->spec
;
3485 static const char * const chname
[4] = {
3486 "Front", "Surround", NULL
/*CLFE*/, "Side"
3490 unsigned int wid_caps
;
3492 for (i
= 0; i
< num_outs
&& i
< ARRAY_SIZE(chname
); i
++) {
3493 if (type
== AUTO_PIN_HP_OUT
&& !spec
->hp_detect
) {
3494 if (is_jack_detectable(codec
, pins
[i
]))
3495 spec
->hp_detect
= 1;
3500 if (type
!= AUTO_PIN_HP_OUT
&& i
== 2) {
3502 err
= create_controls(codec
, "Center", nid
, 1);
3505 err
= create_controls(codec
, "LFE", nid
, 2);
3509 wid_caps
= get_wcaps(codec
, nid
);
3511 if (wid_caps
& AC_WCAP_LR_SWAP
) {
3512 err
= stac92xx_add_control(spec
,
3513 STAC_CTL_WIDGET_CLFE_SWITCH
,
3514 "Swap Center/LFE Playback Switch", nid
);
3524 case AUTO_PIN_HP_OUT
:
3528 case AUTO_PIN_SPEAKER_OUT
:
3529 if (num_outs
<= 2) {
3530 name
= i
? "Bass Speaker" : "Speaker";
3534 /* Fall through in case of multi speaker outs */
3540 err
= create_controls_idx(codec
, name
, idx
, nid
, 3);
3548 static void stac_gpio_set(struct hda_codec
*codec
, unsigned int mask
,
3549 unsigned int dir_mask
, unsigned int data
);
3551 /* hook for controlling mic-mute LED GPIO */
3552 static int stac92xx_capture_sw_put_led(struct snd_kcontrol
*kcontrol
,
3553 struct snd_ctl_elem_value
*ucontrol
)
3555 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3556 struct sigmatel_spec
*spec
= codec
->spec
;
3560 err
= snd_hda_mixer_amp_switch_put(kcontrol
, ucontrol
);
3563 mute
= !(ucontrol
->value
.integer
.value
[0] &&
3564 ucontrol
->value
.integer
.value
[1]);
3565 if (spec
->mic_mute_led_on
!= mute
) {
3566 spec
->mic_mute_led_on
= mute
;
3568 spec
->gpio_data
|= spec
->mic_mute_led_gpio
;
3570 spec
->gpio_data
&= ~spec
->mic_mute_led_gpio
;
3571 stac_gpio_set(codec
, spec
->gpio_mask
,
3572 spec
->gpio_dir
, spec
->gpio_data
);
3577 static int stac92xx_add_capvol_ctls(struct hda_codec
*codec
, unsigned long vol
,
3578 unsigned long sw
, int idx
)
3580 struct sigmatel_spec
*spec
= codec
->spec
;
3581 struct snd_kcontrol_new
*knew
;
3584 err
= stac92xx_add_control_idx(codec
->spec
, STAC_CTL_WIDGET_VOL
, idx
,
3585 "Capture Volume", vol
);
3589 knew
= add_control_temp(spec
,
3590 &stac92xx_control_templates
[STAC_CTL_WIDGET_MUTE
],
3591 idx
, "Capture Switch", sw
);
3594 /* add a LED hook for some HP laptops */
3595 if (spec
->mic_mute_led_gpio
)
3596 knew
->put
= stac92xx_capture_sw_put_led
;
3601 /* add playback controls from the parsed DAC table */
3602 static int stac92xx_auto_create_multi_out_ctls(struct hda_codec
*codec
,
3603 const struct auto_pin_cfg
*cfg
)
3605 struct sigmatel_spec
*spec
= codec
->spec
;
3610 err
= create_multi_out_ctls(codec
, cfg
->line_outs
, cfg
->line_out_pins
,
3611 spec
->multiout
.dac_nids
,
3612 cfg
->line_out_type
);
3616 if (cfg
->hp_outs
> 1 && cfg
->line_out_type
== AUTO_PIN_LINE_OUT
) {
3617 err
= stac92xx_add_control(spec
,
3618 STAC_CTL_WIDGET_HP_SWITCH
,
3619 "Headphone as Line Out Switch",
3620 cfg
->hp_pins
[cfg
->hp_outs
- 1]);
3625 for (idx
= 0; idx
< cfg
->num_inputs
; idx
++) {
3626 if (cfg
->inputs
[idx
].type
> AUTO_PIN_LINE_IN
)
3628 nid
= cfg
->inputs
[idx
].pin
;
3629 err
= stac92xx_add_jack_mode_control(codec
, nid
, idx
);
3637 /* add playback controls for Speaker and HP outputs */
3638 static int stac92xx_auto_create_hp_ctls(struct hda_codec
*codec
,
3639 struct auto_pin_cfg
*cfg
)
3641 struct sigmatel_spec
*spec
= codec
->spec
;
3644 err
= create_multi_out_ctls(codec
, cfg
->hp_outs
, cfg
->hp_pins
,
3645 spec
->hp_dacs
, AUTO_PIN_HP_OUT
);
3649 err
= create_multi_out_ctls(codec
, cfg
->speaker_outs
, cfg
->speaker_pins
,
3650 spec
->speaker_dacs
, AUTO_PIN_SPEAKER_OUT
);
3657 /* labels for mono mux outputs */
3658 static const char * const stac92xx_mono_labels
[4] = {
3659 "DAC0", "DAC1", "Mixer", "DAC2"
3662 /* create mono mux for mono out on capable codecs */
3663 static int stac92xx_auto_create_mono_output_ctls(struct hda_codec
*codec
)
3665 struct sigmatel_spec
*spec
= codec
->spec
;
3666 struct hda_input_mux
*mono_mux
= &spec
->private_mono_mux
;
3668 hda_nid_t con_lst
[ARRAY_SIZE(stac92xx_mono_labels
)];
3670 num_cons
= snd_hda_get_connections(codec
,
3673 HDA_MAX_NUM_INPUTS
);
3674 if (num_cons
<= 0 || num_cons
> ARRAY_SIZE(stac92xx_mono_labels
))
3677 for (i
= 0; i
< num_cons
; i
++)
3678 snd_hda_add_imux_item(mono_mux
, stac92xx_mono_labels
[i
], i
,
3681 return stac92xx_add_control(spec
, STAC_CTL_WIDGET_MONO_MUX
,
3682 "Mono Mux", spec
->mono_nid
);
3685 /* create PC beep volume controls */
3686 static int stac92xx_auto_create_beep_ctls(struct hda_codec
*codec
,
3689 struct sigmatel_spec
*spec
= codec
->spec
;
3690 u32 caps
= query_amp_caps(codec
, nid
, HDA_OUTPUT
);
3691 int err
, type
= STAC_CTL_WIDGET_MUTE_BEEP
;
3693 if (spec
->anabeep_nid
== nid
)
3694 type
= STAC_CTL_WIDGET_MUTE
;
3696 /* check for mute support for the the amp */
3697 if ((caps
& AC_AMPCAP_MUTE
) >> AC_AMPCAP_MUTE_SHIFT
) {
3698 err
= stac92xx_add_control(spec
, type
,
3699 "Beep Playback Switch",
3700 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, HDA_OUTPUT
));
3705 /* check to see if there is volume support for the amp */
3706 if ((caps
& AC_AMPCAP_NUM_STEPS
) >> AC_AMPCAP_NUM_STEPS_SHIFT
) {
3707 err
= stac92xx_add_control(spec
, STAC_CTL_WIDGET_VOL
,
3708 "Beep Playback Volume",
3709 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, HDA_OUTPUT
));
3716 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3717 #define stac92xx_dig_beep_switch_info snd_ctl_boolean_mono_info
3719 static int stac92xx_dig_beep_switch_get(struct snd_kcontrol
*kcontrol
,
3720 struct snd_ctl_elem_value
*ucontrol
)
3722 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3723 ucontrol
->value
.integer
.value
[0] = codec
->beep
->enabled
;
3727 static int stac92xx_dig_beep_switch_put(struct snd_kcontrol
*kcontrol
,
3728 struct snd_ctl_elem_value
*ucontrol
)
3730 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3731 return snd_hda_enable_beep_device(codec
, ucontrol
->value
.integer
.value
[0]);
3734 static const struct snd_kcontrol_new stac92xx_dig_beep_ctrl
= {
3735 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3736 .info
= stac92xx_dig_beep_switch_info
,
3737 .get
= stac92xx_dig_beep_switch_get
,
3738 .put
= stac92xx_dig_beep_switch_put
,
3741 static int stac92xx_beep_switch_ctl(struct hda_codec
*codec
)
3743 return stac92xx_add_control_temp(codec
->spec
, &stac92xx_dig_beep_ctrl
,
3744 0, "Beep Playback Switch", 0);
3748 static int stac92xx_auto_create_mux_input_ctls(struct hda_codec
*codec
)
3750 struct sigmatel_spec
*spec
= codec
->spec
;
3753 for (i
= 0; i
< spec
->num_muxes
; i
++) {
3758 nid
= spec
->mux_nids
[i
];
3759 wcaps
= get_wcaps(codec
, nid
);
3760 if (!(wcaps
& AC_WCAP_OUT_AMP
))
3763 /* check whether already the same control was created as
3764 * normal Capture Volume.
3766 val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
3767 for (j
= 0; j
< spec
->num_caps
; j
++) {
3768 if (spec
->capvols
[j
] == val
)
3771 if (j
< spec
->num_caps
)
3774 err
= stac92xx_add_control_idx(spec
, STAC_CTL_WIDGET_VOL
, i
,
3775 "Mux Capture Volume", val
);
3782 static const char * const stac92xx_spdif_labels
[3] = {
3783 "Digital Playback", "Analog Mux 1", "Analog Mux 2",
3786 static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec
*codec
)
3788 struct sigmatel_spec
*spec
= codec
->spec
;
3789 struct hda_input_mux
*spdif_mux
= &spec
->private_smux
;
3790 const char * const *labels
= spec
->spdif_labels
;
3792 hda_nid_t con_lst
[HDA_MAX_NUM_INPUTS
];
3794 num_cons
= snd_hda_get_connections(codec
,
3797 HDA_MAX_NUM_INPUTS
);
3802 labels
= stac92xx_spdif_labels
;
3804 for (i
= 0; i
< num_cons
; i
++)
3805 snd_hda_add_imux_item(spdif_mux
, labels
[i
], i
, NULL
);
3810 /* labels for dmic mux inputs */
3811 static const char * const stac92xx_dmic_labels
[5] = {
3812 "Analog Inputs", "Digital Mic 1", "Digital Mic 2",
3813 "Digital Mic 3", "Digital Mic 4"
3816 static hda_nid_t
get_connected_node(struct hda_codec
*codec
, hda_nid_t mux
,
3819 hda_nid_t conn
[HDA_MAX_NUM_INPUTS
];
3821 nums
= snd_hda_get_connections(codec
, mux
, conn
, ARRAY_SIZE(conn
));
3822 if (idx
>= 0 && idx
< nums
)
3827 /* look for NID recursively */
3828 #define get_connection_index(codec, mux, nid) \
3829 snd_hda_get_conn_index(codec, mux, nid, 1)
3831 /* create a volume assigned to the given pin (only if supported) */
3832 /* return 1 if the volume control is created */
3833 static int create_elem_capture_vol(struct hda_codec
*codec
, hda_nid_t nid
,
3834 const char *label
, int idx
, int direction
)
3836 unsigned int caps
, nums
;
3840 if (direction
== HDA_OUTPUT
)
3841 caps
= AC_WCAP_OUT_AMP
;
3843 caps
= AC_WCAP_IN_AMP
;
3844 if (!(get_wcaps(codec
, nid
) & caps
))
3846 caps
= query_amp_caps(codec
, nid
, direction
);
3847 nums
= (caps
& AC_AMPCAP_NUM_STEPS
) >> AC_AMPCAP_NUM_STEPS_SHIFT
;
3850 snprintf(name
, sizeof(name
), "%s Capture Volume", label
);
3851 err
= stac92xx_add_control_idx(codec
->spec
, STAC_CTL_WIDGET_VOL
, idx
, name
,
3852 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, direction
));
3858 /* create playback/capture controls for input pins on dmic capable codecs */
3859 static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec
*codec
,
3860 const struct auto_pin_cfg
*cfg
)
3862 struct sigmatel_spec
*spec
= codec
->spec
;
3863 struct hda_input_mux
*imux
= &spec
->private_imux
;
3864 struct hda_input_mux
*dimux
= &spec
->private_dimux
;
3866 unsigned int def_conf
;
3868 snd_hda_add_imux_item(dimux
, stac92xx_dmic_labels
[0], 0, NULL
);
3870 for (i
= 0; i
< spec
->num_dmics
; i
++) {
3872 int index
, type_idx
;
3875 nid
= spec
->dmic_nids
[i
];
3876 if (get_wcaps_type(get_wcaps(codec
, nid
)) != AC_WID_PIN
)
3878 def_conf
= snd_hda_codec_get_pincfg(codec
, nid
);
3879 if (get_defcfg_connect(def_conf
) == AC_JACK_PORT_NONE
)
3882 index
= get_connection_index(codec
, spec
->dmux_nids
[0], nid
);
3886 snd_hda_get_pin_label(codec
, nid
, &spec
->autocfg
,
3887 label
, sizeof(label
), NULL
);
3888 snd_hda_add_imux_item(dimux
, label
, index
, &type_idx
);
3889 if (snd_hda_get_bool_hint(codec
, "separate_dmux") != 1)
3890 snd_hda_add_imux_item(imux
, label
, index
, &type_idx
);
3892 err
= create_elem_capture_vol(codec
, nid
, label
, type_idx
,
3897 err
= create_elem_capture_vol(codec
, nid
, label
,
3898 type_idx
, HDA_OUTPUT
);
3902 nid
= get_connected_node(codec
,
3903 spec
->dmux_nids
[0], index
);
3905 err
= create_elem_capture_vol(codec
,
3907 type_idx
, HDA_INPUT
);
3917 static int check_mic_pin(struct hda_codec
*codec
, hda_nid_t nid
,
3918 hda_nid_t
*fixed
, hda_nid_t
*ext
, hda_nid_t
*dock
)
3925 cfg
= snd_hda_codec_get_pincfg(codec
, nid
);
3926 type
= get_defcfg_device(cfg
);
3927 switch (snd_hda_get_input_pin_attr(cfg
)) {
3928 case INPUT_PIN_ATTR_INT
:
3930 return 1; /* already occupied */
3931 if (type
!= AC_JACK_MIC_IN
)
3932 return 1; /* invalid type */
3935 case INPUT_PIN_ATTR_UNUSED
:
3937 case INPUT_PIN_ATTR_DOCK
:
3939 return 1; /* already occupied */
3940 if (type
!= AC_JACK_MIC_IN
&& type
!= AC_JACK_LINE_IN
)
3941 return 1; /* invalid type */
3946 return 1; /* already occupied */
3947 if (type
!= AC_JACK_MIC_IN
)
3948 return 1; /* invalid type */
3955 static int set_mic_route(struct hda_codec
*codec
,
3956 struct sigmatel_mic_route
*mic
,
3959 struct sigmatel_spec
*spec
= codec
->spec
;
3960 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
3966 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
3967 if (pin
== cfg
->inputs
[i
].pin
)
3970 if (i
< cfg
->num_inputs
&& cfg
->inputs
[i
].type
== AUTO_PIN_MIC
) {
3972 i
= get_connection_index(codec
, spec
->mux_nids
[0], pin
);
3977 if (spec
->dmux_nids
)
3978 mic
->dmux_idx
= get_connection_index(codec
,
3981 } else if (spec
->dmux_nids
) {
3983 i
= get_connection_index(codec
, spec
->dmux_nids
[0], pin
);
3989 mic
->mux_idx
= get_connection_index(codec
,
3991 spec
->dmux_nids
[0]);
3996 /* return non-zero if the device is for automatic mic switch */
3997 static int stac_check_auto_mic(struct hda_codec
*codec
)
3999 struct sigmatel_spec
*spec
= codec
->spec
;
4000 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
4001 hda_nid_t fixed
, ext
, dock
;
4004 fixed
= ext
= dock
= 0;
4005 for (i
= 0; i
< cfg
->num_inputs
; i
++)
4006 if (check_mic_pin(codec
, cfg
->inputs
[i
].pin
,
4007 &fixed
, &ext
, &dock
))
4009 for (i
= 0; i
< spec
->num_dmics
; i
++)
4010 if (check_mic_pin(codec
, spec
->dmic_nids
[i
],
4011 &fixed
, &ext
, &dock
))
4013 if (!fixed
|| (!ext
&& !dock
))
4014 return 0; /* no input to switch */
4015 if (!is_jack_detectable(codec
, ext
))
4016 return 0; /* no unsol support */
4017 if (set_mic_route(codec
, &spec
->ext_mic
, ext
) ||
4018 set_mic_route(codec
, &spec
->int_mic
, fixed
) ||
4019 set_mic_route(codec
, &spec
->dock_mic
, dock
))
4020 return 0; /* something is wrong */
4024 /* create playback/capture controls for input pins */
4025 static int stac92xx_auto_create_analog_input_ctls(struct hda_codec
*codec
, const struct auto_pin_cfg
*cfg
)
4027 struct sigmatel_spec
*spec
= codec
->spec
;
4028 struct hda_input_mux
*imux
= &spec
->private_imux
;
4032 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
4033 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
4034 int index
, err
, type_idx
;
4037 for (j
= 0; j
< spec
->num_muxes
; j
++) {
4038 index
= get_connection_index(codec
, spec
->mux_nids
[j
],
4046 label
= hda_get_autocfg_input_label(codec
, cfg
, i
);
4047 snd_hda_add_imux_item(imux
, label
, index
, &type_idx
);
4049 err
= create_elem_capture_vol(codec
, nid
,
4055 spec
->num_analog_muxes
= imux
->num_items
;
4057 if (imux
->num_items
) {
4059 * Set the current input for the muxes.
4060 * The STAC9221 has two input muxes with identical source
4061 * NID lists. Hopefully this won't get confused.
4063 for (i
= 0; i
< spec
->num_muxes
; i
++) {
4064 snd_hda_codec_write_cache(codec
, spec
->mux_nids
[i
], 0,
4065 AC_VERB_SET_CONNECT_SEL
,
4066 imux
->items
[0].index
);
4073 static void stac92xx_auto_init_multi_out(struct hda_codec
*codec
)
4075 struct sigmatel_spec
*spec
= codec
->spec
;
4078 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
4079 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
4080 stac92xx_auto_set_pinctl(codec
, nid
, AC_PINCTL_OUT_EN
);
4084 static void stac92xx_auto_init_hp_out(struct hda_codec
*codec
)
4086 struct sigmatel_spec
*spec
= codec
->spec
;
4089 for (i
= 0; i
< spec
->autocfg
.hp_outs
; i
++) {
4091 pin
= spec
->autocfg
.hp_pins
[i
];
4092 if (pin
) /* connect to front */
4093 stac92xx_auto_set_pinctl(codec
, pin
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
);
4095 for (i
= 0; i
< spec
->autocfg
.speaker_outs
; i
++) {
4097 pin
= spec
->autocfg
.speaker_pins
[i
];
4098 if (pin
) /* connect to front */
4099 stac92xx_auto_set_pinctl(codec
, pin
, AC_PINCTL_OUT_EN
);
4103 static int is_dual_headphones(struct hda_codec
*codec
)
4105 struct sigmatel_spec
*spec
= codec
->spec
;
4108 if (spec
->autocfg
.line_out_type
!= AUTO_PIN_SPEAKER_OUT
||
4109 spec
->autocfg
.hp_outs
<= 1)
4112 for (i
= 0; i
< spec
->autocfg
.hp_outs
; i
++) {
4113 hda_nid_t nid
= spec
->autocfg
.hp_pins
[i
];
4114 unsigned int cfg
= snd_hda_codec_get_pincfg(codec
, nid
);
4115 if (get_defcfg_location(cfg
) & AC_JACK_LOC_SEPARATE
)
4119 return (valid_hps
> 1);
4123 static int stac92xx_parse_auto_config(struct hda_codec
*codec
)
4125 struct sigmatel_spec
*spec
= codec
->spec
;
4126 hda_nid_t dig_out
= 0, dig_in
= 0;
4130 if ((err
= snd_hda_parse_pin_def_config(codec
,
4132 spec
->dmic_nids
)) < 0)
4134 if (! spec
->autocfg
.line_outs
)
4135 return 0; /* can't find valid pin config */
4137 /* If we have no real line-out pin and multiple hp-outs, HPs should
4138 * be set up as multi-channel outputs.
4140 if (is_dual_headphones(codec
)) {
4141 /* Copy hp_outs to line_outs, backup line_outs in
4142 * speaker_outs so that the following routines can handle
4143 * HP pins as primary outputs.
4145 snd_printdd("stac92xx: Enabling multi-HPs workaround\n");
4146 memcpy(spec
->autocfg
.speaker_pins
, spec
->autocfg
.line_out_pins
,
4147 sizeof(spec
->autocfg
.line_out_pins
));
4148 spec
->autocfg
.speaker_outs
= spec
->autocfg
.line_outs
;
4149 memcpy(spec
->autocfg
.line_out_pins
, spec
->autocfg
.hp_pins
,
4150 sizeof(spec
->autocfg
.hp_pins
));
4151 spec
->autocfg
.line_outs
= spec
->autocfg
.hp_outs
;
4152 spec
->autocfg
.line_out_type
= AUTO_PIN_HP_OUT
;
4153 spec
->autocfg
.hp_outs
= 0;
4156 if (spec
->autocfg
.mono_out_pin
) {
4157 int dir
= get_wcaps(codec
, spec
->autocfg
.mono_out_pin
) &
4158 (AC_WCAP_OUT_AMP
| AC_WCAP_IN_AMP
);
4159 u32 caps
= query_amp_caps(codec
,
4160 spec
->autocfg
.mono_out_pin
, dir
);
4161 hda_nid_t conn_list
[1];
4163 /* get the mixer node and then the mono mux if it exists */
4164 if (snd_hda_get_connections(codec
,
4165 spec
->autocfg
.mono_out_pin
, conn_list
, 1) &&
4166 snd_hda_get_connections(codec
, conn_list
[0],
4167 conn_list
, 1) > 0) {
4169 int wcaps
= get_wcaps(codec
, conn_list
[0]);
4170 int wid_type
= get_wcaps_type(wcaps
);
4171 /* LR swap check, some stac925x have a mux that
4172 * changes the DACs output path instead of the
4175 if (wid_type
== AC_WID_AUD_SEL
&&
4176 !(wcaps
& AC_WCAP_LR_SWAP
))
4177 spec
->mono_nid
= conn_list
[0];
4180 hda_nid_t nid
= spec
->autocfg
.mono_out_pin
;
4182 /* most mono outs have a least a mute/unmute switch */
4183 dir
= (dir
& AC_WCAP_OUT_AMP
) ? HDA_OUTPUT
: HDA_INPUT
;
4184 err
= stac92xx_add_control(spec
, STAC_CTL_WIDGET_MUTE
,
4185 "Mono Playback Switch",
4186 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, dir
));
4189 /* check for volume support for the amp */
4190 if ((caps
& AC_AMPCAP_NUM_STEPS
)
4191 >> AC_AMPCAP_NUM_STEPS_SHIFT
) {
4192 err
= stac92xx_add_control(spec
,
4193 STAC_CTL_WIDGET_VOL
,
4194 "Mono Playback Volume",
4195 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, dir
));
4201 stac92xx_auto_set_pinctl(codec
, spec
->autocfg
.mono_out_pin
,
4205 if (!spec
->multiout
.num_dacs
) {
4206 err
= stac92xx_auto_fill_dac_nids(codec
);
4209 err
= stac92xx_auto_create_multi_out_ctls(codec
,
4215 /* setup analog beep controls */
4216 if (spec
->anabeep_nid
> 0) {
4217 err
= stac92xx_auto_create_beep_ctls(codec
,
4223 /* setup digital beep controls and input device */
4224 #ifdef CONFIG_SND_HDA_INPUT_BEEP
4225 if (spec
->digbeep_nid
> 0) {
4226 hda_nid_t nid
= spec
->digbeep_nid
;
4229 err
= stac92xx_auto_create_beep_ctls(codec
, nid
);
4232 err
= snd_hda_attach_beep_device(codec
, nid
);
4236 /* IDT/STAC codecs have linear beep tone parameter */
4237 codec
->beep
->linear_tone
= spec
->linear_tone_beep
;
4238 /* if no beep switch is available, make its own one */
4239 caps
= query_amp_caps(codec
, nid
, HDA_OUTPUT
);
4240 if (!(caps
& AC_AMPCAP_MUTE
)) {
4241 err
= stac92xx_beep_switch_ctl(codec
);
4249 err
= stac92xx_auto_create_hp_ctls(codec
, &spec
->autocfg
);
4253 /* All output parsing done, now restore the swapped hp pins */
4255 memcpy(spec
->autocfg
.hp_pins
, spec
->autocfg
.line_out_pins
,
4256 sizeof(spec
->autocfg
.hp_pins
));
4257 spec
->autocfg
.hp_outs
= spec
->autocfg
.line_outs
;
4258 spec
->autocfg
.line_out_type
= AUTO_PIN_HP_OUT
;
4259 spec
->autocfg
.line_outs
= 0;
4262 if (stac_check_auto_mic(codec
)) {
4264 /* only one capture for auto-mic */
4267 spec
->num_muxes
= 1;
4270 for (i
= 0; i
< spec
->num_caps
; i
++) {
4271 err
= stac92xx_add_capvol_ctls(codec
, spec
->capvols
[i
],
4272 spec
->capsws
[i
], i
);
4277 err
= stac92xx_auto_create_analog_input_ctls(codec
, &spec
->autocfg
);
4281 if (spec
->mono_nid
> 0) {
4282 err
= stac92xx_auto_create_mono_output_ctls(codec
);
4286 if (spec
->num_dmics
> 0 && !spec
->dinput_mux
)
4287 if ((err
= stac92xx_auto_create_dmic_input_ctls(codec
,
4288 &spec
->autocfg
)) < 0)
4290 if (spec
->num_muxes
> 0) {
4291 err
= stac92xx_auto_create_mux_input_ctls(codec
);
4295 if (spec
->num_smuxes
> 0) {
4296 err
= stac92xx_auto_create_spdif_mux_ctls(codec
);
4301 err
= stac92xx_add_input_source(spec
);
4305 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
4306 if (spec
->multiout
.max_channels
> 2)
4307 spec
->surr_switch
= 1;
4309 /* find digital out and in converters */
4310 for (i
= codec
->start_nid
; i
< codec
->start_nid
+ codec
->num_nodes
; i
++) {
4311 unsigned int wid_caps
= get_wcaps(codec
, i
);
4312 if (wid_caps
& AC_WCAP_DIGITAL
) {
4313 switch (get_wcaps_type(wid_caps
)) {
4314 case AC_WID_AUD_OUT
:
4325 if (spec
->autocfg
.dig_outs
)
4326 spec
->multiout
.dig_out_nid
= dig_out
;
4327 if (dig_in
&& spec
->autocfg
.dig_in_pin
)
4328 spec
->dig_in_nid
= dig_in
;
4330 if (spec
->kctls
.list
)
4331 spec
->mixers
[spec
->num_mixers
++] = spec
->kctls
.list
;
4333 spec
->input_mux
= &spec
->private_imux
;
4334 if (!spec
->dinput_mux
)
4335 spec
->dinput_mux
= &spec
->private_dimux
;
4336 spec
->sinput_mux
= &spec
->private_smux
;
4337 spec
->mono_mux
= &spec
->private_mono_mux
;
4341 /* add playback controls for HP output */
4342 static int stac9200_auto_create_hp_ctls(struct hda_codec
*codec
,
4343 struct auto_pin_cfg
*cfg
)
4345 struct sigmatel_spec
*spec
= codec
->spec
;
4346 hda_nid_t pin
= cfg
->hp_pins
[0];
4351 if (is_jack_detectable(codec
, pin
))
4352 spec
->hp_detect
= 1;
4357 /* add playback controls for LFE output */
4358 static int stac9200_auto_create_lfe_ctls(struct hda_codec
*codec
,
4359 struct auto_pin_cfg
*cfg
)
4361 struct sigmatel_spec
*spec
= codec
->spec
;
4363 hda_nid_t lfe_pin
= 0x0;
4367 * search speaker outs and line outs for a mono speaker pin
4368 * with an amp. If one is found, add LFE controls
4371 for (i
= 0; i
< spec
->autocfg
.speaker_outs
&& lfe_pin
== 0x0; i
++) {
4372 hda_nid_t pin
= spec
->autocfg
.speaker_pins
[i
];
4373 unsigned int wcaps
= get_wcaps(codec
, pin
);
4374 wcaps
&= (AC_WCAP_STEREO
| AC_WCAP_OUT_AMP
);
4375 if (wcaps
== AC_WCAP_OUT_AMP
)
4376 /* found a mono speaker with an amp, must be lfe */
4380 /* if speaker_outs is 0, then speakers may be in line_outs */
4381 if (lfe_pin
== 0 && spec
->autocfg
.speaker_outs
== 0) {
4382 for (i
= 0; i
< spec
->autocfg
.line_outs
&& lfe_pin
== 0x0; i
++) {
4383 hda_nid_t pin
= spec
->autocfg
.line_out_pins
[i
];
4384 unsigned int defcfg
;
4385 defcfg
= snd_hda_codec_get_pincfg(codec
, pin
);
4386 if (get_defcfg_device(defcfg
) == AC_JACK_SPEAKER
) {
4387 unsigned int wcaps
= get_wcaps(codec
, pin
);
4388 wcaps
&= (AC_WCAP_STEREO
| AC_WCAP_OUT_AMP
);
4389 if (wcaps
== AC_WCAP_OUT_AMP
)
4390 /* found a mono speaker with an amp,
4398 err
= create_controls(codec
, "LFE", lfe_pin
, 1);
4406 static int stac9200_parse_auto_config(struct hda_codec
*codec
)
4408 struct sigmatel_spec
*spec
= codec
->spec
;
4411 if ((err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
, NULL
)) < 0)
4414 if ((err
= stac92xx_auto_create_analog_input_ctls(codec
, &spec
->autocfg
)) < 0)
4417 if ((err
= stac9200_auto_create_hp_ctls(codec
, &spec
->autocfg
)) < 0)
4420 if ((err
= stac9200_auto_create_lfe_ctls(codec
, &spec
->autocfg
)) < 0)
4423 if (spec
->num_muxes
> 0) {
4424 err
= stac92xx_auto_create_mux_input_ctls(codec
);
4429 err
= stac92xx_add_input_source(spec
);
4433 if (spec
->autocfg
.dig_outs
)
4434 spec
->multiout
.dig_out_nid
= 0x05;
4435 if (spec
->autocfg
.dig_in_pin
)
4436 spec
->dig_in_nid
= 0x04;
4438 if (spec
->kctls
.list
)
4439 spec
->mixers
[spec
->num_mixers
++] = spec
->kctls
.list
;
4441 spec
->input_mux
= &spec
->private_imux
;
4442 spec
->dinput_mux
= &spec
->private_dimux
;
4448 * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
4449 * funky external mute control using GPIO pins.
4452 static void stac_gpio_set(struct hda_codec
*codec
, unsigned int mask
,
4453 unsigned int dir_mask
, unsigned int data
)
4455 unsigned int gpiostate
, gpiomask
, gpiodir
;
4457 snd_printdd("%s msk %x dir %x gpio %x\n", __func__
, mask
, dir_mask
, data
);
4459 gpiostate
= snd_hda_codec_read(codec
, codec
->afg
, 0,
4460 AC_VERB_GET_GPIO_DATA
, 0);
4461 gpiostate
= (gpiostate
& ~dir_mask
) | (data
& dir_mask
);
4463 gpiomask
= snd_hda_codec_read(codec
, codec
->afg
, 0,
4464 AC_VERB_GET_GPIO_MASK
, 0);
4467 gpiodir
= snd_hda_codec_read(codec
, codec
->afg
, 0,
4468 AC_VERB_GET_GPIO_DIRECTION
, 0);
4469 gpiodir
|= dir_mask
;
4471 /* Configure GPIOx as CMOS */
4472 snd_hda_codec_write(codec
, codec
->afg
, 0, 0x7e7, 0);
4474 snd_hda_codec_write(codec
, codec
->afg
, 0,
4475 AC_VERB_SET_GPIO_MASK
, gpiomask
);
4476 snd_hda_codec_read(codec
, codec
->afg
, 0,
4477 AC_VERB_SET_GPIO_DIRECTION
, gpiodir
); /* sync */
4481 snd_hda_codec_read(codec
, codec
->afg
, 0,
4482 AC_VERB_SET_GPIO_DATA
, gpiostate
); /* sync */
4485 static int stac_add_event(struct hda_codec
*codec
, hda_nid_t nid
,
4486 unsigned char type
, int data
)
4488 struct hda_jack_tbl
*event
;
4490 event
= snd_hda_jack_tbl_new(codec
, nid
);
4493 event
->action
= type
;
4494 event
->private_data
= data
;
4499 static void handle_unsol_event(struct hda_codec
*codec
,
4500 struct hda_jack_tbl
*event
);
4502 /* check if given nid is a valid pin and no other events are assigned
4503 * to it. If OK, assign the event, set the unsol flag, and returns 1.
4504 * Otherwise, returns zero.
4506 static int enable_pin_detect(struct hda_codec
*codec
, hda_nid_t nid
,
4509 struct hda_jack_tbl
*event
;
4511 if (!is_jack_detectable(codec
, nid
))
4513 event
= snd_hda_jack_tbl_new(codec
, nid
);
4516 if (event
->action
&& event
->action
!= type
)
4518 event
->action
= type
;
4519 event
->callback
= handle_unsol_event
;
4520 snd_hda_jack_detect_enable(codec
, nid
, 0);
4524 static int is_nid_out_jack_pin(struct auto_pin_cfg
*cfg
, hda_nid_t nid
)
4527 for (i
= 0; i
< cfg
->hp_outs
; i
++)
4528 if (cfg
->hp_pins
[i
] == nid
)
4529 return 1; /* nid is a HP-Out */
4530 for (i
= 0; i
< cfg
->line_outs
; i
++)
4531 if (cfg
->line_out_pins
[i
] == nid
)
4532 return 1; /* nid is a line-Out */
4533 return 0; /* nid is not a HP-Out */
4536 static void stac92xx_power_down(struct hda_codec
*codec
)
4538 struct sigmatel_spec
*spec
= codec
->spec
;
4540 /* power down inactive DACs */
4541 const hda_nid_t
*dac
;
4542 for (dac
= spec
->dac_list
; *dac
; dac
++)
4543 if (!check_all_dac_nids(spec
, *dac
))
4544 snd_hda_codec_write(codec
, *dac
, 0,
4545 AC_VERB_SET_POWER_STATE
, AC_PWRST_D3
);
4548 static void stac_toggle_power_map(struct hda_codec
*codec
, hda_nid_t nid
,
4551 static inline bool get_int_hint(struct hda_codec
*codec
, const char *key
,
4554 return !snd_hda_get_int_hint(codec
, key
, valp
);
4557 /* override some hints from the hwdep entry */
4558 static void stac_store_hints(struct hda_codec
*codec
)
4560 struct sigmatel_spec
*spec
= codec
->spec
;
4563 val
= snd_hda_get_bool_hint(codec
, "hp_detect");
4565 spec
->hp_detect
= val
;
4566 if (get_int_hint(codec
, "gpio_mask", &spec
->gpio_mask
)) {
4567 spec
->eapd_mask
= spec
->gpio_dir
= spec
->gpio_data
=
4570 if (get_int_hint(codec
, "gpio_dir", &spec
->gpio_dir
))
4571 spec
->gpio_mask
&= spec
->gpio_mask
;
4572 if (get_int_hint(codec
, "gpio_data", &spec
->gpio_data
))
4573 spec
->gpio_dir
&= spec
->gpio_mask
;
4574 if (get_int_hint(codec
, "eapd_mask", &spec
->eapd_mask
))
4575 spec
->eapd_mask
&= spec
->gpio_mask
;
4576 if (get_int_hint(codec
, "gpio_mute", &spec
->gpio_mute
))
4577 spec
->gpio_mute
&= spec
->gpio_mask
;
4578 val
= snd_hda_get_bool_hint(codec
, "eapd_switch");
4580 spec
->eapd_switch
= val
;
4583 static void stac_issue_unsol_events(struct hda_codec
*codec
, int num_pins
,
4584 const hda_nid_t
*pins
)
4587 stac_issue_unsol_event(codec
, *pins
++);
4590 /* fake event to set up pins */
4591 static void stac_fake_hp_events(struct hda_codec
*codec
)
4593 struct sigmatel_spec
*spec
= codec
->spec
;
4595 if (spec
->autocfg
.hp_outs
)
4596 stac_issue_unsol_events(codec
, spec
->autocfg
.hp_outs
,
4597 spec
->autocfg
.hp_pins
);
4598 if (spec
->autocfg
.line_outs
&&
4599 spec
->autocfg
.line_out_pins
[0] != spec
->autocfg
.hp_pins
[0])
4600 stac_issue_unsol_events(codec
, spec
->autocfg
.line_outs
,
4601 spec
->autocfg
.line_out_pins
);
4604 static int stac92xx_init(struct hda_codec
*codec
)
4606 struct sigmatel_spec
*spec
= codec
->spec
;
4607 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
4612 snd_hda_sequence_write(codec
, spec
->init
);
4614 snd_hda_apply_verbs(codec
);
4616 /* power down adcs initially */
4617 if (spec
->powerdown_adcs
)
4618 for (i
= 0; i
< spec
->num_adcs
; i
++)
4619 snd_hda_codec_write(codec
,
4620 spec
->adc_nids
[i
], 0,
4621 AC_VERB_SET_POWER_STATE
, AC_PWRST_D3
);
4623 /* override some hints */
4624 stac_store_hints(codec
);
4627 gpio
= spec
->gpio_data
;
4628 /* turn on EAPD statically when spec->eapd_switch isn't set.
4629 * otherwise, unsol event will turn it on/off dynamically
4631 if (!spec
->eapd_switch
)
4632 gpio
|= spec
->eapd_mask
;
4633 stac_gpio_set(codec
, spec
->gpio_mask
, spec
->gpio_dir
, gpio
);
4636 if (spec
->hp_detect
) {
4637 /* Enable unsolicited responses on the HP widget */
4638 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
4639 hda_nid_t nid
= cfg
->hp_pins
[i
];
4640 enable_pin_detect(codec
, nid
, STAC_HP_EVENT
);
4642 if (cfg
->line_out_type
== AUTO_PIN_LINE_OUT
&&
4643 cfg
->speaker_outs
> 0) {
4644 /* enable pin-detect for line-outs as well */
4645 for (i
= 0; i
< cfg
->line_outs
; i
++) {
4646 hda_nid_t nid
= cfg
->line_out_pins
[i
];
4647 enable_pin_detect(codec
, nid
, STAC_LO_EVENT
);
4651 /* force to enable the first line-out; the others are set up
4654 stac92xx_auto_set_pinctl(codec
, spec
->autocfg
.line_out_pins
[0],
4656 /* fake event to set up pins */
4657 stac_fake_hp_events(codec
);
4659 stac92xx_auto_init_multi_out(codec
);
4660 stac92xx_auto_init_hp_out(codec
);
4661 for (i
= 0; i
< cfg
->hp_outs
; i
++)
4662 stac_toggle_power_map(codec
, cfg
->hp_pins
[i
], 1);
4664 if (spec
->auto_mic
) {
4665 /* initialize connection to analog input */
4666 if (spec
->dmux_nids
)
4667 snd_hda_codec_write_cache(codec
, spec
->dmux_nids
[0], 0,
4668 AC_VERB_SET_CONNECT_SEL
, 0);
4669 if (enable_pin_detect(codec
, spec
->ext_mic
.pin
, STAC_MIC_EVENT
))
4670 stac_issue_unsol_event(codec
, spec
->ext_mic
.pin
);
4671 if (enable_pin_detect(codec
, spec
->dock_mic
.pin
,
4673 stac_issue_unsol_event(codec
, spec
->dock_mic
.pin
);
4675 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
4676 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
4677 int type
= cfg
->inputs
[i
].type
;
4678 unsigned int pinctl
, conf
;
4679 if (type
== AUTO_PIN_MIC
) {
4680 /* for mic pins, force to initialize */
4681 pinctl
= snd_hda_get_default_vref(codec
, nid
);
4682 pinctl
|= AC_PINCTL_IN_EN
;
4683 stac92xx_auto_set_pinctl(codec
, nid
, pinctl
);
4685 pinctl
= snd_hda_codec_read(codec
, nid
, 0,
4686 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
4687 /* if PINCTL already set then skip */
4688 /* Also, if both INPUT and OUTPUT are set,
4689 * it must be a BIOS bug; need to override, too
4691 if (!(pinctl
& AC_PINCTL_IN_EN
) ||
4692 (pinctl
& AC_PINCTL_OUT_EN
)) {
4693 pinctl
&= ~AC_PINCTL_OUT_EN
;
4694 pinctl
|= AC_PINCTL_IN_EN
;
4695 stac92xx_auto_set_pinctl(codec
, nid
, pinctl
);
4698 conf
= snd_hda_codec_get_pincfg(codec
, nid
);
4699 if (get_defcfg_connect(conf
) != AC_JACK_PORT_FIXED
) {
4700 if (enable_pin_detect(codec
, nid
, STAC_INSERT_EVENT
))
4701 stac_issue_unsol_event(codec
, nid
);
4704 for (i
= 0; i
< spec
->num_dmics
; i
++)
4705 stac92xx_auto_set_pinctl(codec
, spec
->dmic_nids
[i
],
4707 if (cfg
->dig_out_pins
[0])
4708 stac92xx_auto_set_pinctl(codec
, cfg
->dig_out_pins
[0],
4710 if (cfg
->dig_in_pin
)
4711 stac92xx_auto_set_pinctl(codec
, cfg
->dig_in_pin
,
4713 for (i
= 0; i
< spec
->num_pwrs
; i
++) {
4714 hda_nid_t nid
= spec
->pwr_nids
[i
];
4715 unsigned int pinctl
, def_conf
;
4717 def_conf
= snd_hda_codec_get_pincfg(codec
, nid
);
4718 def_conf
= get_defcfg_connect(def_conf
);
4719 if (def_conf
== AC_JACK_PORT_NONE
) {
4720 /* power off unused ports */
4721 stac_toggle_power_map(codec
, nid
, 0);
4724 if (def_conf
== AC_JACK_PORT_FIXED
) {
4725 /* no need for jack detection for fixed pins */
4726 stac_toggle_power_map(codec
, nid
, 1);
4729 /* power on when no jack detection is available */
4730 /* or when the VREF is used for controlling LED */
4731 if (!spec
->hp_detect
||
4732 spec
->vref_mute_led_nid
== nid
||
4733 !is_jack_detectable(codec
, nid
)) {
4734 stac_toggle_power_map(codec
, nid
, 1);
4738 if (is_nid_out_jack_pin(cfg
, nid
))
4739 continue; /* already has an unsol event */
4741 pinctl
= snd_hda_codec_read(codec
, nid
, 0,
4742 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
4743 /* outputs are only ports capable of power management
4744 * any attempts on powering down a input port cause the
4745 * referenced VREF to act quirky.
4747 if (pinctl
& AC_PINCTL_IN_EN
) {
4748 stac_toggle_power_map(codec
, nid
, 1);
4751 if (enable_pin_detect(codec
, nid
, STAC_PWR_EVENT
)) {
4752 stac_issue_unsol_event(codec
, nid
);
4755 /* none of the above, turn the port OFF */
4756 stac_toggle_power_map(codec
, nid
, 0);
4760 if (spec
->gpio_led
) {
4761 if (spec
->vmaster_mute
.hook
)
4762 snd_hda_sync_vmaster_hook(&spec
->vmaster_mute
);
4763 else /* the very first init call doesn't have vmaster yet */
4764 stac92xx_update_led_status(codec
, false);
4767 /* sync the power-map */
4769 snd_hda_codec_write(codec
, codec
->afg
, 0,
4770 AC_VERB_IDT_SET_POWER_MAP
,
4771 spec
->power_map_bits
);
4773 stac92xx_power_down(codec
);
4777 static void stac92xx_free_kctls(struct hda_codec
*codec
)
4779 struct sigmatel_spec
*spec
= codec
->spec
;
4781 if (spec
->kctls
.list
) {
4782 struct snd_kcontrol_new
*kctl
= spec
->kctls
.list
;
4784 for (i
= 0; i
< spec
->kctls
.used
; i
++)
4785 kfree(kctl
[i
].name
);
4787 snd_array_free(&spec
->kctls
);
4790 static void stac92xx_shutup_pins(struct hda_codec
*codec
)
4792 unsigned int i
, def_conf
;
4794 if (codec
->bus
->shutdown
)
4796 for (i
= 0; i
< codec
->init_pins
.used
; i
++) {
4797 struct hda_pincfg
*pin
= snd_array_elem(&codec
->init_pins
, i
);
4798 def_conf
= snd_hda_codec_get_pincfg(codec
, pin
->nid
);
4799 if (get_defcfg_connect(def_conf
) != AC_JACK_PORT_NONE
)
4800 snd_hda_set_pin_ctl(codec
, pin
->nid
, 0);
4804 static void stac92xx_shutup(struct hda_codec
*codec
)
4806 struct sigmatel_spec
*spec
= codec
->spec
;
4808 stac92xx_shutup_pins(codec
);
4810 if (spec
->eapd_mask
)
4811 stac_gpio_set(codec
, spec
->gpio_mask
,
4812 spec
->gpio_dir
, spec
->gpio_data
&
4816 static void stac92xx_free(struct hda_codec
*codec
)
4818 struct sigmatel_spec
*spec
= codec
->spec
;
4824 snd_hda_detach_beep_device(codec
);
4827 static void stac92xx_set_pinctl(struct hda_codec
*codec
, hda_nid_t nid
,
4830 unsigned int old_ctl
, pin_ctl
;
4832 pin_ctl
= snd_hda_codec_read(codec
, nid
,
4833 0, AC_VERB_GET_PIN_WIDGET_CONTROL
, 0x00);
4835 if (pin_ctl
& AC_PINCTL_IN_EN
) {
4837 * we need to check the current set-up direction of
4838 * shared input pins since they can be switched via
4839 * "xxx as Output" mixer switch
4841 struct sigmatel_spec
*spec
= codec
->spec
;
4842 if (nid
== spec
->line_switch
|| nid
== spec
->mic_switch
)
4847 /* if setting pin direction bits, clear the current
4848 direction bits first */
4849 if (flag
& (AC_PINCTL_IN_EN
| AC_PINCTL_OUT_EN
))
4850 pin_ctl
&= ~(AC_PINCTL_IN_EN
| AC_PINCTL_OUT_EN
);
4853 if (old_ctl
!= pin_ctl
)
4854 snd_hda_set_pin_ctl_cache(codec
, nid
, pin_ctl
);
4857 static void stac92xx_reset_pinctl(struct hda_codec
*codec
, hda_nid_t nid
,
4860 unsigned int pin_ctl
= snd_hda_codec_read(codec
, nid
,
4861 0, AC_VERB_GET_PIN_WIDGET_CONTROL
, 0x00);
4863 snd_hda_set_pin_ctl_cache(codec
, nid
, pin_ctl
& ~flag
);
4866 static inline int get_pin_presence(struct hda_codec
*codec
, hda_nid_t nid
)
4870 return snd_hda_jack_detect(codec
, nid
);
4873 static void stac92xx_line_out_detect(struct hda_codec
*codec
,
4876 struct sigmatel_spec
*spec
= codec
->spec
;
4877 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
4880 if (cfg
->speaker_outs
== 0)
4883 for (i
= 0; i
< cfg
->line_outs
; i
++) {
4886 presence
= get_pin_presence(codec
, cfg
->line_out_pins
[i
]);
4888 unsigned int pinctl
;
4889 pinctl
= snd_hda_codec_read(codec
,
4890 cfg
->line_out_pins
[i
], 0,
4891 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
4892 if (pinctl
& AC_PINCTL_IN_EN
)
4893 presence
= 0; /* mic- or line-input */
4898 /* disable speakers */
4899 for (i
= 0; i
< cfg
->speaker_outs
; i
++)
4900 stac92xx_reset_pinctl(codec
, cfg
->speaker_pins
[i
],
4902 if (spec
->eapd_mask
&& spec
->eapd_switch
)
4903 stac_gpio_set(codec
, spec
->gpio_mask
,
4904 spec
->gpio_dir
, spec
->gpio_data
&
4907 /* enable speakers */
4908 for (i
= 0; i
< cfg
->speaker_outs
; i
++)
4909 stac92xx_set_pinctl(codec
, cfg
->speaker_pins
[i
],
4911 if (spec
->eapd_mask
&& spec
->eapd_switch
)
4912 stac_gpio_set(codec
, spec
->gpio_mask
,
4913 spec
->gpio_dir
, spec
->gpio_data
|
4918 /* return non-zero if the hp-pin of the given array index isn't
4919 * a jack-detection target
4921 static int no_hp_sensing(struct sigmatel_spec
*spec
, int i
)
4923 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
4925 /* ignore sensing of shared line and mic jacks */
4926 if (cfg
->hp_pins
[i
] == spec
->line_switch
)
4928 if (cfg
->hp_pins
[i
] == spec
->mic_switch
)
4930 /* ignore if the pin is set as line-out */
4931 if (cfg
->hp_pins
[i
] == spec
->hp_switch
)
4936 static void stac92xx_hp_detect(struct hda_codec
*codec
)
4938 struct sigmatel_spec
*spec
= codec
->spec
;
4939 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
4943 if (spec
->gpio_mute
)
4944 presence
= !(snd_hda_codec_read(codec
, codec
->afg
, 0,
4945 AC_VERB_GET_GPIO_DATA
, 0) & spec
->gpio_mute
);
4947 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
4950 if (no_hp_sensing(spec
, i
))
4952 presence
= get_pin_presence(codec
, cfg
->hp_pins
[i
]);
4954 unsigned int pinctl
;
4955 pinctl
= snd_hda_codec_read(codec
, cfg
->hp_pins
[i
], 0,
4956 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
4957 if (pinctl
& AC_PINCTL_IN_EN
)
4958 presence
= 0; /* mic- or line-input */
4963 /* disable lineouts */
4964 if (spec
->hp_switch
)
4965 stac92xx_reset_pinctl(codec
, spec
->hp_switch
,
4967 for (i
= 0; i
< cfg
->line_outs
; i
++)
4968 stac92xx_reset_pinctl(codec
, cfg
->line_out_pins
[i
],
4971 /* enable lineouts */
4972 if (spec
->hp_switch
)
4973 stac92xx_set_pinctl(codec
, spec
->hp_switch
,
4975 for (i
= 0; i
< cfg
->line_outs
; i
++)
4976 stac92xx_set_pinctl(codec
, cfg
->line_out_pins
[i
],
4979 stac92xx_line_out_detect(codec
, presence
);
4980 /* toggle hp outs */
4981 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
4982 unsigned int val
= AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
;
4983 if (no_hp_sensing(spec
, i
))
4986 stac92xx_set_pinctl(codec
, cfg
->hp_pins
[i
], val
);
4988 /* Resetting the pinctl like below may lead to (a sort of) regressions
4989 * on some devices since they use the HP pin actually for line/speaker
4990 * outs although the default pin config shows a different pin (that is
4991 * wrong and useless).
4993 * So, it's basically a problem of default pin configs, likely a BIOS issue.
4994 * But, disabling the code below just works around it, and I'm too tired of
4995 * bug reports with such devices...
4998 stac92xx_reset_pinctl(codec
, cfg
->hp_pins
[i
], val
);
5003 static void stac_toggle_power_map(struct hda_codec
*codec
, hda_nid_t nid
,
5006 struct sigmatel_spec
*spec
= codec
->spec
;
5007 unsigned int idx
, val
;
5009 for (idx
= 0; idx
< spec
->num_pwrs
; idx
++) {
5010 if (spec
->pwr_nids
[idx
] == nid
)
5013 if (idx
>= spec
->num_pwrs
)
5018 val
= spec
->power_map_bits
;
5024 /* power down unused output ports */
5025 if (val
!= spec
->power_map_bits
) {
5026 spec
->power_map_bits
= val
;
5027 snd_hda_codec_write(codec
, codec
->afg
, 0,
5028 AC_VERB_IDT_SET_POWER_MAP
, val
);
5032 static void stac92xx_pin_sense(struct hda_codec
*codec
, hda_nid_t nid
)
5034 stac_toggle_power_map(codec
, nid
, get_pin_presence(codec
, nid
));
5037 /* get the pin connection (fixed, none, etc) */
5038 static unsigned int stac_get_defcfg_connect(struct hda_codec
*codec
, int idx
)
5040 struct sigmatel_spec
*spec
= codec
->spec
;
5043 cfg
= snd_hda_codec_get_pincfg(codec
, spec
->pin_nids
[idx
]);
5044 return get_defcfg_connect(cfg
);
5047 static int stac92xx_connected_ports(struct hda_codec
*codec
,
5048 const hda_nid_t
*nids
, int num_nids
)
5050 struct sigmatel_spec
*spec
= codec
->spec
;
5052 unsigned int def_conf
;
5054 for (num
= 0; num
< num_nids
; num
++) {
5055 for (idx
= 0; idx
< spec
->num_pins
; idx
++)
5056 if (spec
->pin_nids
[idx
] == nids
[num
])
5058 if (idx
>= spec
->num_pins
)
5060 def_conf
= stac_get_defcfg_connect(codec
, idx
);
5061 if (def_conf
== AC_JACK_PORT_NONE
)
5067 static void stac92xx_mic_detect(struct hda_codec
*codec
)
5069 struct sigmatel_spec
*spec
= codec
->spec
;
5070 struct sigmatel_mic_route
*mic
;
5072 if (get_pin_presence(codec
, spec
->ext_mic
.pin
))
5073 mic
= &spec
->ext_mic
;
5074 else if (get_pin_presence(codec
, spec
->dock_mic
.pin
))
5075 mic
= &spec
->dock_mic
;
5077 mic
= &spec
->int_mic
;
5078 if (mic
->dmux_idx
>= 0)
5079 snd_hda_codec_write_cache(codec
, spec
->dmux_nids
[0], 0,
5080 AC_VERB_SET_CONNECT_SEL
,
5082 if (mic
->mux_idx
>= 0)
5083 snd_hda_codec_write_cache(codec
, spec
->mux_nids
[0], 0,
5084 AC_VERB_SET_CONNECT_SEL
,
5088 static void handle_unsol_event(struct hda_codec
*codec
,
5089 struct hda_jack_tbl
*event
)
5091 struct sigmatel_spec
*spec
= codec
->spec
;
5094 switch (event
->action
) {
5097 stac92xx_hp_detect(codec
);
5099 case STAC_MIC_EVENT
:
5100 stac92xx_mic_detect(codec
);
5104 switch (event
->action
) {
5107 case STAC_MIC_EVENT
:
5108 case STAC_INSERT_EVENT
:
5109 case STAC_PWR_EVENT
:
5110 if (spec
->num_pwrs
> 0)
5111 stac92xx_pin_sense(codec
, event
->nid
);
5113 switch (codec
->subsystem_id
) {
5115 if (event
->nid
== 0xb) {
5116 int pin
= AC_PINCTL_IN_EN
;
5118 if (get_pin_presence(codec
, 0xa)
5119 && get_pin_presence(codec
, 0xb))
5120 pin
|= AC_PINCTL_VREF_80
;
5121 if (!get_pin_presence(codec
, 0xb))
5122 pin
|= AC_PINCTL_VREF_80
;
5124 /* toggle VREF state based on mic + hp pin
5127 stac92xx_auto_set_pinctl(codec
, 0x0a, pin
);
5131 case STAC_VREF_EVENT
:
5132 data
= snd_hda_codec_read(codec
, codec
->afg
, 0,
5133 AC_VERB_GET_GPIO_DATA
, 0);
5134 /* toggle VREF state based on GPIOx status */
5135 snd_hda_codec_write(codec
, codec
->afg
, 0, 0x7e0,
5136 !!(data
& (1 << event
->private_data
)));
5141 static void stac_issue_unsol_event(struct hda_codec
*codec
, hda_nid_t nid
)
5143 struct hda_jack_tbl
*event
= snd_hda_jack_tbl_get(codec
, nid
);
5146 handle_unsol_event(codec
, event
);
5149 static int hp_blike_system(u32 subsystem_id
);
5151 static void set_hp_led_gpio(struct hda_codec
*codec
)
5153 struct sigmatel_spec
*spec
= codec
->spec
;
5159 gpio
= snd_hda_param_read(codec
, codec
->afg
, AC_PAR_GPIO_CAP
);
5160 gpio
&= AC_GPIO_IO_COUNT
;
5162 spec
->gpio_led
= 0x08; /* GPIO 3 */
5164 spec
->gpio_led
= 0x01; /* GPIO 0 */
5168 * This method searches for the mute LED GPIO configuration
5169 * provided as OEM string in SMBIOS. The format of that string
5170 * is HP_Mute_LED_P_G or HP_Mute_LED_P
5171 * where P can be 0 or 1 and defines mute LED GPIO control state (low/high)
5172 * that corresponds to the NOT muted state of the master volume
5173 * and G is the index of the GPIO to use as the mute LED control (0..9)
5174 * If _G portion is missing it is assigned based on the codec ID
5176 * So, HP B-series like systems may have HP_Mute_LED_0 (current models)
5177 * or HP_Mute_LED_0_3 (future models) OEM SMBIOS strings
5180 * The dv-series laptops don't seem to have the HP_Mute_LED* strings in
5181 * SMBIOS - at least the ones I have seen do not have them - which include
5182 * my own system (HP Pavilion dv6-1110ax) and my cousin's
5183 * HP Pavilion dv9500t CTO.
5184 * Need more information on whether it is true across the entire series.
5187 static int find_mute_led_cfg(struct hda_codec
*codec
, int default_polarity
)
5189 struct sigmatel_spec
*spec
= codec
->spec
;
5190 const struct dmi_device
*dev
= NULL
;
5192 if (get_int_hint(codec
, "gpio_led", &spec
->gpio_led
)) {
5193 get_int_hint(codec
, "gpio_led_polarity",
5194 &spec
->gpio_led_polarity
);
5197 if ((codec
->subsystem_id
>> 16) == PCI_VENDOR_ID_HP
) {
5198 while ((dev
= dmi_find_device(DMI_DEV_TYPE_OEM_STRING
,
5200 if (sscanf(dev
->name
, "HP_Mute_LED_%d_%x",
5201 &spec
->gpio_led_polarity
,
5202 &spec
->gpio_led
) == 2) {
5203 unsigned int max_gpio
;
5204 max_gpio
= snd_hda_param_read(codec
, codec
->afg
,
5206 max_gpio
&= AC_GPIO_IO_COUNT
;
5207 if (spec
->gpio_led
< max_gpio
)
5208 spec
->gpio_led
= 1 << spec
->gpio_led
;
5210 spec
->vref_mute_led_nid
= spec
->gpio_led
;
5213 if (sscanf(dev
->name
, "HP_Mute_LED_%d",
5214 &spec
->gpio_led_polarity
) == 1) {
5215 set_hp_led_gpio(codec
);
5218 /* BIOS bug: unfilled OEM string */
5219 if (strstr(dev
->name
, "HP_Mute_LED_P_G")) {
5220 set_hp_led_gpio(codec
);
5221 switch (codec
->subsystem_id
) {
5223 spec
->gpio_led_polarity
= 0;
5226 spec
->gpio_led_polarity
= 1;
5234 * Fallback case - if we don't find the DMI strings,
5235 * we statically set the GPIO - if not a B-series system
5236 * and default polarity is provided
5238 if (!hp_blike_system(codec
->subsystem_id
) &&
5239 (default_polarity
== 0 || default_polarity
== 1)) {
5240 set_hp_led_gpio(codec
);
5241 spec
->gpio_led_polarity
= default_polarity
;
5248 static int hp_blike_system(u32 subsystem_id
)
5250 switch (subsystem_id
) {
5277 #ifdef CONFIG_PROC_FS
5278 static void stac92hd_proc_hook(struct snd_info_buffer
*buffer
,
5279 struct hda_codec
*codec
, hda_nid_t nid
)
5281 if (nid
== codec
->afg
)
5282 snd_iprintf(buffer
, "Power-Map: 0x%02x\n",
5283 snd_hda_codec_read(codec
, nid
, 0,
5284 AC_VERB_IDT_GET_POWER_MAP
, 0));
5287 static void analog_loop_proc_hook(struct snd_info_buffer
*buffer
,
5288 struct hda_codec
*codec
,
5291 snd_iprintf(buffer
, "Analog Loopback: 0x%02x\n",
5292 snd_hda_codec_read(codec
, codec
->afg
, 0, verb
, 0));
5295 /* stac92hd71bxx, stac92hd73xx */
5296 static void stac92hd7x_proc_hook(struct snd_info_buffer
*buffer
,
5297 struct hda_codec
*codec
, hda_nid_t nid
)
5299 stac92hd_proc_hook(buffer
, codec
, nid
);
5300 if (nid
== codec
->afg
)
5301 analog_loop_proc_hook(buffer
, codec
, 0xfa0);
5304 static void stac9205_proc_hook(struct snd_info_buffer
*buffer
,
5305 struct hda_codec
*codec
, hda_nid_t nid
)
5307 if (nid
== codec
->afg
)
5308 analog_loop_proc_hook(buffer
, codec
, 0xfe0);
5311 static void stac927x_proc_hook(struct snd_info_buffer
*buffer
,
5312 struct hda_codec
*codec
, hda_nid_t nid
)
5314 if (nid
== codec
->afg
)
5315 analog_loop_proc_hook(buffer
, codec
, 0xfeb);
5318 #define stac92hd_proc_hook NULL
5319 #define stac92hd7x_proc_hook NULL
5320 #define stac9205_proc_hook NULL
5321 #define stac927x_proc_hook NULL
5325 static int stac92xx_resume(struct hda_codec
*codec
)
5327 stac92xx_init(codec
);
5328 snd_hda_codec_resume_amp(codec
);
5329 snd_hda_codec_resume_cache(codec
);
5330 /* fake event to set up pins again to override cached values */
5331 stac_fake_hp_events(codec
);
5335 static int stac92xx_suspend(struct hda_codec
*codec
)
5337 stac92xx_shutup(codec
);
5341 static void stac92xx_set_power_state(struct hda_codec
*codec
, hda_nid_t fg
,
5342 unsigned int power_state
)
5344 unsigned int afg_power_state
= power_state
;
5345 struct sigmatel_spec
*spec
= codec
->spec
;
5347 if (power_state
== AC_PWRST_D3
) {
5348 if (spec
->vref_mute_led_nid
) {
5349 /* with vref-out pin used for mute led control
5350 * codec AFG is prevented from D3 state
5352 afg_power_state
= AC_PWRST_D1
;
5354 /* this delay seems necessary to avoid click noise at power-down */
5357 snd_hda_codec_read(codec
, fg
, 0, AC_VERB_SET_POWER_STATE
,
5359 snd_hda_codec_set_power_to_all(codec
, fg
, power_state
, true);
5362 #define stac92xx_suspend NULL
5363 #define stac92xx_resume NULL
5364 #define stac92xx_set_power_state NULL
5365 #endif /* CONFIG_PM */
5367 /* update mute-LED accoring to the master switch */
5368 static void stac92xx_update_led_status(struct hda_codec
*codec
, int enabled
)
5370 struct sigmatel_spec
*spec
= codec
->spec
;
5371 int muted
= !enabled
;
5373 if (!spec
->gpio_led
)
5376 /* LED state is inverted on these systems */
5377 if (spec
->gpio_led_polarity
)
5380 if (!spec
->vref_mute_led_nid
) {
5382 spec
->gpio_data
|= spec
->gpio_led
;
5384 spec
->gpio_data
&= ~spec
->gpio_led
;
5385 stac_gpio_set(codec
, spec
->gpio_mask
,
5386 spec
->gpio_dir
, spec
->gpio_data
);
5388 spec
->vref_led
= muted
? AC_PINCTL_VREF_50
: AC_PINCTL_VREF_GRD
;
5389 stac_vrefout_set(codec
, spec
->vref_mute_led_nid
,
5394 static const struct hda_codec_ops stac92xx_patch_ops
= {
5395 .build_controls
= stac92xx_build_controls
,
5396 .build_pcms
= stac92xx_build_pcms
,
5397 .init
= stac92xx_init
,
5398 .free
= stac92xx_free
,
5399 .unsol_event
= snd_hda_jack_unsol_event
,
5401 .suspend
= stac92xx_suspend
,
5402 .resume
= stac92xx_resume
,
5404 .reboot_notify
= stac92xx_shutup
,
5407 static int alloc_stac_spec(struct hda_codec
*codec
, int num_pins
,
5408 const hda_nid_t
*pin_nids
)
5410 struct sigmatel_spec
*spec
;
5412 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
5416 codec
->no_trigger_sense
= 1; /* seems common with STAC/IDT codecs */
5417 spec
->num_pins
= num_pins
;
5418 spec
->pin_nids
= pin_nids
;
5419 snd_array_init(&spec
->kctls
, sizeof(struct snd_kcontrol_new
), 32);
5423 static int patch_stac9200(struct hda_codec
*codec
)
5425 struct sigmatel_spec
*spec
;
5428 err
= alloc_stac_spec(codec
, ARRAY_SIZE(stac9200_pin_nids
),
5434 spec
->linear_tone_beep
= 1;
5436 snd_hda_pick_fixup(codec
, stac9200_models
, stac9200_fixup_tbl
,
5439 spec
->multiout
.max_channels
= 2;
5440 spec
->multiout
.num_dacs
= 1;
5441 spec
->multiout
.dac_nids
= stac9200_dac_nids
;
5442 spec
->adc_nids
= stac9200_adc_nids
;
5443 spec
->mux_nids
= stac9200_mux_nids
;
5444 spec
->num_muxes
= 1;
5445 spec
->num_dmics
= 0;
5448 snd_hda_add_verbs(codec
, stac9200_eapd_init
);
5450 spec
->mixer
= stac9200_mixer
;
5452 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PRE_PROBE
);
5454 err
= stac9200_parse_auto_config(codec
);
5456 stac92xx_free(codec
);
5460 codec
->patch_ops
= stac92xx_patch_ops
;
5462 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PROBE
);
5467 static int patch_stac925x(struct hda_codec
*codec
)
5469 struct sigmatel_spec
*spec
;
5472 err
= alloc_stac_spec(codec
, ARRAY_SIZE(stac925x_pin_nids
),
5478 spec
->linear_tone_beep
= 1;
5480 snd_hda_pick_fixup(codec
, stac925x_models
, stac925x_fixup_tbl
,
5483 spec
->multiout
.max_channels
= 2;
5484 spec
->multiout
.num_dacs
= 1;
5485 spec
->multiout
.dac_nids
= stac925x_dac_nids
;
5486 spec
->adc_nids
= stac925x_adc_nids
;
5487 spec
->mux_nids
= stac925x_mux_nids
;
5488 spec
->num_muxes
= 1;
5491 switch (codec
->vendor_id
) {
5492 case 0x83847632: /* STAC9202 */
5493 case 0x83847633: /* STAC9202D */
5494 case 0x83847636: /* STAC9251 */
5495 case 0x83847637: /* STAC9251D */
5496 spec
->num_dmics
= STAC925X_NUM_DMICS
;
5497 spec
->dmic_nids
= stac925x_dmic_nids
;
5498 spec
->num_dmuxes
= ARRAY_SIZE(stac925x_dmux_nids
);
5499 spec
->dmux_nids
= stac925x_dmux_nids
;
5502 spec
->num_dmics
= 0;
5506 snd_hda_add_verbs(codec
, stac925x_core_init
);
5507 spec
->mixer
= stac925x_mixer
;
5509 spec
->capvols
= stac925x_capvols
;
5510 spec
->capsws
= stac925x_capsws
;
5512 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PRE_PROBE
);
5514 err
= stac92xx_parse_auto_config(codec
);
5518 stac92xx_free(codec
);
5522 codec
->patch_ops
= stac92xx_patch_ops
;
5524 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PROBE
);
5529 static int patch_stac92hd73xx(struct hda_codec
*codec
)
5531 struct sigmatel_spec
*spec
;
5532 hda_nid_t conn
[STAC92HD73_DAC_COUNT
+ 2];
5536 err
= alloc_stac_spec(codec
, ARRAY_SIZE(stac92hd73xx_pin_nids
),
5537 stac92hd73xx_pin_nids
);
5542 spec
->linear_tone_beep
= 0;
5543 codec
->slave_dig_outs
= stac92hd73xx_slave_dig_outs
;
5544 spec
->board_config
= snd_hda_check_board_config(codec
,
5545 STAC_92HD73XX_MODELS
,
5546 stac92hd73xx_models
,
5547 stac92hd73xx_cfg_tbl
);
5548 /* check codec subsystem id if not found */
5549 if (spec
->board_config
< 0)
5550 spec
->board_config
=
5551 snd_hda_check_board_codec_sid_config(codec
,
5552 STAC_92HD73XX_MODELS
, stac92hd73xx_models
,
5553 stac92hd73xx_codec_id_cfg_tbl
);
5555 if (spec
->board_config
< 0)
5556 snd_printdd(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
5559 stac92xx_set_config_regs(codec
,
5560 stac92hd73xx_brd_tbl
[spec
->board_config
]);
5562 num_dacs
= snd_hda_get_connections(codec
, 0x0a,
5563 conn
, STAC92HD73_DAC_COUNT
+ 2) - 1;
5565 if (num_dacs
< 3 || num_dacs
> 5) {
5566 printk(KERN_WARNING
"hda_codec: Could not determine "
5567 "number of channels defaulting to DAC count\n");
5568 num_dacs
= STAC92HD73_DAC_COUNT
;
5570 spec
->init
= stac92hd73xx_core_init
;
5572 case 0x3: /* 6 Channel */
5573 spec
->aloopback_ctl
= stac92hd73xx_6ch_loopback
;
5575 case 0x4: /* 8 Channel */
5576 spec
->aloopback_ctl
= stac92hd73xx_8ch_loopback
;
5578 case 0x5: /* 10 Channel */
5579 spec
->aloopback_ctl
= stac92hd73xx_10ch_loopback
;
5582 spec
->multiout
.dac_nids
= spec
->dac_nids
;
5584 spec
->aloopback_mask
= 0x01;
5585 spec
->aloopback_shift
= 8;
5587 spec
->digbeep_nid
= 0x1c;
5588 spec
->mux_nids
= stac92hd73xx_mux_nids
;
5589 spec
->adc_nids
= stac92hd73xx_adc_nids
;
5590 spec
->dmic_nids
= stac92hd73xx_dmic_nids
;
5591 spec
->dmux_nids
= stac92hd73xx_dmux_nids
;
5592 spec
->smux_nids
= stac92hd73xx_smux_nids
;
5594 spec
->num_muxes
= ARRAY_SIZE(stac92hd73xx_mux_nids
);
5595 spec
->num_adcs
= ARRAY_SIZE(stac92hd73xx_adc_nids
);
5596 spec
->num_dmuxes
= ARRAY_SIZE(stac92hd73xx_dmux_nids
);
5598 spec
->num_caps
= STAC92HD73XX_NUM_CAPS
;
5599 spec
->capvols
= stac92hd73xx_capvols
;
5600 spec
->capsws
= stac92hd73xx_capsws
;
5602 switch (spec
->board_config
) {
5604 spec
->init
= dell_eq_core_init
;
5606 case STAC_DELL_M6_AMIC
:
5607 case STAC_DELL_M6_DMIC
:
5608 case STAC_DELL_M6_BOTH
:
5609 spec
->num_smuxes
= 0;
5610 spec
->eapd_switch
= 0;
5612 switch (spec
->board_config
) {
5613 case STAC_DELL_M6_AMIC
: /* Analog Mics */
5614 snd_hda_codec_set_pincfg(codec
, 0x0b, 0x90A70170);
5615 spec
->num_dmics
= 0;
5617 case STAC_DELL_M6_DMIC
: /* Digital Mics */
5618 snd_hda_codec_set_pincfg(codec
, 0x13, 0x90A60160);
5619 spec
->num_dmics
= 1;
5621 case STAC_DELL_M6_BOTH
: /* Both */
5622 snd_hda_codec_set_pincfg(codec
, 0x0b, 0x90A70170);
5623 snd_hda_codec_set_pincfg(codec
, 0x13, 0x90A60160);
5624 spec
->num_dmics
= 1;
5628 case STAC_ALIENWARE_M17X
:
5629 spec
->num_dmics
= STAC92HD73XX_NUM_DMICS
;
5630 spec
->num_smuxes
= ARRAY_SIZE(stac92hd73xx_smux_nids
);
5631 spec
->eapd_switch
= 0;
5634 spec
->num_dmics
= STAC92HD73XX_NUM_DMICS
;
5635 spec
->num_smuxes
= ARRAY_SIZE(stac92hd73xx_smux_nids
);
5636 spec
->eapd_switch
= 1;
5639 if (spec
->board_config
!= STAC_92HD73XX_REF
) {
5640 /* GPIO0 High = Enable EAPD */
5641 spec
->eapd_mask
= spec
->gpio_mask
= spec
->gpio_dir
= 0x1;
5642 spec
->gpio_data
= 0x01;
5645 spec
->num_pwrs
= ARRAY_SIZE(stac92hd73xx_pwr_nids
);
5646 spec
->pwr_nids
= stac92hd73xx_pwr_nids
;
5648 err
= stac92xx_parse_auto_config(codec
);
5651 if (spec
->board_config
< 0) {
5652 printk(KERN_WARNING
"hda_codec: No auto-config is "
5653 "available, default to model=ref\n");
5654 spec
->board_config
= STAC_92HD73XX_REF
;
5661 stac92xx_free(codec
);
5665 if (spec
->board_config
== STAC_92HD73XX_NO_JD
)
5666 spec
->hp_detect
= 0;
5668 codec
->patch_ops
= stac92xx_patch_ops
;
5670 codec
->proc_widget_hook
= stac92hd7x_proc_hook
;
5675 static int hp_bnb2011_with_dock(struct hda_codec
*codec
)
5677 if (codec
->vendor_id
!= 0x111d7605 &&
5678 codec
->vendor_id
!= 0x111d76d1)
5681 switch (codec
->subsystem_id
) {
5715 static void stac92hd8x_add_pin(struct hda_codec
*codec
, hda_nid_t nid
)
5717 struct sigmatel_spec
*spec
= codec
->spec
;
5718 unsigned int def_conf
= snd_hda_codec_get_pincfg(codec
, nid
);
5721 spec
->auto_pin_nids
[spec
->auto_pin_cnt
] = nid
;
5722 spec
->auto_pin_cnt
++;
5724 if (get_defcfg_device(def_conf
) == AC_JACK_MIC_IN
&&
5725 get_defcfg_connect(def_conf
) != AC_JACK_PORT_NONE
) {
5726 for (i
= 0; i
< ARRAY_SIZE(stac92hd83xxx_dmic_nids
); i
++) {
5727 if (nid
== stac92hd83xxx_dmic_nids
[i
]) {
5728 spec
->auto_dmic_nids
[spec
->auto_dmic_cnt
] = nid
;
5729 spec
->auto_dmic_cnt
++;
5735 static void stac92hd8x_add_adc(struct hda_codec
*codec
, hda_nid_t nid
)
5737 struct sigmatel_spec
*spec
= codec
->spec
;
5739 spec
->auto_adc_nids
[spec
->auto_adc_cnt
] = nid
;
5740 spec
->auto_adc_cnt
++;
5743 static void stac92hd8x_add_mux(struct hda_codec
*codec
, hda_nid_t nid
)
5746 struct sigmatel_spec
*spec
= codec
->spec
;
5748 for (i
= 0; i
< spec
->auto_adc_cnt
; i
++) {
5749 if (get_connection_index(codec
,
5750 spec
->auto_adc_nids
[i
], nid
) >= 0) {
5751 /* mux and volume for adc_nids[i] */
5752 if (!spec
->auto_mux_nids
[i
]) {
5753 spec
->auto_mux_nids
[i
] = nid
;
5754 /* 92hd codecs capture volume is in mux */
5755 spec
->auto_capvols
[i
] = HDA_COMPOSE_AMP_VAL(nid
,
5758 for (j
= 0; j
< spec
->auto_dmic_cnt
; j
++) {
5759 if (get_connection_index(codec
, nid
,
5760 spec
->auto_dmic_nids
[j
]) >= 0) {
5761 /* dmux for adc_nids[i] */
5762 if (!spec
->auto_dmux_nids
[i
])
5763 spec
->auto_dmux_nids
[i
] = nid
;
5772 static void stac92hd8x_fill_auto_spec(struct hda_codec
*codec
)
5774 hda_nid_t nid
, end_nid
;
5775 unsigned int wid_caps
, wid_type
;
5776 struct sigmatel_spec
*spec
= codec
->spec
;
5778 end_nid
= codec
->start_nid
+ codec
->num_nodes
;
5780 for (nid
= codec
->start_nid
; nid
< end_nid
; nid
++) {
5781 wid_caps
= get_wcaps(codec
, nid
);
5782 wid_type
= get_wcaps_type(wid_caps
);
5784 if (wid_type
== AC_WID_PIN
)
5785 stac92hd8x_add_pin(codec
, nid
);
5787 if (wid_type
== AC_WID_AUD_IN
&& !(wid_caps
& AC_WCAP_DIGITAL
))
5788 stac92hd8x_add_adc(codec
, nid
);
5791 for (nid
= codec
->start_nid
; nid
< end_nid
; nid
++) {
5792 wid_caps
= get_wcaps(codec
, nid
);
5793 wid_type
= get_wcaps_type(wid_caps
);
5795 if (wid_type
== AC_WID_AUD_SEL
)
5796 stac92hd8x_add_mux(codec
, nid
);
5799 spec
->pin_nids
= spec
->auto_pin_nids
;
5800 spec
->num_pins
= spec
->auto_pin_cnt
;
5801 spec
->adc_nids
= spec
->auto_adc_nids
;
5802 spec
->num_adcs
= spec
->auto_adc_cnt
;
5803 spec
->capvols
= spec
->auto_capvols
;
5804 spec
->capsws
= spec
->auto_capvols
;
5805 spec
->num_caps
= spec
->auto_adc_cnt
;
5806 spec
->mux_nids
= spec
->auto_mux_nids
;
5807 spec
->num_muxes
= spec
->auto_adc_cnt
;
5808 spec
->dmux_nids
= spec
->auto_dmux_nids
;
5809 spec
->num_dmuxes
= spec
->auto_adc_cnt
;
5810 spec
->dmic_nids
= spec
->auto_dmic_nids
;
5811 spec
->num_dmics
= spec
->auto_dmic_cnt
;
5814 static int patch_stac92hd83xxx(struct hda_codec
*codec
)
5816 struct sigmatel_spec
*spec
;
5817 int default_polarity
= -1; /* no default cfg */
5820 err
= alloc_stac_spec(codec
, 0, NULL
); /* pins filled later */
5824 if (hp_bnb2011_with_dock(codec
)) {
5825 snd_hda_codec_set_pincfg(codec
, 0xa, 0x2101201f);
5826 snd_hda_codec_set_pincfg(codec
, 0xf, 0x2181205e);
5829 codec
->epss
= 0; /* longer delay needed for D3 */
5830 stac92hd8x_fill_auto_spec(codec
);
5833 spec
->linear_tone_beep
= 0;
5834 codec
->slave_dig_outs
= stac92hd83xxx_slave_dig_outs
;
5835 spec
->digbeep_nid
= 0x21;
5836 spec
->pwr_nids
= stac92hd83xxx_pwr_nids
;
5837 spec
->num_pwrs
= ARRAY_SIZE(stac92hd83xxx_pwr_nids
);
5838 spec
->multiout
.dac_nids
= spec
->dac_nids
;
5839 spec
->init
= stac92hd83xxx_core_init
;
5841 spec
->board_config
= snd_hda_check_board_config(codec
,
5842 STAC_92HD83XXX_MODELS
,
5843 stac92hd83xxx_models
,
5844 stac92hd83xxx_cfg_tbl
);
5845 /* check codec subsystem id if not found */
5846 if (spec
->board_config
< 0)
5847 spec
->board_config
=
5848 snd_hda_check_board_codec_sid_config(codec
,
5849 STAC_92HD83XXX_MODELS
, stac92hd83xxx_models
,
5850 stac92hd83xxx_codec_id_cfg_tbl
);
5852 if (spec
->board_config
< 0)
5853 snd_printdd(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
5856 stac92xx_set_config_regs(codec
,
5857 stac92hd83xxx_brd_tbl
[spec
->board_config
]);
5859 codec
->patch_ops
= stac92xx_patch_ops
;
5861 switch (spec
->board_config
) {
5862 case STAC_HP_ZEPHYR
:
5863 spec
->init
= stac92hd83xxx_hp_zephyr_init
;
5865 case STAC_92HD83XXX_HP_LED
:
5866 default_polarity
= 0;
5868 case STAC_92HD83XXX_HP_INV_LED
:
5869 default_polarity
= 1;
5871 case STAC_92HD83XXX_HP_MIC_LED
:
5872 spec
->mic_mute_led_gpio
= 0x08; /* GPIO3 */
5874 case STAC_92HD83XXX_HEADSET_JACK
:
5875 spec
->headset_jack
= 1;
5879 if (find_mute_led_cfg(codec
, default_polarity
))
5880 snd_printd("mute LED gpio %d polarity %d\n",
5882 spec
->gpio_led_polarity
);
5884 if (spec
->gpio_led
) {
5885 if (!spec
->vref_mute_led_nid
) {
5886 spec
->gpio_mask
|= spec
->gpio_led
;
5887 spec
->gpio_dir
|= spec
->gpio_led
;
5888 spec
->gpio_data
|= spec
->gpio_led
;
5890 codec
->patch_ops
.set_power_state
=
5891 stac92xx_set_power_state
;
5895 if (spec
->mic_mute_led_gpio
) {
5896 spec
->gpio_mask
|= spec
->mic_mute_led_gpio
;
5897 spec
->gpio_dir
|= spec
->mic_mute_led_gpio
;
5898 spec
->mic_mute_led_on
= true;
5899 spec
->gpio_data
|= spec
->mic_mute_led_gpio
;
5902 err
= stac92xx_parse_auto_config(codec
);
5904 if (spec
->board_config
< 0) {
5905 printk(KERN_WARNING
"hda_codec: No auto-config is "
5906 "available, default to model=ref\n");
5907 spec
->board_config
= STAC_92HD83XXX_REF
;
5914 stac92xx_free(codec
);
5918 codec
->proc_widget_hook
= stac92hd_proc_hook
;
5923 static int stac92hd71bxx_connected_smuxes(struct hda_codec
*codec
,
5926 struct sigmatel_spec
*spec
= codec
->spec
;
5929 for (idx
= 0; idx
< spec
->num_pins
; idx
++)
5930 if (spec
->pin_nids
[idx
] == dig0pin
)
5932 if ((idx
+ 2) >= spec
->num_pins
)
5936 if (stac_get_defcfg_connect(codec
, idx
+ 1) != AC_JACK_PORT_NONE
)
5939 /* dig0pin + dig2pin case */
5940 if (stac_get_defcfg_connect(codec
, idx
+ 2) != AC_JACK_PORT_NONE
)
5942 if (stac_get_defcfg_connect(codec
, idx
) != AC_JACK_PORT_NONE
)
5948 /* HP dv7 bass switch - GPIO5 */
5949 #define stac_hp_bass_gpio_info snd_ctl_boolean_mono_info
5950 static int stac_hp_bass_gpio_get(struct snd_kcontrol
*kcontrol
,
5951 struct snd_ctl_elem_value
*ucontrol
)
5953 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
5954 struct sigmatel_spec
*spec
= codec
->spec
;
5955 ucontrol
->value
.integer
.value
[0] = !!(spec
->gpio_data
& 0x20);
5959 static int stac_hp_bass_gpio_put(struct snd_kcontrol
*kcontrol
,
5960 struct snd_ctl_elem_value
*ucontrol
)
5962 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
5963 struct sigmatel_spec
*spec
= codec
->spec
;
5964 unsigned int gpio_data
;
5966 gpio_data
= (spec
->gpio_data
& ~0x20) |
5967 (ucontrol
->value
.integer
.value
[0] ? 0x20 : 0);
5968 if (gpio_data
== spec
->gpio_data
)
5970 spec
->gpio_data
= gpio_data
;
5971 stac_gpio_set(codec
, spec
->gpio_mask
, spec
->gpio_dir
, spec
->gpio_data
);
5975 static const struct snd_kcontrol_new stac_hp_bass_sw_ctrl
= {
5976 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5977 .info
= stac_hp_bass_gpio_info
,
5978 .get
= stac_hp_bass_gpio_get
,
5979 .put
= stac_hp_bass_gpio_put
,
5982 static int stac_add_hp_bass_switch(struct hda_codec
*codec
)
5984 struct sigmatel_spec
*spec
= codec
->spec
;
5986 if (!stac_control_new(spec
, &stac_hp_bass_sw_ctrl
,
5987 "Bass Speaker Playback Switch", 0))
5990 spec
->gpio_mask
|= 0x20;
5991 spec
->gpio_dir
|= 0x20;
5992 spec
->gpio_data
|= 0x20;
5996 static int patch_stac92hd71bxx(struct hda_codec
*codec
)
5998 struct sigmatel_spec
*spec
;
5999 const struct hda_verb
*unmute_init
= stac92hd71bxx_unmute_core_init
;
6000 unsigned int pin_cfg
;
6003 err
= alloc_stac_spec(codec
, STAC92HD71BXX_NUM_PINS
,
6004 stac92hd71bxx_pin_nids_4port
);
6009 spec
->linear_tone_beep
= 0;
6010 codec
->patch_ops
= stac92xx_patch_ops
;
6011 switch (codec
->vendor_id
) {
6017 /* On 92HD75Bx 0x27 isn't a pin nid */
6021 spec
->pin_nids
= stac92hd71bxx_pin_nids_6port
;
6023 spec
->num_pwrs
= ARRAY_SIZE(stac92hd71bxx_pwr_nids
);
6024 spec
->board_config
= snd_hda_check_board_config(codec
,
6025 STAC_92HD71BXX_MODELS
,
6026 stac92hd71bxx_models
,
6027 stac92hd71bxx_cfg_tbl
);
6029 if (spec
->board_config
< 0)
6030 snd_printdd(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
6033 stac92xx_set_config_regs(codec
,
6034 stac92hd71bxx_brd_tbl
[spec
->board_config
]);
6036 if (spec
->board_config
!= STAC_92HD71BXX_REF
) {
6038 spec
->gpio_mask
= 0x01;
6039 spec
->gpio_dir
= 0x01;
6040 spec
->gpio_data
= 0x01;
6043 spec
->dmic_nids
= stac92hd71bxx_dmic_nids
;
6044 spec
->dmux_nids
= stac92hd71bxx_dmux_nids
;
6046 spec
->num_caps
= STAC92HD71BXX_NUM_CAPS
;
6047 spec
->capvols
= stac92hd71bxx_capvols
;
6048 spec
->capsws
= stac92hd71bxx_capsws
;
6050 switch (codec
->vendor_id
) {
6051 case 0x111d76b6: /* 4 Port without Analog Mixer */
6055 case 0x111d76b4: /* 6 Port without Analog Mixer */
6057 codec
->slave_dig_outs
= stac92hd71bxx_slave_dig_outs
;
6058 spec
->num_dmics
= stac92xx_connected_ports(codec
,
6059 stac92hd71bxx_dmic_nids
,
6060 STAC92HD71BXX_NUM_DMICS
);
6062 case 0x111d7608: /* 5 Port with Analog Mixer */
6063 switch (spec
->board_config
) {
6065 /* Enable VREF power saving on GPIO1 detect */
6066 err
= stac_add_event(codec
, codec
->afg
,
6067 STAC_VREF_EVENT
, 0x02);
6070 snd_hda_codec_write_cache(codec
, codec
->afg
, 0,
6071 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK
, 0x02);
6072 snd_hda_jack_detect_enable(codec
, codec
->afg
, 0);
6073 spec
->gpio_mask
|= 0x02;
6076 if ((codec
->revision_id
& 0xf) == 0 ||
6077 (codec
->revision_id
& 0xf) == 1)
6078 spec
->stream_delay
= 40; /* 40 milliseconds */
6082 snd_hda_codec_set_pincfg(codec
, 0x0f, 0x40f000f0);
6083 snd_hda_codec_set_pincfg(codec
, 0x19, 0x40f000f3);
6084 spec
->dmic_nids
= stac92hd71bxx_dmic_5port_nids
;
6085 spec
->num_dmics
= stac92xx_connected_ports(codec
,
6086 stac92hd71bxx_dmic_5port_nids
,
6087 STAC92HD71BXX_NUM_DMICS
- 1);
6089 case 0x111d7603: /* 6 Port with Analog Mixer */
6090 if ((codec
->revision_id
& 0xf) == 1)
6091 spec
->stream_delay
= 40; /* 40 milliseconds */
6095 codec
->slave_dig_outs
= stac92hd71bxx_slave_dig_outs
;
6096 spec
->num_dmics
= stac92xx_connected_ports(codec
,
6097 stac92hd71bxx_dmic_nids
,
6098 STAC92HD71BXX_NUM_DMICS
);
6102 if (get_wcaps_type(get_wcaps(codec
, 0x28)) == AC_WID_VOL_KNB
)
6103 spec
->init
= stac92hd71bxx_core_init
;
6105 if (get_wcaps(codec
, 0xa) & AC_WCAP_IN_AMP
)
6106 snd_hda_sequence_write_cache(codec
, unmute_init
);
6108 spec
->aloopback_ctl
= stac92hd71bxx_loopback
;
6109 spec
->aloopback_mask
= 0x50;
6110 spec
->aloopback_shift
= 0;
6112 spec
->powerdown_adcs
= 1;
6113 spec
->digbeep_nid
= 0x26;
6114 spec
->mux_nids
= stac92hd71bxx_mux_nids
;
6115 spec
->adc_nids
= stac92hd71bxx_adc_nids
;
6116 spec
->smux_nids
= stac92hd71bxx_smux_nids
;
6117 spec
->pwr_nids
= stac92hd71bxx_pwr_nids
;
6119 spec
->num_muxes
= ARRAY_SIZE(stac92hd71bxx_mux_nids
);
6120 spec
->num_adcs
= ARRAY_SIZE(stac92hd71bxx_adc_nids
);
6121 spec
->num_dmuxes
= ARRAY_SIZE(stac92hd71bxx_dmux_nids
);
6122 spec
->num_smuxes
= stac92hd71bxx_connected_smuxes(codec
, 0x1e);
6124 snd_printdd("Found board config: %d\n", spec
->board_config
);
6126 switch (spec
->board_config
) {
6128 /* enable internal microphone */
6129 snd_hda_codec_set_pincfg(codec
, 0x0e, 0x01813040);
6130 stac92xx_auto_set_pinctl(codec
, 0x0e,
6131 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_80
);
6133 case STAC_DELL_M4_2
:
6134 spec
->num_dmics
= 0;
6135 spec
->num_smuxes
= 0;
6136 spec
->num_dmuxes
= 0;
6138 case STAC_DELL_M4_1
:
6139 case STAC_DELL_M4_3
:
6140 spec
->num_dmics
= 1;
6141 spec
->num_smuxes
= 0;
6142 spec
->num_dmuxes
= 1;
6144 case STAC_HP_DV4_1222NR
:
6145 spec
->num_dmics
= 1;
6146 /* I don't know if it needs 1 or 2 smuxes - will wait for
6147 * bug reports to fix if needed
6149 spec
->num_smuxes
= 1;
6150 spec
->num_dmuxes
= 1;
6153 spec
->gpio_led
= 0x01;
6156 snd_hda_codec_set_pincfg(codec
, 0x0d, 0x90170010);
6157 stac92xx_auto_set_pinctl(codec
, 0x0d, AC_PINCTL_OUT_EN
);
6158 /* HP dv6 gives the headphone pin as a line-out. Thus we
6159 * need to set hp_detect flag here to force to enable HP
6162 spec
->hp_detect
= 1;
6165 spec
->num_dmics
= 1;
6166 spec
->num_dmuxes
= 1;
6167 spec
->num_smuxes
= 1;
6168 spec
->gpio_led
= 0x08;
6172 if (hp_blike_system(codec
->subsystem_id
)) {
6173 pin_cfg
= snd_hda_codec_get_pincfg(codec
, 0x0f);
6174 if (get_defcfg_device(pin_cfg
) == AC_JACK_LINE_OUT
||
6175 get_defcfg_device(pin_cfg
) == AC_JACK_SPEAKER
||
6176 get_defcfg_device(pin_cfg
) == AC_JACK_HP_OUT
) {
6177 /* It was changed in the BIOS to just satisfy MS DTM.
6178 * Lets turn it back into slaved HP
6180 pin_cfg
= (pin_cfg
& (~AC_DEFCFG_DEVICE
))
6181 | (AC_JACK_HP_OUT
<<
6182 AC_DEFCFG_DEVICE_SHIFT
);
6183 pin_cfg
= (pin_cfg
& (~(AC_DEFCFG_DEF_ASSOC
6184 | AC_DEFCFG_SEQUENCE
)))
6186 snd_hda_codec_set_pincfg(codec
, 0x0f, pin_cfg
);
6190 if (find_mute_led_cfg(codec
, 1))
6191 snd_printd("mute LED gpio %d polarity %d\n",
6193 spec
->gpio_led_polarity
);
6195 if (spec
->gpio_led
) {
6196 if (!spec
->vref_mute_led_nid
) {
6197 spec
->gpio_mask
|= spec
->gpio_led
;
6198 spec
->gpio_dir
|= spec
->gpio_led
;
6199 spec
->gpio_data
|= spec
->gpio_led
;
6201 codec
->patch_ops
.set_power_state
=
6202 stac92xx_set_power_state
;
6206 spec
->multiout
.dac_nids
= spec
->dac_nids
;
6208 err
= stac92xx_parse_auto_config(codec
);
6210 if (spec
->board_config
< 0) {
6211 printk(KERN_WARNING
"hda_codec: No auto-config is "
6212 "available, default to model=ref\n");
6213 spec
->board_config
= STAC_92HD71BXX_REF
;
6220 stac92xx_free(codec
);
6224 /* enable bass on HP dv7 */
6225 if (spec
->board_config
== STAC_HP_DV4
||
6226 spec
->board_config
== STAC_HP_DV5
) {
6228 cap
= snd_hda_param_read(codec
, 0x1, AC_PAR_GPIO_CAP
);
6229 cap
&= AC_GPIO_IO_COUNT
;
6231 stac_add_hp_bass_switch(codec
);
6234 codec
->proc_widget_hook
= stac92hd7x_proc_hook
;
6239 static int patch_stac922x(struct hda_codec
*codec
)
6241 struct sigmatel_spec
*spec
;
6244 err
= alloc_stac_spec(codec
, ARRAY_SIZE(stac922x_pin_nids
),
6250 spec
->linear_tone_beep
= 1;
6251 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_922X_MODELS
,
6254 if (spec
->board_config
== STAC_INTEL_MAC_AUTO
) {
6255 spec
->gpio_mask
= spec
->gpio_dir
= 0x03;
6256 spec
->gpio_data
= 0x03;
6257 /* Intel Macs have all same PCI SSID, so we need to check
6258 * codec SSID to distinguish the exact models
6260 printk(KERN_INFO
"hda_codec: STAC922x, Apple subsys_id=%x\n", codec
->subsystem_id
);
6261 switch (codec
->subsystem_id
) {
6264 spec
->board_config
= STAC_INTEL_MAC_V1
;
6268 spec
->board_config
= STAC_INTEL_MAC_V2
;
6276 spec
->board_config
= STAC_INTEL_MAC_V3
;
6280 spec
->board_config
= STAC_INTEL_MAC_V4
;
6284 spec
->board_config
= STAC_INTEL_MAC_V5
;
6287 spec
->board_config
= STAC_INTEL_MAC_V3
;
6293 if (spec
->board_config
< 0)
6294 snd_printdd(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
6297 stac92xx_set_config_regs(codec
,
6298 stac922x_brd_tbl
[spec
->board_config
]);
6300 spec
->adc_nids
= stac922x_adc_nids
;
6301 spec
->mux_nids
= stac922x_mux_nids
;
6302 spec
->num_muxes
= ARRAY_SIZE(stac922x_mux_nids
);
6303 spec
->num_adcs
= ARRAY_SIZE(stac922x_adc_nids
);
6304 spec
->num_dmics
= 0;
6307 spec
->init
= stac922x_core_init
;
6309 spec
->num_caps
= STAC922X_NUM_CAPS
;
6310 spec
->capvols
= stac922x_capvols
;
6311 spec
->capsws
= stac922x_capsws
;
6313 spec
->multiout
.dac_nids
= spec
->dac_nids
;
6315 err
= stac92xx_parse_auto_config(codec
);
6317 if (spec
->board_config
< 0) {
6318 printk(KERN_WARNING
"hda_codec: No auto-config is "
6319 "available, default to model=ref\n");
6320 spec
->board_config
= STAC_D945_REF
;
6326 stac92xx_free(codec
);
6330 codec
->patch_ops
= stac92xx_patch_ops
;
6332 /* Fix Mux capture level; max to 2 */
6333 snd_hda_override_amp_caps(codec
, 0x12, HDA_OUTPUT
,
6334 (0 << AC_AMPCAP_OFFSET_SHIFT
) |
6335 (2 << AC_AMPCAP_NUM_STEPS_SHIFT
) |
6336 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
6337 (0 << AC_AMPCAP_MUTE_SHIFT
));
6342 static int patch_stac927x(struct hda_codec
*codec
)
6344 struct sigmatel_spec
*spec
;
6347 err
= alloc_stac_spec(codec
, ARRAY_SIZE(stac927x_pin_nids
),
6353 spec
->linear_tone_beep
= 1;
6354 codec
->slave_dig_outs
= stac927x_slave_dig_outs
;
6355 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_927X_MODELS
,
6359 if (spec
->board_config
< 0)
6360 snd_printdd(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
6363 stac92xx_set_config_regs(codec
,
6364 stac927x_brd_tbl
[spec
->board_config
]);
6366 spec
->digbeep_nid
= 0x23;
6367 spec
->adc_nids
= stac927x_adc_nids
;
6368 spec
->num_adcs
= ARRAY_SIZE(stac927x_adc_nids
);
6369 spec
->mux_nids
= stac927x_mux_nids
;
6370 spec
->num_muxes
= ARRAY_SIZE(stac927x_mux_nids
);
6371 spec
->smux_nids
= stac927x_smux_nids
;
6372 spec
->num_smuxes
= ARRAY_SIZE(stac927x_smux_nids
);
6373 spec
->spdif_labels
= stac927x_spdif_labels
;
6374 spec
->dac_list
= stac927x_dac_nids
;
6375 spec
->multiout
.dac_nids
= spec
->dac_nids
;
6377 if (spec
->board_config
!= STAC_D965_REF
) {
6378 /* GPIO0 High = Enable EAPD */
6379 spec
->eapd_mask
= spec
->gpio_mask
= 0x01;
6380 spec
->gpio_dir
= spec
->gpio_data
= 0x01;
6383 switch (spec
->board_config
) {
6386 /* GPIO0 High = Enable EAPD */
6387 spec
->num_dmics
= 0;
6388 spec
->init
= d965_core_init
;
6390 case STAC_DELL_BIOS
:
6391 switch (codec
->subsystem_id
) {
6394 /* correct the device field to SPDIF out */
6395 snd_hda_codec_set_pincfg(codec
, 0x21, 0x01442070);
6398 /* configure the analog microphone on some laptops */
6399 snd_hda_codec_set_pincfg(codec
, 0x0c, 0x90a79130);
6400 /* correct the front output jack as a hp out */
6401 snd_hda_codec_set_pincfg(codec
, 0x0f, 0x0227011f);
6402 /* correct the front input jack as a mic */
6403 snd_hda_codec_set_pincfg(codec
, 0x0e, 0x02a79130);
6406 if (codec
->subsystem_id
!= 0x1028022f) {
6407 /* GPIO2 High = Enable EAPD */
6408 spec
->eapd_mask
= spec
->gpio_mask
= 0x04;
6409 spec
->gpio_dir
= spec
->gpio_data
= 0x04;
6411 spec
->dmic_nids
= stac927x_dmic_nids
;
6412 spec
->num_dmics
= STAC927X_NUM_DMICS
;
6414 spec
->init
= dell_3st_core_init
;
6415 spec
->dmux_nids
= stac927x_dmux_nids
;
6416 spec
->num_dmuxes
= ARRAY_SIZE(stac927x_dmux_nids
);
6418 case STAC_927X_VOLKNOB
:
6419 spec
->num_dmics
= 0;
6420 spec
->init
= stac927x_volknob_core_init
;
6423 spec
->num_dmics
= 0;
6424 spec
->init
= stac927x_core_init
;
6428 spec
->num_caps
= STAC927X_NUM_CAPS
;
6429 spec
->capvols
= stac927x_capvols
;
6430 spec
->capsws
= stac927x_capsws
;
6433 spec
->aloopback_ctl
= stac927x_loopback
;
6434 spec
->aloopback_mask
= 0x40;
6435 spec
->aloopback_shift
= 0;
6436 spec
->eapd_switch
= 1;
6438 err
= stac92xx_parse_auto_config(codec
);
6440 if (spec
->board_config
< 0) {
6441 printk(KERN_WARNING
"hda_codec: No auto-config is "
6442 "available, default to model=ref\n");
6443 spec
->board_config
= STAC_D965_REF
;
6449 stac92xx_free(codec
);
6453 codec
->patch_ops
= stac92xx_patch_ops
;
6455 codec
->proc_widget_hook
= stac927x_proc_hook
;
6459 * The STAC927x seem to require fairly long delays for certain
6460 * command sequences. With too short delays (even if the answer
6461 * is set to RIRB properly), it results in the silence output
6462 * on some hardwares like Dell.
6464 * The below flag enables the longer delay (see get_response
6467 codec
->bus
->needs_damn_long_delay
= 1;
6469 /* no jack detecion for ref-no-jd model */
6470 if (spec
->board_config
== STAC_D965_REF_NO_JD
)
6471 spec
->hp_detect
= 0;
6476 static int patch_stac9205(struct hda_codec
*codec
)
6478 struct sigmatel_spec
*spec
;
6481 err
= alloc_stac_spec(codec
, ARRAY_SIZE(stac9205_pin_nids
),
6487 spec
->linear_tone_beep
= 1;
6488 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_9205_MODELS
,
6492 if (spec
->board_config
< 0)
6493 snd_printdd(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
6496 stac92xx_set_config_regs(codec
,
6497 stac9205_brd_tbl
[spec
->board_config
]);
6499 spec
->digbeep_nid
= 0x23;
6500 spec
->adc_nids
= stac9205_adc_nids
;
6501 spec
->num_adcs
= ARRAY_SIZE(stac9205_adc_nids
);
6502 spec
->mux_nids
= stac9205_mux_nids
;
6503 spec
->num_muxes
= ARRAY_SIZE(stac9205_mux_nids
);
6504 spec
->smux_nids
= stac9205_smux_nids
;
6505 spec
->num_smuxes
= ARRAY_SIZE(stac9205_smux_nids
);
6506 spec
->dmic_nids
= stac9205_dmic_nids
;
6507 spec
->num_dmics
= STAC9205_NUM_DMICS
;
6508 spec
->dmux_nids
= stac9205_dmux_nids
;
6509 spec
->num_dmuxes
= ARRAY_SIZE(stac9205_dmux_nids
);
6512 spec
->init
= stac9205_core_init
;
6513 spec
->aloopback_ctl
= stac9205_loopback
;
6515 spec
->num_caps
= STAC9205_NUM_CAPS
;
6516 spec
->capvols
= stac9205_capvols
;
6517 spec
->capsws
= stac9205_capsws
;
6519 spec
->aloopback_mask
= 0x40;
6520 spec
->aloopback_shift
= 0;
6521 /* Turn on/off EAPD per HP plugging */
6522 if (spec
->board_config
!= STAC_9205_EAPD
)
6523 spec
->eapd_switch
= 1;
6524 spec
->multiout
.dac_nids
= spec
->dac_nids
;
6526 switch (spec
->board_config
){
6527 case STAC_9205_DELL_M43
:
6528 /* Enable SPDIF in/out */
6529 snd_hda_codec_set_pincfg(codec
, 0x1f, 0x01441030);
6530 snd_hda_codec_set_pincfg(codec
, 0x20, 0x1c410030);
6532 /* Enable unsol response for GPIO4/Dock HP connection */
6533 err
= stac_add_event(codec
, codec
->afg
, STAC_VREF_EVENT
, 0x01);
6536 snd_hda_codec_write_cache(codec
, codec
->afg
, 0,
6537 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK
, 0x10);
6538 snd_hda_jack_detect_enable(codec
, codec
->afg
, 0);
6540 spec
->gpio_dir
= 0x0b;
6541 spec
->eapd_mask
= 0x01;
6542 spec
->gpio_mask
= 0x1b;
6543 spec
->gpio_mute
= 0x10;
6544 /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute,
6547 spec
->gpio_data
= 0x01;
6550 /* SPDIF-In enabled */
6553 /* GPIO0 High = EAPD */
6554 spec
->eapd_mask
= spec
->gpio_mask
= spec
->gpio_dir
= 0x1;
6555 spec
->gpio_data
= 0x01;
6559 err
= stac92xx_parse_auto_config(codec
);
6561 if (spec
->board_config
< 0) {
6562 printk(KERN_WARNING
"hda_codec: No auto-config is "
6563 "available, default to model=ref\n");
6564 spec
->board_config
= STAC_9205_REF
;
6570 stac92xx_free(codec
);
6574 codec
->patch_ops
= stac92xx_patch_ops
;
6576 codec
->proc_widget_hook
= stac9205_proc_hook
;
6585 static const struct hda_verb stac9872_core_init
[] = {
6586 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x1}, /* mic-sel: 0a,0d,14,02 */
6587 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Mic-in -> 0x9 */
6591 static const hda_nid_t stac9872_pin_nids
[] = {
6592 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
6596 static const hda_nid_t stac9872_adc_nids
[] = {
6600 static const hda_nid_t stac9872_mux_nids
[] = {
6604 static const unsigned long stac9872_capvols
[] = {
6605 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
6607 #define stac9872_capsws stac9872_capvols
6609 static const unsigned int stac9872_vaio_pin_configs
[9] = {
6610 0x03211020, 0x411111f0, 0x411111f0, 0x03a15030,
6611 0x411111f0, 0x90170110, 0x411111f0, 0x411111f0,
6615 static const char * const stac9872_models
[STAC_9872_MODELS
] = {
6616 [STAC_9872_AUTO
] = "auto",
6617 [STAC_9872_VAIO
] = "vaio",
6620 static const unsigned int *stac9872_brd_tbl
[STAC_9872_MODELS
] = {
6621 [STAC_9872_VAIO
] = stac9872_vaio_pin_configs
,
6624 static const struct snd_pci_quirk stac9872_cfg_tbl
[] = {
6625 SND_PCI_QUIRK_MASK(0x104d, 0xfff0, 0x81e0,
6626 "Sony VAIO F/S", STAC_9872_VAIO
),
6630 static int patch_stac9872(struct hda_codec
*codec
)
6632 struct sigmatel_spec
*spec
;
6635 err
= alloc_stac_spec(codec
, ARRAY_SIZE(stac9872_pin_nids
),
6641 spec
->linear_tone_beep
= 1;
6643 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_9872_MODELS
,
6646 if (spec
->board_config
< 0)
6647 snd_printdd(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
6650 stac92xx_set_config_regs(codec
,
6651 stac9872_brd_tbl
[spec
->board_config
]);
6653 spec
->multiout
.dac_nids
= spec
->dac_nids
;
6654 spec
->num_adcs
= ARRAY_SIZE(stac9872_adc_nids
);
6655 spec
->adc_nids
= stac9872_adc_nids
;
6656 spec
->num_muxes
= ARRAY_SIZE(stac9872_mux_nids
);
6657 spec
->mux_nids
= stac9872_mux_nids
;
6658 spec
->init
= stac9872_core_init
;
6660 spec
->capvols
= stac9872_capvols
;
6661 spec
->capsws
= stac9872_capsws
;
6663 err
= stac92xx_parse_auto_config(codec
);
6665 stac92xx_free(codec
);
6668 spec
->input_mux
= &spec
->private_imux
;
6669 codec
->patch_ops
= stac92xx_patch_ops
;
6677 static const struct hda_codec_preset snd_hda_preset_sigmatel
[] = {
6678 { .id
= 0x83847690, .name
= "STAC9200", .patch
= patch_stac9200
},
6679 { .id
= 0x83847882, .name
= "STAC9220 A1", .patch
= patch_stac922x
},
6680 { .id
= 0x83847680, .name
= "STAC9221 A1", .patch
= patch_stac922x
},
6681 { .id
= 0x83847880, .name
= "STAC9220 A2", .patch
= patch_stac922x
},
6682 { .id
= 0x83847681, .name
= "STAC9220D/9223D A2", .patch
= patch_stac922x
},
6683 { .id
= 0x83847682, .name
= "STAC9221 A2", .patch
= patch_stac922x
},
6684 { .id
= 0x83847683, .name
= "STAC9221D A2", .patch
= patch_stac922x
},
6685 { .id
= 0x83847618, .name
= "STAC9227", .patch
= patch_stac927x
},
6686 { .id
= 0x83847619, .name
= "STAC9227", .patch
= patch_stac927x
},
6687 { .id
= 0x83847616, .name
= "STAC9228", .patch
= patch_stac927x
},
6688 { .id
= 0x83847617, .name
= "STAC9228", .patch
= patch_stac927x
},
6689 { .id
= 0x83847614, .name
= "STAC9229", .patch
= patch_stac927x
},
6690 { .id
= 0x83847615, .name
= "STAC9229", .patch
= patch_stac927x
},
6691 { .id
= 0x83847620, .name
= "STAC9274", .patch
= patch_stac927x
},
6692 { .id
= 0x83847621, .name
= "STAC9274D", .patch
= patch_stac927x
},
6693 { .id
= 0x83847622, .name
= "STAC9273X", .patch
= patch_stac927x
},
6694 { .id
= 0x83847623, .name
= "STAC9273D", .patch
= patch_stac927x
},
6695 { .id
= 0x83847624, .name
= "STAC9272X", .patch
= patch_stac927x
},
6696 { .id
= 0x83847625, .name
= "STAC9272D", .patch
= patch_stac927x
},
6697 { .id
= 0x83847626, .name
= "STAC9271X", .patch
= patch_stac927x
},
6698 { .id
= 0x83847627, .name
= "STAC9271D", .patch
= patch_stac927x
},
6699 { .id
= 0x83847628, .name
= "STAC9274X5NH", .patch
= patch_stac927x
},
6700 { .id
= 0x83847629, .name
= "STAC9274D5NH", .patch
= patch_stac927x
},
6701 { .id
= 0x83847632, .name
= "STAC9202", .patch
= patch_stac925x
},
6702 { .id
= 0x83847633, .name
= "STAC9202D", .patch
= patch_stac925x
},
6703 { .id
= 0x83847634, .name
= "STAC9250", .patch
= patch_stac925x
},
6704 { .id
= 0x83847635, .name
= "STAC9250D", .patch
= patch_stac925x
},
6705 { .id
= 0x83847636, .name
= "STAC9251", .patch
= patch_stac925x
},
6706 { .id
= 0x83847637, .name
= "STAC9250D", .patch
= patch_stac925x
},
6707 { .id
= 0x83847645, .name
= "92HD206X", .patch
= patch_stac927x
},
6708 { .id
= 0x83847646, .name
= "92HD206D", .patch
= patch_stac927x
},
6709 /* The following does not take into account .id=0x83847661 when subsys =
6710 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
6711 * currently not fully supported.
6713 { .id
= 0x83847661, .name
= "CXD9872RD/K", .patch
= patch_stac9872
},
6714 { .id
= 0x83847662, .name
= "STAC9872AK", .patch
= patch_stac9872
},
6715 { .id
= 0x83847664, .name
= "CXD9872AKD", .patch
= patch_stac9872
},
6716 { .id
= 0x83847698, .name
= "STAC9205", .patch
= patch_stac9205
},
6717 { .id
= 0x838476a0, .name
= "STAC9205", .patch
= patch_stac9205
},
6718 { .id
= 0x838476a1, .name
= "STAC9205D", .patch
= patch_stac9205
},
6719 { .id
= 0x838476a2, .name
= "STAC9204", .patch
= patch_stac9205
},
6720 { .id
= 0x838476a3, .name
= "STAC9204D", .patch
= patch_stac9205
},
6721 { .id
= 0x838476a4, .name
= "STAC9255", .patch
= patch_stac9205
},
6722 { .id
= 0x838476a5, .name
= "STAC9255D", .patch
= patch_stac9205
},
6723 { .id
= 0x838476a6, .name
= "STAC9254", .patch
= patch_stac9205
},
6724 { .id
= 0x838476a7, .name
= "STAC9254D", .patch
= patch_stac9205
},
6725 { .id
= 0x111d7603, .name
= "92HD75B3X5", .patch
= patch_stac92hd71bxx
},
6726 { .id
= 0x111d7604, .name
= "92HD83C1X5", .patch
= patch_stac92hd83xxx
},
6727 { .id
= 0x111d76d4, .name
= "92HD83C1C5", .patch
= patch_stac92hd83xxx
},
6728 { .id
= 0x111d7605, .name
= "92HD81B1X5", .patch
= patch_stac92hd83xxx
},
6729 { .id
= 0x111d76d5, .name
= "92HD81B1C5", .patch
= patch_stac92hd83xxx
},
6730 { .id
= 0x111d76d1, .name
= "92HD87B1/3", .patch
= patch_stac92hd83xxx
},
6731 { .id
= 0x111d76d9, .name
= "92HD87B2/4", .patch
= patch_stac92hd83xxx
},
6732 { .id
= 0x111d7666, .name
= "92HD88B3", .patch
= patch_stac92hd83xxx
},
6733 { .id
= 0x111d7667, .name
= "92HD88B1", .patch
= patch_stac92hd83xxx
},
6734 { .id
= 0x111d7668, .name
= "92HD88B2", .patch
= patch_stac92hd83xxx
},
6735 { .id
= 0x111d7669, .name
= "92HD88B4", .patch
= patch_stac92hd83xxx
},
6736 { .id
= 0x111d7608, .name
= "92HD75B2X5", .patch
= patch_stac92hd71bxx
},
6737 { .id
= 0x111d7674, .name
= "92HD73D1X5", .patch
= patch_stac92hd73xx
},
6738 { .id
= 0x111d7675, .name
= "92HD73C1X5", .patch
= patch_stac92hd73xx
},
6739 { .id
= 0x111d7676, .name
= "92HD73E1X5", .patch
= patch_stac92hd73xx
},
6740 { .id
= 0x111d76b0, .name
= "92HD71B8X", .patch
= patch_stac92hd71bxx
},
6741 { .id
= 0x111d76b1, .name
= "92HD71B8X", .patch
= patch_stac92hd71bxx
},
6742 { .id
= 0x111d76b2, .name
= "92HD71B7X", .patch
= patch_stac92hd71bxx
},
6743 { .id
= 0x111d76b3, .name
= "92HD71B7X", .patch
= patch_stac92hd71bxx
},
6744 { .id
= 0x111d76b4, .name
= "92HD71B6X", .patch
= patch_stac92hd71bxx
},
6745 { .id
= 0x111d76b5, .name
= "92HD71B6X", .patch
= patch_stac92hd71bxx
},
6746 { .id
= 0x111d76b6, .name
= "92HD71B5X", .patch
= patch_stac92hd71bxx
},
6747 { .id
= 0x111d76b7, .name
= "92HD71B5X", .patch
= patch_stac92hd71bxx
},
6748 { .id
= 0x111d76c0, .name
= "92HD89C3", .patch
= patch_stac92hd73xx
},
6749 { .id
= 0x111d76c1, .name
= "92HD89C2", .patch
= patch_stac92hd73xx
},
6750 { .id
= 0x111d76c2, .name
= "92HD89C1", .patch
= patch_stac92hd73xx
},
6751 { .id
= 0x111d76c3, .name
= "92HD89B3", .patch
= patch_stac92hd73xx
},
6752 { .id
= 0x111d76c4, .name
= "92HD89B2", .patch
= patch_stac92hd73xx
},
6753 { .id
= 0x111d76c5, .name
= "92HD89B1", .patch
= patch_stac92hd73xx
},
6754 { .id
= 0x111d76c6, .name
= "92HD89E3", .patch
= patch_stac92hd73xx
},
6755 { .id
= 0x111d76c7, .name
= "92HD89E2", .patch
= patch_stac92hd73xx
},
6756 { .id
= 0x111d76c8, .name
= "92HD89E1", .patch
= patch_stac92hd73xx
},
6757 { .id
= 0x111d76c9, .name
= "92HD89D3", .patch
= patch_stac92hd73xx
},
6758 { .id
= 0x111d76ca, .name
= "92HD89D2", .patch
= patch_stac92hd73xx
},
6759 { .id
= 0x111d76cb, .name
= "92HD89D1", .patch
= patch_stac92hd73xx
},
6760 { .id
= 0x111d76cc, .name
= "92HD89F3", .patch
= patch_stac92hd73xx
},
6761 { .id
= 0x111d76cd, .name
= "92HD89F2", .patch
= patch_stac92hd73xx
},
6762 { .id
= 0x111d76ce, .name
= "92HD89F1", .patch
= patch_stac92hd73xx
},
6763 { .id
= 0x111d76df, .name
= "92HD93BXX", .patch
= patch_stac92hd83xxx
},
6764 { .id
= 0x111d76e0, .name
= "92HD91BXX", .patch
= patch_stac92hd83xxx
},
6765 { .id
= 0x111d76e3, .name
= "92HD98BXX", .patch
= patch_stac92hd83xxx
},
6766 { .id
= 0x111d76e5, .name
= "92HD99BXX", .patch
= patch_stac92hd83xxx
},
6767 { .id
= 0x111d76e7, .name
= "92HD90BXX", .patch
= patch_stac92hd83xxx
},
6768 { .id
= 0x111d76e8, .name
= "92HD66B1X5", .patch
= patch_stac92hd83xxx
},
6769 { .id
= 0x111d76e9, .name
= "92HD66B2X5", .patch
= patch_stac92hd83xxx
},
6770 { .id
= 0x111d76ea, .name
= "92HD66B3X5", .patch
= patch_stac92hd83xxx
},
6771 { .id
= 0x111d76eb, .name
= "92HD66C1X5", .patch
= patch_stac92hd83xxx
},
6772 { .id
= 0x111d76ec, .name
= "92HD66C2X5", .patch
= patch_stac92hd83xxx
},
6773 { .id
= 0x111d76ed, .name
= "92HD66C3X5", .patch
= patch_stac92hd83xxx
},
6774 { .id
= 0x111d76ee, .name
= "92HD66B1X3", .patch
= patch_stac92hd83xxx
},
6775 { .id
= 0x111d76ef, .name
= "92HD66B2X3", .patch
= patch_stac92hd83xxx
},
6776 { .id
= 0x111d76f0, .name
= "92HD66B3X3", .patch
= patch_stac92hd83xxx
},
6777 { .id
= 0x111d76f1, .name
= "92HD66C1X3", .patch
= patch_stac92hd83xxx
},
6778 { .id
= 0x111d76f2, .name
= "92HD66C2X3", .patch
= patch_stac92hd83xxx
},
6779 { .id
= 0x111d76f3, .name
= "92HD66C3/65", .patch
= patch_stac92hd83xxx
},
6783 MODULE_ALIAS("snd-hda-codec-id:8384*");
6784 MODULE_ALIAS("snd-hda-codec-id:111d*");
6786 MODULE_LICENSE("GPL");
6787 MODULE_DESCRIPTION("IDT/Sigmatel HD-audio codec");
6789 static struct hda_codec_preset_list sigmatel_list
= {
6790 .preset
= snd_hda_preset_sigmatel
,
6791 .owner
= THIS_MODULE
,
6794 static int __init
patch_sigmatel_init(void)
6796 return snd_hda_add_codec_preset(&sigmatel_list
);
6799 static void __exit
patch_sigmatel_exit(void)
6801 snd_hda_delete_codec_preset(&sigmatel_list
);
6804 module_init(patch_sigmatel_init
)
6805 module_exit(patch_sigmatel_exit
)