linux icon indicating copy to clipboard operation
linux copied to clipboard

hda_dsp_hdmi_build_controls: no PCM in topology - intel/sof-tplg/sof-hda-generic-2ch.tplg

Open Nightwing0815 opened this issue 2 years ago • 22 comments

Hey there,

I had some time to research, why i can't send a pcm signal via HDMI to my TV ( and from there to my Teufel Decoderstation), i so i looked in here and do some tests: To finally get the topology file, i removed all of them and rebooted, so dmesg can tell me the missing topology, which is: intel/sof-tplg/sof-hda-generic-2ch.tplg I just did some files with output to upload here, like alsa-info:

alsa-info.txt alsaucm -c hw:0 dump.txt amixer -c 0 scontents.txt aplay -lL.txt arecord -lL.txt intel-snd.log systemctl --user status pipewire pipewire-session-manager.txt wpctl status.txt

and here inxi with more details from my device: inxi.txt

Maybe, we'll find a solution for my system, to get pcm work...

Greetings and thanks in advance,

ToM

Nightwing0815 avatar Jan 08 '23 14:01 Nightwing0815

What is the issue @Nightwing0815 ?

You do have a set of HDMI outputs, as seen in you alsa-info report

card 0: sofhdadsp [sof-hda-dsp], device 0: HDA Analog (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sofhdadsp [sof-hda-dsp], device 3: HDMI1 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sofhdadsp [sof-hda-dsp], device 4: HDMI2 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sofhdadsp [sof-hda-dsp], device 5: HDMI3 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sofhdadsp [sof-hda-dsp], device 31: HDA Analog Deep Buffer (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Can you try this:

speaker-test -Dhw:0,3 -c2 -r48000 speaker-test -Dhw:0,4 -c2 -r48000 speaker-test -Dhw:0,5 -c2 -r48000

and check if you hear any noise on your TV? You have to use the path that's connected to your TV.

plbossart avatar Jan 09 '23 15:01 plbossart

@plbossart

Hi Pierre-Louis,

it's the output hw0,3 (normal HDMI connector):

speaker-test -Dhw:0,3 -c2 -r48000

I have 2 problems:

  • I have only 2 channels, and the mapping is wrong: front-left is okay, front-right is rear-right. Annoying on a 5.1 Setup...
  • I have no Sink / Profile for digital undecoded PCM output to my digital receiver, it's his job, to decode the signal, am I right?

The first problem should be possible with editing alsa or pipewire .conf files, but I'm missing a profile for my second problem from the topology. If i switch to legacy drivers, I have a ton of profiles, but that's not friendly to a customer, too much of them won't work...

I'm sorry for answering that late, but this week, I'm working very late (shift work...), and then coming home: broken wifi signal, sounds like a classical monday...

Thanks,

ToM

Nightwing0815 avatar Jan 09 '23 21:01 Nightwing0815

@Nightwing0815 for now the only thing the SOF driver supports is 2ch audio, and the mapping is not controlled on the SOF side. I have no idea why the right channel would become rear-right, we don't see any channel mappings. Or maybe ALSA does this for you but that's not an SOF specific thing.

Overall this looks like a userspace configuration problem and not an SOF-specific bug, is it?

plbossart avatar Jan 10 '23 00:01 plbossart

@plbossart first of all: thanks for your effort! But: my puzzle ain't not smaller, huh? :-)

for now the only thing the SOF driver supports is 2ch audio

Do you mean this specific device, or all cards/chips with sof?

and the mapping is not controlled on the SOF side

thanks for this hint, I'll ask ALSA. Maybe one small step closer to end this.

Overall this looks like a userspace configuration problem and not an SOF-specific bug, is it?

After your good explanation of sof, it sounds logically to me, so: yes.

Greetings,

ToM

Nightwing0815 avatar Jan 10 '23 01:01 Nightwing0815

@Nightwing0815 wrote:

@plbossart first of all: thanks for your effort! But: my puzzle ain't not smaller, huh? :-)

for now the only thing the SOF driver supports is 2ch audio Do you mean this specific device, or all cards/chips with sof?

This is a current limitation with the DSP topologies and the display codec driver on Intel hardware.

A workaround for these platforms is to use the non-DSP driver ("options snd_intel_dspcfg dsp_driver=1" -> use snd-hda-intel driver instead of SOF).

kv2019i avatar Jan 16 '23 10:01 kv2019i

@Nightwing0815 @kv2019i meant "options snd_intel_dspcfg dsp_driver=1" to use snd-hda-intel. You will have more channels for HDMI but you will lose the ability to record with dmics. No free lunch, eh?

plbossart avatar Jan 16 '23 15:01 plbossart

@plbossart

options snd_intel_dspcfg dsp_driver=1

Yep, that's more crap, than it is now... :smile:

I just wanna have one channel hdmi 5.1, and another one, which streams snd passthru to a receiver. That's all... Maybe, i have to reduce my wishes :smiling_face_with_tear:

ToM

Nightwing0815 avatar Jan 16 '23 21:01 Nightwing0815

... for now the only thing the SOF driver supports is 2ch audio, and the mapping is not controlled on the SOF side. I have no idea why the right channel would become rear-right, we don't see any channel mappings. Or maybe ALSA does this for you but that's not an SOF specific thing.

I don't think that there's any channel remapping by default for the stereo stream in user space. It looks like a bug or another issue in the driver. The remapping should be visible using amixer -c 0 controls command (look for Playback Channel Map controls).

@plbossart : If the remapping / multiple channel configuration is not supported in SOF, it should be disabled in the hdmi driver. I think that hdac_hdmi.c code is used for SOF HDA and the channels are limited by the HDA HDMI converter parameters only.

perexg avatar Jan 29 '23 18:01 perexg

@perexg Thanks for answering. Here's the output from your command amixer -c 0 controls:

$ amixer -c 0 controls
numid=14,iface=CARD,name='HDMI/DP,pcm=3 Jack'
numid=20,iface=CARD,name='HDMI/DP,pcm=4 Jack'
numid=26,iface=CARD,name='HDMI/DP,pcm=5 Jack'
numid=12,iface=CARD,name='Headphone Jack'
numid=11,iface=CARD,name='Mic Jack'
numid=13,iface=CARD,name='Speaker Phantom Jack'
numid=10,iface=MIXER,name='Master Playback Switch'
numid=9,iface=MIXER,name='Master Playback Volume'
numid=2,iface=MIXER,name='Headphone Playback Switch'
numid=1,iface=MIXER,name='Headphone Playback Volume'
numid=8,iface=MIXER,name='Mic Boost Volume'
numid=7,iface=MIXER,name='Capture Switch'
numid=6,iface=MIXER,name='Capture Volume'
numid=15,iface=MIXER,name='IEC958 Playback Con Mask'
numid=21,iface=MIXER,name='IEC958 Playback Con Mask',index=1
numid=27,iface=MIXER,name='IEC958 Playback Con Mask',index=2
numid=16,iface=MIXER,name='IEC958 Playback Pro Mask'
numid=22,iface=MIXER,name='IEC958 Playback Pro Mask',index=1
numid=28,iface=MIXER,name='IEC958 Playback Pro Mask',index=2
numid=17,iface=MIXER,name='IEC958 Playback Default'
numid=23,iface=MIXER,name='IEC958 Playback Default',index=1
numid=29,iface=MIXER,name='IEC958 Playback Default',index=2
numid=18,iface=MIXER,name='IEC958 Playback Switch'
numid=24,iface=MIXER,name='IEC958 Playback Switch',index=1
numid=30,iface=MIXER,name='IEC958 Playback Switch',index=2
numid=5,iface=MIXER,name='Auto-Mute Mode'
numid=42,iface=MIXER,name='Dmic0 Capture Switch'
numid=41,iface=MIXER,name='Dmic0 Capture Volume'
numid=44,iface=MIXER,name='Dmic1 2nd Capture Volume'
numid=43,iface=MIXER,name='EQIIR10.0 eqiir_coef_10'
numid=45,iface=MIXER,name='EQIIR11.0 eqiir_coef_11'
numid=37,iface=MIXER,name='EQIIR2.0 eqiir_bytes_2'
numid=35,iface=MIXER,name='PGA1.0 1 Master Playback Volume'
numid=36,iface=MIXER,name='PGA2.0 2 Master Capture Volume'
numid=46,iface=MIXER,name='PGA30.0 30 Playback Volume'
numid=47,iface=MIXER,name='PGA31.0 31 Playback Volume'
numid=38,iface=MIXER,name='PGA7.0 7 Master Playback Volume'
numid=39,iface=MIXER,name='PGA8.0 8 Master Playback Volume'
numid=40,iface=MIXER,name='PGA9.0 9 Master Playback Volume'
numid=4,iface=MIXER,name='Speaker Playback Switch'
numid=3,iface=MIXER,name='Speaker Playback Volume'
numid=19,iface=PCM,name='ELD',device=3
numid=32,iface=PCM,name='Playback Channel Map',device=3
numid=25,iface=PCM,name='ELD',device=4
numid=33,iface=PCM,name='Playback Channel Map',device=4
numid=31,iface=PCM,name='ELD',device=5
numid=34,iface=PCM,name='Playback Channel Map',device=5

Playback Channel Map you can find on the last 6 lines...

ToM

Nightwing0815 avatar Jan 29 '23 20:01 Nightwing0815

The continue with amixer -c 0 get numid=32 etc.. (33, 34) .. Or use amixer -c 0 contents to get also values for all elements.

perexg avatar Jan 30 '23 07:01 perexg

@perexg thanx for guiding me through that all :-) Here we go, out from amixer -c 0 contents and amixer -c 0 get numid=32

$ amixer -c 0 contents

[cut]

numid=19,iface=PCM,name='ELD',device=3
  ; type=BYTES,access=r--v----,values=0
  : values=
numid=32,iface=PCM,name='Playback Channel Map',device=3
  ; type=INTEGER,access=rw---R--,values=8,min=0,max=36,step=0
  : values=0,0,0,0,0,0,0,0
  | container
    | chmap-variable=FL,FR
numid=25,iface=PCM,name='ELD',device=4
  ; type=BYTES,access=r--v----,values=0
  : values=
numid=33,iface=PCM,name='Playback Channel Map',device=4
  ; type=INTEGER,access=rw---R--,values=8,min=0,max=36,step=0
  : values=0,0,0,0,0,0,0,0
  | container
    | chmap-variable=FL,FR
numid=31,iface=PCM,name='ELD',device=5
  ; type=BYTES,access=r--v----,values=0
  : values=
numid=34,iface=PCM,name='Playback Channel Map',device=5
  ; type=INTEGER,access=rw---R--,values=8,min=0,max=36,step=0
  : values=0,0,0,0,0,0,0,0
  | container
    | chmap-variable=FL,FR

nightwing@Jarvis:~$ amixer -c 0 get numid=32
amixer: Unable to find simple control 'numid=32',0

nightwing@Jarvis:~$ amixer -c 0 get numid=34
amixer: Unable to find simple control 'numid=34',0

ToM

Nightwing0815 avatar Jan 30 '23 14:01 Nightwing0815

@Nightwing0815 can you dump the contents when you have the 5.1 receiver connected? Now the dump shows there is nothing connected.

@perexg SOF now uses hdac_hda.c for all HDA codecs, including HDMI/DP, i.e. we use generic patch_hdmi.c . The limitations are only applied in the DSP topologies as the the PCM frontends and pipelines do not support multi-channel LPCM. So all the standard channel map controls should be available. It just weird that FL/FR would not be routed correctly...

kv2019i avatar Jan 30 '23 14:01 kv2019i

@kv2019i : Thanks for the clarification. The mapping looks fine, but in this case, the code in patch_hdmi.c should be aware about the SOF limits and do not offer the multichannel hardware pcm parameters to the user space.

perexg avatar Jan 30 '23 14:01 perexg

@kv2019i of course I can, here we go:

$ amixer -c 0 contents

[cut]

numid=19,iface=PCM,name='ELD',device=3
  ; type=BYTES,access=r--v----,values=40
  : values=0x10,0x00,0x09,0x00,0x6b,0x20,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x0c,0x00,0x00,0x50,0x68,0x69,0x6c,0x69,0x70,0x73,0x20,0x46,0x54,0x56,0x09,0x1f,0x07,0x15,0x07,0x50,0x00,0x00,0x00
numid=32,iface=PCM,name='Playback Channel Map',device=3
  ; type=INTEGER,access=rw---R--,values=8,min=0,max=36,step=0
  : values=0,0,0,0,0,0,0,0
  | container
    | chmap-variable=FL,FR

[cut]

$ amixer -c 0 get numid=34

amixer: Unable to find simple control 'numid=34',0

ToM

Nightwing0815 avatar Jan 30 '23 16:01 Nightwing0815

The correct command for numid is amixer -c 0 cget numid=32 to avoid printing the other garbage (my mystake get/cget). Also it's sufficient to print info only for device=3 like:

amixer -c 0 cget iface=PCM,name='ELD',device=3
amixer -c 0 cget iface=PCM,name='Playback Channel Map',device=3

or equivalent:

amixer -c 0 cget numid=19
amixer -c 0 cget numid=32

I don't expect any reply to this info.

perexg avatar Jan 30 '23 16:01 perexg

@perexg wrote:

@kv2019i : Thanks for the clarification. The mapping looks fine, but in this case, the code in patch_hdmi.c should be aware about the SOF limits and do not offer the multichannel hardware pcm parameters to the user space.

Ack. It's just a bit tricky as this is not a generic SOF limitation, rather specific to the topologies we have now defined. Probably easier is to complete the work to support mutlichannel in the DSP topologies. This is anyway something we want to enable.

kv2019i avatar Jan 30 '23 17:01 kv2019i

@Nightwing0815 wrote:

numid=32,iface=PCM,name='Playback Channel Map',device=3 ; type=INTEGER,access=rw---R--,values=8,min=0,max=36,step=0 : values=0,0,0,0,0,0,0,0 | container | chmap-variable=FL,FR

Aa, it's empty until playback started. So can you play audio to the PCM "hw:0,3" when the receiver is connected and then do the dump. And just "amixer -c 0 cget numid=32" and "amixer -c 0 cget numid=19" are needed.

kv2019i avatar Jan 30 '23 17:01 kv2019i

@kv2019i sounds logical to me :smile:

mkv with trueHD sound

$ amixer -c 0 cget iface=PCM,name='Playback Channel Map',device=3
numid=32,iface=PCM,name='Playback Channel Map',device=3
  ; type=INTEGER,access=rw---R--,values=8,min=0,max=36,step=0
  : values=3,4,0,0,0,0,0,0
  | container
    | chmap-variable=FL,FR

What exactly we, or you're tryin to do, and: will / can i have after that my 6 channels 5.1 raw passthru signal to my receiver? Sorry for asking that dumb, but I don't see the light. any :smile:

Thanks for editing and shorting my posts before.

ToM

Nightwing0815 avatar Jan 30 '23 18:01 Nightwing0815

@Nightwing0815 wrote:

mkv with trueHD sound [...] $ amixer -c 0 cget iface=PCM,name='Playback Channel Map',device=3 numid=32,iface=PCM,name='Playback Channel Map',device=3 ; type=INTEGER,access=rw---R--,values=8,min=0,max=36,step=0 : values=3,4,0,0,0,0,0,0 [...] What exactly we, or you're tryin to do, and: will / can i have after that my 6 channels 5.1 raw passthru signal to my receiver?

So I wanted to see the logs to understand what your problem really is. Now there is a definite feature gap in that current SOF releases for this hardware do not support passing 5.1/7.1. But passing a stereo stream correctly should still work.

Now based on above output, the channel map actually is correct. 3=FR and 4=FL, so we are playing two channels, front left and front right, so all seems good.

If the problem would be that mapping is wrong, you could do remapping in software. Like here swap left and right mapping with aplay:

aplay -vv -i -Dplughw:0,3 -m "FR,FL" foobar.wav

... but given all looks ok, I cannot explain why front-right is rear-right in your setup. Did you try with the snd-hda-intel driver (without DSP) using the "options snd_intel_dspcfg dsp_driver=1"? Does stereo file playback work as expected with this? This would allow to pinpoint where the problem is.

kv2019i avatar Feb 03 '23 09:02 kv2019i

@kv2019i which logs exactly do you mean? Just tell me the command / path, and I'm on it.

If the problem would be that mapping is wrong, you could do remapping in software. Like here swap left and right mapping with aplay:

aplay -vv -i -Dplughw:0,3 -m "FR,FL" foobar.wav

Sadly, it produces only an error:

$ export LC_ALL=C
$ aplay -vv -i -Dplughw:0,3 -m "FR,FL" /home/nightwing/Downloads/beep.wav
Playing WAVE '/home/nightwing/Downloads/beep.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
aplay: setup_chmap:1253: Channel numbers don't match between hw_params and channel map

In general: it's hard to hear on laptops high-end boxes, if its back or front :smile: I had it before resetting and i have to edit pipewire cfg's to produce an 5.1 snd with lfe, and then I'm able to hear it perfect. I'll working on it.

... but given all looks ok, I cannot explain why front-right is rear-right in your setup. Did you try with the snd-hda-intel driver (without DSP) using the "options snd_intel_dspcfg dsp_driver=1"? Does stereo file playback work as expected with this? This would allow to pinpoint where the problem is.

Yes, of course i checked it: tons of useless devices, so that's where my odyssey just starts... I'll revert to legacy mode, and have a look. Later today, maybe tomorrow, I'll edit here with a bunch of configs. I'll try to keep it shorter, now that I know more, what you're looking for.

Now there is a definite feature gap in that current SOF releases for this hardware do not support passing 5.1/7.1. But passing a stereo stream correctly should still work.

Wow, that's hard, thanks for this rare information! Well, lets hope all the best for future releases!

ToM

Nightwing0815 avatar Feb 03 '23 17:02 Nightwing0815

You should do the aplay test with a stereo wav file (like https://freewavesamples.com/files/Ensoniq-ZR-76-03-Dope-85.wav).

perexg avatar Feb 03 '23 18:02 perexg

@perexg @kv2019i thanks for soundfile, worked. No sound with legacy setting from driver (testfile), i only see the ### swiping. Here are a few logfiles attached, from kernel and alsa commands, and i ran alsa-info, for more details:

alsa-info.txt part one.txt part two.txt

ToM

Nightwing0815 avatar Feb 03 '23 20:02 Nightwing0815