From nobody Mon Feb 28 19:42:24 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 ACB1F19DE04D for ; Mon, 28 Feb 2022 19:42:38 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ua1-x934.google.com (mail-ua1-x934.google.com [IPv6:2607:f8b0:4864:20::934]) (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 4K6rPn3sN5z4bxs for ; Mon, 28 Feb 2022 19:42:37 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-ua1-x934.google.com with SMTP id a28so1439891uaf.7 for ; Mon, 28 Feb 2022 11:42:37 -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=tDZh1g/07oJxcvyZ93i3L1V5dxn8ACurxnd1slHIhyw=; b=Vxpm7UgIkUasRW3pl7yv7tavW2wXMTSQw5VuUV0MZTDWdlZJCJTqPJB+A6tdR5CQF5 9+p0xEG1yZbprq0+sFT07fS9tCPdGOd71ZvvRbJUdlObqcEkFCwI42KXoJjB5iu62V5E onWmHQJ6Z8/ddIekX2FpiVOl565bOSiiwTcRxNn/z8eqJLcWA0d8/180faI97gqhIt5e de57h71cIqA4MQnIoIW9neEgo1D1Eszo2u82k1z8RRc0jsLmc3x+WhCy4NnksZ/YnIOQ ufHlJnvJeR2YR+6I/82q34shfCok4v0QJWM/jNRn8HAU7DY9iC9oXhQbcupJfPnHi1l5 g/bg== 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=tDZh1g/07oJxcvyZ93i3L1V5dxn8ACurxnd1slHIhyw=; b=MGV/RuLqa+1he72aCjJSB6ptq3nAnx6OWjsJKU/jr18hZkIpxbvaiqEz/ENr83JI/n UpKheStuyVNzt1/02ny1XiOlCl7E7zl9XJrq9eK82425VwKwKV/LQjvoBH+iZds147gp s9P6JlTpUtxEF/6yHNsJ28wQCcAb3ICK2Gf8QsgKoFQTYJveq7k5voal7pdhGStGmMtH pxOihpaxlixjZBaUSNVlzLZitFdy/Z9gC83wCfDNWghErC/XT4KPVp/O35s4qF6B0Mmj VEBJOIEQS9GRnHAVuyHqQA+TcEuxSStdL445/zG13ipDVpbKK+93ztBlEReuys3LvVQW Ch/Q== X-Gm-Message-State: AOAM532M0JGQHsWrrIXWgSmbJP2XI19PVaZTiNE43pnZUk5bunOCg3iA 8zfN5rPUn9S4J57puiIN/Flp+xsAL0qodtYIbIKRxppcDVU= X-Google-Smtp-Source: ABdhPJz64GQZC8qdbP5qwdcPmLSziTqwBfHxcNVDAfla2UUnw3rvtci9hZaXg65kDRSP2kqu0j32RC6O/uEzRIIYYQY= X-Received: by 2002:ab0:694d:0:b0:340:618e:57a5 with SMTP id c13-20020ab0694d000000b00340618e57a5mr8117555uas.54.1646077356811; Mon, 28 Feb 2022 11:42: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> <87A63A19-5807-4BA9-9821-D3378129CDB5@gmail.com> In-Reply-To: <87A63A19-5807-4BA9-9821-D3378129CDB5@gmail.com> From: Warner Losh Date: Mon, 28 Feb 2022 12:42:24 -0700 Message-ID: Subject: Re: [PATCH] Experimental vchiq and bcm2835_audio support for arm64 To: Marco Devesas Campos Cc: Ronald Klop , "freebsd-arm@freebsd.org" Content-Type: multipart/alternative; boundary="000000000000203d1605d9194013" X-Rspamd-Queue-Id: 4K6rPn3sN5z4bxs X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20210112.gappssmtp.com header.s=20210112 header.b=Vxpm7UgI; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::934) 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::934: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 --000000000000203d1605d9194013 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Feb 28, 2022, 12:36 PM Marco Devesas Campos < devesas.campos@gmail.com> wrote: > Entirely right, Ronald =E2=80=94 thanks for catching it! > Oops Warner, can I send you a consolidated patch later in the week? What=E2=80= =99s the > best way to submit it? > Git format-patch is likely best. Warner > Best, > Marco > > On 28 Feb 2022, at 19:26, Ronald Klop wrote: > > On Sun, 27 Feb 2022 17:41:25 +0100, Warner Losh wrote: > > > > 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 a= n >> 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 proposa= ls >> 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 =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 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 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: 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 >> static coming >> > > out of whatever is connected to hdmi (maybe headphones too? otherwis= e >> 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 simplebus= 0 >> > +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. >> > >> >> >> > > > > --000000000000203d1605d9194013 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Mon, Feb 28, 2022, 12:36 PM Marco Devesas Campos &l= t;devesas.campos@gmail.com&= gt; wrote:
Entirely right, Ronald =E2=80=94 t= hanks for catching it!

Oops

Warner, can I s= end you a consolidated patch later in the week? What=E2=80=99s the best way= to submit it?

<= /div>
Git format-patch is likely best.

Warner=C2=A0


Best,
Marco

On 28 Feb 2022, a= t 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, Fe= b 27, 2022 at 8:44 AM Marco Devesas Campos <devesas.campos@gmail.c= om> wrote:
https://lists.freebsd.org/archives/freebsd-arm/2022-February/000949.htm= l needed also?
As you mention the patch below is an increment= al patch?

Regards,
Ronald.





Warner
=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






--000000000000203d1605d9194013--