From patchwork Tue Mar 1 08:19:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud POULIQUEN X-Patchwork-Id: 8462951 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2C9069F372 for ; Tue, 1 Mar 2016 08:19:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 479C0201F4 for ; Tue, 1 Mar 2016 08:19:56 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id C8377201BB for ; Tue, 1 Mar 2016 08:19:54 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 592D62661B5; Tue, 1 Mar 2016 09:19:53 +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.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id C522226262A; Tue, 1 Mar 2016 09:19:44 +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 E316426262A; Tue, 1 Mar 2016 09:19:43 +0100 (CET) Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by alsa0.perex.cz (Postfix) with ESMTP id AF051264F50 for ; Tue, 1 Mar 2016 09:19:36 +0100 (CET) Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.15.0.59/8.15.0.59) with SMTP id u218Iw4I025589; Tue, 1 Mar 2016 09:19:36 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 21b1t8qkb3-1 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 01 Mar 2016 09:19:36 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 774DA3F; Tue, 1 Mar 2016 08:19:35 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas22.st.com [10.75.90.92]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 54FB3107A; Tue, 1 Mar 2016 08:19:35 +0000 (GMT) Received: from localhost (10.201.23.162) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 1 Mar 2016 09:19:35 +0100 From: Arnaud Pouliquen To: Date: Tue, 1 Mar 2016 09:19:15 +0100 Message-ID: <1456820357-2545-3-git-send-email-arnaud.pouliquen@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1456820357-2545-1-git-send-email-arnaud.pouliquen@st.com> References: <1456820357-2545-1-git-send-email-arnaud.pouliquen@st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.23.162] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-03-01_05:, , signatures=0 Cc: Jean-Francois Moine , Lars-Peter Clausen , Russell King - ARM Linux , David Airlie , arnaud.pouliquen@st.com, Liam Girdwood , Jyri Sarha , Takashi Iwai , Mark Brown , Philipp Zabel , Moise Gergaud Subject: [alsa-devel] [PATCH v3 2/4] ASoC: core: add code to complete dai init after pcm creation 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 Some Controls defined in DAI need to be associated to PCM device (e.g. IEC60958). This allows to perform post initialization in DAI after PCM device creation. Signed-off-by: Arnaud Pouliquen --- include/sound/soc-dai.h | 7 +++++++ sound/soc/soc-core.c | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index 964b7de..6969c83 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -205,6 +205,13 @@ struct snd_soc_dai_ops { */ snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *, struct snd_soc_dai *); + + /* + * function called by soc_probe_link_dais to post initialize DAI + * after pcm device creation. + * As example, can be used to link a controls to the pcm device + */ + int (*pcm_new)(struct snd_soc_pcm_runtime *, struct snd_soc_dai *); }; /* diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 790ee2b..3899ce7 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1587,6 +1587,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card, { struct snd_soc_dai_link *dai_link = rtd->dai_link; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + const struct snd_soc_dai_ops *ops; int i, ret; dev_dbg(card->dev, "ASoC: probe %s dai link %d late %d\n", @@ -1662,6 +1663,19 @@ static int soc_probe_link_dais(struct snd_soc_card *card, } } + for (i = 0; i < rtd->num_codecs; i++) { + ops = rtd->codec_dais[i]->driver->ops; + if (ops->pcm_new) + ret = ops->pcm_new(rtd, rtd->codec_dais[i]); + if (ret) + return ret; + } + ops = cpu_dai->driver->ops; + if (ops->pcm_new) + ret = ops->pcm_new(rtd, cpu_dai); + if (ret) + return ret; + return 0; }