vc4.ko brings unusable&unstable ALSA sinks

Dave Stevenson dave.stevenson at raspberrypi.com
Wed Mar 31 13:25:04 BST 2021


On Wed, 31 Mar 2021 at 12:19, Diederik de Haas <didi.debian at cknow.org> wrote:
>
> Hi,
>
> On woensdag 31 maart 2021 09:31:03 CEST Ryutaroh Matsumoto wrote:
> > > Is that a 32bit or 64bit kernel? AFAIK, all the problems are with 64bit.
> > It's 64-bit.
>
> Thx
>
> > It is funny that 32-bit kernel works fine while 64-bit doesn't...
>
> AFAIK, the GPU (VC4 in my case) is 32-bit, so that means (something like)
> architecture translation work on 64-bit systems, which isn't needed when
> everything is 32-bit.
>
> > I am pretty sure that vc4hdmi does not work in the same way as
> > snd_bcm2835.ko, as most of aplay commands fail with vc4hdmi
> > while they succeed with snd_bcm2835.
>
> My (naive?) assumption was that the latter has 'snd' in it's name, so if I
> want(ed) to do sth with sound, I needed that one.
> But then the question arose "what is vc4hdmi for then?" It didn't seem to work
> to play audio normally/properly and it was sometimes loaded first, but not
> consistently, messing up index numbers. I later learned (IIUC) that it only
> works with IEC958 frames and that you need pulseaudio to deal with that
> properly.
> While I first wanted to get rid of vc4hdmi, it now appears I should go with
> that one. But that's only based on our trial-and-error, not on any insight I
> could find online or from this ML.

Until recently most of the interfacing for HDMI has been through the
VideoCore VPU (aka the firmware). That has included providing an audio
interface for HDMI and analogue audio via snd_bcm2835.

HDMI audio is directly tied into the video signal being sent on the
same link. When you switch to the kernel handling HDMI via the vc4
DRM/KMS driver you MUST also use it for the audio side too - at that
point the firmware has no idea as to the video format being selected,
and it will mess up the audio.

The HDMI audio hardware requires IEC958 formatted data as that is how
audio is actually placed on the HDMI link.
ALSA will pack PCM for you into the right format if you provide an
appropriate conf file. The version shipped with Raspberry Pi OS will
do this, and is also available from LibreElec[1]. I suspect it hasn't
been upstreamed as yet, so Debian is unlikely to have it.

snd_bcm2835 has two modes of operation, controlled by module parameters.
enable_compat_alsa=1 will expose one audio device that can be switched
between analogue out and HDMI via a control. This is generally not
used now.
enable_compat_alsa=0 will create separate devices for each output.
enable_headphones and enable_hdmi control which devices should be
enabled. Do not use enable_hdmi=1 if using the vc4 DRM/KMS driver.

  Dave

[1] https://github.com/LibreELEC/LibreELEC.tv/blob/master/projects/RPi/filesystem/usr/share/alsa/cards/vc4-hdmi.conf

> > On my RPi4 with module_blacklist=snd_bcm, I have the following multi-channel
> > capable output:
> >
> > $ LANG=C.UTF-8 pacmd list-cards
> > ...
> > In the above "active profile: <output:iec958-stereo>" indicates the
> > default is not multichannel. I believe that the default can be changed to
> > the multichannel by (from pulse-cli-syntax(5)):
>
> Yep, the one with the highest priority gets selected by default, but I changed
> that with "pactl set-card-profile 1 output:iec958-ac3-surround-51". That's why
> my "Active Profile" was different. I think pavucontrol is only or mostly a GUI
> around pactl/pacmd. You can also install just pavucontrol (on rpi-mpd) and
> run: "env PULSE_SERVER=rpi-mpd pavucontrol" (you need to enable some network
> settings for that to work though).
> But I just realized that it's 'only' 5.1, not 7.1 ...
>
> > Best regards, Ryutaroh
> Cheers,
>   Diederik_______________________________________________
> linux-rpi-kernel mailing list
> linux-rpi-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rpi-kernel



More information about the linux-rpi-kernel mailing list