From: Akshu Agrawal <akshu.agrawal@amd.com>
To: unlisted-recipients:; (no To-header on input)
Cc: akshu.agrawal@amd.com, djkurtz@chromium.org,
Alexander.Deucher@amd.com, Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>,
"Mukunda, Vijendar" <Vijendar.Mukunda@amd.com>,
Alex Deucher <alexander.deucher@amd.com>,
alsa-devel@alsa-project.org (moderated list:SOUND - SOC LAYER /
DYNAMIC AUDIO POWER MANAGEM...),
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] ASoC: AMD: Fix capture unstable in beginning for some runs
Date: Mon, 17 Sep 2018 21:10:34 +0530 [thread overview]
Message-ID: <1537198839-15985-1-git-send-email-akshu.agrawal@amd.com> (raw)
alsa_conformance_test -C hw:0,4 -p 1024 --debug
would sometime show:
TIME_DIFF(s) HW_LEVEL READ RATE
0.000095970 1024 1024 10670001.041992
0.042609555 1024 2048 24032.168372
0.021330364 1024 3072 48006.681930
0.021339559 1024 4096 47985.996337
The issue is that in dma pointer function we can have stale value
of the register for current descriptor of channel.
The register retains the number of the last descriptor that
was transferred.
Fix ensures that we report position, 0, till the one period worth of
data is transferred. After one period of data, in handler of period
completion interrupt we update the config and correct value of descriptor
starts reflecting.
Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
---
sound/soc/amd/acp-pcm-dma.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c
index c7e972b..f27e20c 100644
--- a/sound/soc/amd/acp-pcm-dma.c
+++ b/sound/soc/amd/acp-pcm-dma.c
@@ -1050,6 +1050,8 @@ static snd_pcm_uframes_t acp_dma_pointer(struct snd_pcm_substream *substream)
bytescount -= rtd->bytescount;
delay = do_div(bytescount, period_bytes);
runtime->delay = bytes_to_frames(runtime, delay);
+ if (bytescount < period_bytes)
+ pos = 0;
} else {
buffersize = frames_to_bytes(runtime, runtime->buffer_size);
bytescount = acp_get_byte_count(rtd);
--
1.9.1
reply other threads:[~2018-09-17 15:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1537198839-15985-1-git-send-email-akshu.agrawal@amd.com \
--to=akshu.agrawal@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Vijendar.Mukunda@amd.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=djkurtz@chromium.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).