aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-09-09 16:22:02 -0400
committerTakashi Iwai <tiwai@suse.de>2010-09-09 16:22:02 -0400
commit4a4d4a6985dd37a3c96534027f054be796bf95f6 (patch)
tree89ea004d4fbe064cc51cf800a917c6d1f767e4e4 /sound/pci/hda/hda_codec.c
parent990061c28ab6c84e1120afb772b69d92d8965da8 (diff)
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/hda/hda_codec.c')
-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,
4383 } 4383 }
4384} 4384}
4385 4385
4386/* sort inputs in the order of AUTO_PIN_* type */
4387static void sort_autocfg_input_pins(struct auto_pin_cfg *cfg)
4388{
4389 int i, j;
4390
4391 for (i = 0; i < cfg->num_inputs; i++) {
4392 for (j = i + 1; j < cfg->num_inputs; j++) {
4393 if (cfg->inputs[i].type > cfg->inputs[j].type) {
4394 struct auto_pin_cfg_item tmp;
4395 tmp = cfg->inputs[i];
4396 cfg->inputs[i] = cfg->inputs[j];
4397 cfg->inputs[j] = tmp;
4398 }
4399 }
4400 }
4401}
4402
4386/* 4403/*
4387 * Parse all pin widgets and store the useful pin nids to cfg 4404 * Parse all pin widgets and store the useful pin nids to cfg
4388 * 4405 *
@@ -4585,6 +4602,8 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
4585 break; 4602 break;
4586 } 4603 }
4587 4604
4605 sort_autocfg_input_pins(cfg);
4606
4588 /* 4607 /*
4589 * debug prints of the parsed results 4608 * debug prints of the parsed results
4590 */ 4609 */