Alsa-Devel Archive mirror
 help / color / mirror / Atom feed
From: "Péter Ujfalusi" <peter.ujfalusi@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	wim.taymans@gmail.com
Subject: UCM vs SOF vs HDMI passthrough
Date: Thu, 11 Apr 2024 16:15:48 +0300	[thread overview]
Message-ID: <fa1d1a94-57d9-4caf-9569-f9a9f3d725c2@linux.intel.com> (raw)

Hi,

afaik for HDMI passthrough there should be a usable PCM mapping present
for user space:
aplay -L | grep hdmi
hdmi:CARD=PCH,DEV=0
hdmi:CARD=PCH,DEV=1
hdmi:CARD=PCH,DEV=2

or similar.

SOF with IPC4 (Meteor Lake and newer or some TGL/ADL setups with 2024.03
release) it is possible to use passthrough via HDMI technically but we
are lacking the "hdmi:..." PCMs, so in reality it is not usable for
applications. Afaik.

So far I managed to cook up two ways of doing this, but neither one is
good enough as they will create the "hdmi:..." for both IPC3 and IPC4
setups and IPC3 firmware cannot support passthrough.

Setups:
sof-hda-dsp cards have HDMI PCMs: pcm3-5
sof-soundwire cards have HDMI PCMs: pcm5-7

[A] use card profile
Add these to /usr/share/alsa/cards/aliases.conf:
sof-hda-dsp cards.sof-hda-dsp
sof-soundwire cards.sof-soundwire

Create the minimal sof-hda-ds.conf and sof-soundwire.conf to handle the
two types of HDMI PCM numbering.

[B] Using UCM
https://github.com/ujfalusi/alsa-ucm-conf/tree/topic/sof-hdmi

It is using the BootSequence[] to create three files:
[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, ampping
[3] Card specific definitions of the three HDMI port

In both case I have the needed PCMs:
aplay -L | grep hdmi

hdmi:CARD=sofhdadsp,DEV=0
hdmi:CARD=sofhdadsp,DEV=1
hdmi:CARD=sofhdadsp,DEV=2
or
hdmi:CARD=sofsoundwire,DEV=0
hdmi:CARD=sofsoundwire,DEV=1
hdmi:CARD=sofsoundwire,DEV=2

But it is unconditional and they will be created for all sof-hda-dsp and
sof-soundwire cards.

I would really appreciate some guidance on how we can achieve this
correctly (the code for the UCM way leaves much to be desired, I know).

How can this be done conditionally?
We can set the HDMI PCMs to advertise IEC958_SUBFRAME_LE for IPC4 only,
but how can we use that?
Should we add some parameter to 'amixer -c0 info', like ipc_version:4/3,
so if the ipc_version is 3 or missing we assume that passthrough is not
supported?

Thanks for the help,
Péter

             reply	other threads:[~2024-04-11 13:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-11 13:15 Péter Ujfalusi [this message]
2024-04-11 13:38 ` UCM vs SOF vs HDMI passthrough Jaroslav Kysela
2024-04-12 11:44   ` Péter Ujfalusi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fa1d1a94-57d9-4caf-9569-f9a9f3d725c2@linux.intel.com \
    --to=peter.ujfalusi@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=wim.taymans@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).