From nobody Mon Feb 28 19:36:11 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 00E2C19DC177 for ; Mon, 28 Feb 2022 19:36:15 +0000 (UTC) (envelope-from devesas.campos@gmail.com) Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) (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 4K6rGQ1FTRz4YxD for ; Mon, 28 Feb 2022 19:36:14 +0000 (UTC) (envelope-from devesas.campos@gmail.com) Received: by mail-wr1-x42f.google.com with SMTP id p9so17053667wra.12 for ; Mon, 28 Feb 2022 11:36:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=c/0GYb0T8uqvWGRbF6jNI6mWgy15HBnVMiyU5Q+Y23Y=; b=iRGVwCmtlBmNHBI5CCmKO/deP9yhe2vdKyiV3YyseW0ExTdiYf64BCBptJi1G1qJfS 6AaeuX0v49hYEDTTam9I9ZX3aLd+2scXP0y80RqqXzsqEPGLHVtysFkqhd5W0Yvxsl6/ aREhrSLwzRKKif/xiSV18aokW5uMisViDVYpFrq6purn8BQshTs+wI70TQg/7nX7sMh8 eyop/P+DL/4PhSt3nR/ampqMFQ7aOnkj6UNPSXfs/43IUSnRDbJzYu7k8KRh3vhAijnf f2Pwf/D1mL1UvXlu2rzU4XrjFqs5cYdd6s71d11773y5F/Dy3jqiOhT+pxmaab/4yd4S 2lqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=c/0GYb0T8uqvWGRbF6jNI6mWgy15HBnVMiyU5Q+Y23Y=; b=2je5cFw/197ek6Hq0Rdh9W1k5EhHNJL70F4oKEi6/cO4hcjoXXVKOWkE0GaWyx9raV hmOTtjte7Hi2WtfNGxISdIny6q5D/tkdC40p0DC9si62+vMWFHxOvjQQVXTKZrRrx8Bq H6yRl4QPHQQ4xZhuwcOMzobwRE92Gnn/GnD7QCX7X2aEHG3Giw9zzKnEI/eY7Bjw0U9e 5ilpH8WFqtdXbD6fST7aQt/n+0hBTADcwiU9LOaLy7Bt5CKwFZ4TliaEcAIFW+BScmPg 23uFl33ArCrAsrc3kwFUbYFF4pVE9FFyjalwr7F5E6BY3WtCX7Cm8tixbjBz19iz0zaI 9Snw== X-Gm-Message-State: AOAM531rTMMjdvaWlwWpt/MCCa25KgQ8adM6l1+TIqrLOoKfq8VESxwQ LrDUaByvaNzMc6xUSxrRYHo= X-Google-Smtp-Source: ABdhPJxzUa5/IOINIm0vHaX/v1Th0itGpEcceYZpdU9f66SfkHJg3YR/gC6k48qaJo0IIhFtbcZETQ== X-Received: by 2002:a5d:64ed:0:b0:1ef:e1e2:1fcb with SMTP id g13-20020a5d64ed000000b001efe1e21fcbmr3532985wri.37.1646076973099; Mon, 28 Feb 2022 11:36:13 -0800 (PST) Received: from smtpclient.apple (a213-22-242-181.cpe.netcabo.pt. [213.22.242.181]) by smtp.gmail.com with ESMTPSA id b15-20020adfe64f000000b001e60965a5d4sm11303521wrn.44.2022.02.28.11.36.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Feb 2022 11:36:12 -0800 (PST) From: Marco Devesas Campos Message-Id: <87A63A19-5807-4BA9-9821-D3378129CDB5@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_6390B139-EA65-43CA-B7BA-C9C88ABEB429" 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 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: [PATCH] Experimental vchiq and bcm2835_audio support for arm64 Date: Mon, 28 Feb 2022 19:36:11 +0000 In-Reply-To: Cc: Warner Losh , "freebsd-arm@freebsd.org" To: Ronald Klop References: <8EC05647-00D9-455B-98A9-B83A33DDFC5D@gmail.com> <48190d6a-fc5d-7da9-ddfd-fded48d429db@klop.ws> <106195874.50.1644310150579@localhost> X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4K6rGQ1FTRz4YxD X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=iRGVwCmt; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of devesascampos@gmail.com designates 2a00:1450:4864:20::42f as permitted sender) smtp.mailfrom=devesascampos@gmail.com X-Spamd-Result: default: False [-3.50 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MV_CASE(0.50)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; RECEIVED_SPAMHAUS_PBL(0.00)[213.22.242.181:received]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-arm@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::42f:from]; MLMMJ_DEST(0.00)[freebsd-arm]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N --Apple-Mail=_6390B139-EA65-43CA-B7BA-C9C88ABEB429 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Entirely right, Ronald =E2=80=94 thanks for catching it! Warner, can I send you a consolidated patch later in the week? What=E2=80=99= s the best way to submit it? Best, Marco > On 28 Feb 2022, at 19:26, Ronald Klop wrote: >=20 > On Sun, 27 Feb 2022 17:41:25 +0100, Warner Losh = wrote: >=20 >=20 >=20 > On Sun, Feb 27, 2022 at 8:44 AM Marco Devesas Campos = > wrote: > Hi, List >=20 > 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). >=20 > I've committed the patch below. If it turns out we need more, we can = always augment. >=20 >=20 > Hi Marco, Warner, >=20 > 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? >=20 > Regards, > Ronald. >=20 >=20 >=20 >=20 >=20 >=20 >=20 > Warner > =20 > 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. >=20 > Best, > Marco >=20 >=20 >=20 > 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} > }; >=20 >=20 >=20 > > On 8 Feb 2022, at 08:49, Ronald Klop > wrote: > >=20 > > 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 > >=20 > > 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? = otherwise try > > > setting `sysctl dev.pcm.0.dest=3D1`) > > > > > > Best, > > > Marco > >=20 > >=20 > > Hi, > >=20 > > Booted the patched 14-CURRENT on the RPI3B+. > >=20 > > dmesg diff: > > +vchiq0: mem 0x7e00b840-0x7e00b87b irq 54 on = simplebus0 > > +vchiq: local ver 8 (min 3), remote ver 8. > > +pcm0: on vchiq0 > >=20 > > [root@rpi3 ~]# cat /dev/sndstat > > Installed devices: > > pcm0: (play) default > > No devices installed from userspace. > >=20 > > [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: > >=20 > >=20 > > To play some audio I need to search some headphones first. :-) > >=20 > > Ronald. > > =20 > >=20 > >=20 > > Good morning, > >=20 > > Found headphones with a cable on the attic. Plugged it into the = audio jack and played an mp3. Amazing! > >=20 > > Regards, > > Ronald. > > =20 >=20 >=20 >=20 >=20 >=20 --Apple-Mail=_6390B139-EA65-43CA-B7BA-C9C88ABEB429 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Entirely right, Ronald =E2=80= =94 thanks for catching it!

Warner, can I send you a = consolidated patch later in the week? What=E2=80=99s 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> 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,

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 =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 <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 = 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> 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
> >    =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? = otherwise 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 = 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.







= --Apple-Mail=_6390B139-EA65-43CA-B7BA-C9C88ABEB429--