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 4/7] ASoC: soc-link: add snd_soc_link_be_hw_params_fixup()
Date: 19 May 2020 10:02:02 +0900	[thread overview]
Message-ID: <871rng68l1.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_be_hw_params_fixup().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-link.h |  3 +++
 sound/soc/soc-core.c     |  6 +++++-
 sound/soc/soc-dai.c      |  8 +++-----
 sound/soc/soc-link.c     | 11 +++++++++++
 sound/soc/soc-pcm.c      | 14 +++++---------
 5 files changed, 27 insertions(+), 15 deletions(-)

diff --git a/include/sound/soc-link.h b/include/sound/soc-link.h
index 2a81dca945cd..aae72f668de6 100644
--- a/include/sound/soc-link.h
+++ b/include/sound/soc-link.h
@@ -9,6 +9,9 @@
 #define __SOC_LINK_H
 
 int snd_soc_link_init(struct snd_soc_pcm_runtime *rtd);
+int snd_soc_link_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+				    struct snd_pcm_hw_params *params);
+
 int snd_soc_link_startup(struct snd_pcm_substream *substream);
 void snd_soc_link_shutdown(struct snd_pcm_substream *substream);
 int snd_soc_link_prepare(struct snd_pcm_substream *substream);
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index d5450e61626a..d6818f8c7f1d 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1655,7 +1655,11 @@ static void soc_check_tplg_fes(struct snd_soc_card *card)
 			dai_link->dpcm_playback = 1;
 			dai_link->dpcm_capture = 1;
 
-			/* override any BE fixups */
+			/*
+			 * override any BE fixups
+			 * see
+			 *	snd_soc_link_be_hw_params_fixup()
+			 */
 			dai_link->be_hw_params_fixup =
 				component->driver->be_hw_params_fixup;
 
diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c
index ce4e1fd1ab79..39959cc99bc9 100644
--- a/sound/soc/soc-dai.c
+++ b/sound/soc/soc-dai.c
@@ -313,11 +313,9 @@ int snd_soc_dai_hw_params(struct snd_soc_dai *dai,
 	int ret = 0;
 
 	/* perform any topology hw_params fixups before DAI  */
-	if (rtd->dai_link->be_hw_params_fixup) {
-		ret = rtd->dai_link->be_hw_params_fixup(rtd, params);
-		if (ret < 0)
-			goto end;
-	}
+	ret = snd_soc_link_be_hw_params_fixup(rtd, params);
+	if (ret < 0)
+		goto end;
 
 	if (dai->driver->ops &&
 	    dai->driver->ops->hw_params)
diff --git a/sound/soc/soc-link.c b/sound/soc/soc-link.c
index 691910e82bff..a735b3ba2385 100644
--- a/sound/soc/soc-link.c
+++ b/sound/soc/soc-link.c
@@ -35,6 +35,17 @@ int snd_soc_link_init(struct snd_soc_pcm_runtime *rtd)
 	return soc_link_ret(rtd, ret);
 }
 
+int snd_soc_link_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+				    struct snd_pcm_hw_params *params)
+{
+	int ret = 0;
+
+	if (rtd->dai_link->be_hw_params_fixup)
+		ret = rtd->dai_link->be_hw_params_fixup(rtd, params);
+
+	return soc_link_ret(rtd, ret);
+}
+
 int snd_soc_link_startup(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 2b5068001efb..26246228d8c5 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -2087,15 +2087,11 @@ int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream)
 				sizeof(struct snd_pcm_hw_params));
 
 		/* perform any hw_params fixups */
-		if (be->dai_link->be_hw_params_fixup) {
-			ret = be->dai_link->be_hw_params_fixup(be,
-					&dpcm->hw_params);
-			if (ret < 0) {
-				dev_err(be->dev,
-					"ASoC: hw_params BE fixup failed %d\n",
-					ret);
-				goto unwind;
-			}
+		ret = snd_soc_link_be_hw_params_fixup(be, &dpcm->hw_params);
+		if (ret < 0) {
+			dev_err(be->dev,
+				"ASoC: hw_params BE fixup failed %d\n", ret);
+			goto unwind;
 		}
 
 		/* copy the fixed-up hw params for BE dai */
-- 
2.17.1


  parent reply	other threads:[~2020-05-19  1:04 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 ` Kuninori Morimoto [this message]
2020-05-19  1:45   ` [PATCH 4/7] ASoC: soc-link: add snd_soc_link_be_hw_params_fixup() 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 ` [PATCH 7/7] ASoC: soc-link: add snd_soc_link_compr_set_params() Kuninori Morimoto

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=871rng68l1.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.