ASoC: Add a late_probe() callback to cards
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 2 Mar 2011 18:36:34 +0000 (18:36 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Thu, 3 Mar 2011 11:15:35 +0000 (11:15 +0000)
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 <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
include/sound/soc.h
sound/soc/soc-core.c

index 11d59bd1388657c19f4ae1c27be14a9554a1cd20..9c2a6dd170f1acfe09e338c94adbb538eb49e41d 100644 (file)
@@ -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
index 6a2839c1844799f865f8fc2ff2ae540a3d503b52..8926d38fc5a32c1cca592c1144fb2ac7095afc88 100644 (file)
@@ -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);