All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Akshu Agrawal <akshu.agrawal@amd.com>
Cc: djkurtz@chromium.org, Alexander.Deucher@amd.com,
	Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	"moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER
	MANAGEM..."  <alsa-devel@alsa-project.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ASoC: soc-pcm: Use delay set in pointer function
Date: Mon, 30 Jul 2018 11:54:34 +0100	[thread overview]
Message-ID: <20180730105434.GI5789@sirena.org.uk> (raw)
In-Reply-To: <1532686422-1790-1-git-send-email-akshu.agrawal@amd.com>

[-- Attachment #1: Type: text/plain, Size: 1742 bytes --]

On Fri, Jul 27, 2018 at 06:13:42PM +0800, Akshu Agrawal wrote:
> There are cases where a pointer function populates
> runtime->delay, such as:
> ./sound/pci/hda/hda_controller.c
> ./sound/soc/intel/atom/sst-mfld-platform-pcm.c
> 
> Also, in some cases cpu dai used is generic and the pcm
> driver needs to set delay.
> 
> This delay was getting lost and was overwritten by delays
> from codec or cpu dai delay function if exposed.

I'm not 100% clear how this patch is supposed to work.

> --- a/sound/soc/soc-pcm.c
> +++ b/sound/soc/soc-pcm.c
> @@ -1179,6 +1179,9 @@ static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream)
>  	snd_pcm_sframes_t codec_delay = 0;
>  	int i;
>  
> +	/* clearing the previous delay */
> +	runtime->delay = 0;
> +
>  	for_each_rtdcom(rtd, rtdcom) {
>  		component = rtdcom->component;
>  

Here we reset runtime->delay to 0.

> @@ -1203,7 +1206,7 @@ static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream)
>  	}
>  	delay += codec_delay;
>  
> -	runtime->delay = delay;
> +	runtime->delay += delay;
>  
>  	return offset;
>  }

but here we change the only assignment to delay from a straight
assignment to an accumilation.  I'm a bit confused as to the intended
difference - when will this be doing something other than setting
runtime->delay to the value we originally accumilated in delay which was
what we were doing anyway?

The two examples you mention just do a straight assignment to delay so
they're not going to be compatible with accumilating in delay, it feels
like we'd do better to add an explicit delay operation for them too to
match what we're doing with CODECs but perhaps I'm missing something
here.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie@kernel.org>
To: Akshu Agrawal <akshu.agrawal@amd.com>
Cc: "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER
	MANAGEM..." <alsa-devel@alsa-project.org>,
	open list <linux-kernel@vger.kernel.org>,
	Takashi Iwai <tiwai@suse.com>,
	djkurtz@chromium.org, Liam Girdwood <lgirdwood@gmail.com>,
	Alexander.Deucher@amd.com
Subject: Re: [PATCH] ASoC: soc-pcm: Use delay set in pointer function
Date: Mon, 30 Jul 2018 11:54:34 +0100	[thread overview]
Message-ID: <20180730105434.GI5789@sirena.org.uk> (raw)
In-Reply-To: <1532686422-1790-1-git-send-email-akshu.agrawal@amd.com>


[-- Attachment #1.1: Type: text/plain, Size: 1742 bytes --]

On Fri, Jul 27, 2018 at 06:13:42PM +0800, Akshu Agrawal wrote:
> There are cases where a pointer function populates
> runtime->delay, such as:
> ./sound/pci/hda/hda_controller.c
> ./sound/soc/intel/atom/sst-mfld-platform-pcm.c
> 
> Also, in some cases cpu dai used is generic and the pcm
> driver needs to set delay.
> 
> This delay was getting lost and was overwritten by delays
> from codec or cpu dai delay function if exposed.

I'm not 100% clear how this patch is supposed to work.

> --- a/sound/soc/soc-pcm.c
> +++ b/sound/soc/soc-pcm.c
> @@ -1179,6 +1179,9 @@ static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream)
>  	snd_pcm_sframes_t codec_delay = 0;
>  	int i;
>  
> +	/* clearing the previous delay */
> +	runtime->delay = 0;
> +
>  	for_each_rtdcom(rtd, rtdcom) {
>  		component = rtdcom->component;
>  

Here we reset runtime->delay to 0.

> @@ -1203,7 +1206,7 @@ static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream)
>  	}
>  	delay += codec_delay;
>  
> -	runtime->delay = delay;
> +	runtime->delay += delay;
>  
>  	return offset;
>  }

but here we change the only assignment to delay from a straight
assignment to an accumilation.  I'm a bit confused as to the intended
difference - when will this be doing something other than setting
runtime->delay to the value we originally accumilated in delay which was
what we were doing anyway?

The two examples you mention just do a straight assignment to delay so
they're not going to be compatible with accumilating in delay, it feels
like we'd do better to add an explicit delay operation for them too to
match what we're doing with CODECs but perhaps I'm missing something
here.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  parent reply	other threads:[~2018-07-30 10:54 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-27 10:13 [PATCH] ASoC: soc-pcm: Use delay set in pointer function Akshu Agrawal
2018-07-27 10:13 ` Akshu Agrawal
2018-07-27 15:09 ` [alsa-devel] " Pierre-Louis Bossart
2018-07-27 15:09   ` Pierre-Louis Bossart
2018-07-28  4:28   ` Agrawal, Akshu
2018-07-28  4:28     ` Agrawal, Akshu
2018-07-30 15:15     ` [alsa-devel] " Pierre-Louis Bossart
2018-07-30 15:15       ` Pierre-Louis Bossart
2018-07-30 15:32       ` Takashi Iwai
2018-07-30 15:32         ` Takashi Iwai
2018-07-30 15:50         ` Mark Brown
2018-07-30 15:50           ` Mark Brown
2018-07-31  1:25           ` [alsa-devel] " Agrawal, Akshu
2018-07-31  1:25             ` Agrawal, Akshu
2018-07-31  5:30             ` [alsa-devel] " Takashi Iwai
2018-07-31  5:30               ` Takashi Iwai
2018-07-31  9:06               ` Agrawal, Akshu
2018-07-31  9:06                 ` Agrawal, Akshu
2018-07-31  9:25                 ` [alsa-devel] " Takashi Iwai
2018-07-31  9:25                   ` Takashi Iwai
2018-07-31 10:19                   ` Mark Brown
2018-07-31 10:19                     ` Mark Brown
2018-07-31 10:32                     ` [alsa-devel] " Takashi Iwai
2018-07-31 10:32                       ` Takashi Iwai
2018-07-31 13:12                       ` Mark Brown
2018-07-31 13:12                         ` Mark Brown
2018-07-31 13:29                         ` [alsa-devel] " Takashi Iwai
2018-07-31 13:29                           ` Takashi Iwai
2018-07-31 13:51                           ` Mark Brown
2018-07-31 13:51                             ` Mark Brown
2018-07-31 13:56                             ` [alsa-devel] " Takashi Iwai
2018-07-31 13:56                               ` Takashi Iwai
2018-07-31 14:40                               ` Mark Brown
2018-07-31 14:40                                 ` Mark Brown
2018-08-01  4:01                                 ` [alsa-devel] " Agrawal, Akshu
2018-08-01  4:01                                   ` Agrawal, Akshu
2018-07-31 10:03               ` [alsa-devel] " Mark Brown
2018-07-31 10:03                 ` Mark Brown
2018-07-30 10:54 ` Mark Brown [this message]
2018-07-30 10:54   ` 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=20180730105434.GI5789@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=Alexander.Deucher@amd.com \
    --cc=akshu.agrawal@amd.com \
    --cc=alsa-devel@alsa-project.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 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.