From patchwork Tue Jan 19 13:40:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud POULIQUEN X-Patchwork-Id: 8062621 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 7A2139F1CC for ; Tue, 19 Jan 2016 13:42:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9ADDD2038A for ; Tue, 19 Jan 2016 13:42:54 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 427E120364 for ; Tue, 19 Jan 2016 13:42:53 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 72837265A73; Tue, 19 Jan 2016 14:42:52 +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, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 6E8152658D9; Tue, 19 Jan 2016 14:41:16 +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 D4BA32658D8; Tue, 19 Jan 2016 14:41:14 +0100 (CET) Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [62.209.51.94]) by alsa0.perex.cz (Postfix) with ESMTP id 3D1FE261A5A for ; Tue, 19 Jan 2016 14:41:07 +0100 (CET) Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.15.0.59/8.15.0.59) with SMTP id u0JDZV5r019188; Tue, 19 Jan 2016 14:41:06 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 20fc75295h-1 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 19 Jan 2016 14:41:06 +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 4874C31; Tue, 19 Jan 2016 13:40:18 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas21.st.com [10.75.90.44]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 9AB5425A9; Tue, 19 Jan 2016 13:41:05 +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, 19 Jan 2016 14:41:05 +0100 From: Arnaud Pouliquen To: Date: Tue, 19 Jan 2016 14:40:33 +0100 Message-ID: <1453210836-16218-4-git-send-email-arnaud.pouliquen@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1453210836-16218-1-git-send-email-arnaud.pouliquen@st.com> References: <1453210836-16218-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-01-19_06:, , signatures=0 Cc: Jean-Francois Moine , Lars-Peter Clausen , Russell King - ARM Linux , Philipp Zabel , David Airlie , arnaud.pouliquen@st.com, Liam Girdwood , Jyri Sarha , Takashi Iwai , Mark Brown , Benjamin Gaignard Subject: [alsa-devel] [RFC 3/6] 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..50f3f82 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, rtd->codec_dais[i]); + if (ret) + return ret; + return 0; }