[kms/radeon] kernel backport request: hdmi audio support for amd evergreen cards

Reported by zarquon42 on 2012-03-30
34
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Linux
Confirmed
Medium
linux (Ubuntu)
Medium
Unassigned

Bug Description

Hi,
I'm using a laptop with an amd-e450 chipset (hd6320 graphics card). Audio output via hdmi only needs the 3.3 kernel (http://www.x.org/wiki/RadeonFeature) I tested it by installing the mainline kernel and indeed it works. I would like to ask for a backport of this feature into the 12.04 kernel.

Greetings
Stefan

Download full text (4.8 KiB)

I am experiencing audio being played back at roughly 28665Hz instead of expected 44100Hz. This rate is derived for timing for how long it takes to play sample of a known size. Pitch of audio being played is obviously comical.

Hardware:
AMD G-T56N (Radeon HD 6310) box connected to the monitor via native HDMI connector.

This is with kernel.org 3.3.0-rc4 kernel.

Only thing I see in kernel log with apparent relevance is this:
[ 56.086500] HDMI hot plug event: Codec=0 Pin=3 Presence_Detect=1 ELD_Valid=1
[ 56.086526] HDMI status: Codec=0 Pin=3 Presence_Detect=1 ELD_Valid=1
[ 56.086545] ALSA sound/pci/hda/hda_eld.c:337 HDMI: ELD buf size is 0, force 128
[ 56.086561] ALSA sound/pci/hda/hda_eld.c:356 HDMI: invalid ELD data byte 0
[ 56.127063] HDMI hot plug event: Codec=0 Pin=3 Presence_Detect=0 ELD_Valid=1
[ 56.127090] HDMI status: Codec=0 Pin=3 Presence_Detect=1 ELD_Valid=1
[ 56.127109] ALSA sound/pci/hda/hda_eld.c:337 HDMI: ELD buf size is 0, force 128
[ 56.127125] ALSA sound/pci/hda/hda_eld.c:356 HDMI: invalid ELD data byte 0
[ 56.387045] HDMI status: Codec=0 Pin=3 Presence_Detect=1 ELD_Valid=1
[ 56.387069] ALSA sound/pci/hda/hda_eld.c:337 HDMI: ELD buf size is 0, force 128
[ 56.387086] ALSA sound/pci/hda/hda_eld.c:356 HDMI: invalid ELD data byte 0
[ 56.699469] HDMI status: Codec=0 Pin=3 Presence_Detect=1 ELD_Valid=1
[ 56.699494] ALSA sound/pci/hda/hda_eld.c:337 HDMI: ELD buf size is 0, force 128
[ 56.699510] ALSA sound/pci/hda/hda_eld.c:356 HDMI: invalid ELD data byte 0
[ 56.990752] HDMI hot plug event: Codec=0 Pin=3 Presence_Detect=1 ELD_Valid=1
[ 56.990777] HDMI status: Codec=0 Pin=3 Presence_Detect=1 ELD_Valid=1
[ 56.990795] ALSA sound/pci/hda/hda_eld.c:337 HDMI: ELD buf size is 0, force 128
[ 56.990811] ALSA sound/pci/hda/hda_eld.c:356 HDMI: invalid ELD data byte 0
[ 57.001054] HDMI status: Codec=0 Pin=3 Presence_Detect=1 ELD_Valid=1
[ 57.001079] ALSA sound/pci/hda/hda_eld.c:337 HDMI: ELD buf size is 0, force 128
[ 57.001095] ALSA sound/pci/hda/hda_eld.c:356 HDMI: invalid ELD data byte 0
[ 57.302064] HDMI status: Codec=0 Pin=3 Presence_Detect=1 ELD_Valid=1
[ 57.302092] ALSA sound/pci/hda/hda_eld.c:337 HDMI: ELD buf size is 0, force 128
[ 57.302108] ALSA sound/pci/hda/hda_eld.c:356 HDMI: invalid ELD data byte 0
[ 57.420102] HDMI hot plug event: Codec=0 Pin=3 Presence_Detect=0 ELD_Valid=1
[ 57.420130] HDMI status: Codec=0 Pin=3 Presence_Detect=1 ELD_Valid=1
[ 57.420149] ALSA sound/pci/hda/hda_eld.c:337 HDMI: ELD buf size is 0, force 128
[ 57.420165] ALSA sound/pci/hda/hda_eld.c:356 HDMI: invalid ELD data byte 0
[ 57.437447] HDMI hot plug event: Codec=0 Pin=3 Presence_Detect=1 ELD_Valid=1
[ 57.437471] HDMI status: Codec=0 Pin=3 Presence_Detect=1 ELD_Valid=1
[ 57.437489] ALSA sound/pci/hda/hda_eld.c:337 HDMI: ELD buf size is 0, force 128
[ 57.437505] ALSA sound/pci/hda/hda_eld.c:356 HDMI: invalid ELD data byte 0
[ 57.493091] HDMI hot plug event: Codec=0 Pin=3 Presence_Detect=0 ELD_Valid=1
[ 57.493117] HDMI status: Codec=0 Pin=3 Presence_Detect=1 ELD_Valid=1
[ 57.493136] ALSA sound/pci/hda/hda_eld.c:337 HDMI: ELD buf size is 0, force 128
[ 57.493152] ALSA sound/pci/hda/hda_e...

