From patchwork Tue Apr 24 06:05:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 141634 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp1919864lji; Tue, 24 Apr 2018 00:45:57 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+y94XFIO+3pyjaB8YgkgivllrheIrNQQyG6xSMe+Mk/SHx1qfsQI3ioc+fVtRhVjYiqsOi X-Received: by 2002:adf:ad46:: with SMTP id p64-v6mr17858127wrc.44.1524555957435; Tue, 24 Apr 2018 00:45:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524555957; cv=none; d=google.com; s=arc-20160816; b=f9HXPWH13ucd88ucadG4Vu480xSxGObIGd3KaT0AyVTTF97/UGf/ofPpTXLtIlHUyQ F+VNAh6iau6CRhxUNcIW0XG//Hy9ImbDUWsZ53YOEG3lPrawprJoK3PEOEHYZF7tgyLu OYij0Bkxz8JwCD8j86fNfF7/9qjaLUTW+7mowEA6psnnBfFZvghdUlqRx2DWvjj/0t+Z VuaEEXVkTSy84CkGzDx4mwu7bbB0x3lsNa0zuhlwKcIORw+u4dpbCAgmJsJUKU2AngNv /CaO4yo3DPVi1ZQX+7b+YZv/iY0nZTzS1N1MshYxdl2eRAt79Vkye7Lr9Ojni6j7L07C q2xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:delivered-to:arc-authentication-results; bh=KG9yTp1TTk7Xo5Q+n7yVtXtK+VLC+iks1IunZ667gAo=; b=YURA78g0XeEDy+N4vQbHVFIHzlVWPZVtHZGzXhHpvXC1ojXpTYVl9gEyYdROPNAt2Z 7W6jCLMcq3PnHv8eKuVhEnBsJ8WK3p1PZ7A32eBy6xWc/cWcTfAnndnyXTAOLvnUexwq P+Jzf7Sz6gDihbGjmsAdizAbxYTjdO0Ji5k/nvyjqwURlFfb23wUJzAebbhiu6qXewTW 8nI4N+N0jWBRs3W7cv9A5PlcmFtdLaa6CS6iTOfN92GIkRBvlpM/bxU/t5GNuyASG3K5 LCralZUT/GiJ7MkUAf9WtMlGIm55ePWWzp0BMuFpigg6SwNKlJ51A8kaUt+9VCVRLl09 rCXA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id w77si6672725wme.169.2018.04.24.00.45.57; Tue, 24 Apr 2018 00:45:57 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id BF3EF26768E; Tue, 24 Apr 2018 09:45:28 +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 9068D26766E; Tue, 24 Apr 2018 08:01:30 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.4.0 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by alsa0.perex.cz (Postfix) with ESMTP id B71292675D0 for ; Tue, 24 Apr 2018 08:01:28 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Apr 2018 23:01:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,321,1520924400"; d="scan'208";a="222820735" Received: from vkoul-udesk7.iind.intel.com ([10.223.84.143]) by fmsmga005.fm.intel.com with ESMTP; 23 Apr 2018 23:01:26 -0700 From: Vinod Koul To: alsa-devel@alsa-project.org Date: Tue, 24 Apr 2018 11:35:54 +0530 Message-Id: <1524549954-29144-4-git-send-email-vkoul@kernel.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1524549954-29144-1-git-send-email-vkoul@kernel.org> References: <1524549954-29144-1-git-send-email-vkoul@kernel.org> X-Mailman-Approved-At: Tue, 24 Apr 2018 09:45:19 +0200 Cc: liam.r.girdwood@linux.intel.com, patches.audio@intel.com, Vinod Koul , broonie@kernel.org, Shreyas NC Subject: [alsa-devel] [PATCH v4 3/3] ASoC: Add multiple CPU DAI support in DAPM 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 From: Shreyas NC DAPM handles DAIs during soc_dapm_stream_event() and during addition and creation of DAI widgets i.e., dapm_add_valid_dai_widget() and dapm_connect_dai_link_widgets(). Extend these functions to handle multiple cpu dai. Signed-off-by: Shreyas NC Signed-off-by: Vinod Koul --- sound/soc/soc-dapm.c | 71 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 25 deletions(-) -- 2.7.4 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 2d9709104ec5..79f5f611f548 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -4108,38 +4108,57 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card) return 0; } -static void dapm_connect_dai_link_widgets(struct snd_soc_card *card, - struct snd_soc_pcm_runtime *rtd) +static void dapm_add_valid_dai_widget(struct snd_soc_card *card, + struct snd_soc_pcm_runtime *rtd, + struct snd_soc_dai *codec_dai, + struct snd_soc_dai *cpu_dai) { - struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dapm_widget *sink, *source; - int i; - for (i = 0; i < rtd->num_codecs; i++) { - struct snd_soc_dai *codec_dai = rtd->codec_dais[i]; + /* connect BE DAI playback if widgets are valid */ + if (codec_dai->playback_widget && cpu_dai->playback_widget) { + source = cpu_dai->playback_widget; + sink = codec_dai->playback_widget; + dev_err(rtd->dev, "connected DAI link %s:%s -> %s:%s\n", + cpu_dai->component->name, + source->name, + codec_dai->component->name, + sink->name); + + snd_soc_dapm_add_path(&card->dapm, source, sink, + NULL, NULL); + } - /* connect BE DAI playback if widgets are valid */ - if (codec_dai->playback_widget && cpu_dai->playback_widget) { - source = cpu_dai->playback_widget; - sink = codec_dai->playback_widget; - dev_dbg(rtd->dev, "connected DAI link %s:%s -> %s:%s\n", - cpu_dai->component->name, source->name, - codec_dai->component->name, sink->name); + /* connect BE DAI capture if widgets are valid */ + if (codec_dai->capture_widget && cpu_dai->capture_widget) { + source = codec_dai->capture_widget; + sink = cpu_dai->capture_widget; + dev_err(rtd->dev, "connected DAI link %s:%s -> %s:%s\n", + codec_dai->component->name, + source->name, + cpu_dai->component->name, + sink->name); - snd_soc_dapm_add_path(&card->dapm, source, sink, + snd_soc_dapm_add_path(&card->dapm, source, sink, NULL, NULL); - } + } + +} - /* connect BE DAI capture if widgets are valid */ - if (codec_dai->capture_widget && cpu_dai->capture_widget) { - source = codec_dai->capture_widget; - sink = cpu_dai->capture_widget; - dev_dbg(rtd->dev, "connected DAI link %s:%s -> %s:%s\n", - codec_dai->component->name, source->name, - cpu_dai->component->name, sink->name); +static void dapm_connect_dai_link_widgets(struct snd_soc_card *card, + struct snd_soc_pcm_runtime *rtd) +{ + struct snd_soc_dai *cpu_dai; + int i, j; - snd_soc_dapm_add_path(&card->dapm, source, sink, - NULL, NULL); + for (i = 0; i < rtd->num_codecs; i++) { + struct snd_soc_dai *codec_dai = rtd->codec_dais[i]; + + for (j = 0; j < rtd->num_cpu_dai; j++) { + cpu_dai = rtd->cpu_dais[j]; + + dapm_add_valid_dai_widget(card, rtd, + codec_dai, cpu_dai); } } } @@ -4206,7 +4225,9 @@ static void soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, { int i; - soc_dapm_dai_stream_event(rtd->cpu_dai, stream, event); + for (i = 0; i < rtd->num_cpu_dai; i++) + soc_dapm_dai_stream_event(rtd->cpu_dais[i], stream, event); + for (i = 0; i < rtd->num_codecs; i++) soc_dapm_dai_stream_event(rtd->codec_dais[i], stream, event);