Bug 85241

Summary: audio over HDMI on AMD E-350 with radeon driver
Product: Drivers Reporter: wmyrda (wmyrda)
Component: Video(DRI - non Intel)Assignee: drivers_video-dri
Status: NEW ---    
Severity: normal CC: alexdeucher, mirh, serega.belarus, szg00000
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 3.14 and higher Subsystem:
Regression: Yes Bisected commit-id:
Attachments: TV was attached before booting.

Description wmyrda 2014-09-28 14:36:05 UTC
I have problem with HDMI and audio on my Asus AMD E-350 platform which started around kernel 3.14 with sigle error message "[drm:dce4_afmt_write_speaker_allocation] *ERROR* Couldn't read Speaker Allocation Data Block: 0" which become even more severe with kernels 3.15 & 3.16 as now logs are flooded with "sound hdaudioC0D0: HDMI ATI/AMD: no speaker allocation for ELD"

My setup is PC with Asus E-350 connected directly to the TV with HDMI cable (it has been in the past to the 5.1 analog system hence the entry of "options snd-hda-intel model=3stack-6ch-dig" in /etc/modprobe.d/alsa.conf)

on software side it is Gentoo with
libdrm & mesa & xf86-video-ati --- git versions updated on the regular basis about every 1-2 weeks
pulseaudio 5.0
xorg 1.16.1

here are some logs. If more info is needed please let me know

dmesg 3.14.19
http://pastebin.com/AHyV1nRk
Xorg.0.log
http://pastebin.com/J66tUcU5

audio 3.16.3
http://www.alsa-project.org/db/?f=7e2075...92b0b5c23e
audio 3.15.10
http://www.alsa-project.org/db/?f=bbb92a...14bd0bc831
audio 3.14.19
http://www.alsa-project.org/db/?f=5d2f93...2a7a6697a6
Comment 1 Alex Deucher 2014-09-29 15:00:36 UTC
Are you actually seeing a problem with the audio playback or is this bug strictly about the messaged in the kernel log.  If there is a playback problem, can you bisect to indentify what commit caused the regression?  Also, please attach files directly to this bug rather than using pastebin.  The messages are due to your monitor not providing a speaker allocation block.  I think 3.14 was probably the first kernel were we actually tried to query the monitor for the speaker allocation block from the monitor.  The gfx driver passes this information to the audio driver and the audio driver uses it to properly set up the speaker layout.
Comment 2 wmyrda 2014-10-06 18:21:19 UTC
I do have problem with the sound although it might not be an kernel bug at all, but pulseaudio problem. For past several days I tried to pin point the problem and found that this might be a problem with upgrade to xorg 1.16 and some change that made my systemd startup script fail https://bugs.archlinux.org/task/41391#comment125851 but problem persists even when I do not try to run xbmc/kodi but gdm or lightdm as well. There is huge (about 10min) delay before window manager start due to audio not being initialized properly on the system where audio worked and now when it finally starts without an audio. 

To summarize I am not sure is it kernel problem (with older kernel I just got same issue), but seems be worth a check

PS. an errors in dmesg should play nicer anyways 

"sound hdaudioC0D0: HDMI ATI/AMD: no speaker allocation for ELD" could leave just one message and be more explanatory too perhaps? What is ELD?
Comment 3 Siarhei 2015-07-31 18:57:11 UTC
hi, i can reproduce this bug on two configurations.
That's radeon hd 6320, radeon hd 5650.
kernel version 4.1.3, but tried to load radeon module
compiled from 4.1-rc8, and it presents.

Description:
The actual question is that:
  after just loading radeon module
  there is no sound from monitor
  connected through hdmi wire.
  But after running gdm, or
  to be correct reinitializing driver
  with a help of Xorg based application
  everything comes back. But e.g.
  after suspend/resume cycle it
  again generates incorrect eld.
  As a result dmesg shouts
  NO SPEAKER ALLOCATION FOR ELD

Full text:

it generates eld file

$ cat /proc/asound/card0/eld#0.0
monitor_present		0
eld_valid		0

And hdmi codec

$ cat /proc/asound/card0/codec#0
Codec: ATI R6xx HDMI
Address: 0
AFG Function Id: 0x1 (unsol 0)
Vendor Id: 0x1002aa01
Subsystem Id: 0x00aa0100
Revision Id: 0x100200
No Modem Function Group found
Default PCM:
    rates [0x70]: 32000 44100 48000
    bits [0x2]: 16
    formats [0x1]: PCM
Default Amp-In caps: N/A
Default Amp-Out caps: N/A
State of AFG node 0x01:
  Power states:  D0 D3
  Power: setting=D0, actual=D0
