From patchwork Tue Mar 8 12:53:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud POULIQUEN X-Patchwork-Id: 8533711 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 180DEC0553 for ; Tue, 8 Mar 2016 12:55:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E35B1201EF for ; Tue, 8 Mar 2016 12:55:46 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id A40F120165 for ; Tue, 8 Mar 2016 12:55:45 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 20883265A56; Tue, 8 Mar 2016 13:55:44 +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 D2022265474; Tue, 8 Mar 2016 13:54:39 +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 03D77265474; Tue, 8 Mar 2016 13:54:36 +0100 (CET) Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [62.209.51.94]) by alsa0.perex.cz (Postfix) with ESMTP id 87E02261561 for ; Tue, 8 Mar 2016 13:54:28 +0100 (CET) Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by m0046037.ppops.net (8.15.0.59/8.15.0.59) with SMTP id u28CrR9d003956; Tue, 8 Mar 2016 13:54:26 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by m0046037.ppops.net with ESMTP id 21h1y3s2s1-1 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 08 Mar 2016 13:54:26 +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 EA73E3D; Tue, 8 Mar 2016 12:54:25 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas24.st.com [10.75.90.94]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id C5FDE1302; Tue, 8 Mar 2016 12:54:25 +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, 8 Mar 2016 13:54:25 +0100 From: Arnaud Pouliquen To: Date: Tue, 8 Mar 2016 13:53:57 +0100 Message-ID: <1457441641-7501-3-git-send-email-arnaud.pouliquen@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1457441641-7501-1-git-send-email-arnaud.pouliquen@st.com> References: <1457441641-7501-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-08_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 v4 2/6] ASoC: sti: use snd_soc_add_dai_pcm_controls helper 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 Signed-off-by: Arnaud Pouliquen --- sound/soc/sti/sti_uniperif.c | 37 +++++++------------------------------ 1 file changed, 7 insertions(+), 30 deletions(-) diff --git a/sound/soc/sti/sti_uniperif.c b/sound/soc/sti/sti_uniperif.c index 39bcefe..0c87380 100644 --- a/sound/soc/sti/sti_uniperif.c +++ b/sound/soc/sti/sti_uniperif.c @@ -11,34 +11,6 @@ #include "uniperif.h" /* - * sti_uniperiph_dai_create_ctrl - * This function is used to create Ctrl associated to DAI but also pcm device. - * Request is done by front end to associate ctrl with pcm device id - */ -static int sti_uniperiph_dai_create_ctrl(struct snd_soc_dai *dai) -{ - struct sti_uniperiph_data *priv = snd_soc_dai_get_drvdata(dai); - struct uniperif *uni = priv->dai_data.uni; - struct snd_kcontrol_new *ctrl; - int i; - - if (!uni->num_ctrls) - return 0; - - for (i = 0; i < uni->num_ctrls; i++) { - /* - * Several Control can have same name. Controls are indexed on - * Uniperipheral instance ID - */ - ctrl = &uni->snd_ctrls[i]; - ctrl->index = uni->info->id; - ctrl->device = uni->info->id; - } - - return snd_soc_add_dai_controls(dai, uni->snd_ctrls, uni->num_ctrls); -} - -/* * DAI */ int sti_uniperiph_dai_hw_params(struct snd_pcm_substream *substream, @@ -112,6 +84,7 @@ static int sti_uniperiph_dai_probe(struct snd_soc_dai *dai) { struct sti_uniperiph_data *priv = snd_soc_dai_get_drvdata(dai); struct sti_uniperiph_dai *dai_data = &priv->dai_data; + struct uniperif *uni = priv->dai_data.uni; /* DMA settings*/ if (of_device_is_compatible(dai->dev->of_node, "st,sti-uni-player")) @@ -119,10 +92,14 @@ static int sti_uniperiph_dai_probe(struct snd_soc_dai *dai) else snd_soc_dai_init_dma_data(dai, NULL, &dai_data->dma_data); - dai_data->dma_data.addr = dai_data->uni->fifo_phys_address; + dai_data->dma_data.addr = uni->fifo_phys_address; dai_data->dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; - return sti_uniperiph_dai_create_ctrl(dai); + if (uni->num_ctrls) + return snd_soc_add_dai_pcm_controls(dai, uni->snd_ctrls, + uni->num_ctrls); + + return 0; } static const struct snd_soc_dai_driver sti_uniperiph_dai_template = {