From patchwork Tue Feb 25 06:16:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 3713051 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 08BF39F2ED for ; Tue, 25 Feb 2014 06:26:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 39D3F2016C for ; Tue, 25 Feb 2014 06:26:26 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 0F4D2200E1 for ; Tue, 25 Feb 2014 06:26:25 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 26C57265779; Tue, 25 Feb 2014 07:26:19 +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 0F8122655F4; Tue, 25 Feb 2014 07:18:54 +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 1AE382655F4; Tue, 25 Feb 2014 07:18:53 +0100 (CET) Received: from mail-pd0-f180.google.com (mail-pd0-f180.google.com [209.85.192.180]) by alsa0.perex.cz (Postfix) with ESMTP id EBB582655F7 for ; Tue, 25 Feb 2014 07:16:47 +0100 (CET) Received: by mail-pd0-f180.google.com with SMTP id y10so1720155pdj.39 for ; Mon, 24 Feb 2014 22:16:46 -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=vbZw8/r2KXry1SwNC2ULXY0LZHlkUffgjr8v5B/xN3E=; b=zwVEbSyGG/azB6PumbDFbt4iXxXZ2eO0NfdtU4H2GHeQu4y/qfQZ2Kc+Iw2BPTK/Fu GAuDxG6bVZnMGQS51wTvC9ZB5Yne5F8qeK/U2k+xmjpXpI+8o+S+z0A9uhlt9+i9cDn2 nPBgPD7Oaan0iYuN9Mf3FIHOwIf+IpxcjlIBXUHXlY/mQXZRk8ZfDXk5m4T2QGybaxFo d0uvrg3e7bhIuzfk44gfZXAqge2gwTCgwoVFU4tFInaBw8+7G8zzaouO3NYvfZ7AK6E5 QcApm0ue0GBtlZERd3wTPmKSY65rGxT7DeDnPs8iwzVpm+xb0dh3OOQvgUdQTR/qLrsG B+8g== X-Received: by 10.66.159.132 with SMTP id xc4mr29895303pab.27.1393309006796; Mon, 24 Feb 2014 22:16:46 -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 qh2sm135943477pab.13.2014.02.24.22.16.45 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 24 Feb 2014 22:16:46 -0800 (PST) Date: Mon, 24 Feb 2014 22:16:46 -0800 (PST) Message-ID: <87ppmb7m44.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 16/19] 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 4817b0c..7ad63c7 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -850,6 +850,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, @@ -888,6 +889,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 */ @@ -920,9 +931,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, probe); + if (ret) + return ret; + + ret = rsnd_dai_call(rdai, &rdai->capture, probe); + if (ret) + return ret; + } + /* * remove each module */ diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h index 0f3d599..ec6c58e 100644 --- a/sound/soc/sh/rcar/rsnd.h +++ b/sound/soc/sh/rcar/rsnd.h @@ -143,6 +143,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);