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:
Родитель
b5786e85cb
Коммит
86e2959a10
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
return 0;
|
||||
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;
|
||||
pincap = snd_hda_query_pin_caps(codec, nid);
|
||||
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 auto_pin_cfg *cfg = &spec->autocfg;
|
||||
unsigned int def_conf, pincap;
|
||||
int i, mic_type;
|
||||
int i;
|
||||
|
||||
*dac = 0;
|
||||
if (cfg->line_out_type != AUTO_PIN_LINE_OUT)
|
||||
return 0;
|
||||
mic_type = AUTO_PIN_MIC;
|
||||
again:
|
||||
for (i = 0; i < cfg->num_inputs; i++) {
|
||||
hda_nid_t nid = cfg->inputs[i].pin;
|
||||
if (cfg->inputs[i].type != mic_type)
|
||||
if (cfg->inputs[i].type != AUTO_PIN_MIC)
|
||||
continue;
|
||||
def_conf = snd_hda_codec_get_pincfg(codec, nid);
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
@ -3222,7 +3216,7 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec,
|
|||
}
|
||||
|
||||
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;
|
||||
nid = cfg->inputs[idx].pin;
|
||||
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)
|
||||
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 */
|
||||
i = get_connection_index(codec, spec->mux_nids[0], pin);
|
||||
if (i < 0)
|
||||
|
@ -3656,7 +3650,7 @@ static int stac_check_auto_mic(struct hda_codec *codec)
|
|||
int 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 */
|
||||
}
|
||||
fixed = ext = 0;
|
||||
|
@ -4394,7 +4388,7 @@ static int stac92xx_init(struct hda_codec *codec)
|
|||
hda_nid_t nid = cfg->inputs[i].pin;
|
||||
int type = cfg->inputs[i].type;
|
||||
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 */
|
||||
pinctl = stac92xx_get_default_vref(codec, nid);
|
||||
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;
|
||||
if (spec->smart51_enabled && is_smart51_pins(spec, nid))
|
||||
ctl = PIN_OUT;
|
||||
else if (i <= AUTO_PIN_FRONT_MIC)
|
||||
else if (i == AUTO_PIN_MIC)
|
||||
ctl = PIN_VREF50;
|
||||
else
|
||||
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++) {
|
||||
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;
|
||||
}
|
||||
|
@ -1356,9 +1356,9 @@ static int via_smart51_get(struct snd_kcontrol *kcontrol,
|
|||
hda_nid_t nid = cfg->inputs[i].pin;
|
||||
int ctl = snd_hda_codec_read(codec, nid, 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;
|
||||
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)
|
||||
continue; /* ignore FMic for independent HP */
|
||||
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;
|
||||
unsigned int parm;
|
||||
|
||||
if (cfg->inputs[i].type >= AUTO_PIN_FRONT_LINE)
|
||||
if (cfg->inputs[i].type > AUTO_PIN_LINE_IN)
|
||||
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)
|
||||
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,
|
||||
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
|
||||
|| spec->codec_type == VT1716S) {
|
||||
/* 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++) {
|
||||
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]);
|
||||
if (knew == NULL)
|
||||
return -ENOMEM;
|
||||
|
|
Загрузка…
Ссылка в новой задаче