From patchwork Tue Mar 8 12:53:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud POULIQUEN X-Patchwork-Id: 8533721 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 199B5C0553 for ; Tue, 8 Mar 2016 12:56:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3305920165 for ; Tue, 8 Mar 2016 12:56:23 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 1A973201FA for ; Tue, 8 Mar 2016 12:56:21 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 5C81A265B55; Tue, 8 Mar 2016 13:56: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.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 C5BB6265743; Tue, 8 Mar 2016 13:54:42 +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 1661A265367; Tue, 8 Mar 2016 13:54:39 +0100 (CET) Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by alsa0.perex.cz (Postfix) with ESMTP id BD8D7264F8D for ; Tue, 8 Mar 2016 13:54:29 +0100 (CET) Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.15.0.59/8.15.0.59) with SMTP id u28CrK96009965; Tue, 8 Mar 2016 13:54:29 +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 21ft1rrvya-1 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 08 Mar 2016 13:54:29 +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 9475E3D; Tue, 8 Mar 2016 12:54:28 +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 644E01427; Tue, 8 Mar 2016 12:54:28 +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:28 +0100 From: Arnaud Pouliquen To: Date: Tue, 8 Mar 2016 13:53:59 +0100 Message-ID: <1457441641-7501-5-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 4/6] ASoC: core: allow private data for snd_soc_add_dai_pcm_controls 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 To support generic iec958 control implementation, dai needs to provide control private data to allow to retrieve context. Signed-off-by: Arnaud Pouliquen --- include/sound/soc.h | 3 ++- sound/soc/soc-core.c | 10 +++++++--- sound/soc/sti/sti_uniperif.c | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index 044adcf..e277e726 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -599,7 +599,8 @@ int snd_soc_add_card_controls(struct snd_soc_card *soc_card, int snd_soc_add_dai_controls(struct snd_soc_dai *dai, const struct snd_kcontrol_new *controls, int num_controls); int snd_soc_add_dai_pcm_controls(struct snd_soc_dai *dai, - const struct snd_kcontrol_new *controls, int num_controls); + const struct snd_kcontrol_new *controls, + int num_controls, void *data); int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo); int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol, diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 08a1b9f..780192b 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1606,6 +1606,7 @@ static int snd_soc_add_controls(struct snd_card *card, struct device *dev, struct snd_soc_dai_pcm_ctls { struct snd_kcontrol_new *controls; int num_controls; + void *controls_data; struct list_head list; }; @@ -1623,7 +1624,8 @@ static int soc_link_dai_pcm_controls(struct snd_soc_card *card, kctl[i].device = rtd->pcm->device; ret = snd_soc_add_controls(card->snd_card, dai->dev, kctl, - ctls->num_controls, NULL, dai); + ctls->num_controls, NULL, + ctls->controls_data); if (ret < 0) return ret; kfree(kctl); @@ -2387,12 +2389,13 @@ EXPORT_SYMBOL_GPL(snd_soc_add_dai_controls); * @dai: DAI to add controls to * @controls: array of controls to add * @num_controls: number of elements in the array + * @data: control private data * * Return 0 for success, else error. */ int snd_soc_add_dai_pcm_controls(struct snd_soc_dai *dai, const struct snd_kcontrol_new *controls, - int num_controls) + int num_controls, void *data) { struct snd_soc_card *card = dai->component->card; struct snd_soc_pcm_runtime *rtd; @@ -2425,13 +2428,14 @@ int snd_soc_add_dai_pcm_controls(struct snd_soc_dai *dai, for (i = 0; i < num_controls; i++) kctl[i].device = rtd->pcm->device; snd_soc_add_controls(card->snd_card, dai->dev, kctl, - num_controls, NULL, dai); + num_controls, NULL, data); kfree(kctl); } else { /* pcm device does not exists. Postpone to dai link creation */ ctls_list = kzalloc(sizeof(*ctls_list), GFP_KERNEL); ctls_list->controls = kctl; ctls_list->num_controls = num_controls; + ctls_list->controls_data = data; list_add(&ctls_list->list, &dai->list_pcm_ctl); } diff --git a/sound/soc/sti/sti_uniperif.c b/sound/soc/sti/sti_uniperif.c index 0c87380..267c44f 100644 --- a/sound/soc/sti/sti_uniperif.c +++ b/sound/soc/sti/sti_uniperif.c @@ -97,7 +97,7 @@ static int sti_uniperiph_dai_probe(struct snd_soc_dai *dai) if (uni->num_ctrls) return snd_soc_add_dai_pcm_controls(dai, uni->snd_ctrls, - uni->num_ctrls); + uni->num_ctrls, dai); return 0; }