diff mbox

[16/19] ASoC: rsnd: add probe/remove callback on rsnd_mod_ops

Message ID 87ppmb7m44.wl%kuninori.morimoto.gx@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kuninori Morimoto Feb. 25, 2014, 6:16 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>
---
 sound/soc/sh/rcar/core.c |   23 +++++++++++++++++++++++
 sound/soc/sh/rcar/rsnd.h |    6 ++++++
 2 files changed, 29 insertions(+)
diff mbox

Patch

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 4817b0c..7ad63c7 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -850,6 +850,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,
@@ -888,6 +889,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
 	 */
@@ -920,9 +931,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, probe);
+		if (ret)
+			return ret;
+
+		ret = rsnd_dai_call(rdai, &rdai->capture, probe);
+		if (ret)
+			return ret;
+	}
+
 	/*
 	 *	remove each module
 	 */
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 0f3d599..ec6c58e 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -143,6 +143,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);