diff options
author | Wang Xingchao <xingchao.wang@intel.com> | 2012-09-06 02:02:36 (GMT) |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-09-06 06:50:31 (GMT) |
commit | 72357c78b75d39ee9e8d9fb4308957d9525aa674 (patch) | |
tree | 7e6ccb326f5c7e92d13177ebbda8ba7103f9e9b9 /sound | |
parent | 14e42917216ab0859827c2d8024df45a917301b4 (diff) | |
download | linux-fsl-qoriq-72357c78b75d39ee9e8d9fb4308957d9525aa674.tar.xz |
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')
-rw-r--r-- | sound/pci/hda/patch_hdmi.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index afd6850..4fb8199 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) } } +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: * @@ -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); |