RPi4 a/v jack missing when using vc4 driver (kms)

I have used hdmi sound but now I have a need to use the analog audio jack. However, I do not seem to have one in KDE Plasma (arm-unstable).

$ inxi -Fazy

Audio:
  Device-1: bcm2711-hdmi0 driver: vc4_hdmi bus ID: N/A chip ID: brcm:fef00700 
  Device-2: bcm2711-hdmi1 driver: vc4_hdmi bus ID: N/A chip ID: brcm:fef05700 
  Sound Server: ALSA v: k5.10.9-1-MANJARO-ARM

And amixer does not show an analog option.

Maybe related to these messages?

Jan 27 19:11:29 oblio kernel: vc4_hdmi fef05700.hdmi: ASoC: error at snd_soc_dai_startup on fef05700.hdmi: -19
Jan 27 19:11:29 oblio kernel: vc4_hdmi fef05700.hdmi: ASoC: error at snd_soc_dai_startup on fef05700.hdmi: -19
Jan 27 19:11:29 oblio kernel: vc4_hdmi fef05700.hdmi: ASoC: error at snd_soc_dai_startup on fef05700.hdmi: -19
Jan 27 19:11:29 oblio kernel: vc4_hdmi fef05700.hdmi: ASoC: error at snd_soc_dai_startup on fef05700.hdmi: -19
Jan 27 19:11:29 oblio kernel: vc4_hdmi fef05700.hdmi: ASoC: error at snd_soc_dai_startup on fef05700.hdmi: -19
Jan 27 19:11:29 oblio pulseaudio[783]: Failed to find a working profile.
Jan 27 19:11:29 oblio kernel: vc4_hdmi fef05700.hdmi: ASoC: error at snd_soc_dai_startup on fef05700.hdmi: -19
Jan 27 19:11:29 oblio pulseaudio[783]: Failed to load module "module-alsa-card" (argument: "device_id="1" name="platform-fef05700.hdmi" card_name="alsa_card.platform-fef05700.hdmi" namereg_fail=false tsched=no fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes avoid_resampling=no card_properties="module-udev-detect.discovered=1""): initialization failed.

But they seem to reference HDMI, which works fine, so maybe not.

$ cat /boot/config.txt

# sound
dtparam=audio=on
#hdmi_drive=2

$ cat /proc/cmdline

coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 video=HDMI-A-1:1920x1080M@60 smsc95xx.macaddr=DC:A6:32:C1:E1:C7 vc_mem.mem_base=0x3eb00000 vc_mem.mem_size=0x3ff00000  root=LABEL=MNJRO_ROOT rw rootfstype=btrfs rootwait console=ttyAMA0,115200 console=tty1 selinux=0 plymouth.enable=0 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 kgdboc=ttyAMA0,115200 usbhid.mousepoll=8 snd-bcm2835.enable_compat_alsa=1 audit=0 usb-storage.quirks=152d:1561:u

I have messed around with:

$ amixer cset numid=3 [1-4]

But they result in setting the volume to 0, no change in output device.

Default is snd-bcm2835.enable_compat_alsa=0 but you seem to have both in cmdline.txt in 2 different entries (snd-bcm2835.enable_compat_alsa=1).

[ray@pi4 ~]$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: b1 [bcm2835 HDMI 1], device 0: bcm2835 HDMI 1 [bcm2835 HDMI 1]
  Subdevices: 4/4
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
card 1: b2 [bcm2835 HDMI 2], device 0: bcm2835 HDMI 2 [bcm2835 HDMI 2]
  Subdevices: 2/2
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
card 2: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
  Subdevices: 2/2
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1

Kernel is 5.10.10-1

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
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

$ cat cmdline.txt:

root=LABEL=MNJRO_ROOT rw rootfstype=btrfs rootwait console=ttyAMA0,115200 console=tty1 selinux=0 plymouth.enable=0 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 kgdboc=ttyAMA0,115200 usbhid.mousepoll=8 snd-bcm2835.enable_compat_alsa=1 audit=0 usb-storage.quirks=152d:1561:u

As you can see, I have it just the one time in cmdline.txt.

kernel 5.10.9-1

In the prior post you have it twice. Make it snd-bcm2835.enable_compat_alsa=0

I will set it back to 0, it was 1 before.

The previous is from /proc/cmdline (running kernel cmdline), not cmdline.txt. So what is actually passed, not just what I put in the file.

