Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No HDMI audio/sound for Recalbox(RetroPie?) on newer kernels > v.5(working&tested fix) #27

Closed
Vegz78 opened this issue Dec 17, 2021 · 1 comment
Labels
bugfix/workaround Fixes and workarounds for specific issues documentation Improvements or additions to documentation enhancement New feature or request

Comments

@Vegz78
Copy link
Owner

Vegz78 commented Dec 17, 2021

With the advent of newer Linux kernels on the Raspberry Pi, specifically for the newest Recalbox version 8.0 on newer Linux kernels above version 5 and with the vc4-kms-v3d graphics driver, the HDMI audio is now delivered through a new separate vc4 device/module instead of the regular bcm2835, like before.

On some distros, like Recalbox v 8.0, the vc4 HDMI audio device is then not located on the alsa default hw:0,0 first audio device, which MakeCode Arcade(MCA) games requires for audio playback.

This means that MCA games plays back audio perfectly fine on JACK/analog output, but is also stuck to analog, without this workaround.

I have only tested on Recalbox v 8.0, and I am not sure if this applies as well to the regular Raspberry Pi OS and RetroPie distros on Linux kernel versions 5 and above. But it is likely that the same is true there in combination with the new vc4-kms-v3d driver, and possibly it will have a similar solution/workaround to the one described here.

It should also be possible to circumvent this problem by disabling the vc4-kms-v3d driver, or using the old fake vc4-fkms-v3d(maxframbuffers=2?) driver, but this is not desirable if you want the newest support for hardware accelerated graphics.

SOLUTION:
The workaround that was tested ok for MCA HDMI sound on Recalbox v8.0 is based on the earlier fix for USB sound by @QuadDam / @Dace:
McAirpos/issues/11
https://forum.makecode.com/t/just-finished-another-cabinet-for-school/5658/28
https://sudomod.com/forum/viewtopic.php?f=20&t=144

In addition, I found some required and working changes to the vc4-hdmi.conf by @dom at the Raspberry Pi forum:
https://forums.raspberrypi.com/viewtopic.php?f=29&t=269769&p=1636828#p1636828

Steps:
(NB!: REMEMBER TO BACK UP THE ORIGINAL FILES FIRST!)

  1. Copy this file to /etc/modprobe.d or edit the existing alsa-base.conf accordingly:
    alsa-base.conf.zip
  2. Copy this file to /usr/share/alsa/cards or edit the existing vc4-hdmi.conf accordingly:
    vc4-hdmi.conf.zip
  3. Reboot
@Vegz78 Vegz78 added bugfix/workaround Fixes and workarounds for specific issues documentation Improvements or additions to documentation enhancement New feature or request labels Dec 17, 2021
@Vegz78 Vegz78 changed the title No HDMI audo/sound for Recalbox(RetroPie?) on newer kernels > v.5(working&tested fix) No HDMI audio/sound for Recalbox(RetroPie?) on newer kernels > v.5(working&tested fix) Dec 21, 2021
@Vegz78 Vegz78 closed this as completed Dec 21, 2021
@Vegz78
Copy link
Owner Author

Vegz78 commented May 10, 2022

To reiterate on this point and for my own memory:

MakeCode Arcade games are hardcoded to choose ALSA device hw:0,0, irrespectively of other audio settings on higher tiers, in Recalbox/RetroPie menus, different emulators, Pulseaudio etc.

hw:0,0 means the first audio card's first audio subdevice, if I am not mistaken.

Following the kernel versions >= 5 on Raspberry Pis using the vc4-kms-v3d graphics driver(e.g. Recalbox versions <= 8), this driver implements its own HDMI audio card device separated from the bcm2835 card, which now contains only the jack audio output subdevices, instead of both as in earlier kernel versions.

The audio setup for each system can be found by issuing commands like:

  • aplay -l
  • cat /proc/asound/cards
  • cat /proc/asound/devices
  • cat /proc/asound/modules, and
  • cat /proc/asound/pcm etc.

From the lack of full oversight on how this is set up on all various systems, including different upgrade paths, I've identified two functioning workarounds:

  1. The one described in the post above, which is also implemented in two different automatic setup scripts for Recalbox versions >= 8, for hard configuration of jack or HDMI audio, respectively, for MakeCode Arcade games.
    (This workaround from the above post should work also on RetroPie and Raspberry Pi OS installations with kernels >= 5 if you experience problems setting MCA games audio to either jack or HDMI, but not automatically in any script yet)
  2. It is also possible on most systems to disable the audio card you will NOT be using, for example disabling HDMI audio to force jack audio onto hw:0,0:
    (/boot/config.txt might be overwritten on system upgrades on Recalbox etc., requiring this workaround to be repeated)
    1. On Recalbox only: mount -o remount,rw /boot
    2. nano /boot/config.txt (Normally requires sudo on systems other than Recalbox)
    3. Disabling HDMI: Alter dtoverlay=vc4-kms-v3d to dtoverlay=vc4-kms-v3d,noaudio (under section header [pi4] on Recalbox, usually in main section otherwise)
    4. Disabling jack: Comment out the line dtparam=audio=on in the main section or relevant section for Recalbox
    5. Save, exit and reboot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix/workaround Fixes and workarounds for specific issues documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant