aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda
diff options
context:
space:
mode:
authorWang Xingchao <xingchao.wang@intel.com>2012-09-05 22:02:36 -0400
committerTakashi Iwai <tiwai@suse.de>2012-09-06 02:50:31 -0400
commit72357c78b75d39ee9e8d9fb4308957d9525aa674 (patch)
tree7e6ccb326f5c7e92d13177ebbda8ba7103f9e9b9 /sound/pci/hda
parent14e42917216ab0859827c2d8024df45a917301b4 (diff)
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: Wang Xingchao <xingchao.wang@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r--sound/pci/hda/patch_hdmi.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index afd6850670e7..4fb8199d813a 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -469,6 +469,17 @@ static void init_channel_allocations(void)
469 } 469 }
470} 470}
471 471
472static int get_channel_allocation_order(int ca)
473{
474 int i;
475
476 for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) {
477 if (channel_allocations[i].ca_index == ca)
478 break;
479 }
480 return i;
481}
482
472/* 483/*
473 * The transformation takes two steps: 484 * The transformation takes two steps:
474 * 485 *
@@ -541,9 +552,11 @@ static void hdmi_setup_channel_mapping(struct hda_codec *codec,
541{ 552{
542 int i; 553 int i;
543 int err; 554 int err;
555 int order;
544 556
557 order = get_channel_allocation_order(ca);
545 if (hdmi_channel_mapping[ca][1] == 0) { 558 if (hdmi_channel_mapping[ca][1] == 0) {
546 for (i = 0; i < channel_allocations[ca].channels; i++) 559 for (i = 0; i < channel_allocations[order].channels; i++)
547 hdmi_channel_mapping[ca][i] = i | (i << 4); 560 hdmi_channel_mapping[ca][i] = i | (i << 4);
548 for (; i < 8; i++) 561 for (; i < 8; i++)
549 hdmi_channel_mapping[ca][i] = 0xf | (i << 4); 562 hdmi_channel_mapping[ca][i] = 0xf | (i << 4);