Skip to content

Commit 74ece9d

Browse files
bardliaolgirdwood
authored andcommitted
ASoC: Intel: sof-function-topology-lib: skip non-exist file in
best_effort mode Currently we will fallback to the monolithic topology if any function topology is missing. But the monolithic topology may not exist if best_effort is set. We should load the existing function topologies in the case. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
1 parent 8f5e601 commit 74ece9d

1 file changed

Lines changed: 16 additions & 12 deletions

File tree

sound/soc/intel/common/sof-function-topology-lib.c

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ int sof_sdw_get_tplg_files(struct snd_soc_card *card, const struct snd_soc_acpi_
122122
char platform[SOF_INTEL_PLATFORM_NAME_MAX];
123123
unsigned long tplg_mask = 0;
124124
int tplg_num = 0;
125+
char *tplg_file;
125126
int tplg_dev;
126127
int ret;
127128
int i;
@@ -175,25 +176,28 @@ int sof_sdw_get_tplg_files(struct snd_soc_card *card, const struct snd_soc_acpi_
175176
if (tplg_mask & BIT(tplg_dev))
176177
continue;
177178

179+
tplg_file = get_tplg_filename(card->dev, prefix, platform, tplg_dev_name,
180+
dai_link->id, tplg_dev);
181+
if (!tplg_file)
182+
return -ENOMEM;
183+
184+
/* Check presence of sub-topologies */
185+
if (!tplg_files_exist(card->dev, tplg_file)) {
186+
devm_kfree(card->dev, tplg_file);
187+
if (best_effort)
188+
continue;
189+
190+
return 0;
191+
}
192+
178193
tplg_mask |= BIT(tplg_dev);
179194

180-
(*tplg_files)[tplg_num] = get_tplg_filename(card->dev, prefix, platform,
181-
tplg_dev_name, dai_link->id,
182-
tplg_dev);
183-
if (!(*tplg_files)[tplg_num])
184-
return -ENOMEM;
195+
(*tplg_files)[tplg_num] = tplg_file;
185196
tplg_num++;
186197
}
187198

188199
dev_dbg(card->dev, "tplg_mask %#lx tplg_num %d\n", tplg_mask, tplg_num);
189200

190-
/* Check presence of sub-topologies */
191-
for (i = 0; i < tplg_num; i++) {
192-
if (!tplg_files_exist(card->dev, (*tplg_files)[i]))
193-
/* return 0 to use monolithic topology */
194-
return 0;
195-
}
196-
197201
return tplg_num;
198202
}
199203
EXPORT_SYMBOL_GPL(sof_sdw_get_tplg_files);

0 commit comments

Comments
 (0)