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

Commit 86e2959a authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: hda - Remove AUTO_PIN_FRONT_{MIC|LINE}



We can assign multiple pins to a single role now, let's reduce the
redundant FRONT_MIC and FRONT_LINE.  Also, autocfg->input_pins[] is
no longer used, so this is removed as well.

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent b5786e85
Loading
Loading
Loading
Loading
+6 −44
Original line number Diff line number Diff line
@@ -4396,7 +4396,7 @@ static void add_auto_cfg_input_pin(struct auto_pin_cfg *cfg, hda_nid_t nid,
 * output, i.e. to line_out_pins[0].  So, line_outs is always positive
 * if any analog output exists.
 *
 * The analog input pins are assigned to input_pins array.
 * The analog input pins are assigned to inputs array.
 * The digital input/output pins are assigned to dig_in_pin and dig_out_pin,
 * respectively.
 */
@@ -4480,39 +4480,16 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
			sequences_hp[cfg->hp_outs] = (assoc << 4) | seq;
			cfg->hp_outs++;
			break;
		case AC_JACK_MIC_IN: {
			int preferred, alt;
			if (loc == AC_JACK_LOC_FRONT ||
			    (loc & 0x30) == AC_JACK_LOC_INTERNAL) {
				preferred = AUTO_PIN_FRONT_MIC;
				alt = AUTO_PIN_MIC;
			} else {
				preferred = AUTO_PIN_MIC;
				alt = AUTO_PIN_FRONT_MIC;
			}
			if (!cfg->input_pins[preferred])
				cfg->input_pins[preferred] = nid;
			else if (!cfg->input_pins[alt])
				cfg->input_pins[alt] = nid;
			add_auto_cfg_input_pin(cfg, nid, preferred);
		case AC_JACK_MIC_IN:
			add_auto_cfg_input_pin(cfg, nid, AUTO_PIN_MIC);
			break;
		}
		case AC_JACK_LINE_IN: {
			int type;
			if (loc == AC_JACK_LOC_FRONT)
				type = AUTO_PIN_FRONT_LINE;
			else
				type = AUTO_PIN_LINE;
			cfg->input_pins[type] = nid;
			add_auto_cfg_input_pin(cfg, nid, type);
		case AC_JACK_LINE_IN:
			add_auto_cfg_input_pin(cfg, nid, AUTO_PIN_LINE_IN);
			break;
		}
		case AC_JACK_CD:
			cfg->input_pins[AUTO_PIN_CD] = nid;
			add_auto_cfg_input_pin(cfg, nid, AUTO_PIN_CD);
			break;
		case AC_JACK_AUX:
			cfg->input_pins[AUTO_PIN_AUX] = nid;
			add_auto_cfg_input_pin(cfg, nid, AUTO_PIN_AUX);
			break;
		case AC_JACK_SPDIF_OUT:
@@ -4570,21 +4547,6 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
	sort_pins_by_sequence(cfg->hp_pins, sequences_hp,
			      cfg->hp_outs);

	/* if we have only one mic, make it AUTO_PIN_MIC */
	if (!cfg->input_pins[AUTO_PIN_MIC] &&
	    cfg->input_pins[AUTO_PIN_FRONT_MIC]) {
		cfg->input_pins[AUTO_PIN_MIC] =
			cfg->input_pins[AUTO_PIN_FRONT_MIC];
		cfg->input_pins[AUTO_PIN_FRONT_MIC] = 0;
	}
	/* ditto for line-in */
	if (!cfg->input_pins[AUTO_PIN_LINE] &&
	    cfg->input_pins[AUTO_PIN_FRONT_LINE]) {
		cfg->input_pins[AUTO_PIN_LINE] =
			cfg->input_pins[AUTO_PIN_FRONT_LINE];
		cfg->input_pins[AUTO_PIN_FRONT_LINE] = 0;
	}

	/*
	 * FIX-UP: if no line-outs are detected, try to use speaker or HP pin
	 * as a primary output
@@ -4658,7 +4620,7 @@ EXPORT_SYMBOL_HDA(snd_hda_parse_pin_def_config);

/* labels for input pins - for obsoleted config stuff */
const char *auto_pin_cfg_labels[AUTO_PIN_LAST] = {
	"Mic", "Front Mic", "Line", "Front Line", "CD", "Aux"
	"Mic", "Line", "CD", "Aux"
};
EXPORT_SYMBOL_HDA(auto_pin_cfg_labels);

+1 −4
Original line number Diff line number Diff line
@@ -366,9 +366,7 @@ struct hda_bus_unsolicited {

enum {
	AUTO_PIN_MIC,
	AUTO_PIN_FRONT_MIC,
	AUTO_PIN_LINE,
	AUTO_PIN_FRONT_LINE,
	AUTO_PIN_LINE_IN,
	AUTO_PIN_CD,
	AUTO_PIN_AUX,
	AUTO_PIN_LAST
@@ -403,7 +401,6 @@ struct auto_pin_cfg {
	int hp_outs;
	int line_out_type;	/* AUTO_PIN_XXX_OUT */
	hda_nid_t hp_pins[AUTO_CFG_MAX_OUTS];
	hda_nid_t input_pins[AUTO_PIN_LAST]; /* old config; to be deprecated */
	int num_inputs;
	struct auto_pin_cfg_item inputs[AUTO_CFG_MAX_INS];
	int dig_outs;
+2 −2
Original line number Diff line number Diff line
@@ -2923,7 +2923,7 @@ static int ad1988_auto_create_analog_input_ctls(struct ad198x_spec *spec,
			type_idx = 0;
		err = new_analog_input(spec, cfg->inputs[i].pin,
				       auto_pin_cfg_labels[type], type_idx,
				       type <= AUTO_PIN_FRONT_MIC);
				       type == AUTO_PIN_MIC);
		if (err < 0)
			return err;
		snd_hda_get_input_pin_label(cfg, i,
@@ -3015,7 +3015,7 @@ static void ad1988_auto_init_analog_input(struct hda_codec *codec)
			break;
		}
		snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
				    i <= AUTO_PIN_FRONT_MIC ? PIN_VREF80 : PIN_IN);
				    i == AUTO_PIN_MIC ? PIN_VREF80 : PIN_IN);
		if (nid != AD1988_PIN_CD_NID)
			snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
					    AMP_OUT_MUTE);
+3 −3
Original line number Diff line number Diff line
@@ -436,8 +436,8 @@ static int parse_input(struct hda_codec *codec)

	/* check whether the automatic mic switch is available */
	if (spec->num_inputs == 2 &&
	    cfg->inputs[0].type <= AUTO_PIN_FRONT_MIC &&
	    cfg->inputs[1].type == AUTO_PIN_FRONT_MIC) {
	    cfg->inputs[0].type == AUTO_PIN_MIC &&
	    cfg->inputs[1].type == AUTO_PIN_MIC) {
		if (is_ext_mic(codec, cfg->inputs[0].pin)) {
			if (!is_ext_mic(codec, cfg->inputs[1].pin)) {
				spec->mic_detect = 1;
@@ -921,7 +921,7 @@ static void init_input(struct hda_codec *codec)
			continue;
		/* set appropriate pin control and mute first */
		ctl = PIN_IN;
		if (cfg->inputs[i].type <= AUTO_PIN_FRONT_MIC) {
		if (cfg->inputs[i].type == AUTO_PIN_MIC) {
			unsigned int caps = snd_hda_query_pin_caps(codec, pin);
			caps >>= AC_PINCAP_VREF_SHIFT;
			if (caps & AC_PINCAP_VREF_80)
+4 −4
Original line number Diff line number Diff line
@@ -846,7 +846,7 @@ static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
{
	unsigned int val = PIN_IN;
	if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
	if (auto_pin_type == AUTO_PIN_MIC) {
		unsigned int pincap;
		unsigned int oldval;
		oldval = snd_hda_codec_read(codec, nid, 0,
@@ -1298,7 +1298,7 @@ static void alc_init_auto_mic(struct hda_codec *codec)
	/* there must be only two mic inputs exclusively */
	for (i = 0; i < cfg->num_inputs; i++)
		if (cfg->inputs[i].type >= AUTO_PIN_LINE)
		if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN)
			return;
	fixed = ext = 0;
@@ -10622,7 +10622,7 @@ static int alc_auto_add_mic_boost(struct hda_codec *codec)
	hda_nid_t nid;
	for (i = 0; i < cfg->num_inputs; i++) {
		if (cfg->inputs[i].type > AUTO_PIN_FRONT_MIC)
		if (cfg->inputs[i].type > AUTO_PIN_MIC)
			break;
		nid = cfg->inputs[i].pin;
		if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
@@ -19270,7 +19270,7 @@ static void alc680_base_setup(struct hda_codec *codec)
	spec->autocfg.inputs[0].pin = 0x18;
	spec->autocfg.inputs[0].type = AUTO_PIN_MIC;
	spec->autocfg.inputs[1].pin = 0x19;
	spec->autocfg.inputs[1].type = AUTO_PIN_LINE;
	spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN;
}
static void alc680_unsol_event(struct hda_codec *codec,
Loading