Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp222584pxa; Tue, 4 Aug 2020 22:26:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFQHgHtQfcLRSGkesJNZfxF8PbJeqVzO1O+rBIBQu27UOJyY+brq81crUGSUO5bLaNCJSf X-Received: by 2002:a17:907:7292:: with SMTP id dt18mr1616185ejc.512.1596605161664; Tue, 04 Aug 2020 22:26:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596605161; cv=none; d=google.com; s=arc-20160816; b=jTJMJq8LnAfqJcdc4ARK4G2ngln2GPSa7qrVf9SxVJjkrTyWT70vorkMtkw0ZQGFH1 9Dbzao1Dd5A/grRL307yMWwkgJRkgEVNoeYO+jMM3DUvF4+XhtiBiVTRwq7UQaHG1dmK ErXWoMTyEkYqsFsqrqW/k/c6UhsG7P3kDH+Op2A5iw+kJ1IsZ6nSmH4AO5PS8hHKilbx rPK/esAmN62opIAp682qEQAkWHSEj7UzIijuvdjfEBEg+9kWsrzq6amCOHwbq12snS/v hNQ+I3s7It1VJQdp4AtB922p3fklz9Vk9/jzjEG3/5E9pIu8N97tS0sI72SnWVeQ5x+p GNzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from; bh=UQUwKf60j1jzzM7ijV4W0pwwtSq/xeK1A2Ic8vRU7R4=; b=t1QrrJksSsuLgAP+D85ReFfoec2Lw33OVD59Gbw6+dY7OKj/3KOdF5O4AJCyBxe+qX XdmvvJC12xKSDAA1qNcOxHpGePTt3VuKUdTKEEVeiv9fUeS3XfDD4C8vSe3CnoVXtpbH GUbvl/knsM609n2euc64bsBFz7GIIgD6pkX6e9RpWmYcCmth+tndWnufQnTxcrONqNft ox7M1ScNF78IDXWFMLp84RPIYJd8NtI6Ik25yGNfUTYJ6V19J20t2bJxJsYRW/K+S5Mb yDr7ZPGanpXhV819J4tEuyf/hSJIL1P17vAMf93sNDMemI+nQYB1Jk/rzI0CHJo5tJMn zn0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=Hl+cT3ud; 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 gq5si629020ejb.162.2020.08.04.22.25.39; Tue, 04 Aug 2020 22:26: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=Hl+cT3ud; 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 S1726932AbgHEFZA (ORCPT + 99 others); Wed, 5 Aug 2020 01:25:00 -0400 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:2539 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725372AbgHEFY7 (ORCPT ); Wed, 5 Aug 2020 01:24:59 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 04 Aug 2020 22:23:20 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 04 Aug 2020 22:24:59 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 04 Aug 2020 22:24:59 -0700 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 5 Aug 2020 05:24:58 +0000 Received: from hqnvemgw03.nvidia.com (10.124.88.68) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Wed, 5 Aug 2020 05:24:58 +0000 Received: from audio.nvidia.com (Not Verified[10.24.34.185]) by hqnvemgw03.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Tue, 04 Aug 2020 22:24:58 -0700 From: Sameer Pujar To: , , , , , CC: , , , , , , , , , , , , , , Sameer Pujar Subject: [PATCH v2 3/9] ASoC: audio-graph: Identify 'no_pcm' DAI links for DPCM Date: Wed, 5 Aug 2020 10:54:18 +0530 Message-ID: <1596605064-27748-4-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1596605064-27748-1-git-send-email-spujar@nvidia.com> References: <1596605064-27748-1-git-send-email-spujar@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1596605000; bh=UQUwKf60j1jzzM7ijV4W0pwwtSq/xeK1A2Ic8vRU7R4=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=Hl+cT3udOPWRJS6M0GCqi2EAVspJ6QLfZljrlWzxijyp7hnRaxJ/s7LkLHX17JvCf VGfaK9UiODwAnRgH9LYUnd9uZrZatxuE8drZ8kFw2rz0BQKt7h0wAYKbyfymAuMLbk MxBgH+jR8HGd3fiTq0pigHnpX7zhqOpeTuN64tJotC7ALLukjUi4GuqxbVucHwVuld Us5gRP2Kt5v8hW72ms7Zs7gGXWsSLfU3u97OrzzJg4SWk2YtXQcHZ1/GdXBedJqlLD T1M5Ijyd39f45vEzdt0i3dAOvLDBUCa0FPrz3mRJ9sN41zyKABX6F+WQWhXmtRCE/8 5+y35YBmy0Maw== Sender: linux-kernel-owner@vger.kernel.org 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 --- sound/soc/generic/audio-graph-card.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index 1e20562..93bddf6 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(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) @@ -259,6 +270,16 @@ 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. + */ + if (!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