Commit a5b8f71c authored by Amadeusz Sławiński's avatar Amadeusz Sławiński Committed by Mark Brown

ASoC: topology: Remove multistep topology loading

In theory topology can be loaded in multiple steps by providing index to
snd_soc_tplg_component_load, however, from usability point of view it
doesn't make sense, as can be seen from all current users loading
topology in one go. Remove the unnecessary parameter.
Reviewed-by: default avatarGuennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: default avatarAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20201030145427.3497990-3-amadeuszx.slawinski@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 841fb109
...@@ -31,9 +31,6 @@ struct snd_soc_dai_driver; ...@@ -31,9 +31,6 @@ struct snd_soc_dai_driver;
struct snd_soc_dai; struct snd_soc_dai;
struct snd_soc_dapm_route; struct snd_soc_dapm_route;
/* object scan be loaded and unloaded in groups with identfying indexes */
#define SND_SOC_TPLG_INDEX_ALL 0 /* ID that matches all FW objects */
/* dynamic object type */ /* dynamic object type */
enum snd_soc_dobj_type { enum snd_soc_dobj_type {
SND_SOC_DOBJ_NONE = 0, /* object is not dynamic */ SND_SOC_DOBJ_NONE = 0, /* object is not dynamic */
...@@ -181,9 +178,8 @@ static inline const void *snd_soc_tplg_get_data(struct snd_soc_tplg_hdr *hdr) ...@@ -181,9 +178,8 @@ static inline const void *snd_soc_tplg_get_data(struct snd_soc_tplg_hdr *hdr)
/* Dynamic Object loading and removal for component drivers */ /* Dynamic Object loading and removal for component drivers */
int snd_soc_tplg_component_load(struct snd_soc_component *comp, int snd_soc_tplg_component_load(struct snd_soc_component *comp,
struct snd_soc_tplg_ops *ops, const struct firmware *fw, struct snd_soc_tplg_ops *ops, const struct firmware *fw);
u32 index); int snd_soc_tplg_component_remove(struct snd_soc_component *comp);
int snd_soc_tplg_component_remove(struct snd_soc_component *comp, u32 index);
/* Binds event handlers to dynamic widgets */ /* Binds event handlers to dynamic widgets */
int snd_soc_tplg_widget_bind_event(struct snd_soc_dapm_widget *w, int snd_soc_tplg_widget_bind_event(struct snd_soc_dapm_widget *w,
......
...@@ -3742,12 +3742,7 @@ int skl_tplg_init(struct snd_soc_component *component, struct hdac_bus *bus) ...@@ -3742,12 +3742,7 @@ int skl_tplg_init(struct snd_soc_component *component, struct hdac_bus *bus)
} }
component_load: component_load:
ret = snd_soc_tplg_component_load(component, &skl_tplg_ops, fw);
/*
* The complete tplg for SKL is loaded as index 0, we don't use
* any other index
*/
ret = snd_soc_tplg_component_load(component, &skl_tplg_ops, fw, 0);
if (ret < 0) { if (ret < 0) {
dev_err(bus->dev, "tplg component load failed%d\n", ret); dev_err(bus->dev, "tplg component load failed%d\n", ret);
goto err; goto err;
...@@ -3777,5 +3772,5 @@ void skl_tplg_exit(struct snd_soc_component *component, struct hdac_bus *bus) ...@@ -3777,5 +3772,5 @@ void skl_tplg_exit(struct snd_soc_component *component, struct hdac_bus *bus)
list_del(&ppl->node); list_del(&ppl->node);
/* clean up topology */ /* clean up topology */
snd_soc_tplg_component_remove(component, SND_SOC_TPLG_INDEX_ALL); snd_soc_tplg_component_remove(component);
} }
...@@ -64,7 +64,6 @@ struct soc_tplg { ...@@ -64,7 +64,6 @@ struct soc_tplg {
struct device *dev; struct device *dev;
struct snd_soc_component *comp; struct snd_soc_component *comp;
u32 index; /* current block index */ u32 index; /* current block index */
u32 req_index; /* required index, only loaded/free matching blocks */
/* vendor specific kcontrol operations */ /* vendor specific kcontrol operations */
const struct snd_soc_tplg_kcontrol_ops *io_ops; const struct snd_soc_tplg_kcontrol_ops *io_ops;
...@@ -2680,11 +2679,6 @@ static int soc_tplg_load_header(struct soc_tplg *tplg, ...@@ -2680,11 +2679,6 @@ static int soc_tplg_load_header(struct soc_tplg *tplg,
tplg->pos = tplg->hdr_pos + sizeof(struct snd_soc_tplg_hdr); tplg->pos = tplg->hdr_pos + sizeof(struct snd_soc_tplg_hdr);
/* check for matching ID */
if (le32_to_cpu(hdr->index) != tplg->req_index &&
tplg->req_index != SND_SOC_TPLG_INDEX_ALL)
return 0;
tplg->index = le32_to_cpu(hdr->index); tplg->index = le32_to_cpu(hdr->index);
switch (le32_to_cpu(hdr->type)) { switch (le32_to_cpu(hdr->type)) {
...@@ -2804,7 +2798,7 @@ static int soc_tplg_load(struct soc_tplg *tplg) ...@@ -2804,7 +2798,7 @@ static int soc_tplg_load(struct soc_tplg *tplg)
/* load audio component topology from "firmware" file */ /* load audio component topology from "firmware" file */
int snd_soc_tplg_component_load(struct snd_soc_component *comp, int snd_soc_tplg_component_load(struct snd_soc_component *comp,
struct snd_soc_tplg_ops *ops, const struct firmware *fw, u32 id) struct snd_soc_tplg_ops *ops, const struct firmware *fw)
{ {
struct soc_tplg tplg; struct soc_tplg tplg;
int ret; int ret;
...@@ -2819,7 +2813,6 @@ int snd_soc_tplg_component_load(struct snd_soc_component *comp, ...@@ -2819,7 +2813,6 @@ int snd_soc_tplg_component_load(struct snd_soc_component *comp,
tplg.dev = comp->dev; tplg.dev = comp->dev;
tplg.comp = comp; tplg.comp = comp;
tplg.ops = ops; tplg.ops = ops;
tplg.req_index = id;
tplg.io_ops = ops->io_ops; tplg.io_ops = ops->io_ops;
tplg.io_ops_count = ops->io_ops_count; tplg.io_ops_count = ops->io_ops_count;
tplg.bytes_ext_ops = ops->bytes_ext_ops; tplg.bytes_ext_ops = ops->bytes_ext_ops;
...@@ -2828,14 +2821,14 @@ int snd_soc_tplg_component_load(struct snd_soc_component *comp, ...@@ -2828,14 +2821,14 @@ int snd_soc_tplg_component_load(struct snd_soc_component *comp,
ret = soc_tplg_load(&tplg); ret = soc_tplg_load(&tplg);
/* free the created components if fail to load topology */ /* free the created components if fail to load topology */
if (ret) if (ret)
snd_soc_tplg_component_remove(comp, SND_SOC_TPLG_INDEX_ALL); snd_soc_tplg_component_remove(comp);
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(snd_soc_tplg_component_load); EXPORT_SYMBOL_GPL(snd_soc_tplg_component_load);
/* remove dynamic controls from the component driver */ /* remove dynamic controls from the component driver */
int snd_soc_tplg_component_remove(struct snd_soc_component *comp, u32 index) int snd_soc_tplg_component_remove(struct snd_soc_component *comp)
{ {
struct snd_soc_dobj *dobj, *next_dobj; struct snd_soc_dobj *dobj, *next_dobj;
int pass = SOC_TPLG_PASS_END; int pass = SOC_TPLG_PASS_END;
...@@ -2847,11 +2840,6 @@ int snd_soc_tplg_component_remove(struct snd_soc_component *comp, u32 index) ...@@ -2847,11 +2840,6 @@ int snd_soc_tplg_component_remove(struct snd_soc_component *comp, u32 index)
list_for_each_entry_safe(dobj, next_dobj, &comp->dobj_list, list_for_each_entry_safe(dobj, next_dobj, &comp->dobj_list,
list) { list) {
/* match index */
if (dobj->index != index &&
index != SND_SOC_TPLG_INDEX_ALL)
continue;
switch (dobj->type) { switch (dobj->type) {
case SND_SOC_DOBJ_MIXER: case SND_SOC_DOBJ_MIXER:
remove_mixer(comp, dobj, pass); remove_mixer(comp, dobj, pass);
......
...@@ -780,7 +780,7 @@ static int sof_pcm_probe(struct snd_soc_component *component) ...@@ -780,7 +780,7 @@ static int sof_pcm_probe(struct snd_soc_component *component)
static void sof_pcm_remove(struct snd_soc_component *component) static void sof_pcm_remove(struct snd_soc_component *component)
{ {
/* remove topology */ /* remove topology */
snd_soc_tplg_component_remove(component, SND_SOC_TPLG_INDEX_ALL); snd_soc_tplg_component_remove(component);
} }
void snd_sof_new_platform_drv(struct snd_sof_dev *sdev) void snd_sof_new_platform_drv(struct snd_sof_dev *sdev)
......
...@@ -3734,9 +3734,7 @@ int snd_sof_load_topology(struct snd_soc_component *scomp, const char *file) ...@@ -3734,9 +3734,7 @@ int snd_sof_load_topology(struct snd_soc_component *scomp, const char *file)
return ret; return ret;
} }
ret = snd_soc_tplg_component_load(scomp, ret = snd_soc_tplg_component_load(scomp, &sof_tplg_ops, fw);
&sof_tplg_ops, fw,
SND_SOC_TPLG_INDEX_ALL);
if (ret < 0) { if (ret < 0) {
dev_err(scomp->dev, "error: tplg component load failed %d\n", dev_err(scomp->dev, "error: tplg component load failed %d\n",
ret); ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment