mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sameer Pujar <spujar@nvidia.com>
To: <broonie@kernel.org>, <perex@perex.cz>, <tiwai@suse.com>,
	<kuninori.morimoto.gx@renesas.com>, <robh+dt@kernel.org>,
	<lgirdwood@gmail.com>
Cc: <thierry.reding@gmail.com>, <jonathanh@nvidia.com>,
	<digetx@gmail.com>, <alsa-devel@alsa-project.org>,
	<linux-tegra@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<sharadg@nvidia.com>, <mkumard@nvidia.com>,
	<viswanathl@nvidia.com>, <rlokhande@nvidia.com>,
	<dramesh@nvidia.com>, <atalambedu@nvidia.com>,
	<nwartikar@nvidia.com>, <swarren@nvidia.com>,
	<nicoleotsuka@gmail.com>, Sameer Pujar <spujar@nvidia.com>
Subject: [PATCH v4 18/23] ASoC: simple-card: Add support for component chaining
Date: Sat, 27 Jun 2020 10:23:40 +0530	[thread overview]
Message-ID: <1593233625-14961-19-git-send-email-spujar@nvidia.com> (raw)
In-Reply-To: <1593233625-14961-1-git-send-email-spujar@nvidia.com>

The simple-card 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 is required. Hence support
for such sound cards is added under 'simple-cc-audio-card' compatible.
All DAI links under this are treated as DPCM links and links can have
empty Codec list since components are chainied via router controls.

Signed-off-by: Sameer Pujar <spujar@nvidia.com>
---
 include/sound/simple_card.h     |  5 +++++
 sound/soc/generic/simple-card.c | 35 ++++++++++++++++++++++++++++-------
 2 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h
index d264e54..79019d0 100644
--- a/include/sound/simple_card.h
+++ b/include/sound/simple_card.h
@@ -23,4 +23,9 @@ struct asoc_simple_card_info {
 	struct asoc_simple_dai codec_dai;
 };
 
+struct asoc_simple_soc_data {
+	bool dpcm_selectable;
+	bool component_chaining;
+};
+
 #endif /* __SIMPLE_CARD_H */
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index f19030b..758c612 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -16,8 +16,6 @@
 #include <sound/soc-dai.h>
 #include <sound/soc.h>
 
-#define DPCM_SELECTABLE 1
-
 #define DAI	"sound-dai"
 #define CELL	"#sound-dai-cells"
 #define PREFIX	"simple-audio-card,"
@@ -386,10 +384,11 @@ static int simple_for_each_link(struct asoc_simple_priv *priv,
 					 struct device_node *np,
 					 struct link_info *li, bool is_top))
 {
+	struct snd_soc_card *card = simple_priv_to_card(priv);
 	struct device *dev = simple_priv_to_dev(priv);
 	struct device_node *top = dev->of_node;
 	struct device_node *node;
-	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);
 	bool is_top = 0;
 	int ret = 0;
 
