From: Ranjani Sridharan Date: Tue, 7 Mar 2023 14:04:26 +0000 (+0200) Subject: ASoC: SOF: Intel: hda-dai: Pass the CPU dai pointer X-Git-Tag: v6.6.7~2882^2~8^2~151^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b436ed8dd071cae10ac3f94c541a783a094971ff;p=platform%2Fkernel%2Flinux-starfive.git 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 Reviewed-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Signed-off-by: Peter Ujfalusi Link: https://lore.kernel.org/r/20230307140435.2808-6-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown --- diff --git a/sound/soc/sof/intel/hda-dai.c b/sound/soc/sof/intel/hda-dai.c index d4b98bf..e448c65 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;