Skip to contentSkip to conversation

sof-hda-dsp/sof-soundwire: Create "hdmi:" mapping PCMs to allow passthrough if supported

DISCUSSION GitHub pull_request - opened 1 participant 1 message Apr 22, 2024 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

alsa-project/alsa-ucm-conf pull request #411 was opened from ujfalusi:

Hi,

SOF with IPC4 can use 'ChainDMA' on selected PCMs (HDMI/DP currently) which allows them to be used for bytestream passthrough since the data is passed through unmodified. The kernel will list the PCMs with ChainDMA to the card's components list:
https://github.com/thesofproject/linux/pull/4921
For example for sof-dsp-hda cards iec61937-pcm:5,4,3 will be added.

For user space to use HDMI passthrough, the hdmi: PCM device should be present correctly mapping to the machine, for example for sof-dsp-hda:

```
aplay -L | grep hdmi

hdmi:CARD=sofhdadsp,DEV=0
hdmi:CARD=sofhdadsp,DEV=1
hdmi:CARD=sofhdadsp,DEV=2
```

This PR does this by
1. Checking the iec61937-pcm indexes against the expected HDMI devices (sof-dsp-hda: 3-5, sof-soundwire: 5-7)
2. If there is a match (passthrough can be supported) then we will create three conf files:

The generated files are:
[1] /var/lib/alsa/conf.d/42-sof-hdmi.conf
[2] /var/lib/alsa/card[card_number].conf.d/30-sof-hdmi-common.conf
[3] /var/lib/alsa/card[card_number].conf.d/31-sof-hdmi.conf

[1] includes the pcm/iec958.conf and pcm/hdmi.conf to global space of alsaconf to be used by the card macros
[2] Card specific macros for hdmi PCM definition, mapping
[3] Card specific definitions of the three HDMI port

Note for [1]: I needed to use shell "echo '... since the cfg-save would expand the includes into the saved config file and that just does not result a working alsa configuration.

@perexg, I'm sure all this can be done in a cleaner way... We cannot do this unconditionally as if the HDMI is not using ChainDMA (and SOF is not IPC4) then the passthrough is not possible since the firmware might touch the data.

Request URL : https://github.com/alsa-project/alsa-ucm-conf/pull/411
Patch URL : https://github.com/alsa-project/alsa-ucm-conf/pull/411.patch
Repository URL: https://github.com/alsa-project/alsa-ucm-conf