Skip to content

Commit

Permalink
ASoC: rsnd: add probe/remove callback on rsnd_mod_ops
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kuninori Morimoto authored and Mark Brown committed Mar 5, 2014
1 parent 221bf52 commit 7681f6a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
23 changes: 23 additions & 0 deletions sound/soc/sh/rcar/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -912,9 +923,21 @@ static int rsnd_probe(struct platform_device *pdev)
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
*/
Expand Down
6 changes: 6 additions & 0 deletions sound/soc/sh/rcar/rsnd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7681f6a

Please sign in to comment.