Commit 72357c78 authored by Wang Xingchao's avatar Wang Xingchao Committed by Takashi Iwai

ALSA: HDMI - Fix channel_allocation array wrong order

The array channel_allocations[] is an ordered list, add function to get
correct order by ca_index.
Signed-off-by: default avatarWang Xingchao <xingchao.wang@intel.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 14e42917
...@@ -469,6 +469,17 @@ static void init_channel_allocations(void) ...@@ -469,6 +469,17 @@ static void init_channel_allocations(void)
} }
} }
static int get_channel_allocation_order(int ca)
{
int i;
for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) {
if (channel_allocations[i].ca_index == ca)
break;
}
return i;
}
/* /*
* The transformation takes two steps: * The transformation takes two steps:
* *
...@@ -541,9 +552,11 @@ static void hdmi_setup_channel_mapping(struct hda_codec *codec, ...@@ -541,9 +552,11 @@ static void hdmi_setup_channel_mapping(struct hda_codec *codec,
{ {
int i; int i;
int err; int err;
int order;
order = get_channel_allocation_order(ca);
if (hdmi_channel_mapping[ca][1] == 0) { if (hdmi_channel_mapping[ca][1] == 0) {
for (i = 0; i < channel_allocations[ca].channels; i++) for (i = 0; i < channel_allocations[order].channels; i++)
hdmi_channel_mapping[ca][i] = i | (i << 4); hdmi_channel_mapping[ca][i] = i | (i << 4);
for (; i < 8; i++) for (; i < 8; i++)
hdmi_channel_mapping[ca][i] = 0xf | (i << 4); hdmi_channel_mapping[ca][i] = 0xf | (i << 4);
......
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