Skip to content

Commit

Permalink
ASoC: rsnd: use mod probe method on SCU
Browse files Browse the repository at this point in the history
Now, it can use .probe

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 7681f6a commit 76c6fb5
Showing 1 changed file with 39 additions and 25 deletions.
64 changes: 39 additions & 25 deletions sound/soc/sh/rcar/scu.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,42 @@ static int rsnd_scu_set_convert_timing_gen2(struct rsnd_mod *mod,
return ret;
}

static int rsnd_scu_probe_gen2(struct rsnd_mod *mod,
struct rsnd_dai *rdai,
struct rsnd_dai_stream *io)
{
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct rcar_snd_info *info = rsnd_priv_to_info(priv);
struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
struct rsnd_mod *ssi = rsnd_ssi_mod_get(priv, rsnd_mod_id(mod));
struct device *dev = rsnd_priv_to_dev(priv);
int ret;
int is_play;

if (info->dai_info)
is_play = rsnd_info_is_playback(priv, scu);
else
is_play = rsnd_ssi_is_play(ssi);

ret = rsnd_dma_init(priv,
rsnd_mod_to_dma(mod),
is_play,
scu->info->dma_id);
if (ret < 0)
dev_err(dev, "SCU DMA failed\n");

return ret;
}

static int rsnd_scu_remove_gen2(struct rsnd_mod *mod,
struct rsnd_dai *rdai,
struct rsnd_dai_stream *io)
{
rsnd_dma_quit(rsnd_mod_to_priv(mod), rsnd_mod_to_dma(mod));

return 0;
}

static int rsnd_scu_init_gen2(struct rsnd_mod *mod,
struct rsnd_dai *rdai,
struct rsnd_dai_stream *io)
Expand Down Expand Up @@ -576,6 +612,8 @@ static int rsnd_scu_stop_gen2(struct rsnd_mod *mod,

static struct rsnd_mod_ops rsnd_scu_gen2_ops = {
.name = "scu (gen2)",
.probe = rsnd_scu_probe_gen2,
.remove = rsnd_scu_remove_gen2,
.init = rsnd_scu_init_gen2,
.quit = rsnd_scu_quit,
.start = rsnd_scu_start_gen2,
Expand Down Expand Up @@ -631,25 +669,8 @@ int rsnd_scu_probe(struct platform_device *pdev,
if (rsnd_scu_hpbif_is_enable(scu)) {
if (rsnd_is_gen1(priv))
ops = &rsnd_scu_gen1_ops;
if (rsnd_is_gen2(priv)) {
int ret;
int is_play;

if (info->dai_info) {
is_play = rsnd_info_is_playback(priv, scu);
} else {
struct rsnd_mod *ssi = rsnd_ssi_mod_get(priv, i);
is_play = rsnd_ssi_is_play(ssi);
}
ret = rsnd_dma_init(priv,
rsnd_mod_to_dma(&scu->mod),
is_play,
scu->info->dma_id);
if (ret < 0)
return ret;

if (rsnd_is_gen2(priv))
ops = &rsnd_scu_gen2_ops;
}
}

rsnd_mod_init(priv, &scu->mod, ops, RSND_MOD_SCU, i);
Expand All @@ -663,11 +684,4 @@ int rsnd_scu_probe(struct platform_device *pdev,
void rsnd_scu_remove(struct platform_device *pdev,
struct rsnd_priv *priv)
{
struct rsnd_scu *scu;
int i;

for_each_rsnd_scu(scu, priv, i) {
if (rsnd_scu_dma_available(scu))
rsnd_dma_quit(priv, rsnd_mod_to_dma(&scu->mod));
}
}

0 comments on commit 76c6fb5

Please sign in to comment.