1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Universal Interface for Intel High Definition Audio Codec
5 * HD audio interface patch for SigmaTel STAC92xx
7 * Copyright (c) 2005 Embedded Alley Solutions, Inc.
8 * Matt Porter <mporter@embeddedalley.com>
10 * Based on patch_cmedia.c and patch_realtek.c
11 * Copyright (c) 2004 Takashi Iwai <tiwai@suse.de>
14 #include <linux/init.h>
15 #include <linux/delay.h>
16 #include <linux/slab.h>
17 #include <linux/pci.h>
18 #include <linux/dmi.h>
19 #include <linux/module.h>
20 #include <sound/core.h>
21 #include <sound/jack.h>
22 #include <sound/hda_codec.h>
23 #include "hda_local.h"
24 #include "hda_auto_parser.h"
27 #include "hda_generic.h"
59 STAC_92HD73XX_NO_JD, /* no jack-detection */
67 STAC_ELO_VUPOINT_15MX,
68 STAC_92HD89XX_HP_FRONT_JACK,
69 STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK,
70 STAC_92HD73XX_ASUS_MOBO,
76 STAC_92HD83XXX_PWR_REF,
78 STAC_DELL_VOSTRO_3500,
79 STAC_92HD83XXX_HP_cNB11_INTQUAD,
82 STAC_92HD83XXX_HP_LED,
83 STAC_92HD83XXX_HP_INV_LED,
84 STAC_92HD83XXX_HP_MIC_LED,
86 STAC_92HD83XXX_HEADSET_JACK,
91 STAC_HP_ENVY_TS_DAC_BIND,
92 STAC_92HD83XXX_GPIO10_EAPD,
106 STAC_92HD71BXX_NO_DMIC,
107 STAC_92HD71BXX_NO_SMUX,
108 STAC_92HD71BXX_MODELS
144 STAC_922X_INTEL_MAC_GPIO,
149 STAC_D965_REF_NO_JD, /* no jack-detection */
159 STAC_DELL_BIOS_SPDIF,
170 struct sigmatel_spec {
171 struct hda_gen_spec gen;
173 unsigned int eapd_switch: 1;
174 unsigned int linear_tone_beep:1;
175 unsigned int headset_jack:1; /* 4-pin headset jack (hp + mono mic) */
176 unsigned int volknob_init:1; /* special volume-knob initialization */
177 unsigned int powerdown_adcs:1;
178 unsigned int have_spdif_mux:1;
181 unsigned int eapd_mask;
182 unsigned int gpio_mask;
183 unsigned int gpio_dir;
184 unsigned int gpio_data;
185 unsigned int gpio_mute;
186 unsigned int gpio_led;
187 unsigned int gpio_led_polarity;
188 unsigned int vref_mute_led_nid; /* pin NID for mute-LED vref control */
189 unsigned int vref_led;
190 int default_polarity;
192 unsigned int mic_mute_led_gpio; /* capture mute LED GPIO */
193 unsigned int mic_enabled; /* current mic mute state (bitmask) */
196 unsigned int stream_delay;
198 /* analog loopback */
199 const struct snd_kcontrol_new *aloopback_ctl;
200 unsigned int aloopback;
201 unsigned char aloopback_mask;
202 unsigned char aloopback_shift;
204 /* power management */
205 unsigned int power_map_bits;
206 unsigned int num_pwrs;
207 const hda_nid_t *pwr_nids;
208 unsigned int active_adcs;
211 hda_nid_t anabeep_nid;
214 const char * const *spdif_labels;
215 struct hda_input_mux spdif_mux;
216 unsigned int cur_smux[2];
219 #define AC_VERB_IDT_SET_POWER_MAP 0x7ec
220 #define AC_VERB_IDT_GET_POWER_MAP 0xfec
222 static const hda_nid_t stac92hd73xx_pwr_nids[8] = {
223 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
227 static const hda_nid_t stac92hd83xxx_pwr_nids[7] = {
228 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
232 static const hda_nid_t stac92hd71bxx_pwr_nids[3] = {
240 static void stac_playback_pcm_hook(struct hda_pcm_stream *hinfo,
241 struct hda_codec *codec,
242 struct snd_pcm_substream *substream,
245 struct sigmatel_spec *spec = codec->spec;
246 if (action == HDA_GEN_PCM_ACT_OPEN && spec->stream_delay)
247 msleep(spec->stream_delay);
250 static void stac_capture_pcm_hook(struct hda_pcm_stream *hinfo,
251 struct hda_codec *codec,
252 struct snd_pcm_substream *substream,
255 struct sigmatel_spec *spec = codec->spec;
258 if (!spec->powerdown_adcs)
261 for (i = 0; i < spec->gen.num_all_adcs; i++) {
262 if (spec->gen.all_adcs[i] == hinfo->nid) {
269 case HDA_GEN_PCM_ACT_OPEN:
271 snd_hda_codec_write(codec, hinfo->nid, 0,
272 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
273 spec->active_adcs |= (1 << idx);
275 case HDA_GEN_PCM_ACT_CLOSE:
276 snd_hda_codec_write(codec, hinfo->nid, 0,
277 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
278 spec->active_adcs &= ~(1 << idx);
284 * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
285 * funky external mute control using GPIO pins.
288 static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,
289 unsigned int dir_mask, unsigned int data)
291 unsigned int gpiostate, gpiomask, gpiodir;
292 hda_nid_t fg = codec->core.afg;
294 codec_dbg(codec, "%s msk %x dir %x gpio %x\n", __func__, mask, dir_mask, data);
296 gpiostate = snd_hda_codec_read(codec, fg, 0,
297 AC_VERB_GET_GPIO_DATA, 0);
298 gpiostate = (gpiostate & ~dir_mask) | (data & dir_mask);
300 gpiomask = snd_hda_codec_read(codec, fg, 0,
301 AC_VERB_GET_GPIO_MASK, 0);
304 gpiodir = snd_hda_codec_read(codec, fg, 0,
305 AC_VERB_GET_GPIO_DIRECTION, 0);
308 /* Configure GPIOx as CMOS */
309 snd_hda_codec_write(codec, fg, 0, 0x7e7, 0);
311 snd_hda_codec_write(codec, fg, 0,
312 AC_VERB_SET_GPIO_MASK, gpiomask);
313 snd_hda_codec_read(codec, fg, 0,
314 AC_VERB_SET_GPIO_DIRECTION, gpiodir); /* sync */
318 snd_hda_codec_read(codec, fg, 0,
319 AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */
322 /* hook for controlling mic-mute LED GPIO */
323 static void stac_capture_led_update(struct hda_codec *codec)
325 struct sigmatel_spec *spec = codec->spec;
327 if (spec->gen.micmute_led.led_value)
328 spec->gpio_data |= spec->mic_mute_led_gpio;
330 spec->gpio_data &= ~spec->mic_mute_led_gpio;
331 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data);
334 static int stac_vrefout_set(struct hda_codec *codec,
335 hda_nid_t nid, unsigned int new_vref)
339 codec_dbg(codec, "%s, nid %x ctl %x\n", __func__, nid, new_vref);
340 pinctl = snd_hda_codec_read(codec, nid, 0,
341 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
347 pinctl &= ~AC_PINCTL_VREFEN;
348 pinctl |= (new_vref & AC_PINCTL_VREFEN);
350 error = snd_hda_set_pin_ctl_cache(codec, nid, pinctl);
357 /* prevent codec AFG to D3 state when vref-out pin is used for mute LED */
358 /* this hook is set in stac_setup_gpio() */
359 static unsigned int stac_vref_led_power_filter(struct hda_codec *codec,
361 unsigned int power_state)
363 if (nid == codec->core.afg && power_state == AC_PWRST_D3)
365 return snd_hda_gen_path_power_filter(codec, nid, power_state);
368 /* update mute-LED accoring to the master switch */
369 static void stac_update_led_status(struct hda_codec *codec, int enabled)
371 struct sigmatel_spec *spec = codec->spec;
372 int muted = !enabled;
377 /* LED state is inverted on these systems */
378 if (spec->gpio_led_polarity)
381 if (!spec->vref_mute_led_nid) {
383 spec->gpio_data |= spec->gpio_led;
385 spec->gpio_data &= ~spec->gpio_led;
386 stac_gpio_set(codec, spec->gpio_mask,
387 spec->gpio_dir, spec->gpio_data);
389 spec->vref_led = muted ? AC_PINCTL_VREF_50 : AC_PINCTL_VREF_GRD;
390 stac_vrefout_set(codec, spec->vref_mute_led_nid,
395 /* vmaster hook to update mute LED */
396 static void stac_vmaster_hook(void *private_data, int val)
398 stac_update_led_status(private_data, val);
401 /* automute hook to handle GPIO mute and EAPD updates */
402 static void stac_update_outputs(struct hda_codec *codec)
404 struct sigmatel_spec *spec = codec->spec;
407 spec->gen.master_mute =
408 !(snd_hda_codec_read(codec, codec->core.afg, 0,
409 AC_VERB_GET_GPIO_DATA, 0) & spec->gpio_mute);
411 snd_hda_gen_update_outputs(codec);
413 if (spec->eapd_mask && spec->eapd_switch) {
414 unsigned int val = spec->gpio_data;
415 if (spec->gen.speaker_muted)
416 val &= ~spec->eapd_mask;
418 val |= spec->eapd_mask;
419 if (spec->gpio_data != val) {
420 spec->gpio_data = val;
421 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir,
427 static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
428 bool enable, bool do_write)
430 struct sigmatel_spec *spec = codec->spec;
431 unsigned int idx, val;
433 for (idx = 0; idx < spec->num_pwrs; idx++) {
434 if (spec->pwr_nids[idx] == nid)
437 if (idx >= spec->num_pwrs)
442 val = spec->power_map_bits;
448 /* power down unused output ports */
449 if (val != spec->power_map_bits) {
450 spec->power_map_bits = val;
452 snd_hda_codec_write(codec, codec->core.afg, 0,
453 AC_VERB_IDT_SET_POWER_MAP, val);
457 /* update power bit per jack plug/unplug */
458 static void jack_update_power(struct hda_codec *codec,
459 struct hda_jack_callback *jack)
461 struct sigmatel_spec *spec = codec->spec;
467 if (jack && jack->nid) {
468 stac_toggle_power_map(codec, jack->nid,
469 snd_hda_jack_detect(codec, jack->nid),
474 /* update all jacks */
475 for (i = 0; i < spec->num_pwrs; i++) {
476 hda_nid_t nid = spec->pwr_nids[i];
477 if (!snd_hda_jack_tbl_get(codec, nid))
479 stac_toggle_power_map(codec, nid,
480 snd_hda_jack_detect(codec, nid),
484 snd_hda_codec_write(codec, codec->core.afg, 0,
485 AC_VERB_IDT_SET_POWER_MAP,
486 spec->power_map_bits);
489 static void stac_vref_event(struct hda_codec *codec,
490 struct hda_jack_callback *event)
494 data = snd_hda_codec_read(codec, codec->core.afg, 0,
495 AC_VERB_GET_GPIO_DATA, 0);
496 /* toggle VREF state based on GPIOx status */
497 snd_hda_codec_write(codec, codec->core.afg, 0, 0x7e0,
498 !!(data & (1 << event->private_data)));
501 /* initialize the power map and enable the power event to jacks that
502 * haven't been assigned to automute
504 static void stac_init_power_map(struct hda_codec *codec)
506 struct sigmatel_spec *spec = codec->spec;
509 for (i = 0; i < spec->num_pwrs; i++) {
510 hda_nid_t nid = spec->pwr_nids[i];
511 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
512 def_conf = get_defcfg_connect(def_conf);
513 if (def_conf == AC_JACK_PORT_COMPLEX &&
514 spec->vref_mute_led_nid != nid &&
515 is_jack_detectable(codec, nid)) {
516 snd_hda_jack_detect_enable_callback(codec, nid,
519 if (def_conf == AC_JACK_PORT_NONE)
520 stac_toggle_power_map(codec, nid, false, false);
522 stac_toggle_power_map(codec, nid, true, false);
530 static inline bool get_int_hint(struct hda_codec *codec, const char *key,
533 return !snd_hda_get_int_hint(codec, key, valp);
536 /* override some hints from the hwdep entry */
537 static void stac_store_hints(struct hda_codec *codec)
539 struct sigmatel_spec *spec = codec->spec;
542 if (get_int_hint(codec, "gpio_mask", &spec->gpio_mask)) {
543 spec->eapd_mask = spec->gpio_dir = spec->gpio_data =
546 if (get_int_hint(codec, "gpio_dir", &spec->gpio_dir))
547 spec->gpio_dir &= spec->gpio_mask;
548 if (get_int_hint(codec, "gpio_data", &spec->gpio_data))
549 spec->gpio_data &= spec->gpio_mask;
550 if (get_int_hint(codec, "eapd_mask", &spec->eapd_mask))
551 spec->eapd_mask &= spec->gpio_mask;
552 if (get_int_hint(codec, "gpio_mute", &spec->gpio_mute))
553 spec->gpio_mute &= spec->gpio_mask;
554 val = snd_hda_get_bool_hint(codec, "eapd_switch");
556 spec->eapd_switch = val;
563 #define stac_aloopback_info snd_ctl_boolean_mono_info
565 static int stac_aloopback_get(struct snd_kcontrol *kcontrol,
566 struct snd_ctl_elem_value *ucontrol)
568 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
569 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
570 struct sigmatel_spec *spec = codec->spec;
572 ucontrol->value.integer.value[0] = !!(spec->aloopback &
573 (spec->aloopback_mask << idx));
577 static int stac_aloopback_put(struct snd_kcontrol *kcontrol,
578 struct snd_ctl_elem_value *ucontrol)
580 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
581 struct sigmatel_spec *spec = codec->spec;
582 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
583 unsigned int dac_mode;
584 unsigned int val, idx_val;
586 idx_val = spec->aloopback_mask << idx;
587 if (ucontrol->value.integer.value[0])
588 val = spec->aloopback | idx_val;
590 val = spec->aloopback & ~idx_val;
591 if (spec->aloopback == val)
594 spec->aloopback = val;
596 /* Only return the bits defined by the shift value of the
597 * first two bytes of the mask
599 dac_mode = snd_hda_codec_read(codec, codec->core.afg, 0,
600 kcontrol->private_value & 0xFFFF, 0x0);
601 dac_mode >>= spec->aloopback_shift;
603 if (spec->aloopback & idx_val) {
604 snd_hda_power_up(codec);
607 snd_hda_power_down(codec);
608 dac_mode &= ~idx_val;
611 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
612 kcontrol->private_value >> 16, dac_mode);
617 #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \
619 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
620 .name = "Analog Loopback", \
622 .info = stac_aloopback_info, \
623 .get = stac_aloopback_get, \
624 .put = stac_aloopback_put, \
625 .private_value = verb_read | (verb_write << 16), \
629 * Mute LED handling on HP laptops
632 /* check whether it's a HP laptop with a docking port */
633 static bool hp_bnb2011_with_dock(struct hda_codec *codec)
635 if (codec->core.vendor_id != 0x111d7605 &&
636 codec->core.vendor_id != 0x111d76d1)
639 switch (codec->core.subsystem_id) {
673 static bool hp_blike_system(u32 subsystem_id)
675 switch (subsystem_id) {
676 case 0x103c1473: /* HP ProBook 6550b */
703 static void set_hp_led_gpio(struct hda_codec *codec)
705 struct sigmatel_spec *spec = codec->spec;
711 gpio = snd_hda_param_read(codec, codec->core.afg, AC_PAR_GPIO_CAP);
712 gpio &= AC_GPIO_IO_COUNT;
714 spec->gpio_led = 0x08; /* GPIO 3 */
716 spec->gpio_led = 0x01; /* GPIO 0 */
720 * This method searches for the mute LED GPIO configuration
721 * provided as OEM string in SMBIOS. The format of that string
722 * is HP_Mute_LED_P_G or HP_Mute_LED_P
723 * where P can be 0 or 1 and defines mute LED GPIO control state (low/high)
724 * that corresponds to the NOT muted state of the master volume
725 * and G is the index of the GPIO to use as the mute LED control (0..9)
726 * If _G portion is missing it is assigned based on the codec ID
728 * So, HP B-series like systems may have HP_Mute_LED_0 (current models)
729 * or HP_Mute_LED_0_3 (future models) OEM SMBIOS strings
732 * The dv-series laptops don't seem to have the HP_Mute_LED* strings in
733 * SMBIOS - at least the ones I have seen do not have them - which include
734 * my own system (HP Pavilion dv6-1110ax) and my cousin's
735 * HP Pavilion dv9500t CTO.
736 * Need more information on whether it is true across the entire series.
739 static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity)
741 struct sigmatel_spec *spec = codec->spec;
742 const struct dmi_device *dev = NULL;
744 if (get_int_hint(codec, "gpio_led", &spec->gpio_led)) {
745 get_int_hint(codec, "gpio_led_polarity",
746 &spec->gpio_led_polarity);
750 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
751 if (sscanf(dev->name, "HP_Mute_LED_%u_%x",
752 &spec->gpio_led_polarity,
753 &spec->gpio_led) == 2) {
754 unsigned int max_gpio;
755 max_gpio = snd_hda_param_read(codec, codec->core.afg,
757 max_gpio &= AC_GPIO_IO_COUNT;
758 if (spec->gpio_led < max_gpio)
759 spec->gpio_led = 1 << spec->gpio_led;
761 spec->vref_mute_led_nid = spec->gpio_led;
764 if (sscanf(dev->name, "HP_Mute_LED_%u",
765 &spec->gpio_led_polarity) == 1) {
766 set_hp_led_gpio(codec);
769 /* BIOS bug: unfilled OEM string */
770 if (strstr(dev->name, "HP_Mute_LED_P_G")) {
771 set_hp_led_gpio(codec);
772 if (default_polarity >= 0)
773 spec->gpio_led_polarity = default_polarity;
775 spec->gpio_led_polarity = 1;
781 * Fallback case - if we don't find the DMI strings,
782 * we statically set the GPIO - if not a B-series system
783 * and default polarity is provided
785 if (!hp_blike_system(codec->core.subsystem_id) &&
786 (default_polarity == 0 || default_polarity == 1)) {
787 set_hp_led_gpio(codec);
788 spec->gpio_led_polarity = default_polarity;
794 /* check whether a built-in speaker is included in parsed pins */
795 static bool has_builtin_speaker(struct hda_codec *codec)
797 struct sigmatel_spec *spec = codec->spec;
801 if (spec->gen.autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) {
802 nid_pin = spec->gen.autocfg.line_out_pins;
803 nids = spec->gen.autocfg.line_outs;
805 nid_pin = spec->gen.autocfg.speaker_pins;
806 nids = spec->gen.autocfg.speaker_outs;
809 for (i = 0; i < nids; i++) {
810 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid_pin[i]);
811 if (snd_hda_get_input_pin_attr(def_conf) == INPUT_PIN_ATTR_INT)
821 /* create PC beep volume controls */
822 static int stac_auto_create_beep_ctls(struct hda_codec *codec,
825 struct sigmatel_spec *spec = codec->spec;
826 u32 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
827 struct snd_kcontrol_new *knew;
828 static const struct snd_kcontrol_new abeep_mute_ctl =
829 HDA_CODEC_MUTE(NULL, 0, 0, 0);
830 static const struct snd_kcontrol_new dbeep_mute_ctl =
831 HDA_CODEC_MUTE_BEEP(NULL, 0, 0, 0);
832 static const struct snd_kcontrol_new beep_vol_ctl =
833 HDA_CODEC_VOLUME(NULL, 0, 0, 0);
835 /* check for mute support for the the amp */
836 if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) {
837 const struct snd_kcontrol_new *temp;
838 if (spec->anabeep_nid == nid)
839 temp = &abeep_mute_ctl;
841 temp = &dbeep_mute_ctl;
842 knew = snd_hda_gen_add_kctl(&spec->gen,
843 "Beep Playback Switch", temp);
846 knew->private_value =
847 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT);
850 /* check to see if there is volume support for the amp */
851 if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) {
852 knew = snd_hda_gen_add_kctl(&spec->gen,
853 "Beep Playback Volume",
857 knew->private_value =
858 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT);
863 #ifdef CONFIG_SND_HDA_INPUT_BEEP
864 #define stac_dig_beep_switch_info snd_ctl_boolean_mono_info
866 static int stac_dig_beep_switch_get(struct snd_kcontrol *kcontrol,
867 struct snd_ctl_elem_value *ucontrol)
869 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
870 ucontrol->value.integer.value[0] = codec->beep->enabled;
874 static int stac_dig_beep_switch_put(struct snd_kcontrol *kcontrol,
875 struct snd_ctl_elem_value *ucontrol)
877 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
878 return snd_hda_enable_beep_device(codec, ucontrol->value.integer.value[0]);
881 static const struct snd_kcontrol_new stac_dig_beep_ctrl = {
882 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
883 .name = "Beep Playback Switch",
884 .info = stac_dig_beep_switch_info,
885 .get = stac_dig_beep_switch_get,
886 .put = stac_dig_beep_switch_put,
889 static int stac_beep_switch_ctl(struct hda_codec *codec)
891 struct sigmatel_spec *spec = codec->spec;
893 if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &stac_dig_beep_ctrl))
900 * SPDIF-out mux controls
903 static int stac_smux_enum_info(struct snd_kcontrol *kcontrol,
904 struct snd_ctl_elem_info *uinfo)
906 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
907 struct sigmatel_spec *spec = codec->spec;
908 return snd_hda_input_mux_info(&spec->spdif_mux, uinfo);
911 static int stac_smux_enum_get(struct snd_kcontrol *kcontrol,
912 struct snd_ctl_elem_value *ucontrol)
914 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
915 struct sigmatel_spec *spec = codec->spec;
916 unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
918 ucontrol->value.enumerated.item[0] = spec->cur_smux[smux_idx];
922 static int stac_smux_enum_put(struct snd_kcontrol *kcontrol,
923 struct snd_ctl_elem_value *ucontrol)
925 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
926 struct sigmatel_spec *spec = codec->spec;
927 unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
929 return snd_hda_input_mux_put(codec, &spec->spdif_mux, ucontrol,
930 spec->gen.autocfg.dig_out_pins[smux_idx],
931 &spec->cur_smux[smux_idx]);
934 static const struct snd_kcontrol_new stac_smux_mixer = {
935 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
936 .name = "IEC958 Playback Source",
937 /* count set later */
938 .info = stac_smux_enum_info,
939 .get = stac_smux_enum_get,
940 .put = stac_smux_enum_put,
943 static const char * const stac_spdif_labels[] = {
944 "Digital Playback", "Analog Mux 1", "Analog Mux 2", NULL
947 static int stac_create_spdif_mux_ctls(struct hda_codec *codec)
949 struct sigmatel_spec *spec = codec->spec;
950 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
951 const char * const *labels = spec->spdif_labels;
952 struct snd_kcontrol_new *kctl;
955 if (cfg->dig_outs < 1)
958 num_cons = snd_hda_get_num_conns(codec, cfg->dig_out_pins[0]);
963 labels = stac_spdif_labels;
964 for (i = 0; i < num_cons; i++) {
965 if (snd_BUG_ON(!labels[i]))
967 snd_hda_add_imux_item(codec, &spec->spdif_mux, labels[i], i, NULL);
970 kctl = snd_hda_gen_add_kctl(&spec->gen, NULL, &stac_smux_mixer);
973 kctl->count = cfg->dig_outs;
978 static const struct hda_verb stac9200_eapd_init[] = {
979 /* set dac0mux for dac converter */
980 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
981 {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
985 static const struct hda_verb dell_eq_core_init[] = {
986 /* set master volume to max value without distortion
987 * and direct control */
988 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec},
992 static const struct hda_verb stac92hd73xx_core_init[] = {
993 /* set master volume and direct control */
994 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
998 static const struct hda_verb stac92hd83xxx_core_init[] = {
999 /* power state controls amps */
1000 { 0x01, AC_VERB_SET_EAPD, 1 << 2},
1004 static const struct hda_verb stac92hd83xxx_hp_zephyr_init[] = {
1005 { 0x22, 0x785, 0x43 },
1006 { 0x22, 0x782, 0xe0 },
1007 { 0x22, 0x795, 0x00 },
1011 static const struct hda_verb stac92hd71bxx_core_init[] = {
1012 /* set master volume and direct control */
1013 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
1017 static const hda_nid_t stac92hd71bxx_unmute_nids[] = {
1018 /* unmute right and left channels for nodes 0x0f, 0xa, 0x0d */
1022 static const struct hda_verb stac925x_core_init[] = {
1023 /* set dac0mux for dac converter */
1024 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
1025 /* mute the master volume */
1026 { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1030 static const struct hda_verb stac922x_core_init[] = {
1031 /* set master volume and direct control */
1032 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
1036 static const struct hda_verb d965_core_init[] = {
1037 /* unmute node 0x1b */
1038 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
1039 /* select node 0x03 as DAC */
1040 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
1044 static const struct hda_verb dell_3st_core_init[] = {
1045 /* don't set delta bit */
1046 {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f},
1047 /* unmute node 0x1b */
1048 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
1049 /* select node 0x03 as DAC */
1050 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
1054 static const struct hda_verb stac927x_core_init[] = {
1055 /* set master volume and direct control */
1056 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
1057 /* enable analog pc beep path */
1058 { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
1062 static const struct hda_verb stac927x_volknob_core_init[] = {
1063 /* don't set delta bit */
1064 {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f},
1065 /* enable analog pc beep path */
1066 {0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
1070 static const struct hda_verb stac9205_core_init[] = {
1071 /* set master volume and direct control */
1072 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
1073 /* enable analog pc beep path */
1074 { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
1078 static const struct snd_kcontrol_new stac92hd73xx_6ch_loopback =
1079 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3);
1081 static const struct snd_kcontrol_new stac92hd73xx_8ch_loopback =
1082 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4);
1084 static const struct snd_kcontrol_new stac92hd73xx_10ch_loopback =
1085 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5);
1087 static const struct snd_kcontrol_new stac92hd71bxx_loopback =
1088 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2);
1090 static const struct snd_kcontrol_new stac9205_loopback =
1091 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1);
1093 static const struct snd_kcontrol_new stac927x_loopback =
1094 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1);
1096 static const struct hda_pintbl ref9200_pin_configs[] = {
1097 { 0x08, 0x01c47010 },
1098 { 0x09, 0x01447010 },
1099 { 0x0d, 0x0221401f },
1100 { 0x0e, 0x01114010 },
1101 { 0x0f, 0x02a19020 },
1102 { 0x10, 0x01a19021 },
1103 { 0x11, 0x90100140 },
1104 { 0x12, 0x01813122 },
1108 static const struct hda_pintbl gateway9200_m4_pin_configs[] = {
1109 { 0x08, 0x400000fe },
1110 { 0x09, 0x404500f4 },
1111 { 0x0d, 0x400100f0 },
1112 { 0x0e, 0x90110010 },
1113 { 0x0f, 0x400100f1 },
1114 { 0x10, 0x02a1902e },
1115 { 0x11, 0x500000f2 },
1116 { 0x12, 0x500000f3 },
1120 static const struct hda_pintbl gateway9200_m4_2_pin_configs[] = {
1121 { 0x08, 0x400000fe },
1122 { 0x09, 0x404500f4 },
1123 { 0x0d, 0x400100f0 },
1124 { 0x0e, 0x90110010 },
1125 { 0x0f, 0x400100f1 },
1126 { 0x10, 0x02a1902e },
1127 { 0x11, 0x500000f2 },
1128 { 0x12, 0x500000f3 },
1133 STAC 9200 pin configs for
1138 static const struct hda_pintbl dell9200_d21_pin_configs[] = {
1139 { 0x08, 0x400001f0 },
1140 { 0x09, 0x400001f1 },
1141 { 0x0d, 0x02214030 },
1142 { 0x0e, 0x01014010 },
1143 { 0x0f, 0x02a19020 },
1144 { 0x10, 0x01a19021 },
1145 { 0x11, 0x90100140 },
1146 { 0x12, 0x01813122 },
1151 STAC 9200 pin configs for
1155 static const struct hda_pintbl dell9200_d22_pin_configs[] = {
1156 { 0x08, 0x400001f0 },
1157 { 0x09, 0x400001f1 },
1158 { 0x0d, 0x0221401f },
1159 { 0x0e, 0x01014010 },
1160 { 0x0f, 0x01813020 },
1161 { 0x10, 0x02a19021 },
1162 { 0x11, 0x90100140 },
1163 { 0x12, 0x400001f2 },
1168 STAC 9200 pin configs for
1169 102801C4 (Dell Dimension E310)
1176 static const struct hda_pintbl dell9200_d23_pin_configs[] = {
1177 { 0x08, 0x400001f0 },
1178 { 0x09, 0x400001f1 },
1179 { 0x0d, 0x0221401f },
1180 { 0x0e, 0x01014010 },
1181 { 0x0f, 0x01813020 },
1182 { 0x10, 0x01a19021 },
1183 { 0x11, 0x90100140 },
1184 { 0x12, 0x400001f2 },
1190 STAC 9200-32 pin configs for
1191 102801B5 (Dell Inspiron 630m)
1192 102801D8 (Dell Inspiron 640m)
1194 static const struct hda_pintbl dell9200_m21_pin_configs[] = {
1195 { 0x08, 0x40c003fa },
1196 { 0x09, 0x03441340 },
1197 { 0x0d, 0x0321121f },
1198 { 0x0e, 0x90170310 },
1199 { 0x0f, 0x408003fb },
1200 { 0x10, 0x03a11020 },
1201 { 0x11, 0x401003fc },
1202 { 0x12, 0x403003fd },
1207 STAC 9200-32 pin configs for
1208 102801C2 (Dell Latitude D620)
1210 102801CC (Dell Latitude D820)
1214 static const struct hda_pintbl dell9200_m22_pin_configs[] = {
1215 { 0x08, 0x40c003fa },
1216 { 0x09, 0x0144131f },
1217 { 0x0d, 0x0321121f },
1218 { 0x0e, 0x90170310 },
1219 { 0x0f, 0x90a70321 },
1220 { 0x10, 0x03a11020 },
1221 { 0x11, 0x401003fb },
1222 { 0x12, 0x40f000fc },
1227 STAC 9200-32 pin configs for
1228 102801CE (Dell XPS M1710)
1229 102801CF (Dell Precision M90)
1231 static const struct hda_pintbl dell9200_m23_pin_configs[] = {
1232 { 0x08, 0x40c003fa },
1233 { 0x09, 0x01441340 },
1234 { 0x0d, 0x0421421f },
1235 { 0x0e, 0x90170310 },
1236 { 0x0f, 0x408003fb },
1237 { 0x10, 0x04a1102e },
1238 { 0x11, 0x90170311 },
1239 { 0x12, 0x403003fc },
1244 STAC 9200-32 pin configs for
1247 102801CB (Dell Latitude 120L)
1250 static const struct hda_pintbl dell9200_m24_pin_configs[] = {
1251 { 0x08, 0x40c003fa },
1252 { 0x09, 0x404003fb },
1253 { 0x0d, 0x0321121f },
1254 { 0x0e, 0x90170310 },
1255 { 0x0f, 0x408003fc },
1256 { 0x10, 0x03a11020 },
1257 { 0x11, 0x401003fd },
1258 { 0x12, 0x403003fe },
1263 STAC 9200-32 pin configs for
1264 102801BD (Dell Inspiron E1505n)
1268 static const struct hda_pintbl dell9200_m25_pin_configs[] = {
1269 { 0x08, 0x40c003fa },
1270 { 0x09, 0x01441340 },
1271 { 0x0d, 0x0421121f },
1272 { 0x0e, 0x90170310 },
1273 { 0x0f, 0x408003fb },
1274 { 0x10, 0x04a11020 },
1275 { 0x11, 0x401003fc },
1276 { 0x12, 0x403003fd },
1281 STAC 9200-32 pin configs for
1282 102801F5 (Dell Inspiron 1501)
1285 static const struct hda_pintbl dell9200_m26_pin_configs[] = {
1286 { 0x08, 0x40c003fa },
1287 { 0x09, 0x404003fb },
1288 { 0x0d, 0x0421121f },
1289 { 0x0e, 0x90170310 },
1290 { 0x0f, 0x408003fc },
1291 { 0x10, 0x04a11020 },
1292 { 0x11, 0x401003fd },
1293 { 0x12, 0x403003fe },
1299 102801CD (Dell Inspiron E1705/9400)
1301 static const struct hda_pintbl dell9200_m27_pin_configs[] = {
1302 { 0x08, 0x40c003fa },
1303 { 0x09, 0x01441340 },
1304 { 0x0d, 0x0421121f },
1305 { 0x0e, 0x90170310 },
1306 { 0x0f, 0x90170310 },
1307 { 0x10, 0x04a11020 },
1308 { 0x11, 0x90170310 },
1309 { 0x12, 0x40f003fc },
1313 static const struct hda_pintbl oqo9200_pin_configs[] = {
1314 { 0x08, 0x40c000f0 },
1315 { 0x09, 0x404000f1 },
1316 { 0x0d, 0x0221121f },
1317 { 0x0e, 0x02211210 },
1318 { 0x0f, 0x90170111 },
1319 { 0x10, 0x90a70120 },
1320 { 0x11, 0x400000f2 },
1321 { 0x12, 0x400000f3 },
1327 * 18881000 Amigaone X1000
1329 static const struct hda_pintbl nemo_pin_configs[] = {
1330 { 0x0a, 0x02214020 }, /* Front panel HP socket */
1331 { 0x0b, 0x02a19080 }, /* Front Mic */
1332 { 0x0c, 0x0181304e }, /* Line in */
1333 { 0x0d, 0x01014010 }, /* Line out */
1334 { 0x0e, 0x01a19040 }, /* Rear Mic */
1335 { 0x0f, 0x01011012 }, /* Rear speakers */
1336 { 0x10, 0x01016011 }, /* Center speaker */
1337 { 0x11, 0x01012014 }, /* Side speakers (7.1) */
1338 { 0x12, 0x103301f0 }, /* Motherboard CD line in connector */
1339 { 0x13, 0x411111f0 }, /* Unused */
1340 { 0x14, 0x411111f0 }, /* Unused */
1341 { 0x21, 0x01442170 }, /* S/PDIF line out */
1342 { 0x22, 0x411111f0 }, /* Unused */
1343 { 0x23, 0x411111f0 }, /* Unused */
1347 static void stac9200_fixup_panasonic(struct hda_codec *codec,
1348 const struct hda_fixup *fix, int action)
1350 struct sigmatel_spec *spec = codec->spec;
1352 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1353 spec->gpio_mask = spec->gpio_dir = 0x09;
1354 spec->gpio_data = 0x00;
1355 /* CF-74 has no headphone detection, and the driver should *NOT*
1356 * do detection and HP/speaker toggle because the hardware does it.
1358 spec->gen.suppress_auto_mute = 1;
1363 static const struct hda_fixup stac9200_fixups[] = {
1365 .type = HDA_FIXUP_PINS,
1366 .v.pins = ref9200_pin_configs,
1369 .type = HDA_FIXUP_PINS,
1370 .v.pins = oqo9200_pin_configs,
1372 .chain_id = STAC_9200_EAPD_INIT,
1374 [STAC_9200_DELL_D21] = {
1375 .type = HDA_FIXUP_PINS,
1376 .v.pins = dell9200_d21_pin_configs,
1378 [STAC_9200_DELL_D22] = {
1379 .type = HDA_FIXUP_PINS,
1380 .v.pins = dell9200_d22_pin_configs,
1382 [STAC_9200_DELL_D23] = {
1383 .type = HDA_FIXUP_PINS,
1384 .v.pins = dell9200_d23_pin_configs,
1386 [STAC_9200_DELL_M21] = {
1387 .type = HDA_FIXUP_PINS,
1388 .v.pins = dell9200_m21_pin_configs,
1390 [STAC_9200_DELL_M22] = {
1391 .type = HDA_FIXUP_PINS,
1392 .v.pins = dell9200_m22_pin_configs,
1394 [STAC_9200_DELL_M23] = {
1395 .type = HDA_FIXUP_PINS,
1396 .v.pins = dell9200_m23_pin_configs,
1398 [STAC_9200_DELL_M24] = {
1399 .type = HDA_FIXUP_PINS,
1400 .v.pins = dell9200_m24_pin_configs,
1402 [STAC_9200_DELL_M25] = {
1403 .type = HDA_FIXUP_PINS,
1404 .v.pins = dell9200_m25_pin_configs,
1406 [STAC_9200_DELL_M26] = {
1407 .type = HDA_FIXUP_PINS,
1408 .v.pins = dell9200_m26_pin_configs,
1410 [STAC_9200_DELL_M27] = {
1411 .type = HDA_FIXUP_PINS,
1412 .v.pins = dell9200_m27_pin_configs,
1415 .type = HDA_FIXUP_PINS,
1416 .v.pins = gateway9200_m4_pin_configs,
1418 .chain_id = STAC_9200_EAPD_INIT,
1420 [STAC_9200_M4_2] = {
1421 .type = HDA_FIXUP_PINS,
1422 .v.pins = gateway9200_m4_2_pin_configs,
1424 .chain_id = STAC_9200_EAPD_INIT,
1426 [STAC_9200_PANASONIC] = {
1427 .type = HDA_FIXUP_FUNC,
1428 .v.func = stac9200_fixup_panasonic,
1430 [STAC_9200_EAPD_INIT] = {
1431 .type = HDA_FIXUP_VERBS,
1432 .v.verbs = (const struct hda_verb[]) {
1433 {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1439 static const struct hda_model_fixup stac9200_models[] = {
1440 { .id = STAC_REF, .name = "ref" },
1441 { .id = STAC_9200_OQO, .name = "oqo" },
1442 { .id = STAC_9200_DELL_D21, .name = "dell-d21" },
1443 { .id = STAC_9200_DELL_D22, .name = "dell-d22" },
1444 { .id = STAC_9200_DELL_D23, .name = "dell-d23" },
1445 { .id = STAC_9200_DELL_M21, .name = "dell-m21" },
1446 { .id = STAC_9200_DELL_M22, .name = "dell-m22" },
1447 { .id = STAC_9200_DELL_M23, .name = "dell-m23" },
1448 { .id = STAC_9200_DELL_M24, .name = "dell-m24" },
1449 { .id = STAC_9200_DELL_M25, .name = "dell-m25" },
1450 { .id = STAC_9200_DELL_M26, .name = "dell-m26" },
1451 { .id = STAC_9200_DELL_M27, .name = "dell-m27" },
1452 { .id = STAC_9200_M4, .name = "gateway-m4" },
1453 { .id = STAC_9200_M4_2, .name = "gateway-m4-2" },
1454 { .id = STAC_9200_PANASONIC, .name = "panasonic" },
1458 static const struct snd_pci_quirk stac9200_fixup_tbl[] = {
1459 /* SigmaTel reference board */
1460 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1461 "DFI LanParty", STAC_REF),
1462 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1463 "DFI LanParty", STAC_REF),
1464 /* Dell laptops have BIOS problem */
1465 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8,
1466 "unknown Dell", STAC_9200_DELL_D21),
1467 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5,
1468 "Dell Inspiron 630m", STAC_9200_DELL_M21),
1469 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd,
1470 "Dell Inspiron E1505n", STAC_9200_DELL_M25),
1471 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0,
1472 "unknown Dell", STAC_9200_DELL_D22),
1473 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1,
1474 "unknown Dell", STAC_9200_DELL_D22),
1475 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2,
1476 "Dell Latitude D620", STAC_9200_DELL_M22),
1477 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5,
1478 "unknown Dell", STAC_9200_DELL_D23),
1479 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7,
1480 "unknown Dell", STAC_9200_DELL_D23),
1481 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8,
1482 "unknown Dell", STAC_9200_DELL_M22),
1483 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9,
1484 "unknown Dell", STAC_9200_DELL_M24),
1485 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca,
1486 "unknown Dell", STAC_9200_DELL_M24),
1487 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb,
1488 "Dell Latitude 120L", STAC_9200_DELL_M24),
1489 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc,
1490 "Dell Latitude D820", STAC_9200_DELL_M22),
1491 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd,
1492 "Dell Inspiron E1705/9400", STAC_9200_DELL_M27),
1493 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce,
1494 "Dell XPS M1710", STAC_9200_DELL_M23),
1495 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf,
1496 "Dell Precision M90", STAC_9200_DELL_M23),
1497 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3,
1498 "unknown Dell", STAC_9200_DELL_M22),
1499 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4,
1500 "unknown Dell", STAC_9200_DELL_M22),
1501 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6,
1502 "unknown Dell", STAC_9200_DELL_M22),
1503 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8,
1504 "Dell Inspiron 640m", STAC_9200_DELL_M21),
1505 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9,
1506 "unknown Dell", STAC_9200_DELL_D23),
1507 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da,
1508 "unknown Dell", STAC_9200_DELL_D23),
1509 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de,
1510 "unknown Dell", STAC_9200_DELL_D21),
1511 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3,
1512 "unknown Dell", STAC_9200_DELL_D23),
1513 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8,
1514 "unknown Dell", STAC_9200_DELL_D21),
1515 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee,
1516 "unknown Dell", STAC_9200_DELL_M25),
1517 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef,
1518 "unknown Dell", STAC_9200_DELL_M25),
1519 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5,
1520 "Dell Inspiron 1501", STAC_9200_DELL_M26),
1521 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6,
1522 "unknown Dell", STAC_9200_DELL_M26),
1523 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0201,
1524 "Dell Latitude D430", STAC_9200_DELL_M22),
1526 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC),
1527 /* Gateway machines needs EAPD to be set on resume */
1528 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_M4),
1529 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", STAC_9200_M4_2),
1530 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", STAC_9200_M4_2),
1532 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO),
1536 static const struct hda_pintbl ref925x_pin_configs[] = {
1537 { 0x07, 0x40c003f0 },
1538 { 0x08, 0x424503f2 },
1539 { 0x0a, 0x01813022 },
1540 { 0x0b, 0x02a19021 },
1541 { 0x0c, 0x90a70320 },
1542 { 0x0d, 0x02214210 },
1543 { 0x10, 0x01019020 },
1544 { 0x11, 0x9033032e },
1548 static const struct hda_pintbl stac925xM1_pin_configs[] = {
1549 { 0x07, 0x40c003f4 },
1550 { 0x08, 0x424503f2 },
1551 { 0x0a, 0x400000f3 },
1552 { 0x0b, 0x02a19020 },
1553 { 0x0c, 0x40a000f0 },
1554 { 0x0d, 0x90100210 },
1555 { 0x10, 0x400003f1 },
1556 { 0x11, 0x9033032e },
1560 static const struct hda_pintbl stac925xM1_2_pin_configs[] = {
1561 { 0x07, 0x40c003f4 },
1562 { 0x08, 0x424503f2 },
1563 { 0x0a, 0x400000f3 },
1564 { 0x0b, 0x02a19020 },
1565 { 0x0c, 0x40a000f0 },
1566 { 0x0d, 0x90100210 },
1567 { 0x10, 0x400003f1 },
1568 { 0x11, 0x9033032e },
1572 static const struct hda_pintbl stac925xM2_pin_configs[] = {
1573 { 0x07, 0x40c003f4 },
1574 { 0x08, 0x424503f2 },
1575 { 0x0a, 0x400000f3 },
1576 { 0x0b, 0x02a19020 },
1577 { 0x0c, 0x40a000f0 },
1578 { 0x0d, 0x90100210 },
1579 { 0x10, 0x400003f1 },
1580 { 0x11, 0x9033032e },
1584 static const struct hda_pintbl stac925xM2_2_pin_configs[] = {
1585 { 0x07, 0x40c003f4 },
1586 { 0x08, 0x424503f2 },
1587 { 0x0a, 0x400000f3 },
1588 { 0x0b, 0x02a19020 },
1589 { 0x0c, 0x40a000f0 },
1590 { 0x0d, 0x90100210 },
1591 { 0x10, 0x400003f1 },
1592 { 0x11, 0x9033032e },
1596 static const struct hda_pintbl stac925xM3_pin_configs[] = {
1597 { 0x07, 0x40c003f4 },
1598 { 0x08, 0x424503f2 },
1599 { 0x0a, 0x400000f3 },
1600 { 0x0b, 0x02a19020 },
1601 { 0x0c, 0x40a000f0 },
1602 { 0x0d, 0x90100210 },
1603 { 0x10, 0x400003f1 },
1604 { 0x11, 0x503303f3 },
1608 static const struct hda_pintbl stac925xM5_pin_configs[] = {
1609 { 0x07, 0x40c003f4 },
1610 { 0x08, 0x424503f2 },
1611 { 0x0a, 0x400000f3 },
1612 { 0x0b, 0x02a19020 },
1613 { 0x0c, 0x40a000f0 },
1614 { 0x0d, 0x90100210 },
1615 { 0x10, 0x400003f1 },
1616 { 0x11, 0x9033032e },
1620 static const struct hda_pintbl stac925xM6_pin_configs[] = {
1621 { 0x07, 0x40c003f4 },
1622 { 0x08, 0x424503f2 },
1623 { 0x0a, 0x400000f3 },
1624 { 0x0b, 0x02a19020 },
1625 { 0x0c, 0x40a000f0 },
1626 { 0x0d, 0x90100210 },
1627 { 0x10, 0x400003f1 },
1628 { 0x11, 0x90330320 },
1632 static const struct hda_fixup stac925x_fixups[] = {
1634 .type = HDA_FIXUP_PINS,
1635 .v.pins = ref925x_pin_configs,
1638 .type = HDA_FIXUP_PINS,
1639 .v.pins = stac925xM1_pin_configs,
1642 .type = HDA_FIXUP_PINS,
1643 .v.pins = stac925xM1_2_pin_configs,
1646 .type = HDA_FIXUP_PINS,
1647 .v.pins = stac925xM2_pin_configs,
1650 .type = HDA_FIXUP_PINS,
1651 .v.pins = stac925xM2_2_pin_configs,
1654 .type = HDA_FIXUP_PINS,
1655 .v.pins = stac925xM3_pin_configs,
1658 .type = HDA_FIXUP_PINS,
1659 .v.pins = stac925xM5_pin_configs,
1662 .type = HDA_FIXUP_PINS,
1663 .v.pins = stac925xM6_pin_configs,
1667 static const struct hda_model_fixup stac925x_models[] = {
1668 { .id = STAC_REF, .name = "ref" },
1669 { .id = STAC_M1, .name = "m1" },
1670 { .id = STAC_M1_2, .name = "m1-2" },
1671 { .id = STAC_M2, .name = "m2" },
1672 { .id = STAC_M2_2, .name = "m2-2" },
1673 { .id = STAC_M3, .name = "m3" },
1674 { .id = STAC_M5, .name = "m5" },
1675 { .id = STAC_M6, .name = "m6" },
1679 static const struct snd_pci_quirk stac925x_fixup_tbl[] = {
1680 /* SigmaTel reference board */
1681 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
1682 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, "DFI LanParty", STAC_REF),
1683 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
1685 /* Default table for unknown ID */
1686 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2),
1688 /* gateway machines are checked via codec ssid */
1689 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2),
1690 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5),
1691 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1),
1692 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_M2),
1693 SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2),
1694 /* Not sure about the brand name for those */
1695 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1),
1696 SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3),
1697 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6),
1698 SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2),
1702 static const struct hda_pintbl ref92hd73xx_pin_configs[] = {
1703 { 0x0a, 0x02214030 },
1704 { 0x0b, 0x02a19040 },
1705 { 0x0c, 0x01a19020 },
1706 { 0x0d, 0x02214030 },
1707 { 0x0e, 0x0181302e },
1708 { 0x0f, 0x01014010 },
1709 { 0x10, 0x01014020 },
1710 { 0x11, 0x01014030 },
1711 { 0x12, 0x02319040 },
1712 { 0x13, 0x90a000f0 },
1713 { 0x14, 0x90a000f0 },
1714 { 0x22, 0x01452050 },
1715 { 0x23, 0x01452050 },
1719 static const struct hda_pintbl dell_m6_pin_configs[] = {
1720 { 0x0a, 0x0321101f },
1721 { 0x0b, 0x4f00000f },
1722 { 0x0c, 0x4f0000f0 },
1723 { 0x0d, 0x90170110 },
1724 { 0x0e, 0x03a11020 },
1725 { 0x0f, 0x0321101f },
1726 { 0x10, 0x4f0000f0 },
1727 { 0x11, 0x4f0000f0 },
1728 { 0x12, 0x4f0000f0 },
1729 { 0x13, 0x90a60160 },
1730 { 0x14, 0x4f0000f0 },
1731 { 0x22, 0x4f0000f0 },
1732 { 0x23, 0x4f0000f0 },
1736 static const struct hda_pintbl alienware_m17x_pin_configs[] = {
1737 { 0x0a, 0x0321101f },
1738 { 0x0b, 0x0321101f },
1739 { 0x0c, 0x03a11020 },
1740 { 0x0d, 0x03014020 },
1741 { 0x0e, 0x90170110 },
1742 { 0x0f, 0x4f0000f0 },
1743 { 0x10, 0x4f0000f0 },
1744 { 0x11, 0x4f0000f0 },
1745 { 0x12, 0x4f0000f0 },
1746 { 0x13, 0x90a60160 },
1747 { 0x14, 0x4f0000f0 },
1748 { 0x22, 0x4f0000f0 },
1749 { 0x23, 0x904601b0 },
1753 static const struct hda_pintbl intel_dg45id_pin_configs[] = {
1754 { 0x0a, 0x02214230 },
1755 { 0x0b, 0x02A19240 },
1756 { 0x0c, 0x01013214 },
1757 { 0x0d, 0x01014210 },
1758 { 0x0e, 0x01A19250 },
1759 { 0x0f, 0x01011212 },
1760 { 0x10, 0x01016211 },
1764 static const struct hda_pintbl stac92hd89xx_hp_front_jack_pin_configs[] = {
1765 { 0x0a, 0x02214030 },
1766 { 0x0b, 0x02A19010 },
1770 static const struct hda_pintbl stac92hd89xx_hp_z1_g2_right_mic_jack_pin_configs[] = {
1771 { 0x0e, 0x400000f0 },
1775 static void stac92hd73xx_fixup_ref(struct hda_codec *codec,
1776 const struct hda_fixup *fix, int action)
1778 struct sigmatel_spec *spec = codec->spec;
1780 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1783 snd_hda_apply_pincfgs(codec, ref92hd73xx_pin_configs);
1784 spec->gpio_mask = spec->gpio_dir = spec->gpio_data = 0;
1787 static void stac92hd73xx_fixup_dell(struct hda_codec *codec)
1789 struct sigmatel_spec *spec = codec->spec;
1791 snd_hda_apply_pincfgs(codec, dell_m6_pin_configs);
1792 spec->eapd_switch = 0;
1795 static void stac92hd73xx_fixup_dell_eq(struct hda_codec *codec,
1796 const struct hda_fixup *fix, int action)
1798 struct sigmatel_spec *spec = codec->spec;
1800 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1803 stac92hd73xx_fixup_dell(codec);
1804 snd_hda_add_verbs(codec, dell_eq_core_init);
1805 spec->volknob_init = 1;
1809 static void stac92hd73xx_fixup_dell_m6_amic(struct hda_codec *codec,
1810 const struct hda_fixup *fix, int action)
1812 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1815 stac92hd73xx_fixup_dell(codec);
1816 snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
1820 static void stac92hd73xx_fixup_dell_m6_dmic(struct hda_codec *codec,
1821 const struct hda_fixup *fix, int action)
1823 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1826 stac92hd73xx_fixup_dell(codec);
1827 snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
1831 static void stac92hd73xx_fixup_dell_m6_both(struct hda_codec *codec,
1832 const struct hda_fixup *fix, int action)
1834 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1837 stac92hd73xx_fixup_dell(codec);
1838 snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
1839 snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
1842 static void stac92hd73xx_fixup_alienware_m17x(struct hda_codec *codec,
1843 const struct hda_fixup *fix, int action)
1845 struct sigmatel_spec *spec = codec->spec;
1847 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1850 snd_hda_apply_pincfgs(codec, alienware_m17x_pin_configs);
1851 spec->eapd_switch = 0;
1854 static void stac92hd73xx_fixup_no_jd(struct hda_codec *codec,
1855 const struct hda_fixup *fix, int action)
1857 if (action == HDA_FIXUP_ACT_PRE_PROBE)
1858 codec->no_jack_detect = 1;
1862 static void stac92hd73xx_disable_automute(struct hda_codec *codec,
1863 const struct hda_fixup *fix, int action)
1865 struct sigmatel_spec *spec = codec->spec;
1867 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1870 spec->gen.suppress_auto_mute = 1;
1873 static const struct hda_fixup stac92hd73xx_fixups[] = {
1874 [STAC_92HD73XX_REF] = {
1875 .type = HDA_FIXUP_FUNC,
1876 .v.func = stac92hd73xx_fixup_ref,
1878 [STAC_DELL_M6_AMIC] = {
1879 .type = HDA_FIXUP_FUNC,
1880 .v.func = stac92hd73xx_fixup_dell_m6_amic,
1882 [STAC_DELL_M6_DMIC] = {
1883 .type = HDA_FIXUP_FUNC,
1884 .v.func = stac92hd73xx_fixup_dell_m6_dmic,
1886 [STAC_DELL_M6_BOTH] = {
1887 .type = HDA_FIXUP_FUNC,
1888 .v.func = stac92hd73xx_fixup_dell_m6_both,
1891 .type = HDA_FIXUP_FUNC,
1892 .v.func = stac92hd73xx_fixup_dell_eq,
1894 [STAC_ALIENWARE_M17X] = {
1895 .type = HDA_FIXUP_FUNC,
1896 .v.func = stac92hd73xx_fixup_alienware_m17x,
1898 [STAC_ELO_VUPOINT_15MX] = {
1899 .type = HDA_FIXUP_FUNC,
1900 .v.func = stac92hd73xx_disable_automute,
1902 [STAC_92HD73XX_INTEL] = {
1903 .type = HDA_FIXUP_PINS,
1904 .v.pins = intel_dg45id_pin_configs,
1906 [STAC_92HD73XX_NO_JD] = {
1907 .type = HDA_FIXUP_FUNC,
1908 .v.func = stac92hd73xx_fixup_no_jd,
1910 [STAC_92HD89XX_HP_FRONT_JACK] = {
1911 .type = HDA_FIXUP_PINS,
1912 .v.pins = stac92hd89xx_hp_front_jack_pin_configs,
1914 [STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK] = {
1915 .type = HDA_FIXUP_PINS,
1916 .v.pins = stac92hd89xx_hp_z1_g2_right_mic_jack_pin_configs,
1918 [STAC_92HD73XX_ASUS_MOBO] = {
1919 .type = HDA_FIXUP_PINS,
1920 .v.pins = (const struct hda_pintbl[]) {
1921 /* enable 5.1 and SPDIF out */
1922 { 0x0c, 0x01014411 },
1923 { 0x0d, 0x01014410 },
1924 { 0x0e, 0x01014412 },
1925 { 0x22, 0x014b1180 },
1931 static const struct hda_model_fixup stac92hd73xx_models[] = {
1932 { .id = STAC_92HD73XX_NO_JD, .name = "no-jd" },
1933 { .id = STAC_92HD73XX_REF, .name = "ref" },
1934 { .id = STAC_92HD73XX_INTEL, .name = "intel" },
1935 { .id = STAC_DELL_M6_AMIC, .name = "dell-m6-amic" },
1936 { .id = STAC_DELL_M6_DMIC, .name = "dell-m6-dmic" },
1937 { .id = STAC_DELL_M6_BOTH, .name = "dell-m6" },
1938 { .id = STAC_DELL_EQ, .name = "dell-eq" },
1939 { .id = STAC_ALIENWARE_M17X, .name = "alienware" },
1940 { .id = STAC_ELO_VUPOINT_15MX, .name = "elo-vupoint-15mx" },
1941 { .id = STAC_92HD73XX_ASUS_MOBO, .name = "asus-mobo" },
1945 static const struct snd_pci_quirk stac92hd73xx_fixup_tbl[] = {
1946 /* SigmaTel reference board */
1947 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1948 "DFI LanParty", STAC_92HD73XX_REF),
1949 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1950 "DFI LanParty", STAC_92HD73XX_REF),
1951 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5002,
1952 "Intel DG45ID", STAC_92HD73XX_INTEL),
1953 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5003,
1954 "Intel DG45FC", STAC_92HD73XX_INTEL),
1955 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254,
1956 "Dell Studio 1535", STAC_DELL_M6_DMIC),
1957 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255,
1958 "unknown Dell", STAC_DELL_M6_DMIC),
1959 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256,
1960 "unknown Dell", STAC_DELL_M6_BOTH),
1961 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257,
1962 "unknown Dell", STAC_DELL_M6_BOTH),
1963 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e,
1964 "unknown Dell", STAC_DELL_M6_AMIC),
1965 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f,
1966 "unknown Dell", STAC_DELL_M6_AMIC),
1967 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271,
1968 "unknown Dell", STAC_DELL_M6_DMIC),
1969 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0272,
1970 "unknown Dell", STAC_DELL_M6_DMIC),
1971 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f,
1972 "Dell Studio 1537", STAC_DELL_M6_DMIC),
1973 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a0,
1974 "Dell Studio 17", STAC_DELL_M6_DMIC),
1975 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02be,
1976 "Dell Studio 1555", STAC_DELL_M6_DMIC),
1977 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02bd,
1978 "Dell Studio 1557", STAC_DELL_M6_DMIC),
1979 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02fe,
1980 "Dell Studio XPS 1645", STAC_DELL_M6_DMIC),
1981 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0413,
1982 "Dell Studio 1558", STAC_DELL_M6_DMIC),
1983 /* codec SSID matching */
1984 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1,
1985 "Alienware M17x", STAC_ALIENWARE_M17X),
1986 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a,
1987 "Alienware M17x", STAC_ALIENWARE_M17X),
1988 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490,
1989 "Alienware M17x R3", STAC_DELL_EQ),
1990 SND_PCI_QUIRK(0x1059, 0x1011,
1991 "ELO VuPoint 15MX", STAC_ELO_VUPOINT_15MX),
1992 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1927,
1993 "HP Z1 G2", STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK),
1994 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2b17,
1995 "unknown HP", STAC_92HD89XX_HP_FRONT_JACK),
1996 SND_PCI_QUIRK(PCI_VENDOR_ID_ASUSTEK, 0x83f8, "ASUS AT4NM10",
1997 STAC_92HD73XX_ASUS_MOBO),
2001 static const struct hda_pintbl ref92hd83xxx_pin_configs[] = {
2002 { 0x0a, 0x02214030 },
2003 { 0x0b, 0x02211010 },
2004 { 0x0c, 0x02a19020 },
2005 { 0x0d, 0x02170130 },
2006 { 0x0e, 0x01014050 },
2007 { 0x0f, 0x01819040 },
2008 { 0x10, 0x01014020 },
2009 { 0x11, 0x90a3014e },
2010 { 0x1f, 0x01451160 },
2011 { 0x20, 0x98560170 },
2015 static const struct hda_pintbl dell_s14_pin_configs[] = {
2016 { 0x0a, 0x0221403f },
2017 { 0x0b, 0x0221101f },
2018 { 0x0c, 0x02a19020 },
2019 { 0x0d, 0x90170110 },
2020 { 0x0e, 0x40f000f0 },
2021 { 0x0f, 0x40f000f0 },
2022 { 0x10, 0x40f000f0 },
2023 { 0x11, 0x90a60160 },
2024 { 0x1f, 0x40f000f0 },
2025 { 0x20, 0x40f000f0 },
2029 static const struct hda_pintbl dell_vostro_3500_pin_configs[] = {
2030 { 0x0a, 0x02a11020 },
2031 { 0x0b, 0x0221101f },
2032 { 0x0c, 0x400000f0 },
2033 { 0x0d, 0x90170110 },
2034 { 0x0e, 0x400000f1 },
2035 { 0x0f, 0x400000f2 },
2036 { 0x10, 0x400000f3 },
2037 { 0x11, 0x90a60160 },
2038 { 0x1f, 0x400000f4 },
2039 { 0x20, 0x400000f5 },
2043 static const struct hda_pintbl hp_dv7_4000_pin_configs[] = {
2044 { 0x0a, 0x03a12050 },
2045 { 0x0b, 0x0321201f },
2046 { 0x0c, 0x40f000f0 },
2047 { 0x0d, 0x90170110 },
2048 { 0x0e, 0x40f000f0 },
2049 { 0x0f, 0x40f000f0 },
2050 { 0x10, 0x90170110 },
2051 { 0x11, 0xd5a30140 },
2052 { 0x1f, 0x40f000f0 },
2053 { 0x20, 0x40f000f0 },
2057 static const struct hda_pintbl hp_zephyr_pin_configs[] = {
2058 { 0x0a, 0x01813050 },
2059 { 0x0b, 0x0421201f },
2060 { 0x0c, 0x04a1205e },
2061 { 0x0d, 0x96130310 },
2062 { 0x0e, 0x96130310 },
2063 { 0x0f, 0x0101401f },
2064 { 0x10, 0x1111611f },
2065 { 0x11, 0xd5a30130 },
2069 static const struct hda_pintbl hp_cNB11_intquad_pin_configs[] = {
2070 { 0x0a, 0x40f000f0 },
2071 { 0x0b, 0x0221101f },
2072 { 0x0c, 0x02a11020 },
2073 { 0x0d, 0x92170110 },
2074 { 0x0e, 0x40f000f0 },
2075 { 0x0f, 0x92170110 },
2076 { 0x10, 0x40f000f0 },
2077 { 0x11, 0xd5a30130 },
2078 { 0x1f, 0x40f000f0 },
2079 { 0x20, 0x40f000f0 },
2083 static void stac92hd83xxx_fixup_hp(struct hda_codec *codec,
2084 const struct hda_fixup *fix, int action)
2086 struct sigmatel_spec *spec = codec->spec;
2088 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2091 if (hp_bnb2011_with_dock(codec)) {
2092 snd_hda_codec_set_pincfg(codec, 0xa, 0x2101201f);
2093 snd_hda_codec_set_pincfg(codec, 0xf, 0x2181205e);
2096 if (find_mute_led_cfg(codec, spec->default_polarity))
2097 codec_dbg(codec, "mute LED gpio %d polarity %d\n",
2099 spec->gpio_led_polarity);
2101 /* allow auto-switching of dock line-in */
2102 spec->gen.line_in_auto_switch = true;
2105 static void stac92hd83xxx_fixup_hp_zephyr(struct hda_codec *codec,
2106 const struct hda_fixup *fix, int action)
2108 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2111 snd_hda_apply_pincfgs(codec, hp_zephyr_pin_configs);
2112 snd_hda_add_verbs(codec, stac92hd83xxx_hp_zephyr_init);
2115 static void stac92hd83xxx_fixup_hp_led(struct hda_codec *codec,
2116 const struct hda_fixup *fix, int action)
2118 struct sigmatel_spec *spec = codec->spec;
2120 if (action == HDA_FIXUP_ACT_PRE_PROBE)
2121 spec->default_polarity = 0;
2124 static void stac92hd83xxx_fixup_hp_inv_led(struct hda_codec *codec,
2125 const struct hda_fixup *fix, int action)
2127 struct sigmatel_spec *spec = codec->spec;
2129 if (action == HDA_FIXUP_ACT_PRE_PROBE)
2130 spec->default_polarity = 1;
2133 static void stac92hd83xxx_fixup_hp_mic_led(struct hda_codec *codec,
2134 const struct hda_fixup *fix, int action)
2136 struct sigmatel_spec *spec = codec->spec;
2138 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2139 spec->mic_mute_led_gpio = 0x08; /* GPIO3 */
2141 /* resetting controller clears GPIO, so we need to keep on */
2142 codec->core.power_caps &= ~AC_PWRST_CLKSTOP;
2147 static void stac92hd83xxx_fixup_hp_led_gpio10(struct hda_codec *codec,
2148 const struct hda_fixup *fix, int action)
2150 struct sigmatel_spec *spec = codec->spec;
2152 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2153 spec->gpio_led = 0x10; /* GPIO4 */
2154 spec->default_polarity = 0;
2158 static void stac92hd83xxx_fixup_headset_jack(struct hda_codec *codec,
2159 const struct hda_fixup *fix, int action)
2161 struct sigmatel_spec *spec = codec->spec;
2163 if (action == HDA_FIXUP_ACT_PRE_PROBE)
2164 spec->headset_jack = 1;
2167 static void stac92hd83xxx_fixup_gpio10_eapd(struct hda_codec *codec,
2168 const struct hda_fixup *fix,
2171 struct sigmatel_spec *spec = codec->spec;
2173 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2175 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir =
2176 spec->gpio_data = 0x10;
2177 spec->eapd_switch = 0;
2180 static void hp_envy_ts_fixup_dac_bind(struct hda_codec *codec,
2181 const struct hda_fixup *fix,
2184 struct sigmatel_spec *spec = codec->spec;
2185 static hda_nid_t preferred_pairs[] = {
2190 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2193 spec->gen.preferred_dacs = preferred_pairs;
2196 static const struct hda_verb hp_bnb13_eq_verbs[] = {
2198 { 0x22, 0x7A6, 0x3E },
2199 { 0x22, 0x7A7, 0x68 },
2200 { 0x22, 0x7A8, 0x17 },
2201 { 0x22, 0x7A9, 0x3E },
2202 { 0x22, 0x7AA, 0x68 },
2203 { 0x22, 0x7AB, 0x17 },
2204 { 0x22, 0x7AC, 0x00 },
2205 { 0x22, 0x7AD, 0x80 },
2206 { 0x22, 0x7A6, 0x83 },
2207 { 0x22, 0x7A7, 0x2F },
2208 { 0x22, 0x7A8, 0xD1 },
2209 { 0x22, 0x7A9, 0x83 },
2210 { 0x22, 0x7AA, 0x2F },
2211 { 0x22, 0x7AB, 0xD1 },
2212 { 0x22, 0x7AC, 0x01 },
2213 { 0x22, 0x7AD, 0x80 },
2214 { 0x22, 0x7A6, 0x3E },
2215 { 0x22, 0x7A7, 0x68 },
2216 { 0x22, 0x7A8, 0x17 },
2217 { 0x22, 0x7A9, 0x3E },
2218 { 0x22, 0x7AA, 0x68 },
2219 { 0x22, 0x7AB, 0x17 },
2220 { 0x22, 0x7AC, 0x02 },
2221 { 0x22, 0x7AD, 0x80 },
2222 { 0x22, 0x7A6, 0x7C },
2223 { 0x22, 0x7A7, 0xC6 },
2224 { 0x22, 0x7A8, 0x0C },
2225 { 0x22, 0x7A9, 0x7C },
2226 { 0x22, 0x7AA, 0xC6 },
2227 { 0x22, 0x7AB, 0x0C },
2228 { 0x22, 0x7AC, 0x03 },
2229 { 0x22, 0x7AD, 0x80 },
2230 { 0x22, 0x7A6, 0xC3 },
2231 { 0x22, 0x7A7, 0x25 },
2232 { 0x22, 0x7A8, 0xAF },
2233 { 0x22, 0x7A9, 0xC3 },
2234 { 0x22, 0x7AA, 0x25 },
2235 { 0x22, 0x7AB, 0xAF },
2236 { 0x22, 0x7AC, 0x04 },
2237 { 0x22, 0x7AD, 0x80 },
2238 { 0x22, 0x7A6, 0x3E },
2239 { 0x22, 0x7A7, 0x85 },
2240 { 0x22, 0x7A8, 0x73 },
2241 { 0x22, 0x7A9, 0x3E },
2242 { 0x22, 0x7AA, 0x85 },
2243 { 0x22, 0x7AB, 0x73 },
2244 { 0x22, 0x7AC, 0x05 },
2245 { 0x22, 0x7AD, 0x80 },
2246 { 0x22, 0x7A6, 0x85 },
2247 { 0x22, 0x7A7, 0x39 },
2248 { 0x22, 0x7A8, 0xC7 },
2249 { 0x22, 0x7A9, 0x85 },
2250 { 0x22, 0x7AA, 0x39 },
2251 { 0x22, 0x7AB, 0xC7 },
2252 { 0x22, 0x7AC, 0x06 },
2253 { 0x22, 0x7AD, 0x80 },
2254 { 0x22, 0x7A6, 0x3C },
2255 { 0x22, 0x7A7, 0x90 },
2256 { 0x22, 0x7A8, 0xB0 },
2257 { 0x22, 0x7A9, 0x3C },
2258 { 0x22, 0x7AA, 0x90 },
2259 { 0x22, 0x7AB, 0xB0 },
2260 { 0x22, 0x7AC, 0x07 },
2261 { 0x22, 0x7AD, 0x80 },
2262 { 0x22, 0x7A6, 0x7A },
2263 { 0x22, 0x7A7, 0xC6 },
2264 { 0x22, 0x7A8, 0x39 },
2265 { 0x22, 0x7A9, 0x7A },
2266 { 0x22, 0x7AA, 0xC6 },
2267 { 0x22, 0x7AB, 0x39 },
2268 { 0x22, 0x7AC, 0x08 },
2269 { 0x22, 0x7AD, 0x80 },
2270 { 0x22, 0x7A6, 0xC4 },
2271 { 0x22, 0x7A7, 0xE9 },
2272 { 0x22, 0x7A8, 0xDC },
2273 { 0x22, 0x7A9, 0xC4 },
2274 { 0x22, 0x7AA, 0xE9 },
2275 { 0x22, 0x7AB, 0xDC },
2276 { 0x22, 0x7AC, 0x09 },
2277 { 0x22, 0x7AD, 0x80 },
2278 { 0x22, 0x7A6, 0x3D },
2279 { 0x22, 0x7A7, 0xE1 },
2280 { 0x22, 0x7A8, 0x0D },
2281 { 0x22, 0x7A9, 0x3D },
2282 { 0x22, 0x7AA, 0xE1 },
2283 { 0x22, 0x7AB, 0x0D },
2284 { 0x22, 0x7AC, 0x0A },
2285 { 0x22, 0x7AD, 0x80 },
2286 { 0x22, 0x7A6, 0x89 },
2287 { 0x22, 0x7A7, 0xB6 },
2288 { 0x22, 0x7A8, 0xEB },
2289 { 0x22, 0x7A9, 0x89 },
2290 { 0x22, 0x7AA, 0xB6 },
2291 { 0x22, 0x7AB, 0xEB },
2292 { 0x22, 0x7AC, 0x0B },
2293 { 0x22, 0x7AD, 0x80 },
2294 { 0x22, 0x7A6, 0x39 },
2295 { 0x22, 0x7A7, 0x9D },
2296 { 0x22, 0x7A8, 0xFE },
2297 { 0x22, 0x7A9, 0x39 },
2298 { 0x22, 0x7AA, 0x9D },
2299 { 0x22, 0x7AB, 0xFE },
2300 { 0x22, 0x7AC, 0x0C },
2301 { 0x22, 0x7AD, 0x80 },
2302 { 0x22, 0x7A6, 0x76 },
2303 { 0x22, 0x7A7, 0x49 },
2304 { 0x22, 0x7A8, 0x15 },
2305 { 0x22, 0x7A9, 0x76 },
2306 { 0x22, 0x7AA, 0x49 },
2307 { 0x22, 0x7AB, 0x15 },
2308 { 0x22, 0x7AC, 0x0D },
2309 { 0x22, 0x7AD, 0x80 },
2310 { 0x22, 0x7A6, 0xC8 },
2311 { 0x22, 0x7A7, 0x80 },
2312 { 0x22, 0x7A8, 0xF5 },
2313 { 0x22, 0x7A9, 0xC8 },
2314 { 0x22, 0x7AA, 0x80 },
2315 { 0x22, 0x7AB, 0xF5 },
2316 { 0x22, 0x7AC, 0x0E },
2317 { 0x22, 0x7AD, 0x80 },
2318 { 0x22, 0x7A6, 0x40 },
2319 { 0x22, 0x7A7, 0x00 },
2320 { 0x22, 0x7A8, 0x00 },
2321 { 0x22, 0x7A9, 0x40 },
2322 { 0x22, 0x7AA, 0x00 },
2323 { 0x22, 0x7AB, 0x00 },
2324 { 0x22, 0x7AC, 0x0F },
2325 { 0x22, 0x7AD, 0x80 },
2326 { 0x22, 0x7A6, 0x90 },
2327 { 0x22, 0x7A7, 0x68 },
2328 { 0x22, 0x7A8, 0xF1 },
2329 { 0x22, 0x7A9, 0x90 },
2330 { 0x22, 0x7AA, 0x68 },
2331 { 0x22, 0x7AB, 0xF1 },
2332 { 0x22, 0x7AC, 0x10 },
2333 { 0x22, 0x7AD, 0x80 },
2334 { 0x22, 0x7A6, 0x34 },
2335 { 0x22, 0x7A7, 0x47 },
2336 { 0x22, 0x7A8, 0x6C },
2337 { 0x22, 0x7A9, 0x34 },
2338 { 0x22, 0x7AA, 0x47 },
2339 { 0x22, 0x7AB, 0x6C },
2340 { 0x22, 0x7AC, 0x11 },
2341 { 0x22, 0x7AD, 0x80 },
2342 { 0x22, 0x7A6, 0x6F },
2343 { 0x22, 0x7A7, 0x97 },
2344 { 0x22, 0x7A8, 0x0F },
2345 { 0x22, 0x7A9, 0x6F },
2346 { 0x22, 0x7AA, 0x97 },
2347 { 0x22, 0x7AB, 0x0F },
2348 { 0x22, 0x7AC, 0x12 },
2349 { 0x22, 0x7AD, 0x80 },
2350 { 0x22, 0x7A6, 0xCB },
2351 { 0x22, 0x7A7, 0xB8 },
2352 { 0x22, 0x7A8, 0x94 },
2353 { 0x22, 0x7A9, 0xCB },
2354 { 0x22, 0x7AA, 0xB8 },
2355 { 0x22, 0x7AB, 0x94 },
2356 { 0x22, 0x7AC, 0x13 },
2357 { 0x22, 0x7AD, 0x80 },
2358 { 0x22, 0x7A6, 0x40 },
2359 { 0x22, 0x7A7, 0x00 },
2360 { 0x22, 0x7A8, 0x00 },
2361 { 0x22, 0x7A9, 0x40 },
2362 { 0x22, 0x7AA, 0x00 },
2363 { 0x22, 0x7AB, 0x00 },
2364 { 0x22, 0x7AC, 0x14 },
2365 { 0x22, 0x7AD, 0x80 },
2366 { 0x22, 0x7A6, 0x95 },
2367 { 0x22, 0x7A7, 0x76 },
2368 { 0x22, 0x7A8, 0x5B },
2369 { 0x22, 0x7A9, 0x95 },
2370 { 0x22, 0x7AA, 0x76 },
2371 { 0x22, 0x7AB, 0x5B },
2372 { 0x22, 0x7AC, 0x15 },
2373 { 0x22, 0x7AD, 0x80 },
2374 { 0x22, 0x7A6, 0x31 },
2375 { 0x22, 0x7A7, 0xAC },
2376 { 0x22, 0x7A8, 0x31 },
2377 { 0x22, 0x7A9, 0x31 },
2378 { 0x22, 0x7AA, 0xAC },
2379 { 0x22, 0x7AB, 0x31 },
2380 { 0x22, 0x7AC, 0x16 },
2381 { 0x22, 0x7AD, 0x80 },
2382 { 0x22, 0x7A6, 0x6A },
2383 { 0x22, 0x7A7, 0x89 },
2384 { 0x22, 0x7A8, 0xA5 },
2385 { 0x22, 0x7A9, 0x6A },
2386 { 0x22, 0x7AA, 0x89 },
2387 { 0x22, 0x7AB, 0xA5 },
2388 { 0x22, 0x7AC, 0x17 },
2389 { 0x22, 0x7AD, 0x80 },
2390 { 0x22, 0x7A6, 0xCE },
2391 { 0x22, 0x7A7, 0x53 },
2392 { 0x22, 0x7A8, 0xCF },
2393 { 0x22, 0x7A9, 0xCE },
2394 { 0x22, 0x7AA, 0x53 },
2395 { 0x22, 0x7AB, 0xCF },
2396 { 0x22, 0x7AC, 0x18 },
2397 { 0x22, 0x7AD, 0x80 },
2398 { 0x22, 0x7A6, 0x40 },
2399 { 0x22, 0x7A7, 0x00 },
2400 { 0x22, 0x7A8, 0x00 },
2401 { 0x22, 0x7A9, 0x40 },
2402 { 0x22, 0x7AA, 0x00 },
2403 { 0x22, 0x7AB, 0x00 },
2404 { 0x22, 0x7AC, 0x19 },
2405 { 0x22, 0x7AD, 0x80 },
2407 { 0x22, 0x7A6, 0x3E },
2408 { 0x22, 0x7A7, 0x88 },
2409 { 0x22, 0x7A8, 0xDC },
2410 { 0x22, 0x7A9, 0x3E },
2411 { 0x22, 0x7AA, 0x88 },
2412 { 0x22, 0x7AB, 0xDC },
2413 { 0x22, 0x7AC, 0x1A },
2414 { 0x22, 0x7AD, 0x80 },
2415 { 0x22, 0x7A6, 0x82 },
2416 { 0x22, 0x7A7, 0xEE },
2417 { 0x22, 0x7A8, 0x46 },
2418 { 0x22, 0x7A9, 0x82 },
2419 { 0x22, 0x7AA, 0xEE },
2420 { 0x22, 0x7AB, 0x46 },
2421 { 0x22, 0x7AC, 0x1B },
2422 { 0x22, 0x7AD, 0x80 },
2423 { 0x22, 0x7A6, 0x3E },
2424 { 0x22, 0x7A7, 0x88 },
2425 { 0x22, 0x7A8, 0xDC },
2426 { 0x22, 0x7A9, 0x3E },
2427 { 0x22, 0x7AA, 0x88 },
2428 { 0x22, 0x7AB, 0xDC },
2429 { 0x22, 0x7AC, 0x1C },
2430 { 0x22, 0x7AD, 0x80 },
2431 { 0x22, 0x7A6, 0x7D },
2432 { 0x22, 0x7A7, 0x09 },
2433 { 0x22, 0x7A8, 0x28 },
2434 { 0x22, 0x7A9, 0x7D },
2435 { 0x22, 0x7AA, 0x09 },
2436 { 0x22, 0x7AB, 0x28 },
2437 { 0x22, 0x7AC, 0x1D },
2438 { 0x22, 0x7AD, 0x80 },
2439 { 0x22, 0x7A6, 0xC2 },
2440 { 0x22, 0x7A7, 0xE5 },
2441 { 0x22, 0x7A8, 0xB4 },
2442 { 0x22, 0x7A9, 0xC2 },
2443 { 0x22, 0x7AA, 0xE5 },
2444 { 0x22, 0x7AB, 0xB4 },
2445 { 0x22, 0x7AC, 0x1E },
2446 { 0x22, 0x7AD, 0x80 },
2447 { 0x22, 0x7A6, 0x3E },
2448 { 0x22, 0x7A7, 0xA3 },
2449 { 0x22, 0x7A8, 0x1F },
2450 { 0x22, 0x7A9, 0x3E },
2451 { 0x22, 0x7AA, 0xA3 },
2452 { 0x22, 0x7AB, 0x1F },
2453 { 0x22, 0x7AC, 0x1F },
2454 { 0x22, 0x7AD, 0x80 },
2455 { 0x22, 0x7A6, 0x84 },
2456 { 0x22, 0x7A7, 0xCA },
2457 { 0x22, 0x7A8, 0xF1 },
2458 { 0x22, 0x7A9, 0x84 },
2459 { 0x22, 0x7AA, 0xCA },
2460 { 0x22, 0x7AB, 0xF1 },
2461 { 0x22, 0x7AC, 0x20 },
2462 { 0x22, 0x7AD, 0x80 },
2463 { 0x22, 0x7A6, 0x3C },
2464 { 0x22, 0x7A7, 0xD5 },
2465 { 0x22, 0x7A8, 0x9C },
2466 { 0x22, 0x7A9, 0x3C },
2467 { 0x22, 0x7AA, 0xD5 },
2468 { 0x22, 0x7AB, 0x9C },
2469 { 0x22, 0x7AC, 0x21 },
2470 { 0x22, 0x7AD, 0x80 },
2471 { 0x22, 0x7A6, 0x7B },
2472 { 0x22, 0x7A7, 0x35 },
2473 { 0x22, 0x7A8, 0x0F },
2474 { 0x22, 0x7A9, 0x7B },
2475 { 0x22, 0x7AA, 0x35 },
2476 { 0x22, 0x7AB, 0x0F },
2477 { 0x22, 0x7AC, 0x22 },
2478 { 0x22, 0x7AD, 0x80 },
2479 { 0x22, 0x7A6, 0xC4 },
2480 { 0x22, 0x7A7, 0x87 },
2481 { 0x22, 0x7A8, 0x45 },
2482 { 0x22, 0x7A9, 0xC4 },
2483 { 0x22, 0x7AA, 0x87 },
2484 { 0x22, 0x7AB, 0x45 },
2485 { 0x22, 0x7AC, 0x23 },
2486 { 0x22, 0x7AD, 0x80 },
2487 { 0x22, 0x7A6, 0x3E },
2488 { 0x22, 0x7A7, 0x0A },
2489 { 0x22, 0x7A8, 0x78 },
2490 { 0x22, 0x7A9, 0x3E },
2491 { 0x22, 0x7AA, 0x0A },
2492 { 0x22, 0x7AB, 0x78 },
2493 { 0x22, 0x7AC, 0x24 },
2494 { 0x22, 0x7AD, 0x80 },
2495 { 0x22, 0x7A6, 0x88 },
2496 { 0x22, 0x7A7, 0xE2 },
2497 { 0x22, 0x7A8, 0x05 },
2498 { 0x22, 0x7A9, 0x88 },
2499 { 0x22, 0x7AA, 0xE2 },
2500 { 0x22, 0x7AB, 0x05 },
2501 { 0x22, 0x7AC, 0x25 },
2502 { 0x22, 0x7AD, 0x80 },
2503 { 0x22, 0x7A6, 0x3A },
2504 { 0x22, 0x7A7, 0x1A },
2505 { 0x22, 0x7A8, 0xA3 },
2506 { 0x22, 0x7A9, 0x3A },
2507 { 0x22, 0x7AA, 0x1A },
2508 { 0x22, 0x7AB, 0xA3 },
2509 { 0x22, 0x7AC, 0x26 },
2510 { 0x22, 0x7AD, 0x80 },
2511 { 0x22, 0x7A6, 0x77 },
2512 { 0x22, 0x7A7, 0x1D },
2513 { 0x22, 0x7A8, 0xFB },
2514 { 0x22, 0x7A9, 0x77 },
2515 { 0x22, 0x7AA, 0x1D },
2516 { 0x22, 0x7AB, 0xFB },
2517 { 0x22, 0x7AC, 0x27 },
2518 { 0x22, 0x7AD, 0x80 },
2519 { 0x22, 0x7A6, 0xC7 },
2520 { 0x22, 0x7A7, 0xDA },
2521 { 0x22, 0x7A8, 0xE5 },
2522 { 0x22, 0x7A9, 0xC7 },
2523 { 0x22, 0x7AA, 0xDA },
2524 { 0x22, 0x7AB, 0xE5 },
2525 { 0x22, 0x7AC, 0x28 },
2526 { 0x22, 0x7AD, 0x80 },
2527 { 0x22, 0x7A6, 0x40 },
2528 { 0x22, 0x7A7, 0x00 },
2529 { 0x22, 0x7A8, 0x00 },
2530 { 0x22, 0x7A9, 0x40 },
2531 { 0x22, 0x7AA, 0x00 },
2532 { 0x22, 0x7AB, 0x00 },
2533 { 0x22, 0x7AC, 0x29 },
2534 { 0x22, 0x7AD, 0x80 },
2535 { 0x22, 0x7A6, 0x8E },
2536 { 0x22, 0x7A7, 0xD7 },
2537 { 0x22, 0x7A8, 0x22 },
2538 { 0x22, 0x7A9, 0x8E },
2539 { 0x22, 0x7AA, 0xD7 },
2540 { 0x22, 0x7AB, 0x22 },
2541 { 0x22, 0x7AC, 0x2A },
2542 { 0x22, 0x7AD, 0x80 },
2543 { 0x22, 0x7A6, 0x35 },
2544 { 0x22, 0x7A7, 0x26 },
2545 { 0x22, 0x7A8, 0xC6 },
2546 { 0x22, 0x7A9, 0x35 },
2547 { 0x22, 0x7AA, 0x26 },
2548 { 0x22, 0x7AB, 0xC6 },
2549 { 0x22, 0x7AC, 0x2B },
2550 { 0x22, 0x7AD, 0x80 },
2551 { 0x22, 0x7A6, 0x71 },
2552 { 0x22, 0x7A7, 0x28 },
2553 { 0x22, 0x7A8, 0xDE },
2554 { 0x22, 0x7A9, 0x71 },
2555 { 0x22, 0x7AA, 0x28 },
2556 { 0x22, 0x7AB, 0xDE },
2557 { 0x22, 0x7AC, 0x2C },
2558 { 0x22, 0x7AD, 0x80 },
2559 { 0x22, 0x7A6, 0xCA },
2560 { 0x22, 0x7A7, 0xD9 },
2561 { 0x22, 0x7A8, 0x3A },
2562 { 0x22, 0x7A9, 0xCA },
2563 { 0x22, 0x7AA, 0xD9 },
2564 { 0x22, 0x7AB, 0x3A },
2565 { 0x22, 0x7AC, 0x2D },
2566 { 0x22, 0x7AD, 0x80 },
2567 { 0x22, 0x7A6, 0x40 },
2568 { 0x22, 0x7A7, 0x00 },
2569 { 0x22, 0x7A8, 0x00 },
2570 { 0x22, 0x7A9, 0x40 },
2571 { 0x22, 0x7AA, 0x00 },
2572 { 0x22, 0x7AB, 0x00 },
2573 { 0x22, 0x7AC, 0x2E },
2574 { 0x22, 0x7AD, 0x80 },
2575 { 0x22, 0x7A6, 0x93 },
2576 { 0x22, 0x7A7, 0x5E },
2577 { 0x22, 0x7A8, 0xD8 },
2578 { 0x22, 0x7A9, 0x93 },
2579 { 0x22, 0x7AA, 0x5E },
2580 { 0x22, 0x7AB, 0xD8 },
2581 { 0x22, 0x7AC, 0x2F },
2582 { 0x22, 0x7AD, 0x80 },
2583 { 0x22, 0x7A6, 0x32 },
2584 { 0x22, 0x7A7, 0xB7 },
2585 { 0x22, 0x7A8, 0xB1 },
2586 { 0x22, 0x7A9, 0x32 },
2587 { 0x22, 0x7AA, 0xB7 },
2588 { 0x22, 0x7AB, 0xB1 },
2589 { 0x22, 0x7AC, 0x30 },
2590 { 0x22, 0x7AD, 0x80 },
2591 { 0x22, 0x7A6, 0x6C },
2592 { 0x22, 0x7A7, 0xA1 },
2593 { 0x22, 0x7A8, 0x28 },
2594 { 0x22, 0x7A9, 0x6C },
2595 { 0x22, 0x7AA, 0xA1 },
2596 { 0x22, 0x7AB, 0x28 },
2597 { 0x22, 0x7AC, 0x31 },
2598 { 0x22, 0x7AD, 0x80 },
2599 { 0x22, 0x7A6, 0xCD },
2600 { 0x22, 0x7A7, 0x48 },
2601 { 0x22, 0x7A8, 0x4F },
2602 { 0x22, 0x7A9, 0xCD },
2603 { 0x22, 0x7AA, 0x48 },
2604 { 0x22, 0x7AB, 0x4F },
2605 { 0x22, 0x7AC, 0x32 },
2606 { 0x22, 0x7AD, 0x80 },
2607 { 0x22, 0x7A6, 0x40 },
2608 { 0x22, 0x7A7, 0x00 },
2609 { 0x22, 0x7A8, 0x00 },
2610 { 0x22, 0x7A9, 0x40 },
2611 { 0x22, 0x7AA, 0x00 },
2612 { 0x22, 0x7AB, 0x00 },
2613 { 0x22, 0x7AC, 0x33 },
2614 { 0x22, 0x7AD, 0x80 },
2616 { 0x22, 0x782, 0xC1 },
2617 { 0x22, 0x771, 0x2C },
2618 { 0x22, 0x772, 0x2C },
2619 { 0x22, 0x788, 0x04 },
2620 { 0x01, 0x7B0, 0x08 },
2624 static const struct hda_fixup stac92hd83xxx_fixups[] = {
2625 [STAC_92HD83XXX_REF] = {
2626 .type = HDA_FIXUP_PINS,
2627 .v.pins = ref92hd83xxx_pin_configs,
2629 [STAC_92HD83XXX_PWR_REF] = {
2630 .type = HDA_FIXUP_PINS,
2631 .v.pins = ref92hd83xxx_pin_configs,
2634 .type = HDA_FIXUP_PINS,
2635 .v.pins = dell_s14_pin_configs,
2637 [STAC_DELL_VOSTRO_3500] = {
2638 .type = HDA_FIXUP_PINS,
2639 .v.pins = dell_vostro_3500_pin_configs,
2641 [STAC_92HD83XXX_HP_cNB11_INTQUAD] = {
2642 .type = HDA_FIXUP_PINS,
2643 .v.pins = hp_cNB11_intquad_pin_configs,
2645 .chain_id = STAC_92HD83XXX_HP,
2647 [STAC_92HD83XXX_HP] = {
2648 .type = HDA_FIXUP_FUNC,
2649 .v.func = stac92hd83xxx_fixup_hp,
2651 [STAC_HP_DV7_4000] = {
2652 .type = HDA_FIXUP_PINS,
2653 .v.pins = hp_dv7_4000_pin_configs,
2655 .chain_id = STAC_92HD83XXX_HP,
2657 [STAC_HP_ZEPHYR] = {
2658 .type = HDA_FIXUP_FUNC,
2659 .v.func = stac92hd83xxx_fixup_hp_zephyr,
2661 .chain_id = STAC_92HD83XXX_HP,
2663 [STAC_92HD83XXX_HP_LED] = {
2664 .type = HDA_FIXUP_FUNC,
2665 .v.func = stac92hd83xxx_fixup_hp_led,
2667 .chain_id = STAC_92HD83XXX_HP,
2669 [STAC_92HD83XXX_HP_INV_LED] = {
2670 .type = HDA_FIXUP_FUNC,
2671 .v.func = stac92hd83xxx_fixup_hp_inv_led,
2673 .chain_id = STAC_92HD83XXX_HP,
2675 [STAC_92HD83XXX_HP_MIC_LED] = {
2676 .type = HDA_FIXUP_FUNC,
2677 .v.func = stac92hd83xxx_fixup_hp_mic_led,
2679 .chain_id = STAC_92HD83XXX_HP,
2681 [STAC_HP_LED_GPIO10] = {
2682 .type = HDA_FIXUP_FUNC,
2683 .v.func = stac92hd83xxx_fixup_hp_led_gpio10,
2685 .chain_id = STAC_92HD83XXX_HP,
2687 [STAC_92HD83XXX_HEADSET_JACK] = {
2688 .type = HDA_FIXUP_FUNC,
2689 .v.func = stac92hd83xxx_fixup_headset_jack,
2691 [STAC_HP_ENVY_BASS] = {
2692 .type = HDA_FIXUP_PINS,
2693 .v.pins = (const struct hda_pintbl[]) {
2694 { 0x0f, 0x90170111 },
2698 [STAC_HP_BNB13_EQ] = {
2699 .type = HDA_FIXUP_VERBS,
2700 .v.verbs = hp_bnb13_eq_verbs,
2702 .chain_id = STAC_92HD83XXX_HP_MIC_LED,
2704 [STAC_HP_ENVY_TS_BASS] = {
2705 .type = HDA_FIXUP_PINS,
2706 .v.pins = (const struct hda_pintbl[]) {
2707 { 0x10, 0x92170111 },
2711 [STAC_HP_ENVY_TS_DAC_BIND] = {
2712 .type = HDA_FIXUP_FUNC,
2713 .v.func = hp_envy_ts_fixup_dac_bind,
2715 .chain_id = STAC_HP_ENVY_TS_BASS,
2717 [STAC_92HD83XXX_GPIO10_EAPD] = {
2718 .type = HDA_FIXUP_FUNC,
2719 .v.func = stac92hd83xxx_fixup_gpio10_eapd,
2723 static const struct hda_model_fixup stac92hd83xxx_models[] = {
2724 { .id = STAC_92HD83XXX_REF, .name = "ref" },
2725 { .id = STAC_92HD83XXX_PWR_REF, .name = "mic-ref" },
2726 { .id = STAC_DELL_S14, .name = "dell-s14" },
2727 { .id = STAC_DELL_VOSTRO_3500, .name = "dell-vostro-3500" },
2728 { .id = STAC_92HD83XXX_HP_cNB11_INTQUAD, .name = "hp_cNB11_intquad" },
2729 { .id = STAC_HP_DV7_4000, .name = "hp-dv7-4000" },
2730 { .id = STAC_HP_ZEPHYR, .name = "hp-zephyr" },
2731 { .id = STAC_92HD83XXX_HP_LED, .name = "hp-led" },
2732 { .id = STAC_92HD83XXX_HP_INV_LED, .name = "hp-inv-led" },
2733 { .id = STAC_92HD83XXX_HP_MIC_LED, .name = "hp-mic-led" },
2734 { .id = STAC_92HD83XXX_HEADSET_JACK, .name = "headset-jack" },
2735 { .id = STAC_HP_ENVY_BASS, .name = "hp-envy-bass" },
2736 { .id = STAC_HP_BNB13_EQ, .name = "hp-bnb13-eq" },
2737 { .id = STAC_HP_ENVY_TS_BASS, .name = "hp-envy-ts-bass" },
2741 static const struct snd_pci_quirk stac92hd83xxx_fixup_tbl[] = {
2742 /* SigmaTel reference board */
2743 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2744 "DFI LanParty", STAC_92HD83XXX_REF),
2745 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
2746 "DFI LanParty", STAC_92HD83XXX_REF),
2747 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ba,
2748 "unknown Dell", STAC_DELL_S14),
2749 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0532,
2750 "Dell Latitude E6230", STAC_92HD83XXX_HEADSET_JACK),
2751 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0533,
2752 "Dell Latitude E6330", STAC_92HD83XXX_HEADSET_JACK),
2753 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0534,
2754 "Dell Latitude E6430", STAC_92HD83XXX_HEADSET_JACK),
2755 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0535,
2756 "Dell Latitude E6530", STAC_92HD83XXX_HEADSET_JACK),
2757 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x053c,
2758 "Dell Latitude E5430", STAC_92HD83XXX_HEADSET_JACK),
2759 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x053d,
2760 "Dell Latitude E5530", STAC_92HD83XXX_HEADSET_JACK),
2761 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0549,
2762 "Dell Latitude E5430", STAC_92HD83XXX_HEADSET_JACK),
2763 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x057d,
2764 "Dell Latitude E6430s", STAC_92HD83XXX_HEADSET_JACK),
2765 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0584,
2766 "Dell Latitude E6430U", STAC_92HD83XXX_HEADSET_JACK),
2767 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x1028,
2768 "Dell Vostro 3500", STAC_DELL_VOSTRO_3500),
2769 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1656,
2770 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2771 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1657,
2772 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2773 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1658,
2774 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2775 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1659,
2776 "HP Pavilion dv7", STAC_HP_DV7_4000),
2777 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165A,
2778 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2779 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165B,
2780 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2781 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1888,
2782 "HP Envy Spectre", STAC_HP_ENVY_BASS),
2783 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1899,
2784 "HP Folio 13", STAC_HP_LED_GPIO10),
2785 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18df,
2786 "HP Folio", STAC_HP_BNB13_EQ),
2787 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18F8,
2788 "HP bNB13", STAC_HP_BNB13_EQ),
2789 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1909,
2790 "HP bNB13", STAC_HP_BNB13_EQ),
2791 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x190A,
2792 "HP bNB13", STAC_HP_BNB13_EQ),
2793 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x190e,
2794 "HP ENVY TS", STAC_HP_ENVY_TS_BASS),
2795 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1967,
2796 "HP ENVY TS", STAC_HP_ENVY_TS_DAC_BIND),
2797 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1940,
2798 "HP bNB13", STAC_HP_BNB13_EQ),
2799 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1941,
2800 "HP bNB13", STAC_HP_BNB13_EQ),
2801 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1942,
2802 "HP bNB13", STAC_HP_BNB13_EQ),
2803 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1943,
2804 "HP bNB13", STAC_HP_BNB13_EQ),
2805 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1944,
2806 "HP bNB13", STAC_HP_BNB13_EQ),
2807 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1945,
2808 "HP bNB13", STAC_HP_BNB13_EQ),
2809 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1946,
2810 "HP bNB13", STAC_HP_BNB13_EQ),
2811 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1948,
2812 "HP bNB13", STAC_HP_BNB13_EQ),
2813 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1949,
2814 "HP bNB13", STAC_HP_BNB13_EQ),
2815 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194A,
2816 "HP bNB13", STAC_HP_BNB13_EQ),
2817 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194B,
2818 "HP bNB13", STAC_HP_BNB13_EQ),
2819 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194C,
2820 "HP bNB13", STAC_HP_BNB13_EQ),
2821 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194E,
2822 "HP bNB13", STAC_HP_BNB13_EQ),
2823 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194F,
2824 "HP bNB13", STAC_HP_BNB13_EQ),
2825 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1950,
2826 "HP bNB13", STAC_HP_BNB13_EQ),
2827 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1951,
2828 "HP bNB13", STAC_HP_BNB13_EQ),
2829 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x195A,
2830 "HP bNB13", STAC_HP_BNB13_EQ),
2831 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x195B,
2832 "HP bNB13", STAC_HP_BNB13_EQ),
2833 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x195C,
2834 "HP bNB13", STAC_HP_BNB13_EQ),
2835 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1991,
2836 "HP bNB13", STAC_HP_BNB13_EQ),
2837 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2103,
2838 "HP bNB13", STAC_HP_BNB13_EQ),
2839 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2104,
2840 "HP bNB13", STAC_HP_BNB13_EQ),
2841 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2105,
2842 "HP bNB13", STAC_HP_BNB13_EQ),
2843 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2106,
2844 "HP bNB13", STAC_HP_BNB13_EQ),
2845 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2107,
2846 "HP bNB13", STAC_HP_BNB13_EQ),
2847 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2108,
2848 "HP bNB13", STAC_HP_BNB13_EQ),
2849 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2109,
2850 "HP bNB13", STAC_HP_BNB13_EQ),
2851 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x210A,
2852 "HP bNB13", STAC_HP_BNB13_EQ),
2853 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x210B,
2854 "HP bNB13", STAC_HP_BNB13_EQ),
2855 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x211C,
2856 "HP bNB13", STAC_HP_BNB13_EQ),
2857 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x211D,
2858 "HP bNB13", STAC_HP_BNB13_EQ),
2859 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x211E,
2860 "HP bNB13", STAC_HP_BNB13_EQ),
2861 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x211F,
2862 "HP bNB13", STAC_HP_BNB13_EQ),
2863 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2120,
2864 "HP bNB13", STAC_HP_BNB13_EQ),
2865 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2121,
2866 "HP bNB13", STAC_HP_BNB13_EQ),
2867 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2122,
2868 "HP bNB13", STAC_HP_BNB13_EQ),
2869 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2123,
2870 "HP bNB13", STAC_HP_BNB13_EQ),
2871 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x213E,
2872 "HP bNB13", STAC_HP_BNB13_EQ),
2873 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x213F,
2874 "HP bNB13", STAC_HP_BNB13_EQ),
2875 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2140,
2876 "HP bNB13", STAC_HP_BNB13_EQ),
2877 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x21B2,
2878 "HP bNB13", STAC_HP_BNB13_EQ),
2879 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x21B3,
2880 "HP bNB13", STAC_HP_BNB13_EQ),
2881 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x21B5,
2882 "HP bNB13", STAC_HP_BNB13_EQ),
2883 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x21B6,
2884 "HP bNB13", STAC_HP_BNB13_EQ),
2885 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x1900,
2886 "HP", STAC_92HD83XXX_HP_MIC_LED),
2887 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x2000,
2888 "HP", STAC_92HD83XXX_HP_MIC_LED),
2889 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x2100,
2890 "HP", STAC_92HD83XXX_HP_MIC_LED),
2891 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3388,
2892 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2893 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3389,
2894 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2895 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355B,
2896 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2897 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355C,
2898 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2899 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355D,
2900 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2901 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355E,
2902 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2903 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355F,
2904 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2905 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3560,
2906 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2907 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358B,
2908 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2909 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358C,
2910 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2911 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358D,
2912 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2913 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3591,
2914 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2915 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3592,
2916 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2917 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3593,
2918 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2919 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3561,
2920 "HP", STAC_HP_ZEPHYR),
2921 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3660,
2922 "HP Mini", STAC_92HD83XXX_HP_LED),
2923 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x144E,
2924 "HP Pavilion dv5", STAC_92HD83XXX_HP_INV_LED),
2925 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x148a,
2926 "HP Mini", STAC_92HD83XXX_HP_LED),
2927 SND_PCI_QUIRK_VENDOR(PCI_VENDOR_ID_HP, "HP", STAC_92HD83XXX_HP),
2928 /* match both for 0xfa91 and 0xfa93 */
2929 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_TOSHIBA, 0xfffd, 0xfa91,
2930 "Toshiba Satellite S50D", STAC_92HD83XXX_GPIO10_EAPD),
2934 /* HP dv7 bass switch - GPIO5 */
2935 #define stac_hp_bass_gpio_info snd_ctl_boolean_mono_info
2936 static int stac_hp_bass_gpio_get(struct snd_kcontrol *kcontrol,
2937 struct snd_ctl_elem_value *ucontrol)
2939 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2940 struct sigmatel_spec *spec = codec->spec;
2941 ucontrol->value.integer.value[0] = !!(spec->gpio_data & 0x20);
2945 static int stac_hp_bass_gpio_put(struct snd_kcontrol *kcontrol,
2946 struct snd_ctl_elem_value *ucontrol)
2948 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2949 struct sigmatel_spec *spec = codec->spec;
2950 unsigned int gpio_data;
2952 gpio_data = (spec->gpio_data & ~0x20) |
2953 (ucontrol->value.integer.value[0] ? 0x20 : 0);
2954 if (gpio_data == spec->gpio_data)
2956 spec->gpio_data = gpio_data;
2957 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data);
2961 static const struct snd_kcontrol_new stac_hp_bass_sw_ctrl = {
2962 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2963 .info = stac_hp_bass_gpio_info,
2964 .get = stac_hp_bass_gpio_get,
2965 .put = stac_hp_bass_gpio_put,
2968 static int stac_add_hp_bass_switch(struct hda_codec *codec)
2970 struct sigmatel_spec *spec = codec->spec;
2972 if (!snd_hda_gen_add_kctl(&spec->gen, "Bass Speaker Playback Switch",
2973 &stac_hp_bass_sw_ctrl))
2976 spec->gpio_mask |= 0x20;
2977 spec->gpio_dir |= 0x20;
2978 spec->gpio_data |= 0x20;
2982 static const struct hda_pintbl ref92hd71bxx_pin_configs[] = {
2983 { 0x0a, 0x02214030 },
2984 { 0x0b, 0x02a19040 },
2985 { 0x0c, 0x01a19020 },
2986 { 0x0d, 0x01014010 },
2987 { 0x0e, 0x0181302e },
2988 { 0x0f, 0x01014010 },
2989 { 0x14, 0x01019020 },
2990 { 0x18, 0x90a000f0 },
2991 { 0x19, 0x90a000f0 },
2992 { 0x1e, 0x01452050 },
2993 { 0x1f, 0x01452050 },
2997 static const struct hda_pintbl dell_m4_1_pin_configs[] = {
2998 { 0x0a, 0x0421101f },
2999 { 0x0b, 0x04a11221 },
3000 { 0x0c, 0x40f000f0 },
3001 { 0x0d, 0x90170110 },
3002 { 0x0e, 0x23a1902e },
3003 { 0x0f, 0x23014250 },
3004 { 0x14, 0x40f000f0 },
3005 { 0x18, 0x90a000f0 },
3006 { 0x19, 0x40f000f0 },
3007 { 0x1e, 0x4f0000f0 },
3008 { 0x1f, 0x4f0000f0 },
3012 static const struct hda_pintbl dell_m4_2_pin_configs[] = {
3013 { 0x0a, 0x0421101f },
3014 { 0x0b, 0x04a11221 },
3015 { 0x0c, 0x90a70330 },
3016 { 0x0d, 0x90170110 },
3017 { 0x0e, 0x23a1902e },
3018 { 0x0f, 0x23014250 },
3019 { 0x14, 0x40f000f0 },
3020 { 0x18, 0x40f000f0 },
3021 { 0x19, 0x40f000f0 },
3022 { 0x1e, 0x044413b0 },
3023 { 0x1f, 0x044413b0 },
3027 static const struct hda_pintbl dell_m4_3_pin_configs[] = {
3028 { 0x0a, 0x0421101f },
3029 { 0x0b, 0x04a11221 },
3030 { 0x0c, 0x90a70330 },
3031 { 0x0d, 0x90170110 },
3032 { 0x0e, 0x40f000f0 },
3033 { 0x0f, 0x40f000f0 },
3034 { 0x14, 0x40f000f0 },
3035 { 0x18, 0x90a000f0 },
3036 { 0x19, 0x40f000f0 },
3037 { 0x1e, 0x044413b0 },
3038 { 0x1f, 0x044413b0 },
3042 static void stac92hd71bxx_fixup_ref(struct hda_codec *codec,
3043 const struct hda_fixup *fix, int action)
3045 struct sigmatel_spec *spec = codec->spec;
3047 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3050 snd_hda_apply_pincfgs(codec, ref92hd71bxx_pin_configs);
3051 spec->gpio_mask = spec->gpio_dir = spec->gpio_data = 0;
3054 static void stac92hd71bxx_fixup_hp_m4(struct hda_codec *codec,
3055 const struct hda_fixup *fix, int action)
3057 struct sigmatel_spec *spec = codec->spec;
3058 struct hda_jack_callback *jack;
3060 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3063 /* Enable VREF power saving on GPIO1 detect */
3064 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
3065 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02);
3066 jack = snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
3069 jack->private_data = 0x02;
3071 spec->gpio_mask |= 0x02;
3073 /* enable internal microphone */
3074 snd_hda_codec_set_pincfg(codec, 0x0e, 0x01813040);
3077 static void stac92hd71bxx_fixup_hp_dv4(struct hda_codec *codec,
3078 const struct hda_fixup *fix, int action)
3080 struct sigmatel_spec *spec = codec->spec;
3082 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3084 spec->gpio_led = 0x01;
3087 static void stac92hd71bxx_fixup_hp_dv5(struct hda_codec *codec,
3088 const struct hda_fixup *fix, int action)
3093 case HDA_FIXUP_ACT_PRE_PROBE:
3094 snd_hda_codec_set_pincfg(codec, 0x0d, 0x90170010);
3097 case HDA_FIXUP_ACT_PROBE:
3098 /* enable bass on HP dv7 */
3099 cap = snd_hda_param_read(codec, 0x1, AC_PAR_GPIO_CAP);
3100 cap &= AC_GPIO_IO_COUNT;
3102 stac_add_hp_bass_switch(codec);
3107 static void stac92hd71bxx_fixup_hp_hdx(struct hda_codec *codec,
3108 const struct hda_fixup *fix, int action)
3110 struct sigmatel_spec *spec = codec->spec;
3112 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3114 spec->gpio_led = 0x08;
3117 static bool is_hp_output(struct hda_codec *codec, hda_nid_t pin)
3119 unsigned int pin_cfg = snd_hda_codec_get_pincfg(codec, pin);
3121 /* count line-out, too, as BIOS sets often so */
3122 return get_defcfg_connect(pin_cfg) != AC_JACK_PORT_NONE &&
3123 (get_defcfg_device(pin_cfg) == AC_JACK_LINE_OUT ||
3124 get_defcfg_device(pin_cfg) == AC_JACK_HP_OUT);
3127 static void fixup_hp_headphone(struct hda_codec *codec, hda_nid_t pin)
3129 unsigned int pin_cfg = snd_hda_codec_get_pincfg(codec, pin);
3131 /* It was changed in the BIOS to just satisfy MS DTM.
3132 * Lets turn it back into slaved HP
3134 pin_cfg = (pin_cfg & (~AC_DEFCFG_DEVICE)) |
3135 (AC_JACK_HP_OUT << AC_DEFCFG_DEVICE_SHIFT);
3136 pin_cfg = (pin_cfg & (~(AC_DEFCFG_DEF_ASSOC | AC_DEFCFG_SEQUENCE))) |
3138 snd_hda_codec_set_pincfg(codec, pin, pin_cfg);
3141 static void stac92hd71bxx_fixup_hp(struct hda_codec *codec,
3142 const struct hda_fixup *fix, int action)
3144 struct sigmatel_spec *spec = codec->spec;
3146 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3149 /* when both output A and F are assigned, these are supposedly
3150 * dock and built-in headphones; fix both pin configs
3152 if (is_hp_output(codec, 0x0a) && is_hp_output(codec, 0x0f)) {
3153 fixup_hp_headphone(codec, 0x0a);
3154 fixup_hp_headphone(codec, 0x0f);
3157 if (find_mute_led_cfg(codec, 1))
3158 codec_dbg(codec, "mute LED gpio %d polarity %d\n",
3160 spec->gpio_led_polarity);
3164 static const struct hda_fixup stac92hd71bxx_fixups[] = {
3165 [STAC_92HD71BXX_REF] = {
3166 .type = HDA_FIXUP_FUNC,
3167 .v.func = stac92hd71bxx_fixup_ref,
3169 [STAC_DELL_M4_1] = {
3170 .type = HDA_FIXUP_PINS,
3171 .v.pins = dell_m4_1_pin_configs,
3173 [STAC_DELL_M4_2] = {
3174 .type = HDA_FIXUP_PINS,
3175 .v.pins = dell_m4_2_pin_configs,
3177 [STAC_DELL_M4_3] = {
3178 .type = HDA_FIXUP_PINS,
3179 .v.pins = dell_m4_3_pin_configs,
3182 .type = HDA_FIXUP_FUNC,
3183 .v.func = stac92hd71bxx_fixup_hp_m4,
3185 .chain_id = STAC_92HD71BXX_HP,
3188 .type = HDA_FIXUP_FUNC,
3189 .v.func = stac92hd71bxx_fixup_hp_dv4,
3191 .chain_id = STAC_HP_DV5,
3194 .type = HDA_FIXUP_FUNC,
3195 .v.func = stac92hd71bxx_fixup_hp_dv5,
3197 .chain_id = STAC_92HD71BXX_HP,
3200 .type = HDA_FIXUP_FUNC,
3201 .v.func = stac92hd71bxx_fixup_hp_hdx,
3203 .chain_id = STAC_92HD71BXX_HP,
3205 [STAC_92HD71BXX_HP] = {
3206 .type = HDA_FIXUP_FUNC,
3207 .v.func = stac92hd71bxx_fixup_hp,
3211 static const struct hda_model_fixup stac92hd71bxx_models[] = {
3212 { .id = STAC_92HD71BXX_REF, .name = "ref" },
3213 { .id = STAC_DELL_M4_1, .name = "dell-m4-1" },
3214 { .id = STAC_DELL_M4_2, .name = "dell-m4-2" },
3215 { .id = STAC_DELL_M4_3, .name = "dell-m4-3" },
3216 { .id = STAC_HP_M4, .name = "hp-m4" },
3217 { .id = STAC_HP_DV4, .name = "hp-dv4" },
3218 { .id = STAC_HP_DV5, .name = "hp-dv5" },
3219 { .id = STAC_HP_HDX, .name = "hp-hdx" },
3220 { .id = STAC_HP_DV4, .name = "hp-dv4-1222nr" },
3224 static const struct snd_pci_quirk stac92hd71bxx_fixup_tbl[] = {
3225 /* SigmaTel reference board */
3226 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
3227 "DFI LanParty", STAC_92HD71BXX_REF),
3228 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
3229 "DFI LanParty", STAC_92HD71BXX_REF),
3230 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x1720,
3232 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3080,
3234 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x30f0,
3235 "HP dv4-7", STAC_HP_DV4),
3236 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3600,
3237 "HP dv4-7", STAC_HP_DV5),
3238 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3610,
3239 "HP HDX", STAC_HP_HDX), /* HDX18 */
3240 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a,
3241 "HP mini 1000", STAC_HP_M4),
3242 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361b,
3243 "HP HDX", STAC_HP_HDX), /* HDX16 */
3244 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3620,
3245 "HP dv6", STAC_HP_DV5),
3246 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3061,
3247 "HP dv6", STAC_HP_DV5), /* HP dv6-1110ax */
3248 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x363e,
3249 "HP DV6", STAC_HP_DV5),
3250 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x7010,
3252 SND_PCI_QUIRK_VENDOR(PCI_VENDOR_ID_HP, "HP", STAC_92HD71BXX_HP),
3253 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
3254 "unknown Dell", STAC_DELL_M4_1),
3255 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234,
3256 "unknown Dell", STAC_DELL_M4_1),
3257 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250,
3258 "unknown Dell", STAC_DELL_M4_1),
3259 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f,
3260 "unknown Dell", STAC_DELL_M4_1),
3261 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d,
3262 "unknown Dell", STAC_DELL_M4_1),
3263 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251,
3264 "unknown Dell", STAC_DELL_M4_1),
3265 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277,
3266 "unknown Dell", STAC_DELL_M4_1),
3267 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263,
3268 "unknown Dell", STAC_DELL_M4_2),
3269 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265,
3270 "unknown Dell", STAC_DELL_M4_2),
3271 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262,
3272 "unknown Dell", STAC_DELL_M4_2),
3273 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264,
3274 "unknown Dell", STAC_DELL_M4_2),
3275 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02aa,
3276 "unknown Dell", STAC_DELL_M4_3),
3280 static const struct hda_pintbl ref922x_pin_configs[] = {
3281 { 0x0a, 0x01014010 },
3282 { 0x0b, 0x01016011 },
3283 { 0x0c, 0x01012012 },
3284 { 0x0d, 0x0221401f },
3285 { 0x0e, 0x01813122 },
3286 { 0x0f, 0x01011014 },
3287 { 0x10, 0x01441030 },
3288 { 0x11, 0x01c41030 },
3289 { 0x15, 0x40000100 },
3290 { 0x1b, 0x40000100 },
3295 STAC 922X pin configs for
3302 static const struct hda_pintbl dell_922x_d81_pin_configs[] = {
3303 { 0x0a, 0x02214030 },
3304 { 0x0b, 0x01a19021 },
3305 { 0x0c, 0x01111012 },
3306 { 0x0d, 0x01114010 },
3307 { 0x0e, 0x02a19020 },
3308 { 0x0f, 0x01117011 },
3309 { 0x10, 0x400001f0 },
3310 { 0x11, 0x400001f1 },
3311 { 0x15, 0x01813122 },
3312 { 0x1b, 0x400001f2 },
3317 STAC 922X pin configs for
3321 static const struct hda_pintbl dell_922x_d82_pin_configs[] = {
3322 { 0x0a, 0x02214030 },
3323 { 0x0b, 0x01a19021 },
3324 { 0x0c, 0x01111012 },
3325 { 0x0d, 0x01114010 },
3326 { 0x0e, 0x02a19020 },
3327 { 0x0f, 0x01117011 },
3328 { 0x10, 0x01451140 },
3329 { 0x11, 0x400001f0 },
3330 { 0x15, 0x01813122 },
3331 { 0x1b, 0x400001f1 },
3336 STAC 922X pin configs for
3339 static const struct hda_pintbl dell_922x_m81_pin_configs[] = {
3340 { 0x0a, 0x0321101f },
3341 { 0x0b, 0x01112024 },
3342 { 0x0c, 0x01111222 },
3343 { 0x0d, 0x91174220 },
3344 { 0x0e, 0x03a11050 },
3345 { 0x0f, 0x01116221 },
3346 { 0x10, 0x90a70330 },
3347 { 0x11, 0x01452340 },
3348 { 0x15, 0x40C003f1 },
3349 { 0x1b, 0x405003f0 },
3354 STAC 9221 A1 pin configs for
3355 102801D7 (Dell XPS M1210)
3357 static const struct hda_pintbl dell_922x_m82_pin_configs[] = {
3358 { 0x0a, 0x02211211 },
3359 { 0x0b, 0x408103ff },
3360 { 0x0c, 0x02a1123e },
3361 { 0x0d, 0x90100310 },
3362 { 0x0e, 0x408003f1 },
3363 { 0x0f, 0x0221121f },