All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shengjiu Wang <shengjiu.wang@nxp.com>
To: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz,
	tiwai@suse.com, pierre-louis.bossart@linux.intel.com,
	stephan@gerhold.net, guennadi.liakhovetski@linux.intel.com,
	kai.vehmanen@linux.intel.com, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] ASoC: simple-card: Add dummy dai support simple sound card
Date: Thu, 25 Feb 2021 20:08:32 +0800	[thread overview]
Message-ID: <1614254912-15746-1-git-send-email-shengjiu.wang@nxp.com> (raw)

If sound card doesn't need specific codec device, just
dummy codec is enough, then we can link the dummy component
directly.

In this case, user needs to specify below setting in
devicetree. Previously the sound-dai is a node of codec,
now we check if it is zero before parsing the node, zero
means dummy component is specified.

	simple-audio-card,codec {
		sound-dai = <0>;
	};

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
 sound/soc/generic/simple-card.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index c262281bc64d..8b0cabd1bad1 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -34,10 +34,19 @@ static int asoc_simple_parse_dai(struct device_node *node,
 {
 	struct of_phandle_args args;
 	int ret;
+	u32 val;
 
 	if (!node)
 		return 0;
 
+	ret = of_property_read_u32(node, DAI, &val);
+	if (val == 0) {
+		dlc->of_node       = NULL;
+		dlc->dai_name      = "snd-soc-dummy-dai";
+		dlc->name          = "snd-soc-dummy";
+		return 0;
+	}
+
 	/*
 	 * Get node via "sound-dai = <&phandle port>"
 	 * it will be used as xxx_of_node on soc_bind_dai_link()
-- 
2.27.0


             reply	other threads:[~2021-02-25 12:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-25 12:08 Shengjiu Wang [this message]
2021-02-25 13:15 ` [PATCH] ASoC: simple-card: Add dummy dai support simple sound card Mark Brown
2021-02-25 13:15   ` Mark Brown
2021-02-26  6:05   ` Shengjiu Wang
2021-02-26  6:05     ` Shengjiu Wang
2021-03-02 16:32     ` Mark Brown
2021-03-02 16:32       ` Mark Brown

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=1614254912-15746-1-git-send-email-shengjiu.wang@nxp.com \
    --to=shengjiu.wang@nxp.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=guennadi.liakhovetski@linux.intel.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=stephan@gerhold.net \
    --cc=tiwai@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.