Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: topology: allow for partial dailink stream_name

Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

The topology file and the machine driver rely on common definitions
for the dailink stream_name. To avoid any backwards-compatibility
problems, the machine driver stream names are set in stone and cannot
be modified.

This is problematic when we try to name some of the topology widgets
after the stream_name, since the widget name is limited to 44
characters

tools/include/uapi/sound/asound.h:#define SNDRV_CTL_ELEM_ID_NAME_MAXLEN 44

Existing examples include "Analog Playback and Capture" for HDaudio
dailinks, which leaves less than 20 chars to identify widgets/controls
with a meaningful name.

Since the 44-char limit is part of the UAPI definitions, we assumed
there is no way to increase it.

This patchset suggests instead a partial match which allows topology
files to use a shorter stream_name, which in turn allows for
self-explanatory widget names that comply with the 44-char limit.

This should not break any existing setup but with the introduction of
a partial match new dailinks should be named carefully to avoid
confusions between e.g. 'link1' and 'link10'. The last patch fixes
such an issue in the 'nocodec' test topology used by Intel.

+12 -6
+3 -3
sound/soc/soc-topology.c
··· 2030 2030 if (link->id != id) 2031 2031 continue; 2032 2032 2033 - if (name && (!link->name || strcmp(name, link->name))) 2033 + if (name && (!link->name || !strstr(link->name, name))) 2034 2034 continue; 2035 2035 2036 - if (stream_name && (!link->stream_name 2037 - || strcmp(stream_name, link->stream_name))) 2036 + if (stream_name && (!link->stream_name || 2037 + !strstr(link->stream_name, stream_name))) 2038 2038 continue; 2039 2039 2040 2040 return link;
+5 -1
sound/soc/sof/intel/hda.c
··· 1562 1562 1563 1563 mach_params = &mach->mach_params; 1564 1564 mach_params->platform = dev_name(sdev->dev); 1565 - mach_params->num_dai_drivers = desc->ops->num_drv; 1565 + if (IS_ENABLED(CONFIG_SND_SOC_SOF_NOCODEC_DEBUG_SUPPORT) && 1566 + sof_debug_check_flag(SOF_DBG_FORCE_NOCODEC)) 1567 + mach_params->num_dai_drivers = SOF_SKL_NUM_DAIS_NOCODEC; 1568 + else 1569 + mach_params->num_dai_drivers = desc->ops->num_drv; 1566 1570 mach_params->dai_drivers = desc->ops->drv; 1567 1571 } 1568 1572
+3 -1
sound/soc/sof/intel/hda.h
··· 414 414 (HDA_DSP_BDL_SIZE / sizeof(struct sof_intel_dsp_bdl)) 415 415 416 416 /* Number of DAIs */ 417 + #define SOF_SKL_NUM_DAIS_NOCODEC 8 418 + 417 419 #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC) 418 420 #define SOF_SKL_NUM_DAIS 15 419 421 #else 420 - #define SOF_SKL_NUM_DAIS 8 422 + #define SOF_SKL_NUM_DAIS SOF_SKL_NUM_DAIS_NOCODEC 421 423 #endif 422 424 423 425 /* Intel HD Audio SRAM Window 0*/
+1 -1
sound/soc/sof/topology.c
··· 1073 1073 list_for_each_entry(rtd, &card->rtd_list, list) { 1074 1074 /* does stream match DAI link ? */ 1075 1075 if (!rtd->dai_link->stream_name || 1076 - strcmp(w->sname, rtd->dai_link->stream_name)) 1076 + !strstr(rtd->dai_link->stream_name, w->sname)) 1077 1077 continue; 1078 1078 1079 1079 for_each_rtd_cpu_dais(rtd, i, cpu_dai) {