|
@@ -3260,6 +3260,28 @@ static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
|
|
|
alc_fixup_headset_mode(codec, fix, action);
|
|
|
}
|
|
|
|
|
|
+/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
|
|
|
+static int find_ext_mic_pin(struct hda_codec *codec)
|
|
|
+{
|
|
|
+ struct alc_spec *spec = codec->spec;
|
|
|
+ struct auto_pin_cfg *cfg = &spec->gen.autocfg;
|
|
|
+ hda_nid_t nid;
|
|
|
+ unsigned int defcfg;
|
|
|
+ int i;
|
|
|
+
|
|
|
+ for (i = 0; i < cfg->num_inputs; i++) {
|
|
|
+ if (cfg->inputs[i].type != AUTO_PIN_MIC)
|
|
|
+ continue;
|
|
|
+ nid = cfg->inputs[i].pin;
|
|
|
+ defcfg = snd_hda_codec_get_pincfg(codec, nid);
|
|
|
+ if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
|
|
|
+ continue;
|
|
|
+ return nid;
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
|
|
|
const struct hda_fixup *fix,
|
|
|
int action)
|
|
@@ -3267,11 +3289,12 @@ static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
|
|
|
struct alc_spec *spec = codec->spec;
|
|
|
|
|
|
if (action == HDA_FIXUP_ACT_PROBE) {
|
|
|
- if (snd_BUG_ON(!spec->gen.am_entry[1].pin ||
|
|
|
- !spec->gen.autocfg.hp_pins[0]))
|
|
|
+ int mic_pin = find_ext_mic_pin(codec);
|
|
|
+ int hp_pin = spec->gen.autocfg.hp_pins[0];
|
|
|
+
|
|
|
+ if (snd_BUG_ON(!mic_pin || !hp_pin))
|
|
|
return;
|
|
|
- snd_hda_jack_set_gating_jack(codec, spec->gen.am_entry[1].pin,
|
|
|
- spec->gen.autocfg.hp_pins[0]);
|
|
|
+ snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
|
|
|
}
|
|
|
}
|
|
|
|