Skip to content

Commit

Permalink
ASoC: Intel: Skylake: Use DPIB to update position for Playback stream
Browse files Browse the repository at this point in the history
DPIB is read currently from a buffer position in memory (indicated by
the registers DPIB[U|L]BASE).Driver reads the position buffer on BDL
completion interrupts to report the DMA position. But the BDL completion
interrupt only indicates the last DMA transfer of the buffer is
completed at the Intel HD Audio subsystem boundary. The periodic DMA
Position-in-Buffer writes may be scheduled at the same time or later
than the MSI and does not guarantee to reflect the position of the last
buffer that was transferred.

Whereas DPIB register in HDA space(vendor specific register indicated by
SDxDPIB) reflects the actual data that is transferred. Hence update the
position based on DPIB for playback.

Signed-off-by: Dharageswari R <dharageswari.r@intel.com>
Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Dharageswari R authored and Mark Brown committed Oct 6, 2016
1 parent 513e43e commit 9a58725
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions sound/soc/intel/skylake/skl-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1031,10 +1031,24 @@ static snd_pcm_uframes_t skl_platform_pcm_pointer
(struct snd_pcm_substream *substream)
{
struct hdac_ext_stream *hstream = get_hdac_ext_stream(substream);
struct hdac_ext_bus *ebus = get_bus_ctx(substream);
unsigned int pos;

/* use the position buffer as default */
pos = snd_hdac_stream_get_pos_posbuf(hdac_stream(hstream));
/*
* Use DPIB for Playback stream as the periodic DMA Position-in-
* Buffer Writes may be scheduled at the same time or later than
* the MSI and does not guarantee to reflect the Position of the
* last buffer that was transferred. Whereas DPIB register in
* HAD space reflects the actual data that is transferred.
* Use the position buffer for capture, as DPIB write gets
* completed earlier than the actual data written to the DDR.
*/
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
pos = readl(ebus->bus.remap_addr + AZX_REG_VS_SDXDPIB_XBASE +
(AZX_REG_VS_SDXDPIB_XINTERVAL *
hdac_stream(hstream)->index));
else
pos = snd_hdac_stream_get_pos_posbuf(hdac_stream(hstream));

if (pos >= hdac_stream(hstream)->bufsize)
pos = 0;
Expand Down

0 comments on commit 9a58725

Please sign in to comment.