[PATCH 0/3] ASoC: topology: allow for partial dailink stream_name match
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.
Ranjani Sridharan (3): ASoC: topology: Allow partial matching when finding DAI link ASoC: SOF: topology: Use partial match for connecting DAI link and DAI widget ASoC: SOF: Intel: HDA: Limit the number of dai drivers for nocodec mode
sound/soc/soc-topology.c | 6 +++--- sound/soc/sof/intel/hda.c | 6 +++++- sound/soc/sof/intel/hda.h | 4 +++- sound/soc/sof/topology.c | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-)
From: Ranjani Sridharan ranjani.sridharan@linux.intel.com
This allows for setting shorter link names in topology. For example, for the HDA Analog DAI link, just "Analog" would suffice instead of "Analog Playback and Capture"
Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Reviewed-by: Bard Liao yung-chuan.liao@linux.intel.com Reviewed-by: Péter Ujfalusi peter.ujfalusi@linux.intel.com --- sound/soc/soc-topology.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index 20fd46a41cbb..8add361e87c6 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -2030,11 +2030,11 @@ static struct snd_soc_dai_link *snd_soc_find_dai_link(struct snd_soc_card *card, if (link->id != id) continue;
- if (name && (!link->name || strcmp(name, link->name))) + if (name && (!link->name || !strstr(link->name, name))) continue;
- if (stream_name && (!link->stream_name - || strcmp(stream_name, link->stream_name))) + if (stream_name && (!link->stream_name || + !strstr(link->stream_name, stream_name))) continue;
return link;
From: Ranjani Sridharan ranjani.sridharan@linux.intel.com
This allows setting shorter names for the widget stream names in topology. For example, in the case of HDA Analog DAI link, the stream name is "Analog Playback and Capture". But it is enough to match "Analog" in the DAI link stream name with a widget's stream name. This is needed to set more meaningful names for the DAI widgets using the stream name in topology.
Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Reviewed-by: Bard Liao yung-chuan.liao@linux.intel.com --- sound/soc/sof/topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index f160dc454b44..698129dccc7d 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -1077,7 +1077,7 @@ static int sof_connect_dai_widget(struct snd_soc_component *scomp, list_for_each_entry(rtd, &card->rtd_list, list) { /* does stream match DAI link ? */ if (!rtd->dai_link->stream_name || - strcmp(w->sname, rtd->dai_link->stream_name)) + !strstr(rtd->dai_link->stream_name, w->sname)) continue;
for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
From: Ranjani Sridharan ranjani.sridharan@linux.intel.com
With a common kernel config for nocodec and codec modes, the number of DAI drivers will be set to 15 for nocodec as well. So adjust this when set the machine params for the nocodec mode if the debug flag is set.
Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Reviewed-by: Bard Liao yung-chuan.liao@linux.intel.com --- sound/soc/sof/intel/hda.c | 6 +++++- sound/soc/sof/intel/hda.h | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index 3153e21f100a..835c2568dd60 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -1562,7 +1562,11 @@ void hda_set_mach_params(struct snd_soc_acpi_mach *mach,
mach_params = &mach->mach_params; mach_params->platform = dev_name(sdev->dev); - mach_params->num_dai_drivers = desc->ops->num_drv; + if (IS_ENABLED(CONFIG_SND_SOC_SOF_NOCODEC_DEBUG_SUPPORT) && + sof_debug_check_flag(SOF_DBG_FORCE_NOCODEC)) + mach_params->num_dai_drivers = SOF_SKL_NUM_DAIS_NOCODEC; + else + mach_params->num_dai_drivers = desc->ops->num_drv; mach_params->dai_drivers = desc->ops->drv; }
diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index 65832a38bffa..5b3dad2dadf4 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -414,10 +414,12 @@ (HDA_DSP_BDL_SIZE / sizeof(struct sof_intel_dsp_bdl))
/* Number of DAIs */ +#define SOF_SKL_NUM_DAIS_NOCODEC 8 + #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC) #define SOF_SKL_NUM_DAIS 15 #else -#define SOF_SKL_NUM_DAIS 8 +#define SOF_SKL_NUM_DAIS SOF_SKL_NUM_DAIS_NOCODEC #endif
/* Intel HD Audio SRAM Window 0*/
On Fri, 26 May 2023 15:41:46 -0500, Pierre-Louis Bossart wrote:
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
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/3] ASoC: topology: Allow partial matching when finding DAI link commit: e018e0b346706d0a0d7d7f884f3850cc0903abc2 [2/3] ASoC: SOF: topology: Use partial match for connecting DAI link and DAI widget commit: fe88788779fc30a4117dc2f9db4b50182679bb67 [3/3] ASoC: SOF: Intel: HDA: Limit the number of dai drivers for nocodec mode commit: 0f7b6a433097808e7f3e82f837ccc1353f070e4a
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
participants (2)
-
Mark Brown
-
Pierre-Louis Bossart