mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-03 17:14:14 +08:00
ASoC: SOF: Intel: hda-dai-ops: only allocate/release streams for first CPU DAI
When we have multiple CPU DAIs in a dailink, typically for SoundWire aggregated solutions with amplifiers on multiple links, we only want to allocate one HDaudio stream_tag. The simplest solution is to allocate the hext_stream/stream_tag for the DAI with index 0 in the dailink, and reuse the same stream for all other CPU DAIs. This assumption relies on serialization of DAIs by the ASoC core, where all CPU DAIs are handled in a loop. The stream release follows the same idea of releasing the tag for the first DAI only. Ideally we would want the loop to be handled in reverse-order to summetry, but there is no risk of reusing a stream_tag which is no longer valid. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Link: https://lore.kernel.org/r/20230807210959.506849-13-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
b6c508b46d
commit
f8ba62ac86
@ -145,9 +145,17 @@ static struct hdac_ext_stream *hda_assign_hext_stream(struct snd_sof_dev *sdev,
|
||||
struct snd_soc_dai *cpu_dai,
|
||||
struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
||||
struct snd_soc_dai *dai;
|
||||
struct hdac_ext_stream *hext_stream;
|
||||
|
||||
hext_stream = hda_link_stream_assign(sof_to_bus(sdev), substream);
|
||||
/* only allocate a stream_tag for the first DAI in the dailink */
|
||||
dai = asoc_rtd_to_cpu(rtd, 0);
|
||||
if (dai == cpu_dai)
|
||||
hext_stream = hda_link_stream_assign(sof_to_bus(sdev), substream);
|
||||
else
|
||||
hext_stream = snd_soc_dai_get_dma_data(dai, substream);
|
||||
|
||||
if (!hext_stream)
|
||||
return NULL;
|
||||
|
||||
@ -160,9 +168,14 @@ static void hda_release_hext_stream(struct snd_sof_dev *sdev, struct snd_soc_dai
|
||||
struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct hdac_ext_stream *hext_stream = hda_get_hext_stream(sdev, cpu_dai, substream);
|
||||
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
||||
struct snd_soc_dai *dai;
|
||||
|
||||
/* only release a stream_tag for the first DAI in the dailink */
|
||||
dai = asoc_rtd_to_cpu(rtd, 0);
|
||||
if (dai == cpu_dai)
|
||||
snd_hdac_ext_stream_release(hext_stream, HDAC_EXT_STREAM_TYPE_LINK);
|
||||
snd_soc_dai_set_dma_data(cpu_dai, substream, NULL);
|
||||
snd_hdac_ext_stream_release(hext_stream, HDAC_EXT_STREAM_TYPE_LINK);
|
||||
}
|
||||
|
||||
static void hda_setup_hext_stream(struct snd_sof_dev *sdev, struct hdac_ext_stream *hext_stream,
|
||||
|
Loading…
Reference in New Issue
Block a user