I do not have that.

[ray@pi4 ~]$ cat /proc/cmdline
coherent_pool=1M 8250.nr_uarts=0 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 video=HDMI-A-1:1024x768M@60 video=HDMI-A-2:1360x768M@60 smsc95xx.macaddr=DC:A6:32:AF:B8:7B vc_mem.mem_base=0x3eb00000 vc_mem.mem_size=0x3ff00000 root=LABEL=ROOT_MNJRO rw rootwait console=ttyS0,115200 console=tty1 selinux=0 plymouth.enable=0 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 kgdboc=ttyS0,115200 elevator=noop usbhid.mousepoll=8 snd-bcm2835.enable_compat_alsa=0 audit=0

After resetting it to 0, now it appears only once in /proc/cmdline (I assume since the parameter is a duplicate with a duplicate value). But you can see our cmdline.txt parameters start with root=.

coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 video=HDMI-A-1:1920x1080M@60 smsc95xx.macaddr=DC:A6:32:C1:E1:C7 vc_mem.mem_base=0x3eb00000 vc_mem.mem_size=0x3ff00000 root=LABEL=MNJRO_ROOT rw rootfstype=btrfs rootwait console=ttyAMA0,115200 console=tty1 selinux=0 plymouth.enable=0 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 kgdboc=ttyAMA0,115200 usbhid.mousepoll=8 snd-bc
m2835.enable_compat_alsa=0 audit=0 usb-storage.quirks=152d:1561:u

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
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

Edit: heh… it is there twice. Ignore that comment. :slight_smile:

Edit 2: I wonder if I pass snd_bcm2835.enable_hdmi=0?

Have no clue what is going on. You have different aplay names also. Could be something with the 5.10.9 kernel or how your video is configured. But that card 1 should be your headphone jack. Also remember because of the nature of the on board jack being a A/V jack not all plugs will produce audio because of wiring differences. I had to try a couple different phone headphones here to play audio. I have a cheap set of speakes also here with a stero jack that will not play. They sell an A/V splitter adapter.

Remove the ~/.config/pulse directory and reboot so it can create a new one.

Neither setting snd_bcm2835.enable_hdmi=0 nor removing ~/.config caused any change.
I am going to try switching to fkms and see if that effects the audio drivers loaded.

Seems like I remember reading about with kms you loose the onboard jack in 5.10 and seems like there was a fix.

Bingo! No analog audio with kms, interesting.

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: b1 [bcm2835 HDMI 1], device 0: bcm2835 HDMI 1 [bcm2835 HDMI 1]
Subdevices: 4/4
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
card 1: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
Subdevices: 3/4
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3

I believe there is a hack re-writing the alsa card config. It is in the 5.10 next kernel thread on the pi forum. It also involves disabling dtparam=audio=on I think.

Thank you, I will take a look.

From a post, it seems one way to fix this is:

snd_bcm2835.enable_hdmi=0 snd_bcm2835.enable_headphones=1

We were on the right track with the command line parameters. I tried them but it didn’t work. However, that is from a thread on 5.10, so I probably need to upgrade first.

It is late… 5.10… I was thinking 5.10.10. So it should have worked. But then those are for the bcm2835 driver and I seem to be using vc4 driver.

$ lsmod | grep vc4

vc4                   274432  26
cec                    69632  1 vc4
drm_kms_helper        253952  3 vc4
snd_soc_core          241664  1 vc4
snd_pcm               126976  4 vc4,snd_compress,snd_soc_core,snd_pcm_dmaengine
drm                   561152  16 gpu_sched,drm_kms_helper,v3d,vc4

Edit: I found this pull request, so they are working on it.

I found this commit, merged 2 days ago.

It is there in the latest 5.10 and 5.11 kernels. Is it not working?

It is? I don’t have headphone jack as an option but maybe I need to change something in config.txt or cmdline.txt. I’ll hack around some and see if I can get lucky.

I would start with cmdline.txt: snd-bcm2835.enable_compat_alsa=1
And rem out in config.txt: #hdmi_drive=2

So far, no luck. I’ll keep working on it.
I can disable sound but so far no combination that I have tried has produced the headphone jack. I was hopeful that disabling sound from the vc4 would cause the bcm_2835 driver to drive both hdmi and headphone jack.

I did not notice a change in the kernel modules but I’ll look closer as I hack around more.