From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Alex Levin <levinale@chromium.org>
Cc: alsa-devel@alsa-project.org,
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
Liam Girdwood <liam.r.girdwood@linux.intel.com>,
Jie Yang <yang.jie@linux.intel.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>,
linux-kernel@vger.kernel.org, benzh@chromium.org,
cujomalainey@chromium.org
Subject: Re: [PATCH] ASoC: Intel: Atom: read timestamp moved to period_elapsed
Date: Tue, 9 Jul 2019 14:45:19 +0300 [thread overview]
Message-ID: <20190709114519.GW9224@smile.fi.intel.com> (raw)
In-Reply-To: <20190709040147.111927-1-levinale@chromium.org>
On Mon, Jul 08, 2019 at 09:01:47PM -0700, Alex Levin wrote:
> sst_platform_pcm_pointer is called from both snd_pcm_period_elapsed and
> from snd_pcm_ioctl. Calling read timestamp results in recalculating
> pcm_delay and buffer_ptr (sst_calc_tstamp) which consumes buffers in a
> faster rate than intended.
> In a tested BSW system with chtrt5650, for a rate of 48000, the
> measured rate was sometimes 10 times more than that.
> After moving the timestamp read to period elapsed, buffer consumption is
> as expected.
From code prospective it looks good. You may take mine
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Though I'm not an expert in the area, Pierre and / or Liam should give
their blessing.
>
> Signed-off-by: Alex Levin <levinale@chromium.org>
> ---
> sound/soc/intel/atom/sst-mfld-platform-pcm.c | 23 +++++++++++++-------
> 1 file changed, 15 insertions(+), 8 deletions(-)
>
> diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
> index 0e8b1c5eec88..196af0b30b41 100644
> --- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c
> +++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
> @@ -265,16 +265,28 @@ static void sst_period_elapsed(void *arg)
> {
> struct snd_pcm_substream *substream = arg;
> struct sst_runtime_stream *stream;
> - int status;
> + struct snd_soc_pcm_runtime *rtd;
> + int status, ret_val;
>
> if (!substream || !substream->runtime)
> return;
> stream = substream->runtime->private_data;
> if (!stream)
> return;
> +
> + rtd = substream->private_data;
> + if (!rtd)
> + return;
> +
> status = sst_get_stream_status(stream);
> if (status != SST_PLATFORM_RUNNING)
> return;
> +
> + ret_val = stream->ops->stream_read_tstamp(sst->dev, &stream->stream_info);
> + if (ret_val) {
> + dev_err(rtd->dev, "stream_read_tstamp err code = %d\n", ret_val);
> + return;
> + }
> snd_pcm_period_elapsed(substream);
> }
>
> @@ -658,20 +670,15 @@ static snd_pcm_uframes_t sst_platform_pcm_pointer
> (struct snd_pcm_substream *substream)
> {
> struct sst_runtime_stream *stream;
> - int ret_val, status;
> + int status;
> struct pcm_stream_info *str_info;
> - struct snd_soc_pcm_runtime *rtd = substream->private_data;
>
> stream = substream->runtime->private_data;
> status = sst_get_stream_status(stream);
> if (status == SST_PLATFORM_INIT)
> return 0;
> +
> str_info = &stream->stream_info;
> - ret_val = stream->ops->stream_read_tstamp(sst->dev, str_info);
> - if (ret_val) {
> - dev_err(rtd->dev, "sst: error code = %d\n", ret_val);
> - return ret_val;
> - }
> substream->runtime->delay = str_info->pcm_delay;
> return str_info->buffer_ptr;
> }
> --
> 2.22.0.410.gd8fdbe21b5-goog
>
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2019-07-09 11:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-09 4:01 Alex Levin
2019-07-09 11:45 ` Andy Shevchenko [this message]
2019-07-10 23:15 ` Curtis Malainey
2019-07-17 15:30 ` [alsa-devel] " Pierre-Louis Bossart
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=20190709114519.GW9224@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=benzh@chromium.org \
--cc=broonie@kernel.org \
--cc=cujomalainey@chromium.org \
--cc=levinale@chromium.org \
--cc=liam.r.girdwood@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=tiwai@suse.com \
--cc=yang.jie@linux.intel.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
all inboxes | Powered by JetHome®