[ALSA] hda: STAC9228 VT fixes
[powerpc.git] / sound / pci / hda / patch_sigmatel.c
index 4bca790..a0af868 100644 (file)
@@ -24,7 +24,6 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
-#include <sound/driver.h>
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
@@ -107,6 +106,7 @@ enum {
        STAC_D965_3ST,
        STAC_D965_5ST,
        STAC_DELL_3ST,
+       STAC_DELL_BIOS,
        STAC_927X_MODELS
 };
 
@@ -138,6 +138,7 @@ struct sigmatel_spec {
        hda_nid_t *dmic_nids;
        unsigned int num_dmics;
        hda_nid_t *dmux_nids;
+       unsigned int num_dmuxes;
        hda_nid_t dig_in_nid;
 
        /* pin widgets */
@@ -243,6 +244,10 @@ static hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = {
        0x15, 0
 };
 
+static hda_nid_t stac925x_dmux_nids[1] = {
+       0x14,
+};
+
 static hda_nid_t stac922x_adc_nids[2] = {
         0x06, 0x07,
 };
@@ -277,7 +282,7 @@ static hda_nid_t stac9205_mux_nids[2] = {
 };
 
 static hda_nid_t stac9205_dmux_nids[1] = {
-               0x1d,
+       0x1d,
 };
 
 #define STAC9205_NUM_DMICS     2
@@ -457,9 +462,6 @@ static struct hda_verb stac92hd73xx_6ch_core_init[] = {
        /* setup adcs to point to mixer */
        { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
        { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
-       { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Front Mic */
-       { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Mic */
-       { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Line In */
        { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
        { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
        { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
@@ -484,9 +486,6 @@ static struct hda_verb stac92hd73xx_8ch_core_init[] = {
        /* setup adcs to point to mixer */
        { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
        { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
-       { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Front Mic */
-       { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Mic */
-       { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Line In */
        { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
        { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
        { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
@@ -513,9 +512,6 @@ static struct hda_verb stac92hd73xx_10ch_core_init[] = {
        /* setup adcs to point to mixer */
        { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
        { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
-       { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Front Mic */
-       { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Mic */
-       { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Line In */
        { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
        { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
        { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
@@ -528,6 +524,18 @@ static struct hda_verb stac92hd73xx_10ch_core_init[] = {
 };
 
 static struct hda_verb stac92hd71bxx_core_init[] = {
+       /* set master volume and direct control */
+       { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
+       /* connect headphone jack to dac1 */
+       { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
+       { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Speaker */
+       /* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */
+       { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
+       { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
+       { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
+};
+
+static struct hda_verb stac92hd71bxx_analog_core_init[] = {
        /* set master volume and direct control */
        { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
        /* connect headphone jack to dac1 */
@@ -535,14 +543,13 @@ static struct hda_verb stac92hd71bxx_core_init[] = {
        /* connect ports 0d and 0f to audio mixer */
        { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x2},
        { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x2},
+       { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
        /* unmute dac0 input in audio mixer */
        { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
        /* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */
        { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
        { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
        { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
-       /* unmute mono out node */
-       { 0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
        {}
 };
 
@@ -580,16 +587,6 @@ static struct hda_verb stac9205_core_init[] = {
        {}
 };
 
-#define STAC_DIGITAL_INPUT_SOURCE(cnt) \
-       { \
-               .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
-               .name = "Digital Input Source", \
-               .count = cnt, \
-               .info = stac92xx_dmux_enum_info, \
-               .get = stac92xx_dmux_enum_get, \
-               .put = stac92xx_dmux_enum_put,\
-       }
-
 #define STAC_INPUT_SOURCE(cnt) \
        { \
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
@@ -622,13 +619,8 @@ static struct snd_kcontrol_new stac9200_mixer[] = {
 };
 
 static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = {
-       STAC_DIGITAL_INPUT_SOURCE(2),
        STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3),
 
-       /* hardware gain controls */
-       HDA_CODEC_VOLUME_IDX("Digital Mic Volume", 0x0, 0x13, 0x0, HDA_INPUT),
-       HDA_CODEC_VOLUME_IDX("Digital Mic Volume", 0x1, 0x14, 0x0, HDA_INPUT),
-
        HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
        HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
 
@@ -653,13 +645,8 @@ static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = {
 };
 
 static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = {
-       STAC_DIGITAL_INPUT_SOURCE(2),
        STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4),
 
-       /* hardware gain controls */
-       HDA_CODEC_VOLUME_IDX("Digital Mic Volume", 0x0, 0x13, 0x0, HDA_INPUT),
-       HDA_CODEC_VOLUME_IDX("Digital Mic Volume", 0x1, 0x14, 0x0, HDA_INPUT),
-
        HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
        HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
 
@@ -684,13 +671,8 @@ static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = {
 };
 
 static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = {
-       STAC_DIGITAL_INPUT_SOURCE(2),
        STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5),
 
-       /* hardware gain controls */
-       HDA_CODEC_VOLUME_IDX("Digital Mic Volume", 0x0, 0x13, 0x0, HDA_INPUT),
-       HDA_CODEC_VOLUME_IDX("Digital Mic Volume", 0x1, 0x14, 0x0, HDA_INPUT),
-
        HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
        HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
 
@@ -714,14 +696,9 @@ static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = {
        { } /* end */
 };
 
-static struct snd_kcontrol_new stac92hd71bxx_mixer[] = {
-       STAC_DIGITAL_INPUT_SOURCE(1),
+static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = {
        STAC_INPUT_SOURCE(2),
 
-       /* hardware gain controls */
-       HDA_CODEC_VOLUME_IDX("Digital Mic Volume", 0x0, 0x18, 0x0, HDA_OUTPUT),
-       HDA_CODEC_VOLUME_IDX("Digital Mic Volume", 0x1, 0x19, 0x0, HDA_OUTPUT),
-
        HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT),
        HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT),
        HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x0, 0x1a, 0x0, HDA_OUTPUT),
@@ -732,6 +709,24 @@ static struct snd_kcontrol_new stac92hd71bxx_mixer[] = {
 
        HDA_CODEC_MUTE("Analog Loopback 1", 0x17, 0x3, HDA_INPUT),
        HDA_CODEC_MUTE("Analog Loopback 2", 0x17, 0x4, HDA_INPUT),
+
+       HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x14, 0x1, 0, HDA_INPUT),
+       { } /* end */
+};
+
+static struct snd_kcontrol_new stac92hd71bxx_mixer[] = {
+       STAC_INPUT_SOURCE(2),
+       STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2),
+
+       HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT),
+       HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT),
+       HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x0, 0x1a, 0x0, HDA_OUTPUT),
+
+       HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT),
+       HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT),
+       HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x1, 0x1b, 0x0, HDA_OUTPUT),
+
+       HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x14, 0x1, 0, HDA_INPUT),
        { } /* end */
 };
 
@@ -744,7 +739,6 @@ static struct snd_kcontrol_new stac925x_mixer[] = {
 };
 
 static struct snd_kcontrol_new stac9205_mixer[] = {
-       STAC_DIGITAL_INPUT_SOURCE(1),
        STAC_INPUT_SOURCE(2),
        STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1),
 
@@ -774,7 +768,6 @@ static struct snd_kcontrol_new stac922x_mixer[] = {
 
 
 static struct snd_kcontrol_new stac927x_mixer[] = {
-       STAC_DIGITAL_INPUT_SOURCE(1),
        STAC_INPUT_SOURCE(3),
        STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1),
 
@@ -792,6 +785,15 @@ static struct snd_kcontrol_new stac927x_mixer[] = {
        { } /* end */
 };
 
+static struct snd_kcontrol_new stac_dmux_mixer = {
+       .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+       .name = "Digital Input Source",
+       /* count set later */
+       .info = stac92xx_dmux_enum_info,
+       .get = stac92xx_dmux_enum_get,
+       .put = stac92xx_dmux_enum_put,
+};
+
 static int stac92xx_build_controls(struct hda_codec *codec)
 {
        struct sigmatel_spec *spec = codec->spec;
@@ -807,6 +809,13 @@ static int stac92xx_build_controls(struct hda_codec *codec)
                if (err < 0)
                        return err;
        }
+       if (spec->num_dmuxes > 0) {
+               stac_dmux_mixer.count = spec->num_dmuxes;
+               err = snd_ctl_add(codec->bus->card,
+                                 snd_ctl_new1(&stac_dmux_mixer, codec));
+               if (err < 0)
+                       return err;
+       }
 
        if (spec->multiout.dig_out_nid) {
                err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid);
@@ -1374,22 +1383,24 @@ static unsigned int d965_5st_pin_configs[14] = {
 static unsigned int dell_3st_pin_configs[14] = {
        0x02211230, 0x02a11220, 0x01a19040, 0x01114210,
        0x01111212, 0x01116211, 0x01813050, 0x01112214,
-       0x403003fa, 0x40000100, 0x40000100, 0x404003fb,
+       0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb,
        0x40c003fc, 0x40000100
 };
 
 static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
-       [STAC_D965_REF] = ref927x_pin_configs,
-       [STAC_D965_3ST] = d965_3st_pin_configs,
-       [STAC_D965_5ST] = d965_5st_pin_configs,
-       [STAC_DELL_3ST] = dell_3st_pin_configs,
+       [STAC_D965_REF]  = ref927x_pin_configs,
+       [STAC_D965_3ST]  = d965_3st_pin_configs,
+       [STAC_D965_5ST]  = d965_5st_pin_configs,
+       [STAC_DELL_3ST]  = dell_3st_pin_configs,
+       [STAC_DELL_BIOS] = NULL,
 };
 
 static const char *stac927x_models[STAC_927X_MODELS] = {
-       [STAC_D965_REF] = "ref",
-       [STAC_D965_3ST] = "3stack",
-       [STAC_D965_5ST] = "5stack",
-       [STAC_DELL_3ST] = "dell-3stack",
+       [STAC_D965_REF]         = "ref",
+       [STAC_D965_3ST]         = "3stack",
+       [STAC_D965_5ST]         = "5stack",
+       [STAC_DELL_3ST]         = "dell-3stack",
+       [STAC_DELL_BIOS]        = "dell-bios",
 };
 
 static struct snd_pci_quirk stac927x_cfg_tbl[] = {
@@ -1416,13 +1427,21 @@ static struct snd_pci_quirk stac927x_cfg_tbl[] = {
        SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2003, "Intel D965", STAC_D965_3ST),
        SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2002, "Intel D965", STAC_D965_3ST),
        SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2001, "Intel D965", STAC_D965_3ST),
-       SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x01f3, "Dell Inspiron 1420", STAC_D965_3ST),
        /* Dell 3 stack systems */
+       SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x01f7, "Dell XPS M1730", STAC_DELL_3ST),
        SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x01dd, "Dell Dimension E520", STAC_DELL_3ST),
        SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x01ed, "Dell     ", STAC_DELL_3ST),
        SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x01f4, "Dell     ", STAC_DELL_3ST),
+       /* Dell 3 stack systems with verb table in BIOS */
+       SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS),
+       SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x0227, "Dell Vostro 1400  ", STAC_DELL_BIOS),
+       SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x022f, "Dell     ", STAC_DELL_BIOS),
+       SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x022e, "Dell     ", STAC_DELL_BIOS),
+       SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x0242, "Dell     ", STAC_DELL_BIOS),
+       SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x0243, "Dell     ", STAC_DELL_BIOS),
+       SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x02ff, "Dell     ", STAC_DELL_BIOS),
+       SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x0209, "Dell XPS 1330", STAC_DELL_BIOS),
        /* 965 based 5 stack systems */
-       SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x0209, "Dell XPS 1330", STAC_D965_5ST),
        SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2301, "Intel D965", STAC_D965_5ST),
        SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2302, "Intel D965", STAC_D965_5ST),
        SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2303, "Intel D965", STAC_D965_5ST),
@@ -1958,6 +1977,7 @@ static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cf
        for (i = 0; i < codec->num_nodes; i++) {
                wcaps = codec->wcaps[i];
                wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
+
                if (wtype == AC_WID_AUD_OUT && !(wcaps & AC_WCAP_DIGITAL))
                        num_dacs++;
        }
@@ -2045,7 +2065,6 @@ static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec,
                        wcaps = snd_hda_param_read(codec, conn[j],
                                                   AC_PAR_AUDIO_WIDGET_CAP);
                        wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
-
                        if (wtype != AC_WID_AUD_OUT ||
                            (wcaps & AC_WCAP_DIGITAL))
                                continue;
@@ -2264,15 +2283,18 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec,
        struct sigmatel_spec *spec = codec->spec;
        struct hda_input_mux *dimux = &spec->private_dimux;
        hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
-       int i, j;
+       int err, i, j;
+       char name[32];
 
        dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0];
        dimux->items[dimux->num_items].index = 0;
        dimux->num_items++;
 
        for (i = 0; i < spec->num_dmics; i++) {
+               hda_nid_t nid;
                int index;
                int num_cons;
+               unsigned int wcaps;
                unsigned int def_conf;
 
                def_conf = snd_hda_codec_read(codec,
@@ -2283,17 +2305,32 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec,
                if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE)
                        continue;
 
+               nid = spec->dmic_nids[i];
                num_cons = snd_hda_get_connections(codec,
                                spec->dmux_nids[0],
                                con_lst,
                                HDA_MAX_NUM_INPUTS);
                for (j = 0; j < num_cons; j++)
-                       if (con_lst[j] == spec->dmic_nids[i]) {
+                       if (con_lst[j] == nid) {
                                index = j;
                                goto found;
                        }
                continue;
 found:
+               wcaps = get_wcaps(codec, nid);
+
+               if (wcaps & AC_WCAP_OUT_AMP) {
+                       sprintf(name, "%s Capture Volume",
+                               stac92xx_dmic_labels[dimux->num_items]);
+
+                       err = stac92xx_add_control(spec,
+                               STAC_CTL_WIDGET_VOL,
+                               name,
+                               HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
+                       if (err < 0)
+                               return err;
+               }
+
                dimux->items[dimux->num_items].label =
                        stac92xx_dmic_labels[dimux->num_items];
                dimux->items[dimux->num_items].index = index;
@@ -2922,6 +2959,8 @@ static int patch_stac925x(struct hda_codec *codec)
        case 0x83847637: /* STAC9251D */
                spec->num_dmics = STAC925X_NUM_DMICS;
                spec->dmic_nids = stac925x_dmic_nids;
+               spec->num_dmuxes = ARRAY_SIZE(stac925x_dmux_nids);
+               spec->dmux_nids = stac925x_dmux_nids;
                break;
        default:
                spec->num_dmics = 0;
@@ -3030,6 +3069,7 @@ again:
        spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids);
        spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids);
        spec->num_dmics = STAC92HD73XX_NUM_DMICS;
+       spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids);
        spec->dinput_mux = &stac92hd73xx_dmux;
        /* GPIO0 High = Enable EAPD */
        spec->gpio_mask = spec->gpio_data = 0x000001;
@@ -3088,12 +3128,25 @@ again:
                stac92xx_set_config_regs(codec);
        }
 
+       switch (codec->vendor_id) {
+       case 0x111d76b6: /* 4 Port without Analog Mixer */
+       case 0x111d76b7:
+       case 0x111d76b4: /* 6 Port without Analog Mixer */
+       case 0x111d76b5:
+               spec->mixer = stac92hd71bxx_mixer;
+               spec->init = stac92hd71bxx_core_init;
+               break;
+       default:
+               spec->mixer = stac92hd71bxx_analog_mixer;
+               spec->init = stac92hd71bxx_analog_core_init;
+       }
+
+       spec->aloopback_mask = 0x20;
+       spec->aloopback_shift = 0;
+
        spec->gpio_mask = spec->gpio_data = 0x00000001; /* GPIO0 High = EAPD */
        stac92xx_enable_gpio_mask(codec);
 
-       spec->init = stac92hd71bxx_core_init;
-       spec->mixer = stac92hd71bxx_mixer;
-
        spec->mux_nids = stac92hd71bxx_mux_nids;
        spec->adc_nids = stac92hd71bxx_adc_nids;
        spec->dmic_nids = stac92hd71bxx_dmic_nids;
@@ -3102,6 +3155,7 @@ again:
        spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids);
        spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids);
        spec->num_dmics = STAC92HD71BXX_NUM_DMICS;
+       spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids);
 
        spec->multiout.num_dacs = 2;
        spec->multiout.hp_nid = 0x11;
@@ -3246,72 +3300,67 @@ static int patch_stac927x(struct hda_codec *codec)
                                                        stac927x_models,
                                                        stac927x_cfg_tbl);
  again:
-       if (spec->board_config < 0) {
-                snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC927x, using BIOS defaults\n");
+       if (spec->board_config < 0 || !stac927x_brd_tbl[spec->board_config]) {
+               if (spec->board_config < 0)
+                       snd_printdd(KERN_INFO "hda_codec: Unknown model for"
+                                   "STAC927x, using BIOS defaults\n");
                err = stac92xx_save_bios_config_regs(codec);
                if (err < 0) {
                        stac92xx_free(codec);
                        return err;
                }
                spec->pin_configs = spec->bios_pin_configs;
-       } else if (stac927x_brd_tbl[spec->board_config] != NULL) {
+       } else {
                spec->pin_configs = stac927x_brd_tbl[spec->board_config];
                stac92xx_set_config_regs(codec);
        }
 
+       spec->adc_nids = stac927x_adc_nids;
+       spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids);
+       spec->mux_nids = stac927x_mux_nids;
+       spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
+       spec->multiout.dac_nids = spec->dac_nids;
+
        switch (spec->board_config) {
        case STAC_D965_3ST:
-               spec->adc_nids = stac927x_adc_nids;
-               spec->mux_nids = stac927x_mux_nids;
-               spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
-               spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids);
-               spec->init = d965_core_init;
-               spec->mixer = stac927x_mixer;
-               break;
        case STAC_D965_5ST:
-               spec->adc_nids = stac927x_adc_nids;
-               spec->mux_nids = stac927x_mux_nids;
-               spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
-               spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids);
+               /* GPIO0 High = Enable EAPD */
+               spec->gpio_mask = spec->gpio_data = 0x00000001;
+               spec->num_dmics = 0;
+
                spec->init = d965_core_init;
                spec->mixer = stac927x_mixer;
                break;
-       default:
-               spec->adc_nids = stac927x_adc_nids;
-               spec->mux_nids = stac927x_mux_nids;
-               spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
-               spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids);
-               spec->init = stac927x_core_init;
-               spec->mixer = stac927x_mixer;
-       }
-
-       switch (codec->subsystem_id) {
-       case 0x10280242: /* STAC 9228 */
-       case 0x102801f3:
-       case 0x1028020A:
-       case 0x10280209:
+       case STAC_DELL_BIOS:
+               /* correct the front output jack as a hp out */
+               stac92xx_set_config_reg(codec, 0x0f, 0x02270110);
+               /* correct the front input jack as a mic */
+               stac92xx_set_config_reg(codec, 0x0e, 0x02a79130);
+               /* fallthru */
+       case STAC_DELL_3ST:
+               /* GPIO2 High = Enable EAPD */
+               spec->gpio_mask = spec->gpio_data = 0x00000004;
                spec->dmic_nids = stac927x_dmic_nids;
                spec->num_dmics = STAC927X_NUM_DMICS;
-               spec->dmux_nids = stac927x_dmux_nids;
-
-               /* Enable DMIC0 */
-               stac92xx_set_config_reg(codec, 0x13, 0x90a60040);
 
-               /* GPIO2 High = Enable EAPD */
-               spec->gpio_mask = spec->gpio_data = 0x00000004;
+               spec->init = d965_core_init;
+               spec->mixer = stac927x_mixer;
+               spec->dmux_nids = stac927x_dmux_nids;
+               spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids);
                break;
        default:
-               spec->num_dmics = 0;
-
                /* GPIO0 High = Enable EAPD */
                spec->gpio_mask = spec->gpio_data = 0x00000001;
+               spec->num_dmics = 0;
+
+               spec->init = stac927x_core_init;
+               spec->mixer = stac927x_mixer;
        }
 
-       spec->multiout.dac_nids = spec->dac_nids;
        spec->aloopback_mask = 0x40;
        spec->aloopback_shift = 0;
+
        stac92xx_enable_gpio_mask(codec); 
-       
        err = stac92xx_parse_auto_config(codec, 0x1e, 0x20);
        if (!err) {
                if (spec->board_config < 0) {
@@ -3368,6 +3417,7 @@ static int patch_stac9205(struct hda_codec *codec)
        spec->dmic_nids = stac9205_dmic_nids;
        spec->num_dmics = STAC9205_NUM_DMICS;
        spec->dmux_nids = stac9205_dmux_nids;
+       spec->num_dmuxes = ARRAY_SIZE(stac9205_dmux_nids);
 
        spec->init = stac9205_core_init;
        spec->mixer = stac9205_mixer;
@@ -3702,8 +3752,17 @@ struct hda_codec_preset snd_hda_preset_sigmatel[] = {
        { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 },
        { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 },
        { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 },
+       { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx },
+       { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx },
        { .id = 0x111d7676, .name = "92HD73E1X5", .patch = patch_stac92hd73xx },
-       { .id = 0x111d7675, .name = "92HD73D1X5", .patch = patch_stac92hd73xx },
-       { .id = 0x111d76b0, .name = "92HD71BXX", .patch = patch_stac92hd71bxx },
+       { .id = 0x111d7608, .name = "92HD71BXX", .patch = patch_stac92hd71bxx },
+       { .id = 0x111d76b0, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
+       { .id = 0x111d76b1, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
+       { .id = 0x111d76b2, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
+       { .id = 0x111d76b3, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
+       { .id = 0x111d76b4, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
+       { .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
+       { .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
+       { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
        {} /* terminator */
 };