From patchwork Tue Mar 15 15:34:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Piotr Stankiewicz X-Patchwork-Id: 8608711 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 563439F3D1 for ; Thu, 17 Mar 2016 09:34:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 545C6202FE for ; Thu, 17 Mar 2016 09:34:12 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id D797F202AE for ; Thu, 17 Mar 2016 09:34:00 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 1C005266633; Thu, 17 Mar 2016 10:33:59 +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 D9CD92606F7; Thu, 17 Mar 2016 10:33:48 +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 CF1262654D5; Tue, 15 Mar 2016 16:37:37 +0100 (CET) Received: from mx0a-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by alsa0.perex.cz (Postfix) with ESMTP id 1E199265344 for ; Tue, 15 Mar 2016 16:37:29 +0100 (CET) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u2FFSotw010752; Tue, 15 Mar 2016 10:37:28 -0500 Authentication-Results: ppops.net; spf=none smtp.mail=piotrs@opensource.wolfsonmicro.com Received: from mail1.cirrus.com (mail1.cirrus.com [141.131.3.20]) by mx0a-001ae601.pphosted.com with ESMTP id 21mhd3pc05-1; Tue, 15 Mar 2016 10:37:28 -0500 Received: from EX12.ad.cirrus.com (unknown [172.19.9.182]) by mail1.cirrus.com (Postfix) with ESMTP id 3418A342B2; Tue, 15 Mar 2016 10:37:47 -0500 (CDT) Received: from imbe.wolfsonmicro.main (172.20.9.178) by EX12.ad.cirrus.com (172.19.9.182) with Microsoft SMTP Server id 14.3.248.2; Tue, 15 Mar 2016 15:37:26 +0000 Received: from A10627.wolfsonmicro.main ([172.22.20.81]) by imbe.wolfsonmicro.main (8.14.4/8.14.4) with ESMTP id u2FFbKLD014974; Tue, 15 Mar 2016 15:37:20 GMT From: Piotr Stankiewicz To: , Date: Tue, 15 Mar 2016 15:34:49 +0000 Message-ID: <1458056089-885-1-git-send-email-piotrs@opensource.wolfsonmicro.com> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1601100000 definitions=main-1603150215 X-Mailman-Approved-At: Thu, 17 Mar 2016 10:33:46 +0100 Cc: Piotr Stankiewicz , alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com Subject: [alsa-devel] [PATCH] ASoC: dpcm: prevent error for paths including static links 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 According to the DPCM documentation using static codec <-> codec links along dynamic ones is a valid use case, however this causes errors of the following form to be printed to the kernel log: ASoC: can't get [playback|caputure] BE for ASoC: no BE found for This happens when setting up, e.g. a route starting with a dynamic DAI, which passes through a static DAI (say, "Some FE" -> "Some BE" -> "Codec to Modem link"). All DAPM widgets involved in that path will be passed to dpcm_add_paths in order to establish FE <-> BE connections, which will result in dpcm_get_be trying to locate back-ends for dynamic, as well as static links, causing a spurious error to be logged for the latter. This patch changes dpcm_get_be to look up a non front-end runtime for a stream widget, and renames it accordingly. Like this both dynamic and static links can be handled properly in dpcm_add_paths, i.e. an actual missing BE can be distinguished from a normal link. Signed-off-by: Piotr Stankiewicz --- sound/soc/soc-pcm.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 1af4f23..ff5ea7e 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -1220,47 +1220,47 @@ void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) } } -/* get BE for DAI widget and stream */ -static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card, +/* get runtime for DAI widget and stream */ +static struct snd_soc_pcm_runtime *dpcm_get_rtd(struct snd_soc_card *card, struct snd_soc_dapm_widget *widget, int stream) { - struct snd_soc_pcm_runtime *be; + struct snd_soc_pcm_runtime *rtd; int i; if (stream == SNDRV_PCM_STREAM_PLAYBACK) { - list_for_each_entry(be, &card->rtd_list, list) { + list_for_each_entry(rtd, &card->rtd_list, list) { - if (!be->dai_link->no_pcm) + if (rtd->dai_link->dynamic) continue; - if (be->cpu_dai->playback_widget == widget) - return be; + if (rtd->cpu_dai->playback_widget == widget) + return rtd; - for (i = 0; i < be->num_codecs; i++) { - struct snd_soc_dai *dai = be->codec_dais[i]; + for (i = 0; i < rtd->num_codecs; i++) { + struct snd_soc_dai *dai = rtd->codec_dais[i]; if (dai->playback_widget == widget) - return be; + return rtd; } } } else { - list_for_each_entry(be, &card->rtd_list, list) { + list_for_each_entry(rtd, &card->rtd_list, list) { - if (!be->dai_link->no_pcm) + if (rtd->dai_link->dynamic) continue; - if (be->cpu_dai->capture_widget == widget) - return be; + if (rtd->cpu_dai->capture_widget == widget) + return rtd; - for (i = 0; i < be->num_codecs; i++) { - struct snd_soc_dai *dai = be->codec_dais[i]; + for (i = 0; i < rtd->num_codecs; i++) { + struct snd_soc_dai *dai = rtd->codec_dais[i]; if (dai->capture_widget == widget) - return be; + return rtd; } } } - dev_err(card->dev, "ASoC: can't get %s BE for %s\n", + dev_err(card->dev, "ASoC: can't get %s runtime for %s\n", stream ? "capture" : "playback", widget->name); return NULL; } @@ -1367,15 +1367,15 @@ static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream, continue; } - /* is there a valid BE rtd for this widget */ - be = dpcm_get_be(card, list->widgets[i], stream); + /* is there a valid rtd for this widget */ + be = dpcm_get_rtd(card, list->widgets[i], stream); if (!be) { - dev_err(fe->dev, "ASoC: no BE found for %s\n", + dev_err(fe->dev, "ASoC: no runtime found for %s\n", list->widgets[i]->name); continue; } - /* make sure BE is a real BE */ + /* check if the runtime is a BE */ if (!be->dai_link->no_pcm) continue;