On Tue, 31 Jul 2018 11:06:59 +0200, Agrawal, Akshu wrote:
On 7/31/2018 11:00 AM, Takashi Iwai wrote:
On Tue, 31 Jul 2018 03:25:06 +0200, Agrawal, Akshu wrote:
On 7/30/2018 9:20 PM, Mark Brown wrote:
On Mon, Jul 30, 2018 at 05:32:21PM +0200, Takashi Iwai wrote:
That said, if delay callback of CPU dai provides the additional delay, the patch does correct thing. OTOH, if CPU dai provides the base delay instead, we need to clarify that it's rather a must; the delay calculation in pointer callback becomes bogus in this scenario.
Part of the theory here is that every component might have a delay independently of the rest and we need to add them all together to figure out what the system as a whole will see. Personally I'd rather just have everything use a callack consistently to avoid confusion.
For consistency we can add a delay callback in snd_pcm_ops and modify the drivers which directly assigning runtime->delay to use the callback.
No, ALSA PCM ops definition is fine. The delay calculation is basically tied with the position, hence it has to be set together, and that's the pointer callback.
Judging from the call pattern, the current design of ASoC delay callback implies that the return value is more or less constant, which can be accumulated on top of the base value. So your patch is natural from that POV.
OTOH, if the CPU dai can really provide a dynamic value that is strictly tied with pointer, CPU dai itself should provide the pointer callback that covers both the pointer and the base delay, and it should be used instead of component pointer callback.
Not sure if all cpu dai can provide the base delay and thus require component pointer callback for it. For example, in case of AMD, it uses designware cpu dai which is a common code.
It's not necessary that all CPU dais provide the pointer callback. My suggestion is that, if CPU dai *wants* to provide the base delay, it must be tied with the position value, hence it should provide the pointer callback. If CPU dai has a pointer callback, snd_soc_pcm_pointer() skips the component pointer callback but uses CPU dai pointer callback instead.
OTOH, for most of existing implementations, the delay is just additions, and this can be still given via the existing delay callback. In that case, the base delay is taken from the component driver ops, and it'll be like your patch.
Takashi