* [PATCH 0/3] HDMI HBR(High Bit Rate) Feature bug fix for Intel's Chips
@ 2012-09-05 5:58 Wang Xingchao
2012-09-05 6:30 ` Takashi Iwai
0 siblings, 1 reply; 10+ messages in thread
From: Wang Xingchao @ 2012-09-05 5:58 UTC (permalink / raw)
To: alsa-devel; +Cc: tiwai, anssi.hannula, alanwww1, fengguang.wu, Wang Xingchao
Please Note This patchset has not been tested yet on any Hardware platform.
i could only confirm there's no compile error. :)
I test previous single patch on the Yamaha A/V receiver which works well, the
test results was also confirmed by some guys from XBMC forum.
The idea of this patch comes from Anssi, Big credit to him at first!
Any comments are appreciated!
Changelog:
* do not touch channel_allocation priority order, use new api to get
correct channels number
* use spdif->status to check audio type, pcm or non-pcm
* create new non_pcm_mapping[] for non_pcm audio in seperate block
* add non_pcm hdmi_spec_per_cvt to remember previous audio type, used to
determine whether need a channel mapping update during the pcm/non-pcm
stream switch with same channel number.
Wang Xingchao (3):
ALSA: hdmi - fix channel_allocation array wrong order
ALSA: HDMI - Enable HBR feature on Intel chips
ALSA: HDMI - Setup channel mapping for non_pcm audio
sound/pci/hda/patch_hdmi.c | 56 ++++++++++++++++++++++++++++++++++++++++----
1 file changed, 51 insertions(+), 5 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/3] HDMI HBR(High Bit Rate) Feature bug fix for Intel's Chips
2012-09-05 5:58 Wang Xingchao
@ 2012-09-05 6:30 ` Takashi Iwai
2012-09-05 6:34 ` Wang Xingchao
0 siblings, 1 reply; 10+ messages in thread
From: Takashi Iwai @ 2012-09-05 6:30 UTC (permalink / raw)
To: Wang Xingchao; +Cc: anssi.hannula, alsa-devel, alanwww1, fengguang.wu
At Wed, 5 Sep 2012 13:58:35 +0800,
Wang Xingchao wrote:
>
> Please Note This patchset has not been tested yet on any Hardware platform.
> i could only confirm there's no compile error. :)
> I test previous single patch on the Yamaha A/V receiver which works well, the
> test results was also confirmed by some guys from XBMC forum.
>
> The idea of this patch comes from Anssi, Big credit to him at first!
>
> Any comments are appreciated!
>
> Changelog:
> * do not touch channel_allocation priority order, use new api to get
> correct channels number
> * use spdif->status to check audio type, pcm or non-pcm
> * create new non_pcm_mapping[] for non_pcm audio in seperate block
> * add non_pcm hdmi_spec_per_cvt to remember previous audio type, used to
> determine whether need a channel mapping update during the pcm/non-pcm
> stream switch with same channel number.
>
>
> Wang Xingchao (3):
> ALSA: hdmi - fix channel_allocation array wrong order
> ALSA: HDMI - Enable HBR feature on Intel chips
> ALSA: HDMI - Setup channel mapping for non_pcm audio
The patches look good to me. Maybe you can unify the subject line
prefix (either lower or upper case), though :)
thanks,
Takashi
>
> sound/pci/hda/patch_hdmi.c | 56 ++++++++++++++++++++++++++++++++++++++++----
> 1 file changed, 51 insertions(+), 5 deletions(-)
>
> --
> 1.7.9.5
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/3] HDMI HBR(High Bit Rate) Feature bug fix for Intel's Chips
2012-09-05 6:30 ` Takashi Iwai
@ 2012-09-05 6:34 ` Wang Xingchao
0 siblings, 0 replies; 10+ messages in thread
From: Wang Xingchao @ 2012-09-05 6:34 UTC (permalink / raw)
To: Takashi Iwai
Cc: anssi.hannula, alsa-devel, alanwww1, fengguang.wu, Wang Xingchao
2012/9/5 Takashi Iwai <tiwai@suse.de>:
> At Wed, 5 Sep 2012 13:58:35 +0800,
> Wang Xingchao wrote:
>>
>> Please Note This patchset has not been tested yet on any Hardware platform.
>> i could only confirm there's no compile error. :)
>> I test previous single patch on the Yamaha A/V receiver which works well, the
>> test results was also confirmed by some guys from XBMC forum.
>>
>> The idea of this patch comes from Anssi, Big credit to him at first!
>>
>> Any comments are appreciated!
>>
>> Changelog:
>> * do not touch channel_allocation priority order, use new api to get
>> correct channels number
>> * use spdif->status to check audio type, pcm or non-pcm
>> * create new non_pcm_mapping[] for non_pcm audio in seperate block
>> * add non_pcm hdmi_spec_per_cvt to remember previous audio type, used to
>> determine whether need a channel mapping update during the pcm/non-pcm
>> stream switch with same channel number.
>>
>>
>> Wang Xingchao (3):
>> ALSA: hdmi - fix channel_allocation array wrong order
>> ALSA: HDMI - Enable HBR feature on Intel chips
>> ALSA: HDMI - Setup channel mapping for non_pcm audio
>
> The patches look good to me. Maybe you can unify the subject line
> prefix (either lower or upper case), though :)
>
Okay. And I will let you know after the patches are tested, this may
take some time. :(
thanks
--xingchao
>
> thanks,
>
> Takashi
>
>>
>> sound/pci/hda/patch_hdmi.c | 56 ++++++++++++++++++++++++++++++++++++++++----
>> 1 file changed, 51 insertions(+), 5 deletions(-)
>>
>> --
>> 1.7.9.5
>>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 0/3] HDMI HBR(High Bit Rate) Feature bug fix for Intel's Chips
@ 2012-09-06 2:02 Wang Xingchao
2012-09-06 2:02 ` [PATCH 1/3] ALSA: HDMI - Fix channel_allocation array wrong order Wang Xingchao
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Wang Xingchao @ 2012-09-06 2:02 UTC (permalink / raw)
To: alsa-devel; +Cc: tiwai, anssi.hannula, alanwww1, fengguang.wu, Wang Xingchao
As i have no A/V receiver handy and could not test HBR playback directly, i
removed the "RFC" type until the patchset was tested and proved working well.
The patchset was tested on Intel chips and get positive feedback.
Quote from "Øyvind Kvålsvoll <oyvind@kvalsvoll.com>":
"TrueHD and DTS-MA work fine from XBMC, 2-ch playback also works fine
from XBMC.
Channels are all mapped to the right speaker, all 7.1."
Quote from alanwww1:
"I tested the patches. They work perfectly. I tested it with both DTS Master
Audio and Dolby Tru HD streams.
Also tested with speaker-test. Channel mapping was right."
From: http://forum.xbmc.org/showthread.php?tid=128298&pid=1184574#pid1184574
Maybe there's still potential bug and i will keep on track that.
The idea of this patch comes from Anssi, Big credit to him at first!
Thanks the guys from XBMC forum which help test the patches.
For people interested to test the patch, please remember to apply another change in
alsa-lib side, you can refer to the patch detail from XBMC forum:
http://forum.xbmc.org/showthread.php?tid=128298&pid=1178776#pid1178776
I will send that patch to alsa-lib mail-list later.
Changelog:
* do not touch channel_allocation priority order, use new api to get
correct channels number
* use spdif->status to check audio type, pcm or non-pcm
* create new non_pcm_mapping[] for non_pcm audio in seperate block
* add non_pcm hdmi_spec_per_cvt to remember previous audio type, used to
determine whether need a channel mapping update during the pcm/non-pcm
stream switch with same channel number.
Wang Xingchao (3):
ALSA: HDMI - Fix channel_allocation array wrong order
ALSA: HDMI - Enable HBR feature on Intel chips
ALSA: HDMI - Setup channel mapping for non_pcm audio
sound/pci/hda/patch_hdmi.c | 56 ++++++++++++++++++++++++++++++++++++++++----
1 file changed, 51 insertions(+), 5 deletions(-)
--
1.7.9.5
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/3] ALSA: HDMI - Fix channel_allocation array wrong order
2012-09-06 2:02 [PATCH 0/3] HDMI HBR(High Bit Rate) Feature bug fix for Intel's Chips Wang Xingchao
@ 2012-09-06 2:02 ` Wang Xingchao
2012-09-06 2:02 ` [PATCH 2/3] ALSA: HDMI - Enable HBR feature on Intel chips Wang Xingchao
` (2 subsequent siblings)
3 siblings, 0 replies; 10+ messages in thread
From: Wang Xingchao @ 2012-09-06 2:02 UTC (permalink / raw)
To: alsa-devel; +Cc: tiwai, anssi.hannula, alanwww1, fengguang.wu, Wang Xingchao
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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/3] ALSA: HDMI - Enable HBR feature on Intel chips
2012-09-06 2:02 [PATCH 0/3] HDMI HBR(High Bit Rate) Feature bug fix for Intel's Chips Wang Xingchao
2012-09-06 2:02 ` [PATCH 1/3] ALSA: HDMI - Fix channel_allocation array wrong order Wang Xingchao
@ 2012-09-06 2:02 ` Wang Xingchao
2012-09-06 2:02 ` [PATCH 3/3] ALSA: HDMI - Setup channel mapping for non_pcm audio Wang Xingchao
2012-09-06 6:53 ` [PATCH 0/3] HDMI HBR(High Bit Rate) Feature bug fix for Intel's Chips Takashi Iwai
3 siblings, 0 replies; 10+ messages in thread
From: Wang Xingchao @ 2012-09-06 2:02 UTC (permalink / raw)
To: alsa-devel; +Cc: tiwai, anssi.hannula, alanwww1, fengguang.wu, Wang Xingchao
HDMI channel remapping apparently effects HBR packets on Intel's chips.
For compressed non-PCM audio, use "straight-through" channel mapping.
For uncompressed multi-channel pcm audio, use normal channel mapping.
Signed-off-by: Wang Xingchao <xingchao.wang@intel.com>
---
sound/pci/hda/patch_hdmi.c | 36 ++++++++++++++++++++++++++++++++----
1 file changed, 32 insertions(+), 4 deletions(-)
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 6ac21d4..a87f8b2 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -34,6 +34,7 @@
#include <linux/module.h>
#include <sound/core.h>
#include <sound/jack.h>
+#include <sound/asoundef.h>
#include "hda_codec.h"
#include "hda_local.h"
#include "hda_jack.h"
@@ -60,6 +61,7 @@ struct hdmi_spec_per_cvt {
u32 rates;
u64 formats;
unsigned int maxbps;
+ bool non_pcm;
};
struct hdmi_spec_per_pin {
@@ -548,13 +550,17 @@ static void hdmi_debug_channel_mapping(struct hda_codec *codec,
static void hdmi_setup_channel_mapping(struct hda_codec *codec,
hda_nid_t pin_nid,
+ hda_nid_t cvt_nid,
+ bool non_pcm,
int ca)
{
int i;
int err;
int order;
+ int non_pcm_mapping[8];
order = get_channel_allocation_order(ca);
+
if (hdmi_channel_mapping[ca][1] == 0) {
for (i = 0; i < channel_allocations[order].channels; i++)
hdmi_channel_mapping[ca][i] = i | (i << 4);
@@ -562,10 +568,17 @@ static void hdmi_setup_channel_mapping(struct hda_codec *codec,
hdmi_channel_mapping[ca][i] = 0xf | (i << 4);
}
+ if (non_pcm) {
+ for (i = 0; i < channel_allocations[order].channels; i++)
+ non_pcm_mapping[i] = i | (i << 4);
+ for (; i < 8; i++)
+ non_pcm_mapping[i] = 0xf | (i << 4);
+ }
+
for (i = 0; i < 8; i++) {
err = snd_hda_codec_write(codec, pin_nid, 0,
AC_VERB_SET_HDMI_CHAN_SLOT,
- hdmi_channel_mapping[ca][i]);
+ non_pcm ? non_pcm_mapping[i] : hdmi_channel_mapping[ca][i]);
if (err) {
snd_printdd(KERN_NOTICE
"HDMI: channel mapping failed\n");
@@ -699,15 +712,27 @@ static bool hdmi_infoframe_uptodate(struct hda_codec *codec, hda_nid_t pin_nid,
}
static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx,
- struct snd_pcm_substream *substream)
+ hda_nid_t cvt_nid, struct snd_pcm_substream *substream)
{
struct hdmi_spec *spec = codec->spec;
struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx];
+ struct hdmi_spec_per_cvt *per_cvt;
+ struct hda_spdif_out *spdif;
hda_nid_t pin_nid = per_pin->pin_nid;
int channels = substream->runtime->channels;
struct hdmi_eld *eld;
int ca;
+ int cvt_idx;
union audio_infoframe ai;
+ bool non_pcm = false;
+
+ cvt_idx = cvt_nid_to_cvt_index(spec, cvt_nid);
+ per_cvt = &spec->cvts[cvt_idx];
+
+ mutex_lock(&codec->spdif_mutex);
+ spdif = snd_hda_spdif_out_of_nid(codec, cvt_nid);
+ non_pcm = !!(spdif->status & IEC958_AES0_NONAUDIO);
+ mutex_unlock(&codec->spdif_mutex);
eld = &spec->pins[pin_idx].sink_eld;
if (!eld->monitor_present)
@@ -750,12 +775,14 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx,
"pin=%d channels=%d\n",
pin_nid,
channels);
- hdmi_setup_channel_mapping(codec, pin_nid, ca);
+ hdmi_setup_channel_mapping(codec, pin_nid, cvt_nid, non_pcm, ca);
hdmi_stop_infoframe_trans(codec, pin_nid);
hdmi_fill_audio_infoframe(codec, pin_nid,
ai.bytes, sizeof(ai));
hdmi_start_infoframe_trans(codec, pin_nid);
}
+
+ per_cvt->non_pcm = non_pcm;
}
@@ -1077,6 +1104,7 @@ static int hdmi_add_cvt(struct hda_codec *codec, hda_nid_t cvt_nid)
per_cvt->cvt_nid = cvt_nid;
per_cvt->channels_min = 2;
+ per_cvt->non_pcm = false;
if (chans <= 16)
per_cvt->channels_max = chans;
@@ -1164,7 +1192,7 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
hdmi_set_channel_count(codec, cvt_nid, substream->runtime->channels);
- hdmi_setup_audio_infoframe(codec, pin_idx, substream);
+ hdmi_setup_audio_infoframe(codec, pin_idx, cvt_nid, substream);
pinctl = snd_hda_codec_read(codec, pin_nid, 0,
AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/3] ALSA: HDMI - Setup channel mapping for non_pcm audio
2012-09-06 2:02 [PATCH 0/3] HDMI HBR(High Bit Rate) Feature bug fix for Intel's Chips Wang Xingchao
2012-09-06 2:02 ` [PATCH 1/3] ALSA: HDMI - Fix channel_allocation array wrong order Wang Xingchao
2012-09-06 2:02 ` [PATCH 2/3] ALSA: HDMI - Enable HBR feature on Intel chips Wang Xingchao
@ 2012-09-06 2:02 ` Wang Xingchao
2012-09-06 6:53 ` [PATCH 0/3] HDMI HBR(High Bit Rate) Feature bug fix for Intel's Chips Takashi Iwai
3 siblings, 0 replies; 10+ messages in thread
From: Wang Xingchao @ 2012-09-06 2:02 UTC (permalink / raw)
To: alsa-devel; +Cc: tiwai, anssi.hannula, alanwww1, fengguang.wu, Wang Xingchao
For HBR stream test, use straight channel mapping way.
when switched back to "speaker-test -c8", even the audio
infoframe is up-to-date, there should be correct channel mapping setup.
Signed-off-by: Wang Xingchao <xingchao.wang@intel.com>
---
sound/pci/hda/patch_hdmi.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index a87f8b2..bcb0939 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -780,6 +780,11 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx,
hdmi_fill_audio_infoframe(codec, pin_nid,
ai.bytes, sizeof(ai));
hdmi_start_infoframe_trans(codec, pin_nid);
+ } else {
+ /* For non-pcm audio switch, setup new channel mapping
+ * accordingly */
+ if (per_cvt->non_pcm != non_pcm)
+ hdmi_setup_channel_mapping(codec, pin_nid, cvt_nid, non_pcm, ca);
}
per_cvt->non_pcm = non_pcm;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 0/3] HDMI HBR(High Bit Rate) Feature bug fix for Intel's Chips
2012-09-06 2:02 [PATCH 0/3] HDMI HBR(High Bit Rate) Feature bug fix for Intel's Chips Wang Xingchao
` (2 preceding siblings ...)
2012-09-06 2:02 ` [PATCH 3/3] ALSA: HDMI - Setup channel mapping for non_pcm audio Wang Xingchao
@ 2012-09-06 6:53 ` Takashi Iwai
2012-09-06 16:00 ` Takashi Iwai
3 siblings, 1 reply; 10+ messages in thread
From: Takashi Iwai @ 2012-09-06 6:53 UTC (permalink / raw)
To: Wang Xingchao; +Cc: anssi.hannula, alsa-devel, alanwww1, fengguang.wu
At Thu, 6 Sep 2012 10:02:35 +0800,
Wang Xingchao wrote:
>
> As i have no A/V receiver handy and could not test HBR playback directly, i
> removed the "RFC" type until the patchset was tested and proved working well.
> The patchset was tested on Intel chips and get positive feedback.
>
> Quote from "Øyvind Kvålsvoll <oyvind@kvalsvoll.com>":
> "TrueHD and DTS-MA work fine from XBMC, 2-ch playback also works fine
> from XBMC.
> Channels are all mapped to the right speaker, all 7.1."
>
> Quote from alanwww1:
> "I tested the patches. They work perfectly. I tested it with both DTS Master
> Audio and Dolby Tru HD streams.
> Also tested with speaker-test. Channel mapping was right."
> From: http://forum.xbmc.org/showthread.php?tid=128298&pid=1184574#pid1184574
>
> Maybe there's still potential bug and i will keep on track that.
>
> The idea of this patch comes from Anssi, Big credit to him at first!
> Thanks the guys from XBMC forum which help test the patches.
>
> For people interested to test the patch, please remember to apply another change in
> alsa-lib side, you can refer to the patch detail from XBMC forum:
> http://forum.xbmc.org/showthread.php?tid=128298&pid=1178776#pid1178776
Note that the alsa-lib fix isn't necessarily applied to all systems.
The bug appears only on systems with both SPDIF and HDMI.
In anyway, I applied the kernel patches now. Thanks.
Takashi
>
> I will send that patch to alsa-lib mail-list later.
>
> Changelog:
> * do not touch channel_allocation priority order, use new api to get
> correct channels number
> * use spdif->status to check audio type, pcm or non-pcm
> * create new non_pcm_mapping[] for non_pcm audio in seperate block
> * add non_pcm hdmi_spec_per_cvt to remember previous audio type, used to
> determine whether need a channel mapping update during the pcm/non-pcm
> stream switch with same channel number.
>
>
> Wang Xingchao (3):
> ALSA: HDMI - Fix channel_allocation array wrong order
> ALSA: HDMI - Enable HBR feature on Intel chips
> ALSA: HDMI - Setup channel mapping for non_pcm audio
>
> sound/pci/hda/patch_hdmi.c | 56 ++++++++++++++++++++++++++++++++++++++++----
> 1 file changed, 51 insertions(+), 5 deletions(-)
>
> --
> 1.7.9.5
>
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/3] HDMI HBR(High Bit Rate) Feature bug fix for Intel's Chips
2012-09-06 6:53 ` [PATCH 0/3] HDMI HBR(High Bit Rate) Feature bug fix for Intel's Chips Takashi Iwai
@ 2012-09-06 16:00 ` Takashi Iwai
2012-09-07 1:32 ` Wang, Xingchao
0 siblings, 1 reply; 10+ messages in thread
From: Takashi Iwai @ 2012-09-06 16:00 UTC (permalink / raw)
To: Wang Xingchao; +Cc: anssi.hannula, alsa-devel, alanwww1, fengguang.wu
At Thu, 06 Sep 2012 08:53:53 +0200,
Takashi Iwai wrote:
>
> At Thu, 6 Sep 2012 10:02:35 +0800,
> Wang Xingchao wrote:
> >
> > As i have no A/V receiver handy and could not test HBR playback directly, i
> > removed the "RFC" type until the patchset was tested and proved working well.
> > The patchset was tested on Intel chips and get positive feedback.
> >
> > Quote from "Øyvind Kvålsvoll <oyvind@kvalsvoll.com>":
> > "TrueHD and DTS-MA work fine from XBMC, 2-ch playback also works fine
> > from XBMC.
> > Channels are all mapped to the right speaker, all 7.1."
> >
> > Quote from alanwww1:
> > "I tested the patches. They work perfectly. I tested it with both DTS Master
> > Audio and Dolby Tru HD streams.
> > Also tested with speaker-test. Channel mapping was right."
> > From: http://forum.xbmc.org/showthread.php?tid=128298&pid=1184574#pid1184574
> >
> > Maybe there's still potential bug and i will keep on track that.
> >
> > The idea of this patch comes from Anssi, Big credit to him at first!
> > Thanks the guys from XBMC forum which help test the patches.
> >
> > For people interested to test the patch, please remember to apply another change in
> > alsa-lib side, you can refer to the patch detail from XBMC forum:
> > http://forum.xbmc.org/showthread.php?tid=128298&pid=1178776#pid1178776
>
> Note that the alsa-lib fix isn't necessarily applied to all systems.
> The bug appears only on systems with both SPDIF and HDMI.
>
> In anyway, I applied the kernel patches now. Thanks.
While looking through the code again (and need to rebase my channel
mapping branch), I found that the check of non-PCM should be done to
each pin instead of converter. Basically the setup is done to the
audio infoframe of the pin, so when the driver reconnects to another
converter upon the new option, there might be inconsistency regarding
non-PCM status.
So I applied the patch below in addition now.
Takashi
===
From: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH] ALSA: hda - Move non-PCM check to per_pin in patch_hdmi.c
Recently the check for non-PCM stream state was added to the generic
HDMI driver code. But this check should be done rather to each pin
instead of each converter. Otherwise when a different converter is
assigned at the next open, the audio infoframe can be inconsistent
with the setup using the previous converter.
For fixing this issue, this patch moves the state of the current
non-PCM status from per_cvt to per_pin. (In addition an unused
argument cvt_nid is stripped from hdmi_setup_channel_mapping())
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/pci/hda/patch_hdmi.c | 46 +++++++++++++++++++++++++---------------------
1 file changed, 25 insertions(+), 21 deletions(-)
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 5361298..333d533 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -61,7 +61,6 @@ struct hdmi_spec_per_cvt {
u32 rates;
u64 formats;
unsigned int maxbps;
- bool non_pcm;
};
struct hdmi_spec_per_pin {
@@ -73,6 +72,7 @@ struct hdmi_spec_per_pin {
struct hdmi_eld sink_eld;
struct delayed_work work;
int repoll_count;
+ bool non_pcm;
};
struct hdmi_spec {
@@ -550,7 +550,6 @@ static void hdmi_debug_channel_mapping(struct hda_codec *codec,
static void hdmi_setup_channel_mapping(struct hda_codec *codec,
hda_nid_t pin_nid,
- hda_nid_t cvt_nid,
bool non_pcm,
int ca)
{
@@ -712,27 +711,16 @@ static bool hdmi_infoframe_uptodate(struct hda_codec *codec, hda_nid_t pin_nid,
}
static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx,
- hda_nid_t cvt_nid, struct snd_pcm_substream *substream)
+ bool non_pcm,
+ struct snd_pcm_substream *substream)
{
struct hdmi_spec *spec = codec->spec;
struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx];
- struct hdmi_spec_per_cvt *per_cvt;
- struct hda_spdif_out *spdif;
hda_nid_t pin_nid = per_pin->pin_nid;
int channels = substream->runtime->channels;
struct hdmi_eld *eld;
int ca;
- int cvt_idx;
union audio_infoframe ai;
- bool non_pcm = false;
-
- cvt_idx = cvt_nid_to_cvt_index(spec, cvt_nid);
- per_cvt = &spec->cvts[cvt_idx];
-
- mutex_lock(&codec->spdif_mutex);
- spdif = snd_hda_spdif_out_of_nid(codec, cvt_nid);
- non_pcm = !!(spdif->status & IEC958_AES0_NONAUDIO);
- mutex_unlock(&codec->spdif_mutex);
eld = &spec->pins[pin_idx].sink_eld;
if (!eld->monitor_present)
@@ -775,7 +763,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx,
"pin=%d channels=%d\n",
pin_nid,
channels);
- hdmi_setup_channel_mapping(codec, pin_nid, cvt_nid, non_pcm, ca);
+ hdmi_setup_channel_mapping(codec, pin_nid, non_pcm, ca);
hdmi_stop_infoframe_trans(codec, pin_nid);
hdmi_fill_audio_infoframe(codec, pin_nid,
ai.bytes, sizeof(ai));
@@ -783,11 +771,11 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx,
} else {
/* For non-pcm audio switch, setup new channel mapping
* accordingly */
- if (per_cvt->non_pcm != non_pcm)
- hdmi_setup_channel_mapping(codec, pin_nid, cvt_nid, non_pcm, ca);
+ if (per_pin->non_pcm != non_pcm)
+ hdmi_setup_channel_mapping(codec, pin_nid, non_pcm, ca);
}
- per_cvt->non_pcm = non_pcm;
+ per_pin->non_pcm = non_pcm;
}
@@ -1080,6 +1068,7 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
per_pin = &spec->pins[pin_idx];
per_pin->pin_nid = pin_nid;
+ per_pin->non_pcm = false;
err = hdmi_read_pin_conn(codec, pin_idx);
if (err < 0)
@@ -1109,7 +1098,6 @@ static int hdmi_add_cvt(struct hda_codec *codec, hda_nid_t cvt_nid)
per_cvt->cvt_nid = cvt_nid;
per_cvt->channels_min = 2;
- per_cvt->non_pcm = false;
if (chans <= 16)
per_cvt->channels_max = chans;
@@ -1179,6 +1167,19 @@ static char *get_hdmi_pcm_name(int idx)
return &names[idx][0];
}
+static bool check_non_pcm_per_cvt(struct hda_codec *codec, hda_nid_t cvt_nid)
+{
+ struct hda_spdif_out *spdif;
+ bool non_pcm;
+
+ mutex_lock(&codec->spdif_mutex);
+ spdif = snd_hda_spdif_out_of_nid(codec, cvt_nid);
+ non_pcm = !!(spdif->status & IEC958_AES0_NONAUDIO);
+ mutex_unlock(&codec->spdif_mutex);
+ return non_pcm;
+}
+
+
/*
* HDMI callbacks
*/
@@ -1194,10 +1195,13 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
int pin_idx = hinfo_to_pin_index(spec, hinfo);
hda_nid_t pin_nid = spec->pins[pin_idx].pin_nid;
int pinctl;
+ bool non_pcm;
+
+ non_pcm = check_non_pcm_per_cvt(codec, cvt_nid);
hdmi_set_channel_count(codec, cvt_nid, substream->runtime->channels);
- hdmi_setup_audio_infoframe(codec, pin_idx, cvt_nid, substream);
+ hdmi_setup_audio_infoframe(codec, pin_idx, non_pcm, substream);
pinctl = snd_hda_codec_read(codec, pin_nid, 0,
AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
--
1.7.11.5
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 0/3] HDMI HBR(High Bit Rate) Feature bug fix for Intel's Chips
2012-09-06 16:00 ` Takashi Iwai
@ 2012-09-07 1:32 ` Wang, Xingchao
0 siblings, 0 replies; 10+ messages in thread
From: Wang, Xingchao @ 2012-09-07 1:32 UTC (permalink / raw)
To: Takashi Iwai
Cc: anssi.hannula@iki.fi, alsa-devel@alsa-project.org,
alanwww1@xbmc.org, Wu, Fengguang
> -----Original Message-----
> From: Takashi Iwai [mailto:tiwai@suse.de]
> Sent: Friday, September 07, 2012 12:00 AM
> To: Wang, Xingchao
> Cc: alsa-devel@alsa-project.org; anssi.hannula@iki.fi; alanwww1@xbmc.org;
> Wu, Fengguang
> Subject: Re: [PATCH 0/3] HDMI HBR(High Bit Rate) Feature bug fix for Intel's
> Chips
>
> At Thu, 06 Sep 2012 08:53:53 +0200,
> Takashi Iwai wrote:
> >
> > At Thu, 6 Sep 2012 10:02:35 +0800,
> > Wang Xingchao wrote:
> > >
> > > As i have no A/V receiver handy and could not test HBR playback
> > > directly, i removed the "RFC" type until the patchset was tested and proved
> working well.
> > > The patchset was tested on Intel chips and get positive feedback.
> > >
> > > Quote from "Øyvind Kvålsvoll <oyvind@kvalsvoll.com>":
> > > "TrueHD and DTS-MA work fine from XBMC, 2-ch playback also works
> > > fine from XBMC.
> > > Channels are all mapped to the right speaker, all 7.1."
> > >
> > > Quote from alanwww1:
> > > "I tested the patches. They work perfectly. I tested it with both
> > > DTS Master Audio and Dolby Tru HD streams.
> > > Also tested with speaker-test. Channel mapping was right."
> > > From:
> > >
> http://forum.xbmc.org/showthread.php?tid=128298&pid=1184574#pid11845
> > > 74
> > >
> > > Maybe there's still potential bug and i will keep on track that.
> > >
> > > The idea of this patch comes from Anssi, Big credit to him at first!
> > > Thanks the guys from XBMC forum which help test the patches.
> > >
> > > For people interested to test the patch, please remember to apply
> > > another change in alsa-lib side, you can refer to the patch detail from XBMC
> forum:
> > >
> http://forum.xbmc.org/showthread.php?tid=128298&pid=1178776#pid11787
> > > 76
> >
> > Note that the alsa-lib fix isn't necessarily applied to all systems.
> > The bug appears only on systems with both SPDIF and HDMI.
> >
> > In anyway, I applied the kernel patches now. Thanks.
>
> While looking through the code again (and need to rebase my channel mapping
> branch), I found that the check of non-PCM should be done to each pin instead
> of converter. Basically the setup is done to the audio infoframe of the pin, so
> when the driver reconnects to another converter upon the new option, there
> might be inconsistency regarding non-PCM status.
>
> So I applied the patch below in addition now.
Looks better now, Thanks Takashi.
--xingchao
>
>
> Takashi
>
> ===
>
> From: Takashi Iwai <tiwai@suse.de>
> Subject: [PATCH] ALSA: hda - Move non-PCM check to per_pin in patch_hdmi.c
>
> Recently the check for non-PCM stream state was added to the generic HDMI
> driver code. But this check should be done rather to each pin instead of each
> converter. Otherwise when a different converter is assigned at the next open,
> the audio infoframe can be inconsistent with the setup using the previous
> converter.
>
> For fixing this issue, this patch moves the state of the current non-PCM status
> from per_cvt to per_pin. (In addition an unused argument cvt_nid is stripped
> from hdmi_setup_channel_mapping())
>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
> sound/pci/hda/patch_hdmi.c | 46
> +++++++++++++++++++++++++---------------------
> 1 file changed, 25 insertions(+), 21 deletions(-)
>
> diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index
> 5361298..333d533 100644
> --- a/sound/pci/hda/patch_hdmi.c
> +++ b/sound/pci/hda/patch_hdmi.c
> @@ -61,7 +61,6 @@ struct hdmi_spec_per_cvt {
> u32 rates;
> u64 formats;
> unsigned int maxbps;
> - bool non_pcm;
> };
>
> struct hdmi_spec_per_pin {
> @@ -73,6 +72,7 @@ struct hdmi_spec_per_pin {
> struct hdmi_eld sink_eld;
> struct delayed_work work;
> int repoll_count;
> + bool non_pcm;
> };
>
> struct hdmi_spec {
> @@ -550,7 +550,6 @@ static void hdmi_debug_channel_mapping(struct
> hda_codec *codec,
>
> static void hdmi_setup_channel_mapping(struct hda_codec *codec,
> hda_nid_t pin_nid,
> - hda_nid_t cvt_nid,
> bool non_pcm,
> int ca)
> {
> @@ -712,27 +711,16 @@ static bool hdmi_infoframe_uptodate(struct
> hda_codec *codec, hda_nid_t pin_nid, }
>
> static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx,
> - hda_nid_t cvt_nid, struct snd_pcm_substream
> *substream)
> + bool non_pcm,
> + struct snd_pcm_substream *substream)
> {
> struct hdmi_spec *spec = codec->spec;
> struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx];
> - struct hdmi_spec_per_cvt *per_cvt;
> - struct hda_spdif_out *spdif;
> hda_nid_t pin_nid = per_pin->pin_nid;
> int channels = substream->runtime->channels;
> struct hdmi_eld *eld;
> int ca;
> - int cvt_idx;
> union audio_infoframe ai;
> - bool non_pcm = false;
> -
> - cvt_idx = cvt_nid_to_cvt_index(spec, cvt_nid);
> - per_cvt = &spec->cvts[cvt_idx];
> -
> - mutex_lock(&codec->spdif_mutex);
> - spdif = snd_hda_spdif_out_of_nid(codec, cvt_nid);
> - non_pcm = !!(spdif->status & IEC958_AES0_NONAUDIO);
> - mutex_unlock(&codec->spdif_mutex);
>
> eld = &spec->pins[pin_idx].sink_eld;
> if (!eld->monitor_present)
> @@ -775,7 +763,7 @@ static void hdmi_setup_audio_infoframe(struct
> hda_codec *codec, int pin_idx,
> "pin=%d channels=%d\n",
> pin_nid,
> channels);
> - hdmi_setup_channel_mapping(codec, pin_nid, cvt_nid, non_pcm,
> ca);
> + hdmi_setup_channel_mapping(codec, pin_nid, non_pcm, ca);
> hdmi_stop_infoframe_trans(codec, pin_nid);
> hdmi_fill_audio_infoframe(codec, pin_nid,
> ai.bytes, sizeof(ai));
> @@ -783,11 +771,11 @@ static void hdmi_setup_audio_infoframe(struct
> hda_codec *codec, int pin_idx,
> } else {
> /* For non-pcm audio switch, setup new channel mapping
> * accordingly */
> - if (per_cvt->non_pcm != non_pcm)
> - hdmi_setup_channel_mapping(codec, pin_nid, cvt_nid,
> non_pcm, ca);
> + if (per_pin->non_pcm != non_pcm)
> + hdmi_setup_channel_mapping(codec, pin_nid, non_pcm, ca);
> }
>
> - per_cvt->non_pcm = non_pcm;
> + per_pin->non_pcm = non_pcm;
> }
>
>
> @@ -1080,6 +1068,7 @@ static int hdmi_add_pin(struct hda_codec *codec,
> hda_nid_t pin_nid)
> per_pin = &spec->pins[pin_idx];
>
> per_pin->pin_nid = pin_nid;
> + per_pin->non_pcm = false;
>
> err = hdmi_read_pin_conn(codec, pin_idx);
> if (err < 0)
> @@ -1109,7 +1098,6 @@ static int hdmi_add_cvt(struct hda_codec *codec,
> hda_nid_t cvt_nid)
>
> per_cvt->cvt_nid = cvt_nid;
> per_cvt->channels_min = 2;
> - per_cvt->non_pcm = false;
> if (chans <= 16)
> per_cvt->channels_max = chans;
>
> @@ -1179,6 +1167,19 @@ static char *get_hdmi_pcm_name(int idx)
> return &names[idx][0];
> }
>
> +static bool check_non_pcm_per_cvt(struct hda_codec *codec, hda_nid_t
> +cvt_nid) {
> + struct hda_spdif_out *spdif;
> + bool non_pcm;
> +
> + mutex_lock(&codec->spdif_mutex);
> + spdif = snd_hda_spdif_out_of_nid(codec, cvt_nid);
> + non_pcm = !!(spdif->status & IEC958_AES0_NONAUDIO);
> + mutex_unlock(&codec->spdif_mutex);
> + return non_pcm;
> +}
> +
> +
> /*
> * HDMI callbacks
> */
> @@ -1194,10 +1195,13 @@ static int
> generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
> int pin_idx = hinfo_to_pin_index(spec, hinfo);
> hda_nid_t pin_nid = spec->pins[pin_idx].pin_nid;
> int pinctl;
> + bool non_pcm;
> +
> + non_pcm = check_non_pcm_per_cvt(codec, cvt_nid);
>
> hdmi_set_channel_count(codec, cvt_nid, substream->runtime->channels);
>
> - hdmi_setup_audio_infoframe(codec, pin_idx, cvt_nid, substream);
> + hdmi_setup_audio_infoframe(codec, pin_idx, non_pcm, substream);
>
> pinctl = snd_hda_codec_read(codec, pin_nid, 0,
> AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
> --
> 1.7.11.5
>
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2012-09-07 1:32 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-06 2:02 [PATCH 0/3] HDMI HBR(High Bit Rate) Feature bug fix for Intel's Chips Wang Xingchao
2012-09-06 2:02 ` [PATCH 1/3] ALSA: HDMI - Fix channel_allocation array wrong order Wang Xingchao
2012-09-06 2:02 ` [PATCH 2/3] ALSA: HDMI - Enable HBR feature on Intel chips Wang Xingchao
2012-09-06 2:02 ` [PATCH 3/3] ALSA: HDMI - Setup channel mapping for non_pcm audio Wang Xingchao
2012-09-06 6:53 ` [PATCH 0/3] HDMI HBR(High Bit Rate) Feature bug fix for Intel's Chips Takashi Iwai
2012-09-06 16:00 ` Takashi Iwai
2012-09-07 1:32 ` Wang, Xingchao
-- strict thread matches above, loose matches on Subject: below --
2012-09-05 5:58 Wang Xingchao
2012-09-05 6:30 ` Takashi Iwai
2012-09-05 6:34 ` Wang Xingchao
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).