mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 10:09:10 +02:00
ASoC: soc-card: add snd_soc_card_set_topology_name()
Some drivers want to use topology name, but currently each drivers are setting it by own method. This patch adds new snd_soc_card_set_topology_name() and do it by same method. Almost all driver doesn't set topology name, let's remove fixed name array, and use devm_kasprintf() instead. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reviewed-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://patch.msgid.link/878q942wce.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
05b9c15204
commit
ec4489c43e
|
|
@ -47,6 +47,8 @@ int snd_soc_card_late_probe(struct snd_soc_card *card);
|
|||
void snd_soc_card_fixup_controls(struct snd_soc_card *card);
|
||||
int snd_soc_card_remove(struct snd_soc_card *card);
|
||||
|
||||
void snd_soc_card_set_topology_name(struct snd_soc_card *card, const char *preifx);
|
||||
|
||||
int snd_soc_card_set_bias_level(struct snd_soc_card *card,
|
||||
struct snd_soc_dapm_context *dapm,
|
||||
enum snd_soc_bias_level level);
|
||||
|
|
|
|||
|
|
@ -990,7 +990,7 @@ struct snd_soc_card {
|
|||
bool pci_subsystem_set;
|
||||
#endif /* CONFIG_PCI */
|
||||
|
||||
char topology_shortname[32];
|
||||
char *topology_shortname;
|
||||
|
||||
struct device *dev;
|
||||
struct snd_card *snd_card;
|
||||
|
|
@ -1087,7 +1087,6 @@ struct snd_soc_card {
|
|||
#endif
|
||||
/* bit field */
|
||||
unsigned int instantiated:1;
|
||||
unsigned int topology_shortname_created:1;
|
||||
unsigned int fully_routed:1;
|
||||
unsigned int probed:1;
|
||||
unsigned int component_chaining:1;
|
||||
|
|
|
|||
|
|
@ -289,11 +289,8 @@ int mtk_soundcard_common_probe(struct platform_device *pdev)
|
|||
soc_card_data->sof_priv = pdata->sof_priv;
|
||||
card->probe = mtk_sof_card_probe;
|
||||
card->late_probe = mtk_sof_card_late_probe;
|
||||
if (!card->topology_shortname_created) {
|
||||
snprintf(card->topology_shortname, 32, "sof-%s", card->name);
|
||||
card->topology_shortname_created = true;
|
||||
}
|
||||
card->name = card->topology_shortname;
|
||||
|
||||
snd_soc_card_set_topology_name(card, "sof");
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -246,3 +246,16 @@ void snd_soc_card_remove_dai_link(struct snd_soc_card *card,
|
|||
card->remove_dai_link(card, dai_link);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_card_remove_dai_link);
|
||||
|
||||
void snd_soc_card_set_topology_name(struct snd_soc_card *card, const char *prefix)
|
||||
{
|
||||
if (!prefix || !card->name)
|
||||
return;
|
||||
|
||||
if (!card->topology_shortname)
|
||||
card->topology_shortname = devm_kasprintf(card->dev, GFP_KERNEL,
|
||||
"%s-%s", prefix, card->name);
|
||||
|
||||
card->name = card->topology_shortname;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_card_set_topology_name);
|
||||
|
|
|
|||
|
|
@ -1985,7 +1985,6 @@ static inline int snd_soc_set_dmi_name(struct snd_soc_card *card)
|
|||
static void soc_check_tplg_fes(struct snd_soc_card *card)
|
||||
{
|
||||
struct snd_soc_component *component;
|
||||
const struct snd_soc_component_driver *comp_drv;
|
||||
struct snd_soc_dai_link *dai_link;
|
||||
int i;
|
||||
|
||||
|
|
@ -2046,21 +2045,7 @@ static void soc_check_tplg_fes(struct snd_soc_card *card)
|
|||
}
|
||||
|
||||
/* Inform userspace we are using alternate topology */
|
||||
if (component->driver->topology_name_prefix) {
|
||||
|
||||
/* topology shortname created? */
|
||||
if (!card->topology_shortname_created) {
|
||||
comp_drv = component->driver;
|
||||
|
||||
snprintf(card->topology_shortname, 32, "%s-%s",
|
||||
comp_drv->topology_name_prefix,
|
||||
card->name);
|
||||
card->topology_shortname_created = true;
|
||||
}
|
||||
|
||||
/* use topology shortname */
|
||||
card->name = card->topology_shortname;
|
||||
}
|
||||
snd_soc_card_set_topology_name(card, component->driver->topology_name_prefix);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
static struct snd_soc_card sof_nocodec_card = {
|
||||
.name = "nocodec", /* the sof- prefix is added by the core */
|
||||
.topology_shortname = "sof-nocodec",
|
||||
.owner = THIS_MODULE
|
||||
};
|
||||
|
||||
|
|
@ -89,9 +88,10 @@ static int sof_nocodec_probe(struct platform_device *pdev)
|
|||
int ret;
|
||||
|
||||
card->dev = &pdev->dev;
|
||||
card->topology_shortname_created = true;
|
||||
mach = pdev->dev.platform_data;
|
||||
|
||||
snd_soc_card_set_topology_name(card, "sof");
|
||||
|
||||
ret = sof_nocodec_setup(card->dev, mach->mach_params.num_dai_drivers,
|
||||
mach->mach_params.dai_drivers);
|
||||
if (ret < 0)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user