From f11a5c27f9287cacad74af31cd92d4413eccc05a Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Tue, 27 Mar 2018 14:30:41 +0100 Subject: [PATCH] ASoC: core: Add name prefix for machines with topology rewrites Signed-off-by: Liam Girdwood Signed-off-by: Mark Brown --- include/sound/soc.h | 2 ++ sound/soc/soc-core.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/include/sound/soc.h b/include/sound/soc.h index fac4ff04fb7d..3676d0a8f532 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1015,6 +1015,7 @@ struct snd_soc_platform_driver { /* this platform uses topology and ignore machine driver FEs */ const char *ignore_machine; + const char *topology_name_prefix; int (*be_hw_params_fixup)(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params); bool use_dai_pcm_id; /* use the DAI link PCM ID as PCM device number */ @@ -1167,6 +1168,7 @@ struct snd_soc_card { const char *long_name; const char *driver_name; char dmi_longname[80]; + char topology_shortname[32]; struct device *dev; struct snd_card *snd_card; diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 8f01fe8296ff..aa1c33b3cce0 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2143,6 +2143,14 @@ static void soc_check_tplg_fes(struct snd_soc_card *card) if (!dai_link->stream_name) dai_link->stream_name = dai_link->name; } + + /* Inform userspace we are using alternate topology */ + if (platform->driver->topology_name_prefix) { + snprintf(card->topology_shortname, 32, "%s-%s", + platform->driver->topology_name_prefix, + card->name); + card->name = card->topology_shortname; + } } } -- GitLab