[ALSA] hda: STAC9228 VT fixes
[powerpc.git] / sound / pci / hda / patch_sigmatel.c
index 876e1d4..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>
@@ -61,6 +60,16 @@ enum {
        STAC_9205_MODELS
 };
 
+enum {
+       STAC_92HD73XX_REF,
+       STAC_92HD73XX_MODELS
+};
+
+enum {
+       STAC_92HD71BXX_REF,
+       STAC_92HD71BXX_MODELS
+};
+
 enum {
        STAC_925x_REF,
        STAC_M2_2,
@@ -97,6 +106,7 @@ enum {
        STAC_D965_3ST,
        STAC_D965_5ST,
        STAC_DELL_3ST,
+       STAC_DELL_BIOS,
        STAC_927X_MODELS
 };
 
@@ -113,6 +123,8 @@ struct sigmatel_spec {
        unsigned int gpio_mute: 1;
 
        unsigned int gpio_mask, gpio_data;
+       unsigned char aloopback_mask;
+       unsigned char aloopback_shift;
 
        /* playback */
        struct hda_multi_out multiout;
@@ -125,7 +137,8 @@ struct sigmatel_spec {
        unsigned int num_muxes;
        hda_nid_t *dmic_nids;
        unsigned int num_dmics;
-       hda_nid_t dmux_nid;
+       hda_nid_t *dmux_nids;
+       unsigned int num_dmuxes;
        hda_nid_t dig_in_nid;
 
        /* pin widgets */
@@ -140,7 +153,7 @@ struct sigmatel_spec {
 
        /* capture source */
        struct hda_input_mux *dinput_mux;
-       unsigned int cur_dmux;
+       unsigned int cur_dmux[2];
        struct hda_input_mux *input_mux;
        unsigned int cur_mux[3];
 
@@ -171,6 +184,49 @@ static hda_nid_t stac9200_dac_nids[1] = {
         0x02,
 };
 
+static hda_nid_t stac92hd73xx_adc_nids[2] = {
+       0x1a, 0x1b
+};
+
+#define STAC92HD73XX_NUM_DMICS 2
+static hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = {
+       0x13, 0x14, 0
+};
+
+#define STAC92HD73_DAC_COUNT 5
+static hda_nid_t stac92hd73xx_dac_nids[STAC92HD73_DAC_COUNT] = {
+       0x15, 0x16, 0x17, 0x18, 0x19,
+};
+
+static hda_nid_t stac92hd73xx_mux_nids[4] = {
+       0x28, 0x29, 0x2a, 0x2b,
+};
+
+static hda_nid_t stac92hd73xx_dmux_nids[2] = {
+       0x20, 0x21,
+};
+
+static hda_nid_t stac92hd71bxx_adc_nids[2] = {
+       0x12, 0x13,
+};
+
+static hda_nid_t stac92hd71bxx_mux_nids[2] = {
+       0x1a, 0x1b
+};
+
+static hda_nid_t stac92hd71bxx_dmux_nids[1] = {
+       0x1c,
+};
+
+static hda_nid_t stac92hd71bxx_dac_nids[2] = {
+       0x10, /*0x11, */
+};
+
+#define STAC92HD71BXX_NUM_DMICS        2
+static hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS + 1] = {
+       0x18, 0x19, 0
+};
+
 static hda_nid_t stac925x_adc_nids[1] = {
         0x03,
 };
@@ -188,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,
 };
@@ -204,6 +264,10 @@ static hda_nid_t stac927x_mux_nids[3] = {
         0x15, 0x16, 0x17
 };
 
+static hda_nid_t stac927x_dmux_nids[1] = {
+       0x1b,
+};
+
 #define STAC927X_NUM_DMICS 2
 static hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = {
        0x13, 0x14, 0
@@ -217,6 +281,10 @@ static hda_nid_t stac9205_mux_nids[2] = {
         0x19, 0x1a
 };
 
+static hda_nid_t stac9205_dmux_nids[1] = {
+       0x1d,
+};
+
 #define STAC9205_NUM_DMICS     2
 static hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = {
         0x17, 0x18, 0
@@ -237,6 +305,17 @@ static hda_nid_t stac922x_pin_nids[10] = {
        0x0f, 0x10, 0x11, 0x15, 0x1b,
 };
 
+static hda_nid_t stac92hd73xx_pin_nids[12] = {
+       0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
+       0x0f, 0x10, 0x11, 0x12, 0x13,
+       0x14, 0x22
+};
+
+static hda_nid_t stac92hd71bxx_pin_nids[10] = {
+       0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
+       0x0f, 0x14, 0x18, 0x19, 0x1e,
+};
+
 static hda_nid_t stac927x_pin_nids[14] = {
        0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
        0x0f, 0x10, 0x11, 0x12, 0x13,
@@ -262,8 +341,9 @@ static int stac92xx_dmux_enum_get(struct snd_kcontrol *kcontrol,
 {
        struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
        struct sigmatel_spec *spec = codec->spec;
+       unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
 
-       ucontrol->value.enumerated.item[0] = spec->cur_dmux;
+       ucontrol->value.enumerated.item[0] = spec->cur_dmux[dmux_idx];
        return 0;
 }
 
@@ -272,9 +352,10 @@ static int stac92xx_dmux_enum_put(struct snd_kcontrol *kcontrol,
 {
        struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
        struct sigmatel_spec *spec = codec->spec;
+       unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
 
        return snd_hda_input_mux_put(codec, spec->dinput_mux, ucontrol,
-                                    spec->dmux_nid, &spec->cur_dmux);
+                       spec->dmux_nids[dmux_idx], &spec->cur_dmux[dmux_idx]);
 }
 
 static int stac92xx_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
@@ -310,9 +391,11 @@ static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol)
 {
        struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
+       unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
        struct sigmatel_spec *spec = codec->spec;
 
-       ucontrol->value.integer.value[0] = spec->aloopback;
+       ucontrol->value.integer.value[0] = !!(spec->aloopback &
+                                             (spec->aloopback_mask << idx));
        return 0;
 }
 
@@ -321,23 +404,33 @@ static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol,
 {
        struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
        struct sigmatel_spec *spec = codec->spec;
+       unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
        unsigned int dac_mode;
+       unsigned int val, idx_val;
 
-       if (spec->aloopback == ucontrol->value.integer.value[0])
+       idx_val = spec->aloopback_mask << idx;
+       if (ucontrol->value.integer.value[0])
+               val = spec->aloopback | idx_val;
+       else
+               val = spec->aloopback & ~idx_val;
+       if (spec->aloopback == val)
                return 0;
 
-       spec->aloopback = ucontrol->value.integer.value[0];
-
+       spec->aloopback = val;
 
+       /* Only return the bits defined by the shift value of the
+        * first two bytes of the mask
+        */
        dac_mode = snd_hda_codec_read(codec, codec->afg, 0,
-               kcontrol->private_value & 0xFFFF, 0x0);
+                                     kcontrol->private_value & 0xFFFF, 0x0);
+       dac_mode >>= spec->aloopback_shift;
 
-       if (spec->aloopback) {
+       if (spec->aloopback & idx_val) {
                snd_hda_power_up(codec);
-               dac_mode |= 0x40;
+               dac_mode |= idx_val;
        } else {
                snd_hda_power_down(codec);
-               dac_mode &= ~0x40;
+               dac_mode &= ~idx_val;
        }
 
        snd_hda_codec_write_cache(codec, codec->afg, 0,
@@ -359,6 +452,107 @@ static struct hda_verb stac9200_eapd_init[] = {
        {}
 };
 
+static struct hda_verb stac92hd73xx_6ch_core_init[] = {
+       /* set master volume and direct control */
+       { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
+       /* setup audio connections */
+       { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00},
+       { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01},
+       { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02},
+       /* setup adcs to point to mixer */
+       { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
+       { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
+       { 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},
+       /* setup import muxs */
+       { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
+       { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
+       { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
+       { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
+       {}
+};
+
+static struct hda_verb stac92hd73xx_8ch_core_init[] = {
+       /* set master volume and direct control */
+       { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
+       /* setup audio connections */
+       { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00},
+       { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01},
+       { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02},
+       /* connect hp ports to dac3 */
+       { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x03},
+       { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x03},
+       /* setup adcs to point to mixer */
+       { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
+       { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
+       { 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},
+       /* setup import muxs */
+       { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
+       { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
+       { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
+       { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03},
+       {}
+};
+
+static struct hda_verb stac92hd73xx_10ch_core_init[] = {
+       /* set master volume and direct control */
+       { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
+       /* setup audio connections */
+       { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
+       { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01 },
+       { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02 },
+       /* dac3 is connected to import3 mux */
+       { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0xb07f},
+       /* connect hp ports to dac4 */
+       { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x04},
+       { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x04},
+       /* setup adcs to point to mixer */
+       { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
+       { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
+       { 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},
+       /* setup import muxs */
+       { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
+       { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
+       { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
+       { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03},
+       {}
+};
+
+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 */
+       { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
+       /* 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)},
+       {}
+};
+
 static struct hda_verb stac925x_core_init[] = {
        /* set dac0mux for dac converter */
        { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
@@ -393,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, \
@@ -413,11 +597,11 @@ static struct hda_verb stac9205_core_init[] = {
                .put = stac92xx_mux_enum_put, \
        }
 
-#define STAC_ANALOG_LOOPBACK(verb_read,verb_write) \
+#define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \
        { \
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
                .name  = "Analog Loopback", \
-               .count = 1, \
+               .count = cnt, \
                .info  = stac92xx_aloopback_info, \
                .get   = stac92xx_aloopback_get, \
                .put   = stac92xx_aloopback_put, \
@@ -434,6 +618,118 @@ static struct snd_kcontrol_new stac9200_mixer[] = {
        { } /* end */
 };
 
+static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = {
+       STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3),
+
+       HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
+       HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
+
+       HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
+       HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
+
+       HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
+       HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
+
+       HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
+       HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
+
+       HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
+       HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
+
+       HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
+       HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
+
+       HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
+       HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
+       { } /* end */
+};
+
+static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = {
+       STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4),
+
+       HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
+       HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
+
+       HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
+       HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
+
+       HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
+       HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
+
+       HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
+       HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
+
+       HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
+       HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
+
+       HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
+       HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
+
+       HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
+       HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
+       { } /* end */
+};
+
+static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = {
+       STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5),
+
+       HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
+       HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
+
+       HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
+       HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
+
+       HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
+       HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
+
+       HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
+       HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
+
+       HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
+       HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
+
+       HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
+       HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
+
+       HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
+       HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
+       { } /* end */
+};
+
+static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = {
+       STAC_INPUT_SOURCE(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("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 */
+};
+
 static struct snd_kcontrol_new stac925x_mixer[] = {
        STAC_INPUT_SOURCE(1),
        HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT),
@@ -443,9 +739,8 @@ 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),
+       STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1),
 
        HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT),
        HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT),
@@ -473,9 +768,8 @@ 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),
+       STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1),
 
        HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT),
        HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT),
@@ -491,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;
@@ -506,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);
@@ -786,6 +1096,48 @@ static struct snd_pci_quirk stac925x_cfg_tbl[] = {
        {} /* terminator */
 };
 
+static unsigned int ref92hd73xx_pin_configs[12] = {
+       0x02214030, 0x02a19040, 0x01a19020, 0x02214030,
+       0x0181302e, 0x01014010, 0x01014020, 0x01014030,
+       0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050,
+};
+
+static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = {
+       [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs,
+};
+
+static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = {
+       [STAC_92HD73XX_REF] = "ref",
+};
+
+static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
+       /* SigmaTel reference board */
+       SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
+                     "DFI LanParty", STAC_92HD73XX_REF),
+       {} /* terminator */
+};
+
+static unsigned int ref92hd71bxx_pin_configs[10] = {
+       0x02214030, 0x02a19040, 0x01a19020, 0x01014010,
+       0x0181302e, 0x01114010, 0x01a19020, 0x90a000f0,
+       0x90a000f0, 0x01452050,
+};
+
+static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = {
+       [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs,
+};
+
+static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
+       [STAC_92HD71BXX_REF] = "ref",
+};
+
+static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
+       /* SigmaTel reference board */
+       SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
+                     "DFI LanParty", STAC_92HD71BXX_REF),
+       {} /* terminator */
+};
+
 static unsigned int ref922x_pin_configs[10] = {
        0x01014010, 0x01016011, 0x01012012, 0x0221401f,
        0x01813122, 0x01011014, 0x01441030, 0x01c41030,
@@ -832,8 +1184,8 @@ static unsigned int dell_922x_m81_pin_configs[10] = {
     102801D7 (Dell XPS M1210)
 */
 static unsigned int dell_922x_m82_pin_configs[10] = {
-       0x0221121f, 0x408103ff, 0x02111212, 0x90100310, 
-       0x408003f1, 0x02111211, 0x03451340, 0x40c003f2, 
+       0x02211211, 0x408103ff, 0x02a1123e, 0x90100310, 
+       0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2, 
        0x508003f3, 0x405003f4, 
 };
 
@@ -1031,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[] = {
@@ -1073,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),
@@ -1488,7 +1850,7 @@ static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_
        struct sigmatel_spec *spec = codec->spec;
         hda_nid_t nid = kcontrol->private_value >> 8;
        int io_idx = kcontrol-> private_value & 0xff;
-        unsigned short val = ucontrol->value.integer.value[0];
+       unsigned short val = !!ucontrol->value.integer.value[0];
 
        spec->io_switch[io_idx] = val;
 
@@ -1500,6 +1862,13 @@ static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_
                        pinctl |= stac92xx_get_vref(codec, nid);
                stac92xx_auto_set_pinctl(codec, nid, pinctl);
        }
+
+       /* check the auto-mute again: we need to mute/unmute the speaker
+        * appropriately according to the pin direction
+        */
+       if (spec->hp_detect)
+               codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
+
         return 1;
 }
 
@@ -1521,11 +1890,12 @@ static int stac92xx_clfe_switch_put(struct snd_kcontrol *kcontrol,
        struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
        struct sigmatel_spec *spec = codec->spec;
        hda_nid_t nid = kcontrol->private_value & 0xff;
+       unsigned int val = !!ucontrol->value.integer.value[0];
 
-       if (spec->clfe_swap == ucontrol->value.integer.value[0])
+       if (spec->clfe_swap == val)
                return 0;
 
-       spec->clfe_swap = ucontrol->value.integer.value[0];
+       spec->clfe_swap = val;
 
        snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
                spec->clfe_swap ? 0x4 : 0x0);
@@ -1607,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++;
        }
@@ -1694,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;
@@ -1913,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,
@@ -1932,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_nid,
+                               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;
@@ -2035,6 +2423,7 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
 {
        struct sigmatel_spec *spec = codec->spec;
        int err;
+       int hp_speaker_swap = 0;
 
        if ((err = snd_hda_parse_pin_def_config(codec,
                                                &spec->autocfg,
@@ -2043,6 +2432,24 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
        if (! spec->autocfg.line_outs)
                return 0; /* can't find valid pin config */
 
+       /* If we have no real line-out pin and multiple hp-outs, HPs should
+        * be set up as multi-channel outputs.
+        */
+       if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT &&
+           spec->autocfg.hp_outs > 1) {
+               /* Copy hp_outs to line_outs, backup line_outs in
+                * speaker_outs so that the following routines can handle
+                * HP pins as primary outputs.
+                */
+               memcpy(spec->autocfg.speaker_pins, spec->autocfg.line_out_pins,
+                      sizeof(spec->autocfg.line_out_pins));
+               spec->autocfg.speaker_outs = spec->autocfg.line_outs;
+               memcpy(spec->autocfg.line_out_pins, spec->autocfg.hp_pins,
+                      sizeof(spec->autocfg.hp_pins));
+               spec->autocfg.line_outs = spec->autocfg.hp_outs;
+               hp_speaker_swap = 1;
+       }
+
        if ((err = stac92xx_add_dyn_out_pins(codec, &spec->autocfg)) < 0)
                return err;
        if (spec->multiout.num_dacs == 0)
@@ -2054,6 +2461,19 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
        if (err < 0)
                return err;
 
+       if (hp_speaker_swap == 1) {
+               /* Restore the hp_outs and line_outs */
+               memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins,
+                      sizeof(spec->autocfg.line_out_pins));
+               spec->autocfg.hp_outs = spec->autocfg.line_outs;
+               memcpy(spec->autocfg.line_out_pins, spec->autocfg.speaker_pins,
+                      sizeof(spec->autocfg.speaker_pins));
+               spec->autocfg.line_outs = spec->autocfg.speaker_outs;
+               memset(spec->autocfg.speaker_pins, 0,
+                      sizeof(spec->autocfg.speaker_pins));
+               spec->autocfg.speaker_outs = 0;
+       }
+
        err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg);
 
        if (err < 0)
@@ -2082,7 +2502,8 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
                spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
 
        spec->input_mux = &spec->private_imux;
-       spec->dinput_mux = &spec->private_dimux;
+       if (!spec->dinput_mux)
+               spec->dinput_mux = &spec->private_dimux;
 
        return 1;
 }
@@ -2351,13 +2772,20 @@ static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
                        pin_ctl & ~flag);
 }
 
-static int get_pin_presence(struct hda_codec *codec, hda_nid_t nid)
+static int get_hp_pin_presence(struct hda_codec *codec, hda_nid_t nid)
 {
        if (!nid)
                return 0;
        if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0x00)
-           & (1 << 31))
-               return 1;
+           & (1 << 31)) {
+               unsigned int pinctl;
+               pinctl = snd_hda_codec_read(codec, nid, 0,
+                                           AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
+               if (pinctl & AC_PINCTL_IN_EN)
+                       return 0; /* mic- or line-input */
+               else
+                       return 1; /* HP-output */
+       }
        return 0;
 }
 
@@ -2369,7 +2797,7 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res)
 
        presence = 0;
        for (i = 0; i < cfg->hp_outs; i++) {
-               presence = get_pin_presence(codec, cfg->hp_pins[i]);
+               presence = get_hp_pin_presence(codec, cfg->hp_pins[i]);
                if (presence)
                        break;
        }
@@ -2531,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;
@@ -2560,6 +2990,198 @@ static int patch_stac925x(struct hda_codec *codec)
        return 0;
 }
 
+static struct hda_input_mux stac92hd73xx_dmux = {
+       .num_items = 4,
+       .items = {
+               { "Analog Inputs", 0x0b },
+               { "CD", 0x08 },
+               { "Digital Mic 1", 0x09 },
+               { "Digital Mic 2", 0x0a },
+       }
+};
+
+static int patch_stac92hd73xx(struct hda_codec *codec)
+{
+       struct sigmatel_spec *spec;
+       hda_nid_t conn[STAC92HD73_DAC_COUNT + 2];
+       int err = 0;
+
+       spec  = kzalloc(sizeof(*spec), GFP_KERNEL);
+       if (spec == NULL)
+               return -ENOMEM;
+
+       codec->spec = spec;
+       spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids);
+       spec->pin_nids = stac92hd73xx_pin_nids;
+       spec->board_config = snd_hda_check_board_config(codec,
+                                                       STAC_92HD73XX_MODELS,
+                                                       stac92hd73xx_models,
+                                                       stac92hd73xx_cfg_tbl);
+again:
+       if (spec->board_config < 0) {
+               snd_printdd(KERN_INFO "hda_codec: Unknown model for"
+                       " STAC92HD73XX, 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 {
+               spec->pin_configs = stac92hd73xx_brd_tbl[spec->board_config];
+               stac92xx_set_config_regs(codec);
+       }
+
+       spec->multiout.num_dacs = snd_hda_get_connections(codec, 0x0a,
+                       conn, STAC92HD73_DAC_COUNT + 2) - 1;
+
+       if (spec->multiout.num_dacs < 0) {
+               printk(KERN_WARNING "hda_codec: Could not determine "
+                      "number of channels defaulting to DAC count\n");
+               spec->multiout.num_dacs = STAC92HD73_DAC_COUNT;
+       }
+
+       switch (spec->multiout.num_dacs) {
+       case 0x3: /* 6 Channel */
+               spec->mixer = stac92hd73xx_6ch_mixer;
+               spec->init = stac92hd73xx_6ch_core_init;
+               break;
+       case 0x4: /* 8 Channel */
+               spec->multiout.hp_nid = 0x18;
+               spec->mixer = stac92hd73xx_8ch_mixer;
+               spec->init = stac92hd73xx_8ch_core_init;
+               break;
+       case 0x5: /* 10 Channel */
+               spec->multiout.hp_nid = 0x19;
+               spec->mixer = stac92hd73xx_10ch_mixer;
+               spec->init = stac92hd73xx_10ch_core_init;
+       };
+
+       spec->multiout.dac_nids = stac92hd73xx_dac_nids;
+       spec->aloopback_mask = 0x01;
+       spec->aloopback_shift = 8;
+
+       spec->mux_nids = stac92hd73xx_mux_nids;
+       spec->adc_nids = stac92hd73xx_adc_nids;
+       spec->dmic_nids = stac92hd73xx_dmic_nids;
+       spec->dmux_nids = stac92hd73xx_dmux_nids;
+
+       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;
+       stac92xx_enable_gpio_mask(codec);
+
+       err = stac92xx_parse_auto_config(codec, 0x22, 0x24);
+
+       if (!err) {
+               if (spec->board_config < 0) {
+                       printk(KERN_WARNING "hda_codec: No auto-config is "
+                              "available, default to model=ref\n");
+                       spec->board_config = STAC_92HD73XX_REF;
+                       goto again;
+               }
+               err = -EINVAL;
+       }
+
+       if (err < 0) {
+               stac92xx_free(codec);
+               return err;
+       }
+
+       codec->patch_ops = stac92xx_patch_ops;
+
+       return 0;
+}
+
+static int patch_stac92hd71bxx(struct hda_codec *codec)
+{
+       struct sigmatel_spec *spec;
+       int err = 0;
+
+       spec  = kzalloc(sizeof(*spec), GFP_KERNEL);
+       if (spec == NULL)
+               return -ENOMEM;
+
+       codec->spec = spec;
+       spec->num_pins = ARRAY_SIZE(stac92hd71bxx_pin_nids);
+       spec->pin_nids = stac92hd71bxx_pin_nids;
+       spec->board_config = snd_hda_check_board_config(codec,
+                                                       STAC_92HD71BXX_MODELS,
+                                                       stac92hd71bxx_models,
+                                                       stac92hd71bxx_cfg_tbl);
+again:
+       if (spec->board_config < 0) {
+               snd_printdd(KERN_INFO "hda_codec: Unknown model for"
+                       " STAC92HD71BXX, 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 {
+               spec->pin_configs = stac92hd71bxx_brd_tbl[spec->board_config];
+               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->mux_nids = stac92hd71bxx_mux_nids;
+       spec->adc_nids = stac92hd71bxx_adc_nids;
+       spec->dmic_nids = stac92hd71bxx_dmic_nids;
+       spec->dmux_nids = stac92hd71bxx_dmux_nids;
+
+       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;
+       spec->multiout.dac_nids = stac92hd71bxx_dac_nids;
+
+       err = stac92xx_parse_auto_config(codec, 0x21, 0x23);
+       if (!err) {
+               if (spec->board_config < 0) {
+                       printk(KERN_WARNING "hda_codec: No auto-config is "
+                              "available, default to model=ref\n");
+                       spec->board_config = STAC_92HD71BXX_REF;
+                       goto again;
+               }
+               err = -EINVAL;
+       }
+
+       if (err < 0) {
+               stac92xx_free(codec);
+               return err;
+       }
+
+       codec->patch_ops = stac92xx_patch_ops;
+
+       return 0;
+};
+
 static int patch_stac922x(struct hda_codec *codec)
 {
        struct sigmatel_spec *spec;
@@ -2678,61 +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);
+       case STAC_D965_5ST:
+               /* 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;
-       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);
+       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->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->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 = stac927x_core_init;
                spec->mixer = stac927x_mixer;
        }
 
-       switch (codec->subsystem_id) {
-       case 0x1028020A: /* STAC 9228 */
-       case 0x10280209: /* STAC 9228 */
-               spec->dmic_nids = stac927x_dmic_nids;
-               spec->num_dmics = STAC927X_NUM_DMICS;
-               spec->dmux_nid = 0x1b;
-               break;
-       default:
-               spec->num_dmics = 0;    
-       }
+       spec->aloopback_mask = 0x40;
+       spec->aloopback_shift = 0;
 
-       spec->multiout.dac_nids = spec->dac_nids;
-       /* GPIO0 High = Enable EAPD */
-       spec->gpio_mask = spec->gpio_data = 0x00000001;
        stac92xx_enable_gpio_mask(codec); 
-       
        err = stac92xx_parse_auto_config(codec, 0x1e, 0x20);
        if (!err) {
                if (spec->board_config < 0) {
@@ -2788,11 +3416,14 @@ static int patch_stac9205(struct hda_codec *codec)
        spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids);
        spec->dmic_nids = stac9205_dmic_nids;
        spec->num_dmics = STAC9205_NUM_DMICS;
-       spec->dmux_nid = 0x1d;
+       spec->dmux_nids = stac9205_dmux_nids;
+       spec->num_dmuxes = ARRAY_SIZE(stac9205_dmux_nids);
 
        spec->init = stac9205_core_init;
        spec->mixer = stac9205_mixer;
 
+       spec->aloopback_mask = 0x40;
+       spec->aloopback_shift = 0;
        spec->multiout.dac_nids = spec->dac_nids;
        
        switch (spec->board_config){
@@ -2967,7 +3598,7 @@ static int stac9872_vaio_init(struct hda_codec *codec)
 
 static void stac9872_vaio_hp_detect(struct hda_codec *codec, unsigned int res)
 {
-       if (get_pin_presence(codec, 0x0a)) {
+       if (get_hp_pin_presence(codec, 0x0a)) {
                stac92xx_reset_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN);
                stac92xx_set_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN);
        } else {
@@ -3121,5 +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 = 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 */
 };