From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kuninori Morimoto Subject: [PATCH 06/11] ASoC: rsnd: use mod probe method on SCU Date: Mon, 03 Mar 2014 20:50:41 -0800 (PST) Message-ID: <87y50qzhwh.wl%kuninori.morimoto.gx@gmail.com> References: <87d2ib90t9.wl%kuninori.morimoto.gx@gmail.com> <878usq1scd.wl%kuninori.morimoto.gx@gmail.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) by alsa0.perex.cz (Postfix) with ESMTP id 037392656EE for ; Tue, 4 Mar 2014 05:50:42 +0100 (CET) Received: by mail-pa0-f52.google.com with SMTP id rd3so3236516pab.11 for ; Mon, 03 Mar 2014 20:50:42 -0800 (PST) In-Reply-To: <878usq1scd.wl%kuninori.morimoto.gx@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Mark Brown Cc: Linux-ALSA , Simon , Liam Girdwood , Kuninori Morimoto List-Id: alsa-devel@alsa-project.org From: Kuninori Morimoto Now, it can use .probe Signed-off-by: Kuninori Morimoto --- sound/soc/sh/rcar/scu.c | 64 +++++++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 25 deletions(-) diff --git a/sound/soc/sh/rcar/scu.c b/sound/soc/sh/rcar/scu.c index 63e6aeb..40250ac 100644 --- a/sound/soc/sh/rcar/scu.c +++ b/sound/soc/sh/rcar/scu.c @@ -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) @@ -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, @@ -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); @@ -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)); - } } -- 1.7.9.5