From: Wang Xingchao <xingchao.wang@intel.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, anssi.hannula@iki.fi, alanwww1@xbmc.org,
fengguang.wu@intel.com, Wang Xingchao <xingchao.wang@intel.com>
Subject: [PATCH RFC 1/3] ALSA: hdmi - fix channel_allocation array wrong order
Date: Wed, 5 Sep 2012 13:58:36 +0800 [thread overview]
Message-ID: <1346824718-18448-2-git-send-email-xingchao.wang@intel.com> (raw)
In-Reply-To: <1346824718-18448-1-git-send-email-xingchao.wang@intel.com>
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>
---
sound/pci/hda/patch_hdmi.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index d9439c5..6ac21d4 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);
--
1.7.9.5
next prev parent reply other threads:[~2012-09-05 6:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-05 5:58 [PATCH 0/3] HDMI HBR(High Bit Rate) Feature bug fix for Intel's Chips Wang Xingchao
2012-09-05 5:58 ` Wang Xingchao [this message]
2012-09-05 5:58 ` [PATCH RFC 2/3] ALSA: HDMI - Enable HBR feature on Intel chips Wang Xingchao
2012-09-05 5:58 ` [PATCH RFC 3/3] ALSA: HDMI - Setup channel mapping for non_pcm audio Wang Xingchao
2012-09-05 6:30 ` [PATCH 0/3] HDMI HBR(High Bit Rate) Feature bug fix for Intel's Chips Takashi Iwai
2012-09-05 6:34 ` Wang Xingchao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1346824718-18448-2-git-send-email-xingchao.wang@intel.com \
--to=xingchao.wang@intel.com \
--cc=alanwww1@xbmc.org \
--cc=alsa-devel@alsa-project.org \
--cc=anssi.hannula@iki.fi \
--cc=fengguang.wu@intel.com \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).