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

HifiBerry+ DAC and vc4hdmi: different default ALSA card bewteen reboots #130

Open
vanfanel opened this issue Apr 4, 2018 · 9 comments
Open

Comments

@vanfanel
Copy link

vanfanel commented Apr 4, 2018

Hi there, Eric

I updated my system to the latest kernel (4.14.31-v7+) and now I get different default sound cards between boots.
Sometimes aplay -L will report:
default:CARD=sndrpihifiberry
and sometimes it will report:
default:CARD=vc4hdmi

When the vc4hdmi (which I don't currently use) is the default card, sound won't work and alsamixer reports it having no controls.

Do you have an idea on what could be going on?
Any way to disable vc4hdmi so it's never used on the Pi where I use HifiBerry+?

@anholt
Copy link
Owner

anholt commented Apr 9, 2018

My guess would be that baseline ALSA is just defaulting to whatever module probes first, and module probe order in Linux is arbitrary. You should probably be using some software like pulseaudio that implements policy on top of ALSA, or just force the issue using alsa.conf snippets somehow.

@vanfanel
Copy link
Author

@anholt : But I am not using the vc4-hdmi audio. What modules does it use specifically? I don't see a specific vc4-hdmi audio module on lsmod. If I knew what module does vc4-hdmi audio use, I could simply prevent it from being loaded in this machine.

@stschake
Copy link

There is no specific module for it - if you use the VC4 DRM driver, you will automatically get the HDMI audio.

@vanfanel
Copy link
Author

@stschake : I see. Then I don't see the way around it by not loading a module :(
@anholt : No way I will be even using PulseAudio. As for ALSA, one can easily chose the default sound card using something like:

pcm.!default {
	type hw
	card 0
}

ctl.!default {
	type hw           
	card 0
}

In asound.conf. The problem is that the card number assigned to the hifiberry and the vc4hdmi changes bewteen boots. Is there a way to tell default by name instead of number?

@vanfanel
Copy link
Author

Ah, it seems doing:

defaults.pcm.!card $sndrpihifiberry
defaults.ctl.!card $sndrpihifiberry

..does the job. Thanks!

@vanfanel
Copy link
Author

vanfanel commented Feb 8, 2019

@anholt
I still get problems with arbitrary card ordering.
It should be possible to tell Linux probing to NEVER let vc4-hdmi to be the first card, by passing an option to modprobe on boot in /etc/modprobe.d.
So, assuming the module responsible for vc4-hdmi audio card is called "vc4" (since such a module exists when I do lsmod) I created /etc/modprobe.d/alsa-base.conf with this content:

options vc4 index=-2

I got the information for this here:
https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture

However, from time to time, vc4-hdmi is STILL alsa card 0, causing the alsa-restore.service to fail on system boot.
So, please, how can I "convince" the kernel to never make vc4-hdmi the first ALSA card, once and for all?

@pelwell
Copy link

pelwell commented Feb 8, 2019

Alternatively, is there a way to disable the HDMI audio device? If there's a suitable DT property value then I can add a parameter to the vc4-kms-v3d overlay.

@6by9
Copy link

6by9 commented Feb 8, 2019

It looks like nuking the dmas property from the hdmi DT node will do it, whilst leaving the rest of the vc4 driver to come up. Not the cleanest, but might be worth a quick try.

https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/vc4/vc4_hdmi.c#L1075

@pelwell
Copy link

pelwell commented Feb 8, 2019

If only an overlay could delete a property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants