summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSameer Pujar <spujar@nvidia.com>2020-11-02 16:10:11 +0100
committerMark Brown <broonie@kernel.org>2020-11-10 18:28:20 +0100
commitc21cbb526c0a105d582299839a9c4244dd6bf38a (patch)
treec41164e9d21e2b9395b75980b43ac4c77861c738
parentASoC: audio-graph: Use of_node and DAI for DPCM DAI link names (diff)
downloadlinux-c21cbb526c0a105d582299839a9c4244dd6bf38a.tar.xz
linux-c21cbb526c0a105d582299839a9c4244dd6bf38a.zip
ASoC: audio-graph: Identify 'no_pcm' DAI links for DPCM
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 <spujar@nvidia.com> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/1604329814-24779-5-git-send-email-spujar@nvidia.com Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/generic/audio-graph-card.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c
index 1e205629e89a..9b0684173a35 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 {