[v7,09/33] ASoC: qdsp6: q6afe: Increase APR timeout

Message ID 20230921214843.18450-10-quic_wcheng@quicinc.com
State New
Headers
Series Introduce QC USB SND audio offloading support |

Commit Message

Wesley Cheng Sept. 21, 2023, 9:48 p.m. UTC
  For USB offloading situations, the AFE port start command will result in a
QMI handshake between the Q6DSP and the main processor.  Depending on if
the USB bus is suspended, this routine would require more time to complete,
as resuming the USB bus has some overhead associated with it.  Increase the
timeout to 3s to allow for sufficient time for the USB QMI stream enable
handshake to complete.

Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
---
 sound/soc/qcom/qdsp6/q6afe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Mark Brown Sept. 27, 2023, 2:50 p.m. UTC | #1
On Thu, Sep 21, 2023 at 02:48:19PM -0700, Wesley Cheng wrote:
> For USB offloading situations, the AFE port start command will result in a
> QMI handshake between the Q6DSP and the main processor.  Depending on if
> the USB bus is suspended, this routine would require more time to complete,
> as resuming the USB bus has some overhead associated with it.  Increase the
> timeout to 3s to allow for sufficient time for the USB QMI stream enable
> handshake to complete.

...

> -#define TIMEOUT_MS 1000
> +#define TIMEOUT_MS 3000

That seems worryingly large but if it's what the hardware/firmware needs
I guess there's nothing doing - even the 1s that's being replaced would
be nasty if we ever actually hit it.
  
Wesley Cheng Sept. 27, 2023, 8:01 p.m. UTC | #2
Hi Mark,

On 9/27/2023 7:50 AM, Mark Brown wrote:
> On Thu, Sep 21, 2023 at 02:48:19PM -0700, Wesley Cheng wrote:
>> For USB offloading situations, the AFE port start command will result in a
>> QMI handshake between the Q6DSP and the main processor.  Depending on if
>> the USB bus is suspended, this routine would require more time to complete,
>> as resuming the USB bus has some overhead associated with it.  Increase the
>> timeout to 3s to allow for sufficient time for the USB QMI stream enable
>> handshake to complete.
> 
> ...
> 
>> -#define TIMEOUT_MS 1000
>> +#define TIMEOUT_MS 3000
> 
> That seems worryingly large but if it's what the hardware/firmware needs
> I guess there's nothing doing - even the 1s that's being replaced would
> be nasty if we ever actually hit it.

I may have gone overkill with the delay, but when I measured the 
duration of the AFE start command it took ~1.5-2s.  It has to also 
account for the overhead within handling the USB QMI request in the 
qc_audio_offload driver.

Thanks
Wesley Cheng
  

Patch

diff --git a/sound/soc/qcom/qdsp6/q6afe.c b/sound/soc/qcom/qdsp6/q6afe.c
index f49c69472b5c..72c4e6fe20c4 100644
--- a/sound/soc/qcom/qdsp6/q6afe.c
+++ b/sound/soc/qcom/qdsp6/q6afe.c
@@ -365,7 +365,7 @@ 
 #define AFE_API_VERSION_SLOT_MAPPING_CONFIG	1
 #define AFE_API_VERSION_CODEC_DMA_CONFIG	1
 
-#define TIMEOUT_MS 1000
+#define TIMEOUT_MS 3000
 #define AFE_CMD_RESP_AVAIL	0
 #define AFE_CMD_RESP_NONE	1
 #define AFE_CLK_TOKEN		1024