Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cace16f1 authored by Matthew Ranostay's avatar Matthew Ranostay Committed by Mercurial server
Browse files

[ALSA] hda: fix Mic in as output



Some laptop has an internal analog microphone that is 'fixed'.
This patch prevents creating a 'Mic In as Output' switch for
ports that can't be outputs.

Signed-off-by: default avatarMatthew Ranostay <mranostay@embeddedalley.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
parent 493b4acb
Loading
Loading
Loading
Loading
+16 −8
Original line number Diff line number Diff line
@@ -2283,7 +2283,14 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec,
	}

	if (spec->mic_switch) {
		unsigned int def_conf;
		nid = cfg->input_pins[AUTO_PIN_MIC];
		def_conf = snd_hda_codec_read(codec, nid, 0,
						AC_VERB_GET_CONFIG_DEFAULT, 0);

		/* some laptops have an internal analog microphone
		 * which can't be used as a output */
		if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) {
			pincap = snd_hda_param_read(codec, nid,
							AC_PAR_PIN_CAP);
			if (pincap & AC_PINCAP_OUT) {
@@ -2294,6 +2301,7 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec,
					return err;
			}
		}
	}

	return 0;
}