Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Apr 2017 18:44:39 -0700
From:      David Shao <davshao@gmail.com>
To:        freebsd-x11@freebsd.org
Subject:   Might want to test whether HDMI audio works for Radeon video cards
Message-ID:  <CABZaEK6Rcpfq7muY5yvNqMS2RMdU_Dgthb7hcCP9Jcz3cyi5fQ@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
drm-next users at least with Radeon cards with HDMI out should see if
HDMI audio works.

Several years ago there was a mailing list discussion

amd64 panic snd_hda - hdac_get_capabilities: Invalid corb size (0)

https://lists.freebsd.org/pipermail/freebsd-current/2010-July/018764.html

At the time the original poster was not able to get the HDMI audio device to
completely attach.

But using a custom DragonFly kernel with Linux 4.7.10 radeon audio patches
(radeon_audio.c, radeon_audio.h and anything relevant updated) and an updated
userland including mesa 7 and xorg server 1.19.3, I am able to get HDMI audio
to work with a Gigabyte Radeon R7 240 video card.

DragonFly does not load sound drivers by default so it might be best to turn off
default loading.

startx with xfce4

# kldload snd_hda

dmesg ends with something like:

[drm] Initialized radeon 2.40.0 20080528
hdac0: <Intel Panther Point HDA Controller> mem 0xf7f10000-0xf7f13fff
irq 22 at device 27.0 on pci0
hdac0: link ctrl 0x800
hdac0: disable nosnoop
hdac1: <ATI (0xaab0) HDA Controller> mem 0xf7e60000-0xf7e63fff irq 17
at device 0.1 on pci2
hdac1: link ctrl 0x2800
hdac1: disable nosnoop
hdacc0: <VIA VT1708S_0 HDA CODEC> at cad 0 on hdac0
hdaa0: <VIA VT1708S_0 Audio Function Group> at nid 1 on hdacc0
hdacc1: <ATI R6xx HDA CODEC> at cad 0 on hdac1
hdaa1: <ATI R6xx Audio Function Group> at nid 1 on hdacc1
pcm0: <VIA VT1708S_0 (Analog 7.1+HP/2.0)> at nid 28,34,25,35,29 and
26,30,27 on hdaa0
pcm1: <VIA VT1708S_0 (Digital)> at nid 32 on hdaa0
pcm2: <VIA VT1708S_0 (Rear-panel Digital)> at nid 33 on hdaa0
pcm3: <ATI R6xx (HDMI)> at nid 3 on hdaa1

# sysctl hw.snd.default_unit=3
hw.snd.default_unit: 0 -> 3

fire up firefox, go to youtube and listen to whatever.

So someone should check for FreeBSD drm-next whether the following patches are
necessary for Radeon HDMI audio to work, because it SHOULD now work,
and if it doesn't
it needs to and can be fixed.

diff --git a/sys/dev/sound/pci/hda/hdac.c b/sys/dev/sound/pci/hda/hdac.c
index d63843a10f..2178243f88 100644
--- a/sys/dev/sound/pci/hda/hdac.c
+++ b/sys/dev/sound/pci/hda/hdac.c
@@ -488,7 +488,15 @@ hdac_get_capabilities(struct hdac_softc *sc)
else {
device_printf(sc->dev, "%s: Invalid corb size (%x)\n",
__func__, corbsize);
- return (ENXIO);
+ if (1) {
+ device_printf(sc->dev, "Resetting corb size to 256\n");
+ sc->corb_size = 256;
+ corbsize =
+ HDAC_CORBSIZE_CORBSIZE(HDAC_CORBSIZE_CORBSIZE_256);
+ HDAC_WRITE_1(&sc->mem, HDAC_CORBSIZE, corbsize);
+ }
+ else
+ return (ENXIO);
}

rirbsize = HDAC_READ_1(&sc->mem, HDAC_RIRBSIZE);
@@ -504,7 +512,15 @@ hdac_get_capabilities(struct hdac_softc *sc)
else {
device_printf(sc->dev, "%s: Invalid rirb size (%x)\n",
__func__, rirbsize);
- return (ENXIO);
+ if (1) {
+ device_printf(sc->dev, "Resetting rirb size to 256\n");
+ sc->rirb_size = 256;
+ rirbsize =
+ HDAC_RIRBSIZE_RIRBSIZE(HDAC_RIRBSIZE_RIRBSIZE_256);
+ HDAC_WRITE_1(&sc->mem, HDAC_RIRBSIZE, rirbsize);
+ }
+ else
+ return (ENXIO);
}

HDA_BOOTVERBOSE(
@@ -1211,6 +1227,8 @@ hdac_attach(device_t dev)
if (result != 0)
goto hdac_attach_fail;

+ hdac_reset(sc, 1);
+
/* Get Capabilities */
result = hdac_get_capabilities(sc);
if (result != 0)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CABZaEK6Rcpfq7muY5yvNqMS2RMdU_Dgthb7hcCP9Jcz3cyi5fQ>