ASoC: rsnd: add probe/remove callback on rsnd_mod_ops
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tue, 4 Mar 2014 04:50:33 +0000 (20:50 -0800)
committerMark Brown <broonie@linaro.org>
Wed, 5 Mar 2014 06:07:52 +0000 (14:07 +0800)
Each rsnd mod needs specific probe method,
and its best timing is DAI probe timing.
But current code runs it mod probe timing.
This patch adds new probe/remove callback to solve it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/sh/rcar/core.c
sound/soc/sh/rcar/rsnd.h

index 7316d10e464901833b3a60ecdf0096c3a6ea3107..e8e585de7251ed8bae10b3d64bc6f68cc79e9728 100644 (file)
@@ -842,6 +842,7 @@ static int rsnd_probe(struct platform_device *pdev)
        struct rcar_snd_info *info;
        struct rsnd_priv *priv;
        struct device *dev = &pdev->dev;
+       struct rsnd_dai *rdai;
        int (*probe_func[])(struct platform_device *pdev,
                            struct rsnd_priv *priv) = {
                rsnd_gen_probe,
@@ -880,6 +881,16 @@ static int rsnd_probe(struct platform_device *pdev)
                        return ret;
        }
 
+       for_each_rsnd_dai(rdai, priv, i) {
+               ret = rsnd_dai_call(rdai, &rdai->playback, probe);
+               if (ret)
+                       return ret;
+
+               ret = rsnd_dai_call(rdai, &rdai->capture, probe);
+               if (ret)
+                       return ret;
+       }
+
        /*
         *      asoc register
         */
@@ -912,9 +923,21 @@ exit_snd_soc:
 static int rsnd_remove(struct platform_device *pdev)
 {
        struct rsnd_priv *priv = dev_get_drvdata(&pdev->dev);
+       struct rsnd_dai *rdai;
+       int ret, i;
 
        pm_runtime_disable(&pdev->dev);
 
+       for_each_rsnd_dai(rdai, priv, i) {
+               ret = rsnd_dai_call(rdai, &rdai->playback, remove);
+               if (ret)
+                       return ret;
+
+               ret = rsnd_dai_call(rdai, &rdai->capture, remove);
+               if (ret)
+                       return ret;
+       }
+
        /*
         *      remove each module
         */
index 9205f96da2f464a1c89dbb50d8b23d5020cf03cd..db20b372195354ab5bf73efc02b60d0bbc33df48 100644 (file)
@@ -167,6 +167,12 @@ enum rsnd_mod_type {
 
 struct rsnd_mod_ops {
        char *name;
+       int (*probe)(struct rsnd_mod *mod,
+                    struct rsnd_dai *rdai,
+                    struct rsnd_dai_stream *io);
+       int (*remove)(struct rsnd_mod *mod,
+                     struct rsnd_dai *rdai,
+                     struct rsnd_dai_stream *io);
        int (*init)(struct rsnd_mod *mod,
                    struct rsnd_dai *rdai,
                    struct rsnd_dai_stream *io);