alsa-ucm-conf icon indicating copy to clipboard operation
alsa-ucm-conf copied to clipboard

Intel: avs: Add new UCMs after recent kernel work

Open amadeuszslawinski-intel opened this issue 6 months ago • 7 comments

After recent work to rename cards [1], userspace expects different card names and device numbers.

[1] https://lore.kernel.org/linux-sound/[email protected]/

There is one problem with HDMI not working. As far as I can tell, this is due to macro not handling pcm=0 correctly, but I have no idea how to fix that.

numid=1,iface=CARD,name='HDMI/DP Jack'
numid=7,iface=CARD,name='HDMI/DP,pcm=1 Jack'
numid=13,iface=CARD,name='HDMI/DP,pcm=2 Jack'
 DefineMacro.HDMI.If.hdmi {
        Condition {
                Type ControlExists
                Control "iface=CARD,name='HDMI/DP,pcm=${var:__Device} Jack'"
        }

I've opted for adding files instead of moving and editing them, because there may be users who currently use old card names.

Main differences are:

  • HDAudio macros can now be used for HD-Audio card
  • DMIC now automatically constraints number of channels, so no need for two separate files
  • rewrote some files to make use of conditional syntax

amadeuszslawinski-intel avatar Jun 04 '25 12:06 amadeuszslawinski-intel

Friendly ping. While not an expert for alsa-ucm-conf I did review all of this:

Reviewed-by: Cezary Rojewski <[email protected]>

crojewsk-intel avatar Jun 17 '25 09:06 crojewsk-intel

I've tried to solve the zero HDMI device issue in https://github.com/perexg/alsa-ucm-conf/commit/0b550766cacbd0924671ccd74396709d84953aae . Could you give a test, please?

It would be also nice to move the old configs to separate directory, so they can be removed later. It does also apply for old SST drivers which are pretty obsoleted now. I think that it's time to make this cleanup.

The last thing - for UCM, the digital microphone is usually not in a standalone UCM profile - we create merged UCM profile for SOF HDA DSP and ACP HDA (AMD) - see https://github.com/alsa-project/alsa-ucm-conf/blob/master/ucm2/HDA/HDA.conf#L6 and https://github.com/alsa-project/alsa-ucm-conf/blob/master/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf .

EDIT: Example configuration for hidden UCM card: https://github.com/alsa-project/alsa-ucm-conf/blob/master/ucm2/conf.d/acp62/acp62.conf

perexg avatar Jun 20 '25 10:06 perexg

Thanks for suggestion. I've tried but it doesn't work, before I had:

# spa-acp-tool -vvvvvvvvvv -c 2 list-verbose 2>&1| grep jack
UCM jack HDMI/DP,pcm=2 has_control=1
UCM jack HDMI/DP,pcm=1 has_control=1
Found 2 jacks.

With updated file I have:

# spa-acp-tool -vvvvvvvvvv -c 2 list-verbose 2>&1| grep jack
Probe of jack 'Line Out Jack' succeeded (not found)
Probe of jack 'Line Out Phantom Jack' succeeded (not found)
(...)
Probe of jack 'Front Headphone Jack',1 succeeded (not found)
Probe of jack 'Front Headphone Surround Jack' succeeded (not found)
Found 0 jacks.

Regarding old UCM files I can move them. For old SST driver if I recall correctly there were only like 3 or 4 files.

Regarding DMIC does it make sense to merge it with other card, when it is separate card and device? We expose each codec as separate card in our driver, meaning usually there will be separate: speakers, headphones, dmic card. Also in theory one can only enable DMIC support in kernel, without enabling all other devices.

amadeuszslawinski-intel avatar Jun 24 '25 11:06 amadeuszslawinski-intel

The update HDMI configuration file should work: https://github.com/perexg/alsa-ucm-conf/commit/b4e8a04694a2f8188fcc94f9615c05ba8fb38b50

Regarding DMIC does it make sense to merge it with other card, when it is separate card and device? We expose each codec as separate card in our driver, meaning usually there will be separate: speakers, headphones, dmic card. Also in theory one can only enable DMIC support in kernel, without enabling all other devices.

Is it a separate card and device for users? I don't think that the logical abstraction is to have separate cards for onboard audio. For users, it does not much sense. We can just implement this level of abstraction in UCM, if drivers decided to split things using platform devices and create separate card for everything.

perexg avatar Jun 24 '25 12:06 perexg

Still no go, but I've looked closer this time, we can't override the Device itself, as it is also used to match card device in: PlaybackPCM "hw:${CardId},${var:__Device}"

So introducing another variable makes it work, something like:

DefineMacro.HDMI {
        If.1 {
                Condition {
                        Type RegexMatch
                        Regex "(^$|0)"
                        String "${var:-__Device}"
                }
                True.Define.__PCMDevice ""
                False.Define.__PCMDevice ",pcm=${var:__Device}"
        }
        If.2 {
                Condition {
                        Type ControlExists
                        Control "iface=CARD,name='HDMI/DP${var:__PCMDevice} Jack'"
                }
                True.SectionDevice."HDMI${var:__Number}" {
                        Comment "HDMI / DisplayPort ${var:__Number} Output"

                        EnableSequence [
                                cset "name='IEC958 Playback Switch',index=${eval:($__Number-1)} on"
                        ]

                        DisableSequence [
                                cset "name='IEC958 Playback Switch',index=${eval:($__Number-1)} off"
                        ]

                        Value {
                                PlaybackPriority "${var:__Priority}"
                                PlaybackPCM "hw:${CardId},${var:__Device}"
                                JackControl "HDMI/DP${var:__PCMDevice} Jack"
                        }
                }
        }
}

I've also tried with previous version, but it doesn't work with it, so the above seems good to go for me.

Regarding DMIC, I don't mind either way, I guess as it is built into the devices same as speakers, I should group it with them?

amadeuszslawinski-intel avatar Jun 24 '25 13:06 amadeuszslawinski-intel

So introducing another variable makes it work, something like:

Yes. Thanks. Fixed in https://github.com/alsa-project/alsa-ucm-conf/commit/1b69ade9b6d7ee37a87c08b12d7955d0b68fa69d (applied to master branch now)

perexg avatar Jun 24 '25 13:06 perexg

The forced separation of PCM devices is not resolved. I would like really to see the combined UCM profiles (although it may be more complicated doing this in UCM instead in the kernel level).

perexg avatar Aug 29 '25 08:08 perexg