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
bcm2835-pcm: Fix up multichannel pcm audio #3933
Conversation
The previous commit enabled multichannel for the spdif device (as we were experimenting with HBR passthrough which never worked through this interface). The more useful interface to enable multichannel is the pcm one. Tested here: https://www.diyaudio.com/forums/pc-based/334443-2-8-dsp-platform-using-raspberry-pi-hats-10.html |
IMO the problem is the HDMI cards created by the xxx_simple_xxx config call the function snd_bcm2835_new_pcm with param spdif=false which causes that the 2ch hw params for the headphones route are chosen, instead of the 8ch spdif hw params. Perhaps something like this could be a solution (not tested at all):
|
Well, multiple users report 8ch HDMI works OK on their RPis https://www.diyaudio.com/forums/pc-based/334443-2-8-dsp-platform-using-raspberry-pi-hats-10.html#post6345442 |
@HiassofT what is your view on these settings? |
@popcornmix I don't think it's possible to express that via standard pcm constraints. A solution would be to do it programatically. i.e. specify relaxed constraints (max 8ch, 192kHz) and reject invalid combinations with EINVAL in hw_params |
What about the |
TBH I'm not too familiar with that particular driver. From a quick glance it looks like the spdif device might work like normal HDMI audio devices and PCM/non-audio can be selected via IEC958 ctl. So supportting multi-channel and higher rates on would be fine - difference to the non-spdif device seems to be that it's a single-user non-mixing device. OTOH it depends on what the hardware+firmware can support and what you want to support - allowing non-working combinations to be used might not be ideal. So if you want the spdif device to be 2ch/48kHz only then that's fine, too. |
That's my experience too. The spdif (or HDMI) is a regular PCM device, without mixer controls provided by the codecs. IMO "passthrough" is just a name of a bit-perfect (i.e. no mixer/volume control) path. Digital (nonPCM and nonDSD) formats have a marker in the stream (and a corresponding flag in the SPDIF preamble, if applicable). People use RPi to feed 8ch HDMI to a HDMI extractor to get 8 analog channels. Until recently they had to recompile kernel to change the channels_max hw param, with the latest patches the snd_bcm2835_playback_spdif_hw params already specify 8ch but the card-based device (enable_hdmi=1 instead of the device based enable_compat_alsa=1) uses snd_bcm2835_playback_hw params defined for the headphone audio (PWM-based) hardware, even though it's still the same HDMI hardware. |
Fixes: a9c1660 Signed-off-by: Dom Cobley <popcornmix@gmail.com>
Fixed the rates of |
cd5b331
to
75daef0
Compare
Please do I understand correctly this is the current result? module param enable_headphones=1 => using snd_bcm2835_playback_hw => 8ch/192kHz on the stereo analog jack enable_compat_alsa=1 => using snd_bcm2835_playback_hw for headphones and snd_bcm2835_playback_spdif_hw for HDMI0/1 ( https://github.com/popcornmix/linux/blob/75daef083656bd9d84a388089b5671e1eca8640c/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c#L78 ) => 8ch/192kHz on the stereo analog jack + 2ch/48kHz on HDMI0 + 2ch/48kHz on HDMI1 Please correct me if I am wrong. |
kernel: drm/vc4: hdmi: Avoid sleeping in atomic context See: raspberrypi/linux#3910 kernel: bcm2835-pcm: Fix up multichannel pcm audio See: raspberrypi/linux#3933
kernel: drm/vc4: hdmi: Avoid sleeping in atomic context See: raspberrypi/linux#3910 kernel: bcm2835-pcm: Fix up multichannel pcm audio See: raspberrypi/linux#3933
Hi @popcornmix , I think it may be necessary to modify lines 83 and 87 of bcm2835.c - the HDMI devices get a maximum channel count of 2 because the spdif parameter to snd_bcm2835_new_pcm is true. |
Fixes: a9c1660
Signed-off-by: Dom Cobley popcornmix@gmail.com