alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Anssi Hannula <anssi.hannula@iki.fi>
To: Andre Heider <a.heider@gmail.com>
Cc: "Takashi Iwai" <tiwai@suse.de>,
	alsa-devel@alsa-project.org,
	"Peter Frühberger" <fritsch@xbmc.org>
Subject: Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
Date: Mon, 28 Oct 2013 22:35:56 +0200	[thread overview]
Message-ID: <526ECAAC.306@iki.fi> (raw)
In-Reply-To: <20131028183554.GB70502@localhost>

[-- Attachment #1: Type: text/plain, Size: 2929 bytes --]

28.10.2013 20:35, Andre Heider kirjoitti:
> On Mon, Oct 28, 2013 at 08:25:22PM +0200, Anssi Hannula wrote:
>> 28.10.2013 20:17, Andre Heider kirjoitti:
>>> On Mon, Oct 28, 2013 at 08:12:43PM +0200, Anssi Hannula wrote:
>>>> 28.10.2013 19:52, Andre Heider kirjoitti:
>>>>> On Fri, Oct 25, 2013 at 08:23:48PM +0300, Anssi Hannula wrote:
>>>>>> 25.10.2013 19:54, Andre Heider kirjoitti:
>>>>>>> cat /proc/asound/card0/eld\#0.0
>>>>>>> 	monitor_present		1
>>>>>>> 	eld_valid		0
>>>>>>
>>>>>> However, this should have eld_valid=1 and contain more info. To get a
>>>>>> hint on whether it is a bug in audio or video driver, could you give a
>>>>>> log with CONFIG_SND_DEBUG ?
>>>>>>
>>>>>> AFAICS the sound git master tree should have the necessary support in
>>>>>> the radeon video driver to allow the audio driver to generate a valid
>>>>>> ELD with your card.
>>>>>
>>>>> With CONFIG_SND_DEBUG=y I get a bunch of
>>>>> "HDMI ATI/AMD: no speaker allocation for ELD"
>>>>> but afaics that's about it.
>>>>
>>>> Thanks, that is exactly what I was looking for.
>>>>
>>>> Looks like a radeon driver issue - it does not seem to setup the speaker
>>>> allocation registers properly (so that ALSA could read them from there),
>>>> and I verified that the EDID you posted has a valid speaker allocation
>>>> byte 0x4f.
>>>>
>>>> Just to recheck - you are running sound git master, or something else?
>>>
>>> This is from 3.12-rc7 with today's sound/master (3fbdaf9b) merged on top.
>>>
>>
>> Ah, OK, that certainly explains it. 3.12-x has this one:
>> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/gpu/drm/radeon?id=555b1b651acf44bf27ebbb04235d38a8fd2d58dc
>>
>> Could you revert that for testing, just to see if you get proper ELD
>> info then?
> 
> Blergh, guess that's my fault for not just using sound/master.
> 
> But that looks better:
> 
> cat /proc/asound/card0/eld\#0.0
> 	monitor_present		1
> 	eld_valid		1
> 	monitor_name		
> 	connection_type		HDMI
> 	eld_version		[0x2] CEA-861D or below
> 	edid_version		[0x0] no CEA EDID Timing Extension block present
> 	manufacture_id		0x0
> 	product_id		0x0
> 	port_id			0x0
> 	support_hdcp		0
> 	support_ai		0
> 	audio_sync_delay	0
> 	speakers		[0x4f] FL/FR LFE FC RL/RR RLC/RRC
> 	sad_count		4
> 	sad0_coding_type	[0x1] LPCM
> 	sad0_channels		2
> 	sad0_rates		[0x1ee0] 32000 44100 48000 88200 96000 176400 192000
> 	sad0_bits		[0xe0000] 16 20 24

Thanks.

Hmm, seems we have bug in the radeon driver, we are missing the
8-channel PCM SAD here.

Can you try the attached patch?

> 	sad1_coding_type	[0x2] AC-3
> 	sad1_channels		8
> 	sad1_rates		[0xe0] 32000 44100 48000
> 	sad1_max_bitrate	640000
> 	sad2_coding_type	[0x6] AAC-LC
> 	sad2_channels		8
> 	sad2_rates		[0xe0] 32000 44100 48000
> 	sad2_max_bitrate	640000
> 	sad3_coding_type	[0x7] DTS
> 	sad3_channels		8
> 	sad3_rates		[0xe0] 32000 44100 48000
> 	sad3_max_bitrate	1536000


-- 
Anssi Hannula

[-- Attachment #2: 0001-drm-radeon-audio-fix-missing-multichannel-PCM-SAD-in.patch --]
[-- Type: text/x-patch, Size: 4961 bytes --]

>From e9b1708c50a5679eabf0af9489b1a3265e2081bb Mon Sep 17 00:00:00 2001
From: Anssi Hannula <anssi.hannula@iki.fi>
Date: Mon, 28 Oct 2013 22:18:10 +0200
Subject: [PATCH] drm/radeon/audio: fix missing multichannel PCM SAD in some
 cases

The current code writing SADs to the audio registers seems to assume
that there is at most a single SAD per audio format.

However, that is not the case. Especially for PCM it is somewhat common
for sinks to have two SADs, one for 8-channel and one for 2-channel
audio, which may have different supported sample rates (i.e. the sink
supports stereo audio at higher sample rates than multichannel audio).
While multiple SADs per non-PCM audio format is also allowed, I have not
seen this and it would indeed not be useful in normal circumstances.

Because of this, only the 2-channel SAD may be used if it appears before
the 8-channel SAD.

Fix the code to pick the PCM SAD with the highest number of channels,
while merging the rate masks of PCM SADs with lower amount of channels
into the stereo rate mask.

Reported-by: Andre Heider <a.heider@gmail.com>
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>

---
 drivers/gpu/drm/radeon/dce6_afmt.c      | 20 +++++++++++++++-----
 drivers/gpu/drm/radeon/evergreen_hdmi.c | 20 +++++++++++++++-----
 drivers/gpu/drm/radeon/r600_hdmi.c      | 20 +++++++++++++++-----
 3 files changed, 45 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/radeon/dce6_afmt.c b/drivers/gpu/drm/radeon/dce6_afmt.c
index 85a69d2..0a0fcee 100644
--- a/drivers/gpu/drm/radeon/dce6_afmt.c
+++ b/drivers/gpu/drm/radeon/dce6_afmt.c
@@ -198,20 +198,30 @@ void dce6_afmt_write_sad_regs(struct drm_encoder *encoder)
 
 	for (i = 0; i < ARRAY_SIZE(eld_reg_to_type); i++) {
 		u32 value = 0;
+		u8 stereo_freqs = 0;
+		int max_channels = -1;
 		int j;
 
 		for (j = 0; j < sad_count; j++) {
 			struct cea_sad *sad = &sads[j];
 
 			if (sad->format == eld_reg_to_type[i][1]) {
-				value = MAX_CHANNELS(sad->channels) |
-					DESCRIPTOR_BYTE_2(sad->byte2) |
-					SUPPORTED_FREQUENCIES(sad->freq);
+				if (sad->channels > max_channels) {
+					value = MAX_CHANNELS(sad->channels) |
+						DESCRIPTOR_BYTE_2(sad->byte2) |
+						SUPPORTED_FREQUENCIES(sad->freq);
+					max_channels = sad->channels;
+				}
+
 				if (sad->format == HDMI_AUDIO_CODING_TYPE_PCM)
-					value |= SUPPORTED_FREQUENCIES_STEREO(sad->freq);
-				break;
+					stereo_freqs |= sad->freq;
+				else
+					break;
 			}
 		}
+
+		value |= SUPPORTED_FREQUENCIES_STEREO(stereo_freqs);
+
 		WREG32_ENDPOINT(offset, eld_reg_to_type[i][0], value);
 	}
 
diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c
index f71ce39..2a4837d 100644
--- a/drivers/gpu/drm/radeon/evergreen_hdmi.c
+++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c
@@ -139,20 +139,30 @@ static void evergreen_hdmi_write_sad_regs(struct drm_encoder *encoder)
 
 	for (i = 0; i < ARRAY_SIZE(eld_reg_to_type); i++) {
 		u32 value = 0;
+		u8 stereo_freqs = 0;
+		int max_channels = -1;
 		int j;
 
 		for (j = 0; j < sad_count; j++) {
 			struct cea_sad *sad = &sads[j];
 
 			if (sad->format == eld_reg_to_type[i][1]) {
-				value = MAX_CHANNELS(sad->channels) |
-					DESCRIPTOR_BYTE_2(sad->byte2) |
-					SUPPORTED_FREQUENCIES(sad->freq);
+				if (sad->channels > max_channels) {
+					value = MAX_CHANNELS(sad->channels) |
+						DESCRIPTOR_BYTE_2(sad->byte2) |
+						SUPPORTED_FREQUENCIES(sad->freq);
+					max_channels = sad->channels;
+				}
+
 				if (sad->format == HDMI_AUDIO_CODING_TYPE_PCM)
-					value |= SUPPORTED_FREQUENCIES_STEREO(sad->freq);
-				break;
+					stereo_freqs |= sad->freq;
+				else
+					break;
 			}
 		}
+
+		value |= SUPPORTED_FREQUENCIES_STEREO(stereo_freqs);
+
 		WREG32(eld_reg_to_type[i][0], value);
 	}
 
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c
index f443010..da5cfa4 100644
--- a/drivers/gpu/drm/radeon/r600_hdmi.c
+++ b/drivers/gpu/drm/radeon/r600_hdmi.c
@@ -364,20 +364,30 @@ static void dce3_2_afmt_write_sad_regs(struct drm_encoder *encoder)
 
 	for (i = 0; i < ARRAY_SIZE(eld_reg_to_type); i++) {
 		u32 value = 0;
+		u8 stereo_freqs = 0;
+		int max_channels = -1;
 		int j;
 
 		for (j = 0; j < sad_count; j++) {
 			struct cea_sad *sad = &sads[j];
 
 			if (sad->format == eld_reg_to_type[i][1]) {
-				value = MAX_CHANNELS(sad->channels) |
-					DESCRIPTOR_BYTE_2(sad->byte2) |
-					SUPPORTED_FREQUENCIES(sad->freq);
+				if (sad->channels > max_channels) {
+					value = MAX_CHANNELS(sad->channels) |
+						DESCRIPTOR_BYTE_2(sad->byte2) |
+						SUPPORTED_FREQUENCIES(sad->freq);
+					max_channels = sad->channels;
+				}
+
 				if (sad->format == HDMI_AUDIO_CODING_TYPE_PCM)
-					value |= SUPPORTED_FREQUENCIES_STEREO(sad->freq);
-				break;
+					stereo_freqs |= sad->freq;
+				else
+					break;
 			}
 		}
+
+		value |= SUPPORTED_FREQUENCIES_STEREO(stereo_freqs);
+
 		WREG32(eld_reg_to_type[i][0], value);
 	}
 
-- 
1.8.1.5


[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



  reply	other threads:[~2013-10-28 20:36 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-24 18:10 [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support Anssi Hannula
2013-10-24 18:10 ` [PATCH 1/5] ALSA: hda - hdmi: Allow HDA patches to customize more operations Anssi Hannula
2013-10-24 18:10 ` [PATCH 2/5] ALSA: hda - hdmi: Add ATI/AMD multi-channel audio support Anssi Hannula
2013-10-24 18:10 ` [PATCH 3/5] ALSA: hda - hdmi: Add ELD emulation for ATI/AMD codecs Anssi Hannula
2013-10-24 18:10 ` [PATCH 4/5] ALSA: hda - hdmi: Add HBR bitstreaming support for ATI/AMD HDMI codecs Anssi Hannula
2013-10-24 18:10 ` [PATCH 5/5] ALSA: hda - hdmi: Disable ramp-up/down for non-PCM on AMD codecs Anssi Hannula
2013-10-24 19:00   ` Anssi Hannula
2013-10-24 18:26 ` [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support Anssi Hannula
2013-11-08  5:08   ` Olivier Langlois
2013-11-08 10:27     ` Anssi Hannula
2013-11-08 18:17       ` Olivier Langlois
2013-11-08 21:28         ` Olivier Langlois
2013-11-08 22:03           ` Anssi Hannula
2013-11-10  5:42             ` Olivier Langlois
2013-11-10  6:01               ` Anssi Hannula
2013-11-10  7:25                 ` speaker-test chmap bugs (was: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support) Anssi Hannula
2013-11-10 18:29                   ` [PATCH 1/3] speaker-test: Fix chmapped channel selection without specified chmap Anssi Hannula
2013-11-10 18:29                     ` [PATCH 2/3] speaker-test: Always show chmap channel names if available Anssi Hannula
2013-11-10 18:29                     ` [PATCH 3/3] speaker-test: Show out-of-chmap channels as Unknown Anssi Hannula
2013-11-11 15:56                     ` [PATCH 1/3] speaker-test: Fix chmapped channel selection without specified chmap Takashi Iwai
2013-11-11 20:23                       ` Anssi Hannula
2013-11-11 22:04                         ` [PATCH 1/3 v2] " Anssi Hannula
2013-11-12  8:11                           ` Takashi Iwai
2013-11-12 12:34                             ` Anssi Hannula
2013-11-12 13:08                               ` Takashi Iwai
2013-11-12  6:35                 ` [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support Olivier Langlois
2013-11-14  0:04                   ` Anssi Hannula
2013-11-09  8:35         ` Takashi Iwai
2013-10-24 23:04 ` Takashi Iwai
2013-10-25 16:54   ` Andre Heider
2013-10-25 17:13     ` Takashi Iwai
2013-10-25 17:23     ` Anssi Hannula
2013-10-25 18:25       ` Andre Heider
2013-10-28 17:52       ` Andre Heider
2013-10-28 18:12         ` Anssi Hannula
2013-10-28 18:17           ` Andre Heider
2013-10-28 18:25             ` Anssi Hannula
2013-10-28 18:35               ` Andre Heider
2013-10-28 20:35                 ` Anssi Hannula [this message]
2013-10-28 22:00                   ` Andre Heider
2013-10-28 22:42                     ` Anssi Hannula
2013-10-28 23:15                       ` Andre Heider
2013-10-29 19:52                         ` LANGLOIS Olivier PIS -EXT
2013-10-29 20:30                           ` Anssi Hannula
2013-10-28 23:19                       ` [PATCH] drm/radeon/audio: fix missing multichannel PCM SAD in some cases Anssi Hannula
2013-10-31 23:38                         ` Rafał Miłecki
2013-10-31 23:46                           ` Rafał Miłecki
2013-10-31 23:52                           ` Anssi Hannula
2013-11-02  1:01                         ` Rafał Miłecki
2013-11-02  1:08                           ` Anssi Hannula
2013-11-02  1:15                             ` Rafał Miłecki
2013-11-02  1:03                         ` Rafał Miłecki
2013-11-02 15:32 ` [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support Anssi Hannula
2013-11-23  1:05 ` James Le Cuirot
2013-11-23  1:29   ` Anssi Hannula
2013-11-23 15:40     ` James Le Cuirot
2013-11-23 15:45       ` Anssi Hannula
2013-11-24 14:57         ` James Le Cuirot
2013-11-25 13:20           ` Anssi Hannula
2013-11-25 14:32             ` James Le Cuirot
2013-11-25 14:56               ` Anssi Hannula
2014-05-13 12:01                 ` James Le Cuirot
2014-05-13 12:27                   ` Anssi Hannula
2014-05-13 16:16                     ` James Le Cuirot
2014-05-13 21:10                       ` James Le Cuirot
2014-05-13 21:50                         ` Anssi Hannula
2014-05-14 13:04                           ` Deucher, Alexander
2014-05-14 13:19                             ` James Le Cuirot
2013-11-25 15:07   ` Raymond Yau
2013-11-25 15:32     ` James Le Cuirot
2013-11-25 19:35     ` Anssi Hannula

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=526ECAAC.306@iki.fi \
    --to=anssi.hannula@iki.fi \
    --cc=a.heider@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=fritsch@xbmc.org \
    --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).