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: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2010-09-09 14:50:17 +02:00
Родитель b5786e85cb
Коммит 86e2959a10
7 изменённых файлов: 31 добавлений и 78 удалений

Просмотреть файл

@ -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 * output, i.e. to line_out_pins[0]. So, line_outs is always positive
* if any analog output exists. * 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, * The digital input/output pins are assigned to dig_in_pin and dig_out_pin,
* respectively. * respectively.
*/ */
@ -4480,39 +4480,16 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
sequences_hp[cfg->hp_outs] = (assoc << 4) | seq; sequences_hp[cfg->hp_outs] = (assoc << 4) | seq;
cfg->hp_outs++; cfg->hp_outs++;
break; break;
case AC_JACK_MIC_IN: { case AC_JACK_MIC_IN:
int preferred, alt; add_auto_cfg_input_pin(cfg, nid, AUTO_PIN_MIC);
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);
break; break;
} case AC_JACK_LINE_IN:
case AC_JACK_LINE_IN: { add_auto_cfg_input_pin(cfg, nid, AUTO_PIN_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);
break; break;
}
case AC_JACK_CD: case AC_JACK_CD:
cfg->input_pins[AUTO_PIN_CD] = nid;
add_auto_cfg_input_pin(cfg, nid, AUTO_PIN_CD); add_auto_cfg_input_pin(cfg, nid, AUTO_PIN_CD);
break; break;
case AC_JACK_AUX: case AC_JACK_AUX:
cfg->input_pins[AUTO_PIN_AUX] = nid;
add_auto_cfg_input_pin(cfg, nid, AUTO_PIN_AUX); add_auto_cfg_input_pin(cfg, nid, AUTO_PIN_AUX);
break; break;
case AC_JACK_SPDIF_OUT: 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, sort_pins_by_sequence(cfg->hp_pins, sequences_hp,
cfg->hp_outs); 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 * FIX-UP: if no line-outs are detected, try to use speaker or HP pin
* as a primary output * 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 */ /* labels for input pins - for obsoleted config stuff */
const char *auto_pin_cfg_labels[AUTO_PIN_LAST] = { 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); EXPORT_SYMBOL_HDA(auto_pin_cfg_labels);

Просмотреть файл

