All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ughreja, Rakesh A" <rakesh.a.ughreja@intel.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	"Kp, Jeeja" <jeeja.kp@intel.com>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Cc: "R, Dharageswari" <dharageswari.r@intel.com>,
	"tiwai@suse.de" <tiwai@suse.de>,
	"Shah, Hardik T" <hardik.t.shah@intel.com>,
	Patches Audio <patches.audio@intel.com>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"Girdwood, Liam R" <liam.r.girdwood@intel.com>
Subject: Re: [PATCH 09/11] ASoC: Intel: Skylake: Fix DMA position reporting for capture stream
Date: Thu, 23 Mar 2017 15:08:39 +0000	[thread overview]
Message-ID: <85DFEED57DC57344B2483EF7BF8CB60552D0BABB@BGSMSX104.gar.corp.intel.com> (raw)
In-Reply-To: <8e50b63f-a9e7-537b-af1e-93e120d81ef9@linux.intel.com>



>-----Original Message-----
>From: Pierre-Louis Bossart [mailto:pierre-louis.bossart@linux.intel.com]
>Sent: Thursday, March 23, 2017 7:13 AM
>To: Kp, Jeeja <jeeja.kp@intel.com>; alsa-devel@alsa-project.org
>Cc: R, Dharageswari <dharageswari.r@intel.com>; tiwai@suse.de; Shah, Hardik
>T <hardik.t.shah@intel.com>; Patches Audio <patches.audio@intel.com>;
>broonie@kernel.org; Girdwood, Liam R <liam.r.girdwood@intel.com>
>Subject: Re: [alsa-devel] [PATCH 09/11] ASoC: Intel: Skylake: Fix DMA position
>reporting for capture stream
>
>On 3/23/17 8:32 AM, jeeja.kp@intel.com wrote:
>> From: Hardik T Shah <hardik.t.shah@intel.com>
>>
>> As per hardware recommendation, for every capture stream completion
>> following operations need to be done in order to reflect the actual
>> data that is received in position buffer.
>>
>> 1. Wait for 20us before reading the DMA position in buffer once the
>> interrupt is generated for stream completion.
>> 2. Read any of the register to flush the DMA position value. This is
>> dummy read operation.
>>
>> Signed-off-by: Dharageswari R <dharageswari.r@intel.com>
>> Signed-off-by: Hardik T Shah <hardik.t.shah@intel.com>
>> Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
>> ---
>>  sound/soc/intel/skylake/skl-pcm.c | 22 ++++++++++++++++++++--
>>  1 file changed, 20 insertions(+), 2 deletions(-)
>>
>> diff --git a/sound/soc/intel/skylake/skl-pcm.c
>b/sound/soc/intel/skylake/skl-pcm.c
>> index ef440d8..149221c 100644
>> --- a/sound/soc/intel/skylake/skl-pcm.c
>> +++ b/sound/soc/intel/skylake/skl-pcm.c
>> @@ -21,6 +21,7 @@
>>
>>  #include <linux/pci.h>
>>  #include <linux/pm_runtime.h>
>> +#include <linux/delay.h>
>>  #include <sound/pcm_params.h>
>>  #include <sound/soc.h>
>>  #include "skl.h"
>> @@ -1063,13 +1064,30 @@ static snd_pcm_uframes_t
>skl_platform_pcm_pointer
>>  	 * 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.
>> +	 *
>> +	 * For capture stream following workaround is required to fix the
>> +	 * incorrect position reporting.
>> +	 *
>> +	 * 1. Wait for 20us before reading the DMA position in buffer once
>> +	 * the interrupt is generated for stream completion.
>
>is this really 20us regardless of the sampling frequency/channel count?
>20us is one sample at 48kHz so wondering how generic this work-around is...

Yes, this is independent of PCM parameters. Update happens on the 
HDA frame boundary i.e. 20.833uSec.