Read more...

Hi Tvrtko,

Can you install rateontool (avivotool) from git master, and provide output from it?

Installation:
git clone git://people.freedesktop.org/~airlied/radeontool
cd radeontool
./autogen.sh && make && sudo make install

Grabbing regs dump:
[start playing your audio over HDMI]
avivotool regs hdmi

You can easily save output to the file by using
avivotool regs hdmi > dump.txt

Please provide requested dump.

Created attachment 57759
"avivotool regs hdmi" output while audio was playing

I have experienced a possibly similar issue, I could only reproduce it in the following scenario, so maybe this can be another data point:

A DVI output and a HDMI output are connected to the same graphics card. If their resolutions are different the pitch is wrong (the more different the resolutions the more wrong it is). However, if I unplug the DVI before booting the machine, or set the HDMI to the same resolution as the DVI the audio is fine.

I don't have the setup at the moment to verify that we are seeing the same bug, in which case I apologise for the noise.

It's not that in my case since the motherboard I am using doesn't even have DVI. It has VGA and HDMI, with only HDMI connected.

Monitor is Dell 2408WFP in case it matters.

00007d04 02000000 (33554432)
This register is 0x7c30 + R600_HDMI_IEC60958_1. AFAWK value 0x02000000 means 48000 rate. I've to understand how driver handles rates.

Just to clarify, it is possible I was playing back at 48kHz when collecting the register dump. I was trying both 44.1kHz and 48kHz, the latter just to make sure my monitor is not mishandling the former, but in both cases heard and observed playback rate was wrong.

Created attachment 58209
drm/radeon/kms/audio: read correct regs on Evergreen

I guess this patch can fix the issue.

My problem is that I still don't know how much Evergreen is different from older cards. I still can't take a decision if it's worth splitting HDMI/audio code into R600 vs. Evergreen or not...

Created attachment 58223
avivotool register dump while 44100 sample was playing

Unfortunately playback rate is still wrong. I made another register dump while I was playing a 44100Hz wave file directly to the HDMI device. This file is 2m49s long, while playing it over HDMI takes 4m20s. Which gives us the same apparent 28665Hz playback rate as originally observed.

Ahh, sorry, I didn't understand your first problem description you posted in this bug report. I though the playback speed is alright, just the sampling rate used is incorrect.

The problem most probably lays in audio clocks. Values used by radeon seem to be:
EVERGREEN_AUDIO_PLL1_MUL 00075300
EVERGREEN_AUDIO_PLL1_DIV 00177fa0
EVERGREEN_AUDIO_PLL1_UNK 00000071

Do you have fglrx installed? Is this possible for you to switch to the fglrx for a moment and do similar dump (using avivotool) while playing audio with it?
To make debugging quicker: can you also dump "avivotool regsrange 0x500 0x600" just in case fglrx uses some other registers?

