From patchwork Tue Mar 4 04:50:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 3758821 X-Patchwork-Delegate: broonie@sirena.org.uk Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D14C39F1EE for ; Tue, 4 Mar 2014 04:54:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 06ABA20237 for ; Tue, 4 Mar 2014 04:54:30 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id C8CD2201ED for ; Tue, 4 Mar 2014 04:54:28 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 6FBE026575C; Tue, 4 Mar 2014 05:54:27 +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 007A5265763; Tue, 4 Mar 2014 05:51:52 +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 BCD0526576B; Tue, 4 Mar 2014 05:51:50 +0100 (CET) Received: from mail-pd0-f172.google.com (mail-pd0-f172.google.com [209.85.192.172]) by alsa0.perex.cz (Postfix) with ESMTP id 977FC265729 for ; Tue, 4 Mar 2014 05:50:34 +0100 (CET) Received: by mail-pd0-f172.google.com with SMTP id p10so4617958pdj.17 for ; Mon, 03 Mar 2014 20:50:33 -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=U9YKLCNJKxm+laQCp4zs9m4nLPs8DrDOXUfCoG5FiMc=; b=Cupavbc1y1uIo1ZMwpVMI18FiPg9ug3rp/KBLut2M/lc6sBRm7m8g67EU97Ekt18bD kSd6kPCCBE2kIWqlE8OtldHCv0wLq4iR7AfDOHWpu6PsMA/8hyRsnBkC+XWaCf2pHJde r+66Sdt7c7WrFubvOa8lem2W4nKm1eEgihlgf6DMt/h9fBHEERFO9iQJYhPSA7cggbpS 3OkBvgEilyQycxHD8V+mDQrbYC8AWVTZMhqDs4E/eZsC3iBtoGhVtD5qB4P7NC8hszo/ tpFEHD7UqXKjMsb/bDWIvswhsGfH1uiNu7zPji8Hi8Eewc1FA7xXPjZoW1CxCJFjksGL L18Q== X-Received: by 10.66.141.144 with SMTP id ro16mr3488967pab.131.1393908633686; Mon, 03 Mar 2014 20:50:33 -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 fk4sm97205838pab.23.2014.03.03.20.50.32 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 03 Mar 2014 20:50:33 -0800 (PST) Date: Mon, 03 Mar 2014 20:50:33 -0800 (PST) Message-ID: <87zjl6zhwp.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: <878usq1scd.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") Cc: Linux-ALSA , Simon , Liam Girdwood , Kuninori Morimoto Subject: [alsa-devel] [PATCH 05/11] ASoC: rsnd: add probe/remove callback on rsnd_mod_ops 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 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 --- sound/soc/sh/rcar/core.c | 23 +++++++++++++++++++++++ sound/soc/sh/rcar/rsnd.h | 6 ++++++ 2 files changed, 29 insertions(+) diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 7316d10..e8e585d 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -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, @@ -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 */ @@ -912,9 +923,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, remove); + if (ret) + return ret; + + ret = rsnd_dai_call(rdai, &rdai->capture, remove); + if (ret) + return ret; + } + /* * remove each module */ diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h index 9205f96..db20b37 100644 --- a/sound/soc/sh/rcar/rsnd.h +++ b/sound/soc/sh/rcar/rsnd.h @@ -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);