Audio out from TV speakers using VCHIQ on Raspberry Pi 4B, 400, or 3B , 3B+ [SOLVED]

From: Fred Finster <fred_at_thegalacticzoo.com>
Date: Mon, 26 Aug 2024 17:18:41 UTC
Here is my solution for patching FreeBSD kernel source code and also 
patching GhostBSD kernel source code with exact same 3 patches from 
Marcos Devesas-Campos

My review is here D43399 review.freebsd.org

https://reviews.freebsd.org/D37878

https://reviews.freebsd.org/D37879

https://reviews.freebsd.org/D36431

https://reviews.freebsd.org/D43399


I am looking for confirmation from your testing that these patches do 
work or DO NOT WORK.   They did work for me on both standard FREEBSD 
kernel source code at  /usr//src  and also on GhostBSD kernel source 
code at my selected directory location of /usr/ghost14/src

Questons:  Does the audio come out your HDMI Television speakers?  YES, 
NO, SOMETIMES ?? Why?

Can you change from HDMI audio only, to analog 3.5MM headphones, or both 
at the sametime?

Does using these patch files, work also on the Raspberry Pi 3B and 
Raspberry 3B+,  Raspberry Pi 400 keyboard model SBC, Raspberry Pi 4 
compute module.

Anybody get a BlueTooth USB dongle working on Arm64 Raspberry Pi 
hardware or other Arm64 SBC?


Raspberry Pi 5 users will have to test their different HDMI audio setup 
(not VCHIQ internal subsystem in the BCM2712 SOC) and let others know 
about their findings of playing Videos with sound coming out the HDMI 
Television speakers or out Bluetooth connected audio (I do not know if 
Bluetooth is supported on Raspberry Pi 5 or you have to add a USB dongle).

https://forums.freebsd.org/threads/raspberry-pi-5-status.91406/page-3 
Here is RPI 5 Status Forums page

https://ghostbsd-arm64.blogspot.com  search on word  HDMI or Audio to 
find the relevant blog post.

Review D43399 has instructions and URL links to other bits and pieces.  
I posted a detailed write up on a Fxxxxxx image where I wrote a reply to 
Chinese developer.]

https://reviews.freebsd.org/D43399

https://reviews.freebsd.org/F75131370   Here is an explicit write up how 
to download and use 3 patches for enabling HDMI Audio through the VCHIQ 
sub system inside the SOC BCM2711.

~~~~~~~~~

sysctl dev.pcm.0.dest

sysctl dev.pcm.0.dest=0   plays audio on analog 3.5mm jack and HDMI 
Audio at the same time.

Marcos FreeBSD-arm maillist post on Raspberry Pi VCHIQ audio sound 
usage. 
<https://lists.freebsd.org/archives/freebsd-arm/2022-September/001711.html>

From: Marco Devesas Campos <devesas.campos_at_gmail.com>
Date: Tue, 06 Sep 2022 11:23:08 UTC

Hi

    On 7 Sep 2022, at 06:04, Fred Finster <fred@thegalacticzoo.com> wrote:

    VCHIQ sound on Raspi4B HDMI audio. Which DTB to include on
    config.txt file, Any other missing pieces?

stock confit.txt and dtb-s.

dmesg should then show

vchiq0: <BCM2835 VCHIQ> mem 0x7e00b840-0x7e00b87b irq 72 on simplebus0
vchiq: local ver 8 (min 3), remote ver 8.
pcm0: <VCHIQ audio> on vchiq0

and

cat /dev/random > /dev/dsp

should play static

If nothing’s playing, flipping the sysctl dev.pcm.0.dest through

  * 0: both hdmi and headphones
  * 1: headphones
  * 2: hdmi

usually brings the audio back to life.

Best,
Marco

  * Wish you a SOUND fun time using this VCHIQ Audio patch for FreeBSD
    on the Raspberry Pi **

~~~~~~~~~

ps.  Anybody test and verify drivers for the extra serial ports on the 
raspberry Pi 4B hardware. Uart0, Uart1 ttys work, but Uart2, Uart3, 
Uart4, Uart5  do not work and are not tested.  How about testing the I2C 
and other serial interfaces (i2S??)? on the Raspberry Pi 4B hardware ( 
3B, 3B+ hardware too)

Slowly but surely progress in using FreeBSD on Arm64 hardware is 
improving.  Thank you FreeBSD Foundation and developers.


pss.  Anybody working on porting the OpenBSD and/or NetBSD device driver 
for the cy445 internal wifi subsystem on the Raspberry Pi 4B, 400 
hardware SBC?  I have looked at the OpenBSD bwfm driver source code.  
The realtek chipset in a USB dongle does work for internet connectivity 
via wifi from raspberry pi SBCs.  8188eu (TP-Link mfg), 8192cu (Edimax mfg)

psss. Once HDMI Audio VCHIQ is working, would be nice to compile or 
download ORCA screen reader and make this operational on the Raspberry 
Pi hardware for Low Vision users to have an inexpensive desktop computer 
connected to a HDMI television with working TV speakers operational.

Best of luck in your use of FreeBSD Arm64 on other existing SBC 
hardware.  I was really impressed with all the software that just worked 
OOTB (out of the box) with a simple  pkg search  and pkg install geany 
falkon xfce xfce4-goodies for Arm64.  We all benefit by sharing 
information , even when not on a High Powered Arm64 Server.

Yes,  I ran Poudriere 24hours a day (for 30 days) building packages on 
my Raspberry Pi 4B, 8Gigs dram, 1 Terabyte USB SSD. Ugreen Case with 
realtek interface chip inside to connect USB to a M.2 NVME stick inside 
a metal case.  Poudriere did build the packages and the NGINX web server 
served the packages to the world using a NO-IP.com URL for a dynamic-IP 
connection at my home. ( I recently moved so am not setup again with the 
Raspberry Pi online and not working presently 
http://ghostbsdarm64.hopto.org) Leaving here as a future reference.


psss.   What is your JTAG debug setup for ddb or gdb with your Arm64 
hardware?.  I was looking at BMP Black Magic Probe hardware, but looks 
like it support 32 bit ARM debug and not 64 bit ARM debug.  The other 
JTAG hardware with 1.8 - 3.3V ttl serial interface is the "JEFF Probe" 
by FLIRC.  What do you suggest as a good JTAG interface tool?  What 
works for you?

https://forums.freebsd.org/threads/debugging-arm64-booting-of-freebsd-ghostbsd-kernel-for-raspberry-pi-4-what-tool-do-you-use-any-jtag-hardware-kernel-debug.90436/#post-623625


Thank you for reading.  Yes, I asked many related questions.  I hope you 
answer a few questions over on a post at https://forums.freebsd.org

Fred Finster (temp phone 503-949-oh-seven-six-six)


-- 
Fred Finster  971-718-9144
https://ghostbsd-arm64.blogspot.com