(In reply to comment #5)
> Monitor is Dell 2408WFP in case it matters.

Are you using 1900x1200 resolution? Can you try some smaller one? Does it help?

(In reply to comment #11)
> (In reply to comment #5)
> > Monitor is Dell 2408WFP in case it matters.
>
> Are you using 1900x1200 resolution? Can you try some smaller one? Does it help?

It changes the error:

1920x1200: 4m20s = 1.53x too slow
1280x1024: 3m2s = 1.07x too slow
1024x768: 1m49s = 1.55x too fast
800x600: 1m7s = 2.52x too fast

Sound also comes with various distortions in each test.

Is this enough of a hint on what is going wrong or you would still like me to test with fglrx? It may take some time to set it up since I have no experience with it.

I'm afraid I can not do anything without dump from fglrx :( There are 4 clocks related registers we are aware of, but I don't know how else we can try to program them. There may be also some other clock registers. I'm afraid only dump from fglrx can give us some hints and I can't get that info from my card, since it's working pretty well.

Created attachment 58306
avivotool register dump under fglrx

I've managed to get fglrx running and initially playback speed was fine but audio quite distorted (hard to describe). I've noticed in the output a mention of 1024x768 output resolution on the LVDS connector which was unexpected, since the motherboard in question only has HDMI and VGA outputs. I disabled LVDS with xranrd and then audio was perfect. I will attach that register dump as well.

Created attachment 58307
avivotool register dump under fglrx with non-existant LVDS output turned off

Tvrtko: thanks a lot for your effort and dumps coming from fglrx.

What I can say now: it seems fglrx is using the same registers (EVERGREEN_AUDIO_PLL1_MUL and EVERGREEN_AUDIO_PLL1_DIV) for your card.

However:
1) radeon uses 480'000 for MUL
2) fglrx uses 960'000 for MUL

On the other hand fglrx uses 0x72 instead of 0x71 for EVERGREEN_AUDIO_PLL1_UNK. Maybe that 0x2 is some DIV? Maybe it tells GPU to take 960'000 and divide it by 2?

I've to investigate meaning of the register, but you gave me a track to follow, thanks a lot for your effors! I'll take a look on that after my vacations (next week).

If you wish, you can try switching to radeon and:
1) Start playback
2) Make sure speed is still wrong
3) Execute: "avivotool regset 0x05b0 0x000ea600"
4) Execute: "avivotool regset 0x05bc 0x00000072"

Does it help?

Ok, I will try to get you the documentation for the PLL regs, they are not DRM or IP related. So there is a slightly chance that we can release them.

Christian.

(In reply to comment #17)
> If you wish, you can try switching to radeon and:
> 1) Start playback
> 2) Make sure speed is still wrong
> 3) Execute: "avivotool regset 0x05b0 0x000ea600"
> 4) Execute: "avivotool regset 0x05bc 0x00000072"
>
> Does it help?

Unfortunately not. First line speeds it up (way to much) and the second one brings it down into too slow territory again.

Hi, i have same problem hdmi audio slow. Radeon 5450.
But dual screen hdmi+crt 1920 x 1080 audio works fine.

ok
1280x720 radeon 5450 works

avivotool regset 0x05b0 0x00138800

works good

vincenzo@AthlonII-260:~$ sudo avivotool regset 0x05b0 0x00138800
OLD: 0x05b0 (05b0) 0x00075300 (480000)
NEW: 0x05b0 (05b0) 0x00138800 (1280000)

work only 1280x720

slow with 1920 x 1080

sudo avivotool regset 0x05b0 0x00271000

works good whit 1920 x 1080

zarquon42 (zarquon42) on 2012-03-30
description: updated
description: updated
Joseph Salisbury (jsalisbury) wrote :

We generally ask bug reporters to first request that the driver be added to the upstream kernel. This can be done by mailing the Linux Kernel Mailing List or opening a bug at bugzilla.kernel.org.

Changed in linux-meta (Ubuntu):
importance: Undecided → Medium
tags: added: precise
Brad Figg (brad-figg) on 2012-03-30
affects: linux-meta (Ubuntu) → linux (Ubuntu)
Joseph Salisbury (jsalisbury) wrote :

