Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[sfrench/cifs-2.6.git] / sound / pci / hda / patch_sigmatel.c
index ce30b459aee66dd1ee4a4fad9d98074004542be3..03b3646018a1a5e7f1cb710780d1e29999a57ac7 100644 (file)
@@ -3076,6 +3076,11 @@ static int create_multi_out_ctls(struct hda_codec *codec, int num_outs,
        unsigned int wid_caps;
 
        for (i = 0; i < num_outs && i < ARRAY_SIZE(chname); i++) {
+               if (type == AUTO_PIN_HP_OUT && !spec->hp_detect) {
+                       wid_caps = get_wcaps(codec, pins[i]);
+                       if (wid_caps & AC_WCAP_UNSOL_CAP)
+                               spec->hp_detect = 1;
+               }
                nid = dac_nids[i];
                if (!nid)
                        continue;
@@ -3119,11 +3124,6 @@ static int create_multi_out_ctls(struct hda_codec *codec, int num_outs,
                        err = create_controls_idx(codec, name, idx, nid, 3);
                        if (err < 0)
                                return err;
-                       if (type == AUTO_PIN_HP_OUT && !spec->hp_detect) {
-                               wid_caps = get_wcaps(codec, pins[i]);
-                               if (wid_caps & AC_WCAP_UNSOL_CAP)
-                                       spec->hp_detect = 1;
-                       }
                }
        }
        return 0;
@@ -4079,7 +4079,12 @@ static int stac92xx_init(struct hda_codec *codec)
                                pinctl = snd_hda_codec_read(codec, nid, 0,
                                        AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
                                /* if PINCTL already set then skip */
-                               if (!(pinctl & AC_PINCTL_IN_EN)) {
+                               /* Also, if both INPUT and OUTPUT are set,
+                                * it must be a BIOS bug; need to override, too
+                                */
+                               if (!(pinctl & AC_PINCTL_IN_EN) ||
+                                   (pinctl & AC_PINCTL_OUT_EN)) {
+                                       pinctl &= ~AC_PINCTL_OUT_EN;
                                        pinctl |= AC_PINCTL_IN_EN;
                                        stac92xx_auto_set_pinctl(codec, nid,
                                                                 pinctl);