summaryrefslogtreecommitdiffstats
path: root/sound/soc/sof/intel/hda-dai.c
diff options
context:
space:
mode:
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>2022-04-21 15:31:58 -0500
committerMark Brown <broonie@kernel.org>2022-04-25 13:58:34 +0100
commit23b1944e46ab4cd7cbd4ef999f814fc6c6f2eb88 (patch)
tree72fde64f602d8c064c073bd8d5a2900cdc2d067e /sound/soc/sof/intel/hda-dai.c
parentf09e92844eabd6a65feab0c548a7cf6741cfa39d (diff)
downloadlinux-stable-23b1944e46ab4cd7cbd4ef999f814fc6c6f2eb88.tar.gz
linux-stable-23b1944e46ab4cd7cbd4ef999f814fc6c6f2eb88.tar.bz2
linux-stable-23b1944e46ab4cd7cbd4ef999f814fc6c6f2eb88.zip
ASoC: SOF: Intel: hda-dai: improve suspend case
Add comments and re-align with the TRIGGER_SUSPEND case with an additional call to hda_dai_hw_free_ipc() to free-up resources. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20220421203201.1550328-12-pierre-louis.bossart@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.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/sound/soc/sof/intel/hda-dai.c b/sound/soc/sof/intel/hda-dai.c
index c1ff7145745b..dbccd75defe8 100644
--- a/sound/soc/sof/intel/hda-dai.c
+++ b/sound/soc/sof/intel/hda-dai.c
@@ -456,6 +456,7 @@ static int hda_dai_suspend(struct hdac_bus *bus)
struct hdac_stream *s;
const char *name;
int stream_tag;
+ int ret;
/* set internal flag for BE */
list_for_each_entry(s, &bus->stream_list, list) {
@@ -468,20 +469,32 @@ static int hda_dai_suspend(struct hdac_bus *bus)
* explicitly during suspend.
*/
if (hext_stream->link_substream) {
+ struct snd_soc_dai *cpu_dai;
+ struct snd_soc_dai *codec_dai;
+
rtd = asoc_substream_to_rtd(hext_stream->link_substream);
- name = asoc_rtd_to_codec(rtd, 0)->component->name;
+ cpu_dai = asoc_rtd_to_cpu(rtd, 0);
+ codec_dai = asoc_rtd_to_codec(rtd, 0);
+ name = codec_dai->component->name;
link = snd_hdac_ext_bus_get_link(bus, name);
if (!link)
return -EINVAL;
+ /*
+ * we don't need to call snd_hdac_ext_link_stream_clear(he_stream)
+ * since we can only reach this case in the pause_push state, and
+ * the TRIGGER_PAUSE_PUSH already stops the DMA
+ */
+ if (hdac_stream(hext_stream)->direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ stream_tag = hdac_stream(hext_stream)->stream_tag;
+ snd_hdac_ext_link_clear_stream_id(link, stream_tag);
+ }
hext_stream->link_prepared = 0;
- if (hdac_stream(hext_stream)->direction ==
- SNDRV_PCM_STREAM_CAPTURE)
- continue;
-
- stream_tag = hdac_stream(hext_stream)->stream_tag;
- snd_hdac_ext_link_clear_stream_id(link, stream_tag);
+ /* for consistency with TRIGGER_SUSPEND we free DAI resources */
+ ret = hda_dai_hw_free_ipc(hdac_stream(hext_stream)->direction, cpu_dai);
+ if (ret < 0)
+ return ret;
}
}