Bug 213363
Summary: | bcm2835_alsa conflicting to vc4-hdmi makes audio failed on Raspberry Pi 4B | ||
---|---|---|---|
Product: | Drivers | Reporter: | Jian-Hong Pan (jhp) |
Component: | Staging | Assignee: | drivers_staging (drivers_staging) |
Status: | RESOLVED ANSWERED | ||
Severity: | normal | ||
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | 5.11+ | Subsystem: | |
Regression: | Yes | Bisected commit-id: | |
Attachments: |
5.13.0-rc5 dmesg
The kernel build config alsa-info with loaded snd_bcm2835 module alsa-info without snd_bcm2835 module |
Created attachment 297225 [details]
The kernel build config
Created attachment 297227 [details]
alsa-info with loaded snd_bcm2835 module
According the attached alsa-info, system with laoded snd_bcm2835 module detects two vc4-hdmi cards and one bcm2835 ALSA card:
card 0: vc4hdmi0 [vc4-hdmi-0], device 0: MAI PCM vc4-hdmi-hifi-0 [MAI PCM vc4-hdmi-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: vc4hdmi1 [vc4-hdmi-1], device 0: MAI PCM vc4-hdmi-hifi-0 [MAI PCM vc4-hdmi-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 6/7
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
card 2: ALSA [bcm2835 ALSA], device 1: bcm2835 IEC958/HDMI [bcm2835 IEC958/HDMI]
Subdevices: 1/1
Subdevice #0: subdevice #0
Here are related loaded modules:
$ lsmod | grep -E "(vc4|snd)"
snd_bcm2835 28672 1
vchiq 327680 1 snd_bcm2835
vc4 229376 7
snd_soc_core 217088 1 vc4
ac97_bus 16384 1 snd_soc_core
snd_pcm_dmaengine 20480 1 snd_soc_core
snd_pcm 126976 5 vc4,snd_bcm2835,snd_soc_core,snd_pcm_dmaengine
snd_timer 36864 1 snd_pcm
snd 90112 5 snd_bcm2835,snd_timer,snd_soc_core,snd_pcm
cec 57344 1 vc4
drm_kms_helper 270336 3 vc4
drm 573440 4 drm_kms_helper,vc4
Created attachment 297229 [details]
alsa-info without snd_bcm2835 module
Disable snd_bcm2835 module by putting it into deny list, or clear CONFIG_SND_BCM2835.
The alsa utils work, including the sound outputs.
According the attached alsa-info, system without snd_bcm2835 module only detects two vc4-hdmi cards:
card 0: vc4hdmi0 [vc4-hdmi-0], device 0: MAI PCM vc4-hdmi-hifi-0 [MAI PCM vc4-hdmi-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: vc4hdmi1 [vc4-hdmi-1], device 0: MAI PCM vc4-hdmi-hifi-0 [MAI PCM vc4-hdmi-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
Here are related loaded modules:
$ lsmod | grep vc4
$ lsmod | grep snd
snd_bcm2835 36864 1
snd_pcm 151552 1 snd_bcm2835
snd_timer 53248 1 snd_pcm
snd 118784 5 snd_bcm2835,snd_timer,snd_pcm
soundcore 20480 1 snd
vchiq 360448 2 snd_bcm2835,bcm2835_v4l2
Sorry wrong loaded modules in comment #3. There should be: $ lsmod | grep -E "(vc4|snd)" vc4 258048 8 drm_kms_helper 282624 3 vc4 cec 61440 2 drm_kms_helper,vc4 drm 614400 4 drm_kms_helper,vc4 snd_soc_core 299008 1 vc4 ac97_bus 16384 1 snd_soc_core snd_pcm_dmaengine 20480 1 snd_soc_core snd_pcm 139264 3 vc4,snd_soc_core,snd_pcm_dmaengine snd_timer 49152 1 snd_pcm snd 110592 5 snd_timer,snd_soc_core,snd_pcm soundcore 20480 1 snd However, I remember the snd_bcm2835 works fine with kernel 5.8. So, I test it again. System with kernel 5.8 only detects one bcm2835 ALSA card: $ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA] Subdevices: 6/7 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 IEC958/HDMI [bcm2835 IEC958/HDMI] Subdevices: 1/1 Subdevice #0: subdevice #0 Here are related loaded modules: $ lsmod | grep vc4 $ lsmod | grep snd snd_bcm2835 36864 1 snd_pcm 151552 1 snd_bcm2835 snd_timer 53248 1 snd_pcm snd 118784 5 snd_bcm2835,snd_timer,snd_pcm soundcore 20480 1 snd vchiq 360448 2 snd_bcm2835,bcm2835_v4l2 Now, it recalls me the vc4 DRM had not been enabled in kernel 5.8 yet. So, snd_bcm2835 driver worked fine on its own. However, the later kernel like 5.11 and so on has enabled VC4 DRM on Raspberry Pi 4B. And, the corresponding snd_soc_core module follows it, no matter snd_bcm2835 is loaded, or not. So, I think it should use vc4-hdmi from VC4 DRM, instead of bcm2835 ALSA. Recap: On the new version we have a new display driver which comes along with a new HDMI audio setup. The "old" driver falls over here to the point where it breaks sound in general. But if we disable the old driver, we have working sound via a new driver. drivers/gpu/drm/vc4/vc4_hdmi.c shows corresponding message in the comment [1]: HDMI audio is implemented entirely within the HDMI IP block. A register in the HDMI encoder takes SPDIF frames from the DMA engine and transfers them over an internal MAI (multi-channel audio interconnect) bus to the encoder side for insertion into the video blank regions. [1] https://elixir.bootlin.com/linux/v5.13-rc5/source/drivers/gpu/drm/vc4/vc4_hdmi.c#L19 Disabling snd_bcm2835 module just works fine. So, close this issue. |
Created attachment 297223 [details] 5.13.0-rc5 dmesg I tested kernel 5.13.0-rc5 on Raspberry Pi 4B. I notice that the HDMI audio is always failed. And, the kernel shows error like: [ 95.975981] bcm2835_audio bcm2835_audio: vchi message timeout, msg=5 [ 106.211973] bcm2835_audio bcm2835_audio: vchi message timeout, msg=3 The alsa utils will be failed and the terminal hangs, even it is the simple command like "aplay -L". The dmesg keeps showing errors as mentioned above.