Skip to contentSkip to conversation

ALSA: hda - Set channels count for HBR format

PATCH In review Wang Xingchao 2 participants 5 messages Aug 7, 2012 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: hda - Set channels count for HBR format

If it's HBR format, the channels count should be 8.

---
 sound/pci/hda/patch_hdmi.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
sound/pci/hda/patch_hdmi.c +5 -2
index ad319d4..ae4e67e 100644
@@ -1153,8 +1153,11 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
 	struct hdmi_spec *spec = codec->spec;
 	int pin_idx = hinfo_to_pin_index(spec, hinfo);
 	hda_nid_t pin_nid = spec->pins[pin_idx].pin_nid;
-
-	hdmi_set_channel_count(codec, cvt_nid, substream->runtime->channels);
+
+	if (is_hbr_format(format))
+		hdmi_set_channel_count(codec, cvt_nid, 8);
+	else
+		hdmi_set_channel_count(codec, cvt_nid, substream->runtime->channels);
 
 	hdmi_setup_audio_infoframe(codec, pin_idx, substream);
 
Signature · 1 line
1.7.9.5
#1 lore raw

At Tue, 7 Aug 2012 15:20:22 +0800,

Quoted 2 lines · Wang Xingchao

If it's HBR format, the channels count should be 8.

But channels count is practically always 8 when is_hbr_format() is true, no? The format value is calculated from runtime->channels.

Or do you see a real problem?

thanks,

Takashi

Quoted 27 lines
---
 sound/pci/hda/patch_hdmi.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
sound/pci/hda/patch_hdmi.c +5 -2
index ad319d4..ae4e67e 100644
@@ -1153,8 +1153,11 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
 	struct hdmi_spec *spec = codec->spec;
 	int pin_idx = hinfo_to_pin_index(spec, hinfo);
 	hda_nid_t pin_nid = spec->pins[pin_idx].pin_nid;
-
-	hdmi_set_channel_count(codec, cvt_nid, substream->runtime->channels);
+
+	if (is_hbr_format(format))
+		hdmi_set_channel_count(codec, cvt_nid, 8);
+	else
+		hdmi_set_channel_count(codec, cvt_nid, substream->runtime->channels);
 
 	hdmi_setup_audio_infoframe(codec, pin_idx, substream);
 
Signature · 1 line
1.7.9.5
#2 lore raw
In reply to Wang Xingchao

Hi Takashi,

When test HBR feature, unless specify the channel number in command line(as below), alsa will be confused about the real channel number.

aplay -D hdmi:DEV=1,AES0=0x06 -c8 -fs16_le -r192000 testi.dtshd.20120730.ma-71-24.spdif

If the HBR stream is gone through pulseaudio(regarded as passthrough), the channels number is faked.

Thanks
--xingchao

Quoted 42 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Wang Xingchao
Sent: Tuesday, August 07, 2012 3:20 PM
To: [email protected]; [email protected]
Cc: Wang, Xingchao
Subject: [alsa-devel] [PATCH] ALSA: hda - Set channels count for HBR format

If it's HBR format, the channels count should be 8.

---
 sound/pci/hda/patch_hdmi.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
sound/pci/hda/patch_hdmi.c index renamed from sound/pci/hda/patch_hdmi.c +0 -0

ad319d4..ae4e67e 100644

sound/pci/hda/patch_hdmi.c +5 -2
@@ -1153,8 +1153,11 @@ static int
 generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
 	struct hdmi_spec *spec = codec->spec;
 	int pin_idx = hinfo_to_pin_index(spec, hinfo);
 	hda_nid_t pin_nid = spec->pins[pin_idx].pin_nid;
-
-	hdmi_set_channel_count(codec, cvt_nid, substream->runtime->channels);
+
+	if (is_hbr_format(format))
+		hdmi_set_channel_count(codec, cvt_nid, 8);
+	else
+		hdmi_set_channel_count(codec, cvt_nid,
 substream->runtime->channels);
 

hdmi_setup_audio_infoframe(codec, pin_idx, substream);

--
1.7.9.5

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#3 lore raw

At Tue, 7 Aug 2012 07:40:40 +0000,

Quoted 6 lines · Xingchao

Hi Takashi,

When test HBR feature, unless specify the channel number in command line(as below), alsa will be confused about the real channel number.

aplay -D hdmi:DEV=1,AES0=0x06 -c8 -fs16_le -r192000 testi.dtshd.20120730.ma-71-24.spdif

But is_hbr_format() assumes the channels must be 8.

