From: Mark Brown Date: Wed, 2 Mar 2011 18:36:34 +0000 (+0000) Subject: ASoC: Add a late_probe() callback to cards X-Git-Tag: MMI-PSA29.97-13-9~16612^2~1145^2~43 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=28e9ad921d3b7defd8940a3e30e8241c8ed734db;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git ASoC: Add a late_probe() callback to cards This is run after the DAPM widgets and routes are added, allowing setup of things like jacks using the routes. The main card probe() is run before anything else so can't be used for this purpose. Signed-off-by: Mark Brown Acked-by: Liam Girdwood --- diff --git a/include/sound/soc.h b/include/sound/soc.h index 11d59bd13886..9c2a6dd170f1 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -682,6 +682,7 @@ struct snd_soc_card { bool instantiated; int (*probe)(struct snd_soc_card *card); + int (*late_probe)(struct snd_soc_card *card); int (*remove)(struct snd_soc_card *card); /* the pre and post PM functions are used to do any PM work before and diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 6a2839c18447..8926d38fc5a3 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1892,6 +1892,15 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card) snprintf(card->snd_card->longname, sizeof(card->snd_card->longname), "%s", card->name); + if (card->late_probe) { + ret = card->late_probe(card); + if (ret < 0) { + dev_err(card->dev, "%s late_probe() failed: %d\n", + card->name, ret); + goto probe_aux_dev_err; + } + } + ret = snd_card_register(card->snd_card); if (ret < 0) { printk(KERN_ERR "asoc: failed to register soundcard for %s\n", card->name);