]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
ALSA: hda - Add snd_hda_get_input_pin_label() helper function
authorTakashi Iwai <tiwai@suse.de>
Mon, 30 Aug 2010 11:00:16 +0000 (13:00 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 30 Aug 2010 11:00:16 +0000 (13:00 +0200)
Added snd_hda_get_input_pin_label() helper function to return the
string that can be used for control or capture-source ids.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_local.h

index 280a739c2a99b4b84a35dcc0d458734a02f87f1f..72334b7f60e58d1157c992df153bd223d5cfcf4b 100644 (file)
@@ -4654,12 +4654,35 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
 }
 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
 /*
index 44c909445ba2e12f1a348ce6b40a476898a8026f..fb561748adb8bcd81e24809ad5b165093f713df7 100644 (file)
@@ -391,6 +391,8 @@ struct auto_pin_cfg_item {
 };
 
 struct auto_pin_cfg;
+const char *snd_hda_get_input_pin_label(const struct auto_pin_cfg *cfg,
+                                       int input);
 
 struct auto_pin_cfg {
        int line_outs;