Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1116749ybt; Fri, 26 Jun 2020 21:59:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAMBT3wyIAmsZAt6KKgi344RhuenP0jSvJS2Y4b9hzTmFW1ZenRwG3B9dFZU+A0rQ3ITkT X-Received: by 2002:a17:906:950c:: with SMTP id u12mr5320767ejx.37.1593233951033; Fri, 26 Jun 2020 21:59:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593233951; cv=none; d=google.com; s=arc-20160816; b=n1BbAMymUvLTKiAswtoj01SCpZ6bGPajbJQoeY5jJvV2aERXl1yBzWFVQhP/rGG0ZW ty+nuMKtgsG0P3WetJEPNwXXTJNb6q+LtGKgbfLLk8TiEmzBte9YrSv8UaoVoBGXf5/1 ssKHVOgLgTNZP8fUa+gMGTtH3k7nj5oAugAK4nJpXGKRVGLF+VgwcQNx1NGu+ia/H6iY 5cwqa3k2Qh5N2Gi2fOu7pPurdJ1Wn9Y/GLOB9MCvyrZdZs62QaP60U0ED+q+857EGUVC mSSVfSg8HM+Sq3kdusLBXhVZmRqJ3LYD8JjE6M8E7zf45lOxiI5/lMNLcd3tkKF3A+xc umbQ== 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=Te4jUznXki9FHbpY9jdroP0lQAJV5bmFZUw3joZLRMA=; b=wDlwDRdS6+YGjDcoD/nyQhOvVerdL7881JTXl9R1S7m4H67P+TFfQ8eTE8DDG0/INe ERo6VrNdBldqi+2mkC3HEXpefuVdRxckCV3ed7E8FSSDGinJqTtYQURx/jU7oHwxYS1+ s7hDkEEXnJODhwmtMWMVnOF4uEpDy3IaKlm431C/ej0gQztoDFQzO0Wjki/jOoxNIl/d utl6X+xb/73C9Nzy8Bc4AV1GZuNRa4jc7XBym2jTIcoL7XUiXCSo0XAI4LQxA1lQAwm+ CxeyEbSnuTrtQhOWq5umzN8NArD2pnXsstKL0WlwOk9Bj7pomR7od5cApzx6Q+eGjpAW BCpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=kCYw7XDv; 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 t24si5724615eds.158.2020.06.26.21.58.48; Fri, 26 Jun 2020 21:59:11 -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=kCYw7XDv; 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 S1726432AbgF0Ezi (ORCPT + 99 others); Sat, 27 Jun 2020 00:55:38 -0400 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:14237 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725885AbgF0Ezi (ORCPT ); Sat, 27 Jun 2020 00:55:38 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 26 Jun 2020 21:54:50 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 26 Jun 2020 21:55:37 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 26 Jun 2020 21:55:37 -0700 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Sat, 27 Jun 2020 04:55:37 +0000 Received: from hqnvemgw03.nvidia.com (10.124.88.68) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Sat, 27 Jun 2020 04:55:37 +0000 Received: from audio.nvidia.com (Not Verified[10.24.34.185]) by hqnvemgw03.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Fri, 26 Jun 2020 21:55:37 -0700 From: Sameer Pujar To: , , , , , CC: , , , , , , , , , , , , , , , Sameer Pujar Subject: [PATCH v4 15/23] ASoC: soc-core: Identify 'no_pcm' DAI links for DPCM Date: Sat, 27 Jun 2020 10:23:37 +0530 Message-ID: <1593233625-14961-16-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1593233625-14961-1-git-send-email-spujar@nvidia.com> References: <1593233625-14961-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=1593233690; bh=Te4jUznXki9FHbpY9jdroP0lQAJV5bmFZUw3joZLRMA=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Type; b=kCYw7XDvF9dzytYUHEXZKGa52HviuHaMxranP6e94A7JmVFBugO2SPj2QK6xUzD2A O3zOhTqS5jCuWLKFb/eXWBi38tSigO9GJr4893PP/e5zFKnfossemXHHJ3S1HhbXyV R6JQY0QuMiB8dEKBQ82nYDXDgTVjv3PxiSBOrAru1yeKpf4+SVOeqcEoSYcXBPWT5z GjTCEd7Kl24JxZzq+/0s4wdlImKqWXxesIK33GcxRAAss/mTQAaZy4P3osEMkGKBc/ te+bw6/FqoKnoHDEnh5C1aSiGAeyQkkIGRlAIwzexg4P94i0q3qjDv8LezjMaDxNjX I9aNromwY3aZQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org PCM devices are created for dai links with 'no-pcm' flag as '0'. Such DAI links have CPU component which implement pcm_construct() and pcm_destruct() callbacks. 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 components involved in the links. Signed-off-by: Sameer Pujar --- include/sound/soc.h | 2 ++ sound/soc/generic/simple-card.c | 3 +++ sound/soc/soc-core.c | 25 +++++++++++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/include/sound/soc.h b/include/sound/soc.h index 33acead..1e0376f 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -397,6 +397,7 @@ struct snd_soc_dai_driver; struct snd_soc_dai_link; struct snd_soc_component; struct snd_soc_component_driver; +struct snd_soc_dai_link_component; struct soc_enum; struct snd_soc_jack; struct snd_soc_jack_zone; @@ -437,6 +438,7 @@ int snd_soc_add_component(struct device *dev, const struct snd_soc_component_driver *component_driver, struct snd_soc_dai_driver *dai_drv, int num_dai); +bool soc_component_is_pcm(struct snd_soc_dai_link_component *dlc); int snd_soc_register_component(struct device *dev, const struct snd_soc_component_driver *component_driver, struct snd_soc_dai_driver *dai_drv, int num_dai); diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 62f2978..f19030b 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -188,6 +188,9 @@ static int simple_dai_link_of_dpcm(struct asoc_simple_priv *priv, if (ret) goto out_put_node; + if (!soc_component_is_pcm(cpus)) + dai_link->no_pcm = 1; + ret = asoc_simple_parse_clk_cpu(dev, np, dai_link, dai); if (ret < 0) goto out_put_node; diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 9041a03..d2a47c3 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -259,6 +259,31 @@ static inline void snd_soc_debugfs_exit(void) #endif +bool soc_component_is_pcm(struct snd_soc_dai_link_component *dlc) +{ + struct snd_soc_component *component; + struct snd_soc_dai *dai; + + for_each_component(component) { + if (!component->driver) + continue; + + for_each_component_dais(component, dai) { + if (!dai->name || !dlc->dai_name) + continue; + + if (strcmp(dai->name, dlc->dai_name)) + continue; + + if (component->driver->pcm_construct) + return true; + } + } + + return false; +} +EXPORT_SYMBOL_GPL(soc_component_is_pcm); + static int snd_soc_rtd_add_component(struct snd_soc_pcm_runtime *rtd, struct snd_soc_component *component) { -- 2.7.4