Does anyone have HDMI audio working with vc4

This forum is for discussion about general software issues.

Does anyone have HDMI audio working with vc4

Postby keithspg » Mon Feb 28, 2022 4:11 pm

I recently started looking at the adding the vc4-kms-v3d overlay and am trying to understand how to get hdmi audio working. This is for a headless device and I am not running pulseaudio, only alsa.
I cannot get hdmi audio to work. I can get audio on the onboard 3.5mm headphone jack and an i2s hat attached, but not the HDMI audio. This is with a recent kernel on aarch64, linux 5.15.23-1. I have not yet tried armv7 to see if it iny different, but am interested in getting the 64 bit version to work.

I have tried all of these outputs and none put any audio out when connected to an HDMI input on my TV

$this->bbcode_second_pass_code('', 'default:CARD=vc4hdmi
vc4-hdmi, MAI PCM i2s-hifi-0
Default Audio Device
sysdefault:CARD=vc4hdmi
vc4-hdmi, MAI PCM i2s-hifi-0
Default Audio Device
front:CARD=vc4hdmi,DEV=0
vc4-hdmi, MAI PCM i2s-hifi-0
Front output / input
iec958:CARD=vc4hdmi,DEV=0
vc4-hdmi, MAI PCM i2s-hifi-0
IEC958 (S/PDIF) Digital Audio Output
usbstream:CARD=vc4hdmi
vc4-hdmi
USB Stream Output')

Keith
Last edited by keithspg on Wed Mar 02, 2022 3:18 pm, edited 1 time in total.
keithspg
 
Posts: 221
Joined: Mon Feb 23, 2015 4:14 pm

Re: Does anyone have HDMI audio working with current kernel?

Postby keithspg » Wed Mar 02, 2022 1:37 am

What I am trying to do is direct MPD to play on the hdmi output.
I tried a number of things including a clean fresh RPiOS image. With the RPiOS image (also 64 bit) and a very recent kernel build, I can get an output to play a wav file:
$this->bbcode_second_pass_code('', 'pi@raspberrypi:~ $ aplay -D sysdefault:CARD=vc4hdmi /usr/share/sounds/alsa/Front_Center.wav
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono')

all the rest of the outputs play nothing through the speaker on the TV with the RPIOS image.

When I try the same thing with the Arch Arm Linux-rpi (aarch64) I get nothing
$this->bbcode_second_pass_code('', '# aplay -D default:CARD=vc4hdmi /usr/share/sounds/alsa/Front_Center.wav
ALSA lib pcm_direct.c:1206:(snd1_pcm_direct_initialize_slave) requested or auto-format is not available
ALSA lib pcm_dmix.c:1044:(snd_pcm_dmix_open) unable to initialize slave
aplay: main:831: audio open error: Invalid argument')
This one looks promising, but nothing plays from the speakers:
$this->bbcode_second_pass_code('', '~# aplay -D aplay -D iec958:CARD=vc4hdmi,DEV=0 /usr/share/sounds/alsa/Front_Center.wav
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
aplay: set_params:1416: Unable to install hw params:
ACCESS: RW_INTERLEAVED
FORMAT: S16_LE
SUBFORMAT: STD
SAMPLE_BITS: 16
FRAME_BITS: 16
CHANNELS: 1
RATE: 48000
PERIOD_TIME: 125000
PERIOD_SIZE: 6000
PERIOD_BYTES: 12000
PERIODS: 4
BUFFER_TIME: 500000
BUFFER_SIZE: 24000
BUFFER_BYTES: 48000
TICK_TIME: 0')

The strange thing is that I would thing that if the hdmi output shows up as a hw output but I cannot play anything through it form mpd.
keithspg
 
Posts: 221
Joined: Mon Feb 23, 2015 4:14 pm

Re: Does anyone have HDMI audio working with vc4

Postby keithspg » Thu Mar 03, 2022 3:36 pm

When I place this file in the filesystem, I get hdmi audio with the vc4 loaded:
https://forums.raspberrypi.com/viewtopic.php?p=1979825#p1979542
keithspg
 
Posts: 221
Joined: Mon Feb 23, 2015 4:14 pm

Re: Does anyone have HDMI audio working with vc4

Postby keithspg » Thu Mar 03, 2022 6:40 pm

Well, we can get it 'working' with vc4 with this modded file, but it sounds terrible. I have been looking at the differences between the RPiOS and Arch to see what may be different. for one, the RpiOS lists a 'dmix' output.

Looking through the filesystem, there are added Rpi specific cards in /usr/share/alsa/cards and the vc4-hdmi.conf is substantially different. Also I noted that there is actually a /usr/share/alsa/init/bcm2835 on the RPiOS image yet none here I wonder if that single bit may be enough to make it work properly. When I copied all the different files in /usr/share/alsa from the RPiOS to Arch, I was able to get the sound quality to improve. When I do so, I get this as a list of outputs for the hdmi (on a 3b+)

$this->bbcode_second_pass_code('', 'hw:CARD=vc4hdmi,DEV=0
vc4-hdmi, MAI PCM i2s-hifi-0
Direct hardware device without any conversions
plughw:CARD=vc4hdmi,DEV=0
vc4-hdmi, MAI PCM i2s-hifi-0
Hardware device with all software conversions
default:CARD=vc4hdmi
vc4-hdmi, MAI PCM i2s-hifi-0
Default Audio Device
sysdefault:CARD=vc4hdmi
vc4-hdmi, MAI PCM i2s-hifi-0
Default Audio Device
hdmi:CARD=vc4hdmi,DEV=0
vc4-hdmi, MAI PCM i2s-hifi-0
HDMI Audio Output
dmix:CARD=vc4hdmi,DEV=0
vc4-hdmi, MAI PCM i2s-hifi-0
Direct sample mixing device
usbstream:CARD=vc4hdmi
vc4-hdmi
USB Stream Output')

Should this be adjusted?
keithspg
 
Posts: 221
Joined: Mon Feb 23, 2015 4:14 pm

Re: Does anyone have HDMI audio working with vc4

Postby JohnnyBravo » Thu Mar 10, 2022 8:20 am

Check the link because I used the method used in it and it worked for me.https://forums.raspberrypi.com/viewtopic.php?p...
JohnnyBravo
 
Posts: 3
Joined: Thu Mar 10, 2022 8:12 am

Re: Does anyone have HDMI audio working with vc4

Postby keithspg » Thu Mar 10, 2022 7:45 pm

@johnnybravo That is my post. The bigger question, though, is what should Arch Arm do? This modification is not part of the alsa project and has been added by the RPi group. I do not know if it belongs in alsa proper or in the arch arm alsa builds, but I do feel that it should be addressed, somehow, as the vc4 hdmi audio is broken for ArchArm.
keithspg
 
Posts: 221
Joined: Mon Feb 23, 2015 4:14 pm


Return to General

Who is online

Users browsing this forum: No registered users and 8 guests

cron