RE: [PATCH] ASoC: amd :High hw_level while simultaneous capture

From: RAVULAPATI, VISHNU VARDHAN RAO
Date: Tue May 05 2020 - 08:18:51 EST


[AMD Official Use Only - Internal Distribution Only]



-----Original Message-----
From: Mark Brown <broonie@xxxxxxxxxx>
Sent: Tuesday, May 5, 2020 5:21 PM
To: Agrawal, Akshu <Akshu.Agrawal@xxxxxxx>
Cc: RAVULAPATI, VISHNU VARDHAN RAO <Vishnuvardhanrao.Ravulapati@xxxxxxx>; Liam Girdwood <lgirdwood@xxxxxxxxx>; Jaroslav Kysela <perex@xxxxxxxx>; Takashi Iwai <tiwai@xxxxxxxx>; Mukunda, Vijendar <Vijendar.Mukunda@xxxxxxx>; Colin Ian King <colin.king@xxxxxxxxxxxxx>; Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>; moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM... <alsa-devel@xxxxxxxxxxxxxxxx>; open list <linux-kernel@xxxxxxxxxxxxxxx>
Subject: Re: [PATCH] ASoC: amd :High hw_level while simultaneous capture

On Tue, May 05, 2020 at 05:10:20PM +0530, Akshu Agrawal wrote:

> Simultaneous capture on dmic and headset mic is having issue with high
> hw_level being reported.

> Issue Can be reproduced by:
> arecord -D hw:2,0 -f dat -d 60 /tmp/test0 & arecord -D hw:2,2 -f dat
> -d 60 /tmp/test1 & cat /proc/asound/card2/pcm?c/sub0/status

What is a "high hw_level" and how does this patch address it? As far as I can see this patch reorders some of the initialzation but it's not entirely obvious what the issue was or how this fixes it.

Actual issue is :
When we open one capture stream on one instance lets say I2S_SP and then once again if we open other capture on other instance lets say I2S_BT while first capture is in progress and when we try to read the status of both running instances by below command cat /proc/asound/card2/pcm?c/sub0/status
we observe that avail_max is being doubled on first opened capture(I2S_SP in the example).

This is because our previous implementation was like when any instance is opened it gets initialized in dma_open irrespective of on what instance it called open.
For example:
First I2S_SP called opened it initializes both SP/BT capture streams irrespective of on which instance the stream opened.next time I2S_BT called opened and it initializes both SP/BT this corrupts the behaviour .

So with this patch the stream gets initialized only on specific instance when ever it gets opened calls hw_params.

This rectifies the issue.

Thanks,
Vishnu