]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ASoC: soc-card: add snd_soc_card_probe()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Thu, 28 May 2020 01:49:11 +0000 (10:49 +0900)
committerMark Brown <broonie@kernel.org>
Sat, 30 May 2020 01:11:36 +0000 (02:11 +0100)
Card related function should be implemented at soc-card now.
This patch adds it.

One note here is that card has "card->probe" and "card->late_probe"
callbacks.
Because it needs to care "late_probe", "card->probed" flag is set
under if (card->probe) at snd_soc_card_probe().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87wo4wzv54.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-card.h
sound/soc/soc-card.c
sound/soc/soc-core.c

index ab2410397d0ec5405253e74914e906d5ea56e997..191285a0ce19346695c133b42e1612d785171093 100644 (file)
@@ -24,6 +24,8 @@ int snd_soc_card_suspend_post(struct snd_soc_card *card);
 int snd_soc_card_resume_pre(struct snd_soc_card *card);
 int snd_soc_card_resume_post(struct snd_soc_card *card);
 
+int snd_soc_card_probe(struct snd_soc_card *card);
+
 /* device driver data */
 static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
                                            void *data)
index dc14179a1e0fe700e9b62f4903cc989376a410ad..ff3bf379f166266ddc67aadb039ee13046cb9c00 100644 (file)
@@ -119,3 +119,26 @@ int snd_soc_card_resume_post(struct snd_soc_card *card)
 
        return soc_card_ret(card, ret);
 }
+
+int snd_soc_card_probe(struct snd_soc_card *card)
+{
+       if (card->probe) {
+               int ret = card->probe(card);
+
+               if (ret < 0)
+                       return soc_card_ret(card, ret);
+
+               /*
+                * It has "card->probe" and "card->late_probe" callbacks.
+                * So, set "probed" flag here, because it needs to care
+                * about "late_probe".
+                *
+                * see
+                *      snd_soc_bind_card()
+                *      snd_soc_card_late_probe()
+                */
+               card->probed = 1;
+       }
+
+       return 0;
+}
index 7cfb3ee6ff4f98c77c243775039b695ad30ade43..13a7d515853485c86441f194f96770bdc42cc871 100644 (file)
@@ -1825,12 +1825,9 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
                goto probe_end;
 
        /* initialise the sound card only once */
-       if (card->probe) {
-               ret = card->probe(card);
-               if (ret < 0)
-                       goto probe_end;
-               card->probed = 1;
-       }
+       ret = snd_soc_card_probe(card);
+       if (ret < 0)
+               goto probe_end;
 
        /* probe all components used by DAI links on this card */
        ret = soc_probe_link_components(card);