diff mbox series

[02/14] ASoC: SOF: Intel: hda-dai: Remove hda_link_dma_params()

Message ID 20230307140435.2808-3-peter.ujfalusi@linux.intel.com (mailing list archive)
State Accepted
Commit a8310c0093f4ebeb3a317b4b70e864b91739fc50
Headers show
Series ASoC: SOF: Intel: hda: Introduce HDA DAI abstraction | expand

Commit Message

Peter Ujfalusi March 7, 2023, 2:04 p.m. UTC
From: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>

No code change. Just code move from hda_link_dma_params() to
hda_link_dma_hw_params().

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
---
 sound/soc/sof/intel/hda-dai.c | 62 ++++++++++++++++-------------------
 1 file changed, 28 insertions(+), 34 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/sof/intel/hda-dai.c b/sound/soc/sof/intel/hda-dai.c
index c7f89c18d5c2..770c00ae29ac 100644
--- a/sound/soc/sof/intel/hda-dai.c
+++ b/sound/soc/sof/intel/hda-dai.c
@@ -168,39 +168,6 @@  static int hda_link_dma_cleanup(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int hda_link_dma_params(struct hdac_ext_stream *hext_stream,
-			       struct hda_pipe_params *params)
-{
-	struct hdac_stream *hstream = &hext_stream->hstream;
-	unsigned char stream_tag = hstream->stream_tag;
-	struct hdac_bus *bus = hstream->bus;
-	struct hdac_ext_link *hlink;
-	unsigned int format_val;
-
-	snd_hdac_ext_stream_reset(hext_stream);
-
-	format_val = snd_hdac_calc_stream_format(params->s_freq, params->ch,
-						 params->format,
-						 params->link_bps, 0);
-
-	dev_dbg(bus->dev, "format_val=%d, rate=%d, ch=%d, format=%d\n",
-		format_val, params->s_freq, params->ch, params->format);
-
-	snd_hdac_ext_stream_setup(hext_stream, format_val);
-
-	if (hext_stream->hstream.direction == SNDRV_PCM_STREAM_PLAYBACK) {
-		list_for_each_entry(hlink, &bus->hlink_list, list) {
-			if (hlink->index == params->link_index)
-				snd_hdac_ext_bus_link_set_stream_id(hlink,
-								    stream_tag);
-		}
-	}
-
-	hext_stream->link_prepared = 1;
-
-	return 0;
-}
-
 static int hda_link_dma_hw_params(struct snd_pcm_substream *substream,
 				  struct snd_pcm_hw_params *params)
 {
@@ -209,9 +176,12 @@  static int hda_link_dma_hw_params(struct snd_pcm_substream *substream,
 	struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
 	struct hda_pipe_params p_params = {0};
 	struct hdac_ext_stream *hext_stream;
+	struct hdac_stream *hstream;
 	struct hdac_ext_link *hlink;
 	struct snd_sof_dev *sdev;
 	struct hdac_bus *bus;
+	unsigned int format_val;
+	unsigned char stream_tag;
 
 	sdev = snd_soc_component_get_drvdata(cpu_dai->component);
 	bus = sof_to_bus(sdev);
@@ -229,6 +199,9 @@  static int hda_link_dma_hw_params(struct snd_pcm_substream *substream,
 		snd_soc_dai_set_dma_data(cpu_dai, substream, (void *)hext_stream);
 	}
 
+	hstream = &hext_stream->hstream;
+	stream_tag = hstream->stream_tag;
+
 	/* set the hdac_stream in the codec dai */
 	snd_soc_dai_set_stream(codec_dai, hdac_stream(hext_stream), substream->stream);
 
@@ -242,7 +215,28 @@  static int hda_link_dma_hw_params(struct snd_pcm_substream *substream,
 	else
 		p_params.link_bps = codec_dai->driver->capture.sig_bits;
 
-	return hda_link_dma_params(hext_stream, &p_params);
+	snd_hdac_ext_stream_reset(hext_stream);
+
+	format_val = snd_hdac_calc_stream_format(p_params.s_freq, p_params.ch,
+						 p_params.format,
+						 p_params.link_bps, 0);
+
+	dev_dbg(bus->dev, "format_val=%d, rate=%d, ch=%d, format=%d\n",
+		format_val, p_params.s_freq, p_params.ch, p_params.format);
+
+	snd_hdac_ext_stream_setup(hext_stream, format_val);
+
+	if (hext_stream->hstream.direction == SNDRV_PCM_STREAM_PLAYBACK) {
+		list_for_each_entry(hlink, &bus->hlink_list, list) {
+			if (hlink->index == p_params.link_index)
+				snd_hdac_ext_bus_link_set_stream_id(hlink,
+								    stream_tag);
+		}
+	}
+
+	hext_stream->link_prepared = 1;
+
+	return 0;
 }
 
 static int hda_link_dma_prepare(struct snd_pcm_substream *substream)