}
+/* add the found input-pin to the cfg->inputs[] table */
+static void add_auto_cfg_input_pin(struct auto_pin_cfg *cfg, hda_nid_t nid,
+ int type)
+{
+ if (cfg->num_inputs < AUTO_CFG_MAX_INS) {
+ cfg->inputs[cfg->num_inputs].pin = nid;
+ cfg->inputs[cfg->num_inputs].type = type;
+ cfg->num_inputs++;
+ }
+}
+
/*
* Parse all pin widgets and store the useful pin nids to cfg
*
short sequences_line_out[ARRAY_SIZE(cfg->line_out_pins)];
short sequences_speaker[ARRAY_SIZE(cfg->speaker_pins)];
short sequences_hp[ARRAY_SIZE(cfg->hp_pins)];
+ int i;
memset(cfg, 0, sizeof(*cfg));
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;
}
- case AC_JACK_LINE_IN:
+ case AC_JACK_LINE_IN: {
+ int type;
if (loc == AC_JACK_LOC_FRONT)
- cfg->input_pins[AUTO_PIN_FRONT_LINE] = nid;
+ type = AUTO_PIN_FRONT_LINE;
else
- cfg->input_pins[AUTO_PIN_LINE] = nid;
+ type = AUTO_PIN_LINE;
+ cfg->input_pins[type] = nid;
+ add_auto_cfg_input_pin(cfg, nid, type);
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:
case AC_JACK_DIG_OTHER_OUT:
if (cfg->dig_outs)
snd_printd(" dig-out=0x%x/0x%x\n",
cfg->dig_out_pins[0], cfg->dig_out_pins[1]);
- snd_printd(" inputs: mic=0x%x, fmic=0x%x, line=0x%x, fline=0x%x,"
- " cd=0x%x, aux=0x%x\n",
- cfg->input_pins[AUTO_PIN_MIC],
- cfg->input_pins[AUTO_PIN_FRONT_MIC],
- cfg->input_pins[AUTO_PIN_LINE],
- cfg->input_pins[AUTO_PIN_FRONT_LINE],
- cfg->input_pins[AUTO_PIN_CD],
- cfg->input_pins[AUTO_PIN_AUX]);
+ snd_printd(" inputs:");
+ for (i = 0; i < cfg->num_inputs; i++) {
+ snd_printdd(" %s=0x%x",
+ auto_pin_cfg_labels[cfg->inputs[i].type],
+ cfg->inputs[i].pin);
+ }
+ snd_printd("\n");
if (cfg->dig_in_pin)
snd_printd(" dig-in=0x%x\n", cfg->dig_in_pin);
}
EXPORT_SYMBOL_HDA(snd_hda_parse_pin_def_config);
-/* labels for input pins */
+/* 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"
};
EXPORT_SYMBOL_HDA(auto_pin_cfg_labels);
+static const char *input_labels[AUTO_PIN_LAST][4] = {
+ { "Mic", "Mic 2", "Mic 3", "Mic 4" },
+ { "Front Mic", "Front Mic 2", "Front Mic 3", "Front Mic 4" },
+ { "Line", "Line 2", "Line 3", "Line 4" },
+ { "Front Line", "Front Line 2", "Front Line 3", "Front Line 4" },
+ { "CD", "CD 2", "CD 3", "CD 4" },
+ { "Aux", "Aux 2", "Aux 3", "Aux 4" },
+};
+
+const char *snd_hda_get_input_pin_label(const struct auto_pin_cfg *cfg,
+ int input)
+{
+ int type = cfg->inputs[input].type;
+ int idx;
+
+ for (idx = 0; idx < 3 && --input >= 0; idx++) {
+ if (type != cfg->inputs[input].type)
+ break;
+ }
+ return input_labels[type][idx];
+}
+EXPORT_SYMBOL_HDA(snd_hda_get_input_pin_label);
+
#ifdef CONFIG_PM
/*