>
>> +	 * 2. Read DPIB register to flush the DMA position value. This dummy
>> +	 * read is required to flush DMA position value.
>> +	 * 3. Read the DMA Position-in-Buffer. This value now will be equal to
>> +	 * or greater than period boundary.
>>  	 */
>> -	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
>> +
>> +	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
>> +	} else {
>> +		udelay(20);
>> +		readl(ebus->bus.remap_addr +
>> +				AZX_REG_VS_SDXDPIB_XBASE +
>> +				(AZX_REG_VS_SDXDPIB_XINTERVAL *
>> +				 hdac_stream(hstream)->index));
>>  		pos =
>snd_hdac_stream_get_pos_posbuf(hdac_stream(hstream));
>> +	}
>>
>>  	if (pos >= hdac_stream(hstream)->bufsize)
>>  		pos = 0;
>>

  reply	other threads:[~2017-03-23 15:09 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-23 13:31 [PATCH 00/11] ASoC: Intel: Skylake: More driver updates jeeja.kp
2017-03-23 13:31 ` [PATCH 01/11] ALSA: hda: Fix LLCH register read jeeja.kp
2017-03-29 11:02   ` Applied "ALSA: hda: Fix LLCH register read" to the asoc tree Mark Brown
2017-03-23 13:31 ` [PATCH 02/11] ASoC: Intel: Skylake: Use the sig_bits to define dai bps capability jeeja.kp
2017-03-29 11:54   ` Applied "ASoC: Intel: Skylake: Use the sig_bits to define dai bps capability" to the asoc tree Mark Brown
2017-03-23 13:31 ` [PATCH 03/11] ASoC: hdac_hdmi: Update sig_bits based on converter capability jeeja.kp
2017-03-29 11:54   ` Applied "ASoC: hdac_hdmi: Update sig_bits based on converter capability" to the asoc tree Mark Brown
2017-03-23 13:31 ` [PATCH 04/11] ASoC: Intel: Skylake: Add 16-bit constraint to FE bxt_rt298 machine jeeja.kp
2017-03-29 11:54   ` Applied "ASoC: Intel: Skylake: Add 16-bit constraint to FE bxt_rt298 machine" to the asoc tree Mark Brown
2017-03-23 13:32 ` [PATCH 05/11] ASoC: Intel: Skylake: Don't unload module when in use jeeja.kp
2017-03-29 11:54   ` Applied "ASoC: Intel: Skylake: Don't unload module when in use" to the asoc tree Mark Brown
2017-03-23 13:32 ` [PATCH 06/11] ASoC: Intel: Skylake: Remove redundant vmixer handler jeeja.kp
2017-03-29 11:54   ` Applied "ASoC: Intel: Skylake: Remove redundant vmixer handler" to the asoc tree Mark Brown
2017-03-23 13:32 ` [PATCH 07/11] ASoC: Intel: Skylake: remove hard coded ACPI path jeeja.kp
2017-03-29 11:54   ` Applied "ASoC: Intel: Skylake: remove hard coded ACPI path" to the asoc tree Mark Brown
2017-03-23 13:32 ` [PATCH 08/11] ASoC: Intel: Skylake: Rearrangement of code to cleanup SKL SST library jeeja.kp
2017-03-29 11:54   ` Applied "ASoC: Intel: Skylake: Rearrangement of code to cleanup SKL SST library" to the asoc tree Mark Brown
2017-03-23 13:32 ` [PATCH 09/11] ASoC: Intel: Skylake: Fix DMA position reporting for capture stream jeeja.kp
2017-03-23 14:12   ` Pierre-Louis Bossart
2017-03-23 15:08     ` Ughreja, Rakesh A [this message]
2017-03-23 15:31       ` Pierre-Louis Bossart
2017-03-23 13:32 ` [PATCH 10/11] ASoC: Intel: Skylake: Fix module state after unbind and delete jeeja.kp
2017-03-29 11:54   ` Applied "ASoC: Intel: Skylake: Fix module state after unbind and delete" to the asoc tree Mark Brown
2017-03-23 13:32 ` [PATCH 11/11] ASoC: Intel: Skylake: Add support for deferred DSP module bind jeeja.kp
2017-04-12 16:00   ` Applied "ASoC: Intel: Skylake: Add support for deferred DSP module bind" to the asoc tree Mark Brown
2017-03-27  3:22 ` [PATCH 00/11] ASoC: Intel: Skylake: More driver updates Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=85DFEED57DC57344B2483EF7BF8CB60552D0BABB@BGSMSX104.gar.corp.intel.com \
    --to=rakesh.a.ughreja@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=dharageswari.r@intel.com \
    --cc=hardik.t.shah@intel.com \
    --cc=jeeja.kp@intel.com \
    --cc=liam.r.girdwood@intel.com \
    --cc=patches.audio@intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.