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

vc4-hdmi device: "no controls" in alsamixer until sound is played #3953

Closed
vanfanel opened this issue Nov 10, 2020 · 13 comments
Closed

vc4-hdmi device: "no controls" in alsamixer until sound is played #3953

vanfanel opened this issue Nov 10, 2020 · 13 comments

Comments

@vanfanel
Copy link

I have been using the fantastic vc4-hdmi audio device for months now, since it came to 5.4/5.9 series of Pi kernels, in Rasberry Pi OS.

However, I noticed that ALSAMIXER claims that "there are no controls for this device" until I play a sound through ALSA. Any program does: even simply running speakertest is enough.
Just after running the program, ALSAMIXER allows volume adjustment.

The bad thing about this is that ALSA volume adjustments can not be aplied on startup by the corresponding service, so volume is always at 100% on system boot, and can't be adjusted until a sound is played.

More information:
-Running latest 5.10.0-rc3 kernel in 64bit mode on Pi4.
-Running latest Raspberry Pi OS 64bit. No X server, no PulseAudio, nothing that can interfere with the issue.
-My /usr/share/alsa/cards/vc4-hdmi.conf is set like this:

# Configuration for the VC4-HDMI sound card using software IEC958
# subframe conversion

<confdir:pcm/hdmi.conf>
vc4-hdmi.pcm.hdmi.0 {
	@args [ CARD AES0 AES1 AES2 AES3 ]
	@args.CARD {
		type string
	}
	@args.AES0 {
		type integer
	}
	@args.AES1 {
		type integer
	}
	@args.AES2 {
		type integer
	}
	@args.AES3 {
		type integer
	}
	type iec958
	slave {
		format IEC958_SUBFRAME_LE
		pcm {
			type hooks
			slave.pcm {
				type hw
				card $CARD
				device 0
			}
			hooks.0 {
				type ctl_elems
				hook_args [
				{
					name "IEC958 Playback Default"
					optional true
					lock true
					preserve true
					value [ $AES0 $AES1 $AES2 $AES3 ]
				}
				]
			}
		}
	}
	status [ $AES0 $AES1 $AES2 $AES3 ]
}

# default with plug
vc4-hdmi.pcm.default {
	@args [ CARD ]
	@args.CARD {
		type string
	}
	type plug
	slave.pcm {
		type softvol
		slave.pcm {
			@func concat
			strings [ "hdmi:" $CARD ]
		}
		control {
			name "PCM Playback Volume"
			card $CARD
		}
	}
}

...As instructed here:
https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=269769&p=1636828#p1636828

So, any ideas on what could be going on?

@popcornmix popcornmix transferred this issue from raspberrypi/userland Nov 10, 2020
@popcornmix
Copy link
Collaborator

Moved this to linux repo as I suspect the issue would lie there.

@ghost
Copy link

ghost commented Nov 10, 2020

I'm seeing the same thing on 5.9.3-v7l+ installed via rpi-update. I'm running KMS on 32-bit Raspberry Pi OS on a Pi 4B. I see the same behaviour with X running; no PulseAudio is installed. I get audio if I start Chromium and go to YouTube. Closing the browser and going back in there's no audio, and right-clicking on the taskbar audio icon crashes the panel, I'm assuming, as it seems to disappear and relaunch.

@popcornmix
Copy link
Collaborator

I can reproduce this. I suspect it's an ordering issue of calls in the hdmi_vc4 driver (but no guesses currently as to which calls...)

@6by9
Copy link
Contributor

6by9 commented Nov 10, 2020

What controls are you looking at? Volume control?

I suspect they are implemented by the alsalib plugins, in which case you'll need a way to make alsalib load the plugin, not change the kernel driver. The hardware has no volume control ability.

@popcornmix
Copy link
Collaborator

Boot up with vc4 driver. Run alsamixer. It days no volume control. Run "aplay norah.wav". Run alsamixer. I can control volume now.
That state sounds like a kernel driver issue.

@ghost
Copy link

ghost commented Nov 10, 2020

The hardware has no volume control ability.

The recommended ALSA config, which we're using, provides a software volume control.

@6by9
Copy link
Contributor

6by9 commented Nov 10, 2020

The recommended ALSA config, which we're using, provides a software volume control.

Exactly. The hardware has no capability. There is nothing to load in the kernel.

If there's a software volume control plugin, then it's a matter of getting that userspace library loaded, and presumably that's not happening until it is used.

@vanfanel vanfanel changed the title vc4-hdmi device: "no controls" in alsamixer until sound is player vc4-hdmi device: "no controls" in alsamixer until sound is played Jan 31, 2021
@vanfanel
Copy link
Author

Any news on this? This bug hit me today again :(
Something else I can try?

@vanfanel
Copy link
Author

vanfanel commented Nov 3, 2021

@popcornmix This is still happening. Is this a bug or not? I am trying to close old issues.

@6by9 Is the current vc4-hdmi.conf supposed to provide a software volume control plugin?
Is there a way to load a software volume control plugin without resorting to manually play a sound?

@6by9
Copy link
Contributor

6by9 commented Nov 3, 2021

It appears to be documented that softvol will not be available immediately
https://alsa.opensrc.org/Softvol

Note:The new volume control won't appear imidiately! Only after the first usage of the newly defined device (e.g. with speaker-test), should amixer sget Softmaster display the new control. Mixers that were already started before the first usage (like KMix) have to be restarted to adopt the changes. If the new control is still not there, try restarting ALSA or your PC.

It's not something I'm investigating further.

@popcornmix
Copy link
Collaborator

Thanks @6by9. Sounds like this is behaving as expected @vanfanel so I'm not sure there is anything to fix.

@vanfanel
Copy link
Author

vanfanel commented Nov 3, 2021

@6by9 @popcornmix Thanks for the information. Nothing to fix, as you guys say.

@rtomasa
Copy link

rtomasa commented Sep 11, 2022

@6by9 @popcornmix I know that this is an old thread, but I'm now experiencing this issue with the new September Raspberry OS release. Now alsamixer does not provide the PCM control for the vc4-hdmi card. The previous version of Raspberry OS worked fine and provided the volume control via alsamixer. I'm using a Pi3+. Any recent change or config that I should be aware to make it work?

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

4 participants