GPIO: io=0, o=0, i=0, unsolicited=0, wake=0
Node 0x02 [Audio Output] wcaps 0x201: Stereo Digital
  Converter: stream=0, channel=0
  Digital: Enabled GenLevel
  Digital category: 0x2
  IEC Coding Type: 0x0
Node 0x03 [Pin Complex] wcaps 0x400381: Stereo Digital
  Control: name="HDMI/DP,pcm=3 Jack", index=0, device=0
  Control: name="IEC958 Playback Con Mask", index=0, device=0
  Control: name="IEC958 Playback Pro Mask", index=0, device=0
  Control: name="IEC958 Playback Default", index=0, device=0
  Control: name="IEC958 Playback Switch", index=0, device=0
  Control: name="ELD", index=0, device=3
  Pincap 0x00000094: OUT Detect HDMI
  Pin Default 0x18560010: [Jack] Digital Out at Int HDMI
    Conn = Digital, Color = Unknown
    DefAssociation = 0x1, Sequence = 0x0
  Pin-ctls: 0x40: OUT
  Unsolicited: tag=01, enabled=1
  Connection: 1
     0x02

As a result dmesg contains:
  snd_hda_codec_hdmi: "HDMI/ATI audio: No speaker allocation for ELD"

Won't describe the experience of such speaker, probably
it has no connection with a real problem.
I'll say only that after running Xorg i fix it.
In the following way changes appears:

In the codec file appears that line, and eld
file is filled with correct info.
P.S. i tried to fill eld file with a correct info
using possibilities of alsa driver, but no soudn.
Perhaps i should alter codec as well, or there are
still some missed work from the side of radeon driver.

$ diff -p
*** f2/card0/codec#0	2015-07-28 00:10:36.000000000 +0300
--- f1/card0/codec#0	2015-07-28 00:07:58.000000000 +0300
*************** State of AFG node 0x01:
*** 16,21 ****
--- 16,22 ----
    Power: setting=D0, actual=D0
  GPIO: io=0, o=0, i=0, unsolicited=0, wake=0
  Node 0x02 [Audio Output] wcaps 0x201: Stereo Digital
+   Device: name="HDMI 0", type="HDMI", device=3
    Converter: stream=1, channel=0
    Digital: Enabled GenLevel
    Digital category: 0x2

$ cat f1/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		[0x1] FL/FR
sad_count		1
sad0_coding_type	[0x1] LPCM
sad0_channels		2
sad0_rates		[0xe0] 32000 44100 48000
sad0_bits		[0xe0000] 16 20 24

Best regards,
nartes

P.S. Further question are welcome!
Comment 4 mirh 2016-05-09 14:09:18 UTC
Created attachment 215621 [details]
TV was attached before booting.

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=7403c515c49c033fec33df0814fffdc977e6acdc
I read this should be supposed to improve HDMI audio (it landed in 4.6-rc5). 

For as much as I have no problem with sound though, I'm still getting "no speaker allocation for ELD" warnings. 

Also, I wouldn't know if the last EDID error is related or not (could just be driver queried the interface before I could completely remove the cable)
Comment 5 Siarhei 2016-08-15 06:05:59 UTC
(In reply to mirh from comment #4)
> Created attachment 215621 [details]
> TV was attached before booting.
> 
> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/
> ?id=7403c515c49c033fec33df0814fffdc977e6acdc
> I read this should be supposed to improve HDMI audio (it landed in 4.6-rc5). 

Installed recently kernel update (4.7 now, previous 4.6.4). ELD speaker allocation
is working without running Xorg this time.
Each time computer wakes up after a suspend I need to re-attach power cord,
otherwise
  $ cat f1/card0/eld#0.0
shows empty file. But botting up doesn't require reattaching of one.

(In reply to Sergei Sinyak from comment #3)
> hi, i can reproduce this bug on two configurations.
> That's radeon hd 6320, radeon hd 5650.
> kernel version 4.1.3, but tried to load radeon module
> compiled from 4.1-rc8, and it presents.
> 
> Description:
> The actual question is that:
>   after just loading radeon module
>   there is no sound from monitor
>   connected through hdmi wire.
>   But after running gdm, or
>   to be correct reinitializing driver
>   with a help of Xorg based application
>   everything comes back. But e.g.
>   after suspend/resume cycle it
>   again generates incorrect eld.
>   As a result dmesg shouts
>   NO SPEAKER ALLOCATION FOR ELD

Thanks to developers, one year old problem of mine had been partially fixed, it's better then it was before!