Skip to content

ASoC: SOF: Intel: add .ack support for HDaudio platform - take 4#3232

Merged
plbossart merged 2 commits into
thesofproject:topic/sof-devfrom
plbossart:fix/no-rewinds-take4
Nov 3, 2021
Merged

ASoC: SOF: Intel: add .ack support for HDaudio platform - take 4#3232
plbossart merged 2 commits into
thesofproject:topic/sof-devfrom
plbossart:fix/no-rewinds-take4

Conversation

@plbossart

Copy link
Copy Markdown
Member

Minor update based on @tiwai's feedback (c.f. https://lore.kernel.org/alsa-devel/s5hee8i43yj.wl-tiwai@suse.de/ )

diff --git a/sound/soc/sof/intel/hda-pcm.c b/sound/soc/sof/intel/hda-pcm.c
index b3f78639c302..431ad0f7d2da 100644
--- a/sound/soc/sof/intel/hda-pcm.c
+++ b/sound/soc/sof/intel/hda-pcm.c
@@ -300,11 +300,11 @@ int hda_dsp_pcm_open(struct snd_sof_dev *sdev,
        }
 
        /*
-        * if we want the .ack to work, we need to prevent the status and
-        * control from being mapped
+        * if we want the .ack to work, we need to prevent the control from being mapped.
+        * The status can still be mapped.
         */
        if (hda_disable_rewinds)
-               runtime->hw.info |= SNDRV_PCM_INFO_NO_REWINDS | SNDRV_PCM_INFO_EXPLICIT_SYNC;
+               runtime->hw.info |= SNDRV_PCM_INFO_NO_REWINDS | SNDRV_PCM_INFO_SYNC_APPLPTR;
 
        /*
         * All playback streams are DMI L1 capable, capture streams need

plbossart and others added 2 commits October 22, 2021 13:41
This reverts commit 5c1ba8c.

Mechanical revert before new submission and better commit message

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
When we disable rewinds, then the .ack can be used to program SPIB
with the application pointer, which allows the HDaudio DMA to save
power by opportunistically bursting data transfers when the path to
memory is enabled (and conversely to shut it down when there are no
transfer requests).

The SPIB register can only be programmed with incremental values with
wrap-around after the DMA RUN bits are set. For simplicity, we set the
INFO_NO_REWINDS flag in the .open callback when we already need to
program the SNDRV_PCM_INFO_SYNC_APPLPTR flag.

Rewinds are not used by many applications. One notable application
using rewinds is PulseAudio. Practical experiments with
Ubuntu/PulseAudio default settings did not show any audible issues,
but the user may hear volume changes and notification with a delay,
depending on the size of the ring buffer and latency constraints.

The choice of disabling rewinds is exposed as a kernel parameter and
not a Kconfig option to avoid any undesirable side-effects.

Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Co-developed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
@plbossart plbossart requested a review from ranj063 October 25, 2021 19:18
@plbossart plbossart merged commit 7681bcf into thesofproject:topic/sof-dev Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants