]> www.infradead.org Git - linux.git/commitdiff
ASoC: SOF: Intel: hda-dai: simplify .prepare callback
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Fri, 12 May 2023 18:16:54 +0000 (13:16 -0500)
committerMark Brown <broonie@kernel.org>
Mon, 15 May 2023 11:13:57 +0000 (20:13 +0900)
The code has been cleaned-up multiple times, but while adding the new
abstractions for DMIC/SSP/SoundWire it appears that we don't really
need a specific sequence for .prepare, and we can reuse what
.hw_params already does.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
Reviewed-by: Rander Wang <rander.wang@intel.com
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com
Link: https://lore.kernel.org/r/20230512181702.117483-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
sound/soc/sof/intel/hda-dai.c

index 44a5d94c5050fc21f39093470344fabfc823662a..61eb25cfdbe1bee53fd1b78ae9b2bd6c67dcd1e5 100644 (file)
@@ -188,14 +188,6 @@ static int hda_link_dma_hw_params(struct snd_pcm_substream *substream,
        return 0;
 }
 
-static int hda_link_dma_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *cpu_dai)
-{
-       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
-       int stream = substream->stream;
-
-       return hda_link_dma_hw_params(substream, &rtd->dpcm[stream].hw_params, cpu_dai);
-}
-
 static int hda_dai_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *cpu_dai)
 {
        struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(cpu_dai->component);
@@ -251,30 +243,10 @@ static int hda_dai_hw_params(struct snd_pcm_substream *substream,
 
 static int hda_dai_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
 {
-       struct snd_soc_dapm_widget *w = snd_soc_dai_get_widget(dai, substream->stream);
-       struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(dai->component);
-       const struct hda_dai_widget_dma_ops *ops = hda_dai_get_ops(substream, dai);
-       struct hdac_ext_stream *hext_stream;
-       struct snd_sof_dai_config_data data = { 0 };
-       unsigned int flags = SOF_DAI_CONFIG_FLAGS_HW_PARAMS;
-       int ret;
-
-       hext_stream = ops->get_hext_stream(sdev, dai, substream);
-       if (hext_stream && hext_stream->link_prepared)
-               return 0;
-
-       dev_dbg(sdev->dev, "prepare stream dir %d\n", substream->stream);
-
-       ret = hda_link_dma_prepare(substream, dai);
-       if (ret < 0)
-               return ret;
-
-       hext_stream = ops->get_hext_stream(sdev, dai, substream);
-
-       flags |= SOF_DAI_CONFIG_FLAGS_2_STEP_STOP << SOF_DAI_CONFIG_FLAGS_QUIRK_SHIFT;
-       data.dai_data = hdac_stream(hext_stream)->stream_tag - 1;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
+       int stream = substream->stream;
 
-       return hda_dai_config(w, flags, &data);
+       return hda_dai_hw_params(substream, &rtd->dpcm[stream].hw_params, dai);
 }
 
 /*