All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Mark Brown <broonie@kernel.org>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>
Subject: [PATCH v3 5/7] ASoC: soc-link: add snd_soc_link_compr_startup()
Date: 22 May 2020 09:14:14 +0900	[thread overview]
Message-ID: <87eerc4yi1.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87lflk4yk3.wl-kuninori.morimoto.gx@renesas.com>


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

dai_link related function should be implemented at soc-link.c.
This patch adds snd_soc_link_compr_startup().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-link.h |  2 ++
 sound/soc/soc-compress.c | 24 +++++++-----------------
 sound/soc/soc-link.c     | 13 +++++++++++++
 3 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/include/sound/soc-link.h b/include/sound/soc-link.h
index aae72f668de6..20fe46f31e33 100644
--- a/include/sound/soc-link.h
+++ b/include/sound/soc-link.h
@@ -20,4 +20,6 @@ int snd_soc_link_hw_params(struct snd_pcm_substream *substream,
 void snd_soc_link_hw_free(struct snd_pcm_substream *substream);
 int snd_soc_link_trigger(struct snd_pcm_substream *substream, int cmd);
 
+int snd_soc_link_compr_startup(struct snd_compr_stream *cstream);
+
 #endif /* __SOC_LINK_H */
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index 62ece729e425..ddc6c6f69d2f 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -19,6 +19,7 @@
 #include <sound/soc.h>
 #include <sound/initval.h>
 #include <sound/soc-dpcm.h>
+#include <sound/soc-link.h>
 #include <linux/pm_runtime.h>
 
 static int soc_compr_components_open(struct snd_compr_stream *cstream,
@@ -95,15 +96,9 @@ static int soc_compr_open(struct snd_compr_stream *cstream)
 	if (ret < 0)
 		goto machine_err;
 
-	if (rtd->dai_link->compr_ops && rtd->dai_link->compr_ops->startup) {
-		ret = rtd->dai_link->compr_ops->startup(cstream);
-		if (ret < 0) {
-			dev_err(rtd->dev,
-				"Compress ASoC: %s startup failed: %d\n",
-				rtd->dai_link->name, ret);
-			goto machine_err;
-		}
-	}
+	ret = snd_soc_link_compr_startup(cstream);
+	if (ret < 0)
+		goto machine_err;
 
 	snd_soc_runtime_activate(rtd, cstream->direction);
 
@@ -179,14 +174,9 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
 	if (ret < 0)
 		goto open_err;
 
-	if (fe->dai_link->compr_ops && fe->dai_link->compr_ops->startup) {
-		ret = fe->dai_link->compr_ops->startup(cstream);
-		if (ret < 0) {
-			pr_err("Compress ASoC: %s startup failed: %d\n",
-			       fe->dai_link->name, ret);
-			goto machine_err;
-		}
-	}
+	ret = snd_soc_link_compr_startup(cstream);
+	if (ret < 0)
+		goto machine_err;
 
 	dpcm_clear_pending_state(fe, stream);
 	dpcm_path_put(&list);
diff --git a/sound/soc/soc-link.c b/sound/soc/soc-link.c
index 113a4d1b2262..7f0fb53c435a 100644
--- a/sound/soc/soc-link.c
+++ b/sound/soc/soc-link.c
@@ -113,3 +113,16 @@ int snd_soc_link_trigger(struct snd_pcm_substream *substream, int cmd)
 
 	return soc_link_ret(rtd, ret);
 }
+
+int snd_soc_link_compr_startup(struct snd_compr_stream *cstream)
+{
+	struct snd_soc_pcm_runtime *rtd = cstream->private_data;
+	int ret = 0;
+
+	if (rtd->dai_link->compr_ops &&
+	    rtd->dai_link->compr_ops->startup)
+		ret = rtd->dai_link->compr_ops->startup(cstream);
+
+	return soc_link_ret(rtd, ret);
+}
+EXPORT_SYMBOL_GPL(snd_soc_link_compr_startup);
-- 
2.17.1


  parent reply	other threads:[~2020-05-22  0:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-22  0:13 [PATCH v3 0/7] ASoC: add soc-link Kuninori Morimoto
2020-05-22  0:13 ` [PATCH v3 1/7] ASoC: add soc-link.c Kuninori Morimoto
2020-05-22  0:13 ` [PATCH v3 2/7] ASoC: soc-link: move soc_rtd_xxx() Kuninori Morimoto
2020-05-22 18:37   ` Mark Brown
2020-05-25  0:34     ` Kuninori Morimoto
2020-05-22  0:14 ` [PATCH v3 3/7] ASoC: soc-link: remove unneeded parameter from snd_soc_link_xxx() Kuninori Morimoto
2020-05-22  0:14 ` [PATCH v3 4/7] ASoC: soc-link: add snd_soc_link_be_hw_params_fixup() Kuninori Morimoto
2020-05-22  0:14 ` Kuninori Morimoto [this message]
2020-05-22  0:14 ` [PATCH v3 6/7] ASoC: soc-link: add snd_soc_link_compr_shutdown() Kuninori Morimoto
2020-05-22  0:14 ` [PATCH v3 7/7] ASoC: soc-link: add snd_soc_link_compr_set_params() Kuninori Morimoto
2020-05-22  0:21 ` [PATCH v3 0/7] ASoC: add soc-link Kuninori Morimoto
2020-05-22 14:36 ` Pierre-Louis Bossart
2020-05-25 14:57 ` 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=87eerc4yi1.wl-kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    /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.