Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp788653ybh; Sat, 18 Jul 2020 22:12:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyR9nfjkOAr2IMHoYWOyomP5CgwfQ601e08DEaBvvshzzfe47eqm+b7ZeHj00Wx8Kj3sMYd X-Received: by 2002:a50:ef10:: with SMTP id m16mr15755654eds.206.1595135564989; Sat, 18 Jul 2020 22:12:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595135564; cv=none; d=google.com; s=arc-20160816; b=Johtyclr9mZcASn6fGyifC56vjNTY1s/Jx2sOqCdvfWoWnPnhyDMjnSAc0yKRgLT5T sPxcdO8UTC61BvhRH8CyGhie37aF3oW1XPgn22t05eIL2g1Ug/lW2xBgXyh+73R0bQZe TxyUKrp2C+Q6Y/2yEp7gpeXvbt1B9Uu3dM60OtCzxOSAOi+gh3gDbyqPLmohb4OV1SHW xqZBFsvCpuG6VpmXEueHNuu3w2+Av5hZD3DoqfquYrAQL5lj6QE82NIh1rBC1S54EIqk EX3uI2/MpJRuTIYmy7ivoVNFUIP7gLncmQocB1cecnD5ROjzE6zVWMmUG/QGDmA81GAH btDQ== 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=AiqEdZ6kbQEZN+yKxns+eeEbpHyNEjylXXmbVfA2vRc=; b=bkLaLlKAMQpcUKSMJP+DLdhBsot5UDvanQW9x8SPUwFuCV1FHlf8vrc4GT4EZy0nAL VOQywhrC0EGNHwOKv56vrv7OpZaR0a8xhQvlBvZpIPlbFaRavhPGWqORu2aMUHmAIfKo mks0ovz3KRwNrmS5/xBfoQtk64FJms+iKoIGEhuJ7wuxkR/CCzxI1Y6WKVERrD6BQwKz 4f1Su+FTfvxiDILe59sM73kOPTXzLFZYqVpnqkPBFfRk7+tlxPMppDdu2/UKdyIr/jqa g+LTLLW0yGZn/kkH+zKdpYleT2YEkoF4L3HoBlmcaUlZCwhUZPe2s+ta0eRIN60Ipfi7 nyiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=lpY4PtPC; 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 bs10si8403430edb.548.2020.07.18.22.12.22; Sat, 18 Jul 2020 22:12:44 -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=lpY4PtPC; 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 S1726601AbgGSFLU (ORCPT + 99 others); Sun, 19 Jul 2020 01:11:20 -0400 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:4662 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725272AbgGSFLU (ORCPT ); Sun, 19 Jul 2020 01:11:20 -0400 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Sat, 18 Jul 2020 22:10:19 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Sat, 18 Jul 2020 22:11:19 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Sat, 18 Jul 2020 22:11:19 -0700 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Sun, 19 Jul 2020 05:11:19 +0000 Received: from hqnvemgw03.nvidia.com (10.124.88.68) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Sun, 19 Jul 2020 05:11:19 +0000 Received: from audio.nvidia.com (Not Verified[10.24.34.185]) by hqnvemgw03.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Sat, 18 Jul 2020 22:11:19 -0700 From: Sameer Pujar To: , , , , , CC: , , , , , , , , , , , , , , Sameer Pujar Subject: [PATCH 08/10] ASoC: audio-graph: Add support for component chaining Date: Sun, 19 Jul 2020 10:40:15 +0530 Message-ID: <1595135417-16589-9-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1595135417-16589-1-git-send-email-spujar@nvidia.com> References: <1595135417-16589-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=1595135419; bh=AiqEdZ6kbQEZN+yKxns+eeEbpHyNEjylXXmbVfA2vRc=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=lpY4PtPC1RCmN21Y3KqN8JKVhYJV4xeUAbttKd8y05KYyRojl4UH86cw5GrZBlTez XCxZdKgDIvx8MVoBL/q28pjVuzOW5GNT5dC962U4K59YMjD/jBm8Gjd53eSaWWnioa av4IQh29lOPc9tAk4UbBMlGVA6mFwh6994MXW17dQAW6uKMX92UoHsEZ8w4Mcg7+MW P11WoMkVQ6eqyfpF11/V1KpmAmrtUbsw/Q4zEsWTh0rGym2l3Vqgax9JEwVEa7vs9p mFw5FtE+BdfWZIzVThRrneuskaRvTRB03ljG1jYgUMFibq2fumiZnN4WIXYvf0rgZi KOje/Hd3e7JzA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The audio-graph driver supports both normal and DPCM DAI links. The sound cards requiring DPCM DAI link support, use DPCM_SELECTABLE flag and DAI links are treated as DPCM links depending on the number of child nodes in a given DAI link. There is another requirement where multiple ASoC components need to be connected together in a chained fashion in a component model. This patch sets 'component_chaining' flag for such sound cards where FE<->BE and multiple BE<->BE component connections are required. Hence support for such sound cards is added under 'audio-graph-cc-card' compatible. All DAI links under this are treated as DPCM links. Signed-off-by: Sameer Pujar --- sound/soc/generic/audio-graph-card.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index 82d8c740..ccfcf5f 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -20,10 +20,13 @@ #include #include -#define DPCM_SELECTABLE 1 - #define PREFIX "audio-graph-card," +struct asoc_simple_soc_data { + unsigned int dpcm_selectable:1; + unsigned int component_chaining:1; +}; + static int graph_outdrv_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) @@ -449,7 +452,7 @@ static int graph_for_each_link(struct asoc_simple_priv *priv, struct device_node *codec_ep; struct device_node *codec_port; struct asoc_simple_data adata; - uintptr_t dpcm_selectable = (uintptr_t)of_device_get_match_data(dev); + const struct asoc_simple_soc_data *data = of_device_get_match_data(dev); int rc, ret; /* loop for all listed CPU port */ @@ -476,10 +479,12 @@ static int graph_for_each_link(struct asoc_simple_priv *priv, * It is DPCM * if Codec port has many endpoints, * or has convert-xxx property + * or component chaining is used */ - if (dpcm_selectable && + if (data && data->dpcm_selectable && ((of_get_child_count(codec_port) > 1) || - adata.convert_rate || adata.convert_channels)) + adata.convert_rate || adata.convert_channels || + data->component_chaining)) ret = func_dpcm(priv, cpu_ep, codec_ep, li); /* else normal sound */ else @@ -650,6 +655,7 @@ static int graph_probe(struct platform_device *pdev) { struct asoc_simple_priv *priv; struct device *dev = &pdev->dev; + const struct asoc_simple_soc_data *data = of_device_get_match_data(dev); struct snd_soc_card *card; struct link_info li; int ret; @@ -666,6 +672,9 @@ static int graph_probe(struct platform_device *pdev) card->num_dapm_widgets = ARRAY_SIZE(graph_dapm_widgets); card->probe = graph_card_probe; + if (data) + card->component_chaining = data->component_chaining; + memset(&li, 0, sizeof(li)); graph_get_dais_count(priv, &li); if (!li.link || !li.dais) @@ -711,10 +720,19 @@ static int graph_remove(struct platform_device *pdev) return asoc_simple_clean_reference(card); } +static const struct asoc_simple_soc_data scu_card_data = { + .dpcm_selectable = 1, +}; + +static const struct asoc_simple_soc_data cc_card_data = { + .dpcm_selectable = 1, + .component_chaining = 1, +}; + static const struct of_device_id graph_of_match[] = { { .compatible = "audio-graph-card", }, - { .compatible = "audio-graph-scu-card", - .data = (void *)DPCM_SELECTABLE }, + { .compatible = "audio-graph-scu-card", .data = &scu_card_data, }, + { .compatible = "audio-graph-cc-card", .data = &cc_card_data, }, {}, }; MODULE_DEVICE_TABLE(of, graph_of_match); -- 2.7.4