[PATCH] ALSA: hda/hdmi: let new platforms assign the pcm slot dynamically

Kai Vehmanen kai.vehmanen at linux.intel.com
Tue Feb 23 15:14:00 CET 2021


Hi,

thanks for the patch! 

On Tue, 23 Feb 2021, Hui Wang wrote:

> If the platform set the dyn_pcm_assign to true, it will call
> hdmi_find_pcm_slot() to find a pcm slot when hdmi/dp monitor is
> connected and need to create a pcm.
[...]
> This change comes from the discussion between Takashi and
> Kai Vehmanen. Please refer to:
> https://github.com/alsa-project/alsa-lib/pull/118

I did propose to merge the alsa-lib change to give us a bit more time to 
think about how this should be handled in kernel.

While this patch certainly solves the problem of kernel picking ALSA PCMs, 
which current alsa-lib cannot handle, it leaves us a bit halfway. We'd 
create many PCMs that will never be used. And this change is a bit more 
involved.

> So far only intel_hsw_common_init() and patch_nvhdmi() set the
> dyn_pcm_assign to true, here we let tgl platforms assign the pcm slot
> dynamically first, if the driver runs for a period of time and there
> is no regression reported, we could set no_fixed_assgin to true in
> the intel_hsw_common_init(), and then set it to true in the
> patch_nvhdmi().

Staged plan sounds good here, although I'd be fairly cautious with this. 
People using Pulseaudio/Pipewire+UCM won't notice a thing, but I'm sure 
there are people out there assuming a fixed "physical connector -> ALSA 
PCM" mapping and not using UCM. Probably at least some way to opt-out 
would be needed for older platforms.

> +	if (port_num > 6)
> +		spec->no_fixed_assign = true;

I think this is magic enough of a number to be defined separately along 
with some documentation. So basicly user-space has a max limit of 8 now
and two PCMs are reserved for DP-MST, so that brings us to six, right?

This is somewhat arbitrary still. If we simply want to enable the mode for 
TGL only, easier and cleaned would be to set this flag in 
patch_i915_tgl_hdmi() directly.

Br, Kai


More information about the Alsa-devel mailing list