summaryrefslogtreecommitdiff
path: root/sound/soc/sof/intel/hda-dai.c
diff options
context:
space:
mode:
authorRanjani Sridharan <ranjani.sridharan@linux.intel.com>2023-03-07 16:04:26 +0200
committerMark Brown <broonie@kernel.org>2023-03-07 17:06:20 +0000
commitb436ed8dd071cae10ac3f94c541a783a094971ff (patch)
treed467804fccf9df3ff96ca76f994fdbb709fb16f9 /sound/soc/sof/intel/hda-dai.c
parent2be2caf481c7200b29116cea83cf8dd45c9e097f (diff)
ASoC: SOF: Intel: hda-dai: Pass the CPU dai pointer
Pass the CPU DAI pointer from the ASoC core to hda_link_dma_hw_params() and ipc3_hda_dai_trigger(). This will avoid looking up the CPU DAI pointer multiple times. 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> Link: https://lore.kernel.org/r/20230307140435.2808-6-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/intel/hda-dai.c')
-rw-r--r--sound/soc/sof/intel/hda-dai.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/sound/soc/sof/intel/hda-dai.c b/sound/soc/sof/intel/hda-dai.c
index d4b98bfe2adf..e448c653cfe1 100644
--- a/sound/soc/sof/intel/hda-dai.c
+++ b/sound/soc/sof/intel/hda-dai.c
@@ -157,10 +157,9 @@ static int hda_link_dma_cleanup(struct snd_pcm_substream *substream,
}
static int hda_link_dma_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
+ struct snd_pcm_hw_params *params, struct snd_soc_dai *cpu_dai)
{
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
- struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
struct hdac_ext_stream *hext_stream;
struct hdac_stream *hstream;
@@ -216,18 +215,18 @@ 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)
+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);
+ return hda_link_dma_hw_params(substream, &rtd->dpcm[stream].hw_params, cpu_dai);
}
-static int hda_link_dma_trigger(struct snd_pcm_substream *substream, int cmd)
+static int hda_link_dma_trigger(struct snd_pcm_substream *substream, struct snd_soc_dai *cpu_dai,
+ int cmd)
{
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
- struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
struct hdac_ext_stream *hext_stream = snd_soc_dai_get_dma_data(cpu_dai, substream);
int ret;
@@ -258,10 +257,9 @@ static int hda_link_dma_trigger(struct snd_pcm_substream *substream, int cmd)
return 0;
}
-static int hda_link_dma_hw_free(struct snd_pcm_substream *substream)
+static int hda_link_dma_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *cpu_dai)
{
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
- struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
struct hdac_ext_stream *hext_stream;
@@ -317,7 +315,7 @@ static int hda_dai_hw_params(struct snd_pcm_substream *substream,
if (hext_stream && hext_stream->link_prepared)
return 0;
- ret = hda_link_dma_hw_params(substream, params);
+ ret = hda_link_dma_hw_params(substream, params, dai);
if (ret < 0)
return ret;
@@ -357,7 +355,7 @@ static int hda_dai_prepare(struct snd_pcm_substream *substream, struct snd_soc_d
dev_dbg(sdev->dev, "prepare stream dir %d\n", substream->stream);
- ret = hda_link_dma_prepare(substream);
+ ret = hda_link_dma_prepare(substream, dai);
if (ret < 0)
return ret;
@@ -384,7 +382,7 @@ static int ipc3_hda_dai_trigger(struct snd_pcm_substream *substream,
dev_dbg(dai->dev, "cmd=%d dai %s direction %d\n", cmd,
dai->name, substream->stream);
- ret = hda_link_dma_trigger(substream, cmd);
+ ret = hda_link_dma_trigger(substream, dai, cmd);
if (ret < 0)
return ret;
@@ -512,7 +510,7 @@ static int hda_dai_hw_free(struct snd_pcm_substream *substream,
{
int ret;
- ret = hda_link_dma_hw_free(substream);
+ ret = hda_link_dma_hw_free(substream, dai);
if (ret < 0)
return ret;