summaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-09-09 22:22:02 +0200
committerTakashi Iwai <tiwai@suse.de>2010-09-09 22:22:02 +0200
commit4a4d4a6985dd37a3c96534027f054be796bf95f6 (patch)
tree89ea004d4fbe064cc51cf800a917c6d1f767e4e4 /sound/pci
parent990061c28ab6c84e1120afb772b69d92d8965da8 (diff)
downloadlinux-4a4d4a6985dd37a3c96534027f054be796bf95f6.tar.gz
linux-4a4d4a6985dd37a3c96534027f054be796bf95f6.tar.bz2
linux-4a4d4a6985dd37a3c96534027f054be796bf95f6.zip
ALSA: hda - Sort input pins in snd_hda_parse_pin_def_config()
Sort inputs[] array in autocfg so that the codec parsers can filter out easily per input pin types. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/hda_codec.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index ec38bdfad81e..08d81b873022 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -4383,6 +4383,23 @@ static void add_auto_cfg_input_pin(struct auto_pin_cfg *cfg, hda_nid_t nid,
}
}
+/* sort inputs in the order of AUTO_PIN_* type */
+static void sort_autocfg_input_pins(struct auto_pin_cfg *cfg)
+{
+ int i, j;
+
+ for (i = 0; i < cfg->num_inputs; i++) {
+ for (j = i + 1; j < cfg->num_inputs; j++) {
+ if (cfg->inputs[i].type > cfg->inputs[j].type) {
+ struct auto_pin_cfg_item tmp;
+ tmp = cfg->inputs[i];
+ cfg->inputs[i] = cfg->inputs[j];
+ cfg->inputs[j] = tmp;
+ }
+ }
+ }
+}
+
/*
* Parse all pin widgets and store the useful pin nids to cfg
*
@@ -4585,6 +4602,8 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
break;
}
+ sort_autocfg_input_pins(cfg);
+
/*
* debug prints of the parsed results
*/