Re: [PATCH] Experimental vchiq and bcm2835_audio support for arm64

From: Marco Devesas Campos <devesas.campos_at_gmail.com>
Date: Mon, 28 Feb 2022 19:36:11 UTC
Entirely right, Ronald — thanks for catching it!

Warner, can I send you a consolidated patch later in the week? What’s the best way to submit it?

Best,
Marco

> On 28 Feb 2022, at 19:26, Ronald Klop <ronald-lists@klop.ws> wrote:
> 
> On Sun, 27 Feb 2022 17:41:25 +0100, Warner Losh <imp@bsdimp.com> wrote:
> 
> 
> 
> On Sun, Feb 27, 2022 at 8:44 AM Marco Devesas Campos <devesas.campos@gmail.com <mailto:devesas.campos@gmail.com>> wrote:
> Hi, List
> 
> On the back of Ronald Klop's comments (thanks!), I went and got myself an
> RPI 4 and it turns out all that was need was adding the right dtb
> reference and it all works (seemingly) fine (incremental patch attached).
> 
> I've committed the patch below. If it turns out we need more, we can always augment.
> 
> 
> Hi Marco, Warner,
> 
> Isn't the patch from https://lists.freebsd.org/archives/freebsd-arm/2022-February/000949.html needed also?
> As you mention the patch below is an incremental patch?
> 
> Regards,
> Ronald.
> 
> 
> 
> 
> 
> 
> 
> Warner
>  
> One of the potential projects highlighted in the latest call for proposals
> was exactly to get hdmi audio output in 64 bit Pis, viz. the 400-s. If
> anyone who voted for that reads this list, wd be nice to get some input on
> the patches.
> 
> Best,
> Marco
> 
> 
> 
> diff --git a/sys/contrib/vchiq/interface/vchiq_arm/vchiq_kmod.c b/sys/contrib/vchiq/interface/vchiq_arm/vchiq_kmod.c
> index dc18678b99a3..344267ff0c1c 100644
> --- a/sys/contrib/vchiq/interface/vchiq_arm/vchiq_kmod.c
> +++ b/sys/contrib/vchiq/interface/vchiq_arm/vchiq_kmod.c
> @@ -83,6 +83,7 @@ static struct bcm_vchiq_softc *bcm_vchiq_sc = NULL;
>  static struct ofw_compat_data compat_data[] = {
>         {"broadcom,bcm2835-vchiq",      BSD_DTB},
>         {"brcm,bcm2835-vchiq",          UPSTREAM_DTB},
> +       {"brcm,bcm2711-vchiq",          UPSTREAM_DTB},
>         {NULL,                          0}
>  };
> 
> 
> 
> > On 8 Feb 2022, at 08:49, Ronald Klop <ronald-lists@klop.ws <mailto:ronald-lists@klop.ws>> wrote:
> > 
> > Van: Ronald Klop <ronald-lists@klop.ws <mailto:ronald-lists@klop.ws>>
> > Datum: maandag, 7 februari 2022 21:05
> > Aan: Marco Devesas Campos <devesas.campos@gmail.com <mailto:devesas.campos@gmail.com>>, freebsd-arm@freebsd.org <mailto:freebsd-arm@freebsd.org>
> > Onderwerp: Re: [PATCH] Experimental vchiq and bcm2835_audio support for arm64
> > 
> > On 2/6/22 14:46, Marco Devesas Campos wrote:
> > > Hi Ronald,
> > >
> > > Thanks so much for trying out the patch out.
> > >
> > >> On 6 Feb 2022, at 13:05, Ronald Klop <ronald-lists@klop.ws <mailto:ronald-lists@klop.ws>> wrote:
> > >>
> > >> Hi,
> > >>
> > >> I compiled this on a RPI4 + 14-CURRENT. It boots, but I see no difference in available devices.
> > >> I can try to boot it on a RPI3B+ on another time.
> > >
> > > I *think* the GPU/VC in RPI-4 is a very different beast from the others. I'll
> > > look into it, but if you could give it a try on the 3+ I'd be much obliged.
> > >
> > >>
> > >> What would be the expected outcome? Where should I look at (or listen to)?
> > >>
> > >
> > > You should see something like
> > >
> > >    vchiq0: <BCM2835 VCHIQ> mem 0x7e00b840-0x7e00b87b irq 54 on simplebus0
> > >    vchiq: local ver 8 (min 3), remote ver 8.
> > >    pcm0: <VCHIQ audio> on vchiq0
> > >
> > > in your dmesg output.
> > >
> > > The file /dev/vchiq should exist, as well as the following sysctl-s (I'm
> > > assuming no other audio devices are attached)
> > >
> > >    % sysctl dev.pcm
> > >    dev.pcm.0.trace: 0
> > >    ...
> > >    dev.pcm.0.dest: 0
> > >    ...
> > >    dev.pcm.0.%parent: vchiq0
> > >    ...
> > >    dev.pcm.0.%driver: pcm
> > >    dev.pcm.0.%desc: VCHIQ audio
> > >    …
> > >
> > > Then if you `cat < /dev/random > /dev/dsp` you should hear some static coming
> > > out of whatever is connected to hdmi (maybe headphones too? otherwise try
> > > setting `sysctl dev.pcm.0.dest=1`)
> > >
> > > Best,
> > > Marco
> > 
> > 
> > Hi,
> > 
> > Booted the patched 14-CURRENT on the RPI3B+.
> > 
> > dmesg diff:
> > +vchiq0: <BCM2835 VCHIQ> mem 0x7e00b840-0x7e00b87b irq 54 on simplebus0
> > +vchiq: local ver 8 (min 3), remote ver 8.
> > +pcm0: <VCHIQ audio> on vchiq0
> > 
> > [root@rpi3 ~]# cat /dev/sndstat
> > Installed devices:
> > pcm0: <VCHIQ audio> (play) default
> > No devices installed from userspace.
> > 
> > [root@rpi3 ~]# sysctl dev.pcm
> > dev.pcm.0.trace: 0
> > dev.pcm.0.starved: 0
> > dev.pcm.0.freebuffer: 40000
> > dev.pcm.0.underruns: 0
> > dev.pcm.0.retrieved: 0
> > dev.pcm.0.submitted: 0
> > dev.pcm.0.callbacks: 0
> > dev.pcm.0.dest: 0
> > dev.pcm.0.mode: 3
> > dev.pcm.0.bitperfect: 0
> > dev.pcm.0.buffersize: 0
> > dev.pcm.0.play.vchanformat: s16le:2.0
> > dev.pcm.0.play.vchanrate: 48000
> > dev.pcm.0.play.vchanmode: fixed
> > dev.pcm.0.play.vchans: 1
> > dev.pcm.0.%parent: vchiq0
> > dev.pcm.0.%pnpinfo:
> > dev.pcm.0.%location:
> > dev.pcm.0.%driver: pcm
> > dev.pcm.0.%desc: VCHIQ audio
> > dev.pcm.%parent:
> > 
> > 
> > To play some audio I need to search some headphones first. :-)
> > 
> > Ronald.
> >  
> > 
> > 
> > Good morning,
> > 
> > Found headphones with a cable on the attic. Plugged it into the audio jack and played an mp3. Amazing!
> > 
> > Regards,
> > Ronald.
> >  
> 
> 
> 
> 
>