@@ -411,10 +410,13 @@ static int simple_for_each_link(struct asoc_simple_priv *priv,
 		/* get codec */
 		codec = of_get_child_by_name(node, is_top ?
 					     PREFIX "codec" : "codec");
-		if (!codec) {
+
+		/* Codec list can be empty for component<->component chain */
+		if (!codec && !card->component_chaining) {
 			ret = -ENODEV;
 			goto error;
 		}
+
 		/* get platform */
 		plat = of_get_child_by_name(node, is_top ?
 					    PREFIX "plat" : "plat");
@@ -432,9 +434,10 @@ static int simple_for_each_link(struct asoc_simple_priv *priv,
 			 * It is DPCM
 			 * if it has many CPUs,
 			 * or has convert-xxx property
+			 * or if component_chaining is used
 			 */
-			if (dpcm_selectable &&
-			    (num > 2 ||
+			if (data && data->dpcm_selectable &&
+			    (num > 2 || data->component_chaining ||
 			     adata.convert_rate || adata.convert_channels))
 				ret = func_dpcm(priv, np, li, is_top);
 			/* else normal sound */
@@ -654,6 +657,7 @@ static int asoc_simple_probe(struct platform_device *pdev)
 	struct asoc_simple_priv *priv;
 	struct device *dev = &pdev->dev;
 	struct device_node *np = dev->of_node;
+	const struct asoc_simple_soc_data *data;
 	struct snd_soc_card *card;
 	struct link_info li;
 	int ret;
@@ -668,6 +672,11 @@ static int asoc_simple_probe(struct platform_device *pdev)
 	card->dev		= dev;
 	card->probe		= simple_soc_probe;
 
+	data = of_device_get_match_data(dev);
+
+	if (data)
+		card->component_chaining = data->component_chaining;
+
 	memset(&li, 0, sizeof(li));
 	simple_get_dais_count(priv, &li);
 	if (!li.link || !li.dais)
@@ -757,10 +766,22 @@ static int asoc_simple_remove(struct platform_device *pdev)
 	return asoc_simple_clean_reference(card);
 }
 
+static const struct asoc_simple_soc_data scu_card_data = {
+	.dpcm_selectable = true,
+};
+
+/* Component chaining with DPCM */
+static const struct asoc_simple_soc_data cc_card_data = {
+	.dpcm_selectable = true,
+	.component_chaining = true,
+};
+
 static const struct of_device_id simple_of_match[] = {
 	{ .compatible = "simple-audio-card", },
 	{ .compatible = "simple-scu-audio-card",
-	  .data = (void *)DPCM_SELECTABLE },
+	  .data = &scu_card_data },
+	{ .compatible = "simple-cc-audio-card",
+	  .data = &cc_card_data },
 	{},
 };
 MODULE_DEVICE_TABLE(of, simple_of_match);
-- 
2.7.4


  parent reply	other threads:[~2020-06-27  4:55 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-27  4:53 [PATCH v4 00/23] Add support for Tegra210 Audio Sameer Pujar
2020-06-27  4:53 ` [PATCH v4 01/23] ASoC: dt-bindings: tegra: Add DT bindings for Tegra210 Sameer Pujar
2020-06-27  4:53 ` [PATCH v4 02/23] ASoC: tegra: Add support for CIF programming Sameer Pujar
2020-06-27  4:53 ` [PATCH v4 03/23] ASoC: tegra: Add Tegra210 based DMIC driver Sameer Pujar
2020-06-27  4:53 ` [PATCH v4 04/23] ASoC: tegra: Add Tegra210 based I2S driver Sameer Pujar
2020-06-27  4:53 ` [PATCH v4 05/23] ASoC: tegra: Add Tegra210 based AHUB driver Sameer Pujar
2020-06-27  4:53 ` [PATCH v4 06/23] ASoC: tegra: Add Tegra186 based DSPK driver Sameer Pujar
2020-06-27  4:53 ` [PATCH v4 07/23] ASoC: tegra: Add Tegra210 based ADMAIF driver Sameer Pujar
2020-06-27  4:53 ` [PATCH v4 08/23] ASoC: soc-core: Fix component name_prefix parsing Sameer Pujar
2020-06-29  0:38   ` Kuninori Morimoto
2020-06-29 15:46     ` Sameer Pujar
2020-06-30 10:45   ` Mark Brown
2020-06-30 12:56     ` Sameer Pujar
2020-06-27  4:53 ` [PATCH v4 09/23] ASoC: simple-card: Use of_node and DAI names for DAI link names Sameer Pujar
2020-06-27  4:53 ` [PATCH v4 10/23] ASoC: simple-card: Wrong daifmt for CPU end of DPCM DAI link Sameer Pujar
2020-06-29  0:56   ` Kuninori Morimoto
     [not found]     ` <6e27daa5-331e-968b-4027-2e30aeb7d382@nvidia.com>
2020-06-30  0:56       ` Kuninori Morimoto
2020-06-30  3:47         ` Sameer Pujar
2020-06-30  5:07           ` Kuninori Morimoto
2020-06-27  4:53 ` [PATCH v4 11/23] ASoC: simple-card: Loop over all children for 'mclk-fs' Sameer Pujar
2020-06-29  1:05   ` Kuninori Morimoto
2020-06-29 16:32     ` Sameer Pujar
2020-06-30  2:08       ` Kuninori Morimoto
2020-06-30  4:23         ` Sameer Pujar
2020-06-30 10:55           ` Mark Brown
2020-06-30 11:56             ` Sameer Pujar
2020-06-27  4:53 ` [PATCH v4 12/23] ASoC: simple-card: Support DPCM DAI link with multiple Codecs Sameer Pujar
2020-06-29  1:24   ` Kuninori Morimoto
2020-06-29 17:16     ` Sameer Pujar
2020-06-30  1:24       ` Kuninori Morimoto
2020-06-30  4:08         ` Sameer Pujar
2020-06-30  6:55           ` Kuninori Morimoto
2020-06-30  7:52             ` Sameer Pujar
2020-06-30 11:01               ` Mark Brown
2020-06-30 12:53                 ` Sameer Pujar
2020-06-30 15:32                   ` Mark Brown
2020-07-02 10:36                     ` Sameer Pujar
2020-07-02 12:26                       ` Mark Brown
2020-07-17 12:55                         ` Sameer Pujar
2020-06-27  4:53 ` [PATCH v4 13/23] ASoC: simple-card: DPCM DAI link direction as per DAI capability Sameer Pujar
2020-06-27  4:53 ` [PATCH v4 14/23] ASoC: soc-core: Probe auxiliary component before others Sameer Pujar
2020-06-27  4:53 ` [PATCH v4 15/23] ASoC: soc-core: Identify 'no_pcm' DAI links for DPCM Sameer Pujar
2020-06-29  1:38   ` Kuninori Morimoto
2020-06-29 17:19     ` Sameer Pujar
2020-06-30  6:07   ` Kuninori Morimoto
2020-06-30  8:03     ` Sameer Pujar
2020-07-02  0:52       ` Kuninori Morimoto
2020-07-02  3:48         ` Sameer Pujar
2020-07-02  8:50           ` Kuninori Morimoto
2020-07-02  9:56             ` Sameer Pujar
2020-06-27  4:53 ` [PATCH v4 16/23] ASoC: soc-pcm: Get all BEs along DAPM path Sameer Pujar
2020-06-29  1:41   ` Kuninori Morimoto
2020-06-29 17:29     ` Sameer Pujar
2020-06-27  4:53 ` [PATCH v4 17/23] ASoC: dt-bindings: simple-card: Add compatible for component chaining Sameer Pujar
2020-06-27  4:53 ` Sameer Pujar [this message]
2020-06-27  4:53 ` [PATCH v4 19/23] arm64: defconfig: Build AHUB component drivers Sameer Pujar
2020-06-27  4:53 ` [PATCH v4 20/23] arm64: defconfig: Enable CONFIG_TEGRA210_ADMA Sameer Pujar
2020-06-27  4:53 ` [PATCH v4 21/23] arm64: tegra: Add DT binding for AHUB components Sameer Pujar
2020-06-27  4:53 ` [PATCH v4 22/23] arm64: tegra: Enable AHUB components on few Tegra platforms Sameer Pujar
2020-06-27  4:53 ` [PATCH v4 23/23] arm64: tegra: Add support for APE sound card on Jetson Nano and TX1 Sameer Pujar
2020-06-30 10:51 ` [PATCH v4 00/23] Add support for Tegra210 Audio Mark Brown
2020-06-30 11:54   ` Sameer Pujar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1593233625-14961-19-git-send-email-spujar@nvidia.com \
    --to=spujar@nvidia.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=atalambedu@nvidia.com \
    --cc=broonie@kernel.org \
    --cc=digetx@gmail.com \
    --cc=dramesh@nvidia.com \
    --cc=jonathanh@nvidia.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mkumard@nvidia.com \
    --cc=nicoleotsuka@gmail.com \
    --cc=nwartikar@nvidia.com \
    --cc=perex@perex.cz \
    --cc=rlokhande@nvidia.com \
    --cc=robh+dt@kernel.org \
    --cc=sharadg@nvidia.com \
    --cc=swarren@nvidia.com \
    --cc=thierry.reding@gmail.com \
    --cc=tiwai@suse.com \
    --cc=viswanathl@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®