ASoC: SOF: Intel: hda: Fix compressed stream position tracking
Subsystems (3)
PATCH 1/1 ASoC: SOF: Intel: hda: Fix compressed stream position tracking
From: Peter Ujfalusi <[email protected]>
Commit 288fad2f71fa ("ASoC: SOF: Intel: hda: add quirks for HDAudio DMA position information") modified the PCM path only, but left the compressed data patch using an obsolete option.
Move the functionality in a helper that can be called for both PCM and compressed data.
--- sound/soc/sof/intel/hda-pcm.c | 74 +------------------------ sound/soc/sof/intel/hda-stream.c | 94 ++++++++++++++++++++++++++++++-- sound/soc/sof/intel/hda.h | 3 + 3 files changed, 94 insertions(+), 77 deletions(-)
sound/soc/sof/intel/hda-pcm.c +1 -73
@@ -192,79 +192,7 @@ snd_pcm_uframes_t hda_dsp_pcm_pointer(struct snd_sof_dev *sdev, goto found; } -switch (sof_hda_position_quirk) { -case SOF_HDA_POSITION_QUIRK_USE_SKYLAKE_LEGACY : -/* -* This legacy code, inherited from the Skylake driver, -* mixes DPIB registers and DPIB DDR updates and -* does not seem to follow any known hardware recommendations. -* It's not clear e.g. why there is a different flow -* for capture and playback, the only information that matters is -* what traffic class is used, and on all SOF-enabled platforms -* only VC0 is supported so the work-around was likely not necessary -* and quite possibly wrong. -*/ - -/* DPIB/posbuf position mode: -* For Playback, Use DPIB register from HDA space which -* reflects the actual data transferred. -* For Capture, Use the position buffer for pointer, as DPIB -* is not accurate enough, its update may be completed -* earlier than the data written to DDR. -*/ -if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { - pos =snd_sof_dsp_read (sdev,HDA_DSP_HDA_BAR , -AZX_REG_VS_SDXDPIB_XBASE + - (AZX_REG_VS_SDXDPIB_XINTERVAL * - hstream->index)); - }else { -/* -* For capture stream, we need more workaround to fix the -* position incorrect issue: -* -* 1. Wait at least 20us before reading position buffer after -* the interrupt generated(IOC), to make sure position update -* happens on frame boundary i.e. 20.833uSec for 48KHz. -* 2. Perform a dummy Read to DPIB register to flush DMA -* position value. -* 3. Read the DMA Position from posbuf. Now the readback -* value should be >= period boundary. -*/ -usleep_range (20 ,21 ); -snd_sof_dsp_read (sdev,HDA_DSP_HDA_BAR , -AZX_REG_VS_SDXDPIB_XBASE + - (AZX_REG_VS_SDXDPIB_XINTERVAL * - hstream->index)); - pos =snd_hdac_stream_get_pos_posbuf (hstream); - } -break ; -case SOF_HDA_POSITION_QUIRK_USE_DPIB_REGISTERS : -/* -* In case VC1 traffic is disabled this is the recommended option -*/ - pos =snd_sof_dsp_read (sdev,HDA_DSP_HDA_BAR , -AZX_REG_VS_SDXDPIB_XBASE + - (AZX_REG_VS_SDXDPIB_XINTERVAL * - hstream->index)); -break ; -case SOF_HDA_POSITION_QUIRK_USE_DPIB_DDR_UPDATE : -/* -* This is the recommended option when VC1 is enabled. -* While this isn't needed for SOF platforms it's added for -* consistency and debug. -*/ - pos =snd_hdac_stream_get_pos_posbuf (hstream); -break ; -default : -dev_err_once (sdev->dev,"hda_position_quirk value %d not supported\n" , - sof_hda_position_quirk); - pos =0 ; -break ; - } - -if (pos >= hstream->bufsize) - pos =0 ; - + pos =hda_dsp_stream_get_position (hstream, substream->stream, true); found: pos =bytes_to_frames (substream->runtime, pos);
sound/soc/sof/intel/hda-stream.c +90 -4
113 lines not on this page · raw message
sound/soc/sof/intel/hda.h +3 -0
@@ -565,6 +565,9 @@ int hda_dsp_stream_setup_bdl(struct snd_sof_dev *sdev,bool hda_dsp_check_ipc_irq (struct snd_sof_dev *sdev);bool hda_dsp_check_stream_irq (struct snd_sof_dev *sdev); +snd_pcm_uframes_t hda_dsp_stream_get_position (struct hdac_stream *hstream, +int direction,bool can_sleep); +struct hdac_ext_stream *hda_dsp_stream_get (struct snd_sof_dev *sdev,int direction,u32 flags);int hda_dsp_stream_put (struct snd_sof_dev *sdev,int direction,int stream_tag);
Signature · 1 line
2.34.1
Mark Brown
maintainerQuoted 9 lines · Pierre-Louis Bossart
From: Peter Ujfalusi <[email protected]>
Commit
288fad2f71fa("ASoC: SOF: Intel: hda: add quirks for HDAudio DMA position information") modified the PCM path only, but left the compressed data patch using an obsolete option.
Move the functionality in a helper that can be called for both PCM and compressed data.[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: SOF: Intel: hda: Fix compressed stream position tracking
commit: a37a9224d0500f0cf5bf13cb225163c21b29e0f6
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark