Skip to content

Commit a22ae72

Browse files
plbossartbroonie
authored andcommitted
ASoC: soc-core: disable route checks for legacy devices
v5.4 changes in soc-core tightened the checks on soc_dapm_add_routes, which results in the ASoC card probe failing. Introduce a flag to be set in machine drivers to prevent the probe from stopping in case of incomplete topologies or missing routes. This flag is for backwards compatibility only and shall not be used for newer machine drivers. Example with an HDaudio card with a bad topology: [ 236.177898] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: Failed to add route iDisp1_out -> direct -> iDisp1 Tx [ 236.177902] skl_hda_dsp_generic skl_hda_dsp_generic: snd_soc_bind_card: snd_soc_dapm_add_routes failed: -19 with the disable_route_checks set: [ 64.031657] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: Failed to add route iDisp1_out -> direct -> iDisp1 Tx [ 64.031661] skl_hda_dsp_generic skl_hda_dsp_generic: snd_soc_bind_card: disable_route_checks set, ignoring errors on add_routes Fixes: daa480b ("ASoC: soc-core: tidyup for snd_soc_dapm_add_routes()") Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/20200309192744.18380-2-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 9401d5a commit a22ae72

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

include/sound/soc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,7 @@ struct snd_soc_card {
10581058
const struct snd_soc_dapm_route *of_dapm_routes;
10591059
int num_of_dapm_routes;
10601060
bool fully_routed;
1061+
bool disable_route_checks;
10611062

10621063
/* lists of probed devices belonging to this card */
10631064
struct list_head component_dev_list;

sound/soc/soc-core.c

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,8 +1256,18 @@ static int soc_probe_component(struct snd_soc_card *card,
12561256
ret = snd_soc_dapm_add_routes(dapm,
12571257
component->driver->dapm_routes,
12581258
component->driver->num_dapm_routes);
1259-
if (ret < 0)
1260-
goto err_probe;
1259+
if (ret < 0) {
1260+
if (card->disable_route_checks) {
1261+
dev_info(card->dev,
1262+
"%s: disable_route_checks set, ignoring errors on add_routes\n",
1263+
__func__);
1264+
} else {
1265+
dev_err(card->dev,
1266+
"%s: snd_soc_dapm_add_routes failed: %d\n",
1267+
__func__, ret);
1268+
goto err_probe;
1269+
}
1270+
}
12611271

12621272
/* see for_each_card_components */
12631273
list_add(&component->card_list, &card->component_dev_list);
@@ -1938,8 +1948,18 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
19381948

19391949
ret = snd_soc_dapm_add_routes(&card->dapm, card->dapm_routes,
19401950
card->num_dapm_routes);
1941-
if (ret < 0)
1942-
goto probe_end;
1951+
if (ret < 0) {
1952+
if (card->disable_route_checks) {
1953+
dev_info(card->dev,
1954+
"%s: disable_route_checks set, ignoring errors on add_routes\n",
1955+
__func__);
1956+
} else {
1957+
dev_err(card->dev,
1958+
"%s: snd_soc_dapm_add_routes failed: %d\n",
1959+
__func__, ret);
1960+
goto probe_end;
1961+
}
1962+
}
19431963

19441964
ret = snd_soc_dapm_add_routes(&card->dapm, card->of_dapm_routes,
19451965
card->num_of_dapm_routes);

0 commit comments

Comments
 (0)