Re: D43399 FreeBSD Review, enable VCHIQ HDMI Audio subsystem for BCM2711 Raspberry Pi 4B, 400 adding 3 patch files.
Marco Devesas Campos <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.arm |
|---|---|
| Message-ID | <[email protected]> |
Hi,
For future reference, here's what's going on.
Here's the driver code that get's called when you change the volume. You don't need to be a C guru to spot the problem:
static int
bcmmix_set(struct snd_mixer *m, unsigned dev, unsigned left, unsigned right)
{
struct bcm2835_audio_info *sc = mix_getdevinfo(m);
switch (dev) {
case SOUND_MIXER_VOLUME:
BCM2835_AUDIO_LOCK(sc);
sc->volume = left;
bcm2835_worker_update_params(sc);
BCM2835_AUDIO_UNLOCK(sc);
break;
default:
break;
}
return left | (left << 8);
}
afaict, the sound subsystem code that calls this doesn't check the return value so that's why the output of `mixer` doesn't reflect what is going on in the driver.
I checked the netbsd driver and it seems to be doing something similar [1], so this looks like a hardware shortcoming.
You can check l/r separation with sox
play -n synth 3 sine 440 sine 0 #left
play -n synth 3 sine 0 sine 440 #right
and that works fine for me.
Best,
Marco
[1]: https://github.com/NetBSD/src/blob/e18008ace77d058ca7c3b2b5aab54fd9e8eee462/sys/arch/arm/broadcom/bcm2835_vcaudio.c#L650
> On 16 Nov 2025, at 11:39, Nuno Teixeira <[email protected]> wrote:
>
> Hello Adrian,
>
> On my rpi4 connected via hdmi to external monitor.
> Using headphones connected to monitor and I got sound!
>
> I noticed that only 1 channel can be listening in mono, i.e., I can hear both sides as mono.
>
> A simple test is to run:
>
> % mixer vol=0:1 (no sound at all)
> % mixer vol=1:0 (sound on both sides, mono)
>
> NOTE: It could be a monitor/cable problem at my side, but it's worth to make this tests.
>
> vchiq0: <BCM2835 VCHIQ> mem 0x7e00b840-0x7e00b87b irq 78 on simplebus0
>
> % mixer
> pcm0:mixer: <VCHIQ audio> at VCHIQ (play) (default)
> vol = 1.00:1.00 pbk
>
> Thanks!
>
> Adrian Chadd <[email protected]> escreveu (sábado, 15/11/2025 à(s) 15:47):
> hi!
>
> it's all in -HEAD now. Please update to get the support and lets get any other bugs shaken out!
>
>
>
> -adrian
>
>
> On Mon, 27 Oct 2025 at 23:16, Adrian Chadd <[email protected]> wrote:
> hi!
>
> so!
>
> * D36431 landed
> * i've pulled the logging/tracing routines out of the big diff (D37878) into two smaller diffs (D53371 and D53372)
> * I've pushed updates to D37878 to fix some style(9) stuff and pull out the code that's now in D53371 and D53372
>
> Now, the audio works fine out of the 3.5' jack. However if I load the system up (eg doing a buildkernel in parallel) then I saw the audio get stuck and then not ever restart.
> I figure that we can tackle that once the above diffs have landed.
>
> I'll work with Andrew/Ed and whoever else on IRC is up for reviewing and getting D53371 and D53372 landed.
>
> The big diff is now around 1400 lines, which is still big and I can likely pull little bits and pieces of the diff out and land incrementally.
>
> But yes it is getting there! If you've got a rpi4 and you'd like to test this out (or you're running a 32 bit kernel on an older
> RPI and want to verify these didn't break) then please give the diff stack at D37879 (four diffs) a go on the latest -head tree
> and report back!
>
> Thanks again,
>
>
> -adrian
>
>
> --
> Nuno Teixeira
> FreeBSD UNIX: <[email protected]> Web: https://FreeBSD.org