From patchwork Wed May 7 13:05:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 4127691 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D5FE2BFF02 for ; Wed, 7 May 2014 13:08:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 183182018B for ; Wed, 7 May 2014 13:08:13 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id DD19C20256 for ; Wed, 7 May 2014 13:08:11 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 023792654C2; Wed, 7 May 2014 15:08:11 +0200 (CEST) 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, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 693A0265453; Wed, 7 May 2014 15:06:12 +0200 (CEST) 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 51DEE26531F; Wed, 7 May 2014 15:06:08 +0200 (CEST) Received: from smtp-out-016.synserver.de (smtp-out-029.synserver.de [212.40.185.29]) by alsa0.perex.cz (Postfix) with ESMTP id 694CB261B01 for ; Wed, 7 May 2014 15:06:03 +0200 (CEST) Received: (qmail 19604 invoked by uid 0); 7 May 2014 13:05:59 -0000 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 19002 Received: from p4fe61b87.dip0.t-ipconnect.de (HELO lars-adi-laptop.analog.com) [79.230.27.135] by 217.119.54.77 with SMTP; 7 May 2014 13:05:58 -0000 From: Lars-Peter Clausen To: Mark Brown , Liam Girdwood Date: Wed, 7 May 2014 15:05:48 +0200 Message-Id: <1399467948-8770-5-git-send-email-lars@metafoo.de> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1399467948-8770-1-git-send-email-lars@metafoo.de> References: <1399467948-8770-1-git-send-email-lars@metafoo.de> Cc: Songhee Baek , Arun Shamanna Lakshmi , alsa-devel@alsa-project.org, Lars-Peter Clausen Subject: [alsa-devel] [PATCH 5/5] ASoC: dapm: Simplify snd_soc_dapm_link_dai_widgets() 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP If we find a widget who's stream name matches the name of a DAI widget then that's the the widget it should be connected to. Based on the widget id we can say in which direction the path should be. No need to go back to the DAI and check the stream names. Signed-off-by: Lars-Peter Clausen --- sound/soc/soc-dapm.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index de48cab..79b3985 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3337,6 +3337,7 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm, int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card) { struct snd_soc_dapm_widget *dai_w, *w; + struct snd_soc_dapm_widget *src, *sink; struct snd_soc_dai *dai; /* For each DAI widget... */ @@ -3367,25 +3368,15 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card) if (!w->sname || !strstr(w->sname, dai_w->name)) continue; - if (dai->driver->playback.stream_name && - strstr(w->sname, - dai->driver->playback.stream_name)) { - dev_dbg(dai->dev, "%s -> %s\n", - dai->playback_widget->name, w->name); - - snd_soc_dapm_add_path(w->dapm, - dai->playback_widget, w, NULL, NULL); - } - - if (dai->driver->capture.stream_name && - strstr(w->sname, - dai->driver->capture.stream_name)) { - dev_dbg(dai->dev, "%s -> %s\n", - w->name, dai->capture_widget->name); - - snd_soc_dapm_add_path(w->dapm, w, - dai->capture_widget, NULL, NULL); + if (dai_w->id == snd_soc_dapm_dai_in) { + src = dai_w; + sink = w; + } else { + src = w; + sink = dai_w; } + dev_dbg(dai->dev, "%s -> %s\n", src->name, sink->name); + snd_soc_dapm_add_path(w->dapm, src, sink, NULL, NULL); } }