From patchwork Tue Feb 25 06:16:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 3713061 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A187DBF13A for ; Tue, 25 Feb 2014 06:26:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CEB172017E for ; Tue, 25 Feb 2014 06:26:57 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 9B93B200E1 for ; Tue, 25 Feb 2014 06:26:56 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 9D6732657A0; Tue, 25 Feb 2014 07:26:55 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id E0E05265604; Tue, 25 Feb 2014 07:19:10 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 0D080265574; Tue, 25 Feb 2014 07:19:09 +0100 (CET) Received: from mail-pa0-f45.google.com (mail-pa0-f45.google.com [209.85.220.45]) by alsa0.perex.cz (Postfix) with ESMTP id 7F04E265601 for ; Tue, 25 Feb 2014 07:16:55 +0100 (CET) Received: by mail-pa0-f45.google.com with SMTP id lf10so7652618pab.32 for ; Mon, 24 Feb 2014 22:16:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:message-id:from:subject:user-agent:to:cc:in-reply-to :references:mime-version:content-type; bh=MhtyGOmrzrberW+O38RVm4U700UC1Kmy9LgsNcQUTGI=; b=q3Byk0lz2thujagS10BvatkkDPD8fRA+ZIuBhKAd88hTYxcVmxuo0S7wo4Z/Osx0Fs KCOeQAQnt61z46ixvSygtgkarDNB+WWKUlQerx4fgA2eyI6J4B+iSNxYn0g4xUFzJxMl 6pYlCAS4CXbKRcfxYLeRCQCEAiD8HnmuRmrDA/zsfZw8wIYVxCsqkXNi7eeSD3BMPOS4 GZJGmIkJjtHX1fhAmwF0/sZLrm4b/9NKIlKYlaIgP7b3GZnom4nvYmBQdoT7xUV55gRA dnjjZF9zkeO+OupeV0LEHMEOyJSF5VHQQq93wxnPX1JATMTi+HNaP10jLwTa6JR/CAJO VSIw== X-Received: by 10.66.240.4 with SMTP id vw4mr30156057pac.26.1393309014648; Mon, 24 Feb 2014 22:16:54 -0800 (PST) Received: from morimoto-Dell-XPS420.gmail.com (49.14.32.202.bf.2iij.net. [202.32.14.49]) by mx.google.com with ESMTPSA id tu3sm135966071pab.1.2014.02.24.22.16.53 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 24 Feb 2014 22:16:54 -0800 (PST) Date: Mon, 24 Feb 2014 22:16:54 -0800 (PST) Message-ID: <87ob1v7m3x.wl%kuninori.morimoto.gx@gmail.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.14.0 Emacs/23.3 Mule/6.0 To: Mark Brown In-Reply-To: <87d2ib90t9.wl%kuninori.morimoto.gx@gmail.com> References: <87d2ib90t9.wl%kuninori.morimoto.gx@gmail.com> MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Cc: Linux-ALSA , Simon , Liam Girdwood , Kuninori Morimoto Subject: [alsa-devel] [PATCH 17/19] ASoC: rsnd: use mod probe method on SCU X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" 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 X-Virus-Scanned: ClamAV using ClamSMTP 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)); - } }