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

hdmi-output: not working in RPi4 #79

Closed
tmigone opened this issue Jan 15, 2020 · 11 comments · Fixed by #154
Closed

hdmi-output: not working in RPi4 #79

tmigone opened this issue Jan 15, 2020 · 11 comments · Fixed by #154
Labels
bug Something isn't working

Comments

@tmigone
Copy link
Contributor

tmigone commented Jan 15, 2020

HDMI audio is not working on Pi 4.

@tmigone tmigone added the bug Something isn't working label Jan 22, 2020
@zchbndcc9
Copy link

Bump. I am experiencing the same issue

@zchbndcc9
Copy link

Fixed by adding RESIN_HOST_CONFIG_hdmi_mode set to 2 in the configuration settings.

@AlexProgrammerDE
Copy link
Contributor

@tmigone works the comment from zchbndcc9 for you?

@AlexProgrammerDE AlexProgrammerDE linked a pull request Apr 10, 2020 that will close this issue
@AlexProgrammerDE AlexProgrammerDE linked a pull request Apr 10, 2020 that will close this issue
@AlexProgrammerDE
Copy link
Contributor

All fixes are included in the troubleshooting: https://landr-balenalabs-repo-balena-sound.netlify.app/docs/troubleshooting/ Closing.

@AlexdrFontes
Copy link

it did not work for me with a clean install

@chrisys
Copy link
Member

chrisys commented Jan 11, 2021

@AlexdrFontes could you give any more information? I've just done a fresh deploy of the latest version of the software onto a Pi 4 here and it worked fine without any changes.

@chrisys
Copy link
Member

chrisys commented Jan 11, 2021

@AlexdrFontes ah, I'm replying to you on the forum here https://forums.balena.io/t/hdmi-audio-output-only-on-balenasound/232278

@AlexdrFontes
Copy link

Thank you

@chrisys
Copy link
Member

chrisys commented Jan 11, 2021

This seems to be reoccuring: balena-os/balena-raspberrypi#586

@chrisys chrisys reopened this Jan 11, 2021
@tmigone
Copy link
Contributor Author

tmigone commented Feb 12, 2021

Hi @AlexdrFontes @chrisys, this is consequence of changes made by the Pi foundation on the linux kernel. It's still working but they changed the behaviour of the snd_bcm2835 audio hardware. Let me elaborate.

The "problem"
Historically the snd_bcm2835 hardware was initialised in a way that the OS would see one sound card with multiple devices (3.5mm jack, HDMI). This meant you could output audio to both audio jack and HDMI by default with no configuration required.

As of kernel version 5.4, the Pi foundation changed this so the OS now lists two sound cards, one for the audio jack and another one for HDMI (HDMI only showing up if you got a cable plugged in on boot). The default is the audio jack, so you won't get HDMI audio unless you select it as the output interface of your choice. I believe this was made so users get to select which one they want with a nice UI dropdown on Raspberry Pi OS (see below).

References

  • Pi Foundation's changes to the kernel
  • balenaOS 2.54.3+rev1 incorporating those changes only for the Pi4. This explains why it "doesn't work" on 2.60 but it does in 2.50.
  • Pi official docs on how to change output audio device
  • Related GitHub issues in the audio block repo with further details: #39 and #4

The "solution"
So, how do we select which audio interface we want to use now?

If you are using balenaSound or the audio block it's easy, use the AUDIO_OUTPUT environment variable and set it to RPI_HDMI0 for example for HDMI0 on the Pi4. This is described in detail in the balenaSound docs and the audio block readme.

If you are using some other custom audio application you'll have to select the appropriate sound card interface. For example, for aplay you'll need to do aplay --device=<whatever> file.wav.

Note that no other configuration is required, you don't need to change hdmi_force_edid_audio, hdmi_mode or any other config.txt variable. If you have please revert the changes. Defaults should work fine.

I hope this helps @AlexdrFontes, I'll reply to you in the forums too with this information so that others can find it there too. Let's continue the conversation over there if needed. Thanks!

@tmigone tmigone closed this as completed Feb 12, 2021
@jellyfish-bot
Copy link

[tmigone] This issue has attached support thread https://jel.ly.fish/55f70a8b-65df-47f2-bdab-41530764e43f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
6 participants