ALSA: hda - Fix Oops due to STAC/IDT auto-mic changes
[pandora-kernel.git] / sound / pci / hda / patch_sigmatel.c
index e5fbec3..2760730 100644 (file)
@@ -1906,6 +1906,8 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
                      "HP mini 1000", STAC_HP_M4),
        SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361b,
                      "HP HDX", STAC_HP_HDX),  /* HDX16 */
+       SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x7010,
+                     "HP", STAC_HP_DV5),
        SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
                                "unknown Dell", STAC_DELL_M4_1),
        SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234,
@@ -2251,7 +2253,7 @@ static struct snd_pci_quirk stac927x_cfg_tbl[] = {
        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,  0x022e, "Dell     ", STAC_DELL_BIOS),
-       SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x022f, "Dell Inspiron 1525", STAC_DELL_3ST),
+       SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x022f, "Dell Inspiron 1525", 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),
@@ -3669,7 +3671,7 @@ static int set_mic_route(struct hda_codec *codec,
                if (i < 0)
                        return -1;
                mic->mux_idx = i;
-       }  else {
+       }  else if (spec->dmux_nids) {
                /* digital pin */
                mic->mux_idx = 0;
                i = get_connection_index(codec, spec->dmux_nids[0], pin);
@@ -4350,8 +4352,8 @@ static int stac92xx_init(struct hda_codec *codec)
                }
                if (cfg->line_out_type == AUTO_PIN_LINE_OUT) {
                        /* enable pin-detect for line-outs as well */
-                       for (i = 0; i < cfg->hp_outs; i++) {
-                               hda_nid_t nid = cfg->hp_pins[i];
+                       for (i = 0; i < cfg->line_outs; i++) {
+                               hda_nid_t nid = cfg->line_out_pins[i];
                                enable_pin_detect(codec, nid, STAC_LO_EVENT);
                        }
                }
@@ -4371,7 +4373,8 @@ static int stac92xx_init(struct hda_codec *codec)
        }
        if (spec->auto_mic) {
                /* initialize connection to analog input */
-               snd_hda_codec_write_cache(codec, spec->dmux_nids[0], 0,
+               if (spec->dmux_nids)
+                       snd_hda_codec_write_cache(codec, spec->dmux_nids[0], 0,
                                          AC_VERB_SET_CONNECT_SEL, 0);
                if (enable_pin_detect(codec, spec->ext_mic.pin, STAC_MIC_EVENT))
                        stac_issue_unsol_event(codec, spec->ext_mic.pin);
@@ -4782,10 +4785,8 @@ static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
 
        switch (event->type) {
        case STAC_HP_EVENT:
-               stac92xx_hp_detect(codec);
-               break;
        case STAC_LO_EVENT:
-               stac92xx_line_out_detect(codec, 0);
+               stac92xx_hp_detect(codec);
                break;
        case STAC_MIC_EVENT:
                stac92xx_mic_detect(codec);
@@ -5870,6 +5871,13 @@ static int patch_stac927x(struct hda_codec *codec)
                /* GPIO2 High = Enable EAPD */
                spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x04;
                spec->gpio_data = 0x04;
+               switch (codec->subsystem_id) {
+               case 0x1028022f:
+                       /* correct EAPD to be GPIO0 */
+                       spec->eapd_mask = spec->gpio_mask = 0x01;
+                       spec->gpio_dir = spec->gpio_data = 0x01;
+                       break;
+               };
                spec->dmic_nids = stac927x_dmic_nids;
                spec->num_dmics = STAC927X_NUM_DMICS;