This is useful when one route element is added at a time.
Signed-off-by: Subhransu S. Prusty subhransu.s.prusty@intel.com --- include/sound/soc-dapm.h | 2 ++ sound/soc/soc-dapm.c | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+)
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 9706946..fffd1f1 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -396,6 +396,8 @@ int snd_soc_dapm_new_widgets(struct snd_soc_card *card); void snd_soc_dapm_free(struct snd_soc_dapm_context *dapm); int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm, const struct snd_soc_dapm_route *route, int num); +int snd_soc_dapm_add_route_single(struct snd_soc_dapm_context *dapm, + const struct snd_soc_dapm_route *route); int snd_soc_dapm_del_routes(struct snd_soc_dapm_context *dapm, const struct snd_soc_dapm_route *route, int num); int snd_soc_dapm_weak_routes(struct snd_soc_dapm_context *dapm, diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index c446485..ad67647 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -2802,6 +2802,27 @@ int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm, EXPORT_SYMBOL_GPL(snd_soc_dapm_add_routes);
/** + * snd_soc_dapm_add_route_single - Add a single route + * @dapm: DAPM context + * @route: audio route element + * + * Connects 2 dapm widgets together via a named audio path. + * xxx_add_route is already managed through dapm lock. + */ +int snd_soc_dapm_add_route_single(struct snd_soc_dapm_context *dapm, + const struct snd_soc_dapm_route *route) +{ + int ret; + + mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT); + ret = snd_soc_dapm_add_route(dapm, route); + mutex_unlock(&dapm->card->dapm_mutex); + + return ret; +} +EXPORT_SYMBOL_GPL(snd_soc_dapm_add_route_single); + +/** * snd_soc_dapm_del_routes - Remove routes between DAPM widgets * @dapm: DAPM context * @route: audio routes