sound:simple card: fix cannot register pwmdac and hdmi snd card

in soc_check_tplg_fes func, traverse all components for current card to
decide if we should modify dai-link params and use topology(the source
dai-link params is get from dts). because the sof-dsp component is in
the global components list, the sof-dsp set the ignore_machine as the
"asoc simple card", the ignore_machine matches the pwmdac
card->dev->driver->name, so the dai-link params is modified.
But in actually, the pwmdac and hdmi snd card should not use topology
and the dai-link should not be modified. we use no_plat vairalbe in
dai_link to indicates there is no platform component in dai-link and no
sof-dsp plat, and we dont use topology and dont need to change dai-link
params.

Signed-off-by: carter.li <carter.li@starfivetech.com>
This commit is contained in:
carter.li 2023-07-27 17:38:23 +08:00 committed by Justin Hammond
parent bc526cda61
commit c800ff5f3d
3 changed files with 14 additions and 0 deletions

View file

@ -651,6 +651,8 @@ struct snd_soc_dai_link {
struct snd_soc_dai_link_component *platforms;
unsigned int num_platforms;
unsigned int no_plat;
int id; /* optional ID for machine driver link identification */
const struct snd_soc_pcm_stream *params;

View file

@ -314,6 +314,15 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv,
goto dai_link_of_err;
ret = asoc_simple_parse_platform(plat, platforms);
if (!plat) {
dai_link->no_plat = 1;
} else {
dai_link->no_plat = 0;
}
ret = asoc_simple_parse_dai(plat, platforms, NULL);
if (ret < 0)
goto dai_link_of_err;

View file

@ -1805,6 +1805,9 @@ match:
dev_dbg(card->dev, "info: override BE DAI link %s\n",
card->dai_link[i].name);
if (dai_link->no_plat)
continue;
/* override platform component */
if (!dai_link->platforms) {
dev_err(card->dev, "init platform error");