From efb9758192547152396a6ff3022b4dedd4435116 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bossart Date: Mon, 25 Oct 2021 19:44:22 -0500 Subject: [PATCH] ASoC: soc-core: filter use of 'ignore_machine' field The 'ignore_machine' field is currently used to ignore all FE dailinks statically added by the machine drivers, as well as override the fixups for the BE dailinks. The motivation for this field was primarily to reuse the same machine driver on Intel devices, both with legacy and SOF-based platform drivers. SOF is now used on Mediatek platforms, where the same card uses SOF-based dailinks to deal with DSP-managed streams, as well as 'regular' dailinks. The 'ignore_machine' field set by the core SOF platform driver is too strong, with dailinks not managed by SOF being modified. This patch adds a stricter filtering so that only dailinks managed by a topology-based SOF driver are modified. Reported-by: YC Hung Signed-off-by: Pierre-Louis Bossart --- sound/soc/soc-core.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 1d62160f96b117..136f19044dd77c 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1771,6 +1771,19 @@ static void soc_check_tplg_fes(struct snd_soc_card *card) match: /* machine matches, so override the rtd data */ for_each_card_prelinks(card, i, dai_link) { + struct snd_soc_dai_link_component *dlc; + struct snd_soc_dai *dai; + + /* + * ignore dailinks exposed by other components, with the + * assumption that all cpu_dais are exposed by the same + * component + */ + dlc = asoc_link_to_cpu(dai_link, 0); + dai = snd_soc_find_dai(dlc); + + if (dai && dai->component != component) + continue; /* ignore this FE */ if (dai_link->dynamic) {