The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: broonie@kernel.org, lgirdwood@gmail.com, perex@perex.cz,
	tiwai@suse.com, krzysztof.kozlowski@linaro.org,
	pierre-louis.bossart@linux.dev, linux-sound@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: q6apm-dai: schedule all the periods before we start streaming
Date: Mon, 3 Feb 2025 14:12:36 +0000	[thread overview]
Message-ID: <14f167e6-ea2f-401a-87e9-2722929bd9a2@linaro.org> (raw)
In-Reply-To: <za6jydjpvhz77h22qvssjxv2vrh6g637ctgfndqavoxo7pnqel@vcalzbkbfoss>



On 03/02/2025 14:09, Dmitry Baryshkov wrote:
> On Mon, Feb 03, 2025 at 12:49:45PM +0000, srinivas.kandagatla@linaro.org wrote:
>> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>>
>> With the existing code, we are only setting up one period at a time, in a
>> ping-pong buffer style. This tiggers lot of underruns in the dsp
>> leading to jitter noise during audio playback.
>>
>> Fix this by scheduling all the periods, this will ensure that the dsp
>> has enough buffer feed and ultimatley fixing the underruns and audio
>> distortion.
>>
>> Fixes: 9b4fe0f1cd79 ("ASoC: qdsp6: audioreach: add q6apm-dai support")
>> Reported-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>> ---
>>   sound/soc/qcom/qdsp6/q6apm-dai.c | 8 +++++---
>>   1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-dai.c
>> index c9404b5934c7..148c3fb77168 100644
>> --- a/sound/soc/qcom/qdsp6/q6apm-dai.c
>> +++ b/sound/soc/qcom/qdsp6/q6apm-dai.c
>> @@ -299,15 +299,17 @@ static int q6apm_dai_trigger(struct snd_soc_component *component,
>>   {
>>   	struct snd_pcm_runtime *runtime = substream->runtime;
>>   	struct q6apm_dai_rtd *prtd = runtime->private_data;
>> -	int ret = 0;
>> +	int ret = 0, i;
>>   
>>   	switch (cmd) {
>>   	case SNDRV_PCM_TRIGGER_START:
>>   	case SNDRV_PCM_TRIGGER_RESUME:
>>   	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
>>   		 /* start writing buffers for playback only as we already queued capture buffers */
>> -		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
>> -			ret = q6apm_write_async(prtd->graph, prtd->pcm_count, 0, 0, 0);
>> +		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
>> +			for (i = 0; i < runtime->periods; i++)
>> +				ret = q6apm_write_async(prtd->graph, prtd->pcm_count, 0, 0, 0);
> 
> So, all errors except the last one are ignored now?

this needs fixing,

thanks for review
--srini
> 
>> +		}
>>   		break;
>>   	case SNDRV_PCM_TRIGGER_STOP:
>>   		/* TODO support be handled via SoftPause Module */
>> -- 
>> 2.39.5
>>
> 

  reply	other threads:[~2025-02-03 14:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-03 12:49 [PATCH] ASoC: q6apm-dai: schedule all the periods before we start streaming srinivas.kandagatla
2025-02-03 14:09 ` Dmitry Baryshkov
2025-02-03 14:12   ` Srinivas Kandagatla [this message]
2025-02-03 14:17 ` Mark Brown
2025-02-03 14:30   ` Srinivas Kandagatla
2025-02-03 15:07     ` Mark Brown
2025-02-03 17:04       ` Srinivas Kandagatla
2025-02-03 17:27         ` Mark Brown

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=14f167e6-ea2f-401a-87e9-2722929bd9a2@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=broonie@kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.dev \
    --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