Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1317415pxu; Fri, 16 Oct 2020 09:04:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+yDuvGJvkBVOPE3IfM5ddv0/pXWk1VBJU4Y6yd2zJWXdS0Rm8lK92LMveSnMdXcZSETfT X-Received: by 2002:a17:906:486:: with SMTP id f6mr4333797eja.473.1602864241034; Fri, 16 Oct 2020 09:04:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602864241; cv=none; d=google.com; s=arc-20160816; b=DnbqvD4GnkHys+Aowc8WLb1ZzyBDfqmKCrpDmKAlBsM84XNNr0aMRFRym5EqqsxfYM ILQy9BA2V8b8qD1qqfEoudlrZmmrrRAFj/YSxlYWsY1CYFHs1sI3R/DwGasMho/zHAWd CgPGiy7ZZzODT/ZRApoNYUffkyBSr4Lo2WrZr2iFGP0gZg5s8DmolxKN8S5+WkCnRD5e 5k9lwWhN0tGrLd8aB5KLi5nz1+/eEC3RbPM8FpX8181np9U9y8DpfeuYKLtmdfvSiCrW uitOIFjhMRUlYAXOhIIvO5L3nphWfoBVCYpMTKTrQvP2apu1r2V+huCvJkVdsGdSPHjB 0mzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:dkim-signature:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from; bh=FxtLB3V25/9092fJImUbmEK5DDd1xaC11DWTieE2aCs=; b=qF+v8+0u2kOO9vYuF5IfKa3ewYGzGjcfU0pXMfJHsTZRwb00pdTjN6hPnq/WMfHTTX hM2sXzrWO4CyHBjc+uzT2t3iufG6wc8D6zMVPpTM3YMKX4KWMV4A6GrGC6/fxUx+Zl2n lZDh1qCglxqW6J4RAxGsx7pcsgiGK7TYcLHrJhxwkFADjubmBZMtb+b2eSqtNQ7xTR+I KOwbxBA0+o/I2beUBdfVYGoeNZd/yQosZRV7WHZXLDn4XBPUsSf+kWJ1dH+gGUqu1Kl8 r1ekX55sYZya1sN7y/5MgKzPbW4XVUk5hKSITg5aRIXSXxms3evz2S54cmV94VSyNJGe t5nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=YznZ6UF1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b14si1950835ejp.67.2020.10.16.09.03.37; Fri, 16 Oct 2020 09:04:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=YznZ6UF1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2409168AbgJPOnz (ORCPT + 99 others); Fri, 16 Oct 2020 10:43:55 -0400 Received: from hqnvemgate26.nvidia.com ([216.228.121.65]:5036 "EHLO hqnvemgate26.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2409154AbgJPOny (ORCPT ); Fri, 16 Oct 2020 10:43:54 -0400 Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Fri, 16 Oct 2020 07:43:41 -0700 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 16 Oct 2020 14:43:49 +0000 Received: from audio.nvidia.com (10.124.1.5) by mail.nvidia.com (172.20.187.10) with Microsoft SMTP Server id 15.0.1473.3 via Frontend Transport; Fri, 16 Oct 2020 14:43:43 +0000 From: Sameer Pujar To: , , , , , , , , , CC: , , , , , , , , , , , , , Sameer Pujar Subject: [PATCH v4 04/15] ASoC: audio-graph: Identify 'no_pcm' DAI links for DPCM Date: Fri, 16 Oct 2020 20:12:51 +0530 Message-ID: <1602859382-19505-5-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1602859382-19505-1-git-send-email-spujar@nvidia.com> References: <1602859382-19505-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1602859421; bh=FxtLB3V25/9092fJImUbmEK5DDd1xaC11DWTieE2aCs=; h=From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Type; b=YznZ6UF1huzVxz6nXo5V+S8XlLOCPbOg8RYMA942HKtlYpV92JGleS0ns7TRljA2c yHTSUpxqLij3Rz+HtfrzWvEN8U4SVdMvRNZQICDQhp+DZLVBuxVmaRu2BDEwqmV3Tn SL1rZTZxymYZAX8mVTQ6YB6DDpCHJzp1nzuq9TWScXOEgPCsxx22eNLx7MvBgeMR9h Z6JQ0PGbcQOjx6UDnwZh0A8qI9MbuSYCrreIF81vKSj0Wb03HZ/Sf1PH+Lx5IRtgfM n/8MLs4DRItv4UxUqiU0/iZDZcxAoSKl7iz85e9Az1IJ9tGQg09PGzGbPvMrG7F0TN M01VZAkNjnq7g== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org PCM devices are created for FE dai links with 'no-pcm' flag as '0'. Such DAI links have CPU component which implement either pcm_construct() or pcm_new() at component or dai level respectively. Based on this, current patch exposes a helper function to identify such components and populate 'no_pcm' flag for DPCM DAI link. This helps to have BE<->BE component links where PCM devices need not be created for CPU component involved in such links. Signed-off-by: Sameer Pujar Cc: Kuninori Morimoto --- sound/soc/generic/audio-graph-card.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index 1e20562..9b06841 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -111,6 +111,17 @@ static int graph_get_dai_id(struct device_node *ep) return id; } +static bool soc_component_is_pcm(struct snd_soc_dai_link_component *dlc) +{ + struct snd_soc_dai *dai = snd_soc_find_dai_with_mutex(dlc); + + if (dai && (dai->component->driver->pcm_construct || + dai->driver->pcm_new)) + return true; + + return false; +} + static int asoc_simple_parse_dai(struct device_node *ep, struct snd_soc_dai_link_component *dlc, int *is_single_link) @@ -205,6 +216,7 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv, int dup_codec) { struct device *dev = simple_priv_to_dev(priv); + struct snd_soc_card *card = simple_priv_to_card(priv); struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link); struct device_node *top = dev->of_node; @@ -259,6 +271,19 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv, if (ret < 0) goto out_put_node; + /* + * In BE<->BE connections it is not required to create + * PCM devices at CPU end of the dai link and thus 'no_pcm' + * flag needs to be set. It is useful when there are many + * BE components and some of these have to be connected to + * form a valid audio path. + * + * For example: FE <-> BE1 <-> BE2 <-> ... <-> BEn where + * there are 'n' BE components in the path. + */ + if (card->component_chaining && !soc_component_is_pcm(cpus)) + dai_link->no_pcm = 1; + /* card->num_links includes Codec */ asoc_simple_canonicalize_cpu(dai_link, is_single_links); } else { -- 2.7.4