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 7/7] ASoC: soc-link: add snd_soc_link_compr_set_params()
Date: 19 May 2020 10:02:24 +0900	[thread overview]
Message-ID: <87wo584tzz.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <877dx868op.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_set_params().

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

diff --git a/include/sound/soc-link.h b/include/sound/soc-link.h
index 83ca7301c91b..f1fb9036335e 100644
--- a/include/sound/soc-link.h
+++ b/include/sound/soc-link.h
@@ -24,5 +24,7 @@ int snd_soc_link_compr_startup(struct snd_soc_pcm_runtime *rtd,
 			       struct snd_compr_stream *cstream);
 void snd_soc_link_compr_shutdown(struct snd_soc_pcm_runtime *rtd,
 				 struct snd_compr_stream *cstream);
+int snd_soc_link_compr_set_params(struct snd_soc_pcm_runtime *rtd,
+				  struct snd_compr_stream *cstream);
 
 #endif /* __SOC_LINK_H */
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index 9db7810bbe04..7806bb5b46bd 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -438,11 +438,9 @@ static int soc_compr_set_params(struct snd_compr_stream *cstream,
 	if (ret < 0)
 		goto err;
 
-	if (rtd->dai_link->compr_ops && rtd->dai_link->compr_ops->set_params) {
-		ret = rtd->dai_link->compr_ops->set_params(cstream);
-		if (ret < 0)
-			goto err;
-	}
+	ret = snd_soc_link_compr_set_params(rtd, cstream);
+	if (ret < 0)
+		goto err;
 
 	if (cstream->direction == SND_COMPRESS_PLAYBACK)
 		snd_soc_dapm_stream_event(rtd, SNDRV_PCM_STREAM_PLAYBACK,
@@ -506,11 +504,9 @@ static int soc_compr_set_params_fe(struct snd_compr_stream *cstream,
 	if (ret < 0)
 		goto out;
 
-	if (fe->dai_link->compr_ops && fe->dai_link->compr_ops->set_params) {
-		ret = fe->dai_link->compr_ops->set_params(cstream);
-		if (ret < 0)
-			goto out;
-	}
+	ret = snd_soc_link_compr_set_params(fe, cstream);
+	if (ret < 0)
+		goto out;
 
 	dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_START);
 	fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE;
diff --git a/sound/soc/soc-link.c b/sound/soc/soc-link.c
index bad719176379..e9b20a9c05e8 100644
--- a/sound/soc/soc-link.c
+++ b/sound/soc/soc-link.c
@@ -134,3 +134,16 @@ void snd_soc_link_compr_shutdown(struct snd_soc_pcm_runtime *rtd,
 		rtd->dai_link->compr_ops->shutdown(cstream);
 }
 EXPORT_SYMBOL_GPL(snd_soc_link_compr_shutdown);
+
+int snd_soc_link_compr_set_params(struct snd_soc_pcm_runtime *rtd,
+				  struct snd_compr_stream *cstream)
+{
+	int ret = 0;
+
+	if (rtd->dai_link->compr_ops &&
+	    rtd->dai_link->compr_ops->set_params)
+		ret = rtd->dai_link->compr_ops->set_params(cstream);
+
+	return soc_link_ret(rtd, ret);
+}
+EXPORT_SYMBOL_GPL(snd_soc_link_compr_set_params);
-- 
2.17.1


      parent reply	other threads:[~2020-05-19  1:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19  0:59 [PATCH 0/7] ASoC: add soc-link Kuninori Morimoto
2020-05-19  1:01 ` [PATCH 1/7] ASoC: add soc-link.c Kuninori Morimoto
2020-05-19  1:42   ` Ranjani Sridharan
2020-05-19  4:20     ` Kuninori Morimoto
2020-05-19  1:01 ` [PATCH 2/7] ASoC: soc-link: move soc_rtd_xxx() Kuninori Morimoto
2020-05-19  1:01 ` [PATCH 3/7] ASoC: soc-link: remove unneeded parameter from snd_soc_link_xxx() Kuninori Morimoto
2020-05-19  1:02 ` [PATCH 4/7] ASoC: soc-link: add snd_soc_link_be_hw_params_fixup() Kuninori Morimoto
2020-05-19  1:45   ` Ranjani Sridharan
2020-05-19  4:16     ` Kuninori Morimoto
2020-05-19  1:02 ` [PATCH 5/7] ASoC: soc-link: add snd_soc_link_compr_startup() Kuninori Morimoto
2020-05-19  1:47   ` Ranjani Sridharan
2020-05-19  4:18     ` Kuninori Morimoto
2020-05-19  1:02 ` [PATCH 6/7] ASoC: soc-link: add snd_soc_link_compr_shutdown() Kuninori Morimoto
2020-05-19  1:02 ` Kuninori Morimoto [this message]

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=87wo584tzz.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.