#define is_hbr_format(format) \
	((format & AC_FMT_TYPE_NON_PCM) && (format & AC_FMT_CHAN_MASK) == 7)

where format value is computed from runtime->channels in snd_hda_calc_stream_format().

So, passing anything else than 8 is simply invalid as HBR.

Quoted 1 line

If the HBR stream is gone through pulseaudio(regarded as passthrough), the channels number is faked.

That is, this is simply a wrong operation.

Takashi

Quoted 47 lines

Thanks
--xingchao

Quoted 42 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Wang Xingchao
Sent: Tuesday, August 07, 2012 3:20 PM
To: [email protected]; [email protected]
Cc: Wang, Xingchao
Subject: [alsa-devel] [PATCH] ALSA: hda - Set channels count for HBR format

If it's HBR format, the channels count should be 8.

---
 sound/pci/hda/patch_hdmi.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
sound/pci/hda/patch_hdmi.c index renamed from sound/pci/hda/patch_hdmi.c +0 -0

ad319d4..ae4e67e 100644

sound/pci/hda/patch_hdmi.c +5 -2
@@ -1153,8 +1153,11 @@ static int
 generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
 	struct hdmi_spec *spec = codec->spec;
 	int pin_idx = hinfo_to_pin_index(spec, hinfo);
 	hda_nid_t pin_nid = spec->pins[pin_idx].pin_nid;
-
-	hdmi_set_channel_count(codec, cvt_nid, substream->runtime->channels);
+
+	if (is_hbr_format(format))
+		hdmi_set_channel_count(codec, cvt_nid, 8);
+	else
+		hdmi_set_channel_count(codec, cvt_nid,
 substream->runtime->channels);
 

hdmi_setup_audio_infoframe(codec, pin_idx, substream);

--
1.7.9.5

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#4 lore raw
Quoted 21 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Takashi Iwai
Sent: Tuesday, August 07, 2012 3:50 PM
To: Wang, Xingchao
Cc: [email protected]
Subject: Re: [alsa-devel] [PATCH] ALSA: hda - Set channels count for HBR format

At Tue, 7 Aug 2012 07:40:40 +0000,

Quoted 4 lines · Xingchao

Hi Takashi,

When test HBR feature, unless specify the channel number in command

line(as below), alsa will be confused about the real channel number.

Quoted 3 lines

aplay -D hdmi:DEV=1,AES0=0x06 -c8 -fs16_le -r192000 testi.dtshd.20120730.ma-71-24.spdif

Quoted 8 lines

But is_hbr_format() assumes the channels must be 8.

#define is_hbr_format(format) \
	((format & AC_FMT_TYPE_NON_PCM) && (format &

AC_FMT_CHAN_MASK) == 7)

where format value is computed from runtime->channels in snd_hda_calc_stream_format().

Oh yes, thanks for clarification, I did not read this code carefully. :)
I thought the case without setting channels number as 8 from pulseaudio and it's HBR stream in fact.

I've not test HBR stream playback from pulseaduio pass-through mode yet, when that happen and I will Write a new patch then.

So this patch is redundant, just ignore it.

Thanks
--xingchao

Quoted 64 lines

So, passing anything else than 8 is simply invalid as HBR.

Quoted 1 line

If the HBR stream is gone through pulseaudio(regarded as passthrough), the

channels number is faked.

That is, this is simply a wrong operation.

Takashi

Quoted 41 lines

Thanks
--xingchao

Quoted 37 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Wang Xingchao
Sent: Tuesday, August 07, 2012 3:20 PM
To: [email protected]; [email protected]
Cc: Wang, Xingchao
Subject: [alsa-devel] [PATCH] ALSA: hda - Set channels count for HBR format

If it's HBR format, the channels count should be 8.

---
 sound/pci/hda/patch_hdmi.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
sound/pci/hda/patch_hdmi.c +5 -2
index ad319d4..ae4e67e 100644
@@ -1153,8 +1153,11 @@ static int
 generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
 	struct hdmi_spec *spec = codec->spec;
 	int pin_idx = hinfo_to_pin_index(spec, hinfo);
 	hda_nid_t pin_nid = spec->pins[pin_idx].pin_nid;
-
-	hdmi_set_channel_count(codec, cvt_nid, substream->runtime->channels);
+
+	if (is_hbr_format(format))
+		hdmi_set_channel_count(codec, cvt_nid, 8);
+	else
+		hdmi_set_channel_count(codec, cvt_nid,
 substream->runtime->channels);
 

hdmi_setup_audio_infoframe(codec, pin_idx, substream);

Quoted 8 lines
Quoted 7 lines

--
1.7.9.5

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel