diff options
author | Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> | 2022-10-19 11:21:15 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2022-10-20 14:31:42 +0200 |
commit | 6258234129b013c534fa10abaf08751b2401b22b (patch) | |
tree | a98b33796b2db301422375dd549617a069b52724 /sound/soc/intel | |
parent | f90025100fb50552a8281becd8f26aab065d4c31 (diff) | |
download | linux-6258234129b013c534fa10abaf08751b2401b22b.tar.gz linux-6258234129b013c534fa10abaf08751b2401b22b.tar.bz2 linux-6258234129b013c534fa10abaf08751b2401b22b.zip |
ALSA/ASoC: hda: move SPIB/DRMS functionality from ext layer
The SPIB and DRMS capabilities are orthogonal to the DSP enablement
and can be used whether the stream is coupled or not.
The existing code partitioning makes limited sense, the capabilities
are parsed at the sound/hda level but helpers are located in
sound/hda/ext.
This patch moves all the SPIB/DRMS functionality to the sound/hda
layer. This reduces the complexity of the sound/hda/ext layer which is
now limited to handling the multi-link extensions and stream
coupling/decoupling helpers.
Note that this is an iso-functionality code move and rename, the
HDaudio legacy driver would need additional changes to make use of
these capabilities.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20221019162115.185917-11-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/soc/intel')
-rw-r--r-- | sound/soc/intel/avs/loader.c | 16 | ||||
-rw-r--r-- | sound/soc/intel/skylake/skl-messages.c | 6 | ||||
-rw-r--r-- | sound/soc/intel/skylake/skl-pcm.c | 17 |
3 files changed, 18 insertions, 21 deletions
diff --git a/sound/soc/intel/avs/loader.c b/sound/soc/intel/avs/loader.c index 9e3f8ff33a87..34923558dfa5 100644 --- a/sound/soc/intel/avs/loader.c +++ b/sound/soc/intel/avs/loader.c @@ -369,8 +369,8 @@ int avs_hda_load_basefw(struct avs_dev *adev, struct firmware *fw) goto release_stream; /* enable SPIB for hda stream */ - snd_hdac_ext_stream_spbcap_enable(bus, true, hstream->index); - ret = snd_hdac_ext_stream_set_spib(bus, estream, fw->size); + snd_hdac_stream_spbcap_enable(bus, true, hstream->index); + ret = snd_hdac_stream_set_spib(bus, hstream, fw->size); if (ret) goto cleanup_resources; @@ -400,8 +400,8 @@ int avs_hda_load_basefw(struct avs_dev *adev, struct firmware *fw) cleanup_resources: /* disable SPIB for hda stream */ - snd_hdac_ext_stream_spbcap_enable(bus, false, hstream->index); - snd_hdac_ext_stream_set_spib(bus, estream, 0); + snd_hdac_stream_spbcap_enable(bus, false, hstream->index); + snd_hdac_stream_set_spib(bus, hstream, 0); snd_hdac_dsp_cleanup(hstream, &dmab); release_stream: @@ -436,8 +436,8 @@ int avs_hda_load_library(struct avs_dev *adev, struct firmware *lib, u32 id) goto release_stream; /* enable SPIB for hda stream */ - snd_hdac_ext_stream_spbcap_enable(bus, true, stream->index); - snd_hdac_ext_stream_set_spib(bus, estream, lib->size); + snd_hdac_stream_spbcap_enable(bus, true, stream->index); + snd_hdac_stream_set_spib(bus, stream, lib->size); memcpy(dmab.area, lib->data, lib->size); @@ -451,8 +451,8 @@ int avs_hda_load_library(struct avs_dev *adev, struct firmware *lib, u32 id) } /* disable SPIB for hda stream */ - snd_hdac_ext_stream_spbcap_enable(bus, false, stream->index); - snd_hdac_ext_stream_set_spib(bus, estream, 0); + snd_hdac_stream_spbcap_enable(bus, false, stream->index); + snd_hdac_stream_set_spib(bus, stream, 0); snd_hdac_dsp_cleanup(stream, &dmab); release_stream: diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c index eaad180af42e..5ab0917a2b3d 100644 --- a/sound/soc/intel/skylake/skl-messages.c +++ b/sound/soc/intel/skylake/skl-messages.c @@ -53,17 +53,15 @@ static int skl_dsp_setup_spib(struct device *dev, unsigned int size, struct hdac_bus *bus = dev_get_drvdata(dev); struct hdac_stream *stream = snd_hdac_get_stream(bus, SNDRV_PCM_STREAM_PLAYBACK, stream_tag); - struct hdac_ext_stream *estream; if (!stream) return -EINVAL; - estream = stream_to_hdac_ext_stream(stream); /* enable/disable SPIB for this hdac stream */ - snd_hdac_ext_stream_spbcap_enable(bus, enable, stream->index); + snd_hdac_stream_spbcap_enable(bus, enable, stream->index); /* set the spib value */ - snd_hdac_ext_stream_set_spib(bus, estream, size); + snd_hdac_stream_set_spib(bus, stream, size); return 0; } diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c index 27b03c34abd0..dc627d18518d 100644 --- a/sound/soc/intel/skylake/skl-pcm.c +++ b/sound/soc/intel/skylake/skl-pcm.c @@ -467,6 +467,7 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd, struct skl_module_cfg *mconfig; struct hdac_bus *bus = get_bus_ctx(substream); struct hdac_ext_stream *stream = get_hdac_ext_stream(substream); + struct hdac_stream *hstream = hdac_stream(stream); struct snd_soc_dapm_widget *w; int ret; @@ -484,11 +485,9 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd, * dpib & lpib position to resume before starting the * DMA */ - snd_hdac_ext_stream_drsm_enable(bus, true, - hdac_stream(stream)->index); - snd_hdac_ext_stream_set_dpibr(bus, stream, - stream->lpib); - snd_hdac_ext_stream_set_lpib(stream, stream->lpib); + snd_hdac_stream_drsm_enable(bus, true, hstream->index); + snd_hdac_stream_set_dpibr(bus, hstream, hstream->lpib); + snd_hdac_stream_set_lpib(hstream, hstream->lpib); } fallthrough; @@ -520,13 +519,13 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd, ret = skl_decoupled_trigger(substream, cmd); if ((cmd == SNDRV_PCM_TRIGGER_SUSPEND) && !w->ignore_suspend) { /* save the dpib and lpib positions */ - stream->dpib = readl(bus->remap_addr + + hstream->dpib = readl(bus->remap_addr + AZX_REG_VS_SDXDPIB_XBASE + (AZX_REG_VS_SDXDPIB_XINTERVAL * - hdac_stream(stream)->index)); + hstream->index)); + + hstream->lpib = snd_hdac_stream_get_pos_lpib(hstream); - stream->lpib = snd_hdac_stream_get_pos_lpib( - hdac_stream(stream)); snd_hdac_ext_stream_decouple(bus, stream, false); } break; |