ASoC: Intel: avs: Split pcm pages freeing operation from hw_free()

Prepare for introduction of PCM power management support. As freeing
pages during the suspend operation is not desired, separate
snd_pcm_lib_free_pages() from existing avs_dai_fe_hw_free() so that
majority of the code found within it can be reused for standard and PM
flows both.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221027124702.1761002-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Cezary Rojewski 2022-10-27 14:46:54 +02:00 committed by Mark Brown
parent ce992ff38e
commit 0abfc84ba2
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -499,7 +499,7 @@ create_err:
return ret;
}
static int avs_dai_fe_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
static int __avs_dai_fe_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
{
struct avs_dma_data *data;
struct hdac_ext_stream *host_stream;
@ -523,9 +523,15 @@ static int avs_dai_fe_hw_free(struct snd_pcm_substream *substream, struct snd_so
snd_hdac_stream_cleanup(hdac_stream(host_stream));
hdac_stream(host_stream)->prepared = false;
ret = snd_pcm_lib_free_pages(substream);
if (ret < 0)
dev_dbg(dai->dev, "Failed to free pages!\n");
return ret;
}
static int avs_dai_fe_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
{
int ret;
ret = __avs_dai_fe_hw_free(substream, dai);
snd_pcm_lib_free_pages(substream);
return ret;
}