From the bug description, it sounds like this module is in the upstream v3.3 kernel? Do you know if it is going to be queued up for the linux-stable kernel(3.2)?

One way to quickly test, would be to install the latest upstream 3.2 kernel, which is available at:
http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.2.13-precise/

Can you test the latest 3.2 kernel, and report back if it includes the module?

This bug is missing log files that will aid in diagnosing the problem. From a terminal window please run:

apport-collect 969001

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete

Hi,

yes, it is already queued:

could be module
kernel/sound/pci/hda/snd-hda-codec-hdmi.ko

uname -r:
3.2.13-030213-generic

Greetings
Stefan

Joseph Salisbury (jsalisbury) wrote :

Hi Stefan,

The latest precise kernel(3.2.0-21) has been rebased to linux-stable 3.2.13.

You can upgrade just your kernel by running the following in a terminal:

sudo apt-get update
sudo apt-get install linux

or apply all the latest updates with:
sudo apt-get update
sudo apt-get dist-upgrade

If the bug still exists in the latest kernel, please change the status back to "Confirmed". If the bug is fixed, please change the status to "Fix Released".

Thanks in advance

zarquon42 (zarquon42) wrote :

Hi,

strangely it is not fixed...in 3.2.13 mainline it is present in sound menu (haven't tested the output yet - no hdmi TV available at the moment) but in 3.2.0-21 only the analogue device shows up.

Greetings
Stefan

Joseph Salisbury (jsalisbury) wrote :

Hello,

I'll do some research and update the bug shortly.

tags: added: kernel-da-key
Changed in linux (Ubuntu):
status: Incomplete → Confirmed

Thank you for taking the time to file a bug report on this issue.

However, given the number of bugs that the Kernel Team receives during any development cycle it is impossible for us to review them all. Therefore, we occasionally resort to using automated bots to request further testing. This is such a request.

We have noted that there is a newer version of the development kernel than the one you last tested when this issue was found. Please test again with the newer kernel and indicate in the bug if this issue still exists or not.

You can update to the latest development kernel by simply running the following commands in a terminal window:

    sudo apt-get update
    sudo apt-get dist-upgrade

If the bug still exists, change the bug status from Incomplete to Confirmed. If the bug no longer exists, change the bug status from Incomplete to Fix Released.

If you want this bot to quit automatically requesting kernel tests, add a tag named: bot-stop-nagging.

 Thank you for your help, we really do appreciate it.

Changed in linux (Ubuntu):
status: Confirmed → Incomplete
tags: added: kernel-request-3.2.0-21.34

Dear Joseph,

I have to set kernel parameter radeon.audio=1 at boot time (or in grubs config file)
Maybe that helps narrowing down your search.

Many thanks
Stefan

Changed in linux (Ubuntu):
status: Incomplete → Confirmed
Joseph Salisbury (jsalisbury) wrote :

Have you tried booting without the option radeon.audio=1 ?

zarquon42 (zarquon42) wrote :

Yes, but then no hdmi audio no matter which kernel. My other laptop has a hd4670 graphics card, (which is supported by the default kernel) and also needs the parameter for hdmi audio to be available.

Joseph Salisbury (jsalisbury) wrote :

So just to confirm, the mainline 3.2.13 kernel does not have this bug, but the latest Precise kernel does(3.2.0-21.34)?

zarquon42 (zarquon42) wrote :

>So just to confirm, the mainline 3.2.13 kernel does not have this bug, but the latest Precise kernel does(3.2.0-21.34)?

exactly -see screenshots attached

zarquon42 (zarquon42) wrote :

>So just to confirm, the mainline 3.2.13 kernel does not have this bug, but the latest Precise kernel does(3.2.0-21.34)?

exactly -see screenshots attached

zarquon42 (zarquon42) wrote :

sorry for the double post, here comes the screenshot of the sound menu using the 3.2.13 mainline kernel

Please see:
http://lists.freedesktop.org/archives/dri-devel/2012-March/020717.html
http://lists.freedesktop.org/archives/dri-devel/2012-March/020855.html
http://lists.freedesktop.org/archives/dri-devel/2012-March/020857.html
http://people.freedesktop.org/~agd5f/0001-WIP-port-of-hdmi-dp-audio-code-to-newer-kernel.patch

As per the comments in the last patch:

+ /* Express [24MHz / target pixel clock] as an exact rational
+ * number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE
+ * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator
+ */

zarquon42 (zarquon42) wrote :

Tonight I had access to a TV with hdmi input: In 3.2.13 only the item is visible in the sound menu but not functional. At the moment sound is only working with the 3.3 mainline kernel (flawless sound playback).

Greetings
Stefan

Thank you for taking the time to file a bug report on this issue.

However, given the number of bugs that the Kernel Team receives during any development cycle it is impossible for us to review them all. Therefore, we occasionally resort to using automated bots to request further testing. This is such a request.

We have noted that there is a newer version of the development kernel than the one you last tested when this issue was found. Please test again with the newer kernel and indicate in the bug if this issue still exists or not.

You can update to the latest development kernel by simply running the following commands in a terminal window:

    sudo apt-get update
    sudo apt-get dist-upgrade

If the bug still exists, change the bug status from Incomplete to Confirmed. If the bug no longer exists, change the bug status from Incomplete to Fix Released.

If you want this bot to quit automatically requesting kernel tests, add a tag named: bot-stop-nagging.

 Thank you for your help, we really do appreciate it.

Changed in linux (Ubuntu):
status: Confirmed → Incomplete
tags: added: kernel-request-3.2.0-22.35

still not working on 3.2.0-22

Changed in linux (Ubuntu):
status: Incomplete → Confirmed
tags: added: kernel-fixed-upstream
Julian Wiedmann (jwiedmann) wrote :

As far as I know, the patches that landed in 3.3 did not resolve all issues with HDMI audio on AMD GPUs (that's why upstream still defaults to radeon.audio=0).

summary: - kernel backport request: hdmi audio support for amd hd6xxx cards
+ [kms/radeon] kernel backport request: hdmi audio support for amd
+ evergreen cards
Changed in linux:
importance: Unknown → Medium
status: Unknown → Confirmed

Hi
i can't patch a kernel 3.4.0-rc1
i can't patch a kernel 3.3.0
:-(
error radeon display

Error when compiling.

hi , i have compiled kernel 3.5-rc1 but radeon 5450 audio slow.

kernel 3.5.0-rc2 audio workgood.
i have 2 monitor hdmi, after I changed the initial resolution of the monitor works fine 2.
example

1 monitor 1920 x 1080 works
2 monitor 1920 x 1080 works.

after i turn off monitor 1, audio monitor 2 slow.
configure monitor 2 and after all audio works good 1 & 2.

Yeah, the audio rate is controlled by the last output changed.

We should switch to another output if the output driving the audio signal is turned off.

It's on the todo list.

thanks Christian König and Rafał Miłecki for this work.
Sorry my english is bad, i speak only italian :-).

Hansen (moteprime) wrote :

Hi. I hope it's ok to write here.
I have "No hdmi audio" bug on Ideapad s205 AMD E-450 HD6320, and during Laptop testing for QA:
http://laptop.qa.ubuntu.com/qatracker/milestones/242/builds/26245/testcases/893/results
I have reported bug: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1020041
As instructed i have tried to file kernel bug on:
https://bugzilla.kernel.org/show_bug.cgi?id=45321
But i am i bit out of my league and cannot supply the information needed to help solve the bug.

Is it the same bug as this one, i cannot figure it out?
And are any of you able to help me?
Thank you

zarquon42, this bug was reported a while ago and there hasn't been any activity in it recently. We were wondering if this is still an issue? If so, could you please test for this with the latest development release of Ubuntu? ISO images are available from http://cdimage.ubuntu.com/daily-live/current/ .

If it remains an issue, could you please run the following command in the development release from a Terminal (Applications->Accessories->Terminal), as it will automatically gather and attach updated debug information to this report:

apport-collect -p linux <replace-with-bug-number>

tags: added: needs-kernel-logs
removed: kernel-request-3.2.0-21.34 kernel-request-3.2.0-22.35
Changed in linux (Ubuntu):
status: Confirmed → Incomplete
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.