From nobody Sun Feb 27 16:41:25 2022 X-Original-To: freebsd-arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 16CC919E7EA0 for ; Sun, 27 Feb 2022 16:41:43 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-vk1-xa2c.google.com (mail-vk1-xa2c.google.com [IPv6:2607:f8b0:4864:20::a2c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4K68RV33y1z4kyc for ; Sun, 27 Feb 2022 16:41:42 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-vk1-xa2c.google.com with SMTP id j12so4071390vkr.0 for ; Sun, 27 Feb 2022 08:41:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nkXUbSHLyqrEUVuhJlsyhcPKDUiju4uYm+9Kikn6T5I=; b=efKABpavKIme+20F23UZ8u48eMNMb5TIbXMzxhDsVtWFCFmxjZyD62QNYCMw3WcsJH C/fPgx2L/znpcWHBHPbqHU7So1huQ+NP+8Nk+y5CPDlXDAgL49C9zqNvGsZIAn2qsnX2 9gzoYuj+XjX6pjw+KY8Tc8Ukx9f01SHs1hg2ebqrXbQWlUBpR3kVoFMHLxWlp4p++Kj/ FLiKyjVRsTdgN/NFlI/4eiJHX3bZlsD94+K57l6dd1RmhU0g83qcFJfNaZ0kfrvdUaMl +fy/6DYpzUss/2ENSQQq1oTDQBYkqDcFGxlWzmuCe1HscDR2j1jUf4gvNEAjDtjNxS5y 8geg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nkXUbSHLyqrEUVuhJlsyhcPKDUiju4uYm+9Kikn6T5I=; b=hcSg5AeHXdJ1dInaDCsaNx+U/jt7jMhsyL3dLuT1U/dtcWnKYyLaoUprzX6M1Z5D6G +tuI8Z7ccQRQ/3Xndbp5ffFAr2ms6GFuFFpuFwHfRJeQ9is+ioIdFCNty+xCwFSfuO3a WE+QEb/3opbKfwlch9nDQ0KRBAlQ/grQvmt73Jfg7b2Q9+aIiDPthXltwSrueIznTeOd GwklWFXEylEIUPC7RQ7nMZHcNED83dbq6j2bg/tFkJ3IZVXVtRt6jyXXwXjYQMl/nTEq IL0RSOEk5f6U1A070ymI+qgwtsNPeLtZUE9vN4q3KqzmDOtH30d8uO2rtbI96CnmMkuI foYg== X-Gm-Message-State: AOAM532Fa9dGPufXv4ubMfuPg3Phj5wb2/mKoVlaU0G3Zg+vUk5Lg6rw kHBScCbJv+ecIU7/xh3PmXp0cHIzo9Bi0fb1W4GkQ2vkGCs= X-Google-Smtp-Source: ABdhPJxe++bPnEZKQeiD0wP7G7R1PPPX8zSyETZqW89gVS/Bl+xU7ZugevPzrAbdhey2GjbGrtFnbzKF3mZmMDx3J48= X-Received: by 2002:a1f:2355:0:b0:32a:e5bb:29a1 with SMTP id j82-20020a1f2355000000b0032ae5bb29a1mr6765088vkj.2.1645980096266; Sun, 27 Feb 2022 08:41:36 -0800 (PST) List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org MIME-Version: 1.0 References: <8EC05647-00D9-455B-98A9-B83A33DDFC5D@gmail.com> <48190d6a-fc5d-7da9-ddfd-fded48d429db@klop.ws> <106195874.50.1644310150579@localhost> In-Reply-To: From: Warner Losh Date: Sun, 27 Feb 2022 09:41:25 -0700 Message-ID: Subject: Re: [PATCH] Experimental vchiq and bcm2835_audio support for arm64 To: Marco Devesas Campos Cc: "freebsd-arm@freebsd.org" , Ronald Klop Content-Type: multipart/alternative; boundary="000000000000f2174005d9029a6a" X-Rspamd-Queue-Id: 4K68RV33y1z4kyc X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20210112.gappssmtp.com header.s=20210112 header.b=efKABpav; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::a2c) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.00 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20210112.gappssmtp.com:s=20210112]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-arm@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20210112.gappssmtp.com:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::a2c:from]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; MLMMJ_DEST(0.00)[freebsd-arm]; FREEMAIL_TO(0.00)[gmail.com]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; R_SPF_NA(0.00)[no SPF record]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com] X-ThisMailContainsUnwantedMimeParts: N Status: O Content-Length: 11428 Lines: 351 --000000000000f2174005d9029a6a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Feb 27, 2022 at 8:44 AM Marco Devesas Campos < 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. Warner > One of the potential projects highlighted in the latest call for proposal= s > 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 o= n > 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 =3D NULL; > static struct ofw_compat_data compat_data[] =3D { > {"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 wrote: > > > > Van: Ronald Klop > > Datum: maandag, 7 februari 2022 21:05 > > Aan: Marco Devesas Campos , > 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 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 liste= n > to)? > > >> > > > > > > You should see something like > > > > > > vchiq0: mem 0x7e00b840-0x7e00b87b irq 54 on > simplebus0 > > > vchiq: local ver 8 (min 3), remote ver 8. > > > pcm0: 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 > > > =E2=80=A6 > > > > > > Then if you `cat < /dev/random > /dev/dsp` you should hear some stati= c > coming > > > out of whatever is connected to hdmi (maybe headphones too? otherwise > try > > > setting `sysctl dev.pcm.0.dest=3D1`) > > > > > > Best, > > > Marco > > > > > > Hi, > > > > Booted the patched 14-CURRENT on the RPI3B+. > > > > dmesg diff: > > +vchiq0: mem 0x7e00b840-0x7e00b87b irq 54 on simplebus0 > > +vchiq: local ver 8 (min 3), remote ver 8. > > +pcm0: on vchiq0 > > > > [root@rpi3 ~]# cat /dev/sndstat > > Installed devices: > > pcm0: (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. > > > > > --000000000000f2174005d9029a6a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Sun, Feb 27, 2022 at 8:44 AM Marco= Devesas Campos <devesas.cam= pos@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 i= t turns out we need more, we can always augment.

W= arner
=C2=A0
One of the potential projects highlighted in the latest call for proposals<= br> 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<= br> the patches.

Best,
Marco



diff --git a/sys/contrib/vchiq/interface/vchiq_arm/vchiq_kmod.c b/sys/contr= ib/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 =3D NULL;
=C2=A0static struct ofw_compat_data compat_data[] =3D {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 {"broadcom,bcm2835-vchiq",=C2=A0 =C2= =A0 =C2=A0 BSD_DTB},
=C2=A0 =C2=A0 =C2=A0 =C2=A0 {"brcm,bcm2835-vchiq",=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 UPSTREAM_DTB},
+=C2=A0 =C2=A0 =C2=A0 =C2=A0{"brcm,bcm2711-vchiq",=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 UPSTREAM_DTB},
=C2=A0 =C2=A0 =C2=A0 =C2=A0 {NULL,=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 0}
=C2=A0};



> On 8 Feb 2022, at 08:49, Ronald Klop <ronald-lists@klop.ws> wrote:
>
> Van: Ronald Klop <ronald-lists@klop.ws>
> Datum: maandag, 7 februari 2022 21:05
> Aan: Marco Devesas Campos <devesas.campos@gmail.com>, freebsd-arm@freebsd.org
> Onderwerp: Re: [PATCH] Experimental vchiq and bcm2835_audio support fo= r 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> wrote: > >>
> >> Hi,
> >>
> >> I compiled this on a RPI4 + 14-CURRENT. It boots, but I see n= o 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 (o= r listen to)?
> >>
> >
> > You should see something like
> >
> >=C2=A0 =C2=A0 vchiq0: <BCM2835 VCHIQ> mem 0x7e00b840-0x7e00b= 87b irq 54 on simplebus0
> >=C2=A0 =C2=A0 vchiq: local ver 8 (min 3), remote ver 8.
> >=C2=A0 =C2=A0 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)
> >
> >=C2=A0 =C2=A0 % sysctl dev.pcm
> >=C2=A0 =C2=A0 dev.pcm.0.trace: 0
> >=C2=A0 =C2=A0 ...
> >=C2=A0 =C2=A0 dev.pcm.0.dest: 0
> >=C2=A0 =C2=A0 ...
> >=C2=A0 =C2=A0 dev.pcm.0.%parent: vchiq0
> >=C2=A0 =C2=A0 ...
> >=C2=A0 =C2=A0 dev.pcm.0.%driver: pcm
> >=C2=A0 =C2=A0 dev.pcm.0.%desc: VCHIQ audio
> >=C2=A0 =C2=A0 =E2=80=A6
> >
> > Then if you `cat < /dev/random > /dev/dsp` you should hear = some static coming
> > out of whatever is connected to hdmi (maybe headphones too? other= wise try
> > setting `sysctl dev.pcm.0.dest=3D1`)
> >
> > Best,
> > Marco
>
>
> Hi,
>
> Booted the patched 14-CURRENT on the RPI3B+.
>
> dmesg diff:
> +vchiq0: <BCM2835 VCHIQ> mem 0x7e00b840-0x7e00b87b irq 54 on sim= plebus0
> +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.
>=C2=A0
>
>
> Good morning,
>
> Found headphones with a cable on the attic. Plugged it into the audio = jack and played an mp3. Amazing!
>
> Regards,
> Ronald.
>=C2=A0


--000000000000f2174005d9029a6a--