Commit 4a4d4a69 authored by Takashi Iwai's avatar Takashi Iwai

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: default avatarTakashi Iwai <tiwai@suse.de>
parent 990061c2
...@@ -4383,6 +4383,23 @@ static void add_auto_cfg_input_pin(struct auto_pin_cfg *cfg, hda_nid_t nid, ...@@ -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 * 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, ...@@ -4585,6 +4602,8 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
break; break;
} }
sort_autocfg_input_pins(cfg);
/* /*
* debug prints of the parsed results * debug prints of the parsed results
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment