Skip to content

Commit

Permalink
ALSA: HDMI - Fix channel_allocation array wrong order
Browse files Browse the repository at this point in the history
The array channel_allocations[] is an ordered list, add function to get
correct order by ca_index.

Signed-off-by: Wang Xingchao <xingchao.wang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Wang Xingchao authored and Takashi Iwai committed Sep 6, 2012
1 parent 14e4291 commit 72357c7
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion sound/pci/hda/patch_hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
*
Expand Down Expand Up @@ -541,9 +552,11 @@ static void hdmi_setup_channel_mapping(struct hda_codec *codec,
{
int i;
int err;
int order;

order = get_channel_allocation_order(ca);
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);
for (; i < 8; i++)
hdmi_channel_mapping[ca][i] = 0xf | (i << 4);
Expand Down

0 comments on commit 72357c7

Please sign in to comment.