@ -366,9 +366,7 @@ struct hda_bus_unsolicited {
enum { enum {
AUTO_PIN_MIC, AUTO_PIN_MIC,
AUTO_PIN_FRONT_MIC, AUTO_PIN_LINE_IN,
AUTO_PIN_LINE,
AUTO_PIN_FRONT_LINE,
AUTO_PIN_CD, AUTO_PIN_CD,
AUTO_PIN_AUX, AUTO_PIN_AUX,
AUTO_PIN_LAST AUTO_PIN_LAST
@ -403,7 +401,6 @@ struct auto_pin_cfg {
int hp_outs; int hp_outs;
int line_out_type; /* AUTO_PIN_XXX_OUT */ int line_out_type; /* AUTO_PIN_XXX_OUT */
hda_nid_t hp_pins[AUTO_CFG_MAX_OUTS]; 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; int num_inputs;
struct auto_pin_cfg_item inputs[AUTO_CFG_MAX_INS]; struct auto_pin_cfg_item inputs[AUTO_CFG_MAX_INS];
int dig_outs; int dig_outs;

Просмотреть файл

@ -2923,7 +2923,7 @@ static int ad1988_auto_create_analog_input_ctls(struct ad198x_spec *spec,
type_idx = 0; type_idx = 0;
err = new_analog_input(spec, cfg->inputs[i].pin, err = new_analog_input(spec, cfg->inputs[i].pin,
auto_pin_cfg_labels[type], type_idx, auto_pin_cfg_labels[type], type_idx,
type <= AUTO_PIN_FRONT_MIC); type == AUTO_PIN_MIC);
if (err < 0) if (err < 0)
return err; return err;
snd_hda_get_input_pin_label(cfg, i, snd_hda_get_input_pin_label(cfg, i,
@ -3015,7 +3015,7 @@ static void ad1988_auto_init_analog_input(struct hda_codec *codec)
break; break;
} }
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 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) if (nid != AD1988_PIN_CD_NID)
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
AMP_OUT_MUTE); AMP_OUT_MUTE);

Просмотреть файл

@ -436,8 +436,8 @@ static int parse_input(struct hda_codec *codec)
/* check whether the automatic mic switch is available */ /* check whether the automatic mic switch is available */
if (spec->num_inputs == 2 && if (spec->num_inputs == 2 &&
cfg->inputs[0].type <= AUTO_PIN_FRONT_MIC && cfg->inputs[0].type == AUTO_PIN_MIC &&
cfg->inputs[1].type == AUTO_PIN_FRONT_MIC) { cfg->inputs[1].type == AUTO_PIN_MIC) {
if (is_ext_mic(codec, cfg->inputs[0].pin)) { if (is_ext_mic(codec, cfg->inputs[0].pin)) {
if (!is_ext_mic(codec, cfg->inputs[1].pin)) { if (!is_ext_mic(codec, cfg->inputs[1].pin)) {
spec->mic_detect = 1; spec->mic_detect = 1;
@ -921,7 +921,7 @@ static void init_input(struct hda_codec *codec)
continue; continue;
/* set appropriate pin control and mute first */ /* set appropriate pin control and mute first */
ctl = PIN_IN; 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); unsigned int caps = snd_hda_query_pin_caps(codec, pin);
caps >>= AC_PINCAP_VREF_SHIFT; caps >>= AC_PINCAP_VREF_SHIFT;
if (caps & AC_PINCAP_VREF_80) if (caps & AC_PINCAP_VREF_80)

Просмотреть файл

@ -846,7 +846,7 @@ static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
{ {
unsigned int val = PIN_IN; 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 pincap;
unsigned int oldval; unsigned int oldval;
oldval = snd_hda_codec_read(codec, nid, 0, 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 */ /* there must be only two mic inputs exclusively */
for (i = 0; i < cfg->num_inputs; i++) 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; return;
fixed = ext = 0; fixed = ext = 0;
@ -10622,7 +10622,7 @@ static int alc_auto_add_mic_boost(struct hda_codec *codec)
hda_nid_t nid; hda_nid_t nid;
for (i = 0; i < cfg->num_inputs; i++) { 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; break;
nid = cfg->inputs[i].pin; nid = cfg->inputs[i].pin;
if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { 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].pin = 0x18;
spec->autocfg.inputs[0].type = AUTO_PIN_MIC; spec->autocfg.inputs[0].type = AUTO_PIN_MIC;
spec->autocfg.inputs[1].pin = 0x19; 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, static void alc680_unsol_event(struct hda_codec *codec,

Просмотреть файл

@ -2834,7 +2834,7 @@ static hda_nid_t check_line_out_switch(struct hda_codec *codec)
if (cfg->line_out_type != AUTO_PIN_LINE_OUT) if (cfg->line_out_type != AUTO_PIN_LINE_OUT)
return 0; return 0;
for (i = 0; i < cfg->num_inputs; i++) { 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) {
nid = cfg->inputs[i].pin; nid = cfg->inputs[i].pin;
pincap = snd_hda_query_pin_caps(codec, nid); pincap = snd_hda_query_pin_caps(codec, nid);
if (pincap & AC_PINCAP_OUT) if (pincap & AC_PINCAP_OUT)
@ -2852,16 +2852,14 @@ static hda_nid_t check_mic_out_switch(struct hda_codec *codec, hda_nid_t *dac)
struct sigmatel_spec *spec = codec->spec; struct sigmatel_spec *spec = codec->spec;
struct auto_pin_cfg *cfg = &spec->autocfg; struct auto_pin_cfg *cfg = &spec->autocfg;
unsigned int def_conf, pincap; unsigned int def_conf, pincap;
int i, mic_type; int i;
*dac = 0; *dac = 0;
if (cfg->line_out_type != AUTO_PIN_LINE_OUT) if (cfg->line_out_type != AUTO_PIN_LINE_OUT)
return 0; return 0;
mic_type = AUTO_PIN_MIC;
again:
for (i = 0; i < cfg->num_inputs; i++) { for (i = 0; i < cfg->num_inputs; i++) {
hda_nid_t nid = cfg->inputs[i].pin; hda_nid_t nid = cfg->inputs[i].pin;
if (cfg->inputs[i].type != mic_type) if (cfg->inputs[i].type != AUTO_PIN_MIC)
continue; continue;
def_conf = snd_hda_codec_get_pincfg(codec, nid); def_conf = snd_hda_codec_get_pincfg(codec, nid);
/* some laptops have an internal analog microphone /* some laptops have an internal analog microphone
@ -2875,10 +2873,6 @@ static hda_nid_t check_mic_out_switch(struct hda_codec *codec, hda_nid_t *dac)
} }
} }
} }
if (mic_type == AUTO_PIN_MIC) {
mic_type = AUTO_PIN_FRONT_MIC;
goto again;
}
return 0; return 0;
} }
@ -3222,7 +3216,7 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec,
} }
for (idx = 0; idx < cfg->num_inputs; idx++) { for (idx = 0; idx < cfg->num_inputs; idx++) {
if (cfg->inputs[idx].type > AUTO_PIN_FRONT_LINE) if (cfg->inputs[idx].type > AUTO_PIN_LINE_IN)
break; break;
nid = cfg->inputs[idx].pin; nid = cfg->inputs[idx].pin;
err = stac92xx_add_jack_mode_control(codec, nid, idx); err = stac92xx_add_jack_mode_control(codec, nid, idx);
@ -3621,7 +3615,7 @@ static int set_mic_route(struct hda_codec *codec,
if (pin == cfg->inputs[i].pin) if (pin == cfg->inputs[i].pin)
break; break;
} }
if (i < cfg->num_inputs && cfg->inputs[i].type <= AUTO_PIN_FRONT_MIC) { if (i < cfg->num_inputs && cfg->inputs[i].type == AUTO_PIN_MIC) {
/* analog pin */ /* analog pin */
i = get_connection_index(codec, spec->mux_nids[0], pin); i = get_connection_index(codec, spec->mux_nids[0], pin);
if (i < 0) if (i < 0)
@ -3656,7 +3650,7 @@ static int stac_check_auto_mic(struct hda_codec *codec)
int i; int i;
for (i = 0; i < cfg->num_inputs; i++) { 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 0; /* must be exclusively mics */ return 0; /* must be exclusively mics */
} }
fixed = ext = 0; fixed = ext = 0;
@ -4394,7 +4388,7 @@ static int stac92xx_init(struct hda_codec *codec)
hda_nid_t nid = cfg->inputs[i].pin; hda_nid_t nid = cfg->inputs[i].pin;
int type = cfg->inputs[i].type; int type = cfg->inputs[i].type;
unsigned int pinctl, conf; unsigned int pinctl, conf;
if (type == AUTO_PIN_MIC || type == AUTO_PIN_FRONT_MIC) { if (type == AUTO_PIN_MIC) {
/* for mic pins, force to initialize */ /* for mic pins, force to initialize */
pinctl = stac92xx_get_default_vref(codec, nid); pinctl = stac92xx_get_default_vref(codec, nid);
pinctl |= AC_PINCTL_IN_EN; pinctl |= AC_PINCTL_IN_EN;

Просмотреть файл

@ -568,7 +568,7 @@ static void via_auto_init_analog_input(struct hda_codec *codec)
hda_nid_t nid = cfg->inputs[i].pin; hda_nid_t nid = cfg->inputs[i].pin;
if (spec->smart51_enabled && is_smart51_pins(spec, nid)) if (spec->smart51_enabled && is_smart51_pins(spec, nid))
ctl = PIN_OUT; ctl = PIN_OUT;
else if (i <= AUTO_PIN_FRONT_MIC) else if (i == AUTO_PIN_MIC)
ctl = PIN_VREF50; ctl = PIN_VREF50;
else else
ctl = PIN_IN; ctl = PIN_IN;
@ -1328,7 +1328,7 @@ static int is_smart51_pins(struct via_spec *spec, hda_nid_t pin)
for (i = 0; i < cfg->num_inputs; i++) { for (i = 0; i < cfg->num_inputs; i++) {
if (pin == cfg->inputs[i].pin) if (pin == cfg->inputs[i].pin)
return cfg->inputs[i].type < AUTO_PIN_FRONT_LINE; return cfg->inputs[i].type <= AUTO_PIN_LINE_IN;
} }
return 0; return 0;
} }
@ -1356,9 +1356,9 @@ static int via_smart51_get(struct snd_kcontrol *kcontrol,
hda_nid_t nid = cfg->inputs[i].pin; hda_nid_t nid = cfg->inputs[i].pin;
int ctl = snd_hda_codec_read(codec, nid, 0, int ctl = snd_hda_codec_read(codec, nid, 0,
AC_VERB_GET_PIN_WIDGET_CONTROL, 0); AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
if (cfg->inputs[i].type >= AUTO_PIN_FRONT_LINE) if (cfg->inputs[i].type > AUTO_PIN_LINE_IN)
continue; continue;
if (cfg->inputs[i].type == AUTO_PIN_FRONT_MIC && if (cfg->inputs[i].type == AUTO_PIN_MIC &&
spec->hp_independent_mode && spec->codec_type != VT1718S) spec->hp_independent_mode && spec->codec_type != VT1718S)
continue; /* ignore FMic for independent HP */ continue; /* ignore FMic for independent HP */
if ((ctl & AC_PINCTL_IN_EN) && !(ctl & AC_PINCTL_OUT_EN)) if ((ctl & AC_PINCTL_IN_EN) && !(ctl & AC_PINCTL_OUT_EN))
@ -1382,9 +1382,9 @@ static int via_smart51_put(struct snd_kcontrol *kcontrol,
hda_nid_t nid = cfg->inputs[i].pin; hda_nid_t nid = cfg->inputs[i].pin;
unsigned int parm; unsigned int parm;
if (cfg->inputs[i].type >= AUTO_PIN_FRONT_LINE) if (cfg->inputs[i].type > AUTO_PIN_LINE_IN)
continue; continue;
if (cfg->inputs[i].type == AUTO_PIN_FRONT_MIC && if (cfg->inputs[i].type == AUTO_PIN_MIC &&
spec->hp_independent_mode && spec->codec_type != VT1718S) spec->hp_independent_mode && spec->codec_type != VT1718S)
continue; /* don't retask FMic for independent HP */ continue; /* don't retask FMic for independent HP */
@ -1404,7 +1404,7 @@ static int via_smart51_put(struct snd_kcontrol *kcontrol,
codec, nid, HDA_OUTPUT, 0, HDA_AMP_MUTE, codec, nid, HDA_OUTPUT, 0, HDA_AMP_MUTE,
HDA_AMP_UNMUTE); HDA_AMP_UNMUTE);
} }
if (cfg->inputs[i].type == AUTO_PIN_FRONT_MIC) { if (cfg->inputs[i].type == AUTO_PIN_MIC) {
if (spec->codec_type == VT1708S if (spec->codec_type == VT1708S
|| spec->codec_type == VT1716S) { || spec->codec_type == VT1716S) {
/* input = index 1 (AOW3) */ /* input = index 1 (AOW3) */
@ -1450,7 +1450,7 @@ static int via_smart51_build(struct via_spec *spec)
for (i = 0; i < cfg->num_inputs; i++) { for (i = 0; i < cfg->num_inputs; i++) {
nid = cfg->inputs[i].pin; nid = cfg->inputs[i].pin;
if (cfg->inputs[i].type < AUTO_PIN_FRONT_LINE) { if (cfg->inputs[i].type <= AUTO_PIN_LINE_IN) {
knew = via_clone_control(spec, &via_smart51_mixer[1]); knew = via_clone_control(spec, &via_smart51_mixer[1]);
if (knew == NULL) if (knew == NULL)
return -ENOMEM; return -ENOMEM;